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_WEB_WEB_STATE_JS_CREDENTIAL_UTIL_H_ |
| 6 #define IOS_WEB_WEB_STATE_JS_CREDENTIAL_UTIL_H_ |
| 7 |
| 8 namespace base { |
| 9 class DictionaryValue; |
| 10 } // namespace base |
| 11 |
| 12 namespace web { |
| 13 |
| 14 struct Credential; |
| 15 |
| 16 // Populates |credential| from |value|, returning true if successful and false |
| 17 // otherwise. |value| must contain the following string->string key/value |
| 18 // pairs: |
| 19 // |
| 20 // "type": one of "LocalCredential" of "FederatedCredential" |
| 21 // "id": a string (possibly empty) |
| 22 // |
| 23 // The following pairs are optional: |
| 24 // |
| 25 // "name": a string (possibly empty) |
| 26 // "avatarURL": a valid URL as a string |
| 27 // |
| 28 // If "type" is "LocalCredential", then |value| must contain |
| 29 // |
| 30 // "password" a string (possibly empty) |
| 31 // |
| 32 // If "type" is "FederatedCredential", then |value| must contain |
| 33 // |
| 34 // "federation": a valid URL as a string |
| 35 // |
| 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); |
| 40 |
| 41 // Serializes |credential| to |value|. |
| 42 void CredentialToDictionaryValue(const Credential& credential, |
| 43 base::DictionaryValue* value); |
| 44 |
| 45 } // namespace web |
| 46 |
| 47 #endif // IOS_WEB_WEB_STATE_JS_CREDENTIAL_UTIL_H_ |
OLD | NEW |