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

Unified Diff: chrome/browser/dom_ui/new_tab_page_sync_handler.cc

Issue 2905003: Implement support for disabling sync through configuration management. (Closed)
Patch Set: Fix PrefsControllerTest on MAC. Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/configuration_policy_store.h ('k') | chrome/browser/dom_ui/new_tab_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/new_tab_page_sync_handler.cc
diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
index f711709c89c918fc51eeeb42c19a0a293a3a9fe1..b7349fdeec52fc0f5a62a831482f643c3365e416 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -98,6 +98,7 @@ NewTabPageSyncHandler::MessageType
DOMMessageHandler* NewTabPageSyncHandler::Attach(DOMUI* dom_ui) {
sync_service_ = dom_ui->GetProfile()->GetProfileSyncService();
DCHECK(sync_service_); // This shouldn't get called by an incognito NTP.
+ DCHECK(!sync_service_->IsManaged()); // And neither if sync is managed.
sync_service_->AddObserver(this);
return DOMMessageHandler::Attach(dom_ui);
}
@@ -121,8 +122,8 @@ void NewTabPageSyncHandler::HideSyncStatusSection() {
void NewTabPageSyncHandler::BuildAndSendSyncStatus() {
DCHECK(!waiting_for_initial_page_load_);
- // Hide the sync status section if sync is disabled entirely.
- if (!sync_service_) {
+ // Hide the sync status section if sync is managed or disabled entirely.
+ if (!sync_service_ || sync_service_->IsManaged()) {
HideSyncStatusSection();
return;
}
@@ -149,6 +150,8 @@ void NewTabPageSyncHandler::BuildAndSendSyncStatus() {
void NewTabPageSyncHandler::HandleSyncLinkClicked(const Value* value) {
DCHECK(!waiting_for_initial_page_load_);
DCHECK(sync_service_);
+ if (!sync_service_->IsSyncEnabled())
+ return;
if (sync_service_->HasSyncSetupCompleted()) {
if (sync_service_->GetAuthError().state() ==
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS ||
« no previous file with comments | « chrome/browser/configuration_policy_store.h ('k') | chrome/browser/dom_ui/new_tab_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698