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

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

Issue 16109008: Cleanup: Deprecate DriveFileSyncService::kServiceName (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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 #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 11 matching lines...) Expand all
22 22
23 // Observes changes in SyncFileSystem and relays events to JS Extension API. 23 // Observes changes in SyncFileSystem and relays events to JS Extension API.
24 class ExtensionSyncEventObserver 24 class ExtensionSyncEventObserver
25 : public sync_file_system::SyncEventObserver, 25 : public sync_file_system::SyncEventObserver,
26 public BrowserContextKeyedService { 26 public BrowserContextKeyedService {
27 public: 27 public:
28 explicit ExtensionSyncEventObserver(Profile* profile); 28 explicit ExtensionSyncEventObserver(Profile* profile);
29 virtual ~ExtensionSyncEventObserver(); 29 virtual ~ExtensionSyncEventObserver();
30 30
31 void InitializeForService( 31 void InitializeForService(
32 sync_file_system::SyncFileSystemService* sync_service, 32 sync_file_system::SyncFileSystemService* sync_service);
33 const std::string& service_name);
34 33
35 // BrowserContextKeyedService override. 34 // BrowserContextKeyedService override.
36 virtual void Shutdown() OVERRIDE; 35 virtual void Shutdown() OVERRIDE;
37 36
38 // sync_file_system::SyncEventObserver interface implementation. 37 // sync_file_system::SyncEventObserver interface implementation.
39 virtual void OnSyncStateUpdated( 38 virtual void OnSyncStateUpdated(
40 const GURL& app_origin, 39 const GURL& app_origin,
41 sync_file_system::SyncServiceState state, 40 sync_file_system::SyncServiceState state,
42 const std::string& description) OVERRIDE; 41 const std::string& description) OVERRIDE;
43 42
44 virtual void OnFileSynced( 43 virtual void OnFileSynced(
45 const fileapi::FileSystemURL& url, 44 const fileapi::FileSystemURL& url,
46 sync_file_system::SyncFileStatus status, 45 sync_file_system::SyncFileStatus status,
47 sync_file_system::SyncAction action, 46 sync_file_system::SyncAction action,
48 sync_file_system::SyncDirection direction) OVERRIDE; 47 sync_file_system::SyncDirection direction) OVERRIDE;
49 48
50 private: 49 private:
51 // Returns an empty string if the extension |app_origin| cannot be found 50 // Returns an empty string if the extension |app_origin| cannot be found
52 // in the installed extension list. 51 // in the installed extension list.
53 std::string GetExtensionId(const GURL& app_origin); 52 std::string GetExtensionId(const GURL& app_origin);
54 53
55 Profile* profile_; 54 Profile* profile_;
56 55
57 // Not owned. If not null, then this is registered to SyncFileSystemService. 56 // Not owned. If not null, then this is registered to SyncFileSystemService.
58 sync_file_system::SyncFileSystemService* sync_service_; 57 sync_file_system::SyncFileSystemService* sync_service_;
59 std::string service_name_;
60 58
61 void BroadcastOrDispatchEvent(const GURL& app_origin, 59 void BroadcastOrDispatchEvent(const GURL& app_origin,
62 const std::string& event_name, 60 const std::string& event_name,
63 scoped_ptr<base::ListValue> value); 61 scoped_ptr<base::ListValue> value);
64 62
65 DISALLOW_COPY_AND_ASSIGN(ExtensionSyncEventObserver); 63 DISALLOW_COPY_AND_ASSIGN(ExtensionSyncEventObserver);
66 }; 64 };
67 65
68 } // namespace extensions 66 } // namespace extensions
69 67
70 #endif // CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_O BSERVER_H_ 68 #endif // CHROME_BROWSER_EXTENSIONS_API_SYNC_FILE_SYSTEM_EXTENSION_SYNC_EVENT_O BSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698