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 "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "components/metrics/proto/omnibox_event.pb.h" | 11 #include "components/metrics/proto/omnibox_event.pb.h" |
12 #include "components/omnibox/browser/autocomplete_controller.h" | 12 #include "components/omnibox/browser/autocomplete_controller.h" |
13 #include "components/omnibox/browser/autocomplete_input.h" | 13 #include "components/omnibox/browser/autocomplete_input.h" |
14 #include "components/omnibox/browser/autocomplete_match.h" | 14 #include "components/omnibox/browser/autocomplete_match.h" |
15 #include "components/omnibox/browser/autocomplete_provider.h" | 15 #include "components/omnibox/browser/autocomplete_provider.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 // static | 18 // static |
19 const int AutocompleteClassifier::kDefaultOmniboxProviders = | 19 const int AutocompleteClassifier::kDefaultOmniboxProviders = |
20 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 20 #if defined(OS_ANDROID) || defined(OS_IOS) |
21 // Custom search engines cannot be used on mobile.. | 21 // The Physical Web currently is only implemented on mobile devices. |
| 22 AutocompleteProvider::TYPE_PHYSICAL_WEB | |
| 23 #else |
| 24 // Custom search engines cannot be used on mobile. |
22 AutocompleteProvider::TYPE_KEYWORD | | 25 AutocompleteProvider::TYPE_KEYWORD | |
23 #endif | 26 #endif |
24 #if !defined(OS_IOS) | 27 #if !defined(OS_IOS) |
25 // "Builtin", "Shortcuts" and "Zero Suggest" are not supported on iOS. | 28 // "Builtin", "Shortcuts" and "Zero Suggest" are not supported on iOS. |
26 AutocompleteProvider::TYPE_BUILTIN | | 29 AutocompleteProvider::TYPE_BUILTIN | |
27 AutocompleteProvider::TYPE_SHORTCUTS | | 30 AutocompleteProvider::TYPE_SHORTCUTS | |
28 AutocompleteProvider::TYPE_ZERO_SUGGEST | | 31 AutocompleteProvider::TYPE_ZERO_SUGGEST | |
29 #else | 32 #else |
30 // "URL from clipboard" can only be used on iOS. | 33 // "URL from clipboard" can only be used on iOS. |
31 AutocompleteProvider::TYPE_CLIPBOARD_URL | | 34 AutocompleteProvider::TYPE_CLIPBOARD_URL | |
32 // Physical Web omnibox results are only implemented on iOS. | |
33 AutocompleteProvider::TYPE_PHYSICAL_WEB | | |
34 #endif | 35 #endif |
35 AutocompleteProvider::TYPE_BOOKMARK | | 36 AutocompleteProvider::TYPE_BOOKMARK | |
36 AutocompleteProvider::TYPE_HISTORY_QUICK | | 37 AutocompleteProvider::TYPE_HISTORY_QUICK | |
37 AutocompleteProvider::TYPE_HISTORY_URL | | 38 AutocompleteProvider::TYPE_HISTORY_URL | |
38 AutocompleteProvider::TYPE_SEARCH; | 39 AutocompleteProvider::TYPE_SEARCH; |
39 | 40 |
40 AutocompleteClassifier::AutocompleteClassifier( | 41 AutocompleteClassifier::AutocompleteClassifier( |
41 std::unique_ptr<AutocompleteController> controller, | 42 std::unique_ptr<AutocompleteController> controller, |
42 std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier) | 43 std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier) |
43 : controller_(std::move(controller)), | 44 : controller_(std::move(controller)), |
(...skipping 28 matching lines...) Expand all Loading... |
72 if (alternate_nav_url) | 73 if (alternate_nav_url) |
73 *alternate_nav_url = GURL(); | 74 *alternate_nav_url = GURL(); |
74 return; | 75 return; |
75 } | 76 } |
76 | 77 |
77 DCHECK(result.default_match() != result.end()); | 78 DCHECK(result.default_match() != result.end()); |
78 *match = *result.default_match(); | 79 *match = *result.default_match(); |
79 if (alternate_nav_url) | 80 if (alternate_nav_url) |
80 *alternate_nav_url = result.alternate_nav_url(); | 81 *alternate_nav_url = result.alternate_nav_url(); |
81 } | 82 } |
OLD | NEW |