Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: device/gamepad/gamepad_monitor.cc

Issue 2851173004: Eliminate bind callback that doesn't take a BindSourceInfo parameter. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/gamepad/gamepad_monitor.h ('k') | device/geolocation/geolocation_service_context.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "device/gamepad/gamepad_monitor.h" 5 #include "device/gamepad/gamepad_monitor.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/memory/shared_memory.h" 8 #include "base/memory/shared_memory.h"
9 #include "device/gamepad/gamepad_service.h" 9 #include "device/gamepad/gamepad_service.h"
10 #include "device/gamepad/gamepad_shared_buffer.h" 10 #include "device/gamepad/gamepad_shared_buffer.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h" 11 #include "mojo/public/cpp/bindings/strong_binding.h"
12 12
13 namespace device { 13 namespace device {
14 14
15 GamepadMonitor::GamepadMonitor() : is_started_(false) {} 15 GamepadMonitor::GamepadMonitor() : is_started_(false) {}
16 16
17 GamepadMonitor::~GamepadMonitor() { 17 GamepadMonitor::~GamepadMonitor() {
18 if (is_started_) 18 if (is_started_)
19 GamepadService::GetInstance()->RemoveConsumer(this); 19 GamepadService::GetInstance()->RemoveConsumer(this);
20 } 20 }
21 21
22 // static 22 // static
23 void GamepadMonitor::Create(mojom::GamepadMonitorRequest request) { 23 void GamepadMonitor::Create(const service_manager::BindSourceInfo& source_info,
24 mojom::GamepadMonitorRequest request) {
24 mojo::MakeStrongBinding(base::MakeUnique<GamepadMonitor>(), 25 mojo::MakeStrongBinding(base::MakeUnique<GamepadMonitor>(),
25 std::move(request)); 26 std::move(request));
26 } 27 }
27 28
28 void GamepadMonitor::OnGamepadConnected(unsigned index, 29 void GamepadMonitor::OnGamepadConnected(unsigned index,
29 const Gamepad& gamepad) { 30 const Gamepad& gamepad) {
30 if (gamepad_observer_) 31 if (gamepad_observer_)
31 gamepad_observer_->GamepadConnected(index, gamepad); 32 gamepad_observer_->GamepadConnected(index, gamepad);
32 } 33 }
33 34
(...skipping 20 matching lines...) Expand all
54 55
55 GamepadService::GetInstance()->ConsumerBecameInactive(this); 56 GamepadService::GetInstance()->ConsumerBecameInactive(this);
56 callback.Run(); 57 callback.Run();
57 } 58 }
58 59
59 void GamepadMonitor::SetObserver(mojom::GamepadObserverPtr gamepad_observer) { 60 void GamepadMonitor::SetObserver(mojom::GamepadObserverPtr gamepad_observer) {
60 gamepad_observer_ = std::move(gamepad_observer); 61 gamepad_observer_ = std::move(gamepad_observer);
61 } 62 }
62 63
63 } // namespace device 64 } // namespace device
OLDNEW
« no previous file with comments | « device/gamepad/gamepad_monitor.h ('k') | device/geolocation/geolocation_service_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698