| Index: chrome/browser/cocoa/clear_browsing_data_controller.mm
|
| ===================================================================
|
| --- chrome/browser/cocoa/clear_browsing_data_controller.mm (revision 62949)
|
| +++ chrome/browser/cocoa/clear_browsing_data_controller.mm (working copy)
|
| @@ -121,19 +121,10 @@
|
| pathForResource:@"ClearBrowsingData"
|
| ofType:@"nib"];
|
| if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
|
| + profile_ = profile;
|
| observer_.reset(new ClearBrowsingObserver(self));
|
| -
|
| - // Always show preferences for the original profile. Most state when off
|
| - // the record comes from the original profile, but we explicitly use
|
| - // the original profile to avoid potential problems.
|
| - profile_ = profile->GetOriginalProfile();
|
| - sync_service_ = profile_->GetProfileSyncService();
|
| -
|
| - if (sync_service_) {
|
| - sync_service_->ResetClearServerDataState();
|
| - sync_service_->AddObserver(observer_.get());
|
| - }
|
| -
|
| + profile_->GetProfileSyncService()->ResetClearServerDataState();
|
| + profile_->GetProfileSyncService()->AddObserver(observer_.get());
|
| [self initFromPrefs];
|
| }
|
| return self;
|
| @@ -146,8 +137,7 @@
|
| // while clearing is in progress as the dialog is modal and not closeable).
|
| remover_->RemoveObserver(observer_.get());
|
| }
|
| - if (sync_service_)
|
| - sync_service_->RemoveObserver(observer_.get());
|
| + profile_->GetProfileSyncService()->RemoveObserver(observer_.get());
|
| [self setClearingStatus:nil];
|
|
|
| [super dealloc];
|
| @@ -351,13 +341,13 @@
|
| // the syncer syncs and resets itself before the user tries pressing the Clear
|
| // button in this dialog again. TODO(raz) Confirm whether we have an issue
|
| // here
|
| - if (sync_service_->HasSyncSetupCompleted()) {
|
| + if (profile_->GetProfileSyncService()->HasSyncSetupCompleted()) {
|
| bool clear = platform_util::SimpleYesNoBox(
|
| nil,
|
| l10n_util::GetStringUTF16(IDS_CONFIRM_CLEAR_TITLE),
|
| l10n_util::GetStringUTF16(IDS_CONFIRM_CLEAR_DESCRIPTION));
|
| if (clear) {
|
| - sync_service_->ClearServerData();
|
| + profile_->GetProfileSyncService()->ClearServerData();
|
| [self syncStateChanged];
|
| }
|
| }
|
| @@ -367,8 +357,8 @@
|
| bool deleteInProgress = false;
|
|
|
| ProfileSyncService::ClearServerDataState clearState =
|
| - sync_service_->GetClearServerDataState();
|
| - sync_service_->ResetClearServerDataState();
|
| + profile_->GetProfileSyncService()->GetClearServerDataState();
|
| + profile_->GetProfileSyncService()->ResetClearServerDataState();
|
|
|
| switch (clearState) {
|
| case ProfileSyncService::CLEAR_NOT_STARTED:
|
| @@ -397,13 +387,13 @@
|
| [self setIsClearing:deleteInProgress];
|
| }
|
|
|
| -- (BOOL)isSyncVisible {
|
| - return CommandLine::ForCurrentProcess()->HasSwitch(
|
| - switches::kEnableClearServerData);
|
| -}
|
| -
|
| - (BOOL)isSyncEnabled {
|
| - return sync_service_ && sync_service_->HasSyncSetupCompleted();
|
| + BOOL allowClearServerDataUI =
|
| + CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kEnableClearServerData);
|
| +
|
| + return allowClearServerDataUI &&
|
| + profile_->GetProfileSyncService()->HasSyncSetupCompleted();
|
| }
|
|
|
| - (NSFont*)labelFont {
|
|
|