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

Side by Side 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: tweaks 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_
6 #define COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_
7
8 #include "components/web_modal/native_web_contents_modal_dialog.h"
9
10 namespace content {
11 class WebContents;
12 }
13
14 namespace web_modal {
15
16 // Interface from SinglePopupManager to PopupManager.
17 class SinglePopupManagerDelegate {
Finnur 2014/06/30 13:53:36 I kind of would have expected to see this class wi
Greg Billock 2014/07/01 00:53:05 Not really. It's descending from the modal dlg mgr
18 public:
19 SinglePopupManagerDelegate() {}
20 virtual ~SinglePopupManagerDelegate() {}
21
22 // Notify the delegate that the dialog is closing. The
23 // calling SinglePopupManager will be deleted before the end of this call.
24 virtual void WillClose(NativePopup popup) = 0;
25
26 private:
27 DISALLOW_COPY_AND_ASSIGN(SinglePopupManagerDelegate);
28 };
29
30 // Provides an interface for platform-specific UI implementation for popups.
31 // Each object will manage a single NativePopup window during its lifecycle.
32 // The rule of thumb is that only one popup will be shown at a time per tab.
33 // (Exceptions exist.)
34 //
35 // Implementation classes should accept a NativePopup at construction time
36 // and register to be notified when the dialog is closing, so that it can
37 // notify its delegate (WillClose method).
38 class SinglePopupManager {
39 public:
40 virtual ~SinglePopupManager() {}
41
42 // If the manager returns non-null to this call, it is bound to a particular
43 // tab and will be hidden and shown if that tab visibility changes.
44 virtual content::WebContents* GetBoundWebContents() = 0;
45
46 // Makes the popup visible.
47 virtual void Show() = 0;
48
49 // Hides the popup without closing it.
50 virtual void Hide() = 0;
51
52 // Closes the popup.
53 // This method must call WillClose() on the delegate.
54 // Important note: this object will be deleted at the close of that
55 // invocation.
56 virtual void Close() = 0;
57
58 // Sets focus on the popup.
59 virtual void Focus() = 0;
60
61 virtual void Pulse() = 0;
Finnur 2014/06/30 13:53:36 nit: Pulsate the popup, in order to draw the user'
Greg Billock 2014/07/01 00:53:05 Done.
62
63 // Returns the popup under management by this object.
64 virtual NativePopup popup() = 0;
65
66 // Returns true if the popup under management was initiated by a user
67 // gesture. When this is true, the popup manager will hide any existing
68 // popups and move the newly-created NativePopup to the top of the display
69 // queue.
70 virtual bool HasUserGesture() = 0;
71
72 // Returns true if the popup under management is tolerant of being overlapped
73 // by other popups. This may be true for large web-modals which cover most of
74 // the window real estate (e.g. print preview).
75 virtual bool MayBeOverlapped() = 0;
76
77 // Returns true if the popup under management should close if there is a
78 // navigation underneath it, including the showing of any interstitial
79 // content. Popups which relate to the web content being displayed will
80 // ordinarily set this to true.
81 // TODO(gbillock): should be generalized in code location or by splitting
82 // the API to support the same-origin logic in WCMDM::DidNavigateMainFrame.
83 // TBD right now because we're not sure which knobs need to be set here.
84 virtual bool ShouldCloseOnNavigation() = 0;
85
86 protected:
87 SinglePopupManager() {}
Finnur 2014/06/30 13:53:36 nit: You have two ctors and two dtors in this .h f
Greg Billock 2014/07/01 00:53:05 These are interface stubs, which my impression was
88
89 private:
90 DISALLOW_COPY_AND_ASSIGN(SinglePopupManager);
91 };
92
93 } // namespace web_modal
94
95 #endif // COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698