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

Side by Side Diff: components/autofill/content/browser/wallet/gaia_account.cc

Issue 1288093004: rAc Wallet extirpation round 4: clean out RPC code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gn Created 5 years, 4 months 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
(Empty)
1 // Copyright 2013 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 #include "components/autofill/content/browser/wallet/gaia_account.h"
6
7 #include "base/logging.h"
8 #include "base/values.h"
9
10 namespace autofill {
11
12 namespace wallet {
13
14 GaiaAccount::~GaiaAccount() {}
15
16 // static
17 scoped_ptr<GaiaAccount> GaiaAccount::Create(
18 const base::DictionaryValue& dictionary) {
19 std::string email_address;
20 if (!dictionary.GetString("buyer_email", &email_address)) {
21 DLOG(ERROR) << "GAIA account: missing email address";
22 return scoped_ptr<GaiaAccount>();
23 }
24
25 std::string obfuscated_id;
26 if (!dictionary.GetString("gaia_id", &obfuscated_id)) {
27 DLOG(ERROR) << "GAIA account: missing GAIA id";
28 return scoped_ptr<GaiaAccount>();
29 }
30
31 int index = 0;
32 if (!dictionary.GetInteger("gaia_index", &index) ||
33 index < 0) {
34 DLOG(ERROR) << "GAIA account: missing or bad GAIA index";
35 return scoped_ptr<GaiaAccount>();
36 }
37
38 bool is_active = false;
39 if (!dictionary.GetBoolean("is_active", &is_active)) {
40 DLOG(ERROR) << "GAIA account: missing is_active";
41 return scoped_ptr<GaiaAccount>();
42 }
43
44 return scoped_ptr<GaiaAccount>(new GaiaAccount(email_address,
45 obfuscated_id,
46 index,
47 is_active));
48 }
49
50 // static
51 scoped_ptr<GaiaAccount> GaiaAccount::CreateForTesting(
52 const std::string& email_address,
53 const std::string& obfuscated_id,
54 size_t index,
55 bool is_active) {
56 scoped_ptr<GaiaAccount> account(new GaiaAccount(email_address,
57 obfuscated_id,
58 index,
59 is_active));
60 return account.Pass();
61 }
62
63 bool GaiaAccount::operator==(const GaiaAccount& other) const {
64 return email_address_ == other.email_address_ &&
65 obfuscated_id_ == other.obfuscated_id_ &&
66 index_ == other.index_ &&
67 is_active_ == other.is_active_;
68 }
69
70 bool GaiaAccount::operator!=(const GaiaAccount& other) const {
71 return !(*this == other);
72 }
73
74 GaiaAccount::GaiaAccount(const std::string& email_address,
75 const std::string& obfuscated_id,
76 size_t index,
77 bool is_active)
78 : email_address_(email_address),
79 obfuscated_id_(obfuscated_id),
80 index_(index),
81 is_active_(is_active) {}
82
83 } // namespace wallet
84
85 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/browser/wallet/gaia_account.h ('k') | components/autofill/content/browser/wallet/instrument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698