Commit 680316ec authored by John Abd-El-Malek's avatar John Abd-El-Malek Committed by Commit Bot

Remove unnecessary call to StoragePartition::GetURLRequestContext in ArcAuthContext.

It didn't actually use the return value anymore (after conversion to SimpleURLLoader in r610189),
so just return a boolean.

Bug: 837753
Change-Id: I9712f1520db8203f821e36c738c290c783d97dbe
Reviewed-on: https://chromium-review.googlesource.com/c/1372913Reviewed-by: default avatarYury Khmel <khmel@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615809}
parent 5b54ed09
......@@ -71,7 +71,7 @@ ArcAuthContext::~ArcAuthContext() {
void ArcAuthContext::Prepare(const PrepareCallback& callback) {
if (context_prepared_) {
callback.Run(profile_->GetRequestContext());
callback.Run(true);
return;
}
......@@ -123,7 +123,7 @@ void ArcAuthContext::OnRefreshTokensLoaded() {
void ArcAuthContext::OnRefreshTokenTimeout() {
LOG(WARNING) << "Failed to wait for refresh token.";
identity_manager_->RemoveObserver(this);
std::move(callback_).Run(nullptr);
std::move(callback_).Run(false);
}
void ArcAuthContext::StartFetchers() {
......@@ -162,7 +162,7 @@ void ArcAuthContext::OnFetcherError(const GoogleServiceAuthError& error) {
}
LOG(WARNING) << "Too many transient errors. Stop retrying.";
}
std::move(callback_).Run(nullptr);
std::move(callback_).Run(false);
}
void ArcAuthContext::OnUbertokenSuccess(const std::string& token) {
......@@ -182,7 +182,7 @@ void ArcAuthContext::OnMergeSessionSuccess(const std::string& data) {
<< "Auth context was successfully prepared after retry.";
context_prepared_ = true;
ResetFetchers();
std::move(callback_).Run(profile_->GetRequestContext());
std::move(callback_).Run(true);
}
void ArcAuthContext::OnMergeSessionFailure(
......
......@@ -16,11 +16,6 @@
#include "services/identity/public/cpp/identity_manager.h"
class Profile;
namespace net {
class URLRequestContextGetter;
}
namespace arc {
class ArcAuthContext : public UbertokenConsumer,
......@@ -36,10 +31,9 @@ class ArcAuthContext : public UbertokenConsumer,
// Prepares the context. Calling while an inflight operation exists will
// cancel the inflight operation.
// On completion, |context| is passed to the callback. On error, |context|
// is nullptr.
using PrepareCallback =
base::Callback<void(net::URLRequestContextGetter* context)>;
// On completion, |true| is passed to the callback. On error, |false|
// is passed.
using PrepareCallback = base::Callback<void(bool success)>;
void Prepare(const PrepareCallback& callback);
// Creates and starts a request to fetch an access token for the given
......
......@@ -71,9 +71,8 @@ void ArcBackgroundAuthCodeFetcher::Fetch(FetchCallback callback) {
weak_ptr_factory_.GetWeakPtr()));
}
void ArcBackgroundAuthCodeFetcher::OnPrepared(
net::URLRequestContextGetter* request_context_getter) {
if (!request_context_getter) {
void ArcBackgroundAuthCodeFetcher::OnPrepared(bool success) {
if (!success) {
ReportResult(std::string(), OptInSilentAuthCode::CONTEXT_NOT_READY);
return;
}
......
......@@ -23,10 +23,6 @@ class AccessTokenFetcher;
struct AccessTokenInfo;
} // namespace identity
namespace net {
class URLRequestContextGetter;
} // namespace net
namespace network {
class SimpleURLLoader;
class SharedURLLoaderFactory;
......@@ -57,7 +53,7 @@ class ArcBackgroundAuthCodeFetcher : public ArcAuthCodeFetcher {
private:
void ResetFetchers();
void OnPrepared(net::URLRequestContextGetter* request_context_getter);
void OnPrepared(bool success);
void OnAccessTokenFetchComplete(GoogleServiceAuthError error,
identity::AccessTokenInfo token_info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment