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

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

Issue 2601873002: Add a mojo bridge for PersistentPrefStore. (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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 new JsonPrefStore(pref_filename, pref_io_task_runner, 464 new JsonPrefStore(pref_filename, pref_io_task_runner,
465 std::unique_ptr<PrefFilter>()), 465 std::unique_ptr<PrefFilter>()),
466 NULL, // extension_prefs 466 NULL, // extension_prefs
467 async); 467 async);
468 return factory.Create(pref_registry.get()); 468 return factory.Create(pref_registry.get());
469 } 469 }
470 470
471 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs( 471 std::unique_ptr<sync_preferences::PrefServiceSyncable> CreateProfilePrefs(
472 const base::FilePath& profile_path, 472 const base::FilePath& profile_path,
473 base::SequencedTaskRunner* pref_io_task_runner, 473 base::SequencedTaskRunner* pref_io_task_runner,
474 TrackedPreferenceValidationDelegate* validation_delegate, 474 base::WeakPtr<TrackedPreferenceValidationDelegate> validation_delegate,
475 policy::PolicyService* policy_service, 475 policy::PolicyService* policy_service,
476 SupervisedUserSettingsService* supervised_user_settings, 476 SupervisedUserSettingsService* supervised_user_settings,
477 const scoped_refptr<PrefStore>& extension_prefs, 477 const scoped_refptr<PrefStore>& extension_prefs,
478 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry, 478 const scoped_refptr<user_prefs::PrefRegistrySyncable>& pref_registry,
479 bool async) { 479 bool async) {
480 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs"); 480 TRACE_EVENT0("browser", "chrome_prefs::CreateProfilePrefs");
481 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime"); 481 SCOPED_UMA_HISTOGRAM_TIMER("PrefService.CreateProfilePrefsTime");
482 482
483 // A StartSyncFlare used to kick sync early in case of a reset event. This is 483 // A StartSyncFlare used to kick sync early in case of a reset event. This is
484 // done since sync may bring back the user's server value post-reset which 484 // done since sync may bring back the user's server value post-reset which
485 // could potentially cause a "settings flash" between the factory default and 485 // could potentially cause a "settings flash" between the factory default and
486 // the re-instantiated server value. Starting sync ASAP minimizes the window 486 // the re-instantiated server value. Starting sync ASAP minimizes the window
487 // before the server value is re-instantiated (this window can otherwise be 487 // before the server value is re-instantiated (this window can otherwise be
488 // as long as 10 seconds by default). 488 // as long as 10 seconds by default).
489 const base::Closure start_sync_flare_for_prefs = 489 const base::Closure start_sync_flare_for_prefs =
490 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), 490 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
491 syncer::PREFERENCES); 491 syncer::PREFERENCES);
492 492
493 sync_preferences::PrefServiceSyncableFactory factory; 493 sync_preferences::PrefServiceSyncableFactory factory;
494 scoped_refptr<PersistentPrefStore> user_pref_store( 494 scoped_refptr<PersistentPrefStore> user_pref_store(
495 CreateProfilePrefStoreManager(profile_path) 495 CreateProfilePrefStoreManager(profile_path)
496 ->CreateProfilePrefStore(pref_io_task_runner, 496 ->CreateProfilePrefStore(
497 start_sync_flare_for_prefs, 497 content::BrowserThread::GetTaskRunnerForThread(
498 validation_delegate)); 498 content::BrowserThread::IO),
499 pref_io_task_runner, start_sync_flare_for_prefs,
500 validation_delegate));
499 PrepareFactory(&factory, profile_path, policy_service, 501 PrepareFactory(&factory, profile_path, policy_service,
500 supervised_user_settings, user_pref_store, extension_prefs, 502 supervised_user_settings, user_pref_store, extension_prefs,
501 async); 503 async);
502 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service = 504 std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service =
503 factory.CreateSyncable(pref_registry.get()); 505 factory.CreateSyncable(pref_registry.get());
504 506
505 return pref_service; 507 return pref_service;
506 } 508 }
507 509
508 void DisableDomainCheckForTesting() { 510 void DisableDomainCheckForTesting() {
(...skipping 15 matching lines...) Expand all
524 526
525 void ClearResetTime(Profile* profile) { 527 void ClearResetTime(Profile* profile) {
526 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs()); 528 ProfilePrefStoreManager::ClearResetTime(profile->GetPrefs());
527 } 529 }
528 530
529 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 531 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
530 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 532 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
531 } 533 }
532 534
533 } // namespace chrome_prefs 535 } // namespace chrome_prefs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698