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

Unified Diff: chrome/browser/ui/app_list/start_page_service.cc

Issue 774553002: Revert of Updates the mic icon status based on the device's audio state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/app_list/start_page_service.h ('k') | ui/app_list/views/search_box_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/start_page_service.cc
diff --git a/chrome/browser/ui/app_list/start_page_service.cc b/chrome/browser/ui/app_list/start_page_service.cc
index a31c7667f19ebdcc0219bd20e44480739190a11b..2f14a4af0caef0dd623b4643905dd7a32973bad2 100644
--- a/chrome/browser/ui/app_list/start_page_service.cc
+++ b/chrome/browser/ui/app_list/start_page_service.cc
@@ -36,10 +36,6 @@
#include "extensions/common/extension.h"
#include "ui/app_list/app_list_switches.h"
-#if defined(OS_CHROMEOS)
-#include "chromeos/audio/cras_audio_handler.h"
-#endif
-
using base::RecordAction;
using base::UserMetricsAction;
@@ -52,7 +48,7 @@
state == SPEECH_RECOGNITION_IN_SPEECH;
}
-} // namespace
+}
class StartPageService::ProfileDestroyObserver
: public content::NotificationObserver {
@@ -105,48 +101,6 @@
private:
DISALLOW_COPY_AND_ASSIGN(StartPageWebContentsDelegate);
};
-
-#if defined(OS_CHROMEOS)
-
-class StartPageService::AudioStatus
- : public chromeos::CrasAudioHandler::AudioObserver {
- public:
- explicit AudioStatus(StartPageService* start_page_service)
- : start_page_service_(start_page_service) {
- chromeos::CrasAudioHandler::Get()->AddAudioObserver(this);
- CheckAndUpdate();
- }
-
- ~AudioStatus() override {
- chromeos::CrasAudioHandler::Get()->RemoveAudioObserver(this);
- }
-
- bool CanListen() {
- chromeos::CrasAudioHandler* audio_handler =
- chromeos::CrasAudioHandler::Get();
- return (audio_handler->GetPrimaryActiveInputNode() != 0) &&
- !audio_handler->IsInputMuted();
- }
-
- private:
- void CheckAndUpdate() {
- // TODO(mukai): If the system can listen, this should also restart the
- // hotword recognition.
- start_page_service_->OnSpeechRecognitionStateChanged(
- CanListen() ? SPEECH_RECOGNITION_READY : SPEECH_RECOGNITION_OFF);
- }
-
- // chromeos::CrasAudioHandler::AudioObserver:
- void OnInputMuteChanged() override { CheckAndUpdate(); }
-
- void OnActiveInputNodeChanged() override { CheckAndUpdate(); }
-
- StartPageService* start_page_service_;
-
- DISALLOW_COPY_AND_ASSIGN(AudioStatus);
-};
-
-#endif // OS_CHROMEOS
// static
StartPageService* StartPageService::Get(Profile* profile) {
@@ -165,9 +119,8 @@
// If experimental hotwording is enabled, then we're always "ready".
// Transitioning into the "hotword recognizing" state is handled by the
// hotword extension.
- if (HotwordService::IsExperimentalHotwordingEnabled()) {
+ if (HotwordService::IsExperimentalHotwordingEnabled())
state_ = app_list::SPEECH_RECOGNITION_READY;
- }
if (app_list::switches::IsExperimentalAppListEnabled())
LoadContents();
@@ -195,10 +148,6 @@
"appList.startPage.onAppListShown",
base::FundamentalValue(HotwordEnabled()));
}
-
-#if defined(OS_CHROMEOS)
- audio_status_.reset(new AudioStatus(this));
-#endif
}
void StartPageService::AppListHidden() {
@@ -213,10 +162,6 @@
speech_recognizer_) {
speech_recognizer_->Stop();
}
-
-#if defined(OS_CHROMEOS)
- audio_status_.reset();
-#endif
}
void StartPageService::ToggleSpeechRecognition() {
@@ -306,14 +251,6 @@
void StartPageService::OnSpeechRecognitionStateChanged(
SpeechRecognitionState new_state) {
-#if defined(OS_CHROMEOS)
- // Sometimes this can be called even though there are no audio input devices.
- if (!audio_status_->CanListen())
- new_state = SPEECH_RECOGNITION_OFF;
-#endif
-
- if (state_ == new_state)
- return;
if (HotwordService::IsExperimentalHotwordingEnabled() &&
new_state == SPEECH_RECOGNITION_READY &&
@@ -346,9 +283,6 @@
void StartPageService::Shutdown() {
UnloadContents();
-#if defined(OS_CHROMEOS)
- audio_status_.reset();
-#endif
}
void StartPageService::WebUILoaded() {
« no previous file with comments | « chrome/browser/ui/app_list/start_page_service.h ('k') | ui/app_list/views/search_box_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698