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

Side by Side Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Use parameter Created 3 years, 10 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
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/webui/options/browser_options_handler.h" 5 #include "chrome/browser/ui/webui/options/browser_options_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 #endif 940 #endif
941 #if defined(OS_CHROMEOS) 941 #if defined(OS_CHROMEOS)
942 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get( 942 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(
943 Profile::FromWebUI(web_ui())); 943 Profile::FromWebUI(web_ui()));
944 if (arc_prefs) 944 if (arc_prefs)
945 arc_prefs->RemoveObserver(this); 945 arc_prefs->RemoveObserver(this);
946 user_manager::UserManager::Get()->RemoveObserver(this); 946 user_manager::UserManager::Get()->RemoveObserver(this);
947 #endif 947 #endif
948 } 948 }
949 949
950 void BrowserOptionsHandler::OnStateChanged() { 950 void BrowserOptionsHandler::OnStateChanged(syncer::SyncService* sync) {
951 UpdateSyncState(); 951 UpdateSyncState();
952 } 952 }
953 953
954 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& account_id, 954 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& account_id,
955 const std::string& username, 955 const std::string& username,
956 const std::string& password) { 956 const std::string& password) {
957 OnStateChanged(); 957 UpdateSyncState();
958 } 958 }
959 959
960 void BrowserOptionsHandler::GoogleSignedOut(const std::string& account_id, 960 void BrowserOptionsHandler::GoogleSignedOut(const std::string& account_id,
961 const std::string& username) { 961 const std::string& username) {
962 OnStateChanged(); 962 UpdateSyncState();
963 } 963 }
964 964
965 void BrowserOptionsHandler::PageLoadStarted() { 965 void BrowserOptionsHandler::PageLoadStarted() {
966 page_initialized_ = false; 966 page_initialized_ = false;
967 } 967 }
968 968
969 void BrowserOptionsHandler::InitializeHandler() { 969 void BrowserOptionsHandler::InitializeHandler() {
970 Profile* profile = Profile::FromWebUI(web_ui()); 970 Profile* profile = Profile::FromWebUI(web_ui());
971 PrefService* prefs = profile->GetPrefs(); 971 PrefService* prefs = profile->GetPrefs();
972 ChromeZoomLevelPrefs* zoom_level_prefs = profile->GetZoomLevelPrefs(); 972 ChromeZoomLevelPrefs* zoom_level_prefs = profile->GetZoomLevelPrefs();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1115 base::Bind(&BrowserOptionsHandler::SetupSafeBrowsingExtendedReporting, 1115 base::Bind(&BrowserOptionsHandler::SetupSafeBrowsingExtendedReporting,
1116 base::Unretained(this))); 1116 base::Unretained(this)));
1117 } 1117 }
1118 1118
1119 void BrowserOptionsHandler::InitializePage() { 1119 void BrowserOptionsHandler::InitializePage() {
1120 page_initialized_ = true; 1120 page_initialized_ = true;
1121 1121
1122 OnTemplateURLServiceChanged(); 1122 OnTemplateURLServiceChanged();
1123 1123
1124 ObserveThemeChanged(); 1124 ObserveThemeChanged();
1125 OnStateChanged(); 1125 UpdateSyncState();
1126 #if !defined(OS_CHROMEOS) 1126 #if !defined(OS_CHROMEOS)
1127 UpdateDefaultBrowserState(); 1127 UpdateDefaultBrowserState();
1128 #endif 1128 #endif
1129 1129
1130 SetupMetricsReportingSettingVisibility(); 1130 SetupMetricsReportingSettingVisibility();
1131 SetupMetricsReportingCheckbox(); 1131 SetupMetricsReportingCheckbox();
1132 SetupNetworkPredictionControl(); 1132 SetupNetworkPredictionControl();
1133 SetupFontSizeSelector(); 1133 SetupFontSizeSelector();
1134 SetupPageZoomSelector(); 1134 SetupPageZoomSelector();
1135 SetupAutoOpenFileTypes(); 1135 SetupAutoOpenFileTypes();
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 // InitializePage() will update the UI at the end of the load). 1367 // InitializePage() will update the UI at the end of the load).
1368 if (!page_initialized_) 1368 if (!page_initialized_)
1369 return; 1369 return;
1370 1370
1371 switch (type) { 1371 switch (type) {
1372 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: 1372 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED:
1373 ObserveThemeChanged(); 1373 ObserveThemeChanged();
1374 break; 1374 break;
1375 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: 1375 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
1376 // Update our sync/signin status display. 1376 // Update our sync/signin status display.
1377 OnStateChanged(); 1377 UpdateSyncState();
1378 break; 1378 break;
1379 default: 1379 default:
1380 NOTREACHED(); 1380 NOTREACHED();
1381 } 1381 }
1382 } 1382 }
1383 1383
1384 void BrowserOptionsHandler::OnProfileAdded(const base::FilePath& profile_path) { 1384 void BrowserOptionsHandler::OnProfileAdded(const base::FilePath& profile_path) {
1385 SendProfilesInfo(); 1385 SendProfilesInfo();
1386 } 1386 }
1387 1387
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 2300
2301 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2301 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2302 #if defined(OS_CHROMEOS) 2302 #if defined(OS_CHROMEOS)
2303 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2303 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2304 #else 2304 #else
2305 return true; 2305 return true;
2306 #endif 2306 #endif
2307 } 2307 }
2308 2308
2309 } // namespace options 2309 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698