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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 181 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
182 BrowserThread::PostTask( | 182 BrowserThread::PostTask( |
183 BrowserThread::UI, | 183 BrowserThread::UI, |
184 FROM_HERE, | 184 FROM_HERE, |
185 Bind(&SyncFileSystemGetUsageAndQuotaFunction::DidGetUsageAndQuota, this, | 185 Bind(&SyncFileSystemGetUsageAndQuotaFunction::DidGetUsageAndQuota, this, |
186 status, usage, quota)); | 186 status, usage, quota)); |
187 return; | 187 return; |
188 } | 188 } |
189 | 189 |
190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
191 // TODO(calvinlo): Convert QuotaStatusCode to error string | |
192 // (http://crbug.com/156791). | |
193 if (status != quota::kQuotaStatusOk) { | 191 if (status != quota::kQuotaStatusOk) { |
194 error_ = base::StringPrintf(kQuotaError, static_cast<int>(status)); | 192 error_ = QuotaStatusCodeToString(status); |
195 SendResponse(false); | 193 SendResponse(false); |
196 return; | 194 return; |
197 } | 195 } |
198 | 196 |
199 api::sync_file_system::StorageInfo info; | 197 api::sync_file_system::StorageInfo info; |
200 info.usage_bytes = usage; | 198 info.usage_bytes = usage; |
201 info.quota_bytes = quota; | 199 info.quota_bytes = quota; |
202 results_ = api::sync_file_system::GetUsageAndQuota::Results::Create(info); | 200 results_ = api::sync_file_system::GetUsageAndQuota::Results::Create(info); |
203 SendResponse(true); | 201 SendResponse(true); |
204 } | 202 } |
205 | 203 |
206 } // namespace extensions | 204 } // namespace extensions |
OLD | NEW |