| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ | 5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ |
| 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ | 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 const FilePath& cur_dir, | 41 const FilePath& cur_dir, |
| 42 Profile* last_used_profile, | 42 Profile* last_used_profile, |
| 43 const Profiles& last_opened_profiles, | 43 const Profiles& last_opened_profiles, |
| 44 int* return_code) { | 44 int* return_code) { |
| 45 return ProcessCmdLineImpl(cmd_line, cur_dir, true, last_used_profile, | 45 return ProcessCmdLineImpl(cmd_line, cur_dir, true, last_used_profile, |
| 46 last_opened_profiles, return_code, this); | 46 last_opened_profiles, return_code, this); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // This function performs command-line handling and is invoked only after | 49 // This function performs command-line handling and is invoked only after |
| 50 // start up (for example when we get a start request for another process). | 50 // start up (for example when we get a start request for another process). |
| 51 // |command_line| holds the command line we need to process | 51 // |command_line| holds the command line we need to process. |
| 52 static void ProcessCommandLineAlreadyRunning(const CommandLine& cmd_line, | 52 // |cur_dir| is the current working directory that the original process was |
| 53 const FilePath& cur_dir); | 53 // invoked from. |
| 54 // |startup_profile_dir| is the directory that contains the profile that the |
| 55 // command line arguments will be executed under. |
| 56 static void ProcessCommandLineAlreadyRunning( |
| 57 const CommandLine& command_line, |
| 58 const FilePath& cur_dir, |
| 59 const FilePath& startup_profile_dir); |
| 54 | 60 |
| 55 template <class AutomationProviderClass> | 61 template <class AutomationProviderClass> |
| 56 static bool CreateAutomationProvider(const std::string& channel_id, | 62 static bool CreateAutomationProvider(const std::string& channel_id, |
| 57 Profile* profile, | 63 Profile* profile, |
| 58 size_t expected_tabs); | 64 size_t expected_tabs); |
| 59 | 65 |
| 60 // Returns true if we're launching a profile synchronously. In that case, the | 66 // Returns true if we're launching a profile synchronously. In that case, the |
| 61 // opened window should not cause a session restore. | 67 // opened window should not cause a session restore. |
| 62 static bool InSynchronousProfileLaunch(); | 68 static bool InSynchronousProfileLaunch(); |
| 63 | 69 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 static bool ProcessCmdLineImpl(const CommandLine& command_line, | 128 static bool ProcessCmdLineImpl(const CommandLine& command_line, |
| 123 const FilePath& cur_dir, | 129 const FilePath& cur_dir, |
| 124 bool process_startup, | 130 bool process_startup, |
| 125 Profile* last_used_profile, | 131 Profile* last_used_profile, |
| 126 const Profiles& last_opened_profiles, | 132 const Profiles& last_opened_profiles, |
| 127 int* return_code, | 133 int* return_code, |
| 128 StartupBrowserCreator* browser_creator); | 134 StartupBrowserCreator* browser_creator); |
| 129 | 135 |
| 130 // Callback after a profile has been created. | 136 // Callback after a profile has been created. |
| 131 static void ProcessCommandLineOnProfileCreated( | 137 static void ProcessCommandLineOnProfileCreated( |
| 132 const CommandLine& cmd_line, | 138 const CommandLine& command_line, |
| 133 const FilePath& cur_dir, | 139 const FilePath& cur_dir, |
| 134 Profile* profile, | 140 Profile* profile, |
| 135 Profile::CreateStatus status); | 141 Profile::CreateStatus status); |
| 136 | 142 |
| 137 // Returns true once a profile was activated. Used by the | 143 // Returns true once a profile was activated. Used by the |
| 138 // StartupBrowserCreatorTest.LastUsedProfileActivated test. | 144 // StartupBrowserCreatorTest.LastUsedProfileActivated test. |
| 139 static bool ActivatedProfile(); | 145 static bool ActivatedProfile(); |
| 140 | 146 |
| 141 // Additional tabs to open during first run. | 147 // Additional tabs to open during first run. |
| 142 std::vector<GURL> first_run_tabs_; | 148 std::vector<GURL> first_run_tabs_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 154 // member variable instead of a static variable inside WasRestarted because | 160 // member variable instead of a static variable inside WasRestarted because |
| 155 // of testing.) | 161 // of testing.) |
| 156 static bool was_restarted_read_; | 162 static bool was_restarted_read_; |
| 157 | 163 |
| 158 static bool in_synchronous_profile_launch_; | 164 static bool in_synchronous_profile_launch_; |
| 159 | 165 |
| 160 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreator); | 166 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreator); |
| 161 }; | 167 }; |
| 162 | 168 |
| 163 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ | 169 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ |
| OLD | NEW |