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

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

Issue 2354613002: [Sync] Fix namespaces for the browser_sync component. (Closed)
Patch Set: Address comments. Created 4 years, 3 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 base::Bind(&BrowserOptionsHandler::OnDefaultBrowserWorkerFinished, 198 base::Bind(&BrowserOptionsHandler::OnDefaultBrowserWorkerFinished,
199 weak_ptr_factory_.GetWeakPtr())); 199 weak_ptr_factory_.GetWeakPtr()));
200 #endif // !defined(OS_CHROMEOS) 200 #endif // !defined(OS_CHROMEOS)
201 201
202 #if defined(ENABLE_SERVICE_DISCOVERY) 202 #if defined(ENABLE_SERVICE_DISCOVERY)
203 cloud_print_mdns_ui_enabled_ = true; 203 cloud_print_mdns_ui_enabled_ = true;
204 #endif // defined(ENABLE_SERVICE_DISCOVERY) 204 #endif // defined(ENABLE_SERVICE_DISCOVERY)
205 } 205 }
206 206
207 BrowserOptionsHandler::~BrowserOptionsHandler() { 207 BrowserOptionsHandler::~BrowserOptionsHandler() {
208 ProfileSyncService* sync_service(ProfileSyncServiceFactory:: 208 browser_sync::ProfileSyncService* sync_service(
209 GetInstance()->GetForProfile(Profile::FromWebUI(web_ui()))); 209 ProfileSyncServiceFactory::GetInstance()->GetForProfile(
210 Profile::FromWebUI(web_ui())));
210 if (sync_service) 211 if (sync_service)
211 sync_service->RemoveObserver(this); 212 sync_service->RemoveObserver(this);
212 213
213 if (template_url_service_) 214 if (template_url_service_)
214 template_url_service_->RemoveObserver(this); 215 template_url_service_->RemoveObserver(this);
215 // There may be pending file dialogs, we need to tell them that we've gone 216 // There may be pending file dialogs, we need to tell them that we've gone
216 // away so they don't try and call back to us. 217 // away so they don't try and call back to us.
217 if (select_folder_dialog_.get()) 218 if (select_folder_dialog_.get())
218 select_folder_dialog_->ListenerDestroyed(); 219 select_folder_dialog_->ListenerDestroyed();
219 220
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 base::Bind(&BrowserOptionsHandler::SetupPageZoomSelector, 947 base::Bind(&BrowserOptionsHandler::SetupPageZoomSelector,
947 base::Unretained(this))); 948 base::Unretained(this)));
948 } 949 }
949 950
950 g_browser_process->policy_service()->AddObserver( 951 g_browser_process->policy_service()->AddObserver(
951 policy::POLICY_DOMAIN_CHROME, this); 952 policy::POLICY_DOMAIN_CHROME, this);
952 953
953 g_browser_process->profile_manager()-> 954 g_browser_process->profile_manager()->
954 GetProfileAttributesStorage().AddObserver(this); 955 GetProfileAttributesStorage().AddObserver(this);
955 956
956 ProfileSyncService* sync_service( 957 browser_sync::ProfileSyncService* sync_service(
957 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile)); 958 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile));
958 // TODO(blundell): Use a ScopedObserver to observe the PSS so that cleanup on 959 // TODO(blundell): Use a ScopedObserver to observe the PSS so that cleanup on
959 // destruction is automatic. 960 // destruction is automatic.
960 if (sync_service) 961 if (sync_service)
961 sync_service->AddObserver(this); 962 sync_service->AddObserver(this);
962 963
963 SigninManagerBase* signin_manager( 964 SigninManagerBase* signin_manager(
964 SigninManagerFactory::GetInstance()->GetForProfile(profile)); 965 SigninManagerFactory::GetInstance()->GetForProfile(profile));
965 if (signin_manager) 966 if (signin_manager)
966 signin_observer_.Add(signin_manager); 967 signin_observer_.Add(signin_manager);
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 sync_status->SetBoolean("supervisedUser", profile->IsSupervised()); 1532 sync_status->SetBoolean("supervisedUser", profile->IsSupervised());
1532 sync_status->SetBoolean("childUser", profile->IsChild()); 1533 sync_status->SetBoolean("childUser", profile->IsChild());
1533 1534
1534 bool signout_prohibited = false; 1535 bool signout_prohibited = false;
1535 #if !defined(OS_CHROMEOS) 1536 #if !defined(OS_CHROMEOS)
1536 // Signout is not allowed if the user has policy (crbug.com/172204). 1537 // Signout is not allowed if the user has policy (crbug.com/172204).
1537 signout_prohibited = 1538 signout_prohibited =
1538 SigninManagerFactory::GetForProfile(profile)->IsSignoutProhibited(); 1539 SigninManagerFactory::GetForProfile(profile)->IsSignoutProhibited();
1539 #endif 1540 #endif
1540 1541
1541 ProfileSyncService* service = 1542 browser_sync::ProfileSyncService* service =
1542 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); 1543 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
1543 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile); 1544 SigninManagerBase* signin = SigninManagerFactory::GetForProfile(profile);
1544 DCHECK(signin); 1545 DCHECK(signin);
1545 sync_status->SetBoolean("signoutAllowed", !signout_prohibited); 1546 sync_status->SetBoolean("signoutAllowed", !signout_prohibited);
1546 sync_status->SetBoolean("signinAllowed", signin->IsSigninAllowed()); 1547 sync_status->SetBoolean("signinAllowed", signin->IsSigninAllowed());
1547 sync_status->SetBoolean("syncSystemEnabled", (service != NULL)); 1548 sync_status->SetBoolean("syncSystemEnabled", (service != NULL));
1548 sync_status->SetBoolean("setupCompleted", 1549 sync_status->SetBoolean("setupCompleted",
1549 service && service->IsFirstSetupComplete()); 1550 service && service->IsFirstSetupComplete());
1550 sync_status->SetBoolean("setupInProgress", 1551 sync_status->SetBoolean("setupInProgress",
1551 service && !service->IsManaged() && service->IsFirstSetupInProgress()); 1552 service && !service->IsManaged() && service->IsFirstSetupInProgress());
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
2233 2234
2234 bool BrowserOptionsHandler::IsDeviceOwnerProfile() { 2235 bool BrowserOptionsHandler::IsDeviceOwnerProfile() {
2235 #if defined(OS_CHROMEOS) 2236 #if defined(OS_CHROMEOS)
2236 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui())); 2237 return chromeos::ProfileHelper::IsOwnerProfile(Profile::FromWebUI(web_ui()));
2237 #else 2238 #else
2238 return true; 2239 return true;
2239 #endif 2240 #endif
2240 } 2241 }
2241 2242
2242 } // namespace options 2243 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc ('k') | chrome/browser/ui/webui/options/clear_browser_data_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698