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

Side by Side Diff: extensions/browser/api/usb/usb_api.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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
OLDNEW
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 "extensions/browser/api/usb/usb_api.h" 5 #include "extensions/browser/api/usb/usb_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <numeric> 9 #include <numeric>
10 #include <set> 10 #include <set>
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 UsbRequestAccessFunction::UsbRequestAccessFunction() { 724 UsbRequestAccessFunction::UsbRequestAccessFunction() {
725 } 725 }
726 726
727 UsbRequestAccessFunction::~UsbRequestAccessFunction() { 727 UsbRequestAccessFunction::~UsbRequestAccessFunction() {
728 } 728 }
729 729
730 ExtensionFunction::ResponseAction UsbRequestAccessFunction::Run() { 730 ExtensionFunction::ResponseAction UsbRequestAccessFunction::Run() {
731 std::unique_ptr<extensions::api::usb::RequestAccess::Params> parameters = 731 std::unique_ptr<extensions::api::usb::RequestAccess::Params> parameters =
732 RequestAccess::Params::Create(*args_); 732 RequestAccess::Params::Create(*args_);
733 EXTENSION_FUNCTION_VALIDATE(parameters.get()); 733 EXTENSION_FUNCTION_VALIDATE(parameters.get());
734 return RespondNow( 734 return RespondNow(OneArgument(base::MakeUnique<base::Value>(true)));
735 OneArgument(base::MakeUnique<base::FundamentalValue>(true)));
736 } 735 }
737 736
738 UsbOpenDeviceFunction::UsbOpenDeviceFunction() { 737 UsbOpenDeviceFunction::UsbOpenDeviceFunction() {
739 } 738 }
740 739
741 UsbOpenDeviceFunction::~UsbOpenDeviceFunction() { 740 UsbOpenDeviceFunction::~UsbOpenDeviceFunction() {
742 } 741 }
743 742
744 ExtensionFunction::ResponseAction UsbOpenDeviceFunction::Run() { 743 ExtensionFunction::ResponseAction UsbOpenDeviceFunction::Run() {
745 std::unique_ptr<extensions::api::usb::OpenDevice::Params> parameters = 744 std::unique_ptr<extensions::api::usb::OpenDevice::Params> parameters =
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 return RespondNow(Error(kErrorNoConnection)); 1270 return RespondNow(Error(kErrorNoConnection));
1272 } 1271 }
1273 1272
1274 device_handle->ResetDevice( 1273 device_handle->ResetDevice(
1275 base::Bind(&UsbResetDeviceFunction::OnComplete, this)); 1274 base::Bind(&UsbResetDeviceFunction::OnComplete, this));
1276 return RespondLater(); 1275 return RespondLater();
1277 } 1276 }
1278 1277
1279 void UsbResetDeviceFunction::OnComplete(bool success) { 1278 void UsbResetDeviceFunction::OnComplete(bool success) {
1280 if (success) { 1279 if (success) {
1281 Respond(OneArgument(base::MakeUnique<base::FundamentalValue>(true))); 1280 Respond(OneArgument(base::MakeUnique<base::Value>(true)));
1282 } else { 1281 } else {
1283 scoped_refptr<UsbDeviceHandle> device_handle = 1282 scoped_refptr<UsbDeviceHandle> device_handle =
1284 GetDeviceHandle(parameters_->handle); 1283 GetDeviceHandle(parameters_->handle);
1285 if (device_handle.get()) { 1284 if (device_handle.get()) {
1286 device_handle->Close(); 1285 device_handle->Close();
1287 } 1286 }
1288 ReleaseDeviceHandle(parameters_->handle); 1287 ReleaseDeviceHandle(parameters_->handle);
1289 1288
1290 std::unique_ptr<base::ListValue> error_args(new base::ListValue()); 1289 std::unique_ptr<base::ListValue> error_args(new base::ListValue());
1291 error_args->AppendBoolean(false); 1290 error_args->AppendBoolean(false);
1292 // Using ErrorWithArguments is discouraged but required to maintain 1291 // Using ErrorWithArguments is discouraged but required to maintain
1293 // compatibility with existing applications. 1292 // compatibility with existing applications.
1294 Respond(ErrorWithArguments(std::move(error_args), kErrorResetDevice)); 1293 Respond(ErrorWithArguments(std::move(error_args), kErrorResetDevice));
1295 } 1294 }
1296 } 1295 }
1297 1296
1298 } // namespace extensions 1297 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/system_display/system_display_api.cc ('k') | extensions/browser/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698