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

Side by Side Diff: components/web_modal/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_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 // given |web_contents|.
36 bool IsPopupActive(const content::WebContents* web_contents) const;
37
38 // Called by views code to re-activate popups anchored to a particular tab
39 // when that tab gets focus. Note that depending on the situation, more than
40 // one popup may actually be shown (depending on overlappability). The
41 // semantics are that the popups that would have been displayed had the tab
42 // never lost focus are re-displayed when focus is regained.
43 void FocusTopmostPopupForWebContentsIfActive(
44 const content::WebContents* web_contents);
45
46 // Called when a NativePopup we own is about to be closed.
47 virtual void WillClose(NativePopup popup) OVERRIDE;
48
49 private:
50 friend class PopupManagerTest;
51
52 typedef std::deque<SinglePopupManager*> PopupList;
53
54 // Utility function to get the state for a popup.
55 PopupList::iterator FindPopupState(NativePopup popup);
56
57 // Blocks/unblocks interaction with renderer process.
58 void BlockWebContentsInteraction(bool blocked);
59
60 void CloseAllPopups();
61
62 // Notified from content::WebContentsObserver:
63 void DidNavigateMainFrame(
64 content::WebContents* web_contents,
65 const content::LoadCommittedDetails& details,
66 const content::FrameNavigateParams& params);
67 void DidGetIgnoredUIEvent(content::WebContents* web_contents);
68 void WasShown(content::WebContents* web_contents);
69 void WasHidden(content::WebContents* web_contents);
70 void WebContentsDestroyed(content::WebContents* web_contents);
71 void DidAttachInterstitialPage(content::WebContents* web_contents);
72
73 // All active popups.
74 PopupList child_popups_;
75
76 // True while closing all popups.
77 bool closing_all_popups_;
78
79 DISALLOW_COPY_AND_ASSIGN(PopupManager);
80 };
81
82 } // namespace web_modal
83
84 #endif // COMPONENTS_WEB_MODAL_POPUP_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698