Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Side by Side Diff: components/login/base_screen_handler_utils.cc

Issue 1454153002: Revert of This CL replaces e-mail with AccountId on user selection screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "components/login/base_screen_handler_utils.h" 5 #include "components/login/base_screen_handler_utils.h"
6 6
7 #include "components/signin/core/account_id/account_id.h"
8
9 namespace login { 7 namespace login {
10 8
11 namespace { 9 namespace {
12 10
13 template <typename StringListType> 11 template <typename StringListType>
14 bool ParseStringList(const base::Value* value, StringListType* out_value) { 12 bool ParseStringList(const base::Value* value, StringListType* out_value) {
15 const base::ListValue* list = NULL; 13 const base::ListValue* list = NULL;
16 if (!value->GetAsList(&list)) 14 if (!value->GetAsList(&list))
17 return false; 15 return false;
18 out_value->resize(list->GetSize()); 16 out_value->resize(list->GetSize());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 49 }
52 50
53 bool ParseValue(const base::Value* value, StringList* out_value) { 51 bool ParseValue(const base::Value* value, StringList* out_value) {
54 return ParseStringList(value, out_value); 52 return ParseStringList(value, out_value);
55 } 53 }
56 54
57 bool ParseValue(const base::Value* value, String16List* out_value) { 55 bool ParseValue(const base::Value* value, String16List* out_value) {
58 return ParseStringList(value, out_value); 56 return ParseStringList(value, out_value);
59 } 57 }
60 58
61 bool ParseValue(const base::Value* value, AccountId* out_value) {
62 std::string serialized;
63 const bool has_string = value->GetAsString(&serialized);
64 if (!has_string)
65 return false;
66
67 if (AccountId::Deserialize(serialized, out_value))
68 return true;
69
70 LOG(ERROR) << "Failed to deserialize '" << serialized << "'";
71 *out_value = AccountId::FromUserEmail(serialized);
72 return true;
73 }
74
75 base::FundamentalValue MakeValue(bool v) { 59 base::FundamentalValue MakeValue(bool v) {
76 return base::FundamentalValue(v); 60 return base::FundamentalValue(v);
77 } 61 }
78 62
79 base::FundamentalValue MakeValue(int v) { 63 base::FundamentalValue MakeValue(int v) {
80 return base::FundamentalValue(v); 64 return base::FundamentalValue(v);
81 } 65 }
82 66
83 base::FundamentalValue MakeValue(double v) { 67 base::FundamentalValue MakeValue(double v) {
84 return base::FundamentalValue(v); 68 return base::FundamentalValue(v);
85 } 69 }
86 70
87 base::StringValue MakeValue(const std::string& v) { 71 base::StringValue MakeValue(const std::string& v) {
88 return base::StringValue(v); 72 return base::StringValue(v);
89 } 73 }
90 74
91 base::StringValue MakeValue(const base::string16& v) { 75 base::StringValue MakeValue(const base::string16& v) {
92 return base::StringValue(v); 76 return base::StringValue(v);
93 } 77 }
94 78
95 base::StringValue MakeValue(const AccountId& v) {
96 return base::StringValue(v.Serialize());
97 }
98
99 ParsedValueContainer<AccountId>::ParsedValueContainer() {
100 }
101
102 } // namespace login 79 } // namespace login
OLDNEW
« no previous file with comments | « components/login/base_screen_handler_utils.h ('k') | components/signin/core/account_id/account_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698