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 "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/safe_numerics.h" | 9 #include "base/safe_numerics.h" |
10 #include "content/public/renderer/web_preferences.h" | 10 #include "content/public/renderer/web_preferences.h" |
11 #include "skia/ext/platform_canvas.h" | 11 #include "skia/ext/platform_canvas.h" |
12 #include "third_party/WebKit/public/platform/WebSize.h" | 12 #include "third_party/WebKit/public/platform/WebSize.h" |
13 #include "third_party/WebKit/public/platform/WebURL.h" | 13 #include "third_party/WebKit/public/platform/WebURL.h" |
14 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 14 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
15 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 15 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
16 #include "third_party/WebKit/public/web/WebCursorInfo.h" | 16 #include "third_party/WebKit/public/web/WebCursorInfo.h" |
17 #include "third_party/WebKit/public/web/WebDocument.h" | 17 #include "third_party/WebKit/public/web/WebDocument.h" |
18 #include "third_party/WebKit/public/web/WebElement.h" | 18 #include "third_party/WebKit/public/web/WebElement.h" |
19 #include "third_party/WebKit/public/web/WebFrame.h" | 19 #include "third_party/WebKit/public/web/WebFrame.h" |
20 #include "third_party/WebKit/public/web/WebInputEvent.h" | 20 #include "third_party/WebKit/public/web/WebInputEvent.h" |
21 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 21 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
22 #include "third_party/WebKit/public/web/WebView.h" | 22 #include "third_party/WebKit/public/web/WebView.h" |
23 #include "webkit/common/webpreferences.h" | 23 #include "webkit/common/webpreferences.h" |
24 | 24 |
25 using WebKit::WebCanvas; | 25 using blink::WebCanvas; |
26 using WebKit::WebCursorInfo; | 26 using blink::WebCursorInfo; |
27 using WebKit::WebDragData; | 27 using blink::WebDragData; |
28 using WebKit::WebDragOperationsMask; | 28 using blink::WebDragOperationsMask; |
29 using WebKit::WebFrame; | 29 using blink::WebFrame; |
30 using WebKit::WebImage; | 30 using blink::WebImage; |
31 using WebKit::WebInputEvent; | 31 using blink::WebInputEvent; |
32 using WebKit::WebMouseEvent; | 32 using blink::WebMouseEvent; |
33 using WebKit::WebPlugin; | 33 using blink::WebPlugin; |
34 using WebKit::WebPluginContainer; | 34 using blink::WebPluginContainer; |
35 using WebKit::WebPoint; | 35 using blink::WebPoint; |
36 using WebKit::WebRect; | 36 using blink::WebRect; |
37 using WebKit::WebSize; | 37 using blink::WebSize; |
38 using WebKit::WebString; | 38 using blink::WebString; |
39 using WebKit::WebURLError; | 39 using blink::WebURLError; |
40 using WebKit::WebURLRequest; | 40 using blink::WebURLRequest; |
41 using WebKit::WebURLResponse; | 41 using blink::WebURLResponse; |
42 using WebKit::WebVector; | 42 using blink::WebVector; |
43 using WebKit::WebView; | 43 using blink::WebView; |
44 | 44 |
45 WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate) | 45 WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate) |
46 : delegate_(delegate), container_(NULL), finished_loading_(false) { | 46 : delegate_(delegate), container_(NULL), finished_loading_(false) { |
47 web_view_ = WebView::create(this); | 47 web_view_ = WebView::create(this); |
48 web_view_->initializeMainFrame(this); | 48 web_view_->initializeMainFrame(this); |
49 } | 49 } |
50 | 50 |
51 // static | 51 // static |
52 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate, | 52 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate, |
53 const WebPreferences& preferences, | 53 const WebPreferences& preferences, |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 } | 182 } |
183 | 183 |
184 void WebViewPlugin::didFailLoading(const WebURLError& error) { | 184 void WebViewPlugin::didFailLoading(const WebURLError& error) { |
185 DCHECK(!error_.get()); | 185 DCHECK(!error_.get()); |
186 error_.reset(new WebURLError(error)); | 186 error_.reset(new WebURLError(error)); |
187 } | 187 } |
188 | 188 |
189 bool WebViewPlugin::acceptsLoadDrops() { return false; } | 189 bool WebViewPlugin::acceptsLoadDrops() { return false; } |
190 | 190 |
191 void WebViewPlugin::setToolTipText(const WebString& text, | 191 void WebViewPlugin::setToolTipText(const WebString& text, |
192 WebKit::WebTextDirection hint) { | 192 blink::WebTextDirection hint) { |
193 if (container_) | 193 if (container_) |
194 container_->element().setAttribute("title", text); | 194 container_->element().setAttribute("title", text); |
195 } | 195 } |
196 | 196 |
197 void WebViewPlugin::startDragging(WebFrame*, | 197 void WebViewPlugin::startDragging(WebFrame*, |
198 const WebDragData&, | 198 const WebDragData&, |
199 WebDragOperationsMask, | 199 WebDragOperationsMask, |
200 const WebImage&, | 200 const WebImage&, |
201 const WebPoint&) { | 201 const WebPoint&) { |
202 // Immediately stop dragging. | 202 // Immediately stop dragging. |
(...skipping 12 matching lines...) Expand all Loading... |
215 void WebViewPlugin::didClearWindowObject(WebFrame* frame) { | 215 void WebViewPlugin::didClearWindowObject(WebFrame* frame) { |
216 if (delegate_) | 216 if (delegate_) |
217 delegate_->BindWebFrame(frame); | 217 delegate_->BindWebFrame(frame); |
218 } | 218 } |
219 | 219 |
220 void WebViewPlugin::didReceiveResponse(WebFrame* frame, | 220 void WebViewPlugin::didReceiveResponse(WebFrame* frame, |
221 unsigned identifier, | 221 unsigned identifier, |
222 const WebURLResponse& response) { | 222 const WebURLResponse& response) { |
223 WebFrameClient::didReceiveResponse(frame, identifier, response); | 223 WebFrameClient::didReceiveResponse(frame, identifier, response); |
224 } | 224 } |
OLD | NEW |