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 "chrome/browser/ui/ash/volume_controller.h" | 5 #include "chrome/browser/ui/ash/volume_controller.h" |
6 | 6 |
7 #include "ash/public/interfaces/accelerator_controller.mojom.h" | 7 #include "ash/public/interfaces/accelerator_controller.mojom.h" |
| 8 #include "ash/public/interfaces/constants.mojom.h" |
8 #include "base/command_line.h" | 9 #include "base/command_line.h" |
9 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 10 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
10 #include "chrome/browser/ui/ash/ash_util.h" | |
11 #include "chrome/grit/browser_resources.h" | 11 #include "chrome/grit/browser_resources.h" |
12 #include "chromeos/audio/chromeos_sounds.h" | 12 #include "chromeos/audio/chromeos_sounds.h" |
13 #include "chromeos/audio/cras_audio_handler.h" | 13 #include "chromeos/audio/cras_audio_handler.h" |
14 #include "chromeos/chromeos_switches.h" | 14 #include "chromeos/chromeos_switches.h" |
15 #include "content/public/common/service_manager_connection.h" | 15 #include "content/public/common/service_manager_connection.h" |
16 #include "media/audio/sounds/sounds_manager.h" | 16 #include "media/audio/sounds/sounds_manager.h" |
17 #include "services/service_manager/public/cpp/connector.h" | 17 #include "services/service_manager/public/cpp/connector.h" |
18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
19 | 19 |
20 namespace { | 20 namespace { |
(...skipping 14 matching lines...) Expand all Loading... |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 VolumeController::VolumeController() : binding_(this) { | 40 VolumeController::VolumeController() : binding_(this) { |
41 // Connect to the accelerator controller interface in the ash service. | 41 // Connect to the accelerator controller interface in the ash service. |
42 service_manager::Connector* connector = | 42 service_manager::Connector* connector = |
43 content::ServiceManagerConnection::GetForProcess()->GetConnector(); | 43 content::ServiceManagerConnection::GetForProcess()->GetConnector(); |
44 ash::mojom::AcceleratorControllerPtr accelerator_controller_ptr; | 44 ash::mojom::AcceleratorControllerPtr accelerator_controller_ptr; |
45 connector->BindInterface(ash_util::GetAshServiceName(), | 45 connector->BindInterface(ash::mojom::kServiceName, |
46 &accelerator_controller_ptr); | 46 &accelerator_controller_ptr); |
47 | 47 |
48 // Register this object as the volume controller. | 48 // Register this object as the volume controller. |
49 accelerator_controller_ptr->SetVolumeController( | 49 accelerator_controller_ptr->SetVolumeController( |
50 binding_.CreateInterfacePtrAndBind()); | 50 binding_.CreateInterfacePtrAndBind()); |
51 | 51 |
52 if (VolumeAdjustSoundEnabled()) { | 52 if (VolumeAdjustSoundEnabled()) { |
53 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 53 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
54 media::SoundsManager::Get()->Initialize( | 54 media::SoundsManager::Get()->Initialize( |
55 chromeos::SOUND_VOLUME_ADJUST, | 55 chromeos::SOUND_VOLUME_ADJUST, |
(...skipping 28 matching lines...) Expand all Loading... |
84 audio_handler->AdjustOutputVolumeToAudibleLevel(); | 84 audio_handler->AdjustOutputVolumeToAudibleLevel(); |
85 play_sound = true; | 85 play_sound = true; |
86 } else { | 86 } else { |
87 play_sound = audio_handler->GetOutputVolumePercent() != 100; | 87 play_sound = audio_handler->GetOutputVolumePercent() != 100; |
88 audio_handler->AdjustOutputVolumeByPercent(kStepPercentage); | 88 audio_handler->AdjustOutputVolumeByPercent(kStepPercentage); |
89 } | 89 } |
90 | 90 |
91 if (play_sound) | 91 if (play_sound) |
92 PlayVolumeAdjustSound(); | 92 PlayVolumeAdjustSound(); |
93 } | 93 } |
OLD | NEW |