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(syncer::SyncService* sync_service) { | 20 bool ShouldAffiliationBasedMatchingBeActive( |
| 21 sync_driver::SyncService* sync_service) { |
21 return base::FeatureList::IsEnabled(features::kAffiliationBasedMatching) && | 22 return base::FeatureList::IsEnabled(features::kAffiliationBasedMatching) && |
22 sync_service && sync_service->CanSyncStart() && | 23 sync_service && sync_service->CanSyncStart() && |
23 sync_service->IsSyncActive() && | 24 sync_service->IsSyncActive() && |
24 sync_service->GetPreferredDataTypes().Has(syncer::PASSWORDS) && | 25 sync_service->GetPreferredDataTypes().Has(syncer::PASSWORDS) && |
25 !sync_service->IsUsingSecondaryPassphrase(); | 26 !sync_service->IsUsingSecondaryPassphrase(); |
26 } | 27 } |
27 | 28 |
28 void ActivateAffiliationBasedMatching( | 29 void ActivateAffiliationBasedMatching( |
29 PasswordStore* password_store, | 30 PasswordStore* password_store, |
30 net::URLRequestContextGetter* request_context_getter, | 31 net::URLRequestContextGetter* request_context_getter, |
(...skipping 16 matching lines...) Expand all Loading... |
47 } | 48 } |
48 | 49 |
49 base::FilePath GetAffiliationDatabasePath(const base::FilePath& profile_path) { | 50 base::FilePath GetAffiliationDatabasePath(const base::FilePath& profile_path) { |
50 return profile_path.Append(kAffiliationDatabaseFileName); | 51 return profile_path.Append(kAffiliationDatabaseFileName); |
51 } | 52 } |
52 | 53 |
53 } // namespace | 54 } // namespace |
54 | 55 |
55 void ToggleAffiliationBasedMatchingBasedOnPasswordSyncedState( | 56 void ToggleAffiliationBasedMatchingBasedOnPasswordSyncedState( |
56 PasswordStore* password_store, | 57 PasswordStore* password_store, |
57 syncer::SyncService* sync_service, | 58 sync_driver::SyncService* sync_service, |
58 net::URLRequestContextGetter* request_context_getter, | 59 net::URLRequestContextGetter* request_context_getter, |
59 const base::FilePath& profile_path, | 60 const base::FilePath& profile_path, |
60 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner) { | 61 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner) { |
61 DCHECK(password_store); | 62 DCHECK(password_store); |
62 | 63 |
63 const bool matching_should_be_active = | 64 const bool matching_should_be_active = |
64 ShouldAffiliationBasedMatchingBeActive(sync_service); | 65 ShouldAffiliationBasedMatchingBeActive(sync_service); |
65 const bool matching_is_active = | 66 const bool matching_is_active = |
66 password_store->affiliated_match_helper() != nullptr; | 67 password_store->affiliated_match_helper() != nullptr; |
67 | 68 |
(...skipping 19 matching lines...) Expand all Loading... |
87 } | 88 } |
88 } | 89 } |
89 | 90 |
90 std::unique_ptr<LoginDatabase> CreateLoginDatabase( | 91 std::unique_ptr<LoginDatabase> CreateLoginDatabase( |
91 const base::FilePath& profile_path) { | 92 const base::FilePath& profile_path) { |
92 base::FilePath login_db_file_path = profile_path.Append(kLoginDataFileName); | 93 base::FilePath login_db_file_path = profile_path.Append(kLoginDataFileName); |
93 return base::MakeUnique<LoginDatabase>(login_db_file_path); | 94 return base::MakeUnique<LoginDatabase>(login_db_file_path); |
94 } | 95 } |
95 | 96 |
96 } // namespace password_manager | 97 } // namespace password_manager |
OLD | NEW |