| 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_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_I
MPL_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_I
MPL_H_ |
| 6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_I
MPL_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGER_I
MPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "components/password_manager/content/common/credential_manager.mojom.h" | 13 #include "components/password_manager/content/common/credential_manager.mojom.h" |
| 14 #include "components/password_manager/core/browser/credential_manager_password_f
orm_manager.h" | 14 #include "components/password_manager/core/browser/credential_manager_password_f
orm_manager.h" |
| 15 #include "components/password_manager/core/browser/credential_manager_pending_pr
event_silent_access_task.h" |
| 15 #include "components/password_manager/core/browser/credential_manager_pending_re
quest_task.h" | 16 #include "components/password_manager/core/browser/credential_manager_pending_re
quest_task.h" |
| 16 #include "components/password_manager/core/browser/credential_manager_pending_re
quire_user_mediation_task.h" | |
| 17 #include "components/password_manager/core/browser/password_store_consumer.h" | 17 #include "components/password_manager/core/browser/password_store_consumer.h" |
| 18 #include "components/password_manager/core/common/credential_manager_types.h" | 18 #include "components/password_manager/core/common/credential_manager_types.h" |
| 19 #include "components/prefs/pref_member.h" | 19 #include "components/prefs/pref_member.h" |
| 20 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
| 21 #include "mojo/public/cpp/bindings/binding_set.h" | 21 #include "mojo/public/cpp/bindings/binding_set.h" |
| 22 | 22 |
| 23 class GURL; | 23 class GURL; |
| 24 | 24 |
| 25 namespace autofill { | 25 namespace autofill { |
| 26 struct PasswordForm; | 26 struct PasswordForm; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace content { | 29 namespace content { |
| 30 class WebContents; | 30 class WebContents; |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace password_manager { | 33 namespace password_manager { |
| 34 class CredentialManagerPasswordFormManager; | 34 class CredentialManagerPasswordFormManager; |
| 35 class PasswordManagerClient; | 35 class PasswordManagerClient; |
| 36 class PasswordManagerDriver; | 36 class PasswordManagerDriver; |
| 37 class PasswordStore; | 37 class PasswordStore; |
| 38 struct CredentialInfo; | 38 struct CredentialInfo; |
| 39 | 39 |
| 40 class CredentialManagerImpl | 40 class CredentialManagerImpl |
| 41 : public mojom::CredentialManager, | 41 : public mojom::CredentialManager, |
| 42 public content::WebContentsObserver, | 42 public content::WebContentsObserver, |
| 43 public CredentialManagerPasswordFormManagerDelegate, | 43 public CredentialManagerPasswordFormManagerDelegate, |
| 44 public CredentialManagerPendingRequestTaskDelegate, | 44 public CredentialManagerPendingRequestTaskDelegate, |
| 45 public CredentialManagerPendingRequireUserMediationTaskDelegate { | 45 public CredentialManagerPendingPreventSilentAccessTaskDelegate { |
| 46 public: | 46 public: |
| 47 CredentialManagerImpl(content::WebContents* web_contents, | 47 CredentialManagerImpl(content::WebContents* web_contents, |
| 48 PasswordManagerClient* client); | 48 PasswordManagerClient* client); |
| 49 ~CredentialManagerImpl() override; | 49 ~CredentialManagerImpl() override; |
| 50 | 50 |
| 51 void BindRequest(mojom::CredentialManagerRequest request); | 51 void BindRequest(mojom::CredentialManagerRequest request); |
| 52 | 52 |
| 53 // mojom::CredentialManager methods: | 53 // mojom::CredentialManager methods: |
| 54 void Store(const CredentialInfo& credential, StoreCallback callback) override; | 54 void Store(const CredentialInfo& credential, StoreCallback callback) override; |
| 55 void RequireUserMediation(RequireUserMediationCallback callback) override; | 55 void PreventSilentAccess(PreventSilentAccessCallback callback) override; |
| 56 void Get(CredentialMediationRequirement mediation, | 56 void Get(CredentialMediationRequirement mediation, |
| 57 bool include_passwords, | 57 bool include_passwords, |
| 58 const std::vector<GURL>& federations, | 58 const std::vector<GURL>& federations, |
| 59 GetCallback callback) override; | 59 GetCallback callback) override; |
| 60 | 60 |
| 61 // CredentialManagerPendingRequestTaskDelegate: | 61 // CredentialManagerPendingRequestTaskDelegate: |
| 62 bool IsZeroClickAllowed() const override; | 62 bool IsZeroClickAllowed() const override; |
| 63 GURL GetOrigin() const override; | 63 GURL GetOrigin() const override; |
| 64 void SendCredential(const SendCredentialCallback& send_callback, | 64 void SendCredential(const SendCredentialCallback& send_callback, |
| 65 const CredentialInfo& info) override; | 65 const CredentialInfo& info) override; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 87 std::unique_ptr<CredentialManagerPasswordFormManager> form_manager_; | 87 std::unique_ptr<CredentialManagerPasswordFormManager> form_manager_; |
| 88 | 88 |
| 89 // Set to false to disable automatic signing in. | 89 // Set to false to disable automatic signing in. |
| 90 BooleanPrefMember auto_signin_enabled_; | 90 BooleanPrefMember auto_signin_enabled_; |
| 91 | 91 |
| 92 // When 'OnRequestCredential' is called, it in turn calls out to the | 92 // When 'OnRequestCredential' is called, it in turn calls out to the |
| 93 // PasswordStore; we push enough data into Pending*Task objects so that | 93 // PasswordStore; we push enough data into Pending*Task objects so that |
| 94 // they can properly respond to the request once the PasswordStore gives | 94 // they can properly respond to the request once the PasswordStore gives |
| 95 // us data. | 95 // us data. |
| 96 std::unique_ptr<CredentialManagerPendingRequestTask> pending_request_; | 96 std::unique_ptr<CredentialManagerPendingRequestTask> pending_request_; |
| 97 std::unique_ptr<CredentialManagerPendingRequireUserMediationTask> | 97 std::unique_ptr<CredentialManagerPendingPreventSilentAccessTask> |
| 98 pending_require_user_mediation_; | 98 pending_require_user_mediation_; |
| 99 | 99 |
| 100 mojo::BindingSet<mojom::CredentialManager> bindings_; | 100 mojo::BindingSet<mojom::CredentialManager> bindings_; |
| 101 | 101 |
| 102 base::WeakPtrFactory<CredentialManagerImpl> weak_factory_; | 102 base::WeakPtrFactory<CredentialManagerImpl> weak_factory_; |
| 103 | 103 |
| 104 DISALLOW_COPY_AND_ASSIGN(CredentialManagerImpl); | 104 DISALLOW_COPY_AND_ASSIGN(CredentialManagerImpl); |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 } // namespace password_manager | 107 } // namespace password_manager |
| 108 | 108 |
| 109 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGE
R_IMPL_H_ | 109 #endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_BROWSER_CONTENT_CREDENTIAL_MANAGE
R_IMPL_H_ |
| OLD | NEW |