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

Unified Diff: chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h

Issue 11316133: Added implementation of SyncEventObserver to route events to Javascript Extension. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Kinuko Review #4 Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h
diff --git a/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..1942f71844af61e1b297dc9bd3d2ff6529889a64
--- /dev/null
+++ b/chrome/browser/extensions/api/sync_file_system/extension_sync_event_observer.h
@@ -0,0 +1,43 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_OBSERVER_
+#define CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_OBSERVER_
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "chrome/browser/sync_file_system/sync_event_observer.h"
+
+class Profile;
+
+namespace extensions {
+
+// Observes changes in SyncFileSystem and relays events to JS Extension API.
+class ExtensionSyncEventObserver
+ : public sync_file_system::SyncEventObserver {
+ public:
+ ExtensionSyncEventObserver(Profile* profile,
+ const std::string& service_name);
+ ~ExtensionSyncEventObserver();
+
+ virtual void OnSyncStateUpdated(
+ const GURL& app_origin,
+ sync_file_system::SyncEventObserver::SyncServiceState state,
+ const std::string& description) OVERRIDE;
+
+ virtual void OnFileSynced(fileapi::SyncOperationType operation,
+ const fileapi::FileSystemURL& url) OVERRIDE;
+
+ private:
+ Profile* profile_;
benwells 2012/11/29 04:37:58 Nit: Fields should go after functions.
calvinlo 2012/11/29 05:01:22 Done.
+ const std::string service_name_;
+
+ const std::string& GetExtensionId(const GURL& app_origin);
+
+ DISALLOW_COPY_AND_ASSIGN(ExtensionSyncEventObserver);
+};
+
+} // namespace extensions
+
+#endif // #ifndef CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_OBSERVER_

Powered by Google App Engine
This is Rietveld 408576698