| 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" |
| 11 #include "chrome/browser/search_engines/template_url_service_factory.h" | 11 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 12 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 12 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 13 #include "chrome/browser/ui/app_list/search/omnibox_result.h" | 13 #include "chrome/browser/ui/app_list/search/omnibox_result.h" |
| 14 #include "components/metrics/proto/omnibox_event.pb.h" | 14 #include "components/metrics/proto/omnibox_event.pb.h" |
| 15 #include "components/omnibox/browser/autocomplete_classifier.h" | 15 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 16 #include "components/omnibox/browser/autocomplete_controller.h" | 16 #include "components/omnibox/browser/autocomplete_controller.h" |
| 17 #include "components/omnibox/browser/autocomplete_input.h" | 17 #include "components/omnibox/browser/autocomplete_input.h" |
| 18 #include "ui/app_list/search_result.h" | 18 #include "ui/app_list/search_result.h" |
| 19 #include "url/gurl.h" | 19 #include "url/gurl.h" |
| 20 | 20 |
| 21 namespace app_list { | 21 namespace app_list { |
| 22 | 22 |
| 23 OmniboxProvider::OmniboxProvider(Profile* profile, | 23 OmniboxProvider::OmniboxProvider(Profile* profile, |
| 24 AppListControllerDelegate* list_controller) | 24 AppListControllerDelegate* list_controller) |
| 25 : profile_(profile), | 25 : profile_(profile), |
| 26 list_controller_(list_controller), | 26 list_controller_(list_controller), |
| 27 controller_(new AutocompleteController( | 27 controller_(new AutocompleteController( |
| 28 base::WrapUnique(new ChromeAutocompleteProviderClient(profile)), | 28 base::WrapUnique(new ChromeAutocompleteProviderClient(profile)), |
| 29 this, | 29 this, |
| 30 AutocompleteClassifier::kDefaultOmniboxProviders & | 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(), |
| 40 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, | 40 metrics::OmniboxEventProto::INVALID_SPEC, false, false, true, true, false, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 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 |