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