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

Side by Side Diff: chrome/browser/extensions/app_sync_bundle.h

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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_APP_SYNC_BUNDLE_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_APP_SYNC_BUNDLE_H_
6 #define CHROME_BROWSER_EXTENSIONS_APP_SYNC_BUNDLE_H_ 6 #define CHROME_BROWSER_EXTENSIONS_APP_SYNC_BUNDLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/basictypes.h" 14 #include "base/basictypes.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "chrome/browser/extensions/app_sync_data.h" 16 #include "chrome/browser/extensions/app_sync_data.h"
17 #include "sync/api/syncable_service.h" 17 #include "sync/api/syncable_service.h"
18 18
19 class ExtensionService; 19 class ExtensionService;
20 class ExtensionSet; 20 class ExtensionSet;
21 21
22 namespace csync { 22 namespace syncer {
23 class SyncChangeProcessor; 23 class SyncChangeProcessor;
24 class SyncErrorFactory; 24 class SyncErrorFactory;
25 } 25 }
26 26
27 namespace extensions { 27 namespace extensions {
28 28
29 class Extension; 29 class Extension;
30 30
31 // Bundle of app specific sync stuff. 31 // Bundle of app specific sync stuff.
32 class AppSyncBundle { 32 class AppSyncBundle {
33 public: 33 public:
34 explicit AppSyncBundle(ExtensionService* extension_service); 34 explicit AppSyncBundle(ExtensionService* extension_service);
35 virtual ~AppSyncBundle(); 35 virtual ~AppSyncBundle();
36 36
37 // Setup this bundle to be sync application data. 37 // Setup this bundle to be sync application data.
38 void SetupSync(csync::SyncChangeProcessor* sync_proccessor, 38 void SetupSync(syncer::SyncChangeProcessor* sync_proccessor,
39 csync::SyncErrorFactory* sync_error_factory, 39 syncer::SyncErrorFactory* sync_error_factory,
40 const csync::SyncDataList& initial_sync_data); 40 const syncer::SyncDataList& initial_sync_data);
41 41
42 // Resets this class back to it default values, which will disable all syncing 42 // Resets this class back to it default values, which will disable all syncing
43 // until a new sync processor is set. 43 // until a new sync processor is set.
44 void Reset(); 44 void Reset();
45 45
46 // Returns a csync::SyncChange that will delete the given application. 46 // Returns a syncer::SyncChange that will delete the given application.
47 csync::SyncChange CreateSyncChangeToDelete(const Extension* extension) const; 47 syncer::SyncChange CreateSyncChangeToDelete(const Extension* extension) const;
48 48
49 // Process the sync deletion of the given application. 49 // Process the sync deletion of the given application.
50 void ProcessDeletion( 50 void ProcessDeletion(
51 std::string extension_id, const csync::SyncChange& sync_change); 51 std::string extension_id, const syncer::SyncChange& sync_change);
52 52
53 // Create a sync change based on |sync_data|. 53 // Create a sync change based on |sync_data|.
54 csync::SyncChange CreateSyncChange(const csync::SyncData& sync_data); 54 syncer::SyncChange CreateSyncChange(const syncer::SyncData& sync_data);
55 55
56 // Get all the sync data contained in this bundle. 56 // Get all the sync data contained in this bundle.
57 csync::SyncDataList GetAllSyncData() const; 57 syncer::SyncDataList GetAllSyncData() const;
58 58
59 // Sync a newly-installed application or change an existing one. 59 // Sync a newly-installed application or change an existing one.
60 void SyncChangeIfNeeded(const Extension& extension); 60 void SyncChangeIfNeeded(const Extension& extension);
61 61
62 // Process the given sync change and apply it. 62 // Process the given sync change and apply it.
63 void ProcessSyncChange(AppSyncData app_sync_data); 63 void ProcessSyncChange(AppSyncData app_sync_data);
64 64
65 // Process the list of sync changes. 65 // Process the list of sync changes.
66 void ProcessSyncChangeList(csync::SyncChangeList sync_change_list); 66 void ProcessSyncChangeList(syncer::SyncChangeList sync_change_list);
67 67
68 // Check to see if the given |id| is either synced or pending to be synced. 68 // Check to see if the given |id| is either synced or pending to be synced.
69 bool HasExtensionId(const std::string& id) const; 69 bool HasExtensionId(const std::string& id) const;
70 bool HasPendingExtensionId(const std::string& id) const; 70 bool HasPendingExtensionId(const std::string& id) const;
71 71
72 // Add a pending app to be synced. 72 // Add a pending app to be synced.
73 void AddPendingApp(const std::string& id, 73 void AddPendingApp(const std::string& id,
74 const AppSyncData& app_sync_data); 74 const AppSyncData& app_sync_data);
75 75
76 // Returns true if |extension| should be handled by this sync bundle. 76 // Returns true if |extension| should be handled by this sync bundle.
(...skipping 11 matching lines...) Expand all
88 // Add a synced app. 88 // Add a synced app.
89 void AddApp(const std::string& id); 89 void AddApp(const std::string& id);
90 90
91 // Remove a synced app. 91 // Remove a synced app.
92 void RemoveApp(const std::string& id); // make private 92 void RemoveApp(const std::string& id); // make private
93 93
94 // Change an app from being pending to synced. 94 // Change an app from being pending to synced.
95 void MarkPendingAppSynced(const std::string& id); 95 void MarkPendingAppSynced(const std::string& id);
96 96
97 ExtensionService* extension_service_; // Own us. 97 ExtensionService* extension_service_; // Own us.
98 scoped_ptr<csync::SyncChangeProcessor> sync_processor_; 98 scoped_ptr<syncer::SyncChangeProcessor> sync_processor_;
99 scoped_ptr<csync::SyncErrorFactory> sync_error_factory_; 99 scoped_ptr<syncer::SyncErrorFactory> sync_error_factory_;
100 100
101 std::set<std::string> synced_apps_; 101 std::set<std::string> synced_apps_;
102 std::map<std::string, AppSyncData> pending_sync_data_; 102 std::map<std::string, AppSyncData> pending_sync_data_;
103 103
104 DISALLOW_COPY_AND_ASSIGN(AppSyncBundle); 104 DISALLOW_COPY_AND_ASSIGN(AppSyncBundle);
105 }; 105 };
106 106
107 } // namespace extensions 107 } // namespace extensions
108 108
109 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_BUNDLE_H_ 109 #endif // CHROME_BROWSER_EXTENSIONS_APP_SYNC_BUNDLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_notification_manager_sync_unittest.cc ('k') | chrome/browser/extensions/app_sync_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698