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

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

Issue 1440583002: This CL replaces e-mail with AccountId on user selection screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix build. 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
7 namespace login { 9 namespace login {
8 10
9 namespace { 11 namespace {
10 12
11 template <typename StringListType> 13 template <typename StringListType>
12 bool ParseStringList(const base::Value* value, StringListType* out_value) { 14 bool ParseStringList(const base::Value* value, StringListType* out_value) {
13 const base::ListValue* list = NULL; 15 const base::ListValue* list = NULL;
14 if (!value->GetAsList(&list)) 16 if (!value->GetAsList(&list))
15 return false; 17 return false;
16 out_value->resize(list->GetSize()); 18 out_value->resize(list->GetSize());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 } 51 }
50 52
51 bool ParseValue(const base::Value* value, StringList* out_value) { 53 bool ParseValue(const base::Value* value, StringList* out_value) {
52 return ParseStringList(value, out_value); 54 return ParseStringList(value, out_value);
53 } 55 }
54 56
55 bool ParseValue(const base::Value* value, String16List* out_value) { 57 bool ParseValue(const base::Value* value, String16List* out_value) {
56 return ParseStringList(value, out_value); 58 return ParseStringList(value, out_value);
57 } 59 }
58 60
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
59 base::FundamentalValue MakeValue(bool v) { 75 base::FundamentalValue MakeValue(bool v) {
60 return base::FundamentalValue(v); 76 return base::FundamentalValue(v);
61 } 77 }
62 78
63 base::FundamentalValue MakeValue(int v) { 79 base::FundamentalValue MakeValue(int v) {
64 return base::FundamentalValue(v); 80 return base::FundamentalValue(v);
65 } 81 }
66 82
67 base::FundamentalValue MakeValue(double v) { 83 base::FundamentalValue MakeValue(double v) {
68 return base::FundamentalValue(v); 84 return base::FundamentalValue(v);
69 } 85 }
70 86
71 base::StringValue MakeValue(const std::string& v) { 87 base::StringValue MakeValue(const std::string& v) {
72 return base::StringValue(v); 88 return base::StringValue(v);
73 } 89 }
74 90
75 base::StringValue MakeValue(const base::string16& v) { 91 base::StringValue MakeValue(const base::string16& v) {
76 return base::StringValue(v); 92 return base::StringValue(v);
77 } 93 }
78 94
95 base::StringValue MakeValue(const AccountId& v) {
96 return base::StringValue(v.Serialize());
97 }
98
99 ParsedValueContainer<AccountId>::ParsedValueContainer() {
100 }
101
79 } // namespace login 102 } // 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