| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/app_list/search/omnibox_provider.h" | 5 #include "chrome/browser/ui/app_list/search/omnibox_provider.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" | 8 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" |
| 9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 9 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 this, | 29 this, |
| 30 AutocompleteClassifier::DefaultOmniboxProviders() & | 30 AutocompleteClassifier::DefaultOmniboxProviders() & |
| 31 ~AutocompleteProvider::TYPE_ZERO_SUGGEST)), | 31 ~AutocompleteProvider::TYPE_ZERO_SUGGEST)), |
| 32 is_voice_query_(false) {} | 32 is_voice_query_(false) {} |
| 33 | 33 |
| 34 OmniboxProvider::~OmniboxProvider() {} | 34 OmniboxProvider::~OmniboxProvider() {} |
| 35 | 35 |
| 36 void OmniboxProvider::Start(bool is_voice_query, const base::string16& query) { | 36 void OmniboxProvider::Start(bool is_voice_query, const base::string16& query) { |
| 37 is_voice_query_ = is_voice_query; | 37 is_voice_query_ = is_voice_query; |
| 38 controller_->Start(AutocompleteInput( | 38 controller_->Start(AutocompleteInput( |
| 39 query, base::string16::npos, std::string(), GURL(), | 39 query, base::string16::npos, std::string(), GURL(), base::string16(), |
| 40 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, | 40 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, |
| 41 ChromeAutocompleteSchemeClassifier(profile_))); | 41 ChromeAutocompleteSchemeClassifier(profile_))); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void OmniboxProvider::Stop() { | 44 void OmniboxProvider::Stop() { |
| 45 controller_->Stop(false); | 45 controller_->Stop(false); |
| 46 is_voice_query_ = false; | 46 is_voice_query_ = false; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void OmniboxProvider::PopulateFromACResult(const AutocompleteResult& result) { | 49 void OmniboxProvider::PopulateFromACResult(const AutocompleteResult& result) { |
| 50 SearchProvider::Results new_results; | 50 SearchProvider::Results new_results; |
| 51 new_results.reserve(result.size()); | 51 new_results.reserve(result.size()); |
| 52 for (const AutocompleteMatch& match : result) { | 52 for (const AutocompleteMatch& match : result) { |
| 53 if (!match.destination_url.is_valid()) | 53 if (!match.destination_url.is_valid()) |
| 54 continue; | 54 continue; |
| 55 | 55 |
| 56 new_results.emplace_back(base::MakeUnique<OmniboxResult>( | 56 new_results.emplace_back(base::MakeUnique<OmniboxResult>( |
| 57 profile_, list_controller_, controller_.get(), is_voice_query_, match)); | 57 profile_, list_controller_, controller_.get(), is_voice_query_, match)); |
| 58 } | 58 } |
| 59 SwapResults(&new_results); | 59 SwapResults(&new_results); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void OmniboxProvider::OnResultChanged(bool default_match_changed) { | 62 void OmniboxProvider::OnResultChanged(bool default_match_changed) { |
| 63 PopulateFromACResult(controller_->result()); | 63 PopulateFromACResult(controller_->result()); |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace app_list | 66 } // namespace app_list |
| OLD | NEW |