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_POPUP_MANAGER_H_ | |
6 #define COMPONENTS_WEB_MODAL_POPUP_MANAGER_H_ | |
7 | |
8 #include <deque> | |
9 | |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "components/web_modal/single_popup_manager.h" | |
12 #include "content/public/browser/web_contents_user_data.h" | |
13 #include "ui/gfx/native_widget_types.h" | |
14 | |
15 namespace content { | |
16 class FrameNavigateParams; | |
17 struct LoadCommittedDetails; | |
18 class WebContents; | |
19 } | |
20 | |
21 namespace web_modal { | |
22 | |
23 // Per-Browser class to manage popups (bubbles, web-modal dialogs). | |
24 class PopupManager : public SinglePopupManagerDelegate { | |
Finnur
2014/05/16 12:38:14
What is the scope/lifetime of this object?
Greg Billock
2014/05/16 15:49:56
Good question. I'm not sure how to manage creation
| |
25 public: | |
26 virtual ~PopupManager(); | |
27 | |
28 // Schedules a popup governed by the |manager| to be shown. The popup | |
29 // may not be shown inline with this call, at a later asynchronous time, | |
Finnur
2014/05/16 12:38:14
s/not// ?
s/asynchronous// ?
Greg Billock
2014/05/20 19:27:55
Done.
| |
30 // or not at all. | |
31 void ShowPopup(scoped_ptr<SinglePopupManager> manager); | |
32 | |
33 // Returns true if any popups are active and not closed in the | |
34 // currently-visible WebContents. | |
35 bool IsPopupActiveInCurrentWebContents() const; | |
Finnur
2014/05/16 12:38:14
The WebContents association here I found a bit sur
Greg Billock
2014/05/16 15:49:56
I don't know that this method survives. The intent
msw
2014/05/16 17:10:57
This part of the API could be more agnostic about
Greg Billock
2014/05/16 23:28:39
That sounds good to me. We could also just wait to
msw
2014/05/22 04:08:45
Even if it doesn't make sense to replace this with
Greg Billock
2014/05/22 18:25:47
reworked this substantially
| |
36 | |
37 // Focus the topmost popup. IsPopupActiveInCurrentWebContents() must be true | |
38 // when calling this function. | |
Finnur
2014/05/16 12:38:14
From purely an API standpoint (not looking at the
Greg Billock
2014/05/16 15:49:56
This is in the per-WC API for use by the WC view d
Mike Wittman
2014/05/16 20:35:40
The purpose of this function on the WCMD side is t
Greg Billock
2014/05/16 23:28:39
Overall, do you think it should be a design goal t
Mike Wittman
2014/05/17 00:24:06
Yes, I'd prefer to see this encompass the WCMDM fu
msw
2014/05/20 16:51:32
I'd also like this class to replace WCMDM, but per
Greg Billock
2014/05/20 19:27:55
No. I'm planning on this CL basically being a plac
| |
39 void FocusTopmostPopup(); | |
Finnur
2014/05/16 12:38:14
This function is not called at the moment. Who do
Greg Billock
2014/05/22 18:25:47
added call site to cl
| |
40 | |
41 // Called when a NativePopup we own is about to be closed. | |
42 virtual void WillClose(NativePopup popup) OVERRIDE; | |
Finnur
2014/05/16 12:38:14
At the moment only called by the test, which is al
Greg Billock
2014/05/16 15:49:56
Right. This is the main entry point for SinglePopu
msw
2014/05/16 17:10:57
Can't notifications of closure be handled through
Mike Wittman
2014/05/16 20:35:40
That's how it's currently done for WCMDs: the View
Greg Billock
2014/05/16 23:28:39
That's correct. If we had a cross-platform "Widget
| |
43 | |
44 private: | |
45 friend class PopupManagerTest; | |
46 | |
47 explicit PopupManager(); | |
Finnur
2014/05/16 12:38:14
nit: explicit?
Greg Billock
2014/05/20 19:27:55
Done.
| |
48 | |
49 struct PopupState { | |
50 PopupState(NativePopup popup, scoped_ptr<SinglePopupManager> manager); | |
51 ~PopupState(); | |
52 | |
53 NativePopup popup; | |
54 scoped_ptr<SinglePopupManager> manager; | |
55 bool close_on_interstitial_webui; | |
56 }; | |
57 | |
58 typedef std::deque<PopupState*> PopupList; | |
59 | |
60 // Utility function to get the state for a popup. | |
61 PopupList::iterator FindPopupState(NativePopup popup); | |
62 | |
63 // Blocks/unblocks interaction with renderer process. | |
64 void BlockWebContentsInteraction(bool blocked); | |
65 | |
66 void CloseAllPopups(); | |
Finnur
2014/05/16 12:38:14
This is currently private. Won't this need to be p
Greg Billock
2014/05/16 15:49:56
Shouldn't need to be. It isn't in the current WCMD
| |
67 | |
68 // Notified from content::WebContentsObserver: | |
69 void DidNavigateMainFrame( | |
70 content::WebContents* web_contents, | |
71 const content::LoadCommittedDetails& details, | |
72 const content::FrameNavigateParams& params); | |
73 void DidGetIgnoredUIEvent(content::WebContents* web_contents); | |
74 void WasShown(content::WebContents* web_contents); | |
75 void WasHidden(content::WebContents* web_contents); | |
76 void WebContentsDestroyed(content::WebContents* web_contents); | |
77 void DidAttachInterstitialPage(content::WebContents* web_contents); | |
78 | |
79 // All active popups. | |
80 PopupList child_dialogs_; | |
Finnur
2014/05/16 12:38:14
We seem to be conflating dialogs and popups (bubbl
Greg Billock
2014/05/16 15:49:56
Yeah, I thought I got them all in the .h file, but
Greg Billock
2014/05/20 19:27:55
Done.
| |
81 | |
82 // True while closing all popups. | |
83 bool closing_all_popups_; | |
84 | |
85 DISALLOW_COPY_AND_ASSIGN(PopupManager); | |
86 }; | |
87 | |
88 } // namespace web_modal | |
89 | |
90 #endif // COMPONENTS_WEB_MODAL_POPUP_MANAGER_H_ | |
OLD | NEW |