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