diff options
author | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-30 01:49:44 +0000 |
---|---|---|
committer | erg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-30 01:49:44 +0000 |
commit | 31145091d1402ced1c7bf7fe418dac36d441e82b (patch) | |
tree | 4d6eca68aa2cafd219f9641959febed7ec4a2389 /chrome/browser/ui/constrained_window_tab_helper.h | |
parent | 9be87ba466fa2259e27974b43633414e5e1293ab (diff) | |
download | chromium_src-31145091d1402ced1c7bf7fe418dac36d441e82b.zip chromium_src-31145091d1402ced1c7bf7fe418dac36d441e82b.tar.gz chromium_src-31145091d1402ced1c7bf7fe418dac36d441e82b.tar.bz2 |
content: Move constrained window code from TabContents to TabContentsWrapper
BUG=95257
TEST=compiles,ConstrainedWindowTabHelperUnit.ConstrainedWindows is green
Review URL: http://codereview.chromium.org/7880003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103403 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/constrained_window_tab_helper.h')
-rw-r--r-- | chrome/browser/ui/constrained_window_tab_helper.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/chrome/browser/ui/constrained_window_tab_helper.h b/chrome/browser/ui/constrained_window_tab_helper.h new file mode 100644 index 0000000..dee8093 --- /dev/null +++ b/chrome/browser/ui/constrained_window_tab_helper.h @@ -0,0 +1,74 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ +#define CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ +#pragma once + +#include <deque> + +#include "content/browser/tab_contents/tab_contents_observer.h" + +class ConstrainedWindow; +class ConstrainedWindowTabHelperDelegate; +class TabContentsWrapper; + +// Per-tab class to manage constrained windows. +class ConstrainedWindowTabHelper : public TabContentsObserver { + public: + explicit ConstrainedWindowTabHelper(TabContentsWrapper* tab_contents); + virtual ~ConstrainedWindowTabHelper(); + + ConstrainedWindowTabHelperDelegate* delegate() const { return delegate_; } + void set_delegate(ConstrainedWindowTabHelperDelegate* d) { delegate_ = d; } + + // Adds the given window to the list of child windows. The window will notify + // via WillClose() when it is being destroyed. + void AddConstrainedDialog(ConstrainedWindow* window); + + // Closes all constrained windows. + void CloseConstrainedWindows(); + + // Called when a ConstrainedWindow we own is about to be closed. + void WillClose(ConstrainedWindow* window); + + // Blocks/unblocks interaction with renderer process. + void BlockTabContent(bool blocked); + + // Returns the number of constrained windows in this tab. Used by tests. + size_t constrained_window_count() { return child_windows_.size(); } + + typedef std::deque<ConstrainedWindow*> ConstrainedWindowList; + + // Return an iterator for the first constrained window in this tab contents. + ConstrainedWindowList::iterator constrained_window_begin() { + return child_windows_.begin(); + } + + // Return an iterator for the last constrained window in this tab contents. + ConstrainedWindowList::iterator constrained_window_end() { + return child_windows_.end(); + } + + private: + // Overridden from TabContentsObserver: + virtual void DidNavigateMainFramePostCommit( + const content::LoadCommittedDetails& details, + const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; + virtual void DidGetIgnoredUIEvent() OVERRIDE; + virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; + + // Our owning TabContentsWrapper. + TabContentsWrapper* wrapper_; + + // Delegate for notifying our owner about stuff. Not owned by us. + ConstrainedWindowTabHelperDelegate* delegate_; + + // All active constrained windows. + ConstrainedWindowList child_windows_; + + DISALLOW_COPY_AND_ASSIGN(ConstrainedWindowTabHelper); +}; + +#endif // CHROME_BROWSER_UI_CONSTRAINED_WINDOW_TAB_HELPER_H_ |