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

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: 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
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 12 matching lines...) Expand all
23 23
24 // AutocompleteProvider implementation that searches through the contacts 24 // AutocompleteProvider implementation that searches through the contacts
25 // provided by contacts::ContactManager. 25 // provided by contacts::ContactManager.
26 class ContactProvider : public AutocompleteProvider, 26 class ContactProvider : public AutocompleteProvider,
27 public contacts::ContactManagerObserver { 27 public contacts::ContactManagerObserver {
28 public: 28 public:
29 // Key within AutocompleteMatch::additional_info where the corresponding 29 // Key within AutocompleteMatch::additional_info where the corresponding
30 // contact's ID is stored. 30 // contact's ID is stored.
31 static const char kMatchContactIdKey[]; 31 static const char kMatchContactIdKey[];
32 32
33 // Base match relevance assigned to a contact with an affinity of 0.0.
34 static const int kBaseRelevance;
35
36 // Maximum boost to relevance for a contact with an affinity of 1.0.
37 static const int kAffinityRelevanceBoost;
38
33 ContactProvider( 39 ContactProvider(
34 AutocompleteProviderListener* listener, 40 AutocompleteProviderListener* listener,
35 Profile* profile, 41 Profile* profile,
36 base::WeakPtr<contacts::ContactManagerInterface> contact_manager); 42 base::WeakPtr<contacts::ContactManagerInterface> contact_manager);
37 43
38 // AutocompleteProvider overrides: 44 // AutocompleteProvider overrides:
39 virtual void Start(const AutocompleteInput& input, 45 virtual void Start(const AutocompleteInput& input,
40 bool minimal_changes) OVERRIDE; 46 bool minimal_changes) OVERRIDE;
41 47
42 // contacts::ContactManagerObserver overrides: 48 // contacts::ContactManagerObserver overrides:
(...skipping 15 matching lines...) Expand all
58 void AddContactIfMatched(const AutocompleteInput& input, 64 void AddContactIfMatched(const AutocompleteInput& input,
59 const std::vector<string16>& input_words, 65 const std::vector<string16>& input_words,
60 const ContactData& contact); 66 const ContactData& contact);
61 67
62 // Returns an AutocompleteMatch object corresponding to the passed-in data. 68 // Returns an AutocompleteMatch object corresponding to the passed-in data.
63 AutocompleteMatch CreateAutocompleteMatch(const AutocompleteInput& input, 69 AutocompleteMatch CreateAutocompleteMatch(const AutocompleteInput& input,
64 const ContactData& contact); 70 const ContactData& contact);
65 71
66 base::WeakPtr<contacts::ContactManagerInterface> contact_manager_; 72 base::WeakPtr<contacts::ContactManagerInterface> contact_manager_;
67 73
68 // Contacts through which we search. 74 // Contacts through which we search, ordered by descending affinity.
69 ContactDataVector contacts_; 75 ContactDataVector contacts_;
70 76
71 DISALLOW_COPY_AND_ASSIGN(ContactProvider); 77 DISALLOW_COPY_AND_ASSIGN(ContactProvider);
72 }; 78 };
73 79
74 #endif // CHROME_BROWSER_AUTOCOMPLETE_CONTACT_PROVIDER_CHROMEOS_H_ 80 #endif // CHROME_BROWSER_AUTOCOMPLETE_CONTACT_PROVIDER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698