arc: Manual auth flow deprecation. Remove unused code.
This removes unused manual auth flow since it was disabled.
TEST=bots, manually
BUG=63800376
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I2a50d9b095c416c0a8243d7f6b65646934b2f6d1
Reviewed-on: https://chromium-review.googlesource.com/579571
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Reviewed-by: Hidehiko Abe <hidehiko@chromium.org>
Commit-Queue: Yury Khmel <khmel@google.com>
Cr-Commit-Position: refs/heads/master@{#508465}
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp
index 981d375..5ac426c 100644
--- a/chrome/app/chromeos_strings.grdp
+++ b/chrome/app/chromeos_strings.grdp
@@ -4984,7 +4984,7 @@
<message name="IDS_ARC_OPT_IN_DIALOG_BUTTON_SEND_FEEDBACK" desc="Send feedback button of the opt-in dialog for Android apps.">
Send feedback
</message>
- <message name="IDS_ARC_OPT_IN_DIALOG_PROGRESS_LSO" desc="Name of LSO loading progress of the opt-in dialog for Android apps.">
+ <message name="IDS_ARC_OPT_IN_DIALOG_PROGRESS_TERMS" desc="Name of Terms Of Services loading progress of the opt-in dialog for Android apps.">
Just a sec...
</message>
<message name="IDS_ARC_OPT_IN_DIALOG_PROGRESS_ANDROID" desc="Name of Android loading progress of the opt-in dialog for Android apps.">
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn
index 6e2ee73..ae5dc71 100644
--- a/chrome/browser/chromeos/BUILD.gn
+++ b/chrome/browser/chromeos/BUILD.gn
@@ -322,8 +322,6 @@
"arc/auth/arc_background_auth_code_fetcher.cc",
"arc/auth/arc_background_auth_code_fetcher.h",
"arc/auth/arc_fetcher_base.h",
- "arc/auth/arc_manual_auth_code_fetcher.cc",
- "arc/auth/arc_manual_auth_code_fetcher.h",
"arc/auth/arc_robot_auth_code_fetcher.cc",
"arc/auth/arc_robot_auth_code_fetcher.h",
"arc/bluetooth/arc_bluetooth_bridge.cc",
@@ -1866,11 +1864,11 @@
"power/renderer_freezer_unittest.cc",
"preferences_unittest.cc",
"printing/cups_printers_manager_unittest.cc",
+ "printing/printer_detector_test_util.h",
"printing/printer_event_tracker_unittest.cc",
"printing/printers_sync_bridge_unittest.cc",
"printing/specifics_translation_unittest.cc",
"printing/synced_printers_manager_unittest.cc",
- "printing/printer_detector_test_util.h",
"printing/usb_printer_detector_unittest.cc",
"printing/zeroconf_printer_detector_unittest.cc",
"profiles/profile_list_chromeos_unittest.cc",
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.cc b/chrome/browser/chromeos/arc/arc_session_manager.cc
index af8683c9a..bc4a5c5 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager.cc
+++ b/chrome/browser/chromeos/arc/arc_session_manager.cc
@@ -534,14 +534,13 @@
}
// If ARC failed to boot normally, stop ARC. Similarly, if the current page is
- // LSO or ACTIVE_DIRECTORY_AUTH, closing the window should stop ARC since the
- // user chooses to not sign in. In any other case, ARC is booting normally and
+ // ACTIVE_DIRECTORY_AUTH, closing the window should stop ARC since the user
+ // chooses to not sign in. In any other case, ARC is booting normally and
// the instance should not be stopped.
if ((state_ != State::NEGOTIATING_TERMS_OF_SERVICE &&
state_ != State::CHECKING_ANDROID_MANAGEMENT) &&
(!support_host_ ||
(support_host_->ui_page() != ArcSupportHost::UIPage::ERROR &&
- support_host_->ui_page() != ArcSupportHost::UIPage::LSO &&
support_host_->ui_page() !=
ArcSupportHost::UIPage::ACTIVE_DIRECTORY_AUTH))) {
return;
diff --git a/chrome/browser/chromeos/arc/arc_session_manager.h b/chrome/browser/chromeos/arc/arc_session_manager.h
index 07e23238..6d8f887 100644
--- a/chrome/browser/chromeos/arc/arc_session_manager.h
+++ b/chrome/browser/chromeos/arc/arc_session_manager.h
@@ -30,8 +30,7 @@
class ArcTermsOfServiceNegotiator;
enum class ProvisioningResult : int;
-// This class proxies the request from the client to fetch an auth code from
-// LSO. It lives on the UI thread.
+// This class is responsible for handing stages of ARC life-cycle.
class ArcSessionManager : public ArcSessionRunner::Observer,
public ArcSupportHost::ErrorDelegate {
public:
@@ -356,6 +355,7 @@
// Internal state machine. See also State enum class.
State state_ = State::NOT_INITIALIZED;
+
base::ObserverList<Observer> observer_list_;
std::unique_ptr<ArcAppLauncher> playstore_launcher_;
bool reenable_arc_ = false;
diff --git a/chrome/browser/chromeos/arc/arc_support_host.cc b/chrome/browser/chromeos/arc/arc_support_host.cc
index c70e347..029e0a7 100644
--- a/chrome/browser/chromeos/arc/arc_support_host.cc
+++ b/chrome/browser/chromeos/arc/arc_support_host.cc
@@ -70,13 +70,10 @@
// No data will be provided.
constexpr char kEventOnWindowClosed[] = "onWindowClosed";
-// "onAuthSucceeded" is fired when LSO or Active Directory authentication
-// succeeds. For LSO, the auth token is passed via "code" field. For Active
-// Directory, "code" is empty.
+// "onAuthSucceeded" is fired when Active Directory authentication succeeds.
constexpr char kEventOnAuthSucceeded[] = "onAuthSucceeded";
-constexpr char kCode[] = "code";
-// "onAuthFailed" is fired when LSO or Active Directory authentication failed.
+// "onAuthFailed" is fired when Active Directory authentication failed.
constexpr char kEventOnAuthFailed[] = "onAuthFailed";
constexpr char kAuthErrorMessage[] = "errorMessage";
@@ -117,8 +114,6 @@
return os << "NO_PAGE";
case ArcSupportHost::UIPage::TERMS:
return os << "TERMS";
- case ArcSupportHost::UIPage::LSO:
- return os << "LSO";
case ArcSupportHost::UIPage::ARC_LOADING:
return os << "ARC_LOADING";
case ArcSupportHost::UIPage::ACTIVE_DIRECTORY_AUTH:
@@ -163,9 +158,6 @@
} // namespace
-// static
-const char ArcSupportHost::kStorageId[] = "arc_support";
-
ArcSupportHost::ArcSupportHost(Profile* profile)
: profile_(profile),
request_open_app_callback_(base::Bind(&RequestOpenApp)) {
@@ -227,10 +219,6 @@
ShowPage(UIPage::TERMS);
}
-void ArcSupportHost::ShowLso() {
- ShowPage(UIPage::LSO);
-}
-
void ArcSupportHost::ShowArcLoading() {
ShowPage(UIPage::ARC_LOADING);
}
@@ -263,10 +251,6 @@
case UIPage::TERMS:
message.SetString(kPage, "terms");
break;
- case UIPage::LSO:
- // TODO(hidehiko): Merge LSO and LSO_LOADING.
- message.SetString(kPage, "lso-loading");
- break;
case UIPage::ARC_LOADING:
message.SetString(kPage, "arc-loading");
break;
@@ -451,9 +435,6 @@
loadtime_data->SetString(
"greetingHeader", l10n_util::GetStringUTF16(IDS_ARC_OOBE_TERMS_HEADING));
loadtime_data->SetString(
- "loadingDescription",
- l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_PROGRESS_LSO));
- loadtime_data->SetString(
"greetingDescription",
l10n_util::GetStringUTF16(IDS_ARC_OOBE_TERMS_DESCRIPTION));
loadtime_data->SetString(
@@ -472,8 +453,8 @@
"buttonRetry",
l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_BUTTON_RETRY));
loadtime_data->SetString(
- "progressLsoLoading",
- l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_PROGRESS_LSO));
+ "progressTermsLoading",
+ l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_PROGRESS_TERMS));
loadtime_data->SetString(
"progressAndroidLoading",
l10n_util::GetStringUTF16(IDS_ARC_OPT_IN_DIALOG_PROGRESS_ANDROID));
@@ -582,12 +563,7 @@
}
} else if (event == kEventOnAuthSucceeded) {
DCHECK(auth_delegate_);
- std::string code;
- if (!message.GetString(kCode, &code)) {
- NOTREACHED();
- return;
- }
- auth_delegate_->OnAuthSucceeded(code);
+ auth_delegate_->OnAuthSucceeded();
} else if (event == kEventOnAuthFailed) {
DCHECK(auth_delegate_);
std::string error_message;
diff --git a/chrome/browser/chromeos/arc/arc_support_host.h b/chrome/browser/chromeos/arc/arc_support_host.h
index 49c43b4..a1ef654 100644
--- a/chrome/browser/chromeos/arc/arc_support_host.h
+++ b/chrome/browser/chromeos/arc/arc_support_host.h
@@ -27,7 +27,6 @@
enum class UIPage {
NO_PAGE, // Hide everything.
TERMS, // Terms content page.
- LSO, // LSO page to enter user's credentials.
ARC_LOADING, // ARC loading progress page.
ACTIVE_DIRECTORY_AUTH, // Active Directory user SAML authentication.
ERROR, // ARC start error page.
@@ -47,12 +46,11 @@
};
// Delegate to handle authentication related events. Currently used for Active
- // Directory and LSO auth.
+ // Directory.
class AuthDelegate {
public:
- // Called when authentication succeeded. LSO auth returns the auth token
- // |auth_code|, Active Directory auth returns an empty string.
- virtual void OnAuthSucceeded(const std::string& auth_code) = 0;
+ // Called when authentication succeeded.
+ virtual void OnAuthSucceeded() = 0;
// Called when authentication failed. |error_msg| contains error details.
virtual void OnAuthFailed(const std::string& error_msg) = 0;
@@ -105,8 +103,6 @@
virtual ~ErrorDelegate() = default;
};
- static const char kStorageId[];
-
using RequestOpenAppCallback = base::Callback<void(Profile* profile)>;
explicit ArcSupportHost(Profile* profile);
@@ -138,9 +134,6 @@
// Requests to show the "Terms Of Service" page.
void ShowTermsOfService();
- // Requests to show the LSO page.
- void ShowLso();
-
// Requests to show the "ARC is loading" page.
void ShowArcLoading();
diff --git a/chrome/browser/chromeos/arc/arc_support_host_unittest.cc b/chrome/browser/chromeos/arc/arc_support_host_unittest.cc
index 960dfe9..aafe680 100644
--- a/chrome/browser/chromeos/arc/arc_support_host_unittest.cc
+++ b/chrome/browser/chromeos/arc/arc_support_host_unittest.cc
@@ -19,9 +19,12 @@
namespace {
+constexpr char kFakeActiveDirectoryPrefix[] = "fake-prefix";
+constexpr char kFakeFederationUrl[] = "http://example.com/adfs/ls/awesome.aspx";
+
class MockAuthDelegateNonStrict : public ArcSupportHost::AuthDelegate {
public:
- MOCK_METHOD1(OnAuthSucceeded, void(const std::string& auth_code));
+ MOCK_METHOD0(OnAuthSucceeded, void());
MOCK_METHOD1(OnAuthFailed, void(const std::string& error_msg));
MOCK_METHOD0(OnAuthRetryClicked, void());
};
@@ -98,6 +101,13 @@
return error_delegate_.get();
}
+ void ShowAuthPage() {
+ // Currently there is only Active Directory sign-in that provides an
+ // authorization inside the OptIn flow.
+ support_host()->ShowActiveDirectoryAuth(GURL(kFakeFederationUrl),
+ kFakeActiveDirectoryPrefix);
+ }
+
private:
// Fake as if the current testing thread is UI thread.
content::TestBrowserThreadBundle bundle_;
@@ -115,14 +125,13 @@
};
TEST_F(ArcSupportHostTest, AuthSucceeded) {
- constexpr char kFakeCode[] = "fake_code";
MockAuthDelegate* auth_delegate = CreateMockAuthDelegate();
support_host()->SetAuthDelegate(auth_delegate);
- support_host()->ShowLso();
+ ShowAuthPage();
- EXPECT_CALL(*auth_delegate, OnAuthSucceeded(Eq(kFakeCode)));
- fake_arc_support()->EmulateAuthSuccess(kFakeCode);
+ EXPECT_CALL(*auth_delegate, OnAuthSucceeded());
+ fake_arc_support()->EmulateAuthSuccess();
}
TEST_F(ArcSupportHostTest, AuthFailed) {
@@ -130,7 +139,7 @@
MockAuthDelegate* auth_delegate = CreateMockAuthDelegate();
support_host()->SetAuthDelegate(auth_delegate);
- support_host()->ShowLso();
+ ShowAuthPage();
EXPECT_CALL(*auth_delegate, OnAuthFailed(kFakeError));
fake_arc_support()->EmulateAuthFailure(kFakeError);
diff --git a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
index 4bd58d0..f0b6716 100644
--- a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
+++ b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.cc
@@ -200,8 +200,7 @@
.Run(Status::FAILURE, std::string(), std::string());
}
-void ArcActiveDirectoryEnrollmentTokenFetcher::OnAuthSucceeded(
- const std::string& unused_auth_code) {
+void ArcActiveDirectoryEnrollmentTokenFetcher::OnAuthSucceeded() {
VLOG(1) << "SAML auth succeeded.";
DCHECK(!auth_session_id_.empty());
DoFetchEnrollmentToken();
diff --git a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.h b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.h
index 03e5107..8ccbe2a 100644
--- a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.h
+++ b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher.h
@@ -61,7 +61,7 @@
void OnDMTokenAvailable(const std::string& dm_token);
// ArcSupportHost::AuthDelegate:
- void OnAuthSucceeded(const std::string& unused_auth_code) override;
+ void OnAuthSucceeded() override;
void OnAuthFailed(const std::string& error_msg) override;
void OnAuthRetryClicked() override;
diff --git a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc
index 89a7f4e..8fc17eb 100644
--- a/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc
+++ b/chrome/browser/chromeos/arc/auth/arc_active_directory_enrollment_token_fetcher_browsertest.cc
@@ -87,9 +87,7 @@
explicit SimulateAuthSucceedsObserver(FakeArcSupport* fake_arc_support)
: FakeArcSupportObserverBase(fake_arc_support) {}
- void OnAuthPageShown() override {
- fake_arc_support_->EmulateAuthSuccess("" /* auth_code unused */);
- }
+ void OnAuthPageShown() override { fake_arc_support_->EmulateAuthSuccess(); }
};
// Simulates pressing the Cancel button or closing the window.
@@ -147,7 +145,7 @@
fake_arc_support_->ClickRetryButton();
} else if (saml_auth_count_ == 2) {
// Second saml auth attempt, trigger success.
- fake_arc_support_->EmulateAuthSuccess("" /* auth_code unused */);
+ fake_arc_support_->EmulateAuthSuccess();
} else {
ADD_FAILURE() << "Auth page should only be shown twice";
run_loop_->Quit();
diff --git a/chrome/browser/chromeos/arc/auth/arc_auth_context.cc b/chrome/browser/chromeos/arc/auth/arc_auth_context.cc
index 71f0330..56772fbb 100644
--- a/chrome/browser/chromeos/arc/auth/arc_auth_context.cc
+++ b/chrome/browser/chromeos/arc/auth/arc_auth_context.cc
@@ -15,8 +15,6 @@
#include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
#include "components/signin/core/browser/profile_oauth2_token_service.h"
#include "components/signin/core/browser/signin_manager_base.h"
-#include "content/public/browser/browser_context.h"
-#include "content/public/browser/storage_partition.h"
#include "content/public/common/url_constants.h"
#include "google_apis/gaia/gaia_auth_fetcher.h"
#include "google_apis/gaia/gaia_constants.h"
@@ -59,15 +57,7 @@
} // namespace
ArcAuthContext::ArcAuthContext(Profile* profile)
- : retry_backoff_(&kRetryBackoffPolicy) {
- // Reuse storage used in ARC OptIn platform app.
- const std::string site_url =
- base::StringPrintf("%s://%s/persist?%s", content::kGuestScheme,
- kPlayStoreAppId, ArcSupportHost::kStorageId);
- storage_partition_ = content::BrowserContext::GetStoragePartitionForSite(
- profile, GURL(site_url));
- CHECK(storage_partition_);
-
+ : profile_(profile), retry_backoff_(&kRetryBackoffPolicy) {
// Get token service and account ID to fetch auth tokens.
token_service_ = ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
const SigninManagerBase* const signin_manager =
@@ -85,7 +75,7 @@
void ArcAuthContext::Prepare(const PrepareCallback& callback) {
if (context_prepared_) {
- callback.Run(storage_partition_->GetURLRequestContext());
+ callback.Run(profile_->GetRequestContext());
return;
}
@@ -132,9 +122,9 @@
return;
}
- ubertoken_fetcher_.reset(
- new UbertokenFetcher(token_service_, this, GaiaConstants::kChromeOSSource,
- storage_partition_->GetURLRequestContext()));
+ ubertoken_fetcher_.reset(new UbertokenFetcher(token_service_, this,
+ GaiaConstants::kChromeOSSource,
+ profile_->GetRequestContext()));
ubertoken_fetcher_->StartFetchingToken(account_id_);
}
@@ -164,9 +154,8 @@
void ArcAuthContext::OnUbertokenSuccess(const std::string& token) {
ResetFetchers();
- merger_fetcher_.reset(
- new GaiaAuthFetcher(this, GaiaConstants::kChromeOSSource,
- storage_partition_->GetURLRequestContext()));
+ merger_fetcher_.reset(new GaiaAuthFetcher(
+ this, GaiaConstants::kChromeOSSource, profile_->GetRequestContext()));
merger_fetcher_->StartMergeSession(token, std::string());
}
@@ -180,8 +169,7 @@
<< "Auth context was successfully prepared after retry.";
context_prepared_ = true;
ResetFetchers();
- base::ResetAndReturn(&callback_)
- .Run(storage_partition_->GetURLRequestContext());
+ base::ResetAndReturn(&callback_).Run(profile_->GetRequestContext());
}
void ArcAuthContext::OnMergeSessionFailure(
diff --git a/chrome/browser/chromeos/arc/auth/arc_auth_context.h b/chrome/browser/chromeos/arc/auth/arc_auth_context.h
index 291a2c9..a9d5731 100644
--- a/chrome/browser/chromeos/arc/auth/arc_auth_context.h
+++ b/chrome/browser/chromeos/arc/auth/arc_auth_context.h
@@ -17,10 +17,6 @@
class Profile;
class ProfileOAuth2TokenService;
-namespace content {
-class StoragePartition;
-}
-
namespace net {
class URLRequestContextGetter;
}
@@ -73,17 +69,15 @@
void OnFetcherError(const GoogleServiceAuthError& error);
// Unowned pointer.
+ Profile* const profile_;
ProfileOAuth2TokenService* token_service_;
+
std::string account_id_;
std::string full_account_id_;
// Whether the merge session should be skipped. Set to true only in testing.
bool skip_merge_session_for_testing_ = false;
- // Owned by content::BrowserContent. Used to isolate cookies for auth server
- // communication and shared with ARC OptIn UI platform app.
- content::StoragePartition* storage_partition_ = nullptr;
-
PrepareCallback callback_;
bool context_prepared_ = false;
diff --git a/chrome/browser/chromeos/arc/auth/arc_auth_service.cc b/chrome/browser/chromeos/arc/auth/arc_auth_service.cc
index 63a2f229..54c80ced 100644
--- a/chrome/browser/chromeos/arc/auth/arc_auth_service.cc
+++ b/chrome/browser/chromeos/arc/auth/arc_auth_service.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/chromeos/arc/arc_session_manager.h"
#include "chrome/browser/chromeos/arc/arc_util.h"
#include "chrome/browser/chromeos/arc/auth/arc_background_auth_code_fetcher.h"
-#include "chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h"
#include "chrome/browser/chromeos/arc/auth/arc_robot_auth_code_fetcher.h"
#include "chrome/browser/chromeos/arc/policy/arc_policy_util.h"
#include "chrome/browser/lifetime/application_lifetime.h"
diff --git a/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.cc b/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.cc
deleted file mode 100644
index 456d5c8..0000000
--- a/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// 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/auth/arc_manual_auth_code_fetcher.h"
-
-#include "base/bind.h"
-#include "base/callback_helpers.h"
-#include "base/logging.h"
-#include "chrome/browser/chromeos/arc/arc_optin_uma.h"
-#include "chrome/browser/chromeos/arc/auth/arc_auth_context.h"
-
-namespace arc {
-
-ArcManualAuthCodeFetcher::ArcManualAuthCodeFetcher(ArcAuthContext* context,
- ArcSupportHost* support_host)
- : context_(context), support_host_(support_host), weak_ptr_factory_(this) {
- DCHECK(context_);
- DCHECK(support_host_);
- support_host_->SetAuthDelegate(this);
-}
-
-ArcManualAuthCodeFetcher::~ArcManualAuthCodeFetcher() {
- support_host_->SetAuthDelegate(nullptr);
-}
-
-void ArcManualAuthCodeFetcher::Fetch(const FetchCallback& callback) {
- DCHECK(pending_callback_.is_null());
- pending_callback_ = callback;
-
- FetchInternal();
-}
-
-void ArcManualAuthCodeFetcher::FetchInternal() {
- DCHECK(!pending_callback_.is_null());
- context_->Prepare(base::Bind(&ArcManualAuthCodeFetcher::OnContextPrepared,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
-void ArcManualAuthCodeFetcher::OnContextPrepared(
- net::URLRequestContextGetter* request_context_getter) {
- DCHECK(!pending_callback_.is_null());
- if (!request_context_getter) {
- UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR);
- support_host_->ShowError(ArcSupportHost::Error::SIGN_IN_NETWORK_ERROR,
- false);
- return;
- }
-
- support_host_->ShowLso();
-}
-
-void ArcManualAuthCodeFetcher::OnAuthSucceeded(const std::string& auth_code) {
- DCHECK(!pending_callback_.is_null());
- base::ResetAndReturn(&pending_callback_).Run(true /* success */, auth_code);
-}
-
-void ArcManualAuthCodeFetcher::OnAuthFailed(const std::string& error_msg) {
- // Don't report via callback. Extension is already showing more detailed
- // information. Update only UMA here.
- UpdateOptInCancelUMA(OptInCancelReason::NETWORK_ERROR);
-}
-
-void ArcManualAuthCodeFetcher::OnAuthRetryClicked() {
- DCHECK(!pending_callback_.is_null());
- FetchInternal();
-}
-
-} // namespace arc
diff --git a/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h b/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h
deleted file mode 100644
index 2f307b5..0000000
--- a/chrome/browser/chromeos/arc/auth/arc_manual_auth_code_fetcher.h
+++ /dev/null
@@ -1,58 +0,0 @@
-// 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.
-
-#ifndef CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_MANUAL_AUTH_CODE_FETCHER_H_
-#define CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_MANUAL_AUTH_CODE_FETCHER_H_
-
-#include <string>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "chrome/browser/chromeos/arc/arc_support_host.h"
-#include "chrome/browser/chromeos/arc/auth/arc_auth_code_fetcher.h"
-
-namespace net {
-class URLRequestContextGetter;
-}
-
-namespace arc {
-
-class ArcAuthContext;
-
-// Implements the auth token fetching procedure with user's "SIGN IN" button
-// click.
-class ArcManualAuthCodeFetcher : public ArcAuthCodeFetcher,
- public ArcSupportHost::AuthDelegate {
- public:
- ArcManualAuthCodeFetcher(ArcAuthContext* context,
- ArcSupportHost* support_host);
- ~ArcManualAuthCodeFetcher() override;
-
- // ArcAuthCodeFetcher:
- void Fetch(const FetchCallback& callback) override;
-
- private:
- void FetchInternal();
-
- // Called when HTTP request gets ready.
- void OnContextPrepared(net::URLRequestContextGetter* request_context_getter);
-
- // ArcSupportHost::AuthDelegate:
- void OnAuthSucceeded(const std::string& auth_code) override;
- void OnAuthFailed(const std::string& error_msg) override;
- void OnAuthRetryClicked() override;
-
- ArcAuthContext* const context_;
- ArcSupportHost* const support_host_;
-
- FetchCallback pending_callback_;
-
- base::WeakPtrFactory<ArcManualAuthCodeFetcher> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(ArcManualAuthCodeFetcher);
-};
-
-} // namespace arc
-
-#endif // CHROME_BROWSER_CHROMEOS_ARC_AUTH_ARC_MANUAL_AUTH_CODE_FETCHER_H_
diff --git a/chrome/browser/chromeos/arc/extensions/fake_arc_support.cc b/chrome/browser/chromeos/arc/extensions/fake_arc_support.cc
index 48df771..a7e661ea 100644
--- a/chrome/browser/chromeos/arc/extensions/fake_arc_support.cc
+++ b/chrome/browser/chromeos/arc/extensions/fake_arc_support.cc
@@ -58,19 +58,16 @@
UnsetMessageHost();
}
-void FakeArcSupport::EmulateAuthSuccess(const std::string& auth_code) {
- DCHECK(ui_page_ == ArcSupportHost::UIPage::LSO ||
- ui_page_ == ArcSupportHost::UIPage::ACTIVE_DIRECTORY_AUTH);
+void FakeArcSupport::EmulateAuthSuccess() {
+ DCHECK_EQ(ArcSupportHost::UIPage::ACTIVE_DIRECTORY_AUTH, ui_page_);
base::DictionaryValue message;
message.SetString("event", "onAuthSucceeded");
- message.SetString("code", auth_code);
SerializeAndSend(native_message_host_.get(), message);
}
void FakeArcSupport::EmulateAuthFailure(const std::string& error_msg) {
DCHECK(native_message_host_);
- DCHECK(ui_page_ == ArcSupportHost::UIPage::LSO ||
- ui_page_ == ArcSupportHost::UIPage::ACTIVE_DIRECTORY_AUTH);
+ DCHECK_EQ(ArcSupportHost::UIPage::ACTIVE_DIRECTORY_AUTH, ui_page_);
base::DictionaryValue message;
message.SetString("event", "onAuthFailed");
message.SetString("errorMessage", error_msg);
@@ -146,8 +143,6 @@
}
if (page == "terms") {
ui_page_ = ArcSupportHost::UIPage::TERMS;
- } else if (page == "lso-loading") {
- ui_page_ = ArcSupportHost::UIPage::LSO;
} else if (page == "arc-loading") {
ui_page_ = ArcSupportHost::UIPage::ARC_LOADING;
} else if (page == "active-directory-auth") {
diff --git a/chrome/browser/chromeos/arc/extensions/fake_arc_support.h b/chrome/browser/chromeos/arc/extensions/fake_arc_support.h
index 0122913..89e843f 100644
--- a/chrome/browser/chromeos/arc/extensions/fake_arc_support.h
+++ b/chrome/browser/chromeos/arc/extensions/fake_arc_support.h
@@ -40,8 +40,8 @@
// Emulates clicking Close button.
void Close();
- // Authentication page emulation (either LSO or Active Directory).
- void EmulateAuthSuccess(const std::string& auth_code);
+ // Authentication page emulation for Active Directory.
+ void EmulateAuthSuccess();
void EmulateAuthFailure(const std::string& error_msg);
// Emulates clicking Agree button on the fake terms of service page.
diff --git a/chrome/browser/resources/chromeos/arc_support/background.js b/chrome/browser/resources/chromeos/arc_support/background.js
index 90084ef..60f2def 100644
--- a/chrome/browser/resources/chromeos/arc_support/background.js
+++ b/chrome/browser/resources/chromeos/arc_support/background.js
@@ -8,12 +8,6 @@
*/
var appWindow = null;
-/**
- * Contains web content provided by Google authorization server.
- * @type {WebView}
- */
-var lsoView = null;
-
/** @type {TermsOfServicePage} */
var termsPage = null;
@@ -476,7 +470,7 @@
// Did it actually work?
if (details.statusCode == 200) {
// 'code' is unused, but it needs to be there.
- sendNativeMessage('onAuthSucceeded', {code: ''});
+ sendNativeMessage('onAuthSucceeded');
} else {
sendNativeMessage('onAuthFailed', {
errorMessage:
@@ -629,25 +623,12 @@
hideOverlay();
appWindow.contentWindow.stopProgressAnimation();
var doc = appWindow.contentWindow.document;
- // If the request is lso-loading and arc-loading page is currently shown,
- // then we do not switch the view. This is because both pages are saying
- // "operation in progress", and switching the page looks unwanted message
- // change from users' point of view.
- if (pageDivId != 'lso-loading' || doc.getElementById('arc-loading').hidden) {
- var pages = doc.getElementsByClassName('section');
- for (var i = 0; i < pages.length; i++) {
- pages[i].hidden = pages[i].id != pageDivId;
- }
+
+ var pages = doc.getElementsByClassName('section');
+ for (var i = 0; i < pages.length; i++) {
+ pages[i].hidden = pages[i].id != pageDivId;
}
- if (pageDivId == 'lso-loading') {
- lsoView.src = 'https://accounts.google.com/o/oauth2/v2/auth?client_id=' +
- '1070009224336-sdh77n7uot3oc99ais00jmuft6sk2fg9.apps.' +
- 'googleusercontent.com&response_type=code&redirect_uri=oob&' +
- 'scope=https://www.google.com/accounts/OAuthLogin&' +
- 'device_type=arc_plus_plus&device_id=' + currentDeviceId +
- '&hl=' + navigator.language;
- }
if (pageDivId == 'active-directory-auth') {
activeDirectoryAuthPage.enableEventProcessing(true);
activeDirectoryAuthPage.setUrls(
@@ -663,8 +644,7 @@
// Start progress bar animation for the page that has the dynamic progress
// bar. 'error' page has the static progress bar that no need to be animated.
- if (pageDivId == 'terms' || pageDivId == 'arc-loading' ||
- pageDivId == 'lso-loading') {
+ if (pageDivId == 'terms' || pageDivId == 'arc-loading') {
appWindow.contentWindow.startProgressAnimation(pageDivId);
}
}
@@ -794,71 +774,6 @@
chrome.app.runtime.onLaunched.addListener(function() {
var onAppContentLoad = function() {
- var doc = appWindow.contentWindow.document;
- lsoView = doc.getElementById('arc-support');
- lsoView.addContentScripts([{
- name: 'postProcess',
- matches: ['https://accounts.google.com/*'],
- css: {files: ['lso.css']},
- run_at: 'document_end'
- }]);
-
- var isLsoApprovalResponse = function(url) {
- var resultUrlPrefix = 'https://accounts.google.com/o/oauth2/approval?';
- return url.substring(0, resultUrlPrefix.length) == resultUrlPrefix;
- };
-
- var lsoError = false;
- var onLsoViewRequestResponseStarted = function(details) {
- if (isLsoApprovalResponse(details.url)) {
- showPage('arc-loading');
- }
- lsoError = false;
- };
-
- var onLsoViewErrorOccurred = function(details) {
- showErrorPage(
- appWindow.contentWindow.loadTimeData.getString('serverError'));
- lsoError = true;
- };
-
- var onLsoViewContentLoad = function() {
- if (lsoError) {
- return;
- }
-
- if (!isLsoApprovalResponse(lsoView.src)) {
- // Show LSO page when its content is ready.
- showPage('lso');
- // We have fixed width for LSO page in css file in order to prevent
- // unwanted webview resize animation when it is shown first time. Now
- // it safe to make it up to window width.
- lsoView.style.width = '100%';
- return;
- }
-
- lsoView.executeScript({code: 'document.title;'}, function(results) {
- var authCodePrefix = 'Success code=';
- if (results && results.length == 1 && typeof results[0] == 'string' &&
- results[0].substring(0, authCodePrefix.length) == authCodePrefix) {
- var authCode = results[0].substring(authCodePrefix.length);
- sendNativeMessage('onAuthSucceeded', {code: authCode});
- } else {
- sendNativeMessage('onAuthFailed', {errorMessage: 'Bad results.'});
- showErrorPage(appWindow.contentWindow.loadTimeData.getString(
- 'authorizationFailed'));
- }
- });
- };
-
- var requestFilter = {urls: ['<all_urls>'], types: ['main_frame']};
-
- lsoView.request.onResponseStarted.addListener(
- onLsoViewRequestResponseStarted, requestFilter);
- lsoView.request.onErrorOccurred.addListener(
- onLsoViewErrorOccurred, requestFilter);
- lsoView.addEventListener('contentload', onLsoViewContentLoad);
-
var onRetry = function() {
sendNativeMessage('onRetryClicked');
};
@@ -867,6 +782,7 @@
sendNativeMessage('onSendFeedbackClicked');
};
+ var doc = appWindow.contentWindow.document;
doc.getElementById('button-retry').addEventListener('click', onRetry);
doc.getElementById('button-send-feedback')
.addEventListener('click', onSendFeedback);
diff --git a/chrome/browser/resources/chromeos/arc_support/lso.css b/chrome/browser/resources/chromeos/arc_support/lso.css
deleted file mode 100644
index a4629ba..0000000
--- a/chrome/browser/resources/chromeos/arc_support/lso.css
+++ /dev/null
@@ -1,18 +0,0 @@
-/* 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. */
-
-::-webkit-scrollbar {
- background: transparent;
- height: 4px;
- width: 4px;
-}
-
-::-webkit-scrollbar-thumb {
- background: rgba(0, 0, 0, 0.3);
- height: 16px;
-}
-
-::-webkit-scrollbar-thumb:hover {
- background: rgba(0, 0, 0, 0.2);
-}
diff --git a/chrome/browser/resources/chromeos/arc_support/main.html b/chrome/browser/resources/chromeos/arc_support/main.html
index 810c00a..1e9fc655 100644
--- a/chrome/browser/resources/chromeos/arc_support/main.html
+++ b/chrome/browser/resources/chromeos/arc_support/main.html
@@ -80,7 +80,7 @@
<div class="content">
<p class="title" id="greetingTitle" i18n-content="greetingHeader"
aria-hidden="true"></p>
- <p class="subtitle" i18n-content="progressLsoLoading"
+ <p class="subtitle" i18n-content="progressTermsLoading"
aria-live="polite"></p>
<div class="progress-container">
<div class="progress-primary"></div>
@@ -95,7 +95,7 @@
<p class="subtitle" i18n-content="greetingDescription">
</p>
<div class="section-terms" id="terms-container">
- <webview id="terms-view" partition="persist:arc_support"></webview>
+ <webview id="terms-view"></webview>
</div>
<div class="subcontentcontainer">
<div>
@@ -151,9 +151,7 @@
i18n-content="activeDirectoryAuthDesc"></p>
<div class="section-active-directory-auth-view"
id="active-directory-auth-container">
- <webview id="active-directory-auth-view"
- partition="persist:arc_support">
- </webview>
+ <webview id="active-directory-auth-view"></webview>
</div>
<div class="section-active-directory-auth-buttons">
<paper-button class="button-active-directory-auth"
@@ -164,23 +162,6 @@
</div>
</div>
</div>
- <div id="lso-loading" class="section" hidden>
- <img class="image-header" src="images/header.png">
- <div class="scrollable">
- <div class="content">
- <div class="progress-container">
- <div class="progress-primary"></div>
- <div class="progress-secondary"></div>
- </div>
- <p class="text-status" i18n-content="progressLsoLoading"
- aria-live="polite"></p>
- </div>
- </div>
- </div>
- <div id="lso" class="section" hidden>
- <img class="image-header" src="images/header.png">
- <webview id="arc-support" partition="persist:arc_support"></webview>
- </div>
<div id="arc-loading" class="section" hidden>
<div class="header">
<img class="icon-header" src="icon/playstore.svg" aria-hidden="true">
diff --git a/chrome/browser/resources/component_extension_resources.grd b/chrome/browser/resources/component_extension_resources.grd
index 790e53c..6ec5019a 100644
--- a/chrome/browser/resources/component_extension_resources.grd
+++ b/chrome/browser/resources/component_extension_resources.grd
@@ -132,7 +132,6 @@
<include name="IDR_FIRST_RUN_DIALOG_ICON_256" file="chromeos/first_run/app/icon/256.png" type="BINDATA" />
<include name="IDR_ARC_SUPPORT_BACKGROUND_JS" file="chromeos/arc_support/background.js" flattenhtml="true" type="BINDATA" />
<include name="IDR_ARC_SUPPORT_MAIN_CSS" file="chromeos/arc_support/main.css" type="BINDATA" />
- <include name="IDR_ARC_SUPPORT_LSO_CSS" file="chromeos/arc_support/lso.css" type="BINDATA" />
<include name="IDR_ARC_SUPPORT_PLAYSTORE_CSS" file="chromeos/arc_support/playstore.css" type="BINDATA" />
<include name="IDR_ARC_SUPPORT_PLAYSTORE_JS" file="chromeos/arc_support/playstore.js" type="BINDATA" />
<include name="IDR_ARC_SUPPORT_PLAYSTORE_LOGO" file="chromeos/arc_support/icon/playstore.svg" type="BINDATA" />