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

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: rebase 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_controller.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) 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 const base::TimeTicks& last_time_default_match_changed() const {
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. (Normally we allow
154 // matches from the previous result set carry over. These stale
155 // results may outrank legitimate matches from the current result
156 // set. Sometimes we just want the current matches; the easier way
157 // to do this is to throw everything out and reconstruct the result
158 // set from the providers' current data.)
159 // If |force_notify_default_match_changed|, we tell NotifyChanged
160 // the default match has changed even if it hasn't. This is
161 // necessary in some cases; for instance, if the user typed a new
162 // character, the edit model needs to repaint (highlighting changed)
163 // even if the default match didn't change.
164 void UpdateResult(bool regenerate_result,
165 bool force_notify_default_match_changed);
149 166
150 // Updates |result| to populate each match's |associated_keyword| if that 167 // Updates |result| to populate each match's |associated_keyword| if that
151 // match can show a keyword hint. |result| should be sorted by 168 // match can show a keyword hint. |result| should be sorted by
152 // relevance before this is called. 169 // relevance before this is called.
153 void UpdateAssociatedKeywords(AutocompleteResult* result); 170 void UpdateAssociatedKeywords(AutocompleteResult* result);
154 171
155 // For each group of contiguous matches from the same TemplateURL, show the 172 // 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. 173 // provider name as a description on the first match in the group.
157 void UpdateKeywordDescriptions(AutocompleteResult* result); 174 void UpdateKeywordDescriptions(AutocompleteResult* result);
158 175
(...skipping 22 matching lines...) Expand all
181 SearchProvider* search_provider_; 198 SearchProvider* search_provider_;
182 199
183 ZeroSuggestProvider* zero_suggest_provider_; 200 ZeroSuggestProvider* zero_suggest_provider_;
184 201
185 // Input passed to Start. 202 // Input passed to Start.
186 AutocompleteInput input_; 203 AutocompleteInput input_;
187 204
188 // Data from the autocomplete query. 205 // Data from the autocomplete query.
189 AutocompleteResult result_; 206 AutocompleteResult result_;
190 207
208 // The most recent time the default match (inline match) changed. This may
209 // be earlier than the most recent keystroke if the recent keystrokes didn't
210 // change the suggested match in the omnibox. (For instance, if
211 // a user typed "mail.goog" and the match https://mail.google.com/ was
212 // the destination match ever since the user typed "ma" then this is
213 // the time that URL first appeared as the default match.) This may
214 // also be more recent than the last keystroke if there was an
215 // asynchronous provider that returned and changed the default
216 // match. See UpdateResult() for details on when we consider a
217 // match to have changed.
218 base::TimeTicks last_time_default_match_changed_;
219
191 // Timer used to remove any matches copied from the last result. When run 220 // Timer used to remove any matches copied from the last result. When run
192 // invokes |ExpireCopiedEntries|. 221 // invokes |ExpireCopiedEntries|.
193 base::OneShotTimer<AutocompleteController> expire_timer_; 222 base::OneShotTimer<AutocompleteController> expire_timer_;
194 223
195 // True if a query is not currently running. 224 // True if a query is not currently running.
196 bool done_; 225 bool done_;
197 226
198 // Are we in Start()? This is used to avoid updating |result_| and sending 227 // Are we in Start()? This is used to avoid updating |result_| and sending
199 // notifications until Start() has been invoked on all providers. 228 // notifications until Start() has been invoked on all providers.
200 bool in_start_; 229 bool in_start_;
201 230
202 // Has StartZeroSuggest() been called but not Start()? 231 // Has StartZeroSuggest() been called but not Start()?
203 bool in_zero_suggest_; 232 bool in_zero_suggest_;
204 233
205 Profile* profile_; 234 Profile* profile_;
206 235
207 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); 236 DISALLOW_COPY_AND_ASSIGN(AutocompleteController);
208 }; 237 };
209 238
210 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ 239 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698