OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/plugins/renderer/webview_plugin.h" | 5 #include "components/plugins/renderer/webview_plugin.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/location.h" |
11 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
12 #include "base/numerics/safe_conversions.h" | 12 #include "base/numerics/safe_conversions.h" |
| 13 #include "base/single_thread_task_runner.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
13 #include "content/public/common/web_preferences.h" | 15 #include "content/public/common/web_preferences.h" |
14 #include "content/public/renderer/render_view.h" | 16 #include "content/public/renderer/render_view.h" |
15 #include "gin/converter.h" | 17 #include "gin/converter.h" |
16 #include "skia/ext/platform_canvas.h" | 18 #include "skia/ext/platform_canvas.h" |
17 #include "third_party/WebKit/public/platform/WebSize.h" | 19 #include "third_party/WebKit/public/platform/WebSize.h" |
18 #include "third_party/WebKit/public/platform/WebURL.h" | 20 #include "third_party/WebKit/public/platform/WebURL.h" |
19 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 21 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
20 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 22 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
21 #include "third_party/WebKit/public/web/WebDocument.h" | 23 #include "third_party/WebKit/public/web/WebDocument.h" |
22 #include "third_party/WebKit/public/web/WebElement.h" | 24 #include "third_party/WebKit/public/web/WebElement.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 return true; | 151 return true; |
150 } | 152 } |
151 | 153 |
152 void WebViewPlugin::destroy() { | 154 void WebViewPlugin::destroy() { |
153 if (delegate_) { | 155 if (delegate_) { |
154 delegate_->PluginDestroyed(); | 156 delegate_->PluginDestroyed(); |
155 delegate_ = nullptr; | 157 delegate_ = nullptr; |
156 } | 158 } |
157 container_ = nullptr; | 159 container_ = nullptr; |
158 content::RenderViewObserver::Observe(nullptr); | 160 content::RenderViewObserver::Observe(nullptr); |
159 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 161 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); |
160 } | 162 } |
161 | 163 |
162 v8::Local<v8::Object> WebViewPlugin::v8ScriptableObject(v8::Isolate* isolate) { | 164 v8::Local<v8::Object> WebViewPlugin::v8ScriptableObject(v8::Isolate* isolate) { |
163 if (!delegate_) | 165 if (!delegate_) |
164 return v8::Local<v8::Object>(); | 166 return v8::Local<v8::Object>(); |
165 | 167 |
166 return delegate_->GetV8ScriptableObject(isolate); | 168 return delegate_->GetV8ScriptableObject(isolate); |
167 } | 169 } |
168 | 170 |
169 void WebViewPlugin::updateAllLifecyclePhases() { | 171 void WebViewPlugin::updateAllLifecyclePhases() { |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 } | 339 } |
338 | 340 |
339 void WebViewPlugin::OnDestruct() {} | 341 void WebViewPlugin::OnDestruct() {} |
340 | 342 |
341 void WebViewPlugin::OnZoomLevelChanged() { | 343 void WebViewPlugin::OnZoomLevelChanged() { |
342 if (container_) { | 344 if (container_) { |
343 web_view_->setZoomLevel( | 345 web_view_->setZoomLevel( |
344 blink::WebView::zoomFactorToZoomLevel(container_->pageZoomFactor())); | 346 blink::WebView::zoomFactorToZoomLevel(container_->pageZoomFactor())); |
345 } | 347 } |
346 } | 348 } |
OLD | NEW |