Chromium Code Reviews| Index: chrome/browser/chromeos/system/device_disabling_manager.h |
| diff --git a/chrome/browser/chromeos/system/device_disabling_manager.h b/chrome/browser/chromeos/system/device_disabling_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4d605e2a55e5577869c4abc7d1e7a589c39e7672 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/system/device_disabling_manager.h |
| @@ -0,0 +1,66 @@ |
| +// Copyright 2014 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_SYSTEM_DEVICE_DISABLING_MANAGER_H_ |
| +#define CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/callback.h" |
| +#include "base/macros.h" |
| +#include "base/memory/weak_ptr.h" |
| + |
| +namespace policy { |
| +class BrowserPolicyConnectorChromeOS; |
| +} |
| + |
| +namespace chromeos { |
| +namespace system { |
| + |
| +// Remote device disabling is triggered in two different ways, depending on the |
|
achuithb
2014/11/05 19:59:55
Maybe add a sentence to express what device disabl
bartfab (slow)
2014/11/06 16:14:38
Done.
|
| +// state the device is in: |
| +// - If the device has been wiped, it will perform a hash dance during OOBE to |
| +// find out whether any persistent state has been stored for it on the server. |
| +// If so, persistent state is retrieved as a |DeviceStateRetrievalResponse| |
| +// protobuf, parsed and written to the |prefs::kServerBackedDeviceState| local |
| +// state pref. At the appropriate place in the OOBE flow, the |
| +// |WizardController| will call CheckWhetherDeviceDisabledDuringOOBE() to find |
| +// out whether the device is disabled, causing it to either show or skip the |
| +// device disabled screen. |
| +// - If the device has not been wiped, the disabled state is retrieved with |
| +// every device policy fetch as part of the |PolicyData| protobuf, parsed and |
| +// written to the |chromeos::kDeviceDisabled| cros setting. |
| +// |
| +// TODO(bartfab): Make this class subscribe to the cros setting and trigger |
| +// the device disabled screen. http://crbug.com/425574 |
| +class DeviceDisablingManager { |
| + public: |
| + explicit DeviceDisablingManager( |
| + policy::BrowserPolicyConnectorChromeOS* browser_policy_connector); |
| + |
| + // Returns the disabled message. The message is only guaranteed to be up to |
| + // date if the disabled screen was triggered. |
| + const std::string& GetDisabledMessage() const; |
|
achuithb
2014/11/05 19:59:55
Shouldn't this be:
const std::string& disabled_mes
bartfab (slow)
2014/11/06 16:14:38
I always read the style guide as permitting either
|
| + |
| + // Checks whether the device is disabled. |callback| will be invoked with the |
| + // result of the check. |
| + using DeviceDisabledCheckCallback = base::Callback<void(bool)>; |
|
achuithb
2014/11/05 19:59:55
This replaces typedef, right? I'm not able to find
bartfab (slow)
2014/11/06 16:14:38
The style guide has not caught up to using yet. Tr
|
| + void CheckWhetherDeviceDisabledDuringOOBE( |
| + const DeviceDisabledCheckCallback& callback); |
| + |
| + private: |
| + policy::BrowserPolicyConnectorChromeOS* browser_policy_connector_; |
| + |
| + // A cached copy of the message to show on the device disabled screen. |
| + std::string disabled_message_; |
| + |
| + base::WeakPtrFactory<DeviceDisablingManager> weak_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DeviceDisablingManager); |
| +}; |
| + |
| +} // namespace system |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_SYSTEM_DEVICE_DISABLING_MANAGER_H_ |