OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 ScopedVector<autofill::PasswordForm>* forms) override; | 61 ScopedVector<autofill::PasswordForm>* forms) override; |
62 void AddSiteStatsImpl(const InteractionsStats& stats) override; | 62 void AddSiteStatsImpl(const InteractionsStats& stats) override; |
63 void RemoveSiteStatsImpl(const GURL& origin_domain) override; | 63 void RemoveSiteStatsImpl(const GURL& origin_domain) override; |
64 scoped_ptr<InteractionsStats> GetSiteStatsImpl( | 64 scoped_ptr<InteractionsStats> GetSiteStatsImpl( |
65 const GURL& origin_domain) override; | 65 const GURL& origin_domain) override; |
66 | 66 |
67 inline bool DeleteAndRecreateDatabaseFile() { | 67 inline bool DeleteAndRecreateDatabaseFile() { |
68 return login_db_->DeleteAndRecreateDatabaseFile(); | 68 return login_db_->DeleteAndRecreateDatabaseFile(); |
69 } | 69 } |
70 | 70 |
| 71 void set_login_db(scoped_ptr<password_manager::LoginDatabase> login_db) { |
| 72 login_db_.swap(login_db); |
| 73 } |
| 74 |
71 private: | 75 private: |
72 // Resets |login_db_| on the background thread. | 76 // Resets |login_db_| on the background thread. |
73 void ResetLoginDB(); | 77 void ResetLoginDB(); |
74 | 78 |
75 // The login SQL database. The LoginDatabase instance is received via the | 79 // The login SQL database. The LoginDatabase instance is received via the |
76 // in an uninitialized state, so as to allow injecting mocks, then Init() is | 80 // in an uninitialized state, so as to allow injecting mocks, then Init() is |
77 // called on the DB thread in a deferred manner. If opening the DB fails, | 81 // called on the DB thread in a deferred manner. If opening the DB fails, |
78 // |login_db_| will be reset and stay NULL for the lifetime of |this|. | 82 // |login_db_| will be reset and stay NULL for the lifetime of |this|. |
79 scoped_ptr<LoginDatabase> login_db_; | 83 scoped_ptr<LoginDatabase> login_db_; |
80 | 84 |
81 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); | 85 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); |
82 }; | 86 }; |
83 | 87 |
84 } // namespace password_manager | 88 } // namespace password_manager |
85 | 89 |
86 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ | 90 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ |
OLD | NEW |