| Index: content/browser/host_zoom_map_impl.cc
|
| diff --git a/content/browser/host_zoom_map_impl.cc b/content/browser/host_zoom_map_impl.cc
|
| index 942d6f49c61064c6e06e4d6ff73c30e77ad77360..ad7361ba6ebdbf7549de5e4ad457c3342799f9f8 100644
|
| --- a/content/browser/host_zoom_map_impl.cc
|
| +++ b/content/browser/host_zoom_map_impl.cc
|
| @@ -54,9 +54,14 @@ void HostZoomMapImpl::CopyFrom(HostZoomMap* copy_interface) {
|
| HostZoomMapImpl* copy = static_cast<HostZoomMapImpl*>(copy_interface);
|
| base::AutoLock auto_lock(lock_);
|
| base::AutoLock copy_auto_lock(copy->lock_);
|
| - for (HostZoomLevels::const_iterator i(copy->host_zoom_levels_.begin());
|
| - i != copy->host_zoom_levels_.end(); ++i) {
|
| - host_zoom_levels_[i->first] = i->second;
|
| + host_zoom_levels_.
|
| + insert(copy->host_zoom_levels_.begin(), copy->host_zoom_levels_.end());
|
| + for (SchemeHostZoomLevels::const_iterator i(copy->
|
| + scheme_host_zoom_levels_.begin());
|
| + i != copy->scheme_host_zoom_levels_.end(); ++i) {
|
| + scheme_host_zoom_levels_[i->first] = HostZoomLevels();
|
| + scheme_host_zoom_levels_[i->first].
|
| + insert(i->second.begin(), i->second.end());
|
| }
|
| default_zoom_level_ = copy->default_zoom_level_;
|
| }
|
| @@ -67,6 +72,21 @@ double HostZoomMapImpl::GetZoomLevel(const std::string& host) const {
|
| return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second;
|
| }
|
|
|
| +double HostZoomMapImpl::GetZoomLevel(const std::string& scheme,
|
| + const std::string& host) const {
|
| + {
|
| + base::AutoLock auto_lock(lock_);
|
| + SchemeHostZoomLevels::const_iterator scheme_iterator(
|
| + scheme_host_zoom_levels_.find(scheme));
|
| + if (scheme_iterator != scheme_host_zoom_levels_.end()) {
|
| + HostZoomLevels::const_iterator i(scheme_iterator->second.find(host));
|
| + if (i != scheme_iterator->second.end())
|
| + return i->second;
|
| + }
|
| + }
|
| + return GetZoomLevel(host);
|
| +}
|
| +
|
| void HostZoomMapImpl::SetZoomLevel(const std::string& host, double level) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| @@ -86,7 +106,33 @@ void HostZoomMapImpl::SetZoomLevel(const std::string& host, double level) {
|
| if (HostZoomMap::GetForBrowserContext(
|
| render_process_host->GetBrowserContext()) == this) {
|
| render_process_host->Send(
|
| - new ViewMsg_SetZoomLevelForCurrentURL(host, level));
|
| + new ViewMsg_SetZoomLevelForCurrentURL(std::string(), host, level));
|
| + }
|
| + }
|
| +
|
| + NotificationService::current()->Notify(
|
| + NOTIFICATION_ZOOM_LEVEL_CHANGED,
|
| + Source<HostZoomMap>(this),
|
| + Details<const std::string>(&host));
|
| +}
|
| +
|
| +void HostZoomMapImpl::SetZoomLevel(const std::string& scheme,
|
| + const std::string& host,
|
| + double level) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + {
|
| + base::AutoLock auto_lock(lock_);
|
| + scheme_host_zoom_levels_[scheme][host] = level;
|
| + }
|
| +
|
| + // Notify renderers from this browser context.
|
| + for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
|
| + !i.IsAtEnd(); i.Advance()) {
|
| + RenderProcessHost* render_process_host = i.GetCurrentValue();
|
| + if (HostZoomMap::GetForBrowserContext(
|
| + render_process_host->GetBrowserContext()) == this) {
|
| + render_process_host->Send(
|
| + new ViewMsg_SetZoomLevelForCurrentURL(scheme, host, level));
|
| }
|
| }
|
|
|
|
|