| 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; | 19 class FilePath; |
| 20 class Profile; | 20 class Profile; |
| 21 class StartupBrowserCreator; | 21 class StartupBrowserCreator; |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class WebContents; | 24 class WebContents; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace gfx { |
| 28 class Rect; |
| 29 } |
| 30 |
| 27 // Assists launching the application and appending the initial tabs for a | 31 // Assists launching the application and appending the initial tabs for a |
| 28 // browser window. | 32 // browser window. |
| 29 class StartupBrowserCreatorImpl { | 33 class StartupBrowserCreatorImpl { |
| 30 public: | 34 public: |
| 31 // There are two ctors. The first one implies a NULL browser_creator object | 35 // There are two ctors. The first one implies a NULL browser_creator object |
| 32 // and thus no access to distribution-specific first-run behaviors. The | 36 // and thus no access to distribution-specific first-run behaviors. The |
| 33 // second one is always called when the browser starts even if it is not | 37 // second one is always called when the browser starts even if it is not |
| 34 // the first run. |is_first_run| indicates that this is a new profile. | 38 // the first run. |is_first_run| indicates that this is a new profile. |
| 35 StartupBrowserCreatorImpl(const FilePath& cur_dir, | 39 StartupBrowserCreatorImpl(const FilePath& cur_dir, |
| 36 const CommandLine& command_line, | 40 const CommandLine& command_line, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 61 // are added to is returned, which is either |browser| or the newly created | 65 // are added to is returned, which is either |browser| or the newly created |
| 62 // browser. | 66 // browser. |
| 63 Browser* OpenTabsInBrowser(Browser* browser, | 67 Browser* OpenTabsInBrowser(Browser* browser, |
| 64 bool process_startup, | 68 bool process_startup, |
| 65 const StartupTabs& tabs); | 69 const StartupTabs& tabs); |
| 66 | 70 |
| 67 private: | 71 private: |
| 68 FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs); | 72 FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs); |
| 69 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); | 73 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); |
| 70 | 74 |
| 75 // Extracts optional application window size passed in command line. |
| 76 void ExtractOptionalAppWindowSize(gfx::Rect* bounds); |
| 77 |
| 71 // If the process was launched with the web application command line flags, | 78 // If the process was launched with the web application command line flags, |
| 72 // e.g. --app=http://www.google.com/ or --app_id=... return true. | 79 // e.g. --app=http://www.google.com/ or --app_id=... return true. |
| 73 // In this case |app_url| or |app_id| are populated if they're non-null. | 80 // In this case |app_url| or |app_id| are populated if they're non-null. |
| 74 bool IsAppLaunch(std::string* app_url, std::string* app_id); | 81 bool IsAppLaunch(std::string* app_url, std::string* app_id); |
| 75 | 82 |
| 76 // If IsAppLaunch is true, tries to open an application window. | 83 // If IsAppLaunch is true, tries to open an application window. |
| 77 // If the app is specified to start in a tab, or IsAppLaunch is false, | 84 // If the app is specified to start in a tab, or IsAppLaunch is false, |
| 78 // returns false to specify default processing. |out_app_contents| is an | 85 // returns false to specify default processing. |out_app_contents| is an |
| 79 // optional argument to receive the created WebContents for the app. | 86 // optional argument to receive the created WebContents for the app. |
| 80 bool OpenApplicationWindow(Profile* profile, | 87 bool OpenApplicationWindow(Profile* profile, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 StartupBrowserCreator* browser_creator_; | 144 StartupBrowserCreator* browser_creator_; |
| 138 bool is_first_run_; | 145 bool is_first_run_; |
| 139 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); | 146 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); |
| 140 }; | 147 }; |
| 141 | 148 |
| 142 // Returns true if |profile| has exited uncleanly and has not been launched | 149 // Returns true if |profile| has exited uncleanly and has not been launched |
| 143 // after the unclean exit. | 150 // after the unclean exit. |
| 144 bool HasPendingUncleanExit(Profile* profile); | 151 bool HasPendingUncleanExit(Profile* profile); |
| 145 | 152 |
| 146 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ | 153 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ |
| OLD | NEW |