| 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_IMPL_H_ | 5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ |
| 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ | 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "chrome/browser/ui/startup/startup_tab.h" | 13 #include "chrome/browser/ui/startup/startup_tab.h" |
| 14 #include "chrome/browser/ui/startup/startup_types.h" | 14 #include "chrome/browser/ui/startup/startup_types.h" |
| 15 #include "googleurl/src/gurl.h" | 15 #include "googleurl/src/gurl.h" |
| 16 | 16 |
| 17 class Browser; | 17 class Browser; |
| 18 class CommandLine; | 18 class CommandLine; |
| 19 class FilePath; | |
| 20 class Profile; | 19 class Profile; |
| 21 class StartupBrowserCreator; | 20 class StartupBrowserCreator; |
| 22 | 21 |
| 22 namespace base { |
| 23 class FilePath; |
| 24 } |
| 25 |
| 23 namespace content { | 26 namespace content { |
| 24 class WebContents; | 27 class WebContents; |
| 25 } | 28 } |
| 26 | 29 |
| 27 namespace gfx { | 30 namespace gfx { |
| 28 class Rect; | 31 class Rect; |
| 29 } | 32 } |
| 30 | 33 |
| 31 namespace internals { | 34 namespace internals { |
| 32 GURL GetWelcomePageURL(); | 35 GURL GetWelcomePageURL(); |
| 33 } | 36 } |
| 34 | 37 |
| 35 // Assists launching the application and appending the initial tabs for a | 38 // Assists launching the application and appending the initial tabs for a |
| 36 // browser window. | 39 // browser window. |
| 37 class StartupBrowserCreatorImpl { | 40 class StartupBrowserCreatorImpl { |
| 38 public: | 41 public: |
| 39 // There are two ctors. The first one implies a NULL browser_creator object | 42 // There are two ctors. The first one implies a NULL browser_creator object |
| 40 // and thus no access to distribution-specific first-run behaviors. The | 43 // and thus no access to distribution-specific first-run behaviors. The |
| 41 // second one is always called when the browser starts even if it is not | 44 // second one is always called when the browser starts even if it is not |
| 42 // the first run. |is_first_run| indicates that this is a new profile. | 45 // the first run. |is_first_run| indicates that this is a new profile. |
| 43 StartupBrowserCreatorImpl(const FilePath& cur_dir, | 46 StartupBrowserCreatorImpl(const base::FilePath& cur_dir, |
| 44 const CommandLine& command_line, | 47 const CommandLine& command_line, |
| 45 chrome::startup::IsFirstRun is_first_run); | 48 chrome::startup::IsFirstRun is_first_run); |
| 46 StartupBrowserCreatorImpl(const FilePath& cur_dir, | 49 StartupBrowserCreatorImpl(const base::FilePath& cur_dir, |
| 47 const CommandLine& command_line, | 50 const CommandLine& command_line, |
| 48 StartupBrowserCreator* browser_creator, | 51 StartupBrowserCreator* browser_creator, |
| 49 chrome::startup::IsFirstRun is_first_run); | 52 chrome::startup::IsFirstRun is_first_run); |
| 50 ~StartupBrowserCreatorImpl(); | 53 ~StartupBrowserCreatorImpl(); |
| 51 | 54 |
| 52 // Creates the necessary windows for startup. Returns true on success, | 55 // Creates the necessary windows for startup. Returns true on success, |
| 53 // false on failure. process_startup is true if Chrome is just | 56 // false on failure. process_startup is true if Chrome is just |
| 54 // starting up. If process_startup is false, it indicates Chrome was | 57 // starting up. If process_startup is false, it indicates Chrome was |
| 55 // already running and the user wants to launch another instance. | 58 // already running and the user wants to launch another instance. |
| 56 bool Launch(Profile* profile, | 59 bool Launch(Profile* profile, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // Checks whether the Preferences backup is invalid and notifies user in | 144 // Checks whether the Preferences backup is invalid and notifies user in |
| 142 // that case. | 145 // that case. |
| 143 void CheckPreferencesBackup(Profile* profile); | 146 void CheckPreferencesBackup(Profile* profile); |
| 144 | 147 |
| 145 // Function to open startup urls in an existing Browser instance for the | 148 // Function to open startup urls in an existing Browser instance for the |
| 146 // profile passed in. Returns true on success. | 149 // profile passed in. Returns true on success. |
| 147 static bool OpenStartupURLsInExistingBrowser( | 150 static bool OpenStartupURLsInExistingBrowser( |
| 148 Profile* profile, | 151 Profile* profile, |
| 149 const std::vector<GURL>& startup_urls); | 152 const std::vector<GURL>& startup_urls); |
| 150 | 153 |
| 151 const FilePath cur_dir_; | 154 const base::FilePath cur_dir_; |
| 152 const CommandLine& command_line_; | 155 const CommandLine& command_line_; |
| 153 Profile* profile_; | 156 Profile* profile_; |
| 154 StartupBrowserCreator* browser_creator_; | 157 StartupBrowserCreator* browser_creator_; |
| 155 bool is_first_run_; | 158 bool is_first_run_; |
| 156 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); | 159 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); |
| 157 }; | 160 }; |
| 158 | 161 |
| 159 // Returns true if |profile| has exited uncleanly and has not been launched | 162 // Returns true if |profile| has exited uncleanly and has not been launched |
| 160 // after the unclean exit. | 163 // after the unclean exit. |
| 161 bool HasPendingUncleanExit(Profile* profile); | 164 bool HasPendingUncleanExit(Profile* profile); |
| 162 | 165 |
| 163 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ | 166 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ |
| OLD | NEW |