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

Side by Side Diff: chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc

Issue 491753002: [EasyUnlock] Add a private API for establishing an insecure Bluetooth connection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix non-ChromeOS build Created 6 years, 4 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 | Annotate | Revision Log
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 void EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::OnSeekCompleted( 396 void EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::OnSeekCompleted(
397 const easy_unlock::SeekDeviceResult& seek_result) { 397 const easy_unlock::SeekDeviceResult& seek_result) {
398 if (seek_result.success) { 398 if (seek_result.success) {
399 SendResponse(true); 399 SendResponse(true);
400 } else { 400 } else {
401 SetError(seek_result.error_message); 401 SetError(seek_result.error_message);
402 SendResponse(false); 402 SendResponse(false);
403 } 403 }
404 } 404 }
405 405
406 EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
407 EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction() {}
408
409 EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
410 ~EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction() {}
411
412 void EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
413 ConnectToService(device::BluetoothDevice* device,
414 const device::BluetoothUUID& uuid) {
415 easy_unlock::ConnectToBluetoothServiceInsecurely(
416 device,
417 uuid,
418 base::Bind(&EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
419 OnConnect,
420 this),
421 base::Bind(&EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
422 OnConnectError,
423 this));
424 }
425
406 EasyUnlockPrivateUpdateScreenlockStateFunction:: 426 EasyUnlockPrivateUpdateScreenlockStateFunction::
407 EasyUnlockPrivateUpdateScreenlockStateFunction() {} 427 EasyUnlockPrivateUpdateScreenlockStateFunction() {}
408 428
409 EasyUnlockPrivateUpdateScreenlockStateFunction:: 429 EasyUnlockPrivateUpdateScreenlockStateFunction::
410 ~EasyUnlockPrivateUpdateScreenlockStateFunction() {} 430 ~EasyUnlockPrivateUpdateScreenlockStateFunction() {}
411 431
412 bool EasyUnlockPrivateUpdateScreenlockStateFunction::RunSync() { 432 bool EasyUnlockPrivateUpdateScreenlockStateFunction::RunSync() {
413 scoped_ptr<easy_unlock_private::UpdateScreenlockState::Params> params( 433 scoped_ptr<easy_unlock_private::UpdateScreenlockState::Params> params(
414 easy_unlock_private::UpdateScreenlockState::Params::Create(*args_)); 434 easy_unlock_private::UpdateScreenlockState::Params::Create(*args_));
415 EXTENSION_FUNCTION_VALIDATE(params.get()); 435 EXTENSION_FUNCTION_VALIDATE(params.get());
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 bool EasyUnlockPrivateGetRemoteDevicesFunction::RunSync() { 539 bool EasyUnlockPrivateGetRemoteDevicesFunction::RunSync() {
520 Profile* profile = Profile::FromBrowserContext(browser_context()); 540 Profile* profile = Profile::FromBrowserContext(browser_context());
521 const base::ListValue* devices = 541 const base::ListValue* devices =
522 EasyUnlockService::Get(profile)->GetRemoteDevices(); 542 EasyUnlockService::Get(profile)->GetRemoteDevices();
523 SetResult(devices ? devices->DeepCopy() : new base::ListValue()); 543 SetResult(devices ? devices->DeepCopy() : new base::ListValue());
524 return true; 544 return true;
525 } 545 }
526 546
527 } // namespace api 547 } // namespace api
528 } // namespace extensions 548 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698