diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 00:29:05 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 00:29:05 +0000 |
commit | 15952e462a8d6ef6d555219d0af62ceae093a173 (patch) | |
tree | 530c1a3e238e3ca7488b5589c49480df51f7378d /chrome/views/window.h | |
parent | d6dfe0d2402e2dbf997833f2deaf5b4a55b9b40a (diff) | |
download | chromium_src-15952e462a8d6ef6d555219d0af62ceae093a173.zip chromium_src-15952e462a8d6ef6d555219d0af62ceae093a173.tar.gz chromium_src-15952e462a8d6ef6d555219d0af62ceae093a173.tar.bz2 |
Re-do the way browser windows are shown:
- Remove the path from WinMain to the Browser object passing the show_command. For the Browser object, this is a problem since this value isn't portable. For the code in general it involves a lot of ugly wiring. It's completely unnecessary since the value is obtainable via GetStartupInfo.
- Remove show_command plumbing from all over the place (session restore, web app launcher, etc)
Change the way browser windows are constructed:
- The browser constructor now takes just a type and a profile, and simply initializes the object.
- Some configuration that used to be part of the constructor that was only used in one or two use cases (initial bounds, maximized state, web app name) are split into separate setters.
- Window creation is split out into a separate step to be called post configuration.
- Assorted static helper functions added to Browser to make construction of common types easy.
- Remove Browser::Show in favor of BrowserWindow::Show
- Adjust all callers to use the new helpers.
Change the way ChromeViews restores window placement:
- Split restored size determination from restored maximized determination. They are needed by the code at different times. Size restoration happens when the window is constructed and Window::SetInitialBounds is called. Maximized state restoration happens when the window is shown for the first time and SW_SHOWMAXIMIZED or SW_SHOWNORMAL is needed. Thus, replace WindowDelegate::RestoreWindowPosition with WindowDelegate::RestoreWindowBounds and WindowDelegate::RestoreMaximizedState.
- Window::SetInitialBounds calls WindowDelegate::RestoreWindowBounds
- Window::Show calls WindowDelegate::RestoreMaximizedState
- Adjusts all WindowDelegate implementations that override RestoreWindowPosition to implement these new methods instead.
- Move "playback/record" mode window size setting from browser_init to Browser::RestoreWindowBounds.
- Provide a virtual function on Window called GetShowState that determines the default show state to be used when Window::Show is called. For most windows and dialogs this is SW_SHOWNORMAL. AeroGlassFrame/OpaqueFrame (the browser window frames) override this since they're the app's main windows to return the value provided by GetStartupInfo which gives the value from the app shortcut.
http://crbug.com/3557
Review URL: http://codereview.chromium.org/10896
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5417 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views/window.h')
-rw-r--r-- | chrome/views/window.h | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/chrome/views/window.h b/chrome/views/window.h index 533bc27..ad8f020 100644 --- a/chrome/views/window.h +++ b/chrome/views/window.h @@ -52,7 +52,14 @@ class Window : public ContainerWin { // Show the window. void Show(); - void Show(int show_style); + void Show(int show_state); + + // Retrieve the show state of the window. This is one of the SW_SHOW* flags + // passed into Windows' ShowWindow method. For normal windows this defaults + // to SW_SHOWNORMAL, however windows (e.g. the main window) can override this + // method to provide different values (e.g. retrieve the user's specified + // show state from the shortcut starutp info). + virtual int GetShowState() const; // Activate the window, assuming it already exists and is visible. void Activate(); @@ -104,24 +111,6 @@ class Window : public ContainerWin { // The parent of this window. HWND owning_window() const { return owning_hwnd_; } - // Convenience methods for storing/retrieving window location information - // to/from a PrefService using the specified |entry| name. - // WindowDelegate instances can use these methods in their implementation of - // SaveWindowPosition/RestoreWindowPosition to save windows' location to - // preferences. - static bool SaveWindowPositionToPrefService(PrefService* pref_service, - const std::wstring& entry, - const CRect& bounds, - bool maximized, - bool always_on_top); - // Returns true if the window location was retrieved from the PrefService and - // set in |bounds|, |maximized| and |always_on_top|. - static bool RestoreWindowPositionFromPrefService(PrefService* pref_service, - const std::wstring& entry, - CRect* bounds, - bool* maximized, - bool* always_on_top); - // Returns the preferred size of the contents view of this window based on // its localized size data. The width in cols is held in a localized string // resource identified by |col_resource_id|, the height in the same fashion. @@ -195,6 +184,10 @@ class Window : public ContainerWin { // bounds used when the window was created. void SetInitialBounds(const gfx::Rect& create_bounds); + // Restore saved always on stop state and add the always on top system menu + // if needed. + void InitAlwaysOnTopState(); + // Add an item for "Always on Top" to the System Menu. void AddAlwaysOnTopSystemMenuItem(); |