OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 IOS_CHROME_BROWSER_PASSWORDS_CREDENTIAL_MANAGER_H_ | 5 #ifndef IOS_CHROME_BROWSER_PASSWORDS_CREDENTIAL_MANAGER_H_ |
6 #define IOS_CHROME_BROWSER_PASSWORDS_CREDENTIAL_MANAGER_H_ | 6 #define IOS_CHROME_BROWSER_PASSWORDS_CREDENTIAL_MANAGER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void SignedIn(int request_id, | 51 void SignedIn(int request_id, |
52 const GURL& source_url, | 52 const GURL& source_url, |
53 const web::Credential& credential) override; | 53 const web::Credential& credential) override; |
54 void SignedOut(int request_id, const GURL& source_url) override; | 54 void SignedOut(int request_id, const GURL& source_url) override; |
55 void WebStateDestroyed() override; | 55 void WebStateDestroyed() override; |
56 | 56 |
57 // password_manager::CredentialManagerPendingRequestTaskDelegate: | 57 // password_manager::CredentialManagerPendingRequestTaskDelegate: |
58 bool IsZeroClickAllowed() const override; | 58 bool IsZeroClickAllowed() const override; |
59 GURL GetOrigin() const override; | 59 GURL GetOrigin() const override; |
60 void SendCredential( | 60 void SendCredential( |
61 int id, | 61 const password_manager::SendCredentialCallback& send_callback, |
62 const password_manager::CredentialInfo& credential) override; | 62 const password_manager::CredentialInfo& credential) override; |
63 void SendPasswordForm(int id, const autofill::PasswordForm* form) override; | 63 void SendPasswordForm( |
| 64 const password_manager::SendCredentialCallback& send_callback, |
| 65 const autofill::PasswordForm* form) override; |
64 password_manager::PasswordManagerClient* client() const override; | 66 password_manager::PasswordManagerClient* client() const override; |
65 autofill::PasswordForm GetSynthesizedFormForOrigin() const override; | 67 autofill::PasswordForm GetSynthesizedFormForOrigin() const override; |
66 | 68 |
67 // password_manager::CredentialManagerPendingRequireUserMediationTaskDelegate: | 69 // password_manager::CredentialManagerPendingRequireUserMediationTaskDelegate: |
68 password_manager::PasswordStore* GetPasswordStore() override; | 70 password_manager::PasswordStore* GetPasswordStore() override; |
69 void DoneRequiringUserMediation() override; | 71 void DoneRequiringUserMediation() override; |
70 | 72 |
71 // CredentialManagerPasswordFormManagerDelegate: | 73 // CredentialManagerPasswordFormManagerDelegate: |
72 void OnProvisionalSaveComplete() override; | 74 void OnProvisionalSaveComplete() override; |
73 | 75 |
74 private: | 76 private: |
75 // The errors that can cause a request to fail. | 77 // The errors that can cause a request to fail. |
76 enum ErrorType { | 78 enum ErrorType { |
77 // An existing request is outstanding. | 79 // An existing request is outstanding. |
78 ERROR_TYPE_PENDING_REQUEST = 0, | 80 ERROR_TYPE_PENDING_REQUEST = 0, |
79 | 81 |
80 // The password store isn't available. | 82 // The password store isn't available. |
81 ERROR_TYPE_PASSWORD_STORE_UNAVAILABLE, | 83 ERROR_TYPE_PASSWORD_STORE_UNAVAILABLE, |
82 | 84 |
83 // The page origin is untrusted. | 85 // The page origin is untrusted. |
84 ERROR_TYPE_SECURITY_ERROR_UNTRUSTED_ORIGIN, | 86 ERROR_TYPE_SECURITY_ERROR_UNTRUSTED_ORIGIN, |
85 }; | 87 }; |
86 | 88 |
| 89 void SendCredentialByID(int request_id, |
| 90 const password_manager::CredentialInfo& credential); |
| 91 |
87 // Sends a message via |js_manager_| to resolve the JavaScript Promise | 92 // Sends a message via |js_manager_| to resolve the JavaScript Promise |
88 // associated with |request_id|. Invoked after a page-initiated credential | 93 // associated with |request_id|. Invoked after a page-initiated credential |
89 // event is acknowledged by the PasswordStore. | 94 // event is acknowledged by the PasswordStore. |
90 void ResolvePromise(int request_id); | 95 void ResolvePromise(int request_id); |
91 | 96 |
92 // Sends a message via |js_manager_| to reject the JavaScript Promise | 97 // Sends a message via |js_manager_| to reject the JavaScript Promise |
93 // associated with |request_id_| with the given |error_type|. Invoked after a | 98 // associated with |request_id_| with the given |error_type|. Invoked after a |
94 // page-initiated credential event, store, or retrieval fails. | 99 // page-initiated credential event, store, or retrieval fails. |
95 void RejectPromise(int request_id, ErrorType error_type); | 100 void RejectPromise(int request_id, ErrorType error_type); |
96 | 101 |
(...skipping 27 matching lines...) Expand all Loading... |
124 // Whether zero-click sign-in is enabled. | 129 // Whether zero-click sign-in is enabled. |
125 BooleanPrefMember zero_click_sign_in_enabled_; | 130 BooleanPrefMember zero_click_sign_in_enabled_; |
126 | 131 |
127 // Weak pointer factory for asynchronously resolving requests. | 132 // Weak pointer factory for asynchronously resolving requests. |
128 base::WeakPtrFactory<CredentialManager> weak_factory_; | 133 base::WeakPtrFactory<CredentialManager> weak_factory_; |
129 | 134 |
130 DISALLOW_COPY_AND_ASSIGN(CredentialManager); | 135 DISALLOW_COPY_AND_ASSIGN(CredentialManager); |
131 }; | 136 }; |
132 | 137 |
133 #endif // IOS_CHROME_BROWSER_PASSWORDS_CREDENTIAL_MANAGER_H_ | 138 #endif // IOS_CHROME_BROWSER_PASSWORDS_CREDENTIAL_MANAGER_H_ |
OLD | NEW |