OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_UI_APP_LIST_ARC_ARC_PACKAGE_SYNC_DATA_TYPE_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_ARC_ARC_PACKAGE_SYNC_DATA_TYPE_CONTROLLER_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_PACKAGE_SYNC_DATA_TYPE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_ARC_ARC_PACKAGE_SYNC_DATA_TYPE_CONTROLLER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 9 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
10 #include "components/prefs/pref_change_registrar.h" | 10 #include "components/prefs/pref_change_registrar.h" |
| 11 #include "components/sync/driver/async_directory_type_controller.h" |
11 #include "components/sync/driver/data_type_controller.h" | 12 #include "components/sync/driver/data_type_controller.h" |
12 #include "components/sync/driver/non_ui_data_type_controller.h" | |
13 | 13 |
14 class Profile; | 14 class Profile; |
15 | 15 |
16 namespace syncer { | 16 namespace syncer { |
17 class SyncClient; | 17 class SyncClient; |
18 } | 18 } |
19 | 19 |
20 // A DataTypeController for arc package sync datatypes, which enables or | 20 // A DataTypeController for arc package sync datatypes, which enables or |
21 // disables these types based on whether ArcAppInstance is ready. | 21 // disables these types based on whether ArcAppInstance is ready. |
22 class ArcPackageSyncDataTypeController : public syncer::NonUIDataTypeController, | 22 class ArcPackageSyncDataTypeController |
23 public ArcAppListPrefs::Observer { | 23 : public syncer::AsyncDirectoryTypeController, |
| 24 public ArcAppListPrefs::Observer { |
24 public: | 25 public: |
25 // |dump_stack| is called when an unrecoverable error occurs. | 26 // |dump_stack| is called when an unrecoverable error occurs. |
26 ArcPackageSyncDataTypeController(syncer::ModelType type, | 27 ArcPackageSyncDataTypeController(syncer::ModelType type, |
27 const base::Closure& dump_stack, | 28 const base::Closure& dump_stack, |
28 syncer::SyncClient* sync_client, | 29 syncer::SyncClient* sync_client, |
29 Profile* profile); | 30 Profile* profile); |
30 ~ArcPackageSyncDataTypeController() override; | 31 ~ArcPackageSyncDataTypeController() override; |
31 | 32 |
32 // NonUIDataTypeController implementation. | 33 // AsyncDirectoryTypeController implementation. |
33 bool ReadyForStart() const override; | 34 bool ReadyForStart() const override; |
34 bool StartModels() override; | 35 bool StartModels() override; |
35 void StopModels() override; | 36 void StopModels() override; |
36 | 37 |
37 private: | 38 private: |
38 // ArcAppListPrefs::Observer: | 39 // ArcAppListPrefs::Observer: |
39 void OnPackageListInitialRefreshed() override; | 40 void OnPackageListInitialRefreshed() override; |
40 | 41 |
41 void OnArcEnabledPrefChanged(); | 42 void OnArcEnabledPrefChanged(); |
42 | 43 |
43 void EnableDataType(); | 44 void EnableDataType(); |
44 | 45 |
45 bool ShouldSyncArc() const; | 46 bool ShouldSyncArc() const; |
46 | 47 |
47 bool model_normal_start_ = true; | 48 bool model_normal_start_ = true; |
48 | 49 |
49 Profile* const profile_; | 50 Profile* const profile_; |
50 | 51 |
51 PrefChangeRegistrar pref_registrar_; | 52 PrefChangeRegistrar pref_registrar_; |
52 | 53 |
53 DISALLOW_COPY_AND_ASSIGN(ArcPackageSyncDataTypeController); | 54 DISALLOW_COPY_AND_ASSIGN(ArcPackageSyncDataTypeController); |
54 }; | 55 }; |
55 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_PACKAGE_SYNC_DATA_TYPE_CONTROLLER_
H_ | 56 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_PACKAGE_SYNC_DATA_TYPE_CONTROLLER_
H_ |
OLD | NEW |