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 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 5 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/browser/autocomplete/zero_suggest_provider.h" | 24 #include "chrome/browser/autocomplete/zero_suggest_provider.h" |
25 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
26 #include "components/omnibox/omnibox_field_trial.h" | 26 #include "components/omnibox/omnibox_field_trial.h" |
27 #include "components/search_engines/template_url.h" | 27 #include "components/search_engines/template_url.h" |
28 #include "components/search_engines/template_url_service.h" | 28 #include "components/search_engines/template_url_service.h" |
29 #include "content/public/browser/notification_service.h" | 29 #include "content/public/browser/notification_service.h" |
30 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
31 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
32 #include "ui/base/l10n/l10n_util.h" | 32 #include "ui/base/l10n/l10n_util.h" |
33 | 33 |
| 34 #if defined(ENABLE_EXTENSIONS) |
| 35 #include "chrome/browser/autocomplete/keyword_extensions_delegate_impl.h" |
| 36 #endif |
| 37 |
34 namespace { | 38 namespace { |
35 | 39 |
36 // Converts the given match to a type (and possibly subtype) based on the AQS | 40 // Converts the given match to a type (and possibly subtype) based on the AQS |
37 // specification. For more details, see | 41 // specification. For more details, see |
38 // http://goto.google.com/binary-clients-logging. | 42 // http://goto.google.com/binary-clients-logging. |
39 void AutocompleteMatchToAssistedQuery( | 43 void AutocompleteMatchToAssistedQuery( |
40 const AutocompleteMatch::Type& match, | 44 const AutocompleteMatch::Type& match, |
41 const AutocompleteProvider* provider, | 45 const AutocompleteProvider* provider, |
42 size_t* type, | 46 size_t* type, |
43 size_t* subtype) { | 47 size_t* subtype) { |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 providers_.push_back(new BuiltinProvider()); | 192 providers_.push_back(new BuiltinProvider()); |
189 if (provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK) | 193 if (provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK) |
190 providers_.push_back(new HistoryQuickProvider(profile)); | 194 providers_.push_back(new HistoryQuickProvider(profile)); |
191 if (provider_types & AutocompleteProvider::TYPE_HISTORY_URL) { | 195 if (provider_types & AutocompleteProvider::TYPE_HISTORY_URL) { |
192 history_url_provider_ = new HistoryURLProvider(this, profile); | 196 history_url_provider_ = new HistoryURLProvider(this, profile); |
193 providers_.push_back(history_url_provider_); | 197 providers_.push_back(history_url_provider_); |
194 } | 198 } |
195 // "Tab to search" can be used on all platforms other than Android. | 199 // "Tab to search" can be used on all platforms other than Android. |
196 #if !defined(OS_ANDROID) | 200 #if !defined(OS_ANDROID) |
197 if (provider_types & AutocompleteProvider::TYPE_KEYWORD) { | 201 if (provider_types & AutocompleteProvider::TYPE_KEYWORD) { |
198 keyword_provider_ = new KeywordProvider(this, profile); | 202 keyword_provider_ = new KeywordProvider(this, template_url_service); |
| 203 #if defined(ENABLE_EXTENSIONS) |
| 204 keyword_provider_->set_extensions_delegate( |
| 205 scoped_ptr<KeywordExtensionsDelegate>( |
| 206 new KeywordExtensionsDelegateImpl(profile, keyword_provider_))); |
| 207 #endif |
199 providers_.push_back(keyword_provider_); | 208 providers_.push_back(keyword_provider_); |
200 } | 209 } |
201 #endif | 210 #endif |
202 if (provider_types & AutocompleteProvider::TYPE_SEARCH) { | 211 if (provider_types & AutocompleteProvider::TYPE_SEARCH) { |
203 search_provider_ = new SearchProvider(this, template_url_service, profile); | 212 search_provider_ = new SearchProvider(this, template_url_service, profile); |
204 providers_.push_back(search_provider_); | 213 providers_.push_back(search_provider_); |
205 } | 214 } |
206 if (provider_types & AutocompleteProvider::TYPE_SHORTCUTS) | 215 if (provider_types & AutocompleteProvider::TYPE_SHORTCUTS) |
207 providers_.push_back(new ShortcutsProvider(profile)); | 216 providers_.push_back(new ShortcutsProvider(profile)); |
208 if (provider_types & AutocompleteProvider::TYPE_ZERO_SUGGEST) { | 217 if (provider_types & AutocompleteProvider::TYPE_ZERO_SUGGEST) { |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 this, &AutocompleteController::ExpireCopiedEntries); | 677 this, &AutocompleteController::ExpireCopiedEntries); |
669 } | 678 } |
670 | 679 |
671 void AutocompleteController::StartStopTimer() { | 680 void AutocompleteController::StartStopTimer() { |
672 stop_timer_.Start(FROM_HERE, | 681 stop_timer_.Start(FROM_HERE, |
673 stop_timer_duration_, | 682 stop_timer_duration_, |
674 base::Bind(&AutocompleteController::Stop, | 683 base::Bind(&AutocompleteController::Stop, |
675 base::Unretained(this), | 684 base::Unretained(this), |
676 false)); | 685 false)); |
677 } | 686 } |
OLD | NEW |