| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/password_manager/core/browser/password_store_factory_util.h
" | 5 #include "components/password_manager/core/browser/password_store_factory_util.h
" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "components/password_manager/core/browser/affiliated_match_helper.h" | 10 #include "components/password_manager/core/browser/affiliated_match_helper.h" |
| 11 #include "components/password_manager/core/browser/affiliation_service.h" | 11 #include "components/password_manager/core/browser/affiliation_service.h" |
| 12 #include "components/password_manager/core/browser/affiliation_utils.h" | 12 #include "components/password_manager/core/browser/affiliation_utils.h" |
| 13 #include "components/password_manager/core/browser/password_manager_constants.h" | 13 #include "components/password_manager/core/browser/password_manager_constants.h" |
| 14 #include "components/password_manager/core/common/password_manager_features.h" | 14 #include "components/password_manager/core/common/password_manager_features.h" |
| 15 | 15 |
| 16 namespace password_manager { | 16 namespace password_manager { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 bool ShouldAffiliationBasedMatchingBeActive( | 20 bool ShouldAffiliationBasedMatchingBeActive(syncer::SyncService* sync_service) { |
| 21 sync_driver::SyncService* sync_service) { | |
| 22 return base::FeatureList::IsEnabled(features::kAffiliationBasedMatching) && | 21 return base::FeatureList::IsEnabled(features::kAffiliationBasedMatching) && |
| 23 sync_service && sync_service->CanSyncStart() && | 22 sync_service && sync_service->CanSyncStart() && |
| 24 sync_service->IsSyncActive() && | 23 sync_service->IsSyncActive() && |
| 25 sync_service->GetPreferredDataTypes().Has(syncer::PASSWORDS) && | 24 sync_service->GetPreferredDataTypes().Has(syncer::PASSWORDS) && |
| 26 !sync_service->IsUsingSecondaryPassphrase(); | 25 !sync_service->IsUsingSecondaryPassphrase(); |
| 27 } | 26 } |
| 28 | 27 |
| 29 void ActivateAffiliationBasedMatching( | 28 void ActivateAffiliationBasedMatching( |
| 30 PasswordStore* password_store, | 29 PasswordStore* password_store, |
| 31 net::URLRequestContextGetter* request_context_getter, | 30 net::URLRequestContextGetter* request_context_getter, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 48 } | 47 } |
| 49 | 48 |
| 50 base::FilePath GetAffiliationDatabasePath(const base::FilePath& profile_path) { | 49 base::FilePath GetAffiliationDatabasePath(const base::FilePath& profile_path) { |
| 51 return profile_path.Append(kAffiliationDatabaseFileName); | 50 return profile_path.Append(kAffiliationDatabaseFileName); |
| 52 } | 51 } |
| 53 | 52 |
| 54 } // namespace | 53 } // namespace |
| 55 | 54 |
| 56 void ToggleAffiliationBasedMatchingBasedOnPasswordSyncedState( | 55 void ToggleAffiliationBasedMatchingBasedOnPasswordSyncedState( |
| 57 PasswordStore* password_store, | 56 PasswordStore* password_store, |
| 58 sync_driver::SyncService* sync_service, | 57 syncer::SyncService* sync_service, |
| 59 net::URLRequestContextGetter* request_context_getter, | 58 net::URLRequestContextGetter* request_context_getter, |
| 60 const base::FilePath& profile_path, | 59 const base::FilePath& profile_path, |
| 61 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner) { | 60 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner) { |
| 62 DCHECK(password_store); | 61 DCHECK(password_store); |
| 63 | 62 |
| 64 const bool matching_should_be_active = | 63 const bool matching_should_be_active = |
| 65 ShouldAffiliationBasedMatchingBeActive(sync_service); | 64 ShouldAffiliationBasedMatchingBeActive(sync_service); |
| 66 const bool matching_is_active = | 65 const bool matching_is_active = |
| 67 password_store->affiliated_match_helper() != nullptr; | 66 password_store->affiliated_match_helper() != nullptr; |
| 68 | 67 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 88 } | 87 } |
| 89 } | 88 } |
| 90 | 89 |
| 91 std::unique_ptr<LoginDatabase> CreateLoginDatabase( | 90 std::unique_ptr<LoginDatabase> CreateLoginDatabase( |
| 92 const base::FilePath& profile_path) { | 91 const base::FilePath& profile_path) { |
| 93 base::FilePath login_db_file_path = profile_path.Append(kLoginDataFileName); | 92 base::FilePath login_db_file_path = profile_path.Append(kLoginDataFileName); |
| 94 return base::MakeUnique<LoginDatabase>(login_db_file_path); | 93 return base::MakeUnique<LoginDatabase>(login_db_file_path); |
| 95 } | 94 } |
| 96 | 95 |
| 97 } // namespace password_manager | 96 } // namespace password_manager |
| OLD | NEW |