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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_controller.h

Issue 11316057: Omnibox: Log Elapsed Time Since Last Time The Default Match Changed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
11 #include "base/string16.h" 11 #include "base/string16.h"
12 #include "base/time.h"
12 #include "base/timer.h" 13 #include "base/timer.h"
13 #include "chrome/browser/autocomplete/autocomplete_input.h" 14 #include "chrome/browser/autocomplete/autocomplete_input.h"
14 #include "chrome/browser/autocomplete/autocomplete_provider.h" 15 #include "chrome/browser/autocomplete/autocomplete_provider.h"
15 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h" 16 #include "chrome/browser/autocomplete/autocomplete_provider_listener.h"
16 #include "chrome/browser/autocomplete/autocomplete_result.h" 17 #include "chrome/browser/autocomplete/autocomplete_result.h"
17 18
18 class AutocompleteControllerDelegate; 19 class AutocompleteControllerDelegate;
19 class KeywordProvider; 20 class KeywordProvider;
20 class Profile; 21 class Profile;
21 class SearchProvider; 22 class SearchProvider;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 void ExpireCopiedEntries(); 119 void ExpireCopiedEntries();
119 120
120 SearchProvider* search_provider() const { return search_provider_; } 121 SearchProvider* search_provider() const { return search_provider_; }
121 KeywordProvider* keyword_provider() const { return keyword_provider_; } 122 KeywordProvider* keyword_provider() const { return keyword_provider_; }
122 123
123 const AutocompleteInput& input() const { return input_; } 124 const AutocompleteInput& input() const { return input_; }
124 const AutocompleteResult& result() const { return result_; } 125 const AutocompleteResult& result() const { return result_; }
125 bool done() const { return done_; } 126 bool done() const { return done_; }
126 const ACProviders* providers() const { return &providers_; } 127 const ACProviders* providers() const { return &providers_; }
127 128
129 base::TimeTicks last_time_default_match_changed() const {
Peter Kasting 2012/11/16 23:57:18 Nit: return class objects by const & where possibl
Mark P 2012/11/19 22:21:45 Good idea.
130 return last_time_default_match_changed_;
131 }
132
128 // AutocompleteProviderListener: 133 // AutocompleteProviderListener:
129 virtual void OnProviderUpdate(bool updated_matches) OVERRIDE; 134 virtual void OnProviderUpdate(bool updated_matches) OVERRIDE;
130 135
131 // Called when an omnibox event log entry is generated. 136 // Called when an omnibox event log entry is generated.
132 // Populates provider_info with diagnostic information about the status 137 // Populates provider_info with diagnostic information about the status
133 // of various providers. In turn, calls 138 // of various providers. In turn, calls
134 // AutocompleteProvider::AddProviderInfo() so each provider can add 139 // AutocompleteProvider::AddProviderInfo() so each provider can add
135 // provider-specific information, information we want to log for a particular 140 // provider-specific information, information we want to log for a particular
136 // provider but not others. 141 // provider but not others.
137 void AddProvidersInfo(ProvidersInfo* provider_info) const; 142 void AddProvidersInfo(ProvidersInfo* provider_info) const;
138 143
139 private: 144 private:
140 friend class AutocompleteProviderTest; 145 friend class AutocompleteProviderTest;
141 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, 146 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest,
142 RedundantKeywordsIgnoredInResult); 147 RedundantKeywordsIgnoredInResult);
143 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, UpdateAssistedQueryStats); 148 FRIEND_TEST_ALL_PREFIXES(AutocompleteProviderTest, UpdateAssistedQueryStats);
144 149
145 // Updates |result_| to reflect the current provider state. Resets timers and 150 // Updates |result_| to reflect the current provider state and fires
146 // fires notifications as necessary. |is_synchronous_pass| is true only when 151 // notifications. If |regenerate_result| then we clear the result
147 // Start() is calling this to get the synchronous result. 152 // so when we incorporate the current provider state we end up
148 void UpdateResult(bool is_synchronous_pass); 153 // implicitly removing all expired matches. If
154 // |force_notify_default_match_changed|, we tell NotifyChanged the
155 // default match has changed even if it hasn't.
Peter Kasting 2012/11/16 23:57:18 Nit: May want to motivate this last sentence with
Mark P 2012/11/19 22:21:45 Done.
156 void UpdateResult(bool regenerate_result,
157 bool force_notify_default_match_changed);
149 158
150 // Updates |result| to populate each match's |associated_keyword| if that 159 // Updates |result| to populate each match's |associated_keyword| if that
151 // match can show a keyword hint. |result| should be sorted by 160 // match can show a keyword hint. |result| should be sorted by
152 // relevance before this is called. 161 // relevance before this is called.
153 void UpdateAssociatedKeywords(AutocompleteResult* result); 162 void UpdateAssociatedKeywords(AutocompleteResult* result);
154 163
155 // For each group of contiguous matches from the same TemplateURL, show the 164 // For each group of contiguous matches from the same TemplateURL, show the
156 // provider name as a description on the first match in the group. 165 // provider name as a description on the first match in the group.
157 void UpdateKeywordDescriptions(AutocompleteResult* result); 166 void UpdateKeywordDescriptions(AutocompleteResult* result);
158 167
(...skipping 22 matching lines...) Expand all
181 SearchProvider* search_provider_; 190 SearchProvider* search_provider_;
182 191
183 ZeroSuggestProvider* zero_suggest_provider_; 192 ZeroSuggestProvider* zero_suggest_provider_;
184 193
185 // Input passed to Start. 194 // Input passed to Start.
186 AutocompleteInput input_; 195 AutocompleteInput input_;
187 196
188 // Data from the autocomplete query. 197 // Data from the autocomplete query.
189 AutocompleteResult result_; 198 AutocompleteResult result_;
190 199
200 // The most recent time the default match (inline match) changed. This may
201 // be earlier than the most recent keystroke if the recent keystrokes didn't
202 // change the suggested match in the omnibox. (For instance, if
203 // a user typed "mail.goog" and the match https://mail.google.com/ was
204 // the destination match ever since the user typed "ma" then this time
205 // corresponds to the first instance https://mail.google.com/ first
Bart N. 2012/11/19 18:02:21 Nit: remove second "first".
Mark P 2012/11/19 22:21:45 Done.
206 // appeared as the default match.) This also be me more recent than the
Peter Kasting 2012/11/16 23:57:18 Nit: extra "me"
Bart N. 2012/11/19 18:02:21 Nit: move dot outside parenthese.
Mark P 2012/11/19 22:21:45 Let's as-is. The parenthetical remark is a full s
Mark P 2012/11/19 22:21:45 Removed "me"
207 // last keystroke if there was an asynchronous provider that returned
208 // and changed the default match. See UpdateResult() for details on
209 // when we consider a match has changed.
Peter Kasting 2012/11/16 23:57:18 Nit: has -> to have
Mark P 2012/11/19 22:21:45 Done.
210 base::TimeTicks last_time_default_match_changed_;
211
191 // Timer used to remove any matches copied from the last result. When run 212 // Timer used to remove any matches copied from the last result. When run
192 // invokes |ExpireCopiedEntries|. 213 // invokes |ExpireCopiedEntries|.
193 base::OneShotTimer<AutocompleteController> expire_timer_; 214 base::OneShotTimer<AutocompleteController> expire_timer_;
194 215
195 // True if a query is not currently running. 216 // True if a query is not currently running.
196 bool done_; 217 bool done_;
197 218
198 // Are we in Start()? This is used to avoid updating |result_| and sending 219 // Are we in Start()? This is used to avoid updating |result_| and sending
199 // notifications until Start() has been invoked on all providers. 220 // notifications until Start() has been invoked on all providers.
200 bool in_start_; 221 bool in_start_;
201 222
202 // Has StartZeroSuggest() been called but not Start()? 223 // Has StartZeroSuggest() been called but not Start()?
203 bool in_zero_suggest_; 224 bool in_zero_suggest_;
204 225
205 Profile* profile_; 226 Profile* profile_;
206 227
207 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); 228 DISALLOW_COPY_AND_ASSIGN(AutocompleteController);
208 }; 229 };
209 230
210 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ 231 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698