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

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() {}
Finnur 2014/05/16 12:38:14 nit: Move these impls to .cc
+
+ // Notify the delegate that the dialog is closing. The native
+ // manager will be deleted before the end of this call.
Finnur 2014/05/16 12:38:14 The term native manager is a little lost in this c
+ 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;
Mike Wittman 2014/05/16 20:35:40 GetBoundWebContents? IsBoundWebContents is odd for
msw 2014/05/22 04:08:45 I agree with Mike's comment here, can you try to a
Greg Billock 2014/05/22 18:25:47 Yeah, I've been focusing more on the PopupManager
+
+ // Makes the popup visible. Only one popup will be shown at a time per tab.
+ // (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
Mike Wittman 2014/05/16 20:35:40 This comment is misleading, both here and in the S
Greg Billock 2014/05/22 18:25:47 I noticed that too reading this over. Changing. A
Mike Wittman 2014/05/23 19:02:34 I don't see a better way to do this off-hand. In t
+ // 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() {}
Finnur 2014/05/16 12:38:14 nit: Move to .cc
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SinglePopupManager);
+};
+
+} // namespace web_modal
+
+#endif // COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698