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

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

Issue 296983017: WebViewPlugin: Apply Prefs to WebSettings before creating a WebLocalFrame (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/renderer/web_preferences.h"
(...skipping 23 matching lines...) Expand all
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 43
44 WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate) 44 WebViewPlugin::WebViewPlugin(WebViewPlugin::Delegate* delegate,
45 const WebPreferences& preferences)
45 : delegate_(delegate), 46 : delegate_(delegate),
46 container_(NULL), 47 container_(NULL),
47 web_view_(WebView::create(this)), 48 web_view_(WebView::create(this)),
48 web_frame_(WebLocalFrame::create(this)),
49 finished_loading_(false), 49 finished_loading_(false),
50 focused_(false) { 50 focused_(false) {
51 // ApplyWebPreferences before making a WebLocalFrame so that the frame sees a
52 // consistent view of our preferences.
53 content::ApplyWebPreferences(preferences, web_view_);
54 web_frame_ = WebLocalFrame::create(this);
51 web_view_->setMainFrame(web_frame_); 55 web_view_->setMainFrame(web_frame_);
52 } 56 }
53 57
54 // static 58 // static
55 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate, 59 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate,
56 const WebPreferences& preferences, 60 const WebPreferences& preferences,
57 const std::string& html_data, 61 const std::string& html_data,
58 const GURL& url) { 62 const GURL& url) {
59 WebViewPlugin* plugin = new WebViewPlugin(delegate); 63 WebViewPlugin* plugin = new WebViewPlugin(delegate, preferences);
60 WebView* web_view = plugin->web_view(); 64 plugin->web_view()->mainFrame()->loadHTMLString(html_data, url);
61 content::ApplyWebPreferences(preferences, web_view);
62 web_view->mainFrame()->loadHTMLString(html_data, url);
63 return plugin; 65 return plugin;
64 } 66 }
65 67
66 WebViewPlugin::~WebViewPlugin() { 68 WebViewPlugin::~WebViewPlugin() {
67 web_view_->close(); 69 web_view_->close();
68 web_frame_->close(); 70 web_frame_->close();
69 } 71 }
70 72
71 void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) { 73 void WebViewPlugin::ReplayReceivedData(WebPlugin* plugin) {
72 if (!response_.isNull()) { 74 if (!response_.isNull()) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) { 237 void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) {
236 if (delegate_) 238 if (delegate_)
237 delegate_->BindWebFrame(frame); 239 delegate_->BindWebFrame(frame);
238 } 240 }
239 241
240 void WebViewPlugin::didReceiveResponse(WebLocalFrame* frame, 242 void WebViewPlugin::didReceiveResponse(WebLocalFrame* frame,
241 unsigned identifier, 243 unsigned identifier,
242 const WebURLResponse& response) { 244 const WebURLResponse& response) {
243 WebFrameClient::didReceiveResponse(frame, identifier, response); 245 WebFrameClient::didReceiveResponse(frame, identifier, response);
244 } 246 }
OLDNEW
« no previous file with comments | « components/plugins/renderer/webview_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698