Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Side by Side Diff: chrome/browser/chromeos/system/device_disabling_manager.h

Issue 692383005: Add DeviceDisablingManager to manage device disabling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@f_3_425574_disable_header_bar
Patch Set: Fix overzealous gypi clean-up. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698