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

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: move to own file and start unit tests 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"
(...skipping 17 matching lines...) Expand all
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_hash_filter.h" 29 #include "chrome/browser/prefs/pref_hash_filter.h"
30 #include "chrome/browser/prefs/pref_model_associator.h" 30 #include "chrome/browser/prefs/pref_model_associator.h"
31 #include "chrome/browser/prefs/pref_service_syncable.h" 31 #include "chrome/browser/prefs/pref_service_syncable.h"
32 #include "chrome/browser/prefs/pref_service_syncable_factory.h" 32 #include "chrome/browser/prefs/pref_service_syncable_factory.h"
33 #include "chrome/browser/prefs/profile_pref_store_manager.h" 33 #include "chrome/browser/prefs/profile_pref_store_manager.h"
34 #include "chrome/browser/profiles/file_path_verifier_win.h" 34 #include "chrome/browser/profiles/file_path_verifier_win.h"
35 #include "chrome/browser/profiles/profile.h" 35 #include "chrome/browser/profiles/profile.h"
36 #include "chrome/browser/search_engines/default_search_pref_migration.h" 36 #include "chrome/browser/search_engines/default_search_pref_migration.h"
37 #include "chrome/browser/sync/glue/sync_start_util.h" 37 #include "chrome/browser/sync/glue/sync_start_util.h"
38 #include "chrome/browser/ui/prefs_migrator.h"
38 #include "chrome/browser/ui/profile_error_dialog.h" 39 #include "chrome/browser/ui/profile_error_dialog.h"
39 #include "chrome/common/chrome_constants.h" 40 #include "chrome/common/chrome_constants.h"
40 #include "chrome/common/pref_names.h" 41 #include "chrome/common/pref_names.h"
41 #include "chrome/grit/chromium_strings.h" 42 #include "chrome/grit/chromium_strings.h"
42 #include "chrome/grit/generated_resources.h" 43 #include "chrome/grit/generated_resources.h"
43 #include "components/pref_registry/pref_registry_syncable.h" 44 #include "components/pref_registry/pref_registry_syncable.h"
44 #include "components/search_engines/default_search_manager.h" 45 #include "components/search_engines/default_search_manager.h"
45 #include "components/search_engines/search_engines_pref_names.h" 46 #include "components/search_engines/search_engines_pref_names.h"
46 #include "components/sync_driver/pref_names.h" 47 #include "components/sync_driver/pref_names.h"
47 #include "content/public/browser/browser_context.h" 48 #include "content/public/browser/browser_context.h"
(...skipping 408 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 // BrowserUIPrefsMigrationObserver unregisters and deletes itself after it is
473 // done migrating.
474 user_pref_store->AddObserver(
475 new BrowserUIPrefsMigrationObserver(user_pref_store));
466 PrepareFactory(&factory, 476 PrepareFactory(&factory,
467 policy_service, 477 policy_service,
468 supervised_user_settings, 478 supervised_user_settings,
469 scoped_refptr<PersistentPrefStore>( 479 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, 480 extension_prefs,
475 async); 481 async);
476 scoped_ptr<PrefServiceSyncable> pref_service = 482 scoped_ptr<PrefServiceSyncable> pref_service =
477 factory.CreateSyncable(pref_registry.get()); 483 factory.CreateSyncable(pref_registry.get());
478 484
479 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get()); 485 ConfigureDefaultSearchPrefMigrationToDictionaryValue(pref_service.get());
480 486
481 return pref_service.Pass(); 487 return pref_service.Pass();
482 } 488 }
483 489
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 523
518 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { 524 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
519 ProfilePrefStoreManager::RegisterProfilePrefs(registry); 525 ProfilePrefStoreManager::RegisterProfilePrefs(registry);
520 } 526 }
521 527
522 void RegisterPrefs(PrefRegistrySimple* registry) { 528 void RegisterPrefs(PrefRegistrySimple* registry) {
523 ProfilePrefStoreManager::RegisterPrefs(registry); 529 ProfilePrefStoreManager::RegisterPrefs(registry);
524 } 530 }
525 531
526 } // namespace chrome_prefs 532 } // namespace chrome_prefs
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698