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

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

Issue 2819713002: Create TetherService, a TetherAllowed pref, and use DependencyManager for RegisterProfilePrefs call… (Closed)
Patch Set: Move TetherService[Factory] from chrome/browser to chrome/browser/chromeos. 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_CHROMEOS_TETHER_TETHER_SERVICE_H_
6 #define CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "components/keyed_service/core/keyed_service.h"
12 #include "components/prefs/pref_change_registrar.h"
13
14 namespace user_prefs {
15 class PrefRegistrySyncable;
16 }
17
18 class Profile;
19
20 class TetherService : public KeyedService {
21 public:
22 explicit TetherService(Profile* profile);
23 ~TetherService() override;
24
25 // Gets TetherService instance.
26 static TetherService* Get(Profile* profile);
27
28 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
29
30 // Start the Tether module. Should only be called once a user is logged in.
31 void StartTether();
32
33 // Whether Tether is allowed to be used. If the controlling preference
34 // is set (from policy), this returns the preference value. Otherwise, it is
35 // permitted if the flag is enabled. Virtual to allow override for testing.
36 virtual bool IsAllowed() const;
37
38 protected:
39 // KeyedService
40 void Shutdown() override;
41
42 private:
43 // Callback when the controlling pref changes.
44 void OnPrefsChanged();
45
46 Profile* profile_;
47 PrefChangeRegistrar registrar_;
48
49 // Whether the service has been shut down.
50 bool shut_down_;
51
52 DISALLOW_COPY_AND_ASSIGN(TetherService);
53 };
54
55 #endif // CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698