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

Unified Diff: components/web_modal/popup_manager.h

Issue 287123002: [WebModals] New API for browser-scoped popup management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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
« no previous file with comments | « components/web_modal/native_web_contents_modal_dialog.h ('k') | components/web_modal/popup_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/web_modal/popup_manager.h
diff --git a/components/web_modal/popup_manager.h b/components/web_modal/popup_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..cd4d2bbe50a9acb74e815f493f42f8eadc1d0f83
--- /dev/null
+++ b/components/web_modal/popup_manager.h
@@ -0,0 +1,83 @@
+// 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 "components/web_modal/single_popup_manager.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 SinglePopupManagerDelegate {
+ public:
+ // |host| may be null.
+ PopupManager(WebContentsModalDialogHost* host);
+
+ virtual ~PopupManager();
+
+ // Returns the native view which will be the parent of managed popups.
+ virtual gfx::NativeView GetHostView() const;
+
+ // Schedules a popup governed by the |manager| to be shown. The popup
+ // may be shown inline with this call, at a later time, or not at all.
+ virtual void ShowPopup(scoped_ptr<SinglePopupManager> manager);
+
+ // Temporary method: Provides compatibility with existing
+ // WebContentsModalDialogManager code.
+ virtual void ShowModalDialog(NativePopup 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.
+ virtual bool IsWebModalDialogActive(
+ const content::WebContents* web_contents) const;
+
+ // Called when a NativePopup we own is about to be closed.
+ virtual void WillClose(NativePopup popup) OVERRIDE;
+
+ // 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.
+ virtual 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.
+ virtual 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_
« no previous file with comments | « components/web_modal/native_web_contents_modal_dialog.h ('k') | components/web_modal/popup_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698