OLD | NEW |
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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 web_ui()->CallJavascriptFunctionUnsafe("LocalStateInterface.onGotLocalState", | 424 web_ui()->CallJavascriptFunctionUnsafe("LocalStateInterface.onGotLocalState", |
425 *enrollment_state, *device_sync_state, | 425 *enrollment_state, *device_sync_state, |
426 *unlock_keys); | 426 *unlock_keys); |
427 } | 427 } |
428 | 428 |
429 std::unique_ptr<base::DictionaryValue> | 429 std::unique_ptr<base::DictionaryValue> |
430 ProximityAuthWebUIHandler::GetEnrollmentStateDictionary() { | 430 ProximityAuthWebUIHandler::GetEnrollmentStateDictionary() { |
431 CryptAuthEnrollmentManager* enrollment_manager = | 431 CryptAuthEnrollmentManager* enrollment_manager = |
432 proximity_auth_client_->GetCryptAuthEnrollmentManager(); | 432 proximity_auth_client_->GetCryptAuthEnrollmentManager(); |
433 if (!enrollment_manager) | 433 if (!enrollment_manager) |
434 return base::WrapUnique(new base::DictionaryValue()); | 434 return base::MakeUnique<base::DictionaryValue>(); |
435 | 435 |
436 return CreateSyncStateDictionary( | 436 return CreateSyncStateDictionary( |
437 enrollment_manager->GetLastEnrollmentTime().ToJsTime(), | 437 enrollment_manager->GetLastEnrollmentTime().ToJsTime(), |
438 enrollment_manager->GetTimeToNextAttempt().InMillisecondsF(), | 438 enrollment_manager->GetTimeToNextAttempt().InMillisecondsF(), |
439 enrollment_manager->IsRecoveringFromFailure(), | 439 enrollment_manager->IsRecoveringFromFailure(), |
440 enrollment_manager->IsEnrollmentInProgress()); | 440 enrollment_manager->IsEnrollmentInProgress()); |
441 } | 441 } |
442 | 442 |
443 std::unique_ptr<base::DictionaryValue> | 443 std::unique_ptr<base::DictionaryValue> |
444 ProximityAuthWebUIHandler::GetDeviceSyncStateDictionary() { | 444 ProximityAuthWebUIHandler::GetDeviceSyncStateDictionary() { |
445 CryptAuthDeviceManager* device_manager = | 445 CryptAuthDeviceManager* device_manager = |
446 proximity_auth_client_->GetCryptAuthDeviceManager(); | 446 proximity_auth_client_->GetCryptAuthDeviceManager(); |
447 if (!device_manager) | 447 if (!device_manager) |
448 return base::WrapUnique(new base::DictionaryValue()); | 448 return base::MakeUnique<base::DictionaryValue>(); |
449 | 449 |
450 return CreateSyncStateDictionary( | 450 return CreateSyncStateDictionary( |
451 device_manager->GetLastSyncTime().ToJsTime(), | 451 device_manager->GetLastSyncTime().ToJsTime(), |
452 device_manager->GetTimeToNextAttempt().InMillisecondsF(), | 452 device_manager->GetTimeToNextAttempt().InMillisecondsF(), |
453 device_manager->IsRecoveringFromFailure(), | 453 device_manager->IsRecoveringFromFailure(), |
454 device_manager->IsSyncInProgress()); | 454 device_manager->IsSyncInProgress()); |
455 } | 455 } |
456 | 456 |
457 std::unique_ptr<base::ListValue> | 457 std::unique_ptr<base::ListValue> |
458 ProximityAuthWebUIHandler::GetUnlockKeysList() { | 458 ProximityAuthWebUIHandler::GetUnlockKeysList() { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 << "\n trust_agent_state: " | 609 << "\n trust_agent_state: " |
610 << static_cast<int>(status_update.trust_agent_state); | 610 << static_cast<int>(status_update.trust_agent_state); |
611 | 611 |
612 last_remote_status_update_.reset(new RemoteStatusUpdate(status_update)); | 612 last_remote_status_update_.reset(new RemoteStatusUpdate(status_update)); |
613 std::unique_ptr<base::ListValue> unlock_keys = GetUnlockKeysList(); | 613 std::unique_ptr<base::ListValue> unlock_keys = GetUnlockKeysList(); |
614 web_ui()->CallJavascriptFunctionUnsafe( | 614 web_ui()->CallJavascriptFunctionUnsafe( |
615 "LocalStateInterface.onUnlockKeysChanged", *unlock_keys); | 615 "LocalStateInterface.onUnlockKeysChanged", *unlock_keys); |
616 } | 616 } |
617 | 617 |
618 } // namespace proximity_auth | 618 } // namespace proximity_auth |
OLD | NEW |