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

Side by Side Diff: chrome/browser/chromeos/extensions/extension_volume_observer.cc

Issue 2427913003: Use mojo volume interfaces for mash and classic ash. (Closed)
Patch Set: Split volume and system events observers; only hook up volume. Created 4 years, 2 months 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/chromeos/extensions/extension_volume_observer.h"
6
7 #include "chrome/browser/extensions/api/system_private/system_private_api.h"
8 #include "chromeos/audio/cras_audio_handler.h"
9
10 namespace chromeos {
11
12 namespace {
13
14 // A helper to call the corresponding extensions method.
15 void DispatchVolumeChangedEvent() {
16 CrasAudioHandler* audio_handler = CrasAudioHandler::Get();
17 extensions::DispatchVolumeChangedEvent(
18 audio_handler->GetOutputVolumePercent(), audio_handler->IsOutputMuted());
19 }
20
21 } // namespace
22
23 ExtensionVolumeObserver::ExtensionVolumeObserver() {
24 CrasAudioHandler::Get()->AddAudioObserver(this);
25 }
26
27 ExtensionVolumeObserver::~ExtensionVolumeObserver() {
28 if (CrasAudioHandler::IsInitialized())
29 CrasAudioHandler::Get()->RemoveAudioObserver(this);
30 }
31
32 void ExtensionVolumeObserver::OnOutputNodeVolumeChanged(uint64_t node_id,
33 int volume) {
34 DispatchVolumeChangedEvent();
35 }
36
37 void ExtensionVolumeObserver::OnOutputMuteChanged(bool /* mute_on */,
38 bool /* system_adjust */) {
39 DispatchVolumeChangedEvent();
40 }
41
42 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/extension_volume_observer.h ('k') | chrome/browser/ui/ash/system_tray_delegate_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698