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

Unified Diff: chrome/browser/profiles/off_the_record_profile_impl.cc

Issue 393133002: Migrate HostZoomMap to live in StoragePartition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Perhaps HostZoomLevelContextDeleter was needed after all ... Created 6 years, 1 month 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
Index: chrome/browser/profiles/off_the_record_profile_impl.cc
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc
index 0f83a404bae5cb5c9c4b3f17b2db487dfc1607a9..77c5533848e0ba30370aa8541326f76359c764e5 100644
--- a/chrome/browser/profiles/off_the_record_profile_impl.cc
+++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -143,7 +143,7 @@ void OffTheRecordProfileImpl::Init() {
GetRequestContext();
#endif // defined(OS_CHROMEOS)
- InitHostZoomMap();
+ TrackZoomLevelsFromParent();
#if defined(ENABLE_PLUGINS)
ChromePluginServiceFilter::GetInstance()->RegisterResourceContext(
@@ -199,15 +199,22 @@ void OffTheRecordProfileImpl::InitIoData() {
io_data_.reset(new OffTheRecordProfileIOData::Handle(this));
}
-void OffTheRecordProfileImpl::InitHostZoomMap() {
+void OffTheRecordProfileImpl::TrackZoomLevelsFromParent() {
+ DCHECK(profile_->GetProfileType() != INCOGNITO_PROFILE);
Charlie Reis 2014/11/04 23:43:16 DCHECK_NE
wjmaclean 2014/11/05 21:55:42 Done.
+
+ // Here we only want to use zoom levels stored in the main-context's default
+ // storage partition. We're not interested in zoom levels in special
+ // partitions, e.g. those used by WebViewGuests.
HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this);
HostZoomMap* parent_host_zoom_map =
HostZoomMap::GetDefaultForBrowserContext(profile_);
host_zoom_map->CopyFrom(parent_host_zoom_map);
- // Observe parent's HZM change for propagating change of parent's
- // change to this HZM.
- zoom_subscription_ = parent_host_zoom_map->AddZoomLevelChangedCallback(
- base::Bind(&OffTheRecordProfileImpl::OnZoomLevelChanged,
+ // Observe parent profile's HostZoomMap changes so they can also be applied
+ // to this profile's HostZoomMap.
+ // Important: this function should never be made virtual without moving the
Charlie Reis 2014/11/04 23:43:16 I don't fully understand this comment, but it also
wjmaclean 2014/11/05 21:55:42 Actually, I'm removing it ... it used to apply whe
+ // subscription down to the leaf nodes(s).
Charlie Reis 2014/11/04 23:43:16 nit: node(s) (I think. Node is an unusual term f
wjmaclean 2014/11/05 21:55:42 Acknowledged.
+ track_zoom_subscription_ = parent_host_zoom_map->AddZoomLevelChangedCallback(
+ base::Bind(&OffTheRecordProfileImpl::TrackParentZoomLevelChanged,
base::Unretained(this)));
}
@@ -510,7 +517,7 @@ Profile* Profile::CreateOffTheRecordProfile() {
return profile;
}
-void OffTheRecordProfileImpl::OnZoomLevelChanged(
+void OffTheRecordProfileImpl::TrackParentZoomLevelChanged(
const HostZoomMap::ZoomLevelChange& change) {
HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this);
switch (change.mode) {

Powered by Google App Engine
This is Rietveld 408576698