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

Side by Side Diff: chrome/browser/profiles/profile_impl.cc

Issue 12315053: Fix prefs registration in SyncPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment change. Created 7 years, 10 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/profiles/profile_impl.h" 5 #include "chrome/browser/profiles/profile_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 policy_service_ = 381 policy_service_ =
382 g_browser_process->browser_policy_connector()->CreatePolicyService(this); 382 g_browser_process->browser_policy_connector()->CreatePolicyService(this);
383 #else 383 #else
384 policy_service_.reset(new policy::PolicyServiceStub()); 384 policy_service_.reset(new policy::PolicyServiceStub());
385 #endif 385 #endif
386 386
387 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS || 387 DCHECK(create_mode == CREATE_MODE_ASYNCHRONOUS ||
388 create_mode == CREATE_MODE_SYNCHRONOUS); 388 create_mode == CREATE_MODE_SYNCHRONOUS);
389 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS; 389 bool async_prefs = create_mode == CREATE_MODE_ASYNCHRONOUS;
390 390
391 chrome::RegisterUserPrefs(pref_registry_);
391 Profile::RegisterUserPrefs(pref_registry_); 392 Profile::RegisterUserPrefs(pref_registry_);
Mattias Nissler (ping if slow) 2013/02/22 15:44:32 Suggestion: move this call into chrome::RegisterUs
Jói 2013/02/22 16:08:07 Done.
392 393
393 { 394 {
394 // On startup, preference loading is always synchronous so a scoped timer 395 // On startup, preference loading is always synchronous so a scoped timer
395 // will work here. 396 // will work here.
396 startup_metric_utils::ScopedSlowStartupUMA 397 startup_metric_utils::ScopedSlowStartupUMA
397 scoped_timer("Startup.SlowStartupPreferenceLoading"); 398 scoped_timer("Startup.SlowStartupPreferenceLoading");
398 prefs_.reset(chrome_prefs::CreateProfilePrefs( 399 prefs_.reset(chrome_prefs::CreateProfilePrefs(
399 GetPrefFilePath(), 400 GetPrefFilePath(),
400 sequenced_task_runner, 401 sequenced_task_runner,
401 policy_service_.get(), 402 policy_service_.get(),
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 return extension_special_storage_policy_.get(); 703 return extension_special_storage_policy_.get();
703 } 704 }
704 705
705 void ProfileImpl::OnPrefsLoaded(bool success) { 706 void ProfileImpl::OnPrefsLoaded(bool success) {
706 if (!success) { 707 if (!success) {
707 if (delegate_) 708 if (delegate_)
708 delegate_->OnProfileCreated(this, false, false); 709 delegate_->OnProfileCreated(this, false, false);
709 return; 710 return;
710 } 711 }
711 712
712 // TODO(joi): Registration can move to the constructor once it
713 // doesn't need the PrefService parameter.
714 chrome::RegisterUserPrefs(prefs_.get(), pref_registry_);
715
716 // TODO(mirandac): remove migration code after 6 months (crbug.com/69995). 713 // TODO(mirandac): remove migration code after 6 months (crbug.com/69995).
717 if (g_browser_process->local_state()) 714 if (g_browser_process->local_state())
718 chrome::MigrateBrowserPrefs(this, g_browser_process->local_state()); 715 chrome::MigrateBrowserPrefs(this, g_browser_process->local_state());
719 // TODO(ivankr): remove cleanup code eventually (crbug.com/165672). 716 // TODO(ivankr): remove cleanup code eventually (crbug.com/165672).
720 chrome::MigrateUserPrefs(this); 717 chrome::MigrateUserPrefs(this);
721 718
722 // |kSessionExitType| was added after |kSessionExitedCleanly|. If the pref 719 // |kSessionExitType| was added after |kSessionExitedCleanly|. If the pref
723 // value is empty fallback to checking for |kSessionExitedCleanly|. 720 // value is empty fallback to checking for |kSessionExitedCleanly|.
724 const std::string exit_type_pref_value( 721 const std::string exit_type_pref_value(
725 prefs_->GetString(prefs::kSessionExitType)); 722 prefs_->GetString(prefs::kSessionExitType));
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 base::FilePath* cache_path, 1181 base::FilePath* cache_path,
1185 int* max_size) { 1182 int* max_size) {
1186 DCHECK(cache_path); 1183 DCHECK(cache_path);
1187 DCHECK(max_size); 1184 DCHECK(max_size);
1188 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir)); 1185 base::FilePath path(prefs_->GetFilePath(prefs::kDiskCacheDir));
1189 if (!path.empty()) 1186 if (!path.empty())
1190 *cache_path = path; 1187 *cache_path = path;
1191 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) : 1188 *max_size = is_media_context ? prefs_->GetInteger(prefs::kMediaCacheSize) :
1192 prefs_->GetInteger(prefs::kDiskCacheSize); 1189 prefs_->GetInteger(prefs::kDiskCacheSize);
1193 } 1190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698