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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" | 16 #include "chrome/browser/autocomplete/autocomplete_controller_delegate.h" |
17 #include "chrome/browser/autocomplete/bookmark_provider.h" | 17 #include "chrome/browser/autocomplete/bookmark_provider.h" |
18 #include "chrome/browser/autocomplete/builtin_provider.h" | 18 #include "chrome/browser/autocomplete/builtin_provider.h" |
| 19 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_delegate.h" |
19 #include "chrome/browser/autocomplete/history_quick_provider.h" | 20 #include "chrome/browser/autocomplete/history_quick_provider.h" |
20 #include "chrome/browser/autocomplete/history_url_provider.h" | 21 #include "chrome/browser/autocomplete/history_url_provider.h" |
21 #include "chrome/browser/autocomplete/search_provider.h" | 22 #include "chrome/browser/autocomplete/search_provider.h" |
22 #include "chrome/browser/autocomplete/shortcuts_provider.h" | 23 #include "chrome/browser/autocomplete/shortcuts_provider.h" |
23 #include "chrome/browser/autocomplete/zero_suggest_provider.h" | 24 #include "chrome/browser/autocomplete/zero_suggest_provider.h" |
24 #include "chrome/browser/chrome_notification_types.h" | 25 #include "chrome/browser/chrome_notification_types.h" |
25 #include "components/omnibox/keyword_provider.h" | 26 #include "components/omnibox/keyword_provider.h" |
26 #include "components/omnibox/omnibox_field_trial.h" | 27 #include "components/omnibox/omnibox_field_trial.h" |
27 #include "components/search_engines/template_url.h" | 28 #include "components/search_engines/template_url.h" |
28 #include "components/search_engines/template_url_service.h" | 29 #include "components/search_engines/template_url_service.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 keyword_provider_ = new KeywordProvider(this, template_url_service); | 202 keyword_provider_ = new KeywordProvider(this, template_url_service); |
202 #if defined(ENABLE_EXTENSIONS) | 203 #if defined(ENABLE_EXTENSIONS) |
203 keyword_provider_->set_extensions_delegate( | 204 keyword_provider_->set_extensions_delegate( |
204 scoped_ptr<KeywordExtensionsDelegate>( | 205 scoped_ptr<KeywordExtensionsDelegate>( |
205 new KeywordExtensionsDelegateImpl(profile, keyword_provider_))); | 206 new KeywordExtensionsDelegateImpl(profile, keyword_provider_))); |
206 #endif | 207 #endif |
207 providers_.push_back(keyword_provider_); | 208 providers_.push_back(keyword_provider_); |
208 } | 209 } |
209 #endif | 210 #endif |
210 if (provider_types & AutocompleteProvider::TYPE_SEARCH) { | 211 if (provider_types & AutocompleteProvider::TYPE_SEARCH) { |
211 search_provider_ = new SearchProvider(this, template_url_service, profile); | 212 search_provider_ = new SearchProvider( |
| 213 this, template_url_service, scoped_ptr<AutocompleteProviderDelegate>( |
| 214 new ChromeAutocompleteProviderDelegate(profile))); |
212 providers_.push_back(search_provider_); | 215 providers_.push_back(search_provider_); |
213 } | 216 } |
214 if (provider_types & AutocompleteProvider::TYPE_SHORTCUTS) | 217 if (provider_types & AutocompleteProvider::TYPE_SHORTCUTS) |
215 providers_.push_back(new ShortcutsProvider(profile)); | 218 providers_.push_back(new ShortcutsProvider(profile)); |
216 if (provider_types & AutocompleteProvider::TYPE_ZERO_SUGGEST) { | 219 if (provider_types & AutocompleteProvider::TYPE_ZERO_SUGGEST) { |
217 zero_suggest_provider_ = ZeroSuggestProvider::Create( | 220 zero_suggest_provider_ = ZeroSuggestProvider::Create( |
218 this, template_url_service, profile); | 221 this, template_url_service, profile); |
219 if (zero_suggest_provider_) | 222 if (zero_suggest_provider_) |
220 providers_.push_back(zero_suggest_provider_); | 223 providers_.push_back(zero_suggest_provider_); |
221 } | 224 } |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 this, &AutocompleteController::ExpireCopiedEntries); | 679 this, &AutocompleteController::ExpireCopiedEntries); |
677 } | 680 } |
678 | 681 |
679 void AutocompleteController::StartStopTimer() { | 682 void AutocompleteController::StartStopTimer() { |
680 stop_timer_.Start(FROM_HERE, | 683 stop_timer_.Start(FROM_HERE, |
681 stop_timer_duration_, | 684 stop_timer_duration_, |
682 base::Bind(&AutocompleteController::Stop, | 685 base::Bind(&AutocompleteController::Stop, |
683 base::Unretained(this), | 686 base::Unretained(this), |
684 false)); | 687 false)); |
685 } | 688 } |
OLD | NEW |