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/linux/audio_manager_linux.h" | 5 #include "media/audio/linux/audio_manager_linux.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/environment.h" | 8 #include "base/environment.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/nix/xdg_util.h" | 10 #include "base/nix/xdg_util.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void AudioManagerLinux::MuteAll() { | 65 void AudioManagerLinux::MuteAll() { |
66 NOTIMPLEMENTED(); | 66 NOTIMPLEMENTED(); |
67 } | 67 } |
68 | 68 |
69 void AudioManagerLinux::UnMuteAll() { | 69 void AudioManagerLinux::UnMuteAll() { |
70 NOTIMPLEMENTED(); | 70 NOTIMPLEMENTED(); |
71 } | 71 } |
72 | 72 |
73 bool AudioManagerLinux::CanShowAudioInputSettings() { | 73 bool AudioManagerLinux::CanShowAudioInputSettings() { |
74 scoped_ptr<base::Environment> env(base::Environment::Create()); | 74 scoped_ptr<base::Environment> env(base::Environment::Create()); |
75 base::nix::DesktopEnvironment desktop = base::nix::GetDesktopEnvironment( | 75 |
76 env.get()); | 76 switch (base::nix::GetDesktopEnvironment(env.get())) { |
77 return (desktop == base::nix::DESKTOP_ENVIRONMENT_GNOME || | 77 case base::nix::DESKTOP_ENVIRONMENT_GNOME: |
78 desktop == base::nix::DESKTOP_ENVIRONMENT_KDE3 || | 78 case base::nix::DESKTOP_ENVIRONMENT_KDE3: |
79 desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4); | 79 case base::nix::DESKTOP_ENVIRONMENT_KDE4: |
| 80 return true; |
| 81 case base::nix::DESKTOP_ENVIRONMENT_OTHER: |
| 82 case base::nix::DESKTOP_ENVIRONMENT_UNITY: |
| 83 case base::nix::DESKTOP_ENVIRONMENT_XFCE: |
| 84 return false; |
| 85 } |
| 86 // Unless GetDesktopEnvironment() badly misbehaves, this should never happen. |
| 87 NOTREACHED(); |
| 88 return false; |
80 } | 89 } |
81 | 90 |
82 void AudioManagerLinux::ShowAudioInputSettings() { | 91 void AudioManagerLinux::ShowAudioInputSettings() { |
83 scoped_ptr<base::Environment> env(base::Environment::Create()); | 92 scoped_ptr<base::Environment> env(base::Environment::Create()); |
84 base::nix::DesktopEnvironment desktop = base::nix::GetDesktopEnvironment( | 93 base::nix::DesktopEnvironment desktop = base::nix::GetDesktopEnvironment( |
85 env.get()); | 94 env.get()); |
86 std::string command((desktop == base::nix::DESKTOP_ENVIRONMENT_GNOME) ? | 95 std::string command((desktop == base::nix::DESKTOP_ENVIRONMENT_GNOME) ? |
87 "gnome-volume-control" : "kmix"); | 96 "gnome-volume-control" : "kmix"); |
88 base::LaunchProcess(CommandLine(FilePath(command)), base::LaunchOptions(), | 97 base::LaunchProcess(CommandLine(FilePath(command)), base::LaunchOptions(), |
89 NULL); | 98 NULL); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } | 314 } |
306 | 315 |
307 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); | 316 return new AlsaPcmInputStream(this, device_name, params, wrapper_.get()); |
308 } | 317 } |
309 | 318 |
310 AudioManager* CreateAudioManager() { | 319 AudioManager* CreateAudioManager() { |
311 return new AudioManagerLinux(); | 320 return new AudioManagerLinux(); |
312 } | 321 } |
313 | 322 |
314 } // namespace media | 323 } // namespace media |
OLD | NEW |