diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 22:03:17 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-11 22:03:17 +0000 |
commit | a9e8afc41dd0adfe4ac5900f2b73ff259276e2bd (patch) | |
tree | 7c82250d47888a4057e3048bfc7f54c07027fdb2 /chrome/browser/tab_contents | |
parent | e819b55cf062822a23280b4da7760abfd2a86e64 (diff) | |
download | chromium_src-a9e8afc41dd0adfe4ac5900f2b73ff259276e2bd.zip chromium_src-a9e8afc41dd0adfe4ac5900f2b73ff259276e2bd.tar.gz chromium_src-a9e8afc41dd0adfe4ac5900f2b73ff259276e2bd.tar.bz2 |
Add support for constrained windows on os x, based on Avi's GTMWindowSheetController. Add carpet bombing dialog as first per-tab sheet.
Depends http://codereview.appspot.com/105064 .
The main issue with this patch is that GTMWindowSheetController doesn't provide an api to move sheets between windows, so this CL disables tab dragging for tabs with sheets, and fullscreen mode for windows with sheets. We can fix this later.
Other stuff that should be done at some point, but not now:
* Open/Save panels should be per-tab
* Need an ui test that goes to page, then page with sheet, then hit back, forward, reload.
* Bookmark sheets should not be sheets but in a separate window
BUG=14666
TEST=Go to skypher.com/SkyLined/Repro/Chrome/carpet bombing/repro.html , a per-window sheet should appear. Things to test with this dialog:
* Hitting cmd-q while a sheet is open in any tab should not quit but instead focus the sheet.
* Hitting cmd-w while a sheet is open in any tab should not close the window but instead focus the sheet.
* Dragging a tab with a sheet should move the window (and keep the tab visible), not detach the tab.
* Going fullscreen should be disabled for windows with open tabs.
* When a per-tab sheet is open in a non-active tab, it shouldn't steal the focus, i.e. going to the page above, then hitting cmd-t, and then hitting cmd-l should work.
* Closing a non-frontmost tab with a per-tab sheet shouldn't crash.
* Going to the url above and quickly opening a new tab, so that the sheet opens while its tab is not front-most should work (sheet should display only when you switch back to the tab with the sheet).
* Go to google.com, then to skypher.com/SkyLined/Repro/Chrome/carpet bombing/repro.html ,
hit "backward" with open sheet, hit forward, focus location bar, hit enter. This shouldn't crash.
* Hitting escape should dismiss the sheet
* Hitting enter should confirm the sheet.
Review URL: http://codereview.chromium.org/159780
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/tab_contents')
-rw-r--r-- | chrome/browser/tab_contents/constrained_window.h | 5 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 2 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.h | 13 |
3 files changed, 12 insertions, 8 deletions
diff --git a/chrome/browser/tab_contents/constrained_window.h b/chrome/browser/tab_contents/constrained_window.h index 437f820b..a1b8c2a 100644 --- a/chrome/browser/tab_contents/constrained_window.h +++ b/chrome/browser/tab_contents/constrained_window.h @@ -19,9 +19,8 @@ typedef views::WindowDelegate ConstrainedWindowDelegate; class ConstrainedWindowGtkDelegate; typedef ConstrainedWindowGtkDelegate ConstrainedWindowDelegate; #elif defined(OS_MACOSX) -// TODO(port): Change this type when Mac gets ConstrainedWindows. It is here -// only to make things compile. There is no user or consumer of this type. -typedef void* ConstrainedWindowDelegate; +class ConstrainedWindowMacDelegate; +typedef ConstrainedWindowMacDelegate ConstrainedWindowDelegate; #endif class TabContents; diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 5f6de7c..f6e6687 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -771,7 +771,6 @@ void TabContents::ShowPageInfo(const GURL& url, delegate_->ShowPageInfo(profile(), url, ssl, show_history); } -#if defined(OS_WIN) || defined(OS_LINUX) ConstrainedWindow* TabContents::CreateConstrainedDialog( ConstrainedWindowDelegate* delegate) { ConstrainedWindow* window = @@ -779,7 +778,6 @@ ConstrainedWindow* TabContents::CreateConstrainedDialog( child_windows_.push_back(window); return window; } -#endif void TabContents::AddNewContents(TabContents* new_contents, WindowOpenDisposition disposition, diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index e8f7d14..575eb21 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -337,7 +337,6 @@ class TabContents : public PageNavigator, // Window management --------------------------------------------------------- -#if defined(OS_WIN) || defined(OS_LINUX) // Create a new window constrained to this TabContents' clip and visibility. // The window is initialized by using the supplied delegate to obtain basic // window characteristics, and the supplied view for the content. The window @@ -345,7 +344,6 @@ class TabContents : public PageNavigator, // within the contents. ConstrainedWindow* CreateConstrainedDialog( ConstrainedWindowDelegate* delegate); -#endif // Adds a new tab or window with the given already-created contents void AddNewContents(TabContents* new_contents, @@ -366,6 +364,16 @@ class TabContents : public PageNavigator, // Returns the number of constrained windows in this tab. Used by tests. size_t constrained_window_count() { return child_windows_.size(); } + typedef std::vector<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(); } + // Views and focus ----------------------------------------------------------- // TODO(brettw): Most of these should be removed and the caller should call // the view directly. @@ -660,7 +668,6 @@ class TabContents : public PageNavigator, // up at the next animation step if the throbber is going. void SetNotWaitingForResponse() { waiting_for_response_ = false; } - typedef std::vector<ConstrainedWindow*> ConstrainedWindowList; ConstrainedWindowList child_windows_; // Expires InfoBars that need to be expired, according to the state carried |