Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Unified Diff: chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cocoa, more test fiddles, etc Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
diff --git a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
index bddbc41dd227af8d5cd8c61b9fb14b2b402fd474..09238930cb8e465cada23ac33e40b9c4b74d5f7c 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_popup_controller.mm
@@ -13,10 +13,11 @@
#include "chrome/browser/extensions/extension_view_host_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
#import "chrome/browser/ui/cocoa/extensions/extension_view_mac.h"
#import "chrome/browser/ui/cocoa/info_bubble_window.h"
-#include "components/web_modal/web_contents_modal_dialog_manager.h"
+#include "components/web_modal/popup_manager.h"
#include "content/public/browser/devtools_agent_host.h"
#include "content/public/browser/devtools_manager.h"
#include "content/public/browser/notification_details.h"
@@ -207,11 +208,12 @@ class DevtoolsNotificationBridge : public content::NotificationObserver {
- (void)close {
// |windowWillClose:| could have already been called. http://crbug.com/279505
if (host_) {
- web_modal::WebContentsModalDialogManager* modalDialogManager =
- web_modal::WebContentsModalDialogManager::FromWebContents(
- host_->host_contents());
- if (modalDialogManager &&
- modalDialogManager->IsDialogActive()) {
+ // TODO(gbillock): Change this API to say directly if the current popup
+ // should block tab close? This is a bit over-reaching.
+ Browser* browser =
+ chrome::FindBrowserWithWebContents(host_->host_contents());
+ if (browser && browser->popup_manager()->IsWebModalDialogActive(
Mike Wittman 2014/06/25 21:12:44 Can we use PopupManager::FromWebContents() here as
Greg Billock 2014/06/26 00:21:12 Done.
+ host_->host_contents())) {
return;
}
// We must shutdown host_ immediately, and it will notify RendererProcess
@@ -237,11 +239,11 @@ class DevtoolsNotificationBridge : 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::WebContentsModalDialogManager* modalDialogManager =
- web_modal::WebContentsModalDialogManager::FromWebContents(
+ web_modal::PopupManager* popupManager =
+ web_modal::PopupManager::FromWebContents(
host_->host_contents());
- if (modalDialogManager &&
- modalDialogManager->IsDialogActive()) {
+ if (popupManager &&
+ popupManager->IsWebModalDialogActive(host_->host_contents())) {
ignoreWindowDidResignKey_ = YES;
return;
}

Powered by Google App Engine
This is Rietveld 408576698