summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 18:14:21 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-10 18:14:21 +0000
commit826012343fb2a661c7dda67f078b89fcf536e22b (patch)
treec6c39cbe5123c5563b9a58170cf239dd74ad5177
parentc7221b423e1d051dc5b68cb3f66cfe11398f5696 (diff)
downloadchromium_src-826012343fb2a661c7dda67f078b89fcf536e22b.zip
chromium_src-826012343fb2a661c7dda67f078b89fcf536e22b.tar.gz
chromium_src-826012343fb2a661c7dda67f078b89fcf536e22b.tar.bz2
Revert 136337 - Rename BrowserInit to StartupBrowserCreator, and move into startup subdir.
BUG=none TEST=none TBR=sky Review URL: https://chromiumcodereview.appspot.com/10356100 TBR=ben@chromium.org Review URL: https://chromiumcodereview.appspot.com/10382108 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136343 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/app_controller_mac.mm11
-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/browser_init.cc (renamed from chrome/browser/ui/startup/startup_browser_creator.cc)155
-rw-r--r--chrome/browser/ui/browser_init.h (renamed from chrome/browser/ui/startup/startup_browser_creator.h)29
-rw-r--r--chrome/browser/ui/browser_init_browsertest.cc (renamed from chrome/browser/ui/startup/startup_browser_creator_browsertest.cc)138
-rw-r--r--chrome/browser/ui/browser_init_win.cc (renamed from chrome/browser/ui/startup/startup_browser_creator_win.cc)2
-rw-r--r--chrome/browser/ui/browser_init_win.h (renamed from chrome/browser/ui/startup/startup_browser_creator_win.h)10
-rw-r--r--chrome/browser/ui/panels/panel_app_browsertest.cc1
-rw-r--r--chrome/chrome_browser.gypi8
-rw-r--r--chrome/chrome_tests.gypi2
34 files changed, 252 insertions, 286 deletions
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 4c8ba0b..5612008 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"
@@ -996,11 +996,10 @@ const AEEventClass kAECloudPrintUninstallClass = 'GCPu';
{
AutoReset<bool> auto_reset_in_run(&g_is_opening_new_window, true);
int 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);
+ BrowserInit browser_init;
+ browser_init.LaunchBrowser(command_line, [self lastProfile], FilePath(),
+ BrowserInit::IS_NOT_PROCESS_STARTUP,
+ BrowserInit::IS_NOT_FIRST_RUN, &return_code);
}
// We've handled the reopen event, so return NO to tell AppKit not
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 0b0db8f..320d431 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -98,6 +98,7 @@
#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 ff8337a..ab4dd94 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/startup/startup_browser_creator.h"
+#include "chrome/browser/ui/browser_init.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(StartupBrowserCreator* browser_creator,
+void AddFirstRunNewTabs(BrowserInit* browser_init,
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_creator->AddFirstRunTab(*it);
+ browser_init->AddFirstRunTab(*it);
}
}
@@ -498,7 +498,7 @@ bool ProcessSingletonNotificationCallback(const CommandLine& command_line,
return true;
}
- StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
+ BrowserInit::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_creator_.get());
+ DCHECK(browser_init_.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_creator_.reset(new StartupBrowserCreator);
+ browser_init_.reset(new BrowserInit);
#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_creator_.get(), master_prefs_->new_tabs);
+ AddFirstRunNewTabs(browser_init_.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_creator_->Start (OR parameters().ui_task->Run())
+// ... browser_init_->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_creator_->Start(parsed_command_line(), FilePath(),
- profile_, last_opened_profiles, &result_code)) {
+ if (browser_init_->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_creator_.reset();
+ browser_init_.reset();
PostBrowserStart();
diff --git a/chrome/browser/chrome_browser_main.h b/chrome/browser/chrome_browser_main.h
index 71afa03..fb67705 100644
--- a/chrome/browser/chrome_browser_main.h
+++ b/chrome/browser/chrome_browser_main.h
@@ -15,10 +15,11 @@
#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/startup/startup_browser_creator.h"
+#include "chrome/browser/ui/browser_init.h"
#include "content/public/browser/browser_main_parts.h"
#include "content/public/browser/browser_thread.h"
+class BrowserInit;
class BrowserProcessImpl;
class ChromeBrowserMainExtraParts;
class FieldTrialSynchronizer;
@@ -26,7 +27,6 @@ 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<StartupBrowserCreator> browser_creator_;
+ scoped_ptr<BrowserInit> browser_init_;
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 db4e3e6..94920be 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/startup/startup_browser_creator.h"
+#include "chrome/browser/ui/browser_init.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
@@ -715,17 +715,16 @@ void LoginUtilsImpl::DoBrowserLaunch(Profile* profile,
BootTimesLoader::Get()->AddLoginTimeMarker("BrowserLaunched", false);
VLOG(1) << "Launching browser...";
- StartupBrowserCreator browser_creator;
+ BrowserInit browser_init;
int 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);
+ 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);
// 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 f3dd88e..50dcf39 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 StartupBrowserCreator::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 BrowserInit::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 a31bb06..7e9f6d1 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_creator.LaunchBrowser(...) was called after user sign in.
+ // browser_init.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_creator.LaunchBrowser(...) was called after sign in
+ // browser_init.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 b9e372b..704e434 100644
--- a/chrome/browser/chromeos/network_message_observer.cc
+++ b/chrome/browser/chromeos/network_message_observer.cc
@@ -52,8 +52,7 @@ NetworkMessageObserver::NetworkMessageObserver(Profile* profile)
NetworkLibrary* netlib = CrosLibrary::Get()->GetNetworkLibrary();
OnNetworkManagerChanged(netlib);
// Note that this gets added as a NetworkManagerObserver,
- // CellularDataPlanObserver, and UserActionObserver in
- // startup_browser_creator.cc
+ // CellularDataPlanObserver, and UserActionObserver in browser_init.cc
}
NetworkMessageObserver::~NetworkMessageObserver() {
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index c7cfc77..d62ff41 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -56,6 +56,7 @@
#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 96bdf06..7ba4efe 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/startup/startup_browser_creator.h"
+#include "chrome/browser/ui/browser_init.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;
- StartupBrowserCreator browser_creator;
- return StartupBrowserCreator::ProcessCmdLineImpl(
- command_line, FilePath(), false, profile,
- StartupBrowserCreator::Profiles(), &return_code, &browser_creator);
+ BrowserInit browser_init;
+ return BrowserInit::ProcessCmdLineImpl(command_line, FilePath(), false,
+ profile, BrowserInit::Profiles(),
+ &return_code, &browser_init);
}
protected:
@@ -433,7 +433,7 @@ ProfileKeyedService* TestCloudPrintProxyServiceFactory(Profile* profile) {
return service;
}
-TEST_F(CloudPrintProxyPolicyTest, StartupBrowserCreatorWithCommandLine) {
+TEST_F(CloudPrintProxyPolicyTest, StartBrowserInitWithCommandLine) {
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 5fe6940..dd641fb 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/startup/startup_browser_creator.h"
+#include "chrome/browser/ui/browser_init.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;
- StartupBrowserCreator browser_creator;
- return StartupBrowserCreator::ProcessCmdLineImpl(
- command_line, FilePath(), false, profile,
- StartupBrowserCreator::Profiles(), &return_code, &browser_creator);
+ BrowserInit browser_init;
+ return BrowserInit::ProcessCmdLineImpl(command_line, FilePath(), false,
+ profile, BrowserInit::Profiles(),
+ &return_code, &browser_init);
}
protected:
diff --git a/chrome/browser/profiles/avatar_menu_model.cc b/chrome/browser/profiles/avatar_menu_model.cc
index 8a8df27..11c0076 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,
- StartupBrowserCreator::IS_NOT_PROCESS_STARTUP,
- StartupBrowserCreator::IS_NOT_FIRST_RUN,
+ BrowserInit::IS_NOT_PROCESS_STARTUP,
+ BrowserInit::IS_NOT_FIRST_RUN,
always_create);
}
}
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 143c96d..2642240 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/startup/startup_browser_creator.h"
+#include "chrome/browser/ui/browser_init.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 =
- StartupBrowserCreator::GetSessionStartupPref(
- *CommandLine::ForCurrentProcess(), this).type;
+ BrowserInit::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 a9f51b2..93fd178 100644
--- a/chrome/browser/profiles/profile_impl.h
+++ b/chrome/browser/profiles/profile_impl.h
@@ -130,8 +130,7 @@ class ProfileImpl : public Profile,
private:
friend class Profile;
- FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
- ProfilesLaunchedAfterCrash);
+ FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, 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 4abb87e..64385fd 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,
- StartupBrowserCreator::IS_PROCESS_STARTUP,
- StartupBrowserCreator::IS_FIRST_RUN,
+ BrowserInit::IS_PROCESS_STARTUP,
+ BrowserInit::IS_FIRST_RUN,
false);
}
}
@@ -469,8 +469,8 @@ Profile* ProfileManager::GetProfileByPath(const FilePath& path) const {
// static
void ProfileManager::FindOrCreateNewWindowForProfile(
Profile* profile,
- StartupBrowserCreator::IsProcessStartup process_startup,
- StartupBrowserCreator::IsFirstRun is_first_run,
+ BrowserInit::IsProcessStartup process_startup,
+ BrowserInit::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;
- StartupBrowserCreator browser_creator;
- browser_creator.LaunchBrowser(command_line, profile, FilePath(),
- process_startup, is_first_run, &return_code);
+ BrowserInit browser_init;
+ browser_init.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 8f02319..38da261 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,
- StartupBrowserCreator::IsProcessStartup process_startup,
- StartupBrowserCreator::IsFirstRun is_first_run,
+ BrowserInit::IsProcessStartup process_startup,
+ BrowserInit::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 abfbf24..5dd491d 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;
- StartupBrowserCreator::LaunchWithProfile::Tab pinned_tab;
+ BrowserInit::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 b794959..49684a7 100644
--- a/chrome/browser/sessions/session_restore_browsertest.cc
+++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -17,6 +17,7 @@
#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 193ecf6..f39ec70 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_ &&
- !StartupBrowserCreator::InSynchronousProfileLaunch() &&
+ !BrowserInit::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 = StartupBrowserCreator::GetSessionStartupPref(
+ SessionStartupPref pref = BrowserInit::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 d50d1f0..eb09cd1 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 StartupBrowserCreator::LaunchWithProfile::Tab Tab;
+typedef BrowserInit::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 2872f90..28542dc 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/startup/startup_browser_creator.h"
+#include "chrome/browser/ui/browser_init.h"
#include "googleurl/src/gurl.h"
namespace base {
@@ -27,7 +27,7 @@ class Profile;
// dictionary describing the entry.
class PinnedTabCodec {
public:
- typedef std::vector<StartupBrowserCreator::LaunchWithProfile::Tab> Tabs;
+ typedef std::vector<BrowserInit::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 0360a02..087df64 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 StartupBrowserCreator::LaunchWithProfile::Tab Tab;
+typedef BrowserInit::LaunchWithProfile::Tab Tab;
namespace {
@@ -17,7 +17,7 @@ std::string TabToString(const Tab& tab) {
// static
std::string PinnedTabTestUtils::TabsToString(
- const std::vector<StartupBrowserCreator::LaunchWithProfile::Tab>& values) {
+ const std::vector<BrowserInit::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 57850de..ab73e34 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/startup/startup_browser_creator.h"
+#include "chrome/browser/ui/browser_init.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<StartupBrowserCreator::LaunchWithProfile::Tab>& values);
+ const std::vector<BrowserInit::LaunchWithProfile::Tab>& values);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(PinnedTabTestUtils);
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 2ae6a5e..13c4daf 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,
- // 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.
+ // 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.
prefs->RegisterBooleanPref(prefs::kShowUpdatePromotionInfoBar,
true,
PrefService::UNSYNCABLE_PREF);
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index c7c8dbb..bd6cd89 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -901,12 +901,11 @@ 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(StartupBrowserCreatorTest, OpenAppShortcutNoPref);
- FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
- OpenAppShortcutWindowPref);
- FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, OpenAppShortcutTabPref);
- FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, OpenAppShortcutPanel);
+ 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);
// 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 0dd7420..bd88449 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,11 +898,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, AppIdSwitch) {
CommandLine command_line(CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- StartupBrowserCreator::IS_FIRST_RUN :
- StartupBrowserCreator::IS_NOT_FIRST_RUN;
- StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
- first_run);
+ BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
+ BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run);
ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile()));
// Check that the new browser has an app name.
@@ -1252,10 +1250,9 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, RestorePinnedTabs) {
// Simulate launching again.
CommandLine dummy(CommandLine::NO_PROGRAM);
- StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- StartupBrowserCreator::IS_FIRST_RUN :
- StartupBrowserCreator::IS_NOT_FIRST_RUN;
- StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
+ BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
+ BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run);
launch.profile_ = browser()->profile();
launch.ProcessStartupURLs(std::vector<GURL>());
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/browser_init.cc
index e6bff02..5a95062 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/browser_init.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/startup/startup_browser_creator.h"
+#include "chrome/browser/ui/browser_init.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/startup/startup_browser_creator_win.h"
+#include "chrome/browser/ui/browser_init_win.h"
#endif
using content::BrowserThread;
@@ -195,11 +195,10 @@ GURL GetWelcomePageURL() {
return GURL(welcome_url);
}
-void UrlsToTabs(
- const std::vector<GURL>& urls,
- std::vector<StartupBrowserCreator::LaunchWithProfile::Tab>* tabs) {
+void UrlsToTabs(const std::vector<GURL>& urls,
+ std::vector<BrowserInit::LaunchWithProfile::Tab>* tabs) {
for (size_t i = 0; i < urls.size(); ++i) {
- StartupBrowserCreator::LaunchWithProfile::Tab tab;
+ BrowserInit::LaunchWithProfile::Tab tab;
tab.is_pinned = false;
tab.url = urls[i];
tabs->push_back(tab);
@@ -242,8 +241,7 @@ void RecordCmdLineAppHistogram() {
void RecordAppLaunches(
Profile* profile,
const std::vector<GURL>& cmd_line_urls,
- const std::vector<StartupBrowserCreator::LaunchWithProfile::Tab>&
- autolaunch_tabs) {
+ const std::vector<BrowserInit::LaunchWithProfile::Tab>& autolaunch_tabs) {
ExtensionService* extension_service = profile->GetExtensionService();
DCHECK(extension_service);
for (size_t i = 0; i < cmd_line_urls.size(); ++i) {
@@ -335,28 +333,31 @@ bool HasPendingUncleanExit(Profile* profile) {
} // namespace
-StartupBrowserCreator::StartupBrowserCreator() {}
-StartupBrowserCreator::~StartupBrowserCreator() {}
+// BrowserInit ----------------------------------------------------------------
+
+BrowserInit::BrowserInit() {}
+
+BrowserInit::~BrowserInit() {}
// static
-bool StartupBrowserCreator::was_restarted_read_ = false;
+bool BrowserInit::was_restarted_read_ = false;
-void StartupBrowserCreator::AddFirstRunTab(const GURL& url) {
+void BrowserInit::AddFirstRunTab(const GURL& url) {
first_run_tabs_.push_back(url);
}
// static
-bool StartupBrowserCreator::InSynchronousProfileLaunch() {
+bool BrowserInit::InSynchronousProfileLaunch() {
return in_synchronous_profile_launch;
}
-bool StartupBrowserCreator::LaunchBrowser(const CommandLine& command_line,
- Profile* profile,
- const FilePath& cur_dir,
- IsProcessStartup process_startup,
- IsFirstRun is_first_run,
- int* return_code) {
+bool BrowserInit::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);
@@ -370,11 +371,9 @@ bool StartupBrowserCreator::LaunchBrowser(const CommandLine& command_line,
<< "browser session.";
}
- StartupBrowserCreator::LaunchWithProfile lwp(cur_dir, command_line, this,
- is_first_run);
- std::vector<GURL> urls_to_launch =
- StartupBrowserCreator::GetURLsFromCommandLine(command_line, cur_dir,
- profile);
+ BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this, is_first_run);
+ std::vector<GURL> urls_to_launch = BrowserInit::GetURLsFromCommandLine(
+ command_line, cur_dir, profile);
bool launched = lwp.Launch(profile, urls_to_launch,
in_synchronous_profile_launch);
in_synchronous_profile_launch = false;
@@ -394,7 +393,7 @@ bool StartupBrowserCreator::LaunchBrowser(const CommandLine& command_line,
}
// static
-bool StartupBrowserCreator::WasRestarted() {
+bool BrowserInit::WasRestarted() {
// Stores the value of the preference kWasRestarted had when it was read.
static bool was_restarted = false;
@@ -408,7 +407,7 @@ bool StartupBrowserCreator::WasRestarted() {
}
// static
-SessionStartupPref StartupBrowserCreator::GetSessionStartupPref(
+SessionStartupPref BrowserInit::GetSessionStartupPref(
const CommandLine& command_line,
Profile* profile) {
SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile);
@@ -418,7 +417,7 @@ SessionStartupPref StartupBrowserCreator::GetSessionStartupPref(
pref.type = SessionStartupPref::DEFAULT;
if (command_line.HasSwitch(switches::kRestoreLastSession) ||
- StartupBrowserCreator::WasRestarted()) {
+ BrowserInit::WasRestarted()) {
pref.type = SessionStartupPref::LAST;
}
if (pref.type == SessionStartupPref::LAST &&
@@ -433,45 +432,42 @@ SessionStartupPref StartupBrowserCreator::GetSessionStartupPref(
}
-// StartupBrowserCreator::LaunchWithProfile::Tab -------------------------------
+// BrowserInit::LaunchWithProfile::Tab ----------------------------------------
-StartupBrowserCreator::LaunchWithProfile::Tab::Tab()
- : is_app(false),
- is_pinned(true) {
-}
+BrowserInit::LaunchWithProfile::Tab::Tab() : is_app(false), is_pinned(true) {}
+
+BrowserInit::LaunchWithProfile::Tab::~Tab() {}
-StartupBrowserCreator::LaunchWithProfile::Tab::~Tab() {
-}
-// StartupBrowserCreator::LaunchWithProfile ------------------------------------
+// BrowserInit::LaunchWithProfile ---------------------------------------------
-StartupBrowserCreator::LaunchWithProfile::LaunchWithProfile(
+BrowserInit::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_creator_(NULL),
+ browser_init_(NULL),
is_first_run_(is_first_run == IS_FIRST_RUN) {
}
-StartupBrowserCreator::LaunchWithProfile::LaunchWithProfile(
+BrowserInit::LaunchWithProfile::LaunchWithProfile(
const FilePath& cur_dir,
const CommandLine& command_line,
- StartupBrowserCreator* browser_creator,
+ BrowserInit* browser_init,
IsFirstRun is_first_run)
: cur_dir_(cur_dir),
command_line_(command_line),
profile_(NULL),
- browser_creator_(browser_creator),
+ browser_init_(browser_init),
is_first_run_(is_first_run == IS_FIRST_RUN) {
}
-StartupBrowserCreator::LaunchWithProfile::~LaunchWithProfile() {
+BrowserInit::LaunchWithProfile::~LaunchWithProfile() {
}
-bool StartupBrowserCreator::LaunchWithProfile::Launch(
+bool BrowserInit::LaunchWithProfile::Launch(
Profile* profile,
const std::vector<GURL>& urls_to_open,
bool process_startup) {
@@ -585,9 +581,8 @@ bool StartupBrowserCreator::LaunchWithProfile::Launch(
return true;
}
-bool StartupBrowserCreator::LaunchWithProfile::IsAppLaunch(
- std::string* app_url,
- std::string* app_id) {
+bool BrowserInit::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);
@@ -601,8 +596,7 @@ bool StartupBrowserCreator::LaunchWithProfile::IsAppLaunch(
return false;
}
-bool StartupBrowserCreator::LaunchWithProfile::OpenApplicationTab(
- Profile* profile) {
+bool BrowserInit::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
@@ -627,8 +621,7 @@ bool StartupBrowserCreator::LaunchWithProfile::OpenApplicationTab(
return (app_tab != NULL);
}
-bool StartupBrowserCreator::LaunchWithProfile::OpenApplicationWindow(
- Profile* profile) {
+bool BrowserInit::LaunchWithProfile::OpenApplicationWindow(Profile* profile) {
std::string url_string, app_id;
if (!IsAppLaunch(&url_string, &app_id))
return false;
@@ -688,7 +681,7 @@ bool StartupBrowserCreator::LaunchWithProfile::OpenApplicationWindow(
return false;
}
-void StartupBrowserCreator::LaunchWithProfile::ProcessLaunchURLs(
+void BrowserInit::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
@@ -745,7 +738,7 @@ void StartupBrowserCreator::LaunchWithProfile::ProcessLaunchURLs(
AddInfoBarsIfNecessary(browser, is_process_startup);
}
-bool StartupBrowserCreator::LaunchWithProfile::ProcessStartupURLs(
+bool BrowserInit::LaunchWithProfile::ProcessStartupURLs(
const std::vector<GURL>& urls_to_open) {
SessionStartupPref pref = GetSessionStartupPref(command_line_, profile_);
@@ -787,7 +780,7 @@ bool StartupBrowserCreator::LaunchWithProfile::ProcessStartupURLs(
return true;
}
-Browser* StartupBrowserCreator::LaunchWithProfile::ProcessSpecifiedURLs(
+Browser* BrowserInit::LaunchWithProfile::ProcessSpecifiedURLs(
const std::vector<GURL>& urls_to_open) {
SessionStartupPref pref = GetSessionStartupPref(command_line_, profile_);
std::vector<Tab> tabs;
@@ -830,7 +823,7 @@ Browser* StartupBrowserCreator::LaunchWithProfile::ProcessSpecifiedURLs(
return browser;
}
-void StartupBrowserCreator::LaunchWithProfile::AddUniqueURLs(
+void BrowserInit::LaunchWithProfile::AddUniqueURLs(
const std::vector<GURL>& urls,
std::vector<Tab>* tabs) {
size_t num_existing_tabs = tabs->size();
@@ -843,7 +836,7 @@ void StartupBrowserCreator::LaunchWithProfile::AddUniqueURLs(
}
}
if (!in_tabs) {
- StartupBrowserCreator::LaunchWithProfile::Tab tab;
+ BrowserInit::LaunchWithProfile::Tab tab;
tab.is_pinned = false;
tab.url = urls[i];
tabs->push_back(tab);
@@ -851,7 +844,7 @@ void StartupBrowserCreator::LaunchWithProfile::AddUniqueURLs(
}
}
-Browser* StartupBrowserCreator::LaunchWithProfile::OpenURLsInBrowser(
+Browser* BrowserInit::LaunchWithProfile::OpenURLsInBrowser(
Browser* browser,
bool process_startup,
const std::vector<GURL>& urls) {
@@ -860,7 +853,7 @@ Browser* StartupBrowserCreator::LaunchWithProfile::OpenURLsInBrowser(
return OpenTabsInBrowser(browser, process_startup, tabs);
}
-Browser* StartupBrowserCreator::LaunchWithProfile::OpenTabsInBrowser(
+Browser* BrowserInit::LaunchWithProfile::OpenTabsInBrowser(
Browser* browser,
bool process_startup,
const std::vector<Tab>& tabs) {
@@ -935,7 +928,7 @@ Browser* StartupBrowserCreator::LaunchWithProfile::OpenTabsInBrowser(
return browser;
}
-void StartupBrowserCreator::LaunchWithProfile::AddInfoBarsIfNecessary(
+void BrowserInit::LaunchWithProfile::AddInfoBarsIfNecessary(
Browser* browser,
IsProcessStartup is_process_startup) {
if (!browser || !profile_ || browser->tab_count() == 0)
@@ -955,7 +948,7 @@ void StartupBrowserCreator::LaunchWithProfile::AddInfoBarsIfNecessary(
}
-void StartupBrowserCreator::LaunchWithProfile::AddStartupURLs(
+void BrowserInit::LaunchWithProfile::AddStartupURLs(
std::vector<GURL>* startup_urls) const {
// If we have urls specified beforehand (i.e. from command line) use them
// and nothing else.
@@ -964,11 +957,10 @@ void StartupBrowserCreator::LaunchWithProfile::AddStartupURLs(
// If we have urls specified by the first run master preferences use them
// and nothing else.
- 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()) {
+ 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()) {
// Replace magic names for the actual urls.
if (it->host() == "new_tab_page") {
startup_urls->push_back(GURL(chrome::kChromeUINewTabURL));
@@ -979,7 +971,7 @@ void StartupBrowserCreator::LaunchWithProfile::AddStartupURLs(
}
++it;
}
- browser_creator_->first_run_tabs_.clear();
+ browser_init_->first_run_tabs_.clear();
}
}
@@ -1026,8 +1018,7 @@ void StartupBrowserCreator::LaunchWithProfile::AddStartupURLs(
}
}
-void StartupBrowserCreator::LaunchWithProfile::CheckPreferencesBackup(
- Profile* profile) {
+void BrowserInit::LaunchWithProfile::CheckPreferencesBackup(Profile* profile) {
ProtectorService* protector_service =
ProtectorServiceFactory::GetForProfile(profile);
ProtectedPrefsWatcher* prefs_watcher = protector_service->GetPrefsWatcher();
@@ -1083,7 +1074,7 @@ void StartupBrowserCreator::LaunchWithProfile::CheckPreferencesBackup(
}
}
-std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine(
+std::vector<GURL> BrowserInit::GetURLsFromCommandLine(
const CommandLine& command_line,
const FilePath& cur_dir,
Profile* profile) {
@@ -1148,14 +1139,14 @@ std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine(
return urls;
}
-bool StartupBrowserCreator::ProcessCmdLineImpl(
+bool BrowserInit::ProcessCmdLineImpl(
const CommandLine& command_line,
const FilePath& cur_dir,
bool process_startup,
Profile* last_used_profile,
const Profiles& last_opened_profiles,
int* return_code,
- StartupBrowserCreator* browser_creator) {
+ BrowserInit* browser_init) {
DCHECK(last_used_profile);
if (process_startup) {
if (command_line.HasSwitch(switches::kDisablePromptOnRepost))
@@ -1307,11 +1298,9 @@ bool StartupBrowserCreator::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_creator->LaunchBrowser(command_line, last_used_profile,
- cur_dir, is_process_startup,
- is_first_run, return_code)) {
+ if (!browser_init->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.
@@ -1334,12 +1323,12 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
startup_pref.type == SessionStartupPref::DEFAULT &&
!HasPendingUncleanExit(*it))
continue;
- if (!browser_creator->LaunchBrowser((*it == last_used_profile) ?
+ if (!browser_init->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 = StartupBrowserCreator::IS_NOT_PROCESS_STARTUP;
+ is_process_startup = BrowserInit::IS_NOT_PROCESS_STARTUP;
}
}
}
@@ -1347,10 +1336,9 @@ bool StartupBrowserCreator::ProcessCmdLineImpl(
}
template <class AutomationProviderClass>
-bool StartupBrowserCreator::CreateAutomationProvider(
- const std::string& channel_id,
- Profile* profile,
- size_t expected_tabs) {
+bool BrowserInit::CreateAutomationProvider(const std::string& channel_id,
+ Profile* profile,
+ size_t expected_tabs) {
#if defined(ENABLE_AUTOMATION)
scoped_refptr<AutomationProviderClass> automation =
new AutomationProviderClass(profile);
@@ -1367,7 +1355,7 @@ bool StartupBrowserCreator::CreateAutomationProvider(
}
// static
-void StartupBrowserCreator::ProcessCommandLineOnProfileCreated(
+void BrowserInit::ProcessCommandLineOnProfileCreated(
const CommandLine& cmd_line,
const FilePath& cur_dir,
Profile* profile,
@@ -1378,15 +1366,14 @@ void StartupBrowserCreator::ProcessCommandLineOnProfileCreated(
}
// static
-void StartupBrowserCreator::ProcessCommandLineAlreadyRunning(
- const CommandLine& cmd_line,
- const FilePath& cur_dir) {
+void BrowserInit::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(&StartupBrowserCreator::ProcessCommandLineOnProfileCreated,
+ base::Bind(&BrowserInit::ProcessCommandLineOnProfileCreated,
cmd_line, cur_dir));
return;
}
diff --git a/chrome/browser/ui/startup/startup_browser_creator.h b/chrome/browser/ui/browser_init.h
index 88cc3fa..5b90bfa 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.h
+++ b/chrome/browser/ui/browser_init.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_STARTUP_STARTUP_BROWSER_CREATOR_H_
-#define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_
+#ifndef CHROME_BROWSER_UI_BROWSER_INIT_H_
+#define CHROME_BROWSER_UI_BROWSER_INIT_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 StartupBrowserCreator {
+class BrowserInit {
public:
typedef std::vector<Profile*> Profiles;
@@ -37,8 +37,8 @@ class StartupBrowserCreator {
IS_FIRST_RUN
};
- StartupBrowserCreator();
- ~StartupBrowserCreator();
+ BrowserInit();
+ ~BrowserInit();
// Adds a url to be opened during first run. This overrides the standard
// tabs shown at first run.
@@ -117,7 +117,7 @@ class StartupBrowserCreator {
std::string app_id;
};
- // There are two ctors. The first one implies a NULL browser_creator object
+ // There are two ctors. The first one implies a NULL browser_init 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 StartupBrowserCreator {
IsFirstRun is_first_run);
LaunchWithProfile(const FilePath& cur_dir,
const CommandLine& command_line,
- StartupBrowserCreator* browser_creator,
+ BrowserInit* browser_init,
IsFirstRun is_first_run);
~LaunchWithProfile();
@@ -221,7 +221,7 @@ class StartupBrowserCreator {
const FilePath cur_dir_;
const CommandLine& command_line_;
Profile* profile_;
- StartupBrowserCreator* browser_creator_;
+ BrowserInit* browser_init_;
bool is_first_run_;
DISALLOW_COPY_AND_ASSIGN(LaunchWithProfile);
};
@@ -229,11 +229,10 @@ class StartupBrowserCreator {
private:
friend class CloudPrintProxyPolicyTest;
friend class CloudPrintProxyPolicyStartupTest;
- FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
+ FRIEND_TEST_ALL_PREFIXES(BrowserInitTest,
ReadingWasRestartedAfterNormalStart);
- FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
- ReadingWasRestartedAfterRestart);
- FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, UpdateWithTwoProfiles);
+ FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, ReadingWasRestartedAfterRestart);
+ FRIEND_TEST_ALL_PREFIXES(BrowserInitTest, 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.
@@ -248,7 +247,7 @@ class StartupBrowserCreator {
Profile* last_used_profile,
const Profiles& last_opened_profiles,
int* return_code,
- StartupBrowserCreator* browser_creator);
+ BrowserInit* browser_init);
// Callback after a profile has been created.
static void ProcessCommandLineOnProfileCreated(
@@ -265,7 +264,7 @@ class StartupBrowserCreator {
// of testing.)
static bool was_restarted_read_;
- DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreator);
+ DISALLOW_COPY_AND_ASSIGN(BrowserInit);
};
-#endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_
+#endif // CHROME_BROWSER_UI_BROWSER_INIT_H_
diff --git a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc b/chrome/browser/ui/browser_init_browsertest.cc
index 7adb270..4a09805 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_browsertest.cc
+++ b/chrome/browser/ui/browser_init_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 StartupBrowserCreatorTest : public ExtensionBrowserTest {
+class BrowserInitTest : 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
-// StartupBrowserCreator::LaunchWithProfile::OpenURLsInBrowser don't crash
-// because there's no explicit profile given.
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) {
+// BrowserInit::LaunchWithProfile::OpenURLsInBrowser don't crash because
+// there's no explicit profile given.
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenURLsPopup) {
std::vector<GURL> urls;
urls.push_back(GURL("http://localhost"));
@@ -129,10 +129,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenURLsPopup) {
ASSERT_EQ(popup, observer.added_browser_);
CommandLine dummy(CommandLine::NO_PROGRAM);
- StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- StartupBrowserCreator::IS_FIRST_RUN :
- StartupBrowserCreator::IS_NOT_FIRST_RUN;
- StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
+ BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
+ BrowserInit::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);
@@ -147,7 +146,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, 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(StartupBrowserCreatorTest,
+IN_PROC_BROWSER_TEST_F(BrowserInitTest,
StartupURLsOnNewWindowWithNoTabbedBrowsers) {
// Use a couple same-site HTTP URLs.
ASSERT_TRUE(test_server()->Start());
@@ -165,10 +164,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
// Do a simple non-process-startup browser launch.
CommandLine dummy(CommandLine::NO_PROGRAM);
- StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- StartupBrowserCreator::IS_FIRST_RUN :
- StartupBrowserCreator::IS_NOT_FIRST_RUN;
- StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
+ BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
+ BrowserInit::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
@@ -191,7 +189,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
// 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(StartupBrowserCreatorTest,
+IN_PROC_BROWSER_TEST_F(BrowserInitTest,
StartupURLsOnNewWindow) {
// Use a couple arbitrary URLs.
std::vector<GURL> urls;
@@ -209,10 +207,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
// Do a simple non-process-startup browser launch.
CommandLine dummy(CommandLine::NO_PROGRAM);
- StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- StartupBrowserCreator::IS_FIRST_RUN :
- StartupBrowserCreator::IS_NOT_FIRST_RUN;
- StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run);
+ BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
+ BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run);
ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), false));
// This should have created a new browser window.
@@ -225,7 +222,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
// App shortcuts are not implemented on mac os.
#if !defined(OS_MACOSX)
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) {
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutNoPref) {
// Load an app with launch.container = 'tab'.
const Extension* extension_app = NULL;
ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
@@ -234,11 +231,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) {
CommandLine command_line(CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- StartupBrowserCreator::IS_FIRST_RUN :
- StartupBrowserCreator::IS_NOT_FIRST_RUN;
- StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
- first_run);
+ BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
+ BrowserInit::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.
@@ -255,7 +250,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutNoPref) {
std::string::npos) << new_browser->app_name_;
}
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) {
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutWindowPref) {
const Extension* extension_app = NULL;
ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
@@ -264,11 +259,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) {
CommandLine command_line(CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- StartupBrowserCreator::IS_FIRST_RUN :
- StartupBrowserCreator::IS_NOT_FIRST_RUN;
- StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
- first_run);
+ BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
+ BrowserInit::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
@@ -286,7 +279,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutWindowPref) {
std::string::npos) << new_browser->app_name_;
}
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) {
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenAppShortcutTabPref) {
// Load an app with launch.container = 'tab'.
const Extension* extension_app = NULL;
ASSERT_NO_FATAL_FAILURE(LoadApp("app_with_tab_container", &extension_app));
@@ -296,11 +289,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) {
CommandLine command_line(CommandLine::NO_PROGRAM);
command_line.AppendSwitchASCII(switches::kAppId, extension_app->id());
- StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- StartupBrowserCreator::IS_FIRST_RUN :
- StartupBrowserCreator::IS_NOT_FIRST_RUN;
- StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
- first_run);
+ BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
+ BrowserInit::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
@@ -320,18 +311,16 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutTabPref) {
std::string::npos) << new_browser->app_name_;
}
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutPanel) {
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, 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());
- StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
- StartupBrowserCreator::IS_FIRST_RUN :
- StartupBrowserCreator::IS_NOT_FIRST_RUN;
- StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line,
- first_run);
+ BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ?
+ BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN;
+ BrowserInit::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.
@@ -351,32 +340,30 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, OpenAppShortcutPanel) {
#endif // !defined(OS_CHROMEOS)
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
- ReadingWasRestartedAfterRestart) {
- // Tests that StartupBrowserCreator::WasRestarted reads and resets the
- // preference kWasRestarted correctly.
- StartupBrowserCreator::was_restarted_read_ = false;
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterRestart) {
+ // Tests that BrowserInit::WasRestarted reads and resets the preference
+ // kWasRestarted correctly.
+ BrowserInit::was_restarted_read_ = false;
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kWasRestarted, true);
- EXPECT_TRUE(StartupBrowserCreator::WasRestarted());
+ EXPECT_TRUE(BrowserInit::WasRestarted());
EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted));
- EXPECT_TRUE(StartupBrowserCreator::WasRestarted());
+ EXPECT_TRUE(BrowserInit::WasRestarted());
}
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
- ReadingWasRestartedAfterNormalStart) {
- // Tests that StartupBrowserCreator::WasRestarted reads and resets the
- // preference kWasRestarted correctly.
- StartupBrowserCreator::was_restarted_read_ = false;
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, ReadingWasRestartedAfterNormalStart) {
+ // Tests that BrowserInit::WasRestarted reads and resets the preference
+ // kWasRestarted correctly.
+ BrowserInit::was_restarted_read_ = false;
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kWasRestarted, false);
- EXPECT_FALSE(StartupBrowserCreator::WasRestarted());
+ EXPECT_FALSE(BrowserInit::WasRestarted());
EXPECT_FALSE(pref_service->GetBoolean(prefs::kWasRestarted));
- EXPECT_FALSE(StartupBrowserCreator::WasRestarted());
+ EXPECT_FALSE(BrowserInit::WasRestarted());
}
#if !defined(OS_CHROMEOS)
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) {
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, StartupURLsForTwoProfiles) {
Profile* default_profile = browser()->profile();
ProfileManager* profile_manager = g_browser_process->profile_manager();
@@ -412,12 +399,12 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) {
CommandLine dummy(CommandLine::NO_PROGRAM);
int return_code;
- StartupBrowserCreator browser_creator;
+ BrowserInit browser_init;
std::vector<Profile*> last_opened_profiles;
last_opened_profiles.push_back(default_profile);
last_opened_profiles.push_back(other_profile);
- browser_creator.Start(dummy, profile_manager->user_data_dir(),
- default_profile, last_opened_profiles, &return_code);
+ browser_init.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.
@@ -437,9 +424,9 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, StartupURLsForTwoProfiles) {
EXPECT_EQ(urls2[0], new_browser->GetWebContentsAt(0)->GetURL());
}
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) {
- // Make StartupBrowserCreator::WasRestarted() return true.
- StartupBrowserCreator::was_restarted_read_ = false;
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, UpdateWithTwoProfiles) {
+ // Make BrowserInit::WasRestarted() return true.
+ BrowserInit::was_restarted_read_ = false;
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kWasRestarted, true);
@@ -477,12 +464,12 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) {
// Simulate a launch after a browser update.
CommandLine dummy(CommandLine::NO_PROGRAM);
int return_code;
- StartupBrowserCreator browser_creator;
+ BrowserInit browser_init;
std::vector<Profile*> last_opened_profiles;
last_opened_profiles.push_back(profile1);
last_opened_profiles.push_back(profile2);
- browser_creator.Start(dummy, profile_manager->user_data_dir(), profile1,
- last_opened_profiles, &return_code);
+ browser_init.Start(dummy, profile_manager->user_data_dir(), profile1,
+ last_opened_profiles, &return_code);
while (SessionRestore::IsRestoring(profile1) ||
SessionRestore::IsRestoring(profile2))
@@ -509,8 +496,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, UpdateWithTwoProfiles) {
new_browser->GetWebContentsAt(0)->GetURL());
}
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
- ProfilesWithoutPagesNotLaunched) {
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, ProfilesWithoutPagesNotLaunched) {
Profile* default_profile = browser()->profile();
ProfileManager* profile_manager = g_browser_process->profile_manager();
@@ -559,14 +545,14 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
CommandLine dummy(CommandLine::NO_PROGRAM);
int return_code;
- StartupBrowserCreator browser_creator;
+ BrowserInit browser_init;
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_creator.Start(dummy, profile_manager->user_data_dir(), profile_home1,
- last_opened_profiles, &return_code);
+ browser_init.Start(dummy, profile_manager->user_data_dir(), profile_home1,
+ last_opened_profiles, &return_code);
while (SessionRestore::IsRestoring(default_profile) ||
@@ -605,7 +591,7 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest,
ASSERT_EQ(0u, BrowserList::GetBrowserCount(profile_home2));
}
-IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
+IN_PROC_BROWSER_TEST_F(BrowserInitTest, ProfilesLaunchedAfterCrash) {
// After an unclean exit, all profiles will be launched. However, they won't
// open any pages automatically.
@@ -650,13 +636,13 @@ IN_PROC_BROWSER_TEST_F(StartupBrowserCreatorTest, ProfilesLaunchedAfterCrash) {
CommandLine dummy(CommandLine::NO_PROGRAM);
int return_code;
- StartupBrowserCreator browser_creator;
+ BrowserInit browser_init;
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_creator.Start(dummy, profile_manager->user_data_dir(), profile_home,
- last_opened_profiles, &return_code);
+ browser_init.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/startup/startup_browser_creator_win.cc b/chrome/browser/ui/browser_init_win.cc
index efd1429..20e124e 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_win.cc
+++ b/chrome/browser/ui/browser_init_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/startup/startup_browser_creator_win.h"
+#include "chrome/browser/ui/browser_init_win.h"
#include "base/logging.h"
#include "base/win/metro.h"
diff --git a/chrome/browser/ui/startup/startup_browser_creator_win.h b/chrome/browser/ui/browser_init_win.h
index 25395ae5..a208c3b 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_win.h
+++ b/chrome/browser/ui/browser_init_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_STARTUP_STARTUP_BROWSER_CREATOR_WIN_H_
-#define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_WIN_H_
+#ifndef CHROME_BROWSER_UI_BROWSER_INIT_WIN_H_
+#define CHROME_BROWSER_UI_BROWSER_INIT_WIN_H_
#pragma once
#include "base/basictypes.h"
@@ -13,12 +13,10 @@
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_STARTUP_STARTUP_BROWSER_CREATOR_WIN_H_
+#endif // CHROME_BROWSER_UI_BROWSER_INIT_WIN_H_
diff --git a/chrome/browser/ui/panels/panel_app_browsertest.cc b/chrome/browser/ui/panels/panel_app_browsertest.cc
index 541aef5..d658d72 100644
--- a/chrome/browser/ui/panels/panel_app_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_app_browsertest.cc
@@ -8,6 +8,7 @@
#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/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 4530e7b..bdad54c 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -2297,6 +2297,10 @@
'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',
@@ -3162,10 +3166,6 @@
'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 c4b79b5..e58af95 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -2872,6 +2872,7 @@
'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',
@@ -2889,7 +2890,6 @@
'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',