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

Side by Side Diff: extensions/browser/api/system_storage/system_storage_api.cc

Issue 1991083002: Remove ExtensionFunction::SetResult(T*) overload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU Created 4 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/system_storage/system_storage_api.h" 5 #include "extensions/browser/api/system_storage/system_storage_api.h"
6 6
7 #include "base/memory/ptr_util.h"
8
7 using storage_monitor::StorageMonitor; 9 using storage_monitor::StorageMonitor;
8 10
9 namespace extensions { 11 namespace extensions {
10 12
11 using api::system_storage::StorageUnitInfo; 13 using api::system_storage::StorageUnitInfo;
12 namespace EjectDevice = api::system_storage::EjectDevice; 14 namespace EjectDevice = api::system_storage::EjectDevice;
13 namespace GetAvailableCapacity = api::system_storage::GetAvailableCapacity; 15 namespace GetAvailableCapacity = api::system_storage::GetAvailableCapacity;
14 16
15 SystemStorageGetInfoFunction::SystemStorageGetInfoFunction() { 17 SystemStorageGetInfoFunction::SystemStorageGetInfoFunction() {
16 } 18 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 case StorageMonitor::EJECT_IN_USE: 83 case StorageMonitor::EJECT_IN_USE:
82 result = api::system_storage::EJECT_DEVICE_RESULT_CODE_IN_USE; 84 result = api::system_storage::EJECT_DEVICE_RESULT_CODE_IN_USE;
83 break; 85 break;
84 case StorageMonitor::EJECT_NO_SUCH_DEVICE: 86 case StorageMonitor::EJECT_NO_SUCH_DEVICE:
85 result = api::system_storage::EJECT_DEVICE_RESULT_CODE_NO_SUCH_DEVICE; 87 result = api::system_storage::EJECT_DEVICE_RESULT_CODE_NO_SUCH_DEVICE;
86 break; 88 break;
87 case StorageMonitor::EJECT_FAILURE: 89 case StorageMonitor::EJECT_FAILURE:
88 result = api::system_storage::EJECT_DEVICE_RESULT_CODE_FAILURE; 90 result = api::system_storage::EJECT_DEVICE_RESULT_CODE_FAILURE;
89 } 91 }
90 92
91 SetResult(new base::StringValue(api::system_storage::ToString(result))); 93 SetResult(base::MakeUnique<base::StringValue>(
94 api::system_storage::ToString(result)));
92 SendResponse(true); 95 SendResponse(true);
93 } 96 }
94 97
95 SystemStorageGetAvailableCapacityFunction:: 98 SystemStorageGetAvailableCapacityFunction::
96 SystemStorageGetAvailableCapacityFunction() { 99 SystemStorageGetAvailableCapacityFunction() {
97 } 100 }
98 101
99 SystemStorageGetAvailableCapacityFunction:: 102 SystemStorageGetAvailableCapacityFunction::
100 ~SystemStorageGetAvailableCapacityFunction() { 103 ~SystemStorageGetAvailableCapacityFunction() {
101 } 104 }
(...skipping 27 matching lines...) Expand all
129 } 132 }
130 133
131 void SystemStorageGetAvailableCapacityFunction::OnQueryCompleted( 134 void SystemStorageGetAvailableCapacityFunction::OnQueryCompleted(
132 const std::string& transient_id, 135 const std::string& transient_id,
133 double available_capacity) { 136 double available_capacity) {
134 bool success = available_capacity >= 0; 137 bool success = available_capacity >= 0;
135 if (success) { 138 if (success) {
136 api::system_storage::StorageAvailableCapacityInfo result; 139 api::system_storage::StorageAvailableCapacityInfo result;
137 result.id = transient_id; 140 result.id = transient_id;
138 result.available_capacity = available_capacity; 141 result.available_capacity = available_capacity;
139 SetResult(result.ToValue().release()); 142 SetResult(result.ToValue());
140 } else { 143 } else {
141 SetError("Error occurred when querying available capacity."); 144 SetError("Error occurred when querying available capacity.");
142 } 145 }
143 SendResponse(success); 146 SendResponse(success);
144 } 147 }
145 148
146 } // namespace extensions 149 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698