Add ICU message format support
[chromium-blink-merge.git] / ios / web / web_state / js / credential_util.h
blob39230dec05c964c07952dc70b17c04c5aca2f4f9
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.
5 #ifndef IOS_WEB_WEB_STATE_JS_CREDENTIAL_UTIL_H_
6 #define IOS_WEB_WEB_STATE_JS_CREDENTIAL_UTIL_H_
8 namespace base {
9 class DictionaryValue;
10 } // namespace base
12 namespace web {
14 struct Credential;
16 // Populates |credential| from |value|, returning true if successful and false
17 // otherwise. |value| must contain the following string->string key/value
18 // pairs:
20 // "type": one of "PasswordCredential" of "FederatedCredential"
21 // "id": a string (possibly empty)
23 // The following pairs are optional:
25 // "name": a string (possibly empty)
26 // "avatarURL": a valid URL as a string
28 // If "type" is "PasswordCredential", then |value| must contain
30 // "password" a string (possibly empty)
32 // If "type" is "FederatedCredential", then |value| must contain
34 // "federation": a valid URL as a string
36 // If passed a |value| that doesn't meet these restrictions, |credential| will
37 // not be modified and false will be returned. |credential| must not be null.
38 bool DictionaryValueToCredential(const base::DictionaryValue& value,
39 Credential* credential);
41 // Serializes |credential| to |value|.
42 void CredentialToDictionaryValue(const Credential& credential,
43 base::DictionaryValue* value);
45 } // namespace web
47 #endif // IOS_WEB_WEB_STATE_JS_CREDENTIAL_UTIL_H_