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

Side by Side Diff: chrome/browser/ui/web_contents_modal_dialog_manager.h

Issue 11633052: Rename platform-independent ConstrainedWindow types to WebContentsModalDialog types (part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use gtk_widget_get_toplevel for GetNativeWindow Created 7 years, 11 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ 5 #ifndef CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_
6 #define CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ 6 #define CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "content/public/browser/web_contents_observer.h" 10 #include "content/public/browser/web_contents_observer.h"
11 #include "content/public/browser/web_contents_user_data.h" 11 #include "content/public/browser/web_contents_user_data.h"
12 12
13 class ConstrainedWindow; 13 class WebContentsModalDialog;
14 class ConstrainedWindowTabHelperDelegate; 14 class WebContentsModalDialogManagerDelegate;
15 15
16 // Per-tab class to manage constrained windows. 16 // Per-WebContents class to manage WebContents-modal dialogs.
17 class ConstrainedWindowTabHelper 17 class WebContentsModalDialogManager
18 : public content::WebContentsObserver, 18 : public content::WebContentsObserver,
19 public content::WebContentsUserData<ConstrainedWindowTabHelper> { 19 public content::WebContentsUserData<WebContentsModalDialogManager> {
20 public: 20 public:
21 virtual ~ConstrainedWindowTabHelper(); 21 virtual ~WebContentsModalDialogManager();
22 22
23 ConstrainedWindowTabHelperDelegate* delegate() const { return delegate_; } 23 WebContentsModalDialogManagerDelegate* delegate() const { return delegate_; }
24 void set_delegate(ConstrainedWindowTabHelperDelegate* d) { delegate_ = d; } 24 void set_delegate(WebContentsModalDialogManagerDelegate* d) { delegate_ = d; }
25 25
26 // Adds the given window to the list of child windows. The window will notify 26 // Adds the given dialog to the list of child dialogs. The dialog will notify
27 // via WillClose() when it is being destroyed. 27 // via WillClose() when it is being destroyed.
28 void AddDialog(ConstrainedWindow* window); 28 void AddDialog(WebContentsModalDialog* dialog);
29 29
30 // Closes all WebContentsModalDialogs. 30 // Closes all WebContentsModalDialogs.
31 void CloseAllDialogs(); 31 void CloseAllDialogs();
32 32
33 // Called when a WebContentsModalDialogs we own is about to be closed. 33 // Called when a WebContentsModalDialogs we own is about to be closed.
34 void WillClose(ConstrainedWindow* window); 34 void WillClose(WebContentsModalDialog* dialog);
35 35
36 // Blocks/unblocks interaction with renderer process. 36 // Blocks/unblocks interaction with renderer process.
37 void BlockWebContentsInteraction(bool blocked); 37 void BlockWebContentsInteraction(bool blocked);
38 38
39 // Returns the number of constrained windows in this tab. 39 // Returns the number of dialogs in this tab.
40 size_t dialog_count() { return child_dialogs_.size(); } 40 size_t dialog_count() { return child_dialogs_.size(); }
41 41
42 typedef std::deque<ConstrainedWindow*> WebContentsModalDialogList; 42 typedef std::deque<WebContentsModalDialog*> WebContentsModalDialogList;
43 43
44 // Return an iterator for the first constrained window in this web contents. 44 // Return an iterator for the first dialog in this web contents.
45 WebContentsModalDialogList::iterator dialog_begin() { 45 WebContentsModalDialogList::iterator dialog_begin() {
46 return child_dialogs_.begin(); 46 return child_dialogs_.begin();
47 } 47 }
48 48
49 // Return an iterator for the last constrained window in this web contents. 49 // Return an iterator for the last dialog in this web contents.
50 WebContentsModalDialogList::iterator dialog_end() { 50 WebContentsModalDialogList::iterator dialog_end() {
51 return child_dialogs_.end(); 51 return child_dialogs_.end();
52 } 52 }
53 53
54 private: 54 private:
55 explicit ConstrainedWindowTabHelper(content::WebContents* web_contents); 55 explicit WebContentsModalDialogManager(content::WebContents* web_contents);
56 friend class content::WebContentsUserData<ConstrainedWindowTabHelper>; 56 friend class content::WebContentsUserData<WebContentsModalDialogManager>;
57 57
58 // Overridden from content::WebContentsObserver: 58 // Overridden from content::WebContentsObserver:
59 virtual void DidNavigateMainFrame( 59 virtual void DidNavigateMainFrame(
60 const content::LoadCommittedDetails& details, 60 const content::LoadCommittedDetails& details,
61 const content::FrameNavigateParams& params) OVERRIDE; 61 const content::FrameNavigateParams& params) OVERRIDE;
62 virtual void DidGetIgnoredUIEvent() OVERRIDE; 62 virtual void DidGetIgnoredUIEvent() OVERRIDE;
63 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; 63 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE;
64 64
65 // Delegate for notifying our owner about stuff. Not owned by us. 65 // Delegate for notifying our owner about stuff. Not owned by us.
66 ConstrainedWindowTabHelperDelegate* delegate_; 66 WebContentsModalDialogManagerDelegate* delegate_;
67 67
68 // All active constrained windows. 68 // All active dialogs.
69 WebContentsModalDialogList child_dialogs_; 69 WebContentsModalDialogList child_dialogs_;
70 70
71 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowTabHelper); 71 DISALLOW_COPY_AND_ASSIGN(WebContentsModalDialogManager);
72 }; 72 };
73 73
74 #endif // CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ 74 #endif // CHROME_BROWSER_UI_WEB_CONTENTS_MODAL_DIALOG_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/web_contents_modal_dialog.h ('k') | chrome/browser/ui/web_contents_modal_dialog_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698