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

Unified Diff: chrome/browser/ui/browser_command_controller.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_command_controller.h ('k') | chrome/browser/ui/browser_instant_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_command_controller.cc
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index ae7c6dbfbacebbdd1680895fdf84cf6ec68d7dd4..b871deb3874f97ad1927152c3b22d5e45d60178c 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -664,29 +664,6 @@ void BrowserCommandController::Observe(
const content::NotificationSource& source,
const content::NotificationDetails& details) {
switch (type) {
- case NOTIFICATION_PREF_CHANGED: {
- const std::string& pref_name =
- *content::Details<std::string>(details).ptr();
- if (pref_name == prefs::kPrintingEnabled) {
- UpdatePrintingState();
- } else if (pref_name == prefs::kIncognitoModeAvailability) {
- UpdateCommandsForIncognitoAvailability();
- } else if (pref_name == prefs::kDevToolsDisabled) {
- UpdateCommandsForDevTools();
- } else if (pref_name == prefs::kEditBookmarksEnabled) {
- UpdateCommandsForBookmarkEditing();
- } else if (pref_name == prefs::kShowBookmarkBar) {
- UpdateCommandsForBookmarkBar();
- } else if (pref_name == prefs::kAllowFileSelectionDialogs) {
- UpdateSaveAsState();
- UpdateOpenFileState();
- } else if (pref_name == prefs::kInManagedMode) {
- UpdateCommandsForMultipleProfiles();
- } else {
- NOTREACHED();
- }
- break;
- }
case content::NOTIFICATION_INTERSTITIAL_ATTACHED:
UpdateCommandsForTabState();
break;
@@ -701,6 +678,32 @@ void BrowserCommandController::Observe(
}
////////////////////////////////////////////////////////////////////////////////
+// PrefObserver implementation:
+
+void BrowserCommandController::OnPreferenceChanged(
+ PrefServiceBase* service,
+ const std::string& pref_name) {
+ if (pref_name == prefs::kPrintingEnabled) {
+ UpdatePrintingState();
+ } else if (pref_name == prefs::kIncognitoModeAvailability) {
+ UpdateCommandsForIncognitoAvailability();
+ } else if (pref_name == prefs::kDevToolsDisabled) {
+ UpdateCommandsForDevTools();
+ } else if (pref_name == prefs::kEditBookmarksEnabled) {
+ UpdateCommandsForBookmarkEditing();
+ } else if (pref_name == prefs::kShowBookmarkBar) {
+ UpdateCommandsForBookmarkBar();
+ } else if (pref_name == prefs::kAllowFileSelectionDialogs) {
+ UpdateSaveAsState();
+ UpdateOpenFileState();
+ } else if (pref_name == prefs::kInManagedMode) {
+ UpdateCommandsForMultipleProfiles();
+ } else {
+ NOTREACHED();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
// BrowserCommandController, TabStripModelObserver implementation:
void BrowserCommandController::TabInsertedAt(TabContents* contents,
« no previous file with comments | « chrome/browser/ui/browser_command_controller.h ('k') | chrome/browser/ui/browser_instant_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698