| 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 "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 9 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 10 #include "chrome/browser/ui/ash/ash_util.h" | 10 #include "chrome/browser/ui/ash/ash_util.h" |
| (...skipping 24 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->ConnectToInterface(ash_util::GetAshServiceName(), | 45 connector->BindInterface(ash_util::GetAshServiceName(), |
| 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, |
| 56 bundle.GetRawDataResource(IDR_SOUND_VOLUME_ADJUST_WAV)); | 56 bundle.GetRawDataResource(IDR_SOUND_VOLUME_ADJUST_WAV)); |
| (...skipping 27 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 |