Commit 0424cfa8 authored by Kush Sinha's avatar Kush Sinha Committed by Commit Bot

Revert "Code Cleanup: Dedup usages of AccountManager's URL Context"

This reverts commit 94c42a4f.

Reason for revert: To unblock https://chromium-review.googlesource.com/c/chromium/src/+/1100515

Original change's description:
> Code Cleanup: Dedup usages of AccountManager's URL Context
> 
> |InlineLoginHandlerChromeOS| and |ChromeOSOAuth2TokenServiceDelegate|
> use the system URL context because they 'know' that AccountManager is
> going to use the same. This is a leaky abstraction.
> 
> Add a method in AccountManager that returns its URL Request Context.
> This request context happens to be the system URL context for now.
> 
> Bug: 820046
> Change-Id: I668769167893c995f73df63acc575eb410c0f986
> Reviewed-on: https://chromium-review.googlesource.com/1088617
> Commit-Queue: Kush Sinha <sinhak@chromium.org>
> Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
> Reviewed-by: Lutz Justen <ljusten@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#566998}

TBR=xiyuan@chromium.org,ljusten@chromium.org,sinhak@chromium.org

Change-Id: I57c56e1cde479c6544f93c42061cfc6eec08254e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 820046
Reviewed-on: https://chromium-review.googlesource.com/1100775Reviewed-by: default avatarKush Sinha <sinhak@chromium.org>
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567208}
parent 1ef408b1
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/logging.h" #include "base/logging.h"
#include "chrome/browser/browser_process.h"
#include "chromeos/account_manager/account_manager.h" #include "chromeos/account_manager/account_manager.h"
#include "components/signin/core/browser/account_tracker_service.h" #include "components/signin/core/browser/account_tracker_service.h"
...@@ -139,7 +140,13 @@ void ChromeOSOAuth2TokenServiceDelegate::UpdateCredentials( ...@@ -139,7 +140,13 @@ void ChromeOSOAuth2TokenServiceDelegate::UpdateCredentials(
net::URLRequestContextGetter* net::URLRequestContextGetter*
ChromeOSOAuth2TokenServiceDelegate::GetRequestContext() const { ChromeOSOAuth2TokenServiceDelegate::GetRequestContext() const {
return account_manager_->GetUrlRequestContext(); // LSTs on Chrome are not channel/token bound for now and hence we can use
// the system request context.
// Note that we cannot use the Profile's request context since
// |AccountManager| acts outside the scope of Profiles.
// TODO(sinhak): Create a new |URLRequestContext| for |AccountManager| which
// conforms to token binding when those details are finalized.
return g_browser_process->system_request_context();
} }
OAuth2TokenServiceDelegate::LoadCredentialsState OAuth2TokenServiceDelegate::LoadCredentialsState
......
...@@ -121,6 +121,10 @@ void InlineLoginHandlerChromeOS::CompleteLogin(const base::ListValue* args) { ...@@ -121,6 +121,10 @@ void InlineLoginHandlerChromeOS::CompleteLogin(const base::ListValue* args) {
const std::string& email = auth_data->FindKey("email")->GetString(); const std::string& email = auth_data->FindKey("email")->GetString();
CHECK(!email.empty()); CHECK(!email.empty());
// TODO(sinhak): Get URL Context from Account Manager when that is available.
net::URLRequestContextGetter* request_context =
g_browser_process->system_request_context();
// TODO(sinhak): Do not depend on Profile unnecessarily. // TODO(sinhak): Do not depend on Profile unnecessarily.
Profile* profile = Profile::FromWebUI(web_ui()); Profile* profile = Profile::FromWebUI(web_ui());
...@@ -133,8 +137,7 @@ void InlineLoginHandlerChromeOS::CompleteLogin(const base::ListValue* args) { ...@@ -133,8 +137,7 @@ void InlineLoginHandlerChromeOS::CompleteLogin(const base::ListValue* args) {
->GetAccountManager(profile->GetPath().value()); ->GetAccountManager(profile->GetPath().value());
// SigninHelper deletes itself after its work is done. // SigninHelper deletes itself after its work is done.
new SigninHelper(profile, account_manager, new SigninHelper(profile, account_manager, request_context, gaia_id, email,
account_manager->GetUrlRequestContext(), gaia_id, email,
auth_code); auth_code);
} }
......
...@@ -329,12 +329,6 @@ void AccountManager::RemoveObserver(AccountManager::Observer* observer) { ...@@ -329,12 +329,6 @@ void AccountManager::RemoveObserver(AccountManager::Observer* observer) {
} }
net::URLRequestContextGetter* AccountManager::GetUrlRequestContext() { net::URLRequestContextGetter* AccountManager::GetUrlRequestContext() {
// LSTs on Chrome are not channel/token bound for now and hence we can use
// the system request context.
// Note that we cannot use the Profile's request context since
// |AccountManager| acts outside the scope of Profiles.
// TODO(sinhak): Create a new |URLRequestContext| for |AccountManager| which
// conforms to token binding when those details are finalized.
DCHECK(request_context_); DCHECK(request_context_);
return request_context_; return request_context_;
} }
......
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