summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorwittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-03 00:41:58 +0000
committerwittman@chromium.org <wittman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-03 00:41:58 +0000
commitd2b1657066dd75dae77a79f0d27b33c2eb708e3b (patch)
tree0fa11dccf1e81084eca2943bf7e61f3a9059a338 /chrome
parent937c4ebd57998c1fac40e5f9ed80cb8867ac661e (diff)
downloadchromium_src-d2b1657066dd75dae77a79f0d27b33c2eb708e3b.zip
chromium_src-d2b1657066dd75dae77a79f0d27b33c2eb708e3b.tar.gz
chromium_src-d2b1657066dd75dae77a79f0d27b33c2eb708e3b.tar.bz2
Rename platform-independent ConstrainedWindow types to WebContentsModalDialog types (part 2). See https://codereview.chromium.org/11647017/ for part 1.
This performs the actual class/filename renames. No functional changes are intended in this CL. R=sky@chromium.org BUG=157161 Review URL: https://chromiumcodereview.appspot.com/11633052 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@174900 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/chromeos/login/simple_web_view_dialog.cc4
-rw-r--r--chrome/browser/chromeos/login/webui_login_view.cc4
-rw-r--r--chrome/browser/download/download_danger_prompt.h2
-rw-r--r--chrome/browser/extensions/api/media_galleries/media_galleries_api.cc14
-rw-r--r--chrome/browser/extensions/platform_app_browsertest.cc12
-rw-r--r--chrome/browser/instant/instant_loader.cc27
-rw-r--r--chrome/browser/repost_form_warning_browsertest.cc16
-rw-r--r--chrome/browser/ssl/ssl_browser_tests.cc4
-rw-r--r--chrome/browser/ui/browser.cc6
-rw-r--r--chrome/browser/ui/browser.h6
-rw-r--r--chrome/browser/ui/browser_commands.cc8
-rw-r--r--chrome/browser/ui/browser_tab_contents.cc4
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm4
-rw-r--r--chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm2
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h2
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.mm2
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.mm2
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h8
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm2
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h9
-rw-r--r--chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm17
-rw-r--r--chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_browsertest.mm12
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm2
-rw-r--r--chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm8
-rw-r--r--chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm14
-rw-r--r--chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm2
-rw-r--r--chrome/browser/ui/constrained_window.cc22
-rw-r--r--chrome/browser/ui/constrained_window_tab_helper.h74
-rw-r--r--chrome/browser/ui/constrained_window_tab_helper_delegate.cc21
-rw-r--r--chrome/browser/ui/constrained_window_tab_helper_delegate.h38
-rw-r--r--chrome/browser/ui/extensions/shell_window.cc4
-rw-r--r--chrome/browser/ui/gtk/collected_cookies_gtk.h2
-rw-r--r--chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc10
-rw-r--r--chrome/browser/ui/gtk/constrained_window_gtk.cc35
-rw-r--r--chrome/browser/ui/gtk/constrained_window_gtk.h22
-rw-r--r--chrome/browser/ui/gtk/ssl_client_certificate_selector.cc2
-rw-r--r--chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_gtk.cc2
-rw-r--r--chrome/browser/ui/intents/web_intent_picker_controller.cc14
-rw-r--r--chrome/browser/ui/login/login_prompt.cc6
-rw-r--r--chrome/browser/ui/login/login_prompt.h8
-rw-r--r--chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc2
-rw-r--r--chrome/browser/ui/tab_modal_confirm_dialog_delegate.h8
-rw-r--r--chrome/browser/ui/views/autofill/autofill_dialog_views.cc5
-rw-r--r--chrome/browser/ui/views/collected_cookies_views.cc2
-rw-r--r--chrome/browser/ui/views/collected_cookies_views.h4
-rw-r--r--chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc8
-rw-r--r--chrome/browser/ui/views/constrained_window_views.cc29
-rw-r--r--chrome/browser/ui/views/constrained_window_views.h12
-rw-r--r--chrome/browser/ui/views/constrained_window_views_browsertest.cc22
-rw-r--r--chrome/browser/ui/views/ssl_client_certificate_selector.h4
-rw-r--r--chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc20
-rw-r--r--chrome/browser/ui/views/web_intent_picker_views.cc2
-rw-r--r--chrome/browser/ui/web_contents_modal_dialog.h (renamed from chrome/browser/ui/constrained_window.h)20
-rw-r--r--chrome/browser/ui/web_contents_modal_dialog_manager.cc (renamed from chrome/browser/ui/constrained_window_tab_helper.cc)63
-rw-r--r--chrome/browser/ui/web_contents_modal_dialog_manager.h74
-rw-r--r--chrome/browser/ui/web_contents_modal_dialog_manager_delegate.cc24
-rw-r--r--chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h39
-rw-r--r--chrome/browser/ui/web_contents_modal_dialog_manager_unittest.cc (renamed from chrome/browser/ui/constrained_window_tab_helper_unittest.cc)42
-rw-r--r--chrome/browser/ui/webui/certificate_viewer_webui.cc2
-rw-r--r--chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc7
-rw-r--r--chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h9
-rw-r--r--chrome/browser/ui/webui/constrained_web_dialog_ui.h10
-rw-r--r--chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc8
-rw-r--r--chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc8
-rw-r--r--chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc2
-rw-r--r--chrome/chrome_browser_ui.gypi11
-rw-r--r--chrome/chrome_tests_unit.gypi2
67 files changed, 454 insertions, 438 deletions
diff --git a/chrome/browser/chromeos/login/simple_web_view_dialog.cc b/chrome/browser/chromeos/login/simple_web_view_dialog.cc
index 57eb874..8bb2b79 100644
--- a/chrome/browser/chromeos/login/simple_web_view_dialog.cc
+++ b/chrome/browser/chromeos/login/simple_web_view_dialog.cc
@@ -15,13 +15,13 @@
#include "chrome/browser/password_manager/password_manager_delegate_impl.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/content_settings/content_setting_bubble_model_delegate.h"
#include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/location_bar/location_icon_view.h"
#include "chrome/browser/ui/views/page_info_bubble_view.h"
#include "chrome/browser/ui/views/reload_button.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/web_contents.h"
@@ -158,7 +158,7 @@ void SimpleWebViewDialog::StartLoad(const GURL& url) {
web_contents, PasswordManagerDelegateImpl::FromWebContents(web_contents));
// LoginHandlerViews uses a constrained window for the password manager view.
- ConstrainedWindowTabHelper::CreateForWebContents(web_contents);
+ WebContentsModalDialogManager::CreateForWebContents(web_contents);
}
void SimpleWebViewDialog::Init() {
diff --git a/chrome/browser/chromeos/login/webui_login_view.cc b/chrome/browser/chromeos/login/webui_login_view.cc
index 15c3ca8..4931457 100644
--- a/chrome/browser/chromeos/login/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/webui_login_view.cc
@@ -22,7 +22,7 @@
#include "chrome/browser/password_manager/password_manager_delegate_impl.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/renderer_preferences_util.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -161,7 +161,7 @@ void WebUILoginView::Init(views::Widget* login_window) {
web_contents, PasswordManagerDelegateImpl::FromWebContents(web_contents));
// LoginHandlerViews uses a constrained window for the password manager view.
- ConstrainedWindowTabHelper::CreateForWebContents(web_contents);
+ WebContentsModalDialogManager::CreateForWebContents(web_contents);
web_contents->SetDelegate(this);
renderer_preferences_util::UpdateFromSystemSettings(
diff --git a/chrome/browser/download/download_danger_prompt.h b/chrome/browser/download/download_danger_prompt.h
index f63e0dc..5a21dbd 100644
--- a/chrome/browser/download/download_danger_prompt.h
+++ b/chrome/browser/download/download_danger_prompt.h
@@ -7,8 +7,6 @@
#include "base/callback_forward.h"
-class ConstrainedWindow;
-
namespace content {
class DownloadItem;
class WebContents;
diff --git a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
index 0ae7c96..afd3d0b 100644
--- a/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
+++ b/chrome/browser/extensions/api/media_galleries/media_galleries_api.cc
@@ -19,8 +19,8 @@
#include "chrome/browser/media_gallery/media_file_system_registry.h"
#include "chrome/browser/media_gallery/media_galleries_dialog_controller.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/extensions/shell_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/api/experimental_media_galleries.h"
#include "chrome/common/extensions/api/media_galleries.h"
@@ -173,12 +173,12 @@ void MediaGalleriesGetMediaFileSystemsFunction::ReturnGalleries(
void MediaGalleriesGetMediaFileSystemsFunction::ShowDialog() {
WebContents* contents = WebContents::FromRenderViewHost(render_view_host());
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(contents);
- if (!constrained_window_tab_helper) {
- // If there is no ConstrainedWindowTabHelper, then this contents is probably
- // the background page for an app. Try to find a shell window to host the
- // dialog.
+ WebContentsModalDialogManager* web_contents_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(contents);
+ if (!web_contents_dialog_manager) {
+ // If there is no WebContentsModalDialogManager, then this contents is
+ // probably the background page for an app. Try to find a shell window to
+ // host the dialog.
ShellWindow* window = ShellWindowRegistry::Get(profile())->
GetCurrentShellWindowForApp(GetExtension()->id());
if (window) {
diff --git a/chrome/browser/extensions/platform_app_browsertest.cc b/chrome/browser/extensions/platform_app_browsertest.cc
index 1970a3d..d2715bd 100644
--- a/chrome/browser/extensions/platform_app_browsertest.cc
+++ b/chrome/browser/extensions/platform_app_browsertest.cc
@@ -24,10 +24,10 @@
#include "chrome/browser/tab_contents/render_view_context_menu.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/extensions/application_launch.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/extensions/shell_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/ui_test_utils.h"
@@ -769,15 +769,15 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_ConstrainedWindowRequest) {
WebContents* web_contents = GetFirstShellWindowWebContents();
ASSERT_TRUE(web_contents);
- // Verify that the shell window has a constrained window attached.
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- EXPECT_EQ(1u, constrained_window_tab_helper->dialog_count());
+ // Verify that the shell window has a dialog attached.
+ WebContentsModalDialogManager* web_contents_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ EXPECT_EQ(1u, web_contents_dialog_manager->dialog_count());
// Close the constrained window and wait for the reply to the permission
// request.
ExtensionTestMessageListener listener("PermissionRequestDone", false);
- constrained_window_tab_helper->CloseAllDialogs();
+ web_contents_dialog_manager->CloseAllDialogs();
ASSERT_TRUE(listener.WaitUntilSatisfied());
}
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index 389a071..c6e6874 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -11,11 +11,11 @@
#include "chrome/browser/instant/instant_controller.h"
#include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
-#include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
#include "chrome/browser/ui/search/search_tab_helper.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -46,15 +46,15 @@ class InstantLoaderUserData : public base::SupportsUserData::Data {
// WebContentsDelegateImpl -----------------------------------------------------
class InstantLoader::WebContentsDelegateImpl
- : public ConstrainedWindowTabHelperDelegate,
+ : public WebContentsModalDialogManagerDelegate,
public CoreTabHelperDelegate,
public content::WebContentsDelegate {
public:
explicit WebContentsDelegateImpl(InstantLoader* loader);
private:
- // Overridden from ConstrainedWindowTabHelperDelegate:
- virtual bool ShouldFocusConstrainedWindow() OVERRIDE;
+ // Overridden from WebContentsModalDialogManagerDelegate:
+ virtual bool ShouldFocusWebContentsModalDialog() OVERRIDE;
// Overridden from CoreTabHelperDelegate:
virtual void SwapTabContents(content::WebContents* old_contents,
@@ -90,10 +90,11 @@ InstantLoader::WebContentsDelegateImpl::WebContentsDelegateImpl(
: loader_(loader) {
}
-bool InstantLoader::WebContentsDelegateImpl::ShouldFocusConstrainedWindow() {
- // Return false so that constrained windows are not initially focused. If we
- // did otherwise the preview would prematurely get committed when focus goes
- // to the constrained window.
+bool InstantLoader::WebContentsDelegateImpl::ShouldFocusWebContentsModalDialog(
+) {
+ // Return false so that web contents modal dialogs are not initially
+ // focused. If we did otherwise the preview would prematurely get committed
+ // when focus goes to the dialog.
return false;
}
@@ -364,9 +365,9 @@ void InstantLoader::SetupPreviewContents() {
TabSpecificContentSettings::FromWebContents(contents())->
SetPopupsBlocked(true);
- // A tab helper to control constrained windows.
- ConstrainedWindowTabHelper::CreateForWebContents(contents());
- ConstrainedWindowTabHelper::FromWebContents(contents())->
+ // A manager to control web contents modal dialogs.
+ WebContentsModalDialogManager::CreateForWebContents(contents());
+ WebContentsModalDialogManager::FromWebContents(contents())->
set_delegate(delegate_.get());
// A tab helper to catch prerender content swapping shenanigans.
@@ -410,7 +411,7 @@ void InstantLoader::CleanupPreviewContents() {
TabSpecificContentSettings::FromWebContents(contents())->
SetPopupsBlocked(false);
- ConstrainedWindowTabHelper::FromWebContents(contents())->
+ WebContentsModalDialogManager::FromWebContents(contents())->
set_delegate(NULL);
CoreTabHelper::FromWebContents(contents())->set_delegate(NULL);
diff --git a/chrome/browser/repost_form_warning_browsertest.cc b/chrome/browser/repost_form_warning_browsertest.cc
index 01cc526..efc6d83 100644
--- a/chrome/browser/repost_form_warning_browsertest.cc
+++ b/chrome/browser/repost_form_warning_browsertest.cc
@@ -6,7 +6,7 @@
#include "chrome/browser/net/url_fixer_upper.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -37,19 +37,17 @@ IN_PROC_BROWSER_TEST_F(RepostFormWarningTest, TestDoubleReload) {
web_contents->GetController().Reload(true);
// There should only be one dialog open.
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- size_t num_constrained_windows =
- constrained_window_tab_helper->dialog_count();
- EXPECT_EQ(1u, num_constrained_windows);
+ WebContentsModalDialogManager* web_contents_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ size_t num_dialogs = web_contents_dialog_manager->dialog_count();
+ EXPECT_EQ(1u, num_dialogs);
// Navigate away from the page (this is when the test usually crashes).
ui_test_utils::NavigateToURL(browser(), test_server()->GetURL("bar"));
// The dialog should've been closed.
- num_constrained_windows =
- constrained_window_tab_helper->dialog_count();
- EXPECT_EQ(0u, num_constrained_windows);
+ num_dialogs = web_contents_dialog_manager->dialog_count();
+ EXPECT_EQ(0u, num_dialogs);
}
// If becomes flaky, disable on Windows and use http://crbug.com/47228
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index 4c3b143..553050c 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -16,8 +16,8 @@
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -217,7 +217,7 @@ class SSLUITest : public InProcessBrowserTest {
}
size_t GetConstrainedWindowCount() const {
- return ConstrainedWindowTabHelper::FromWebContents(
+ return WebContentsModalDialogManager::FromWebContents(
chrome::GetActiveWebContents(browser()))->dialog_count();
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 910ff0b..5cfc9b4 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -112,7 +112,6 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/extensions/shell_window.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
@@ -139,6 +138,7 @@
#include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
#include "chrome/browser/ui/unload_controller.h"
#include "chrome/browser/ui/web_applications/web_app_ui.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/ui/webui/signin/login_ui_service.h"
#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
#include "chrome/browser/ui/window_sizer/window_sizer.h"
@@ -1827,7 +1827,7 @@ void Browser::ConfirmAddSearchProvider(TemplateURL* template_url,
}
///////////////////////////////////////////////////////////////////////////////
-// Browser, ConstrainedWindowTabHelperDelegate implementation:
+// Browser, WebContentsModalDialogManagerDelegate implementation:
void Browser::SetWebContentsBlocked(content::WebContents* web_contents,
bool blocked) {
@@ -2234,7 +2234,7 @@ void Browser::SetAsDelegate(WebContents* web_contents, Browser* delegate) {
BlockedContentTabHelper::FromWebContents(web_contents)->
set_delegate(delegate);
BookmarkTabHelper::FromWebContents(web_contents)->set_delegate(delegate);
- ConstrainedWindowTabHelper::FromWebContents(web_contents)->
+ WebContentsModalDialogManager::FromWebContents(web_contents)->
set_delegate(delegate);
CoreTabHelper::FromWebContents(web_contents)->set_delegate(delegate);
SearchEngineTabHelper::FromWebContents(web_contents)->set_delegate(delegate);
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index a712d75..fe312e3 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -25,13 +25,13 @@
#include "chrome/browser/ui/bookmarks/bookmark_bar.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper_delegate.h"
#include "chrome/browser/ui/browser_navigator.h"
-#include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/search/search_model_observer.h"
#include "chrome/browser/ui/search_engines/search_engine_tab_helper_delegate.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h"
#include "chrome/browser/ui/zoom/zoom_observer.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_types.h"
@@ -101,7 +101,7 @@ class Browser : public TabStripModelObserver,
public content::WebContentsDelegate,
public CoreTabHelperDelegate,
public SearchEngineTabHelperDelegate,
- public ConstrainedWindowTabHelperDelegate,
+ public WebContentsModalDialogManagerDelegate,
public BlockedContentTabHelperDelegate,
public BookmarkTabHelperDelegate,
public ZoomObserver,
@@ -680,7 +680,7 @@ class Browser : public TabStripModelObserver,
virtual void ConfirmAddSearchProvider(TemplateURL* template_url,
Profile* profile) OVERRIDE;
- // Overridden from ConstrainedWindowTabHelperDelegate:
+ // Overridden from WebContentsModalDialogManagerDelegate:
virtual void SetWebContentsBlocked(content::WebContents* web_contents,
bool blocked) OVERRIDE;
virtual bool GetDialogTopCenter(gfx::Point* point) OVERRIDE;
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index e7e6624..fef09f5 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -42,7 +42,6 @@
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/find_bar/find_tab_helper.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
@@ -51,6 +50,7 @@
#include "chrome/browser/ui/search/search_model.h"
#include "chrome/browser/ui/status_bubble.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_switches.h"
@@ -178,9 +178,9 @@ bool HasConstrainedWindow(const Browser* browser) {
if (!web_contents)
return false;
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- return constrained_window_tab_helper->dialog_count() > 0;
+ WebContentsModalDialogManager* web_contents_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ return web_contents_dialog_manager->dialog_count() > 0;
}
bool PrintPreviewShowing(const Browser* browser) {
diff --git a/chrome/browser/ui/browser_tab_contents.cc b/chrome/browser/ui/browser_tab_contents.cc
index 54da082..4b35cc0 100644
--- a/chrome/browser/ui/browser_tab_contents.cc
+++ b/chrome/browser/ui/browser_tab_contents.cc
@@ -34,7 +34,6 @@
#include "chrome/browser/ui/autofill/tab_autofill_manager_delegate.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
#include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/find_bar/find_tab_helper.h"
#include "chrome/browser/ui/hung_plugin_tab_helper.h"
#include "chrome/browser/ui/intents/web_intent_picker_controller.h"
@@ -46,6 +45,7 @@
#include "chrome/browser/ui/snapshot_tab_helper.h"
#include "chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h"
#include "chrome/browser/ui/tab_contents/core_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/ui/zoom/zoom_controller.h"
#include "chrome/browser/view_type_utils.h"
#include "chrome/common/chrome_switches.h"
@@ -121,7 +121,7 @@ void BrowserTabContents::AttachTabHelpers(WebContents* web_contents) {
chrome_browser_net::LoadTimeStatsTabHelper::CreateForWebContents(
web_contents);
chrome_browser_net::NetErrorTabHelper::CreateForWebContents(web_contents);
- ConstrainedWindowTabHelper::CreateForWebContents(web_contents);
+ WebContentsModalDialogManager::CreateForWebContents(web_contents);
CoreTabHelper::CreateForWebContents(web_contents);
extensions::TabHelper::CreateForWebContents(web_contents);
extensions::WebNavigationTabObserver::CreateForWebContents(web_contents);
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 9e50df3..bbbc107 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -61,13 +61,13 @@
#import "chrome/browser/ui/cocoa/tabs/tab_strip_view.h"
#import "chrome/browser/ui/cocoa/tabs/tab_view.h"
#import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
#include "chrome/browser/ui/omnibox/location_bar.h"
#include "chrome/browser/ui/tabs/dock_info.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/ui/window_sizer/window_sizer.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
@@ -1509,7 +1509,7 @@ enum {
WebContents* contents = chrome::GetWebContentsAt(browser_.get(), index);
if (!contents)
return NO;
- return ConstrainedWindowTabHelper::FromWebContents(contents)->
+ return WebContentsModalDialogManager::FromWebContents(contents)->
dialog_count() == 0;
}
diff --git a/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm b/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm
index 178111e..dd710c11 100644
--- a/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm
+++ b/chrome/browser/ui/cocoa/constrained_web_dialog_delegate_mac.mm
@@ -46,7 +46,7 @@ class ConstrainedWebDialogDelegateMac :
virtual void ReleaseWebContentsOnDialogClose() OVERRIDE {
return impl_->ReleaseWebContentsOnDialogClose();
}
- virtual ConstrainedWindow* GetWindow() OVERRIDE {
+ virtual WebContentsModalDialog* GetWindow() OVERRIDE {
return impl_->GetWindow();
}
virtual WebContents* GetWebContents() OVERRIDE {
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h b/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h
index a4b4f18..899e6cf 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h
@@ -11,7 +11,7 @@
// This class implements an alert that has a constrained window look and feel
// (close button on top right, WebUI style buttons, etc...). To use this class
-// subclass ConstrainedWindow and create an instance of this class.
+// subclass WebContentsModalDialog and create an instance of this class.
// The alert can be shown by using the window accessor and calling
// -[window orderFont:]. Normally this would be done by
// ConstrainedWindowSheetController.
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.mm
index 6dbb894..78462e1 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.mm
@@ -10,7 +10,7 @@
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h"
#import "chrome/browser/ui/cocoa/hover_close_button.h"
-#import "chrome/browser/ui/constrained_window.h"
+#import "chrome/browser/ui/web_contents_modal_dialog.h"
#include "skia/ext/skia_utils_mac.h"
#include "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
#include "ui/base/cocoa/window_size_constants.h"
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.mm
index 698a538..199c4f9 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_control_utils.h"
#include "base/memory/scoped_nsobject.h"
-#include "chrome/browser/ui/constrained_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "skia/ext/skia_utils_mac.h"
namespace constrained_window {
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h
index d451d70..18b3dac 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.h
@@ -12,11 +12,11 @@
// A NSWindow subclass that gives a custom look (rounded corners and white
// background).
//
-// Unfortunately the word "window" here is overused. ConstrainedWindow is the
-// tab modal dialog controller. ConstrainedWindowCustomWindow is the custom
-// NSWindow that gives us the new look (rounded corners and white background).
+// Note that WebContentsModalDialog is the web contents modal dialog
+// controller. ConstrainedWindowCustomWindow is the custom NSWindow that gives
+// us the new look (rounded corners and white background).
//
-// If a ConstrainedWindow is using ConstrainedWindowAlert to display its UI
+// If a WebContentsModalDialog is using ConstrainedWindowAlert to display its UI
// then it doesn't have to use this class. On the other hand, if it has some
// custom UI (say from a nib) then it should use this class.
@interface ConstrainedWindowCustomWindow : ChromeEventProcessingWindow
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm
index b7c87f8..18b5298 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm
@@ -7,7 +7,7 @@
#import "base/memory/scoped_nsobject.h"
#import "chrome/browser/ui/chrome_style.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h"
-#import "chrome/browser/ui/constrained_window.h"
+#import "chrome/browser/ui/web_contents_modal_dialog.h"
#include "skia/ext/skia_utils_mac.h"
@implementation ConstrainedWindowCustomWindow
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h
index 4116a29..80ac59a 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h
@@ -8,7 +8,7 @@
#import <Cocoa/Cocoa.h>
#include "base/memory/scoped_nsobject.h"
-#include "chrome/browser/ui/constrained_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -28,7 +28,7 @@ class ConstrainedWindowMacDelegate {
// Constrained window implementation for Mac.
// Normally an instance of this class is owned by the delegate. The delegate
// should delete the instance when the window is closed.
-class ConstrainedWindowMac : public ConstrainedWindow,
+class ConstrainedWindowMac : public WebContentsModalDialog,
public content::NotificationObserver {
public:
ConstrainedWindowMac(
@@ -37,10 +37,11 @@ class ConstrainedWindowMac : public ConstrainedWindow,
id<ConstrainedWindowSheet> sheet);
virtual ~ConstrainedWindowMac();
- // ConstrainedWindow implementation.
+ // WebContentsModalDialog implementation.
virtual void ShowWebContentsModalDialog() OVERRIDE;
// Closes the constrained window and deletes this instance.
virtual void CloseWebContentsModalDialog() OVERRIDE;
+ virtual void FocusWebContentsModalDialog() OVERRIDE;
virtual void PulseWebContentsModalDialog() OVERRIDE;
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
virtual bool CanShowWebContentsModalDialog() OVERRIDE;
@@ -56,7 +57,7 @@ class ConstrainedWindowMac : public ConstrainedWindow,
ConstrainedWindowMacDelegate* delegate_; // weak, owns us.
- // The WebContents that owns and constrains this ConstrainedWindow. Weak.
+ // The WebContents that owns and constrains this WebContentsModalDialog. Weak.
content::WebContents* web_contents_;
scoped_nsprotocol<id<ConstrainedWindowSheet>> sheet_;
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
index 6176715..e8f8d32 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.mm
@@ -10,7 +10,7 @@
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h"
#import "chrome/browser/ui/cocoa/tabs/tab_strip_controller.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
@@ -27,9 +27,9 @@ ConstrainedWindowMac::ConstrainedWindowMac(
pending_show_(false) {
DCHECK(web_contents);
DCHECK(sheet_.get());
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- constrained_window_tab_helper->AddDialog(this);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ web_contents_modal_dialog_manager->AddDialog(this);
registrar_.Add(this,
content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
@@ -61,13 +61,16 @@ void ConstrainedWindowMac::CloseWebContentsModalDialog() {
[[ConstrainedWindowSheetController controllerForSheet:sheet_]
closeSheet:sheet_];
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->WillClose(this);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->WillClose(this);
if (delegate_)
delegate_->OnConstrainedWindowClosed(this);
}
+void ConstrainedWindowMac::FocusWebContentsModalDialog() {
+}
+
void ConstrainedWindowMac::PulseWebContentsModalDialog() {
[[ConstrainedWindowSheetController controllerForSheet:sheet_]
pulseSheet:sheet_];
diff --git a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_browsertest.mm b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_browsertest.mm
index ea2c15e..7be70c1 100644
--- a/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_browsertest.mm
+++ b/chrome/browser/ui/cocoa/content_settings/collected_cookies_mac_browsertest.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/content_settings/collected_cookies_mac.h"
#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/test_utils.h"
@@ -13,18 +13,18 @@ typedef InProcessBrowserTest CollectedCookiesMacTest;
IN_PROC_BROWSER_TEST_F(CollectedCookiesMacTest, Close) {
content::WebContents* web_contents = chrome::GetActiveWebContents(browser());
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- EXPECT_EQ(0u, constrained_window_tab_helper->dialog_count());
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ EXPECT_EQ(0u, web_contents_modal_dialog_manager->dialog_count());
// Deletes itself.
CollectedCookiesMac* dialog =
new CollectedCookiesMac(chrome::GetActiveWebContents(browser()));
- EXPECT_EQ(1u, constrained_window_tab_helper->dialog_count());
+ EXPECT_EQ(1u, web_contents_modal_dialog_manager->dialog_count());
dialog->PerformClose();
content::RunAllPendingInMessageLoop();
- EXPECT_EQ(0u, constrained_window_tab_helper->dialog_count());
+ EXPECT_EQ(0u, web_contents_modal_dialog_manager->dialog_count());
}
IN_PROC_BROWSER_TEST_F(CollectedCookiesMacTest, Outlets) {
diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
index 7c2e5f0..8969b4a 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_install_view_controller.mm
@@ -14,7 +14,7 @@
#include "chrome/browser/extensions/bundle_installer.h"
#import "chrome/browser/ui/chrome_style.h"
#import "chrome/browser/ui/cocoa/hyperlink_button_cell.h"
-#include "chrome/browser/ui/constrained_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "chrome/common/extensions/extension.h"
#include "content/public/browser/page_navigator.h"
#include "grit/generated_resources.h"
diff --git a/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm
index d6ed91f..80c5c5b 100644
--- a/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm
+++ b/chrome/browser/ui/cocoa/extensions/media_galleries_dialog_cocoa_browsertest.mm
@@ -7,7 +7,7 @@
#include "chrome/browser/media_gallery/media_galleries_dialog_controller_mock.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -40,9 +40,9 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesDialogBrowserTest, Close) {
scoped_nsobject<NSWindow> window([[dialog->alert_ window] retain]);
EXPECT_TRUE([window isVisible]);
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- constrained_window_tab_helper->CloseAllDialogs();
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ web_contents_modal_dialog_manager->CloseAllDialogs();
EXPECT_FALSE([window isVisible]);
}
diff --git a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm
index 66d63d4..d979f12 100644
--- a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm
+++ b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa_browsertest.mm
@@ -10,7 +10,7 @@
#include "chrome/browser/ssl/ssl_client_certificate_selector_test.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/ssl/ssl_client_certificate_selector.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
@@ -33,9 +33,9 @@ typedef SSLClientCertificateSelectorTestBase
IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, Basic) {
content::WebContents* web_contents = chrome::GetActiveWebContents(browser());
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- EXPECT_EQ(0u, constrained_window_tab_helper->dialog_count());
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ EXPECT_EQ(0u, web_contents_modal_dialog_manager->dialog_count());
net::X509Certificate* cert = NULL;
int count = 0;
@@ -49,11 +49,11 @@ IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorCocoaTest, Basic) {
[selector displayForWebContents:web_contents];
content::RunAllPendingInMessageLoop();
EXPECT_TRUE([selector panel]);
- EXPECT_EQ(1u, constrained_window_tab_helper->dialog_count());
+ EXPECT_EQ(1u, web_contents_modal_dialog_manager->dialog_count());
- constrained_window_tab_helper->CloseAllDialogs();
+ web_contents_modal_dialog_manager->CloseAllDialogs();
content::RunAllPendingInMessageLoop();
- EXPECT_EQ(0u, constrained_window_tab_helper->dialog_count());
+ EXPECT_EQ(0u, web_contents_modal_dialog_manager->dialog_count());
EXPECT_EQ(NULL, cert);
EXPECT_EQ(1, count);
diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
index 423a9ed..2e93810 100644
--- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
@@ -46,7 +46,6 @@
#import "chrome/browser/ui/cocoa/tabs/tab_projecting_image_view.h"
#import "chrome/browser/ui/cocoa/tabs/throbbing_image_view.h"
#import "chrome/browser/ui/cocoa/tracking_area.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/find_bar/find_bar_controller.h"
#include "chrome/browser/ui/find_bar/find_tab_helper.h"
@@ -54,6 +53,7 @@
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "chrome/browser/ui/tabs/tab_utils.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/navigation_controller.h"
diff --git a/chrome/browser/ui/constrained_window.cc b/chrome/browser/ui/constrained_window.cc
deleted file mode 100644
index 44d4201a..0000000
--- a/chrome/browser/ui/constrained_window.cc
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2011 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 "chrome/browser/ui/constrained_window.h"
-
-#include "base/logging.h"
-
-void ConstrainedWindow::FocusWebContentsModalDialog() {
-}
-
-void ConstrainedWindow::PulseWebContentsModalDialog() {
-}
-
-bool ConstrainedWindow::CanShowWebContentsModalDialog() {
- return true;
-}
-
-gfx::NativeWindow ConstrainedWindow::GetNativeWindow() {
- NOTREACHED();
- return NULL;
-}
diff --git a/chrome/browser/ui/constrained_window_tab_helper.h b/chrome/browser/ui/constrained_window_tab_helper.h
deleted file mode 100644
index f62176d..0000000
--- a/chrome/browser/ui/constrained_window_tab_helper.h
+++ /dev/null
@@ -1,74 +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 CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_
-#define CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_
-
-#include <deque>
-
-#include "content/public/browser/web_contents_observer.h"
-#include "content/public/browser/web_contents_user_data.h"
-
-class ConstrainedWindow;
-class ConstrainedWindowTabHelperDelegate;
-
-// Per-tab class to manage constrained windows.
-class ConstrainedWindowTabHelper
- : public content::WebContentsObserver,
- public content::WebContentsUserData<ConstrainedWindowTabHelper> {
- public:
- virtual ~ConstrainedWindowTabHelper();
-
- ConstrainedWindowTabHelperDelegate* delegate() const { return delegate_; }
- void set_delegate(ConstrainedWindowTabHelperDelegate* d) { delegate_ = d; }
-
- // Adds the given window to the list of child windows. The window will notify
- // via WillClose() when it is being destroyed.
- void AddDialog(ConstrainedWindow* window);
-
- // Closes all WebContentsModalDialogs.
- void CloseAllDialogs();
-
- // Called when a WebContentsModalDialogs we own is about to be closed.
- void WillClose(ConstrainedWindow* window);
-
- // Blocks/unblocks interaction with renderer process.
- void BlockWebContentsInteraction(bool blocked);
-
- // Returns the number of constrained windows in this tab.
- size_t dialog_count() { return child_dialogs_.size(); }
-
- typedef std::deque<ConstrainedWindow*> WebContentsModalDialogList;
-
- // Return an iterator for the first constrained window in this web contents.
- WebContentsModalDialogList::iterator dialog_begin() {
- return child_dialogs_.begin();
- }
-
- // Return an iterator for the last constrained window in this web contents.
- WebContentsModalDialogList::iterator dialog_end() {
- return child_dialogs_.end();
- }
-
- private:
- explicit ConstrainedWindowTabHelper(content::WebContents* web_contents);
- friend class content::WebContentsUserData<ConstrainedWindowTabHelper>;
-
- // Overridden from content::WebContentsObserver:
- virtual void DidNavigateMainFrame(
- const content::LoadCommittedDetails& details,
- const content::FrameNavigateParams& params) OVERRIDE;
- virtual void DidGetIgnoredUIEvent() OVERRIDE;
- virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE;
-
- // Delegate for notifying our owner about stuff. Not owned by us.
- ConstrainedWindowTabHelperDelegate* delegate_;
-
- // All active constrained windows.
- WebContentsModalDialogList child_dialogs_;
-
- DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowTabHelper);
-};
-
-#endif // CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_
diff --git a/chrome/browser/ui/constrained_window_tab_helper_delegate.cc b/chrome/browser/ui/constrained_window_tab_helper_delegate.cc
deleted file mode 100644
index 512eee9..0000000
--- a/chrome/browser/ui/constrained_window_tab_helper_delegate.cc
+++ /dev/null
@@ -1,21 +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 "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
-
-#include <string.h>
-
-bool ConstrainedWindowTabHelperDelegate::ShouldFocusConstrainedWindow() {
- return true;
-}
-
-void ConstrainedWindowTabHelperDelegate::SetWebContentsBlocked(
- content::WebContents* web_contents, bool blocked) {
-}
-
-ConstrainedWindowTabHelperDelegate::~ConstrainedWindowTabHelperDelegate() {}
-
-bool ConstrainedWindowTabHelperDelegate::GetDialogTopCenter(gfx::Point* point) {
- return false;
-}
diff --git a/chrome/browser/ui/constrained_window_tab_helper_delegate.h b/chrome/browser/ui/constrained_window_tab_helper_delegate.h
deleted file mode 100644
index d7de24e..0000000
--- a/chrome/browser/ui/constrained_window_tab_helper_delegate.h
+++ /dev/null
@@ -1,38 +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 CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_DELEGATE_H_
-#define CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_DELEGATE_H_
-
-namespace content {
-class WebContents;
-}
-
-namespace gfx {
-class Point;
-}
-
-class ConstrainedWindowTabHelperDelegate {
- public:
- // Returns true if constrained windows should be focused. Default is true.
- virtual bool ShouldFocusConstrainedWindow();
-
- // Changes the blocked state of |web_contents|. WebContentses are considered
- // blocked while displaying a tab modal dialog. During that time renderer host
- // will ignore any UI interaction within WebContents outside of the
- // currently displaying dialog.
- virtual void SetWebContentsBlocked(content::WebContents* web_contents,
- bool blocked);
-
- // Fills in |point| with the coordinates for positioning chrome style
- // constrained windows. The constrained window should position itself such
- // that its top center is at |point|. Return false if the default position
- // should be used.
- virtual bool GetDialogTopCenter(gfx::Point* point);
-
- protected:
- virtual ~ConstrainedWindowTabHelperDelegate();
-};
-
-#endif // CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_DELEGATE_H_
diff --git a/chrome/browser/ui/extensions/shell_window.cc b/chrome/browser/ui/extensions/shell_window.cc
index 6e91482..c930eb7 100644
--- a/chrome/browser/ui/extensions/shell_window.cc
+++ b/chrome/browser/ui/extensions/shell_window.cc
@@ -23,9 +23,9 @@
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/extensions/native_app_window.h"
#include "chrome/browser/ui/intents/web_intent_picker_controller.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/view_type_utils.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/api/app_window.h"
@@ -125,7 +125,7 @@ void ShellWindow::Init(const GURL& url,
web_contents_.reset(WebContents::Create(WebContents::CreateParams(
profile(), SiteInstance::CreateForURL(profile(), url))));
- ConstrainedWindowTabHelper::CreateForWebContents(web_contents_.get());
+ WebContentsModalDialogManager::CreateForWebContents(web_contents_.get());
FaviconTabHelper::CreateForWebContents(web_contents_.get());
WebIntentPickerController::CreateForWebContents(web_contents_.get());
diff --git a/chrome/browser/ui/gtk/collected_cookies_gtk.h b/chrome/browser/ui/gtk/collected_cookies_gtk.h
index 4a16ca0..0ed8331 100644
--- a/chrome/browser/ui/gtk/collected_cookies_gtk.h
+++ b/chrome/browser/ui/gtk/collected_cookies_gtk.h
@@ -87,7 +87,7 @@ class CollectedCookiesGtk : public ConstrainedWindowGtkDelegate,
content::NotificationRegistrar registrar_;
- ConstrainedWindow* window_;
+ WebContentsModalDialog* window_;
// Widgets of the dialog.
GtkWidget* dialog_;
diff --git a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc
index e59def4..267a832 100644
--- a/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc
+++ b/chrome/browser/ui/gtk/constrained_web_dialog_delegate_gtk.cc
@@ -28,8 +28,8 @@ class ConstrainedWebDialogDelegateGtk : public ConstrainedWindowGtkDelegate,
virtual ~ConstrainedWebDialogDelegateGtk() {}
- void set_window(ConstrainedWindow* window) {
- return impl_->set_window(window);
+ void set_window(WebContentsModalDialog* dialog) {
+ return impl_->set_window(dialog);
}
// ConstrainedWebDialogDelegate interface
@@ -46,7 +46,7 @@ class ConstrainedWebDialogDelegateGtk : public ConstrainedWindowGtkDelegate,
virtual void ReleaseWebContentsOnDialogClose() OVERRIDE {
return impl_->ReleaseWebContentsOnDialogClose();
}
- virtual ConstrainedWindow* GetWindow() OVERRIDE {
+ virtual WebContentsModalDialog* GetWindow() OVERRIDE {
return impl_->GetWindow();
}
virtual WebContents* GetWebContents() OVERRIDE {
@@ -99,8 +99,8 @@ ConstrainedWebDialogDelegate* CreateConstrainedWebDialog(
ConstrainedWebDialogDelegateGtk* constrained_delegate =
new ConstrainedWebDialogDelegateGtk(
browser_context, delegate, tab_delegate);
- ConstrainedWindow* constrained_window =
+ WebContentsModalDialog* web_contents_modal_dialog =
new ConstrainedWindowGtk(web_contents, constrained_delegate);
- constrained_delegate->set_window(constrained_window);
+ constrained_delegate->set_window(web_contents_modal_dialog);
return constrained_delegate;
}
diff --git a/chrome/browser/ui/gtk/constrained_window_gtk.cc b/chrome/browser/ui/gtk/constrained_window_gtk.cc
index 2894dbc..dbe8958 100644
--- a/chrome/browser/ui/gtk/constrained_window_gtk.cc
+++ b/chrome/browser/ui/gtk/constrained_window_gtk.cc
@@ -9,10 +9,10 @@
#include "base/bind.h"
#include "base/message_loop.h"
#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
-#include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_gtk.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/gtk/focus_store_gtk.h"
@@ -73,9 +73,9 @@ ConstrainedWindowGtk::ConstrainedWindowGtk(
g_signal_connect(widget(), "hierarchy-changed",
G_CALLBACK(OnHierarchyChangedThunk), this);
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->AddDialog(this);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->AddDialog(this);
}
ConstrainedWindowGtk::~ConstrainedWindowGtk() {
@@ -96,9 +96,9 @@ void ConstrainedWindowGtk::CloseWebContentsModalDialog() {
if (visible_)
ContainingView()->RemoveConstrainedWindow(this);
delegate_->DeleteDelegate();
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->WillClose(this);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->WillClose(this);
delete this;
}
@@ -110,10 +110,10 @@ void ConstrainedWindowGtk::FocusWebContentsModalDialog() {
// The user may have focused another tab. In this case do not grab focus
// until this tab is refocused.
- ConstrainedWindowTabHelper* helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- if ((!helper->delegate() ||
- helper->delegate()->ShouldFocusConstrainedWindow()) &&
+ WebContentsModalDialogManager* manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ if ((!manager->delegate() ||
+ manager->delegate()->ShouldFocusWebContentsModalDialog()) &&
gtk_util::IsWidgetAncestryVisible(focus_widget)) {
gtk_widget_grab_focus(focus_widget);
} else {
@@ -121,6 +121,17 @@ void ConstrainedWindowGtk::FocusWebContentsModalDialog() {
}
}
+void ConstrainedWindowGtk::PulseWebContentsModalDialog() {
+}
+
+bool ConstrainedWindowGtk::CanShowWebContentsModalDialog() {
+ return true;
+}
+
+gfx::NativeWindow ConstrainedWindowGtk::GetNativeWindow() {
+ return GTK_WINDOW(gtk_widget_get_toplevel(widget()));
+}
+
void ConstrainedWindowGtk::BackgroundColorChanged() {
GdkColor background;
if (delegate_->GetBackgroundColor(&background)) {
diff --git a/chrome/browser/ui/gtk/constrained_window_gtk.h b/chrome/browser/ui/gtk/constrained_window_gtk.h
index 11ad3c3..3c8e3e7e 100644
--- a/chrome/browser/ui/gtk/constrained_window_gtk.h
+++ b/chrome/browser/ui/gtk/constrained_window_gtk.h
@@ -10,7 +10,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
-#include "chrome/browser/ui/constrained_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "ui/base/gtk/gtk_signal.h"
#include "ui/base/gtk/owned_widget_gtk.h"
@@ -26,7 +26,8 @@ class ConstrainedWindowGtkDelegate {
// Returns the widget that will be put in the constrained window's container.
virtual GtkWidget* GetWidgetRoot() = 0;
- // Returns the widget that should get focus when ConstrainedWindow is focused.
+ // Returns the widget that should get focus when WebContentsModalDialog is
+ // focused.
virtual GtkWidget* GetFocusWidget() = 0;
// Tells the delegate to either delete itself or set up a task to delete
@@ -42,10 +43,10 @@ class ConstrainedWindowGtkDelegate {
virtual ~ConstrainedWindowGtkDelegate();
};
-// Constrained window implementation for the GTK port. Unlike the Win32 system,
-// ConstrainedWindowGtk doesn't draw draggable fake windows and instead just
-// centers the dialog. It is thus an order of magnitude simpler.
-class ConstrainedWindowGtk : public ConstrainedWindow {
+// WebContentsModalDialog implementation for the GTK port. Unlike the Win32
+// system, ConstrainedWindowGtk doesn't draw draggable fake windows and instead
+// just centers the dialog. It is thus an order of magnitude simpler.
+class ConstrainedWindowGtk : public WebContentsModalDialog {
public:
typedef ChromeWebContentsViewDelegateGtk TabContentsViewType;
@@ -53,10 +54,13 @@ class ConstrainedWindowGtk : public ConstrainedWindow {
ConstrainedWindowGtkDelegate* delegate);
virtual ~ConstrainedWindowGtk();
- // Overridden from ConstrainedWindow:
+ // Overridden from WebContentsModalDialog:
virtual void ShowWebContentsModalDialog() OVERRIDE;
virtual void CloseWebContentsModalDialog() OVERRIDE;
virtual void FocusWebContentsModalDialog() OVERRIDE;
+ virtual void PulseWebContentsModalDialog() OVERRIDE;
+ virtual bool CanShowWebContentsModalDialog() OVERRIDE;
+ virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
// Called when the result of GetBackgroundColor may have changed.
void BackgroundColorChanged();
@@ -71,7 +75,7 @@ class ConstrainedWindowGtk : public ConstrainedWindow {
TabContentsViewType* ContainingView();
private:
- friend class ConstrainedWindow;
+ friend class WebContentsModalDialog;
// Signal callbacks.
CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, gboolean, OnKeyPress,
@@ -79,7 +83,7 @@ class ConstrainedWindowGtk : public ConstrainedWindow {
CHROMEGTK_CALLBACK_1(ConstrainedWindowGtk, void, OnHierarchyChanged,
GtkWidget*);
- // The WebContents that owns and constrains this ConstrainedWindow.
+ // The WebContents that owns and constrains this WebContentsModalDialog.
content::WebContents* web_contents_;
// The top level widget container that exports to our WebContentsView.
diff --git a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc
index d54bc50..51ecba0 100644
--- a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc
+++ b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc
@@ -93,7 +93,7 @@ class SSLClientCertificateSelector : public SSLClientAuthObserver,
GtkWidget* select_button_;
WebContents* web_contents_;
- ConstrainedWindow* window_;
+ WebContentsModalDialog* window_;
DISALLOW_COPY_AND_ASSIGN(SSLClientCertificateSelector);
};
diff --git a/chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_gtk.cc b/chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_gtk.cc
index 2b82654..f7e227c 100644
--- a/chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_gtk.cc
+++ b/chrome/browser/ui/gtk/tab_contents/chrome_web_contents_view_delegate_gtk.cc
@@ -172,7 +172,7 @@ void ChromeWebContentsViewDelegateGtk::OnSetFloatingPosition(
if (!constrained_window_)
return;
- // Place each ConstrainedWindow in the center of the view.
+ // Place each WebContentsModalDialog in the center of the view.
GtkWidget* widget = constrained_window_->widget();
DCHECK(gtk_widget_get_parent(widget) == floating_.get());
diff --git a/chrome/browser/ui/intents/web_intent_picker_controller.cc b/chrome/browser/ui/intents/web_intent_picker_controller.cc
index bcc3b92..5b54493 100644
--- a/chrome/browser/ui/intents/web_intent_picker_controller.cc
+++ b/chrome/browser/ui/intents/web_intent_picker_controller.cc
@@ -31,11 +31,11 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/intents/web_intent_icon_loader.h"
#include "chrome/browser/ui/intents/web_intent_picker.h"
#include "chrome/browser/ui/intents/web_intent_picker_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
@@ -239,9 +239,9 @@ void WebIntentPickerController::ShowDialog(DefaultsUsage suppress_defaults) {
// As soon as the dialog is requested, block all input events
// on the original tab.
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->BlockWebContentsInteraction(true);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->BlockWebContentsInteraction(true);
SetDialogState(kPickerSetup);
pending_async_count_++;
@@ -703,9 +703,9 @@ void WebIntentPickerController::Reset() {
picker_shown_ = false;
DCHECK(web_contents_);
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->BlockWebContentsInteraction(false);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->BlockWebContentsInteraction(false);
}
void WebIntentPickerController::OnShowExtensionInstallDialog(
diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc
index cff1096..839570e 100644
--- a/chrome/browser/ui/login/login_prompt.cc
+++ b/chrome/browser/ui/login/login_prompt.cc
@@ -12,7 +12,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/password_manager/password_manager.h"
#include "chrome/browser/tab_contents/tab_util.h"
-#include "chrome/browser/ui/constrained_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_registrar.h"
@@ -242,7 +242,7 @@ void LoginHandler::SetModel(LoginModel* model) {
login_model_->SetObserver(this);
}
-void LoginHandler::SetDialog(ConstrainedWindow* dialog) {
+void LoginHandler::SetDialog(WebContentsModalDialog* dialog) {
dialog_ = dialog;
}
@@ -377,7 +377,7 @@ void LoginHandler::CancelAuthDeferred() {
void LoginHandler::CloseContentsDeferred() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- // The hosting ConstrainedWindow may have been freed.
+ // The hosting WebContentsModalDialog may have been freed.
if (dialog_)
dialog_->CloseWebContentsModalDialog();
}
diff --git a/chrome/browser/ui/login/login_prompt.h b/chrome/browser/ui/login/login_prompt.h
index ad755a0..2197811 100644
--- a/chrome/browser/ui/login/login_prompt.h
+++ b/chrome/browser/ui/login/login_prompt.h
@@ -13,7 +13,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/resource_dispatcher_host_login_delegate.h"
-class ConstrainedWindow;
+class WebContentsModalDialog;
class GURL;
namespace content {
@@ -83,7 +83,7 @@ class LoginHandler : public content::ResourceDispatcherHostLoginDelegate,
void SetModel(LoginModel* model);
- void SetDialog(ConstrainedWindow* dialog);
+ void SetDialog(WebContentsModalDialog* dialog);
// Notify observers that authentication is needed.
void NotifyAuthNeeded();
@@ -123,9 +123,9 @@ class LoginHandler : public content::ResourceDispatcherHostLoginDelegate,
bool handled_auth_;
mutable base::Lock handled_auth_lock_;
- // The ConstrainedWindow that is hosting our LoginView.
+ // The WebContentsModalDialog that is hosting our LoginView.
// This should only be accessed on the UI loop.
- ConstrainedWindow* dialog_;
+ WebContentsModalDialog* dialog_;
// Who/where/what asked for the authentication.
scoped_refptr<net::AuthChallengeInfo> auth_info_;
diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
index 9515bcae..e6a0f1c 100644
--- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
+++ b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
-#include "chrome/browser/ui/constrained_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/notification_source.h"
diff --git a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h
index b4c44bc..3045adb 100644
--- a/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h
+++ b/chrome/browser/ui/tab_modal_confirm_dialog_delegate.h
@@ -11,7 +11,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
-class ConstrainedWindow;
+class WebContentsModalDialog;
namespace content {
class WebContents;
@@ -28,7 +28,7 @@ class TabModalConfirmDialogDelegate : public content::NotificationObserver {
explicit TabModalConfirmDialogDelegate(content::WebContents* web_contents);
virtual ~TabModalConfirmDialogDelegate();
- void set_window(ConstrainedWindow* window) { window_ = window; }
+ void set_window(WebContentsModalDialog* window) { window_ = window; }
// Accepts the confirmation prompt and calls |OnAccepted|.
// This method is safe to call even from an |OnAccepted| or |OnCanceled|
@@ -62,7 +62,7 @@ class TabModalConfirmDialogDelegate : public content::NotificationObserver {
virtual const char* GetCancelButtonIcon();
protected:
- ConstrainedWindow* window() { return window_; }
+ WebContentsModalDialog* window() { return window_; }
// content::NotificationObserver implementation.
// Watch for a new load or a closed tab and dismiss the dialog if they occur.
@@ -80,7 +80,7 @@ class TabModalConfirmDialogDelegate : public content::NotificationObserver {
// Close the dialog.
void CloseDialog();
- ConstrainedWindow* window_;
+ WebContentsModalDialog* window_;
// True iff we are in the process of closing, to avoid running callbacks
// multiple times.
bool closing_;
diff --git a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
index 27796a0..b549b25 100644
--- a/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_dialog_views.cc
@@ -90,8 +90,9 @@ AutofillDialogViews::~AutofillDialogViews() {
void AutofillDialogViews::Show() {
InitChildViews();
- // Ownership of |contents_| is handed off by this call. The ConstrainedWindow
- // will take care of deleting itself after calling DeleteDelegate().
+ // Ownership of |contents_| is handed off by this call. The
+ // WebContentsModalDialog will take care of deleting itself after calling
+ // DeleteDelegate().
window_ = new ConstrainedWindowViews(controller_->web_contents(), this);
window_->GetFocusManager()->AddFocusChangeListener(this);
}
diff --git a/chrome/browser/ui/views/collected_cookies_views.cc b/chrome/browser/ui/views/collected_cookies_views.cc
index 619be41..4de3fee 100644
--- a/chrome/browser/ui/views/collected_cookies_views.cc
+++ b/chrome/browser/ui/views/collected_cookies_views.cc
@@ -19,9 +19,9 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/collected_cookies_infobar_delegate.h"
-#include "chrome/browser/ui/constrained_window.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "chrome/browser/ui/views/cookie_info_view.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/notification_details.h"
diff --git a/chrome/browser/ui/views/collected_cookies_views.h b/chrome/browser/ui/views/collected_cookies_views.h
index 1ae5d97..c641ab3 100644
--- a/chrome/browser/ui/views/collected_cookies_views.h
+++ b/chrome/browser/ui/views/collected_cookies_views.h
@@ -14,7 +14,7 @@
#include "ui/views/controls/tree/tree_view_controller.h"
#include "ui/views/window/dialog_delegate.h"
-class ConstrainedWindow;
+class WebContentsModalDialog;
class CookieInfoView;
class CookiesTreeModel;
class InfobarView;
@@ -89,7 +89,7 @@ class CollectedCookiesViews : public views::DialogDelegateView,
content::NotificationRegistrar registrar_;
- ConstrainedWindow* window_;
+ WebContentsModalDialog* window_;
// The web contents.
content::WebContents* web_contents_;
diff --git a/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc b/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
index d4d93bc..3a13d3f 100644
--- a/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
+++ b/chrome/browser/ui/views/constrained_web_dialog_delegate_views.cc
@@ -79,7 +79,7 @@ class ConstrainedWebDialogDelegateViewViews
WebDialogWebContentsDelegate* tab_delegate);
virtual ~ConstrainedWebDialogDelegateViewViews();
- void set_window(ConstrainedWindow* window) {
+ void set_window(WebContentsModalDialog* window) {
return impl_->set_window(window);
}
@@ -97,7 +97,7 @@ class ConstrainedWebDialogDelegateViewViews
virtual void ReleaseWebContentsOnDialogClose() OVERRIDE {
return impl_->ReleaseWebContentsOnDialogClose();
}
- virtual ConstrainedWindow* GetWindow() OVERRIDE {
+ virtual WebContentsModalDialog* GetWindow() OVERRIDE {
return impl_->GetWindow();
}
virtual WebContents* GetWebContents() OVERRIDE {
@@ -197,8 +197,8 @@ ConstrainedWebDialogDelegate* CreateConstrainedWebDialog(
ConstrainedWebDialogDelegateViewViews* constrained_delegate =
new ConstrainedWebDialogDelegateViewViews(
browser_context, delegate, tab_delegate);
- ConstrainedWindow* constrained_window =
+ WebContentsModalDialog* web_contents_modal_dialog =
new ConstrainedWindowViews(web_contents, constrained_delegate);
- constrained_delegate->set_window(constrained_window);
+ constrained_delegate->set_window(web_contents_modal_dialog);
return constrained_delegate;
}
diff --git a/chrome/browser/ui/views/constrained_window_views.cc b/chrome/browser/ui/views/constrained_window_views.cc
index 6e1908b..46aad8b 100644
--- a/chrome/browser/ui/views/constrained_window_views.cc
+++ b/chrome/browser/ui/views/constrained_window_views.cc
@@ -12,9 +12,9 @@
#include "chrome/browser/platform_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/theme_service.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/toolbar/toolbar_model.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/common/chrome_constants.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
@@ -584,9 +584,9 @@ ConstrainedWindowViews::ConstrainedWindowViews(
#endif
Init(params);
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->AddDialog(this);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->AddDialog(this);
#if defined(USE_ASH)
GetNativeWindow()->SetProperty(ash::kConstrainedWindowKey, true);
views::corewm::SetModalParent(GetNativeWindow(),
@@ -614,10 +614,10 @@ void ConstrainedWindowViews::CloseWebContentsModalDialog() {
}
void ConstrainedWindowViews::FocusWebContentsModalDialog() {
- ConstrainedWindowTabHelper* helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- if ((!helper->delegate() ||
- helper->delegate()->ShouldFocusConstrainedWindow()) &&
+ WebContentsModalDialogManager* manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ if ((!manager->delegate() ||
+ manager->delegate()->ShouldFocusWebContentsModalDialog()) &&
widget_delegate() &&
widget_delegate()->GetInitiallyFocusedView()) {
widget_delegate()->GetInitiallyFocusedView()->RequestFocus();
@@ -629,6 +629,13 @@ void ConstrainedWindowViews::FocusWebContentsModalDialog() {
#endif
}
+void ConstrainedWindowViews::PulseWebContentsModalDialog() {
+}
+
+bool ConstrainedWindowViews::CanShowWebContentsModalDialog() {
+ return true;
+}
+
gfx::NativeWindow ConstrainedWindowViews::GetNativeWindow() {
return Widget::GetNativeWindow();
}
@@ -637,9 +644,9 @@ void ConstrainedWindowViews::NotifyTabHelperWillClose() {
if (!web_contents_)
return;
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->WillClose(this);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->WillClose(this);
}
views::NonClientFrameView* ConstrainedWindowViews::CreateNonClientFrameView() {
diff --git a/chrome/browser/ui/views/constrained_window_views.h b/chrome/browser/ui/views/constrained_window_views.h
index 179c3cf..884f04b 100644
--- a/chrome/browser/ui/views/constrained_window_views.h
+++ b/chrome/browser/ui/views/constrained_window_views.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_UI_VIEWS_CONSTRAINED_WINDOW_VIEWS_H_
#include "base/compiler_specific.h"
-#include "chrome/browser/ui/constrained_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/rect.h"
#include "ui/views/widget/widget.h"
@@ -51,12 +51,12 @@ class NativeConstrainedWindow {
///////////////////////////////////////////////////////////////////////////////
// ConstrainedWindowViews
//
-// A ConstrainedWindow implementation that implements a Constrained Window as
-// a child HWND with a custom window frame. The ConstrainedWindowViews owns
+// A WebContentsModalDialog implementation that implements the dialog as a
+// child HWND with a custom window frame. The ConstrainedWindowViews owns
// itself and will be deleted soon after being closed.
//
class ConstrainedWindowViews : public views::Widget,
- public ConstrainedWindow,
+ public WebContentsModalDialog,
public NativeConstrainedWindowDelegate {
public:
ConstrainedWindowViews(content::WebContents* web_contents,
@@ -66,10 +66,12 @@ class ConstrainedWindowViews : public views::Widget,
// Returns the WebContents that constrains this Constrained Window.
content::WebContents* owner() const { return web_contents_; }
- // Overridden from ConstrainedWindow:
+ // Overridden from WebContentsModalDialog:
virtual void ShowWebContentsModalDialog() OVERRIDE;
virtual void CloseWebContentsModalDialog() OVERRIDE;
virtual void FocusWebContentsModalDialog() OVERRIDE;
+ virtual void PulseWebContentsModalDialog() OVERRIDE;
+ virtual bool CanShowWebContentsModalDialog() OVERRIDE;
virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
// Default insets for the dialog:
diff --git a/chrome/browser/ui/views/constrained_window_views_browsertest.cc b/chrome/browser/ui/views/constrained_window_views_browsertest.cc
index 7a16ada..5b9740a 100644
--- a/chrome/browser/ui/views/constrained_window_views_browsertest.cc
+++ b/chrome/browser/ui/views/constrained_window_views_browsertest.cc
@@ -6,10 +6,10 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -122,9 +122,9 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) {
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(web_contents != NULL);
- ConstrainedWindowTabHelper* constrained_window_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- ASSERT_TRUE(constrained_window_helper != NULL);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ ASSERT_TRUE(web_contents_modal_dialog_manager != NULL);
// Create a constrained dialog. It will attach itself to web_contents.
scoped_ptr<TestConstrainedDialog> test_dialog1(new TestConstrainedDialog);
@@ -150,7 +150,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) {
// test_dialog1's text field should still be the view that has focus.
EXPECT_EQ(test_dialog1->GetInitiallyFocusedView(),
focus_manager->GetFocusedView());
- ASSERT_EQ(2u, constrained_window_helper->dialog_count());
+ ASSERT_EQ(2u, web_contents_modal_dialog_manager->dialog_count());
// Now send a VKEY_RETURN to the browser. This should result in closing
// test_dialog1.
@@ -160,7 +160,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) {
EXPECT_TRUE(test_dialog1->done());
EXPECT_FALSE(test_dialog2->done());
- EXPECT_EQ(1u, constrained_window_helper->dialog_count());
+ EXPECT_EQ(1u, web_contents_modal_dialog_manager->dialog_count());
// test_dialog2 will be shown. Focus should be on test_dialog2's text field.
EXPECT_EQ(test_dialog2->GetInitiallyFocusedView(),
@@ -187,7 +187,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, FocusTest) {
ui::Accelerator(ui::VKEY_RETURN, ui::EF_NONE)));
content::RunAllPendingInMessageLoop();
EXPECT_TRUE(test_dialog2->done());
- EXPECT_EQ(0u, constrained_window_helper->dialog_count());
+ EXPECT_EQ(0u, web_contents_modal_dialog_manager->dialog_count());
}
// Tests that the constrained window is closed properly when its tab is
@@ -196,9 +196,9 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, TabCloseTest) {
content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
ASSERT_TRUE(web_contents != NULL);
- ConstrainedWindowTabHelper* constrained_window_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- ASSERT_TRUE(constrained_window_helper != NULL);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ ASSERT_TRUE(web_contents_modal_dialog_manager != NULL);
// Create a constrained dialog. It will attach itself to web_contents.
scoped_ptr<TestConstrainedDialog> test_dialog(new TestConstrainedDialog);
@@ -254,7 +254,7 @@ IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest, TabSwitchTest) {
// Tests that backspace is not processed before it's sent to the web contents.
// We do not run this test on Aura because key events are sent to the web
// contents through a different code path that does not call
-// views::FocusManager::OnKeyEvent when ConstrainedWindow is focused.
+// views::FocusManager::OnKeyEvent when WebContentsModalDialog is focused.
IN_PROC_BROWSER_TEST_F(ConstrainedWindowViewTest,
BackspaceSentToWebContent) {
content::WebContents* web_contents =
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.h b/chrome/browser/ui/views/ssl_client_certificate_selector.h
index 916cdf9..317adda 100644
--- a/chrome/browser/ui/views/ssl_client_certificate_selector.h
+++ b/chrome/browser/ui/views/ssl_client_certificate_selector.h
@@ -33,7 +33,7 @@ class TextButton;
}
class CertificateSelectorTableModel;
-class ConstrainedWindow;
+class WebContentsModalDialog;
class SSLClientCertificateSelector : public SSLClientAuthObserver,
public views::DialogDelegateView,
@@ -81,7 +81,7 @@ class SSLClientCertificateSelector : public SSLClientAuthObserver,
content::WebContents* web_contents_;
- ConstrainedWindow* window_;
+ WebContentsModalDialog* window_;
views::TableView* table_;
views::TextButton* view_cert_button_;
views::View* view_cert_button_container_;
diff --git a/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc b/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc
index 50ade41..1504e4b 100644
--- a/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc
+++ b/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc
@@ -5,11 +5,11 @@
#include "chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.h"
#include "chrome/browser/browser_shutdown.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/sad_tab_helper.h"
#include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
#include "chrome/browser/ui/views/constrained_window_views.h"
#include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
@@ -68,15 +68,15 @@ bool ChromeWebContentsViewDelegateViews::Focus() {
}
}
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- if (constrained_window_tab_helper) {
- // TODO(erg): WebContents used to own constrained windows, which is why
- // this is here. Eventually this should be ported to a containing view
- // specializing in constrained window management.
- if (constrained_window_tab_helper->dialog_count() > 0) {
- ConstrainedWindow* window =
- *constrained_window_tab_helper->dialog_begin();
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ if (web_contents_modal_dialog_manager) {
+ // TODO(erg): WebContents used to own web contents modal dialogs, which is
+ // why this is here. Eventually this should be ported to a containing view
+ // specializing in web contents modal dialog management.
+ if (web_contents_modal_dialog_manager->dialog_count() > 0) {
+ WebContentsModalDialog* window =
+ *web_contents_modal_dialog_manager->dialog_begin();
DCHECK(window);
window->FocusWebContentsModalDialog();
return true;
diff --git a/chrome/browser/ui/views/web_intent_picker_views.cc b/chrome/browser/ui/views/web_intent_picker_views.cc
index 72fd54f..95e558d 100644
--- a/chrome/browser/ui/views/web_intent_picker_views.cc
+++ b/chrome/browser/ui/views/web_intent_picker_views.cc
@@ -1048,7 +1048,7 @@ class WebIntentPickerViews : public views::ButtonListener,
scoped_ptr<WebContents> inline_web_contents_;
// Indicate if dialog should display its own close button.
- // TODO(groby): Only relevant until new ConstrainedWindow is implemented,
+ // TODO(groby): Only relevant until new WebContentsModalDialog is implemented,
// from then on always true.
bool use_close_button_;
diff --git a/chrome/browser/ui/constrained_window.h b/chrome/browser/ui/web_contents_modal_dialog.h
index c527fe5..784e1eb 100644
--- a/chrome/browser/ui/constrained_window.h
+++ b/chrome/browser/ui/web_contents_modal_dialog.h
@@ -2,19 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_CONSTRAINED_WINDOW_H_
-#define CHROME_BROWSER_UI_CONSTRAINED_WINDOW_H_
+#ifndef CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_H_
+#define CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_H_
#include "build/build_config.h"
#include "ui/gfx/native_widget_types.h"
///////////////////////////////////////////////////////////////////////////////
-// ConstrainedWindow
+// WebContentsModalDialog
//
// This interface represents a window that is constrained to a
// WebContentsView's bounds.
//
-class ConstrainedWindow {
+class WebContentsModalDialog {
public:
// Makes the web contents modal dialog visible. Only one web contents modal
// dialog is shown at a time per tab.
@@ -24,19 +24,19 @@ class ConstrainedWindow {
virtual void CloseWebContentsModalDialog() = 0;
// Sets focus on the web contents modal dialog.
- virtual void FocusWebContentsModalDialog();
+ virtual void FocusWebContentsModalDialog() = 0;
// Runs a pulse animation for the web contents modal dialog.
- virtual void PulseWebContentsModalDialog();
+ virtual void PulseWebContentsModalDialog() = 0;
// Checks if the web contents modal dialog can be shown.
- virtual bool CanShowWebContentsModalDialog();
+ virtual bool CanShowWebContentsModalDialog() = 0;
// Returns the native window of the web contents modal dialog.
- virtual gfx::NativeWindow GetNativeWindow();
+ virtual gfx::NativeWindow GetNativeWindow() = 0;
protected:
- virtual ~ConstrainedWindow() {}
+ virtual ~WebContentsModalDialog() {}
};
-#endif // CHROME_BROWSER_UI_CONSTRAINED_WINDOW_H_
+#endif // CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_H_
diff --git a/chrome/browser/ui/constrained_window_tab_helper.cc b/chrome/browser/ui/web_contents_modal_dialog_manager.cc
index c90a4a9..65bbd44 100644
--- a/chrome/browser/ui/constrained_window_tab_helper.cc
+++ b/chrome/browser/ui/web_contents_modal_dialog_manager.cc
@@ -2,10 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
-#include "chrome/browser/ui/constrained_window.h"
-#include "chrome/browser/ui/constrained_window_tab_helper_delegate.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h"
#include "chrome/common/render_messages.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/navigation_entry.h"
@@ -16,61 +16,60 @@
using content::WebContents;
-DEFINE_WEB_CONTENTS_USER_DATA_KEY(ConstrainedWindowTabHelper)
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(WebContentsModalDialogManager)
-ConstrainedWindowTabHelper::ConstrainedWindowTabHelper(
+WebContentsModalDialogManager::WebContentsModalDialogManager(
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
delegate_(NULL) {
}
-ConstrainedWindowTabHelper::~ConstrainedWindowTabHelper() {
+WebContentsModalDialogManager::~WebContentsModalDialogManager() {
DCHECK(child_dialogs_.empty());
}
-void ConstrainedWindowTabHelper::AddDialog(
- ConstrainedWindow* window) {
- child_dialogs_.push_back(window);
+void WebContentsModalDialogManager::AddDialog(
+ WebContentsModalDialog* dialog) {
+ child_dialogs_.push_back(dialog);
- if (child_dialogs_.size() == 1 && window->CanShowWebContentsModalDialog()) {
- window->ShowWebContentsModalDialog();
+ if (child_dialogs_.size() == 1 && dialog->CanShowWebContentsModalDialog()) {
+ dialog->ShowWebContentsModalDialog();
BlockWebContentsInteraction(true);
}
}
-void ConstrainedWindowTabHelper::CloseAllDialogs() {
- // Clear out any web contents modal dialogs since we are leaving this page
- // entirely. To ensure that we iterate over every element in child_dialogs_
- // we need to use a copy of child_dialogs_. Otherwise if
- // window->CloseWebContentsModalDialog() modifies child_dialogs_ we could end
- // up skipping some elements.
+void WebContentsModalDialogManager::CloseAllDialogs() {
+ // Clear out any dialogs since we are leaving this page entirely. To ensure
+ // that we iterate over every element in child_dialogs_ we need to use a copy
+ // of child_dialogs_. Otherwise if dialog->CloseWebContentsModalDialog()
+ // modifies child_dialogs_ we could end up skipping some elements.
WebContentsModalDialogList child_dialogs_copy(child_dialogs_);
for (WebContentsModalDialogList::iterator it = child_dialogs_copy.begin();
it != child_dialogs_copy.end(); ++it) {
- ConstrainedWindow* window = *it;
- if (window) {
- window->CloseWebContentsModalDialog();
+ WebContentsModalDialog* dialog = *it;
+ if (dialog) {
+ dialog->CloseWebContentsModalDialog();
BlockWebContentsInteraction(false);
}
}
}
-void ConstrainedWindowTabHelper::WillClose(ConstrainedWindow* window) {
+void WebContentsModalDialogManager::WillClose(WebContentsModalDialog* dialog) {
WebContentsModalDialogList::iterator i(
- std::find(child_dialogs_.begin(), child_dialogs_.end(), window));
- bool removed_topmost_window = i == child_dialogs_.begin();
+ std::find(child_dialogs_.begin(), child_dialogs_.end(), dialog));
+ bool removed_topmost_dialog = i == child_dialogs_.begin();
if (i != child_dialogs_.end())
child_dialogs_.erase(i);
if (child_dialogs_.empty()) {
BlockWebContentsInteraction(false);
} else {
- if (removed_topmost_window)
+ if (removed_topmost_dialog)
child_dialogs_[0]->ShowWebContentsModalDialog();
BlockWebContentsInteraction(true);
}
}
-void ConstrainedWindowTabHelper::BlockWebContentsInteraction(bool blocked) {
+void WebContentsModalDialogManager::BlockWebContentsInteraction(bool blocked) {
WebContents* contents = web_contents();
if (!contents) {
// The WebContents has already disconnected.
@@ -88,7 +87,7 @@ void ConstrainedWindowTabHelper::BlockWebContentsInteraction(bool blocked) {
delegate_->SetWebContentsBlocked(contents, blocked);
}
-void ConstrainedWindowTabHelper::DidNavigateMainFrame(
+void WebContentsModalDialogManager::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
// Close constrained windows if necessary.
@@ -97,17 +96,17 @@ void ConstrainedWindowTabHelper::DidNavigateMainFrame(
CloseAllDialogs();
}
-void ConstrainedWindowTabHelper::DidGetIgnoredUIEvent() {
+void WebContentsModalDialogManager::DidGetIgnoredUIEvent() {
if (dialog_count()) {
- ConstrainedWindow* window = *dialog_begin();
- window->FocusWebContentsModalDialog();
+ WebContentsModalDialog* dialog = *dialog_begin();
+ dialog->FocusWebContentsModalDialog();
}
}
-void ConstrainedWindowTabHelper::WebContentsDestroyed(WebContents* tab) {
- // First cleanly close all child windows.
+void WebContentsModalDialogManager::WebContentsDestroyed(WebContents* tab) {
+ // First cleanly close all child dialogs.
// TODO(mpcomplete): handle case if MaybeCloseChildWindows() already asked
- // some of these to close. CloseWindows is async, so it might get called
+ // some of these to close. CloseAllDialogs is async, so it might get called
// twice before it runs.
CloseAllDialogs();
}
diff --git a/chrome/browser/ui/web_contents_modal_dialog_manager.h b/chrome/browser/ui/web_contents_modal_dialog_manager.h
new file mode 100644
index 0000000..10bb91d
--- /dev/null
+++ b/chrome/browser/ui/web_contents_modal_dialog_manager.h
@@ -0,0 +1,74 @@
+// 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 CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_
+#define CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_
+
+#include <deque>
+
+#include "content/public/browser/web_contents_observer.h"
+#include "content/public/browser/web_contents_user_data.h"
+
+class WebContentsModalDialog;
+class WebContentsModalDialogManagerDelegate;
+
+// Per-WebContents class to manage WebContents-modal dialogs.
+class WebContentsModalDialogManager
+ : public content::WebContentsObserver,
+ public content::WebContentsUserData<WebContentsModalDialogManager> {
+ public:
+ virtual ~WebContentsModalDialogManager();
+
+ WebContentsModalDialogManagerDelegate* delegate() const { return delegate_; }
+ void set_delegate(WebContentsModalDialogManagerDelegate* d) { delegate_ = d; }
+
+ // Adds the given dialog to the list of child dialogs. The dialog will notify
+ // via WillClose() when it is being destroyed.
+ void AddDialog(WebContentsModalDialog* dialog);
+
+ // Closes all WebContentsModalDialogs.
+ void CloseAllDialogs();
+
+ // Called when a WebContentsModalDialogs we own is about to be closed.
+ void WillClose(WebContentsModalDialog* dialog);
+
+ // Blocks/unblocks interaction with renderer process.
+ void BlockWebContentsInteraction(bool blocked);
+
+ // Returns the number of dialogs in this tab.
+ size_t dialog_count() { return child_dialogs_.size(); }
+
+ typedef std::deque<WebContentsModalDialog*> WebContentsModalDialogList;
+
+ // Return an iterator for the first dialog in this web contents.
+ WebContentsModalDialogList::iterator dialog_begin() {
+ return child_dialogs_.begin();
+ }
+
+ // Return an iterator for the last dialog in this web contents.
+ WebContentsModalDialogList::iterator dialog_end() {
+ return child_dialogs_.end();
+ }
+
+ private:
+ explicit WebContentsModalDialogManager(content::WebContents* web_contents);
+ friend class content::WebContentsUserData<WebContentsModalDialogManager>;
+
+ // Overridden from content::WebContentsObserver:
+ virtual void DidNavigateMainFrame(
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) OVERRIDE;
+ virtual void DidGetIgnoredUIEvent() OVERRIDE;
+ virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE;
+
+ // Delegate for notifying our owner about stuff. Not owned by us.
+ WebContentsModalDialogManagerDelegate* delegate_;
+
+ // All active dialogs.
+ WebContentsModalDialogList child_dialogs_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManager);
+};
+
+#endif // CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_
diff --git a/chrome/browser/ui/web_contents_modal_dialog_manager_delegate.cc b/chrome/browser/ui/web_contents_modal_dialog_manager_delegate.cc
new file mode 100644
index 0000000..8a0943d
--- /dev/null
+++ b/chrome/browser/ui/web_contents_modal_dialog_manager_delegate.cc
@@ -0,0 +1,24 @@
+// 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 "chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h"
+
+#include <string.h>
+
+bool WebContentsModalDialogManagerDelegate::ShouldFocusWebContentsModalDialog(
+) {
+ return true;
+}
+
+void WebContentsModalDialogManagerDelegate::SetWebContentsBlocked(
+ content::WebContents* web_contents, bool blocked) {
+}
+
+WebContentsModalDialogManagerDelegate::~WebContentsModalDialogManagerDelegate(
+) {}
+
+bool WebContentsModalDialogManagerDelegate::GetDialogTopCenter(
+ gfx::Point* point) {
+ return false;
+}
diff --git a/chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h b/chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h
new file mode 100644
index 0000000..382e125
--- /dev/null
+++ b/chrome/browser/ui/web_contents_modal_dialog_manager_delegate.h
@@ -0,0 +1,39 @@
+// 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 CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_
+#define CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_
+
+namespace content {
+class WebContents;
+}
+
+namespace gfx {
+class Point;
+}
+
+class WebContentsModalDialogManagerDelegate {
+ public:
+ // Returns true if WebContentsModalDialogs should be focused. Default is true.
+ virtual bool ShouldFocusWebContentsModalDialog();
+
+ // Changes the blocked state of |web_contents|. WebContentses are considered
+ // blocked while displaying a web contents modal dialog. During that time
+ // renderer host will ignore any UI interaction within WebContents outside of
+ // the currently displaying dialog.
+ virtual void SetWebContentsBlocked(content::WebContents* web_contents,
+ bool blocked);
+
+ // Fills in |point| with the coordinates for positioning web contents modal
+ // dialogs. The dialog should position itself such that its top center is at
+ // |point|. Return false if the default position should be used.
+ // TODO(wittman): Remove this function once we have migrated positioning
+ // functionality to a ShowDialog function on WebContentsModalDialogManager.
+ virtual bool GetDialogTopCenter(gfx::Point* point);
+
+ protected:
+ virtual ~WebContentsModalDialogManagerDelegate();
+};
+
+#endif // CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_MANAGER_DELEGATE_H_
diff --git a/chrome/browser/ui/constrained_window_tab_helper_unittest.cc b/chrome/browser/ui/web_contents_modal_dialog_manager_unittest.cc
index 2ff348b..e990254 100644
--- a/chrome/browser/ui/constrained_window_tab_helper_unittest.cc
+++ b/chrome/browser/ui/web_contents_modal_dialog_manager_unittest.cc
@@ -2,62 +2,70 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/constrained_window.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "content/public/test/test_browser_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
using content::BrowserThread;
-class ConstrainedWindowTabHelperTest : public ChromeRenderViewHostTestHarness {
+class WebContentsModalDialogManagerTest
+ : public ChromeRenderViewHostTestHarness {
public:
- ConstrainedWindowTabHelperTest()
+ WebContentsModalDialogManagerTest()
: ChromeRenderViewHostTestHarness(),
ui_thread_(BrowserThread::UI, &message_loop_) {
}
virtual void SetUp() {
ChromeRenderViewHostTestHarness::SetUp();
- ConstrainedWindowTabHelper::CreateForWebContents(web_contents());
+ WebContentsModalDialogManager::CreateForWebContents(web_contents());
}
private:
content::TestBrowserThread ui_thread_;
};
-class WebContentsModalDialogCloseTest : public ConstrainedWindow {
+class WebContentsModalDialogCloseTest : public WebContentsModalDialog {
public:
explicit WebContentsModalDialogCloseTest(content::WebContents* web_contents)
: web_contents_(web_contents) {
}
virtual void ShowWebContentsModalDialog() {}
- virtual void FocusWebContentsModalDialog() {}
- virtual ~WebContentsModalDialogCloseTest() {}
-
virtual void CloseWebContentsModalDialog() {
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents_);
- constrained_window_tab_helper->WillClose(this);
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents_);
+ web_contents_modal_dialog_manager->WillClose(this);
close_count++;
}
+ virtual void FocusWebContentsModalDialog() {}
+ virtual void PulseWebContentsModalDialog() {}
+ virtual bool CanShowWebContentsModalDialog() {
+ return true;
+ }
+ virtual gfx::NativeWindow GetNativeWindow() {
+ NOTREACHED();
+ return NULL;
+ }
+ virtual ~WebContentsModalDialogCloseTest() {}
int close_count;
content::WebContents* web_contents_;
};
-TEST_F(ConstrainedWindowTabHelperTest, ConstrainedWindows) {
+TEST_F(WebContentsModalDialogManagerTest, ConstrainedWindows) {
WebContentsModalDialogCloseTest window(web_contents());
window.close_count = 0;
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents());
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents());
const int kWindowCount = 4;
for (int i = 0; i < kWindowCount; i++)
- constrained_window_tab_helper->AddDialog(&window);
+ web_contents_modal_dialog_manager->AddDialog(&window);
EXPECT_EQ(window.close_count, 0);
- constrained_window_tab_helper->CloseAllDialogs();
+ web_contents_modal_dialog_manager->CloseAllDialogs();
EXPECT_EQ(window.close_count, kWindowCount);
}
diff --git a/chrome/browser/ui/webui/certificate_viewer_webui.cc b/chrome/browser/ui/webui/certificate_viewer_webui.cc
index 76831b7..b955651 100644
--- a/chrome/browser/ui/webui/certificate_viewer_webui.cc
+++ b/chrome/browser/ui/webui/certificate_viewer_webui.cc
@@ -13,7 +13,7 @@
#include "chrome/browser/certificate_viewer.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/certificate_dialogs.h"
-#include "chrome/browser/ui/constrained_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
#include "chrome/common/net/x509_certificate_model.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
index 0a38d26..d23618e 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
+++ b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.cc
@@ -6,7 +6,7 @@
#include <string>
-#include "chrome/browser/ui/constrained_window.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "chrome/browser/ui/webui/chrome_web_contents_handler.h"
#include "content/public/browser/web_contents.h"
#include "ipc/ipc_message.h"
@@ -66,7 +66,8 @@ void ConstrainedWebDialogDelegateBase::OnDialogCloseFromWebUI() {
window_->CloseWebContentsModalDialog();
}
-void ConstrainedWebDialogDelegateBase::set_window(ConstrainedWindow* window) {
+void ConstrainedWebDialogDelegateBase::set_window(
+ WebContentsModalDialog* window) {
window_ = window;
}
@@ -83,7 +84,7 @@ void ConstrainedWebDialogDelegateBase::ReleaseWebContentsOnDialogClose() {
release_contents_on_close_ = true;
}
-ConstrainedWindow* ConstrainedWebDialogDelegateBase::GetWindow() {
+WebContentsModalDialog* ConstrainedWebDialogDelegateBase::GetWindow() {
return window_;
}
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h
index c814c7d..3fcc0fb 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h
+++ b/chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h
@@ -29,7 +29,7 @@ class ConstrainedWebDialogDelegateBase
WebDialogWebContentsDelegate* tab_delegate);
virtual ~ConstrainedWebDialogDelegateBase();
- void set_window(ConstrainedWindow* window);
+ void set_window(WebContentsModalDialog* window);
bool closed_via_webui() const;
// ConstrainedWebDialogDelegate interface.
@@ -38,7 +38,7 @@ class ConstrainedWebDialogDelegateBase
virtual ui::WebDialogDelegate* GetWebDialogDelegate() OVERRIDE;
virtual void OnDialogCloseFromWebUI() OVERRIDE;
virtual void ReleaseWebContentsOnDialogClose() OVERRIDE;
- virtual ConstrainedWindow* GetWindow() OVERRIDE;
+ virtual WebContentsModalDialog* GetWindow() OVERRIDE;
virtual content::WebContents* GetWebContents() OVERRIDE;
// WebDialogWebContentsDelegate interface.
@@ -53,8 +53,9 @@ class ConstrainedWebDialogDelegateBase
private:
scoped_ptr<ui::WebDialogDelegate> web_dialog_delegate_;
- // The constrained window that owns |this|. Saved so we can close it later.
- ConstrainedWindow* window_;
+ // The web contents modal dialog that owns |this|. Saved so we can close it
+ // later.
+ WebContentsModalDialog* window_;
// Holds the HTML to display in the constrained dialog.
scoped_ptr<content::WebContents> web_contents_;
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui.h b/chrome/browser/ui/webui/constrained_web_dialog_ui.h
index ea1e2ca..791e0bf 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_ui.h
+++ b/chrome/browser/ui/webui/constrained_web_dialog_ui.h
@@ -8,7 +8,7 @@
#include "base/compiler_specific.h"
#include "content/public/browser/web_ui_controller.h"
-class ConstrainedWindow;
+class WebContentsModalDialog;
namespace content {
class BrowserContext;
@@ -35,8 +35,8 @@ class ConstrainedWebDialogDelegate {
// released WebContents.
virtual void ReleaseWebContentsOnDialogClose() = 0;
- // Returns the ConstrainedWindow.
- virtual ConstrainedWindow* GetWindow() = 0;
+ // Returns the WebContentsModalDialog.
+ virtual WebContentsModalDialog* GetWindow() = 0;
// Returns the WebContents owned by the constrained window.
virtual content::WebContents* GetWebContents() = 0;
@@ -47,9 +47,9 @@ class ConstrainedWebDialogDelegate {
// ConstrainedWebDialogUI is a facility to show HTML WebUI content
// in a tab-modal constrained dialog. It is implemented as an adapter
-// between an WebDialogUI object and a ConstrainedWindow object.
+// between an WebDialogUI object and a WebContentsModalDialog object.
//
-// Since ConstrainedWindow requires platform-specific delegate
+// Since WebContentsModalDialog requires platform-specific delegate
// implementations, this class is just a factory stub.
// TODO(thestig): Refactor the platform-independent code out of the
// platform-specific implementations.
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
index 0097e6b..d581568 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/constrained_web_dialog_ui_browsertest.cc
@@ -8,7 +8,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
@@ -49,9 +49,9 @@ class ConstrainedWebDialogBrowserTest : public InProcessBrowserTest {
protected:
size_t GetConstrainedWindowCount(WebContents* web_contents) const {
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(web_contents);
- return constrained_window_tab_helper->dialog_count();
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ return web_contents_modal_dialog_manager->dialog_count();
}
};
diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc
index 8453f26..f4e069b 100644
--- a/chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc
+++ b/chrome/browser/ui/webui/print_preview/print_preview_ui_unittest.cc
@@ -11,8 +11,8 @@
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_tabstrip.h"
-#include "chrome/browser/ui/constrained_window_tab_helper.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/web_contents_modal_dialog_manager.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
@@ -36,9 +36,9 @@ base::RefCountedBytes* CreateTestData() {
}
size_t GetConstrainedWindowCount(WebContents* tab) {
- ConstrainedWindowTabHelper* constrained_window_tab_helper =
- ConstrainedWindowTabHelper::FromWebContents(tab);
- return constrained_window_tab_helper->dialog_count();
+ WebContentsModalDialogManager* web_contents_modal_dialog_manager =
+ WebContentsModalDialogManager::FromWebContents(tab);
+ return web_contents_modal_dialog_manager->dialog_count();
}
} // namespace
diff --git a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc
index 4ebf328..adb6db6 100644
--- a/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc
+++ b/chrome/browser/ui/webui/tab_modal_confirm_dialog_webui.cc
@@ -14,8 +14,8 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/constrained_window.h"
#include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h"
+#include "chrome/browser/ui/web_contents_modal_dialog.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager.h"
#include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
#include "chrome/browser/ui/webui/constrained_web_dialog_ui.h"
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index 5f43439..a6f8f8b 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -801,12 +801,6 @@
'browser/ui/content_settings/content_setting_bubble_model_delegate.h',
'browser/ui/content_settings/content_setting_image_model.cc',
'browser/ui/content_settings/content_setting_image_model.h',
- 'browser/ui/constrained_window.cc',
- 'browser/ui/constrained_window.h',
- 'browser/ui/constrained_window_tab_helper.cc',
- 'browser/ui/constrained_window_tab_helper.h',
- 'browser/ui/constrained_window_tab_helper_delegate.cc',
- 'browser/ui/constrained_window_tab_helper_delegate.h',
'browser/ui/crypto_module_password_dialog.cc',
'browser/ui/crypto_module_password_dialog.h',
'browser/ui/crypto_module_password_dialog_nss.cc',
@@ -1727,6 +1721,11 @@
'browser/ui/views/wrench_menu.h',
'browser/ui/web_applications/web_app_ui.cc',
'browser/ui/web_applications/web_app_ui.h',
+ 'browser/ui/web_contents_modal_dialog.h',
+ 'browser/ui/web_contents_modal_dialog_manager.cc',
+ 'browser/ui/web_contents_modal_dialog_manager.h',
+ 'browser/ui/web_contents_modal_dialog_manager_delegate.cc',
+ 'browser/ui/web_contents_modal_dialog_manager_delegate.h',
'browser/ui/website_settings/permission_menu_model.cc',
'browser/ui/website_settings/permission_menu_model.h',
'browser/ui/website_settings/website_settings.cc',
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 635cdce..be3cc94 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -1327,7 +1327,6 @@
'browser/ui/cocoa/wrench_menu/menu_tracked_root_view_unittest.mm',
'browser/ui/cocoa/wrench_menu/wrench_menu_button_cell_unittest.mm',
'browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm',
- 'browser/ui/constrained_window_tab_helper_unittest.cc',
'browser/ui/content_settings/content_setting_bubble_model_unittest.cc',
'browser/ui/content_settings/content_setting_image_model_unittest.cc',
'browser/ui/find_bar/find_backend_unittest.cc',
@@ -1392,6 +1391,7 @@
'browser/ui/views/tabs/stacked_tab_strip_layout_unittest.cc',
'browser/ui/views/tabs/tab_unittest.cc',
'browser/ui/views/tabs/tab_strip_unittest.cc',
+ 'browser/ui/web_contents_modal_dialog_manager_unittest.cc',
'browser/ui/website_settings/website_settings_unittest.cc',
'browser/ui/webui/chrome_web_ui_data_source_unittest.cc',
'browser/ui/webui/fileicon_source_unittest.cc',