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

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

Issue 2870203003: Make Hands-Off Zero-Touch Enrollment compatibile with tests (Closed)
Patch Set: Created 3 years, 7 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 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" 5 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 "Enterprise.EnrollmentTime.Failure"; 50 "Enterprise.EnrollmentTime.Failure";
51 const char * const kMetricEnrollmentTimeSuccess = 51 const char * const kMetricEnrollmentTimeSuccess =
52 "Enterprise.EnrollmentTime.Success"; 52 "Enterprise.EnrollmentTime.Success";
53 53
54 // Retry policy constants. 54 // Retry policy constants.
55 constexpr int kInitialDelayMS = 4 * 1000; // 4 seconds 55 constexpr int kInitialDelayMS = 4 * 1000; // 4 seconds
56 constexpr double kMultiplyFactor = 1.5; 56 constexpr double kMultiplyFactor = 1.5;
57 constexpr double kJitterFactor = 0.1; // +/- 10% jitter 57 constexpr double kJitterFactor = 0.1; // +/- 10% jitter
58 constexpr int64_t kMaxDelayMS = 8 * 60 * 1000; // 8 minutes 58 constexpr int64_t kMaxDelayMS = 8 * 60 * 1000; // 8 minutes
59 59
60 // Helper function. Returns true if we are using Hands Off Enrollment.
61 bool UsingHandsOffEnrollment() {
62 return policy::DeviceCloudPolicyManagerChromeOS::
63 GetZeroTouchEnrollmentMode() ==
64 policy::ZeroTouchEnrollmentMode::HANDS_OFF;
65 }
66
67 } // namespace 60 } // namespace
68 61
69 namespace chromeos { 62 namespace chromeos {
70 63
71 // static 64 // static
72 EnrollmentScreen* EnrollmentScreen::Get(ScreenManager* manager) { 65 EnrollmentScreen* EnrollmentScreen::Get(ScreenManager* manager) {
73 return static_cast<EnrollmentScreen*>( 66 return static_cast<EnrollmentScreen*>(
74 manager->GetScreen(OobeScreen::SCREEN_OOBE_ENROLLMENT)); 67 manager->GetScreen(OobeScreen::SCREEN_OOBE_ENROLLMENT));
75 } 68 }
76 69
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 if (elapsed_timer_) 384 if (elapsed_timer_)
392 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_); 385 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_);
393 } 386 }
394 387
395 void EnrollmentScreen::JoinDomain(OnDomainJoinedCallback on_joined_callback) { 388 void EnrollmentScreen::JoinDomain(OnDomainJoinedCallback on_joined_callback) {
396 on_joined_callback_ = std::move(on_joined_callback); 389 on_joined_callback_ = std::move(on_joined_callback);
397 view_->ShowAdJoin(); 390 view_->ShowAdJoin();
398 } 391 }
399 392
400 } // namespace chromeos 393 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698