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

Side by Side 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 documentation Created 7 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_thread_impl.h" 5 #include "content/renderer/render_thread_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 const int64 kLongIdleHandlerDelayMs = 30*1000; 136 const int64 kLongIdleHandlerDelayMs = 30*1000;
137 const int kIdleCPUUsageThresholdInPercents = 3; 137 const int kIdleCPUUsageThresholdInPercents = 3;
138 138
139 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access 139 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access
140 // incorrectly from the wrong thread. 140 // incorrectly from the wrong thread.
141 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> > 141 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> >
142 lazy_tls = LAZY_INSTANCE_INITIALIZER; 142 lazy_tls = LAZY_INSTANCE_INITIALIZER;
143 143
144 class RenderViewZoomer : public RenderViewVisitor { 144 class RenderViewZoomer : public RenderViewVisitor {
145 public: 145 public:
146 RenderViewZoomer(const std::string& host, double zoom_level) 146 RenderViewZoomer(const std::string& scheme,
147 : host_(host), zoom_level_(zoom_level) { 147 const std::string& host,
148 double zoom_level) : scheme_(scheme),
149 host_(host),
150 zoom_level_(zoom_level) {
148 } 151 }
149 152
150 virtual bool Visit(RenderView* render_view) OVERRIDE { 153 virtual bool Visit(RenderView* render_view) OVERRIDE {
151 WebView* webview = render_view->GetWebView(); 154 WebView* webview = render_view->GetWebView();
152 WebDocument document = webview->mainFrame()->document(); 155 WebDocument document = webview->mainFrame()->document();
153 156
154 // Don't set zoom level for full-page plugin since they don't use the same 157 // Don't set zoom level for full-page plugin since they don't use the same
155 // zoom settings. 158 // zoom settings.
156 if (document.isPluginDocument()) 159 if (document.isPluginDocument())
157 return true; 160 return true;
158 161 GURL url(document.url());
159 if (net::GetHostOrSpecFromURL(GURL(document.url())) == host_) 162 // Empty scheme works as wildcard that matches any scheme,
163 if ((net::GetHostOrSpecFromURL(url) == host_) &&
164 (scheme_.empty() || scheme_ == url.scheme())) {
160 webview->setZoomLevel(false, zoom_level_); 165 webview->setZoomLevel(false, zoom_level_);
166 }
161 return true; 167 return true;
162 } 168 }
163 169
164 private: 170 private:
165 std::string host_; 171 const std::string scheme_;
166 double zoom_level_; 172 const std::string host_;
173 const double zoom_level_;
167 174
168 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer); 175 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer);
169 }; 176 };
170 177
171 std::string HostToCustomHistogramSuffix(const std::string& host) { 178 std::string HostToCustomHistogramSuffix(const std::string& host) {
172 if (host == "mail.google.com") 179 if (host == "mail.google.com")
173 return ".gmail"; 180 return ".gmail";
174 if (host == "docs.google.com" || host == "drive.google.com") 181 if (host == "docs.google.com" || host == "drive.google.com")
175 return ".docs"; 182 return ".docs";
176 if (host == "plus.google.com") 183 if (host == "plus.google.com")
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 } 1080 }
1074 1081
1075 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { 1082 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() {
1076 suspend_webkit_shared_timer_ = false; 1083 suspend_webkit_shared_timer_ = false;
1077 } 1084 }
1078 1085
1079 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { 1086 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() {
1080 notify_webkit_of_modal_loop_ = false; 1087 notify_webkit_of_modal_loop_ = false;
1081 } 1088 }
1082 1089
1083 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host, 1090 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& scheme,
1091 const std::string& host,
1084 double zoom_level) { 1092 double zoom_level) {
1085 RenderViewZoomer zoomer(host, zoom_level); 1093 RenderViewZoomer zoomer(scheme, host, zoom_level);
1086 RenderView::ForEach(&zoomer); 1094 RenderView::ForEach(&zoomer);
1087 } 1095 }
1088 1096
1089 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 1097 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
1090 ObserverListBase<RenderProcessObserver>::Iterator it(observers_); 1098 ObserverListBase<RenderProcessObserver>::Iterator it(observers_);
1091 RenderProcessObserver* observer; 1099 RenderProcessObserver* observer;
1092 while ((observer = it.GetNext()) != NULL) { 1100 while ((observer = it.GetNext()) != NULL) {
1093 if (observer->OnControlMessageReceived(msg)) 1101 if (observer->OnControlMessageReceived(msg))
1094 return true; 1102 return true;
1095 } 1103 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 1261
1254 void RenderThreadImpl::SetFlingCurveParameters( 1262 void RenderThreadImpl::SetFlingCurveParameters(
1255 const std::vector<float>& new_touchpad, 1263 const std::vector<float>& new_touchpad,
1256 const std::vector<float>& new_touchscreen) { 1264 const std::vector<float>& new_touchscreen) {
1257 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, 1265 webkit_platform_support_->SetFlingCurveParameters(new_touchpad,
1258 new_touchscreen); 1266 new_touchscreen);
1259 1267
1260 } 1268 }
1261 1269
1262 } // namespace content 1270 } // namespace content
OLDNEW
« 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