diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-22 15:47:39 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-22 15:47:39 +0000 |
commit | 400eaf8568057c158aaf8f0bf2d1095498791af4 (patch) | |
tree | a21011a58f29e3e790ead3b94ed7d249256f3b93 /chrome | |
parent | be128cfc576f164873323bb28dd8939c183af84f (diff) | |
download | chromium_src-400eaf8568057c158aaf8f0bf2d1095498791af4.zip chromium_src-400eaf8568057c158aaf8f0bf2d1095498791af4.tar.gz chromium_src-400eaf8568057c158aaf8f0bf2d1095498791af4.tar.bz2 |
Restoring a session should restore window minimization state
Extends session service to support more generalized "show" state encompassing maximized, minimized, and normal window states. This includes forward-migration logic from old stored session data. Mac changes to save and restore minimized windows as well as fixes for window position. Linux/GTK changes to save and restore minimized windows. Windows/Views changes to follow.
BUG=43274
TEST=Manual. SessionServiceTest.*
Review URL: http://codereview.chromium.org/7621061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
30 files changed, 249 insertions, 129 deletions
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc index 3ed5bfd..c4c5b29 100644 --- a/chrome/browser/sessions/session_restore.cc +++ b/chrome/browser/sessions/session_restore.cc @@ -466,7 +466,7 @@ class SessionRestoreImpl : public NotificationObserver { Browser* browser = CreateRestoredBrowser( static_cast<Browser::Type>((*i)->type), (*i)->bounds, - (*i)->is_maximized); + (*i)->show_state); // Restore and show the browser. const int initial_tab_count = browser->tab_count(); @@ -616,7 +616,7 @@ class SessionRestoreImpl : public NotificationObserver { browser = CreateRestoredBrowser( static_cast<Browser::Type>((*i)->type), (*i)->bounds, - (*i)->is_maximized); + (*i)->show_state); #if defined(OS_CHROMEOS) chromeos::BootTimesLoader::Get()->AddLoginTimeMarker( "SessionRestore-CreateRestoredBrowser-End", false); @@ -710,12 +710,10 @@ class SessionRestoreImpl : public NotificationObserver { Browser* CreateRestoredBrowser(Browser::Type type, gfx::Rect bounds, - bool is_maximized) { + ui::WindowShowState show_state) { Browser* browser = new Browser(type, profile_); browser->set_override_bounds(bounds); - browser->set_maximized_state(is_maximized ? - Browser::MAXIMIZED_STATE_MAXIMIZED : - Browser::MAXIMIZED_STATE_UNMAXIMIZED); + browser->set_show_state(show_state); browser->InitBrowserWindow(); return browser; } diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index ba4a4e0..dbb0f94 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -44,8 +44,7 @@ using base::Time; // Identifier for commands written to file. static const SessionCommand::id_type kCommandSetTabWindow = 0; -// kCommandSetWindowBounds is no longer used (it's superseded by -// kCommandSetWindowBounds2). I leave it here to document what it was. +// OBSOLETE Superseded by kCommandSetWindowBounds3. // static const SessionCommand::id_type kCommandSetWindowBounds = 1; static const SessionCommand::id_type kCommandSetTabIndexInWindow = 2; static const SessionCommand::id_type kCommandTabClosed = 3; @@ -56,11 +55,13 @@ static const SessionCommand::id_type kCommandUpdateTabNavigation = 6; static const SessionCommand::id_type kCommandSetSelectedNavigationIndex = 7; static const SessionCommand::id_type kCommandSetSelectedTabInIndex = 8; static const SessionCommand::id_type kCommandSetWindowType = 9; -static const SessionCommand::id_type kCommandSetWindowBounds2 = 10; +// OBSOLETE Superseded by kCommandSetWindowBounds3. Except for data migration. +// static const SessionCommand::id_type kCommandSetWindowBounds2 = 10; static const SessionCommand::id_type kCommandTabNavigationPathPrunedFromFront = 11; static const SessionCommand::id_type kCommandSetPinnedState = 12; static const SessionCommand::id_type kCommandSetExtensionAppID = 13; +static const SessionCommand::id_type kCommandSetWindowBounds3 = 14; // Every kWritesPerReset commands triggers recreating the file. static const int kWritesPerReset = 250; @@ -105,6 +106,15 @@ struct WindowBoundsPayload2 { bool is_maximized; }; +struct WindowBoundsPayload3 { + SessionID::id_type window_id; + int32 x; + int32 y; + int32 w; + int32 h; + int32 show_state; +}; + struct IDAndIndexPayload { SessionID::id_type id; int32 index; @@ -188,12 +198,11 @@ void SessionService::SetTabWindow(const SessionID& window_id, void SessionService::SetWindowBounds(const SessionID& window_id, const gfx::Rect& bounds, - bool is_maximized) { + ui::WindowShowState show_state) { if (!ShouldTrackChangesToWindow(window_id)) return; - ScheduleCommand(CreateSetWindowBoundsCommand(window_id, bounds, - is_maximized)); + ScheduleCommand(CreateSetWindowBoundsCommand(window_id, bounds, show_state)); } void SessionService::SetTabIndexInWindow(const SessionID& window_id, @@ -667,15 +676,15 @@ SessionCommand* SessionService::CreateSetTabWindowCommand( SessionCommand* SessionService::CreateSetWindowBoundsCommand( const SessionID& window_id, const gfx::Rect& bounds, - bool is_maximized) { - WindowBoundsPayload2 payload = { 0 }; + ui::WindowShowState show_state) { + WindowBoundsPayload3 payload = { 0 }; payload.window_id = window_id.id(); payload.x = bounds.x(); payload.y = bounds.y(); payload.w = bounds.width(); payload.h = bounds.height(); - payload.is_maximized = is_maximized; - SessionCommand* command = new SessionCommand(kCommandSetWindowBounds2, + payload.show_state = show_state; + SessionCommand* command = new SessionCommand(kCommandSetWindowBounds3, sizeof(payload)); memcpy(command->contents(), &payload, sizeof(payload)); return command; @@ -925,6 +934,7 @@ bool SessionService::CreateTabsAndWindows( for (std::vector<SessionCommand*>::const_iterator i = data.begin(); i != data.end(); ++i) { + const SessionCommand::id_type kCommandSetWindowBounds2 = 10; const SessionCommand* command = *i; switch (command->id()) { @@ -936,6 +946,8 @@ bool SessionService::CreateTabsAndWindows( break; } + // This is here for forward migration only. New data is saved with + // |kCommandSetWindowBounds3|. case kCommandSetWindowBounds2: { WindowBoundsPayload2 payload; if (!command->GetPayload(&payload, sizeof(payload))) @@ -944,8 +956,28 @@ bool SessionService::CreateTabsAndWindows( payload.y, payload.w, payload.h); - GetWindow(payload.window_id, windows)->is_maximized = - payload.is_maximized; + GetWindow(payload.window_id, windows)->show_state = + payload.is_maximized ? + ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL; + break; + } + + case kCommandSetWindowBounds3: { + WindowBoundsPayload3 payload; + if (!command->GetPayload(&payload, sizeof(payload))) + return true; + GetWindow(payload.window_id, windows)->bounds.SetRect(payload.x, + payload.y, + payload.w, + payload.h); + ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; + if (payload.show_state > ui::SHOW_STATE_DEFAULT && + payload.show_state < ui::SHOW_STATE_MAX) { + show_state = static_cast<ui::WindowShowState>(payload.show_state); + } else { + NOTREACHED(); + } + GetWindow(payload.window_id, windows)->show_state = show_state; break; } @@ -1137,10 +1169,16 @@ void SessionService::BuildCommandsForBrowser( DCHECK(browser && commands); DCHECK(browser->session_id().id()); + ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; + if (browser->window()->IsMaximized()) + show_state = ui::SHOW_STATE_MAXIMIZED; + else if (browser->window()->IsMinimized()) + show_state = ui::SHOW_STATE_MINIMIZED; + commands->push_back( CreateSetWindowBoundsCommand(browser->session_id(), browser->window()->GetRestoredBounds(), - browser->window()->IsMaximized())); + show_state)); commands->push_back(CreateSetWindowTypeCommand( browser->session_id(), WindowTypeForBrowserType(browser->type()))); diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h index 71dd177..6e49c2d 100644 --- a/chrome/browser/sessions/session_service.h +++ b/chrome/browser/sessions/session_service.h @@ -19,6 +19,7 @@ #include "chrome/browser/ui/browser_list.h" #include "content/common/notification_observer.h" #include "content/common/notification_registrar.h" +#include "ui/base/ui_base_types.h" class NavigationEntry; class Profile; @@ -81,7 +82,7 @@ class SessionService : public BaseSessionService, // Sets the bounds of a window. void SetWindowBounds(const SessionID& window_id, const gfx::Rect& bounds, - bool is_maximized); + ui::WindowShowState show_state); // Sets the visual index of the tab in its parent window. void SetTabIndexInWindow(const SessionID& window_id, @@ -218,7 +219,7 @@ class SessionService : public BaseSessionService, SessionCommand* CreateSetWindowBoundsCommand(const SessionID& window_id, const gfx::Rect& bounds, - bool is_maximized); + ui::WindowShowState show_state); SessionCommand* CreateSetTabIndexInWindowCommand(const SessionID& tab_id, int new_index); diff --git a/chrome/browser/sessions/session_service_unittest.cc b/chrome/browser/sessions/session_service_unittest.cc index b6af02e..4fc561e 100644 --- a/chrome/browser/sessions/session_service_unittest.cc +++ b/chrome/browser/sessions/session_service_unittest.cc @@ -45,7 +45,9 @@ class SessionServiceTest : public BrowserWithTestWindowTest, helper_.set_service(session_service); service()->SetWindowType(window_id, Browser::TYPE_TABBED); - service()->SetWindowBounds(window_id, window_bounds, false); + service()->SetWindowBounds(window_id, + window_bounds, + ui::SHOW_STATE_NORMAL); } // Upon notification, increment the sync_save_count variable @@ -268,7 +270,9 @@ TEST_F(SessionServiceTest, TwoWindows) { const gfx::Rect window2_bounds(3, 4, 5, 6); service()->SetWindowType(window2_id, Browser::TYPE_TABBED); - service()->SetWindowBounds(window2_id, window2_bounds, true); + service()->SetWindowBounds(window2_id, + window2_bounds, + ui::SHOW_STATE_MAXIMIZED); helper_.PrepareTabInWindow(window2_id, tab2_id, 0, true); UpdateNavigation(window2_id, tab2_id, nav2, 0, true); @@ -285,15 +289,15 @@ TEST_F(SessionServiceTest, TwoWindows) { SessionTab* rt2; if (windows[0]->window_id.id() == window_id.id()) { ASSERT_EQ(window2_id.id(), windows[1]->window_id.id()); - ASSERT_FALSE(windows[0]->is_maximized); - ASSERT_TRUE(windows[1]->is_maximized); + ASSERT_EQ(ui::SHOW_STATE_NORMAL, windows[0]->show_state); + ASSERT_EQ(ui::SHOW_STATE_MAXIMIZED, windows[1]->show_state); rt1 = windows[0]->tabs[0]; rt2 = windows[1]->tabs[0]; } else { ASSERT_EQ(window2_id.id(), windows[0]->window_id.id()); ASSERT_EQ(window_id.id(), windows[1]->window_id.id()); - ASSERT_TRUE(windows[0]->is_maximized); - ASSERT_FALSE(windows[1]->is_maximized); + ASSERT_EQ(ui::SHOW_STATE_MAXIMIZED, windows[0]->show_state); + ASSERT_EQ(ui::SHOW_STATE_NORMAL, windows[1]->show_state); rt1 = windows[1]->tabs[0]; rt2 = windows[0]->tabs[0]; } @@ -320,7 +324,9 @@ TEST_F(SessionServiceTest, WindowWithNoTabsGetsPruned) { const gfx::Rect window2_bounds(3, 4, 5, 6); service()->SetWindowType(window2_id, Browser::TYPE_TABBED); - service()->SetWindowBounds(window2_id, window2_bounds, false); + service()->SetWindowBounds(window2_id, + window2_bounds, + ui::SHOW_STATE_NORMAL); helper_.PrepareTabInWindow(window2_id, tab2_id, 0, true); ScopedVector<SessionWindow> windows; @@ -380,7 +386,9 @@ TEST_F(SessionServiceTest, WindowCloseCommittedAfterNavigate) { ASSERT_NE(window2_id.id(), window_id.id()); service()->SetWindowType(window2_id, Browser::TYPE_TABBED); - service()->SetWindowBounds(window2_id, window_bounds, false); + service()->SetWindowBounds(window2_id, + window_bounds, + ui::SHOW_STATE_NORMAL); TabNavigation nav1(0, GURL("http://google.com"), GURL(), ASCIIToUTF16("abc"), "def", @@ -423,7 +431,9 @@ TEST_F(SessionServiceTest, IgnorePopups) { ASSERT_NE(window2_id.id(), window_id.id()); service()->SetWindowType(window2_id, Browser::TYPE_POPUP); - service()->SetWindowBounds(window2_id, window_bounds, false); + service()->SetWindowBounds(window2_id, + window_bounds, + ui::SHOW_STATE_NORMAL); TabNavigation nav1(0, GURL("http://google.com"), GURL(), ASCIIToUTF16("abc"), "def", @@ -462,7 +472,9 @@ TEST_F(SessionServiceTest, RestorePopup) { ASSERT_NE(window2_id.id(), window_id.id()); service()->SetWindowType(window2_id, Browser::TYPE_POPUP); - service()->SetWindowBounds(window2_id, window_bounds, false); + service()->SetWindowBounds(window2_id, + window_bounds, + ui::SHOW_STATE_NORMAL); TabNavigation nav1(0, GURL("http://google.com"), GURL(), ASCIIToUTF16("abc"), "def", diff --git a/chrome/browser/sessions/session_types.cc b/chrome/browser/sessions/session_types.cc index 7a61e4e..c1f1c28 100644 --- a/chrome/browser/sessions/session_types.cc +++ b/chrome/browser/sessions/session_types.cc @@ -114,7 +114,7 @@ SessionWindow::SessionWindow() : selected_tab_index(-1), type(Browser::TYPE_TABBED), is_constrained(true), - is_maximized(false) { + show_state(ui::SHOW_STATE_DEFAULT) { } SessionWindow::~SessionWindow() { diff --git a/chrome/browser/sessions/session_types.h b/chrome/browser/sessions/session_types.h index e107b3f..fd52cb9 100644 --- a/chrome/browser/sessions/session_types.h +++ b/chrome/browser/sessions/session_types.h @@ -15,6 +15,7 @@ #include "chrome/browser/sessions/session_id.h" #include "content/common/page_transition_types.h" #include "googleurl/src/gurl.h" +#include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" class NavigationEntry; @@ -189,8 +190,8 @@ struct SessionWindow { // The tabs, ordered by visual order. std::vector<SessionTab*> tabs; - // Is the window maximized? - bool is_maximized; + // Is the window maximized, minimized, or normal? + ui::WindowShowState show_state; private: DISALLOW_COPY_AND_ASSIGN(SessionWindow); diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc index fa2a5ec..5c74b74 100644 --- a/chrome/browser/sync/profile_sync_service_session_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc @@ -43,6 +43,7 @@ #include "content/common/notification_service.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/ui_base_types.h" using browser_sync::SessionChangeProcessor; using browser_sync::SessionDataTypeController; @@ -81,7 +82,9 @@ class ProfileSyncServiceSessionTest SessionService* session_service = new SessionService(temp_dir_.path()); helper_.set_service(session_service); service()->SetWindowType(window_id_, Browser::TYPE_TABBED); - service()->SetWindowBounds(window_id_, window_bounds_, false); + service()->SetWindowBounds(window_id_, + window_bounds_, + ui::SHOW_STATE_NORMAL); registrar_.Add(this, chrome::NOTIFICATION_FOREIGN_SESSION_UPDATED, NotificationService::AllSources()); } diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index f54bcf50..63d5c25 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -247,7 +247,7 @@ Browser::Browser(Type type, Profile* profile) chrome_updater_factory_(this), is_attempting_to_close_browser_(false), cancel_download_confirmation_state_(NOT_PROMPTED), - maximized_state_(MAXIMIZED_STATE_DEFAULT), + show_state_(ui::SHOW_STATE_DEFAULT), method_factory_(this), block_command_execution_(false), last_blocked_command_id_(-1), @@ -853,7 +853,8 @@ bool Browser::ShouldSaveWindowPlacement() const { } } -void Browser::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) { +void Browser::SaveWindowPlacement(const gfx::Rect& bounds, + ui::WindowShowState show_state) { // Save to the session storage service, used when reloading a past session. // Note that we don't want to be the ones who cause lazy initialization of // the session service. This function gets called during initial window @@ -861,7 +862,7 @@ void Browser::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) { SessionService* session_service = SessionServiceFactory::GetForProfileIfExisting(profile()); if (session_service) - session_service->SetWindowBounds(session_id_, bounds, maximized); + session_service->SetWindowBounds(session_id_, bounds, show_state); } gfx::Rect Browser::GetSavedWindowBounds() const { @@ -886,21 +887,19 @@ gfx::Rect Browser::GetSavedWindowBounds() const { // TODO(beng): obtain maximized state some other way so we don't need to go // through all this hassle. -bool Browser::GetSavedMaximizedState() const { +ui::WindowShowState Browser::GetSavedWindowShowState() const { if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStartMaximized)) - return true; + return ui::SHOW_STATE_MAXIMIZED; - if (maximized_state_ == MAXIMIZED_STATE_MAXIMIZED) - return true; - if (maximized_state_ == MAXIMIZED_STATE_UNMAXIMIZED) - return false; + if (show_state_ != ui::SHOW_STATE_DEFAULT) + return show_state_; // An explicit maximized state was not set. Query the window sizer. gfx::Rect restored_bounds; bool maximized = false; WindowSizer::GetBrowserWindowBounds(app_name_, restored_bounds, this, &restored_bounds, &maximized); - return maximized; + return maximized ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL; } SkBitmap Browser::GetCurrentPageIcon() const { @@ -2728,8 +2727,8 @@ Browser* Browser::CreateNewStripWithContents( // Create an empty new browser window the same size as the old one. Browser* browser = new Browser(TYPE_TABBED, profile_); browser->set_override_bounds(new_window_bounds); - browser->set_maximized_state( - maximize ? MAXIMIZED_STATE_MAXIMIZED : MAXIMIZED_STATE_UNMAXIMIZED); + browser->set_show_state( + maximize ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL); browser->InitBrowserWindow(); browser->tabstrip_model()->AppendTabContents(detached_contents, true); // Make sure the loading state is updated correctly, otherwise the throbber diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h index 30a8d87..cac7b21 100644 --- a/chrome/browser/ui/browser.h +++ b/chrome/browser/ui/browser.h @@ -43,6 +43,7 @@ #include "content/common/notification_registrar.h" #include "content/common/page_transition_types.h" #include "content/common/page_zoom.h" +#include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" class BrowserSyncedWindowDelegate; @@ -102,19 +103,6 @@ class Browser : public TabHandlerDelegate, FEATURE_DOWNLOADSHELF = 128 }; - // Maximized state on creation. - enum MaximizedState { - // The maximized state is set to the default, which varies depending upon - // what the user has done. - MAXIMIZED_STATE_DEFAULT, - - // Maximized state is explicitly maximized. - MAXIMIZED_STATE_MAXIMIZED, - - // Maximized state is explicitly not maximized (normal). - MAXIMIZED_STATE_UNMAXIMIZED - }; - struct CreateParams { CreateParams(Type type, Profile* profile); @@ -171,8 +159,8 @@ class Browser : public TabHandlerDelegate, void set_override_bounds(const gfx::Rect& bounds) { override_bounds_ = bounds; } - void set_maximized_state(MaximizedState state) { - maximized_state_ = state; + void set_show_state(ui::WindowShowState show_state) { + show_state_ = show_state; } // Return true if the initial window bounds have been overridden. bool bounds_overridden() const { @@ -310,9 +298,10 @@ class Browser : public TabHandlerDelegate, // Save and restore the window position. std::string GetWindowPlacementKey() const; bool ShouldSaveWindowPlacement() const; - void SaveWindowPlacement(const gfx::Rect& bounds, bool maximized); + void SaveWindowPlacement(const gfx::Rect& bounds, + ui::WindowShowState show_state); gfx::Rect GetSavedWindowBounds() const; - bool GetSavedMaximizedState() const; + ui::WindowShowState GetSavedWindowShowState() const; // Gets the Favicon of the page in the selected tab. SkBitmap GetCurrentPageIcon() const; @@ -1226,13 +1215,14 @@ class Browser : public TabHandlerDelegate, ///////////////////////////////////////////////////////////////////////////// - // Override values for the bounds of the window and its maximized state. + // Override values for the bounds of the window and its maximized or minimized + // state. // These are supplied by callers that don't want to use the default values. // The default values are typically loaded from local state (last session), // obtained from the last window of the same type, or obtained from the // shell shortcut's startup info. gfx::Rect override_bounds_; - MaximizedState maximized_state_; + ui::WindowShowState show_state_; // The following factory is used to close the frame at a later time. ScopedRunnableMethodFactory<Browser> method_factory_; diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index ff69a66..d8f3a25 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -772,14 +772,14 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, OpenAppWindowLikeNtp) { #endif // !defined(OS_MACOSX) // Makes sure the browser doesn't crash when -// set_maximized_state(MAXIMIZED_STATE_MAXIMIZED) has been invoked. +// set_show_state(ui::SHOW_STATE_MAXIMIZED) has been invoked. IN_PROC_BROWSER_TEST_F(BrowserTest, StartMaximized) { // Can't test TYPE_PANEL as they are currently created differently (and can't // end up maximized). Browser::Type types[] = { Browser::TYPE_TABBED, Browser::TYPE_POPUP }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(types); ++i) { Browser* max_browser = new Browser(types[i], browser()->profile()); - max_browser->set_maximized_state(Browser::MAXIMIZED_STATE_MAXIMIZED); + max_browser->set_show_state(ui::SHOW_STATE_MAXIMIZED); max_browser->InitBrowserWindow(); AddBlankTabAndShow(max_browser); } diff --git a/chrome/browser/ui/browser_window.h b/chrome/browser/ui/browser_window.h index 9b9fd07..b74f9fa 100644 --- a/chrome/browser/ui/browser_window.h +++ b/chrome/browser/ui/browser_window.h @@ -130,6 +130,9 @@ class BrowserWindow { // Returns true if the frame is maximized (aka zoomed). virtual bool IsMaximized() const = 0; + // Returns true if the frame is minimized. + virtual bool IsMinimized() const = 0; + // Accessors for fullscreen mode state. virtual void SetFullscreen(bool fullscreen) = 0; virtual bool IsFullscreen() const = 0; diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.h b/chrome/browser/ui/cocoa/browser_window_cocoa.h index 410b145..327f409 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.h +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.h @@ -27,8 +27,7 @@ class BrowserWindowCocoa : public BrowserWindow, public NotificationObserver { public: BrowserWindowCocoa(Browser* browser, - BrowserWindowController* controller, - NSWindow* window); + BrowserWindowController* controller); virtual ~BrowserWindowCocoa(); // Overridden from BrowserWindow @@ -53,6 +52,7 @@ class BrowserWindowCocoa : public BrowserWindow, virtual gfx::Rect GetRestoredBounds() const; virtual gfx::Rect GetBounds() const; virtual bool IsMaximized() const; + virtual bool IsMinimized() const; virtual void SetFullscreen(bool fullscreen); virtual bool IsFullscreen() const; virtual bool IsFullscreenBubbleVisible() const; diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm index 5faefc7..c87c61a 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm @@ -44,11 +44,31 @@ #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util_mac.h" +#include "ui/base/ui_base_types.h" #include "ui/gfx/rect.h" +// Replicate specific 10.7 SDK declarations for building with prior SDKs. +#if !defined(MAC_OS_X_VERSION_10_7) || \ + MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 + +enum { + NSWindowAnimationBehaviorDefault = 0, + NSWindowAnimationBehaviorNone = 2, + NSWindowAnimationBehaviorDocumentWindow = 3, + NSWindowAnimationBehaviorUtilityWindow = 4, + NSWindowAnimationBehaviorAlertPanel = 5 +}; +typedef NSInteger NSWindowAnimationBehavior; + +@interface NSWindow (LionSDKDeclarations) +- (NSWindowAnimationBehavior)animationBehavior; +- (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior; +@end + +#endif // MAC_OS_X_VERSION_10_7 + BrowserWindowCocoa::BrowserWindowCocoa(Browser* browser, - BrowserWindowController* controller, - NSWindow* window) + BrowserWindowController* controller) : browser_(browser), controller_(controller), confirm_close_factory_(browser) { @@ -73,11 +93,35 @@ void BrowserWindowCocoa::Show() { // the previous browser instead if we don't explicitly set it here. BrowserList::SetLastActive(browser_); - [window() makeKeyAndOrderFront:controller_]; + ui::WindowShowState show_state = browser_->GetSavedWindowShowState(); + if (show_state == ui::SHOW_STATE_MINIMIZED) { + // Turn off swishing when restoring minimized windows. When creating + // windows from nibs it is necessary to |orderFront:| prior to |orderOut:| + // then |miniaturize:| when restoring windows in the minimized state. + NSWindowAnimationBehavior savedAnimationBehavior = 0; + if ([window() respondsToSelector:@selector(animationBehavior)] && + [window() respondsToSelector:@selector(setAnimationBehavior:)]) { + savedAnimationBehavior = [window() animationBehavior]; + [window() setAnimationBehavior:NSWindowAnimationBehaviorNone]; + } + + [window() makeKeyAndOrderFront:controller_]; + + [window() orderOut:controller_]; + [window() miniaturize:controller_]; + + // Restore window animation behavior. + if ([window() respondsToSelector:@selector(animationBehavior)] && + [window() respondsToSelector:@selector(setAnimationBehavior:)]) { + [window() setAnimationBehavior:savedAnimationBehavior]; + } + } else { + [window() makeKeyAndOrderFront:controller_]; + } } void BrowserWindowCocoa::ShowInactive() { - [window() orderFront:controller_]; + [window() orderFront:controller_]; } void BrowserWindowCocoa::SetBounds(const gfx::Rect& bounds) { @@ -214,6 +258,10 @@ bool BrowserWindowCocoa::IsMaximized() const { return [window() isZoomed]; } +bool BrowserWindowCocoa::IsMinimized() const { + return [window() isMiniaturized]; +} + void BrowserWindowCocoa::SetFullscreen(bool fullscreen) { [controller_ setFullscreen:fullscreen]; } diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm b/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm index 3348a5b..66fbda3 100644 --- a/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm +++ b/chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm @@ -19,8 +19,8 @@ class BrowserWindowCocoaPong : public BrowserWindowCocoa { public: BrowserWindowCocoaPong(Browser* browser, - BrowserWindowController* controller) : - BrowserWindowCocoa(browser, controller, [controller window]) { + BrowserWindowController* controller) + : BrowserWindowCocoa(browser, controller) { pong_ = false; } virtual ~BrowserWindowCocoaPong() { } diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm index 7f5f04e..5a7cdc2 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller.mm @@ -156,8 +156,7 @@ @end -// Provide the forward-declarations of new 10.7 SDK symbols so they can be -// called when building with the 10.5 SDK. +// Replicate specific 10.7 SDK declarations for building with prior SDKs. #if !defined(MAC_OS_X_VERSION_10_7) || \ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 @@ -223,7 +222,7 @@ enum { browser_.reset(browser); ownsBrowser_ = ownIt; NSWindow* window = [self window]; - windowShim_.reset(new BrowserWindowCocoa(browser, self, window)); + windowShim_.reset(new BrowserWindowCocoa(browser, self)); // Create the bar visibility lock set; 10 is arbitrary, but should hopefully // be big enough to hold all locks that'll ever be needed. @@ -614,6 +613,8 @@ enum { // Called when we have been minimized. - (void)windowDidMiniaturize:(NSNotification *)notification { + [self saveWindowPositionIfNeeded]; + // Let the selected RenderWidgetHostView know, so that it can tell plugins. if (TabContents* contents = browser_->GetSelectedTabContents()) { if (RenderWidgetHostView* rwhv = contents->GetRenderWidgetHostView()) @@ -1763,6 +1764,8 @@ enum { // Delegate method called when window is resized. - (void)windowDidResize:(NSNotification*)notification { + [self saveWindowPositionIfNeeded]; + // Resize (and possibly move) the status bubble. Note that we may get called // when the status bubble does not exist. if (statusBubble_) { @@ -1803,6 +1806,8 @@ enum { // |-windowWillMove:|, which is called less frequently than |-windowDidMove| // instead.) - (void)windowDidMove:(NSNotification*)notification { + [self saveWindowPositionIfNeeded]; + NSWindow* window = [self window]; NSRect windowFrame = [window frame]; NSRect workarea = [[window screen] visibleFrame]; diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.h b/chrome/browser/ui/cocoa/browser_window_controller_private.h index 26c181b..39b1f38 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.h +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.h @@ -28,9 +28,6 @@ // Saves the window's position in the local state preferences. - (void)saveWindowPositionIfNeeded; -// Saves the window's position to the given pref service. -- (void)saveWindowPositionToPrefs:(PrefService*)prefs; - // We need to adjust where sheets come out of the window, as by default they // erupt from the omnibox, which is rather weird. - (NSRect)window:(NSWindow*)window diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm index bd3512d..3a4b410 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm @@ -35,6 +35,7 @@ #include "content/browser/renderer_host/render_widget_host_view.h" #include "content/browser/tab_contents/tab_contents.h" #include "content/browser/tab_contents/tab_contents_view.h" +#include "ui/base/ui_base_types.h" // Forward-declare symbols that are part of the 10.6 SDK. #if !defined(MAC_OS_X_VERSION_10_6) || \ @@ -111,18 +112,9 @@ const CGFloat kLocBarBottomInset = 1; } - (void)saveWindowPositionIfNeeded { - if (browser_ != BrowserList::GetLastActive()) + if (!browser_->ShouldSaveWindowPlacement()) return; - if (!browser_->profile()->GetPrefs() || - !browser_->ShouldSaveWindowPlacement()) { - return; - } - - [self saveWindowPositionToPrefs:browser_->profile()->GetPrefs()]; -} - -- (void)saveWindowPositionToPrefs:(PrefService*)prefs { // If we're in fullscreen mode, save the position of the regular window // instead. NSWindow* window = [self isFullscreen] ? savedRegularWindow_ : [self window]; @@ -144,14 +136,20 @@ const CGFloat kLocBarBottomInset = 1; gfx::Rect bounds(NSRectToCGRect([window frame])); bounds.set_y(monitorFrame.size.height - bounds.y() - bounds.height()); - // We also need to save the current work area, in flipped coordinates. + // Browser::SaveWindowPlacement saves information for session restore. + ui::WindowShowState show_state = [window isMiniaturized] ? + ui::SHOW_STATE_MINIMIZED : ui::SHOW_STATE_NORMAL; + browser_->SaveWindowPlacement(bounds, show_state); + + // Only save main window information to preferences. + PrefService* prefs = browser_->profile()->GetPrefs(); + if (!prefs || browser_ != BrowserList::GetLastActive()) + return; + + // Save the current work area, in flipped coordinates. gfx::Rect workArea(NSRectToCGRect([windowScreen visibleFrame])); workArea.set_y(monitorFrame.size.height - workArea.y() - workArea.height()); - // Browser::SaveWindowPlacement is used for session restore. - if (browser_->ShouldSaveWindowPlacement()) - browser_->SaveWindowPlacement(bounds, /*maximized=*/ false); - DictionaryPrefUpdate update(prefs, browser_->GetWindowPlacementKey().c_str()); DictionaryValue* windowPreferences = update.Get(); windowPreferences->SetInteger("left", bounds.x()); diff --git a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm index 0bd0620..533b9a4 100644 --- a/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/browser_window_controller_unittest.mm @@ -7,6 +7,7 @@ #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/sync/sync_ui_util.h" +#include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/cocoa/browser_test_helper.h" #include "chrome/browser/ui/cocoa/browser_window_controller.h" @@ -19,7 +20,7 @@ @interface BrowserWindowController (JustForTesting) // Already defined in BWC. -- (void)saveWindowPositionToPrefs:(PrefService*)prefs; +- (void)saveWindowPositionIfNeeded; - (void)layoutSubviews; @end @@ -92,7 +93,8 @@ TEST_F(BrowserWindowControllerTest, TestSaveWindowPosition) { // Ask the window to save its position, then check that a preference // exists. - [controller_ saveWindowPositionToPrefs:prefs]; + BrowserList::SetLastActive(browser_helper_.browser()); + [controller_ saveWindowPositionIfNeeded]; browser_window_placement = prefs->GetDictionary(prefs::kBrowserWindowPlacement); ASSERT_TRUE(browser_window_placement); diff --git a/chrome/browser/ui/cocoa/framed_browser_window.mm b/chrome/browser/ui/cocoa/framed_browser_window.mm index 712959a..296404e 100644 --- a/chrome/browser/ui/cocoa/framed_browser_window.mm +++ b/chrome/browser/ui/cocoa/framed_browser_window.mm @@ -13,8 +13,7 @@ #import "chrome/browser/renderer_host/render_widget_host_view_mac.h" #include "chrome/browser/themes/theme_service.h" -// Provide the forward-declarations of new 10.7 SDK symbols so they can be -// called when building with the 10.5 SDK. +// Replicate specific 10.7 SDK declarations for building with prior SDKs. #if !defined(MAC_OS_X_VERSION_10_7) || \ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm index d63f04f..bcc5028 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm @@ -67,21 +67,6 @@ NSString* const kTabStripNumberOfTabsChanged = @"kTabStripNumberOfTabsChanged"; -// 10.7 adds public APIs for full-screen support. Provide the declaration so it -// can be called below when building with the 10.5 SDK. -#if !defined(MAC_OS_X_VERSION_10_7) || \ -MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 - -@interface NSWindow (LionSDKDeclarations) -- (void)toggleFullScreen:(id)sender; -@end - -enum { - NSWindowFullScreenButton = 7 -}; - -#endif // MAC_OS_X_VERSION_10_7 - namespace { // A value to indicate tab layout should use the full available width of the diff --git a/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm b/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm index 8873af6..1a92665 100644 --- a/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm +++ b/chrome/browser/ui/cocoa/tabs/tab_strip_drag_controller.mm @@ -11,8 +11,7 @@ #import "chrome/browser/ui/cocoa/tabs/tab_view.h" #import "chrome/browser/ui/cocoa/tabs/tab_window_controller.h" -// Provide the forward-declarations of new 10.7 SDK symbols so they can be -// called when building with the 10.5 SDK. +// Replicate specific 10.7 SDK declarations for building with prior SDKs. #if !defined(MAC_OS_X_VERSION_10_7) || \ MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 diff --git a/chrome/browser/ui/gtk/browser_window_gtk.cc b/chrome/browser/ui/gtk/browser_window_gtk.cc index 4b4dea8..3b7219f 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.cc +++ b/chrome/browser/ui/gtk/browser_window_gtk.cc @@ -324,7 +324,7 @@ BrowserWindowGtk::BrowserWindowGtk(Browser* browser) frame_cursor_(NULL), is_active_(!ui::ActiveWindowWatcherX::WMSupportsActivation()), last_click_time_(0), - maximize_after_show_(false), + show_state_after_show_(ui::SHOW_STATE_DEFAULT), suppress_window_raise_(false), accel_group_(NULL), debounce_timer_disabled_(false) { @@ -646,9 +646,12 @@ void BrowserWindowGtk::Show() { BrowserList::SetLastActive(browser()); gtk_window_present(window_); - if (maximize_after_show_) { + if (show_state_after_show_ == ui::SHOW_STATE_MAXIMIZED) { gtk_window_maximize(window_); - maximize_after_show_ = false; + show_state_after_show_ = ui::SHOW_STATE_NORMAL; + } else if (show_state_after_show_ == ui::SHOW_STATE_MINIMIZED) { + gtk_window_iconify(window_); + show_state_after_show_ = ui::SHOW_STATE_NORMAL; } // If we have sized the window by setting a size request for the render @@ -837,6 +840,10 @@ bool BrowserWindowGtk::IsMaximized() const { return (state_ & GDK_WINDOW_STATE_MAXIMIZED); } +bool BrowserWindowGtk::IsMinimized() const { + return (state_ & GDK_WINDOW_STATE_ICONIFIED); +} + bool BrowserWindowGtk::ShouldDrawContentDropShadow() { return !IsMaximized() && UseCustomFrame(); } @@ -1602,7 +1609,7 @@ void BrowserWindowGtk::SetGeometryHints() { // confused and maximizes the window, but doesn't set the // GDK_WINDOW_STATE_MAXIMIZED bit. So instead, we keep track of whether to // maximize and call it after gtk_window_present. - maximize_after_show_ = browser_->GetSavedMaximizedState(); + show_state_after_show_ = browser_->GetSavedWindowShowState(); gfx::Rect bounds = browser_->GetSavedWindowBounds(); // We don't blindly call SetBounds here: that sets a forced position @@ -1891,8 +1898,14 @@ void BrowserWindowGtk::UpdateCustomFrame() { void BrowserWindowGtk::SaveWindowPosition() { // Browser::SaveWindowPlacement is used for session restore. + ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; + if (IsMaximized()) + show_state = ui::SHOW_STATE_MAXIMIZED; + else if (IsMinimized()) + show_state = ui::SHOW_STATE_MINIMIZED; + if (browser_->ShouldSaveWindowPlacement()) - browser_->SaveWindowPlacement(restored_bounds_, IsMaximized()); + browser_->SaveWindowPlacement(restored_bounds_, show_state); // We also need to save the placement for startup. // This is a web of calls between views and delegates on Windows, but the diff --git a/chrome/browser/ui/gtk/browser_window_gtk.h b/chrome/browser/ui/gtk/browser_window_gtk.h index c7fd581..ecb2e3c 100644 --- a/chrome/browser/ui/gtk/browser_window_gtk.h +++ b/chrome/browser/ui/gtk/browser_window_gtk.h @@ -18,6 +18,7 @@ #include "chrome/browser/tabs/tab_strip_model_observer.h" #include "chrome/browser/ui/browser_window.h" #include "ui/base/gtk/gtk_signal.h" +#include "ui/base/ui_base_types.h" #include "ui/base/x/active_window_watcher_x.h" #include "ui/base/x/x11_util.h" #include "ui/gfx/rect.h" @@ -76,6 +77,7 @@ class BrowserWindowGtk : public BrowserWindow, virtual gfx::Rect GetRestoredBounds() const; virtual gfx::Rect GetBounds() const; virtual bool IsMaximized() const; + virtual bool IsMinimized() const; virtual void SetFullscreen(bool fullscreen); virtual bool IsFullscreen() const; virtual bool IsFullscreenBubbleVisible() const; @@ -491,9 +493,10 @@ class BrowserWindowGtk : public BrowserWindow, guint32 last_click_time_; gfx::Point last_click_position_; - // If true, maximize the window after we call BrowserWindow::Show for the - // first time. This is to work around a compiz bug. - bool maximize_after_show_; + // Optionally maximize or minimize the window after we call + // BrowserWindow::Show for the first time. This is to work around a compiz + // bug. + ui::WindowShowState show_state_after_show_; // If true, don't call gdk_window_raise() when we get a click in the title // bar or window border. This is to work around a compiz bug. diff --git a/chrome/browser/ui/panels/panel.cc b/chrome/browser/ui/panels/panel.cc index 7fc539b..102ac60b 100644 --- a/chrome/browser/ui/panels/panel.cc +++ b/chrome/browser/ui/panels/panel.cc @@ -163,6 +163,11 @@ bool Panel::IsMaximized() const { return false; } +bool Panel::IsMinimized() const { + NOTIMPLEMENTED(); + return false; +} + void Panel::SetFullscreen(bool fullscreen) { NOTIMPLEMENTED(); } diff --git a/chrome/browser/ui/panels/panel.h b/chrome/browser/ui/panels/panel.h index 3966ce3..af9b6214 100644 --- a/chrome/browser/ui/panels/panel.h +++ b/chrome/browser/ui/panels/panel.h @@ -68,6 +68,7 @@ class Panel : public BrowserWindow { virtual gfx::Rect GetRestoredBounds() const OVERRIDE; virtual gfx::Rect GetBounds() const OVERRIDE; virtual bool IsMaximized() const OVERRIDE; + virtual bool IsMinimized() const OVERRIDE; virtual void SetFullscreen(bool fullscreen) OVERRIDE; virtual bool IsFullscreen() const OVERRIDE; virtual bool IsFullscreenBubbleVisible() const OVERRIDE; diff --git a/chrome/browser/ui/views/frame/browser_frame.cc b/chrome/browser/ui/views/frame/browser_frame.cc index acaf68f..20f685a 100644 --- a/chrome/browser/ui/views/frame/browser_frame.cc +++ b/chrome/browser/ui/views/frame/browser_frame.cc @@ -48,7 +48,8 @@ void BrowserFrame::InitBrowserFrame() { // Typed panel/popup can only return a size once the widget has been // created. params.bounds = browser_view_->browser()->GetSavedWindowBounds(); - params.maximize = browser_view_->browser()->GetSavedMaximizedState(); + params.maximize = browser_view_->browser()->GetSavedWindowShowState() == + ui::SHOW_STATE_MAXIMIZED; } Init(params); #if defined(OS_CHROMEOS) diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 59906b5e..e206a6d 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -783,6 +783,12 @@ bool BrowserView::IsMaximized() const { return frame_->IsMaximized(); } +bool BrowserView::IsMinimized() const { + // TODO(dhollowa): Add support for session restore of minimized state. + // http://crbug.com/43274 + return false; +} + void BrowserView::SetFullscreen(bool fullscreen) { if (IsFullscreen() == fullscreen) return; // Nothing to do. @@ -1623,12 +1629,17 @@ std::wstring BrowserView::GetWindowName() const { void BrowserView::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) { + // TODO(dhollowa): Add support for session restore of minimized state. + // http://crbug.com/43274 + // If IsFullscreen() is true, we've just changed into fullscreen mode, and // we're catching the going-into-fullscreen sizing and positioning calls, // which we want to ignore. if (!IsFullscreen() && browser_->ShouldSaveWindowPlacement()) { WidgetDelegate::SaveWindowPlacement(bounds, maximized); - browser_->SaveWindowPlacement(bounds, maximized); + browser_->SaveWindowPlacement(bounds, + maximized ? ui::SHOW_STATE_MAXIMIZED : + ui::SHOW_STATE_NORMAL); } } @@ -1672,7 +1683,9 @@ bool BrowserView::GetSavedWindowBounds(gfx::Rect* bounds) const { } bool BrowserView::GetSavedMaximizedState(bool* maximized) const { - *maximized = browser_->GetSavedMaximizedState(); + // TODO(dhollowa): Add support for session restore of minimized state. + // http://crbug.com/43274 + *maximized = browser_->GetSavedWindowShowState() == ui::SHOW_STATE_MAXIMIZED; return true; } diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index 28ae5c9..66aba98 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -270,6 +270,7 @@ class BrowserView : public BrowserBubbleHost, virtual gfx::Rect GetRestoredBounds() const OVERRIDE; virtual gfx::Rect GetBounds() const OVERRIDE; virtual bool IsMaximized() const OVERRIDE; + virtual bool IsMinimized() const OVERRIDE; virtual void SetFullscreen(bool fullscreen) OVERRIDE; virtual bool IsFullscreen() const OVERRIDE; virtual LocationBar* GetLocationBar() const OVERRIDE; diff --git a/chrome/test/base/test_browser_window.cc b/chrome/test/base/test_browser_window.cc index 0b008d1..5e4c966 100644 --- a/chrome/test/base/test_browser_window.cc +++ b/chrome/test/base/test_browser_window.cc @@ -38,6 +38,10 @@ bool TestBrowserWindow::IsMaximized() const { return false; } +bool TestBrowserWindow::IsMinimized() const { + return false; +} + bool TestBrowserWindow::IsFullscreen() const { return false; } diff --git a/chrome/test/base/test_browser_window.h b/chrome/test/base/test_browser_window.h index e08aad6..4878800 100644 --- a/chrome/test/base/test_browser_window.h +++ b/chrome/test/base/test_browser_window.h @@ -42,6 +42,7 @@ class TestBrowserWindow : public BrowserWindow { virtual gfx::Rect GetRestoredBounds() const OVERRIDE; virtual gfx::Rect GetBounds() const OVERRIDE; virtual bool IsMaximized() const OVERRIDE; + virtual bool IsMinimized() const OVERRIDE; virtual void SetFullscreen(bool fullscreen) OVERRIDE {} virtual bool IsFullscreen() const OVERRIDE; virtual bool IsFullscreenBubbleVisible() const OVERRIDE; |