summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 20:06:03 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 20:06:03 +0000
commitfe7c487d945c411c41d07b68b5018d4f961d9196 (patch)
treefaa58489cad15fe2470e5269b69621d30ce9199a
parent828a6dfa99115fec7ea4d90be55bfe025f01703c (diff)
downloadchromium_src-fe7c487d945c411c41d07b68b5018d4f961d9196.zip
chromium_src-fe7c487d945c411c41d07b68b5018d4f961d9196.tar.gz
chromium_src-fe7c487d945c411c41d07b68b5018d4f961d9196.tar.bz2
Rename BrowserInit to StartupBrowserCreator, and move into startup subdir.
BUG=none TEST=none TBR=sky Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=136337 Review URL: https://chromiumcodereview.appspot.com/10356100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136366 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/app_controller_mac.mm30
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc1
-rw-r--r--chrome/browser/chrome_browser_main.cc22
-rw-r--r--chrome/browser/chrome_browser_main.h6
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc21
-rw-r--r--chrome/browser/chromeos/login/login_utils.h6
-rw-r--r--chrome/browser/chromeos/login/user_manager.h4
-rw-r--r--chrome/browser/chromeos/network_message_observer.cc3
-rw-r--r--chrome/browser/prefs/browser_prefs.cc1
-rw-r--r--chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc12
-rw-r--r--chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc10
-rw-r--r--chrome/browser/profiles/avatar_menu_model.cc6
-rw-r--r--chrome/browser/profiles/profile_impl.cc6
-rw-r--r--chrome/browser/profiles/profile_impl.h3
-rw-r--r--chrome/browser/profiles/profile_manager.cc14
-rw-r--r--chrome/browser/profiles/profile_manager.h6
-rw-r--r--chrome/browser/protector/session_startup_change_unittest.cc2
-rw-r--r--chrome/browser/sessions/session_restore_browsertest.cc1
-rw-r--r--chrome/browser/sessions/session_service.cc6
-rw-r--r--chrome/browser/tabs/pinned_tab_codec.cc2
-rw-r--r--chrome/browser/tabs/pinned_tab_codec.h4
-rw-r--r--chrome/browser/tabs/pinned_tab_test_utils.cc4
-rw-r--r--chrome/browser/tabs/pinned_tab_test_utils.h4
-rw-r--r--chrome/browser/ui/browser.cc10
-rw-r--r--chrome/browser/ui/browser.h11
-rw-r--r--chrome/browser/ui/browser_browsertest.cc17
-rw-r--r--chrome/browser/ui/panels/panel_app_browsertest.cc1
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator.cc (renamed from chrome/browser/ui/browser_init.cc)155
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator.h (renamed from chrome/browser/ui/browser_init.h)29
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_browsertest.cc (renamed from chrome/browser/ui/browser_init_browsertest.cc)138
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_win.cc (renamed from chrome/browser/ui/browser_init_win.cc)2
-rw-r--r--chrome/browser/ui/startup/startup_browser_creator_win.h (renamed from chrome/browser/ui/browser_init_win.h)10
-rw-r--r--chrome/chrome_browser.gypi8
-rw-r--r--chrome/chrome_tests.gypi2
34 files changed, 296 insertions, 261 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 5612008..1a9329c 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -37,9 +37,9 @@
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/sync/sync_ui_util_mac.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_menu_bridge.h"
#import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
@@ -95,9 +95,9 @@ NSString* NSPopoverDidCloseNotification = @"NSPopoverDidCloseNotification";
#endif
// True while AppController is calling Browser::NewEmptyWindow(). We need a
-// global flag here, analogue to BrowserInit::InProcessStartup() because
-// otherwise the SessionService will try to restore sessions when we make a new
-// window while there are no other active windows.
+// global flag here, analogue to StartupBrowserCreator::InProcessStartup()
+// because otherwise the SessionService will try to restore sessions when we
+// make a new window while there are no other active windows.
bool g_is_opening_new_window = false;
// Activates a browser window having the given profile (the last one active) if
@@ -996,10 +996,11 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu';
{
AutoReset<bool> auto_reset_in_run(&g_is_opening_new_window, true);
int return_code;
- BrowserInit browser_init;
- browser_init.LaunchBrowser(command_line, [self lastProfile], FilePath(),
- BrowserInit::IS_NOT_PROCESS_STARTUP,
- BrowserInit::IS_NOT_FIRST_RUN, &return_code);
+ StartupBrowserCreator browser_creator;
+ browser_creator.LaunchBrowser(
+ command_line, [self lastProfile], FilePath(),
+ StartupBrowserCreator::IS_NOT_PROCESS_STARTUP,
+ StartupBrowserCreator::IS_NOT_FIRST_RUN, &return_code);
}
// We've handled the reopen event, so return NO to tell AppKit not
@@ -1085,9 +1086,9 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu';
}
// Various methods to open URLs that we get in a native fashion. We use
-// BrowserInit here because on the other platforms, URLs to open come through
-// the ProcessSingleton, and it calls BrowserInit. It's best to bottleneck the
-// openings through that for uniform handling.
+// StartupBrowserCreator here because on the other platforms, URLs to open come
+// through the ProcessSingleton, and it calls StartupBrowserCreator. It's best
+// to bottleneck the openings through that for uniform handling.
- (void)openUrls:(const std::vector<GURL>&)urls {
// If the browser hasn't started yet, just queue up the URLs.
@@ -1104,9 +1105,10 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu';
}
CommandLine dummy(CommandLine::NO_PROGRAM);
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
launch.OpenURLsInBrowser(browser, false, urls);
}
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 320d431..0b0db8f 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -98,7 +98,6 @@
#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
#include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
#include "chrome/browser/ui/bookmarks/bookmark_bar.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/find_bar/find_bar.h"
#include "chrome/browser/ui/fullscreen_controller.h"
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index ab4dd94..ff8337a 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -79,7 +79,7 @@
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/translate/translate_manager.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_init.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/webui/chrome_url_data_manager_backend.h"
#include "chrome/common/child_process_logging.h"
#include "chrome/common/chrome_constants.h"
@@ -208,12 +208,12 @@ void HandleTestParameters(const CommandLine& command_line) {
#endif
}
-void AddFirstRunNewTabs(BrowserInit* browser_init,
+void AddFirstRunNewTabs(StartupBrowserCreator* browser_creator,
const std::vector<GURL>& new_tabs) {
for (std::vector<GURL>::const_iterator it = new_tabs.begin();
it != new_tabs.end(); ++it) {
if (it->is_valid())
- browser_init->AddFirstRunTab(*it);
+ browser_creator->AddFirstRunTab(*it);
}
}
@@ -498,7 +498,7 @@ bool ProcessSingletonNotificationCallback(const CommandLine& command_line,
return true;
}
- BrowserInit::ProcessCommandLineAlreadyRunning(
+ StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
command_line, current_directory);
return true;
}
@@ -1209,7 +1209,7 @@ int ChromeBrowserMainParts::PreCreateThreads() {
result_code_ = PreCreateThreadsImpl();
// These members must be initialized before returning from this function.
DCHECK(master_prefs_.get());
- DCHECK(browser_init_.get());
+ DCHECK(browser_creator_.get());
return result_code_;
}
@@ -1267,7 +1267,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
// These members must be initialized before returning from this function.
master_prefs_.reset(new first_run::MasterPrefs);
- browser_init_.reset(new BrowserInit);
+ browser_creator_.reset(new StartupBrowserCreator);
#if !defined(OS_ANDROID)
// Convert active labs into switches. This needs to be done before
@@ -1352,7 +1352,7 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
if (is_first_run_) {
first_run_ui_bypass_ = !first_run::ProcessMasterPreferences(
user_data_dir_, master_prefs_.get());
- AddFirstRunNewTabs(browser_init_.get(), master_prefs_->new_tabs);
+ AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs);
// If we are running in App mode, we do not want to show the importer
// (first run) UI.
@@ -1432,7 +1432,7 @@ void ChromeBrowserMainParts::PreMainMessageLoopRun() {
// PostProfileInit()
// ... additional setup
// PreBrowserStart()
-// ... browser_init_->Start (OR parameters().ui_task->Run())
+// ... browser_creator_->Start (OR parameters().ui_task->Run())
// PostBrowserStart()
void ChromeBrowserMainParts::PreProfileInit() {
@@ -1826,8 +1826,8 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
std::vector<Profile*> last_opened_profiles =
g_browser_process->profile_manager()->GetLastOpenedProfiles();
#endif
- if (browser_init_->Start(parsed_command_line(), FilePath(),
- profile_, last_opened_profiles, &result_code)) {
+ if (browser_creator_->Start(parsed_command_line(), FilePath(),
+ profile_, last_opened_profiles, &result_code)) {
#if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
// Initialize autoupdate timer. Timer callback costs basically nothing
// when browser is not in persistent mode, so it's OK to let it ride on
@@ -1872,7 +1872,7 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() {
} else {
run_message_loop_ = false;
}
- browser_init_.reset();
+ browser_creator_.reset();
PostBrowserStart();
diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h
index fb67705..71afa03 100644
--- a/chrome/browser/chrome_browser_main.h
+++ b/chrome/browser/chrome_browser_main.h
@@ -15,11 +15,10 @@
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/process_singleton.h"
#include "chrome/browser/task_profiler/auto_tracking.h"
-#include "chrome/browser/ui/browser_init.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "content/public/browser/browser_main_parts.h"
#include "content/public/browser/browser_thread.h"
-class BrowserInit;
class BrowserProcessImpl;
class ChromeBrowserMainExtraParts;
class FieldTrialSynchronizer;
@@ -27,6 +26,7 @@ class HistogramSynchronizer;
class MetricsService;
class PrefService;
class Profile;
+class StartupBrowserCreator;
class StartupTimeBomb;
class ShutdownWatcherHelper;
class TranslateManager;
@@ -185,7 +185,7 @@ class ChromeBrowserMainParts : public content::BrowserMainParts {
// Members initialized after / released before main_message_loop_ ------------
- scoped_ptr<BrowserInit> browser_init_;
+ scoped_ptr<StartupBrowserCreator> browser_creator_;
scoped_ptr<BrowserProcessImpl> browser_process_;
scoped_refptr<HistogramSynchronizer> histogram_synchronizer_;
scoped_refptr<chrome_browser_metrics::TrackingSynchronizer>
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 94920be..db4e3e6 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -58,7 +58,7 @@
#include "chrome/browser/signin/token_service_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
-#include "chrome/browser/ui/browser_init.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -715,16 +715,17 @@ void LoginUtilsImpl::DoBrowserLaunch(Profile* profile,
BootTimesLoader::Get()->AddLoginTimeMarker("BrowserLaunched", false);
VLOG(1) << "Launching browser...";
- BrowserInit browser_init;
+ StartupBrowserCreator browser_creator;
int return_code;
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN: BrowserInit::IS_NOT_FIRST_RUN;
- browser_init.LaunchBrowser(*CommandLine::ForCurrentProcess(),
- profile,
- FilePath(),
- BrowserInit::IS_PROCESS_STARTUP,
- first_run,
- &return_code);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ browser_creator.LaunchBrowser(*CommandLine::ForCurrentProcess(),
+ profile,
+ FilePath(),
+ StartupBrowserCreator::IS_PROCESS_STARTUP,
+ first_run,
+ &return_code);
// Mark login host for deletion after browser starts. This
// guarantees that the message loop will be referenced by the
diff --git a/chrome/browser/chromeos/login/login_utils.h b/chrome/browser/chromeos/login/login_utils.h
index 50dcf39..f3dd88e 100644
--- a/chrome/browser/chromeos/login/login_utils.h
+++ b/chrome/browser/chromeos/login/login_utils.h
@@ -47,9 +47,9 @@ class LoginUtils {
virtual ~LoginUtils() {}
- // Thin wrapper around BrowserInit::LaunchBrowser(). Meant to be used in a
- // Task posted to the UI thread. Once the browser is launched the login
- // host is deleted.
+ // Thin wrapper around StartupBrowserCreator::LaunchBrowser(). Meant to be
+ // used in a Task posted to the UI thread. Once the browser is launched the
+ // login host is deleted.
virtual void DoBrowserLaunch(Profile* profile,
LoginDisplayHost* login_host) = 0;
diff --git a/chrome/browser/chromeos/login/user_manager.h b/chrome/browser/chromeos/login/user_manager.h
index 7e9f6d1..a31bb06 100644
--- a/chrome/browser/chromeos/login/user_manager.h
+++ b/chrome/browser/chromeos/login/user_manager.h
@@ -104,7 +104,7 @@ class UserManager {
virtual void UserSelected(const std::string& email) = 0;
// Called when browser session is started i.e. after
- // browser_init.LaunchBrowser(...) was called after user sign in.
+ // browser_creator.LaunchBrowser(...) was called after user sign in.
// When user is at the image screen IsUserLoggedIn() will return true
// but SessionStarted() will return false.
// Fires NOTIFICATION_SESSION_STARTED.
@@ -219,7 +219,7 @@ class UserManager {
virtual bool IsLoggedInAsStub() const = 0;
// Returns true if we're logged in and browser has been started i.e.
- // browser_init.LaunchBrowser(...) was called after sign in
+ // browser_creator.LaunchBrowser(...) was called after sign in
// or restart after crash.
virtual bool IsSessionStarted() const = 0;
diff --git a/chrome/browser/chromeos/network_message_observer.cc b/chrome/browser/chromeos/network_message_observer.cc
index 704e434..b9e372b 100644
--- a/chrome/browser/chromeos/network_message_observer.cc
+++ b/chrome/browser/chromeos/network_message_observer.cc
@@ -52,7 +52,8 @@ NetworkMessageObserver::NetworkMessageObserver(Profile* profile)
NetworkLibrary* netlib = CrosLibrary::Get()->GetNetworkLibrary();
OnNetworkManagerChanged(netlib);
// Note that this gets added as a NetworkManagerObserver,
- // CellularDataPlanObserver, and UserActionObserver in browser_init.cc
+ // CellularDataPlanObserver, and UserActionObserver in
+ // startup_browser_creator.cc
}
NetworkMessageObserver::~NetworkMessageObserver() {
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index d62ff41..c7cfc77 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -56,7 +56,6 @@
#include "chrome/browser/translate/translate_prefs.h"
#include "chrome/browser/ui/alternate_error_tab_observer.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_view_prefs.h"
#include "chrome/browser/ui/network_profile_bubble_prefs.h"
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
diff --git a/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc b/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc
index 7ba4efe..96bdf06 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc
@@ -10,7 +10,7 @@
#include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
#include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.h"
#include "chrome/browser/service/service_process_control.h"
-#include "chrome/browser/ui/browser_init.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/cloud_print/cloud_print_proxy_info.h"
#include "chrome/common/pref_names.h"
@@ -188,10 +188,10 @@ class CloudPrintProxyPolicyTest : public ::testing::Test {
bool LaunchBrowser(const CommandLine& command_line, Profile* profile) {
int return_code = 0;
- BrowserInit browser_init;
- return BrowserInit::ProcessCmdLineImpl(command_line, FilePath(), false,
- profile, BrowserInit::Profiles(),
- &return_code, &browser_init);
+ StartupBrowserCreator browser_creator;
+ return StartupBrowserCreator::ProcessCmdLineImpl(
+ command_line, FilePath(), false, profile,
+ StartupBrowserCreator::Profiles(), &return_code, &browser_creator);
}
protected:
@@ -433,7 +433,7 @@ ProfileKeyedService* TestCloudPrintProxyServiceFactory(Profile* profile) {
return service;
}
-TEST_F(CloudPrintProxyPolicyTest, StartBrowserInitWithCommandLine) {
+TEST_F(CloudPrintProxyPolicyTest, StartupBrowserCreatorWithCommandLine) {
TestingPrefService* prefs = profile_.GetTestingPrefService();
prefs->SetUserPref(prefs::kCloudPrintEmail,
Value::CreateStringValue(std::string()));
diff --git a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
index dd641fb..5fe6940 100644
--- a/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
+++ b/chrome/browser/printing/cloud_print/test/cloud_print_proxy_process_browsertest.cc
@@ -18,7 +18,7 @@
#include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.h"
#include "chrome/browser/profiles/profile_keyed_service.h"
#include "chrome/browser/service/service_process_control.h"
-#include "chrome/browser/ui/browser_init.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/service_messages.h"
@@ -303,10 +303,10 @@ class CloudPrintProxyPolicyStartupTest : public base::MultiProcessTest,
bool LaunchBrowser(const CommandLine& command_line, Profile* profile) {
int return_code = 0;
- BrowserInit browser_init;
- return BrowserInit::ProcessCmdLineImpl(command_line, FilePath(), false,
- profile, BrowserInit::Profiles(),
- &return_code, &browser_init);
+ StartupBrowserCreator browser_creator;
+ return StartupBrowserCreator::ProcessCmdLineImpl(
+ command_line, FilePath(), false, profile,
+ StartupBrowserCreator::Profiles(), &return_code, &browser_creator);
}
protected:
diff --git a/chrome/browser/profiles/avatar_menu_model.cc b/chrome/browser/profiles/avatar_menu_model.cc
index 11c0076..8a8df27 100644
--- a/chrome/browser/profiles/avatar_menu_model.cc
+++ b/chrome/browser/profiles/avatar_menu_model.cc
@@ -15,9 +15,9 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/notification_service.h"
@@ -36,8 +36,8 @@ void OnProfileCreated(bool always_create,
if (status == Profile::CREATE_STATUS_INITIALIZED) {
ProfileManager::FindOrCreateNewWindowForProfile(
profile,
- BrowserInit::IS_NOT_PROCESS_STARTUP,
- BrowserInit::IS_NOT_FIRST_RUN,
+ StartupBrowserCreator::IS_NOT_PROCESS_STARTUP,
+ StartupBrowserCreator::IS_NOT_FIRST_RUN,
always_create);
}
}
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 2642240..143c96d 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -63,7 +63,7 @@
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/speech/chrome_speech_recognition_preferences.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
-#include "chrome/browser/ui/browser_init.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
#include "chrome/browser/user_style_sheet_watcher.h"
#include "chrome/browser/visitedlink/visitedlink_event_listener.h"
@@ -363,8 +363,8 @@ void ProfileImpl::DoFinalInit(bool is_new_profile) {
SessionStartupPref::GetDefaultStartupType();
#else
SessionStartupPref::Type startup_pref_type =
- BrowserInit::GetSessionStartupPref(*CommandLine::ForCurrentProcess(),
- this).type;
+ StartupBrowserCreator::GetSessionStartupPref(
+ *CommandLine::ForCurrentProcess(), this).type;
#endif
bool restore_old_session_cookies =
session_restore_enabled_ &&
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h
index 93fd178..a9f51b2 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -130,7 +130,8 @@ class ProfileImpl : public Profile,
private:
friend class Profile;
- FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, ProfilesLaunchedAfterCrash);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
+ ProfilesLaunchedAfterCrash);
FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest, ProfileReadmeCreated);
FRIEND_TEST_ALL_PREFIXES(ProfileBrowserTest,
ProfileDeletedBeforeReadmeCreated);
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 64385fd..4abb87e 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -150,8 +150,8 @@ void OnOpenWindowForNewProfile(Profile* profile,
if (status == Profile::CREATE_STATUS_INITIALIZED) {
ProfileManager::FindOrCreateNewWindowForProfile(
profile,
- BrowserInit::IS_PROCESS_STARTUP,
- BrowserInit::IS_FIRST_RUN,
+ StartupBrowserCreator::IS_PROCESS_STARTUP,
+ StartupBrowserCreator::IS_FIRST_RUN,
false);
}
}
@@ -469,8 +469,8 @@ Profile* ProfileManager::GetProfileByPath(const FilePath& path) const {
// static
void ProfileManager::FindOrCreateNewWindowForProfile(
Profile* profile,
- BrowserInit::IsProcessStartup process_startup,
- BrowserInit::IsFirstRun is_first_run,
+ StartupBrowserCreator::IsProcessStartup process_startup,
+ StartupBrowserCreator::IsFirstRun is_first_run,
bool always_create) {
DCHECK(profile);
@@ -485,9 +485,9 @@ void ProfileManager::FindOrCreateNewWindowForProfile(
content::RecordAction(UserMetricsAction("NewWindow"));
CommandLine command_line(CommandLine::NO_PROGRAM);
int return_code;
- BrowserInit browser_init;
- browser_init.LaunchBrowser(command_line, profile, FilePath(),
- process_startup, is_first_run, &return_code);
+ StartupBrowserCreator browser_creator;
+ browser_creator.LaunchBrowser(command_line, profile, FilePath(),
+ process_startup, is_first_run, &return_code);
}
void ProfileManager::Observe(
diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h
index 38da261..8f02319 100644
--- a/chrome/browser/profiles/profile_manager.h
+++ b/chrome/browser/profiles/profile_manager.h
@@ -20,8 +20,8 @@
#include "base/message_loop.h"
#include "base/threading/non_thread_safe.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -147,8 +147,8 @@ class ProfileManager : public base::NonThreadSafe,
// creation of a window from the multi-profile dropdown menu.
static void FindOrCreateNewWindowForProfile(
Profile* profile,
- BrowserInit::IsProcessStartup process_startup,
- BrowserInit::IsFirstRun is_first_run,
+ StartupBrowserCreator::IsProcessStartup process_startup,
+ StartupBrowserCreator::IsFirstRun is_first_run,
bool always_create);
// Profile::Delegate implementation:
diff --git a/chrome/browser/protector/session_startup_change_unittest.cc b/chrome/browser/protector/session_startup_change_unittest.cc
index 5dd491d..abfbf24 100644
--- a/chrome/browser/protector/session_startup_change_unittest.cc
+++ b/chrome/browser/protector/session_startup_change_unittest.cc
@@ -104,7 +104,7 @@ TEST_F(SessionStartupChangeTest, ApplyButtonCaptions) {
// Pinned tabs count as startup URLs as well.
PinnedTabCodec::Tabs new_pinned_tabs;
- BrowserInit::LaunchWithProfile::Tab pinned_tab;
+ StartupBrowserCreator::LaunchWithProfile::Tab pinned_tab;
pinned_tab.url = GURL(kStartupUrl3);
new_pinned_tabs.push_back(pinned_tab);
change.reset(
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc
index 49684a7..b794959 100644
--- a/chrome/browser/sessions/session_restore_browsertest.cc
+++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -17,7 +17,6 @@
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index f39ec70..193ecf6 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -27,9 +27,9 @@
#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/sessions/session_types.h"
#include "chrome/browser/tabs/tab_strip_model.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
@@ -532,7 +532,7 @@ bool SessionService::ShouldNewWindowStartSession() {
return false;
#endif
if (!has_open_trackable_browsers_ &&
- !BrowserInit::InSynchronousProfileLaunch() &&
+ !StartupBrowserCreator::InSynchronousProfileLaunch() &&
!SessionRestore::IsRestoring(profile())
#if defined(OS_MACOSX)
// On OSX, a new window should not start a new session if it was opened
@@ -555,7 +555,7 @@ bool SessionService::RestoreIfNecessary(const std::vector<GURL>& urls_to_open,
MoveCurrentSessionToLastSession();
move_on_new_browser_ = false;
}
- SessionStartupPref pref = BrowserInit::GetSessionStartupPref(
+ SessionStartupPref pref = StartupBrowserCreator::GetSessionStartupPref(
*CommandLine::ForCurrentProcess(), profile());
if (pref.type == SessionStartupPref::LAST) {
SessionRestore::RestoreSession(
diff --git a/chrome/browser/tabs/pinned_tab_codec.cc b/chrome/browser/tabs/pinned_tab_codec.cc
index eb09cd1..d50d1f0 100644
--- a/chrome/browser/tabs/pinned_tab_codec.cc
+++ b/chrome/browser/tabs/pinned_tab_codec.cc
@@ -20,7 +20,7 @@
using content::NavigationEntry;
-typedef BrowserInit::LaunchWithProfile::Tab Tab;
+typedef StartupBrowserCreator::LaunchWithProfile::Tab Tab;
// Key used in dictionaries for the app id.
static const char kAppID[] = "app_id";
diff --git a/chrome/browser/tabs/pinned_tab_codec.h b/chrome/browser/tabs/pinned_tab_codec.h
index 28542dc..2872f90 100644
--- a/chrome/browser/tabs/pinned_tab_codec.h
+++ b/chrome/browser/tabs/pinned_tab_codec.h
@@ -8,7 +8,7 @@
#include <vector>
-#include "chrome/browser/ui/browser_init.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "googleurl/src/gurl.h"
namespace base {
@@ -27,7 +27,7 @@ class Profile;
// dictionary describing the entry.
class PinnedTabCodec {
public:
- typedef std::vector<BrowserInit::LaunchWithProfile::Tab> Tabs;
+ typedef std::vector<StartupBrowserCreator::LaunchWithProfile::Tab> Tabs;
// Registers the preference used by this class.
static void RegisterUserPrefs(PrefService* prefs);
diff --git a/chrome/browser/tabs/pinned_tab_test_utils.cc b/chrome/browser/tabs/pinned_tab_test_utils.cc
index 087df64..0360a02 100644
--- a/chrome/browser/tabs/pinned_tab_test_utils.cc
+++ b/chrome/browser/tabs/pinned_tab_test_utils.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/tabs/pinned_tab_test_utils.h"
-typedef BrowserInit::LaunchWithProfile::Tab Tab;
+typedef StartupBrowserCreator::LaunchWithProfile::Tab Tab;
namespace {
@@ -17,7 +17,7 @@ std::string TabToString(const Tab& tab) {
// static
std::string PinnedTabTestUtils::TabsToString(
- const std::vector<BrowserInit::LaunchWithProfile::Tab>& values) {
+ const std::vector<StartupBrowserCreator::LaunchWithProfile::Tab>& values) {
std::string result;
for (size_t i = 0; i < values.size(); ++i) {
if (i != 0)
diff --git a/chrome/browser/tabs/pinned_tab_test_utils.h b/chrome/browser/tabs/pinned_tab_test_utils.h
index ab73e34..57850de 100644
--- a/chrome/browser/tabs/pinned_tab_test_utils.h
+++ b/chrome/browser/tabs/pinned_tab_test_utils.h
@@ -10,7 +10,7 @@
#include <vector>
#include "base/basictypes.h"
-#include "chrome/browser/ui/browser_init.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
class PinnedTabTestUtils {
public:
@@ -18,7 +18,7 @@ class PinnedTabTestUtils {
// of urls. If the tab is an app, ':app' is appended, and if the tab is
// pinned, ':pinned' is appended.
static std::string TabsToString(
- const std::vector<BrowserInit::LaunchWithProfile::Tab>& values);
+ const std::vector<StartupBrowserCreator::LaunchWithProfile::Tab>& values);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(PinnedTabTestUtils);
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 13c4daf..2ae6a5e 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -2364,11 +2364,11 @@ void Browser::RegisterUserPrefs(PrefService* prefs) {
// This really belongs in platform code, but there's no good place to
// initialize it between the time when the AppController is created
// (where there's no profile) and the time the controller gets another
- // crack at the start of the main event loop. By that time, BrowserInit
- // has already created the browser window, and it's too late: we need the
- // pref to be already initialized. Doing it here also saves us from having
- // to hard-code pref registration in the several unit tests that use
- // this preference.
+ // crack at the start of the main event loop. By that time,
+ // StartupBrowserCreator has already created the browser window, and it's too
+ // late: we need the pref to be already initialized. Doing it here also saves
+ // us from having to hard-code pref registration in the several unit tests
+ // that use this preference.
prefs->RegisterBooleanPref(prefs::kShowUpdatePromotionInfoBar,
true,
PrefService::UNSYNCABLE_PREF);
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index bd6cd89..c7c8dbb 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -901,11 +901,12 @@ class Browser : public TabStripModelDelegate,
FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch);
FRIEND_TEST_ALL_PREFIXES(BrowserTest, TabEntersPresentationModeFromWindowed);
FRIEND_TEST_ALL_PREFIXES(FullscreenExitBubbleControllerTest,
- DenyExitsFullscreen);
- FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutNoPref);
- FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutWindowPref);
- FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutTabPref);
- FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, OpenAppShortcutPanel);
+ DenyExitsFullscreen);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, OpenAppShortcutNoPref);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
+ OpenAppShortcutWindowPref);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, OpenAppShortcutTabPref);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, OpenAppShortcutPanel);
// Used to describe why a tab is being detached. This is used by
// TabDetachedAtImpl.
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index bd88449..0dd7420 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -30,12 +30,12 @@
#include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
#include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/fullscreen_controller.h"
#include "chrome/browser/ui/fullscreen_exit_bubble_type.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -898,9 +898,11 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) {
CommandLine command_line(CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
+ first_run);
ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile()));
// Check that the new browser has an app name.
@@ -1250,9 +1252,10 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) {
// Simulate launching again.
CommandLine dummy(CommandLine::NO_PROGRAM);
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
launch.profile_ = browser()->profile();
launch.ProcessStartupURLs(std::vector<GURL>());
diff --git a/chrome/browser/ui/panels/panel_app_browsertest.cc b/chrome/browser/ui/panels/panel_app_browsertest.cc
index d658d72..541aef5 100644
--- a/chrome/browser/ui/panels/panel_app_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_app_browsertest.cc
@@ -8,7 +8,6 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/panels/panel_manager.h"
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index 5a95062..e6bff02 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/browser_init.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include <algorithm> // For max().
#include <set>
@@ -118,7 +118,7 @@
#if defined(OS_WIN)
#include "base/win/windows_version.h"
-#include "chrome/browser/ui/browser_init_win.h"
+#include "chrome/browser/ui/startup/startup_browser_creator_win.h"
#endif
using content::BrowserThread;
@@ -195,10 +195,11 @@ GURL GetWelcomePageURL() {
return GURL(welcome_url);
}
-void UrlsToTabs(const std::vector<GURL>& urls,
- std::vector<BrowserInit::LaunchWithProfile::Tab>* tabs) {
+void UrlsToTabs(
+ const std::vector<GURL>& urls,
+ std::vector<StartupBrowserCreator::LaunchWithProfile::Tab>* tabs) {
for (size_t i = 0; i < urls.size(); ++i) {
- BrowserInit::LaunchWithProfile::Tab tab;
+ StartupBrowserCreator::LaunchWithProfile::Tab tab;
tab.is_pinned = false;
tab.url = urls[i];
tabs->push_back(tab);
@@ -241,7 +242,8 @@ void RecordCmdLineAppHistogram() {
void RecordAppLaunches(
Profile* profile,
const std::vector<GURL>& cmd_line_urls,
- const std::vector<BrowserInit::LaunchWithProfile::Tab>& autolaunch_tabs) {
+ const std::vector<StartupBrowserCreator::LaunchWithProfile::Tab>&
+ autolaunch_tabs) {
ExtensionService* extension_service = profile->GetExtensionService();
DCHECK(extension_service);
for (size_t i = 0; i < cmd_line_urls.size(); ++i) {
@@ -333,31 +335,28 @@ bool HasPendingUncleanExit(Profile* profile) {
} // namespace
+StartupBrowserCreator::StartupBrowserCreator() {}
-// BrowserInit ----------------------------------------------------------------
-
-BrowserInit::BrowserInit() {}
-
-BrowserInit::~BrowserInit() {}
+StartupBrowserCreator::~StartupBrowserCreator() {}
// static
-bool BrowserInit::was_restarted_read_ = false;
+bool StartupBrowserCreator::was_restarted_read_ = false;
-void BrowserInit::AddFirstRunTab(const GURL& url) {
+void StartupBrowserCreator::AddFirstRunTab(const GURL& url) {
first_run_tabs_.push_back(url);
}
// static
-bool BrowserInit::InSynchronousProfileLaunch() {
+bool StartupBrowserCreator::InSynchronousProfileLaunch() {
return in_synchronous_profile_launch;
}
-bool BrowserInit::LaunchBrowser(const CommandLine& command_line,
- Profile* profile,
- const FilePath& cur_dir,
- IsProcessStartup process_startup,
- IsFirstRun is_first_run,
- int* return_code) {
+bool StartupBrowserCreator::LaunchBrowser(const CommandLine& command_line,
+ Profile* profile,
+ const FilePath& cur_dir,
+ IsProcessStartup process_startup,
+ IsFirstRun is_first_run,
+ int* return_code) {
in_synchronous_profile_launch = process_startup == IS_PROCESS_STARTUP;
DCHECK(profile);
@@ -371,9 +370,11 @@ bool BrowserInit::LaunchBrowser(const CommandLine& command_line,
<< "browser session.";
}
- BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this, is_first_run);
- std::vector<GURL> urls_to_launch = BrowserInit::GetURLsFromCommandLine(
- command_line, cur_dir, profile);
+ StartupBrowserCreator::LaunchWithProfile lwp(cur_dir, command_line, this,
+ is_first_run);
+ std::vector<GURL> urls_to_launch =
+ StartupBrowserCreator::GetURLsFromCommandLine(command_line, cur_dir,
+ profile);
bool launched = lwp.Launch(profile, urls_to_launch,
in_synchronous_profile_launch);
in_synchronous_profile_launch = false;
@@ -393,7 +394,7 @@ bool BrowserInit::LaunchBrowser(const CommandLine& command_line,
}
// static
-bool BrowserInit::WasRestarted() {
+bool StartupBrowserCreator::WasRestarted() {
// Stores the value of the preference kWasRestarted had when it was read.
static bool was_restarted = false;
@@ -407,7 +408,7 @@ bool BrowserInit::WasRestarted() {
}
// static
-SessionStartupPref BrowserInit::GetSessionStartupPref(
+SessionStartupPref StartupBrowserCreator::GetSessionStartupPref(
const CommandLine& command_line,
Profile* profile) {
SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile);
@@ -417,7 +418,7 @@ SessionStartupPref BrowserInit::GetSessionStartupPref(
pref.type = SessionStartupPref::DEFAULT;
if (command_line.HasSwitch(switches::kRestoreLastSession) ||
- BrowserInit::WasRestarted()) {
+ StartupBrowserCreator::WasRestarted()) {
pref.type = SessionStartupPref::LAST;
}
if (pref.type == SessionStartupPref::LAST &&
@@ -432,42 +433,45 @@ SessionStartupPref BrowserInit::GetSessionStartupPref(
}
-// BrowserInit::LaunchWithProfile::Tab ----------------------------------------
+// StartupBrowserCreator::LaunchWithProfile::Tab -------------------------------
-BrowserInit::LaunchWithProfile::Tab::Tab() : is_app(false), is_pinned(true) {}
-
-BrowserInit::LaunchWithProfile::Tab::~Tab() {}
+StartupBrowserCreator::LaunchWithProfile::Tab::Tab()
+ : is_app(false),
+ is_pinned(true) {
+}
+StartupBrowserCreator::LaunchWithProfile::Tab::~Tab() {
+}
-// BrowserInit::LaunchWithProfile ---------------------------------------------
+// StartupBrowserCreator::LaunchWithProfile ------------------------------------
-BrowserInit::LaunchWithProfile::LaunchWithProfile(
+StartupBrowserCreator::LaunchWithProfile::LaunchWithProfile(
const FilePath& cur_dir,
const CommandLine& command_line,
IsFirstRun is_first_run)
: cur_dir_(cur_dir),
command_line_(command_line),
profile_(NULL),
- browser_init_(NULL),
+ browser_creator_(NULL),
is_first_run_(is_first_run == IS_FIRST_RUN) {
}
-BrowserInit::LaunchWithProfile::LaunchWithProfile(
+StartupBrowserCreator::LaunchWithProfile::LaunchWithProfile(
const FilePath& cur_dir,
const CommandLine& command_line,
- BrowserInit* browser_init,
+ StartupBrowserCreator* browser_creator,
IsFirstRun is_first_run)
: cur_dir_(cur_dir),
command_line_(command_line),
profile_(NULL),
- browser_init_(browser_init),
+ browser_creator_(browser_creator),
is_first_run_(is_first_run == IS_FIRST_RUN) {
}
-BrowserInit::LaunchWithProfile::~LaunchWithProfile() {
+StartupBrowserCreator::LaunchWithProfile::~LaunchWithProfile() {
}
-bool BrowserInit::LaunchWithProfile::Launch(
+bool StartupBrowserCreator::LaunchWithProfile::Launch(
Profile* profile,
const std::vector<GURL>& urls_to_open,
bool process_startup) {
@@ -581,8 +585,9 @@ bool BrowserInit::LaunchWithProfile::Launch(
return true;
}
-bool BrowserInit::LaunchWithProfile::IsAppLaunch(std::string* app_url,
- std::string* app_id) {
+bool StartupBrowserCreator::LaunchWithProfile::IsAppLaunch(
+ std::string* app_url,
+ std::string* app_id) {
if (command_line_.HasSwitch(switches::kApp)) {
if (app_url)
*app_url = command_line_.GetSwitchValueASCII(switches::kApp);
@@ -596,7 +601,8 @@ bool BrowserInit::LaunchWithProfile::IsAppLaunch(std::string* app_url,
return false;
}
-bool BrowserInit::LaunchWithProfile::OpenApplicationTab(Profile* profile) {
+bool StartupBrowserCreator::LaunchWithProfile::OpenApplicationTab(
+ Profile* profile) {
std::string app_id;
// App shortcuts to URLs always open in an app window. Because this
// function will open an app that should be in a tab, there is no need
@@ -621,7 +627,8 @@ bool BrowserInit::LaunchWithProfile::OpenApplicationTab(Profile* profile) {
return (app_tab != NULL);
}
-bool BrowserInit::LaunchWithProfile::OpenApplicationWindow(Profile* profile) {
+bool StartupBrowserCreator::LaunchWithProfile::OpenApplicationWindow(
+ Profile* profile) {
std::string url_string, app_id;
if (!IsAppLaunch(&url_string, &app_id))
return false;
@@ -681,7 +688,7 @@ bool BrowserInit::LaunchWithProfile::OpenApplicationWindow(Profile* profile) {
return false;
}
-void BrowserInit::LaunchWithProfile::ProcessLaunchURLs(
+void StartupBrowserCreator::LaunchWithProfile::ProcessLaunchURLs(
bool process_startup,
const std::vector<GURL>& urls_to_open) {
// If we're starting up in "background mode" (no open browser window) then
@@ -738,7 +745,7 @@ void BrowserInit::LaunchWithProfile::ProcessLaunchURLs(
AddInfoBarsIfNecessary(browser, is_process_startup);
}
-bool BrowserInit::LaunchWithProfile::ProcessStartupURLs(
+bool StartupBrowserCreator::LaunchWithProfile::ProcessStartupURLs(
const std::vector<GURL>& urls_to_open) {
SessionStartupPref pref = GetSessionStartupPref(command_line_, profile_);
@@ -780,7 +787,7 @@ bool BrowserInit::LaunchWithProfile::ProcessStartupURLs(
return true;
}
-Browser* BrowserInit::LaunchWithProfile::ProcessSpecifiedURLs(
+Browser* StartupBrowserCreator::LaunchWithProfile::ProcessSpecifiedURLs(
const std::vector<GURL>& urls_to_open) {
SessionStartupPref pref = GetSessionStartupPref(command_line_, profile_);
std::vector<Tab> tabs;
@@ -823,7 +830,7 @@ Browser* BrowserInit::LaunchWithProfile::ProcessSpecifiedURLs(
return browser;
}
-void BrowserInit::LaunchWithProfile::AddUniqueURLs(
+void StartupBrowserCreator::LaunchWithProfile::AddUniqueURLs(
const std::vector<GURL>& urls,
std::vector<Tab>* tabs) {
size_t num_existing_tabs = tabs->size();
@@ -836,7 +843,7 @@ void BrowserInit::LaunchWithProfile::AddUniqueURLs(
}
}
if (!in_tabs) {
- BrowserInit::LaunchWithProfile::Tab tab;
+ StartupBrowserCreator::LaunchWithProfile::Tab tab;
tab.is_pinned = false;
tab.url = urls[i];
tabs->push_back(tab);
@@ -844,7 +851,7 @@ void BrowserInit::LaunchWithProfile::AddUniqueURLs(
}
}
-Browser* BrowserInit::LaunchWithProfile::OpenURLsInBrowser(
+Browser* StartupBrowserCreator::LaunchWithProfile::OpenURLsInBrowser(
Browser* browser,
bool process_startup,
const std::vector<GURL>& urls) {
@@ -853,7 +860,7 @@ Browser* BrowserInit::LaunchWithProfile::OpenURLsInBrowser(
return OpenTabsInBrowser(browser, process_startup, tabs);
}
-Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser(
+Browser* StartupBrowserCreator::LaunchWithProfile::OpenTabsInBrowser(
Browser* browser,
bool process_startup,
const std::vector<Tab>& tabs) {
@@ -928,7 +935,7 @@ Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser(
return browser;
}
-void BrowserInit::LaunchWithProfile::AddInfoBarsIfNecessary(
+void StartupBrowserCreator::LaunchWithProfile::AddInfoBarsIfNecessary(
Browser* browser,
IsProcessStartup is_process_startup) {
if (!browser || !profile_ || browser->tab_count() == 0)
@@ -948,7 +955,7 @@ void BrowserInit::LaunchWithProfile::AddInfoBarsIfNecessary(
}
-void BrowserInit::LaunchWithProfile::AddStartupURLs(
+void StartupBrowserCreator::LaunchWithProfile::AddStartupURLs(
std::vector<GURL>* startup_urls) const {
// If we have urls specified beforehand (i.e. from command line) use them
// and nothing else.
@@ -957,10 +964,11 @@ void BrowserInit::LaunchWithProfile::AddStartupURLs(
// If we have urls specified by the first run master preferences use them
// and nothing else.
- if (browser_init_) {
- if (!browser_init_->first_run_tabs_.empty()) {
- std::vector<GURL>::iterator it = browser_init_->first_run_tabs_.begin();
- while (it != browser_init_->first_run_tabs_.end()) {
+ if (browser_creator_) {
+ if (!browser_creator_->first_run_tabs_.empty()) {
+ std::vector<GURL>::iterator it =
+ browser_creator_->first_run_tabs_.begin();
+ while (it != browser_creator_->first_run_tabs_.end()) {
// Replace magic names for the actual urls.
if (it->host() == "new_tab_page") {
startup_urls->push_back(GURL(chrome::kChromeUINewTabURL));
@@ -971,7 +979,7 @@ void BrowserInit::LaunchWithProfile::AddStartupURLs(
}
++it;
}
- browser_init_->first_run_tabs_.clear();
+ browser_creator_->first_run_tabs_.clear();
}
}
@@ -1018,7 +1026,8 @@ void BrowserInit::LaunchWithProfile::AddStartupURLs(
}
}
-void BrowserInit::LaunchWithProfile::CheckPreferencesBackup(Profile* profile) {
+void StartupBrowserCreator::LaunchWithProfile::CheckPreferencesBackup(
+ Profile* profile) {
ProtectorService* protector_service =
ProtectorServiceFactory::GetForProfile(profile);
ProtectedPrefsWatcher* prefs_watcher = protector_service->GetPrefsWatcher();
@@ -1074,7 +1083,7 @@ void BrowserInit::LaunchWithProfile::CheckPreferencesBackup(Profile* profile) {
}
}
-std::vector<GURL> BrowserInit::GetURLsFromCommandLine(
+std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine(
const CommandLine& command_line,
const FilePath& cur_dir,
Profile* profile) {
@@ -1139,14 +1148,14 @@ std::vector<GURL> BrowserInit::GetURLsFromCommandLine(
return urls;
}
-bool BrowserInit::ProcessCmdLineImpl(
+bool StartupBrowserCreator::ProcessCmdLineImpl(
const CommandLine& command_line,
const FilePath& cur_dir,
bool process_startup,
Profile* last_used_profile,
const Profiles& last_opened_profiles,
int* return_code,
- BrowserInit* browser_init) {
+ StartupBrowserCreator* browser_creator) {
DCHECK(last_used_profile);
if (process_startup) {
if (command_line.HasSwitch(switches::kDisablePromptOnRepost))
@@ -1298,9 +1307,11 @@ bool BrowserInit::ProcessCmdLineImpl(
// |last_used_profile| is the last used incognito profile. Restoring it will
// create a browser window for the corresponding original profile.
if (last_opened_profiles.empty()) {
- if (!browser_init->LaunchBrowser(command_line, last_used_profile, cur_dir,
- is_process_startup, is_first_run, return_code))
+ if (!browser_creator->LaunchBrowser(command_line, last_used_profile,
+ cur_dir, is_process_startup,
+ is_first_run, return_code)) {
return false;
+ }
} else {
// Launch the last used profile with the full command line, and the other
// opened profiles without the URLs to launch.
@@ -1323,12 +1334,12 @@ bool BrowserInit::ProcessCmdLineImpl(
startup_pref.type == SessionStartupPref::DEFAULT &&
!HasPendingUncleanExit(*it))
continue;
- if (!browser_init->LaunchBrowser((*it == last_used_profile) ?
+ if (!browser_creator->LaunchBrowser((*it == last_used_profile) ?
command_line : command_line_without_urls, *it, cur_dir,
is_process_startup, is_first_run, return_code))
return false;
// We've launched at least one browser.
- is_process_startup = BrowserInit::IS_NOT_PROCESS_STARTUP;
+ is_process_startup = StartupBrowserCreator::IS_NOT_PROCESS_STARTUP;
}
}
}
@@ -1336,9 +1347,10 @@ bool BrowserInit::ProcessCmdLineImpl(
}
template <class AutomationProviderClass>
-bool BrowserInit::CreateAutomationProvider(const std::string& channel_id,
- Profile* profile,
- size_t expected_tabs) {
+bool StartupBrowserCreator::CreateAutomationProvider(
+ const std::string& channel_id,
+ Profile* profile,
+ size_t expected_tabs) {
#if defined(ENABLE_AUTOMATION)
scoped_refptr<AutomationProviderClass> automation =
new AutomationProviderClass(profile);
@@ -1355,7 +1367,7 @@ bool BrowserInit::CreateAutomationProvider(const std::string& channel_id,
}
// static
-void BrowserInit::ProcessCommandLineOnProfileCreated(
+void StartupBrowserCreator::ProcessCommandLineOnProfileCreated(
const CommandLine& cmd_line,
const FilePath& cur_dir,
Profile* profile,
@@ -1366,14 +1378,15 @@ void BrowserInit::ProcessCommandLineOnProfileCreated(
}
// static
-void BrowserInit::ProcessCommandLineAlreadyRunning(const CommandLine& cmd_line,
- const FilePath& cur_dir) {
+void StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
+ const CommandLine& cmd_line,
+ const FilePath& cur_dir) {
if (cmd_line.HasSwitch(switches::kProfileDirectory)) {
ProfileManager* profile_manager = g_browser_process->profile_manager();
FilePath path = cmd_line.GetSwitchValuePath(switches::kProfileDirectory);
path = profile_manager->user_data_dir().Append(path);
profile_manager->CreateProfileAsync(path,
- base::Bind(&BrowserInit::ProcessCommandLineOnProfileCreated,
+ base::Bind(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated,
cmd_line, cur_dir));
return;
}
diff --git a/chrome/browser/ui/browser_init.h b/chrome/browser/ui/startup/startup_browser_creator.h
index 5b90bfa..88cc3fa 100644
--- a/chrome/browser/ui/browser_init.h
+++ b/chrome/browser/ui/startup/startup_browser_creator.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_BROWSER_INIT_H_
-#define CHROME_BROWSER_UI_BROWSER_INIT_H_
+#ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_
+#define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_
#pragma once
#include <string>
@@ -24,7 +24,7 @@ class TabContentsWrapper;
// class containing helpers for BrowserMain to spin up a new instance and
// initialize the profile.
-class BrowserInit {
+class StartupBrowserCreator {
public:
typedef std::vector<Profile*> Profiles;
@@ -37,8 +37,8 @@ class BrowserInit {
IS_FIRST_RUN
};
- BrowserInit();
- ~BrowserInit();
+ StartupBrowserCreator();
+ ~StartupBrowserCreator();
// Adds a url to be opened during first run. This overrides the standard
// tabs shown at first run.
@@ -117,7 +117,7 @@ class BrowserInit {
std::string app_id;
};
- // There are two ctors. The first one implies a NULL browser_init object
+ // There are two ctors. The first one implies a NULL browser_creator object
// and thus no access to distribution-specific first-run behaviors. The
// second one is always called when the browser starts even if it is not
// the first run. |is_first_run| indicates that this is a new profile.
@@ -126,7 +126,7 @@ class BrowserInit {
IsFirstRun is_first_run);
LaunchWithProfile(const FilePath& cur_dir,
const CommandLine& command_line,
- BrowserInit* browser_init,
+ StartupBrowserCreator* browser_creator,
IsFirstRun is_first_run);
~LaunchWithProfile();
@@ -221,7 +221,7 @@ class BrowserInit {
const FilePath cur_dir_;
const CommandLine& command_line_;
Profile* profile_;
- BrowserInit* browser_init_;
+ StartupBrowserCreator* browser_creator_;
bool is_first_run_;
DISALLOW_COPY_AND_ASSIGN(LaunchWithProfile);
};
@@ -229,10 +229,11 @@ class BrowserInit {
private:
friend class CloudPrintProxyPolicyTest;
friend class CloudPrintProxyPolicyStartupTest;
- FRIEND_TEST_ALL_PREFIXES(BrowserInitTest,
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
ReadingWasRestartedAfterNormalStart);
- FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, ReadingWasRestartedAfterRestart);
- FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, UpdateWithTwoProfiles);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
+ ReadingWasRestartedAfterRestart);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, UpdateWithTwoProfiles);
// Returns the list of URLs to open from the command line. The returned
// vector is empty if the user didn't specify any URLs on the command line.
@@ -247,7 +248,7 @@ class BrowserInit {
Profile* last_used_profile,
const Profiles& last_opened_profiles,
int* return_code,
- BrowserInit* browser_init);
+ StartupBrowserCreator* browser_creator);
// Callback after a profile has been created.
static void ProcessCommandLineOnProfileCreated(
@@ -264,7 +265,7 @@ class BrowserInit {
// of testing.)
static bool was_restarted_read_;
- DISALLOW_COPY_AND_ASSIGN(BrowserInit);
+ DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreator);
};
-#endif // CHROME_BROWSER_UI_BROWSER_INIT_H_
+#endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_
diff --git a/chrome/browser/ui/browser_init_browsertest.cc b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
index 4a09805..7adb270 100644
--- a/chrome/browser/ui/browser_init_browsertest.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
@@ -17,9 +17,9 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_init.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
@@ -29,7 +29,7 @@
#include "content/public/browser/web_contents.h"
#include "testing/gtest/include/gtest/gtest.h"
-class BrowserInitTest : public ExtensionBrowserTest {
+class StartupBrowserCreatorTest : public ExtensionBrowserTest {
protected:
virtual bool SetUpUserDataDirectory() OVERRIDE {
// Make sure the first run sentinel file exists before running these tests,
@@ -109,9 +109,9 @@ class OpenURLsPopupObserver : public BrowserList::Observer {
};
// Test that when there is a popup as the active browser any requests to
-// BrowserInit::LaunchWithProfile::OpenURLsInBrowser don't crash because
-// there's no explicit profile given.
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenURLsPopup) {
+// StartupBrowserCreator::LaunchWithProfile::OpenURLsInBrowser don't crash
+// because there's no explicit profile given.
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) {
std::vector<GURL> urls;
urls.push_back(GURL("http://localhost"));
@@ -129,9 +129,10 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenURLsPopup) {
ASSERT_EQ(popup, observer.added_browser_);
CommandLine dummy(CommandLine::NO_PROGRAM);
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
// This should create a new window, but re-use the profile from |popup|. If
// it used a NULL or invalid profile, it would crash.
launch.OpenURLsInBrowser(popup, false, urls);
@@ -146,7 +147,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenURLsPopup) {
// Verify that startup URLs are honored when the process already exists but has
// no tabbed browser windows (eg. as if the process is running only due to a
// background application.
-IN_PROC_BROWSER_TEST_F(BrowserInitTest,
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
StartupURLsOnNewWindowWithNoTabbedBrowsers) {
// Use a couple same-site HTTP URLs.
ASSERT_TRUE(test_server()->Start());
@@ -164,9 +165,10 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest,
// Do a simple non-process-startup browser launch.
CommandLine dummy(CommandLine::NO_PROGRAM);
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
// This should have created a new browser window. |browser()| is still
@@ -189,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest,
// Verify that startup URLs aren't used when the process already exists
// and has other tabbed browser windows. This is the common case of starting a
// new browser.
-IN_PROC_BROWSER_TEST_F(BrowserInitTest,
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
StartupURLsOnNewWindow) {
// Use a couple arbitrary URLs.
std::vector<GURL> urls;
@@ -207,9 +209,10 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest,
// Do a simple non-process-startup browser launch.
CommandLine dummy(CommandLine::NO_PROGRAM);
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
// This should have created a new browser window.
@@ -222,7 +225,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest,
// App shortcuts are not implemented on mac os.
#if !defined(OS_MACOSX)
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutNoPref) {
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) {
// Load an app with launch.container = 'tab'.
const Extension* extension_app = NULL;
ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
@@ -231,9 +234,11 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutNoPref) {
CommandLine command_line(CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
+ first_run);
ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
// No pref was set, so the app should have opened in a window.
@@ -250,7 +255,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutNoPref) {
std::string::npos) << new_browser->app_name_;
}
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutWindowPref) {
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) {
const Extension* extension_app = NULL;
ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
@@ -259,9 +264,11 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutWindowPref) {
CommandLine command_line(CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
+ first_run);
ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
// Pref was set to open in a window, so the app should have opened in a
@@ -279,7 +286,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutWindowPref) {
std::string::npos) << new_browser->app_name_;
}
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutTabPref) {
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) {
// Load an app with launch.container = 'tab'.
const Extension* extension_app = NULL;
ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
@@ -289,9 +296,11 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutTabPref) {
CommandLine command_line(CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
+ first_run);
ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
// When an app shortcut is open and the pref indicates a tab should
@@ -311,16 +320,18 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutTabPref) {
std::string::npos) << new_browser->app_name_;
}
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutPanel) {
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutPanel) {
// Load an app with launch.container = 'panel'.
const Extension* extension_app = NULL;
ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_panel_container", &extension_app));
CommandLine command_line(CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
- BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run);
+ StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ StartupBrowserCreator::IS_FIRST_RUN :
+ StartupBrowserCreator::IS_NOT_FIRST_RUN;
+ StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
+ first_run);
ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
// The launch should have created a new browser, with a panel type.
@@ -340,30 +351,32 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutPanel) {
#endif // !defined(OS_CHROMEOS)
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterRestart) {
- // Tests that BrowserInit::WasRestarted reads and resets the preference
- // kWasRestarted correctly.
- BrowserInit::was_restarted_read_ = false;
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
+ ReadingWasRestartedAfterRestart) {
+ // Tests that StartupBrowserCreator::WasRestarted reads and resets the
+ // preference kWasRestarted correctly.
+ StartupBrowserCreator::was_restarted_read_ = false;
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kWasRestarted, true);
- EXPECT_TRUE(BrowserInit::WasRestarted());
+ EXPECT_TRUE(StartupBrowserCreator::WasRestarted());
EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted));
- EXPECT_TRUE(BrowserInit::WasRestarted());
+ EXPECT_TRUE(StartupBrowserCreator::WasRestarted());
}
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterNormalStart) {
- // Tests that BrowserInit::WasRestarted reads and resets the preference
- // kWasRestarted correctly.
- BrowserInit::was_restarted_read_ = false;
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
+ ReadingWasRestartedAfterNormalStart) {
+ // Tests that StartupBrowserCreator::WasRestarted reads and resets the
+ // preference kWasRestarted correctly.
+ StartupBrowserCreator::was_restarted_read_ = false;
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kWasRestarted, false);
- EXPECT_FALSE(BrowserInit::WasRestarted());
+ EXPECT_FALSE(StartupBrowserCreator::WasRestarted());
EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted));
- EXPECT_FALSE(BrowserInit::WasRestarted());
+ EXPECT_FALSE(StartupBrowserCreator::WasRestarted());
}
#if !defined(OS_CHROMEOS)
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, StartupURLsForTwoProfiles) {
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) {
Profile* default_profile = browser()->profile();
ProfileManager* profile_manager = g_browser_process->profile_manager();
@@ -399,12 +412,12 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, StartupURLsForTwoProfiles) {
CommandLine dummy(CommandLine::NO_PROGRAM);
int return_code;
- BrowserInit browser_init;
+ StartupBrowserCreator browser_creator;
std::vector<Profile*> last_opened_profiles;
last_opened_profiles.push_back(default_profile);
last_opened_profiles.push_back(other_profile);
- browser_init.Start(dummy, profile_manager->user_data_dir(), default_profile,
- last_opened_profiles, &return_code);
+ browser_creator.Start(dummy, profile_manager->user_data_dir(),
+ default_profile, last_opened_profiles, &return_code);
// urls1 were opened in a browser for default_profile, and urls2 were opened
// in a browser for other_profile.
@@ -424,9 +437,9 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, StartupURLsForTwoProfiles) {
EXPECT_EQ(urls2[0], new_browser->GetWebContentsAt(0)->GetURL());
}
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, UpdateWithTwoProfiles) {
- // Make BrowserInit::WasRestarted() return true.
- BrowserInit::was_restarted_read_ = false;
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) {
+ // Make StartupBrowserCreator::WasRestarted() return true.
+ StartupBrowserCreator::was_restarted_read_ = false;
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kWasRestarted, true);
@@ -464,12 +477,12 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, UpdateWithTwoProfiles) {
// Simulate a launch after a browser update.
CommandLine dummy(CommandLine::NO_PROGRAM);
int return_code;
- BrowserInit browser_init;
+ StartupBrowserCreator browser_creator;
std::vector<Profile*> last_opened_profiles;
last_opened_profiles.push_back(profile1);
last_opened_profiles.push_back(profile2);
- browser_init.Start(dummy, profile_manager->user_data_dir(), profile1,
- last_opened_profiles, &return_code);
+ browser_creator.Start(dummy, profile_manager->user_data_dir(), profile1,
+ last_opened_profiles, &return_code);
while (SessionRestore::IsRestoring(profile1) ||
SessionRestore::IsRestoring(profile2))
@@ -496,7 +509,8 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, UpdateWithTwoProfiles) {
new_browser->GetWebContentsAt(0)->GetURL());
}
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, ProfilesWithoutPagesNotLaunched) {
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
+ ProfilesWithoutPagesNotLaunched) {
Profile* default_profile = browser()->profile();
ProfileManager* profile_manager = g_browser_process->profile_manager();
@@ -545,14 +559,14 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, ProfilesWithoutPagesNotLaunched) {
CommandLine dummy(CommandLine::NO_PROGRAM);
int return_code;
- BrowserInit browser_init;
+ StartupBrowserCreator browser_creator;
std::vector<Profile*> last_opened_profiles;
last_opened_profiles.push_back(profile_home1);
last_opened_profiles.push_back(profile_home2);
last_opened_profiles.push_back(profile_last);
last_opened_profiles.push_back(profile_urls);
- browser_init.Start(dummy, profile_manager->user_data_dir(), profile_home1,
- last_opened_profiles, &return_code);
+ browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home1,
+ last_opened_profiles, &return_code);
while (SessionRestore::IsRestoring(default_profile) ||
@@ -591,7 +605,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, ProfilesWithoutPagesNotLaunched) {
ASSERT_EQ(0u, BrowserList::GetBrowserCount(profile_home2));
}
-IN_PROC_BROWSER_TEST_F(BrowserInitTest, ProfilesLaunchedAfterCrash) {
+IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
// After an unclean exit, all profiles will be launched. However, they won't
// open any pages automatically.
@@ -636,13 +650,13 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, ProfilesLaunchedAfterCrash) {
CommandLine dummy(CommandLine::NO_PROGRAM);
int return_code;
- BrowserInit browser_init;
+ StartupBrowserCreator browser_creator;
std::vector<Profile*> last_opened_profiles;
last_opened_profiles.push_back(profile_home);
last_opened_profiles.push_back(profile_last);
last_opened_profiles.push_back(profile_urls);
- browser_init.Start(dummy, profile_manager->user_data_dir(), profile_home,
- last_opened_profiles, &return_code);
+ browser_creator.Start(dummy, profile_manager->user_data_dir(), profile_home,
+ last_opened_profiles, &return_code);
// No profiles are getting restored, since they all display the crash info
// bar.
diff --git a/chrome/browser/ui/browser_init_win.cc b/chrome/browser/ui/startup/startup_browser_creator_win.cc
index 20e124e..efd1429 100644
--- a/chrome/browser/ui/browser_init_win.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator_win.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/ui/browser_init_win.h"
+#include "chrome/browser/ui/startup/startup_browser_creator_win.h"
#include "base/logging.h"
#include "base/win/metro.h"
diff --git a/chrome/browser/ui/browser_init_win.h b/chrome/browser/ui/startup/startup_browser_creator_win.h
index a208c3b..25395ae5 100644
--- a/chrome/browser/ui/browser_init_win.h
+++ b/chrome/browser/ui/startup/startup_browser_creator_win.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_BROWSER_UI_BROWSER_INIT_WIN_H_
-#define CHROME_BROWSER_UI_BROWSER_INIT_WIN_H_
+#ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_WIN_H_
+#define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_WIN_H_
#pragma once
#include "base/basictypes.h"
@@ -13,10 +13,12 @@
class Profile;
namespace browser {
-// If we are in Windows 8 metro mode and were launched as a result of the
+
+ // If we are in Windows 8 metro mode and were launched as a result of the
// search charm or via a url navigation in metro, then this function fetches
// the url/search term from the metro driver.
GURL GetURLToOpen(Profile* profile);
+
} // namespace browser;
-#endif // CHROME_BROWSER_UI_BROWSER_INIT_WIN_H_
+#endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_WIN_H_
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 4617604..d1e762a 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2297,10 +2297,6 @@
'browser/ui/browser_content_setting_bubble_model_delegate.cc',
'browser/ui/browser_content_setting_bubble_model_delegate.h',
'browser/ui/browser_dialogs.h',
- 'browser/ui/browser_init.cc',
- 'browser/ui/browser_init.h',
- 'browser/ui/browser_init_win.cc',
- 'browser/ui/browser_init_win.h',
'browser/ui/browser_list.cc',
'browser/ui/browser_list.h',
'browser/ui/browser_list_aura.cc',
@@ -3166,6 +3162,10 @@
'browser/ui/startup/obsolete_os_prompt_gtk.cc',
'browser/ui/startup/session_crashed_prompt.cc',
'browser/ui/startup/session_crashed_prompt.h',
+ 'browser/ui/startup/startup_browser_creator.cc',
+ 'browser/ui/startup/startup_browser_creator.h',
+ 'browser/ui/startup/startup_browser_creator_win.cc',
+ 'browser/ui/startup/startup_browser_creator_win.h',
'browser/ui/status_bubble.h',
'browser/ui/sync/browser_synced_window_delegate.h',
'browser/ui/sync/browser_synced_window_delegate.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index e8b2e7c..5310aa1 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -2872,7 +2872,6 @@
'browser/translate/translate_manager_browsertest.cc',
'browser/ui/browser_browsertest.cc',
'browser/ui/browser_close_browsertest.cc',
- 'browser/ui/browser_init_browsertest.cc',
'browser/ui/browser_navigator_browsertest.cc',
'browser/ui/browser_navigator_browsertest.h',
'browser/ui/browser_navigator_browsertest_chromeos.cc',
@@ -2890,6 +2889,7 @@
'browser/ui/panels/panel_app_browsertest.cc',
'browser/ui/panels/panel_browser_view_browsertest.cc',
'browser/ui/prefs/prefs_tab_helper_browsertest.cc',
+ 'browser/ui/startup/startup_browser_creator_browsertest.cc',
'browser/ui/tab_modal_confirm_dialog_browsertest_mac.mm',
'browser/ui/tab_modal_confirm_dialog_browsertest.cc',
'browser/ui/tab_modal_confirm_dialog_browsertest.h',