OLD | NEW |
(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_ |
OLD | NEW |