| 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 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/prefs/session_startup_pref.h" | 15 #include "chrome/browser/prefs/session_startup_pref.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/startup/startup_tab.h" | 17 #include "chrome/browser/ui/startup/startup_tab.h" |
| 18 #include "chrome/browser/ui/startup/startup_types.h" | 18 #include "chrome/browser/ui/startup/startup_types.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 class Browser; |
| 21 class GURL; | 22 class GURL; |
| 22 class PrefRegistrySimple; | 23 class PrefRegistrySimple; |
| 23 | 24 |
| 24 namespace base { | 25 namespace base { |
| 25 class CommandLine; | 26 class CommandLine; |
| 26 } | 27 } |
| 27 | 28 |
| 28 // class containing helpers for BrowserMain to spin up a new instance and | 29 // class containing helpers for BrowserMain to spin up a new instance and |
| 29 // initialize the profile. | 30 // initialize the profile. |
| 30 class StartupBrowserCreator { | 31 class StartupBrowserCreator { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 50 // |command_line| holds the command line we need to process. | 51 // |command_line| holds the command line we need to process. |
| 51 // |cur_dir| is the current working directory that the original process was | 52 // |cur_dir| is the current working directory that the original process was |
| 52 // invoked from. | 53 // invoked from. |
| 53 // |startup_profile_dir| is the directory that contains the profile that the | 54 // |startup_profile_dir| is the directory that contains the profile that the |
| 54 // command line arguments will be executed under. | 55 // command line arguments will be executed under. |
| 55 static void ProcessCommandLineAlreadyRunning( | 56 static void ProcessCommandLineAlreadyRunning( |
| 56 const base::CommandLine& command_line, | 57 const base::CommandLine& command_line, |
| 57 const base::FilePath& cur_dir, | 58 const base::FilePath& cur_dir, |
| 58 const base::FilePath& startup_profile_dir); | 59 const base::FilePath& startup_profile_dir); |
| 59 | 60 |
| 61 // Opens the set of startup pages from the current session startup prefs. |
| 62 static void OpenStartupPages(Browser* browser, bool process_startup); |
| 63 |
| 60 // Returns true if we're launching a profile synchronously. In that case, the | 64 // Returns true if we're launching a profile synchronously. In that case, the |
| 61 // opened window should not cause a session restore. | 65 // opened window should not cause a session restore. |
| 62 static bool InSynchronousProfileLaunch(); | 66 static bool InSynchronousProfileLaunch(); |
| 63 | 67 |
| 64 // Launches a browser window associated with |profile|. |command_line| should | 68 // Launches a browser window associated with |profile|. |command_line| should |
| 65 // be the command line passed to this process. |cur_dir| can be empty, which | 69 // be the command line passed to this process. |cur_dir| can be empty, which |
| 66 // implies that the directory of the executable should be used. | 70 // implies that the directory of the executable should be used. |
| 67 // |process_startup| indicates whether this is the first browser. | 71 // |process_startup| indicates whether this is the first browser. |
| 68 // |is_first_run| indicates that this is a new profile. | 72 // |is_first_run| indicates that this is a new profile. |
| 69 bool LaunchBrowser(const base::CommandLine& command_line, | 73 bool LaunchBrowser(const base::CommandLine& command_line, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 const base::CommandLine& command_line); | 195 const base::CommandLine& command_line); |
| 192 | 196 |
| 193 // Returns the profile that should be loaded on process startup when | 197 // Returns the profile that should be loaded on process startup when |
| 194 // GetStartupProfile() returns null. As with GetStartupProfile(), returning the | 198 // GetStartupProfile() returns null. As with GetStartupProfile(), returning the |
| 195 // guest profile means the caller should open the user manager. This may return | 199 // guest profile means the caller should open the user manager. This may return |
| 196 // null if neither any profile nor the user manager can be opened. | 200 // null if neither any profile nor the user manager can be opened. |
| 197 Profile* GetFallbackStartupProfile(); | 201 Profile* GetFallbackStartupProfile(); |
| 198 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) | 202 #endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID) |
| 199 | 203 |
| 200 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ | 204 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ |
| OLD | NEW |