| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 private: | 78 private: |
| 79 DISALLOW_ASSIGN(Delegate); | 79 DISALLOW_ASSIGN(Delegate); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 // |delegate| must outlive |this|. | 82 // |delegate| must outlive |this|. |
| 83 DeviceDisablingManager(Delegate* delegate, | 83 DeviceDisablingManager(Delegate* delegate, |
| 84 CrosSettings* cros_settings, | 84 CrosSettings* cros_settings, |
| 85 user_manager::UserManager* user_manager); | 85 user_manager::UserManager* user_manager); |
| 86 ~DeviceDisablingManager(); | 86 ~DeviceDisablingManager(); |
| 87 | 87 |
| 88 // Must be called after construction. |
| 89 void Init(); |
| 90 |
| 88 void AddObserver(Observer* observer); | 91 void AddObserver(Observer* observer); |
| 89 void RemoveObserver(Observer* observer); | 92 void RemoveObserver(Observer* observer); |
| 90 | 93 |
| 91 // Returns the cached domain that owns the device. The domain is only | 94 // Returns the cached domain that owns the device. The domain is only |
| 92 // guaranteed to be up to date if the disabled screen was triggered. | 95 // guaranteed to be up to date if the disabled screen was triggered. |
| 93 const std::string& enrollment_domain() const { return enrollment_domain_; } | 96 const std::string& enrollment_domain() const { return enrollment_domain_; } |
| 94 | 97 |
| 95 // Returns the cached disabled message. The message is only guaranteed to be | 98 // Returns the cached disabled message. The message is only guaranteed to be |
| 96 // up to date if the disabled screen was triggered. | 99 // up to date if the disabled screen was triggered. |
| 97 const std::string& disabled_message() const { return disabled_message_; } | 100 const std::string& disabled_message() const { return disabled_message_; } |
| 98 | 101 |
| 99 // Performs a check whether the device is disabled during OOBE. |callback| | 102 // Performs a check whether the device is disabled during OOBE. |callback| |
| 100 // will be invoked with the result of the check. | 103 // will be invoked with the result of the check. |
| 101 void CheckWhetherDeviceDisabledDuringOOBE( | 104 void CheckWhetherDeviceDisabledDuringOOBE( |
| 102 const DeviceDisabledCheckCallback& callback); | 105 const DeviceDisabledCheckCallback& callback); |
| 103 | 106 |
| 104 // Whenever trusted cros settings indicate that the device is disabled, this | 107 // Whenever trusted cros settings indicate that the device is disabled, this |
| 105 // method should be used to check whether the device disabling is to be | 108 // method should be used to check whether the device disabling is to be |
| 106 // honored. If this method returns false, the device should not be disabled. | 109 // honored. If this method returns false, the device should not be disabled. |
| 107 static bool HonorDeviceDisablingDuringNormalOperation(); | 110 static bool HonorDeviceDisablingDuringNormalOperation(); |
| 108 | 111 |
| 109 private: | 112 private: |
| 110 void Init(); | |
| 111 | |
| 112 // Cache the disabled message and inform observers if it changed. | 113 // Cache the disabled message and inform observers if it changed. |
| 113 void CacheDisabledMessageAndNotify(const std::string& disabled_message); | 114 void CacheDisabledMessageAndNotify(const std::string& disabled_message); |
| 114 | 115 |
| 115 void UpdateFromCrosSettings(); | 116 void UpdateFromCrosSettings(); |
| 116 | 117 |
| 117 Delegate* delegate_; | 118 Delegate* delegate_; |
| 118 policy::BrowserPolicyConnectorChromeOS* browser_policy_connector_; | 119 policy::BrowserPolicyConnectorChromeOS* browser_policy_connector_; |
| 119 CrosSettings* cros_settings_; | 120 CrosSettings* cros_settings_; |
| 120 user_manager::UserManager* user_manager_; | 121 user_manager::UserManager* user_manager_; |
| 121 | 122 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 138 | 139 |
| 139 base::WeakPtrFactory<DeviceDisablingManager> weak_factory_; | 140 base::WeakPtrFactory<DeviceDisablingManager> weak_factory_; |
| 140 | 141 |
| 141 DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManager); | 142 DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManager); |
| 142 }; | 143 }; |
| 143 | 144 |
| 144 } // namespace system | 145 } // namespace system |
| 145 } // namespace chromeos | 146 } // namespace chromeos |
| 146 | 147 |
| 147 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ | 148 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ |
| OLD | NEW |