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

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

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 | « extensions/browser/api/storage/storage_api.cc ('k') | extensions/browser/extension_prefs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 UsbRequestAccessFunction::UsbRequestAccessFunction() { 730 UsbRequestAccessFunction::UsbRequestAccessFunction() {
731 } 731 }
732 732
733 UsbRequestAccessFunction::~UsbRequestAccessFunction() { 733 UsbRequestAccessFunction::~UsbRequestAccessFunction() {
734 } 734 }
735 735
736 ExtensionFunction::ResponseAction UsbRequestAccessFunction::Run() { 736 ExtensionFunction::ResponseAction UsbRequestAccessFunction::Run() {
737 std::unique_ptr<extensions::api::usb::RequestAccess::Params> parameters = 737 std::unique_ptr<extensions::api::usb::RequestAccess::Params> parameters =
738 RequestAccess::Params::Create(*args_); 738 RequestAccess::Params::Create(*args_);
739 EXTENSION_FUNCTION_VALIDATE(parameters.get()); 739 EXTENSION_FUNCTION_VALIDATE(parameters.get());
740 return RespondNow( 740 return RespondNow(OneArgument(base::MakeUnique<base::Value>(true)));
741 OneArgument(base::MakeUnique<base::FundamentalValue>(true)));
742 } 741 }
743 742
744 UsbOpenDeviceFunction::UsbOpenDeviceFunction() { 743 UsbOpenDeviceFunction::UsbOpenDeviceFunction() {
745 } 744 }
746 745
747 UsbOpenDeviceFunction::~UsbOpenDeviceFunction() { 746 UsbOpenDeviceFunction::~UsbOpenDeviceFunction() {
748 } 747 }
749 748
750 ExtensionFunction::ResponseAction UsbOpenDeviceFunction::Run() { 749 ExtensionFunction::ResponseAction UsbOpenDeviceFunction::Run() {
751 std::unique_ptr<extensions::api::usb::OpenDevice::Params> parameters = 750 std::unique_ptr<extensions::api::usb::OpenDevice::Params> parameters =
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
1277 return RespondNow(Error(kErrorNoConnection)); 1276 return RespondNow(Error(kErrorNoConnection));
1278 } 1277 }
1279 1278
1280 device_handle->ResetDevice( 1279 device_handle->ResetDevice(
1281 base::Bind(&UsbResetDeviceFunction::OnComplete, this)); 1280 base::Bind(&UsbResetDeviceFunction::OnComplete, this));
1282 return RespondLater(); 1281 return RespondLater();
1283 } 1282 }
1284 1283
1285 void UsbResetDeviceFunction::OnComplete(bool success) { 1284 void UsbResetDeviceFunction::OnComplete(bool success) {
1286 if (success) { 1285 if (success) {
1287 Respond(OneArgument(base::MakeUnique<base::FundamentalValue>(true))); 1286 Respond(OneArgument(base::MakeUnique<base::Value>(true)));
1288 } else { 1287 } else {
1289 scoped_refptr<UsbDeviceHandle> device_handle = 1288 scoped_refptr<UsbDeviceHandle> device_handle =
1290 GetDeviceHandle(parameters_->handle); 1289 GetDeviceHandle(parameters_->handle);
1291 if (device_handle.get()) { 1290 if (device_handle.get()) {
1292 device_handle->Close(); 1291 device_handle->Close();
1293 } 1292 }
1294 ReleaseDeviceHandle(parameters_->handle); 1293 ReleaseDeviceHandle(parameters_->handle);
1295 1294
1296 std::unique_ptr<base::ListValue> error_args(new base::ListValue()); 1295 std::unique_ptr<base::ListValue> error_args(new base::ListValue());
1297 error_args->AppendBoolean(false); 1296 error_args->AppendBoolean(false);
1298 // Using ErrorWithArguments is discouraged but required to maintain 1297 // Using ErrorWithArguments is discouraged but required to maintain
1299 // compatibility with existing applications. 1298 // compatibility with existing applications.
1300 Respond(ErrorWithArguments(std::move(error_args), kErrorResetDevice)); 1299 Respond(ErrorWithArguments(std::move(error_args), kErrorResetDevice));
1301 } 1300 }
1302 } 1301 }
1303 1302
1304 } // namespace extensions 1303 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/storage/storage_api.cc ('k') | extensions/browser/extension_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698