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_THEMES_THEME_SYNCABLE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_THEMES_THEME_SYNCABLE_SERVICE_H_ |
6 #define CHROME_BROWSER_THEMES_THEME_SYNCABLE_SERVICE_H_ | 6 #define CHROME_BROWSER_THEMES_THEME_SYNCABLE_SERVICE_H_ |
7 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/threading/thread_checker.h" | 9 #include "base/threading/thread_checker.h" |
10 #include "sync/api/sync_change.h" | 10 #include "sync/api/sync_change.h" |
11 #include "sync/api/sync_data.h" | 11 #include "sync/api/sync_data.h" |
12 #include "sync/api/sync_error_factory.h" | 12 #include "sync/api/sync_error_factory.h" |
13 #include "sync/api/sync_error.h" | 13 #include "sync/api/sync_error.h" |
14 #include "sync/api/syncable_service.h" | 14 #include "sync/api/syncable_service.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 class ThemeService; | 17 class ThemeService; |
18 class ThemeSyncableServiceTest; | 18 class ThemeSyncableServiceTest; |
19 | 19 |
20 namespace sync_pb { | 20 namespace sync_pb { |
21 class ThemeSpecifics; | 21 class ThemeSpecifics; |
22 } | 22 } |
23 | 23 |
24 class ThemeSyncableService : public syncer::SyncableService { | 24 class ThemeSyncableService : public syncer::SyncableService { |
25 public: | 25 public: |
26 ThemeSyncableService(Profile* profile, // Same profile used by theme_service. | 26 ThemeSyncableService(Profile* profile, // Same profile used by theme_service. |
27 ThemeService* theme_service); | 27 ThemeService* theme_service); |
28 virtual ~ThemeSyncableService(); | 28 ~ThemeSyncableService() override; |
29 | 29 |
30 static syncer::ModelType model_type() { return syncer::THEMES; } | 30 static syncer::ModelType model_type() { return syncer::THEMES; } |
31 | 31 |
32 // Called by ThemeService when user changes theme. | 32 // Called by ThemeService when user changes theme. |
33 void OnThemeChange(); | 33 void OnThemeChange(); |
34 | 34 |
35 // syncer::SyncableService implementation. | 35 // syncer::SyncableService implementation. |
36 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 36 syncer::SyncMergeResult MergeDataAndStartSyncing( |
37 syncer::ModelType type, | 37 syncer::ModelType type, |
38 const syncer::SyncDataList& initial_sync_data, | 38 const syncer::SyncDataList& initial_sync_data, |
39 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 39 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
40 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | 40 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; |
41 virtual void StopSyncing(syncer::ModelType type) override; | 41 void StopSyncing(syncer::ModelType type) override; |
42 virtual syncer::SyncDataList GetAllSyncData( | 42 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
43 syncer::ModelType type) const override; | 43 syncer::SyncError ProcessSyncChanges( |
44 virtual syncer::SyncError ProcessSyncChanges( | |
45 const tracked_objects::Location& from_here, | 44 const tracked_objects::Location& from_here, |
46 const syncer::SyncChangeList& change_list) override; | 45 const syncer::SyncChangeList& change_list) override; |
47 | 46 |
48 // Client tag and tile of theme node in sync. | 47 // Client tag and tile of theme node in sync. |
49 static const char kCurrentThemeClientTag[]; | 48 static const char kCurrentThemeClientTag[]; |
50 static const char kCurrentThemeNodeTitle[]; | 49 static const char kCurrentThemeNodeTitle[]; |
51 | 50 |
52 private: | 51 private: |
53 static bool AreThemeSpecificsEqual( | 52 static bool AreThemeSpecificsEqual( |
54 const sync_pb::ThemeSpecifics& a, | 53 const sync_pb::ThemeSpecifics& a, |
(...skipping 30 matching lines...) Expand all Loading... |
85 bool use_system_theme_by_default_; | 84 bool use_system_theme_by_default_; |
86 | 85 |
87 base::ThreadChecker thread_checker_; | 86 base::ThreadChecker thread_checker_; |
88 | 87 |
89 FRIEND_TEST_ALL_PREFIXES(ThemeSyncableServiceTest, AreThemeSpecificsEqual); | 88 FRIEND_TEST_ALL_PREFIXES(ThemeSyncableServiceTest, AreThemeSpecificsEqual); |
90 | 89 |
91 DISALLOW_COPY_AND_ASSIGN(ThemeSyncableService); | 90 DISALLOW_COPY_AND_ASSIGN(ThemeSyncableService); |
92 }; | 91 }; |
93 | 92 |
94 #endif // CHROME_BROWSER_THEMES_THEME_SYNCABLE_SERVICE_H_ | 93 #endif // CHROME_BROWSER_THEMES_THEME_SYNCABLE_SERVICE_H_ |
OLD | NEW |