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

Unified Diff: components/web_modal/popup_manager.cc

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make PopupManager a thin API for WCMDM Created 6 years, 7 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: components/web_modal/popup_manager.cc
diff --git a/components/web_modal/popup_manager.cc b/components/web_modal/popup_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8238504e3e920231e0290e97a11a70010ef14f33
--- /dev/null
+++ b/components/web_modal/popup_manager.cc
@@ -0,0 +1,64 @@
+// 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 "components/web_modal/popup_manager.h"
+
+#include "components/web_modal/web_contents_modal_dialog_manager.h"
+#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/navigation_entry.h"
+#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/web_contents.h"
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
Mike Wittman 2014/06/02 19:54:50 I think all these includes can be removed except f
Greg Billock 2014/06/03 01:30:07 Done.
+
+using content::WebContents;
+
+namespace web_modal {
+
+PopupManager::PopupManager() {
+}
+
+PopupManager::~PopupManager() {
+}
+
+void PopupManager::ShowPopup(scoped_ptr<SinglePopupManager> manager) {
+ content::WebContents* web_contents = manager->GetBoundWebContents();
+ // TODO(gbillock): get rid of this when we handle bubbles
+ DCHECK(web_contents);
+
+ // TODO(gbillock): remove when we port the popup management logic to this
+ // class.
+ NativeWebContentsModalDialog dialog =
+ static_cast<NativeWebContentsModalDialog>(manager->popup());
+
+ WebContentsModalDialogManager* wm_manager =
+ WebContentsModalDialogManager::FromWebContents(web_contents);
+ DCHECK(wm_manager);
+ wm_manager->ShowModalDialog(dialog);
+}
+
+
+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() : false;
+}
+
+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(NativePopup popup) {
Mike Wittman 2014/06/02 19:54:50 Forward on to WebContentsModalDialogManager::WillC
Greg Billock 2014/06/03 01:30:07 I still need to do a bit more migrating. I haven't
+}
+
+} // namespace web_modal

Powered by Google App Engine
This is Rietveld 408576698