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

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: Few more fixes Created 7 years, 11 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 const int64 kLongIdleHandlerDelayMs = 30*1000; 134 const int64 kLongIdleHandlerDelayMs = 30*1000;
135 const int kIdleCPUUsageThresholdInPercents = 3; 135 const int kIdleCPUUsageThresholdInPercents = 3;
136 136
137 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access 137 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access
138 // incorrectly from the wrong thread. 138 // incorrectly from the wrong thread.
139 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> > 139 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> >
140 lazy_tls = LAZY_INSTANCE_INITIALIZER; 140 lazy_tls = LAZY_INSTANCE_INITIALIZER;
141 141
142 class RenderViewZoomer : public RenderViewVisitor { 142 class RenderViewZoomer : public RenderViewVisitor {
143 public: 143 public:
144 RenderViewZoomer(const std::string& host, double zoom_level) 144 RenderViewZoomer(const std::string& scheme,
145 : host_(host), zoom_level_(zoom_level) { 145 const std::string& host,
146 double zoom_level)
147 : scheme_(scheme), host_(host), zoom_level_(zoom_level) {
146 } 148 }
147 149
148 virtual bool Visit(RenderView* render_view) { 150 virtual bool Visit(RenderView* render_view) {
149 WebView* webview = render_view->GetWebView(); 151 WebView* webview = render_view->GetWebView();
150 WebDocument document = webview->mainFrame()->document(); 152 WebDocument document = webview->mainFrame()->document();
151 153
152 // Don't set zoom level for full-page plugin since they don't use the same 154 // Don't set zoom level for full-page plugin since they don't use the same
153 // zoom settings. 155 // zoom settings.
154 if (document.isPluginDocument()) 156 if (document.isPluginDocument())
155 return true; 157 return true;
156 158 GURL url(document.url());
157 if (net::GetHostOrSpecFromURL(GURL(document.url())) == host_) 159 if ((net::GetHostOrSpecFromURL(url) == host_) &&
160 (scheme_.empty() || scheme_ == url.scheme())) {
158 webview->setZoomLevel(false, zoom_level_); 161 webview->setZoomLevel(false, zoom_level_);
162 }
159 return true; 163 return true;
160 } 164 }
161 165
162 private: 166 private:
167 std::string scheme_;
163 std::string host_; 168 std::string host_;
164 double zoom_level_; 169 double zoom_level_;
165 170
166 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer); 171 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer);
167 }; 172 };
168 173
169 std::string HostToCustomHistogramSuffix(const std::string& host) { 174 std::string HostToCustomHistogramSuffix(const std::string& host) {
170 if (host == "mail.google.com") 175 if (host == "mail.google.com")
171 return ".gmail"; 176 return ".gmail";
172 if (host == "docs.google.com" || host == "drive.google.com") 177 if (host == "docs.google.com" || host == "drive.google.com")
(...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after
998 } 1003 }
999 1004
1000 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { 1005 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() {
1001 suspend_webkit_shared_timer_ = false; 1006 suspend_webkit_shared_timer_ = false;
1002 } 1007 }
1003 1008
1004 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { 1009 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() {
1005 notify_webkit_of_modal_loop_ = false; 1010 notify_webkit_of_modal_loop_ = false;
1006 } 1011 }
1007 1012
1008 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host, 1013 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& scheme,
1014 const std::string& host,
1009 double zoom_level) { 1015 double zoom_level) {
1010 RenderViewZoomer zoomer(host, zoom_level); 1016 RenderViewZoomer zoomer(scheme, host, zoom_level);
1011 RenderView::ForEach(&zoomer); 1017 RenderView::ForEach(&zoomer);
1012 } 1018 }
1013 1019
1014 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 1020 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
1015 ObserverListBase<RenderProcessObserver>::Iterator it(observers_); 1021 ObserverListBase<RenderProcessObserver>::Iterator it(observers_);
1016 RenderProcessObserver* observer; 1022 RenderProcessObserver* observer;
1017 while ((observer = it.GetNext()) != NULL) { 1023 while ((observer = it.GetNext()) != NULL) {
1018 if (observer->OnControlMessageReceived(msg)) 1024 if (observer->OnControlMessageReceived(msg))
1019 return true; 1025 return true;
1020 } 1026 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 RenderThreadImpl::GetFileThreadMessageLoopProxy() { 1165 RenderThreadImpl::GetFileThreadMessageLoopProxy() {
1160 DCHECK(message_loop() == MessageLoop::current()); 1166 DCHECK(message_loop() == MessageLoop::current());
1161 if (!file_thread_.get()) { 1167 if (!file_thread_.get()) {
1162 file_thread_.reset(new base::Thread("Renderer::FILE")); 1168 file_thread_.reset(new base::Thread("Renderer::FILE"));
1163 file_thread_->Start(); 1169 file_thread_->Start();
1164 } 1170 }
1165 return file_thread_->message_loop_proxy(); 1171 return file_thread_->message_loop_proxy();
1166 } 1172 }
1167 1173
1168 } // namespace content 1174 } // namespace content
OLDNEW
« content/browser/host_zoom_map_impl.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