Chromium Code Reviews| 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> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 Profile* profile, | 57 Profile* profile, |
| 58 size_t expected_tabs); | 58 size_t expected_tabs); |
| 59 | 59 |
| 60 // Returns true if the browser is coming up. | 60 // Returns true if the browser is coming up. |
| 61 static bool InProcessStartup(); | 61 static bool InProcessStartup(); |
| 62 | 62 |
| 63 // Launches a browser window associated with |profile|. |command_line| should | 63 // Launches a browser window associated with |profile|. |command_line| should |
| 64 // be the command line passed to this process. |cur_dir| can be empty, which | 64 // be the command line passed to this process. |cur_dir| can be empty, which |
| 65 // implies that the directory of the executable should be used. | 65 // implies that the directory of the executable should be used. |
| 66 // |process_startup| indicates whether this is the first browser. | 66 // |process_startup| indicates whether this is the first browser. |
| 67 // |is_first_run| indicates that this is a new profile. | |
| 67 bool LaunchBrowser(const CommandLine& command_line, Profile* profile, | 68 bool LaunchBrowser(const CommandLine& command_line, Profile* profile, |
| 68 const FilePath& cur_dir, bool process_startup, | 69 const FilePath& cur_dir, bool process_startup, |
| 69 int* return_code); | 70 bool is_first_run, int* return_code); |
|
sky
2011/10/04 15:33:53
Each param on its own line, here and all other met
sail
2011/10/04 19:25:22
Done.
| |
| 70 | 71 |
| 71 // LaunchWithProfile --------------------------------------------------------- | 72 // LaunchWithProfile --------------------------------------------------------- |
| 72 // | 73 // |
| 73 // Assists launching the application and appending the initial tabs for a | 74 // Assists launching the application and appending the initial tabs for a |
| 74 // browser window. | 75 // browser window. |
| 75 | 76 |
| 76 class LaunchWithProfile { | 77 class LaunchWithProfile { |
| 77 public: | 78 public: |
| 78 // Used by OpenTabsInBrowser. | 79 // Used by OpenTabsInBrowser. |
| 79 struct Tab { | 80 struct Tab { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 90 // True if the is tab pinned. | 91 // True if the is tab pinned. |
| 91 bool is_pinned; | 92 bool is_pinned; |
| 92 | 93 |
| 93 // Id of the app. | 94 // Id of the app. |
| 94 std::string app_id; | 95 std::string app_id; |
| 95 }; | 96 }; |
| 96 | 97 |
| 97 // There are two ctors. The first one implies a NULL browser_init object | 98 // There are two ctors. The first one implies a NULL browser_init object |
| 98 // and thus no access to distribution-specific first-run behaviors. The | 99 // and thus no access to distribution-specific first-run behaviors. The |
| 99 // second one is always called when the browser starts even if it is not | 100 // second one is always called when the browser starts even if it is not |
| 100 // the first run. | 101 // the first run. |is_first_run| indicates that this is a new profile. |
| 101 LaunchWithProfile(const FilePath& cur_dir, const CommandLine& command_line); | |
| 102 LaunchWithProfile(const FilePath& cur_dir, const CommandLine& command_line, | 102 LaunchWithProfile(const FilePath& cur_dir, const CommandLine& command_line, |
| 103 BrowserInit* browser_init); | 103 bool is_first_run); |
| 104 LaunchWithProfile(const FilePath& cur_dir, const CommandLine& command_line, | |
| 105 BrowserInit* browser_init, bool is_first_run); | |
| 104 ~LaunchWithProfile(); | 106 ~LaunchWithProfile(); |
| 105 | 107 |
| 106 // Creates the necessary windows for startup. Returns true on success, | 108 // Creates the necessary windows for startup. Returns true on success, |
| 107 // false on failure. process_startup is true if Chrome is just | 109 // false on failure. process_startup is true if Chrome is just |
| 108 // starting up. If process_startup is false, it indicates Chrome was | 110 // starting up. If process_startup is false, it indicates Chrome was |
| 109 // already running and the user wants to launch another instance. | 111 // already running and the user wants to launch another instance. |
| 110 bool Launch(Profile* profile, | 112 bool Launch(Profile* profile, |
| 111 const std::vector<GURL>& urls_to_open, | 113 const std::vector<GURL>& urls_to_open, |
| 112 bool process_startup); | 114 bool process_startup); |
| 113 | 115 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 void AddStartupURLs(std::vector<GURL>* startup_urls) const; | 208 void AddStartupURLs(std::vector<GURL>* startup_urls) const; |
| 207 | 209 |
| 208 // Checks whether Chrome is still the default browser (unless the user | 210 // Checks whether Chrome is still the default browser (unless the user |
| 209 // previously instructed not to do so) and warns the user if it is not. | 211 // previously instructed not to do so) and warns the user if it is not. |
| 210 void CheckDefaultBrowser(Profile* profile); | 212 void CheckDefaultBrowser(Profile* profile); |
| 211 | 213 |
| 212 const FilePath cur_dir_; | 214 const FilePath cur_dir_; |
| 213 const CommandLine& command_line_; | 215 const CommandLine& command_line_; |
| 214 Profile* profile_; | 216 Profile* profile_; |
| 215 BrowserInit* browser_init_; | 217 BrowserInit* browser_init_; |
| 218 bool is_first_run_; | |
| 216 DISALLOW_COPY_AND_ASSIGN(LaunchWithProfile); | 219 DISALLOW_COPY_AND_ASSIGN(LaunchWithProfile); |
| 217 }; | 220 }; |
| 218 | 221 |
| 219 private: | 222 private: |
| 220 // Returns the list of URLs to open from the command line. The returned | 223 // Returns the list of URLs to open from the command line. The returned |
| 221 // vector is empty if the user didn't specify any URLs on the command line. | 224 // vector is empty if the user didn't specify any URLs on the command line. |
| 222 static std::vector<GURL> GetURLsFromCommandLine( | 225 static std::vector<GURL> GetURLsFromCommandLine( |
| 223 const CommandLine& command_line, | 226 const CommandLine& command_line, |
| 224 const FilePath& cur_dir, | 227 const FilePath& cur_dir, |
| 225 Profile* profile); | 228 Profile* profile); |
| 226 | 229 |
| 227 static bool ProcessCmdLineImpl(const CommandLine& command_line, | 230 static bool ProcessCmdLineImpl(const CommandLine& command_line, |
| 228 const FilePath& cur_dir, bool process_startup, | 231 const FilePath& cur_dir, bool process_startup, |
| 229 Profile* profile, int* return_code, | 232 Profile* profile, int* return_code, |
| 230 BrowserInit* browser_init); | 233 BrowserInit* browser_init); |
| 231 | 234 |
| 232 // Additional tabs to open during first run. | 235 // Additional tabs to open during first run. |
| 233 std::vector<GURL> first_run_tabs_; | 236 std::vector<GURL> first_run_tabs_; |
| 234 | 237 |
| 235 DISALLOW_COPY_AND_ASSIGN(BrowserInit); | 238 DISALLOW_COPY_AND_ASSIGN(BrowserInit); |
| 236 }; | 239 }; |
| 237 | 240 |
| 238 #endif // CHROME_BROWSER_UI_BROWSER_INIT_H_ | 241 #endif // CHROME_BROWSER_UI_BROWSER_INIT_H_ |
| OLD | NEW |