| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_OBSE
RVER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_OBSE
RVER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_OBSE
RVER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_OBSE
RVER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 | 24 |
| 25 // Observes changes in SyncFileSystem and relays events to JS Extension API. | 25 // Observes changes in SyncFileSystem and relays events to JS Extension API. |
| 26 class ExtensionSyncEventObserver : public sync_file_system::SyncEventObserver, | 26 class ExtensionSyncEventObserver : public sync_file_system::SyncEventObserver, |
| 27 public BrowserContextKeyedAPI { | 27 public BrowserContextKeyedAPI { |
| 28 public: | 28 public: |
| 29 static BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver>* | 29 static BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver>* |
| 30 GetFactoryInstance(); | 30 GetFactoryInstance(); |
| 31 | 31 |
| 32 explicit ExtensionSyncEventObserver(content::BrowserContext* context); | 32 explicit ExtensionSyncEventObserver(content::BrowserContext* context); |
| 33 virtual ~ExtensionSyncEventObserver(); | 33 ~ExtensionSyncEventObserver() override; |
| 34 | 34 |
| 35 void InitializeForService( | 35 void InitializeForService( |
| 36 sync_file_system::SyncFileSystemService* sync_service); | 36 sync_file_system::SyncFileSystemService* sync_service); |
| 37 | 37 |
| 38 // KeyedService override. | 38 // KeyedService override. |
| 39 virtual void Shutdown() override; | 39 void Shutdown() override; |
| 40 | 40 |
| 41 // sync_file_system::SyncEventObserver interface implementation. | 41 // sync_file_system::SyncEventObserver interface implementation. |
| 42 virtual void OnSyncStateUpdated( | 42 void OnSyncStateUpdated(const GURL& app_origin, |
| 43 const GURL& app_origin, | 43 sync_file_system::SyncServiceState state, |
| 44 sync_file_system::SyncServiceState state, | 44 const std::string& description) override; |
| 45 const std::string& description) override; | |
| 46 | 45 |
| 47 virtual void OnFileSynced(const storage::FileSystemURL& url, | 46 void OnFileSynced(const storage::FileSystemURL& url, |
| 48 sync_file_system::SyncFileType file_type, | 47 sync_file_system::SyncFileType file_type, |
| 49 sync_file_system::SyncFileStatus status, | 48 sync_file_system::SyncFileStatus status, |
| 50 sync_file_system::SyncAction action, | 49 sync_file_system::SyncAction action, |
| 51 sync_file_system::SyncDirection direction) override; | 50 sync_file_system::SyncDirection direction) override; |
| 52 | 51 |
| 53 private: | 52 private: |
| 54 friend class BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver>; | 53 friend class BrowserContextKeyedAPIFactory<ExtensionSyncEventObserver>; |
| 55 | 54 |
| 56 // Returns an empty string if the extension |app_origin| cannot be found | 55 // Returns an empty string if the extension |app_origin| cannot be found |
| 57 // in the installed extension list. | 56 // in the installed extension list. |
| 58 std::string GetExtensionId(const GURL& app_origin); | 57 std::string GetExtensionId(const GURL& app_origin); |
| 59 | 58 |
| 60 // BrowserContextKeyedAPI implementation. | 59 // BrowserContextKeyedAPI implementation. |
| 61 static const char* service_name() { return "ExtensionSyncEventObserver"; } | 60 static const char* service_name() { return "ExtensionSyncEventObserver"; } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 73 DISALLOW_COPY_AND_ASSIGN(ExtensionSyncEventObserver); | 72 DISALLOW_COPY_AND_ASSIGN(ExtensionSyncEventObserver); |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 template <> | 75 template <> |
| 77 void BrowserContextKeyedAPIFactory< | 76 void BrowserContextKeyedAPIFactory< |
| 78 ExtensionSyncEventObserver>::DeclareFactoryDependencies(); | 77 ExtensionSyncEventObserver>::DeclareFactoryDependencies(); |
| 79 | 78 |
| 80 } // namespace extensions | 79 } // namespace extensions |
| 81 | 80 |
| 82 #endif // CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_O
BSERVER_H_ | 81 #endif // CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_O
BSERVER_H_ |
| OLD | NEW |