Chromium Code Reviews| 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 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT_H_ |
| 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
|
Lei Zhang
2012/04/26 19:44:49
I think you can remove this guy too?
Mike Mammarella
2012/04/26 20:58:18
Done.
| |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "chrome/browser/password_manager/login_database.h" | 13 #include "chrome/browser/password_manager/login_database.h" |
| 14 #include "chrome/browser/password_manager/password_store.h" | 14 #include "chrome/browser/password_manager/password_store.h" |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 class WebDataService; | |
| 18 | 17 |
| 19 // Simple password store implementation that delegates everything to | 18 // Simple password store implementation that delegates everything to |
| 20 // the LoginDatabase. | 19 // the LoginDatabase. |
| 21 class PasswordStoreDefault : public PasswordStore { | 20 class PasswordStoreDefault : public PasswordStore { |
| 22 public: | 21 public: |
| 23 // Takes ownership of |login_db|. | 22 // Takes ownership of |login_db|. |
| 24 PasswordStoreDefault(LoginDatabase* login_db, | 23 PasswordStoreDefault(LoginDatabase* login_db, |
| 25 Profile* profile, | 24 Profile* profile); |
| 26 WebDataService* web_data_service); | |
| 27 | 25 |
| 28 protected: | 26 protected: |
| 29 virtual ~PasswordStoreDefault(); | 27 virtual ~PasswordStoreDefault(); |
| 30 | 28 |
| 31 // Implements RefCountedProfileKeyedService. | 29 // Implements RefCountedProfileKeyedService. |
| 32 virtual void ShutdownOnUIThread() OVERRIDE; | 30 virtual void ShutdownOnUIThread() OVERRIDE; |
| 33 | 31 |
| 34 // Implements PasswordStore interface. | 32 // Implements PasswordStore interface. |
| 35 virtual void ReportMetricsImpl() OVERRIDE; | 33 virtual void ReportMetricsImpl() OVERRIDE; |
| 36 virtual void AddLoginImpl(const webkit::forms::PasswordForm& form) OVERRIDE; | 34 virtual void AddLoginImpl(const webkit::forms::PasswordForm& form) OVERRIDE; |
| 37 virtual void UpdateLoginImpl( | 35 virtual void UpdateLoginImpl( |
| 38 const webkit::forms::PasswordForm& form) OVERRIDE; | 36 const webkit::forms::PasswordForm& form) OVERRIDE; |
| 39 virtual void RemoveLoginImpl( | 37 virtual void RemoveLoginImpl( |
| 40 const webkit::forms::PasswordForm& form) OVERRIDE; | 38 const webkit::forms::PasswordForm& form) OVERRIDE; |
| 41 virtual void RemoveLoginsCreatedBetweenImpl( | 39 virtual void RemoveLoginsCreatedBetweenImpl( |
| 42 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; | 40 const base::Time& delete_begin, const base::Time& delete_end) OVERRIDE; |
| 43 virtual void GetLoginsImpl(GetLoginsRequest* request, | 41 virtual void GetLoginsImpl(GetLoginsRequest* request, |
| 44 const webkit::forms::PasswordForm& form) OVERRIDE; | 42 const webkit::forms::PasswordForm& form) OVERRIDE; |
| 45 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE; | 43 virtual void GetAutofillableLoginsImpl(GetLoginsRequest* request) OVERRIDE; |
| 46 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE; | 44 virtual void GetBlacklistLoginsImpl(GetLoginsRequest* request) OVERRIDE; |
| 47 virtual bool FillAutofillableLogins( | 45 virtual bool FillAutofillableLogins( |
| 48 std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; | 46 std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; |
| 49 virtual bool FillBlacklistLogins( | 47 virtual bool FillBlacklistLogins( |
| 50 std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; | 48 std::vector<webkit::forms::PasswordForm*>* forms) OVERRIDE; |
| 51 | 49 |
| 52 scoped_refptr<WebDataService> web_data_service_; | |
| 53 | |
| 54 protected: | 50 protected: |
| 55 inline bool DeleteAndRecreateDatabaseFile() { | 51 inline bool DeleteAndRecreateDatabaseFile() { |
| 56 return login_db_->DeleteAndRecreateDatabaseFile(); | 52 return login_db_->DeleteAndRecreateDatabaseFile(); |
| 57 } | 53 } |
| 58 | 54 |
| 59 private: | 55 private: |
| 60 class MigrateHelper; | |
| 61 | |
| 62 // Migrates logins from the WDS to the LoginDatabase. | |
| 63 void MigrateIfNecessary(); | |
| 64 | |
| 65 scoped_ptr<LoginDatabase> login_db_; | 56 scoped_ptr<LoginDatabase> login_db_; |
| 66 Profile* profile_; | 57 Profile* profile_; |
| 67 | 58 |
| 68 scoped_ptr<MigrateHelper> migrate_helper_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); | 59 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); |
| 71 }; | 60 }; |
| 72 | 61 |
| 73 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT_H_ | 62 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT_H_ |
| OLD | NEW |