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/browser/browser_init.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/browser/browser_init.h')
-rw-r--r-- | chrome/browser/browser_init.h | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/chrome/browser/browser_init.h b/chrome/browser/browser_init.h index 424de15..8b27aa1 100644 --- a/chrome/browser/browser_init.h +++ b/chrome/browser/browser_init.h @@ -46,7 +46,7 @@ class BrowserInit { // TODO(brettw): this will not handle all cases. If two process start up too // close to each other, the window might not have been created yet for the // first one, so this function won't find it. - bool NotifyOtherProcess(int show_cmd); + bool NotifyOtherProcess(); // Create the toplevel message window for IPC. void Create(); @@ -97,8 +97,7 @@ class BrowserInit { class LaunchWithProfile { public: LaunchWithProfile(const std::wstring& cur_dir, - const std::wstring& cmd_line, - int show_command); + const std::wstring& cmd_line); ~LaunchWithProfile() { } // Creates the necessary windows for startup. Returns true on success, @@ -108,11 +107,6 @@ class BrowserInit { bool Launch(Profile* profile, bool process_startup); private: - // Creates a new tabbed browser. - // - // Note that the window returned by this function may not be visible yet. - Browser* CreateTabbedBrowser(); - // Does the following: // . If the user's startup pref is to restore the last session (or the // command line flag is present to force using last session), it is @@ -144,7 +138,6 @@ class BrowserInit { std::wstring cur_dir_; std::wstring command_line_; - int show_command_; Profile* profile_; // Bounds for the browser. @@ -160,16 +153,14 @@ class BrowserInit { // the WM_COPYDATA handler. static bool ProcessCommandLine(const CommandLine& parsed_command_line, const std::wstring& cur_dir, - PrefService* prefs, int show_command, - bool process_startup, Profile* profile, - int* return_code); + PrefService* prefs, bool process_startup, + Profile* profile, int* return_code); // Helper function to launch a new browser based on command-line arguments // This function takes in a specific profile to use. static bool LaunchBrowser(const CommandLine& parsed_command_line, - Profile* profile, int show_command, - const std::wstring& cur_dir, bool process_startup, - int* return_code); + Profile* profile, const std::wstring& cur_dir, + bool process_startup, int* return_code); template <class AutomationProviderClass> static void CreateAutomationProvider(const std::wstring& channel_id, @@ -179,8 +170,7 @@ class BrowserInit { private: // Does the work of LaunchBrowser returning the result. static bool LaunchBrowserImpl(const CommandLine& parsed_command_line, - Profile* profile, int show_command, - const std::wstring& cur_dir, + Profile* profile, const std::wstring& cur_dir, bool process_startup, int* return_code); // This class is for scoping purposes. |