OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 // Maps the original match (|text| in the Shortcut) to Shortcut for quick | 75 // Maps the original match (|text| in the Shortcut) to Shortcut for quick |
76 // search. | 76 // search. |
77 typedef std::multimap<string16, Shortcut> ShortcutMap; | 77 typedef std::multimap<string16, Shortcut> ShortcutMap; |
78 | 78 |
79 // Clamp relevance scores to ensure none of our matches will become the | 79 // Clamp relevance scores to ensure none of our matches will become the |
80 // default. This prevents us from having to worry about inline autocompletion. | 80 // default. This prevents us from having to worry about inline autocompletion. |
81 static const int kMaxScore; | 81 static const int kMaxScore; |
82 | 82 |
83 // NotificationObserver: | 83 // NotificationObserver: |
84 virtual void Observe(NotificationType type, | 84 virtual void Observe(int type, |
85 const NotificationSource& source, | 85 const NotificationSource& source, |
86 const NotificationDetails& details) OVERRIDE; | 86 const NotificationDetails& details) OVERRIDE; |
87 | 87 |
88 void DeleteMatchesWithURLs(const std::set<GURL>& urls); | 88 void DeleteMatchesWithURLs(const std::set<GURL>& urls); |
89 void DeleteShortcutsWithURLs(const std::set<GURL>& urls); | 89 void DeleteShortcutsWithURLs(const std::set<GURL>& urls); |
90 | 90 |
91 // Performs the autocomplete matching and scoring. | 91 // Performs the autocomplete matching and scoring. |
92 void GetMatches(const AutocompleteInput& input); | 92 void GetMatches(const AutocompleteInput& input); |
93 | 93 |
94 AutocompleteMatch ShortcutToACMatch(const AutocompleteInput& input, | 94 AutocompleteMatch ShortcutToACMatch(const AutocompleteInput& input, |
(...skipping 27 matching lines...) Expand all Loading... |
122 static string16 SpansToString(const ACMatchClassifications& value); | 122 static string16 SpansToString(const ACMatchClassifications& value); |
123 // Coverts comma-separated unsigned integer values into spans vector. | 123 // Coverts comma-separated unsigned integer values into spans vector. |
124 static ACMatchClassifications SpansFromString(const string16& value); | 124 static ACMatchClassifications SpansFromString(const string16& value); |
125 | 125 |
126 std::string languages_; | 126 std::string languages_; |
127 NotificationRegistrar notification_registrar_; | 127 NotificationRegistrar notification_registrar_; |
128 ShortcutMap shortcuts_map_; | 128 ShortcutMap shortcuts_map_; |
129 }; | 129 }; |
130 | 130 |
131 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ | 131 #endif // CHROME_BROWSER_AUTOCOMPLETE_SHORTCUTS_PROVIDER_H_ |
OLD | NEW |