diff options
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 4 | ||||
-rw-r--r-- | content/browser/host_zoom_map.cc | 7 | ||||
-rw-r--r-- | content/browser/host_zoom_map.h | 21 | ||||
-rw-r--r-- | content/browser/renderer_host/async_resource_handler.cc | 3 | ||||
-rw-r--r-- | content/browser/renderer_host/render_view_host.cc | 2 | ||||
-rw-r--r-- | content/browser/tab_contents/tab_contents.cc | 2 |
6 files changed, 19 insertions, 20 deletions
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index c36d91d..3ed5116 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -976,7 +976,7 @@ HostZoomMap* ProfileImpl::GetHostZoomMap() { bool success = host_zoom_dictionary->GetDoubleWithoutPathExpansion( host, &zoom_level); DCHECK(success); - host_zoom_map_->SetZoomLevel(GURL(host), zoom_level); + host_zoom_map_->SetZoomLevel(host, zoom_level); } } @@ -1418,7 +1418,7 @@ void ProfileImpl::Observe(NotificationType type, case NotificationType::ZOOM_LEVEL_CHANGED: { const std::string& host = *(Details<const std::string>(details).ptr()); if (!host.empty()) { - double level = host_zoom_map_->GetZoomLevel(GURL(host)); + double level = host_zoom_map_->GetZoomLevel(host); DictionaryPrefUpdate update(prefs_.get(), prefs::kPerHostZoomLevels); DictionaryValue* host_zoom_dictionary = update.Get(); if (level == host_zoom_map_->default_zoom_level()) { diff --git a/content/browser/host_zoom_map.cc b/content/browser/host_zoom_map.cc index 63c1c83..79b0d18 100644 --- a/content/browser/host_zoom_map.cc +++ b/content/browser/host_zoom_map.cc @@ -24,18 +24,15 @@ HostZoomMap::HostZoomMap() : default_zoom_level_(0.0) { NotificationService::AllSources()); } -double HostZoomMap::GetZoomLevel(const GURL& url) const { - std::string host(net::GetHostOrSpecFromURL(url)); +double HostZoomMap::GetZoomLevel(std::string host) const { base::AutoLock auto_lock(lock_); HostZoomLevels::const_iterator i(host_zoom_levels_.find(host)); return (i == host_zoom_levels_.end()) ? default_zoom_level_ : i->second; } -void HostZoomMap::SetZoomLevel(const GURL& url, double level) { +void HostZoomMap::SetZoomLevel(std::string host, double level) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - std::string host(net::GetHostOrSpecFromURL(url)); - { base::AutoLock auto_lock(lock_); if (level == default_zoom_level_) diff --git a/content/browser/host_zoom_map.h b/content/browser/host_zoom_map.h index 5a923e3..6ec7492 100644 --- a/content/browser/host_zoom_map.h +++ b/content/browser/host_zoom_map.h @@ -31,21 +31,22 @@ class HostZoomMap : public: HostZoomMap(); - // Returns the zoom level for a given url. The zoom level is determined by - // the host portion of the URL, or (in the absence of a host) the complete - // spec of the URL. In most cases, there is no custom zoom level, and this - // returns the user's default zoom level. Otherwise, returns the saved zoom - // level, which may be positive (to zoom in) or negative (to zoom out). + // Returns the zoom level for the host or spec for a given url. The zoom + // level is determined by the host portion of the URL, or (in the absence of + // a host) the complete spec of the URL. In most cases, there is no custom + // zoom level, and this returns the user's default zoom level. Otherwise, + // returns the saved zoom level, which may be positive (to zoom in) or + // negative (to zoom out). // // This may be called on any thread. - double GetZoomLevel(const GURL& url) const; + double GetZoomLevel(std::string host) const; - // Sets the zoom level for a given url to |level|. If the level matches the - // current default zoom level, the host is erased from the saved preferences; - // otherwise the new value is written out. + // Sets the zoom level for the host or spec for a given url to |level|. If + // the level matches the current default zoom level, the host is erased + // from the saved preferences; otherwise the new value is written out. // // This should only be called on the UI thread. - void SetZoomLevel(const GURL& url, double level); + void SetZoomLevel(std::string host, double level); // Returns the temporary zoom level that's only valid for the lifetime of // the given tab (i.e. isn't saved and doesn't affect other tabs) if it diff --git a/content/browser/renderer_host/async_resource_handler.cc b/content/browser/renderer_host/async_resource_handler.cc index bb20ff1..44866d1 100644 --- a/content/browser/renderer_host/async_resource_handler.cc +++ b/content/browser/renderer_host/async_resource_handler.cc @@ -129,7 +129,8 @@ bool AsyncResourceHandler::OnResponseStarted(int request_id, GURL request_url(request->url()); filter_->Send(new ViewMsg_SetZoomLevelForLoadingURL( info->route_id(), - request_url, host_zoom_map_->GetZoomLevel(request_url))); + request_url, host_zoom_map_->GetZoomLevel(net::GetHostOrSpecFromURL( + request_url)))); } filter_->Send(new ResourceMsg_ReceivedResponse( diff --git a/content/browser/renderer_host/render_view_host.cc b/content/browser/renderer_host/render_view_host.cc index 406605b..7b07d51 100644 --- a/content/browser/renderer_host/render_view_host.cc +++ b/content/browser/renderer_host/render_view_host.cc @@ -1255,7 +1255,7 @@ void RenderViewHost::OnDidZoomURL(double zoom_level, DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); HostZoomMap* host_zoom_map = process()->profile()->GetHostZoomMap(); if (remember) { - host_zoom_map->SetZoomLevel(url, zoom_level); + host_zoom_map->SetZoomLevel(net::GetHostOrSpecFromURL(url), zoom_level); // Notify renderers from this profile. for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); !i.IsAtEnd(); i.Advance()) { diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index 9b45752..6e70151 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -755,7 +755,7 @@ double TabContents::GetZoomLevel() const { zoom_level = zoom_map->GetTemporaryZoomLevel( GetRenderProcessHost()->id(), render_view_host()->routing_id()); } else { - zoom_level = zoom_map->GetZoomLevel(GetURL()); + zoom_level = zoom_map->GetZoomLevel(net::GetHostOrSpecFromURL(GetURL())); } return zoom_level; } |