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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 return false; | 402 return false; |
402 return file_util::WriteFile(first_run_sentinel, "", 0) != -1; | 403 return file_util::WriteFile(first_run_sentinel, "", 0) != -1; |
403 } | 404 } |
404 | 405 |
405 std::string GetPingDelayPrefName() { | 406 std::string GetPingDelayPrefName() { |
406 return base::StringPrintf("%s.%s", | 407 return base::StringPrintf("%s.%s", |
407 installer::master_preferences::kDistroDict, | 408 installer::master_preferences::kDistroDict, |
408 installer::master_preferences::kDistroPingDelay); | 409 installer::master_preferences::kDistroPingDelay); |
409 } | 410 } |
410 | 411 |
411 void RegisterUserPrefs(PrefServiceSyncable* prefs) { | 412 void RegisterUserPrefs(PrefRegistrySyncable* registry) { |
412 prefs->RegisterIntegerPref(GetPingDelayPrefName().c_str(), | 413 registry->RegisterIntegerPref(GetPingDelayPrefName().c_str(), |
413 0, | 414 0, |
414 PrefServiceSyncable::UNSYNCABLE_PREF); | 415 PrefRegistrySyncable::UNSYNCABLE_PREF); |
415 } | 416 } |
416 | 417 |
417 bool RemoveSentinel() { | 418 bool RemoveSentinel() { |
418 FilePath first_run_sentinel; | 419 FilePath first_run_sentinel; |
419 if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel)) | 420 if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel)) |
420 return false; | 421 return false; |
421 return file_util::Delete(first_run_sentinel, false); | 422 return file_util::Delete(first_run_sentinel, false); |
422 } | 423 } |
423 | 424 |
424 bool SetShowFirstRunBubblePref(FirstRunBubbleOptions show_bubble_option) { | 425 bool SetShowFirstRunBubblePref(FirstRunBubbleOptions show_bubble_option) { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 if (template_url && template_url->GetDefaultSearchProvider()) | 718 if (template_url && template_url->GetDefaultSearchProvider()) |
718 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); | 719 FirstRunBubbleLauncher::ShowFirstRunBubbleSoon(); |
719 SetShowWelcomePagePref(); | 720 SetShowWelcomePagePref(); |
720 SetPersonalDataManagerFirstRunPref(); | 721 SetPersonalDataManagerFirstRunPref(); |
721 #endif // !defined(USE_AURA) | 722 #endif // !defined(USE_AURA) |
722 | 723 |
723 internal::DoPostImportPlatformSpecificTasks(); | 724 internal::DoPostImportPlatformSpecificTasks(); |
724 } | 725 } |
725 | 726 |
726 } // namespace first_run | 727 } // namespace first_run |
OLD | NEW |