OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 <stdint.h> | |
6 #include <utility> | |
7 | |
8 #include "base/memory/ptr_util.h" | |
9 #include "device/vibration/vibration_manager_impl.h" | |
10 #include "mojo/public/cpp/bindings/strong_binding.h" | |
11 | |
12 namespace device { | |
13 | |
14 int64_t VibrationManagerImpl::milli_seconds_for_testing_ = -1; | |
15 bool VibrationManagerImpl::cancelled_for_testing_ = false; | |
16 | |
17 namespace { | |
18 | |
19 class VibrationManagerEmptyImpl : public mojom::VibrationManager { | |
20 public: | |
21 VibrationManagerEmptyImpl() {} | |
22 ~VibrationManagerEmptyImpl() override {} | |
23 | |
24 void Vibrate(int64_t milliseconds, const VibrateCallback& callback) override { | |
25 VibrationManagerImpl::milli_seconds_for_testing_ = milliseconds; | |
26 callback.Run(); | |
27 } | |
28 | |
29 void Cancel(const CancelCallback& callback) override { | |
30 VibrationManagerImpl::cancelled_for_testing_ = true; | |
31 callback.Run(); | |
32 } | |
33 }; | |
34 | |
35 } // namespace | |
36 | |
37 // static | |
38 void VibrationManagerImpl::Create(mojom::VibrationManagerRequest request) { | |
39 mojo::MakeStrongBinding(base::MakeUnique<VibrationManagerEmptyImpl>(), | |
40 std::move(request)); | |
41 } | |
42 | |
43 } // namespace device | |
OLD | NEW |