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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 11 matching lines...) Expand all Loading... |
22 // ranking for future uses of that search term. | 22 // ranking for future uses of that search term. |
23 class ShortcutsProvider | 23 class ShortcutsProvider |
24 : public AutocompleteProvider, | 24 : public AutocompleteProvider, |
25 public ShortcutsBackend::ShortcutsBackendObserver { | 25 public ShortcutsBackend::ShortcutsBackendObserver { |
26 public: | 26 public: |
27 explicit ShortcutsProvider(Profile* profile); | 27 explicit ShortcutsProvider(Profile* profile); |
28 | 28 |
29 // Performs the autocompletion synchronously. Since no asynch completion is | 29 // Performs the autocompletion synchronously. Since no asynch completion is |
30 // performed |minimal_changes| is ignored. | 30 // performed |minimal_changes| is ignored. |
31 virtual void Start(const AutocompleteInput& input, | 31 virtual void Start(const AutocompleteInput& input, |
32 bool minimal_changes) OVERRIDE; | 32 bool minimal_changes) override; |
33 | 33 |
34 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; | 34 virtual void DeleteMatch(const AutocompleteMatch& match) override; |
35 | 35 |
36 private: | 36 private: |
37 friend class ClassifyTest; | 37 friend class ClassifyTest; |
38 friend class ShortcutsProviderTest; | 38 friend class ShortcutsProviderTest; |
39 FRIEND_TEST_ALL_PREFIXES(ShortcutsProviderTest, CalculateScore); | 39 FRIEND_TEST_ALL_PREFIXES(ShortcutsProviderTest, CalculateScore); |
40 | 40 |
41 typedef std::multimap<base::char16, base::string16> WordMap; | 41 typedef std::multimap<base::char16, base::string16> WordMap; |
42 | 42 |
43 virtual ~ShortcutsProvider(); | 43 virtual ~ShortcutsProvider(); |
44 | 44 |
45 // ShortcutsBackendObserver: | 45 // ShortcutsBackendObserver: |
46 virtual void OnShortcutsLoaded() OVERRIDE; | 46 virtual void OnShortcutsLoaded() override; |
47 | 47 |
48 // Performs the autocomplete matching and scoring. | 48 // Performs the autocomplete matching and scoring. |
49 void GetMatches(const AutocompleteInput& input); | 49 void GetMatches(const AutocompleteInput& input); |
50 | 50 |
51 // Returns an AutocompleteMatch corresponding to |shortcut|. Assigns it | 51 // Returns an AutocompleteMatch corresponding to |shortcut|. Assigns it |
52 // |relevance| score in the process, and highlights the description and | 52 // |relevance| score in the process, and highlights the description and |
53 // contents against |input|, which should be the lower-cased version of | 53 // contents against |input|, which should be the lower-cased version of |
54 // the user's input. |input| and |fixed_up_input_text| are used to decide | 54 // the user's input. |input| and |fixed_up_input_text| are used to decide |
55 // what can be inlined. | 55 // what can be inlined. |
56 AutocompleteMatch ShortcutToACMatch( | 56 AutocompleteMatch ShortcutToACMatch( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // The default max relevance unless overridden by a field trial. | 104 // The default max relevance unless overridden by a field trial. |
105 static const int kShortcutsProviderDefaultMaxRelevance; | 105 static const int kShortcutsProviderDefaultMaxRelevance; |
106 | 106 |
107 Profile* profile_; | 107 Profile* profile_; |
108 std::string languages_; | 108 std::string languages_; |
109 bool initialized_; | 109 bool initialized_; |
110 }; | 110 }; |
111 | 111 |
112 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ | 112 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ |
OLD | NEW |