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