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

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

Issue 14141006: [components] Switch {RefCounted}ProfileKeyedService to use BrowserContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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_factory.h" 5 #include "chrome/browser/password_manager/password_store_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/environment.h" 8 #include "base/environment.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/password_manager/login_database.h" 10 #include "chrome/browser/password_manager/login_database.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 id = rand() & kLocalProfileIdMask; 88 id = rand() & kLocalProfileIdMask;
89 // TODO(mdm): scan other profiles to make sure they are not using this id? 89 // TODO(mdm): scan other profiles to make sure they are not using this id?
90 } while (id == kInvalidLocalProfileId); 90 } while (id == kInvalidLocalProfileId);
91 prefs->SetInteger(prefs::kLocalProfileId, id); 91 prefs->SetInteger(prefs::kLocalProfileId, id);
92 } 92 }
93 return id; 93 return id;
94 } 94 }
95 #endif 95 #endif
96 96
97 scoped_refptr<RefcountedProfileKeyedService> 97 scoped_refptr<RefcountedProfileKeyedService>
98 PasswordStoreFactory::BuildServiceInstanceFor(Profile* profile) const { 98 PasswordStoreFactory::BuildServiceInstanceFor(
99 content::BrowserContext* context) const {
100 Profile* profile = static_cast<Profile*>(context);
101
99 scoped_refptr<PasswordStore> ps; 102 scoped_refptr<PasswordStore> ps;
100 base::FilePath login_db_file_path = profile->GetPath(); 103 base::FilePath login_db_file_path = profile->GetPath();
101 login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName); 104 login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName);
102 LoginDatabase* login_db = new LoginDatabase(); 105 LoginDatabase* login_db = new LoginDatabase();
103 { 106 {
104 // TODO(paivanof@gmail.com): execution of login_db->Init() should go 107 // TODO(paivanof@gmail.com): execution of login_db->Init() should go
105 // to DB thread. http://crbug.com/138903 108 // to DB thread. http://crbug.com/138903
106 base::ThreadRestrictions::ScopedAllowIO allow_io; 109 base::ThreadRestrictions::ScopedAllowIO allow_io;
107 if (!login_db->Init(login_db_file_path)) { 110 if (!login_db->Init(login_db_file_path)) {
108 LOG(ERROR) << "Could not initialize login database."; 111 LOG(ERROR) << "Could not initialize login database.";
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 #endif 209 #endif
207 } 210 }
208 211
209 bool PasswordStoreFactory::ServiceRedirectedInIncognito() const { 212 bool PasswordStoreFactory::ServiceRedirectedInIncognito() const {
210 return true; 213 return true;
211 } 214 }
212 215
213 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { 216 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const {
214 return true; 217 return true;
215 } 218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698