Chromium Code Reviews| 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 3e6d87222f3672c024501be00ddaee67cc82e5f7..c523f254de3f82dab8da2eced8d49910cea221c9 100644 |
| --- a/chrome/browser/profiles/off_the_record_profile_impl.cc |
| +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc |
| @@ -142,7 +142,7 @@ void OffTheRecordProfileImpl::Init() { |
| GetRequestContext(); |
| #endif // defined(OS_CHROMEOS) |
| - InitHostZoomMap(); |
| + TrackZoomLevelsFromParent(); |
| #if defined(ENABLE_PLUGINS) |
| ChromePluginServiceFilter::GetInstance()->RegisterResourceContext( |
| @@ -198,15 +198,20 @@ void OffTheRecordProfileImpl::InitIoData() { |
| io_data_.reset(new OffTheRecordProfileIOData::Handle(this)); |
| } |
| -void OffTheRecordProfileImpl::InitHostZoomMap() { |
| +void OffTheRecordProfileImpl::TrackZoomLevelsFromParent() { |
| + DCHECK_NE(profile_->GetProfileType(), INCOGNITO_PROFILE); |
|
Bernhard Bauer
2014/11/12 10:39:20
Put the expected (well, non-expected here) value f
wjmaclean
2014/11/12 15:12:55
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. |
| + track_zoom_subscription_ = parent_host_zoom_map->AddZoomLevelChangedCallback( |
| + base::Bind(&OffTheRecordProfileImpl::OnParentZoomLevelChanged, |
| base::Unretained(this))); |
| } |
| @@ -227,6 +232,12 @@ base::FilePath OffTheRecordProfileImpl::GetPath() const { |
| return profile_->GetPath(); |
| } |
| +scoped_ptr<content::ZoomLevelDelegate> |
| +OffTheRecordProfileImpl::CreateZoomLevelDelegate( |
| + const base::FilePath& partition_path) { |
| + return nullptr; |
| +} |
| + |
| scoped_refptr<base::SequencedTaskRunner> |
| OffTheRecordProfileImpl::GetIOTaskRunner() { |
| return profile_->GetIOTaskRunner(); |
| @@ -513,7 +524,7 @@ Profile* Profile::CreateOffTheRecordProfile() { |
| return profile; |
| } |
| -void OffTheRecordProfileImpl::OnZoomLevelChanged( |
| +void OffTheRecordProfileImpl::OnParentZoomLevelChanged( |
| const HostZoomMap::ZoomLevelChange& change) { |
| HostZoomMap* host_zoom_map = HostZoomMap::GetDefaultForBrowserContext(this); |
| switch (change.mode) { |