OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_COMMON_CREDENTIAL_MANAGER_TYPES_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_COMMON_CREDENTIAL_MANAGER_TYPES_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_COMMON_CREDENTIAL_MANAGER_TYPES_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_COMMON_CREDENTIAL_MANAGER_TYPES_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <ostream> | |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
14 #include "url/gurl.h" | 15 #include "url/gurl.h" |
15 #include "url/origin.h" | 16 #include "url/origin.h" |
16 | 17 |
17 namespace autofill { | 18 namespace autofill { |
18 struct PasswordForm; | 19 struct PasswordForm; |
19 } | 20 } |
20 | 21 |
21 namespace password_manager { | 22 namespace password_manager { |
22 | 23 |
23 // Limit the size of the federations array that we pass to the browser to | 24 // Limit the size of the federations array that we pass to the browser to |
24 // something reasonably sane. | 25 // something reasonably sane. |
25 const size_t kMaxFederations = 50u; | 26 const size_t kMaxFederations = 50u; |
26 | 27 |
27 enum class CredentialType { | 28 enum class CredentialType { |
28 CREDENTIAL_TYPE_EMPTY = 0, | 29 CREDENTIAL_TYPE_EMPTY = 0, |
29 CREDENTIAL_TYPE_PASSWORD, | 30 CREDENTIAL_TYPE_PASSWORD, |
30 CREDENTIAL_TYPE_FEDERATED, | 31 CREDENTIAL_TYPE_FEDERATED, |
31 CREDENTIAL_TYPE_LAST = CREDENTIAL_TYPE_FEDERATED | 32 CREDENTIAL_TYPE_LAST = CREDENTIAL_TYPE_FEDERATED |
32 }; | 33 }; |
33 | 34 |
35 inline std::ostream& operator<<(std::ostream& os, CredentialType value) { | |
vabr (Chromium)
2016/03/14 15:40:26
Please do not inline this, create a .cc file and p
leonhsl(Using Gerrit)
2016/03/16 07:07:28
Done. Moved the definition to credential_manager_t
| |
36 switch (value) { | |
37 case CredentialType::CREDENTIAL_TYPE_EMPTY: | |
38 return os << "CredentialType::CREDENTIAL_TYPE_EMPTY"; | |
39 case CredentialType::CREDENTIAL_TYPE_PASSWORD: | |
40 return os << "CredentialType::CREDENTIAL_TYPE_PASSWORD"; | |
41 case CredentialType::CREDENTIAL_TYPE_FEDERATED: | |
42 return os << "CredentialType::CREDENTIAL_TYPE_FEDERATED"; | |
43 default: | |
vabr (Chromium)
2016/03/14 15:40:26
nit: Move this from the default clause to below li
leonhsl(Using Gerrit)
2016/03/16 07:07:28
Done.
| |
44 return os << "Unknown CredentialType value: " | |
45 << static_cast<int32_t>(value); | |
46 } | |
47 } | |
48 | |
34 struct CredentialInfo { | 49 struct CredentialInfo { |
35 CredentialInfo(); | 50 CredentialInfo(); |
36 CredentialInfo(const autofill::PasswordForm& form, CredentialType form_type); | 51 CredentialInfo(const autofill::PasswordForm& form, CredentialType form_type); |
37 CredentialInfo(const CredentialInfo& other); | 52 CredentialInfo(const CredentialInfo& other); |
38 ~CredentialInfo(); | 53 ~CredentialInfo(); |
39 | 54 |
40 bool operator==(const CredentialInfo& rhs) const; | 55 bool operator==(const CredentialInfo& rhs) const; |
41 | 56 |
42 CredentialType type; | 57 CredentialType type; |
43 | 58 |
(...skipping 18 matching lines...) Expand all Loading... | |
62 | 77 |
63 // Create a new autofill::PasswordForm object based on |info|, valid in the | 78 // Create a new autofill::PasswordForm object based on |info|, valid in the |
64 // context of |origin|. Returns an empty scoped_ptr for CREDENTIAL_TYPE_EMPTY. | 79 // context of |origin|. Returns an empty scoped_ptr for CREDENTIAL_TYPE_EMPTY. |
65 scoped_ptr<autofill::PasswordForm> CreatePasswordFormFromCredentialInfo( | 80 scoped_ptr<autofill::PasswordForm> CreatePasswordFormFromCredentialInfo( |
66 const CredentialInfo& info, | 81 const CredentialInfo& info, |
67 const GURL& origin); | 82 const GURL& origin); |
68 | 83 |
69 } // namespace password_manager | 84 } // namespace password_manager |
70 | 85 |
71 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_COMMON_CREDENTIAL_MANAGER_TYPES_H_ | 86 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_COMMON_CREDENTIAL_MANAGER_TYPES_H_ |
OLD | NEW |