Chromium Code Reviews| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 40 // AutocompleteProvider: | 40 // AutocompleteProvider: |
| 41 void Start(const AutocompleteInput& input, bool minimal_changes) override; | 41 void Start(const AutocompleteInput& input, bool minimal_changes) override; |
| 42 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; | 42 void Stop(bool clear_cached_results, bool due_to_user_inactivity) override; |
| 43 void AddProviderInfo(ProvidersInfo* provider_info) const override; | 43 void AddProviderInfo(ProvidersInfo* provider_info) const override; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 PhysicalWebProvider(AutocompleteProviderClient* client, | 46 PhysicalWebProvider(AutocompleteProviderClient* client, |
| 47 HistoryURLProvider* history_url_provider); | 47 HistoryURLProvider* history_url_provider); |
| 48 ~PhysicalWebProvider() override; | 48 ~PhysicalWebProvider() override; |
| 49 | 49 |
| 50 // Called when a new omnibox session is started. For the purposes of this | |
| 51 // provider, a session begins when the omnibox is initially focused. | |
| 52 void BeginOmniboxSession(); | |
| 53 | |
| 50 // When the user has focused the omnibox but not yet entered any text (i.e., | 54 // When the user has focused the omnibox but not yet entered any text (i.e., |
| 51 // the Zero Suggest case), calling this method adds a separate match item to | 55 // the Zero Suggest case), calling this method adds a separate match item to |
| 52 // |matches_| for each nearby URL in |metadata_list|, up to the maximum number | 56 // |matches_| for each nearby URL in |metadata_list|, up to the maximum number |
| 53 // of matches allowed. If the total number of nearby URLs exceeds this limit, | 57 // of matches allowed. If the total number of nearby URLs exceeds this limit, |
| 54 // one match is used for an overflow item. | 58 // one match is used for an overflow item. |
| 55 void ConstructZeroSuggestMatches( | 59 void ConstructZeroSuggestMatches( |
| 56 std::unique_ptr<physical_web::MetadataList> metadata_list); | 60 std::unique_ptr<physical_web::MetadataList> metadata_list); |
| 57 | 61 |
| 58 // When the user has entered text into the omnibox (i.e., the Query Suggest | 62 // When the user has entered text into the omnibox (i.e., the Query Suggest |
| 59 // case), calling this method adds a separate match item to |matches_| for | 63 // case), calling this method adds a separate match item to |matches_| for |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 72 void AppendOverflowItem(int additional_url_count, | 76 void AppendOverflowItem(int additional_url_count, |
| 73 int relevance, | 77 int relevance, |
| 74 const base::string16& title); | 78 const base::string16& title); |
| 75 | 79 |
| 76 AutocompleteProviderClient* client_; | 80 AutocompleteProviderClient* client_; |
| 77 | 81 |
| 78 // Used for efficiency when creating the verbatim match. Can be null. | 82 // Used for efficiency when creating the verbatim match. Can be null. |
| 79 HistoryURLProvider* history_url_provider_; | 83 HistoryURLProvider* history_url_provider_; |
| 80 | 84 |
| 81 // The number of nearby Physical Web URLs when the provider last constructed | 85 // The number of nearby Physical Web URLs when the provider last constructed |
| 82 // matches. | 86 // matches. |
|
Mark P
2017/02/23 00:38:59
Please say something about npos here and below.
mattreynolds
2017/02/23 02:03:07
Done.
| |
| 83 size_t nearby_url_count_; | 87 size_t nearby_url_count_; |
| 84 | 88 |
| 89 // The number of nearby Physical Web URLs when the omnibox input was last | |
| 90 // focused. | |
| 91 size_t nearby_url_count_at_focus_; | |
| 92 | |
| 85 // If true, provide suggestions when the user has focused the omnibox but has | 93 // If true, provide suggestions when the user has focused the omnibox but has |
| 86 // not typed anything. | 94 // not typed anything. |
| 87 bool zero_suggest_enabled_; | 95 bool zero_suggest_enabled_; |
| 88 | 96 |
| 89 // If true, provide suggestions when the user has entered a query into the | 97 // If true, provide suggestions when the user has entered a query into the |
| 90 // omnibox. | 98 // omnibox. |
| 91 bool after_typing_enabled_; | 99 bool after_typing_enabled_; |
| 92 | 100 |
| 93 // The base relevance score for Physical Web URL suggestions when the user has | 101 // The base relevance score for Physical Web URL suggestions when the user has |
| 94 // not typed anything into the omnibox. | 102 // not typed anything into the omnibox. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 105 | 113 |
| 106 // Set to true if at least one suggestion was created since the last time the | 114 // Set to true if at least one suggestion was created since the last time the |
| 107 // omnibox was focused, even if the suggestion could not be displayed due to | 115 // omnibox was focused, even if the suggestion could not be displayed due to |
| 108 // a field trial. | 116 // a field trial. |
| 109 bool had_physical_web_suggestions_at_focus_or_later_; | 117 bool had_physical_web_suggestions_at_focus_or_later_; |
| 110 | 118 |
| 111 DISALLOW_COPY_AND_ASSIGN(PhysicalWebProvider); | 119 DISALLOW_COPY_AND_ASSIGN(PhysicalWebProvider); |
| 112 }; | 120 }; |
| 113 | 121 |
| 114 #endif // COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ | 122 #endif // COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ |
| OLD | NEW |