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

Side by Side Diff: chrome/browser/chromeos/login/enrollment/enrollment_screen.h

Issue 2526973002: Added retry policy (Closed)
Patch Set: Fixed GN problem Created 3 years, 10 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_ENROLLMENT_SCREEN_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/cancelable_callback.h"
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h" 17 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h"
17 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper. h" 18 #include "chrome/browser/chromeos/login/enrollment/enterprise_enrollment_helper. h"
18 #include "chrome/browser/chromeos/login/screens/base_screen.h" 19 #include "chrome/browser/chromeos/login/screens/base_screen.h"
19 #include "chrome/browser/chromeos/policy/enrollment_config.h" 20 #include "chrome/browser/chromeos/policy/enrollment_config.h"
20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 21 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
21 #include "components/policy/core/common/cloud/enterprise_metrics.h" 22 #include "components/policy/core/common/cloud/enterprise_metrics.h"
23 #include "net/base/backoff_entry.h"
22 24
23 namespace base { 25 namespace base {
24 class ElapsedTimer; 26 class ElapsedTimer;
25 } 27 }
26 28
27 namespace pairing_chromeos { 29 namespace pairing_chromeos {
28 class ControllerPairingController; 30 class ControllerPairingController;
29 } 31 }
30 32
31 namespace chromeos { 33 namespace chromeos {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 void OnDeviceEnrolled(const std::string& additional_token) override; 76 void OnDeviceEnrolled(const std::string& additional_token) override;
75 void OnDeviceAttributeUploadCompleted(bool success) override; 77 void OnDeviceAttributeUploadCompleted(bool success) override;
76 void OnDeviceAttributeUpdatePermission(bool granted) override; 78 void OnDeviceAttributeUpdatePermission(bool granted) override;
77 79
78 // Used for testing. 80 // Used for testing.
79 EnrollmentScreenActor* GetActor() { 81 EnrollmentScreenActor* GetActor() {
80 return actor_; 82 return actor_;
81 } 83 }
82 84
83 private: 85 private:
86 friend class EnrollmentScreenUnitTest;
84 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); 87 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess);
85 FRIEND_TEST_ALL_PREFIXES(AttestationAuthEnrollmentScreenTest, TestCancel); 88 FRIEND_TEST_ALL_PREFIXES(AttestationAuthEnrollmentScreenTest, TestCancel);
86 FRIEND_TEST_ALL_PREFIXES(ForcedAttestationAuthEnrollmentScreenTest, 89 FRIEND_TEST_ALL_PREFIXES(ForcedAttestationAuthEnrollmentScreenTest,
87 TestCancel); 90 TestCancel);
88 FRIEND_TEST_ALL_PREFIXES(MultiAuthEnrollmentScreenTest, TestCancel); 91 FRIEND_TEST_ALL_PREFIXES(MultiAuthEnrollmentScreenTest, TestCancel);
89 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, 92 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest,
90 TestProperPageGetsLoadedOnEnrollmentSuccess); 93 TestProperPageGetsLoadedOnEnrollmentSuccess);
91 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, 94 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest,
92 TestAttributePromptPageGetsLoaded); 95 TestAttributePromptPageGetsLoaded);
93 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, 96 FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest,
94 TestAuthCodeGetsProperlyReceivedFromGaia); 97 TestAuthCodeGetsProperlyReceivedFromGaia);
95 FRIEND_TEST_ALL_PREFIXES(HandsOffNetworkScreenTest, RequiresNoInput); 98 FRIEND_TEST_ALL_PREFIXES(HandsOffNetworkScreenTest, RequiresNoInput);
99 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenUnitTest, Retries);
100 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenUnitTest, DoesNotRetryOnTopOfUser);
101 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenUnitTest, DoesNotRetryAfterSuccess);
96 102
97 // The authentication mechanisms that this class can use. 103 // The authentication mechanisms that this class can use.
98 enum Auth { 104 enum Auth {
99 AUTH_ATTESTATION, 105 AUTH_ATTESTATION,
100 AUTH_OAUTH, 106 AUTH_OAUTH,
101 }; 107 };
102 108
103 // Sets the current config to use for enrollment. 109 // Sets the current config to use for enrollment.
104 void SetConfig(); 110 void SetConfig();
105 111
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Shows the device attribute prompt screen. 143 // Shows the device attribute prompt screen.
138 // Used as a callback to run after successful enrollment. 144 // Used as a callback to run after successful enrollment.
139 void ShowAttributePromptScreen(); 145 void ShowAttributePromptScreen();
140 146
141 // Record metrics when we encounter an enrollment error. 147 // Record metrics when we encounter an enrollment error.
142 void RecordEnrollmentErrorMetrics(); 148 void RecordEnrollmentErrorMetrics();
143 149
144 // Advance to the next authentication mechanism if possible. 150 // Advance to the next authentication mechanism if possible.
145 bool AdvanceToNextAuth(); 151 bool AdvanceToNextAuth();
146 152
153 // Similar to OnRetry(), but responds to a timer instead of the user
154 // pressing the Retry button.
155 void AutomaticRetry();
156
157 // Processes a request to retry enrollment.
158 // Called by OnRetry() and AutomaticRetry().
159 void ProcessRetry();
160
147 pairing_chromeos::ControllerPairingController* shark_controller_ = nullptr; 161 pairing_chromeos::ControllerPairingController* shark_controller_ = nullptr;
148 162
149 EnrollmentScreenActor* actor_; 163 EnrollmentScreenActor* actor_;
150 policy::EnrollmentConfig config_; 164 policy::EnrollmentConfig config_;
151 policy::EnrollmentConfig enrollment_config_; 165 policy::EnrollmentConfig enrollment_config_;
152 Auth current_auth_ = AUTH_OAUTH; 166 Auth current_auth_ = AUTH_OAUTH;
153 Auth last_auth_ = AUTH_OAUTH; 167 Auth last_auth_ = AUTH_OAUTH;
154 bool enrollment_failed_once_ = false; 168 bool enrollment_failed_once_ = false;
155 std::string enrolling_user_domain_; 169 std::string enrolling_user_domain_;
156 std::string auth_code_; 170 std::string auth_code_;
157 std::unique_ptr<base::ElapsedTimer> elapsed_timer_; 171 std::unique_ptr<base::ElapsedTimer> elapsed_timer_;
172 net::BackoffEntry::Policy retry_policy_;
173 std::unique_ptr<net::BackoffEntry> retry_backoff_;
174 base::CancelableClosure retry_task_;
175 int num_retries_ = 0;
158 std::unique_ptr<EnterpriseEnrollmentHelper> enrollment_helper_; 176 std::unique_ptr<EnterpriseEnrollmentHelper> enrollment_helper_;
159 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; 177 base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_;
160 178
161 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); 179 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen);
162 }; 180 };
163 181
164 } // namespace chromeos 182 } // namespace chromeos
165 183
166 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_ 184 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/BUILD.gn ('k') | chrome/browser/chromeos/login/enrollment/enrollment_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698