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/first_run/first_run.h" | 5 #include "chrome/browser/first_run/first_run.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/extensions/updater/extension_updater.h" | 18 #include "chrome/browser/extensions/updater/extension_updater.h" |
19 #include "chrome/browser/first_run/first_run_dialog.h" | 19 #include "chrome/browser/first_run/first_run_dialog.h" |
20 #include "chrome/browser/first_run/first_run_import_observer.h" | 20 #include "chrome/browser/first_run/first_run_import_observer.h" |
21 #include "chrome/browser/first_run/first_run_internal.h" | 21 #include "chrome/browser/first_run/first_run_internal.h" |
22 #include "chrome/browser/google/google_util.h" | 22 #include "chrome/browser/google/google_util.h" |
23 #include "chrome/browser/importer/external_process_importer_host.h" | 23 #include "chrome/browser/importer/external_process_importer_host.h" |
24 #include "chrome/browser/importer/importer_host.h" | 24 #include "chrome/browser/importer/importer_host.h" |
25 #include "chrome/browser/importer/importer_list.h" | 25 #include "chrome/browser/importer/importer_list.h" |
26 #include "chrome/browser/importer/importer_progress_dialog.h" | 26 #include "chrome/browser/importer/importer_progress_dialog.h" |
27 #include "chrome/browser/importer/importer_progress_observer.h" | 27 #include "chrome/browser/importer/importer_progress_observer.h" |
28 #include "chrome/browser/prefs/pref_registry_simple.h" | 28 #include "chrome/browser/prefs/pref_registry_simple.h" |
| 29 #include "chrome/browser/prefs/pref_registry_syncable.h" |
29 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
30 #include "chrome/browser/process_singleton.h" | 31 #include "chrome/browser/process_singleton.h" |
31 #include "chrome/browser/profiles/profile_manager.h" | 32 #include "chrome/browser/profiles/profile_manager.h" |
32 #include "chrome/browser/search_engines/template_url_service.h" | 33 #include "chrome/browser/search_engines/template_url_service.h" |
33 #include "chrome/browser/search_engines/template_url_service_factory.h" | 34 #include "chrome/browser/search_engines/template_url_service_factory.h" |
34 #include "chrome/browser/shell_integration.h" | 35 #include "chrome/browser/shell_integration.h" |
35 #include "chrome/browser/ui/browser.h" | 36 #include "chrome/browser/ui/browser.h" |
36 #include "chrome/browser/ui/browser_finder.h" | 37 #include "chrome/browser/ui/browser_finder.h" |
37 #include "chrome/browser/ui/global_error/global_error_service.h" | 38 #include "chrome/browser/ui/global_error/global_error_service.h" |
38 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 39 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 return false; | 404 return false; |
404 return file_util::WriteFile(first_run_sentinel, "", 0) != -1; | 405 return file_util::WriteFile(first_run_sentinel, "", 0) != -1; |
405 } | 406 } |
406 | 407 |
407 std::string GetPingDelayPrefName() { | 408 std::string GetPingDelayPrefName() { |
408 return base::StringPrintf("%s.%s", | 409 return base::StringPrintf("%s.%s", |
409 installer::master_preferences::kDistroDict, | 410 installer::master_preferences::kDistroDict, |
410 installer::master_preferences::kDistroPingDelay); | 411 installer::master_preferences::kDistroPingDelay); |
411 } | 412 } |
412 | 413 |
413 void RegisterUserPrefs(PrefServiceSyncable* prefs) { | 414 void RegisterUserPrefs(PrefRegistrySyncable* registry) { |
414 prefs->RegisterIntegerPref(GetPingDelayPrefName().c_str(), | 415 registry->RegisterIntegerPref(GetPingDelayPrefName().c_str(), |
415 0, | 416 0, |
416 PrefServiceSyncable::UNSYNCABLE_PREF); | 417 PrefRegistrySyncable::UNSYNCABLE_PREF); |
417 } | 418 } |
418 | 419 |
419 bool RemoveSentinel() { | 420 bool RemoveSentinel() { |
420 base::FilePath first_run_sentinel; | 421 base::FilePath first_run_sentinel; |
421 if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel)) | 422 if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel)) |
422 return false; | 423 return false; |
423 return file_util::Delete(first_run_sentinel, false); | 424 return file_util::Delete(first_run_sentinel, false); |
424 } | 425 } |
425 | 426 |
426 bool SetShowFirstRunBubblePref(FirstRunBubbleOptions show_bubble_option) { | 427 bool SetShowFirstRunBubblePref(FirstRunBubbleOptions show_bubble_option) { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 if (template_url && template_url->GetDefaultSearchProvider()) | 720 if (template_url && template_url->GetDefaultSearchProvider()) |
720 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); | 721 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); |
721 SetShowWelcomePagePref(); | 722 SetShowWelcomePagePref(); |
722 SetPersonalDataManagerFirstRunPref(); | 723 SetPersonalDataManagerFirstRunPref(); |
723 #endif // !defined(USE_AURA) | 724 #endif // !defined(USE_AURA) |
724 | 725 |
725 internal::DoPostImportPlatformSpecificTasks(); | 726 internal::DoPostImportPlatformSpecificTasks(); |
726 } | 727 } |
727 | 728 |
728 } // namespace first_run | 729 } // namespace first_run |
OLD | NEW |