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

Side by Side Diff: components/plugins/renderer/webview_plugin.cc

Issue 357203003: Move webpreferences.* from webkit/ to content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add comment Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
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/numerics/safe_conversions.h" 9 #include "base/numerics/safe_conversions.h"
10 #include "content/public/renderer/web_preferences.h" 10 #include "content/public/common/web_preferences.h"
11 #include "content/public/renderer/render_view.h"
11 #include "skia/ext/platform_canvas.h" 12 #include "skia/ext/platform_canvas.h"
12 #include "third_party/WebKit/public/platform/WebSize.h" 13 #include "third_party/WebKit/public/platform/WebSize.h"
13 #include "third_party/WebKit/public/platform/WebURL.h" 14 #include "third_party/WebKit/public/platform/WebURL.h"
14 #include "third_party/WebKit/public/platform/WebURLRequest.h" 15 #include "third_party/WebKit/public/platform/WebURLRequest.h"
15 #include "third_party/WebKit/public/platform/WebURLResponse.h" 16 #include "third_party/WebKit/public/platform/WebURLResponse.h"
16 #include "third_party/WebKit/public/web/WebDocument.h" 17 #include "third_party/WebKit/public/web/WebDocument.h"
17 #include "third_party/WebKit/public/web/WebElement.h" 18 #include "third_party/WebKit/public/web/WebElement.h"
18 #include "third_party/WebKit/public/web/WebInputEvent.h" 19 #include "third_party/WebKit/public/web/WebInputEvent.h"
19 #include "third_party/WebKit/public/web/WebLocalFrame.h" 20 #include "third_party/WebKit/public/web/WebLocalFrame.h"
20 #include "third_party/WebKit/public/web/WebPluginContainer.h" 21 #include "third_party/WebKit/public/web/WebPluginContainer.h"
21 #include "third_party/WebKit/public/web/WebView.h" 22 #include "third_party/WebKit/public/web/WebView.h"
22 #include "webkit/common/webpreferences.h"
23 23
24 using blink::WebCanvas; 24 using blink::WebCanvas;
25 using blink::WebCursorInfo; 25 using blink::WebCursorInfo;
26 using blink::WebDragData; 26 using blink::WebDragData;
27 using blink::WebDragOperationsMask; 27 using blink::WebDragOperationsMask;
28 using blink::WebImage; 28 using blink::WebImage;
29 using blink::WebInputEvent; 29 using blink::WebInputEvent;
30 using blink::WebLocalFrame; 30 using blink::WebLocalFrame;
31 using blink::WebMouseEvent; 31 using blink::WebMouseEvent;
32 using blink::WebPlugin; 32 using blink::WebPlugin;
33 using blink::WebPluginContainer; 33 using blink::WebPluginContainer;
34 using blink::WebPoint; 34 using blink::WebPoint;
35 using blink::WebRect; 35 using blink::WebRect;
36 using blink::WebSize; 36 using blink::WebSize;
37 using blink::WebString; 37 using blink::WebString;
38 using blink::WebURLError; 38 using blink::WebURLError;
39 using blink::WebURLRequest; 39 using blink::WebURLRequest;
40 using blink::WebURLResponse; 40 using blink::WebURLResponse;
41 using blink::WebVector; 41 using blink::WebVector;
42 using blink::WebView; 42 using blink::WebView;
43 using content::WebPreferences;
43 44
44 WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate, 45 WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate,
46 content::RenderView* render_view,
45 const WebPreferences& preferences) 47 const WebPreferences& preferences)
46 : delegate_(delegate), 48 : delegate_(delegate),
47 container_(NULL), 49 container_(NULL),
48 web_view_(WebView::create(this)), 50 web_view_(WebView::create(this)),
49 finished_loading_(false), 51 finished_loading_(false),
50 focused_(false) { 52 focused_(false) {
51 // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a 53 // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a
52 // consistent view of our preferences. 54 // consistent view of our preferences.
53 content::ApplyWebPreferences(preferences, web_view_); 55 render_view->ApplyWebPreferences(preferences);
54 web_frame_ = WebLocalFrame::create(this); 56 web_frame_ = WebLocalFrame::create(this);
55 web_view_->setMainFrame(web_frame_); 57 web_view_->setMainFrame(web_frame_);
56 } 58 }
57 59
58 // static 60 // static
59 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate, 61 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate,
62 content::RenderView* render_view,
60 const WebPreferences& preferences, 63 const WebPreferences& preferences,
61 const std::string& html_data, 64 const std::string& html_data,
62 const GURL& url) { 65 const GURL& url) {
63 WebViewPlugin* plugin = new WebViewPlugin(delegate, preferences); 66 WebViewPlugin* plugin = new WebViewPlugin(delegate, render_view, preferences);
64 plugin->web_view()->mainFrame()->loadHTMLString(html_data, url); 67 plugin->web_view()->mainFrame()->loadHTMLString(html_data, url);
65 return plugin; 68 return plugin;
66 } 69 }
67 70
68 WebViewPlugin::~WebViewPlugin() { 71 WebViewPlugin::~WebViewPlugin() {
69 web_view_->close(); 72 web_view_->close();
70 web_frame_->close(); 73 web_frame_->close();
71 } 74 }
72 75
73 void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) { 76 void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) { 240 void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) {
238 if (delegate_) 241 if (delegate_)
239 delegate_->BindWebFrame(frame); 242 delegate_->BindWebFrame(frame);
240 } 243 }
241 244
242 void WebViewPlugin::didReceiveResponse(WebLocalFrame* frame, 245 void WebViewPlugin::didReceiveResponse(WebLocalFrame* frame,
243 unsigned identifier, 246 unsigned identifier,
244 const WebURLResponse& response) { 247 const WebURLResponse& response) {
245 WebFrameClient::didReceiveResponse(frame, identifier, response); 248 WebFrameClient::didReceiveResponse(frame, identifier, response);
246 } 249 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698