| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 5 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 6 | 6 |
| 7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 #include "grit/locale_settings.h" | 64 #include "grit/locale_settings.h" |
| 65 #include "net/base/net_util.h" | 65 #include "net/base/net_util.h" |
| 66 #include "ui/base/l10n/l10n_util.h" | 66 #include "ui/base/l10n/l10n_util.h" |
| 67 #include "ui/base/resource/resource_bundle.h" | 67 #include "ui/base/resource/resource_bundle.h" |
| 68 | 68 |
| 69 #if defined(OS_CHROMEOS) | 69 #if defined(OS_CHROMEOS) |
| 70 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" | 70 #include "chrome/browser/chromeos/app_mode/startup_app_launcher.h" |
| 71 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 71 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
| 72 #include "chrome/browser/chromeos/login/user_manager.h" | 72 #include "chrome/browser/chromeos/login/user_manager.h" |
| 73 #include "chrome/browser/chromeos/profile_startup.h" | 73 #include "chrome/browser/chromeos/profile_startup.h" |
| 74 #include "chromeos/chromeos_switches.h" | |
| 75 #endif | 74 #endif |
| 76 | 75 |
| 77 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) | 76 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) |
| 78 #include "ui/base/touch/touch_factory_x11.h" | 77 #include "ui/base/touch/touch_factory_x11.h" |
| 79 #endif | 78 #endif |
| 80 | 79 |
| 81 #if defined(OS_WIN) | 80 #if defined(OS_WIN) |
| 82 #include "chrome/browser/automation/chrome_frame_automation_provider_win.h" | 81 #include "chrome/browser/automation/chrome_frame_automation_provider_win.h" |
| 83 #include "chrome/browser/ui/startup/startup_browser_creator_win.h" | 82 #include "chrome/browser/ui/startup/startup_browser_creator_win.h" |
| 84 #endif | 83 #endif |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // compatibility with the old testing code | 449 // compatibility with the old testing code |
| 451 // If there are any extra parameters, we expect each one to generate a | 450 // If there are any extra parameters, we expect each one to generate a |
| 452 // new tab; if there are none then we get one homepage tab. | 451 // new tab; if there are none then we get one homepage tab. |
| 453 int expected_tab_count = 1; | 452 int expected_tab_count = 1; |
| 454 if (command_line.HasSwitch(switches::kNoStartupWindow) && | 453 if (command_line.HasSwitch(switches::kNoStartupWindow) && |
| 455 !command_line.HasSwitch(switches::kAutoLaunchAtStartup)) { | 454 !command_line.HasSwitch(switches::kAutoLaunchAtStartup)) { |
| 456 expected_tab_count = 0; | 455 expected_tab_count = 0; |
| 457 #if defined(OS_CHROMEOS) | 456 #if defined(OS_CHROMEOS) |
| 458 // kLoginManager will cause Chrome to start up with the ChromeOS login | 457 // kLoginManager will cause Chrome to start up with the ChromeOS login |
| 459 // screen instead of a browser window, so it won't load any tabs. | 458 // screen instead of a browser window, so it won't load any tabs. |
| 460 } else if (command_line.HasSwitch(chromeos::switches::kLoginManager)) { | 459 } else if (command_line.HasSwitch(switches::kLoginManager)) { |
| 461 expected_tab_count = 0; | 460 expected_tab_count = 0; |
| 462 #endif | 461 #endif |
| 463 } else if (command_line.HasSwitch(switches::kRestoreLastSession)) { | 462 } else if (command_line.HasSwitch(switches::kRestoreLastSession)) { |
| 464 std::string restore_session_value( | 463 std::string restore_session_value( |
| 465 command_line.GetSwitchValueASCII(switches::kRestoreLastSession)); | 464 command_line.GetSwitchValueASCII(switches::kRestoreLastSession)); |
| 466 base::StringToInt(restore_session_value, &expected_tab_count); | 465 base::StringToInt(restore_session_value, &expected_tab_count); |
| 467 } else { | 466 } else { |
| 468 std::vector<GURL> urls_to_open = GetURLsFromCommandLine( | 467 std::vector<GURL> urls_to_open = GetURLsFromCommandLine( |
| 469 command_line, cur_dir, last_used_profile); | 468 command_line, cur_dir, last_used_profile); |
| 470 expected_tab_count = | 469 expected_tab_count = |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 } | 561 } |
| 563 | 562 |
| 564 if (command_line.HasSwitch(switches::kLimitedInstallFromWebstore)) { | 563 if (command_line.HasSwitch(switches::kLimitedInstallFromWebstore)) { |
| 565 extensions::StartupHelper helper; | 564 extensions::StartupHelper helper; |
| 566 helper.LimitedInstallFromWebstore(command_line, last_used_profile, | 565 helper.LimitedInstallFromWebstore(command_line, last_used_profile, |
| 567 base::Bind(&base::DoNothing)); | 566 base::Bind(&base::DoNothing)); |
| 568 } | 567 } |
| 569 | 568 |
| 570 #if defined(OS_CHROMEOS) | 569 #if defined(OS_CHROMEOS) |
| 571 // The browser will be launched after the user logs in. | 570 // The browser will be launched after the user logs in. |
| 572 if (command_line.HasSwitch(chromeos::switches::kLoginManager) || | 571 if (command_line.HasSwitch(switches::kLoginManager) || |
| 573 command_line.HasSwitch(chromeos::switches::kLoginPassword)) { | 572 command_line.HasSwitch(switches::kLoginPassword)) { |
| 574 silent_launch = true; | 573 silent_launch = true; |
| 575 } | 574 } |
| 576 | 575 |
| 577 if (chrome::IsRunningInAppMode() && | 576 if (chrome::IsRunningInAppMode() && |
| 578 command_line.HasSwitch(switches::kAppId)) { | 577 command_line.HasSwitch(switches::kAppId)) { |
| 579 // StartupAppLauncher deletes itself when done. | 578 // StartupAppLauncher deletes itself when done. |
| 580 (new chromeos::StartupAppLauncher( | 579 (new chromeos::StartupAppLauncher( |
| 581 last_used_profile, | 580 last_used_profile, |
| 582 command_line.GetSwitchValueASCII(switches::kAppId)))->Start(); | 581 command_line.GetSwitchValueASCII(switches::kAppId)))->Start(); |
| 583 | 582 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 720 |
| 722 // static | 721 // static |
| 723 bool StartupBrowserCreator::ActivatedProfile() { | 722 bool StartupBrowserCreator::ActivatedProfile() { |
| 724 return profile_launch_observer.Get().activated_profile(); | 723 return profile_launch_observer.Get().activated_profile(); |
| 725 } | 724 } |
| 726 | 725 |
| 727 bool HasPendingUncleanExit(Profile* profile) { | 726 bool HasPendingUncleanExit(Profile* profile) { |
| 728 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && | 727 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && |
| 729 !profile_launch_observer.Get().HasBeenLaunched(profile); | 728 !profile_launch_observer.Get().HasBeenLaunched(profile); |
| 730 } | 729 } |
| OLD | NEW |