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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/environment.h" | 14 #include "base/environment.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
19 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/prefs/pref_service.h" | 21 #include "base/prefs/pref_service.h" |
22 #include "base/string_split.h" | 22 #include "base/string_split.h" |
23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
24 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
25 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
26 #include "chrome/browser/app_mode/app_mode_utils.h" | 26 #include "chrome/browser/app_mode/app_mode_utils.h" |
27 #include "chrome/browser/auto_launch_trial.h" | 27 #include "chrome/browser/auto_launch_trial.h" |
28 #include "chrome/browser/automation/automation_provider.h" | 28 #include "chrome/browser/automation/automation_provider.h" |
29 #include "chrome/browser/automation/automation_provider_list.h" | 29 #include "chrome/browser/automation/automation_provider_list.h" |
30 #include "chrome/browser/automation/chrome_frame_automation_provider.h" | |
31 #include "chrome/browser/automation/testing_automation_provider.h" | 30 #include "chrome/browser/automation/testing_automation_provider.h" |
32 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
33 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 32 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
34 #include "chrome/browser/extensions/startup_helper.h" | 33 #include "chrome/browser/extensions/startup_helper.h" |
35 #include "chrome/browser/extensions/unpacked_installer.h" | 34 #include "chrome/browser/extensions/unpacked_installer.h" |
36 #include "chrome/browser/first_run/first_run.h" | 35 #include "chrome/browser/first_run/first_run.h" |
37 #include "chrome/browser/google/google_util.h" | 36 #include "chrome/browser/google/google_util.h" |
38 #include "chrome/browser/net/url_fixer_upper.h" | 37 #include "chrome/browser/net/url_fixer_upper.h" |
39 #include "chrome/browser/notifications/desktop_notification_service.h" | 38 #include "chrome/browser/notifications/desktop_notification_service.h" |
40 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 39 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
(...skipping 30 matching lines...) Expand all Loading... |
71 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 70 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
72 #include "chrome/browser/chromeos/login/user_manager.h" | 71 #include "chrome/browser/chromeos/login/user_manager.h" |
73 #include "chrome/browser/chromeos/profile_startup.h" | 72 #include "chrome/browser/chromeos/profile_startup.h" |
74 #endif | 73 #endif |
75 | 74 |
76 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) | 75 #if defined(TOOLKIT_VIEWS) && defined(OS_LINUX) |
77 #include "ui/base/touch/touch_factory.h" | 76 #include "ui/base/touch/touch_factory.h" |
78 #endif | 77 #endif |
79 | 78 |
80 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| 80 #include "chrome/browser/automation/chrome_frame_automation_provider_win.h" |
81 #include "chrome/browser/ui/startup/startup_browser_creator_win.h" | 81 #include "chrome/browser/ui/startup/startup_browser_creator_win.h" |
82 #endif | 82 #endif |
83 | 83 |
84 using content::BrowserThread; | 84 using content::BrowserThread; |
85 using content::ChildProcessSecurityPolicy; | 85 using content::ChildProcessSecurityPolicy; |
86 | 86 |
87 namespace { | 87 namespace { |
88 | 88 |
89 // Keeps track on which profiles have been launched. | 89 // Keeps track on which profiles have been launched. |
90 class ProfileLaunchObserver : public content::NotificationObserver { | 90 class ProfileLaunchObserver : public content::NotificationObserver { |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 // If there are any extra parameters, we expect each one to generate a | 490 // If there are any extra parameters, we expect each one to generate a |
491 // new tab; if there are none then we have no tabs | 491 // new tab; if there are none then we have no tabs |
492 std::vector<GURL> urls_to_open = GetURLsFromCommandLine( | 492 std::vector<GURL> urls_to_open = GetURLsFromCommandLine( |
493 command_line, cur_dir, last_used_profile); | 493 command_line, cur_dir, last_used_profile); |
494 size_t expected_tabs = | 494 size_t expected_tabs = |
495 std::max(static_cast<int>(urls_to_open.size()), 0); | 495 std::max(static_cast<int>(urls_to_open.size()), 0); |
496 if (expected_tabs == 0) | 496 if (expected_tabs == 0) |
497 silent_launch = true; | 497 silent_launch = true; |
498 | 498 |
499 if (command_line.HasSwitch(switches::kChromeFrame)) { | 499 if (command_line.HasSwitch(switches::kChromeFrame)) { |
500 #if !defined(USE_AURA) | 500 #if defined(OS_WIN) |
501 if (!CreateAutomationProvider<ChromeFrameAutomationProvider>( | 501 if (!CreateAutomationProvider<ChromeFrameAutomationProvider>( |
502 automation_channel_id, last_used_profile, expected_tabs)) | 502 automation_channel_id, last_used_profile, expected_tabs)) |
503 return false; | 503 return false; |
504 #endif | 504 #endif |
505 } else { | 505 } else { |
506 if (!CreateAutomationProvider<AutomationProvider>( | 506 if (!CreateAutomationProvider<AutomationProvider>( |
507 automation_channel_id, last_used_profile, expected_tabs)) | 507 automation_channel_id, last_used_profile, expected_tabs)) |
508 return false; | 508 return false; |
509 } | 509 } |
510 } | 510 } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 | 710 |
711 // static | 711 // static |
712 bool StartupBrowserCreator::ActivatedProfile() { | 712 bool StartupBrowserCreator::ActivatedProfile() { |
713 return profile_launch_observer.Get().activated_profile(); | 713 return profile_launch_observer.Get().activated_profile(); |
714 } | 714 } |
715 | 715 |
716 bool HasPendingUncleanExit(Profile* profile) { | 716 bool HasPendingUncleanExit(Profile* profile) { |
717 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && | 717 return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && |
718 !profile_launch_observer.Get().HasBeenLaunched(profile); | 718 !profile_launch_observer.Get().HasBeenLaunched(profile); |
719 } | 719 } |
OLD | NEW |