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

Side by Side Diff: chrome/browser/webdata/autofill_change.cc

Issue 9006038: [Coverity] Change some pass by values to pass by const refs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removing const ref from enums Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/webdata/autofill_change.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/webdata/autofill_change.h" 5 #include "chrome/browser/webdata/autofill_change.h"
6 6
7 #include "chrome/browser/autofill/autofill_profile.h" 7 #include "chrome/browser/autofill/autofill_profile.h"
8 #include "chrome/browser/autofill/credit_card.h" 8 #include "chrome/browser/autofill/credit_card.h"
9 9
10 AutofillChange::AutofillChange(Type type, const AutofillKey& key) 10 AutofillChange::AutofillChange(Type type, const AutofillKey& key)
11 : GenericAutofillChange<AutofillKey>(type, key) { 11 : GenericAutofillChange<AutofillKey>(type, key) {
12 } 12 }
13 13
14 AutofillChange::~AutofillChange() { 14 AutofillChange::~AutofillChange() {
15 } 15 }
16 16
17 AutofillProfileChange::AutofillProfileChange( 17 AutofillProfileChange::AutofillProfileChange(
18 Type type, std::string key, const AutofillProfile* profile) 18 Type type, const std::string& key, const AutofillProfile* profile)
19 : GenericAutofillChange<std::string>(type, key), 19 : GenericAutofillChange<std::string>(type, key),
20 profile_(profile) { 20 profile_(profile) {
21 DCHECK(type == ADD ? (profile && profile->guid() == key) : true); 21 DCHECK(type == ADD ? (profile && profile->guid() == key) : true);
22 DCHECK(type == UPDATE ? (profile && profile->guid() == key) : true); 22 DCHECK(type == UPDATE ? (profile && profile->guid() == key) : true);
23 DCHECK(type == REMOVE ? !profile : true); 23 DCHECK(type == REMOVE ? !profile : true);
24 } 24 }
25 25
26 AutofillProfileChange::~AutofillProfileChange() { 26 AutofillProfileChange::~AutofillProfileChange() {
27 } 27 }
28 28
29 bool AutofillProfileChange::operator==( 29 bool AutofillProfileChange::operator==(
30 const AutofillProfileChange& change) const { 30 const AutofillProfileChange& change) const {
31 return type() == change.type() && 31 return type() == change.type() &&
32 key() == change.key() && 32 key() == change.key() &&
33 (type() != REMOVE) ? *profile() == *change.profile() : true; 33 (type() != REMOVE) ? *profile() == *change.profile() : true;
34 } 34 }
35 35
36 AutofillCreditCardChange::AutofillCreditCardChange( 36 AutofillCreditCardChange::AutofillCreditCardChange(
37 Type type, std::string key, const CreditCard* credit_card) 37 Type type, const std::string& key, const CreditCard* credit_card)
38 : GenericAutofillChange<std::string>(type, key), credit_card_(credit_card) { 38 : GenericAutofillChange<std::string>(type, key), credit_card_(credit_card) {
39 DCHECK(type == ADD ? (credit_card && credit_card->guid() == key) : true); 39 DCHECK(type == ADD ? (credit_card && credit_card->guid() == key) : true);
40 DCHECK(type == UPDATE ? (credit_card && credit_card->guid() == key) : true); 40 DCHECK(type == UPDATE ? (credit_card && credit_card->guid() == key) : true);
41 DCHECK(type == REMOVE ? !credit_card : true); 41 DCHECK(type == REMOVE ? !credit_card : true);
42 } 42 }
43 43
44 AutofillCreditCardChange::~AutofillCreditCardChange() { 44 AutofillCreditCardChange::~AutofillCreditCardChange() {
45 } 45 }
46 46
47 bool AutofillCreditCardChange::operator==( 47 bool AutofillCreditCardChange::operator==(
48 const AutofillCreditCardChange& change) const { 48 const AutofillCreditCardChange& change) const {
49 return type() == change.type() && 49 return type() == change.type() &&
50 key() == change.key() && 50 key() == change.key() &&
51 (type() != REMOVE) ? *credit_card() == *change.credit_card() : true; 51 (type() != REMOVE) ? *credit_card() == *change.credit_card() : true;
52 } 52 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/autofill_change.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698