Commit cf9c8934 authored by Kush Sinha's avatar Kush Sinha Committed by Commit Bot

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

This is a reland of 94c42a4f

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}

Bug: 820046
Change-Id: I614beba63f15ebe3a3db9a267ef8d747a7728a50
Reviewed-on: https://chromium-review.googlesource.com/1105777Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Kush Sinha <sinhak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568778}
parent d2429f7c
......@@ -9,7 +9,6 @@
#include "base/bind.h"
#include "base/logging.h"
#include "chrome/browser/browser_process.h"
#include "chromeos/account_manager/account_manager.h"
#include "components/signin/core/browser/account_tracker_service.h"
......@@ -140,13 +139,7 @@ void ChromeOSOAuth2TokenServiceDelegate::UpdateCredentials(
net::URLRequestContextGetter*
ChromeOSOAuth2TokenServiceDelegate::GetRequestContext() const {
// 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();
return account_manager_->GetUrlRequestContext();
}
OAuth2TokenServiceDelegate::LoadCredentialsState
......
......@@ -120,10 +120,6 @@ void InlineLoginHandlerChromeOS::CompleteLogin(const base::ListValue* args) {
const std::string& email = auth_data->FindKey("email")->GetString();
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.
Profile* profile = Profile::FromWebUI(web_ui());
......@@ -136,7 +132,8 @@ void InlineLoginHandlerChromeOS::CompleteLogin(const base::ListValue* args) {
->GetAccountManager(profile->GetPath().value());
// SigninHelper deletes itself after its work is done.
new SigninHelper(profile, account_manager, request_context, gaia_id, email,
new SigninHelper(profile, account_manager,
account_manager->GetUrlRequestContext(), gaia_id, email,
auth_code);
}
......
......@@ -352,6 +352,12 @@ void AccountManager::RemoveObserver(AccountManager::Observer* observer) {
}
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_);
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