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

Side by Side Diff: chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.h

Issue 2723073002: Extract kArcEnabled preference from ArcSessionManager part 2. (Closed)
Patch Set: address comments Created 3 years, 9 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_PLAY_STORE_ENABLED_PREFERENCE_HANDLER_H_
6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_PLAY_STORE_ENABLED_PREFERENCE_HANDLER_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "components/prefs/pref_change_registrar.h"
11 #include "components/sync_preferences/pref_service_syncable_observer.h"
12
13 class Profile;
14
15 namespace arc {
16
17 class ArcSessionManager;
18
19 // Observes Google Play Store enabled preference (whose key is "arc.enabled"
20 // for historical reason), and controls ARC via ArcSessionManager.
21 // In addition, this controls showing/hiding a notification to enable Google
22 // Play Store.
23 class ArcPlayStoreEnabledPreferenceHandler
24 : public sync_preferences::PrefServiceSyncableObserver {
25 public:
26 ArcPlayStoreEnabledPreferenceHandler(Profile* profile,
27 ArcSessionManager* arc_session_manager);
28 ~ArcPlayStoreEnabledPreferenceHandler() override;
29
30 // Starts observing Google Play Store enabled preference change.
31 // Also, based on its initial value, this may start ArcSession, or may start
32 // removing the data, as initial state.
33 // In addition, this triggers to show ArcAuthNotification, if necessary.
34 void Start();
35
36 private:
37 // Called when Google Play Store enabled preference is changed.
38 void OnPreferenceChanged();
39
40 // Updates enabling/disabling of ArcSessionManager. Also, sets
41 // ArcSupportHost's managed state.
42 void UpdateArcSessionManager();
43
44 // sync_preferences::PrefServiceSyncableObserver:
45 void OnIsSyncingChanged() override;
46
47 Profile* const profile_;
48
49 // Owned by ArcServiceLauncher.
50 ArcSessionManager* const arc_session_manager_;
51
52 // Registrar used to monitor ARC enabled state.
53 PrefChangeRegistrar pref_change_registrar_;
54
55 // Must be the last member.
56 base::WeakPtrFactory<ArcPlayStoreEnabledPreferenceHandler> weak_ptr_factory_;
57
58 DISALLOW_COPY_AND_ASSIGN(ArcPlayStoreEnabledPreferenceHandler);
59 };
60
61 } // namespace arc
62
63 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_PLAY_STORE_ENABLED_PREFERENCE_HANDLER _H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/arc/arc_play_store_enabled_preference_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698