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 "content/browser/speech/speech_recognition_manager_impl.h" | 5 #include "content/browser/speech/speech_recognition_manager_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "content/browser/browser_main_loop.h" | 9 #include "content/browser/browser_main_loop.h" |
10 #include "content/browser/speech/google_one_shot_remote_engine.h" | 10 #include "content/browser/speech/google_one_shot_remote_engine.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 SpeechRecognitionManagerImpl::SpeechRecognitionManagerImpl() | 49 SpeechRecognitionManagerImpl::SpeechRecognitionManagerImpl() |
50 : session_id_capturing_audio_(kSessionIDInvalid), | 50 : session_id_capturing_audio_(kSessionIDInvalid), |
51 last_session_id_(kSessionIDInvalid), | 51 last_session_id_(kSessionIDInvalid), |
52 is_dispatching_event_(false), | 52 is_dispatching_event_(false), |
53 delegate_(NULL) { | 53 delegate_(NULL) { |
54 } | 54 } |
55 | 55 |
56 SpeechRecognitionManagerImpl::~SpeechRecognitionManagerImpl() { | 56 SpeechRecognitionManagerImpl::~SpeechRecognitionManagerImpl() { |
57 // Recognition sessions will be aborted by the corresponding destructors. | 57 // Don't put anything here as it will be never called (due to LeakySingleton). |
58 sessions_.clear(); | |
59 } | 58 } |
60 | 59 |
61 void SpeechRecognitionManagerImpl::SetDelegate( | 60 void SpeechRecognitionManagerImpl::SetDelegate( |
62 content::SpeechRecognitionManagerDelegate* delegate) { | 61 content::SpeechRecognitionManagerDelegate* delegate) { |
63 // If we are injecting a non-NULL delegate, we must not already have a valid | 62 // If we are injecting a non-NULL delegate, we must not already have a valid |
64 // (non NULL) delegate_. | 63 // (non NULL) delegate_. |
65 DCHECK(!delegate || !delegate_); | 64 DCHECK(!delegate || !delegate_); |
66 delegate_ = delegate; | 65 delegate_ = delegate; |
67 } | 66 } |
68 | 67 |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 517 |
519 SpeechRecognitionManagerImpl::Session::Session() | 518 SpeechRecognitionManagerImpl::Session::Session() |
520 : id(kSessionIDInvalid), | 519 : id(kSessionIDInvalid), |
521 listener_is_active(true) { | 520 listener_is_active(true) { |
522 } | 521 } |
523 | 522 |
524 SpeechRecognitionManagerImpl::Session::~Session() { | 523 SpeechRecognitionManagerImpl::Session::~Session() { |
525 } | 524 } |
526 | 525 |
527 } // namespace speech | 526 } // namespace speech |
OLD | NEW |