| 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 "media/audio/test_audio_input_controller_factory.h" | 5 #include "media/audio/test_audio_input_controller_factory.h" |
| 6 #include "media/audio/audio_io.h" | 6 #include "media/audio/audio_io.h" |
| 7 | 7 |
| 8 namespace media { | 8 namespace media { |
| 9 | 9 |
| 10 TestAudioInputController::TestAudioInputController( | 10 TestAudioInputController::TestAudioInputController( |
| 11 TestAudioInputControllerFactory* factory, | 11 TestAudioInputControllerFactory* factory, |
| 12 AudioManager* audio_manager, | 12 AudioManager* audio_manager, |
| 13 const AudioParameters& audio_parameters, | 13 const AudioParameters& audio_parameters, |
| 14 EventHandler* event_handler, | 14 EventHandler* event_handler, |
| 15 SyncWriter* sync_writer) | 15 SyncWriter* sync_writer, |
| 16 : AudioInputController(event_handler, sync_writer), | 16 KeyPressMonitor* key_press_monitor) |
| 17 : AudioInputController(event_handler, sync_writer, key_press_monitor), |
| 17 audio_parameters_(audio_parameters), | 18 audio_parameters_(audio_parameters), |
| 18 factory_(factory), | 19 factory_(factory), |
| 19 event_handler_(event_handler) { | 20 event_handler_(event_handler) { |
| 20 message_loop_ = audio_manager->GetMessageLoop(); | 21 message_loop_ = audio_manager->GetMessageLoop(); |
| 21 } | 22 } |
| 22 | 23 |
| 23 TestAudioInputController::~TestAudioInputController() { | 24 TestAudioInputController::~TestAudioInputController() { |
| 24 // Inform the factory so that it allows creating new instances in future. | 25 // Inform the factory so that it allows creating new instances in future. |
| 25 factory_->OnTestAudioInputControllerDestroyed(this); | 26 factory_->OnTestAudioInputControllerDestroyed(this); |
| 26 } | 27 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 41 delegate_(NULL) { | 42 delegate_(NULL) { |
| 42 } | 43 } |
| 43 | 44 |
| 44 TestAudioInputControllerFactory::~TestAudioInputControllerFactory() { | 45 TestAudioInputControllerFactory::~TestAudioInputControllerFactory() { |
| 45 DCHECK(!controller_); | 46 DCHECK(!controller_); |
| 46 } | 47 } |
| 47 | 48 |
| 48 AudioInputController* TestAudioInputControllerFactory::Create( | 49 AudioInputController* TestAudioInputControllerFactory::Create( |
| 49 AudioManager* audio_manager, | 50 AudioManager* audio_manager, |
| 50 AudioInputController::EventHandler* event_handler, | 51 AudioInputController::EventHandler* event_handler, |
| 51 AudioParameters params) { | 52 AudioParameters params, |
| 53 KeyPressMonitor* key_press_monitor) { |
| 52 DCHECK(!controller_); // Only one test instance managed at a time. | 54 DCHECK(!controller_); // Only one test instance managed at a time. |
| 53 controller_ = new TestAudioInputController(this, audio_manager, params, | 55 controller_ = new TestAudioInputController( |
| 54 event_handler, NULL); | 56 this, audio_manager, params, event_handler, NULL, key_press_monitor); |
| 55 return controller_; | 57 return controller_; |
| 56 } | 58 } |
| 57 | 59 |
| 58 void TestAudioInputControllerFactory::SetDelegateForTests( | 60 void TestAudioInputControllerFactory::SetDelegateForTests( |
| 59 TestAudioInputControllerDelegate* delegate) { | 61 TestAudioInputControllerDelegate* delegate) { |
| 60 delegate_ = delegate; | 62 delegate_ = delegate; |
| 61 } | 63 } |
| 62 | 64 |
| 63 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( | 65 void TestAudioInputControllerFactory::OnTestAudioInputControllerDestroyed( |
| 64 TestAudioInputController* controller) { | 66 TestAudioInputController* controller) { |
| 65 DCHECK_EQ(controller_, controller); | 67 DCHECK_EQ(controller_, controller); |
| 66 controller_ = NULL; | 68 controller_ = NULL; |
| 67 } | 69 } |
| 68 | 70 |
| 69 } // namespace media | 71 } // namespace media |
| OLD | NEW |