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

Side by Side Diff: chrome/browser/ui/app_list/app_list_view_delegate.cc

Issue 796293002: App list voice searches now prioritize exact-match web results. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 6 years 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
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/app_list/app_list_view_delegate.h" 5 #include "chrome/browser/ui/app_list/app_list_view_delegate.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "apps/custom_launcher_page_contents.h" 9 #include "apps/custom_launcher_page_contents.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 urls->push_back(extension->GetResourceURL(info->page)); 151 urls->push_back(extension->GetResourceURL(info->page));
152 } 152 }
153 } 153 }
154 154
155 } // namespace 155 } // namespace
156 156
157 AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller) 157 AppListViewDelegate::AppListViewDelegate(AppListControllerDelegate* controller)
158 : controller_(controller), 158 : controller_(controller),
159 profile_(NULL), 159 profile_(NULL),
160 model_(NULL), 160 model_(NULL),
161 is_voice_query_(false),
161 scoped_observer_(this) { 162 scoped_observer_(this) {
162 // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed. 163 // TODO(vadimt): Remove ScopedTracker below once crbug.com/431326 is fixed.
163 tracked_objects::ScopedTracker tracking_profile( 164 tracked_objects::ScopedTracker tracking_profile(
164 FROM_HERE_WITH_EXPLICIT_FUNCTION( 165 FROM_HERE_WITH_EXPLICIT_FUNCTION(
165 "431326 AppListViewDelegate::AppListViewDelegate")); 166 "431326 AppListViewDelegate::AppListViewDelegate"));
166 167
167 CHECK(controller_); 168 CHECK(controller_);
168 // The SigninManagerFactor and the SigninManagers are observed to keep the 169 // The SigninManagerFactor and the SigninManagers are observed to keep the
169 // profile switcher menu up to date, with the correct list of profiles and the 170 // profile switcher menu up to date, with the correct list of profiles and the
170 // correct email address (or none for signed out users) for each. 171 // correct email address (or none for signed out users) for each.
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 extension, 459 extension,
459 profile_, 460 profile_,
460 base::Bind(CreateShortcutInWebAppDir, app_data_dir, callback)); 461 base::Bind(CreateShortcutInWebAppDir, app_data_dir, callback));
461 #else 462 #else
462 callback.Run(base::FilePath()); 463 callback.Run(base::FilePath());
463 #endif 464 #endif
464 } 465 }
465 466
466 void AppListViewDelegate::StartSearch() { 467 void AppListViewDelegate::StartSearch() {
467 if (search_controller_) { 468 if (search_controller_) {
468 search_controller_->Start(); 469 search_controller_->Start(is_voice_query_);
469 controller_->OnSearchStarted(); 470 controller_->OnSearchStarted();
470 } 471 }
471 } 472 }
472 473
473 void AppListViewDelegate::StopSearch() { 474 void AppListViewDelegate::StopSearch() {
474 if (search_controller_) 475 if (search_controller_)
475 search_controller_->Stop(); 476 search_controller_->Stop();
476 } 477 }
477 478
478 void AppListViewDelegate::OpenSearchResult( 479 void AppListViewDelegate::OpenSearchResult(
(...skipping 12 matching lines...) Expand all
491 search_controller_->InvokeResultAction(result, action_index, event_flags); 492 search_controller_->InvokeResultAction(result, action_index, event_flags);
492 } 493 }
493 494
494 base::TimeDelta AppListViewDelegate::GetAutoLaunchTimeout() { 495 base::TimeDelta AppListViewDelegate::GetAutoLaunchTimeout() {
495 return auto_launch_timeout_; 496 return auto_launch_timeout_;
496 } 497 }
497 498
498 void AppListViewDelegate::AutoLaunchCanceled() { 499 void AppListViewDelegate::AutoLaunchCanceled() {
499 base::RecordAction(base::UserMetricsAction("AppList_AutoLaunchCanceled")); 500 base::RecordAction(base::UserMetricsAction("AppList_AutoLaunchCanceled"));
500 auto_launch_timeout_ = base::TimeDelta(); 501 auto_launch_timeout_ = base::TimeDelta();
502 // Cancelling the auto launch means we are no longer in a voice query.
503 is_voice_query_ = false;
501 } 504 }
502 505
503 void AppListViewDelegate::ViewInitialized() { 506 void AppListViewDelegate::ViewInitialized() {
504 app_list::StartPageService* service = 507 app_list::StartPageService* service =
505 app_list::StartPageService::Get(profile_); 508 app_list::StartPageService::Get(profile_);
506 if (service) { 509 if (service) {
507 service->AppListShown(); 510 service->AppListShown();
508 if (service->HotwordEnabled()) { 511 if (service->HotwordEnabled()) {
509 HotwordService* hotword_service = 512 HotwordService* hotword_service =
510 HotwordServiceFactory::GetForProfile(profile_); 513 HotwordServiceFactory::GetForProfile(profile_);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 const base::FilePath& profile_path) { 618 const base::FilePath& profile_path) {
616 controller_->ShowForProfileByPath(profile_path); 619 controller_->ShowForProfileByPath(profile_path);
617 } 620 }
618 621
619 void AppListViewDelegate::OnSpeechResult(const base::string16& result, 622 void AppListViewDelegate::OnSpeechResult(const base::string16& result,
620 bool is_final) { 623 bool is_final) {
621 speech_ui_->SetSpeechResult(result, is_final); 624 speech_ui_->SetSpeechResult(result, is_final);
622 if (is_final) { 625 if (is_final) {
623 auto_launch_timeout_ = base::TimeDelta::FromMilliseconds( 626 auto_launch_timeout_ = base::TimeDelta::FromMilliseconds(
624 kAutoLaunchDefaultTimeoutMilliSec); 627 kAutoLaunchDefaultTimeoutMilliSec);
628 is_voice_query_ = true;
625 model_->search_box()->SetText(result); 629 model_->search_box()->SetText(result);
626 } 630 }
627 } 631 }
628 632
629 void AppListViewDelegate::OnSpeechSoundLevelChanged(int16 level) { 633 void AppListViewDelegate::OnSpeechSoundLevelChanged(int16 level) {
630 speech_ui_->UpdateSoundLevel(level); 634 speech_ui_->UpdateSoundLevel(level);
631 } 635 }
632 636
633 void AppListViewDelegate::OnSpeechRecognitionStateChanged( 637 void AppListViewDelegate::OnSpeechRecognitionStateChanged(
634 app_list::SpeechRecognitionState new_state) { 638 app_list::SpeechRecognitionState new_state) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 775
772 // SigninManagerFactory is not a leaky singleton (unlike this class), and 776 // SigninManagerFactory is not a leaky singleton (unlike this class), and
773 // its destructor will check that it has no remaining observers. 777 // its destructor will check that it has no remaining observers.
774 scoped_observer_.RemoveAll(); 778 scoped_observer_.RemoveAll();
775 SigninManagerFactory::GetInstance()->RemoveObserver(this); 779 SigninManagerFactory::GetInstance()->RemoveObserver(this);
776 break; 780 break;
777 default: 781 default:
778 NOTREACHED(); 782 NOTREACHED();
779 } 783 }
780 } 784 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/app_list_view_delegate.h ('k') | chrome/browser/ui/app_list/search/omnibox_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698