Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 7129037: Act on the incognito enabled policy change and set the menu accordingly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <windows.h> 9 #include <windows.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 if (local_state) { 253 if (local_state) {
254 local_pref_registrar_.Init(local_state); 254 local_pref_registrar_.Init(local_state);
255 local_pref_registrar_.Add(prefs::kPrintingEnabled, this); 255 local_pref_registrar_.Add(prefs::kPrintingEnabled, this);
256 local_pref_registrar_.Add(prefs::kAllowFileSelectionDialogs, this); 256 local_pref_registrar_.Add(prefs::kAllowFileSelectionDialogs, this);
257 } 257 }
258 258
259 profile_pref_registrar_.Init(profile_->GetPrefs()); 259 profile_pref_registrar_.Init(profile_->GetPrefs());
260 profile_pref_registrar_.Add(prefs::kDevToolsDisabled, this); 260 profile_pref_registrar_.Add(prefs::kDevToolsDisabled, this);
261 profile_pref_registrar_.Add(prefs::kEditBookmarksEnabled, this); 261 profile_pref_registrar_.Add(prefs::kEditBookmarksEnabled, this);
262 profile_pref_registrar_.Add(prefs::kInstantEnabled, this); 262 profile_pref_registrar_.Add(prefs::kInstantEnabled, this);
263 profile_pref_registrar_.Add(prefs::kIncognitoEnabled, this);
263 264
264 InitCommandState(); 265 InitCommandState();
265 BrowserList::AddBrowser(this); 266 BrowserList::AddBrowser(this);
266 267
267 // NOTE: These prefs all need to be explicitly destroyed in the destructor 268 // NOTE: These prefs all need to be explicitly destroyed in the destructor
268 // or you'll get a nasty surprise when you run the incognito tests. 269 // or you'll get a nasty surprise when you run the incognito tests.
269 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector, 270 encoding_auto_detect_.Init(prefs::kWebKitUsesUniversalDetector,
270 profile_->GetPrefs(), NULL); 271 profile_->GetPrefs(), NULL);
271 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this); 272 use_vertical_tabs_.Init(prefs::kUseVerticalTabs, profile_->GetPrefs(), this);
272 use_compact_navigation_bar_.Init(prefs::kUseCompactNavigationBar, 273 use_compact_navigation_bar_.Init(prefs::kUseCompactNavigationBar,
(...skipping 3400 matching lines...) Expand 10 before | Expand all | Expand 10 after
3673 } else if (pref_name == prefs::kInstantEnabled) { 3674 } else if (pref_name == prefs::kInstantEnabled) {
3674 if (!InstantController::IsEnabled(profile())) { 3675 if (!InstantController::IsEnabled(profile())) {
3675 if (instant()) { 3676 if (instant()) {
3676 instant()->DestroyPreviewContents(); 3677 instant()->DestroyPreviewContents();
3677 instant_.reset(); 3678 instant_.reset();
3678 instant_unload_handler_.reset(); 3679 instant_unload_handler_.reset();
3679 } 3680 }
3680 } else { 3681 } else {
3681 CreateInstantIfNecessary(); 3682 CreateInstantIfNecessary();
3682 } 3683 }
3684 } else if (pref_name == prefs::kIncognitoEnabled) {
3685 command_updater_.UpdateCommandEnabled(
3686 IDC_NEW_INCOGNITO_WINDOW,
3687 profile_->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled));
3683 } else if (pref_name == prefs::kDevToolsDisabled) { 3688 } else if (pref_name == prefs::kDevToolsDisabled) {
3684 UpdateCommandsForDevTools(); 3689 UpdateCommandsForDevTools();
3685 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled)) 3690 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled))
3686 g_browser_process->devtools_manager()->CloseAllClientHosts(); 3691 g_browser_process->devtools_manager()->CloseAllClientHosts();
3687 } else if (pref_name == prefs::kEditBookmarksEnabled) { 3692 } else if (pref_name == prefs::kEditBookmarksEnabled) {
3688 UpdateCommandsForBookmarkEditing(); 3693 UpdateCommandsForBookmarkEditing();
3689 } else if (pref_name == prefs::kAllowFileSelectionDialogs) { 3694 } else if (pref_name == prefs::kAllowFileSelectionDialogs) {
3690 UpdateSaveAsState(GetContentRestrictionsForSelectedTab()); 3695 UpdateSaveAsState(GetContentRestrictionsForSelectedTab());
3691 UpdateOpenFileState(); 3696 UpdateOpenFileState();
3692 } else { 3697 } else {
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after
4695 TabContents* current_tab = GetSelectedTabContents(); 4700 TabContents* current_tab = GetSelectedTabContents();
4696 if (current_tab) { 4701 if (current_tab) {
4697 content_restrictions = current_tab->content_restrictions(); 4702 content_restrictions = current_tab->content_restrictions();
4698 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry(); 4703 NavigationEntry* active_entry = current_tab->controller().GetActiveEntry();
4699 // See comment in UpdateCommandsForTabState about why we call url(). 4704 // See comment in UpdateCommandsForTabState about why we call url().
4700 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL())) 4705 if (!SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL()))
4701 content_restrictions |= CONTENT_RESTRICTION_SAVE; 4706 content_restrictions |= CONTENT_RESTRICTION_SAVE;
4702 } 4707 }
4703 return content_restrictions; 4708 return content_restrictions;
4704 } 4709 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698