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

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

Issue 3674005: [Mac] Update Clear Browsing dialog for proper functioning from incognito wind... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 2 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/clear_browsing_data_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/clear_browsing_data_controller.mm
===================================================================
--- chrome/browser/cocoa/clear_browsing_data_controller.mm (revision 62169)
+++ chrome/browser/cocoa/clear_browsing_data_controller.mm (working copy)
@@ -121,10 +121,19 @@
pathForResource:@"ClearBrowsingData"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
- profile_ = profile;
observer_.reset(new ClearBrowsingObserver(self));
- profile_->GetProfileSyncService()->ResetClearServerDataState();
- profile_->GetProfileSyncService()->AddObserver(observer_.get());
+
+ // 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());
+ }
+
[self initFromPrefs];
}
return self;
@@ -137,7 +146,8 @@
// while clearing is in progress as the dialog is modal and not closeable).
remover_->RemoveObserver(observer_.get());
}
- profile_->GetProfileSyncService()->RemoveObserver(observer_.get());
+ if (sync_service_)
+ sync_service_->RemoveObserver(observer_.get());
[self setClearingStatus:nil];
[super dealloc];
@@ -341,13 +351,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 (profile_->GetProfileSyncService()->HasSyncSetupCompleted()) {
+ if (sync_service_->HasSyncSetupCompleted()) {
bool clear = platform_util::SimpleYesNoBox(
nil,
l10n_util::GetStringUTF16(IDS_CONFIRM_CLEAR_TITLE),
l10n_util::GetStringUTF16(IDS_CONFIRM_CLEAR_DESCRIPTION));
if (clear) {
- profile_->GetProfileSyncService()->ClearServerData();
+ sync_service_->ClearServerData();
[self syncStateChanged];
}
}
@@ -357,8 +367,8 @@
bool deleteInProgress = false;
ProfileSyncService::ClearServerDataState clearState =
- profile_->GetProfileSyncService()->GetClearServerDataState();
- profile_->GetProfileSyncService()->ResetClearServerDataState();
+ sync_service_->GetClearServerDataState();
+ sync_service_->ResetClearServerDataState();
switch (clearState) {
case ProfileSyncService::CLEAR_NOT_STARTED:
@@ -387,13 +397,13 @@
[self setIsClearing:deleteInProgress];
}
+- (BOOL)isSyncVisible {
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableClearServerData);
+}
+
- (BOOL)isSyncEnabled {
- BOOL allowClearServerDataUI =
- CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableClearServerData);
-
- return allowClearServerDataUI &&
- profile_->GetProfileSyncService()->HasSyncSetupCompleted();
+ return sync_service_ && sync_service_->HasSyncSetupCompleted();
}
- (NSFont*)labelFont {
« no previous file with comments | « chrome/browser/cocoa/clear_browsing_data_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698