| 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/extension_sync_event_ob
server.h" | 5 #include "chrome/browser/extensions/api/sync_file_system/extension_sync_event_ob
server.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/sync_file_system/sync_file_system_api_he
lpers.h" | 7 #include "chrome/browser/extensions/api/sync_file_system/sync_file_system_api_he
lpers.h" |
| 8 #include "chrome/browser/extensions/event_names.h" | 8 #include "chrome/browser/extensions/event_names.h" |
| 9 #include "chrome/browser/extensions/event_router.h" | 9 #include "chrome/browser/extensions/event_router.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 BroadcastOrDispatchEvent(app_origin, | 68 BroadcastOrDispatchEvent(app_origin, |
| 69 event_names::kOnServiceStatusChanged, | 69 event_names::kOnServiceStatusChanged, |
| 70 params.Pass()); | 70 params.Pass()); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void ExtensionSyncEventObserver::OnFileSynced( | 73 void ExtensionSyncEventObserver::OnFileSynced( |
| 74 const fileapi::FileSystemURL& url, | 74 const fileapi::FileSystemURL& url, |
| 75 sync_file_system::SyncFileStatus status, | 75 sync_file_system::SyncFileStatus status, |
| 76 sync_file_system::SyncAction action, | 76 sync_file_system::SyncAction action, |
| 77 sync_file_system::SyncDirection direction) { | 77 sync_file_system::SyncDirection direction) { |
| 78 scoped_ptr<base::ListValue> params(new ListValue()); | 78 scoped_ptr<base::ListValue> params(new base::ListValue()); |
| 79 | 79 |
| 80 // For now we always assume events come only for files (not directories). | 80 // For now we always assume events come only for files (not directories). |
| 81 params->Append(CreateDictionaryValueForFileSystemEntry( | 81 params->Append(CreateDictionaryValueForFileSystemEntry( |
| 82 url, sync_file_system::SYNC_FILE_TYPE_FILE)); | 82 url, sync_file_system::SYNC_FILE_TYPE_FILE)); |
| 83 | 83 |
| 84 // Status, SyncAction and any optional notes to go here. | 84 // Status, SyncAction and any optional notes to go here. |
| 85 api::sync_file_system::FileStatus status_enum = | 85 api::sync_file_system::FileStatus status_enum = |
| 86 SyncFileStatusToExtensionEnum(status); | 86 SyncFileStatusToExtensionEnum(status); |
| 87 api::sync_file_system::SyncAction action_enum = | 87 api::sync_file_system::SyncAction action_enum = |
| 88 SyncActionToExtensionEnum(action); | 88 SyncActionToExtensionEnum(action); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Dispatch to single extension ID. | 119 // Dispatch to single extension ID. |
| 120 const std::string extension_id = GetExtensionId(app_origin); | 120 const std::string extension_id = GetExtensionId(app_origin); |
| 121 if (extension_id.empty()) | 121 if (extension_id.empty()) |
| 122 return; | 122 return; |
| 123 event_router->DispatchEventToExtension(extension_id, event.Pass()); | 123 event_router->DispatchEventToExtension(extension_id, event.Pass()); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace extensions | 126 } // namespace extensions |
| OLD | NEW |