Skip to content

Commit

Permalink
Clean up WebViewSigninClient implementation
Browse files Browse the repository at this point in the history
Removing old code needed to support auth cookies in the content area.

Change-Id: I51088ce0bba0468fd02db7f5693be8546d352712
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2140181
Reviewed-by: Hiroshi Ichikawa <ichikawa@chromium.org>
Commit-Queue: John Wu <jzw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757338}
  • Loading branch information
John Z Wu authored and Commit Bot committed Apr 8, 2020
1 parent 56948dc commit 556c4f4
Show file tree
Hide file tree
Showing 12 changed files with 139 additions and 266 deletions.
9 changes: 3 additions & 6 deletions ios/web_view/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,6 @@ source_set("web_view_sources") {
"internal/autofill/web_view_personal_data_manager_factory.mm",
"internal/autofill/web_view_strike_database_factory.h",
"internal/autofill/web_view_strike_database_factory.mm",
"internal/content_settings/web_view_cookie_settings_factory.h",
"internal/content_settings/web_view_cookie_settings_factory.mm",
"internal/content_settings/web_view_host_content_settings_map_factory.h",
"internal/content_settings/web_view_host_content_settings_map_factory.mm",
"internal/cwv_back_forward_list.mm",
"internal/cwv_back_forward_list_internal.h",
"internal/cwv_back_forward_list_item.mm",
Expand Down Expand Up @@ -184,6 +180,8 @@ source_set("web_view_sources") {
"internal/signin/ios_web_view_signin_client.mm",
"internal/signin/web_view_device_accounts_provider_impl.h",
"internal/signin/web_view_device_accounts_provider_impl.mm",
"internal/signin/web_view_gaia_auth_fetcher.h",
"internal/signin/web_view_gaia_auth_fetcher.mm",
"internal/signin/web_view_identity_manager_factory.h",
"internal/signin/web_view_identity_manager_factory.mm",
"internal/signin/web_view_signin_client_factory.h",
Expand Down Expand Up @@ -254,7 +252,6 @@ source_set("web_view_sources") {
"//components/autofill/ios/browser",
"//components/autofill/ios/form_util",
"//components/browser_sync",
"//components/content_settings/core/browser",
"//components/flags_ui",
"//components/flags_ui:switches",
"//components/gcm_driver",
Expand All @@ -277,7 +274,6 @@ source_set("web_view_sources") {
"//components/proxy_config",
"//components/signin/core/browser",
"//components/signin/ios/browser",
"//components/signin/ios/browser:active_state_manager",
"//components/signin/public/identity_manager",
"//components/signin/public/identity_manager/ios",
"//components/signin/public/webdata",
Expand Down Expand Up @@ -409,6 +405,7 @@ test("ios_web_view_unittests") {
"internal/passwords/cwv_password_controller_fake.mm",
"internal/passwords/cwv_password_unittest.mm",
"internal/signin/cwv_identity_unittest.mm",
"internal/signin/web_view_gaia_auth_fetcher_unittest.mm",
"internal/sync/cwv_sync_controller_unittest.mm",
"internal/translate/cwv_translation_controller_unittest.mm",
"internal/translate/cwv_translation_language_unittest.mm",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 3 additions & 12 deletions ios/web_view/internal/signin/ios_web_view_signin_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@
#include <memory>

#include "base/macros.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/signin/ios/browser/wait_for_network_callback_helper.h"
#include "components/signin/public/base/signin_client.h"
#include "net/cookies/cookie_change_dispatcher.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"

namespace ios_web_view {
Expand All @@ -22,11 +19,8 @@ class WebViewBrowserState;
// iOS WebView specific signin client.
class IOSWebViewSigninClient : public SigninClient {
public:
IOSWebViewSigninClient(
PrefService* pref_service,
ios_web_view::WebViewBrowserState* browser_state,
scoped_refptr<content_settings::CookieSettings> cookie_settings,
scoped_refptr<HostContentSettingsMap> host_content_settings_map);
IOSWebViewSigninClient(PrefService* pref_service,
ios_web_view::WebViewBrowserState* browser_state);

~IOSWebViewSigninClient() override;

Expand Down Expand Up @@ -57,11 +51,8 @@ class IOSWebViewSigninClient : public SigninClient {
std::unique_ptr<WaitForNetworkCallbackHelper> network_callback_helper_;
// The PrefService associated with this service.
PrefService* pref_service_;
// The browser_state_ associated with this service.
ios_web_view::WebViewBrowserState* browser_state_;
// Used to check if sign in cookies are allowed.
scoped_refptr<content_settings::CookieSettings> cookie_settings_;
// Used to add and remove content settings observers.
scoped_refptr<HostContentSettingsMap> host_content_settings_map_;

DISALLOW_COPY_AND_ASSIGN(IOSWebViewSigninClient);
};
Expand Down
23 changes: 10 additions & 13 deletions ios/web_view/internal/signin/ios_web_view_signin_client.mm
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

#include "ios/web_view/internal/signin/ios_web_view_signin_client.h"

#include "base/macros.h"
#include "components/signin/core/browser/cookie_settings_util.h"
#include "google_apis/gaia/gaia_auth_fetcher.h"
#include "ios/web_view/internal/signin/web_view_gaia_auth_fetcher.h"
#include "ios/web_view/internal/web_view_browser_state.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"

Expand All @@ -15,15 +16,11 @@

IOSWebViewSigninClient::IOSWebViewSigninClient(
PrefService* pref_service,
ios_web_view::WebViewBrowserState* browser_state,
scoped_refptr<content_settings::CookieSettings> cookie_settings,
scoped_refptr<HostContentSettingsMap> host_content_settings_map)
ios_web_view::WebViewBrowserState* browser_state)
: network_callback_helper_(
std::make_unique<WaitForNetworkCallbackHelper>()),
pref_service_(pref_service),
browser_state_(browser_state),
cookie_settings_(cookie_settings),
host_content_settings_map_(host_content_settings_map) {}
browser_state_(browser_state) {}

IOSWebViewSigninClient::~IOSWebViewSigninClient() {
}
Expand All @@ -48,21 +45,21 @@
void IOSWebViewSigninClient::DoFinalInit() {}

bool IOSWebViewSigninClient::AreSigninCookiesAllowed() {
return signin::SettingsAllowSigninCookies(cookie_settings_.get());
return false;
}

bool IOSWebViewSigninClient::AreSigninCookiesDeletedOnExit() {
return signin::SettingsDeleteSigninCookiesOnExit(cookie_settings_.get());
return false;
}

void IOSWebViewSigninClient::AddContentSettingsObserver(
content_settings::Observer* observer) {
host_content_settings_map_->AddObserver(observer);
NOTIMPLEMENTED();
}

void IOSWebViewSigninClient::RemoveContentSettingsObserver(
content_settings::Observer* observer) {
host_content_settings_map_->RemoveObserver(observer);
NOTIMPLEMENTED();
}

void IOSWebViewSigninClient::PreSignOut(
Expand All @@ -78,7 +75,7 @@
std::unique_ptr<GaiaAuthFetcher> IOSWebViewSigninClient::CreateGaiaAuthFetcher(
GaiaAuthConsumer* consumer,
gaia::GaiaSource source) {
return std::make_unique<GaiaAuthFetcher>(consumer, source,
GetURLLoaderFactory());
return std::make_unique<ios_web_view::WebViewGaiaAuthFetcher>(
consumer, source, GetURLLoaderFactory());
}

Loading

0 comments on commit 556c4f4

Please sign in to comment.