Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 173 | 173 |
| 174 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access | 174 // Keep the global RenderThreadImpl in a TLS slot so it is impossible to access |
| 175 // incorrectly from the wrong thread. | 175 // incorrectly from the wrong thread. |
| 176 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> > | 176 base::LazyInstance<base::ThreadLocalPointer<RenderThreadImpl> > |
| 177 lazy_tls = LAZY_INSTANCE_INITIALIZER; | 177 lazy_tls = LAZY_INSTANCE_INITIALIZER; |
| 178 | 178 |
| 179 class RenderViewZoomer : public RenderViewVisitor { | 179 class RenderViewZoomer : public RenderViewVisitor { |
| 180 public: | 180 public: |
| 181 RenderViewZoomer(const std::string& scheme, | 181 RenderViewZoomer(const std::string& scheme, |
| 182 const std::string& host, | 182 const std::string& host, |
| 183 double zoom_level) : scheme_(scheme), | 183 double zoom_level) |
|
Fady Samuel
2014/06/12 18:49:48
Unnecessary change. Please revert to avoid code ch
wjmaclean
2014/06/12 19:35:27
Done.
| |
| 184 host_(host), | 184 : scheme_(scheme), |
| 185 zoom_level_(zoom_level) { | 185 host_(host), |
| 186 } | 186 zoom_level_(zoom_level) {} |
| 187 | 187 |
| 188 virtual bool Visit(RenderView* render_view) OVERRIDE { | 188 virtual bool Visit(RenderView* render_view) OVERRIDE { |
| 189 WebView* webview = render_view->GetWebView(); | 189 WebView* webview = render_view->GetWebView(); |
| 190 WebDocument document = webview->mainFrame()->document(); | 190 WebDocument document = webview->mainFrame()->document(); |
| 191 | 191 |
| 192 // Don't set zoom level for full-page plugin since they don't use the same | 192 // Don't set zoom level for full-page plugin since they don't use the same |
| 193 // zoom settings. | 193 // zoom settings. |
| 194 if (document.isPluginDocument()) | 194 if (document.isPluginDocument()) |
| 195 return true; | 195 return true; |
| 196 GURL url(document.url()); | 196 GURL url(document.url()); |
| 197 // Empty scheme works as wildcard that matches any scheme, | 197 // Empty scheme works as wildcard that matches any scheme, |
| 198 if ((net::GetHostOrSpecFromURL(url) == host_) && | 198 if ((net::GetHostOrSpecFromURL(url) == host_) && |
| 199 (scheme_.empty() || scheme_ == url.scheme())) { | 199 (scheme_.empty() || scheme_ == url.scheme()) && |
| 200 !static_cast<RenderViewImpl*>(render_view) | |
| 201 ->uses_temporary_zoom_level()) { | |
| 200 webview->hidePopups(); | 202 webview->hidePopups(); |
| 201 webview->setZoomLevel(zoom_level_); | 203 webview->setZoomLevel(zoom_level_); |
| 202 } | 204 } |
| 203 return true; | 205 return true; |
| 204 } | 206 } |
| 205 | 207 |
| 206 private: | 208 private: |
| 207 const std::string scheme_; | 209 const std::string scheme_; |
| 208 const std::string host_; | 210 const std::string host_; |
| 209 const double zoom_level_; | 211 const double zoom_level_; |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1186 } | 1188 } |
| 1187 | 1189 |
| 1188 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { | 1190 void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { |
| 1189 suspend_webkit_shared_timer_ = false; | 1191 suspend_webkit_shared_timer_ = false; |
| 1190 } | 1192 } |
| 1191 | 1193 |
| 1192 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { | 1194 void RenderThreadImpl::DoNotNotifyWebKitOfModalLoop() { |
| 1193 notify_webkit_of_modal_loop_ = false; | 1195 notify_webkit_of_modal_loop_ = false; |
| 1194 } | 1196 } |
| 1195 | 1197 |
| 1196 void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& scheme, | 1198 void RenderThreadImpl::OnSetZoomLevelForCurrentURL( |
|
Fady Samuel
2014/06/12 18:49:48
Unnecessary change, please revert to avoid code ch
wjmaclean
2014/06/12 19:35:53
Done.
| |
| 1197 const std::string& host, | 1199 const std::string& scheme, |
| 1198 double zoom_level) { | 1200 const std::string& host, |
| 1201 double zoom_level) { | |
| 1199 RenderViewZoomer zoomer(scheme, host, zoom_level); | 1202 RenderViewZoomer zoomer(scheme, host, zoom_level); |
| 1200 RenderView::ForEach(&zoomer); | 1203 RenderView::ForEach(&zoomer); |
| 1201 } | 1204 } |
| 1202 | 1205 |
| 1203 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { | 1206 bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { |
| 1204 ObserverListBase<RenderProcessObserver>::Iterator it(observers_); | 1207 ObserverListBase<RenderProcessObserver>::Iterator it(observers_); |
| 1205 RenderProcessObserver* observer; | 1208 RenderProcessObserver* observer; |
| 1206 while ((observer = it.GetNext()) != NULL) { | 1209 while ((observer = it.GetNext()) != NULL) { |
| 1207 if (observer->OnControlMessageReceived(msg)) | 1210 if (observer->OnControlMessageReceived(msg)) |
| 1208 return true; | 1211 return true; |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1513 hidden_widget_count_--; | 1516 hidden_widget_count_--; |
| 1514 | 1517 |
| 1515 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { | 1518 if (!GetContentClient()->renderer()->RunIdleHandlerWhenWidgetsHidden()) { |
| 1516 return; | 1519 return; |
| 1517 } | 1520 } |
| 1518 | 1521 |
| 1519 ScheduleIdleHandler(kLongIdleHandlerDelayMs); | 1522 ScheduleIdleHandler(kLongIdleHandlerDelayMs); |
| 1520 } | 1523 } |
| 1521 | 1524 |
| 1522 } // namespace content | 1525 } // namespace content |
| OLD | NEW |