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

Unified Diff: content/renderer/render_thread_impl.cc

Issue 11866004: Add scheme to HostZoomMap (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix alignment, add comment Created 7 years, 10 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
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 7ee9da4a7b9d0c5721bc413273695c93c2f30f85..7e82e04b525b03ed26d4a21967cebb7bde2f6f15 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -142,8 +142,11 @@ base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> >
class RenderViewZoomer : public RenderViewVisitor {
public:
- RenderViewZoomer(const std::string& host, double zoom_level)
- : host_(host), zoom_level_(zoom_level) {
+ RenderViewZoomer(const std::string& scheme,
+ const std::string& host,
+ double zoom_level) : scheme_(scheme),
+ host_(host),
+ zoom_level_(zoom_level) {
}
virtual bool Visit(RenderView* render_view) OVERRIDE {
@@ -154,15 +157,19 @@ class RenderViewZoomer : public RenderViewVisitor {
// zoom settings.
if (document.isPluginDocument())
return true;
-
- if (net::GetHostOrSpecFromURL(GURL(document.url())) == host_)
+ GURL url(document.url());
+ // Empty scheme works as wildcard that matches any scheme,
+ if ((net::GetHostOrSpecFromURL(url) == host_) &&
+ (scheme_.empty() || scheme_ == url.scheme())) {
webview->setZoomLevel(false, zoom_level_);
+ }
return true;
}
private:
- std::string host_;
- double zoom_level_;
+ const std::string scheme_;
+ const std::string host_;
+ const double zoom_level_;
DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer);
};
@@ -1025,9 +1032,10 @@ void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() {
notify_webkit_of_modal_loop_ = false;
}
-void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host,
+void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& scheme,
+ const std::string& host,
double zoom_level) {
- RenderViewZoomer zoomer(host, zoom_level);
+ RenderViewZoomer zoomer(scheme, host, zoom_level);
RenderView::ForEach(&zoomer);
}
« content/public/browser/host_zoom_map.h ('K') | « content/renderer/render_thread_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698