Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: chrome/browser/ui/ash/app_list/search_builder.cc

Issue 10871028: app_list: Refocus app when clicked from search result. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/ash/app_list/app_list_controller_ash.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(&params); 257 chrome::Navigate(&params);
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/app_list/app_list_controller_ash.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698