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

Side by Side Diff: components/arc/audio/arc_audio_bridge.cc

Issue 2489723005: chromeos: Make system tray audio item observe CrasAudioHandler directly (Closed)
Patch Set: rebase Created 4 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.cc ('k') | 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/arc/audio/arc_audio_bridge.h" 5 #include "components/arc/audio/arc_audio_bridge.h"
6 6
7 #include "ash/common/system/tray/system_tray_notifier.h" 7 #include "ash/common/system/chromeos/audio/tray_audio.h"
8 #include "ash/common/wm_shell.h"
9 #include "base/logging.h" 8 #include "base/logging.h"
10 #include "chromeos/audio/audio_device.h" 9 #include "chromeos/audio/audio_device.h"
11 #include "components/arc/arc_bridge_service.h" 10 #include "components/arc/arc_bridge_service.h"
12 11
13 namespace arc { 12 namespace arc {
14 13
15 namespace { 14 namespace {
16 15
17 // Note: unlike most of our mojom definitions, AudioInstance::Init's minimum 16 // Note: unlike most of our mojom definitions, AudioInstance::Init's minimum
18 // version is not zero. 17 // version is not zero.
(...skipping 20 matching lines...) Expand all
39 void ArcAudioBridge::OnInstanceReady() { 38 void ArcAudioBridge::OnInstanceReady() {
40 mojom::AudioInstance* audio_instance = 39 mojom::AudioInstance* audio_instance =
41 arc_bridge_service()->audio()->GetInstanceForMethod( 40 arc_bridge_service()->audio()->GetInstanceForMethod(
42 "Init", kMinInstanceVersionForInit); 41 "Init", kMinInstanceVersionForInit);
43 DCHECK(audio_instance); // the instance on ARC side is too old. 42 DCHECK(audio_instance); // the instance on ARC side is too old.
44 audio_instance->Init(binding_.CreateInterfacePtrAndBind()); 43 audio_instance->Init(binding_.CreateInterfacePtrAndBind());
45 } 44 }
46 45
47 void ArcAudioBridge::ShowVolumeControls() { 46 void ArcAudioBridge::ShowVolumeControls() {
48 VLOG(2) << "ArcAudioBridge::ShowVolumeControls"; 47 VLOG(2) << "ArcAudioBridge::ShowVolumeControls";
49 ash::WmShell::Get()->system_tray_notifier()->NotifyAudioOutputVolumeChanged( 48 ash::TrayAudio::ShowPopUpVolumeView();
50 0, 0);
51 } 49 }
52 50
53 void ArcAudioBridge::OnAudioNodesChanged() { 51 void ArcAudioBridge::OnAudioNodesChanged() {
54 uint64_t output_id = cras_audio_handler_->GetPrimaryActiveOutputNode(); 52 uint64_t output_id = cras_audio_handler_->GetPrimaryActiveOutputNode();
55 const chromeos::AudioDevice* output_device = 53 const chromeos::AudioDevice* output_device =
56 cras_audio_handler_->GetDeviceFromId(output_id); 54 cras_audio_handler_->GetDeviceFromId(output_id);
57 bool headphone_inserted = 55 bool headphone_inserted =
58 (output_device && 56 (output_device &&
59 output_device->type == chromeos::AudioDeviceType::AUDIO_TYPE_HEADPHONE); 57 output_device->type == chromeos::AudioDeviceType::AUDIO_TYPE_HEADPHONE);
60 58
(...skipping 22 matching lines...) Expand all
83 } 81 }
84 82
85 VLOG(1) << "Send switch state " << switch_state; 83 VLOG(1) << "Send switch state " << switch_state;
86 mojom::AudioInstance* audio_instance = 84 mojom::AudioInstance* audio_instance =
87 arc_bridge_service()->audio()->GetInstanceForMethod("NotifySwitchState"); 85 arc_bridge_service()->audio()->GetInstanceForMethod("NotifySwitchState");
88 if (audio_instance) 86 if (audio_instance)
89 audio_instance->NotifySwitchState(switch_state); 87 audio_instance->NotifySwitchState(switch_state);
90 } 88 }
91 89
92 } // namespace arc 90 } // namespace arc
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698