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

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: 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;
Yusuke Sato 2017/03/01 18:09:26 nit: As you know, https://google.github.io/stylegu
hidehiko 2017/03/01 19:21:31 AFAIK, in Chromium, the rule is overriden by https
Luis Héctor Chávez 2017/03/02 00:09:17 Yes, Chromium is considered to be a single project
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 // sync_preferences::PrefServiceSyncableObserver:
41 void OnIsSyncingChanged() override;
42
43 Profile* const profile_;
44
45 // Owned by ArcServiceLauncher.
46 ArcSessionManager* const arc_session_manager_;
47
48 // Registrar used to monitor ARC enabled state.
49 PrefChangeRegistrar pref_change_registrar_;
50
51 // Must be the last member.
52 base::WeakPtrFactory<ArcPlayStoreEnabledPreferenceHandler> weak_ptr_factory_;
53
54 DISALLOW_COPY_AND_ASSIGN(ArcPlayStoreEnabledPreferenceHandler);
55 };
56
57 } // namespace arc
58
59 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_PLAY_STORE_ENABLED_PREFERENCE_HANDLER _H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698