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

Side by Side Diff: components/proximity_auth/ble/proximity_auth_ble_system.cc

Issue 1116963002: Bluetooth low energy connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing debug messages Created 5 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
OLDNEW
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/logging.h" 8 #include "base/logging.h"
9 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h"
9 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h " 10 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h "
10 #include "components/proximity_auth/connection.h" 11 #include "components/proximity_auth/connection.h"
12 #include "components/proximity_auth/remote_device.h"
11 #include "device/bluetooth/bluetooth_device.h" 13 #include "device/bluetooth/bluetooth_device.h"
12 #include "device/bluetooth/bluetooth_gatt_connection.h" 14 #include "device/bluetooth/bluetooth_gatt_connection.h"
13 15
14 namespace proximity_auth { 16 namespace proximity_auth {
15 17
16 namespace { 18 namespace {
17 19
18 // The UUID of the Bluetooth Low Energy service. 20 // The UUID of the Bluetooth Low Energy service.
19 const char kSmartLockServiceUUID[] = "b3b7e28e-a000-3e17-bd86-6e97b9e28c11"; 21 const char kSmartLockServiceUUID[] = "b3b7e28e-a000-3e17-bd86-6e97b9e28c11";
20 22
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 case ScreenlockBridge::LockHandler::OTHER_SCREEN: 57 case ScreenlockBridge::LockHandler::OTHER_SCREEN:
56 connection_finder_.reset(); 58 connection_finder_.reset();
57 break; 59 break;
58 } 60 }
59 }; 61 };
60 62
61 void ProximityAuthBleSystem::OnScreenDidUnlock( 63 void ProximityAuthBleSystem::OnScreenDidUnlock(
62 ScreenlockBridge::LockHandler::ScreenType screen_type) { 64 ScreenlockBridge::LockHandler::ScreenType screen_type) {
63 VLOG(1) << "OnScreenDidUnlock: " << screen_type; 65 VLOG(1) << "OnScreenDidUnlock: " << screen_type;
64 connection_finder_.reset(); 66 connection_finder_.reset();
67 connection_.reset();
msarda 2015/05/05 11:56:15 Destroy the connection before the finder. Just in
sacomoto 2015/05/06 13:47:59 Done.
65 }; 68 };
66 69
67 void ProximityAuthBleSystem::OnFocusedUserChanged(const std::string& user_id) { 70 void ProximityAuthBleSystem::OnFocusedUserChanged(const std::string& user_id) {
68 VLOG(1) << "OnFocusedUserChanged: " << user_id; 71 VLOG(1) << "OnFocusedUserChanged: " << user_id;
69 }; 72 };
70 73
71 void ProximityAuthBleSystem::OnConnectionFound( 74 void ProximityAuthBleSystem::OnConnectionFound(
72 scoped_ptr<device::BluetoothGattConnection> connection) { 75 scoped_ptr<Connection> connection) {
73 VLOG(1) << "Connection found. Unlock."; 76 VLOG(1) << "Connection found. Unlock.";
74 77
75 // Close the connection as it it no longer needed. 78 connection_ = connection.Pass();
msarda 2015/05/05 11:56:15 We should close the connection when the screen in
sacomoto 2015/05/06 13:47:59 There is no need to do it here. When the screen is
76 connection_finder_->CloseConnection(connection.Pass());
77 79
78 // Unlock the screen when a connection is found. 80 // Unlock the screen when a connection is found.
79 // 81 //
80 // Note that this magically unlocks Chrome (no user interaction is needed). 82 // Note that this magically unlocks Chrome (no user interaction is needed).
81 // This user experience for this operation will be greately improved once 83 // This user experience for this operation will be greately improved once
82 // the Proximity Auth Unlock Manager migration to C++ is done. 84 // the Proximity Auth Unlock Manager migration to C++ is done.
83 screenlock_bridge_->Unlock(browser_context_); 85 screenlock_bridge_->Unlock(browser_context_);
84 } 86 }
85 87
86 } // namespace proximity_auth 88 } // namespace proximity_auth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698