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

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: Create an IsEnabled method on TetherService. 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
« no previous file with comments | « chrome/browser/chromeos/tether/OWNERS ('k') | chrome/browser/chromeos/tether/tether_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Whether Tether is enabled. Virtual to allow override for testing.
39 virtual bool IsEnabled() 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_CHROMEOS_TETHER_TETHER_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/tether/OWNERS ('k') | chrome/browser/chromeos/tether/tether_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698