diff options
author | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-04 17:44:37 +0000 |
---|---|---|
committer | rkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-04 17:44:37 +0000 |
commit | 9ed9ac97bd45365c2cb491b16f9c70ee96b036ff (patch) | |
tree | 89ff0c0e172d0e4141dd68bc907289dc748a1dd3 /ui/views | |
parent | 1e89ed3c8f8002a67f70acdc72f3c6e6801bf112 (diff) | |
download | chromium_src-9ed9ac97bd45365c2cb491b16f9c70ee96b036ff.zip chromium_src-9ed9ac97bd45365c2cb491b16f9c70ee96b036ff.tar.gz chromium_src-9ed9ac97bd45365c2cb491b16f9c70ee96b036ff.tar.bz2 |
Revert 135369 - 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
TBR=rkc@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r-- | ui/views/controls/webview/webview.cc | 27 | ||||
-rw-r--r-- | ui/views/controls/webview/webview.h | 9 | ||||
-rw-r--r-- | ui/views/test/DEPS | 3 | ||||
-rw-r--r-- | ui/views/test/test_views_delegate.cc | 8 | ||||
-rw-r--r-- | ui/views/test/test_views_delegate.h | 4 | ||||
-rw-r--r-- | ui/views/test/webview_test_helper.cc | 34 | ||||
-rw-r--r-- | ui/views/test/webview_test_helper.h | 41 | ||||
-rw-r--r-- | ui/views/views.gyp | 33 | ||||
-rw-r--r-- | ui/views/views_delegate.h | 11 |
9 files changed, 11 insertions, 159 deletions
diff --git a/ui/views/controls/webview/webview.cc b/ui/views/controls/webview/webview.cc index b6825d1..eb7846b 100644 --- a/ui/views/controls/webview/webview.cc +++ b/ui/views/controls/webview/webview.cc @@ -17,7 +17,6 @@ #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 { @@ -47,7 +46,11 @@ content::WebContents* WebView::GetWebContents() { void WebView::CreateWebContentsWithSiteInstance( content::SiteInstance* site_instance) { if (!web_contents_) { - wc_owner_.reset(CreateWebContents(browser_context_, site_instance)); + wc_owner_.reset(content::WebContents::Create(browser_context_, + site_instance, + MSG_ROUTING_NONE, + NULL, + NULL)); web_contents_ = wc_owner_.get(); web_contents_->SetDelegate(this); AttachWebContents(); @@ -225,24 +228,4 @@ 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 de6fa7c..5a73dc9 100644 --- a/ui/views/controls/webview/webview.h +++ b/ui/views/controls/webview/webview.h @@ -102,13 +102,6 @@ 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_; @@ -121,4 +114,4 @@ class VIEWS_EXPORT WebView : public View, } // namespace views -#endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_ +#endif // UI_VIEWS_CONTROLS_WEBVIEW_WEBVIEW_H_
\ No newline at end of file diff --git a/ui/views/test/DEPS b/ui/views/test/DEPS deleted file mode 100644 index 659b105..0000000 --- a/ui/views/test/DEPS +++ /dev/null @@ -1,3 +0,0 @@ -include_rules = [ - "+content/test", -] diff --git a/ui/views/test/test_views_delegate.cc b/ui/views/test/test_views_delegate.cc index 21ae8ae..a8fe511 100644 --- a/ui/views/test/test_views_delegate.cc +++ b/ui/views/test/test_views_delegate.cc @@ -5,7 +5,6 @@ #include "ui/views/test/test_views_delegate.h" #include "base/logging.h" -#include "content/test/web_contents_tester.h" #include "ui/base/clipboard/clipboard.h" namespace views { @@ -65,11 +64,4 @@ views::NativeWidgetHelperAura* TestViewsDelegate::CreateNativeWidgetHelper( } #endif -content::WebContents* TestViewsDelegate::CreateWebContents( - content::BrowserContext* browser_context, - content::SiteInstance* site_instance) { - return content::WebContentsTester::CreateTestWebContents(browser_context, - site_instance); -} - } // namespace views diff --git a/ui/views/test/test_views_delegate.h b/ui/views/test/test_views_delegate.h index 54ae0be..1ea5cdf 100644 --- a/ui/views/test/test_views_delegate.h +++ b/ui/views/test/test_views_delegate.h @@ -64,10 +64,6 @@ class TestViewsDelegate : public ViewsDelegate { views::NativeWidgetAura* native_widget) OVERRIDE; #endif - virtual content::WebContents* CreateWebContents( - content::BrowserContext* browser_context, - content::SiteInstance* site_instance) OVERRIDE; - private: mutable scoped_ptr<ui::Clipboard> clipboard_; bool use_transparent_windows_; diff --git a/ui/views/test/webview_test_helper.cc b/ui/views/test/webview_test_helper.cc deleted file mode 100644 index 6ff3925..0000000 --- a/ui/views/test/webview_test_helper.cc +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ui/views/test/webview_test_helper.h" - -#include "base/message_loop.h" -#include "content/test/mock_render_process_host.h" -#include "content/test/test_browser_thread.h" -#include "content/test/test_content_client_initializer.h" -#include "content/test/test_render_view_host_factory.h" -#include "ui/views/controls/webview/webview.h" - -namespace views { - -WebViewTestHelper::WebViewTestHelper(MessageLoopForUI* ui_loop) { - test_content_client_initializer_.reset( - new content::TestContentClientInitializer); - - // Setup to register a new RenderViewHost factory which manufactures - // mock render process hosts. This ensures that we never create a 'real' - // render view host since support for it doesn't exist in unit tests. - rph_factory_.reset(new content::MockRenderProcessHostFactory()); - rvh_factory_.reset( - new content::TestRenderViewHostFactory(rph_factory_.get())); - - ui_thread_.reset( - new content::TestBrowserThread(content::BrowserThread::UI, ui_loop)); -} - -WebViewTestHelper::~WebViewTestHelper() { -} - -} // namespace views diff --git a/ui/views/test/webview_test_helper.h b/ui/views/test/webview_test_helper.h deleted file mode 100644 index 9868bcc..0000000 --- a/ui/views/test/webview_test_helper.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef UI_VIEWS_TEST_WEB_VIEW_TEST_HELPER_H_ -#define UI_VIEWS_TEST_WEB_VIEW_TEST_HELPER_H_ -#pragma once - -#include "base/memory/scoped_ptr.h" - -class MessageLoopForUI; - -namespace content { -class TestContentClientInitializer; -class TestBrowserThread; -class MockRenderProcessHostFactory; -class TestRenderViewHostFactory; -} // namespace content - -namespace views { - -class WebViewTestHelper { - public: - explicit WebViewTestHelper(MessageLoopForUI* ui_loop); - virtual ~WebViewTestHelper(); - - private: - scoped_ptr<content::TestContentClientInitializer> - test_content_client_initializer_; - - scoped_ptr<content::TestBrowserThread> ui_thread_; - - scoped_ptr<content::MockRenderProcessHostFactory> rph_factory_; - scoped_ptr<content::TestRenderViewHostFactory> rvh_factory_; - - DISALLOW_COPY_AND_ASSIGN(WebViewTestHelper); -}; - -} // namespace views - -#endif // UI_VIEWS_TEST_WEB_VIEW_TEST_HELPER_H_ diff --git a/ui/views/views.gyp b/ui/views/views.gyp index e83e467..7919b8e 100644 --- a/ui/views/views.gyp +++ b/ui/views/views.gyp @@ -451,32 +451,6 @@ ], }, # target_name: views { - 'target_name': 'test_support_views', - 'type': 'static_library', - 'dependencies': [ - '../../base/base.gyp:base', - '../../content/content.gyp:test_support_content', - '../../ipc/ipc.gyp:test_support_ipc', - '../../net/net.gyp:net_test_support', - '../../skia/skia.gyp:skia', - '../../testing/gtest.gyp:gtest', - '../ui.gyp:ui', - 'views', - ], - 'include_dirs': [ - '..', - ], - 'sources': [ - 'test/test_tooltip_client.h', - 'test/test_views_delegate.cc', - 'test/test_views_delegate.h', - 'test/views_test_base.cc', - 'test/views_test_base.h', - 'test/webview_test_helper.cc', - 'test/webview_test_helper.h', - ], - }, # target_name: test_support_views - { 'target_name': 'views_unittests', 'type': 'executable', 'dependencies': [ @@ -499,7 +473,6 @@ '../ui.gyp:ui', '../ui.gyp:ui_resources', '../ui.gyp:ui_resources_standard', - 'test_support_views', 'views', ], 'include_dirs': [ @@ -531,6 +504,11 @@ 'focus/focus_traversal_unittest.cc', 'layout/box_layout_unittest.cc', 'layout/grid_layout_unittest.cc', + 'test/test_tooltip_client.h', + 'test/test_views_delegate.cc', + 'test/test_views_delegate.h', + 'test/views_test_base.cc', + 'test/views_test_base.h', 'view_model_unittest.cc', 'view_model_utils_unittest.cc', 'view_unittest.cc', @@ -677,7 +655,6 @@ '../../chrome/chrome_resources.gyp:packed_resources', '../../content/content.gyp:content_shell_lib', '../../content/content.gyp:content', - '../../content/content.gyp:test_support_content', '../../skia/skia.gyp:skia', '../../third_party/icu/icu.gyp:icui18n', '../../third_party/icu/icu.gyp:icuuc', diff --git a/ui/views/views_delegate.h b/ui/views/views_delegate.h index 11e38f5..d1fc739 100644 --- a/ui/views/views_delegate.h +++ b/ui/views/views_delegate.h @@ -17,12 +17,6 @@ #include "ui/base/ui_base_types.h" #include "ui/views/views_export.h" -namespace content { -class WebContents; -class BrowserContext; -class SiteInstance; -} - namespace gfx { class Rect; } @@ -114,11 +108,6 @@ class VIEWS_EXPORT ViewsDelegate { virtual NativeWidgetHelperAura* CreateNativeWidgetHelper( NativeWidgetAura* native_widget) = 0; #endif - - // Creates a web contents. This will return NULL unless overriden. - virtual content::WebContents* CreateWebContents( - content::BrowserContext* browser_context, - content::SiteInstance* site_instance) = 0; }; } // namespace views |