OLD | NEW |
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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 EasyUnlockPrivateSetRemoteDevicesFunction:: | 558 EasyUnlockPrivateSetRemoteDevicesFunction:: |
559 ~EasyUnlockPrivateSetRemoteDevicesFunction() { | 559 ~EasyUnlockPrivateSetRemoteDevicesFunction() { |
560 } | 560 } |
561 | 561 |
562 bool EasyUnlockPrivateSetRemoteDevicesFunction::RunSync() { | 562 bool EasyUnlockPrivateSetRemoteDevicesFunction::RunSync() { |
563 scoped_ptr<easy_unlock_private::SetRemoteDevices::Params> params( | 563 scoped_ptr<easy_unlock_private::SetRemoteDevices::Params> params( |
564 easy_unlock_private::SetRemoteDevices::Params::Create(*args_)); | 564 easy_unlock_private::SetRemoteDevices::Params::Create(*args_)); |
565 EXTENSION_FUNCTION_VALIDATE(params.get()); | 565 EXTENSION_FUNCTION_VALIDATE(params.get()); |
566 | 566 |
567 Profile* profile = Profile::FromBrowserContext(browser_context()); | 567 Profile* profile = Profile::FromBrowserContext(browser_context()); |
568 if (params->devices.empty()) { | 568 base::ListValue devices; |
569 EasyUnlockService::Get(profile)->ClearRemoteDevices(); | 569 for (size_t i = 0; i < params->devices.size(); ++i) { |
570 } else { | 570 devices.Append(params->devices[i]->ToValue().release()); |
571 base::ListValue devices; | |
572 for (size_t i = 0; i < params->devices.size(); ++i) { | |
573 devices.Append(params->devices[i]->ToValue().release()); | |
574 } | |
575 EasyUnlockService::Get(profile)->SetRemoteDevices(devices); | |
576 } | 571 } |
| 572 EasyUnlockService::Get(profile)->SetRemoteDevices(devices); |
577 | 573 |
578 return true; | 574 return true; |
579 } | 575 } |
580 | 576 |
581 EasyUnlockPrivateGetRemoteDevicesFunction:: | 577 EasyUnlockPrivateGetRemoteDevicesFunction:: |
582 EasyUnlockPrivateGetRemoteDevicesFunction() { | 578 EasyUnlockPrivateGetRemoteDevicesFunction() { |
583 } | 579 } |
584 | 580 |
585 EasyUnlockPrivateGetRemoteDevicesFunction:: | 581 EasyUnlockPrivateGetRemoteDevicesFunction:: |
586 ~EasyUnlockPrivateGetRemoteDevicesFunction() { | 582 ~EasyUnlockPrivateGetRemoteDevicesFunction() { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 // TODO(tengs): Find a way to get the profile picture for non-ChromeOS | 685 // TODO(tengs): Find a way to get the profile picture for non-ChromeOS |
690 // devices. | 686 // devices. |
691 results_ = easy_unlock_private::GetUserImage::Results::Create(""); | 687 results_ = easy_unlock_private::GetUserImage::Results::Create(""); |
692 SetError("Not supported on non-ChromeOS platforms."); | 688 SetError("Not supported on non-ChromeOS platforms."); |
693 #endif | 689 #endif |
694 return true; | 690 return true; |
695 } | 691 } |
696 | 692 |
697 } // namespace api | 693 } // namespace api |
698 } // namespace extensions | 694 } // namespace extensions |
OLD | NEW |