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

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: cleanup 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..a153b39f21066a0b92e770ebe57b62f79e731bbe
--- /dev/null
+++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_oobe_negotiator.cc
@@ -0,0 +1,57 @@
+// 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() = default;
+
+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()) {
hidehiko 2016/12/16 05:31:51 Could you comment when this happens? Also, can we
khmel 2016/12/16 18:37:55 Changed to DCHECK
hidehiko 2016/12/19 15:49:44 Comments are still missing. Please find my comment
khmel 2016/12/19 17:48:10 Resolved in .h comments
+ 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);
+ 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