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

Side by Side Diff: components/web_modal/single_popup_manager.h

Issue 985133002: Remove NativeWebContentsModalDialog and NativePopup typedefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@extension-popup
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_ 5 #ifndef COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_
6 #define COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_ 6 #define COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_
7 7
8 #include "components/web_modal/native_web_contents_modal_dialog.h" 8 #include "ui/gfx/native_widget_types.h"
9 9
10 namespace content { 10 namespace content {
11 class WebContents; 11 class WebContents;
12 } 12 }
13 13
14 namespace web_modal { 14 namespace web_modal {
15 15
16 // Interface from SinglePopupManager to PopupManager. 16 // Interface from SinglePopupManager to PopupManager.
17 class SinglePopupManagerDelegate { 17 class SinglePopupManagerDelegate {
18 public: 18 public:
19 SinglePopupManagerDelegate() {} 19 SinglePopupManagerDelegate() {}
20 virtual ~SinglePopupManagerDelegate() {} 20 virtual ~SinglePopupManagerDelegate() {}
21 21
22 // Notify the delegate that the dialog is closing. The 22 // Notify the delegate that the dialog is closing. The
23 // calling SinglePopupManager will be deleted before the end of this call. 23 // calling SinglePopupManager will be deleted before the end of this call.
24 virtual void WillClose(NativePopup popup) = 0; 24 virtual void WillClose(gfx::NativeWindow popup) = 0;
25 25
26 private: 26 private:
27 DISALLOW_COPY_AND_ASSIGN(SinglePopupManagerDelegate); 27 DISALLOW_COPY_AND_ASSIGN(SinglePopupManagerDelegate);
28 }; 28 };
29 29
30 // Provides an interface for platform-specific UI implementation for popups. 30 // Provides an interface for platform-specific UI implementation for popups.
31 // Each object will manage a single NativePopup window during its lifecycle. 31 // Each object will manage a single native popup window during its lifecycle.
32 // The rule of thumb is that only one popup will be shown at a time per tab. 32 // The rule of thumb is that only one popup will be shown at a time per tab.
33 // (Exceptions exist.) 33 // (Exceptions exist.)
34 // 34 //
35 // Implementation classes should accept a NativePopup at construction time 35 // Implementation classes should accept a native popup at construction time
36 // and register to be notified when the dialog is closing, so that it can 36 // and register to be notified when the dialog is closing, so that it can
37 // notify its delegate (WillClose method). 37 // notify its delegate (WillClose method).
38 class SinglePopupManager { 38 class SinglePopupManager {
39 public: 39 public:
40 virtual ~SinglePopupManager() {} 40 virtual ~SinglePopupManager() {}
41 41
42 // If the manager returns non-null to this call, it is bound to a particular 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. 43 // tab and will be hidden and shown if that tab visibility changes.
44 virtual content::WebContents* GetBoundWebContents() = 0; 44 virtual content::WebContents* GetBoundWebContents() = 0;
45 45
46 // Makes the popup visible. 46 // Makes the popup visible.
47 virtual void Show() = 0; 47 virtual void Show() = 0;
48 48
49 // Hides the popup without closing it. 49 // Hides the popup without closing it.
50 virtual void Hide() = 0; 50 virtual void Hide() = 0;
51 51
52 // Closes the popup. 52 // Closes the popup.
53 // This method must call WillClose() on the delegate. 53 // This method must call WillClose() on the delegate.
54 // Important note: this object will be deleted at the close of that 54 // Important note: this object will be deleted at the close of that
55 // invocation. 55 // invocation.
56 virtual void Close() = 0; 56 virtual void Close() = 0;
57 57
58 // Sets focus on the popup. 58 // Sets focus on the popup.
59 virtual void Focus() = 0; 59 virtual void Focus() = 0;
60 60
61 // Pulsates the popup to draw the user's attention to it. 61 // Pulsates the popup to draw the user's attention to it.
62 virtual void Pulse() = 0; 62 virtual void Pulse() = 0;
63 63
64 // Returns the popup under management by this object. 64 // Returns the popup under management by this object.
65 virtual NativePopup popup() = 0; 65 virtual gfx::NativeWindow popup() = 0;
66 66
67 // Returns true if the popup under management was initiated by a user 67 // Returns true if the popup under management was initiated by a user
68 // gesture. When this is true, the popup manager will hide any existing 68 // gesture. When this is true, the popup manager will hide any existing
69 // popups and move the newly-created NativePopup to the top of the display 69 // popups and move the newly-created native popup to the top of the display
70 // queue. 70 // queue.
71 virtual bool HasUserGesture() = 0; 71 virtual bool HasUserGesture() = 0;
72 72
73 // Returns true if the popup under management is tolerant of being overlapped 73 // Returns true if the popup under management is tolerant of being overlapped
74 // by other popups. This may be true for large web-modals which cover most of 74 // by other popups. This may be true for large web-modals which cover most of
75 // the window real estate (e.g. print preview). 75 // the window real estate (e.g. print preview).
76 virtual bool MayBeOverlapped() = 0; 76 virtual bool MayBeOverlapped() = 0;
77 77
78 // Returns true if the popup under management should close if there is a 78 // Returns true if the popup under management should close if there is a
79 // navigation underneath it, including the showing of any interstitial 79 // navigation underneath it, including the showing of any interstitial
80 // content. Popups which relate to the web content being displayed will 80 // content. Popups which relate to the web content being displayed will
81 // ordinarily set this to true. 81 // ordinarily set this to true.
82 // TODO(gbillock): should be generalized in code location or by splitting 82 // TODO(gbillock): should be generalized in code location or by splitting
83 // the API to support the same-origin logic in WCMDM::DidNavigateMainFrame. 83 // the API to support the same-origin logic in WCMDM::DidNavigateMainFrame.
84 // TBD right now because we're not sure which knobs need to be set here. 84 // TBD right now because we're not sure which knobs need to be set here.
85 virtual bool ShouldCloseOnNavigation() = 0; 85 virtual bool ShouldCloseOnNavigation() = 0;
86 86
87 protected: 87 protected:
88 SinglePopupManager() {} 88 SinglePopupManager() {}
89 89
90 private: 90 private:
91 DISALLOW_COPY_AND_ASSIGN(SinglePopupManager); 91 DISALLOW_COPY_AND_ASSIGN(SinglePopupManager);
92 }; 92 };
93 93
94 } // namespace web_modal 94 } // namespace web_modal
95 95
96 #endif // COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_ 96 #endif // COMPONENTS_WEB_MODAL_SINGLE_POPUP_MANAGER_H_
OLDNEW
« no previous file with comments | « components/web_modal/popup_manager.cc ('k') | components/web_modal/single_web_contents_dialog_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698