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

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

Issue 2561023002: arc: ARC loading progress should not be shown when started from OOBE. (Closed)
Patch Set: rebased + comments updated Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.cc
diff --git a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.cc b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.cc
index 8214aa5a26e785c318d8f025bf1b5c23a5790db3..3ea27f4e7c41d4dc3868215735783c0fbbcc58e7 100644
--- a/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.cc
+++ b/chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.cc
@@ -4,95 +4,24 @@
#include "chrome/browser/chromeos/arc/optin/arc_terms_of_service_negotiator.h"
-#include <string>
-
#include "base/callback_helpers.h"
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "chrome/browser/chromeos/arc/optin/arc_optin_preference_handler.h"
namespace arc {
-ArcTermsOfServiceNegotiator::ArcTermsOfServiceNegotiator(
- PrefService* pref_service,
- ArcSupportHost* support_host)
- : pref_service_(pref_service), support_host_(support_host) {
- DCHECK(pref_service_);
- DCHECK(support_host_);
-}
+ArcTermsOfServiceNegotiator::ArcTermsOfServiceNegotiator() = default;
-ArcTermsOfServiceNegotiator::~ArcTermsOfServiceNegotiator() {
- support_host_->RemoveObserver(this);
-}
+ArcTermsOfServiceNegotiator::~ArcTermsOfServiceNegotiator() = default;
void ArcTermsOfServiceNegotiator::StartNegotiation(
const NegotiationCallback& callback) {
DCHECK(pending_callback_.is_null());
- DCHECK(!preference_handler_);
pending_callback_ = callback;
- preference_handler_ =
- base::MakeUnique<ArcOptInPreferenceHandler>(this, pref_service_);
- // This automatically updates all preferences.
- preference_handler_->Start();
-
- support_host_->AddObserver(this);
- support_host_->ShowTermsOfService();
+ StartNegotiationImpl();
}
-void ArcTermsOfServiceNegotiator::OnWindowClosed() {
+void ArcTermsOfServiceNegotiator::ReportResult(bool accepted) {
DCHECK(!pending_callback_.is_null());
- DCHECK(preference_handler_);
- support_host_->RemoveObserver(this);
- preference_handler_.reset();
-
- // User cancels terms-of-service agreement UI by clicking "Cancel" button
- // or closing the window directly.
- base::ResetAndReturn(&pending_callback_).Run(false);
-}
-
-void ArcTermsOfServiceNegotiator::OnTermsAgreed(
- bool is_metrics_enabled,
- bool is_backup_and_restore_enabled,
- bool is_location_service_enabled) {
- DCHECK(!pending_callback_.is_null());
- DCHECK(preference_handler_);
- support_host_->RemoveObserver(this);
-
- // Update the preferences with the value passed from UI.
- preference_handler_->EnableMetrics(is_metrics_enabled);
- preference_handler_->EnableBackupRestore(is_backup_and_restore_enabled);
- preference_handler_->EnableLocationService(is_location_service_enabled);
- preference_handler_.reset();
-
- base::ResetAndReturn(&pending_callback_).Run(true);
-}
-
-void ArcTermsOfServiceNegotiator::OnAuthSucceeded(
- const std::string& auth_code) {
- NOTREACHED();
-}
-
-void ArcTermsOfServiceNegotiator::OnRetryClicked() {
- support_host_->ShowTermsOfService();
-}
-
-void ArcTermsOfServiceNegotiator::OnSendFeedbackClicked() {
- NOTREACHED();
-}
-
-void ArcTermsOfServiceNegotiator::OnMetricsModeChanged(bool enabled,
- bool managed) {
- support_host_->SetMetricsPreferenceCheckbox(enabled, managed);
-}
-
-void ArcTermsOfServiceNegotiator::OnBackupAndRestoreModeChanged(bool enabled,
- bool managed) {
- support_host_->SetBackupAndRestorePreferenceCheckbox(enabled, managed);
-}
-
-void ArcTermsOfServiceNegotiator::OnLocationServicesModeChanged(bool enabled,
- bool managed) {
- support_host_->SetLocationServicesPreferenceCheckbox(enabled, managed);
+ base::ResetAndReturn(&pending_callback_).Run(accepted);
}
} // namespace arc

Powered by Google App Engine
This is Rietveld 408576698