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

Side by Side Diff: components/signin/core/browser/account_info.cc

Issue 1728033002: components: Add out-of-line copy ctors for complex classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/signin/core/browser/account_info.h" 5 #include "components/signin/core/browser/account_info.h"
6 6
7 namespace { 7 namespace {
8 8
9 bool UpdateField(std::string* field, const std::string& new_value) { 9 bool UpdateField(std::string* field, const std::string& new_value) {
10 bool should_update = field->empty() && !new_value.empty(); 10 bool should_update = field->empty() && !new_value.empty();
(...skipping 13 matching lines...) Expand all
24 AccountInfo::AccountInfo() 24 AccountInfo::AccountInfo()
25 : account_id(), 25 : account_id(),
26 gaia(), 26 gaia(),
27 email(), 27 email(),
28 full_name(), 28 full_name(),
29 given_name(), 29 given_name(),
30 hosted_domain(), 30 hosted_domain(),
31 locale(), 31 locale(),
32 picture_url(), 32 picture_url(),
33 is_child_account(false) {} 33 is_child_account(false) {}
34 AccountInfo::AccountInfo(const AccountInfo& other) = default;
34 AccountInfo::~AccountInfo() {} 35 AccountInfo::~AccountInfo() {}
35 36
36 bool AccountInfo::IsValid() const { 37 bool AccountInfo::IsValid() const {
37 return !account_id.empty() && !email.empty() && !gaia.empty() && 38 return !account_id.empty() && !email.empty() && !gaia.empty() &&
38 !hosted_domain.empty() && !full_name.empty() && !given_name.empty() && 39 !hosted_domain.empty() && !full_name.empty() && !given_name.empty() &&
39 !locale.empty() && !picture_url.empty(); 40 !locale.empty() && !picture_url.empty();
40 } 41 }
41 42
42 bool AccountInfo::UpdateWith(const AccountInfo& other) { 43 bool AccountInfo::UpdateWith(const AccountInfo& other) {
43 if (account_id != other.account_id) { 44 if (account_id != other.account_id) {
44 // Only updates with a compatible AccountInfo. 45 // Only updates with a compatible AccountInfo.
45 return false; 46 return false;
46 } 47 }
47 48
48 bool modified = UpdateField(&gaia, other.gaia); 49 bool modified = UpdateField(&gaia, other.gaia);
49 modified |= UpdateField(&email, other.email); 50 modified |= UpdateField(&email, other.email);
50 modified |= UpdateField(&full_name, other.full_name); 51 modified |= UpdateField(&full_name, other.full_name);
51 modified |= UpdateField(&given_name, other.given_name); 52 modified |= UpdateField(&given_name, other.given_name);
52 modified |= UpdateField(&hosted_domain, other.hosted_domain); 53 modified |= UpdateField(&hosted_domain, other.hosted_domain);
53 modified |= UpdateField(&locale, other.locale); 54 modified |= UpdateField(&locale, other.locale);
54 modified |= UpdateField(&picture_url, other.picture_url); 55 modified |= UpdateField(&picture_url, other.picture_url);
55 modified |= UpdateField(&is_child_account, other.is_child_account); 56 modified |= UpdateField(&is_child_account, other.is_child_account);
56 57
57 return modified; 58 return modified;
58 } 59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698