Chromium Code Reviews| 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 <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "base/prefs/pref_value_store.h" | 23 #include "base/prefs/pref_value_store.h" |
| 24 #include "base/threading/sequenced_worker_pool.h" | 24 #include "base/threading/sequenced_worker_pool.h" |
| 25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
| 26 #include "base/trace_event/trace_event.h" | 26 #include "base/trace_event/trace_event.h" |
| 27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/prefs/command_line_pref_store.h" | 28 #include "chrome/browser/prefs/command_line_pref_store.h" |
| 29 #include "chrome/browser/prefs/pref_model_associator.h" | 29 #include "chrome/browser/prefs/pref_model_associator.h" |
| 30 #include "chrome/browser/prefs/pref_service_syncable.h" | 30 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 31 #include "chrome/browser/prefs/pref_service_syncable_factory.h" | 31 #include "chrome/browser/prefs/pref_service_syncable_factory.h" |
| 32 #include "chrome/browser/prefs/profile_pref_store_manager.h" | 32 #include "chrome/browser/prefs/profile_pref_store_manager.h" |
| 33 #include "chrome/browser/prefs/tracked/pref_hash_filter.h" | |
| 34 #include "chrome/browser/profiles/file_path_verifier_win.h" | 33 #include "chrome/browser/profiles/file_path_verifier_win.h" |
| 35 #include "chrome/browser/profiles/profile.h" | 34 #include "chrome/browser/profiles/profile.h" |
| 36 #include "chrome/browser/sync/glue/sync_start_util.h" | 35 #include "chrome/browser/sync/glue/sync_start_util.h" |
| 37 #include "chrome/browser/ui/profile_error_dialog.h" | 36 #include "chrome/browser/ui/profile_error_dialog.h" |
| 38 #include "chrome/common/chrome_constants.h" | 37 #include "chrome/common/chrome_constants.h" |
| 39 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
| 40 #include "chrome/grit/chromium_strings.h" | 39 #include "chrome/grit/chromium_strings.h" |
| 41 #include "chrome/grit/generated_resources.h" | 40 #include "chrome/grit/generated_resources.h" |
| 42 #include "components/component_updater/pref_names.h" | 41 #include "components/component_updater/pref_names.h" |
| 43 #include "components/pref_registry/pref_registry_syncable.h" | 42 #include "components/pref_registry/pref_registry_syncable.h" |
| 44 #include "components/search_engines/default_search_manager.h" | 43 #include "components/search_engines/default_search_manager.h" |
| 45 #include "components/search_engines/default_search_pref_migration.h" | 44 #include "components/search_engines/default_search_pref_migration.h" |
| 46 #include "components/search_engines/search_engines_pref_names.h" | 45 #include "components/search_engines/search_engines_pref_names.h" |
| 47 #include "components/sync_driver/pref_names.h" | 46 #include "components/sync_driver/pref_names.h" |
| 47 #include "components/user_prefs/tracked/pref_names.h" | |
| 48 #include "content/public/browser/browser_context.h" | 48 #include "content/public/browser/browser_context.h" |
| 49 #include "content/public/browser/browser_thread.h" | 49 #include "content/public/browser/browser_thread.h" |
| 50 #include "grit/browser_resources.h" | 50 #include "grit/browser_resources.h" |
| 51 #include "sync/internal_api/public/base/model_type.h" | 51 #include "sync/internal_api/public/base/model_type.h" |
| 52 #include "ui/base/resource/resource_bundle.h" | 52 #include "ui/base/resource/resource_bundle.h" |
| 53 | 53 |
| 54 #if defined(ENABLE_CONFIGURATION_POLICY) | 54 #if defined(ENABLE_CONFIGURATION_POLICY) |
| 55 #include "components/policy/core/browser/browser_policy_connector.h" | 55 #include "components/policy/core/browser/browser_policy_connector.h" |
| 56 #include "components/policy/core/browser/configuration_policy_pref_store.h" | 56 #include "components/policy/core/browser/configuration_policy_pref_store.h" |
| 57 #include "components/policy/core/common/policy_types.h" | 57 #include "components/policy/core/common/policy_types.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 // Protecting kPreferenceResetTime does two things: | 183 // Protecting kPreferenceResetTime does two things: |
| 184 // 1) It ensures this isn't accidently set by someone stomping the pref | 184 // 1) It ensures this isn't accidently set by someone stomping the pref |
| 185 // file. | 185 // file. |
| 186 // 2) More importantly, it declares kPreferenceResetTime as a protected | 186 // 2) More importantly, it declares kPreferenceResetTime as a protected |
| 187 // pref which is required for it to be visible when queried via the | 187 // pref which is required for it to be visible when queried via the |
| 188 // SegregatedPrefStore. This is because it's written directly in the | 188 // SegregatedPrefStore. This is because it's written directly in the |
| 189 // protected JsonPrefStore by that store's PrefHashFilter if there was | 189 // protected JsonPrefStore by that store's PrefHashFilter if there was |
| 190 // a reset in FilterOnLoad and SegregatedPrefStore will not look for it | 190 // a reset in FilterOnLoad and SegregatedPrefStore will not look for it |
| 191 // in the protected JsonPrefStore unless it's declared as a protected | 191 // in the protected JsonPrefStore unless it's declared as a protected |
| 192 // preference here. | 192 // preference here. |
| 193 15, prefs::kPreferenceResetTime, | 193 15, user_prefs::kPreferenceResetTime, |
| 194 PrefHashFilter::ENFORCE_ON_LOAD, | 194 PrefHashFilter::ENFORCE_ON_LOAD, |
| 195 PrefHashFilter::TRACKING_STRATEGY_ATOMIC, | 195 PrefHashFilter::TRACKING_STRATEGY_ATOMIC, |
| 196 PrefHashFilter::VALUE_IMPERSONAL | 196 PrefHashFilter::VALUE_IMPERSONAL |
| 197 }, | 197 }, |
| 198 { | 198 { |
| 199 17, sync_driver::prefs::kSyncRemainingRollbackTries, | 199 17, sync_driver::prefs::kSyncRemainingRollbackTries, |
| 200 PrefHashFilter::ENFORCE_ON_LOAD, | 200 PrefHashFilter::ENFORCE_ON_LOAD, |
| 201 PrefHashFilter::TRACKING_STRATEGY_ATOMIC, | 201 PrefHashFilter::TRACKING_STRATEGY_ATOMIC, |
| 202 PrefHashFilter::VALUE_IMPERSONAL | 202 PrefHashFilter::VALUE_IMPERSONAL |
| 203 }, | 203 }, |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 // This is used by | 400 // This is used by |
| 401 // chrome/browser/extensions/api/music_manager_private/device_id_win.cc | 401 // chrome/browser/extensions/api/music_manager_private/device_id_win.cc |
| 402 // but that API is private (http://crbug.com/276485) and other platforms are | 402 // but that API is private (http://crbug.com/276485) and other platforms are |
| 403 // not available synchronously. | 403 // not available synchronously. |
| 404 // As part of improving pref metrics on other platforms we may want to find | 404 // As part of improving pref metrics on other platforms we may want to find |
| 405 // ways to defer preference loading until the device ID can be used. | 405 // ways to defer preference loading until the device ID can be used. |
| 406 rlz_lib::GetMachineId(&device_id); | 406 rlz_lib::GetMachineId(&device_id); |
| 407 #endif | 407 #endif |
| 408 std::string seed; | 408 std::string seed; |
| 409 #if defined(GOOGLE_CHROME_BUILD) | 409 #if defined(GOOGLE_CHROME_BUILD) |
| 410 seed = ResourceBundle::GetSharedInstance().GetRawDataResource( | 410 seed = ResourceBundle::GetSharedInstance().GetRawDataResource( |
|
Ryan Sleevi
2015/08/07 20:03:34
Why put this behind an ifdef? Wouldn't it work jus
gab
2015/08/07 20:12:36
Hey Ryan, I own this code so I'll answer.
That's
| |
| 411 IDR_PREF_HASH_SEED_BIN).as_string(); | 411 IDR_PREF_HASH_SEED_BIN).as_string(); |
| 412 #endif | 412 #endif |
| 413 return make_scoped_ptr(new ProfilePrefStoreManager( | 413 return make_scoped_ptr(new ProfilePrefStoreManager( |
| 414 profile_path, | 414 profile_path, |
| 415 GetTrackingConfiguration(), | 415 GetTrackingConfiguration(), |
| 416 kTrackedPrefsReportingIDsCount, | 416 kTrackedPrefsReportingIDsCount, |
| 417 seed, | 417 seed, |
| 418 device_id, | 418 device_id, |
| 419 g_browser_process->local_state())); | 419 g_browser_process->local_state())); |
| 420 } | 420 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 | 573 |
| 574 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 574 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 575 ProfilePrefStoreManager::RegisterProfilePrefs(registry); | 575 ProfilePrefStoreManager::RegisterProfilePrefs(registry); |
| 576 } | 576 } |
| 577 | 577 |
| 578 void RegisterPrefs(PrefRegistrySimple* registry) { | 578 void RegisterPrefs(PrefRegistrySimple* registry) { |
| 579 ProfilePrefStoreManager::RegisterPrefs(registry); | 579 ProfilePrefStoreManager::RegisterPrefs(registry); |
| 580 } | 580 } |
| 581 | 581 |
| 582 } // namespace chrome_prefs | 582 } // namespace chrome_prefs |
| OLD | NEW |