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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 DCHECK(profile); | 96 DCHECK(profile); |
97 ProfileSyncService* profile_sync_service = | 97 ProfileSyncService* profile_sync_service = |
98 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 98 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
99 return profile_sync_service && | 99 return profile_sync_service && |
100 profile_sync_service->IsSyncEnabledAndLoggedIn() && | 100 profile_sync_service->IsSyncEnabledAndLoggedIn() && |
101 profile_sync_service->SyncActive() && | 101 profile_sync_service->SyncActive() && |
102 profile_sync_service->GetPreferredDataTypes().Has(syncer::PASSWORDS) && | 102 profile_sync_service->GetPreferredDataTypes().Has(syncer::PASSWORDS) && |
103 !profile_sync_service->IsUsingSecondaryPassphrase(); | 103 !profile_sync_service->IsUsingSecondaryPassphrase(); |
104 } | 104 } |
105 | 105 |
| 106 bool ShouldPropagatingPasswordChangesToWebCredentialsBeEnabled() { |
| 107 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 108 return password_manager::IsPropagatingPasswordChangesToWebCredentialsEnabled( |
| 109 *command_line); |
| 110 } |
| 111 |
106 void ActivateAffiliationBasedMatching(PasswordStore* password_store, | 112 void ActivateAffiliationBasedMatching(PasswordStore* password_store, |
107 Profile* profile) { | 113 Profile* profile) { |
108 DCHECK(password_store); | 114 DCHECK(password_store); |
109 DCHECK(profile); | 115 DCHECK(profile); |
110 | 116 |
111 // The PasswordStore is so far the only consumer of the AffiliationService, | 117 // The PasswordStore is so far the only consumer of the AffiliationService, |
112 // therefore the service is owned by the AffiliatedMatchHelper, which in | 118 // therefore the service is owned by the AffiliatedMatchHelper, which in |
113 // turn is owned by the PasswordStore. | 119 // turn is owned by the PasswordStore. |
114 // TODO(engedy): Double-check which request context we want. | 120 // TODO(engedy): Double-check which request context we want. |
115 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner( | 121 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner( |
116 content::BrowserThread::GetMessageLoopProxyForThread( | 122 content::BrowserThread::GetMessageLoopProxyForThread( |
117 content::BrowserThread::DB)); | 123 content::BrowserThread::DB)); |
118 scoped_ptr<password_manager::AffiliationService> affiliation_service( | 124 scoped_ptr<password_manager::AffiliationService> affiliation_service( |
119 new password_manager::AffiliationService(db_thread_runner)); | 125 new password_manager::AffiliationService(db_thread_runner)); |
120 affiliation_service->Initialize(profile->GetRequestContext(), | 126 affiliation_service->Initialize(profile->GetRequestContext(), |
121 GetAffiliationDatabasePath(profile)); | 127 GetAffiliationDatabasePath(profile)); |
122 scoped_ptr<password_manager::AffiliatedMatchHelper> affiliated_match_helper( | 128 scoped_ptr<password_manager::AffiliatedMatchHelper> affiliated_match_helper( |
123 new password_manager::AffiliatedMatchHelper(password_store, | 129 new password_manager::AffiliatedMatchHelper(password_store, |
124 affiliation_service.Pass())); | 130 affiliation_service.Pass())); |
125 affiliated_match_helper->Initialize(); | 131 affiliated_match_helper->Initialize(); |
126 password_store->SetAffiliatedMatchHelper(affiliated_match_helper.Pass()); | 132 password_store->SetAffiliatedMatchHelper(affiliated_match_helper.Pass()); |
| 133 password_store->enable_propagating_password_changes_to_web_credentials( |
| 134 ShouldPropagatingPasswordChangesToWebCredentialsBeEnabled()); |
127 } | 135 } |
128 | 136 |
129 } // namespace | 137 } // namespace |
130 | 138 |
131 | 139 |
132 PasswordStoreService::PasswordStoreService( | 140 PasswordStoreService::PasswordStoreService( |
133 scoped_refptr<PasswordStore> password_store) | 141 scoped_refptr<PasswordStore> password_store) |
134 : password_store_(password_store) {} | 142 : password_store_(password_store) {} |
135 | 143 |
136 PasswordStoreService::~PasswordStoreService() {} | 144 PasswordStoreService::~PasswordStoreService() {} |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 break; | 431 break; |
424 case LIBSECRET: | 432 case LIBSECRET: |
425 usage = OTHER_LIBSECRET; | 433 usage = OTHER_LIBSECRET; |
426 break; | 434 break; |
427 } | 435 } |
428 } | 436 } |
429 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, | 437 UMA_HISTOGRAM_ENUMERATION("PasswordManager.LinuxBackendStatistics", usage, |
430 MAX_BACKEND_USAGE_VALUE); | 438 MAX_BACKEND_USAGE_VALUE); |
431 } | 439 } |
432 #endif | 440 #endif |
OLD | NEW |