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

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

Issue 511393003: No longer register app window placement preference keys on the fly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ToT Created 6 years, 3 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 | Annotate | Revision Log
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_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"
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/metrics/field_trial.h" 14 #include "base/metrics/field_trial.h"
15 #include "base/metrics/histogram.h" 15 #include "base/metrics/histogram.h"
16 #include "base/prefs/default_pref_store.h" 16 #include "base/prefs/default_pref_store.h"
17 #include "base/prefs/json_pref_store.h" 17 #include "base/prefs/json_pref_store.h"
18 #include "base/prefs/pref_filter.h" 18 #include "base/prefs/pref_filter.h"
19 #include "base/prefs/pref_notifier_impl.h" 19 #include "base/prefs/pref_notifier_impl.h"
20 #include "base/prefs/pref_registry.h" 20 #include "base/prefs/pref_registry.h"
21 #include "base/prefs/pref_registry_simple.h" 21 #include "base/prefs/pref_registry_simple.h"
22 #include "base/prefs/pref_service.h" 22 #include "base/prefs/pref_service.h"
23 #include "base/prefs/pref_store.h" 23 #include "base/prefs/pref_store.h"
24 #include "base/prefs/pref_value_store.h" 24 #include "base/prefs/pref_value_store.h"
25 #include "base/threading/sequenced_worker_pool.h" 25 #include "base/threading/sequenced_worker_pool.h"
26 #include "base/time/time.h" 26 #include "base/time/time.h"
27 #include "chrome/browser/browser_process.h" 27 #include "chrome/browser/browser_process.h"
28 #include "chrome/browser/prefs/browser_ui_prefs_migrator.h"
28 #include "chrome/browser/prefs/command_line_pref_store.h" 29 #include "chrome/browser/prefs/command_line_pref_store.h"
29 #include "chrome/browser/prefs/pref_hash_filter.h" 30 #include "chrome/browser/prefs/pref_hash_filter.h"
30 #include "chrome/browser/prefs/pref_model_associator.h" 31 #include "chrome/browser/prefs/pref_model_associator.h"
31 #include "chrome/browser/prefs/pref_service_syncable.h" 32 #include "chrome/browser/prefs/pref_service_syncable.h"
32 #include "chrome/browser/prefs/pref_service_syncable_factory.h" 33 #include "chrome/browser/prefs/pref_service_syncable_factory.h"
33 #include "chrome/browser/prefs/profile_pref_store_manager.h" 34 #include "chrome/browser/prefs/profile_pref_store_manager.h"
34 #include "chrome/browser/profiles/file_path_verifier_win.h" 35 #include "chrome/browser/profiles/file_path_verifier_win.h"
35 #include "chrome/browser/profiles/profile.h" 36 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/search_engines/default_search_pref_migration.h" 37 #include "chrome/browser/search_engines/default_search_pref_migration.h"
37 #include "chrome/browser/sync/glue/sync_start_util.h" 38 #include "chrome/browser/sync/glue/sync_start_util.h"
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 // done since sync may bring back the user's server value post-reset which 457 // done since sync may bring back the user's server value post-reset which
457 // could potentially cause a "settings flash" between the factory default and 458 // could potentially cause a "settings flash" between the factory default and
458 // the re-instantiated server value. Starting sync ASAP minimizes the window 459 // the re-instantiated server value. Starting sync ASAP minimizes the window
459 // before the server value is re-instantiated (this window can otherwise be 460 // before the server value is re-instantiated (this window can otherwise be
460 // as long as 10 seconds by default). 461 // as long as 10 seconds by default).
461 const base::Closure start_sync_flare_for_prefs = 462 const base::Closure start_sync_flare_for_prefs =
462 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path), 463 base::Bind(sync_start_util::GetFlareForSyncableService(profile_path),
463 syncer::PREFERENCES); 464 syncer::PREFERENCES);
464 465
465 PrefServiceSyncableFactory factory; 466 PrefServiceSyncableFactory factory;
467 scoped_refptr<PersistentPrefStore> user_pref_store(
468 CreateProfilePrefStoreManager(profile_path)
469 ->CreateProfilePrefStore(pref_io_task_runner,
470 start_sync_flare_for_prefs,
471 validation_delegate));
472 // BrowserUIPrefsMigrator unregisters and deletes itself after it is done.
473 user_pref_store->AddObserver(
474 new BrowserUIPrefsMigrator(user_pref_store.get()));
466 PrepareFactory(&factory, 475 PrepareFactory(&factory,
467 policy_service, 476 policy_service,
468 supervised_user_settings, 477 supervised_user_settings,
469 scoped_refptr<PersistentPrefStore>( 478 user_pref_store,
470 CreateProfilePrefStoreManager(profile_path)
471 ->CreateProfilePrefStore(pref_io_task_runner,
472 start_sync_flare_for_prefs,
473 validation_delegate)),
474 extension_prefs, 479 extension_prefs,
475 async); 480 async);
476 scoped_ptr<PrefServiceSyncable> pref_service = 481 scoped_ptr<PrefServiceSyncable> pref_service =
477 factory.CreateSyncable(pref_registry.get()); 482 factory.CreateSyncable(pref_registry.get());
478 483
479 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get()); 484 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get());
480 485
481 return pref_service.Pass(); 486 return pref_service.Pass();
482 } 487 }
483 488
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 522
518 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 523 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
519 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 524 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
520 } 525 }
521 526
522 void RegisterPrefs(PrefRegistrySimple* registry) { 527 void RegisterPrefs(PrefRegistrySimple* registry) {
523 ProfilePrefStoreManager::RegisterPrefs(registry); 528 ProfilePrefStoreManager::RegisterPrefs(registry);
524 } 529 }
525 530
526 } // namespace chrome_prefs 531 } // namespace chrome_prefs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698