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

Unified Diff: components/web_modal/single_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, 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/single_popup_manager.h
diff --git a/components/web_modal/single_popup_manager.h b/components/web_modal/single_popup_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..bfd52ebe13b8ed0db22f744518a05cc9487718ea
--- /dev/null
+++ b/components/web_modal/single_popup_manager.h
@@ -0,0 +1,84 @@
+// 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_SINGLE_POPUP_MANAGER_H_
+#define COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_
+
+#include "components/web_modal/native_web_contents_modal_dialog.h"
+
+namespace content {
+class WebContents;
+}
+
+namespace web_modal {
+
+// Interface from SinglePopupManager to PopupManager.
+class SinglePopupManagerDelegate {
+ public:
+ SinglePopupManagerDelegate() {}
+ virtual ~SinglePopupManagerDelegate() {}
+
+ // Notify the delegate that the dialog is closing. The native
+ // manager will be deleted before the end of this call.
+ virtual void WillClose(NativePopup popup) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SinglePopupManagerDelegate);
+};
+
+// Provides an interface for platform-specific UI implementation for popups.
+// Each object will manage a single NativePopup window during its lifecycle.
+//
+// Implementation classes should accept a NativePopup at construction time
+// and register to be notified when the dialog is closing, so that it can
+// notify its delegate (WillClose method).
+class SinglePopupManager {
+ public:
+ virtual ~SinglePopupManager() {}
+
+ // If the manager returns non-null to this call, it is bound to a particular
+ // tab and will be hidden and shown if that tab visibility changes.
+ virtual content::WebContents* IsBoundToWebContents() = 0;
+
+ // Makes the popup visible. Only one popup will be shown at a time per tab.
msw 2014/05/22 04:08:45 noting per-tab behavior here is incorrect (or jump
Greg Billock 2014/05/22 18:25:47 I know what you mean; this is basically guidance f
+ // (Unless there's an overlappable popup.)
+ virtual void Show() = 0;
+
+ // Hides the popup without closing it.
+ virtual void Hide() = 0;
+
+ // Closes the popup.
+ // If this method causes a WillClose() call to the delegate, the manager
+ // will be deleted at the close of that invocation.
+ virtual void Close() = 0;
+
+ // Sets focus on the popup.
+ virtual void Focus() = 0;
+
+ virtual void Pulse() = 0;
+
+ // Returns the popup under management by this object.
+ virtual NativePopup popup() = 0;
+
+ // Returns true if the popup under management was initiated by a user
+ // gesture. When this is true, the popup manager will hide any existing
+ // popups and move the newly-created NativePopup to the top of the display
+ // queue.
+ virtual bool HasUserGesture() = 0;
+
+ // Returns true if the popup under management is tolerant of being overlapped
+ // by other popups. This may be true for large web-modals which cover most of
+ // the window real estate (e.g. print preview).
+ virtual bool MayBeOverlapped() = 0;
+
+ protected:
+ SinglePopupManager() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SinglePopupManager);
+};
+
+} // namespace web_modal
+
+#endif // COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_
« components/web_modal/popup_manager.h ('K') | « components/web_modal/popup_manager_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698