| 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 "apps/app_load_service.h" | 10 #include "apps/app_load_service.h" |
| 11 #include "apps/switches.h" | 11 #include "apps/switches.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/environment.h" | 16 #include "base/environment.h" |
| 17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
| 18 #include "base/files/file_util.h" | 18 #include "base/files/file_util.h" |
| 19 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
| 20 #include "base/logging.h" | 20 #include "base/logging.h" |
| 21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 22 #include "base/metrics/histogram.h" | 22 #include "base/metrics/histogram_macros.h" |
| 23 #include "base/metrics/statistics_recorder.h" | 23 #include "base/metrics/statistics_recorder.h" |
| 24 #include "base/prefs/pref_service.h" | 24 #include "base/prefs/pref_service.h" |
| 25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 26 #include "base/strings/string_split.h" | 26 #include "base/strings/string_split.h" |
| 27 #include "base/strings/string_tokenizer.h" | 27 #include "base/strings/string_tokenizer.h" |
| 28 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| 29 #include "base/threading/thread_restrictions.h" | 29 #include "base/threading/thread_restrictions.h" |
| 30 #include "base/trace_event/trace_event.h" |
| 30 #include "chrome/browser/app_mode/app_mode_utils.h" | 31 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 31 #include "chrome/browser/auto_launch_trial.h" | 32 #include "chrome/browser/auto_launch_trial.h" |
| 32 #include "chrome/browser/browser_process.h" | 33 #include "chrome/browser/browser_process.h" |
| 33 #include "chrome/browser/chrome_notification_types.h" | 34 #include "chrome/browser/chrome_notification_types.h" |
| 34 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 35 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 35 #include "chrome/browser/extensions/startup_helper.h" | 36 #include "chrome/browser/extensions/startup_helper.h" |
| 36 #include "chrome/browser/extensions/unpacked_installer.h" | 37 #include "chrome/browser/extensions/unpacked_installer.h" |
| 37 #include "chrome/browser/first_run/first_run.h" | 38 #include "chrome/browser/first_run/first_run.h" |
| 38 #include "chrome/browser/notifications/desktop_notification_service.h" | 39 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 39 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 40 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 } | 477 } |
| 477 | 478 |
| 478 // static | 479 // static |
| 479 bool StartupBrowserCreator::ProcessCmdLineImpl( | 480 bool StartupBrowserCreator::ProcessCmdLineImpl( |
| 480 const base::CommandLine& command_line, | 481 const base::CommandLine& command_line, |
| 481 const base::FilePath& cur_dir, | 482 const base::FilePath& cur_dir, |
| 482 bool process_startup, | 483 bool process_startup, |
| 483 Profile* last_used_profile, | 484 Profile* last_used_profile, |
| 484 const Profiles& last_opened_profiles, | 485 const Profiles& last_opened_profiles, |
| 485 StartupBrowserCreator* browser_creator) { | 486 StartupBrowserCreator* browser_creator) { |
| 487 TRACE_EVENT0("startup", "StartupBrowserCreator::ProcessCmdLineImpl"); |
| 488 SCOPED_UMA_HISTOGRAM_TIMER( |
| 489 "Startup.StartupBrowserCreatorProcessCmdLineImplTime"); |
| 490 |
| 486 VLOG(2) << "ProcessCmdLineImpl : BEGIN"; | 491 VLOG(2) << "ProcessCmdLineImpl : BEGIN"; |
| 487 DCHECK(last_used_profile); | 492 DCHECK(last_used_profile); |
| 488 if (process_startup) { | 493 if (process_startup) { |
| 489 if (command_line.HasSwitch(switches::kDisablePromptOnRepost)) | 494 if (command_line.HasSwitch(switches::kDisablePromptOnRepost)) |
| 490 content::NavigationController::DisablePromptOnRepost(); | 495 content::NavigationController::DisablePromptOnRepost(); |
| 491 } | 496 } |
| 492 | 497 |
| 493 bool silent_launch = false; | 498 bool silent_launch = false; |
| 494 | 499 |
| 495 #if defined(ENABLE_PRINT_PREVIEW) | 500 #if defined(ENABLE_PRINT_PREVIEW) |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 // If we are showing the app list then chrome isn't shown so load the app | 861 // If we are showing the app list then chrome isn't shown so load the app |
| 857 // list's profile rather than chrome's. | 862 // list's profile rather than chrome's. |
| 858 if (command_line.HasSwitch(switches::kShowAppList)) { | 863 if (command_line.HasSwitch(switches::kShowAppList)) { |
| 859 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | 864 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> |
| 860 GetProfilePath(user_data_dir); | 865 GetProfilePath(user_data_dir); |
| 861 } | 866 } |
| 862 | 867 |
| 863 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 868 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
| 864 user_data_dir); | 869 user_data_dir); |
| 865 } | 870 } |
| OLD | NEW |