OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_audio_controller_chromeos.h" | 5 #include "extensions/shell/browser/shell_audio_controller_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chromeos/audio/audio_device.h" | 9 #include "chromeos/audio/audio_device.h" |
10 | 10 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 uint64 best_input = 0, best_output = 0; | 109 uint64 best_input = 0, best_output = 0; |
110 for (chromeos::AudioDeviceList::const_reverse_iterator it = devices.rbegin(); | 110 for (chromeos::AudioDeviceList::const_reverse_iterator it = devices.rbegin(); |
111 it != devices.rend() && (!best_input || !best_output); ++it) { | 111 it != devices.rend() && (!best_input || !best_output); ++it) { |
112 // TODO(derat): Need to check |plugged_time|? | 112 // TODO(derat): Need to check |plugged_time|? |
113 if (it->is_input && !best_input) | 113 if (it->is_input && !best_input) |
114 best_input = it->id; | 114 best_input = it->id; |
115 else if (!it->is_input && !best_output) | 115 else if (!it->is_input && !best_output) |
116 best_output = it->id; | 116 best_output = it->id; |
117 } | 117 } |
118 | 118 |
119 if (best_input && best_input != handler->GetActiveInputNode()) { | 119 if (best_input && best_input != handler->GetPrimaryActiveInputNode()) { |
120 const chromeos::AudioDevice* device = GetDevice(devices, best_input); | 120 const chromeos::AudioDevice* device = GetDevice(devices, best_input); |
121 DCHECK(device); | 121 DCHECK(device); |
122 VLOG(1) << "Activating input device: " << device->ToString(); | 122 VLOG(1) << "Activating input device: " << device->ToString(); |
123 handler->SwitchToDevice(*device); | 123 handler->SwitchToDevice(*device); |
124 } | 124 } |
125 if (best_output && best_output != handler->GetActiveOutputNode()) { | 125 if (best_output && best_output != handler->GetPrimaryActiveOutputNode()) { |
126 const chromeos::AudioDevice* device = GetDevice(devices, best_output); | 126 const chromeos::AudioDevice* device = GetDevice(devices, best_output); |
127 DCHECK(device); | 127 DCHECK(device); |
128 VLOG(1) << "Activating output device: " << device->ToString(); | 128 VLOG(1) << "Activating output device: " << device->ToString(); |
129 handler->SwitchToDevice(*device); | 129 handler->SwitchToDevice(*device); |
130 } | 130 } |
131 } | 131 } |
132 | 132 |
133 } // namespace extensions | 133 } // namespace extensions |
OLD | NEW |