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

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

Issue 1072413003: Add foundation for trimming the AffiliationDatabase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 if (ShouldAffiliationBasedMatchingBeActive(profile) && 185 if (ShouldAffiliationBasedMatchingBeActive(profile) &&
186 !password_store->HasAffiliatedMatchHelper()) { 186 !password_store->HasAffiliatedMatchHelper()) {
187 ActivateAffiliationBasedMatching(password_store.get(), profile); 187 ActivateAffiliationBasedMatching(password_store.get(), profile);
188 } else if (!ShouldAffiliationBasedMatchingBeActive(profile) && 188 } else if (!ShouldAffiliationBasedMatchingBeActive(profile) &&
189 password_store->HasAffiliatedMatchHelper()) { 189 password_store->HasAffiliatedMatchHelper()) {
190 password_store->SetAffiliatedMatchHelper( 190 password_store->SetAffiliatedMatchHelper(
191 make_scoped_ptr<password_manager::AffiliatedMatchHelper>(nullptr)); 191 make_scoped_ptr<password_manager::AffiliatedMatchHelper>(nullptr));
192 } 192 }
193 } 193 }
194 194
195 // static
196 void PasswordStoreFactory::TrimOrDeleteAffiliationCache(Profile* profile) {
197 scoped_refptr<PasswordStore> password_store =
198 GetForProfile(profile, ServiceAccessType::EXPLICIT_ACCESS);
199 if (password_store && password_store->HasAffiliatedMatchHelper()) {
200 password_store->TrimAffiliationCache();
201 } else {
202 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner(
203 content::BrowserThread::GetMessageLoopProxyForThread(
204 content::BrowserThread::DB));
205 password_manager::AffiliationService::DeleteCache(
206 GetAffiliationDatabasePath(profile), db_thread_runner.get());
207 }
208 }
209
195 PasswordStoreFactory::PasswordStoreFactory() 210 PasswordStoreFactory::PasswordStoreFactory()
196 : BrowserContextKeyedServiceFactory( 211 : BrowserContextKeyedServiceFactory(
197 "PasswordStore", 212 "PasswordStore",
198 BrowserContextDependencyManager::GetInstance()) { 213 BrowserContextDependencyManager::GetInstance()) {
199 DependsOn(WebDataServiceFactory::GetInstance()); 214 DependsOn(WebDataServiceFactory::GetInstance());
200 } 215 }
201 216
202 PasswordStoreFactory::~PasswordStoreFactory() {} 217 PasswordStoreFactory::~PasswordStoreFactory() {}
203 218
204 #if !defined(OS_CHROMEOS) && defined(USE_X11) 219 #if !defined(OS_CHROMEOS) && defined(USE_X11)
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 break; 446 break;
432 case LIBSECRET: 447 case LIBSECRET:
433 usage = OTHER_LIBSECRET; 448 usage = OTHER_LIBSECRET;
434 break; 449 break;
435 } 450 }
436 } 451 }
437 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, 452 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage,
438 MAX_BACKEND_USAGE_VALUE); 453 MAX_BACKEND_USAGE_VALUE);
439 } 454 }
440 #endif 455 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698