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

Side by Side Diff: components/omnibox/browser/physical_web_provider.h

Issue 2319033006: Include a page title in the Physical Web omnibox overflow item (Closed)
Patch Set: move kPhysicalWebMaxMatches declaration Created 4 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
« no previous file with comments | « no previous file | components/omnibox/browser/physical_web_provider.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) 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 "base/macros.h" 8 #include "base/macros.h"
9 #include "components/omnibox/browser/autocomplete_input.h" 9 #include "components/omnibox/browser/autocomplete_input.h"
10 #include "components/omnibox/browser/autocomplete_provider.h" 10 #include "components/omnibox/browser/autocomplete_provider.h"
11 11
12 class AutocompleteProviderClient; 12 class AutocompleteProviderClient;
13 class HistoryURLProvider; 13 class HistoryURLProvider;
14 14
15 namespace base { 15 namespace base {
16 class ListValue; 16 class ListValue;
17 } 17 }
18 18
19 class PhysicalWebProvider : public AutocompleteProvider { 19 class PhysicalWebProvider : public AutocompleteProvider {
20 public: 20 public:
21 // The maximum number of match results to provide. If the number of nearby
22 // URLs exceeds this limit, an overflow item is created. Tapping the overflow
23 // item navigates to a page with the full list of nearby URLs. The overflow
24 // item is counted as a match result for the purposes of the match limit.
25 //
26 // ex: With kPhysicalWebMaxMatches == 1, there should be at most one
27 // suggestion created by this provider. If there is a single nearby URL, then
28 // the suggestion will be for that URL. If there are multiple nearby URLs, the
29 // suggestion will be the overflow item which navigates to the WebUI when
30 // tapped.
31 static const size_t kPhysicalWebMaxMatches;
32
21 static PhysicalWebProvider* Create(AutocompleteProviderClient* client, 33 static PhysicalWebProvider* Create(AutocompleteProviderClient* client,
22 HistoryURLProvider* history_url_provider); 34 HistoryURLProvider* history_url_provider);
23 35
24 // AutocompleteProvider: 36 // AutocompleteProvider:
25 void Start(const AutocompleteInput& input, bool minimal_changes) override; 37 void Start(const AutocompleteInput& input, bool minimal_changes) override;
26 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; 38 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override;
27 39
28 private: 40 private:
29 PhysicalWebProvider(AutocompleteProviderClient* client, 41 PhysicalWebProvider(AutocompleteProviderClient* client,
30 HistoryURLProvider* history_url_provider); 42 HistoryURLProvider* history_url_provider);
31 ~PhysicalWebProvider() override; 43 ~PhysicalWebProvider() override;
32 44
33 // Adds a separate match item to |matches_| for each nearby URL in 45 // Adds a separate match item to |matches_| for each nearby URL in
34 // |metadata_list|, up to the maximum number of matches allowed. If the total 46 // |metadata_list|, up to the maximum number of matches allowed. If the total
35 // number of nearby URLs exceeds this limit, one match is used for an overflow 47 // number of nearby URLs exceeds this limit, one match is used for an overflow
36 // item. 48 // item.
37 void ConstructMatches(base::ListValue* metadata_list); 49 void ConstructMatches(base::ListValue* metadata_list);
38 50
39 // Adds an overflow match item to |matches_| with a relevance score equal to 51 // Adds an overflow match item to |matches_| with a relevance score equal to
40 // |relevance| and a label indicating there are |additional_url_count| more 52 // |relevance| and a label indicating there are |additional_url_count| more
41 // nearby URLs. Selecting the overflow item navigates to the Physical Web 53 // nearby URLs. The page |title| of one of the additional nearby URLs will be
42 // WebUI, which displays the full list of nearby URLs. 54 // included in the label, truncating if necessary. Selecting the overflow item
43 void AppendOverflowItem(int additional_url_count, int relevance); 55 // navigates to the Physical Web WebUI, which displays the full list of nearby
56 // URLs.
57 void AppendOverflowItem(int additional_url_count,
58 int relevance,
59 const base::string16& title);
44 60
45 AutocompleteProviderClient* client_; 61 AutocompleteProviderClient* client_;
46 62
47 // Used for efficiency when creating the verbatim match. Can be null. 63 // Used for efficiency when creating the verbatim match. Can be null.
48 HistoryURLProvider* history_url_provider_; 64 HistoryURLProvider* history_url_provider_;
49 65
50 DISALLOW_COPY_AND_ASSIGN(PhysicalWebProvider); 66 DISALLOW_COPY_AND_ASSIGN(PhysicalWebProvider);
51 }; 67 };
52 68
53 #endif // COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ 69 #endif // COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | components/omnibox/browser/physical_web_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698