Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Unified Diff: ios/chrome/browser/passwords/js_credential_manager.h

Issue 1456983002: Move JS-related password manager code upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/passwords/js_credential_manager.h
diff --git a/ios/chrome/browser/passwords/js_credential_manager.h b/ios/chrome/browser/passwords/js_credential_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..5163de4e613a83c75788c37483dd663bc5a39f34
--- /dev/null
+++ b/ios/chrome/browser/passwords/js_credential_manager.h
@@ -0,0 +1,54 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_PASSWORDS_JS_CREDENTIAL_MANAGER_H_
+#define IOS_CHROME_BROWSER_PASSWORDS_JS_CREDENTIAL_MANAGER_H_
+
+#include "ios/web/public/web_state/credential.h"
+#import "ios/web/public/web_state/js/crw_js_injection_manager.h"
+
+namespace base {
+class DictionaryValue;
+} // namespace base
+
+namespace ios {
droger 2015/11/18 16:24:17 Remove the ios:: namespace
vabr (Chromium) 2015/11/18 16:52:28 Done.
+namespace passwords {
vabr (Chromium) 2015/11/18 16:55:13 Hm, I see you only advised against the 'ios' here,
droger 2015/11/18 17:07:40 Some people argue that we should not use any names
droger 2015/11/18 17:11:27 This discussion is also related: https://groups.go
vabr (Chromium) 2015/11/18 17:14:06 As an alternative I can just prefix all the names
+// Constants for rejecting requests.
+extern const char kPendingRequestErrorType[];
+extern const char kPendingRequestErrorMessage[];
+extern const char kSecurityErrorType[];
+extern const char kPasswordStoreUnavailableErrorType[];
+extern const char kPasswordStoreUnavailableErrorMessage[];
+extern const char kSecurityErrorMessageUntrustedOrigin[];
+} // namespace passwords
+} // namespace ios
+
+// Injects the JavaScript that implements the request credentials API and
+// provides an app-side interface for interacting with it.
+@interface JSCredentialManager : CRWJSInjectionManager
+
+// Resolves the JavaScript Promise associated with |requestID| with the
+// specified |credential|. |completionHandler| will be invoked after the
+// operation has completed with YES if successful.
+- (void)resolvePromiseWithRequestID:(NSInteger)requestID
+ credential:(const web::Credential&)credential
+ completionHandler:(void (^)(BOOL))completionHandler;
+
+// Resolves the JavaScript Promise associated with |requestID|.
+// |completionHandler| will be invoked after the operation has completed with
+// YES if successful.
+- (void)resolvePromiseWithRequestID:(NSInteger)requestID
+ completionHandler:(void (^)(BOOL))completionHandler;
+
+// Rejects the JavaScript Promise associated with |requestID| with an Error of
+// the specified |errorType| and |message|. |completionHandler| will be invoked
+// after the operation has completed with YES if successful.
+- (void)rejectPromiseWithRequestID:(NSInteger)requestID
+ errorType:(NSString*)errorType
+ message:(NSString*)message
+ completionHandler:(void (^)(BOOL))completionHandler;
+
+@end
+
+#endif // IOS_CHROME_BROWSER_PASSWORDS_JS_CREDENTIAL_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698