| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/android/vr_shell/vr_omnibox.h" | 5 #include "chrome/browser/android/vr_shell/vr_omnibox.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "chrome/browser/android/vr_shell/ui_interface.h" | 11 #include "chrome/browser/android/vr_shell/ui_interface.h" |
| 12 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" | 12 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" |
| 13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
| 14 #include "components/omnibox/browser/autocomplete_classifier.h" | 14 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 15 #include "components/omnibox/browser/autocomplete_controller.h" | 15 #include "components/omnibox/browser/autocomplete_controller.h" |
| 16 #include "components/omnibox/browser/autocomplete_input.h" | 16 #include "components/omnibox/browser/autocomplete_input.h" |
| 17 | 17 |
| 18 namespace vr_shell { | 18 namespace vr_shell { |
| 19 | 19 |
| 20 VrOmnibox::VrOmnibox(UiInterface* ui) | 20 VrOmnibox::VrOmnibox(UiInterface* ui) |
| 21 : ui_(ui), | 21 : ui_(ui), |
| 22 profile_(ProfileManager::GetLastUsedProfile()), | 22 profile_(ProfileManager::GetLastUsedProfile()), |
| 23 autocomplete_controller_(base::MakeUnique<AutocompleteController>( | 23 autocomplete_controller_(base::MakeUnique<AutocompleteController>( |
| 24 base::MakeUnique<ChromeAutocompleteProviderClient>(profile_), | 24 base::MakeUnique<ChromeAutocompleteProviderClient>(profile_), |
| 25 this, | 25 this, |
| 26 AutocompleteClassifier::kDefaultOmniboxProviders)) {} | 26 AutocompleteClassifier::DefaultOmniboxProviders())) {} |
| 27 | 27 |
| 28 VrOmnibox::~VrOmnibox() = default; | 28 VrOmnibox::~VrOmnibox() = default; |
| 29 | 29 |
| 30 void VrOmnibox::HandleInput(const base::DictionaryValue& dict) { | 30 void VrOmnibox::HandleInput(const base::DictionaryValue& dict) { |
| 31 base::string16 text; | 31 base::string16 text; |
| 32 CHECK(dict.GetString("text", &text)); | 32 CHECK(dict.GetString("text", &text)); |
| 33 | 33 |
| 34 // TODO(crbug.com/683344): Scrub and appropriately tune these parameters. | 34 // TODO(crbug.com/683344): Scrub and appropriately tune these parameters. |
| 35 GURL current_url; | 35 GURL current_url; |
| 36 size_t cursor_pos = base::string16::npos; | 36 size_t cursor_pos = base::string16::npos; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 58 auto entry = base::MakeUnique<base::DictionaryValue>(); | 58 auto entry = base::MakeUnique<base::DictionaryValue>(); |
| 59 entry->SetString("description", match.contents); | 59 entry->SetString("description", match.contents); |
| 60 entry->SetString("url", match.destination_url.spec()); | 60 entry->SetString("url", match.destination_url.spec()); |
| 61 suggestions->Append(std::move(entry)); | 61 suggestions->Append(std::move(entry)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 ui_->SetOmniboxSuggestions(std::move(suggestions)); | 64 ui_->SetOmniboxSuggestions(std::move(suggestions)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace vr_shell | 67 } // namespace vr_shell |
| OLD | NEW |