| 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/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
| 10 #include "content/public/common/web_preferences.h" | 10 #include "content/public/common/web_preferences.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 content::RenderView::ApplyWebPreferences(preferences, web_view_); | 54 content::RenderView::ApplyWebPreferences(preferences, web_view_); |
| 55 web_frame_ = WebLocalFrame::create(blink::WebTreeScopeType::Document, this); | 55 web_frame_ = WebLocalFrame::create(blink::WebTreeScopeType::Document, this); |
| 56 web_view_->setMainFrame(web_frame_); | 56 web_view_->setMainFrame(web_frame_); |
| 57 } | 57 } |
| 58 | 58 |
| 59 // static | 59 // static |
| 60 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate, | 60 WebViewPlugin* WebViewPlugin::Create(WebViewPlugin::Delegate* delegate, |
| 61 const WebPreferences& preferences, | 61 const WebPreferences& preferences, |
| 62 const std::string& html_data, | 62 const std::string& html_data, |
| 63 const GURL& url) { | 63 const GURL& url) { |
| 64 DCHECK(url.is_valid()) << "Blink requires the WebView to have a valid URL."; |
| 64 WebViewPlugin* plugin = new WebViewPlugin(delegate, preferences); | 65 WebViewPlugin* plugin = new WebViewPlugin(delegate, preferences); |
| 65 plugin->web_view()->mainFrame()->loadHTMLString(html_data, url); | 66 plugin->web_view()->mainFrame()->loadHTMLString(html_data, url); |
| 66 return plugin; | 67 return plugin; |
| 67 } | 68 } |
| 68 | 69 |
| 69 WebViewPlugin::~WebViewPlugin() { | 70 WebViewPlugin::~WebViewPlugin() { |
| 70 web_view_->close(); | 71 web_view_->close(); |
| 71 web_frame_->close(); | 72 web_frame_->close(); |
| 72 } | 73 } |
| 73 | 74 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) { | 264 void WebViewPlugin::didClearWindowObject(WebLocalFrame* frame) { |
| 264 if (delegate_) | 265 if (delegate_) |
| 265 delegate_->BindWebFrame(frame); | 266 delegate_->BindWebFrame(frame); |
| 266 } | 267 } |
| 267 | 268 |
| 268 void WebViewPlugin::didReceiveResponse(WebLocalFrame* frame, | 269 void WebViewPlugin::didReceiveResponse(WebLocalFrame* frame, |
| 269 unsigned identifier, | 270 unsigned identifier, |
| 270 const WebURLResponse& response) { | 271 const WebURLResponse& response) { |
| 271 WebFrameClient::didReceiveResponse(frame, identifier, response); | 272 WebFrameClient::didReceiveResponse(frame, identifier, response); |
| 272 } | 273 } |
| OLD | NEW |