| 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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 EasyUnlockPrivateSetRemoteDevicesFunction:: | 560 EasyUnlockPrivateSetRemoteDevicesFunction:: |
| 561 ~EasyUnlockPrivateSetRemoteDevicesFunction() { | 561 ~EasyUnlockPrivateSetRemoteDevicesFunction() { |
| 562 } | 562 } |
| 563 | 563 |
| 564 bool EasyUnlockPrivateSetRemoteDevicesFunction::RunSync() { | 564 bool EasyUnlockPrivateSetRemoteDevicesFunction::RunSync() { |
| 565 scoped_ptr<easy_unlock_private::SetRemoteDevices::Params> params( | 565 scoped_ptr<easy_unlock_private::SetRemoteDevices::Params> params( |
| 566 easy_unlock_private::SetRemoteDevices::Params::Create(*args_)); | 566 easy_unlock_private::SetRemoteDevices::Params::Create(*args_)); |
| 567 EXTENSION_FUNCTION_VALIDATE(params.get()); | 567 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 568 | 568 |
| 569 Profile* profile = Profile::FromBrowserContext(browser_context()); | 569 Profile* profile = Profile::FromBrowserContext(browser_context()); |
| 570 if (params->devices.empty()) { | 570 base::ListValue devices; |
| 571 EasyUnlockService::Get(profile)->ClearRemoteDevices(); | 571 for (size_t i = 0; i < params->devices.size(); ++i) { |
| 572 } else { | 572 devices.Append(params->devices[i]->ToValue().release()); |
| 573 base::ListValue devices; | |
| 574 for (size_t i = 0; i < params->devices.size(); ++i) { | |
| 575 devices.Append(params->devices[i]->ToValue().release()); | |
| 576 } | |
| 577 EasyUnlockService::Get(profile)->SetRemoteDevices(devices); | |
| 578 } | 573 } |
| 574 EasyUnlockService::Get(profile)->SetRemoteDevices(devices); |
| 579 | 575 |
| 580 return true; | 576 return true; |
| 581 } | 577 } |
| 582 | 578 |
| 583 EasyUnlockPrivateGetRemoteDevicesFunction:: | 579 EasyUnlockPrivateGetRemoteDevicesFunction:: |
| 584 EasyUnlockPrivateGetRemoteDevicesFunction() { | 580 EasyUnlockPrivateGetRemoteDevicesFunction() { |
| 585 } | 581 } |
| 586 | 582 |
| 587 EasyUnlockPrivateGetRemoteDevicesFunction:: | 583 EasyUnlockPrivateGetRemoteDevicesFunction:: |
| 588 ~EasyUnlockPrivateGetRemoteDevicesFunction() { | 584 ~EasyUnlockPrivateGetRemoteDevicesFunction() { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 // TODO(tengs): Find a way to get the profile picture for non-ChromeOS | 706 // TODO(tengs): Find a way to get the profile picture for non-ChromeOS |
| 711 // devices. | 707 // devices. |
| 712 results_ = easy_unlock_private::GetUserImage::Results::Create(""); | 708 results_ = easy_unlock_private::GetUserImage::Results::Create(""); |
| 713 SetError("Not supported on non-ChromeOS platforms."); | 709 SetError("Not supported on non-ChromeOS platforms."); |
| 714 #endif | 710 #endif |
| 715 return true; | 711 return true; |
| 716 } | 712 } |
| 717 | 713 |
| 718 } // namespace api | 714 } // namespace api |
| 719 } // namespace extensions | 715 } // namespace extensions |
| OLD | NEW |