OLD | NEW |
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. | 7 // and generates search query suggestions based on the current URL. |
8 | 8 |
9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ | 9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ |
10 #define CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ | 10 #define CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "chrome/browser/autocomplete/base_search_provider.h" | 15 #include "chrome/browser/autocomplete/base_search_provider.h" |
16 #include "chrome/browser/autocomplete/search_provider.h" | 16 #include "chrome/browser/autocomplete/search_provider.h" |
17 #include "chrome/browser/history/history_types.h" | 17 #include "chrome/browser/history/history_types.h" |
18 #include "components/metrics/proto/omnibox_event.pb.h" | 18 #include "components/metrics/proto/omnibox_event.pb.h" |
19 #include "net/url_request/url_fetcher_delegate.h" | 19 #include "net/url_request/url_fetcher_delegate.h" |
20 | 20 |
21 class AutocompleteProviderListener; | 21 class AutocompleteProviderListener; |
| 22 class Profile; |
22 class TemplateURLService; | 23 class TemplateURLService; |
23 | 24 |
24 namespace base { | 25 namespace base { |
25 class ListValue; | 26 class ListValue; |
26 class Value; | 27 class Value; |
27 } | 28 } |
28 | 29 |
29 namespace net { | 30 namespace net { |
30 class URLFetcher; | 31 class URLFetcher; |
31 } | 32 } |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // Whether we can show zero suggest on |current_page_url| without | 123 // Whether we can show zero suggest on |current_page_url| without |
123 // sending |current_page_url| as a parameter to the server at |suggest_url|. | 124 // sending |current_page_url| as a parameter to the server at |suggest_url|. |
124 bool CanShowZeroSuggestWithoutSendingURL(const GURL& suggest_url, | 125 bool CanShowZeroSuggestWithoutSendingURL(const GURL& suggest_url, |
125 const GURL& current_page_url) const; | 126 const GURL& current_page_url) const; |
126 | 127 |
127 // Checks whether we have a set of zero suggest results cached, and if so | 128 // Checks whether we have a set of zero suggest results cached, and if so |
128 // populates |matches_| with cached results. | 129 // populates |matches_| with cached results. |
129 void MaybeUseCachedSuggestions(); | 130 void MaybeUseCachedSuggestions(); |
130 | 131 |
131 AutocompleteProviderListener* listener_; | 132 AutocompleteProviderListener* listener_; |
| 133 Profile* profile_; |
132 | 134 |
133 // The URL for which a suggestion fetch is pending. | 135 // The URL for which a suggestion fetch is pending. |
134 std::string current_query_; | 136 std::string current_query_; |
135 | 137 |
136 // The type of page the user is viewing (a search results page doing search | 138 // The type of page the user is viewing (a search results page doing search |
137 // term replacement, an arbitrary URL, etc.). | 139 // term replacement, an arbitrary URL, etc.). |
138 metrics::OmniboxEventProto::PageClassification current_page_classification_; | 140 metrics::OmniboxEventProto::PageClassification current_page_classification_; |
139 | 141 |
140 // Copy of OmniboxEditModel::permanent_text_. | 142 // Copy of OmniboxEditModel::permanent_text_. |
141 base::string16 permanent_text_; | 143 base::string16 permanent_text_; |
(...skipping 13 matching lines...) Expand all Loading... |
155 | 157 |
156 history::MostVisitedURLList most_visited_urls_; | 158 history::MostVisitedURLList most_visited_urls_; |
157 | 159 |
158 // For callbacks that may be run after destruction. | 160 // For callbacks that may be run after destruction. |
159 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_; | 161 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_; |
160 | 162 |
161 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); | 163 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); |
162 }; | 164 }; |
163 | 165 |
164 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ | 166 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ |
OLD | NEW |