diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-07 23:37:59 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-07 23:37:59 +0000 |
commit | 4a8bca5ce3b7c77514f3a46625c0ac397848b15b (patch) | |
tree | 5b460d39ca15419f076d8cd697223ebdcbaa8574 /chrome/browser/browser_init.h | |
parent | 7c0bef11a5930ee52e6351248228444889bdc702 (diff) | |
download | chromium_src-4a8bca5ce3b7c77514f3a46625c0ac397848b15b.zip chromium_src-4a8bca5ce3b7c77514f3a46625c0ac397848b15b.tar.gz chromium_src-4a8bca5ce3b7c77514f3a46625c0ac397848b15b.tar.bz2 |
Refactor BrowserInit in preparation for customized first run tabs
- BrowserInit is now a instanciable class
- The 'bag of static functions' part is mostly unchanged
- unused members in the interface moved to the cc file
TEST= no visible change. interactive UI tests sufice
BUG=9706
Review URL: http://codereview.chromium.org/113113
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15595 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_init.h')
-rw-r--r-- | chrome/browser/browser_init.h | 67 |
1 files changed, 37 insertions, 30 deletions
diff --git a/chrome/browser/browser_init.h b/chrome/browser/browser_init.h index 6be28502..221f169 100644 --- a/chrome/browser/browser_init.h +++ b/chrome/browser/browser_init.h @@ -9,6 +9,7 @@ #include <vector> #include "base/basictypes.h" +#include "googleurl/src/gurl.h" class Browser; class CommandLine; @@ -17,10 +18,42 @@ class PrefService; class Profile; class TabContents; -// Scoper class containing helpers for BrowserMain to spin up a new instance -// and initialize the profile. +// class containing helpers for BrowserMain to spin up a new instance and +// initialize the profile. class BrowserInit { public: + BrowserInit() {}; + ~BrowserInit() {}; + + // Adds a url to be opened during first run. This overrides the standard + // tabs shown at first run. + void AddFirstRunTab(const GURL& url) { + first_run_tabs_.push_back(url); + } + + // This function is equivalent to ProcessCommandLine but should only be + // called during actual process startup. + bool Start(const CommandLine& cmd_line, const std::wstring& cur_dir, + Profile* profile, int* return_code) { + return ProcessCommandLine(cmd_line, cur_dir, true, profile, return_code); + } + + // This function performs command-line handling and is invoked when + // process starts as well as when we get a start request from another + // process (via the WM_COPYDATA message). |command_line| holds the command + // line we need to process - either from this process or from some other one + // (if |process_startup| is true and we are being called from + // ProcessSingleton::OnCopyData). + static bool ProcessCommandLine(const CommandLine& command_line, + const std::wstring& cur_dir, + bool process_startup, Profile* profile, + int* return_code); + + template <class AutomationProviderClass> + static void CreateAutomationProvider(const std::wstring& channel_id, + Profile* profile, + size_t expected_tabs); + // Returns true if the browser is coming up. static bool InProcessStartup(); @@ -89,36 +122,10 @@ class BrowserInit { DISALLOW_COPY_AND_ASSIGN(LaunchWithProfile); }; - // This function performs command-line handling and is invoked when - // process starts as well as when we get a start request from another - // process (via the WM_COPYDATA message). |command_line| holds the command - // line we need to process - either from this process or from some other one - // (if |process_startup| is true and we are being called from - // ProcessSingleton::OnCopyData). - static bool ProcessCommandLine(const CommandLine& command_line, - const std::wstring& cur_dir, - 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& command_line, - Profile* profile, const std::wstring& cur_dir, - bool process_startup, int* return_code); - - template <class AutomationProviderClass> - static void CreateAutomationProvider(const std::wstring& channel_id, - Profile* profile, - size_t expected_tabs); - private: - // Does the work of LaunchBrowser returning the result. - static bool LaunchBrowserImpl(const CommandLine& command_line, - Profile* profile, const std::wstring& cur_dir, - bool process_startup, int* return_code); + // Additional tabs to open during first run. + std::vector<GURL> first_run_tabs_; - // This class is for scoping purposes. - BrowserInit(); DISALLOW_COPY_AND_ASSIGN(BrowserInit); }; |