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() { ...@@ -71,7 +71,7 @@ ArcAuthContext::~ArcAuthContext() {
void ArcAuthContext::Prepare(const PrepareCallback& callback) { void ArcAuthContext::Prepare(const PrepareCallback& callback) {
if (context_prepared_) { if (context_prepared_) {
callback.Run(profile_->GetRequestContext()); callback.Run(true);
return; return;
} }
...@@ -123,7 +123,7 @@ void ArcAuthContext::OnRefreshTokensLoaded() { ...@@ -123,7 +123,7 @@ void ArcAuthContext::OnRefreshTokensLoaded() {
void ArcAuthContext::OnRefreshTokenTimeout() { void ArcAuthContext::OnRefreshTokenTimeout() {
LOG(WARNING) << "Failed to wait for refresh token."; LOG(WARNING) << "Failed to wait for refresh token.";
identity_manager_->RemoveObserver(this); identity_manager_->RemoveObserver(this);
std::move(callback_).Run(nullptr); std::move(callback_).Run(false);
} }
void ArcAuthContext::StartFetchers() { void ArcAuthContext::StartFetchers() {
...@@ -162,7 +162,7 @@ void ArcAuthContext::OnFetcherError(const GoogleServiceAuthError& error) { ...@@ -162,7 +162,7 @@ void ArcAuthContext::OnFetcherError(const GoogleServiceAuthError& error) {
} }
LOG(WARNING) << "Too many transient errors. Stop retrying."; 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) { void ArcAuthContext::OnUbertokenSuccess(const std::string& token) {
...@@ -182,7 +182,7 @@ void ArcAuthContext::OnMergeSessionSuccess(const std::string& data) { ...@@ -182,7 +182,7 @@ void ArcAuthContext::OnMergeSessionSuccess(const std::string& data) {
<< "Auth context was successfully prepared after retry."; << "Auth context was successfully prepared after retry.";
context_prepared_ = true; context_prepared_ = true;
ResetFetchers(); ResetFetchers();
std::move(callback_).Run(profile_->GetRequestContext()); std::move(callback_).Run(true);
} }
void ArcAuthContext::OnMergeSessionFailure( void ArcAuthContext::OnMergeSessionFailure(
......
...@@ -16,11 +16,6 @@ ...@@ -16,11 +16,6 @@
#include "services/identity/public/cpp/identity_manager.h" #include "services/identity/public/cpp/identity_manager.h"
class Profile; class Profile;
namespace net {
class URLRequestContextGetter;
}
namespace arc { namespace arc {
class ArcAuthContext : public UbertokenConsumer, class ArcAuthContext : public UbertokenConsumer,
...@@ -36,10 +31,9 @@ class ArcAuthContext : public UbertokenConsumer, ...@@ -36,10 +31,9 @@ class ArcAuthContext : public UbertokenConsumer,
// Prepares the context. Calling while an inflight operation exists will // Prepares the context. Calling while an inflight operation exists will
// cancel the inflight operation. // cancel the inflight operation.
// On completion, |context| is passed to the callback. On error, |context| // On completion, |true| is passed to the callback. On error, |false|
// is nullptr. // is passed.
using PrepareCallback = using PrepareCallback = base::Callback<void(bool success)>;
base::Callback<void(net::URLRequestContextGetter* context)>;
void Prepare(const PrepareCallback& callback); void Prepare(const PrepareCallback& callback);
// Creates and starts a request to fetch an access token for the given // Creates and starts a request to fetch an access token for the given
......
...@@ -71,9 +71,8 @@ void ArcBackgroundAuthCodeFetcher::Fetch(FetchCallback callback) { ...@@ -71,9 +71,8 @@ void ArcBackgroundAuthCodeFetcher::Fetch(FetchCallback callback) {
weak_ptr_factory_.GetWeakPtr())); weak_ptr_factory_.GetWeakPtr()));
} }
void ArcBackgroundAuthCodeFetcher::OnPrepared( void ArcBackgroundAuthCodeFetcher::OnPrepared(bool success) {
net::URLRequestContextGetter* request_context_getter) { if (!success) {
if (!request_context_getter) {
ReportResult(std::string(), OptInSilentAuthCode::CONTEXT_NOT_READY); ReportResult(std::string(), OptInSilentAuthCode::CONTEXT_NOT_READY);
return; return;
} }
......
...@@ -23,10 +23,6 @@ class AccessTokenFetcher; ...@@ -23,10 +23,6 @@ class AccessTokenFetcher;
struct AccessTokenInfo; struct AccessTokenInfo;
} // namespace identity } // namespace identity
namespace net {
class URLRequestContextGetter;
} // namespace net
namespace network { namespace network {
class SimpleURLLoader; class SimpleURLLoader;
class SharedURLLoaderFactory; class SharedURLLoaderFactory;
...@@ -57,7 +53,7 @@ class ArcBackgroundAuthCodeFetcher : public ArcAuthCodeFetcher { ...@@ -57,7 +53,7 @@ class ArcBackgroundAuthCodeFetcher : public ArcAuthCodeFetcher {
private: private:
void ResetFetchers(); void ResetFetchers();
void OnPrepared(net::URLRequestContextGetter* request_context_getter); void OnPrepared(bool success);
void OnAccessTokenFetchComplete(GoogleServiceAuthError error, void OnAccessTokenFetchComplete(GoogleServiceAuthError error,
identity::AccessTokenInfo token_info); 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