Chromium Code Reviews| 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 AutocompleteProvider::TYPE_PHYSICAL_WEB | | |
|
Mark P
2017/01/05 19:52:31
Please comment, e.g., is this here because it's no
cco3
2017/01/05 20:24:05
Done.
| |
| 22 #else | |
| 21 // Custom search engines cannot be used on mobile.. | 23 // Custom search engines cannot be used on mobile.. |
|
Mark P
2017/01/05 19:52:31
nit: please remove the extra period while you're h
cco3
2017/01/05 20:24:05
Done.
| |
| 22 AutocompleteProvider::TYPE_KEYWORD | | 24 AutocompleteProvider::TYPE_KEYWORD | |
| 23 #endif | 25 #endif |
| 24 #if !defined(OS_IOS) | 26 #if !defined(OS_IOS) |
| 25 // "Builtin", "Shortcuts" and "Zero Suggest" are not supported on iOS. | 27 // "Builtin", "Shortcuts" and "Zero Suggest" are not supported on iOS. |
| 26 AutocompleteProvider::TYPE_BUILTIN | | 28 AutocompleteProvider::TYPE_BUILTIN | |
| 27 AutocompleteProvider::TYPE_SHORTCUTS | | 29 AutocompleteProvider::TYPE_SHORTCUTS | |
| 28 AutocompleteProvider::TYPE_ZERO_SUGGEST | | 30 AutocompleteProvider::TYPE_ZERO_SUGGEST | |
| 29 #else | 31 #else |
| 30 // "URL from clipboard" can only be used on iOS. | 32 // "URL from clipboard" can only be used on iOS. |
| 31 AutocompleteProvider::TYPE_CLIPBOARD_URL | | 33 AutocompleteProvider::TYPE_CLIPBOARD_URL | |
| 32 // Physical Web omnibox results are only implemented on iOS. | |
| 33 AutocompleteProvider::TYPE_PHYSICAL_WEB | | |
| 34 #endif | 34 #endif |
| 35 AutocompleteProvider::TYPE_BOOKMARK | | 35 AutocompleteProvider::TYPE_BOOKMARK | |
| 36 AutocompleteProvider::TYPE_HISTORY_QUICK | | 36 AutocompleteProvider::TYPE_HISTORY_QUICK | |
| 37 AutocompleteProvider::TYPE_HISTORY_URL | | 37 AutocompleteProvider::TYPE_HISTORY_URL | |
| 38 AutocompleteProvider::TYPE_SEARCH; | 38 AutocompleteProvider::TYPE_SEARCH; |
| 39 | 39 |
| 40 AutocompleteClassifier::AutocompleteClassifier( | 40 AutocompleteClassifier::AutocompleteClassifier( |
| 41 std::unique_ptr<AutocompleteController> controller, | 41 std::unique_ptr<AutocompleteController> controller, |
| 42 std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier) | 42 std::unique_ptr<AutocompleteSchemeClassifier> scheme_classifier) |
| 43 : controller_(std::move(controller)), | 43 : controller_(std::move(controller)), |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 72 if (alternate_nav_url) | 72 if (alternate_nav_url) |
| 73 *alternate_nav_url = GURL(); | 73 *alternate_nav_url = GURL(); |
| 74 return; | 74 return; |
| 75 } | 75 } |
| 76 | 76 |
| 77 DCHECK(result.default_match() != result.end()); | 77 DCHECK(result.default_match() != result.end()); |
| 78 *match = *result.default_match(); | 78 *match = *result.default_match(); |
| 79 if (alternate_nav_url) | 79 if (alternate_nav_url) |
| 80 *alternate_nav_url = result.alternate_nav_url(); | 80 *alternate_nav_url = result.alternate_nav_url(); |
| 81 } | 81 } |
| OLD | NEW |