| 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_macros.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_registry_simple.h" |
| 24 #include "base/prefs/pref_service.h" | 25 #include "base/prefs/pref_service.h" |
| 25 #include "base/profiler/scoped_profile.h" | 26 #include "base/profiler/scoped_profile.h" |
| 26 #include "base/strings/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
| 27 #include "base/strings/string_split.h" | 28 #include "base/strings/string_split.h" |
| 28 #include "base/strings/string_tokenizer.h" | 29 #include "base/strings/string_tokenizer.h" |
| 29 #include "base/strings/utf_string_conversions.h" | 30 #include "base/strings/utf_string_conversions.h" |
| 30 #include "base/threading/thread_restrictions.h" | 31 #include "base/threading/thread_restrictions.h" |
| 31 #include "base/trace_event/trace_event.h" | 32 #include "base/trace_event/trace_event.h" |
| 32 #include "chrome/browser/app_mode/app_mode_utils.h" | 33 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 33 #include "chrome/browser/auto_launch_trial.h" | 34 #include "chrome/browser/auto_launch_trial.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 } | 425 } |
| 425 | 426 |
| 426 return pref; | 427 return pref; |
| 427 } | 428 } |
| 428 | 429 |
| 429 // static | 430 // static |
| 430 void StartupBrowserCreator::ClearLaunchedProfilesForTesting() { | 431 void StartupBrowserCreator::ClearLaunchedProfilesForTesting() { |
| 431 profile_launch_observer.Get().Clear(); | 432 profile_launch_observer.Get().Clear(); |
| 432 } | 433 } |
| 433 | 434 |
| 435 #if defined(OS_WIN) |
| 436 // static |
| 437 void StartupBrowserCreator::RegisterLocalStatePrefs( |
| 438 PrefRegistrySimple* registry) { |
| 439 registry->RegisterStringPref(prefs::kLastWelcomedOSVersion, std::string()); |
| 440 registry->RegisterBooleanPref(prefs::kWelcomePageOnOSUpgradeEnabled, true); |
| 441 } |
| 442 #endif |
| 443 |
| 434 // static | 444 // static |
| 435 std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine( | 445 std::vector<GURL> StartupBrowserCreator::GetURLsFromCommandLine( |
| 436 const base::CommandLine& command_line, | 446 const base::CommandLine& command_line, |
| 437 const base::FilePath& cur_dir, | 447 const base::FilePath& cur_dir, |
| 438 Profile* profile) { | 448 Profile* profile) { |
| 439 std::vector<GURL> urls; | 449 std::vector<GURL> urls; |
| 440 | 450 |
| 441 const base::CommandLine::StringVector& params = command_line.GetArgs(); | 451 const base::CommandLine::StringVector& params = command_line.GetArgs(); |
| 442 for (size_t i = 0; i < params.size(); ++i) { | 452 for (size_t i = 0; i < params.size(); ++i) { |
| 443 base::FilePath param = base::FilePath(params[i]); | 453 base::FilePath param = base::FilePath(params[i]); |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 // If we are showing the app list then chrome isn't shown so load the app | 860 // If we are showing the app list then chrome isn't shown so load the app |
| 851 // list's profile rather than chrome's. | 861 // list's profile rather than chrome's. |
| 852 if (command_line.HasSwitch(switches::kShowAppList)) { | 862 if (command_line.HasSwitch(switches::kShowAppList)) { |
| 853 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> | 863 return AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)-> |
| 854 GetProfilePath(user_data_dir); | 864 GetProfilePath(user_data_dir); |
| 855 } | 865 } |
| 856 | 866 |
| 857 return g_browser_process->profile_manager()->GetLastUsedProfileDir( | 867 return g_browser_process->profile_manager()->GetLastUsedProfileDir( |
| 858 user_data_dir); | 868 user_data_dir); |
| 859 } | 869 } |
| OLD | NEW |