summaryrefslogtreecommitdiffstats
path: root/ui/views/controls
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 21:54:04 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-02 21:54:04 +0000
commit669a2ef721ff2ba7fba0d5bf1f8357af5f722ff6 (patch)
treefa52cca867d3d600b074524b67dc0286d8041359 /ui/views/controls
parent75d86c040b469787676a7bb1f3650a4903bc13fb (diff)
downloadchromium_src-669a2ef721ff2ba7fba0d5bf1f8357af5f722ff6.zip
chromium_src-669a2ef721ff2ba7fba0d5bf1f8357af5f722ff6.tar.gz
chromium_src-669a2ef721ff2ba7fba0d5bf1f8357af5f722ff6.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@135000 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_