summaryrefslogtreecommitdiffstats
path: root/ui/views/controls/webview/webview.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/views/controls/webview/webview.cc')
-rw-r--r--ui/views/controls/webview/webview.cc27
1 files changed, 22 insertions, 5 deletions
diff --git a/ui/views/controls/webview/webview.cc b/ui/views/controls/webview/webview.cc
index eb7846b..b6825d1 100644
--- a/ui/views/controls/webview/webview.cc
+++ b/ui/views/controls/webview/webview.cc
@@ -17,6 +17,7 @@
#include "ui/base/accessibility/accessibility_types.h"
#include "ui/views/controls/native/native_view_host.h"
#include "ui/views/focus/focus_manager.h"
+#include "ui/views/views_delegate.h"
namespace views {
@@ -46,11 +47,7 @@ content::WebContents* WebView::GetWebContents() {
void WebView::CreateWebContentsWithSiteInstance(
content::SiteInstance* site_instance) {
if (!web_contents_) {
- wc_owner_.reset(content::WebContents::Create(browser_context_,
- site_instance,
- MSG_ROUTING_NONE,
- NULL,
- NULL));
+ wc_owner_.reset(CreateWebContents(browser_context_, site_instance));
web_contents_ = wc_owner_.get();
web_contents_->SetDelegate(this);
AttachWebContents();
@@ -228,4 +225,24 @@ void WebView::WebContentsDestroyed(content::WebContents* web_contents) {
SetWebContents(NULL);
}
+content::WebContents* WebView::CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance) {
+ content::WebContents* contents = NULL;
+ if (ViewsDelegate::views_delegate) {
+ contents = ViewsDelegate::views_delegate->CreateWebContents(
+ browser_context, site_instance);
+ }
+
+ if (!contents) {
+ return content::WebContents::Create(browser_context,
+ site_instance,
+ MSG_ROUTING_NONE,
+ NULL,
+ NULL);
+ }
+
+ return contents;
+}
+
} // namespace views