| 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_STUB_PASSWORD_MANAGER_CLIENT_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_PASSWORD_MANAGER_CLIENT_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_PASSWORD_MANAGER_CLIENT_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_PASSWORD_MANAGER_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/password_manager/core/browser/password_manager_client.h" | 9 #include "components/password_manager/core/browser/password_manager_client.h" |
| 10 #include "components/password_manager/core/browser/stub_credentials_filter.h" | 10 #include "components/password_manager/core/browser/stub_credentials_filter.h" |
| 11 #include "components/password_manager/core/browser/stub_log_manager.h" | 11 #include "components/password_manager/core/browser/stub_log_manager.h" |
| 12 | 12 |
| 13 namespace password_manager { | 13 namespace password_manager { |
| 14 | 14 |
| 15 // Use this class as a base for mock or test clients to avoid stubbing | 15 // Use this class as a base for mock or test clients to avoid stubbing |
| 16 // uninteresting pure virtual methods. All the implemented methods are just | 16 // uninteresting pure virtual methods. All the implemented methods are just |
| 17 // trivial stubs. Do NOT use in production, only use in tests. | 17 // trivial stubs. Do NOT use in production, only use in tests. |
| 18 class StubPasswordManagerClient : public PasswordManagerClient { | 18 class StubPasswordManagerClient : public PasswordManagerClient { |
| 19 public: | 19 public: |
| 20 StubPasswordManagerClient(); | 20 StubPasswordManagerClient(); |
| 21 ~StubPasswordManagerClient() override; | 21 ~StubPasswordManagerClient() override; |
| 22 | 22 |
| 23 // PasswordManagerClient: | 23 // PasswordManagerClient: |
| 24 bool PromptUserToSaveOrUpdatePassword( | 24 bool PromptUserToSaveOrUpdatePassword( |
| 25 std::unique_ptr<PasswordFormManager> form_to_save, | 25 scoped_refptr<PasswordFormManager> form_to_save, |
| 26 bool update_password) override; | 26 bool update_password) override; |
| 27 bool PromptUserToChooseCredentials( | 27 bool PromptUserToChooseCredentials( |
| 28 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, | 28 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, |
| 29 const GURL& origin, | 29 const GURL& origin, |
| 30 const CredentialsCallback& callback) override; | 30 const CredentialsCallback& callback) override; |
| 31 void NotifyUserAutoSignin( | 31 void NotifyUserAutoSignin( |
| 32 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, | 32 std::vector<std::unique_ptr<autofill::PasswordForm>> local_forms, |
| 33 const GURL& origin) override; | 33 const GURL& origin) override; |
| 34 void NotifyUserCouldBeAutoSignedIn( | 34 void NotifyUserCouldBeAutoSignedIn( |
| 35 std::unique_ptr<autofill::PasswordForm>) override; | 35 std::unique_ptr<autofill::PasswordForm>) override; |
| 36 void NotifySuccessfulLoginWithExistingPassword( | 36 void NotifySuccessfulLoginWithExistingPassword( |
| 37 const autofill::PasswordForm& form) override; | 37 const autofill::PasswordForm& form) override; |
| 38 void NotifyStorePasswordCalled() override; | 38 void NotifyStorePasswordCalled() override; |
| 39 void AutomaticPasswordSave( | 39 void AutomaticPasswordSave( |
| 40 std::unique_ptr<PasswordFormManager> saved_manager) override; | 40 scoped_refptr<PasswordFormManager> saved_manager) override; |
| 41 PrefService* GetPrefs() override; | 41 PrefService* GetPrefs() override; |
| 42 PasswordStore* GetPasswordStore() const override; | 42 PasswordStore* GetPasswordStore() const override; |
| 43 const GURL& GetLastCommittedEntryURL() const override; | 43 const GURL& GetLastCommittedEntryURL() const override; |
| 44 const CredentialsFilter* GetStoreResultFilter() const override; | 44 const CredentialsFilter* GetStoreResultFilter() const override; |
| 45 const LogManager* GetLogManager() const override; | 45 const LogManager* GetLogManager() const override; |
| 46 #if defined(SAFE_BROWSING_DB_LOCAL) | 46 #if defined(SAFE_BROWSING_DB_LOCAL) |
| 47 safe_browsing::PasswordProtectionService* GetPasswordProtectionService() | 47 safe_browsing::PasswordProtectionService* GetPasswordProtectionService() |
| 48 const override; | 48 const override; |
| 49 void CheckSafeBrowsingReputation(const GURL& form_action, | 49 void CheckSafeBrowsingReputation(const GURL& form_action, |
| 50 const GURL& frame_url) override; | 50 const GURL& frame_url) override; |
| 51 void CheckProtectedPasswordEntry( | 51 void CheckProtectedPasswordEntry( |
| 52 const std::string& password_saved_domain) override; | 52 const std::string& password_saved_domain) override; |
| 53 #endif | 53 #endif |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 const StubCredentialsFilter credentials_filter_; | 56 const StubCredentialsFilter credentials_filter_; |
| 57 StubLogManager log_manager_; | 57 StubLogManager log_manager_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(StubPasswordManagerClient); | 59 DISALLOW_COPY_AND_ASSIGN(StubPasswordManagerClient); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace password_manager | 62 } // namespace password_manager |
| 63 | 63 |
| 64 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_PASSWORD_MANAGER_CLIENT
_H_ | 64 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_STUB_PASSWORD_MANAGER_CLIENT
_H_ |
| OLD | NEW |