OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_CHROME_BROWSER_PASSWORDS_JS_CREDENTIAL_MANAGER_H_ |
| 6 #define IOS_CHROME_BROWSER_PASSWORDS_JS_CREDENTIAL_MANAGER_H_ |
| 7 |
| 8 #include "ios/web/public/web_state/credential.h" |
| 9 #import "ios/web/public/web_state/js/crw_js_injection_manager.h" |
| 10 |
| 11 namespace base { |
| 12 class DictionaryValue; |
| 13 } // namespace base |
| 14 |
| 15 // Constants for rejecting requests. |
| 16 extern const char kCredentialsPendingRequestErrorType[]; |
| 17 extern const char kCredentialsPendingRequestErrorMessage[]; |
| 18 extern const char kCredentialsSecurityErrorType[]; |
| 19 extern const char kCredentialsPasswordStoreUnavailableErrorType[]; |
| 20 extern const char kCredentialsPasswordStoreUnavailableErrorMessage[]; |
| 21 extern const char kCredentialsSecurityErrorMessageUntrustedOrigin[]; |
| 22 |
| 23 // Injects the JavaScript that implements the request credentials API and |
| 24 // provides an app-side interface for interacting with it. |
| 25 @interface JSCredentialManager : CRWJSInjectionManager |
| 26 |
| 27 // Resolves the JavaScript Promise associated with |requestID| with the |
| 28 // specified |credential|. |completionHandler| will be invoked after the |
| 29 // operation has completed with YES if successful. |
| 30 - (void)resolvePromiseWithRequestID:(NSInteger)requestID |
| 31 credential:(const web::Credential&)credential |
| 32 completionHandler:(void (^)(BOOL))completionHandler; |
| 33 |
| 34 // Resolves the JavaScript Promise associated with |requestID|. |
| 35 // |completionHandler| will be invoked after the operation has completed with |
| 36 // YES if successful. |
| 37 - (void)resolvePromiseWithRequestID:(NSInteger)requestID |
| 38 completionHandler:(void (^)(BOOL))completionHandler; |
| 39 |
| 40 // Rejects the JavaScript Promise associated with |requestID| with an Error of |
| 41 // the specified |errorType| and |message|. |completionHandler| will be invoked |
| 42 // after the operation has completed with YES if successful. |
| 43 - (void)rejectPromiseWithRequestID:(NSInteger)requestID |
| 44 errorType:(NSString*)errorType |
| 45 message:(NSString*)message |
| 46 completionHandler:(void (^)(BOOL))completionHandler; |
| 47 |
| 48 @end |
| 49 |
| 50 #endif // IOS_CHROME_BROWSER_PASSWORDS_JS_CREDENTIAL_MANAGER_H_ |
OLD | NEW |