Commit b7ed9196 authored by Jérôme Lebel's avatar Jérôme Lebel Committed by Commit Bot

[iOS] kUseMultiloginEndpoint linked to kWKHTTPSystemCookieStore

kUseMultiloginEndpoint can only be enabled if kWKHTTPSystemCookieStore
is enabled. CookieManager::SetCanonicalCookie() fails to store the
cookies.

Bug: 902584, 892130
Change-Id: If3ba635f031e7de830c87b7a97fd262a9e6e2cee
Reviewed-on: https://chromium-review.googlesource.com/c/1352324
Commit-Queue: Jérôme Lebel <jlebel@chromium.org>
Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612157}
parent df04c03b
......@@ -226,6 +226,12 @@ void AccountReconcilor::Initialize(bool start_reconcile_if_tokens_available) {
}
}
#if defined(OS_IOS)
void AccountReconcilor::SetIsWKHTTPSystemCookieStoreEnabled(bool is_enabled) {
is_wkhttp_system_cookie_store_enabled_ = is_enabled;
}
#endif // defined(OS_IOS)
void AccountReconcilor::EnableReconcile() {
DCHECK(delegate_->IsReconcileEnabled());
RegisterWithCookieManagerService();
......@@ -568,7 +574,7 @@ void AccountReconcilor::OnGaiaAccountsInCookieUpdated(
return;
}
if (base::FeatureList::IsEnabled(kUseMultiloginEndpoint)) {
if (IsMultiloginEndpointEnabled()) {
FinishReconcileWithMultiloginEndpoint(primary_account,
LoadValidAccountsFromTokenService(),
std::move(verified_gaia_accounts));
......@@ -905,3 +911,14 @@ void AccountReconcilor::HandleReconcileTimeout() {
AbortReconcile();
DCHECK(!timer_->IsRunning());
}
bool AccountReconcilor::IsMultiloginEndpointEnabled() const {
#if defined(OS_IOS)
// kUseMultiloginEndpoint feature should not be used if
// kWKHTTPSystemCookieStore feature is disabbled.
// See http://crbug.com/902584.
if (!is_wkhttp_system_cookie_store_enabled_)
return false;
#endif // defined(OS_IOS)
return base::FeatureList::IsEnabled(kUseMultiloginEndpoint);
}
......@@ -18,6 +18,7 @@
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "components/content_settings/core/browser/content_settings_observer.h"
#include "components/content_settings/core/common/content_settings_pattern.h"
#include "components/keyed_service/core/keyed_service.h"
......@@ -109,6 +110,11 @@ class AccountReconcilor : public KeyedService,
// construction.
void Initialize(bool start_reconcile_if_tokens_available);
#if defined(OS_IOS)
// Sets the WKHTTPSystemCookieStore flag value.
void SetIsWKHTTPSystemCookieStoreEnabled(bool is_enabled);
#endif // defined(OS_IOS)
// Enables and disables the reconciliation.
void EnableReconcile();
void DisableReconcile(bool logout_all_gaia_accounts);
......@@ -303,6 +309,9 @@ class AccountReconcilor : public KeyedService,
void HandleReconcileTimeout();
// Returns true is multilogin endpoint can be enabled.
bool IsMultiloginEndpointEnabled() const;
std::unique_ptr<signin::AccountReconcilorDelegate> delegate_;
// The ProfileOAuth2TokenService associated with this reconcilor.
......@@ -371,6 +380,11 @@ class AccountReconcilor : public KeyedService,
// not invalidate the primary token while this is happening.
int synced_data_deletion_in_progress_count_ = 0;
#if defined(OS_IOS)
// Stores the WKHTTPSystemCookieStore flag value.
bool is_wkhttp_system_cookie_store_enabled_ = false;
#endif // defined(OS_IOS)
base::WeakPtrFactory<AccountReconcilor> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(AccountReconcilor);
......
......@@ -131,6 +131,9 @@ class DummyAccountReconcilorWithDelegate : public AccountReconcilor {
CreateAccountReconcilorDelegate(client,
identity_manager,
account_consistency)) {
#if defined(OS_IOS)
SetIsWKHTTPSystemCookieStoreEnabled(true);
#endif // defined(OS_IOS)
Initialize(false /* start_reconcile_if_tokens_available */);
}
......@@ -148,6 +151,9 @@ class DummyAccountReconcilorWithDelegate : public AccountReconcilor {
client,
cookie_manager_service,
std::unique_ptr<signin::AccountReconcilorDelegate>(delegate)) {
#if defined(OS_IOS)
SetIsWKHTTPSystemCookieStoreEnabled(true);
#endif // defined(OS_IOS)
Initialize(false /* start_reconcile_if_tokens_available */);
}
......
......@@ -7,6 +7,7 @@
#include <memory>
#include "base/memory/singleton.h"
#include "build/build_config.h"
#include "components/keyed_service/ios/browser_state_dependency_manager.h"
#include "components/signin/core/browser/account_reconcilor.h"
#include "components/signin/core/browser/mirror_account_reconcilor_delegate.h"
......@@ -15,6 +16,7 @@
#include "ios/chrome/browser/signin/identity_manager_factory.h"
#include "ios/chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "ios/chrome/browser/signin/signin_client_factory.h"
#include "ios/web/public/features.h"
#include "services/identity/public/cpp/identity_manager.h"
namespace ios {
......@@ -57,6 +59,10 @@ std::unique_ptr<KeyedService> AccountReconcilorFactory::BuildServiceInstanceFor(
GaiaCookieManagerServiceFactory::GetForBrowserState(chrome_browser_state),
std::make_unique<signin::MirrorAccountReconcilorDelegate>(
identity_manager)));
#if defined(OS_IOS)
reconcilor->SetIsWKHTTPSystemCookieStoreEnabled(
base::FeatureList::IsEnabled(web::features::kWKHTTPSystemCookieStore));
#endif // defined(OS_IOS)
reconcilor->Initialize(true /* start_reconcile_if_tokens_available */);
return reconcilor;
}
......
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