Index: chrome/browser/tether/tether_service.h |
diff --git a/chrome/browser/tether/tether_service.h b/chrome/browser/tether/tether_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..78f89533f529187ffb2d3339f9edbf99de55fade |
--- /dev/null |
+++ b/chrome/browser/tether/tether_service.h |
@@ -0,0 +1,58 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_TETHER_TETHER_SERVICE_H_ |
+#define CHROME_BROWSER_TETHER_TETHER_SERVICE_H_ |
+ |
+#include <memory> |
+ |
+#include "base/macros.h" |
+#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.
|
+#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.
|
+#include "components/keyed_service/core/keyed_service.h" |
+#include "components/pref_registry/pref_registry_syncable.h" |
+#include "components/prefs/pref_change_registrar.h" |
+ |
+// 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.
|
+// class PrefRegistrySyncable; |
+// } |
+ |
+class Profile; |
+ |
+class TetherService : public KeyedService { |
+ public: |
+ explicit TetherService(Profile* profile); |
+ ~TetherService() override; |
+ |
+ // Gets TetherService instance. |
+ static TetherService* Get(Profile* profile); |
+ |
+ static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
+ |
+ // Start the Tether module. Should only be called once a user is logged in. |
+ void StartTether(); |
+ |
+ // Whether Tether is allowed to be used. If the controlling preference |
+ // is set (from policy), this returns the preference value. Otherwise, it is |
+ // permitted if the flag is enabled. Virtual to allow override for testing. |
+ virtual bool IsAllowed() const; |
+ |
+ protected: |
+ // KeyedService |
+ void Shutdown() override; |
+ |
+ private: |
+ // Callback when the controlling pref changes. |
+ void OnPrefsChanged(); |
+ |
+ Profile* profile_; |
+ PrefChangeRegistrar registrar_; |
+ |
+ // Whether the service has been shut down. |
+ bool shut_down_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TetherService); |
+}; |
+ |
+#endif // CHROME_BROWSER_TETHER_TETHER_SERVICE_H_ |