summaryrefslogtreecommitdiffstats
path: root/ui/views/controls
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-04 19:42:18 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-04 19:42:18 +0000
commit24af497c4c0881693cc47516ac3845f283bf07bc (patch)
tree50594b19ab8f40b4c7b0b74d2134220c622593b1 /ui/views/controls
parentf1dc1b19c71b94689eb0fc6309993ec591600da0 (diff)
downloadchromium_src-24af497c4c0881693cc47516ac3845f283bf07bc.zip
chromium_src-24af497c4c0881693cc47516ac3845f283bf07bc.tar.gz
chromium_src-24af497c4c0881693cc47516ac3845f283bf07bc.tar.bz2
Re-implement the screensaver to use WebView instead of ExtensionDialogHost.
Use WebView to render the screensaver extension instead of ExtensionDialogHost. Using the RenderViewGone override to detect termination of the renderer process to restart it. Added browser tests. R=ben@chromium.org,sky@chromium.org BUG=chromium-os:28211 TEST=Tested that the screensaver comes up; tested the reload via crashing the extension renderer with SIG_ABRT; also ran browser tests. Review URL: https://chromiumcodereview.appspot.com/10191010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135392 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls')
-rw-r--r--ui/views/controls/webview/webview.cc27
-rw-r--r--ui/views/controls/webview/webview.h9
2 files changed, 30 insertions, 6 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
diff --git a/ui/views/controls/webview/webview.h b/ui/views/controls/webview/webview.h
index 5a73dc9..de6fa7c 100644
--- a/ui/views/controls/webview/webview.h
+++ b/ui/views/controls/webview/webview.h
@@ -102,6 +102,13 @@ class VIEWS_EXPORT WebView : public View,
content::RenderViewHost* new_host);
void WebContentsDestroyed(content::WebContents* web_contents);
+ // Create a regular or test web contents (based on whether we're running
+ // in a unit test or not).
+ content::WebContents* CreateWebContents(
+ content::BrowserContext* browser_context,
+ content::SiteInstance* site_instance);
+
+
NativeViewHost* wcv_holder_;
scoped_ptr<content::WebContents> wc_owner_;
content::WebContents* web_contents_;
@@ -114,4 +121,4 @@ class VIEWS_EXPORT WebView : public View,
} // namespace views
-#endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ \ No newline at end of file
+#endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_