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

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

Issue 2561023002: arc: ARC loading progress should not be shown when started from OOBE. (Closed)
Patch Set: oobe negotiator based 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_oobe_negotiator.cc
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.cc b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..96b3bdba02d2999d56ff5fe64c7d6cc253c1152d
--- /dev/null
+++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.cc
@@ -0,0 +1,61 @@
+// 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_oobe_negotiator.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 {
+
+ArcTermsOfServiceOOBENegotiator::ArcTermsOfServiceOOBENegotiator(
+ PrefService* pref_service)
+ : pref_service_(pref_service) {}
+
+ArcTermsOfServiceOOBENegotiator::~ArcTermsOfServiceOOBENegotiator() {
+ chromeos::LoginDisplayHost* host = chromeos::LoginDisplayHost::default_host();
+ if (host && host->GetOobeUI())
+ host->GetOobeUI()->GetArcTermsOfServiceScreenActor()->RemoveObserver(this);
+}
+
+void ArcTermsOfServiceOOBENegotiator::StartNegotiation(
+ const NegotiationCallback& callback) {
+ ArcTermsOfServiceNegotiator::StartNegotiation(callback);
+
+ chromeos::LoginDisplayHost* host = chromeos::LoginDisplayHost::default_host();
+ if (!host || !host->GetOobeUI()) {
+ ReportResult(false);
+ return;
+ }
+
+ host->GetOobeUI()->GetArcTermsOfServiceScreenActor()->AddObserver(this);
+}
+
+void ArcTermsOfServiceOOBENegotiator::HandleTermsAccepted(bool accepted) {
+ chromeos::LoginDisplayHost* host = chromeos::LoginDisplayHost::default_host();
+ DCHECK(host && host->GetOobeUI());
+ host->GetOobeUI()->GetArcTermsOfServiceScreenActor()->RemoveObserver(this);
+ if (accepted)
+ pref_service_->SetBoolean(prefs::kArcEnabled, true);
+ ReportResult(accepted);
+}
+
+void ArcTermsOfServiceOOBENegotiator::OnSkip() {
+ HandleTermsAccepted(false);
+}
+
+void ArcTermsOfServiceOOBENegotiator::OnAccept() {
+ HandleTermsAccepted(true);
+}
+
+void ArcTermsOfServiceOOBENegotiator::OnActorDestroyed(
+ chromeos::ArcTermsOfServiceScreenActor* actor) {
+ HandleTermsAccepted(false);
+}
+
+} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698