OLD | NEW |
---|---|
(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 { | |
18 public: | |
19 SinglePopupManagerDelegate() {} | |
20 virtual ~SinglePopupManagerDelegate() {} | |
21 | |
22 // Notify the delegate that the dialog is closing. The native | |
23 // manager 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 // | |
33 // Implementation classes should accept a NativePopup at construction time | |
34 // and register to be notified when the dialog is closing, so that it can | |
35 // notify its delegate (WillClose method). | |
36 class SinglePopupManager { | |
37 public: | |
38 virtual ~SinglePopupManager() {} | |
39 | |
40 // If the manager returns non-null to this call, it is bound to a particular | |
41 // tab and will be hidden and shown if that tab visibility changes. | |
42 virtual content::WebContents* IsBoundToWebContents() = 0; | |
43 | |
44 // 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
| |
45 // (Unless there's an overlappable popup.) | |
46 virtual void Show() = 0; | |
47 | |
48 // Hides the popup without closing it. | |
49 virtual void Hide() = 0; | |
50 | |
51 // Closes the popup. | |
52 // If this method causes a WillClose() call to the delegate, the manager | |
53 // will be deleted at the close of that invocation. | |
54 virtual void Close() = 0; | |
55 | |
56 // Sets focus on the popup. | |
57 virtual void Focus() = 0; | |
58 | |
59 virtual void Pulse() = 0; | |
60 | |
61 // Returns the popup under management by this object. | |
62 virtual NativePopup popup() = 0; | |
63 | |
64 // Returns true if the popup under management was initiated by a user | |
65 // gesture. When this is true, the popup manager will hide any existing | |
66 // popups and move the newly-created NativePopup to the top of the display | |
67 // queue. | |
68 virtual bool HasUserGesture() = 0; | |
69 | |
70 // Returns true if the popup under management is tolerant of being overlapped | |
71 // by other popups. This may be true for large web-modals which cover most of | |
72 // the window real estate (e.g. print preview). | |
73 virtual bool MayBeOverlapped() = 0; | |
74 | |
75 protected: | |
76 SinglePopupManager() {} | |
77 | |
78 private: | |
79 DISALLOW_COPY_AND_ASSIGN(SinglePopupManager); | |
80 }; | |
81 | |
82 } // namespace web_modal | |
83 | |
84 #endif // COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_ | |
OLD | NEW |