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

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

Issue 11440004: Remove deprecated extension EventRouter APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 // Convert state and description into SyncState Object 86 // Convert state and description into SyncState Object
87 api::sync_file_system::SyncState sync_state; 87 api::sync_file_system::SyncState sync_state;
88 sync_state.service_name = service_name_; 88 sync_state.service_name = service_name_;
89 sync_state.state = SyncServiceStateEnumToExtensionEnum(state); 89 sync_state.state = SyncServiceStateEnumToExtensionEnum(state);
90 sync_state.description = description; 90 sync_state.description = description;
91 scoped_ptr<base::ListValue> params( 91 scoped_ptr<base::ListValue> params(
92 api::sync_file_system::OnSyncStateChanged::Create(sync_state)); 92 api::sync_file_system::OnSyncStateChanged::Create(sync_state));
93 93
94 // Dispatch the event to the extension 94 // Dispatch the event to the extension
95 scoped_ptr<Event> event(new Event(
96 event_names::kOnSyncStateChanged, params.Pass()));
97 event->restrict_to_profile = profile_;
95 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( 98 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension(
96 extension_id, event_names::kOnSyncStateChanged, params.Pass(), 99 extension_id, event.Pass());
97 profile_, GURL());
98 } 100 }
99 101
100 void ExtensionSyncEventObserver::OnFileSynced( 102 void ExtensionSyncEventObserver::OnFileSynced(
101 const fileapi::FileSystemURL& url, 103 const fileapi::FileSystemURL& url,
102 fileapi::SyncOperationType operation) { 104 fileapi::SyncOperationType operation) {
103 const std::string extension_id = GetExtensionId(url.origin()); 105 const std::string extension_id = GetExtensionId(url.origin());
104 106
105 // TODO(calvinlo):Convert filePath from string to Webkit FileEntry. 107 // TODO(calvinlo):Convert filePath from string to Webkit FileEntry.
106 const api::sync_file_system::SyncOperationType sync_operation_type = 108 const api::sync_file_system::SyncOperationType sync_operation_type =
107 SyncOperationTypeToExtensionEnum(operation); 109 SyncOperationTypeToExtensionEnum(operation);
108 const std::string filePath = url.path().AsUTF8Unsafe(); 110 const std::string filePath = url.path().AsUTF8Unsafe();
109 scoped_ptr<base::ListValue> params( 111 scoped_ptr<base::ListValue> params(
110 api::sync_file_system::OnFileSynced::Create(filePath, 112 api::sync_file_system::OnFileSynced::Create(filePath,
111 sync_operation_type)); 113 sync_operation_type));
112 114
113 // Dispatch the event to the extension 115 // Dispatch the event to the extension
116 scoped_ptr<Event> event(new Event(
117 event_names::kOnFileSynced, params.Pass()));
118 event->restrict_to_profile = profile_;
114 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension( 119 ExtensionSystem::Get(profile_)->event_router()->DispatchEventToExtension(
115 extension_id, event_names::kOnFileSynced, params.Pass(), 120 extension_id, event.Pass());
116 profile_, GURL());
117 } 121 }
118 122
119 } // namespace extensions 123 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698