OLD | NEW |
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 if (ShouldAffiliationBasedMatchingBeActive(profile) && | 186 if (ShouldAffiliationBasedMatchingBeActive(profile) && |
187 !password_store->HasAffiliatedMatchHelper()) { | 187 !password_store->HasAffiliatedMatchHelper()) { |
188 ActivateAffiliationBasedMatching(password_store.get(), profile); | 188 ActivateAffiliationBasedMatching(password_store.get(), profile); |
189 } else if (!ShouldAffiliationBasedMatchingBeActive(profile) && | 189 } else if (!ShouldAffiliationBasedMatchingBeActive(profile) && |
190 password_store->HasAffiliatedMatchHelper()) { | 190 password_store->HasAffiliatedMatchHelper()) { |
191 password_store->SetAffiliatedMatchHelper( | 191 password_store->SetAffiliatedMatchHelper( |
192 make_scoped_ptr<password_manager::AffiliatedMatchHelper>(nullptr)); | 192 make_scoped_ptr<password_manager::AffiliatedMatchHelper>(nullptr)); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
| 196 // static |
| 197 void PasswordStoreFactory::TrimOrDeleteAffiliationCache(Profile* profile) { |
| 198 scoped_refptr<PasswordStore> password_store = |
| 199 GetForProfile(profile, ServiceAccessType::EXPLICIT_ACCESS); |
| 200 if (password_store && password_store->HasAffiliatedMatchHelper()) { |
| 201 password_store->TrimAffiliationCache(); |
| 202 } else { |
| 203 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner( |
| 204 content::BrowserThread::GetMessageLoopProxyForThread( |
| 205 content::BrowserThread::DB)); |
| 206 password_manager::AffiliationService::DeleteCache( |
| 207 GetAffiliationDatabasePath(profile), db_thread_runner.get()); |
| 208 } |
| 209 } |
| 210 |
196 PasswordStoreFactory::PasswordStoreFactory() | 211 PasswordStoreFactory::PasswordStoreFactory() |
197 : BrowserContextKeyedServiceFactory( | 212 : BrowserContextKeyedServiceFactory( |
198 "PasswordStore", | 213 "PasswordStore", |
199 BrowserContextDependencyManager::GetInstance()) { | 214 BrowserContextDependencyManager::GetInstance()) { |
200 DependsOn(WebDataServiceFactory::GetInstance()); | 215 DependsOn(WebDataServiceFactory::GetInstance()); |
201 } | 216 } |
202 | 217 |
203 PasswordStoreFactory::~PasswordStoreFactory() {} | 218 PasswordStoreFactory::~PasswordStoreFactory() {} |
204 | 219 |
205 #if !defined(OS_CHROMEOS) && defined(USE_X11) | 220 #if !defined(OS_CHROMEOS) && defined(USE_X11) |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 break; | 445 break; |
431 case LIBSECRET: | 446 case LIBSECRET: |
432 usage = OTHER_LIBSECRET; | 447 usage = OTHER_LIBSECRET; |
433 break; | 448 break; |
434 } | 449 } |
435 } | 450 } |
436 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, | 451 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, |
437 MAX_BACKEND_USAGE_VALUE); | 452 MAX_BACKEND_USAGE_VALUE); |
438 } | 453 } |
439 #endif | 454 #endif |
OLD | NEW |