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

Unified Diff: chrome/browser/cocoa/preferences_window_controller.mm

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/cocoa/browser_window_controller.mm ('k') | chrome/browser/configuration_policy_pref_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/preferences_window_controller.mm
diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm
index 175835a0412eab1f7aab81f5fe0989d914d2fa33..95a2531f9ba03deba573483f2aa3cfc293331153 100644
--- a/chrome/browser/cocoa/preferences_window_controller.mm
+++ b/chrome/browser/cocoa/preferences_window_controller.mm
@@ -75,6 +75,11 @@ static const wchar_t* kGeneralPolicyConstrainedPrefs[] = {
prefs::kHomePageIsNewTabPage
};
+// Content page preferences that are potentially constrained by policy.
+static const wchar_t* kContentPolicyConstrainedPrefs[] = {
+ prefs::kSyncManaged
+};
+
std::string GetNewTabUIURLString() {
return URLFixerUpper::FixupURL(chrome::kChromeUINewTabURL,
std::string()).possibly_invalid_spec();
@@ -411,6 +416,9 @@ class ManagedPrefsBannerState : public ManagedPrefsBannerBase {
kGeneralPolicyConstrainedPrefs,
arraysize(kGeneralPolicyConstrainedPrefs));
case OPTIONS_PAGE_CONTENT:
+ return new ManagedPrefsBannerState(controller, page, prefs,
+ kContentPolicyConstrainedPrefs,
+ arraysize(kContentPolicyConstrainedPrefs));
break;
case OPTIONS_PAGE_ADVANCED:
break;
@@ -1234,7 +1242,7 @@ const int kDisabledIndex = 1;
- (void)stopSyncAlertDidEnd:(NSAlert*)alert
returnCode:(int)returnCode
contextInfo:(void*)contextInfo {
- DCHECK(syncService_);
+ DCHECK(syncService_ && !syncService_->IsManaged());
if (returnCode == NSAlertFirstButtonReturn) {
syncService_->DisableForUser();
ProfileSyncService::SyncEvent(ProfileSyncService::STOP_FROM_OPTIONS);
@@ -1244,7 +1252,7 @@ const int kDisabledIndex = 1;
// Called when the user clicks the multi-purpose sync button in the
// "Personal Stuff" pane.
- (IBAction)doSyncAction:(id)sender {
- DCHECK(syncService_);
+ DCHECK(syncService_ && !syncService_->IsManaged());
if (syncService_->HasSyncSetupCompleted()) {
// If sync setup has completed that means the sync button was a
// "stop syncing" button. Bring up a confirmation dialog before
@@ -1282,7 +1290,7 @@ const int kDisabledIndex = 1;
}
- (IBAction)doSyncReauthentication:(id)sender {
- DCHECK(syncService_);
+ DCHECK(syncService_ && !syncService_->IsManaged());
syncService_->ShowLoginDialog();
}
@@ -1710,6 +1718,7 @@ const int kDisabledIndex = 1;
string16 statusLabel, linkLabel;
sync_ui_util::MessageType status =
sync_ui_util::GetStatusLabels(syncService_, &statusLabel, &linkLabel);
+ bool managed = syncService_->IsManaged();
[syncButton_ setEnabled:!syncService_->WizardIsVisible()];
NSString* buttonLabel;
@@ -1727,11 +1736,14 @@ const int kDisabledIndex = 1;
IDS_SYNC_START_SYNC_BUTTON_LABEL);
[syncCustomizeButton_ setHidden:true];
}
+ [syncCustomizeButton_ setEnabled:!managed];
[syncButton_ setTitle:buttonLabel];
+ [syncButton_ setEnabled:!managed];
[syncStatus_ setStringValue:base::SysUTF16ToNSString(statusLabel)];
[syncLink_ setHidden:linkLabel.empty()];
[syncLink_ setTitle:base::SysUTF16ToNSString(linkLabel)];
+ [syncLink_ setEnabled:!managed];
NSButtonCell* syncLinkCell = static_cast<NSButtonCell*>([syncLink_ cell]);
if (!syncStatusNoErrorBackgroundColor_) {
« no previous file with comments | « chrome/browser/cocoa/browser_window_controller.mm ('k') | chrome/browser/configuration_policy_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698