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 "components/arc/common/app.mojom.h" | 9 #include "components/arc/common/app.mojom.h" |
10 #include "components/arc/instance_holder.h" | 10 #include "components/arc/instance_holder.h" |
11 #include "components/prefs/pref_change_registrar.h" | 11 #include "components/prefs/pref_change_registrar.h" |
12 #include "components/sync/driver/data_type_controller.h" | 12 #include "components/sync/driver/data_type_controller.h" |
13 #include "components/sync/driver/ui_data_type_controller.h" | 13 #include "components/sync/driver/ui_data_type_controller.h" |
14 | 14 |
15 class Profile; | 15 namespace sync_driver { |
16 | |
17 namespace syncer { | |
18 class SyncClient; | 16 class SyncClient; |
19 } | 17 } |
20 | 18 |
| 19 class Profile; |
| 20 |
21 // A UIDataTypeController for arc package sync datatypes, which enables or | 21 // A UIDataTypeController for arc package sync datatypes, which enables or |
22 // disables these types based on whether ArcAppInstance is ready. | 22 // disables these types based on whether ArcAppInstance is ready. |
23 class ArcPackageSyncDataTypeController | 23 class ArcPackageSyncDataTypeController |
24 : public syncer::UIDataTypeController, | 24 : public sync_driver::UIDataTypeController, |
25 public arc::InstanceHolder<arc::mojom::AppInstance>::Observer { | 25 public arc::InstanceHolder<arc::mojom::AppInstance>::Observer { |
26 public: | 26 public: |
27 // |dump_stack| is called when an unrecoverable error occurs. | 27 // |dump_stack| is called when an unrecoverable error occurs. |
28 ArcPackageSyncDataTypeController(syncer::ModelType type, | 28 ArcPackageSyncDataTypeController(syncer::ModelType type, |
29 const base::Closure& dump_stack, | 29 const base::Closure& dump_stack, |
30 syncer::SyncClient* sync_client, | 30 sync_driver::SyncClient* sync_client, |
31 Profile* profile); | 31 Profile* profile); |
32 ~ArcPackageSyncDataTypeController() override; | 32 ~ArcPackageSyncDataTypeController() override; |
33 | 33 |
34 // UIDataTypeController override: | 34 // UIDataTypeController override: |
35 bool ReadyForStart() const override; | 35 bool ReadyForStart() const override; |
36 bool StartModels() override; | 36 bool StartModels() override; |
37 | 37 |
38 private: | 38 private: |
39 // arc::InstanceHolder<arc::mojom::AppInstance>::Observer: | 39 // arc::InstanceHolder<arc::mojom::AppInstance>::Observer: |
40 void OnInstanceReady() override; | 40 void OnInstanceReady() override; |
41 | 41 |
42 void OnArcEnabledPrefChanged(); | 42 void OnArcEnabledPrefChanged(); |
43 | 43 |
44 void EnableDataType(); | 44 void EnableDataType(); |
45 | 45 |
46 bool ShouldSyncArc() const; | 46 bool ShouldSyncArc() const; |
47 | 47 |
48 bool model_normal_start_ = true; | 48 bool model_normal_start_ = true; |
49 | 49 |
50 Profile* const profile_; | 50 Profile* const profile_; |
51 | 51 |
52 syncer::SyncClient* sync_client_; | 52 sync_driver::SyncClient* sync_client_; |
53 | 53 |
54 PrefChangeRegistrar pref_registrar_; | 54 PrefChangeRegistrar pref_registrar_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(ArcPackageSyncDataTypeController); | 56 DISALLOW_COPY_AND_ASSIGN(ArcPackageSyncDataTypeController); |
57 }; | 57 }; |
58 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_PACKAGE_SYNC_DATA_TYPE_CONTROLLER_
H_ | 58 #endif // CHROME_BROWSER_UI_APP_LIST_ARC_ARC_PACKAGE_SYNC_DATA_TYPE_CONTROLLER_
H_ |
OLD | NEW |