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

Side by Side Diff: chrome/browser/ui/app_list/arc/arc_package_sync_data_type_controller.h

Issue 2353213002: arc: Fix Android App resurrected by sync. (Closed)
Patch Set: Remove redundant pref observer. Created 4 years, 2 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
OLDNEW
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 // UIDataTypeController override:
31 bool ReadyForStart() const override; 35 bool ReadyForStart() const override;
36 bool StartModels() override;
32 37
33 private: 38 private:
34 void OnArcAppsSyncPrefChanged(); 39 // arc::InstanceHolder<arc::mojom::AppInstance>::Observer:
40 void OnInstanceReady() override;
35 41
36 void OnArcEnabledPrefChanged(); 42 void OnArcEnabledPrefChanged();
37 43
44 void EnableDataType();
45
46 bool ShouldSyncArc() const;
47
48 bool model_normal_start_ = true;
49
38 Profile* const profile_; 50 Profile* const profile_;
39 51
40 sync_driver::SyncClient* sync_client_; 52 sync_driver::SyncClient* sync_client_;
41 53
42 PrefChangeRegistrar pref_registrar_; 54 PrefChangeRegistrar pref_registrar_;
43 55
44 DISALLOW_COPY_AND_ASSIGN(ArcPackageSyncDataTypeController); 56 DISALLOW_COPY_AND_ASSIGN(ArcPackageSyncDataTypeController);
45 }; 57 };
46 #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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698