Commit f077558a authored by Nohemi Fernandez's avatar Nohemi Fernandez Committed by Chromium LUCI CQ

[iOS] Refactor GAIA constants in iOS components.

Bug: N/A
Change-Id: Ib53af301ed14bdacf6ddc1a05d4681d205a10527
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2624627Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Nohemi Fernandez <fernandex@chromium.org>
Cr-Commit-Position: refs/heads/master@{#842570}
parent f919c90b
......@@ -80,10 +80,6 @@ const net::BackoffEntry::Policy kBackoffPolicy = {
false,
};
// Name of the GAIA cookie that is being observed to detect when available
// accounts have changed in the content-area.
const char* const kGaiaCookieName = "SAPISID";
// State of requests to Gaia logout endpoint. Used as entry for histogram
// |Signin.GaiaCookieManager.Logout|.
enum LogoutRequestState {
......@@ -482,7 +478,8 @@ void GaiaCookieManagerService::InitCookieListener() {
// testing contexts.
if (cookie_manager) {
cookie_manager->AddCookieChangeListener(
GaiaUrls::GetInstance()->secure_google_url(), kGaiaCookieName,
GaiaUrls::GetInstance()->secure_google_url(),
GaiaConstants::kGaiaSigninCookieName,
cookie_listener_receiver_.BindNewPipeAndPassRemote());
cookie_listener_receiver_.set_disconnect_handler(base::BindOnce(
&GaiaCookieManagerService::OnCookieListenerConnectionError,
......@@ -602,10 +599,11 @@ void GaiaCookieManagerService::ForceOnCookieChangeProcessing() {
GURL google_url = GaiaUrls::GetInstance()->secure_google_url();
std::unique_ptr<net::CanonicalCookie> cookie =
net::CanonicalCookie::CreateSanitizedCookie(
google_url, kGaiaCookieName, std::string(), "." + google_url.host(),
"/", base::Time(), base::Time(), base::Time(), true /* secure */,
false /* httponly */, net::CookieSameSite::NO_RESTRICTION,
net::COOKIE_PRIORITY_DEFAULT, false /* same_party */);
google_url, GaiaConstants::kGaiaSigninCookieName, std::string(),
"." + google_url.host(), "/", base::Time(), base::Time(),
base::Time(), true /* secure */, false /* httponly */,
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */);
OnCookieChange(
net::CookieChangeInfo(*cookie, net::CookieAccessResult(),
net::CookieChangeCause::UNKNOWN_DELETION));
......@@ -693,7 +691,7 @@ void GaiaCookieManagerService::MarkListAccountsStale() {
void GaiaCookieManagerService::OnCookieChange(
const net::CookieChangeInfo& change) {
DCHECK_EQ(kGaiaCookieName, change.cookie.Name());
DCHECK_EQ(GaiaConstants::kGaiaSigninCookieName, change.cookie.Name());
DCHECK(change.cookie.IsDomainMatch(
GaiaUrls::GetInstance()->google_url().host()));
list_accounts_stale_ = true;
......
......@@ -44,9 +44,6 @@ class AccountConsistencyService : public KeyedService,
// Google authentication cookies are managed by |AccountReconcilor|).
static const char kChromeConnectedCookieName[];
// Name of the Google authentication cookie.
static const char kGaiaCookieName[];
AccountConsistencyService(
web::BrowserState* browser_state,
AccountReconcilor* account_reconcilor,
......
......@@ -22,6 +22,7 @@
#include "components/signin/public/base/account_consistency_method.h"
#include "components/signin/public/identity_manager/accounts_cookie_mutator.h"
#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h"
#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/gaia/gaia_urls.h"
#include "ios/web/common/web_view_creation_util.h"
#include "ios/web/public/browser_state.h"
......@@ -357,8 +358,6 @@ void AccountConsistencyHandler::WebStateDestroyed() {
const char AccountConsistencyService::kChromeConnectedCookieName[] =
"CHROME_CONNECTED";
const char AccountConsistencyService::kGaiaCookieName[] = "SAPISID";
AccountConsistencyService::AccountConsistencyService(
web::BrowserState* browser_state,
AccountReconcilor* account_reconcilor,
......@@ -428,7 +427,7 @@ void AccountConsistencyService::TriggerGaiaCookieChangeIfDeleted(
const net::CookieAccessResultList& cookie_list,
const net::CookieAccessResultList& unused_excluded_cookies) {
for (const auto& cookie : cookie_list) {
if (cookie.cookie.Name() == kGaiaCookieName) {
if (cookie.cookie.Name() == GaiaConstants::kGaiaSigninCookieName) {
LogIOSGaiaCookiesState(
GaiaCookieStateOnSignedInNavigation::kGaiaCookiePresentOnNavigation);
return;
......
......@@ -107,4 +107,8 @@ const char kClientOAuthEmailKey[] = "email";
// Used as an Invalid refresh token.
const char kInvalidRefreshToken[] = "invalid_refresh_token";
// Name of the Google authentication cookie.
const char kGaiaSigninCookieName[] = "SAPISID";
} // namespace GaiaConstants
......@@ -58,6 +58,9 @@ extern const char kClientOAuthEmailKey[];
// Refresh token that is guaranteed to be invalid.
extern const char kInvalidRefreshToken[];
// Name of the Google authentication cookie.
extern const char kGaiaSigninCookieName[];
} // namespace GaiaConstants
#endif // GOOGLE_APIS_GAIA_GAIA_CONSTANTS_H_
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