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

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, 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()))
Nikita (slow) 2013/01/11 15:23:55 nit: move one space left
Denis Kuznetsov (DE-MUC) 2013/01/11 15:48:59 Done.
158 webview->setZoomLevel(false, zoom_level_); 161 webview->setZoomLevel(false, zoom_level_);
Nikita (slow) 2013/01/11 15:23:55 nit: add {}
Denis Kuznetsov (DE-MUC) 2013/01/11 15:48:59 Done.
159 return true; 162 return true;
160 } 163 }
161 164
162 private: 165 private:
166 std::string scheme_;
163 std::string host_; 167 std::string host_;
164 double zoom_level_; 168 double zoom_level_;
165 169
166 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer); 170 DISALLOW_COPY_AND_ASSIGN(RenderViewZoomer);
167 }; 171 };
168 172
169 std::string HostToCustomHistogramSuffix(const std::string& host) { 173 std::string HostToCustomHistogramSuffix(const std::string& host) {
170 if (host == "mail.google.com") 174 if (host == "mail.google.com")
171 return ".gmail"; 175 return ".gmail";
172 if (host == "docs.google.com" || host == "drive.google.com") 176 if (host == "docs.google.com" || host == "drive.google.com")
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 } 1003 }
1000 1004
1001 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { 1005 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() {
1002 suspend_webkit_shared_timer_ = false; 1006 suspend_webkit_shared_timer_ = false;
1003 } 1007 }
1004 1008
1005 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { 1009 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() {
1006 notify_webkit_of_modal_loop_ = false; 1010 notify_webkit_of_modal_loop_ = false;
1007 } 1011 }
1008 1012
1009 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host, 1013 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& scheme,
1014 const std::string& host,
1010 double zoom_level) { 1015 double zoom_level) {
1011 RenderViewZoomer zoomer(host, zoom_level); 1016 RenderViewZoomer zoomer(scheme, host, zoom_level);
1012 RenderView::ForEach(&zoomer); 1017 RenderView::ForEach(&zoomer);
1013 } 1018 }
1014 1019
1015 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { 1020 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
1016 ObserverListBase<RenderProcessObserver>::Iterator it(observers_); 1021 ObserverListBase<RenderProcessObserver>::Iterator it(observers_);
1017 RenderProcessObserver* observer; 1022 RenderProcessObserver* observer;
1018 while ((observer = it.GetNext()) != NULL) { 1023 while ((observer = it.GetNext()) != NULL) {
1019 if (observer->OnControlMessageReceived(msg)) 1024 if (observer->OnControlMessageReceived(msg))
1020 return true; 1025 return true;
1021 } 1026 }
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 RenderThreadImpl::GetFileThreadMessageLoopProxy() { 1165 RenderThreadImpl::GetFileThreadMessageLoopProxy() {
1161 DCHECK(message_loop() == MessageLoop::current()); 1166 DCHECK(message_loop() == MessageLoop::current());
1162 if (!file_thread_.get()) { 1167 if (!file_thread_.get()) {
1163 file_thread_.reset(new base::Thread("Renderer::FILE")); 1168 file_thread_.reset(new base::Thread("Renderer::FILE"));
1164 file_thread_->Start(); 1169 file_thread_->Start();
1165 } 1170 }
1166 return file_thread_->message_loop_proxy(); 1171 return file_thread_->message_loop_proxy();
1167 } 1172 }
1168 1173
1169 } // namespace content 1174 } // 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