| 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/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 28 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/search/search.h" | 30 #include "chrome/browser/search/search.h" |
| 31 #include "chrome/browser/search_engines/template_url.h" | 31 #include "chrome/browser/search_engines/template_url.h" |
| 32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
| 33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 34 #include "grit/generated_resources.h" | 34 #include "grit/generated_resources.h" |
| 35 #include "grit/theme_resources.h" | 35 #include "grit/theme_resources.h" |
| 36 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 37 | 37 |
| 38 #if defined(OS_CHROMEOS) | |
| 39 #include "chrome/browser/autocomplete/contact_provider_chromeos.h" | |
| 40 #include "chrome/browser/chromeos/contacts/contact_manager.h" | |
| 41 #endif | |
| 42 | |
| 43 namespace { | 38 namespace { |
| 44 | 39 |
| 45 // 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 |
| 46 // specification. For more details, see | 41 // specification. For more details, see |
| 47 // http://goto.google.com/binary-clients-logging. | 42 // http://goto.google.com/binary-clients-logging. |
| 48 void AutocompleteMatchToAssistedQuery( | 43 void AutocompleteMatchToAssistedQuery( |
| 49 const AutocompleteMatch::Type& match, size_t* type, size_t* subtype) { | 44 const AutocompleteMatch::Type& match, size_t* type, size_t* subtype) { |
| 50 // This type indicates a native chrome suggestion. | 45 // This type indicates a native chrome suggestion. |
| 51 *type = 69; | 46 *type = 69; |
| 52 // Default value, indicating no subtype. | 47 // Default value, indicating no subtype. |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 in_zero_suggest_(false), | 161 in_zero_suggest_(false), |
| 167 profile_(profile) { | 162 profile_(profile) { |
| 168 // AND with the disabled providers, if any. | 163 // AND with the disabled providers, if any. |
| 169 provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes(); | 164 provider_types &= ~OmniboxFieldTrial::GetDisabledProviderTypes(); |
| 170 bool use_hqp = !!(provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK); | 165 bool use_hqp = !!(provider_types & AutocompleteProvider::TYPE_HISTORY_QUICK); |
| 171 // TODO(mrossetti): Permanently modify the HistoryURLProvider to not search | 166 // TODO(mrossetti): Permanently modify the HistoryURLProvider to not search |
| 172 // titles once HQP is turned on permanently. | 167 // titles once HQP is turned on permanently. |
| 173 | 168 |
| 174 if (provider_types & AutocompleteProvider::TYPE_BUILTIN) | 169 if (provider_types & AutocompleteProvider::TYPE_BUILTIN) |
| 175 providers_.push_back(new BuiltinProvider(this, profile)); | 170 providers_.push_back(new BuiltinProvider(this, profile)); |
| 176 #if defined(OS_CHROMEOS) | |
| 177 if (provider_types & AutocompleteProvider::TYPE_CONTACT) | |
| 178 providers_.push_back(new ContactProvider(this, profile, | |
| 179 contacts::ContactManager::GetInstance()->GetWeakPtr())); | |
| 180 #endif | |
| 181 if (provider_types & AutocompleteProvider::TYPE_EXTENSION_APP) | 171 if (provider_types & AutocompleteProvider::TYPE_EXTENSION_APP) |
| 182 providers_.push_back(new ExtensionAppProvider(this, profile)); | 172 providers_.push_back(new ExtensionAppProvider(this, profile)); |
| 183 if (use_hqp) | 173 if (use_hqp) |
| 184 providers_.push_back(new HistoryQuickProvider(this, profile)); | 174 providers_.push_back(new HistoryQuickProvider(this, profile)); |
| 185 if (provider_types & AutocompleteProvider::TYPE_HISTORY_URL) { | 175 if (provider_types & AutocompleteProvider::TYPE_HISTORY_URL) { |
| 186 history_url_provider_ = new HistoryURLProvider(this, profile); | 176 history_url_provider_ = new HistoryURLProvider(this, profile); |
| 187 providers_.push_back(history_url_provider_); | 177 providers_.push_back(history_url_provider_); |
| 188 } | 178 } |
| 189 // Search provider/"tab to search" can be used on all platforms other than | 179 // Search provider/"tab to search" can be used on all platforms other than |
| 190 // Android. | 180 // Android. |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 this, &AutocompleteController::ExpireCopiedEntries); | 645 this, &AutocompleteController::ExpireCopiedEntries); |
| 656 } | 646 } |
| 657 | 647 |
| 658 void AutocompleteController::StartStopTimer() { | 648 void AutocompleteController::StartStopTimer() { |
| 659 stop_timer_.Start(FROM_HERE, | 649 stop_timer_.Start(FROM_HERE, |
| 660 stop_timer_duration_, | 650 stop_timer_duration_, |
| 661 base::Bind(&AutocompleteController::Stop, | 651 base::Bind(&AutocompleteController::Stop, |
| 662 base::Unretained(this), | 652 base::Unretained(this), |
| 663 false)); | 653 false)); |
| 664 } | 654 } |
| OLD | NEW |