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

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: . 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 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 {
18 public:
19 SinglePopupManagerDelegate() {}
20 virtual ~SinglePopupManagerDelegate() {}
Finnur 2014/05/16 12:38:14 nit: Move these impls to .cc
21
22 // Notify the delegate that the dialog is closing. The native
23 // 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
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;
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
43
44 // Makes the popup visible. Only one popup will be shown at a time per tab.
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
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
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() {}
Finnur 2014/05/16 12:38:14 nit: Move to .cc
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698