Chromium Code Reviews| 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 ConstrainedWindowTabHelperDelegate; | |
| 15 class TabContentsWrapper; | |
| 16 | |
| 17 // Per-tab class to manage constrained windows. | |
| 18 class ConstrainedWindowTabHelper : public TabContentsObserver { | |
| 19 public: | |
| 20 explicit ConstrainedWindowTabHelper(TabContentsWrapper* tab_contents); | |
| 21 virtual ~ConstrainedWindowTabHelper(); | |
| 22 | |
| 23 ConstrainedWindowTabHelperDelegate* delegate() const { return delegate_; } | |
| 24 void set_delegate(ConstrainedWindowTabHelperDelegate* d) { delegate_ = d; } | |
| 25 | |
| 26 // Adds the given window to the list of child windows. The window will notify | |
| 27 // via WillClose() when it is being destroyed. | |
| 28 void AddConstrainedDialog(ConstrainedWindow* window); | |
| 29 | |
| 30 // Closes all constrained windows. | |
| 31 void CloseConstrainedWindows(); | |
| 32 | |
| 33 // Called when a ConstrainedWindow we own is about to be closed. | |
| 34 void WillClose(ConstrainedWindow* window); | |
| 35 | |
| 36 // Blocks/unblocks interaction with renderer process. | |
| 37 void BlockTabContent(bool blocked); | |
| 38 | |
| 39 // Returns the number of constrained windows in this tab. Used by tests. | |
| 40 size_t constrained_window_count() { return child_windows_.size(); } | |
| 41 | |
| 42 typedef std::deque<ConstrainedWindow*> ConstrainedWindowList; | |
| 43 | |
| 44 // Return an iterator for the first constrained window in this tab contents. | |
| 45 ConstrainedWindowList::iterator constrained_window_begin() | |
|
Avi (use Gerrit)
2011/09/29 18:30:36
As previously noted, opening brace goes on this li
| |
| 46 { return child_windows_.begin(); } | |
| 47 | |
| 48 // Return an iterator for the last constrained window in this tab contents. | |
| 49 ConstrainedWindowList::iterator constrained_window_end() | |
| 50 { return child_windows_.end(); } | |
|
Avi (use Gerrit)
2011/09/29 18:30:36
ditto
| |
| 51 | |
| 52 private: | |
| 53 // Overridden from TabContentsObserver: | |
| 54 virtual void DidNavigateMainFramePostCommit( | |
| 55 const content::LoadCommittedDetails& details, | |
| 56 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; | |
| 57 virtual void DidGetIgnoredUIEvent() OVERRIDE; | |
| 58 virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; | |
| 59 | |
| 60 // Our owning TabContentsWrapper. | |
| 61 TabContentsWrapper* wrapper_; | |
| 62 | |
| 63 // Delegate for notifying our owner about stuff. Not owned by us. | |
| 64 ConstrainedWindowTabHelperDelegate* delegate_; | |
| 65 | |
| 66 // All active constrained windows. | |
| 67 ConstrainedWindowList child_windows_; | |
| 68 | |
| 69 DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowTabHelper); | |
| 70 }; | |
| 71 | |
| 72 #endif // CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ | |
| OLD | NEW |