| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chromeos/audio/cras_audio_switch_handler.h" | 5 #include "chromeos/audio/cras_audio_switch_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chromeos/audio/audio_pref_handler.h" | 10 #include "chromeos/audio/audio_pref_handler.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 g_cras_audio_handler = NULL; | 34 g_cras_audio_handler = NULL; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 CrasAudioSwitchHandler* CrasAudioSwitchHandler::Get() { | 38 CrasAudioSwitchHandler* CrasAudioSwitchHandler::Get() { |
| 39 CHECK(g_cras_audio_handler) | 39 CHECK(g_cras_audio_handler) |
| 40 << "CrasAudioSwitchHandler::Get() called before Initialize()."; | 40 << "CrasAudioSwitchHandler::Get() called before Initialize()."; |
| 41 return g_cras_audio_handler; | 41 return g_cras_audio_handler; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void CrasAudioSwitchHandler::UpdateActiveDevice() { | |
| 45 GetNodes(); | |
| 46 } | |
| 47 | |
| 48 CrasAudioSwitchHandler::CrasAudioSwitchHandler() | 44 CrasAudioSwitchHandler::CrasAudioSwitchHandler() |
| 49 : muted_device_id_(0), | 45 : muted_device_id_(0), |
| 50 weak_ptr_factory_(this) { | 46 weak_ptr_factory_(this) { |
| 51 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->AddObserver(this); | 47 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()->AddObserver(this); |
| 52 GetNodes(); | 48 GetNodes(); |
| 53 } | 49 } |
| 54 | 50 |
| 55 CrasAudioSwitchHandler::~CrasAudioSwitchHandler() { | 51 CrasAudioSwitchHandler::~CrasAudioSwitchHandler() { |
| 56 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()-> | 52 chromeos::DBusThreadManager::Get()->GetCrasAudioClient()-> |
| 57 RemoveObserver(this); | 53 RemoveObserver(this); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 const AudioNodeList& node_list, bool success) { | 152 const AudioNodeList& node_list, bool success) { |
| 157 if (!success) { | 153 if (!success) { |
| 158 LOG(ERROR) << "Failed to retrieve audio nodes data"; | 154 LOG(ERROR) << "Failed to retrieve audio nodes data"; |
| 159 return; | 155 return; |
| 160 } | 156 } |
| 161 | 157 |
| 162 UpdateDevicesAndSwitch(node_list); | 158 UpdateDevicesAndSwitch(node_list); |
| 163 } | 159 } |
| 164 | 160 |
| 165 } // namespace chromeos | 161 } // namespace chromeos |
| OLD | NEW |