| 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. 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 bool field_trial_triggered_in_session() const { | 81 bool field_trial_triggered_in_session() const { |
| 82 return field_trial_triggered_in_session_; | 82 return field_trial_triggered_in_session_; |
| 83 } | 83 } |
| 84 | 84 |
| 85 private: | 85 private: |
| 86 ZeroSuggestProvider(AutocompleteProviderListener* listener, | 86 ZeroSuggestProvider(AutocompleteProviderListener* listener, |
| 87 Profile* profile); | 87 Profile* profile); |
| 88 | 88 |
| 89 virtual ~ZeroSuggestProvider(); | 89 virtual ~ZeroSuggestProvider(); |
| 90 | 90 |
| 91 bool ShouldRunZeroSuggest(const GURL& url) const; | |
| 92 | |
| 93 // Whether the URL can get Zero Suggest. For example, don't send the URL of | |
| 94 // non-Google HTTPS requests because it may contain sensitive information. | |
| 95 bool ShouldSendURL(const GURL& url) const; | |
| 96 | |
| 97 // The 4 functions below (that take classes defined in SearchProvider as | 91 // The 4 functions below (that take classes defined in SearchProvider as |
| 98 // arguments) were copied and trimmed from SearchProvider. | 92 // arguments) were copied and trimmed from SearchProvider. |
| 99 // TODO(hfung): Refactor them into a new base class common to both | 93 // TODO(hfung): Refactor them into a new base class common to both |
| 100 // ZeroSuggestProvider and SearchProvider. | 94 // ZeroSuggestProvider and SearchProvider. |
| 101 | 95 |
| 102 // From the OpenSearch formatted response |root_val|, populate query | 96 // From the OpenSearch formatted response |root_val|, populate query |
| 103 // suggestions into |suggest_results|, navigation suggestions into | 97 // suggestions into |suggest_results|, navigation suggestions into |
| 104 // |navigation_results|, and the verbatim relevance score into | 98 // |navigation_results|, and the verbatim relevance score into |
| 105 // |verbatim_relevance|. | 99 // |verbatim_relevance|. |
| 106 void FillResults(const base::Value& root_val, | 100 void FillResults(const base::Value& root_val, |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 186 |
| 193 history::MostVisitedURLList most_visited_urls_; | 187 history::MostVisitedURLList most_visited_urls_; |
| 194 | 188 |
| 195 // For callbacks that may be run after destruction. | 189 // For callbacks that may be run after destruction. |
| 196 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_; | 190 base::WeakPtrFactory<ZeroSuggestProvider> weak_ptr_factory_; |
| 197 | 191 |
| 198 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); | 192 DISALLOW_COPY_AND_ASSIGN(ZeroSuggestProvider); |
| 199 }; | 193 }; |
| 200 | 194 |
| 201 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ | 195 #endif // CHROME_BROWSER_AUTOCOMPLETE_ZERO_SUGGEST_PROVIDER_H_ |
| OLD | NEW |