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

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

Issue 228013002: Use whether a query is from the app list to determine the RLZ parameter. (Closed) Base URL: http://git.chromium.org/chromium/src.git@rlz-access-ids
Patch Set: Created 6 years, 8 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 | chrome/browser/autocomplete/base_search_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This class contains common functionality for search-based autocomplete 5 // This class contains common functionality for search-based autocomplete
6 // providers. Search provider and zero suggest provider both use it for common 6 // providers. Search provider and zero suggest provider both use it for common
7 // functionality. 7 // functionality.
8 8
9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ 9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_
10 #define CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ 10 #define CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // AutocompleteProvider: 67 // AutocompleteProvider:
68 virtual void Stop(bool clear_cached_results) OVERRIDE; 68 virtual void Stop(bool clear_cached_results) OVERRIDE;
69 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; 69 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE;
70 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; 70 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE;
71 71
72 bool field_trial_triggered_in_session() const { 72 bool field_trial_triggered_in_session() const {
73 return field_trial_triggered_in_session_; 73 return field_trial_triggered_in_session_;
74 } 74 }
75 75
76 void set_in_app_list() { in_app_list_ = true; }
77
76 protected: 78 protected:
77 // The following keys are used to record additional information on matches. 79 // The following keys are used to record additional information on matches.
78 80
79 // We annotate our AutocompleteMatches with whether their relevance scores 81 // We annotate our AutocompleteMatches with whether their relevance scores
80 // were server-provided using this key in the |additional_info| field. 82 // were server-provided using this key in the |additional_info| field.
81 static const char kRelevanceFromServerKey[]; 83 static const char kRelevanceFromServerKey[];
82 84
83 // Indicates whether the server said a match should be prefetched. 85 // Indicates whether the server said a match should be prefetched.
84 static const char kShouldPrefetchKey[]; 86 static const char kShouldPrefetchKey[];
85 87
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 // portions of the match contents to distinguish locally-typed text from 322 // portions of the match contents to distinguish locally-typed text from
321 // suggested text. 323 // suggested text.
322 // 324 //
323 // |input| is also necessary for various other details, like whether we should 325 // |input| is also necessary for various other details, like whether we should
324 // allow inline autocompletion and what the transition type should be. 326 // allow inline autocompletion and what the transition type should be.
325 // |accepted_suggestion| and |omnibox_start_margin| are used to generate 327 // |accepted_suggestion| and |omnibox_start_margin| are used to generate
326 // Assisted Query Stats. 328 // Assisted Query Stats.
327 // |append_extra_query_params| should be set if |template_url| is the default 329 // |append_extra_query_params| should be set if |template_url| is the default
328 // search engine, so the destination URL will contain any 330 // search engine, so the destination URL will contain any
329 // command-line-specified query params. 331 // command-line-specified query params.
332 // |from_app_list| should be set if the search was made from the app list.
330 static AutocompleteMatch CreateSearchSuggestion( 333 static AutocompleteMatch CreateSearchSuggestion(
331 AutocompleteProvider* autocomplete_provider, 334 AutocompleteProvider* autocomplete_provider,
332 const AutocompleteInput& input, 335 const AutocompleteInput& input,
333 const SuggestResult& suggestion, 336 const SuggestResult& suggestion,
334 const TemplateURL* template_url, 337 const TemplateURL* template_url,
335 int accepted_suggestion, 338 int accepted_suggestion,
336 int omnibox_start_margin, 339 int omnibox_start_margin,
337 bool append_extra_query_params); 340 bool append_extra_query_params,
341 bool from_app_list);
338 342
339 // Parses JSON response received from the provider, stripping XSSI 343 // Parses JSON response received from the provider, stripping XSSI
340 // protection if needed. Returns the parsed data if successful, NULL 344 // protection if needed. Returns the parsed data if successful, NULL
341 // otherwise. 345 // otherwise.
342 static scoped_ptr<base::Value> DeserializeJsonData(std::string json_data); 346 static scoped_ptr<base::Value> DeserializeJsonData(std::string json_data);
343 347
344 // Returns whether the requirements for requesting zero suggest results 348 // Returns whether the requirements for requesting zero suggest results
345 // are met. The requirements are 349 // are met. The requirements are
346 // * The user is enrolled in a zero suggest experiment. 350 // * The user is enrolled in a zero suggest experiment.
347 // * The user is not on the NTP. 351 // * The user is not on the NTP.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 // server to handle the results of the deletion. It will be called after the 477 // server to handle the results of the deletion. It will be called after the
474 // deletion request completes. 478 // deletion request completes.
475 void OnDeletionComplete(bool success, 479 void OnDeletionComplete(bool success,
476 SuggestionDeletionHandler* handler); 480 SuggestionDeletionHandler* handler);
477 481
478 // Each deletion handler in this vector corresponds to an outstanding request 482 // Each deletion handler in this vector corresponds to an outstanding request
479 // that a server delete a personalized suggestion. Making this a ScopedVector 483 // that a server delete a personalized suggestion. Making this a ScopedVector
480 // causes us to auto-cancel all such requests on shutdown. 484 // causes us to auto-cancel all such requests on shutdown.
481 SuggestionDeletionHandlers deletion_handlers_; 485 SuggestionDeletionHandlers deletion_handlers_;
482 486
487 // True if this provider's results are being displayed in the app list. By
488 // default this is false, meaning that the results will be shown in the
489 // omnibox.
490 bool in_app_list_;
491
483 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); 492 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider);
484 }; 493 };
485 494
486 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ 495 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/base_search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698