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_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback_list.h" | 12 #include "base/callback_list.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" | 16 #include "chrome/browser/chromeos/policy/auto_enrollment_client.h" |
17 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 17 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
18 | 18 |
19 namespace cryptohome { | |
20 class BaseReply; | |
21 } // namespace cryptohome | |
22 | |
19 namespace chromeos { | 23 namespace chromeos { |
20 | 24 |
21 // Drives the forced re-enrollment check (for historical reasons called | 25 // Drives the forced re-enrollment check (for historical reasons called |
22 // auto-enrollment check), running an AutoEnrollmentClient if appropriate to | 26 // auto-enrollment check), running an AutoEnrollmentClient if appropriate to |
23 // make a decision. | 27 // make a decision. |
24 class AutoEnrollmentController { | 28 class AutoEnrollmentController { |
25 public: | 29 public: |
26 typedef base::CallbackList<void(policy::AutoEnrollmentState)> | 30 typedef base::CallbackList<void(policy::AutoEnrollmentState)> |
27 ProgressCallbackList; | 31 ProgressCallbackList; |
28 | 32 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 // Callback for the ownership status check. | 83 // Callback for the ownership status check. |
80 void OnOwnershipStatusCheckDone( | 84 void OnOwnershipStatusCheckDone( |
81 DeviceSettingsService::OwnershipStatus status); | 85 DeviceSettingsService::OwnershipStatus status); |
82 | 86 |
83 // Starts the auto-enrollment client. | 87 // Starts the auto-enrollment client. |
84 void StartClient(const std::vector<std::string>& state_keys); | 88 void StartClient(const std::vector<std::string>& state_keys); |
85 | 89 |
86 // Sets |state_| and notifies |progress_callbacks_|. | 90 // Sets |state_| and notifies |progress_callbacks_|. |
87 void UpdateState(policy::AutoEnrollmentState state); | 91 void UpdateState(policy::AutoEnrollmentState state); |
88 | 92 |
93 // Makes a D-Bus call to cryptohome to remove the firmware management | |
94 // parameters (FWMP) from TPM. Stops the |safeguard_timer_| and notifies the | |
95 // |progress_callbacks_| after update is done if the timer is still running. | |
96 // The notifications have to be sent only after the FWMP is cleared, because | |
97 // the user might try to switch to devmode. In this case, if block_devmode is | |
98 // in FWMP and the clear operation didn't finish, the switch would be denied. | |
99 // Also the safeguard timer has to be active until the FWMP is cleared to | |
100 // avoid the risk of blocked flow. | |
101 void RemoveFirmwareManagementParameters(); | |
Thiemo Nagel
2017/03/23 17:23:52
Nit: I'd suggest to add "Start" to the beginning o
igorcov
2017/03/24 13:29:15
Done.
| |
102 | |
103 // Callback for RemoveFirmwareManagementParameters(). If an error is received | |
104 // here, it is logged only, without changing the flow after that, because | |
105 // the FWMP is used only for newer devices. | |
106 void OnFirmwareManagementParametersRemoved( | |
107 chromeos::DBusMethodCallStatus call_status, | |
108 bool result, | |
109 const cryptohome::BaseReply& reply); | |
110 | |
89 // Handles timeout of the safeguard timer and stops waiting for a result. | 111 // Handles timeout of the safeguard timer and stops waiting for a result. |
90 void Timeout(); | 112 void Timeout(); |
91 | 113 |
92 policy::AutoEnrollmentState state_; | 114 policy::AutoEnrollmentState state_; |
93 ProgressCallbackList progress_callbacks_; | 115 ProgressCallbackList progress_callbacks_; |
94 | 116 |
95 std::unique_ptr<policy::AutoEnrollmentClient> client_; | 117 std::unique_ptr<policy::AutoEnrollmentClient> client_; |
96 | 118 |
97 // This timer acts as a belt-and-suspenders safety for the case where one of | 119 // This timer acts as a belt-and-suspenders safety for the case where one of |
98 // the asynchronous steps required to make the auto-enrollment decision | 120 // the asynchronous steps required to make the auto-enrollment decision |
99 // doesn't come back. Even though in theory they should all terminate, better | 121 // doesn't come back. Even though in theory they should all terminate, better |
100 // safe than sorry: There are DBus interactions, an entire network stack etc. | 122 // safe than sorry: There are DBus interactions, an entire network stack etc. |
101 // - just too many moving pieces to be confident there are no bugs. If | 123 // - just too many moving pieces to be confident there are no bugs. If |
102 // something goes wrong, the timer will ensure that a decision gets made | 124 // something goes wrong, the timer will ensure that a decision gets made |
103 // eventually, which is crucial to not block OOBE forever. See | 125 // eventually, which is crucial to not block OOBE forever. See |
104 // http://crbug.com/433634 for background. | 126 // http://crbug.com/433634 for background. |
105 base::Timer safeguard_timer_; | 127 base::Timer safeguard_timer_; |
106 | 128 |
107 // Whether the forced re-enrollment check has to be applied. | 129 // Whether the forced re-enrollment check has to be applied. |
108 FRERequirement fre_requirement_ = REQUIRED; | 130 FRERequirement fre_requirement_ = REQUIRED; |
109 | 131 |
110 base::WeakPtrFactory<AutoEnrollmentController> client_start_weak_factory_; | 132 base::WeakPtrFactory<AutoEnrollmentController> client_start_weak_factory_; |
111 | 133 |
112 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentController); | 134 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentController); |
113 }; | 135 }; |
114 | 136 |
115 } // namespace chromeos | 137 } // namespace chromeos |
116 | 138 |
117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H _ | 139 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H _ |
OLD | NEW |