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

Unified Diff: chrome/browser/host_zoom_map.cc

Issue 2079010: Forget zoom levels set/changed in incognito mode when exiting incognito. Thi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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 | « no previous file | chrome/browser/profile.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/host_zoom_map.cc
===================================================================
--- chrome/browser/host_zoom_map.cc (revision 47531)
+++ chrome/browser/host_zoom_map.cc (working copy)
@@ -22,7 +22,11 @@
Load();
registrar_.Add(this, NotificationType::PROFILE_DESTROYED,
Source<Profile>(profile));
- profile_->GetPrefs()->AddPrefObserver(prefs::kPerHostZoomLevels, this);
+ // Don't observe pref changes (e.g. from sync) in Incognito; once we create
+ // the incognito window it should have no further connection to the main
+ // profile/prefs.
+ if (!profile_->IsOffTheRecord())
+ profile_->GetPrefs()->AddPrefObserver(prefs::kPerHostZoomLevels, this);
}
void HostZoomMap::Load() {
@@ -74,6 +78,11 @@
host_zoom_levels_[host] = level;
}
+ // If we're in incognito mode, don't persist changes to the prefs. We'll keep
+ // them in memory only so they will be forgotten on exiting incognito.
+ if (profile_->IsOffTheRecord())
+ return;
+
updating_preferences_ = true;
{
ScopedPrefUpdate update(profile_->GetPrefs(), prefs::kPerHostZoomLevels);
@@ -113,7 +122,8 @@
registrar_.Remove(this,
NotificationType::PROFILE_DESTROYED,
Source<Profile>(profile_));
- profile_->GetPrefs()->RemovePrefObserver(prefs::kPerHostZoomLevels, this);
+ if (!profile_->IsOffTheRecord())
+ profile_->GetPrefs()->RemovePrefObserver(prefs::kPerHostZoomLevels, this);
profile_ = NULL;
}
« no previous file with comments | « no previous file | chrome/browser/profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698