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

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

Issue 22364007: AutocompleteInput::PageClassification -> AutocompleteInput::OmniboxContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 zero-suggest autocomplete provider. This experimental 5 // This file contains the zero-suggest autocomplete provider. This experimental
6 // provider is invoked when the user focuses in the omnibox prior to editing, 6 // provider is invoked when the user focuses in the omnibox prior to editing,
7 // and generates search query suggestions based on the current URL. To enable 7 // and generates search query suggestions based on the current URL. To enable
8 // this provider, point --experimental-zero-suggest-url-prefix at an 8 // this provider, point --experimental-zero-suggest-url-prefix at an
9 // appropriate suggestion service. 9 // appropriate suggestion service.
10 // 10 //
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 // Adds provider-specific information to omnibox event logs. 64 // Adds provider-specific information to omnibox event logs.
65 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; 65 virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE;
66 66
67 // Sets |field_trial_triggered_| to false. 67 // Sets |field_trial_triggered_| to false.
68 virtual void ResetSession() OVERRIDE; 68 virtual void ResetSession() OVERRIDE;
69 69
70 // net::URLFetcherDelegate 70 // net::URLFetcherDelegate
71 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 71 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
72 72
73 // Initiates a new fetch for the given |url| of classification 73 // Initiates a new fetch for the given |url|. |omnibox_context| is the
74 // |page_classification|. |permanent_text| is the omnibox text 74 // current user context. |permanent_text| is the omnibox text for the current
75 // for the current page. 75 // page.
76 void StartZeroSuggest( 76 void StartZeroSuggest(
77 const GURL& url, 77 const GURL& url,
78 AutocompleteInput::PageClassification page_classification, 78 AutocompleteInput::OmniboxContext omnibox_context,
79 const string16& permanent_text); 79 const string16& permanent_text);
80 80
81 private: 81 private:
82 ZeroSuggestProvider(AutocompleteProviderListener* listener, 82 ZeroSuggestProvider(AutocompleteProviderListener* listener,
83 Profile* profile); 83 Profile* profile);
84 84
85 virtual ~ZeroSuggestProvider(); 85 virtual ~ZeroSuggestProvider();
86 86
87 bool ShouldRunZeroSuggest(const GURL& url) const; 87 bool ShouldRunZeroSuggest(const GURL& url) const;
88 88
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 AutocompleteMatch MatchForCurrentURL(); 140 AutocompleteMatch MatchForCurrentURL();
141 141
142 // Used to build default search engine URLs for suggested queries. 142 // Used to build default search engine URLs for suggested queries.
143 TemplateURLService* template_url_service_; 143 TemplateURLService* template_url_service_;
144 144
145 // The URL for which a suggestion fetch is pending. 145 // The URL for which a suggestion fetch is pending.
146 std::string current_query_; 146 std::string current_query_;
147 147
148 // The type of page the user is viewing (a search results page doing search 148 // The type of page the user is viewing (a search results page doing search
149 // term replacement, an arbitrary URL, etc.). 149 // term replacement, an arbitrary URL, etc.).
150 AutocompleteInput::PageClassification current_page_classification_; 150 AutocompleteInput::OmniboxContext omnibox_context_;
151 151
152 // Copy of OmniboxEditModel::permanent_text_. 152 // Copy of OmniboxEditModel::permanent_text_.
153 string16 permanent_text_; 153 string16 permanent_text_;
154 154
155 // Fetcher used to retrieve results. 155 // Fetcher used to retrieve results.
156 scoped_ptr<net::URLFetcher> fetcher_; 156 scoped_ptr<net::URLFetcher> fetcher_;
157 // Whether there's a pending request in flight. 157 // Whether there's a pending request in flight.
158 bool have_pending_request_; 158 bool have_pending_request_;
159 159
160 // Suggestion for the current URL. 160 // Suggestion for the current URL.
(...skipping 13 matching lines...) Expand all
174 // Whether a zero suggest request triggered a field trial in the omnibox 174 // Whether a zero suggest request triggered a field trial in the omnibox
175 // session. The user could have clicked on a suggestion when zero suggest 175 // session. The user could have clicked on a suggestion when zero suggest
176 // triggered (same condition as field_trial_triggered_), or triggered zero 176 // triggered (same condition as field_trial_triggered_), or triggered zero
177 // suggest but kept typing. 177 // suggest but kept typing.
178 bool field_trial_triggered_in_session_; 178 bool field_trial_triggered_in_session_;
179 179
180 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); 180 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider);
181 }; 181 };
182 182
183 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ 183 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698