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

Side by Side Diff: chrome/browser/autocomplete/contact_provider_chromeos.cc

Issue 109013006: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 12 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
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/autocomplete/contact_provider_chromeos.h" 5 #include "chrome/browser/autocomplete/contact_provider_chromeos.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/i18n/break_iterator.h" 10 #include "base/i18n/break_iterator.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return; 164 return;
165 165
166 scoped_ptr<contacts::ContactPointers> contacts = 166 scoped_ptr<contacts::ContactPointers> contacts =
167 contact_manager_->GetAllContacts(profile_); 167 contact_manager_->GetAllContacts(profile_);
168 168
169 contacts_.clear(); 169 contacts_.clear();
170 contacts_.reserve(contacts->size()); 170 contacts_.reserve(contacts->size());
171 for (contacts::ContactPointers::const_iterator it = contacts->begin(); 171 for (contacts::ContactPointers::const_iterator it = contacts->begin();
172 it != contacts->end(); ++it) { 172 it != contacts->end(); ++it) {
173 const contacts::Contact& contact = **it; 173 const contacts::Contact& contact = **it;
174 base::string16 full_name = 174 base::string16 full_name = AutocompleteMatch::SanitizeString(
175 AutocompleteMatch::SanitizeString(UTF8ToUTF16(contact.full_name())); 175 base::UTF8ToUTF16(contact.full_name()));
176 base::string16 given_name = 176 base::string16 given_name = AutocompleteMatch::SanitizeString(
177 AutocompleteMatch::SanitizeString(UTF8ToUTF16(contact.given_name())); 177 base::UTF8ToUTF16(contact.given_name()));
178 base::string16 family_name = 178 base::string16 family_name = AutocompleteMatch::SanitizeString(
179 AutocompleteMatch::SanitizeString(UTF8ToUTF16(contact.family_name())); 179 base::UTF8ToUTF16(contact.family_name()));
180 float affinity = 180 float affinity =
181 contact.has_affinity() ? contact.affinity() : kDefaultAffinity; 181 contact.has_affinity() ? contact.affinity() : kDefaultAffinity;
182 182
183 if (!full_name.empty()) { 183 if (!full_name.empty()) {
184 contacts_.push_back( 184 contacts_.push_back(
185 ContactData(full_name, given_name, family_name, contact.contact_id(), 185 ContactData(full_name, given_name, family_name, contact.contact_id(),
186 affinity)); 186 affinity));
187 } 187 }
188 } 188 }
189 std::sort(contacts_.begin(), contacts_.end(), CompareAffinity); 189 std::sort(contacts_.begin(), contacts_.end(), CompareAffinity);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 const AutocompleteInput& input, 227 const AutocompleteInput& input,
228 const ContactData& contact) { 228 const ContactData& contact) {
229 AutocompleteMatch match(this, 0, false, AutocompleteMatchType::CONTACT); 229 AutocompleteMatch match(this, 0, false, AutocompleteMatchType::CONTACT);
230 match.contents = contact.full_name; 230 match.contents = contact.full_name;
231 match.fill_into_edit = match.contents; 231 match.fill_into_edit = match.contents;
232 match.relevance = kBaseRelevance + 232 match.relevance = kBaseRelevance +
233 static_cast<int>(roundf(kAffinityRelevanceBoost * contact.affinity)); 233 static_cast<int>(roundf(kAffinityRelevanceBoost * contact.affinity));
234 match.RecordAdditionalInfo(kMatchContactIdKey, contact.contact_id); 234 match.RecordAdditionalInfo(kMatchContactIdKey, contact.contact_id);
235 return match; 235 return match;
236 } 236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698