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

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

Issue 2560713002: Move RemoteDevice from //components/proximity_auth to //components/cryptauth so that it can be easi… (Closed)
Patch Set: Add cryptauth dependency. Created 4 years 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/base64url.h" 10 #include "base/base64url.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 return unlock_keys; 464 return unlock_keys;
465 465
466 for (const auto& unlock_key : device_manager->unlock_keys()) { 466 for (const auto& unlock_key : device_manager->unlock_keys()) {
467 unlock_keys->Append(ExternalDeviceInfoToDictionary(unlock_key)); 467 unlock_keys->Append(ExternalDeviceInfoToDictionary(unlock_key));
468 } 468 }
469 469
470 return unlock_keys; 470 return unlock_keys;
471 } 471 }
472 472
473 void ProximityAuthWebUIHandler::OnRemoteDevicesLoaded( 473 void ProximityAuthWebUIHandler::OnRemoteDevicesLoaded(
474 const std::vector<RemoteDevice>& remote_devices) { 474 const std::vector<cryptauth::RemoteDevice>& remote_devices) {
475 if (remote_devices[0].persistent_symmetric_key.empty()) { 475 if (remote_devices[0].persistent_symmetric_key.empty()) {
476 PA_LOG(ERROR) << "Failed to derive PSK."; 476 PA_LOG(ERROR) << "Failed to derive PSK.";
477 return; 477 return;
478 } 478 }
479 479
480 selected_remote_device_ = remote_devices[0]; 480 selected_remote_device_ = remote_devices[0];
481 life_cycle_.reset(new RemoteDeviceLifeCycleImpl(selected_remote_device_, 481 life_cycle_.reset(new RemoteDeviceLifeCycleImpl(selected_remote_device_,
482 proximity_auth_client_)); 482 proximity_auth_client_));
483 life_cycle_->AddObserver(this); 483 life_cycle_->AddObserver(this);
484 life_cycle_->Start(); 484 life_cycle_->Start();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 ExternalDeviceInfoToDictionary(ineligible_device.device()); 564 ExternalDeviceInfoToDictionary(ineligible_device.device());
565 device_dictionary->Set(kIneligibleDeviceReasons, 565 device_dictionary->Set(kIneligibleDeviceReasons,
566 std::move(ineligibility_reasons)); 566 std::move(ineligibility_reasons));
567 return device_dictionary; 567 return device_dictionary;
568 } 568 }
569 569
570 void ProximityAuthWebUIHandler::CleanUpRemoteDeviceLifeCycle() { 570 void ProximityAuthWebUIHandler::CleanUpRemoteDeviceLifeCycle() {
571 PA_LOG(INFO) << "Cleaning up connection to " << selected_remote_device_.name 571 PA_LOG(INFO) << "Cleaning up connection to " << selected_remote_device_.name
572 << " [" << selected_remote_device_.bluetooth_address << "]"; 572 << " [" << selected_remote_device_.bluetooth_address << "]";
573 life_cycle_.reset(); 573 life_cycle_.reset();
574 selected_remote_device_ = RemoteDevice(); 574 selected_remote_device_ = cryptauth::RemoteDevice();
575 last_remote_status_update_.reset(); 575 last_remote_status_update_.reset();
576 web_ui()->CallJavascriptFunctionUnsafe( 576 web_ui()->CallJavascriptFunctionUnsafe(
577 "LocalStateInterface.onUnlockKeysChanged", *GetUnlockKeysList()); 577 "LocalStateInterface.onUnlockKeysChanged", *GetUnlockKeysList());
578 } 578 }
579 579
580 void ProximityAuthWebUIHandler::OnLifeCycleStateChanged( 580 void ProximityAuthWebUIHandler::OnLifeCycleStateChanged(
581 RemoteDeviceLifeCycle::State old_state, 581 RemoteDeviceLifeCycle::State old_state,
582 RemoteDeviceLifeCycle::State new_state) { 582 RemoteDeviceLifeCycle::State new_state) {
583 // Do not re-attempt to find a connection after the first one fails--just 583 // Do not re-attempt to find a connection after the first one fails--just
584 // abort. 584 // abort.
(...skipping 25 matching lines...) Expand all
610 << "\n trust_agent_state: " 610 << "\n trust_agent_state: "
611 << static_cast<int>(status_update.trust_agent_state); 611 << static_cast<int>(status_update.trust_agent_state);
612 612
613 last_remote_status_update_.reset(new RemoteStatusUpdate(status_update)); 613 last_remote_status_update_.reset(new RemoteStatusUpdate(status_update));
614 std::unique_ptr<base::ListValue> unlock_keys = GetUnlockKeysList(); 614 std::unique_ptr<base::ListValue> unlock_keys = GetUnlockKeysList();
615 web_ui()->CallJavascriptFunctionUnsafe( 615 web_ui()->CallJavascriptFunctionUnsafe(
616 "LocalStateInterface.onUnlockKeysChanged", *unlock_keys); 616 "LocalStateInterface.onUnlockKeysChanged", *unlock_keys);
617 } 617 }
618 618
619 } // namespace proximity_auth 619 } // 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