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_internal.h" | 5 #include "chrome/browser/first_run/first_run_internal.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/first_run/first_run.h" | 12 #include "chrome/browser/first_run/first_run.h" |
13 #include "chrome/browser/first_run/first_run_dialog.h" | 13 #include "chrome/browser/first_run/first_run_dialog.h" |
14 #include "chrome/browser/metrics/metrics_reporting_state.h" | |
15 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
16 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
17 #include "chrome/installer/util/google_update_settings.h" | 16 #include "chrome/installer/util/google_update_settings.h" |
18 #include "chrome/installer/util/master_preferences.h" | 17 #include "chrome/installer/util/master_preferences.h" |
19 #include "components/metrics/metrics_pref_names.h" | 18 #include "components/metrics/metrics_pref_names.h" |
| 19 #include "components/metrics/metrics_reporting_default_state.h" |
20 #include "components/prefs/pref_service.h" | 20 #include "components/prefs/pref_service.h" |
21 #include "components/startup_metric_utils/browser/startup_metric_utils.h" | 21 #include "components/startup_metric_utils/browser/startup_metric_utils.h" |
22 | 22 |
23 namespace first_run { | 23 namespace first_run { |
24 namespace internal { | 24 namespace internal { |
25 | 25 |
26 void DoPostImportPlatformSpecificTasks(Profile* profile) { | 26 void DoPostImportPlatformSpecificTasks(Profile* profile) { |
27 #if !defined(OS_CHROMEOS) | 27 #if !defined(OS_CHROMEOS) |
28 base::FilePath local_state_path; | 28 base::FilePath local_state_path; |
29 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); | 29 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); |
30 bool local_state_file_exists = base::PathExists(local_state_path); | 30 bool local_state_file_exists = base::PathExists(local_state_path); |
31 // Launch the first run dialog only for certain builds, and only if the user | 31 // Launch the first run dialog only for certain builds, and only if the user |
32 // has not already set preferences. | 32 // has not already set preferences. |
33 if (internal::IsOrganicFirstRun() && !local_state_file_exists) { | 33 if (internal::IsOrganicFirstRun() && !local_state_file_exists) { |
34 if (ShowFirstRunDialog(profile)) { | 34 if (ShowFirstRunDialog(profile)) { |
35 RecordMetricsReportingDefaultOptIn(g_browser_process->local_state(), | 35 metrics::RecordMetricsReportingDefaultOptIn( |
36 first_run::IsMetricsReportingOptIn()); | 36 g_browser_process->local_state(), |
| 37 first_run::IsMetricsReportingOptIn()); |
37 startup_metric_utils::SetNonBrowserUIDisplayed(); | 38 startup_metric_utils::SetNonBrowserUIDisplayed(); |
38 } | 39 } |
39 } | 40 } |
40 | 41 |
41 // If stats reporting was turned on by the first run dialog then toggle | 42 // If stats reporting was turned on by the first run dialog then toggle |
42 // the pref (on Windows, the download is tagged with enable/disable stats so | 43 // the pref (on Windows, the download is tagged with enable/disable stats so |
43 // this is POSIX-specific). | 44 // this is POSIX-specific). |
44 if (GoogleUpdateSettings::GetCollectStatsConsent()) { | 45 if (GoogleUpdateSettings::GetCollectStatsConsent()) { |
45 g_browser_process->local_state()->SetBoolean( | 46 g_browser_process->local_state()->SetBoolean( |
46 metrics::prefs::kMetricsReportingEnabled, true); | 47 metrics::prefs::kMetricsReportingEnabled, true); |
47 } | 48 } |
48 #endif | 49 #endif |
49 } | 50 } |
50 | 51 |
51 bool IsFirstRunSentinelPresent() { | 52 bool IsFirstRunSentinelPresent() { |
52 base::FilePath sentinel; | 53 base::FilePath sentinel; |
53 return !GetFirstRunSentinelFilePath(&sentinel) || base::PathExists(sentinel); | 54 return !GetFirstRunSentinelFilePath(&sentinel) || base::PathExists(sentinel); |
54 } | 55 } |
55 | 56 |
56 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { | 57 bool ShowPostInstallEULAIfNeeded(installer::MasterPreferences* install_prefs) { |
57 // The EULA is only handled on Windows. | 58 // The EULA is only handled on Windows. |
58 return true; | 59 return true; |
59 } | 60 } |
60 | 61 |
61 } // namespace internal | 62 } // namespace internal |
62 } // namespace first_run | 63 } // namespace first_run |
OLD | NEW |