Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(514)

Side by Side Diff: chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.cc

Issue 11827026: Overhaul JSON Schema Compiler to support a number of features required to (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/event_names.h" 7 #include "chrome/browser/extensions/event_names.h"
8 #include "chrome/browser/extensions/event_router.h" 8 #include "chrome/browser/extensions/event_router.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_system.h" 10 #include "chrome/browser/extensions/extension_system.h"
11 #include "chrome/browser/sync_file_system/sync_event_observer.h" 11 #include "chrome/browser/sync_file_system/sync_event_observer.h"
12 #include "chrome/browser/sync_file_system/sync_file_system_service.h" 12 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
13 #include "chrome/common/extensions/api/sync_file_system.h" 13 #include "chrome/common/extensions/api/sync_file_system.h"
14 #include "webkit/fileapi/file_system_url.h" 14 #include "webkit/fileapi/file_system_url.h"
15 #include "webkit/fileapi/syncable/sync_operation_result.h" 15 #include "webkit/fileapi/syncable/sync_operation_result.h"
16 16
17 using sync_file_system::SyncEventObserver; 17 using sync_file_system::SyncEventObserver;
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 namespace { 21 namespace {
22 22
23 api::sync_file_system::SyncStateStatus SyncServiceStateEnumToExtensionEnum( 23 api::sync_file_system::SyncStateStatus SyncServiceStateEnumToExtensionEnum(
24 SyncEventObserver::SyncServiceState state) { 24 SyncEventObserver::SyncServiceState state) {
25 switch (state) { 25 switch (state) {
26 case SyncEventObserver::SYNC_SERVICE_RUNNING: 26 case SyncEventObserver::SYNC_SERVICE_RUNNING:
27 return api::sync_file_system::SYNC_FILE_SYSTEM_SYNC_STATE_STATUS_RUNNING; 27 return api::sync_file_system::SYNC_STATE_STATUS_RUNNING;
28 case SyncEventObserver::SYNC_SERVICE_AUTHENTICATION_REQUIRED: 28 case SyncEventObserver::SYNC_SERVICE_AUTHENTICATION_REQUIRED:
29 return api::sync_file_system:: 29 return api::sync_file_system::
30 SYNC_FILE_SYSTEM_SYNC_STATE_STATUS_AUTHENTICATION_REQUIRED; 30 SYNC_STATE_STATUS_AUTHENTICATION_REQUIRED;
31 case SyncEventObserver::SYNC_SERVICE_TEMPORARY_UNAVAILABLE: 31 case SyncEventObserver::SYNC_SERVICE_TEMPORARY_UNAVAILABLE:
32 return api::sync_file_system:: 32 return api::sync_file_system::
33 SYNC_FILE_SYSTEM_SYNC_STATE_STATUS_TEMPORARY_UNAVAILABLE; 33 SYNC_STATE_STATUS_TEMPORARY_UNAVAILABLE;
34 case SyncEventObserver::SYNC_SERVICE_DISABLED: 34 case SyncEventObserver::SYNC_SERVICE_DISABLED:
35 return api::sync_file_system::SYNC_FILE_SYSTEM_SYNC_STATE_STATUS_DISABLED; 35 return api::sync_file_system::SYNC_STATE_STATUS_DISABLED;
36 } 36 }
37 NOTREACHED(); 37 NOTREACHED();
38 return api::sync_file_system::SYNC_FILE_SYSTEM_SYNC_STATE_STATUS_NONE; 38 return api::sync_file_system::SYNC_STATE_STATUS_NONE;
39 } 39 }
40 40
41 api::sync_file_system::SyncOperationResult SyncOperationResultToExtensionEnum( 41 api::sync_file_system::SyncOperationResult SyncOperationResultToExtensionEnum(
42 fileapi::SyncOperationResult operation_result) { 42 fileapi::SyncOperationResult operation_result) {
43 switch (operation_result) { 43 switch (operation_result) {
44 case fileapi::SYNC_OPERATION_NONE: 44 case fileapi::SYNC_OPERATION_NONE:
45 return api::sync_file_system:: 45 return api::sync_file_system::
46 SYNC_FILE_SYSTEM_SYNC_OPERATION_RESULT_NONE; 46 SYNC_OPERATION_RESULT_NONE;
47 case fileapi::SYNC_OPERATION_ADDED: 47 case fileapi::SYNC_OPERATION_ADDED:
48 return api::sync_file_system:: 48 return api::sync_file_system::
49 SYNC_FILE_SYSTEM_SYNC_OPERATION_RESULT_ADDED; 49 SYNC_OPERATION_RESULT_ADDED;
50 case fileapi::SYNC_OPERATION_UPDATED: 50 case fileapi::SYNC_OPERATION_UPDATED:
51 return api::sync_file_system:: 51 return api::sync_file_system::
52 SYNC_FILE_SYSTEM_SYNC_OPERATION_RESULT_UPDATED; 52 SYNC_OPERATION_RESULT_UPDATED;
53 case fileapi::SYNC_OPERATION_DELETED: 53 case fileapi::SYNC_OPERATION_DELETED:
54 return api::sync_file_system:: 54 return api::sync_file_system::
55 SYNC_FILE_SYSTEM_SYNC_OPERATION_RESULT_DELETED; 55 SYNC_OPERATION_RESULT_DELETED;
56 case fileapi::SYNC_OPERATION_CONFLICTED: 56 case fileapi::SYNC_OPERATION_CONFLICTED:
57 return api::sync_file_system:: 57 return api::sync_file_system::
58 SYNC_FILE_SYSTEM_SYNC_OPERATION_RESULT_CONFLICTED; 58 SYNC_OPERATION_RESULT_CONFLICTED;
59 } 59 }
60 NOTREACHED(); 60 NOTREACHED();
61 return api::sync_file_system::SYNC_FILE_SYSTEM_SYNC_OPERATION_RESULT_NONE; 61 return api::sync_file_system::SYNC_OPERATION_RESULT_NONE;
62 } 62 }
63 63
64 } // namespace 64 } // namespace
65 65
66 ExtensionSyncEventObserver::ExtensionSyncEventObserver( 66 ExtensionSyncEventObserver::ExtensionSyncEventObserver(
67 Profile* profile) 67 Profile* profile)
68 : profile_(profile), 68 : profile_(profile),
69 sync_service_(NULL) {} 69 sync_service_(NULL) {}
70 70
71 void ExtensionSyncEventObserver::InitializeForService( 71 void ExtensionSyncEventObserver::InitializeForService(
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 event_router->BroadcastEvent(event.Pass()); 147 event_router->BroadcastEvent(event.Pass());
148 return; 148 return;
149 } 149 }
150 150
151 // Dispatch to single extension ID. 151 // Dispatch to single extension ID.
152 const std::string extension_id = GetExtensionId(app_origin); 152 const std::string extension_id = GetExtensionId(app_origin);
153 event_router->DispatchEventToExtension(extension_id, event.Pass()); 153 event_router->DispatchEventToExtension(extension_id, event.Pass());
154 } 154 }
155 155
156 } // namespace extensions 156 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698