| Index: components/omnibox/browser/autocomplete_classifier.cc
|
| diff --git a/components/omnibox/browser/autocomplete_classifier.cc b/components/omnibox/browser/autocomplete_classifier.cc
|
| index c6e81cfe9ae2c0dde0b5d51f6d785a8c43973ed0..685a8c5806cceb5e37bc1371ebebbe9e388bde62 100644
|
| --- a/components/omnibox/browser/autocomplete_classifier.cc
|
| +++ b/components/omnibox/browser/autocomplete_classifier.cc
|
| @@ -7,37 +7,16 @@
|
| #include <utility>
|
|
|
| #include "base/auto_reset.h"
|
| +#include "base/feature_list.h"
|
| #include "build/build_config.h"
|
| #include "components/metrics/proto/omnibox_event.pb.h"
|
| #include "components/omnibox/browser/autocomplete_controller.h"
|
| #include "components/omnibox/browser/autocomplete_input.h"
|
| #include "components/omnibox/browser/autocomplete_match.h"
|
| #include "components/omnibox/browser/autocomplete_provider.h"
|
| +#include "components/omnibox/browser/omnibox_field_trial.h"
|
| #include "url/gurl.h"
|
|
|
| -// static
|
| -const int AutocompleteClassifier::kDefaultOmniboxProviders =
|
| -#if defined(OS_ANDROID) || defined(OS_IOS)
|
| - // The Physical Web currently is only implemented on mobile devices.
|
| - AutocompleteProvider::TYPE_PHYSICAL_WEB |
|
| -#else
|
| - // Custom search engines cannot be used on mobile.
|
| - AutocompleteProvider::TYPE_KEYWORD |
|
| -#endif
|
| -#if !defined(OS_IOS)
|
| - // "Builtin", "Shortcuts" and "Zero Suggest" are not supported on iOS.
|
| - AutocompleteProvider::TYPE_BUILTIN |
|
| - AutocompleteProvider::TYPE_SHORTCUTS |
|
| - AutocompleteProvider::TYPE_ZERO_SUGGEST |
|
| -#else
|
| - // "URL from clipboard" can only be used on iOS.
|
| - AutocompleteProvider::TYPE_CLIPBOARD_URL |
|
| -#endif
|
| - AutocompleteProvider::TYPE_BOOKMARK |
|
| - AutocompleteProvider::TYPE_HISTORY_QUICK |
|
| - AutocompleteProvider::TYPE_HISTORY_URL |
|
| - AutocompleteProvider::TYPE_SEARCH;
|
| -
|
| AutocompleteClassifier::AutocompleteClassifier(
|
| std::unique_ptr<AutocompleteController> controller,
|
| std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier)
|
| @@ -54,6 +33,31 @@ void AutocompleteClassifier::Shutdown() {
|
| controller_.reset();
|
| }
|
|
|
| +// static
|
| +int AutocompleteClassifier::DefaultOmniboxProviders() {
|
| + return
|
| +#if defined(OS_ANDROID) || defined(OS_IOS)
|
| + // The Physical Web currently is only implemented on mobile devices.
|
| + AutocompleteProvider::TYPE_PHYSICAL_WEB |
|
| +#else
|
| + // Custom search engines cannot be used on mobile.
|
| + AutocompleteProvider::TYPE_KEYWORD |
|
| +#endif
|
| +#if !defined(OS_IOS)
|
| + // "Builtin", "Shortcuts" and "Zero Suggest" are not supported on iOS.
|
| + AutocompleteProvider::TYPE_BUILTIN |
|
| + AutocompleteProvider::TYPE_SHORTCUTS |
|
| + AutocompleteProvider::TYPE_ZERO_SUGGEST |
|
| +#endif
|
| + (base::FeatureList::IsEnabled(omnibox::kEnableClipboardProvider)
|
| + ? AutocompleteProvider::TYPE_CLIPBOARD_URL
|
| + : 0) |
|
| + AutocompleteProvider::TYPE_BOOKMARK |
|
| + AutocompleteProvider::TYPE_HISTORY_QUICK |
|
| + AutocompleteProvider::TYPE_HISTORY_URL |
|
| + AutocompleteProvider::TYPE_SEARCH;
|
| +}
|
| +
|
| void AutocompleteClassifier::Classify(
|
| const base::string16& text,
|
| bool prefer_keyword,
|
|
|