haptic_gamepad_android.cc 935 B

123456789101112131415161718192021222324252627282930
  1. // Copyright 2022 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. #include "device/gamepad/haptic_gamepad_android.h"
  5. #include "device/gamepad/gamepad_platform_data_fetcher_android.h"
  6. namespace device {
  7. HapticGamepadAndroid::HapticGamepadAndroid(int device_index)
  8. : device_index_(device_index){};
  9. HapticGamepadAndroid::~HapticGamepadAndroid() = default;
  10. void HapticGamepadAndroid::SetVibration(
  11. mojom::GamepadEffectParametersPtr params) {
  12. GamepadPlatformDataFetcherAndroid::SetVibration(
  13. device_index_, params->strong_magnitude, params->weak_magnitude);
  14. }
  15. void HapticGamepadAndroid::SetZeroVibration() {
  16. GamepadPlatformDataFetcherAndroid::SetZeroVibration(device_index_);
  17. }
  18. base::WeakPtr<AbstractHapticGamepad> HapticGamepadAndroid::GetWeakPtr() {
  19. return weak_factory_.GetWeakPtr();
  20. }
  21. } // namespace device