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

Side by Side Diff: chrome/browser/password_manager/password_store_x.cc

Issue 14622003: components: Move PrefRegistrySyncable into user_prefs namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 7 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/password_manager/password_store_x.h" 5 #include "chrome/browser/password_manager/password_store_x.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 DeleteAndRecreateDatabaseFile(); 264 DeleteAndRecreateDatabaseFile();
265 } 265 }
266 } 266 }
267 ssize_t result = ok ? forms.size() : -1; 267 ssize_t result = ok ? forms.size() : -1;
268 STLDeleteElements(&forms); 268 STLDeleteElements(&forms);
269 return result; 269 return result;
270 } 270 }
271 271
272 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) 272 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
273 // static 273 // static
274 void PasswordStoreX::RegisterUserPrefs(PrefRegistrySyncable* registry) { 274 void PasswordStoreX::RegisterUserPrefs(
275 user_prefs::PrefRegistrySyncable* registry) {
275 // Normally we should be on the UI thread here, but in tests we might not. 276 // Normally we should be on the UI thread here, but in tests we might not.
276 registry->RegisterBooleanPref(prefs::kPasswordsUseLocalProfileId, 277 registry->RegisterBooleanPref(
277 // default: passwords don't use local ids 278 prefs::kPasswordsUseLocalProfileId,
278 false, 279 // default: passwords don't use local ids
279 PrefRegistrySyncable::UNSYNCABLE_PREF); 280 false,
281 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
280 } 282 }
281 283
282 // static 284 // static
283 bool PasswordStoreX::PasswordsUseLocalProfileId(PrefService* prefs) { 285 bool PasswordStoreX::PasswordsUseLocalProfileId(PrefService* prefs) {
284 // Normally we should be on the UI thread here, but in tests we might not. 286 // Normally we should be on the UI thread here, but in tests we might not.
285 return prefs->GetBoolean(prefs::kPasswordsUseLocalProfileId); 287 return prefs->GetBoolean(prefs::kPasswordsUseLocalProfileId);
286 } 288 }
287 289
288 namespace { 290 namespace {
289 // This function is a hack to do something not entirely thread safe: the pref 291 // This function is a hack to do something not entirely thread safe: the pref
290 // service comes from the UI thread, but it's not ref counted. We keep a pointer 292 // service comes from the UI thread, but it's not ref counted. We keep a pointer
291 // to it on the DB thread, and need to invoke a method on the UI thread. This 293 // to it on the DB thread, and need to invoke a method on the UI thread. This
292 // function does that for us without requiring ref counting the pref service. 294 // function does that for us without requiring ref counting the pref service.
293 // TODO(mdm): Fix this if it becomes a problem. Given that this function will 295 // TODO(mdm): Fix this if it becomes a problem. Given that this function will
294 // be called once ever per profile, it probably will not cause a problem... 296 // be called once ever per profile, it probably will not cause a problem...
295 void UISetPasswordsUseLocalProfileId(PrefService* prefs) { 297 void UISetPasswordsUseLocalProfileId(PrefService* prefs) {
296 prefs->SetBoolean(prefs::kPasswordsUseLocalProfileId, true); 298 prefs->SetBoolean(prefs::kPasswordsUseLocalProfileId, true);
297 } 299 }
298 } // anonymous namespace 300 } // anonymous namespace
299 301
300 // static 302 // static
301 void PasswordStoreX::SetPasswordsUseLocalProfileId(PrefService* prefs) { 303 void PasswordStoreX::SetPasswordsUseLocalProfileId(PrefService* prefs) {
302 // This method should work on any thread, but we expect the DB thread. 304 // This method should work on any thread, but we expect the DB thread.
303 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
304 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 306 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
305 base::Bind(&UISetPasswordsUseLocalProfileId, prefs)); 307 base::Bind(&UISetPasswordsUseLocalProfileId, prefs));
306 } 308 }
307 #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX) 309 #endif // !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && defined(OS_POSIX)
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store_x.h ('k') | chrome/browser/pepper_flash_settings_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698