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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/tether/tether_service.h
diff --git a/chrome/browser/chromeos/tether/tether_service.h b/chrome/browser/chromeos/tether/tether_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..34218f0e9c28becd2045caea8c35624b54131d95
--- /dev/null
+++ b/chrome/browser/chromeos/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_CHROMEOS_TETHER_TETHER_SERVICE_H_
+#define CHROME_BROWSER_CHROMEOS_TETHER_TETHER_SERVICE_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "components/keyed_service/core/keyed_service.h"
+#include "components/prefs/pref_change_registrar.h"
+
+namespace user_prefs {
+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;
+
+ // Whether Tether is enabled. Virtual to allow override for testing.
+ virtual bool IsEnabled() 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_CHROMEOS_TETHER_TETHER_SERVICE_H_
« 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