OLD | NEW |
---|---|
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ |
6 #define COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ |
7 | 7 |
8 #include "components/omnibox/browser/autocomplete_input.h" | 8 #include "components/omnibox/browser/autocomplete_input.h" |
9 #include "components/omnibox/browser/autocomplete_provider.h" | 9 #include "components/omnibox/browser/autocomplete_provider.h" |
10 | 10 |
11 class AutocompleteProviderClient; | 11 class AutocompleteProviderClient; |
12 | 12 |
Mark P
2016/08/30 22:26:20
nit: forward declare HistoryURLProvider
mattreynolds
2016/08/31 22:06:48
Done.
| |
13 namespace base { | 13 namespace base { |
14 class ListValue; | 14 class ListValue; |
15 } | 15 } |
16 | 16 |
17 class PhysicalWebProvider : public AutocompleteProvider { | 17 class PhysicalWebProvider : public AutocompleteProvider { |
18 public: | 18 public: |
19 static PhysicalWebProvider* Create(AutocompleteProviderClient* client); | 19 static PhysicalWebProvider* Create(AutocompleteProviderClient* client, |
20 HistoryURLProvider* history_url_provider); | |
20 | 21 |
21 // AutocompleteProvider: | 22 // AutocompleteProvider: |
22 void Start(const AutocompleteInput& input, bool minimal_changes) override; | 23 void Start(const AutocompleteInput& input, bool minimal_changes) override; |
23 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; | 24 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; |
24 | 25 |
25 private: | 26 private: |
26 PhysicalWebProvider(AutocompleteProviderClient* client); | 27 PhysicalWebProvider(AutocompleteProviderClient* client, |
28 HistoryURLProvider* history_url_provider); | |
27 ~PhysicalWebProvider() override; | 29 ~PhysicalWebProvider() override; |
28 | 30 |
29 // Adds a separate match item to |matches_| for each nearby URL in | 31 // Adds a separate match item to |matches_| for each nearby URL in |
30 // |metadata_list|, up to the maximum number of matches allowed. If the total | 32 // |metadata_list|, up to the maximum number of matches allowed. If the total |
31 // number of nearby URLs exceeds this limit, one match is used for an overflow | 33 // number of nearby URLs exceeds this limit, one match is used for an overflow |
32 // item. | 34 // item. |
33 void ConstructMatches(base::ListValue* metadata_list); | 35 void ConstructMatches(base::ListValue* metadata_list); |
34 | 36 |
35 // Adds an overflow match item to |matches_| with a relevance score equal to | 37 // Adds an overflow match item to |matches_| with a relevance score equal to |
36 // |relevance| and a label indicating there are |additional_url_count| more | 38 // |relevance| and a label indicating there are |additional_url_count| more |
37 // nearby URLs. Selecting the overflow item navigates to the Physical Web | 39 // nearby URLs. Selecting the overflow item navigates to the Physical Web |
38 // WebUI, which displays the full list of nearby URLs. | 40 // WebUI, which displays the full list of nearby URLs. |
39 void AppendOverflowItem(int additional_url_count, int relevance); | 41 void AppendOverflowItem(int additional_url_count, int relevance); |
40 | 42 |
41 AutocompleteProviderClient* client_; | 43 AutocompleteProviderClient* client_; |
44 | |
45 // Used for efficiency when creating the verbatim match. Can be NULL. | |
46 HistoryURLProvider* history_url_provider_; | |
42 }; | 47 }; |
43 | 48 |
44 #endif // COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ | 49 #endif // COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ |
OLD | NEW |