OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/proximity_auth/ble/proximity_auth_ble_system.h" | 5 #include "components/proximity_auth/ble/proximity_auth_ble_system.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" | 11 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" |
12 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
" | 12 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h
" |
13 #include "components/proximity_auth/ble/fake_wire_message.h" | 13 #include "components/proximity_auth/ble/fake_wire_message.h" |
14 #include "components/proximity_auth/connection.h" | 14 #include "components/proximity_auth/connection.h" |
15 #include "components/proximity_auth/remote_device.h" | 15 #include "components/proximity_auth/remote_device.h" |
16 #include "device/bluetooth/bluetooth_device.h" | 16 #include "device/bluetooth/bluetooth_device.h" |
17 #include "device/bluetooth/bluetooth_gatt_connection.h" | 17 #include "device/bluetooth/bluetooth_gatt_connection.h" |
18 | 18 |
19 namespace proximity_auth { | 19 namespace proximity_auth { |
20 | 20 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 VLOG(1) << "Polling stopped"; | 176 VLOG(1) << "Polling stopped"; |
177 is_polling_screen_state_ = false; | 177 is_polling_screen_state_ = false; |
178 return; | 178 return; |
179 } | 179 } |
180 | 180 |
181 // Sends message requesting screen state. | 181 // Sends message requesting screen state. |
182 connection_->SendMessage( | 182 connection_->SendMessage( |
183 make_scoped_ptr(new FakeWireMessage(kPollScreenState))); | 183 make_scoped_ptr(new FakeWireMessage(kPollScreenState))); |
184 | 184 |
185 // Schedules the next message in |kPollingIntervalSeconds| ms. | 185 // Schedules the next message in |kPollingIntervalSeconds| ms. |
186 base::MessageLoopProxy::current()->PostDelayedTask( | 186 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
187 FROM_HERE, base::Bind(&ProximityAuthBleSystem::StartPollingScreenState, | 187 FROM_HERE, base::Bind(&ProximityAuthBleSystem::StartPollingScreenState, |
188 weak_ptr_factory_.GetWeakPtr()), | 188 weak_ptr_factory_.GetWeakPtr()), |
189 base::TimeDelta::FromSeconds(kPollingIntervalSeconds)); | 189 base::TimeDelta::FromSeconds(kPollingIntervalSeconds)); |
190 } | 190 } |
191 } | 191 } |
192 | 192 |
193 void ProximityAuthBleSystem::StopPollingScreenState() { | 193 void ProximityAuthBleSystem::StopPollingScreenState() { |
194 is_polling_screen_state_ = false; | 194 is_polling_screen_state_ = false; |
195 } | 195 } |
196 | 196 |
197 } // namespace proximity_auth | 197 } // namespace proximity_auth |
OLD | NEW |