OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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_POLICY_DEVICE_POLICY_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_POLICY_DEVICE_POLICY_CONTROLLER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "chrome/browser/policy/cloud_policy_controller.h" |
| 10 #include "chrome/common/notification_observer.h" |
| 11 #include "chrome/common/notification_registrar.h" |
| 12 |
| 13 class TokenService; |
| 14 |
| 15 namespace policy { |
| 16 |
| 17 // DM token provider that stores the token in CrOS signed settings. |
| 18 class DevicePolicyController : public CloudPolicyController, |
| 19 public NotificationObserver { |
| 20 public: |
| 21 DevicePolicyController(); |
| 22 virtual ~DevicePolicyController() {} |
| 23 |
| 24 // CloudPolicyController implementation: |
| 25 virtual std::string GetDeviceToken(); |
| 26 virtual std::string GetDeviceID(); |
| 27 virtual bool GetCredentials(std::string* username, |
| 28 std::string* auth_token); |
| 29 virtual void OnTokenAvailable(const std::string& token); |
| 30 |
| 31 private: |
| 32 // Recheck whether all parameters are available and if so, trigger a |
| 33 // credentials changed notification. |
| 34 void CheckAndTriggerFetch(); |
| 35 |
| 36 // NotificationObserver method overrides: |
| 37 virtual void Observe(NotificationType type, |
| 38 const NotificationSource& source, |
| 39 const NotificationDetails& details); |
| 40 |
| 41 // The machine identifier. |
| 42 std::string machine_id_; |
| 43 |
| 44 // Current token. Empty if not available. |
| 45 std::string device_token_; |
| 46 |
| 47 // Whether to try and register. Device policy enrollment does not happen |
| 48 // automatically except for the case that the device gets claimed. This |
| 49 // situation is detected by listening for the OWNERSHIP_TAKEN notification. |
| 50 bool should_register_; |
| 51 |
| 52 // Registers the provider for notification of successful Gaia logins. |
| 53 NotificationRegistrar registrar_; |
| 54 |
| 55 DISALLOW_COPY_AND_ASSIGN(DevicePolicyController); |
| 56 }; |
| 57 |
| 58 } // namespace policy |
| 59 |
| 60 #endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_CONTROLLER_H_ |
OLD | NEW |