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 29 matching lines...) Expand all Loading... |
40 | 40 |
41 // Error messages. | 41 // Error messages. |
42 const char kNotSupportedService[] = "Cloud service %s not supported."; | 42 const char kNotSupportedService[] = "Cloud service %s not supported."; |
43 const char kFileError[] = "File error %d."; | 43 const char kFileError[] = "File error %d."; |
44 const char kQuotaError[] = "Quota error %d."; | 44 const char kQuotaError[] = "Quota error %d."; |
45 | 45 |
46 api::sync_file_system::FileSyncStatus FileSyncStatusEnumToExtensionEnum( | 46 api::sync_file_system::FileSyncStatus FileSyncStatusEnumToExtensionEnum( |
47 const fileapi::SyncFileStatus state) { | 47 const fileapi::SyncFileStatus state) { |
48 switch (state) { | 48 switch (state) { |
49 case fileapi::SYNC_FILE_STATUS_UNKNOWN: | 49 case fileapi::SYNC_FILE_STATUS_UNKNOWN: |
50 return api::sync_file_system::SYNC_FILE_SYSTEM_FILE_SYNC_STATUS_NONE; | 50 return api::sync_file_system::FILE_SYNC_STATUS_NONE; |
51 case fileapi::SYNC_FILE_STATUS_SYNCED: | 51 case fileapi::SYNC_FILE_STATUS_SYNCED: |
52 return api::sync_file_system::SYNC_FILE_SYSTEM_FILE_SYNC_STATUS_SYNCED; | 52 return api::sync_file_system::FILE_SYNC_STATUS_SYNCED; |
53 case fileapi::SYNC_FILE_STATUS_HAS_PENDING_CHANGES: | 53 case fileapi::SYNC_FILE_STATUS_HAS_PENDING_CHANGES: |
54 return api::sync_file_system::SYNC_FILE_SYSTEM_FILE_SYNC_STATUS_PENDING; | 54 return api::sync_file_system::FILE_SYNC_STATUS_PENDING; |
55 case fileapi::SYNC_FILE_STATUS_CONFLICTING: | 55 case fileapi::SYNC_FILE_STATUS_CONFLICTING: |
56 return api::sync_file_system:: | 56 return api::sync_file_system:: |
57 SYNC_FILE_SYSTEM_FILE_SYNC_STATUS_CONFLICTING; | 57 FILE_SYNC_STATUS_CONFLICTING; |
58 } | 58 } |
59 NOTREACHED(); | 59 NOTREACHED(); |
60 return api::sync_file_system::SYNC_FILE_SYSTEM_FILE_SYNC_STATUS_NONE; | 60 return api::sync_file_system::FILE_SYNC_STATUS_NONE; |
61 } | 61 } |
62 | 62 |
63 sync_file_system::SyncFileSystemService* GetSyncFileSystemService( | 63 sync_file_system::SyncFileSystemService* GetSyncFileSystemService( |
64 Profile* profile) { | 64 Profile* profile) { |
65 sync_file_system::SyncFileSystemService* service = | 65 sync_file_system::SyncFileSystemService* service = |
66 SyncFileSystemServiceFactory::GetForProfile(profile); | 66 SyncFileSystemServiceFactory::GetForProfile(profile); |
67 DCHECK(service); | 67 DCHECK(service); |
68 ExtensionSyncEventObserver* observer = | 68 ExtensionSyncEventObserver* observer = |
69 ExtensionSyncEventObserverFactory::GetForProfile(profile); | 69 ExtensionSyncEventObserverFactory::GetForProfile(profile); |
70 DCHECK(observer); | 70 DCHECK(observer); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 } | 292 } |
293 | 293 |
294 api::sync_file_system::StorageInfo info; | 294 api::sync_file_system::StorageInfo info; |
295 info.usage_bytes = usage; | 295 info.usage_bytes = usage; |
296 info.quota_bytes = quota; | 296 info.quota_bytes = quota; |
297 results_ = api::sync_file_system::GetUsageAndQuota::Results::Create(info); | 297 results_ = api::sync_file_system::GetUsageAndQuota::Results::Create(info); |
298 SendResponse(true); | 298 SendResponse(true); |
299 } | 299 } |
300 | 300 |
301 } // namespace extensions | 301 } // namespace extensions |
OLD | NEW |