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