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

Side by Side Diff: chrome/browser/tether/tether_service.h

Issue 2819713002: Create TetherService, a TetherAllowed pref, and use DependencyManager for RegisterProfilePrefs call… (Closed)
Patch Set: Do not explicitly call on TetherService::Shutdown() from UserSessionManager. Created 3 years, 8 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_TETHER_TETHER_SERVICE_H_
6 #define CHROME_BROWSER_TETHER_TETHER_SERVICE_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
Lei Zhang 2017/04/19 19:13:17 No WeakPtrs here.
Ryan Hansberry 2017/04/20 17:22:32 Done.
12 #include "build/build_config.h"
Lei Zhang 2017/04/19 19:13:17 Not needed since nothing is being #ifdef'd? Ditto
Ryan Hansberry 2017/04/20 17:22:32 Removed here and elsewhere.
13 #include "components/keyed_service/core/keyed_service.h"
14 #include "components/pref_registry/pref_registry_syncable.h"
15 #include "components/prefs/pref_change_registrar.h"
16
17 // namespace user_prefs {
Lei Zhang 2017/04/19 19:13:17 I think you should uncomment this and remove the #
Ryan Hansberry 2017/04/20 17:22:32 My bad, removed.
Lei Zhang 2017/04/20 19:24:30 Why not keep the forward decl and move the pref_re
Ryan Hansberry 2017/04/20 22:08:09 Oops. Fixed.
18 // class PrefRegistrySyncable;
19 // }
20
21 class Profile;
22
23 class TetherService : public KeyedService {
24 public:
25 explicit TetherService(Profile* profile);
26 ~TetherService() override;
27
28 // Gets TetherService instance.
29 static TetherService* Get(Profile* profile);
30
31 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
32
33 // Start the Tether module. Should only be called once a user is logged in.
34 void StartTether();
35
36 // Whether Tether is allowed to be used. If the controlling preference
37 // is set (from policy), this returns the preference value. Otherwise, it is
38 // permitted if the flag is enabled. Virtual to allow override for testing.
39 virtual bool IsAllowed() const;
40
41 protected:
42 // KeyedService
43 void Shutdown() override;
44
45 private:
46 // Callback when the controlling pref changes.
47 void OnPrefsChanged();
48
49 Profile* profile_;
50 PrefChangeRegistrar registrar_;
51
52 // Whether the service has been shut down.
53 bool shut_down_;
54
55 DISALLOW_COPY_AND_ASSIGN(TetherService);
56 };
57
58 #endif // CHROME_BROWSER_TETHER_TETHER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698