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

Side by Side Diff: chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc

Issue 10960010: Speech Input: always abort when user clicks outside speech bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | « no previous file | 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/speech/chrome_speech_recognition_manager_delegate.h" 5 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // event (corresponding to the old session that should be aborted) can be 267 // event (corresponding to the old session that should be aborted) can be
268 // received after a new session (corresponding to the 2nd click) is started. 268 // received after a new session (corresponding to the 2nd click) is started.
269 if (GetBubbleController()->GetActiveSessionID() != session_id) 269 if (GetBubbleController()->GetActiveSessionID() != session_id)
270 return; 270 return;
271 271
272 // Note, the session might have been destroyed, therefore avoid calls to the 272 // Note, the session might have been destroyed, therefore avoid calls to the
273 // manager which imply its existance (e.g., GetSessionContext()). 273 // manager which imply its existance (e.g., GetSessionContext()).
274 GetBubbleController()->CloseBubble(); 274 GetBubbleController()->CloseBubble();
275 last_session_config_.reset(); 275 last_session_config_.reset();
276 276
277 // If the user clicks outside the bubble while capturing audio we abort the 277 // Clicking outside the bubble means we should abort.
278 // session. Otherwise, i.e. audio capture is ended and we are just waiting for 278 SpeechRecognitionManager::GetInstance()->AbortSession(session_id);
279 // results, this activity is carried silently in background.
280 if (SpeechRecognitionManager::GetInstance()->IsCapturingAudio())
281 SpeechRecognitionManager::GetInstance()->AbortSession(session_id);
282 } 279 }
283 280
284 void ChromeSpeechRecognitionManagerDelegate::RestartLastSession() { 281 void ChromeSpeechRecognitionManagerDelegate::RestartLastSession() {
285 DCHECK(last_session_config_.get()); 282 DCHECK(last_session_config_.get());
286 SpeechRecognitionManager* manager = SpeechRecognitionManager::GetInstance(); 283 SpeechRecognitionManager* manager = SpeechRecognitionManager::GetInstance();
287 const int new_session_id = manager->CreateSession(*last_session_config_); 284 const int new_session_id = manager->CreateSession(*last_session_config_);
288 DCHECK_NE(SpeechRecognitionManager::kSessionIDInvalid, new_session_id); 285 DCHECK_NE(SpeechRecognitionManager::kSessionIDInvalid, new_session_id);
289 last_session_config_.reset(); 286 last_session_config_.reset();
290 manager->StartSession(new_session_id); 287 manager->StartSession(new_session_id);
291 } 288 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 577
581 SpeechRecognitionTrayIconController* 578 SpeechRecognitionTrayIconController*
582 ChromeSpeechRecognitionManagerDelegate::GetTrayIconController() { 579 ChromeSpeechRecognitionManagerDelegate::GetTrayIconController() {
583 if (!tray_icon_controller_.get()) 580 if (!tray_icon_controller_.get())
584 tray_icon_controller_ = new SpeechRecognitionTrayIconController(); 581 tray_icon_controller_ = new SpeechRecognitionTrayIconController();
585 return tray_icon_controller_.get(); 582 return tray_icon_controller_.get();
586 } 583 }
587 584
588 585
589 } // namespace speech 586 } // namespace speech
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698