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" |
74 #endif | 75 #endif |
75 | 76 |
76 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) | 77 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) |
77 #include "ui/base/touch/touch_factory_x11.h" | 78 #include "ui/base/touch/touch_factory_x11.h" |
78 #endif | 79 #endif |
79 | 80 |
80 #if defined(OS_WIN) | 81 #if defined(OS_WIN) |
81 #include "chrome/browser/automation/chrome_frame_automation_provider_win.h" | 82 #include "chrome/browser/automation/chrome_frame_automation_provider_win.h" |
82 #include "chrome/browser/ui/startup/startup_browser_creator_win.h" | 83 #include "chrome/browser/ui/startup/startup_browser_creator_win.h" |
83 #endif | 84 #endif |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 // compatibility with the old testing code | 450 // compatibility with the old testing code |
450 // If there are any extra parameters, we expect each one to generate a | 451 // If there are any extra parameters, we expect each one to generate a |
451 // new tab; if there are none then we get one homepage tab. | 452 // new tab; if there are none then we get one homepage tab. |
452 int expected_tab_count = 1; | 453 int expected_tab_count = 1; |
453 if (command_line.HasSwitch(switches::kNoStartupWindow) && | 454 if (command_line.HasSwitch(switches::kNoStartupWindow) && |
454 !command_line.HasSwitch(switches::kAutoLaunchAtStartup)) { | 455 !command_line.HasSwitch(switches::kAutoLaunchAtStartup)) { |
455 expected_tab_count = 0; | 456 expected_tab_count = 0; |
456 #if defined(OS_CHROMEOS) | 457 #if defined(OS_CHROMEOS) |
457 // kLoginManager will cause Chrome to start up with the ChromeOS login | 458 // kLoginManager will cause Chrome to start up with the ChromeOS login |
458 // screen instead of a browser window, so it won't load any tabs. | 459 // screen instead of a browser window, so it won't load any tabs. |
459 } else if (command_line.HasSwitch(switches::kLoginManager)) { | 460 } else if (command_line.HasSwitch(chromeos::switches::kLoginManager)) { |
460 expected_tab_count = 0; | 461 expected_tab_count = 0; |
461 #endif | 462 #endif |
462 } else if (command_line.HasSwitch(switches::kRestoreLastSession)) { | 463 } else if (command_line.HasSwitch(switches::kRestoreLastSession)) { |
463 std::string restore_session_value( | 464 std::string restore_session_value( |
464 command_line.GetSwitchValueASCII(switches::kRestoreLastSession)); | 465 command_line.GetSwitchValueASCII(switches::kRestoreLastSession)); |
465 base::StringToInt(restore_session_value, &expected_tab_count); | 466 base::StringToInt(restore_session_value, &expected_tab_count); |
466 } else { | 467 } else { |
467 std::vector<GURL> urls_to_open = GetURLsFromCommandLine( | 468 std::vector<GURL> urls_to_open = GetURLsFromCommandLine( |
468 command_line, cur_dir, last_used_profile); | 469 command_line, cur_dir, last_used_profile); |
469 expected_tab_count = | 470 expected_tab_count = |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 } | 562 } |
562 | 563 |
563 if (command_line.HasSwitch(switches::kLimitedInstallFromWebstore)) { | 564 if (command_line.HasSwitch(switches::kLimitedInstallFromWebstore)) { |
564 extensions::StartupHelper helper; | 565 extensions::StartupHelper helper; |
565 helper.LimitedInstallFromWebstore(command_line, last_used_profile, | 566 helper.LimitedInstallFromWebstore(command_line, last_used_profile, |
566 base::Bind(&base::DoNothing)); | 567 base::Bind(&base::DoNothing)); |
567 } | 568 } |
568 | 569 |
569 #if defined(OS_CHROMEOS) | 570 #if defined(OS_CHROMEOS) |
570 // The browser will be launched after the user logs in. | 571 // The browser will be launched after the user logs in. |
571 if (command_line.HasSwitch(switches::kLoginManager) || | 572 if (command_line.HasSwitch(chromeos::switches::kLoginManager) || |
572 command_line.HasSwitch(switches::kLoginPassword)) { | 573 command_line.HasSwitch(chromeos::switches::kLoginPassword)) { |
573 silent_launch = true; | 574 silent_launch = true; |
574 } | 575 } |
575 | 576 |
576 if (chrome::IsRunningInAppMode() && | 577 if (chrome::IsRunningInAppMode() && |
577 command_line.HasSwitch(switches::kAppId)) { | 578 command_line.HasSwitch(switches::kAppId)) { |
578 // StartupAppLauncher deletes itself when done. | 579 // StartupAppLauncher deletes itself when done. |
579 (new chromeos::StartupAppLauncher( | 580 (new chromeos::StartupAppLauncher( |
580 last_used_profile, | 581 last_used_profile, |
581 command_line.GetSwitchValueASCII(switches::kAppId)))->Start(); | 582 command_line.GetSwitchValueASCII(switches::kAppId)))->Start(); |
582 | 583 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 | 721 |
721 // static | 722 // static |
722 bool StartupBrowserCreator::ActivatedProfile() { | 723 bool StartupBrowserCreator::ActivatedProfile() { |
723 return profile_launch_observer.Get().activated_profile(); | 724 return profile_launch_observer.Get().activated_profile(); |
724 } | 725 } |
725 | 726 |
726 bool HasPendingUncleanExit(Profile* profile) { | 727 bool HasPendingUncleanExit(Profile* profile) { |
727 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && | 728 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && |
728 !profile_launch_observer.Get().HasBeenLaunched(profile); | 729 !profile_launch_observer.Get().HasBeenLaunched(profile); |
729 } | 730 } |
OLD | NEW |