OLD | NEW |
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" |
11 #include "base/i18n/string_search.h" | 11 #include "base/i18n/string_search.h" |
12 #include "base/string_split.h" | |
13 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "base/strings/string_split.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/autocomplete/autocomplete_input.h" | 15 #include "chrome/browser/autocomplete/autocomplete_input.h" |
16 #include "chrome/browser/chromeos/contacts/contact.pb.h" | 16 #include "chrome/browser/chromeos/contacts/contact.pb.h" |
17 #include "chrome/browser/chromeos/contacts/contact_manager.h" | 17 #include "chrome/browser/chromeos/contacts/contact_manager.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // Default affinity assigned to contacts whose |affinity| field is unset. | 22 // Default affinity assigned to contacts whose |affinity| field is unset. |
23 // TODO(derat): Set this to something reasonable (probably 0.0) once we're | 23 // TODO(derat): Set this to something reasonable (probably 0.0) once we're |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 const ContactData& contact) { | 228 const ContactData& contact) { |
229 AutocompleteMatch match(this, 0, false, AutocompleteMatch::CONTACT); | 229 AutocompleteMatch match(this, 0, false, AutocompleteMatch::CONTACT); |
230 match.inline_autocomplete_offset = string16::npos; | 230 match.inline_autocomplete_offset = string16::npos; |
231 match.contents = contact.full_name; | 231 match.contents = contact.full_name; |
232 match.fill_into_edit = match.contents; | 232 match.fill_into_edit = match.contents; |
233 match.relevance = kBaseRelevance + | 233 match.relevance = kBaseRelevance + |
234 static_cast<int>(roundf(kAffinityRelevanceBoost * contact.affinity)); | 234 static_cast<int>(roundf(kAffinityRelevanceBoost * contact.affinity)); |
235 match.RecordAdditionalInfo(kMatchContactIdKey, contact.contact_id); | 235 match.RecordAdditionalInfo(kMatchContactIdKey, contact.contact_id); |
236 return match; | 236 return match; |
237 } | 237 } |
OLD | NEW |