summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrouslan <rouslan@chromium.org>2015-07-27 12:45:57 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-27 19:46:55 +0000
commitcd3b9842dde7f32cb7f32199548173601b2118ce (patch)
tree6a0f776c46cab619e1fd9a7d84e65d4d49851981
parent8f3218985dde74063ccc362da47803be163f3165 (diff)
downloadchromium_src-cd3b9842dde7f32cb7f32199548173601b2118ce.zip
chromium_src-cd3b9842dde7f32cb7f32199548173601b2118ce.tar.gz
chromium_src-cd3b9842dde7f32cb7f32199548173601b2118ce.tar.bz2
Remove PopupManager from src/components/web_modal/.
WebContentsModalDialogManager handles all dialogs. BUG=496955 Review URL: https://codereview.chromium.org/1213613007 Cr-Commit-Position: refs/heads/master@{#340536}
-rw-r--r--chrome/browser/chromeos/login/ui/webui_login_view.cc3
-rw-r--r--chrome/browser/chromeos/login/ui/webui_login_view.h7
-rw-r--r--chrome/browser/extensions/api/platform_keys/platform_keys_api.cc5
-rw-r--r--chrome/browser/extensions/extension_view_host.cc3
-rw-r--r--chrome/browser/extensions/extension_view_host.h8
-rw-r--r--chrome/browser/ui/browser.cc16
-rw-r--r--chrome/browser/ui/browser.h8
-rw-r--r--chrome/browser/ui/browser_commands.cc10
-rw-r--r--chrome/browser/ui/cocoa/browser_window_controller.mm6
-rw-r--r--chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm18
-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.mm4
-rw-r--r--chrome/browser/ui/tabs/tab_strip_model.cc16
-rw-r--r--chrome/browser/ui/tabs/tab_strip_model_unittest.cc3
-rw-r--r--chrome/browser/ui/views/desktop_media_picker_views.cc1
-rw-r--r--chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc8
-rw-r--r--chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc11
-rw-r--r--chrome/browser/ui/views/ssl_client_certificate_selector.cc1
-rw-r--r--chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc10
-rw-r--r--chrome/browser/ui/webui/constrained_web_dialog_ui.h4
-rw-r--r--components/web_modal.gypi2
-rw-r--r--components/web_modal/BUILD.gn2
-rw-r--r--components/web_modal/popup_manager.cc113
-rw-r--r--components/web_modal/popup_manager.h78
-rw-r--r--components/web_modal/web_contents_modal_dialog_manager.h1
-rw-r--r--extensions/browser/app_window/app_window.cc4
-rw-r--r--extensions/browser/app_window/app_window.h5
27 files changed, 49 insertions, 306 deletions
diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.cc b/chrome/browser/chromeos/login/ui/webui_login_view.cc
index c69032f..b5dc131 100644
--- a/chrome/browser/chromeos/login/ui/webui_login_view.cc
+++ b/chrome/browser/chromeos/login/ui/webui_login_view.cc
@@ -217,9 +217,6 @@ void WebUILoginView::Init() {
WebContentsModalDialogManager::CreateForWebContents(web_contents);
WebContentsModalDialogManager::FromWebContents(web_contents)->
SetDelegate(this);
- if (!popup_manager_.get())
- popup_manager_.reset(new web_modal::PopupManager(this));
- popup_manager_->RegisterWith(web_contents);
web_contents->SetDelegate(this);
extensions::ChromeExtensionWebContentsObserver::CreateForWebContents(
diff --git a/chrome/browser/chromeos/login/ui/webui_login_view.h b/chrome/browser/chromeos/login/ui/webui_login_view.h
index 9102fba..9e91195 100644
--- a/chrome/browser/chromeos/login/ui/webui_login_view.h
+++ b/chrome/browser/chromeos/login/ui/webui_login_view.h
@@ -8,10 +8,8 @@
#include <map>
#include <string>
-#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "chrome/browser/ui/chrome_web_modal_dialog_manager_delegate.h"
-#include "components/web_modal/popup_manager.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -188,11 +186,6 @@ class WebUILoginView : public views::View,
base::ObserverList<web_modal::ModalDialogHostObserver> observer_list_;
base::ObserverList<FrameObserver> frame_observer_list_;
- // Manage popups appearing over the login window.
- // TODO(gbillock): See if we can get rid of this. Perhaps in favor of
- // in-content styled popups or something? There oughtta be a way...
- scoped_ptr<web_modal::PopupManager> popup_manager_;
-
DISALLOW_COPY_AND_ASSIGN(WebUILoginView);
};
diff --git a/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc b/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc
index 33dbcc6..213ed46 100644
--- a/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc
+++ b/chrome/browser/extensions/api/platform_keys/platform_keys_api.cc
@@ -15,7 +15,7 @@
#include "chrome/browser/chromeos/platform_keys/platform_keys_service_factory.h"
#include "chrome/browser/extensions/api/platform_keys/verify_trust_api.h"
#include "chrome/common/extensions/api/platform_keys_internal.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/net_errors.h"
#include "net/cert/x509_certificate.h"
@@ -204,7 +204,8 @@ PlatformKeysInternalSelectClientCertificatesFunction::Run() {
// Ensure that this function is called in a context that allows opening
// dialogs.
if (!web_contents ||
- !web_modal::PopupManager::FromWebContents(web_contents)) {
+ !web_modal::WebContentsModalDialogManager::FromWebContents(
+ web_contents)) {
return RespondNow(Error(kErrorInteractiveCallFromBackground));
}
}
diff --git a/chrome/browser/extensions/extension_view_host.cc b/chrome/browser/extensions/extension_view_host.cc
index f739d46..fd0cca9 100644
--- a/chrome/browser/extensions/extension_view_host.cc
+++ b/chrome/browser/extensions/extension_view_host.cc
@@ -130,9 +130,6 @@ void ExtensionViewHost::LoadInitialURL() {
WebContentsModalDialogManager::CreateForWebContents(host_contents());
WebContentsModalDialogManager::FromWebContents(
host_contents())->SetDelegate(this);
- if (!popup_manager_.get())
- popup_manager_.reset(new web_modal::PopupManager(this));
- popup_manager_->RegisterWith(host_contents());
}
ExtensionHost::LoadInitialURL();
diff --git a/chrome/browser/extensions/extension_view_host.h b/chrome/browser/extensions/extension_view_host.h
index 52d9a6f..a8c47a8 100644
--- a/chrome/browser/extensions/extension_view_host.h
+++ b/chrome/browser/extensions/extension_view_host.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_VIEW_HOST_H_
#include "base/memory/scoped_ptr.h"
-#include "components/web_modal/popup_manager.h"
#include "components/web_modal/web_contents_modal_dialog_host.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "content/public/browser/notification_observer.h"
@@ -27,7 +26,6 @@ class ExtensionView;
// The ExtensionHost for an extension that backs a view in the browser UI. For
// example, this could be an extension popup or dialog, but not a background
// page.
-// TODO(gbillock): See if we can remove WebContentsModalDialogManager here.
class ExtensionViewHost
: public ExtensionHost,
public web_modal::WebContentsModalDialogManagerDelegate,
@@ -124,12 +122,6 @@ class ExtensionViewHost
class AssociatedWebContentsObserver;
scoped_ptr<AssociatedWebContentsObserver> associated_web_contents_observer_;
- // Manage popups overlaying the WebContents in this EVH.
- // TODO(gbillock): should usually not be used -- instead use the parent
- // window's popup manager. Should only be used when the EVH is created without
- // a parent window.
- scoped_ptr<web_modal::PopupManager> popup_manager_;
-
content::NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(ExtensionViewHost);
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index c8a447d..6278531 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -163,7 +163,6 @@
#include "components/startup_metric_utils/startup_metric_utils.h"
#include "components/translate/core/browser/language_state.h"
#include "components/ui/zoom/zoom_controller.h"
-#include "components/web_modal/popup_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/interstitial_page.h"
@@ -452,12 +451,6 @@ Browser::Browser(const CreateParams& params)
exclusive_access_manager_.reset(
new ExclusiveAccessManager(window_->GetExclusiveAccessContext()));
- // Must be initialized after window_.
- // Also: surprise! a modal dialog host is not necessary to host modal dialogs
- // without a modal dialog host, so that value may be null.
- popup_manager_.reset(new web_modal::PopupManager(
- GetWebContentsModalDialogHost()));
-
// TODO(beng): Move BrowserList::AddBrowser() to the end of this function and
// replace uses of this with BL's notifications.
BrowserList::AddBrowser(this);
@@ -937,9 +930,6 @@ void Browser::TabInsertedAt(WebContents* contents,
bool foreground) {
SetAsDelegate(contents, true);
- if (popup_manager_)
- popup_manager_->RegisterWith(contents);
-
SessionTabHelper* session_tab_helper =
SessionTabHelper::FromWebContents(contents);
session_tab_helper->SetWindowID(session_id());
@@ -981,9 +971,6 @@ void Browser::TabClosingAt(TabStripModel* tab_strip_model,
content::Source<NavigationController>(&contents->GetController()),
content::NotificationService::NoDetails());
- if (popup_manager_)
- popup_manager_->UnregisterWith(contents);
-
// Sever the WebContents' connection back to us.
SetAsDelegate(contents, false);
}
@@ -1000,9 +987,6 @@ void Browser::TabDetachedAt(WebContents* contents, int index) {
old_active_index - 1);
}
- if (popup_manager_)
- popup_manager_->UnregisterWith(contents);
-
TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH);
}
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 22a908e..e41c5d6 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -98,7 +98,6 @@ class WebDialogDelegate;
}
namespace web_modal {
-class PopupManager;
class WebContentsModalDialogHost;
}
@@ -255,9 +254,6 @@ class Browser : public TabStripModelObserver,
toolbar_model->swap(toolbar_model_);
}
#endif
- web_modal::PopupManager* popup_manager() {
- return popup_manager_.get();
- }
TabStripModel* tab_strip_model() const { return tab_strip_model_.get(); }
chrome::BrowserCommandController* command_controller() {
return command_controller_.get();
@@ -857,10 +853,6 @@ class Browser : public TabStripModelObserver,
// This Browser's window.
BrowserWindow* window_;
- // Manages popup windows (bubbles, tab-modals) visible overlapping this
- // window. JS alerts are not handled by this manager.
- scoped_ptr<web_modal::PopupManager> popup_manager_;
-
scoped_ptr<TabStripModelDelegate> tab_strip_model_delegate_;
scoped_ptr<TabStripModel> tab_strip_model_;
diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc
index b937d6f..74ac03a 100644
--- a/chrome/browser/ui/browser_commands.cc
+++ b/chrome/browser/ui/browser_commands.cc
@@ -61,7 +61,7 @@
#include "components/translate/core/browser/language_state.h"
#include "components/ui/zoom/page_zoom.h"
#include "components/ui/zoom/zoom_controller.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
@@ -228,15 +228,13 @@ bool IsShowingWebContentsModalDialog(Browser* browser) {
if (!web_contents)
return false;
- // In test code we may not have a popup manager.
- if (!browser->popup_manager())
- return false;
-
// TODO(gbillock): This is currently called in production by the CanPrint
// method, and may be too restrictive if we allow print preview to overlap.
// Re-assess how to queue print preview after we know more about popup
// management policy.
- return browser->popup_manager()->IsWebModalDialogActive(web_contents);
+ const web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(web_contents);
+ return manager && manager->IsDialogActive();
}
#if defined(ENABLE_BASIC_PRINTING)
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index cb00583..3f79c03 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -87,7 +87,6 @@
#include "components/signin/core/common/profile_management_switches.h"
#include "components/translate/core/browser/translate_manager.h"
#include "components/translate/core/browser/translate_ui_delegate.h"
-#include "components/web_modal/popup_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host_view.h"
@@ -1678,8 +1677,9 @@ using content::WebContents;
if (!contents)
return NO;
- return !web_modal::PopupManager::FromWebContents(contents)->
- IsWebModalDialogActive(contents);
+ const web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(contents);
+ return !manager || !manager->IsDialogActive();
}
// TabStripControllerDelegate protocol.
diff --git a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
index 9a37e66..570855f 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
@@ -15,7 +15,7 @@
#import "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
#import "chrome/browser/ui/cocoa/info_bubble_window.h"
#include "chrome/common/url_constants.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/notification_details.h"
@@ -201,12 +201,11 @@ class ExtensionPopupNotificationBridge : public content::NotificationObserver {
if (host_) {
// TODO(gbillock): Change this API to say directly if the current popup
// should block tab close? This is a bit over-reaching.
- web_modal::PopupManager* popup_manager =
- web_modal::PopupManager::FromWebContents(host_->host_contents());
- if (popup_manager && popup_manager->IsWebModalDialogActive(
- host_->host_contents())) {
+ const web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(
+ host_->host_contents());
+ if (manager && manager->IsDialogActive())
return;
- }
}
[super close];
}
@@ -227,11 +226,10 @@ class ExtensionPopupNotificationBridge : public content::NotificationObserver {
// it steals key-ness from the popup. Don't close the popup when this
// happens. There's an extra windowDidResignKey: notification after the
// modal dialog closes that should also be ignored.
- web_modal::PopupManager* popupManager =
- web_modal::PopupManager::FromWebContents(
+ const web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(
host_->host_contents());
- if (popupManager &&
- popupManager->IsWebModalDialogActive(host_->host_contents())) {
+ if (manager && manager->IsDialogActive()) {
ignoreWindowDidResignKey_ = YES;
return;
}
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 ab42719..9183630 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
@@ -10,7 +10,7 @@
#include "chrome/browser/ui/cocoa/constrained_window/constrained_window_alert.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/test/base/in_process_browser_test.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -48,8 +48,8 @@ IN_PROC_BROWSER_TEST_F(MediaGalleriesDialogBrowserTest, Close) {
base::scoped_nsobject<NSWindow> window([[dialog->alert_ window] retain]);
EXPECT_TRUE([window isVisible]);
- web_modal::PopupManager* popup_manager =
- web_modal::PopupManager::FromWebContents(web_contents);
- popup_manager->CloseAllDialogsForTesting(web_contents);
+ web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(web_contents);
+ web_modal::WebContentsModalDialogManager::TestApi(manager).CloseAllDialogs();
EXPECT_FALSE([window isVisible]);
}
diff --git a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm
index 4f90adc..6e2703d 100644
--- a/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm
+++ b/chrome/browser/ui/cocoa/ssl_client_certificate_selector_cocoa.mm
@@ -15,7 +15,7 @@
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_mac.h"
#include "chrome/grit/generated_resources.h"
#include "components/guest_view/browser/guest_view_base.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/web_contents.h"
@@ -85,7 +85,7 @@ void ShowSSLClientCertificateSelector(
// GetTopLevelWebContents() will return |contents| otherwise.
// TODO(davidben): Move this hook to the WebContentsDelegate and only try to
// show a dialog in Browser's implementation. https://crbug.com/456255
- if (web_modal::PopupManager::FromWebContents(
+ if (web_modal::WebContentsModalDialogManager::FromWebContents(
guest_view::GuestViewBase::GetTopLevelWebContents(contents)) ==
nullptr)
return;
diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc
index b309b7d..09dfad4 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -23,7 +23,7 @@
#include "chrome/browser/ui/tabs/tab_utils.h"
#include "chrome/browser/ui/web_contents_sizer.h"
#include "chrome/common/url_constants.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/user_metrics.h"
#include "content/public/browser/web_contents.h"
@@ -311,13 +311,13 @@ void TabStripModel::InsertWebContentsAt(int index,
data->set_opener(active_contents);
}
- // TODO(gbillock): Ask the bubble manager whether the WebContents should be
- // blocked, or just let the bubble manager make the blocking call directly
- // and not use this at all.
- web_modal::PopupManager* popup_manager =
- web_modal::PopupManager::FromWebContents(contents);
- if (popup_manager)
- data->set_blocked(popup_manager->IsWebModalDialogActive(contents));
+ // TODO(gbillock): Ask the modal dialog manager whether the WebContents should
+ // be blocked, or just let the modal dialog manager make the blocking call
+ // directly and not use this at all.
+ const web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(contents);
+ if (manager)
+ data->set_blocked(manager->IsDialogActive());
contents_data_.insert(contents_data_.begin() + index, data);
diff --git a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
index dba7d9f..3964197 100644
--- a/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model_unittest.cc
@@ -26,7 +26,6 @@
#include "chrome/common/url_constants.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
-#include "components/web_modal/popup_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_entry.h"
@@ -2527,8 +2526,6 @@ TEST_F(TabStripModelTest, TabBlockedState) {
// Setup a SingleWebContentsDialogManager for tab |contents2|.
web_modal::WebContentsModalDialogManager* modal_dialog_manager =
web_modal::WebContentsModalDialogManager::FromWebContents(contents2);
- web_modal::PopupManager popup_manager(NULL);
- popup_manager.RegisterWith(contents2);
// Show a dialog that blocks tab |contents2|.
// DummySingleWebContentsDialogManager doesn't care about the
diff --git a/chrome/browser/ui/views/desktop_media_picker_views.cc b/chrome/browser/ui/views/desktop_media_picker_views.cc
index cb2cfb0..b323cfb 100644
--- a/chrome/browser/ui/views/desktop_media_picker_views.cc
+++ b/chrome/browser/ui/views/desktop_media_picker_views.cc
@@ -12,7 +12,6 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
-#include "components/web_modal/popup_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents_delegate.h"
diff --git a/chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc b/chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc
index 951ef66..e907e22 100644
--- a/chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc
+++ b/chrome/browser/ui/views/extensions/device_permissions_dialog_view.cc
@@ -12,7 +12,7 @@
#include "chrome/browser/extensions/api/chrome_device_permissions_prompt.h"
#include "chrome/grit/generated_resources.h"
#include "components/constrained_window/constrained_window_views.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/browser_thread.h"
#include "device/usb/usb_device.h"
#include "extensions/common/extension.h"
@@ -162,9 +162,9 @@ gfx::Size DevicePermissionsDialogView::GetPreferredSize() const {
void ChromeDevicePermissionsPrompt::ShowDialog() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- web_modal::PopupManager* popup_manager =
- web_modal::PopupManager::FromWebContents(web_contents());
- if (popup_manager) {
+ web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(web_contents());
+ if (manager) {
constrained_window::ShowWebModalDialogViews(
new DevicePermissionsDialogView(prompt()), web_contents());
} else {
diff --git a/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc b/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc
index f9c1467..638d63c 100644
--- a/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc
+++ b/chrome/browser/ui/views/extensions/media_galleries_dialog_views.cc
@@ -9,7 +9,7 @@
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/locale_settings.h"
#include "components/constrained_window/constrained_window_views.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/native_theme/native_theme.h"
@@ -81,10 +81,11 @@ MediaGalleriesDialogViews::~MediaGalleriesDialogViews() {
void MediaGalleriesDialogViews::AcceptDialogForTesting() {
accepted_ = true;
- web_modal::PopupManager* popup_manager =
- web_modal::PopupManager::FromWebContents(controller_->WebContents());
- DCHECK(popup_manager);
- popup_manager->CloseAllDialogsForTesting(controller_->WebContents());
+ web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(
+ controller_->WebContents());
+ DCHECK(manager);
+ web_modal::WebContentsModalDialogManager::TestApi(manager).CloseAllDialogs();
}
void MediaGalleriesDialogViews::InitChildViews() {
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector.cc b/chrome/browser/ui/views/ssl_client_certificate_selector.cc
index 1963b26..4f89b5c 100644
--- a/chrome/browser/ui/views/ssl_client_certificate_selector.cc
+++ b/chrome/browser/ui/views/ssl_client_certificate_selector.cc
@@ -8,7 +8,6 @@
#include "base/bind_helpers.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/grit/generated_resources.h"
-#include "components/web_modal/popup_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/web_contents.h"
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 3c2a7d4..3ec93e8 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
@@ -13,7 +13,7 @@
#include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
#include "chrome/browser/ui/views/renderer_context_menu/render_view_context_menu_views.h"
#include "chrome/browser/ui/views/sad_tab_view.h"
-#include "components/web_modal/popup_manager.h"
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
@@ -67,10 +67,10 @@ bool ChromeWebContentsViewDelegateViews::Focus() {
}
}
- web_modal::PopupManager* popup_manager =
- web_modal::PopupManager::FromWebContents(web_contents_);
- if (popup_manager)
- popup_manager->WasFocused(web_contents_);
+ const web_modal::WebContentsModalDialogManager* manager =
+ web_modal::WebContentsModalDialogManager::FromWebContents(web_contents_);
+ if (manager && manager->IsDialogActive())
+ manager->FocusTopmostDialog();
return false;
}
diff --git a/chrome/browser/ui/webui/constrained_web_dialog_ui.h b/chrome/browser/ui/webui/constrained_web_dialog_ui.h
index 958fd01..62c9a8b 100644
--- a/chrome/browser/ui/webui/constrained_web_dialog_ui.h
+++ b/chrome/browser/ui/webui/constrained_web_dialog_ui.h
@@ -99,8 +99,8 @@ ConstrainedWebDialogDelegate* ShowConstrainedWebDialog(
content::WebContents* overshadowed);
// Create and show a constrained HTML dialog with auto-resize enabled. The
-// dialog is shown automatically with a call to PopupManager->ShowModalDialog()
-// after document load has completed to avoid UI jankiness.
+// dialog is shown automatically after document load has completed to avoid UI
+// jankiness.
// |browser_context| is used to construct the dialog's WebContents.
// |delegate| controls the behavior of the dialog.
// |overshadowed| is the tab being overshadowed by the dialog.
diff --git a/components/web_modal.gypi b/components/web_modal.gypi
index 7cc7aab..cb257da 100644
--- a/components/web_modal.gypi
+++ b/components/web_modal.gypi
@@ -20,8 +20,6 @@
# Note: sources list duplicated in GN build.
'web_modal/modal_dialog_host.cc',
'web_modal/modal_dialog_host.h',
- 'web_modal/popup_manager.cc',
- 'web_modal/popup_manager.h',
'web_modal/single_web_contents_dialog_manager.h',
'web_modal/web_contents_modal_dialog_host.cc',
'web_modal/web_contents_modal_dialog_host.h',
diff --git a/components/web_modal/BUILD.gn b/components/web_modal/BUILD.gn
index 8250c4a..64385d5 100644
--- a/components/web_modal/BUILD.gn
+++ b/components/web_modal/BUILD.gn
@@ -6,8 +6,6 @@ static_library("web_modal") {
sources = [
"modal_dialog_host.cc",
"modal_dialog_host.h",
- "popup_manager.cc",
- "popup_manager.h",
"single_web_contents_dialog_manager.h",
"web_contents_modal_dialog_host.cc",
"web_contents_modal_dialog_host.h",
diff --git a/components/web_modal/popup_manager.cc b/components/web_modal/popup_manager.cc
deleted file mode 100644
index bde2915..0000000
--- a/components/web_modal/popup_manager.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2014 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 "components/web_modal/popup_manager.h"
-
-#include "components/web_modal/web_contents_modal_dialog_host.h"
-#include "components/web_modal/web_contents_modal_dialog_manager.h"
-#include "content/public/browser/web_contents.h"
-#include "content/public/browser/web_contents_user_data.h"
-#include "ui/gfx/geometry/size.h"
-
-using content::WebContents;
-
-namespace web_modal {
-
-namespace {
-
-const char kPopupManagerUserDataKey[] = "PopupManager";
-
-// This class provides a hook to get a PopupManager from a WebContents.
-// The PopupManager is browser-scoped, but will use a FromWebContents API
-// to attach to each WebContents in that browser.
-class PopupManagerRelay : public content::WebContentsUserData<PopupManager> {
- public:
- explicit PopupManagerRelay(base::WeakPtr<PopupManager> manager)
- : manager_(manager) {}
-
- ~PopupManagerRelay() override {}
-
- base::WeakPtr<PopupManager> manager_;
-};
-
-} // namespace
-
-PopupManager::PopupManager(WebContentsModalDialogHost* host)
- : host_(host),
- weak_factory_(this) {}
-
-PopupManager::~PopupManager() {
-}
-
-void PopupManager::ShowModalDialog(gfx::NativeWindow popup,
- content::WebContents* web_contents) {
- // TODO make a new native popup manager and call ShowPopup.
- // For now just lay off to WCMDM.
- WebContentsModalDialogManager* manager =
- WebContentsModalDialogManager::FromWebContents(web_contents);
- manager->ShowModalDialog(popup);
-}
-
-bool PopupManager::IsWebModalDialogActive(
- const content::WebContents* web_contents) const {
- if (web_contents == NULL)
- return false;
-
- const WebContentsModalDialogManager* manager =
- WebContentsModalDialogManager::FromWebContents(web_contents);
- return manager && manager->IsDialogActive();
-}
-
-void PopupManager::WasFocused(const content::WebContents* web_contents) {
- if (!IsWebModalDialogActive(web_contents))
- return;
-
- const WebContentsModalDialogManager* manager =
- WebContentsModalDialogManager::FromWebContents(web_contents);
- if (manager)
- manager->FocusTopmostDialog();
-}
-
-void PopupManager::WillClose(gfx::NativeWindow popup) {
-}
-
-void PopupManager::RegisterWith(content::WebContents* web_contents) {
- web_contents->SetUserData(kPopupManagerUserDataKey,
- new PopupManagerRelay(weak_factory_.GetWeakPtr()));
- // TODO(gbillock): Need to do something more extreme here to manage changing
- // popup managers with popups in-flight?
-}
-
-void PopupManager::UnregisterWith(content::WebContents* web_contents) {
- web_contents->RemoveUserData(kPopupManagerUserDataKey);
- // TODO(gbillock): Need to do something more extreme here to manage changing
- // popup managers with popups in-flight?
-}
-
-PopupManager* PopupManager::FromWebContents(
- content::WebContents* web_contents) {
- PopupManagerRelay* relay = static_cast<PopupManagerRelay*>(
- web_contents->GetUserData(kPopupManagerUserDataKey));
- if (!relay)
- return NULL;
-
- return relay->manager_.get();
-}
-
-gfx::NativeView PopupManager::GetHostView() const {
- // TODO(gbillock): replace this with a PopupManagerHost or something.
- DCHECK(host_);
- return host_->GetHostView();
-}
-
-void PopupManager::CloseAllDialogsForTesting(
- content::WebContents* web_contents) {
- // TODO: re-implement, probably in terms of something in the host_,
- // or of owned WCMDMs.
- WebContentsModalDialogManager* manager =
- WebContentsModalDialogManager::FromWebContents(web_contents);
- manager->CloseAllDialogs();
-}
-
-} // namespace web_modal
diff --git a/components/web_modal/popup_manager.h b/components/web_modal/popup_manager.h
deleted file mode 100644
index 510aaa2..0000000
--- a/components/web_modal/popup_manager.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2014 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 COMPONENTS_WEB_MODAL_POPUP_MANAGER_H_
-#define COMPONENTS_WEB_MODAL_POPUP_MANAGER_H_
-
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "ui/gfx/native_widget_types.h"
-
-namespace content {
-class WebContents;
-}
-
-namespace gfx {
-class Size;
-}
-
-namespace web_modal {
-
-class WebContentsModalDialogHost;
-
-// Per-Browser class to manage popups (bubbles, web-modal dialogs).
-class PopupManager {
- public:
- // |host| may be null.
- explicit PopupManager(WebContentsModalDialogHost* host);
-
- ~PopupManager();
-
- // Returns the native view which will be the parent of managed popups.
- gfx::NativeView GetHostView() const;
-
- // Temporary method: Provides compatibility with existing
- // WebContentsModalDialogManager code.
- void ShowModalDialog(gfx::NativeWindow popup,
- content::WebContents* web_contents);
-
- // Returns true if a web modal dialog is active and not closed in the
- // given |web_contents|. Note: this is intended for legacy use only; it will
- // be deleted at some point -- new code shouldn't use it.
- bool IsWebModalDialogActive(const content::WebContents* web_contents) const;
-
- // Called when a native popup we own is about to be closed.
- void WillClose(gfx::NativeWindow popup);
-
- // Called by views code to re-activate popups anchored to a particular tab
- // when that tab gets focus. Note that depending on the situation, more than
- // one popup may actually be shown (depending on overlappability). The
- // semantics are that the popups that would have been displayed had the tab
- // never lost focus are re-focused when tab focus is regained.
- void WasFocused(const content::WebContents* web_contents);
-
- // WebContentsUserData-alike API for retrieving the associated window
- // PopupManager from a |web_contents|. Any window which doesn't have a popup
- // manager associated will return null -- popups should not be issued against
- // that window.
- static PopupManager* FromWebContents(content::WebContents* web_contents);
-
- // Should not be called except by WebContents-owning class; not by clients.
- void RegisterWith(content::WebContents* web_contents);
- void UnregisterWith(content::WebContents* web_contents);
-
- // DEPRECATED.
- void CloseAllDialogsForTesting(content::WebContents* web_contents);
-
- private:
- WebContentsModalDialogHost* host_;
-
- base::WeakPtrFactory<PopupManager> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(PopupManager);
-};
-
-} // namespace web_modal
-
-#endif // COMPONENTS_WEB_MODAL_POPUP_MANAGER_H_
diff --git a/components/web_modal/web_contents_modal_dialog_manager.h b/components/web_modal/web_contents_modal_dialog_manager.h
index af790f1..07a0da2 100644
--- a/components/web_modal/web_contents_modal_dialog_manager.h
+++ b/components/web_modal/web_contents_modal_dialog_manager.h
@@ -73,7 +73,6 @@ class WebContentsModalDialogManager
private:
explicit WebContentsModalDialogManager(content::WebContents* web_contents);
friend class content::WebContentsUserData<WebContentsModalDialogManager>;
- friend class PopupManager;
struct DialogState {
DialogState(gfx::NativeWindow dialog,
diff --git a/extensions/browser/app_window/app_window.cc b/extensions/browser/app_window/app_window.cc
index fb99b1b..f621ef5 100644
--- a/extensions/browser/app_window/app_window.cc
+++ b/extensions/browser/app_window/app_window.cc
@@ -289,10 +289,6 @@ void AppWindow::Init(const GURL& url,
helper_.reset(new AppWebContentsHelper(
browser_context_, extension_id_, web_contents(), app_delegate_.get()));
- popup_manager_.reset(
- new web_modal::PopupManager(GetWebContentsModalDialogHost()));
- popup_manager_->RegisterWith(web_contents());
-
UpdateExtensionAppIcon();
AppWindowRegistry::Get(browser_context_)->AddAppWindow(this);
diff --git a/extensions/browser/app_window/app_window.h b/extensions/browser/app_window/app_window.h
index 12eb78d..e92c553 100644
--- a/extensions/browser/app_window/app_window.h
+++ b/extensions/browser/app_window/app_window.h
@@ -11,7 +11,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/sessions/session_id.h"
-#include "components/web_modal/popup_manager.h"
#include "components/web_modal/web_contents_modal_dialog_manager_delegate.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_observer.h"
@@ -514,10 +513,6 @@ class AppWindow : public content::WebContentsDelegate,
// The initial url this AppWindow was navigated to.
GURL initial_url_;
- // Manages popup windows (bubbles, tab-modals) visible overlapping the
- // app window.
- scoped_ptr<web_modal::PopupManager> popup_manager_;
-
// Bit field of FullscreenType.
int fullscreen_types_;