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 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
27 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 27 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/browser/search/search.h" | 29 #include "chrome/browser/search/search.h" |
30 #include "chrome/browser/search_engines/template_url.h" | 30 #include "chrome/browser/search_engines/template_url.h" |
31 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
32 #include "grit/generated_resources.h" | 32 #include "grit/generated_resources.h" |
33 #include "grit/theme_resources.h" | 33 #include "grit/theme_resources.h" |
34 #include "ui/base/l10n/l10n_util.h" | 34 #include "ui/base/l10n/l10n_util.h" |
35 | 35 |
36 #if defined(OS_CHROMEOS) | |
37 #include "chrome/browser/autocomplete/contact_provider_chromeos.h" | |
38 #include "chrome/browser/chromeos/contacts/contact_manager.h" | |
39 #endif | |
40 | |
41 namespace { | 36 namespace { |
42 | 37 |
43 // Converts the given match to a type (and possibly subtype) based on the AQS | 38 // Converts the given match to a type (and possibly subtype) based on the AQS |
44 // specification. For more details, see | 39 // specification. For more details, see |
45 // http://goto.google.com/binary-clients-logging. | 40 // http://goto.google.com/binary-clients-logging. |
46 void AutocompleteMatchToAssistedQuery( | 41 void AutocompleteMatchToAssistedQuery( |
47 const AutocompleteMatch::Type& match, size_t* type, size_t* subtype) { | 42 const AutocompleteMatch::Type& match, size_t* type, size_t* subtype) { |
48 // This type indicates a native chrome suggestion. | 43 // This type indicates a native chrome suggestion. |
49 *type = 69; | 44 *type = 69; |
50 // Default value, indicating no subtype. | 45 // Default value, indicating no subtype. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 stop_timer_duration_(OmniboxFieldTrial::StopTimerFieldTrialDuration()), | 156 stop_timer_duration_(OmniboxFieldTrial::StopTimerFieldTrialDuration()), |
162 done_(true), | 157 done_(true), |
163 in_start_(false), | 158 in_start_(false), |
164 in_zero_suggest_(false), | 159 in_zero_suggest_(false), |
165 profile_(profile) { | 160 profile_(profile) { |
166 provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes(); | 161 provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes(); |
167 if (provider_types & AutocompleteProvider::TYPE_BOOKMARK) | 162 if (provider_types & AutocompleteProvider::TYPE_BOOKMARK) |
168 providers_.push_back(new BookmarkProvider(this, profile)); | 163 providers_.push_back(new BookmarkProvider(this, profile)); |
169 if (provider_types & AutocompleteProvider::TYPE_BUILTIN) | 164 if (provider_types & AutocompleteProvider::TYPE_BUILTIN) |
170 providers_.push_back(new BuiltinProvider(this, profile)); | 165 providers_.push_back(new BuiltinProvider(this, profile)); |
171 #if defined(OS_CHROMEOS) | |
172 if (provider_types & AutocompleteProvider::TYPE_CONTACT) | |
173 providers_.push_back(new ContactProvider(this, profile, | |
174 contacts::ContactManager::GetInstance()->GetWeakPtr())); | |
175 #endif | |
176 if (provider_types & AutocompleteProvider::TYPE_EXTENSION_APP) | 166 if (provider_types & AutocompleteProvider::TYPE_EXTENSION_APP) |
177 providers_.push_back(new ExtensionAppProvider(this, profile)); | 167 providers_.push_back(new ExtensionAppProvider(this, profile)); |
178 if (provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK) | 168 if (provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK) |
179 providers_.push_back(new HistoryQuickProvider(this, profile)); | 169 providers_.push_back(new HistoryQuickProvider(this, profile)); |
180 if (provider_types & AutocompleteProvider::TYPE_HISTORY_URL) { | 170 if (provider_types & AutocompleteProvider::TYPE_HISTORY_URL) { |
181 history_url_provider_ = new HistoryURLProvider(this, profile); | 171 history_url_provider_ = new HistoryURLProvider(this, profile); |
182 providers_.push_back(history_url_provider_); | 172 providers_.push_back(history_url_provider_); |
183 } | 173 } |
184 // "Tab to search" can be used on all platforms other than Android. | 174 // "Tab to search" can be used on all platforms other than Android. |
185 #if !defined(OS_ANDROID) | 175 #if !defined(OS_ANDROID) |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 this, &AutocompleteController::ExpireCopiedEntries); | 632 this, &AutocompleteController::ExpireCopiedEntries); |
643 } | 633 } |
644 | 634 |
645 void AutocompleteController::StartStopTimer() { | 635 void AutocompleteController::StartStopTimer() { |
646 stop_timer_.Start(FROM_HERE, | 636 stop_timer_.Start(FROM_HERE, |
647 stop_timer_duration_, | 637 stop_timer_duration_, |
648 base::Bind(&AutocompleteController::Stop, | 638 base::Bind(&AutocompleteController::Stop, |
649 base::Unretained(this), | 639 base::Unretained(this), |
650 false)); | 640 false)); |
651 } | 641 } |
OLD | NEW |