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

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

Issue 2250023005: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/unlock_manager.cc ('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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « components/proximity_auth/unlock_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698