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/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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 653 |
654 // With the new hotword extension, stop the hotword session. With the launcher | 654 // With the new hotword extension, stop the hotword session. With the launcher |
655 // and NTP, this is unnecessary since the hotwording is implicitly stopped. | 655 // and NTP, this is unnecessary since the hotwording is implicitly stopped. |
656 // However, for always on, hotword triggering launches the launcher which | 656 // However, for always on, hotword triggering launches the launcher which |
657 // starts a session and hence starts the hotword detector. This results in the | 657 // starts a session and hence starts the hotword detector. This results in the |
658 // hotword detector and the speech-to-text engine running in parallel, which | 658 // hotword detector and the speech-to-text engine running in parallel, which |
659 // will conflict with each other (i.e. saying 'Ok Google' twice in a row | 659 // will conflict with each other (i.e. saying 'Ok Google' twice in a row |
660 // should cause a search to happen for 'Ok Google', not two hotword triggers). | 660 // should cause a search to happen for 'Ok Google', not two hotword triggers). |
661 // To get around this, always stop the session when switching to speech | 661 // To get around this, always stop the session when switching to speech |
662 // recognition. | 662 // recognition. |
663 if (HotwordService::IsExperimentalHotwordingEnabled() && | 663 if (service && service->HotwordEnabled()) { |
664 service && service->HotwordEnabled()) { | |
665 HotwordService* hotword_service = | 664 HotwordService* hotword_service = |
666 HotwordServiceFactory::GetForProfile(profile_); | 665 HotwordServiceFactory::GetForProfile(profile_); |
667 if (hotword_service) | 666 if (hotword_service) |
668 hotword_service->StopHotwordSession(this); | 667 hotword_service->StopHotwordSession(this); |
669 } | 668 } |
670 } | 669 } |
671 | 670 |
672 void AppListViewDelegate::ShowForProfileByPath( | 671 void AppListViewDelegate::ShowForProfileByPath( |
673 const base::FilePath& profile_path) { | 672 const base::FilePath& profile_path) { |
674 controller_->ShowForProfileByPath(profile_path); | 673 controller_->ShowForProfileByPath(profile_path); |
(...skipping 17 matching lines...) Expand all Loading... |
692 void AppListViewDelegate::OnSpeechRecognitionStateChanged( | 691 void AppListViewDelegate::OnSpeechRecognitionStateChanged( |
693 app_list::SpeechRecognitionState new_state) { | 692 app_list::SpeechRecognitionState new_state) { |
694 speech_ui_->SetSpeechRecognitionState(new_state); | 693 speech_ui_->SetSpeechRecognitionState(new_state); |
695 | 694 |
696 app_list::StartPageService* service = | 695 app_list::StartPageService* service = |
697 app_list::StartPageService::Get(profile_); | 696 app_list::StartPageService::Get(profile_); |
698 // With the new hotword extension, we need to re-request hotwording after | 697 // With the new hotword extension, we need to re-request hotwording after |
699 // speech recognition has stopped. Do not request hotwording after the app | 698 // speech recognition has stopped. Do not request hotwording after the app |
700 // list has already closed. | 699 // list has already closed. |
701 if (new_state == app_list::SPEECH_RECOGNITION_READY && | 700 if (new_state == app_list::SPEECH_RECOGNITION_READY && |
702 HotwordService::IsExperimentalHotwordingEnabled() && | |
703 service && service->HotwordEnabled() && | 701 service && service->HotwordEnabled() && |
704 controller_->GetAppListWindow()) { | 702 controller_->GetAppListWindow()) { |
705 HotwordService* hotword_service = | 703 HotwordService* hotword_service = |
706 HotwordServiceFactory::GetForProfile(profile_); | 704 HotwordServiceFactory::GetForProfile(profile_); |
707 if (hotword_service) { | 705 if (hotword_service) { |
708 hotword_service->RequestHotwordSession(this); | 706 hotword_service->RequestHotwordSession(this); |
709 } | 707 } |
710 } | 708 } |
711 } | 709 } |
712 | 710 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 | 843 |
846 // SigninManagerFactory is not a leaky singleton (unlike this class), and | 844 // SigninManagerFactory is not a leaky singleton (unlike this class), and |
847 // its destructor will check that it has no remaining observers. | 845 // its destructor will check that it has no remaining observers. |
848 scoped_observer_.RemoveAll(); | 846 scoped_observer_.RemoveAll(); |
849 SigninManagerFactory::GetInstance()->RemoveObserver(this); | 847 SigninManagerFactory::GetInstance()->RemoveObserver(this); |
850 break; | 848 break; |
851 default: | 849 default: |
852 NOTREACHED(); | 850 NOTREACHED(); |
853 } | 851 } |
854 } | 852 } |
OLD | NEW |