| 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/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" | 
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" | 
| 11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" | 
| 12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" | 
| 13 #include "chrome/browser/profiles/incognito_helpers.h" | 13 #include "chrome/browser/profiles/incognito_helpers.h" | 
| 14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" | 
| 15 #include "chrome/browser/sync/glue/sync_start_util.h" | 15 #include "chrome/browser/sync/glue/sync_start_util.h" | 
| 16 #include "chrome/browser/sync/profile_sync_service.h" | 16 #include "chrome/browser/sync/profile_sync_service.h" | 
| 17 #include "chrome/browser/sync/profile_sync_service_factory.h" | 17 #include "chrome/browser/sync/profile_sync_service_factory.h" | 
| 18 #include "chrome/browser/web_data_service_factory.h" | 18 #include "chrome/browser/web_data_service_factory.h" | 
| 19 #include "chrome/common/chrome_constants.h" |  | 
| 20 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" | 
| 21 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 20 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 
| 22 #include "components/os_crypt/os_crypt_switches.h" | 21 #include "components/os_crypt/os_crypt_switches.h" | 
| 23 #include "components/password_manager/core/browser/affiliated_match_helper.h" | 22 #include "components/password_manager/core/browser/affiliated_match_helper.h" | 
| 24 #include "components/password_manager/core/browser/affiliation_service.h" | 23 #include "components/password_manager/core/browser/affiliation_service.h" | 
| 25 #include "components/password_manager/core/browser/affiliation_utils.h" | 24 #include "components/password_manager/core/browser/affiliation_utils.h" | 
| 26 #include "components/password_manager/core/browser/login_database.h" | 25 #include "components/password_manager/core/browser/login_database.h" | 
|  | 26 #include "components/password_manager/core/browser/password_manager_constants.h" | 
| 27 #include "components/password_manager/core/browser/password_store.h" | 27 #include "components/password_manager/core/browser/password_store.h" | 
| 28 #include "components/password_manager/core/browser/password_store_default.h" | 28 #include "components/password_manager/core/browser/password_store_default.h" | 
| 29 #include "components/password_manager/core/common/password_manager_pref_names.h" | 29 #include "components/password_manager/core/common/password_manager_pref_names.h" | 
| 30 #include "components/pref_registry/pref_registry_syncable.h" | 30 #include "components/pref_registry/pref_registry_syncable.h" | 
| 31 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" | 
| 32 | 32 | 
| 33 #if defined(OS_WIN) | 33 #if defined(OS_WIN) | 
| 34 #include "chrome/browser/password_manager/password_manager_util_win.h" | 34 #include "chrome/browser/password_manager/password_manager_util_win.h" | 
| 35 #include "chrome/browser/password_manager/password_store_win.h" | 35 #include "chrome/browser/password_manager/password_store_win.h" | 
| 36 #include "components/password_manager/core/browser/webdata/password_web_data_ser
     vice_win.h" | 36 #include "components/password_manager/core/browser/webdata/password_web_data_ser
     vice_win.h" | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 62     static_cast<LocalProfileId>(0); | 62     static_cast<LocalProfileId>(0); | 
| 63 #endif | 63 #endif | 
| 64 | 64 | 
| 65 #if defined(USE_LIBSECRET) | 65 #if defined(USE_LIBSECRET) | 
| 66 const char kLibsecretFieldTrialName[] = "Libsecret"; | 66 const char kLibsecretFieldTrialName[] = "Libsecret"; | 
| 67 const char kLibsecretFieldTrialDisabledGroupName[] = "Disabled"; | 67 const char kLibsecretFieldTrialDisabledGroupName[] = "Disabled"; | 
| 68 #endif | 68 #endif | 
| 69 | 69 | 
| 70 base::FilePath GetAffiliationDatabasePath(Profile* profile) { | 70 base::FilePath GetAffiliationDatabasePath(Profile* profile) { | 
| 71   DCHECK(profile); | 71   DCHECK(profile); | 
| 72   return profile->GetPath().Append(chrome::kAffiliationDatabaseFileName); | 72   return profile->GetPath().Append( | 
|  | 73       password_manager::kAffiliationDatabaseFileName); | 
| 73 } | 74 } | 
| 74 | 75 | 
| 75 bool ShouldAffiliationBasedMatchingBeActive(Profile* profile) { | 76 bool ShouldAffiliationBasedMatchingBeActive(Profile* profile) { | 
| 76   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 77   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 
| 77   if (!password_manager::IsAffiliationBasedMatchingEnabled(*command_line)) | 78   if (!password_manager::IsAffiliationBasedMatchingEnabled(*command_line)) | 
| 78     return false; | 79     return false; | 
| 79 | 80 | 
| 80   DCHECK(profile); | 81   DCHECK(profile); | 
| 81   ProfileSyncService* profile_sync_service = | 82   ProfileSyncService* profile_sync_service = | 
| 82       ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 83       ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 226 KeyedService* PasswordStoreFactory::BuildServiceInstanceFor( | 227 KeyedService* PasswordStoreFactory::BuildServiceInstanceFor( | 
| 227     content::BrowserContext* context) const { | 228     content::BrowserContext* context) const { | 
| 228 #if defined(OS_WIN) | 229 #if defined(OS_WIN) | 
| 229   password_manager_util_win::DelayReportOsPassword(); | 230   password_manager_util_win::DelayReportOsPassword(); | 
| 230 #endif | 231 #endif | 
| 231   Profile* profile = static_cast<Profile*>(context); | 232   Profile* profile = static_cast<Profile*>(context); | 
| 232 | 233 | 
| 233   // Given that LoginDatabase::Init() takes ~100ms on average; it will be called | 234   // Given that LoginDatabase::Init() takes ~100ms on average; it will be called | 
| 234   // by PasswordStore::Init() on the background thread to avoid UI jank. | 235   // by PasswordStore::Init() on the background thread to avoid UI jank. | 
| 235   base::FilePath login_db_file_path = profile->GetPath(); | 236   base::FilePath login_db_file_path = profile->GetPath(); | 
| 236   login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName); | 237   login_db_file_path = | 
|  | 238       login_db_file_path.Append(password_manager::kLoginDataFileName); | 
| 237   scoped_ptr<password_manager::LoginDatabase> login_db( | 239   scoped_ptr<password_manager::LoginDatabase> login_db( | 
| 238       new password_manager::LoginDatabase(login_db_file_path)); | 240       new password_manager::LoginDatabase(login_db_file_path)); | 
| 239 | 241 | 
| 240   scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner( | 242   scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner( | 
| 241       base::ThreadTaskRunnerHandle::Get()); | 243       base::ThreadTaskRunnerHandle::Get()); | 
| 242   scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner( | 244   scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner( | 
| 243       content::BrowserThread::GetMessageLoopProxyForThread( | 245       content::BrowserThread::GetMessageLoopProxyForThread( | 
| 244           content::BrowserThread::DB)); | 246           content::BrowserThread::DB)); | 
| 245 | 247 | 
| 246   scoped_refptr<PasswordStore> ps; | 248   scoped_refptr<PasswordStore> ps; | 
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 433         break; | 435         break; | 
| 434       case LIBSECRET: | 436       case LIBSECRET: | 
| 435         usage = OTHER_LIBSECRET; | 437         usage = OTHER_LIBSECRET; | 
| 436         break; | 438         break; | 
| 437     } | 439     } | 
| 438   } | 440   } | 
| 439   UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, | 441   UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, | 
| 440                             MAX_BACKEND_USAGE_VALUE); | 442                             MAX_BACKEND_USAGE_VALUE); | 
| 441 } | 443 } | 
| 442 #endif | 444 #endif | 
| OLD | NEW | 
|---|