Commit 1d52b83c authored by Henrique Ferreiro's avatar Henrique Ferreiro Committed by Commit Bot

Restructure //components/signin/ios for IdentityManager

This CL moves PO2TSIOSDelegate to
//components/signin/internal/identity_manager and DeviceAccountsProvider
to //components/signin/public/identity_manager/ios.

Additionally, profile_oauth2_token_service_ios_delegate* is renamed to
profile_oauth2_token_service_delegate_ios*.

This CL is required for moving the building of IdentityManager in //ios
into identity_manager_builder.cc and
profile_oauth2_token_service_builder.cc.

TBR=jochen@chromium.org

Bug: 952788
Change-Id: I18ed100802f436699e9928fbcf0068b97b4c406a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1701851Reviewed-by: default avatarHenrique Ferreiro <hferreiro@igalia.com>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Commit-Queue: Henrique Ferreiro <hferreiro@igalia.com>
Cr-Commit-Position: refs/heads/master@{#678596}
parent b51f32aa
......@@ -41,6 +41,8 @@ source_set("identity_manager") {
"profile_oauth2_token_service_builder.h",
"profile_oauth2_token_service_delegate_chromeos.cc",
"profile_oauth2_token_service_delegate_chromeos.h",
"profile_oauth2_token_service_delegate_ios.h",
"profile_oauth2_token_service_delegate_ios.mm",
"ubertoken_fetcher_impl.cc",
"ubertoken_fetcher_impl.h",
]
......@@ -94,10 +96,14 @@ source_set("identity_manager") {
}
if (is_ios) {
configs += [ "//build/config/compiler:enable_arc" ]
sources += [
"device_accounts_synchronizer_impl.cc",
"device_accounts_synchronizer_impl.h",
]
deps += [ "//components/signin/public/identity_manager/ios" ]
}
}
......@@ -115,6 +121,7 @@ source_set("unit_tests") {
"primary_account_manager_unittest.cc",
"primary_account_policy_manager_impl_unittest.cc",
"profile_oauth2_token_service_delegate_chromeos_unittest.cc",
"profile_oauth2_token_service_delegate_ios_unittest.mm",
"profile_oauth2_token_service_unittest.cc",
"ubertoken_fetcher_impl_unittest.cc",
]
......@@ -139,6 +146,7 @@ source_set("unit_tests") {
"//google_apis",
"//google_apis:test_support",
"//net",
"//net:test_support",
"//services/network:test_support",
"//services/network/public/cpp",
"//testing/gmock",
......@@ -150,6 +158,12 @@ source_set("unit_tests") {
deps += [ "//chromeos/components/account_manager" ]
}
if (is_ios) {
configs += [ "//build/config/compiler:enable_arc" ]
deps += [ "//components/signin/public/identity_manager/ios:test_support" ]
}
}
# This target contains test support that backs the test support for
......
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SIGNIN_IOS_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_DELEGATE_H_
#define COMPONENTS_SIGNIN_IOS_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_DELEGATE_H_
#ifndef COMPONENTS_SIGNIN_INTERNAL_IDENTITY_MANAGER_PROFILE_OAUTH2_TOKEN_SERVICE_DELEGATE_IOS_H_
#define COMPONENTS_SIGNIN_INTERNAL_IDENTITY_MANAGER_PROFILE_OAUTH2_TOKEN_SERVICE_DELEGATE_IOS_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
......@@ -98,13 +101,13 @@ class ProfileOAuth2TokenServiceIOSDelegate : public OAuth2TokenServiceDelegate {
// Calls to this class are expected to be made from the browser UI thread.
// The purpose of this checker is to detect access to
// ProfileOAuth2TokenService from multiple threads in upstream code.
base::ThreadChecker thread_checker_;
THREAD_CHECKER(thread_checker_);
// The client with which this instance was initialied, or NULL.
// The client with which this instance was initialied, or null.
SigninClient* client_ = nullptr;
std::unique_ptr<DeviceAccountsProvider> provider_;
AccountTrackerService* account_tracker_service_;
DISALLOW_COPY_AND_ASSIGN(ProfileOAuth2TokenServiceIOSDelegate);
};
#endif // COMPONENTS_SIGNIN_IOS_BROWSER_PROFILE_OAUTH2_TOKEN_SERVICE_IOS_DELEGATE_H_
#endif // COMPONENTS_SIGNIN_INTERNAL_IDENTITY_MANAGER_PROFILE_OAUTH2_TOKEN_SERVICE_DELEGATE_IOS_H_
......@@ -2,14 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h"
#include "components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios.h"
#import <Foundation/Foundation.h>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include <utility>
#include "base/bind.h"
#include "base/macros.h"
......@@ -19,10 +17,10 @@
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/signin/internal/identity_manager/account_tracker_service.h"
#include "components/signin/ios/browser/device_accounts_provider.h"
#include "components/signin/public/base/signin_client.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/ios/device_accounts_provider.h"
#include "google_apis/gaia/oauth2_access_token_fetcher.h"
#include "net/url_request/url_request_status.h"
......@@ -119,8 +117,7 @@ SSOAccessTokenFetcher::SSOAccessTokenFetcher(
DCHECK(provider_);
}
SSOAccessTokenFetcher::~SSOAccessTokenFetcher() {
}
SSOAccessTokenFetcher::~SSOAccessTokenFetcher() {}
void SSOAccessTokenFetcher::Start(const std::string& client_id,
const std::string& client_secret_unused,
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h"
#include "components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
......@@ -10,9 +10,9 @@
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/testing_pref_service.h"
#include "components/signin/internal/identity_manager/account_tracker_service.h"
#include "components/signin/ios/browser/fake_device_accounts_provider.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "components/signin/public/base/test_signin_client.h"
#include "components/signin/public/identity_manager/ios/fake_device_accounts_provider.h"
#include "google_apis/gaia/gaia_urls.h"
#include "google_apis/gaia/oauth2_access_token_consumer.h"
#include "google_apis/gaia/oauth2_access_token_fetcher.h"
......@@ -20,6 +20,7 @@
#include "google_apis/gaia/oauth2_token_service_observer.h"
#include "net/url_request/test_url_fetcher_factory.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......@@ -28,12 +29,12 @@
typedef DeviceAccountsProvider::AccountInfo ProviderAccount;
class ProfileOAuth2TokenServiceIOSDelegateTest
: public testing::Test,
: public PlatformTest,
public OAuth2AccessTokenConsumer,
public OAuth2TokenServiceObserver {
public:
ProfileOAuth2TokenServiceIOSDelegateTest()
: factory_(NULL),
: factory_(nullptr),
client_(&prefs_),
token_available_count_(0),
token_revoked_count_(0),
......
......@@ -7,27 +7,26 @@ source_set("browser") {
sources = [
"account_consistency_service.h",
"account_consistency_service.mm",
"device_accounts_provider.h",
"device_accounts_provider.mm",
"manage_accounts_delegate.h",
"profile_oauth2_token_service_ios_delegate.h",
"profile_oauth2_token_service_ios_delegate.mm",
"wait_for_network_callback_helper.cc",
"wait_for_network_callback_helper.h",
]
deps = [
":active_state_manager",
"//components/content_settings/core/browser",
"//components/google/core/browser",
"//components/keyed_service/core",
"//components/pref_registry",
"//components/prefs",
"//components/signin/core/browser",
"//components/signin/internal/identity_manager",
"//components/signin/public/identity_manager",
"//google_apis",
"//components/signin/public/base",
"//ios/web",
"//url",
]
public_deps = [
":active_state_manager",
"//base",
"//components/keyed_service/core",
"//components/signin/public/identity_manager",
"//net",
]
}
......@@ -46,43 +45,32 @@ source_set("active_state_manager") {
]
}
source_set("test_support") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"fake_device_accounts_provider.h",
"fake_device_accounts_provider.mm",
]
public_deps = [
":browser",
"//base",
"//google_apis:test_support",
]
}
source_set("unit_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"account_consistency_service_unittest.mm",
"active_state_manager_impl_unittest.mm",
"profile_oauth2_token_service_ios_delegate_unittest.mm",
"wait_for_network_callback_helper_unittest.cc",
]
deps = [
":active_state_manager",
":test_support",
"//components/prefs:test_support",
":browser",
"//base",
"//components/content_settings/core/browser",
"//components/prefs",
"//components/signin/core/browser",
"//components/signin/internal/identity_manager",
"//components/signin/public/base:test_support",
"//components/signin/public/identity_manager",
"//components/signin/public/identity_manager:test_support",
"//components/sync_preferences:test_support",
"//ios/web",
"//ios/web/public/test",
"//ios/web/public/test/fakes",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
"//third_party/ocmock",
]
}
......@@ -15,12 +15,15 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/time/time.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/keyed_service/core/keyed_service.h"
#include "components/signin/ios/browser/active_state_manager.h"
#import "components/signin/ios/browser/manage_accounts_delegate.h"
#import "components/signin/public/identity_manager/identity_manager.h"
namespace content_settings {
class CookieSettings;
}
namespace web {
class BrowserState;
class WebState;
......@@ -28,6 +31,7 @@ class WebStatePolicyDecider;
}
class AccountReconcilor;
class PrefService;
@class AccountConsistencyNavigationDelegate;
@class WKWebView;
......
......@@ -11,8 +11,10 @@
#import "base/mac/foundation_util.h"
#include "base/macros.h"
#include "base/strings/sys_string_conversions.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/google/core/common/google_util.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/scoped_user_pref_update.h"
#include "components/signin/core/browser/account_reconcilor.h"
#include "components/signin/core/browser/signin_header_helper.h"
......
......@@ -11,6 +11,9 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/values.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "components/prefs/pref_service.h"
#include "components/signin/core/browser/account_reconcilor.h"
#include "components/signin/core/browser/account_reconcilor_delegate.h"
#include "components/signin/public/base/list_accounts_test_utils.h"
......
......@@ -129,8 +129,4 @@ source_set("test_support") {
"//components/sync_preferences:test_support",
"//testing/gtest",
]
if (is_ios) {
deps += [ "//components/signin/ios/browser" ]
}
}
......@@ -35,8 +35,7 @@
#if defined(OS_IOS)
#include "components/signin/internal/identity_manager/device_accounts_synchronizer_impl.h"
#include "components/signin/ios/browser/device_accounts_provider.h"
#include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h"
#include "components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios.h"
#endif
#if !defined(OS_ANDROID) && !defined(OS_IOS)
......
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("ios") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"device_accounts_provider.h",
"device_accounts_provider.mm",
]
public_deps = [
"//base",
]
}
source_set("test_support") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"fake_device_accounts_provider.h",
"fake_device_accounts_provider.mm",
]
public_deps = [
":ios",
"//base",
]
}
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SIGNIN_IOS_BROWSER_DEVICE_ACCOUNTS_PROVIDER_H_
#define COMPONENTS_SIGNIN_IOS_BROWSER_DEVICE_ACCOUNTS_PROVIDER_H_
#ifndef COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IOS_DEVICE_ACCOUNTS_PROVIDER_H_
#define COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IOS_DEVICE_ACCOUNTS_PROVIDER_H_
#if defined(__OBJC__)
@class NSDate;
......@@ -71,4 +71,4 @@ class DeviceAccountsProvider {
NSError* error) const;
};
#endif // COMPONENTS_SIGNIN_IOS_BROWSER_DEVICE_ACCOUNTS_PROVIDER_H_
#endif // COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IOS_DEVICE_ACCOUNTS_PROVIDER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/signin/ios/browser/device_accounts_provider.h"
#include "components/signin/public/identity_manager/ios/device_accounts_provider.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
......
......@@ -2,16 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SIGNIN_IOS_BROWSER_FAKE_DEVICE_ACCOUNTS_PROVIDER_H_
#define COMPONENTS_SIGNIN_IOS_BROWSER_FAKE_DEVICE_ACCOUNTS_PROVIDER_H_
#ifndef COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IOS_FAKE_DEVICE_ACCOUNTS_PROVIDER_H_
#define COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IOS_FAKE_DEVICE_ACCOUNTS_PROVIDER_H_
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/macros.h"
#include "components/signin/ios/browser/device_accounts_provider.h"
#include "components/signin/public/identity_manager/ios/device_accounts_provider.h"
// Mock class of DeviceAccountsProvider for testing.
class FakeDeviceAccountsProvider : public DeviceAccountsProvider {
......@@ -46,4 +46,4 @@ class FakeDeviceAccountsProvider : public DeviceAccountsProvider {
DISALLOW_COPY_AND_ASSIGN(FakeDeviceAccountsProvider);
};
#endif // COMPONENTS_SIGNIN_IOS_BROWSER_FAKE_DEVICE_ACCOUNTS_PROVIDER_H_
#endif // COMPONENTS_SIGNIN_PUBLIC_IDENTITY_MANAGER_IOS_FAKE_DEVICE_ACCOUNTS_PROVIDER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/signin/ios/browser/fake_device_accounts_provider.h"
#include "components/signin/public/identity_manager/ios/fake_device_accounts_provider.h"
#import <Foundation/Foundation.h>
......
......@@ -67,6 +67,7 @@ source_set("signin") {
"//components/signin/ios/browser",
"//components/signin/ios/browser:active_state_manager",
"//components/signin/public/identity_manager",
"//components/signin/public/identity_manager/ios",
"//components/sync",
"//components/unified_consent",
"//google_apis",
......@@ -147,7 +148,6 @@ source_set("unit_tests") {
"//components/prefs",
"//components/signin/core/browser",
"//components/signin/ios/browser",
"//components/signin/ios/browser:test_support",
"//components/signin/public/base:test_support",
"//components/signin/public/identity_manager",
"//components/signin/public/identity_manager:test_support",
......
......@@ -13,6 +13,7 @@ specific_include_rules = {
"+components/signin/internal/identity_manager/primary_account_manager.h",
"+components/signin/internal/identity_manager/primary_account_policy_manager_impl.h",
"+components/signin/internal/identity_manager/profile_oauth2_token_service.h",
"+components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios.h",
],
# The dependence on the Identity Service implementation should be used *only*
......
......@@ -5,6 +5,7 @@
#include "ios/chrome/browser/signin/account_consistency_service_factory.h"
#include "base/no_destructor.h"
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/keyed_service/ios/browser_state_dependency_manager.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/signin/ios/browser/account_consistency_service.h"
......
......@@ -5,11 +5,12 @@
#ifndef IOS_CHROME_BROWSER_SIGNIN_DEVICE_ACCOUNTS_PROVIDER_IMPL_H_
#define IOS_CHROME_BROWSER_SIGNIN_DEVICE_ACCOUNTS_PROVIDER_IMPL_H_
#include <set>
#include <string>
#include <vector>
#include "base/macros.h"
#include "components/signin/ios/browser/device_accounts_provider.h"
#include "components/signin/public/identity_manager/ios/device_accounts_provider.h"
// Implementation of DeviceAccountsProvider.
class DeviceAccountsProviderImpl : public DeviceAccountsProvider {
......
......@@ -21,7 +21,7 @@
#include "components/signin/internal/identity_manager/primary_account_mutator_impl.h"
#include "components/signin/internal/identity_manager/primary_account_policy_manager_impl.h"
#include "components/signin/internal/identity_manager/profile_oauth2_token_service.h"
#include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h"
#include "components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios.h"
#include "components/signin/public/base/account_consistency_method.h"
#include "components/signin/public/base/signin_client.h"
#include "components/signin/public/identity_manager/accounts_mutator.h"
......
......@@ -289,6 +289,7 @@ ios_web_view_deps = [
"//components/signin/ios/browser",
"//components/signin/ios/browser:active_state_manager",
"//components/signin/public/identity_manager",
"//components/signin/public/identity_manager/ios",
"//components/strings:components_strings_grit",
"//components/sync",
"//components/sync_device_info",
......@@ -431,7 +432,6 @@ test("ios_web_view_unittests") {
"//components/autofill/ios/form_util:test_support",
"//components/browser_sync:test_support",
"//components/prefs:test_support",
"//components/signin/ios/browser:test_support",
"//components/signin/public/base:test_support",
"//components/signin/public/identity_manager:test_support",
"//components/sync:test_support",
......
......@@ -5,11 +5,12 @@
#ifndef IOS_WEB_VIEW_INTERNAL_SIGNIN_WEB_VIEW_DEVICE_ACCOUNTS_PROVIDER_IMPL_H_
#define IOS_WEB_VIEW_INTERNAL_SIGNIN_WEB_VIEW_DEVICE_ACCOUNTS_PROVIDER_IMPL_H_
#include <set>
#include <string>
#include <vector>
#include "base/macros.h"
#include "components/signin/ios/browser/device_accounts_provider.h"
#include "components/signin/public/identity_manager/ios/device_accounts_provider.h"
class IOSWebViewSigninClient;
......
......@@ -21,7 +21,7 @@
#include "components/signin/internal/identity_manager/primary_account_mutator_impl.h"
#include "components/signin/internal/identity_manager/primary_account_policy_manager_impl.h"
#include "components/signin/internal/identity_manager/profile_oauth2_token_service.h"
#include "components/signin/ios/browser/profile_oauth2_token_service_ios_delegate.h"
#include "components/signin/internal/identity_manager/profile_oauth2_token_service_delegate_ios.h"
#include "components/signin/public/base/account_consistency_method.h"
#include "components/signin/public/base/signin_client.h"
#include "components/signin/public/base/signin_pref_names.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