OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/callback.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/memory/weak_ptr.h" |
| 13 |
| 14 namespace policy { |
| 15 class BrowserPolicyConnectorChromeOS; |
| 16 } |
| 17 |
| 18 namespace chromeos { |
| 19 namespace system { |
| 20 |
| 21 // Remote device disabling is triggered in two different ways, depending on the |
| 22 // state the device is in: |
| 23 // - If the device has been wiped, it will perform a hash dance during OOBE to |
| 24 // find out whether any persistent state has been stored for it on the server. |
| 25 // If so, persistent state is retrieved as a |DeviceStateRetrievalResponse| |
| 26 // protobuf, parsed and written to the |prefs::kServerBackedDeviceState| local |
| 27 // state pref. At the appropriate place in the OOBE flow, the |
| 28 // |WizardController| will call CheckWhetherDeviceDisabledDuringOOBE() to find |
| 29 // out whether the device is disabled, causing it to either show or skip the |
| 30 // device disabled screen. |
| 31 // - If the device has not been wiped, the disabled state is retrieved with |
| 32 // every device policy fetch as part of the |PolicyData| protobuf, parsed and |
| 33 // written to the |chromeos::kDeviceDisabled| cros setting. |
| 34 // |
| 35 // TODO(bartfab): Make this class subscribe to the cros setting and trigger |
| 36 // the device disabled screen. http://crbug.com/425574 |
| 37 class DeviceDisablingManager { |
| 38 public: |
| 39 explicit DeviceDisablingManager( |
| 40 policy::BrowserPolicyConnectorChromeOS* browser_policy_connector); |
| 41 |
| 42 // Returns the disabled message. The message is only guaranteed to be up to |
| 43 // date if the disabled screen was triggered. |
| 44 const std::string& GetDisabledMessage() const; |
| 45 |
| 46 // Checks whether the device is disabled. |callback| will be invoked with the |
| 47 // result of the check. |
| 48 using DeviceDisabledCheckCallback = base::Callback<void(bool)>; |
| 49 void CheckWhetherDeviceDisabledDuringOOBE( |
| 50 const DeviceDisabledCheckCallback& callback); |
| 51 |
| 52 private: |
| 53 policy::BrowserPolicyConnectorChromeOS* browser_policy_connector_; |
| 54 |
| 55 // A cached copy of the message to show on the device disabled screen. |
| 56 std::string disabled_message_; |
| 57 |
| 58 base::WeakPtrFactory<DeviceDisablingManager> weak_factory_; |
| 59 |
| 60 DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManager); |
| 61 }; |
| 62 |
| 63 } // namespace system |
| 64 } // namespace chromeos |
| 65 |
| 66 #endif // CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ |
OLD | NEW |