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

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 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 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 const int64 kLongIdleHandlerDelayMs = 30*1000; 135 const int64 kLongIdleHandlerDelayMs = 30*1000;
136 const int kIdleCPUUsageThresholdInPercents = 3; 136 const int kIdleCPUUsageThresholdInPercents = 3;
137 137
138 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access 138 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access
139 // incorrectly from the wrong thread. 139 // incorrectly from the wrong thread.
140 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> > 140 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> >
141 lazy_tls = LAZY_INSTANCE_INITIALIZER; 141 lazy_tls = LAZY_INSTANCE_INITIALIZER;
142 142
143 class RenderViewZoomer : public RenderViewVisitor { 143 class RenderViewZoomer : public RenderViewVisitor {
144 public: 144 public:
145 RenderViewZoomer(const std::string& host, double zoom_level) 145 RenderViewZoomer(const std::string& scheme,
146 : host_(host), zoom_level_(zoom_level) { 146 const std::string& host,
147 double zoom_level) : scheme_(scheme),
148 host_(host),
149 zoom_level_(zoom_level) {
147 } 150 }
148 151
149 virtual bool Visit(RenderView* render_view) OVERRIDE { 152 virtual bool Visit(RenderView* render_view) OVERRIDE {
150 WebView* webview = render_view->GetWebView(); 153 WebView* webview = render_view->GetWebView();
151 WebDocument document = webview->mainFrame()->document(); 154 WebDocument document = webview->mainFrame()->document();
152 155
153 // Don't set zoom level for full-page plugin since they don't use the same 156 // Don't set zoom level for full-page plugin since they don't use the same
154 // zoom settings. 157 // zoom settings.
155 if (document.isPluginDocument()) 158 if (document.isPluginDocument())
156 return true; 159 return true;
157 160 GURL url(document.url());
158 if (net::GetHostOrSpecFromURL(GURL(document.url())) == host_) 161 // Empty scheme works as wildcard that matches any scheme,
162 if ((net::GetHostOrSpecFromURL(url) == host_) &&
163 (scheme_.empty() || scheme_ == url.scheme())) {
159 webview->setZoomLevel(false, zoom_level_); 164 webview->setZoomLevel(false, zoom_level_);
165 }
160 return true; 166 return true;
161 } 167 }
162 168
163 private: 169 private:
164 std::string host_; 170 const std::string scheme_;
165 double zoom_level_; 171 const std::string host_;
172 const double zoom_level_;
166 173
167 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer); 174 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer);
168 }; 175 };
169 176
170 std::string HostToCustomHistogramSuffix(const std::string& host) { 177 std::string HostToCustomHistogramSuffix(const std::string& host) {
171 if (host == "mail.google.com") 178 if (host == "mail.google.com")
172 return ".gmail"; 179 return ".gmail";
173 if (host == "docs.google.com" || host == "drive.google.com") 180 if (host == "docs.google.com" || host == "drive.google.com")
174 return ".docs"; 181 return ".docs";
175 if (host == "plus.google.com") 182 if (host == "plus.google.com")
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 } 1025 }
1019 1026
1020 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { 1027 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() {
1021 suspend_webkit_shared_timer_ = false; 1028 suspend_webkit_shared_timer_ = false;
1022 } 1029 }
1023 1030
1024 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { 1031 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() {
1025 notify_webkit_of_modal_loop_ = false; 1032 notify_webkit_of_modal_loop_ = false;
1026 } 1033 }
1027 1034
1028 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host, 1035 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& scheme,
1036 const std::string& host,
1029 double zoom_level) { 1037 double zoom_level) {
1030 RenderViewZoomer zoomer(host, zoom_level); 1038 RenderViewZoomer zoomer(scheme, host, zoom_level);
1031 RenderView::ForEach(&zoomer); 1039 RenderView::ForEach(&zoomer);
1032 } 1040 }
1033 1041
1034 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 1042 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
1035 ObserverListBase<RenderProcessObserver>::Iterator it(observers_); 1043 ObserverListBase<RenderProcessObserver>::Iterator it(observers_);
1036 RenderProcessObserver* observer; 1044 RenderProcessObserver* observer;
1037 while ((observer = it.GetNext()) != NULL) { 1045 while ((observer = it.GetNext()) != NULL) {
1038 if (observer->OnControlMessageReceived(msg)) 1046 if (observer->OnControlMessageReceived(msg))
1039 return true; 1047 return true;
1040 } 1048 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 1201
1194 void RenderThreadImpl::SetFlingCurveParameters( 1202 void RenderThreadImpl::SetFlingCurveParameters(
1195 const std::vector<float>& new_touchpad, 1203 const std::vector<float>& new_touchpad,
1196 const std::vector<float>& new_touchscreen) { 1204 const std::vector<float>& new_touchscreen) {
1197 webkit_platform_support_->SetFlingCurveParameters(new_touchpad, 1205 webkit_platform_support_->SetFlingCurveParameters(new_touchpad,
1198 new_touchscreen); 1206 new_touchscreen);
1199 1207
1200 } 1208 }
1201 1209
1202 } // namespace content 1210 } // 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