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/prefs/chrome_pref_service_factory.h" | 5 #include "chrome/browser/prefs/chrome_pref_service_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/prefs/pref_hash_filter.h" | 21 #include "chrome/browser/prefs/pref_hash_filter.h" |
22 #include "chrome/browser/prefs/pref_hash_store.h" | 22 #include "chrome/browser/prefs/pref_hash_store.h" |
23 #include "chrome/browser/prefs/pref_model_associator.h" | 23 #include "chrome/browser/prefs/pref_model_associator.h" |
24 #include "chrome/browser/prefs/pref_service_syncable.h" | 24 #include "chrome/browser/prefs/pref_service_syncable.h" |
25 #include "chrome/browser/prefs/pref_service_syncable_factory.h" | 25 #include "chrome/browser/prefs/pref_service_syncable_factory.h" |
26 #include "chrome/browser/ui/profile_error_dialog.h" | 26 #include "chrome/browser/ui/profile_error_dialog.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "components/user_prefs/pref_registry_syncable.h" | 28 #include "components/user_prefs/pref_registry_syncable.h" |
29 #include "content/public/browser/browser_context.h" | 29 #include "content/public/browser/browser_context.h" |
30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 31 #include "extensions/browser/pref_names.h" |
31 #include "grit/chromium_strings.h" | 32 #include "grit/chromium_strings.h" |
32 #include "grit/generated_resources.h" | 33 #include "grit/generated_resources.h" |
33 | 34 |
34 #if defined(ENABLE_CONFIGURATION_POLICY) | 35 #if defined(ENABLE_CONFIGURATION_POLICY) |
35 #include "chrome/browser/policy/browser_policy_connector.h" | 36 #include "chrome/browser/policy/browser_policy_connector.h" |
36 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 37 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
37 #include "components/policy/core/common/policy_types.h" | 38 #include "components/policy/core/common/policy_types.h" |
38 #endif | 39 #endif |
39 | 40 |
40 #if defined(ENABLE_MANAGED_USERS) | 41 #if defined(ENABLE_MANAGED_USERS) |
41 #include "chrome/browser/managed_mode/supervised_user_pref_store.h" | 42 #include "chrome/browser/managed_mode/supervised_user_pref_store.h" |
42 #endif | 43 #endif |
43 | 44 |
44 using content::BrowserContext; | 45 using content::BrowserContext; |
45 using content::BrowserThread; | 46 using content::BrowserThread; |
46 | 47 |
47 namespace { | 48 namespace { |
48 | 49 |
49 // These preferences must be kept in sync with the TrackedPreference enum in | 50 // These preferences must be kept in sync with the TrackedPreference enum in |
50 // tools/metrics/histograms/histograms.xml. To add a new preference, append it | 51 // tools/metrics/histograms/histograms.xml. To add a new preference, append it |
51 // to the array and add a corresponding value to the histogram enum. Each | 52 // to the array and add a corresponding value to the histogram enum. Each |
52 // tracked preference must be given a unique reporting ID. | 53 // tracked preference must be given a unique reporting ID. |
53 const PrefHashFilter::TrackedPreference kTrackedPrefs[] = { | 54 const PrefHashFilter::TrackedPreference kTrackedPrefs[] = { |
54 { 0, prefs::kShowHomeButton, true }, | 55 { 0, prefs::kShowHomeButton, true }, |
55 { 1, prefs::kHomePageIsNewTabPage, true }, | 56 { 1, prefs::kHomePageIsNewTabPage, true }, |
56 { 2, prefs::kHomePage, true }, | 57 { 2, prefs::kHomePage, true }, |
57 { 3, prefs::kRestoreOnStartup, true }, | 58 { 3, prefs::kRestoreOnStartup, true }, |
58 { 4, prefs::kURLsToRestoreOnStartup, true }, | 59 { 4, prefs::kURLsToRestoreOnStartup, true }, |
59 { 5, prefs::kExtensionsPref, false }, | 60 { 5, extensions::pref_names::kExtensions, false }, |
60 { 6, prefs::kGoogleServicesLastUsername, true }, | 61 { 6, prefs::kGoogleServicesLastUsername, true }, |
61 { 7, prefs::kSearchProviderOverrides, true }, | 62 { 7, prefs::kSearchProviderOverrides, true }, |
62 { 8, prefs::kDefaultSearchProviderSearchURL, true }, | 63 { 8, prefs::kDefaultSearchProviderSearchURL, true }, |
63 { 9, prefs::kDefaultSearchProviderKeyword, true }, | 64 { 9, prefs::kDefaultSearchProviderKeyword, true }, |
64 { 10, prefs::kDefaultSearchProviderName, true }, | 65 { 10, prefs::kDefaultSearchProviderName, true }, |
65 #if !defined(OS_ANDROID) | 66 #if !defined(OS_ANDROID) |
66 { 11, prefs::kPinnedTabs, true }, | 67 { 11, prefs::kPinnedTabs, true }, |
67 #endif | 68 #endif |
68 { 12, prefs::kExtensionKnownDisabled, true }, | 69 { 12, extensions::pref_names::kKnownDisabled, true }, |
69 { 13, prefs::kProfileResetPromptMemento, true }, | 70 { 13, prefs::kProfileResetPromptMemento, true }, |
70 }; | 71 }; |
71 | 72 |
72 // The count of tracked preferences IDs across all platforms. | 73 // The count of tracked preferences IDs across all platforms. |
73 const size_t kTrackedPrefsReportingIDsCount = 14; | 74 const size_t kTrackedPrefsReportingIDsCount = 14; |
74 COMPILE_ASSERT(kTrackedPrefsReportingIDsCount >= arraysize(kTrackedPrefs), | 75 COMPILE_ASSERT(kTrackedPrefsReportingIDsCount >= arraysize(kTrackedPrefs), |
75 need_to_increment_ids_count); | 76 need_to_increment_ids_count); |
76 | 77 |
77 PrefHashFilter::EnforcementLevel GetSettingsEnforcementLevel() { | 78 PrefHashFilter::EnforcementLevel GetSettingsEnforcementLevel() { |
78 static const char kSettingsEnforcementExperiment[] = "SettingsEnforcement"; | 79 static const char kSettingsEnforcementExperiment[] = "SettingsEnforcement"; |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 pref_io_task_runner, | 250 pref_io_task_runner, |
250 policy_service, | 251 policy_service, |
251 managed_user_settings, | 252 managed_user_settings, |
252 pref_hash_store.Pass(), | 253 pref_hash_store.Pass(), |
253 extension_prefs, | 254 extension_prefs, |
254 async); | 255 async); |
255 return factory.CreateSyncable(pref_registry.get()); | 256 return factory.CreateSyncable(pref_registry.get()); |
256 } | 257 } |
257 | 258 |
258 } // namespace chrome_prefs | 259 } // namespace chrome_prefs |
OLD | NEW |