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

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

Issue 17022004: Replace --google-base-suggest-url and --instant-url with --google-base-url. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 5 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 | 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 // This file contains the Search autocomplete provider. This provider is 5 // This file contains the Search autocomplete provider. This provider is
6 // responsible for all autocomplete entries that start with "Search <engine> 6 // responsible for all autocomplete entries that start with "Search <engine>
7 // for ...", including searching for the current input string, search 7 // for ...", including searching for the current input string, search
8 // history, and search suggestions. An instance of it gets created and 8 // history, and search suggestions. An instance of it gets created and
9 // managed by the autocomplete controller. 9 // managed by the autocomplete controller.
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 public net::URLFetcherDelegate { 54 public net::URLFetcherDelegate {
55 public: 55 public:
56 // ID used in creating URLFetcher for default provider's suggest results. 56 // ID used in creating URLFetcher for default provider's suggest results.
57 static const int kDefaultProviderURLFetcherID; 57 static const int kDefaultProviderURLFetcherID;
58 58
59 // ID used in creating URLFetcher for keyword provider's suggest results. 59 // ID used in creating URLFetcher for keyword provider's suggest results.
60 static const int kKeywordProviderURLFetcherID; 60 static const int kKeywordProviderURLFetcherID;
61 61
62 SearchProvider(AutocompleteProviderListener* listener, Profile* profile); 62 SearchProvider(AutocompleteProviderListener* listener, Profile* profile);
63 63
64 // Returns an AutocompleteMatch representing a search for |query_string| 64 // Returns an AutocompleteMatch with the given |autocomplete_provider|,
65 // using the provider identified by |keyword|. |is_keyword| should be true if 65 // |relevance|, and |type|, which represents a search via |template_url| for
66 // |input| represents a keyword search (even if it's for the default search 66 // |query_string|. If |template_url| is NULL, returns a match with an invalid
67 // provider). |input_text| (the original input text) and |accepted_suggestion| 67 // destination URL.
68 // are used to generate Assisted Query Stats. 68 //
69 // Returns a match with an invalid destination_url in case of any errors. 69 // |input_text| is the original user input, which may differ from
70 // |query_string|; e.g. the user typed "foo" and got a search suggestion of
71 // "food", which we're now marking up. This is used to highlight portions of
72 // the match contents to distinguish locally-typed text from suggested text.
73 //
74 // |input| and |is_keyword| are necessary for various other details, like
75 // whether we should allow inline autocompletion and what the transition type
76 // should be. |accepted_suggestion| and |omnibox_start_margin| are used along
77 // with |input_text| to generate Assisted Query Stats.
78 // |append_extra_query_params| should be set if |template_url| is the default
79 // search engine, so the destination URL will contain any
80 // command-line-specified query params.
70 static AutocompleteMatch CreateSearchSuggestion( 81 static AutocompleteMatch CreateSearchSuggestion(
71 Profile* profile,
72 AutocompleteProvider* autocomplete_provider, 82 AutocompleteProvider* autocomplete_provider,
73 const AutocompleteInput& input, 83 int relevance,
84 AutocompleteMatch::Type type,
85 const TemplateURL* template_url,
74 const string16& query_string, 86 const string16& query_string,
75 const string16& input_text, 87 const string16& input_text,
76 int relevance, 88 const AutocompleteInput& input,
77 AutocompleteMatch::Type type, 89 bool is_keyword,
78 int accepted_suggestion, 90 int accepted_suggestion,
79 bool is_keyword, 91 int omnibox_start_margin,
80 const string16& keyword, 92 bool append_extra_query_params);
81 int omnibox_start_margin);
82 93
83 // AutocompleteProvider: 94 // AutocompleteProvider:
84 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; 95 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE;
85 virtual void ResetSession() OVERRIDE; 96 virtual void ResetSession() OVERRIDE;
86 97
87 // Marks the instant query as done. If |input_text| is non-empty this changes 98 // Marks the instant query as done. If |input_text| is non-empty this changes
88 // the 'search what you typed' results text to |input_text| + 99 // the 'search what you typed' results text to |input_text| +
89 // |suggestion.text|. |input_text| is the text the user input into the edit. 100 // |suggestion.text|. |input_text| is the text the user input into the edit.
90 // |input_text| differs from |input_.text()| if the input contained 101 // |input_text| differs from |input_.text()| if the input contained
91 // whitespace. 102 // whitespace.
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // See comments for SuppressSearchSuggestions(). 566 // See comments for SuppressSearchSuggestions().
556 bool suppress_search_suggestions_; 567 bool suppress_search_suggestions_;
557 568
558 // Start margin of the omnibox. Used to construct search URLs. 569 // Start margin of the omnibox. Used to construct search URLs.
559 int omnibox_start_margin_; 570 int omnibox_start_margin_;
560 571
561 DISALLOW_COPY_AND_ASSIGN(SearchProvider); 572 DISALLOW_COPY_AND_ASSIGN(SearchProvider);
562 }; 573 };
563 574
564 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ 575 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/keyword_provider_unittest.cc ('k') | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698