Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: components/password_manager/core/browser/password_store_default.h

Issue 1192963002: Implement PasswordStoreProxyMac and SimplePasswordStoreMac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed the comments Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "components/password_manager/core/browser/login_database.h" 11 #include "components/password_manager/core/browser/login_database.h"
12 #include "components/password_manager/core/browser/password_store.h" 12 #include "components/password_manager/core/browser/password_store.h"
13 13
14 namespace password_manager { 14 namespace password_manager {
15 15
16 // Simple password store implementation that delegates everything to 16 // Simple password store implementation that delegates everything to
17 // the LoginDatabase. 17 // the LoginDatabase.
18 class PasswordStoreDefault : public PasswordStore { 18 class PasswordStoreDefault : public PasswordStore {
19 public: 19 public:
20 // The |login_db| must not have been Init()-ed yet. It will be initialized in 20 // The |login_db| must not have been Init()-ed yet. It will be initialized in
21 // a deferred manner on the DB thread. 21 // a deferred manner on the DB thread.
22 PasswordStoreDefault( 22 PasswordStoreDefault(
23 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner, 23 scoped_refptr<base::SingleThreadTaskRunner> main_thread_runner,
24 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner, 24 scoped_refptr<base::SingleThreadTaskRunner> db_thread_runner,
25 scoped_ptr<LoginDatabase> login_db); 25 scoped_ptr<LoginDatabase> login_db);
26 26
27 bool Init(const syncer::SyncableService::StartSyncFlare& flare) override; 27 bool Init(const syncer::SyncableService::StartSyncFlare& flare) override;
28 28
29 void Shutdown() override;
30
29 // To be used only for testing. 31 // To be used only for testing.
30 LoginDatabase* login_db() const { return login_db_.get(); } 32 LoginDatabase* login_db() const { return login_db_.get(); }
31 33
32 protected: 34 protected:
33 ~PasswordStoreDefault() override; 35 ~PasswordStoreDefault() override;
34 36
35 // Opens |login_db_| on the DB thread. 37 // Opens |login_db_| on the DB thread.
36 void InitOnDBThread(); 38 void InitOnDBThread();
37 39
38 // Implements PasswordStore interface. 40 // Implements PasswordStore interface.
(...skipping 23 matching lines...) Expand all
62 void AddSiteStatsImpl(const InteractionsStats& stats) override; 64 void AddSiteStatsImpl(const InteractionsStats& stats) override;
63 void RemoveSiteStatsImpl(const GURL& origin_domain) override; 65 void RemoveSiteStatsImpl(const GURL& origin_domain) override;
64 scoped_ptr<InteractionsStats> GetSiteStatsImpl( 66 scoped_ptr<InteractionsStats> GetSiteStatsImpl(
65 const GURL& origin_domain) override; 67 const GURL& origin_domain) override;
66 68
67 inline bool DeleteAndRecreateDatabaseFile() { 69 inline bool DeleteAndRecreateDatabaseFile() {
68 return login_db_->DeleteAndRecreateDatabaseFile(); 70 return login_db_->DeleteAndRecreateDatabaseFile();
69 } 71 }
70 72
71 private: 73 private:
74 // Resets |login_db_| on the background thread.
75 void ResetLoginDB();
76
72 // The login SQL database. The LoginDatabase instance is received via the 77 // The login SQL database. The LoginDatabase instance is received via the
73 // in an uninitialized state, so as to allow injecting mocks, then Init() is 78 // in an uninitialized state, so as to allow injecting mocks, then Init() is
74 // called on the DB thread in a deferred manner. If opening the DB fails, 79 // called on the DB thread in a deferred manner. If opening the DB fails,
75 // |login_db_| will be reset and stay NULL for the lifetime of |this|. 80 // |login_db_| will be reset and stay NULL for the lifetime of |this|.
76 scoped_ptr<LoginDatabase> login_db_; 81 scoped_ptr<LoginDatabase> login_db_;
77 82
78 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); 83 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault);
79 }; 84 };
80 85
81 } // namespace password_manager 86 } // namespace password_manager
82 87
83 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_ 88 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_STORE_DEFAULT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698