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

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

Issue 2689803002: Ensure nearby URL count metric is properly initialized (Closed)
Patch Set: add new histogram to detect corner case Created 3 years, 10 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 <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 29 matching lines...) Expand all
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 15 matching lines...) Expand all
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.
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_;
Mark P 2017/02/22 06:25:39 Can you use npos and test for it explicitly rather
mattreynolds 2017/02/22 20:53:55 Sure, done.
92
93 // The nearby URL count is invalid if the omnibox was not focused during the
94 // current omnibox session. Invalid URL counts should not be recorded.
95 bool nearby_url_count_at_focus_valid_;
96
85 // If true, provide suggestions when the user has focused the omnibox but has 97 // If true, provide suggestions when the user has focused the omnibox but has
86 // not typed anything. 98 // not typed anything.
87 bool zero_suggest_enabled_; 99 bool zero_suggest_enabled_;
88 100
89 // If true, provide suggestions when the user has entered a query into the 101 // If true, provide suggestions when the user has entered a query into the
90 // omnibox. 102 // omnibox.
91 bool after_typing_enabled_; 103 bool after_typing_enabled_;
92 104
93 // The base relevance score for Physical Web URL suggestions when the user has 105 // The base relevance score for Physical Web URL suggestions when the user has
94 // not typed anything into the omnibox. 106 // not typed anything into the omnibox.
(...skipping 10 matching lines...) Expand all
105 117
106 // Set to true if at least one suggestion was created since the last time the 118 // 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 119 // omnibox was focused, even if the suggestion could not be displayed due to
108 // a field trial. 120 // a field trial.
109 bool had_physical_web_suggestions_at_focus_or_later_; 121 bool had_physical_web_suggestions_at_focus_or_later_;
110 122
111 DISALLOW_COPY_AND_ASSIGN(PhysicalWebProvider); 123 DISALLOW_COPY_AND_ASSIGN(PhysicalWebProvider);
112 }; 124 };
113 125
114 #endif // COMPONENTS_OMNIBOX_BROWSER_PHYSICAL_WEB_PROVIDER_H_ 126 #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