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 "chrome/browser/ui/ash/app_list/search_builder.h" | 5 #include "chrome/browser/ui/ash/app_list/search_builder.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 10 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 239 |
240 // Count AppList.Search here because it is composed of search + action. | 240 // Count AppList.Search here because it is composed of search + action. |
241 content::RecordAction(content::UserMetricsAction("AppList_Search")); | 241 content::RecordAction(content::UserMetricsAction("AppList_Search")); |
242 | 242 |
243 if (match.type == AutocompleteMatch::EXTENSION_APP) { | 243 if (match.type == AutocompleteMatch::EXTENSION_APP) { |
244 const extensions::Extension* extension = | 244 const extensions::Extension* extension = |
245 GetExtensionByURL(profile_, match.destination_url); | 245 GetExtensionByURL(profile_, match.destination_url); |
246 if (extension) { | 246 if (extension) { |
247 content::RecordAction( | 247 content::RecordAction( |
248 content::UserMetricsAction("AppList_ClickOnAppFromSearch")); | 248 content::UserMetricsAction("AppList_ClickOnAppFromSearch")); |
249 list_controller_->OpenApp(profile_, extension->id(), event_flags); | 249 list_controller_->ActivateApp(profile_, extension->id(), event_flags); |
250 } | 250 } |
251 } else { | 251 } else { |
252 // TODO(xiyuan): What should we do for alternate url case? | 252 // TODO(xiyuan): What should we do for alternate url case? |
253 chrome::NavigateParams params(profile_, | 253 chrome::NavigateParams params(profile_, |
254 match.destination_url, | 254 match.destination_url, |
255 match.transition); | 255 match.transition); |
256 params.disposition = chrome::DispositionFromEventFlags(event_flags); | 256 params.disposition = chrome::DispositionFromEventFlags(event_flags); |
257 chrome::Navigate(¶ms); | 257 chrome::Navigate(¶ms); |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 void SearchBuilder::PopulateFromACResult(const AutocompleteResult& ac_result) { | 261 void SearchBuilder::PopulateFromACResult(const AutocompleteResult& ac_result) { |
262 results_->DeleteAll(); | 262 results_->DeleteAll(); |
263 for (ACMatches::const_iterator it = ac_result.begin(); | 263 for (ACMatches::const_iterator it = ac_result.begin(); |
264 it != ac_result.end(); | 264 it != ac_result.end(); |
265 ++it) { | 265 ++it) { |
266 results_->Add(new SearchBuilderResult(profile_, *it)); | 266 results_->Add(new SearchBuilderResult(profile_, *it)); |
267 } | 267 } |
268 } | 268 } |
269 | 269 |
270 void SearchBuilder::OnResultChanged(bool default_match_changed) { | 270 void SearchBuilder::OnResultChanged(bool default_match_changed) { |
271 // TODO(xiyuan): Handle default match properly. | 271 // TODO(xiyuan): Handle default match properly. |
272 const AutocompleteResult& ac_result = controller_->result(); | 272 const AutocompleteResult& ac_result = controller_->result(); |
273 PopulateFromACResult(ac_result); | 273 PopulateFromACResult(ac_result); |
274 } | 274 } |
OLD | NEW |