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

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: Chromeos fix 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 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 #endif 955 #endif
956 #if defined(OS_CHROMEOS) 956 #if defined(OS_CHROMEOS)
957 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get( 957 ArcAppListPrefs* arc_prefs = ArcAppListPrefs::Get(
958 Profile::FromWebUI(web_ui())); 958 Profile::FromWebUI(web_ui()));
959 if (arc_prefs) 959 if (arc_prefs)
960 arc_prefs->RemoveObserver(this); 960 arc_prefs->RemoveObserver(this);
961 user_manager::UserManager::Get()->RemoveObserver(this); 961 user_manager::UserManager::Get()->RemoveObserver(this);
962 #endif 962 #endif
963 } 963 }
964 964
965 void BrowserOptionsHandler::OnStateChanged() { 965 void BrowserOptionsHandler::OnStateChanged(syncer::SyncService* sync) {
966 UpdateSyncState(); 966 UpdateSyncState();
967 } 967 }
968 968
969 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& account_id, 969 void BrowserOptionsHandler::GoogleSigninSucceeded(const std::string& account_id,
970 const std::string& username, 970 const std::string& username,
971 const std::string& password) { 971 const std::string& password) {
972 OnStateChanged(); 972 UpdateSyncState();
973 } 973 }
974 974
975 void BrowserOptionsHandler::GoogleSignedOut(const std::string& account_id, 975 void BrowserOptionsHandler::GoogleSignedOut(const std::string& account_id,
976 const std::string& username) { 976 const std::string& username) {
977 OnStateChanged(); 977 UpdateSyncState();
978 } 978 }
979 979
980 void BrowserOptionsHandler::PageLoadStarted() { 980 void BrowserOptionsHandler::PageLoadStarted() {
981 page_initialized_ = false; 981 page_initialized_ = false;
982 } 982 }
983 983
984 void BrowserOptionsHandler::InitializeHandler() { 984 void BrowserOptionsHandler::InitializeHandler() {
985 Profile* profile = Profile::FromWebUI(web_ui()); 985 Profile* profile = Profile::FromWebUI(web_ui());
986 PrefService* prefs = profile->GetPrefs(); 986 PrefService* prefs = profile->GetPrefs();
987 ChromeZoomLevelPrefs* zoom_level_prefs = profile->GetZoomLevelPrefs(); 987 ChromeZoomLevelPrefs* zoom_level_prefs = profile->GetZoomLevelPrefs();
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 base::Bind(&BrowserOptionsHandler::SetupSafeBrowsingExtendedReporting, 1130 base::Bind(&BrowserOptionsHandler::SetupSafeBrowsingExtendedReporting,
1131 base::Unretained(this))); 1131 base::Unretained(this)));
1132 } 1132 }
1133 1133
1134 void BrowserOptionsHandler::InitializePage() { 1134 void BrowserOptionsHandler::InitializePage() {
1135 page_initialized_ = true; 1135 page_initialized_ = true;
1136 1136
1137 OnTemplateURLServiceChanged(); 1137 OnTemplateURLServiceChanged();
1138 1138
1139 ObserveThemeChanged(); 1139 ObserveThemeChanged();
1140 OnStateChanged(); 1140 UpdateSyncState();
1141 #if !defined(OS_CHROMEOS) 1141 #if !defined(OS_CHROMEOS)
1142 UpdateDefaultBrowserState(); 1142 UpdateDefaultBrowserState();
1143 #endif 1143 #endif
1144 1144
1145 SetupMetricsReportingSettingVisibility(); 1145 SetupMetricsReportingSettingVisibility();
1146 SetupMetricsReportingCheckbox(); 1146 SetupMetricsReportingCheckbox();
1147 SetupNetworkPredictionControl(); 1147 SetupNetworkPredictionControl();
1148 SetupFontSizeSelector(); 1148 SetupFontSizeSelector();
1149 SetupPageZoomSelector(); 1149 SetupPageZoomSelector();
1150 SetupAutoOpenFileTypes(); 1150 SetupAutoOpenFileTypes();
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 // InitializePage() will update the UI at the end of the load). 1382 // InitializePage() will update the UI at the end of the load).
1383 if (!page_initialized_) 1383 if (!page_initialized_)
1384 return; 1384 return;
1385 1385
1386 switch (type) { 1386 switch (type) {
1387 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED: 1387 case chrome::NOTIFICATION_BROWSER_THEME_CHANGED:
1388 ObserveThemeChanged(); 1388 ObserveThemeChanged();
1389 break; 1389 break;
1390 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED: 1390 case chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED:
1391 // Update our sync/signin status display. 1391 // Update our sync/signin status display.
1392 OnStateChanged(); 1392 UpdateSyncState();
1393 break; 1393 break;
1394 default: 1394 default:
1395 NOTREACHED(); 1395 NOTREACHED();
1396 } 1396 }
1397 } 1397 }
1398 1398
1399 void BrowserOptionsHandler::OnProfileAdded(const base::FilePath& profile_path) { 1399 void BrowserOptionsHandler::OnProfileAdded(const base::FilePath& profile_path) {
1400 SendProfilesInfo(); 1400 SendProfilesInfo();
1401 } 1401 }
1402 1402
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 2315
2316 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2316 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2317 #if defined(OS_CHROMEOS) 2317 #if defined(OS_CHROMEOS)
2318 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2318 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2319 #else 2319 #else
2320 return true; 2320 return true;
2321 #endif 2321 #endif
2322 } 2322 }
2323 2323
2324 } // namespace options 2324 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698