forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upstream more leaf files in ios/web/web_state
Also updates a few related files that had become stale relative to downstream. BUG=464810 Review URL: https://codereview.chromium.org/1107083002 Cr-Commit-Position: refs/heads/master@{#327081}
- Loading branch information
stuartmorgan
authored and
Commit bot
committed
Apr 27, 2015
1 parent
95a989f
commit cd59886
Showing
19 changed files
with
631 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
include_rules = [ | ||
"+crypto", | ||
"+ios/public/provider/web", | ||
"+ios/net", | ||
"+ios/web", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_PUBLIC_WEB_STATE_CREDENTIAL_H_ | ||
#define IOS_WEB_PUBLIC_WEB_STATE_CREDENTIAL_H_ | ||
|
||
#include "base/strings/string16.h" | ||
#include "url/gurl.h" | ||
|
||
namespace web { | ||
|
||
// Indicates the specific type of a Credential object. | ||
enum CredentialType { | ||
CREDENTIAL_TYPE_EMPTY = 0, | ||
CREDENTIAL_TYPE_LOCAL, | ||
CREDENTIAL_TYPE_FEDERATED, | ||
CREDENTIAL_TYPE_LAST = CREDENTIAL_TYPE_FEDERATED | ||
}; | ||
|
||
// Represents an instance of the JavaScript Credential type. | ||
struct Credential { | ||
Credential(); | ||
~Credential(); | ||
|
||
// The specific type of this credential. | ||
CredentialType type; | ||
|
||
// An identifier for the credential. | ||
base::string16 id; | ||
|
||
// A human-understandable name corresponding to the credential. | ||
base::string16 name; | ||
|
||
// The URL of the user's avatar. | ||
GURL avatar_url; | ||
|
||
// The password for a local credential. | ||
base::string16 password; | ||
|
||
// The federation URL for a federated credential. | ||
GURL federation_url; | ||
}; | ||
|
||
} // namespace web | ||
|
||
#endif // IOS_WEB_PUBLIC_WEB_STATE_CREDENTIAL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// 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. | ||
|
||
#include "ios/web/public/web_state/credential.h" | ||
|
||
namespace web { | ||
|
||
Credential::Credential() = default; | ||
|
||
Credential::~Credential() = default; | ||
|
||
} // namespace web |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_ |
Oops, something went wrong.