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

Side by Side Diff: components/proximity_auth/webui/proximity_auth_webui_handler.cc

Issue 1277483007: Implement finding BLE connections in chrome://proximity-auth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: refactor unit test Created 5 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
« no previous file with comments | « components/proximity_auth/webui/proximity_auth_webui_handler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/webui/proximity_auth_webui_handler.h" 5 #include "components/proximity_auth/webui/proximity_auth_webui_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/i18n/time_formatting.h" 10 #include "base/i18n/time_formatting.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/thread_task_runner_handle.h" 12 #include "base/thread_task_runner_handle.h"
13 #include "base/time/default_clock.h" 13 #include "base/time/default_clock.h"
14 #include "base/time/default_tick_clock.h"
14 #include "base/values.h" 15 #include "base/values.h"
15 #include "components/proximity_auth/bluetooth_connection.h" 16 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h "
17 #include "components/proximity_auth/ble/bluetooth_low_energy_device_whitelist.h"
18 #include "components/proximity_auth/ble/pref_names.h"
19 #include "components/proximity_auth/bluetooth_connection_finder.h"
20 #include "components/proximity_auth/bluetooth_throttler_impl.h"
16 #include "components/proximity_auth/bluetooth_util.h" 21 #include "components/proximity_auth/bluetooth_util.h"
17 #include "components/proximity_auth/client_impl.h" 22 #include "components/proximity_auth/client_impl.h"
18 #include "components/proximity_auth/cryptauth/base64url.h" 23 #include "components/proximity_auth/cryptauth/base64url.h"
19 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" 24 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h"
20 #include "components/proximity_auth/cryptauth/cryptauth_gcm_manager_impl.h" 25 #include "components/proximity_auth/cryptauth/cryptauth_gcm_manager_impl.h"
21 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h" 26 #include "components/proximity_auth/cryptauth/proto/cryptauth_api.pb.h"
22 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" 27 #include "components/proximity_auth/cryptauth/secure_message_delegate.h"
23 #include "components/proximity_auth/device_to_device_authenticator.h" 28 #include "components/proximity_auth/device_to_device_authenticator.h"
24 #include "components/proximity_auth/logging/logging.h" 29 #include "components/proximity_auth/logging/logging.h"
25 #include "components/proximity_auth/remote_status_update.h" 30 #include "components/proximity_auth/remote_status_update.h"
26 #include "components/proximity_auth/secure_context.h" 31 #include "components/proximity_auth/secure_context.h"
27 #include "components/proximity_auth/webui/cryptauth_enroller_factory_impl.h" 32 #include "components/proximity_auth/webui/cryptauth_enroller_factory_impl.h"
28 #include "components/proximity_auth/webui/proximity_auth_ui_delegate.h" 33 #include "components/proximity_auth/webui/proximity_auth_ui_delegate.h"
29 #include "components/proximity_auth/webui/reachable_phone_flow.h" 34 #include "components/proximity_auth/webui/reachable_phone_flow.h"
30 #include "content/public/browser/browser_thread.h" 35 #include "content/public/browser/browser_thread.h"
31 #include "content/public/browser/web_ui.h" 36 #include "content/public/browser/web_ui.h"
32 #include "device/bluetooth/bluetooth_uuid.h" 37 #include "device/bluetooth/bluetooth_uuid.h"
33 38
34 namespace proximity_auth { 39 namespace proximity_auth {
35 40
36 namespace { 41 namespace {
37 42
38 // The UUID of the Smart Lock Bluetooth service. 43 // The UUID of the Smart Lock classic Bluetooth service.
39 const char kBluetoothServiceUUID[] = "704EE561-3782-405A-A14B-2D47A2DDCDDF"; 44 const char kClassicBluetoothServiceUUID[] =
45 "704EE561-3782-405A-A14B-2D47A2DDCDDF";
46
47 // The UUID of the Bluetooth Low Energy service.
48 const char kBLESmartLockServiceUUID[] = "b3b7e28e-a000-3e17-bd86-6e97b9e28c11";
49
50 // The UUID of the characteristic used to send data to the peripheral.
51 const char kBLEToPeripheralCharUUID[] = "977c6674-1239-4e72-993b-502369b8bb5a";
52
53 // The UUID of the characteristic used to receive data from the peripheral.
54 const char kBLEFromPeripheralCharUUID[] =
55 "f4b904a2-a030-43b3-98a8-221c536c03cb";
40 56
41 // Keys in the JSON representation of a log message. 57 // Keys in the JSON representation of a log message.
42 const char kLogMessageTextKey[] = "text"; 58 const char kLogMessageTextKey[] = "text";
43 const char kLogMessageTimeKey[] = "time"; 59 const char kLogMessageTimeKey[] = "time";
44 const char kLogMessageFileKey[] = "file"; 60 const char kLogMessageFileKey[] = "file";
45 const char kLogMessageLineKey[] = "line"; 61 const char kLogMessageLineKey[] = "line";
46 const char kLogMessageSeverityKey[] = "severity"; 62 const char kLogMessageSeverityKey[] = "severity";
47 63
48 // Keys in the JSON representation of a SyncState object for enrollment or 64 // Keys in the JSON representation of a SyncState object for enrollment or
49 // device sync. 65 // device sync.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 sync_state->SetBoolean(kSyncStateOperationInProgress, 114 sync_state->SetBoolean(kSyncStateOperationInProgress,
99 is_enrollment_in_progress); 115 is_enrollment_in_progress);
100 return sync_state; 116 return sync_state;
101 } 117 }
102 118
103 } // namespace 119 } // namespace
104 120
105 ProximityAuthWebUIHandler::ProximityAuthWebUIHandler( 121 ProximityAuthWebUIHandler::ProximityAuthWebUIHandler(
106 ProximityAuthUIDelegate* delegate) 122 ProximityAuthUIDelegate* delegate)
107 : delegate_(delegate), 123 : delegate_(delegate),
108 web_contents_initialized_(false),
109 weak_ptr_factory_(this) { 124 weak_ptr_factory_(this) {
110 cryptauth_client_factory_ = delegate_->CreateCryptAuthClientFactory(); 125 cryptauth_client_factory_ = delegate_->CreateCryptAuthClientFactory();
111 } 126 }
112 127
113 ProximityAuthWebUIHandler::~ProximityAuthWebUIHandler() { 128 ProximityAuthWebUIHandler::~ProximityAuthWebUIHandler() {
114 LogBuffer::GetInstance()->RemoveObserver(this); 129 LogBuffer::GetInstance()->RemoveObserver(this);
115 } 130 }
116 131
117 void ProximityAuthWebUIHandler::RegisterMessages() { 132 void ProximityAuthWebUIHandler::RegisterMessages() {
118 web_ui()->RegisterMessageCallback( 133 web_ui()->RegisterMessageCallback(
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 !args->GetString(0, &b64_public_key) || 321 !args->GetString(0, &b64_public_key) ||
307 !Base64UrlDecode(b64_public_key, &public_key)) { 322 !Base64UrlDecode(b64_public_key, &public_key)) {
308 return; 323 return;
309 } 324 }
310 325
311 Connection* connection = GetConnection(); 326 Connection* connection = GetConnection();
312 for (const auto& unlock_key : device_manager_->unlock_keys()) { 327 for (const auto& unlock_key : device_manager_->unlock_keys()) {
313 if (unlock_key.public_key() == public_key) { 328 if (unlock_key.public_key() == public_key) {
314 // Check if there is an existing connection to disconnect from first. 329 // Check if there is an existing connection to disconnect from first.
315 if (connection && connection->IsConnected() && 330 if (connection && connection->IsConnected() &&
316 connection->remote_device().public_key == public_key) { 331 selected_remote_device_.public_key == public_key) {
317 PA_LOG(INFO) << "Disconnecting from " 332 PA_LOG(INFO) << "Disconnecting from "
318 << unlock_key.friendly_device_name() << "[" 333 << unlock_key.friendly_device_name() << "["
319 << unlock_key.bluetooth_address() << "]"; 334 << unlock_key.bluetooth_address() << "]";
320 connection->Disconnect(); 335 connection->Disconnect();
321 return; 336 return;
322 } 337 }
323 338
324 // Derive the PSK before connecting to the device. 339 // Derive the PSK before connecting to the device.
325 PA_LOG(INFO) << "Connecting to " << unlock_key.friendly_device_name() 340 PA_LOG(INFO) << "Deriving PSK before connecting to "
326 << "[" << unlock_key.bluetooth_address() << "]"; 341 << unlock_key.friendly_device_name();
327 secure_message_delegate_ = delegate_->CreateSecureMessageDelegate(); 342 secure_message_delegate_ = delegate_->CreateSecureMessageDelegate();
328 secure_message_delegate_->DeriveKey( 343 secure_message_delegate_->DeriveKey(
329 user_private_key_, unlock_key.public_key(), 344 user_private_key_, unlock_key.public_key(),
330 base::Bind(&ProximityAuthWebUIHandler::OnPSKDerived, 345 base::Bind(&ProximityAuthWebUIHandler::OnPSKDerived,
331 weak_ptr_factory_.GetWeakPtr(), unlock_key)); 346 weak_ptr_factory_.GetWeakPtr(), unlock_key));
332 347
333 return; 348 return;
334 } 349 }
335 } 350 }
336 351
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 return unlock_keys; 517 return unlock_keys;
503 518
504 for (const auto& unlock_key : device_manager_->unlock_keys()) { 519 for (const auto& unlock_key : device_manager_->unlock_keys()) {
505 unlock_keys->Append(ExternalDeviceInfoToDictionary(unlock_key)); 520 unlock_keys->Append(ExternalDeviceInfoToDictionary(unlock_key));
506 } 521 }
507 522
508 return unlock_keys; 523 return unlock_keys;
509 } 524 }
510 525
511 Connection* ProximityAuthWebUIHandler::GetConnection() { 526 Connection* ProximityAuthWebUIHandler::GetConnection() {
512 Connection* connection = bluetooth_connection_.get(); 527 Connection* connection = connection_.get();
513 if (client_) { 528 if (client_) {
514 DCHECK(!connection); 529 DCHECK(!connection);
515 connection = client_->connection(); 530 connection = client_->connection();
516 } 531 }
517 return connection; 532 return connection;
518 } 533 }
519 534
520 void ProximityAuthWebUIHandler::OnPSKDerived( 535 void ProximityAuthWebUIHandler::OnPSKDerived(
521 const cryptauth::ExternalDeviceInfo& unlock_key, 536 const cryptauth::ExternalDeviceInfo& unlock_key,
522 const std::string& persistent_symmetric_key) { 537 const std::string& persistent_symmetric_key) {
523 if (persistent_symmetric_key.empty()) { 538 if (persistent_symmetric_key.empty()) {
524 PA_LOG(ERROR) << "Failed to derive PSK."; 539 PA_LOG(ERROR) << "Failed to derive PSK.";
525 return; 540 return;
526 } 541 }
527 542
528 RemoteDevice remote_device( 543 selected_remote_device_ =
529 unlock_key.friendly_device_name(), unlock_key.public_key(), 544 RemoteDevice(unlock_key.friendly_device_name(), unlock_key.public_key(),
530 unlock_key.bluetooth_address(), persistent_symmetric_key); 545 unlock_key.bluetooth_address(), persistent_symmetric_key);
531 546
532 bluetooth_connection_.reset(new BluetoothConnection( 547 // TODO(tengs): We distinguish whether the unlock key uses classic Bluetooth
533 remote_device, device::BluetoothUUID(kBluetoothServiceUUID))); 548 // or BLE based on the presence of the |bluetooth_address| field. However, we
534 bluetooth_connection_->AddObserver(this); 549 // should ideally have a separate field specifying the protocol.
535 550 if (selected_remote_device_.bluetooth_address.empty())
536 // This SeekDeviceByAddress operation is needed to connect to a device if 551 FindBluetoothLowEnergyConnection(selected_remote_device_);
537 // it is not already known to the local device. 552 else
538 bluetooth_util::SeekDeviceByAddress( 553 FindBluetoothClassicConnection(selected_remote_device_);
539 remote_device.bluetooth_address,
540 base::Bind(&ProximityAuthWebUIHandler::OnSeekedDeviceByAddress,
541 weak_ptr_factory_.GetWeakPtr()),
542 base::Bind(&ProximityAuthWebUIHandler::OnSeekedDeviceByAddressError,
543 weak_ptr_factory_.GetWeakPtr()),
544 content::BrowserThread::GetBlockingPool()
545 ->GetTaskRunnerWithShutdownBehavior(
546 base::SequencedWorkerPool::CONTINUE_ON_SHUTDOWN)
547 .get());
548 } 554 }
549 555
550 void ProximityAuthWebUIHandler::OnSeekedDeviceByAddress() { 556 void ProximityAuthWebUIHandler::FindBluetoothClassicConnection(
551 PA_LOG(INFO) << "Found Bluetooth device: " 557 const RemoteDevice& remote_device) {
552 << bluetooth_connection_->remote_device().bluetooth_address; 558 PA_LOG(INFO) << "Finding classic Bluetooth device " << remote_device.name
553 bluetooth_connection_->Connect(); 559 << " [" << remote_device.bluetooth_address << "].";
560
561 // TODO(tengs): Set a timeout to stop the connection finder eventually.
562 connection_finder_.reset(new BluetoothConnectionFinder(
563 remote_device, device::BluetoothUUID(kClassicBluetoothServiceUUID),
564 base::TimeDelta::FromSeconds(3)));
565 connection_finder_->Find(
566 base::Bind(&ProximityAuthWebUIHandler::OnConnectionFound,
567 weak_ptr_factory_.GetWeakPtr()));
568
569 web_ui()->CallJavascriptFunction("LocalStateInterface.onUnlockKeysChanged",
570 *GetUnlockKeysList());
554 } 571 }
555 572
556 void ProximityAuthWebUIHandler::OnSeekedDeviceByAddressError( 573 void ProximityAuthWebUIHandler::FindBluetoothLowEnergyConnection(
557 const std::string& error_message) { 574 const RemoteDevice& remote_device) {
558 PA_LOG(WARNING) << "Failed to seek device by address: " 575 PrefService* pref_service = delegate_->GetPrefService();
559 << bluetooth_connection_->remote_device().bluetooth_address; 576 if (!pref_service->FindPreference(
577 prefs::kBluetoothLowEnergyDeviceWhitelist)) {
578 PA_LOG(ERROR) << "Please enable the BLE experiment in chrome://flags.";
579 return;
580 }
581
582 PA_LOG(INFO) << "Finding Bluetooth Low Energy device " << remote_device.name;
583 if (!bluetooth_throttler_) {
584 bluetooth_throttler_.reset(new BluetoothThrottlerImpl(
585 make_scoped_ptr(new base::DefaultTickClock())));
586 }
587
588 ble_device_whitelist_.reset(
589 new BluetoothLowEnergyDeviceWhitelist(delegate_->GetPrefService()));
590
591 // TODO(tengs): Set a timeout to stop the connection finder eventually.
592 connection_finder_.reset(new BluetoothLowEnergyConnectionFinder(
593 kBLESmartLockServiceUUID, kBLEToPeripheralCharUUID,
594 kBLEFromPeripheralCharUUID, ble_device_whitelist_.get(),
595 bluetooth_throttler_.get(), 3));
596 connection_finder_->Find(
597 base::Bind(&ProximityAuthWebUIHandler::OnConnectionFound,
598 weak_ptr_factory_.GetWeakPtr()));
599
600 web_ui()->CallJavascriptFunction("LocalStateInterface.onUnlockKeysChanged",
601 *GetUnlockKeysList());
560 } 602 }
561 603
562 void ProximityAuthWebUIHandler::OnAuthenticationResult( 604 void ProximityAuthWebUIHandler::OnAuthenticationResult(
563 Authenticator::Result result, 605 Authenticator::Result result,
564 scoped_ptr<SecureContext> secure_context) { 606 scoped_ptr<SecureContext> secure_context) {
565 secure_context_ = secure_context.Pass(); 607 secure_context_ = secure_context.Pass();
566 608
567 // Create the ClientImpl asynchronously. |client_| registers itself as an 609 // Create the ClientImpl asynchronously. |client_| registers itself as an
568 // observer of |bluetooth_connection_|, so creating it synchronously would 610 // observer of |connection_|, so creating it synchronously would
569 // trigger |OnSendComplete()| as an observer call for |client_|. 611 // trigger |OnSendComplete()| as an observer call for |client_|.
570 base::ThreadTaskRunnerHandle::Get()->PostTask( 612 base::ThreadTaskRunnerHandle::Get()->PostTask(
571 FROM_HERE, 613 FROM_HERE,
572 base::Bind(&ProximityAuthWebUIHandler::CreateStatusUpdateClient, 614 base::Bind(&ProximityAuthWebUIHandler::CreateStatusUpdateClient,
573 weak_ptr_factory_.GetWeakPtr())); 615 weak_ptr_factory_.GetWeakPtr()));
574 } 616 }
575 617
618 void ProximityAuthWebUIHandler::OnConnectionFound(
619 scoped_ptr<Connection> connection) {
620 DCHECK(connection->IsConnected());
621 connection_ = connection.Pass();
622 connection_->AddObserver(this);
623
624 web_ui()->CallJavascriptFunction("LocalStateInterface.onUnlockKeysChanged",
625 *GetUnlockKeysList());
626
627 // TODO(tengs): Create an authenticator for BLE connections.
628 if (selected_remote_device_.bluetooth_address.empty())
629 return;
630
631 authenticator_.reset(new DeviceToDeviceAuthenticator(
632 connection_.get(), delegate_->GetAccountId(),
633 delegate_->CreateSecureMessageDelegate()));
634 authenticator_->Authenticate(
635 base::Bind(&ProximityAuthWebUIHandler::OnAuthenticationResult,
636 weak_ptr_factory_.GetWeakPtr()));
637 }
638
576 void ProximityAuthWebUIHandler::CreateStatusUpdateClient() { 639 void ProximityAuthWebUIHandler::CreateStatusUpdateClient() {
577 client_.reset( 640 client_.reset(new ClientImpl(connection_.Pass(), secure_context_.Pass()));
578 new ClientImpl(bluetooth_connection_.Pass(), secure_context_.Pass()));
579 client_->AddObserver(this); 641 client_->AddObserver(this);
580 } 642 }
581 643
582 scoped_ptr<base::DictionaryValue> 644 scoped_ptr<base::DictionaryValue>
583 ProximityAuthWebUIHandler::ExternalDeviceInfoToDictionary( 645 ProximityAuthWebUIHandler::ExternalDeviceInfoToDictionary(
584 const cryptauth::ExternalDeviceInfo& device_info) { 646 const cryptauth::ExternalDeviceInfo& device_info) {
585 std::string base64_public_key; 647 std::string base64_public_key;
586 Base64UrlEncode(device_info.public_key(), &base64_public_key); 648 Base64UrlEncode(device_info.public_key(), &base64_public_key);
587 649
588 // Set the fields in the ExternalDeviceInfo proto. 650 // Set the fields in the ExternalDeviceInfo proto.
(...skipping 14 matching lines...) Expand all
603 // the corresponding local device data (e.g. connection status and remote 665 // the corresponding local device data (e.g. connection status and remote
604 // status updates). 666 // status updates).
605 std::string public_key = device_info.public_key(); 667 std::string public_key = device_info.public_key();
606 auto iterator = std::find_if( 668 auto iterator = std::find_if(
607 device_manager_->unlock_keys().begin(), 669 device_manager_->unlock_keys().begin(),
608 device_manager_->unlock_keys().end(), 670 device_manager_->unlock_keys().end(),
609 [&public_key](const cryptauth::ExternalDeviceInfo& unlock_key) { 671 [&public_key](const cryptauth::ExternalDeviceInfo& unlock_key) {
610 return unlock_key.public_key() == public_key; 672 return unlock_key.public_key() == public_key;
611 }); 673 });
612 674
613 if (iterator == device_manager_->unlock_keys().end()) 675 if (iterator == device_manager_->unlock_keys().end() ||
676 selected_remote_device_.public_key != device_info.public_key())
614 return dictionary; 677 return dictionary;
615 678
616 // Fill in the current Bluetooth connection status. 679 // Fill in the current Bluetooth connection status.
680 std::string connection_status = kExternalDeviceDisconnected;
617 Connection* connection = GetConnection(); 681 Connection* connection = GetConnection();
618 if (!connection || 682 if (connection && connection->IsConnected()) {
619 connection->remote_device().public_key != device_info.public_key())
620 return dictionary;
621
622 std::string connection_status = kExternalDeviceDisconnected;
623 if (connection->IsConnected()) {
624 connection_status = kExternalDeviceConnected; 683 connection_status = kExternalDeviceConnected;
625 } else if (connection->status() == Connection::IN_PROGRESS) { 684 } else if (connection_finder_) {
626 connection_status = kExternalDeviceConnecting; 685 connection_status = kExternalDeviceConnecting;
627 } 686 }
628 dictionary->SetString(kExternalDeviceConnectionStatus, connection_status); 687 dictionary->SetString(kExternalDeviceConnectionStatus, connection_status);
629 688
630 // Fill the remote status dictionary. 689 // Fill the remote status dictionary.
631 if (last_remote_status_update_) { 690 if (last_remote_status_update_) {
632 scoped_ptr<base::DictionaryValue> status_dictionary( 691 scoped_ptr<base::DictionaryValue> status_dictionary(
633 new base::DictionaryValue()); 692 new base::DictionaryValue());
634 status_dictionary->SetInteger("userPresent", 693 status_dictionary->SetInteger("userPresent",
635 last_remote_status_update_->user_presence); 694 last_remote_status_update_->user_presence);
(...skipping 22 matching lines...) Expand all
658 ineligibility_reasons.Pass()); 717 ineligibility_reasons.Pass());
659 return device_dictionary; 718 return device_dictionary;
660 } 719 }
661 720
662 void ProximityAuthWebUIHandler::OnConnectionStatusChanged( 721 void ProximityAuthWebUIHandler::OnConnectionStatusChanged(
663 Connection* connection, 722 Connection* connection,
664 Connection::Status old_status, 723 Connection::Status old_status,
665 Connection::Status new_status) { 724 Connection::Status new_status) {
666 PA_LOG(INFO) << "Connection status changed from " << old_status << " to " 725 PA_LOG(INFO) << "Connection status changed from " << old_status << " to "
667 << new_status; 726 << new_status;
668 if (new_status == Connection::CONNECTED) { 727
669 authenticator_.reset(new DeviceToDeviceAuthenticator( 728 if (new_status == Connection::DISCONNECTED) {
670 connection, delegate_->GetAccountId(),
671 delegate_->CreateSecureMessageDelegate()));
672 authenticator_->Authenticate(
673 base::Bind(&ProximityAuthWebUIHandler::OnAuthenticationResult,
674 weak_ptr_factory_.GetWeakPtr()));
675 } else if (new_status == Connection::DISCONNECTED) {
676 last_remote_status_update_.reset(); 729 last_remote_status_update_.reset();
730 selected_remote_device_ = RemoteDevice();
731 connection_finder_.reset();
677 } 732 }
678 733
679 scoped_ptr<base::ListValue> unlock_keys = GetUnlockKeysList(); 734 scoped_ptr<base::ListValue> unlock_keys = GetUnlockKeysList();
680 web_ui()->CallJavascriptFunction("LocalStateInterface.onUnlockKeysChanged", 735 web_ui()->CallJavascriptFunction("LocalStateInterface.onUnlockKeysChanged",
681 *unlock_keys); 736 *unlock_keys);
682 } 737 }
683 738
684 void ProximityAuthWebUIHandler::OnMessageReceived(const Connection& connection, 739 void ProximityAuthWebUIHandler::OnMessageReceived(const Connection& connection,
685 const WireMessage& message) { 740 const WireMessage& message) {
686 std::string address = connection.remote_device().bluetooth_address; 741 std::string address = connection.remote_device().bluetooth_address;
(...skipping 10 matching lines...) Expand all
697 << "\n trust_agent_state: " 752 << "\n trust_agent_state: "
698 << static_cast<int>(status_update.trust_agent_state); 753 << static_cast<int>(status_update.trust_agent_state);
699 754
700 last_remote_status_update_.reset(new RemoteStatusUpdate(status_update)); 755 last_remote_status_update_.reset(new RemoteStatusUpdate(status_update));
701 scoped_ptr<base::ListValue> unlock_keys = GetUnlockKeysList(); 756 scoped_ptr<base::ListValue> unlock_keys = GetUnlockKeysList();
702 web_ui()->CallJavascriptFunction("LocalStateInterface.onUnlockKeysChanged", 757 web_ui()->CallJavascriptFunction("LocalStateInterface.onUnlockKeysChanged",
703 *unlock_keys); 758 *unlock_keys);
704 } 759 }
705 760
706 } // namespace proximity_auth 761 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/proximity_auth/webui/proximity_auth_webui_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698