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 = { ...@@ -80,10 +80,6 @@ const net::BackoffEntry::Policy kBackoffPolicy = {
false, 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 // State of requests to Gaia logout endpoint. Used as entry for histogram
// |Signin.GaiaCookieManager.Logout|. // |Signin.GaiaCookieManager.Logout|.
enum LogoutRequestState { enum LogoutRequestState {
...@@ -482,7 +478,8 @@ void GaiaCookieManagerService::InitCookieListener() { ...@@ -482,7 +478,8 @@ void GaiaCookieManagerService::InitCookieListener() {
// testing contexts. // testing contexts.
if (cookie_manager) { if (cookie_manager) {
cookie_manager->AddCookieChangeListener( cookie_manager->AddCookieChangeListener(
GaiaUrls::GetInstance()->secure_google_url(), kGaiaCookieName, GaiaUrls::GetInstance()->secure_google_url(),
GaiaConstants::kGaiaSigninCookieName,
cookie_listener_receiver_.BindNewPipeAndPassRemote()); cookie_listener_receiver_.BindNewPipeAndPassRemote());
cookie_listener_receiver_.set_disconnect_handler(base::BindOnce( cookie_listener_receiver_.set_disconnect_handler(base::BindOnce(
&GaiaCookieManagerService::OnCookieListenerConnectionError, &GaiaCookieManagerService::OnCookieListenerConnectionError,
...@@ -602,10 +599,11 @@ void GaiaCookieManagerService::ForceOnCookieChangeProcessing() { ...@@ -602,10 +599,11 @@ void GaiaCookieManagerService::ForceOnCookieChangeProcessing() {
GURL google_url = GaiaUrls::GetInstance()->secure_google_url(); GURL google_url = GaiaUrls::GetInstance()->secure_google_url();
std::unique_ptr<net::CanonicalCookie> cookie = std::unique_ptr<net::CanonicalCookie> cookie =
net::CanonicalCookie::CreateSanitizedCookie( net::CanonicalCookie::CreateSanitizedCookie(
google_url, kGaiaCookieName, std::string(), "." + google_url.host(), google_url, GaiaConstants::kGaiaSigninCookieName, std::string(),
"/", base::Time(), base::Time(), base::Time(), true /* secure */, "." + google_url.host(), "/", base::Time(), base::Time(),
false /* httponly */, net::CookieSameSite::NO_RESTRICTION, base::Time(), true /* secure */, false /* httponly */,
net::COOKIE_PRIORITY_DEFAULT, false /* same_party */); net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT,
false /* same_party */);
OnCookieChange( OnCookieChange(
net::CookieChangeInfo(*cookie, net::CookieAccessResult(), net::CookieChangeInfo(*cookie, net::CookieAccessResult(),
net::CookieChangeCause::UNKNOWN_DELETION)); net::CookieChangeCause::UNKNOWN_DELETION));
...@@ -693,7 +691,7 @@ void GaiaCookieManagerService::MarkListAccountsStale() { ...@@ -693,7 +691,7 @@ void GaiaCookieManagerService::MarkListAccountsStale() {
void GaiaCookieManagerService::OnCookieChange( void GaiaCookieManagerService::OnCookieChange(
const net::CookieChangeInfo& change) { const net::CookieChangeInfo& change) {
DCHECK_EQ(kGaiaCookieName, change.cookie.Name()); DCHECK_EQ(GaiaConstants::kGaiaSigninCookieName, change.cookie.Name());
DCHECK(change.cookie.IsDomainMatch( DCHECK(change.cookie.IsDomainMatch(
GaiaUrls::GetInstance()->google_url().host())); GaiaUrls::GetInstance()->google_url().host()));
list_accounts_stale_ = true; list_accounts_stale_ = true;
......
...@@ -44,9 +44,6 @@ class AccountConsistencyService : public KeyedService, ...@@ -44,9 +44,6 @@ class AccountConsistencyService : public KeyedService,
// Google authentication cookies are managed by |AccountReconcilor|). // Google authentication cookies are managed by |AccountReconcilor|).
static const char kChromeConnectedCookieName[]; static const char kChromeConnectedCookieName[];
// Name of the Google authentication cookie.
static const char kGaiaCookieName[];
AccountConsistencyService( AccountConsistencyService(
web::BrowserState* browser_state, web::BrowserState* browser_state,
AccountReconcilor* account_reconcilor, AccountReconcilor* account_reconcilor,
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "components/signin/public/base/account_consistency_method.h" #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_cookie_mutator.h"
#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.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 "google_apis/gaia/gaia_urls.h"
#include "ios/web/common/web_view_creation_util.h" #include "ios/web/common/web_view_creation_util.h"
#include "ios/web/public/browser_state.h" #include "ios/web/public/browser_state.h"
...@@ -357,8 +358,6 @@ void AccountConsistencyHandler::WebStateDestroyed() { ...@@ -357,8 +358,6 @@ void AccountConsistencyHandler::WebStateDestroyed() {
const char AccountConsistencyService::kChromeConnectedCookieName[] = const char AccountConsistencyService::kChromeConnectedCookieName[] =
"CHROME_CONNECTED"; "CHROME_CONNECTED";
const char AccountConsistencyService::kGaiaCookieName[] = "SAPISID";
AccountConsistencyService::AccountConsistencyService( AccountConsistencyService::AccountConsistencyService(
web::BrowserState* browser_state, web::BrowserState* browser_state,
AccountReconcilor* account_reconcilor, AccountReconcilor* account_reconcilor,
...@@ -428,7 +427,7 @@ void AccountConsistencyService::TriggerGaiaCookieChangeIfDeleted( ...@@ -428,7 +427,7 @@ void AccountConsistencyService::TriggerGaiaCookieChangeIfDeleted(
const net::CookieAccessResultList& cookie_list, const net::CookieAccessResultList& cookie_list,
const net::CookieAccessResultList& unused_excluded_cookies) { const net::CookieAccessResultList& unused_excluded_cookies) {
for (const auto& cookie : cookie_list) { for (const auto& cookie : cookie_list) {
if (cookie.cookie.Name() == kGaiaCookieName) { if (cookie.cookie.Name() == GaiaConstants::kGaiaSigninCookieName) {
LogIOSGaiaCookiesState( LogIOSGaiaCookiesState(
GaiaCookieStateOnSignedInNavigation::kGaiaCookiePresentOnNavigation); GaiaCookieStateOnSignedInNavigation::kGaiaCookiePresentOnNavigation);
return; return;
......
...@@ -107,4 +107,8 @@ const char kClientOAuthEmailKey[] = "email"; ...@@ -107,4 +107,8 @@ const char kClientOAuthEmailKey[] = "email";
// Used as an Invalid refresh token. // Used as an Invalid refresh token.
const char kInvalidRefreshToken[] = "invalid_refresh_token"; const char kInvalidRefreshToken[] = "invalid_refresh_token";
// Name of the Google authentication cookie.
const char kGaiaSigninCookieName[] = "SAPISID";
} // namespace GaiaConstants } // namespace GaiaConstants
...@@ -58,6 +58,9 @@ extern const char kClientOAuthEmailKey[]; ...@@ -58,6 +58,9 @@ extern const char kClientOAuthEmailKey[];
// Refresh token that is guaranteed to be invalid. // Refresh token that is guaranteed to be invalid.
extern const char kInvalidRefreshToken[]; extern const char kInvalidRefreshToken[];
// Name of the Google authentication cookie.
extern const char kGaiaSigninCookieName[];
} // namespace GaiaConstants } // namespace GaiaConstants
#endif // GOOGLE_APIS_GAIA_GAIA_CONSTANTS_H_ #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