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 struct 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 { | |
25 public: | |
26 PopupManager(); | |
27 | |
28 virtual ~PopupManager(); | |
29 | |
30 // Schedules a popup governed by the |manager| to be shown. The popup | |
31 // may be shown inline with this call, at a later time, or not at all. | |
32 void ShowPopup(scoped_ptr<SinglePopupManager> manager); | |
33 | |
34 // Returns true if any popups are active and not closed in the | |
35 // currently-visible WebContents. | |
36 bool IsPopupActiveInCurrentWebContents() const; | |
msw
2014/05/22 04:08:45
As per the older comment thread, consider IsPopupA
Greg Billock
2014/05/22 18:25:47
I've brought call sites into the CL now, and there
msw
2014/05/22 21:40:02
That's totally reasonable, at least for now. If no
Greg Billock
2014/05/27 22:42:02
ok, let's head that direction. Added this API with
| |
37 | |
38 // Focus the topmost popup. IsPopupActiveInCurrentWebContents() must be true | |
msw
2014/05/22 04:08:45
Perhaps this should just be a no-op if IsPopupActi
Greg Billock
2014/05/22 18:25:47
Agreed.
| |
39 // when calling this function. | |
40 void FocusTopmostPopup(); | |
msw
2014/05/22 04:08:45
Can you describe what topmost means in the comment
Greg Billock
2014/05/22 18:25:47
I've changed this significantly, updated the comme
msw
2014/05/22 21:40:02
Oh jeez, you mean (1) a wcmd is shown for Tab A (2
Finnur
2014/05/23 15:29:52
This is anecdotal, but I think I've only used bubb
msw
2014/05/23 17:22:42
I'm very much in favor of any effort to reduce the
Greg Billock
2014/05/27 22:42:02
Do we have enough info in the SinglePopupManager t
| |
41 | |
42 // Called when a NativePopup we own is about to be closed. | |
43 virtual void WillClose(NativePopup popup) OVERRIDE; | |
44 | |
45 private: | |
46 friend class PopupManagerTest; | |
47 | |
48 struct PopupState { | |
msw
2014/05/22 04:08:45
How does this relate to SinglePopupManager itself?
Greg Billock
2014/05/22 18:25:47
Yeah, that was kind of a long-term plan for WCMDM.
| |
49 PopupState(NativePopup popup, scoped_ptr<SinglePopupManager> manager); | |
50 ~PopupState(); | |
51 | |
52 NativePopup popup; | |
53 scoped_ptr<SinglePopupManager> manager; | |
54 bool close_on_interstitial_webui; | |
msw
2014/05/22 04:08:45
nit: I removed the corresponding flag from WCMDM's
Greg Billock
2014/05/22 18:25:47
Sensible. I added this as a field of the SinglePop
| |
55 }; | |
56 | |
57 typedef std::deque<PopupState*> PopupList; | |
58 | |
59 // Utility function to get the state for a popup. | |
60 PopupList::iterator FindPopupState(NativePopup popup); | |
61 | |
62 // Blocks/unblocks interaction with renderer process. | |
63 void BlockWebContentsInteraction(bool blocked); | |
64 | |
65 void CloseAllPopups(); | |
66 | |
67 // Notified from content::WebContentsObserver: | |
68 void DidNavigateMainFrame( | |
69 content::WebContents* web_contents, | |
70 const content::LoadCommittedDetails& details, | |
71 const content::FrameNavigateParams& params); | |
72 void DidGetIgnoredUIEvent(content::WebContents* web_contents); | |
73 void WasShown(content::WebContents* web_contents); | |
74 void WasHidden(content::WebContents* web_contents); | |
75 void WebContentsDestroyed(content::WebContents* web_contents); | |
76 void DidAttachInterstitialPage(content::WebContents* web_contents); | |
77 | |
78 // All active popups. | |
79 PopupList child_popups_; | |
80 | |
81 // True while closing all popups. | |
82 bool closing_all_popups_; | |
83 | |
84 DISALLOW_COPY_AND_ASSIGN(PopupManager); | |
85 }; | |
86 | |
87 } // namespace web_modal | |
88 | |
89 #endif // COMPONENTS_WEB_MODAL_POPUP_MANAGER_H_ | |
OLD | NEW |