diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 15:24:31 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-14 15:24:31 +0000 |
commit | 96649a0f3cafe764eb191532f635d99c234ea005 (patch) | |
tree | 4450b4a03d498df44850ef549814a458cbc77be9 /chrome/browser/window_sizer.h | |
parent | 3313359d46d2a4f0e0dc8c4dc476462dec8c988a (diff) | |
download | chromium_src-96649a0f3cafe764eb191532f635d99c234ea005.zip chromium_src-96649a0f3cafe764eb191532f635d99c234ea005.tar.gz chromium_src-96649a0f3cafe764eb191532f635d99c234ea005.tar.bz2 |
Enable basic saving/restoring window placements on Mac.
Refactors the existing WindowSizer code to move platform-specific code
into separate files. Future CLs will add Mac support for muliple
monitors.
TEST=Browser windows should remember their position on Mac. The
corresponding behavior on Windows should not have changed.
Review URL: http://codereview.chromium.org/113286
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16056 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/window_sizer.h')
-rw-r--r-- | chrome/browser/window_sizer.h | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/chrome/browser/window_sizer.h b/chrome/browser/window_sizer.h index 5153f6d..d1db1db 100644 --- a/chrome/browser/window_sizer.h +++ b/chrome/browser/window_sizer.h @@ -1,9 +1,9 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 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_WINDOW_SIZER_H__ -#define CHROME_BROWSER_WINDOW_SIZER_H__ +#ifndef CHROME_BROWSER_WINDOW_SIZER_H_ +#define CHROME_BROWSER_WINDOW_SIZER_H_ #include <vector> @@ -33,6 +33,10 @@ class WindowSizer { MonitorInfoProvider* monitor_info_provider); virtual ~WindowSizer(); + // Static factory methods to create default MonitorInfoProvider + // instances. The returned object is owned by the caller. + static MonitorInfoProvider* CreateDefaultMonitorInfoProvider(); + // An interface implemented by an object that can retrieve information about // the monitors on the system. class MonitorInfoProvider { @@ -92,20 +96,6 @@ class WindowSizer { virtual bool GetLastActiveWindowState(gfx::Rect* bounds) const = 0; }; - // Determines the size, position and maximized state for the browser window. - // See documentation for DetermineWindowBounds below. Normally, - // |window_bounds| is calculated by calling GetLastActiveWindowState(). To - // explicitly specify a particular window to base the bounds on, pass in a - // non-NULL value for |browser|. - static void GetBrowserWindowBounds(const std::wstring& app_name, - const gfx::Rect& specified_bounds, - Browser* browser, - gfx::Rect* window_bounds, - bool* maximized); - - // Returns the default origin for popups of the given size. - static gfx::Point GetDefaultPopupOrigin(const gfx::Size& size); - // Determines the position, size and maximized state for a window as it is // created. This function uses several strategies to figure out optimal size // and placement, first looking for an existing active window, then falling @@ -121,6 +111,24 @@ class WindowSizer { gfx::Rect* bounds, bool* maximized) const; + // Determines the size, position and maximized state for the browser window. + // See documentation for DetermineWindowBounds below. Normally, + // |window_bounds| is calculated by calling GetLastActiveWindowState(). To + // explicitly specify a particular window to base the bounds on, pass in a + // non-NULL value for |browser|. + static void GetBrowserWindowBounds(const std::wstring& app_name, + const gfx::Rect& specified_bounds, + Browser* browser, + gfx::Rect* window_bounds, + bool* maximized); + + // Returns the default origin for popups of the given size. + static gfx::Point GetDefaultPopupOrigin(const gfx::Size& size); + + // How much horizontal and vertical offset there is between newly + // opened windows. This value may be different on each platform. + static const int kWindowTilePixels; + private: // The edge of the screen to check for out-of-bounds. enum Edge { TOP, LEFT, BOTTOM, RIGHT }; @@ -165,5 +173,4 @@ class WindowSizer { DISALLOW_EVIL_CONSTRUCTORS(WindowSizer); }; - -#endif // #ifndef CHROME_BROWSER_WINDOW_SIZER_H__ +#endif // #ifndef CHROME_BROWSER_WINDOW_SIZER_H_ |