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

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

Issue 217423002: Removes Experimental hotword-always-on feature. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/start_page_service.h" 5 #include "chrome/browser/ui/app_list/start_page_service.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 "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
11 #include "base/metrics/user_metrics.h" 11 #include "base/metrics/user_metrics.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/media/media_stream_infobar_delegate.h" 13 #include "chrome/browser/media/media_stream_infobar_delegate.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/ui/app_list/app_list_service.h"
16 #include "chrome/browser/ui/app_list/recommended_apps.h" 15 #include "chrome/browser/ui/app_list/recommended_apps.h"
17 #include "chrome/browser/ui/app_list/start_page_observer.h" 16 #include "chrome/browser/ui/app_list/start_page_observer.h"
18 #include "chrome/browser/ui/app_list/start_page_service_factory.h" 17 #include "chrome/browser/ui/app_list/start_page_service_factory.h"
19 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/url_constants.h" 19 #include "chrome/common/url_constants.h"
21 #include "content/public/browser/notification_details.h" 20 #include "content/public/browser/notification_details.h"
22 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
23 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
24 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_source.h" 24 #include "content/public/browser/notification_source.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 164 }
166 165
167 void StartPageService::OnSpeechSoundLevelChanged(int16 level) { 166 void StartPageService::OnSpeechSoundLevelChanged(int16 level) {
168 FOR_EACH_OBSERVER(StartPageObserver, 167 FOR_EACH_OBSERVER(StartPageObserver,
169 observers_, 168 observers_,
170 OnSpeechSoundLevelChanged(level)); 169 OnSpeechSoundLevelChanged(level));
171 } 170 }
172 171
173 void StartPageService::OnSpeechRecognitionStateChanged( 172 void StartPageService::OnSpeechRecognitionStateChanged(
174 SpeechRecognitionState new_state) { 173 SpeechRecognitionState new_state) {
175 SpeechRecognitionState old_state = state_; 174 if (!InSpeechRecognition(state_) && InSpeechRecognition(new_state)) {
176 state_ = new_state;
177
178 if (!InSpeechRecognition(old_state) && InSpeechRecognition(new_state)) {
179 if (!speech_button_toggled_manually_ && 175 if (!speech_button_toggled_manually_ &&
180 old_state == SPEECH_RECOGNITION_HOTWORD_LISTENING) { 176 state_ == SPEECH_RECOGNITION_HOTWORD_LISTENING) {
181 RecordAction(UserMetricsAction("AppList_HotwordRecognized")); 177 RecordAction(UserMetricsAction("AppList_HotwordRecognized"));
182 AppListService* app_list_service =
183 AppListService::Get(chrome::GetActiveDesktop());
184 if (!app_list_service->IsAppListVisible())
185 app_list_service->Show();
186 } else { 178 } else {
187 RecordAction(UserMetricsAction("AppList_VoiceSearchStartedManually")); 179 RecordAction(UserMetricsAction("AppList_VoiceSearchStartedManually"));
188 } 180 }
189 } else if (InSpeechRecognition(old_state) && 181 } else if (InSpeechRecognition(state_) && !InSpeechRecognition(new_state) &&
190 !InSpeechRecognition(new_state) &&
191 !speech_result_obtained_) { 182 !speech_result_obtained_) {
192 RecordAction(UserMetricsAction("AppList_VoiceSearchCanceled")); 183 RecordAction(UserMetricsAction("AppList_VoiceSearchCanceled"));
193 } 184 }
194 speech_button_toggled_manually_ = false; 185 speech_button_toggled_manually_ = false;
195 speech_result_obtained_ = false; 186 speech_result_obtained_ = false;
196 187 state_ = new_state;
197 FOR_EACH_OBSERVER(StartPageObserver, 188 FOR_EACH_OBSERVER(StartPageObserver,
198 observers_, 189 observers_,
199 OnSpeechRecognitionStateChanged(new_state)); 190 OnSpeechRecognitionStateChanged(new_state));
200 } 191 }
201 192
202 void StartPageService::Shutdown() { 193 void StartPageService::Shutdown() {
203 contents_.reset(); 194 contents_.reset();
204 } 195 }
205 196
206 } // namespace app_list 197 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698