OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/sync_file_system/sync_file_system_api.h" | 5 #include "chrome/browser/extensions/api/sync_file_system/sync_file_system_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 139 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
140 BrowserThread::PostTask( | 140 BrowserThread::PostTask( |
141 BrowserThread::UI, | 141 BrowserThread::UI, |
142 FROM_HERE, | 142 FROM_HERE, |
143 Bind(&SyncFileSystemGetUsageAndQuotaFunction::DidGetUsageAndQuota, this, | 143 Bind(&SyncFileSystemGetUsageAndQuotaFunction::DidGetUsageAndQuota, this, |
144 status, usage, quota)); | 144 status, usage, quota)); |
145 return; | 145 return; |
146 } | 146 } |
147 | 147 |
148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 148 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
149 // TODO(calvinlo): Convert QuotaStatusCode to error string | |
150 // (http://crbug.com/156791). | |
151 if (status != quota::kQuotaStatusOk) { | 149 if (status != quota::kQuotaStatusOk) { |
152 error_ = base::StringPrintf(kQuotaError, static_cast<int>(status)); | 150 error_ = QuotaStatusCodeToString(status); |
153 SendResponse(false); | 151 SendResponse(false); |
154 return; | 152 return; |
155 } | 153 } |
156 | 154 |
157 api::sync_file_system::StorageInfo info; | 155 api::sync_file_system::StorageInfo info; |
158 info.usage_bytes = usage; | 156 info.usage_bytes = usage; |
159 info.quota_bytes = quota; | 157 info.quota_bytes = quota; |
160 results_ = api::sync_file_system::GetUsageAndQuota::Results::Create(info); | 158 results_ = api::sync_file_system::GetUsageAndQuota::Results::Create(info); |
161 SendResponse(true); | 159 SendResponse(true); |
162 } | 160 } |
163 | 161 |
164 } // namespace extensions | 162 } // namespace extensions |
OLD | NEW |