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

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

Issue 2591053002: Show PhysicalWebProvider suggestions with omnibox input (Closed)
Patch Set: debase Created 3 years, 12 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
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/bookmarks/browser/titled_url_match.h"
9 #include "components/omnibox/browser/autocomplete_input.h" 10 #include "components/omnibox/browser/autocomplete_input.h"
10 #include "components/omnibox/browser/autocomplete_provider.h" 11 #include "components/omnibox/browser/autocomplete_provider.h"
11 12
12 class AutocompleteProviderClient; 13 class AutocompleteProviderClient;
13 class HistoryURLProvider; 14 class HistoryURLProvider;
14 15
15 namespace base { 16 namespace base {
16 class ListValue; 17 class ListValue;
17 } 18 }
18 19
(...skipping 17 matching lines...) Expand all
36 // AutocompleteProvider: 37 // AutocompleteProvider:
37 void Start(const AutocompleteInput& input, bool minimal_changes) override; 38 void Start(const AutocompleteInput& input, bool minimal_changes) override;
38 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; 39 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override;
39 void AddProviderInfo(ProvidersInfo* provider_info) const override; 40 void AddProviderInfo(ProvidersInfo* provider_info) const override;
40 41
41 private: 42 private:
42 PhysicalWebProvider(AutocompleteProviderClient* client, 43 PhysicalWebProvider(AutocompleteProviderClient* client,
43 HistoryURLProvider* history_url_provider); 44 HistoryURLProvider* history_url_provider);
44 ~PhysicalWebProvider() override; 45 ~PhysicalWebProvider() override;
45 46
46 // Adds a separate match item to |matches_| for each nearby URL in 47 // When the user has focused the omnibox but not yet entered any text (ie,
Mark P 2016/12/21 18:57:50 nit: ie -> i.e. ditto below
mattreynolds 2016/12/21 22:25:58 Done.
47 // |metadata_list|, up to the maximum number of matches allowed. If the total 48 // the Zero Suggest case), calling this method adds a separate match item to
48 // number of nearby URLs exceeds this limit, one match is used for an overflow 49 // |matches_| for each nearby URL in |metadata_list|, up to the maximum number
49 // item. 50 // of matches allowed. If the total number of nearby URLs exceeds this limit,
50 void ConstructMatches(base::ListValue* metadata_list); 51 // one match is used for an overflow item.
52 void ConstructZeroSuggestMatches(
53 std::unique_ptr<base::ListValue> metadata_list);
54
55 // When the user has entered text into the omnibox (ie, the Query Suggest
56 // case), calling this method adds a separate match item to |matches_| for
57 // each nearby URL in |metadata_list| that matches all of the query terms in
58 // |input|, up to the maximum number of matches allowed.
59 void ConstructQuerySuggestMatches(
60 std::unique_ptr<base::ListValue> metadata_list,
61 const AutocompleteInput& input);
51 62
52 // Adds an overflow match item to |matches_| with a relevance score equal to 63 // Adds an overflow match item to |matches_| with a relevance score equal to
53 // |relevance| and a label indicating there are |additional_url_count| more 64 // |relevance| and a label indicating there are |additional_url_count| more
54 // nearby URLs. The page |title| of one of the additional nearby URLs will be 65 // nearby URLs. The page |title| of one of the additional nearby URLs will be
55 // included in the label, truncating if necessary. Selecting the overflow item 66 // included in the label, truncating if necessary. Selecting the overflow item
56 // navigates to the Physical Web WebUI, which displays the full list of nearby 67 // navigates to the Physical Web WebUI, which displays the full list of nearby
57 // URLs. 68 // URLs.
58 void AppendOverflowItem(int additional_url_count, 69 void AppendOverflowItem(int additional_url_count,
59 int relevance, 70 int relevance,
60 const base::string16& title); 71 const base::string16& title);
61 72
62 AutocompleteProviderClient* client_; 73 AutocompleteProviderClient* client_;
63 74
64 // Used for efficiency when creating the verbatim match. Can be null. 75 // Used for efficiency when creating the verbatim match. Can be null.
65 HistoryURLProvider* history_url_provider_; 76 HistoryURLProvider* history_url_provider_;
66 77
67 // The number of nearby Physical Web URLs when the provider last constructed 78 // The number of nearby Physical Web URLs when the provider last constructed
68 // matches. 79 // matches.
69 size_t nearby_url_count_; 80 size_t nearby_url_count_;
70 81
71 DISALLOW_COPY_AND_ASSIGN(PhysicalWebProvider); 82 DISALLOW_COPY_AND_ASSIGN(PhysicalWebProvider);
72 }; 83 };
73 84
74 #endif // COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ 85 #endif // COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698