1// Copyright 2014 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 COMPONENTS_PASSWORD_MANAGER_CONTENT_COMMON_CREDENTIAL_MANAGER_TYPES_H_
6#define COMPONENTS_PASSWORD_MANAGER_CONTENT_COMMON_CREDENTIAL_MANAGER_TYPES_H_
7
8#include <string>
9
10#include "base/basictypes.h"
11#include "base/compiler_specific.h"
12#include "base/strings/string16.h"
13#include "url/gurl.h"
14
15namespace password_manager {
16
17// Limit the size of the federations array that we pass to the browser to
18// something reasonably sane.
19const size_t kMaxFederations = 50u;
20
21enum CredentialType {
22  CREDENTIAL_TYPE_UNKNOWN = 0,
23  CREDENTIAL_TYPE_LOCAL,
24  CREDENTIAL_TYPE_FEDERATED,
25  CREDENTIAL_TYPE_LAST = CREDENTIAL_TYPE_FEDERATED
26};
27
28struct CredentialInfo {
29  CredentialInfo();
30  CredentialInfo(const base::string16& id,
31                 const base::string16& name,
32                 const GURL& avatar);
33  ~CredentialInfo();
34
35  CredentialType type;
36
37  // An identifier (username, email address, etc). Corresponds to
38  // WebCredential's id property.
39  base::string16 id;
40
41  // An user-friendly name ("John Doe"). Corresponds to WebCredential's name
42  // property.
43  base::string16 name;
44
45  // The address of a user's avatar. Corresponds to WebCredential's avatar
46  // property.
47  GURL avatar;
48
49  // Corresponds to WebLocalCredential's password property.
50  base::string16 password;
51
52  // Corresponds to WebFederatedCredential's federation property, which is an
53  // origin serialized as a URL (e.g. "https://example.com/").
54  GURL federation;
55};
56
57}  // namespace password_manager
58
59#endif  // COMPONENTS_PASSWORD_MANAGER_CONTENT_COMMON_CREDENTIAL_MANAGER_TYPES_H_
60