| OLD | NEW |
| 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 using storage_monitor::StorageMonitor; | 7 using storage_monitor::StorageMonitor; |
| 8 | 8 |
| 9 namespace extensions { | 9 namespace extensions { |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 SendResponse(success); | 35 SendResponse(success); |
| 36 } | 36 } |
| 37 | 37 |
| 38 SystemStorageEjectDeviceFunction::~SystemStorageEjectDeviceFunction() { | 38 SystemStorageEjectDeviceFunction::~SystemStorageEjectDeviceFunction() { |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool SystemStorageEjectDeviceFunction::RunAsync() { | 41 bool SystemStorageEjectDeviceFunction::RunAsync() { |
| 42 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 42 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 43 | 43 |
| 44 scoped_ptr<EjectDevice::Params> params(EjectDevice::Params::Create(*args_)); | 44 std::unique_ptr<EjectDevice::Params> params( |
| 45 EjectDevice::Params::Create(*args_)); |
| 45 EXTENSION_FUNCTION_VALIDATE(params.get()); | 46 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 46 | 47 |
| 47 StorageMonitor::GetInstance()->EnsureInitialized( | 48 StorageMonitor::GetInstance()->EnsureInitialized( |
| 48 base::Bind(&SystemStorageEjectDeviceFunction::OnStorageMonitorInit, | 49 base::Bind(&SystemStorageEjectDeviceFunction::OnStorageMonitorInit, |
| 49 this, | 50 this, |
| 50 params->id)); | 51 params->id)); |
| 51 return true; | 52 return true; |
| 52 } | 53 } |
| 53 | 54 |
| 54 void SystemStorageEjectDeviceFunction::OnStorageMonitorInit( | 55 void SystemStorageEjectDeviceFunction::OnStorageMonitorInit( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 SystemStorageGetAvailableCapacityFunction() { | 96 SystemStorageGetAvailableCapacityFunction() { |
| 96 } | 97 } |
| 97 | 98 |
| 98 SystemStorageGetAvailableCapacityFunction:: | 99 SystemStorageGetAvailableCapacityFunction:: |
| 99 ~SystemStorageGetAvailableCapacityFunction() { | 100 ~SystemStorageGetAvailableCapacityFunction() { |
| 100 } | 101 } |
| 101 | 102 |
| 102 bool SystemStorageGetAvailableCapacityFunction::RunAsync() { | 103 bool SystemStorageGetAvailableCapacityFunction::RunAsync() { |
| 103 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 104 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 104 | 105 |
| 105 scoped_ptr<GetAvailableCapacity::Params> params( | 106 std::unique_ptr<GetAvailableCapacity::Params> params( |
| 106 GetAvailableCapacity::Params::Create(*args_)); | 107 GetAvailableCapacity::Params::Create(*args_)); |
| 107 EXTENSION_FUNCTION_VALIDATE(params.get()); | 108 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 108 | 109 |
| 109 StorageMonitor::GetInstance()->EnsureInitialized(base::Bind( | 110 StorageMonitor::GetInstance()->EnsureInitialized(base::Bind( |
| 110 &SystemStorageGetAvailableCapacityFunction::OnStorageMonitorInit, | 111 &SystemStorageGetAvailableCapacityFunction::OnStorageMonitorInit, |
| 111 this, | 112 this, |
| 112 params->id)); | 113 params->id)); |
| 113 return true; | 114 return true; |
| 114 } | 115 } |
| 115 | 116 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 136 result.id = transient_id; | 137 result.id = transient_id; |
| 137 result.available_capacity = available_capacity; | 138 result.available_capacity = available_capacity; |
| 138 SetResult(result.ToValue().release()); | 139 SetResult(result.ToValue().release()); |
| 139 } else { | 140 } else { |
| 140 SetError("Error occurred when querying available capacity."); | 141 SetError("Error occurred when querying available capacity."); |
| 141 } | 142 } |
| 142 SendResponse(success); | 143 SendResponse(success); |
| 143 } | 144 } |
| 144 | 145 |
| 145 } // namespace extensions | 146 } // namespace extensions |
| OLD | NEW |