OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_BROWSER_INIT_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_INIT_H_ |
6 #define CHROME_BROWSER_UI_BROWSER_INIT_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_INIT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 | 17 |
18 class Browser; | 18 class Browser; |
19 class CommandLine; | 19 class CommandLine; |
20 class GURL; | 20 class GURL; |
| 21 class PrefService; |
21 class TabContentsWrapper; | 22 class TabContentsWrapper; |
22 | 23 |
23 // class containing helpers for BrowserMain to spin up a new instance and | 24 // class containing helpers for BrowserMain to spin up a new instance and |
24 // initialize the profile. | 25 // initialize the profile. |
25 class BrowserInit { | 26 class BrowserInit { |
26 public: | 27 public: |
27 enum IsProcessStartup { | 28 enum IsProcessStartup { |
28 IS_NOT_PROCESS_STARTUP, | 29 IS_NOT_PROCESS_STARTUP, |
29 IS_PROCESS_STARTUP | 30 IS_PROCESS_STARTUP |
30 }; | 31 }; |
(...skipping 24 matching lines...) Expand all Loading... |
55 const FilePath& cur_dir); | 56 const FilePath& cur_dir); |
56 | 57 |
57 template <class AutomationProviderClass> | 58 template <class AutomationProviderClass> |
58 static bool CreateAutomationProvider(const std::string& channel_id, | 59 static bool CreateAutomationProvider(const std::string& channel_id, |
59 Profile* profile, | 60 Profile* profile, |
60 size_t expected_tabs); | 61 size_t expected_tabs); |
61 | 62 |
62 // Returns true if the browser is coming up. | 63 // Returns true if the browser is coming up. |
63 static bool InProcessStartup(); | 64 static bool InProcessStartup(); |
64 | 65 |
| 66 static void RegisterUserPrefs(PrefService* prefs); |
| 67 |
65 // Launches a browser window associated with |profile|. |command_line| should | 68 // Launches a browser window associated with |profile|. |command_line| should |
66 // 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 |
67 // implies that the directory of the executable should be used. | 70 // implies that the directory of the executable should be used. |
68 // |process_startup| indicates whether this is the first browser. | 71 // |process_startup| indicates whether this is the first browser. |
69 // |is_first_run| indicates that this is a new profile. | 72 // |is_first_run| indicates that this is a new profile. |
70 bool LaunchBrowser(const CommandLine& command_line, | 73 bool LaunchBrowser(const CommandLine& command_line, |
71 Profile* profile, | 74 Profile* profile, |
72 const FilePath& cur_dir, | 75 const FilePath& cur_dir, |
73 IsProcessStartup is_process_startup, | 76 IsProcessStartup is_process_startup, |
74 IsFirstRun is_first_run, | 77 IsFirstRun is_first_run, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // about it. | 220 // about it. |
218 void AddObsoleteSystemInfoBarIfNecessary(TabContentsWrapper* tab); | 221 void AddObsoleteSystemInfoBarIfNecessary(TabContentsWrapper* tab); |
219 | 222 |
220 // Adds additional startup URLs to the specified vector. | 223 // Adds additional startup URLs to the specified vector. |
221 void AddStartupURLs(std::vector<GURL>* startup_urls) const; | 224 void AddStartupURLs(std::vector<GURL>* startup_urls) const; |
222 | 225 |
223 // Checks whether Chrome is still the default browser (unless the user | 226 // Checks whether Chrome is still the default browser (unless the user |
224 // previously instructed not to do so) and warns the user if it is not. | 227 // previously instructed not to do so) and warns the user if it is not. |
225 void CheckDefaultBrowser(Profile* profile); | 228 void CheckDefaultBrowser(Profile* profile); |
226 | 229 |
| 230 // Checks whether Chrome was auto-started at login. |
| 231 void CheckIfAutoLaunched(Profile* profile); |
| 232 |
227 const FilePath cur_dir_; | 233 const FilePath cur_dir_; |
228 const CommandLine& command_line_; | 234 const CommandLine& command_line_; |
229 Profile* profile_; | 235 Profile* profile_; |
230 BrowserInit* browser_init_; | 236 BrowserInit* browser_init_; |
231 bool is_first_run_; | 237 bool is_first_run_; |
232 DISALLOW_COPY_AND_ASSIGN(LaunchWithProfile); | 238 DISALLOW_COPY_AND_ASSIGN(LaunchWithProfile); |
233 }; | 239 }; |
234 | 240 |
235 private: | 241 private: |
236 // Returns the list of URLs to open from the command line. The returned | 242 // Returns the list of URLs to open from the command line. The returned |
(...skipping 20 matching lines...) Expand all Loading... |
257 | 263 |
258 // Stores the value of the preference kWasRestarted had when it was read. | 264 // Stores the value of the preference kWasRestarted had when it was read. |
259 static bool was_restarted_; | 265 static bool was_restarted_; |
260 // True if we have already read and reset the preference kWasRestarted. | 266 // True if we have already read and reset the preference kWasRestarted. |
261 static bool was_restarted_read_; | 267 static bool was_restarted_read_; |
262 | 268 |
263 DISALLOW_COPY_AND_ASSIGN(BrowserInit); | 269 DISALLOW_COPY_AND_ASSIGN(BrowserInit); |
264 }; | 270 }; |
265 | 271 |
266 #endif // CHROME_BROWSER_UI_BROWSER_INIT_H_ | 272 #endif // CHROME_BROWSER_UI_BROWSER_INIT_H_ |
OLD | NEW |