| 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 "chrome/browser/autocomplete/autocomplete_classifier.h" | 7 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
| 8 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 8 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| 9 #include "chrome/browser/autocomplete/autocomplete_input.h" | 9 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 controller_->search_provider()->set_in_app_list(); | 140 controller_->search_provider()->set_in_app_list(); |
| 141 } | 141 } |
| 142 | 142 |
| 143 OmniboxProvider::~OmniboxProvider() {} | 143 OmniboxProvider::~OmniboxProvider() {} |
| 144 | 144 |
| 145 void OmniboxProvider::Start(const base::string16& query) { | 145 void OmniboxProvider::Start(const base::string16& query) { |
| 146 controller_->Start(AutocompleteInput(query, | 146 controller_->Start(AutocompleteInput(query, |
| 147 base::string16::npos, | 147 base::string16::npos, |
| 148 base::string16(), | 148 base::string16(), |
| 149 GURL(), | 149 GURL(), |
| 150 AutocompleteInput::INVALID_SPEC, | 150 metrics::OmniboxEventProto::INVALID_SPEC, |
| 151 false, | 151 false, |
| 152 false, | 152 false, |
| 153 true, | 153 true, |
| 154 true)); | 154 true)); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void OmniboxProvider::Stop() { | 157 void OmniboxProvider::Stop() { |
| 158 controller_->Stop(false); | 158 controller_->Stop(false); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void OmniboxProvider::PopulateFromACResult(const AutocompleteResult& result) { | 161 void OmniboxProvider::PopulateFromACResult(const AutocompleteResult& result) { |
| 162 ClearResults(); | 162 ClearResults(); |
| 163 for (ACMatches::const_iterator it = result.begin(); | 163 for (ACMatches::const_iterator it = result.begin(); |
| 164 it != result.end(); | 164 it != result.end(); |
| 165 ++it) { | 165 ++it) { |
| 166 if (!it->destination_url.is_valid()) | 166 if (!it->destination_url.is_valid()) |
| 167 continue; | 167 continue; |
| 168 | 168 |
| 169 Add(scoped_ptr<SearchResult>(new OmniboxResult(profile_, *it))); | 169 Add(scoped_ptr<SearchResult>(new OmniboxResult(profile_, *it))); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 void OmniboxProvider::OnResultChanged(bool default_match_changed) { | 173 void OmniboxProvider::OnResultChanged(bool default_match_changed) { |
| 174 const AutocompleteResult& result = controller_->result(); | 174 const AutocompleteResult& result = controller_->result(); |
| 175 PopulateFromACResult(result); | 175 PopulateFromACResult(result); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace app_list | 178 } // namespace app_list |
| OLD | NEW |