OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ | |
6 #define CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ | |
7 #pragma once | |
8 | |
9 #include <deque> | |
10 | |
11 #include "content/browser/tab_contents/tab_contents_observer.h" | |
12 | |
13 class ConstrainedWindow; | |
14 class TabContentsWrapper; | |
15 | |
16 // Per-tab class to manage constrained windows. | |
17 class ConstrainedWindowTabHelper : public TabContentsObserver { | |
18 public: | |
19 explicit ConstrainedWindowTabHelper(TabContentsWrapper* tab_contents); | |
20 virtual ~ConstrainedWindowTabHelper(); | |
21 | |
22 // Adds the given window to the list of child windows. The window will notify | |
23 // via WillClose() when it is being destroyed. | |
24 void AddConstrainedDialog(ConstrainedWindow* window); | |
25 | |
26 // Closes all constrained windows. | |
27 void CloseConstrainedWindows(); | |
28 | |
29 // Called when a ConstrainedWindow we own is about to be closed. | |
30 void WillClose(ConstrainedWindow* window); | |
31 | |
32 // Blocks/unblocks interaction with renderer process. | |
33 void BlockTabContent(bool blocked); | |
34 | |
35 // Returns the number of constrained windows in this tab. Used by tests. | |
36 size_t constrained_window_count() { return child_windows_.size(); } | |
37 | |
38 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList; | |
39 | |
40 // Return an iterator for the first constrained window in this tab contents. | |
41 ConstrainedWindowList::iterator constrained_window_begin() | |
42 { return child_windows_.begin(); } | |
jam
2011/09/28 00:08:36
nit: the brace bracket be on the previous line. al
| |
43 | |
44 // Return an iterator for the last constrained window in this tab contents. | |
45 ConstrainedWindowList::iterator constrained_window_end() | |
46 { return child_windows_.end(); } | |
47 | |
48 private: | |
49 // Overridden from TabContentsObserver: | |
50 virtual void DidNavigateMainFramePostCommit( | |
51 const content::LoadCommittedDetails& details, | |
52 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; | |
53 virtual void DidGetIgnoredUIEvent() OVERRIDE; | |
54 virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; | |
55 | |
56 // Our owning TabContentsWrapper. | |
57 TabContentsWrapper* wrapper_; | |
58 | |
59 // All active constrained windows. | |
60 ConstrainedWindowList child_windows_; | |
jam
2011/09/28 00:08:36
nit: DISALLOW_COPY_AND_ASSIGN?
| |
61 }; | |
62 | |
63 #endif // CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ | |
OLD | NEW |