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: chrome/browser/chromeos/contacts/contact_map.cc

Issue 10910162: contacts: Apply nits to ContactMap class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/chromeos/contacts/contact_map_unittest.cc » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chromeos/contacts/contact_map.h" 5 #include "chrome/browser/chromeos/contacts/contact_map.h"
6 6
7 #include "chrome/browser/chromeos/contacts/contact.pb.h" 7 #include "chrome/browser/chromeos/contacts/contact.pb.h"
8 8
9 namespace contacts { 9 namespace contacts {
10 10
11 ContactMap::ContactMap() : contacts_deleter_(&contacts_) {} 11 ContactMap::ContactMap() : contacts_deleter_(&contacts_) {}
12 12
13 ContactMap::~ContactMap() {} 13 ContactMap::~ContactMap() {}
14 14
15 const Contact* ContactMap::Find(const std::string& contact_id) const { 15 const Contact* ContactMap::Find(const std::string& contact_id) const {
16 Map::const_iterator it = contacts_.find(contact_id); 16 Map::const_iterator it = contacts_.find(contact_id);
17 return (it != contacts_.end()) ? it->second : NULL; 17 return (it != contacts_.end()) ? it->second : NULL;
18 } 18 }
19 19
20 void ContactMap::Clear() { 20 void ContactMap::Clear() {
21 STLDeleteValues(&contacts_); 21 STLDeleteValues(&contacts_);
22 contacts_.clear();
23 } 22 }
24 23
25 void ContactMap::Merge(scoped_ptr<ScopedVector<Contact> > updated_contacts, 24 void ContactMap::Merge(scoped_ptr<ScopedVector<Contact> > updated_contacts,
26 DeletedContactPolicy policy) { 25 DeletedContactPolicy policy) {
27 for (ScopedVector<Contact>::iterator it = updated_contacts->begin(); 26 for (ScopedVector<Contact>::iterator it = updated_contacts->begin();
28 it != updated_contacts->end(); ++it) { 27 it != updated_contacts->end(); ++it) {
29 Contact* contact = *it; 28 Contact* contact = *it;
30 Map::iterator map_it = contacts_.find(contact->contact_id()); 29 Map::iterator map_it = contacts_.find(contact->contact_id());
31 30
32 if (contact->deleted() && policy == DROP_DELETED_CONTACTS) { 31 if (contact->deleted() && policy == DROP_DELETED_CONTACTS) {
(...skipping 26 matching lines...) Expand all
59 base::Time::FromInternalValue(contact->update_time()); 58 base::Time::FromInternalValue(contact->update_time());
60 if (!update_time.is_null() && 59 if (!update_time.is_null() &&
61 (max_update_time.is_null() || max_update_time < update_time)) { 60 (max_update_time.is_null() || max_update_time < update_time)) {
62 max_update_time = update_time; 61 max_update_time = update_time;
63 } 62 }
64 } 63 }
65 return max_update_time; 64 return max_update_time;
66 } 65 }
67 66
68 } // namespace contacts 67 } // namespace contacts
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/contacts/contact_map_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698