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

Unified Diff: chrome/browser/chromeos/arc/optin/arc_terms_of_service_initial_oobe_negotiator_for_managed_user.cc

Issue 2561023002: arc: ARC loading progress should not be shown when started from OOBE. (Closed)
Patch Set: comments addresses Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/optin/arc_terms_of_service_initial_oobe_negotiator_for_managed_user.cc
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_initial_oobe_negotiator_for_managed_user.cc b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_initial_oobe_negotiator_for_managed_user.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8bc4f628e192c64411071ef71b41f49aa463f9f7
--- /dev/null
+++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_initial_oobe_negotiator_for_managed_user.cc
@@ -0,0 +1,75 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_initial_oobe_negotiator_for_managed_user.h"
+
+#include "base/bind.h"
+#include "chrome/browser/chromeos/login/screens/arc_terms_of_service_screen_actor.h"
+#include "chrome/browser/chromeos/login/ui/login_display_host.h"
+#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h"
+#include "chrome/common/pref_names.h"
+#include "components/prefs/pref_service.h"
+
+namespace arc {
+
+namespace {
+chromeos::ArcTermsOfServiceScreenActor* actor_for_testing = nullptr;
+
+chromeos::ArcTermsOfServiceScreenActor* GetScreenActor() {
+ // Inject testing instance.
+ if (actor_for_testing)
+ return actor_for_testing;
+
+ chromeos::LoginDisplayHost* host = chromeos::LoginDisplayHost::default_host();
+ if (!host)
+ return nullptr;
+ DCHECK(host->GetOobeUI());
+ return host->GetOobeUI()->GetArcTermsOfServiceScreenActor();
+}
+
+} // namespace
+
+// static
+void ArcTermsOfServiceInitialOobeNegotiatorForManagedUser::
+ SetArcTermsOfServiceScreenActorForTesting(
+ chromeos::ArcTermsOfServiceScreenActor* actor) {
+ actor_for_testing = actor;
+}
+
+ArcTermsOfServiceInitialOobeNegotiatorForManagedUser::
+ ArcTermsOfServiceInitialOobeNegotiatorForManagedUser() = default;
+
+ArcTermsOfServiceInitialOobeNegotiatorForManagedUser::
+ ~ArcTermsOfServiceInitialOobeNegotiatorForManagedUser() = default;
+
+void ArcTermsOfServiceInitialOobeNegotiatorForManagedUser::
+ StartNegotiationImpl() {
+ chromeos::ArcTermsOfServiceScreenActor* screen_actor = GetScreenActor();
+ DCHECK(screen_actor);
+ screen_actor->AddObserver(this);
+}
+
+void ArcTermsOfServiceInitialOobeNegotiatorForManagedUser::HandleTermsAccepted(
+ bool accepted) {
+ chromeos::ArcTermsOfServiceScreenActor* screen_actor = GetScreenActor();
+ // In case called from OnActorDestroyed, screen actor is not available.
+ if (screen_actor)
+ screen_actor->RemoveObserver(this);
+ ReportResult(accepted);
+}
+
+void ArcTermsOfServiceInitialOobeNegotiatorForManagedUser::OnSkip() {
+ HandleTermsAccepted(false);
+}
+
+void ArcTermsOfServiceInitialOobeNegotiatorForManagedUser::OnAccept() {
+ HandleTermsAccepted(true);
+}
+
+void ArcTermsOfServiceInitialOobeNegotiatorForManagedUser::OnActorDestroyed(
+ chromeos::ArcTermsOfServiceScreenActor* actor) {
+ HandleTermsAccepted(false);
+}
+
+} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698