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

Unified Diff: ios/web/web_state/js/credential_util.h

Issue 1107083002: Upstream more leaf files in ios/web/web_state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web-resync
Patch Set: Created 5 years, 8 months 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
« no previous file with comments | « ios/web/web_state/credential.cc ('k') | ios/web/web_state/js/credential_util.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/web_state/js/credential_util.h
diff --git a/ios/web/web_state/js/credential_util.h b/ios/web/web_state/js/credential_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..affd0eefc54d25303740a94c5a4f30f1141e000f
--- /dev/null
+++ b/ios/web/web_state/js/credential_util.h
@@ -0,0 +1,47 @@
+// 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_WEB_WEB_STATE_JS_CREDENTIAL_UTIL_H_
+#define IOS_WEB_WEB_STATE_JS_CREDENTIAL_UTIL_H_
+
+namespace base {
+class DictionaryValue;
+} // namespace base
+
+namespace web {
+
+struct Credential;
+
+// Populates |credential| from |value|, returning true if successful and false
+// otherwise. |value| must contain the following string->string key/value
+// pairs:
+//
+// "type": one of "LocalCredential" of "FederatedCredential"
+// "id": a string (possibly empty)
+//
+// The following pairs are optional:
+//
+// "name": a string (possibly empty)
+// "avatarURL": a valid URL as a string
+//
+// If "type" is "LocalCredential", then |value| must contain
+//
+// "password" a string (possibly empty)
+//
+// If "type" is "FederatedCredential", then |value| must contain
+//
+// "federation": a valid URL as a string
+//
+// If passed a |value| that doesn't meet these restrictions, |credential| will
+// not be modified and false will be returned. |credential| must not be null.
+bool DictionaryValueToCredential(const base::DictionaryValue& value,
+ Credential* credential);
+
+// Serializes |credential| to |value|.
+void CredentialToDictionaryValue(const Credential& credential,
+ base::DictionaryValue* value);
+
+} // namespace web
+
+#endif // IOS_WEB_WEB_STATE_JS_CREDENTIAL_UTIL_H_
« no previous file with comments | « ios/web/web_state/credential.cc ('k') | ios/web/web_state/js/credential_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698