| 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 "components/omnibox/browser/autocomplete_classifier.h" | 5 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 int AutocompleteClassifier::DefaultOmniboxProviders() { | 37 int AutocompleteClassifier::DefaultOmniboxProviders() { |
| 38 return | 38 return |
| 39 #if defined(OS_ANDROID) || defined(OS_IOS) | 39 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 40 // The Physical Web currently is only implemented on mobile devices. | 40 // The Physical Web currently is only implemented on mobile devices. |
| 41 AutocompleteProvider::TYPE_PHYSICAL_WEB | | 41 AutocompleteProvider::TYPE_PHYSICAL_WEB | |
| 42 #else | 42 #else |
| 43 // Custom search engines cannot be used on mobile. | 43 // Custom search engines cannot be used on mobile. |
| 44 AutocompleteProvider::TYPE_KEYWORD | | 44 AutocompleteProvider::TYPE_KEYWORD | |
| 45 #endif | 45 #endif |
| 46 #if !defined(OS_IOS) | 46 #if !defined(OS_IOS) |
| 47 // "Builtin", "Shortcuts" and "Zero Suggest" are not supported on iOS. | 47 // "Shortcuts" and "Zero Suggest" are not supported on iOS. |
| 48 AutocompleteProvider::TYPE_BUILTIN | | |
| 49 AutocompleteProvider::TYPE_SHORTCUTS | | 48 AutocompleteProvider::TYPE_SHORTCUTS | |
| 50 AutocompleteProvider::TYPE_ZERO_SUGGEST | | 49 AutocompleteProvider::TYPE_ZERO_SUGGEST | |
| 51 #endif | 50 #endif |
| 52 (base::FeatureList::IsEnabled(omnibox::kEnableClipboardProvider) | 51 (base::FeatureList::IsEnabled(omnibox::kEnableClipboardProvider) |
| 53 ? AutocompleteProvider::TYPE_CLIPBOARD_URL | 52 ? AutocompleteProvider::TYPE_CLIPBOARD_URL |
| 54 : 0) | | 53 : 0) | |
| 55 AutocompleteProvider::TYPE_BOOKMARK | | 54 AutocompleteProvider::TYPE_BOOKMARK | |
| 55 AutocompleteProvider::TYPE_BUILTIN | |
| 56 AutocompleteProvider::TYPE_HISTORY_QUICK | | 56 AutocompleteProvider::TYPE_HISTORY_QUICK | |
| 57 AutocompleteProvider::TYPE_HISTORY_URL | | 57 AutocompleteProvider::TYPE_HISTORY_URL | |
| 58 AutocompleteProvider::TYPE_SEARCH; | 58 AutocompleteProvider::TYPE_SEARCH; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void AutocompleteClassifier::Classify( | 61 void AutocompleteClassifier::Classify( |
| 62 const base::string16& text, | 62 const base::string16& text, |
| 63 bool prefer_keyword, | 63 bool prefer_keyword, |
| 64 bool allow_exact_keyword_match, | 64 bool allow_exact_keyword_match, |
| 65 metrics::OmniboxEventProto::PageClassification page_classification, | 65 metrics::OmniboxEventProto::PageClassification page_classification, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 77 if (alternate_nav_url) | 77 if (alternate_nav_url) |
| 78 *alternate_nav_url = GURL(); | 78 *alternate_nav_url = GURL(); |
| 79 return; | 79 return; |
| 80 } | 80 } |
| 81 | 81 |
| 82 DCHECK(result.default_match() != result.end()); | 82 DCHECK(result.default_match() != result.end()); |
| 83 *match = *result.default_match(); | 83 *match = *result.default_match(); |
| 84 if (alternate_nav_url) | 84 if (alternate_nav_url) |
| 85 *alternate_nav_url = result.alternate_nav_url(); | 85 *alternate_nav_url = result.alternate_nav_url(); |
| 86 } | 86 } |
| OLD | NEW |