Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: chrome/browser/prefs/chrome_pref_service_factory.cc

Issue 2746023002: Pref service: enable for user prefs in chrome behind a flag. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_command_line_pref_store.h> 5 #include <chrome/browser/prefs/chrome_command_line_pref_store.h>
6 #include "chrome/browser/prefs/chrome_pref_service_factory.h" 6 #include "chrome/browser/prefs/chrome_pref_service_factory.h"
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 new JsonPrefStore(pref_filename, pref_io_task_runner, 450 new JsonPrefStore(pref_filename, pref_io_task_runner,
451 std::unique_ptr<PrefFilter>()), 451 std::unique_ptr<PrefFilter>()),
452 NULL, // extension_prefs 452 NULL, // extension_prefs
453 async); 453 async);
454 return factory.Create(pref_registry.get()); 454 return factory.Create(pref_registry.get());
455 } 455 }
456 456
457 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs( 457 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs(
458 const base::FilePath& profile_path, 458 const base::FilePath& profile_path,
459 base::SequencedTaskRunner* pref_io_task_runner, 459 base::SequencedTaskRunner* pref_io_task_runner,
460 prefs::mojom::TrackedPreferenceValidationDelegate* validation_delegate, 460 std::unique_ptr<prefs::mojom::TrackedPreferenceValidationDelegate>*
461 validation_delegate,
461 policy::PolicyService* policy_service, 462 policy::PolicyService* policy_service,
462 SupervisedUserSettingsService* supervised_user_settings, 463 SupervisedUserSettingsService* supervised_user_settings,
463 const scoped_refptr<PrefStore>& extension_prefs, 464 const scoped_refptr<PrefStore>& extension_prefs,
464 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, 465 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry,
465 bool async, 466 bool async,
466 service_manager::Connector* connector) { 467 service_manager::Connector* connector) {
467 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); 468 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs");
468 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); 469 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime");
469 470
470 // A StartSyncFlare used to kick sync early in case of a reset event. This is 471 // A StartSyncFlare used to kick sync early in case of a reset event. This is
471 // done since sync may bring back the user's server value post-reset which 472 // done since sync may bring back the user's server value post-reset which
472 // could potentially cause a "settings flash" between the factory default and 473 // could potentially cause a "settings flash" between the factory default and
473 // the re-instantiated server value. Starting sync ASAP minimizes the window 474 // the re-instantiated server value. Starting sync ASAP minimizes the window
474 // before the server value is re-instantiated (this window can otherwise be 475 // before the server value is re-instantiated (this window can otherwise be
475 // as long as 10 seconds by default). 476 // as long as 10 seconds by default).
476 const base::Closure start_sync_flare_for_prefs = 477 const base::Closure start_sync_flare_for_prefs =
477 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), 478 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
478 syncer::PREFERENCES); 479 syncer::PREFERENCES);
479 480
480 sync_preferences::PrefServiceSyncableFactory factory; 481 sync_preferences::PrefServiceSyncableFactory factory;
481 scoped_refptr<PersistentPrefStore> user_pref_store( 482 scoped_refptr<PersistentPrefStore> user_pref_store(
482 CreateProfilePrefStoreManager(profile_path) 483 CreateProfilePrefStoreManager(profile_path)
483 ->CreateProfilePrefStore(pref_io_task_runner, 484 ->CreateProfilePrefStore(pref_io_task_runner,
484 start_sync_flare_for_prefs, 485 start_sync_flare_for_prefs,
485 validation_delegate)); 486 validation_delegate, connector));
486 PrepareFactory(&factory, profile_path, policy_service, 487 PrepareFactory(&factory, profile_path, policy_service,
487 supervised_user_settings, user_pref_store, extension_prefs, 488 supervised_user_settings, user_pref_store, extension_prefs,
488 async); 489 async);
489 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service = 490 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service =
490 factory.CreateSyncable(pref_registry.get(), connector); 491 factory.CreateSyncable(pref_registry.get(), connector);
491 492
492 return pref_service; 493 return pref_service;
493 } 494 }
494 495
495 void DisableDomainCheckForTesting() { 496 void DisableDomainCheckForTesting() {
(...skipping 15 matching lines...) Expand all
511 512
512 void ClearResetTime(Profile* profile) { 513 void ClearResetTime(Profile* profile) {
513 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); 514 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs());
514 } 515 }
515 516
516 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 517 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
517 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 518 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
518 } 519 }
519 520
520 } // namespace chrome_prefs 521 } // namespace chrome_prefs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698