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

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: 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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1070 } 1077 }
1071 1078
1072 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { 1079 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() {
1073 suspend_webkit_shared_timer_ = false; 1080 suspend_webkit_shared_timer_ = false;
1074 } 1081 }
1075 1082
1076 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { 1083 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() {
1077 notify_webkit_of_modal_loop_ = false; 1084 notify_webkit_of_modal_loop_ = false;
1078 } 1085 }
1079 1086
1080 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host, 1087 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& scheme,
1088 const std::string& host,
1081 double zoom_level) { 1089 double zoom_level) {
1082 RenderViewZoomer zoomer(host, zoom_level); 1090 RenderViewZoomer zoomer(scheme, host, zoom_level);
1083 RenderView::ForEach(&zoomer); 1091 RenderView::ForEach(&zoomer);
1084 } 1092 }
1085 1093
1086 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 1094 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
1087 ObserverListBase<RenderProcessObserver>::Iterator it(observers_); 1095 ObserverListBase<RenderProcessObserver>::Iterator it(observers_);
1088 RenderProcessObserver* observer; 1096 RenderProcessObserver* observer;
1089 while ((observer = it.GetNext()) != NULL) { 1097 while ((observer = it.GetNext()) != NULL) {
1090 if (observer->OnControlMessageReceived(msg)) 1098 if (observer->OnControlMessageReceived(msg))
1091 return true; 1099 return true;
1092 } 1100 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 1258
1251 void RenderThreadImpl::SetFlingCurveParameters( 1259 void RenderThreadImpl::SetFlingCurveParameters(
1252 const std::vector<float>& new_touchpad, 1260 const std::vector<float>& new_touchpad,
1253 const std::vector<float>& new_touchscreen) { 1261 const std::vector<float>& new_touchscreen) {
1254 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, 1262 webkit_platform_support_->SetFlingCurveParameters(new_touchpad,
1255 new_touchscreen); 1263 new_touchscreen);
1256 1264
1257 } 1265 }
1258 1266
1259 } // namespace content 1267 } // 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