| 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 "chrome/browser/extensions/api/system_storage/system_storage_api.h" | 5 #include "chrome/browser/extensions/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 22 matching lines...) Expand all Loading... |
| 33 SetError("Error occurred when querying storage information."); | 33 SetError("Error occurred when querying storage information."); |
| 34 } | 34 } |
| 35 | 35 |
| 36 SendResponse(success); | 36 SendResponse(success); |
| 37 } | 37 } |
| 38 | 38 |
| 39 SystemStorageEjectDeviceFunction::~SystemStorageEjectDeviceFunction() { | 39 SystemStorageEjectDeviceFunction::~SystemStorageEjectDeviceFunction() { |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool SystemStorageEjectDeviceFunction::RunImpl() { | 42 bool SystemStorageEjectDeviceFunction::RunImpl() { |
| 43 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 43 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 44 | 44 |
| 45 scoped_ptr<EjectDevice::Params> params(EjectDevice::Params::Create(*args_)); | 45 scoped_ptr<EjectDevice::Params> params(EjectDevice::Params::Create(*args_)); |
| 46 EXTENSION_FUNCTION_VALIDATE(params.get()); | 46 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 47 | 47 |
| 48 StorageMonitor::GetInstance()->EnsureInitialized(base::Bind( | 48 StorageMonitor::GetInstance()->EnsureInitialized(base::Bind( |
| 49 &SystemStorageEjectDeviceFunction::OnStorageMonitorInit, | 49 &SystemStorageEjectDeviceFunction::OnStorageMonitorInit, |
| 50 this, | 50 this, |
| 51 params->id)); | 51 params->id)); |
| 52 return true; | 52 return true; |
| 53 } | 53 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 SystemStorageGetAvailableCapacityFunction:: | 98 SystemStorageGetAvailableCapacityFunction:: |
| 99 SystemStorageGetAvailableCapacityFunction() { | 99 SystemStorageGetAvailableCapacityFunction() { |
| 100 } | 100 } |
| 101 | 101 |
| 102 SystemStorageGetAvailableCapacityFunction:: | 102 SystemStorageGetAvailableCapacityFunction:: |
| 103 ~SystemStorageGetAvailableCapacityFunction() { | 103 ~SystemStorageGetAvailableCapacityFunction() { |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool SystemStorageGetAvailableCapacityFunction::RunImpl() { | 106 bool SystemStorageGetAvailableCapacityFunction::RunImpl() { |
| 107 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 107 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 108 | 108 |
| 109 scoped_ptr<GetAvailableCapacity::Params> params( | 109 scoped_ptr<GetAvailableCapacity::Params> params( |
| 110 GetAvailableCapacity::Params::Create(*args_)); | 110 GetAvailableCapacity::Params::Create(*args_)); |
| 111 EXTENSION_FUNCTION_VALIDATE(params.get()); | 111 EXTENSION_FUNCTION_VALIDATE(params.get()); |
| 112 | 112 |
| 113 StorageMonitor::GetInstance()->EnsureInitialized(base::Bind( | 113 StorageMonitor::GetInstance()->EnsureInitialized(base::Bind( |
| 114 &SystemStorageGetAvailableCapacityFunction::OnStorageMonitorInit, | 114 &SystemStorageGetAvailableCapacityFunction::OnStorageMonitorInit, |
| 115 this, | 115 this, |
| 116 params->id)); | 116 params->id)); |
| 117 return true; | 117 return true; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 138 result.id = transient_id; | 138 result.id = transient_id; |
| 139 result.available_capacity = available_capacity; | 139 result.available_capacity = available_capacity; |
| 140 SetResult(result.ToValue().release()); | 140 SetResult(result.ToValue().release()); |
| 141 } else { | 141 } else { |
| 142 SetError("Error occurred when querying available capacity."); | 142 SetError("Error occurred when querying available capacity."); |
| 143 } | 143 } |
| 144 SendResponse(success); | 144 SendResponse(success); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace extensions | 147 } // namespace extensions |
| OLD | NEW |