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

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

Issue 10916304: autocomplete: Make ContactProvider rank contacts by affinity (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: improve error messages 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/autocomplete/contact_provider_chromeos.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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_CONTACT_PROVIDER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_CONTACT_PROVIDER_CHROMEOS_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_CONTACT_PROVIDER_CHROMEOS_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_CONTACT_PROVIDER_CHROMEOS_H_
7 7
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 30 matching lines...) Expand all
41 41
42 // contacts::ContactManagerObserver overrides: 42 // contacts::ContactManagerObserver overrides:
43 virtual void OnContactsUpdated(Profile* profile) OVERRIDE; 43 virtual void OnContactsUpdated(Profile* profile) OVERRIDE;
44 44
45 private: 45 private:
46 struct ContactData; 46 struct ContactData;
47 typedef std::vector<ContactData> ContactDataVector; 47 typedef std::vector<ContactData> ContactDataVector;
48 48
49 virtual ~ContactProvider(); 49 virtual ~ContactProvider();
50 50
51 // Returns true if |a|'s affinity is greater than |b|'s affinity.
52 static bool CompareAffinity(const ContactData& a, const ContactData& b);
53
51 // Updates |contacts_| to match the contacts currently reported by 54 // Updates |contacts_| to match the contacts currently reported by
52 // ContactManager. 55 // ContactManager.
53 void RefreshContacts(); 56 void RefreshContacts();
54 57
55 // Adds an AutocompleteMatch object for |contact| to |matches_| if |contact| 58 // Adds an AutocompleteMatch object for |contact| to |matches_| if |contact|
56 // is matched by |input|. |input_words| is |input.text()| split on word 59 // is matched by |input|. |input_words| is |input.text()| split on word
57 // boundaries. 60 // boundaries.
58 void AddContactIfMatched(const AutocompleteInput& input, 61 void AddContactIfMatched(const AutocompleteInput& input,
59 const std::vector<string16>& input_words, 62 const std::vector<string16>& input_words,
60 const ContactData& contact); 63 const ContactData& contact);
61 64
62 // Returns an AutocompleteMatch object corresponding to the passed-in data. 65 // Returns an AutocompleteMatch object corresponding to the passed-in data.
63 AutocompleteMatch CreateAutocompleteMatch(const AutocompleteInput& input, 66 AutocompleteMatch CreateAutocompleteMatch(const AutocompleteInput& input,
64 const ContactData& contact); 67 const ContactData& contact);
65 68
66 base::WeakPtr<contacts::ContactManagerInterface> contact_manager_; 69 base::WeakPtr<contacts::ContactManagerInterface> contact_manager_;
67 70
68 // Contacts through which we search. 71 // Contacts through which we search, ordered by descending affinity.
69 ContactDataVector contacts_; 72 ContactDataVector contacts_;
70 73
71 DISALLOW_COPY_AND_ASSIGN(ContactProvider); 74 DISALLOW_COPY_AND_ASSIGN(ContactProvider);
72 }; 75 };
73 76
74 #endif // CHROME_BROWSER_AUTOCOMPLETE_CONTACT_PROVIDER_CHROMEOS_H_ 77 #endif // CHROME_BROWSER_AUTOCOMPLETE_CONTACT_PROVIDER_CHROMEOS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/contact_provider_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698