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 | |
Daniel Erat
2017/03/06 21:18:25
nit: i think we usually omit these blank lines whe
Andrew T Wilson (Slow)
2017/03/07 11:16:30
nit: this is OK as-is, but typically I avoid blank
igorcov
2017/03/09 12:22:57
Done.
| |
21 class BaseReply; | |
22 | |
23 } // namespace cryptohome | |
24 | |
19 namespace chromeos { | 25 namespace chromeos { |
20 | 26 |
21 // Drives the forced re-enrollment check (for historical reasons called | 27 // Drives the forced re-enrollment check (for historical reasons called |
22 // auto-enrollment check), running an AutoEnrollmentClient if appropriate to | 28 // auto-enrollment check), running an AutoEnrollmentClient if appropriate to |
23 // make a decision. | 29 // make a decision. |
24 class AutoEnrollmentController { | 30 class AutoEnrollmentController { |
25 public: | 31 public: |
26 typedef base::CallbackList<void(policy::AutoEnrollmentState)> | 32 typedef base::CallbackList<void(policy::AutoEnrollmentState)> |
27 ProgressCallbackList; | 33 ProgressCallbackList; |
28 | 34 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 // Callback for the ownership status check. | 85 // Callback for the ownership status check. |
80 void OnOwnershipStatusCheckDone( | 86 void OnOwnershipStatusCheckDone( |
81 DeviceSettingsService::OwnershipStatus status); | 87 DeviceSettingsService::OwnershipStatus status); |
82 | 88 |
83 // Starts the auto-enrollment client. | 89 // Starts the auto-enrollment client. |
84 void StartClient(const std::vector<std::string>& state_keys); | 90 void StartClient(const std::vector<std::string>& state_keys); |
85 | 91 |
86 // Sets |state_| and notifies |progress_callbacks_|. | 92 // Sets |state_| and notifies |progress_callbacks_|. |
87 void UpdateState(policy::AutoEnrollmentState state); | 93 void UpdateState(policy::AutoEnrollmentState state); |
88 | 94 |
95 // D-Bus call to cryptohome to remove the firmware management parameters from | |
Daniel Erat
2017/03/06 21:18:25
nit: "Makes a D-Bus call ..."
igorcov
2017/03/09 12:22:56
Done.
| |
96 // TPM. | |
97 void RemoveFwmp(); | |
Daniel Erat
2017/03/06 21:18:25
mind also renaming this to RemoveFirmwareManagemen
igorcov
2017/03/09 12:22:57
Done.
| |
98 | |
99 // Callback after the firmware management parameters is removed. | |
Daniel Erat
2017/03/06 21:18:25
nit: s/is/are/, but maybe just:
// Callback for R
Andrew T Wilson (Slow)
2017/03/07 11:16:30
nit: is->are
igorcov
2017/03/09 12:22:56
Done.
| |
100 void OnFwmpRemoved(chromeos::DBusMethodCallStatus call_status, | |
Daniel Erat
2017/03/06 21:18:25
ditto here
igorcov
2017/03/09 12:22:57
Done.
| |
101 bool result, | |
102 const cryptohome::BaseReply& reply); | |
103 | |
89 // Handles timeout of the safeguard timer and stops waiting for a result. | 104 // Handles timeout of the safeguard timer and stops waiting for a result. |
90 void Timeout(); | 105 void Timeout(); |
91 | 106 |
92 policy::AutoEnrollmentState state_; | 107 policy::AutoEnrollmentState state_; |
93 ProgressCallbackList progress_callbacks_; | 108 ProgressCallbackList progress_callbacks_; |
94 | 109 |
95 std::unique_ptr<policy::AutoEnrollmentClient> client_; | 110 std::unique_ptr<policy::AutoEnrollmentClient> client_; |
96 | 111 |
97 // This timer acts as a belt-and-suspenders safety for the case where one of | 112 // 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 | 113 // the asynchronous steps required to make the auto-enrollment decision |
99 // doesn't come back. Even though in theory they should all terminate, better | 114 // 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. | 115 // 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 | 116 // - 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 | 117 // something goes wrong, the timer will ensure that a decision gets made |
103 // eventually, which is crucial to not block OOBE forever. See | 118 // eventually, which is crucial to not block OOBE forever. See |
104 // http://crbug.com/433634 for background. | 119 // http://crbug.com/433634 for background. |
105 base::Timer safeguard_timer_; | 120 base::Timer safeguard_timer_; |
106 | 121 |
107 // Whether the forced re-enrollment check has to be applied. | 122 // Whether the forced re-enrollment check has to be applied. |
108 FRERequirement fre_requirement_ = REQUIRED; | 123 FRERequirement fre_requirement_ = REQUIRED; |
109 | 124 |
110 base::WeakPtrFactory<AutoEnrollmentController> client_start_weak_factory_; | 125 base::WeakPtrFactory<AutoEnrollmentController> client_start_weak_factory_; |
111 | 126 |
112 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentController); | 127 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentController); |
113 }; | 128 }; |
114 | 129 |
115 } // namespace chromeos | 130 } // namespace chromeos |
116 | 131 |
117 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H _ | 132 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CONTROLLER_H _ |
OLD | NEW |