OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_
api.h" | 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_
api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 // |params->setup_service_uuid|. | 1070 // |params->setup_service_uuid|. |
1071 connection_finder_.reset( | 1071 connection_finder_.reset( |
1072 new proximity_auth::BluetoothLowEnergyConnectionFinder( | 1072 new proximity_auth::BluetoothLowEnergyConnectionFinder( |
1073 proximity_auth::RemoteDevice(), params->setup_service_uuid, | 1073 proximity_auth::RemoteDevice(), params->setup_service_uuid, |
1074 proximity_auth::BluetoothLowEnergyConnectionFinder::FIND_ANY_DEVICE, | 1074 proximity_auth::BluetoothLowEnergyConnectionFinder::FIND_ANY_DEVICE, |
1075 nullptr, bluetooth_throttler_.get(), 3)); | 1075 nullptr, bluetooth_throttler_.get(), 3)); |
1076 | 1076 |
1077 connection_finder_->Find(base::Bind( | 1077 connection_finder_->Find(base::Bind( |
1078 &EasyUnlockPrivateFindSetupConnectionFunction::OnConnectionFound, this)); | 1078 &EasyUnlockPrivateFindSetupConnectionFunction::OnConnectionFound, this)); |
1079 | 1079 |
1080 timer_.reset( | 1080 timer_.reset(new base::OneShotTimer()); |
1081 new base::OneShotTimer<EasyUnlockPrivateFindSetupConnectionFunction>()); | |
1082 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(params->time_out), | 1081 timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(params->time_out), |
1083 base::Bind(&EasyUnlockPrivateFindSetupConnectionFunction:: | 1082 base::Bind(&EasyUnlockPrivateFindSetupConnectionFunction:: |
1084 OnConnectionFinderTimedOut, | 1083 OnConnectionFinderTimedOut, |
1085 this)); | 1084 this)); |
1086 | 1085 |
1087 return true; | 1086 return true; |
1088 } | 1087 } |
1089 | 1088 |
1090 EasyUnlockPrivateSetupConnectionStatusFunction:: | 1089 EasyUnlockPrivateSetupConnectionStatusFunction:: |
1091 EasyUnlockPrivateSetupConnectionStatusFunction() {} | 1090 EasyUnlockPrivateSetupConnectionStatusFunction() {} |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 EXTENSION_FUNCTION_VALIDATE(params); | 1135 EXTENSION_FUNCTION_VALIDATE(params); |
1137 std::string payload(params->data.begin(), params->data.end()); | 1136 std::string payload(params->data.begin(), params->data.end()); |
1138 bool success = GetConnectionManager(browser_context()) | 1137 bool success = GetConnectionManager(browser_context()) |
1139 ->SendMessage(extension(), params->connection_id, payload); | 1138 ->SendMessage(extension(), params->connection_id, payload); |
1140 if (!success) | 1139 if (!success) |
1141 SetError("Invalid connectionId."); | 1140 SetError("Invalid connectionId."); |
1142 return true; | 1141 return true; |
1143 } | 1142 } |
1144 | 1143 |
1145 } // namespace extensions | 1144 } // namespace extensions |
OLD | NEW |