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

Side by Side Diff: chrome/browser/ui/browser.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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_command_controller.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 if (window() && window()->GetLocationBar()) 1909 if (window() && window()->GetLocationBar())
1910 window()->GetLocationBar()->UpdatePageActions(); 1910 window()->GetLocationBar()->UpdatePageActions();
1911 break; 1911 break;
1912 1912
1913 #if defined(ENABLE_THEMES) 1913 #if defined(ENABLE_THEMES)
1914 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: 1914 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED:
1915 window()->UserChangedTheme(); 1915 window()->UserChangedTheme();
1916 break; 1916 break;
1917 #endif 1917 #endif
1918 1918
1919 case chrome::NOTIFICATION_PREF_CHANGED: {
1920 const std::string& pref_name =
1921 *content::Details<std::string>(details).ptr();
1922 if (pref_name == prefs::kDevToolsDisabled) {
1923 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled))
1924 content::DevToolsManager::GetInstance()->CloseAllClientHosts();
1925 } else if (pref_name == prefs::kShowBookmarkBar) {
1926 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE);
1927 } else if (pref_name == prefs::kHomePage) {
1928 PrefService* pref_service = content::Source<PrefService>(source).ptr();
1929 MarkHomePageAsChanged(pref_service);
1930 } else {
1931 NOTREACHED();
1932 }
1933 break;
1934 }
1935
1936 case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: { 1919 case chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED: {
1937 WebContents* web_contents = content::Source<WebContents>(source).ptr(); 1920 WebContents* web_contents = content::Source<WebContents>(source).ptr();
1938 if (web_contents == chrome::GetActiveWebContents(this)) { 1921 if (web_contents == chrome::GetActiveWebContents(this)) {
1939 LocationBar* location_bar = window()->GetLocationBar(); 1922 LocationBar* location_bar = window()->GetLocationBar();
1940 if (location_bar) 1923 if (location_bar)
1941 location_bar->UpdateContentSettingsIcons(); 1924 location_bar->UpdateContentSettingsIcons();
1942 } 1925 }
1943 break; 1926 break;
1944 } 1927 }
1945 1928
1946 case content::NOTIFICATION_INTERSTITIAL_ATTACHED: 1929 case content::NOTIFICATION_INTERSTITIAL_ATTACHED:
1947 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); 1930 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
1948 break; 1931 break;
1949 1932
1950 case content::NOTIFICATION_INTERSTITIAL_DETACHED: 1933 case content::NOTIFICATION_INTERSTITIAL_DETACHED:
1951 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); 1934 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
1952 break; 1935 break;
1953 1936
1954 default: 1937 default:
1955 NOTREACHED() << "Got a notification we didn't register for."; 1938 NOTREACHED() << "Got a notification we didn't register for.";
1956 } 1939 }
1957 } 1940 }
1958 1941
1942 void Browser::OnPreferenceChanged(PrefServiceBase* service,
1943 const std::string& pref_name) {
1944 if (pref_name == prefs::kDevToolsDisabled) {
1945 if (profile_->GetPrefs()->GetBoolean(prefs::kDevToolsDisabled))
1946 content::DevToolsManager::GetInstance()->CloseAllClientHosts();
1947 } else if (pref_name == prefs::kShowBookmarkBar) {
1948 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_PREF_CHANGE);
1949 } else if (pref_name == prefs::kHomePage) {
1950 MarkHomePageAsChanged(static_cast<PrefService*>(service));
1951 } else {
1952 NOTREACHED();
1953 }
1954 }
1955
1959 void Browser::ModeChanged(const chrome::search::Mode& old_mode, 1956 void Browser::ModeChanged(const chrome::search::Mode& old_mode,
1960 const chrome::search::Mode& new_mode) { 1957 const chrome::search::Mode& new_mode) {
1961 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); 1958 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
1962 } 1959 }
1963 1960
1964 /////////////////////////////////////////////////////////////////////////////// 1961 ///////////////////////////////////////////////////////////////////////////////
1965 // Browser, Command and state updating (private): 1962 // Browser, Command and state updating (private):
1966 1963
1967 void Browser::MarkHomePageAsChanged(PrefService* pref_service) { 1964 void Browser::MarkHomePageAsChanged(PrefService* pref_service) {
1968 pref_service->SetBoolean(prefs::kHomePageChanged, true); 1965 pref_service->SetBoolean(prefs::kHomePageChanged, true);
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
2351 if (contents && !allow_js_access) { 2348 if (contents && !allow_js_access) {
2352 contents->web_contents()->GetController().LoadURL( 2349 contents->web_contents()->GetController().LoadURL(
2353 target_url, 2350 target_url,
2354 content::Referrer(), 2351 content::Referrer(),
2355 content::PAGE_TRANSITION_LINK, 2352 content::PAGE_TRANSITION_LINK,
2356 std::string()); // No extra headers. 2353 std::string()); // No extra headers.
2357 } 2354 }
2358 2355
2359 return contents != NULL; 2356 return contents != NULL;
2360 } 2357 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.h ('k') | chrome/browser/ui/browser_command_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698