Commit 9c107085 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Commit Bot

[ios] Fix compilation when widgets and extensions are disabled

Applications build for the macOS "catalyst" environment do not support
the extensions or widgets that ships with Chrome on iOS. Fix the build
when the variables used to enabled them are set to false.

Add assertion to ensure that the BUILD.gn defining the extensions and
widgets are not included when the variables are set to false, in order
to prevent from accidental inclusion.

Add a gn variable to control whether screen_time is enabled or not.
It will allow disabling it when environment is macOS "catalyst".

Bug: 1138425
Change-Id: If2cf9734c0595098cb2f60247702f73cf5da7d63
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2498593
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821287}
parent 37440eec
...@@ -22,9 +22,6 @@ group("all") { ...@@ -22,9 +22,6 @@ group("all") {
deps = [ deps = [
# List all the targets that need to be built on iOS by default. # List all the targets that need to be built on iOS by default.
"//ios/chrome/app:chrome", "//ios/chrome/app:chrome",
"//ios/chrome/content_widget_extension",
"//ios/chrome/search_widget_extension",
"//ios/chrome/share_extension",
"//ios/showcase", "//ios/showcase",
"//ios/web/shell:ios_web_shell", "//ios/web/shell:ios_web_shell",
"//ios/web_view/shell:ios_web_view_shell", "//ios/web_view/shell:ios_web_view_shell",
......
...@@ -67,6 +67,9 @@ declare_args() { ...@@ -67,6 +67,9 @@ declare_args() {
ios_chrome_cpe_entitlements_additions = [] ios_chrome_cpe_entitlements_additions = []
} }
# ScreenTime is only available in iOS 14.0+ SDK.
ios_enable_screen_time = xcode_version_int >= 1200
# Configure whether breakpad support is enabled. # Configure whether breakpad support is enabled.
breakpad_enabled = is_official_build && is_chrome_branded breakpad_enabled = is_official_build && is_chrome_branded
......
...@@ -217,7 +217,7 @@ source_set("app_internal") { ...@@ -217,7 +217,7 @@ source_set("app_internal") {
"//ios/chrome/browser/crash_report:crash_report_internal", "//ios/chrome/browser/crash_report:crash_report_internal",
"//ios/chrome/browser/crash_report/breadcrumbs", "//ios/chrome/browser/crash_report/breadcrumbs",
"//ios/chrome/browser/crash_report/breadcrumbs:feature_flags", "//ios/chrome/browser/crash_report/breadcrumbs:feature_flags",
"//ios/chrome/browser/credential_provider", "//ios/chrome/browser/credential_provider:buildflags",
"//ios/chrome/browser/download", "//ios/chrome/browser/download",
"//ios/chrome/browser/external_files", "//ios/chrome/browser/external_files",
"//ios/chrome/browser/favicon", "//ios/chrome/browser/favicon",
...@@ -288,6 +288,10 @@ source_set("app_internal") { ...@@ -288,6 +288,10 @@ source_set("app_internal") {
"//ui/strings:ui_strings", "//ui/strings:ui_strings",
] ]
if (ios_enable_credential_provider_extension) {
deps += [ "//ios/chrome/browser/credential_provider" ]
}
frameworks = [ frameworks = [
"CoreSpotlight.framework", "CoreSpotlight.framework",
"MediaPlayer.framework", "MediaPlayer.framework",
......
...@@ -57,8 +57,7 @@ ...@@ -57,8 +57,7 @@
#include "ios/chrome/browser/crash_report/crash_loop_detection_util.h" #include "ios/chrome/browser/crash_report/crash_loop_detection_util.h"
#include "ios/chrome/browser/crash_report/crash_report_helper.h" #include "ios/chrome/browser/crash_report/crash_report_helper.h"
#import "ios/chrome/browser/crash_report/crash_restore_helper.h" #import "ios/chrome/browser/crash_report/crash_restore_helper.h"
#include "ios/chrome/browser/credential_provider/credential_provider_service_factory.h" #include "ios/chrome/browser/credential_provider/credential_provider_buildflags.h"
#include "ios/chrome/browser/credential_provider/credential_provider_support.h"
#include "ios/chrome/browser/download/download_directory_util.h" #include "ios/chrome/browser/download/download_directory_util.h"
#import "ios/chrome/browser/external_files/external_file_remover_factory.h" #import "ios/chrome/browser/external_files/external_file_remover_factory.h"
#import "ios/chrome/browser/external_files/external_file_remover_impl.h" #import "ios/chrome/browser/external_files/external_file_remover_impl.h"
...@@ -112,6 +111,11 @@ ...@@ -112,6 +111,11 @@
#import "net/base/mac/url_conversions.h" #import "net/base/mac/url_conversions.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
#if BUILDFLAG(IOS_CREDENTIAL_PROVIDER_ENABLED)
#include "ios/chrome/browser/credential_provider/credential_provider_service_factory.h"
#include "ios/chrome/browser/credential_provider/credential_provider_support.h"
#endif
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
...@@ -534,10 +538,12 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData( ...@@ -534,10 +538,12 @@ void MainControllerAuthenticationServiceDelegate::ClearBrowsingData(
self.appState.mainBrowserState); self.appState.mainBrowserState);
service->Initialize(); service->Initialize();
#if BUILDFLAG(IOS_CREDENTIAL_PROVIDER_ENABLED)
if (IsCredentialProviderExtensionSupported()) { if (IsCredentialProviderExtensionSupported()) {
CredentialProviderServiceFactory::GetForBrowserState( CredentialProviderServiceFactory::GetForBrowserState(
self.appState.mainBrowserState); self.appState.mainBrowserState);
} }
#endif
_windowConfigurationRecorder = [[WindowConfigurationRecorder alloc] init]; _windowConfigurationRecorder = [[WindowConfigurationRecorder alloc] init];
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//ios/build/chrome_build.gni")
source_set("browser_state") { source_set("browser_state") {
sources = [ sources = [
"browser_state_otr_helper.cc", "browser_state_otr_helper.cc",
...@@ -94,7 +96,7 @@ source_set("browser_state_impl") { ...@@ -94,7 +96,7 @@ source_set("browser_state_impl") {
"//ios/chrome/browser/browsing_data", "//ios/chrome/browser/browsing_data",
"//ios/chrome/browser/content_settings", "//ios/chrome/browser/content_settings",
"//ios/chrome/browser/crash_report/breadcrumbs", "//ios/chrome/browser/crash_report/breadcrumbs",
"//ios/chrome/browser/credential_provider", "//ios/chrome/browser/credential_provider:buildflags",
"//ios/chrome/browser/device_sharing", "//ios/chrome/browser/device_sharing",
"//ios/chrome/browser/discover_feed", "//ios/chrome/browser/discover_feed",
"//ios/chrome/browser/dom_distiller", "//ios/chrome/browser/dom_distiller",
...@@ -117,8 +119,7 @@ source_set("browser_state_impl") { ...@@ -117,8 +119,7 @@ source_set("browser_state_impl") {
"//ios/chrome/browser/prefs:browser_prefs", "//ios/chrome/browser/prefs:browser_prefs",
"//ios/chrome/browser/reading_list", "//ios/chrome/browser/reading_list",
"//ios/chrome/browser/safe_browsing", "//ios/chrome/browser/safe_browsing",
"//ios/chrome/browser/screen_time", "//ios/chrome/browser/screen_time:buildflags",
"//ios/chrome/browser/screen_time:feature_flags",
"//ios/chrome/browser/search_engines", "//ios/chrome/browser/search_engines",
"//ios/chrome/browser/send_tab_to_self", "//ios/chrome/browser/send_tab_to_self",
"//ios/chrome/browser/sessions", "//ios/chrome/browser/sessions",
...@@ -141,6 +142,15 @@ source_set("browser_state_impl") { ...@@ -141,6 +142,15 @@ source_set("browser_state_impl") {
"//net", "//net",
"//net:extras", "//net:extras",
] ]
if (ios_enable_screen_time) {
deps += [
"//ios/chrome/browser/screen_time",
"//ios/chrome/browser/screen_time:feature_flags",
]
}
if (ios_enable_credential_provider_extension) {
deps += [ "//ios/chrome/browser/credential_provider" ]
}
allow_circular_includes_from = [ allow_circular_includes_from = [
"//ios/chrome/browser", "//ios/chrome/browser",
"//ios/chrome/browser/browser_state_metrics", "//ios/chrome/browser/browser_state_metrics",
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "ios/chrome/browser/browsing_data/browsing_data_remover_factory.h" #include "ios/chrome/browser/browsing_data/browsing_data_remover_factory.h"
#include "ios/chrome/browser/content_settings/cookie_settings_factory.h" #include "ios/chrome/browser/content_settings/cookie_settings_factory.h"
#include "ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_keyed_service_factory.h" #include "ios/chrome/browser/crash_report/breadcrumbs/breadcrumb_manager_keyed_service_factory.h"
#include "ios/chrome/browser/credential_provider/credential_provider_service_factory.h" #include "ios/chrome/browser/credential_provider/credential_provider_buildflags.h"
#import "ios/chrome/browser/device_sharing/device_sharing_manager_factory.h" #import "ios/chrome/browser/device_sharing/device_sharing_manager_factory.h"
#include "ios/chrome/browser/discover_feed/discover_feed_service_factory.h" #include "ios/chrome/browser/discover_feed/discover_feed_service_factory.h"
#include "ios/chrome/browser/dom_distiller/dom_distiller_service_factory.h" #include "ios/chrome/browser/dom_distiller/dom_distiller_service_factory.h"
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include "ios/chrome/browser/reading_list/reading_list_model_factory.h" #include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
#import "ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.h" #import "ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.h"
#import "ios/chrome/browser/safe_browsing/verdict_cache_manager_factory.h" #import "ios/chrome/browser/safe_browsing/verdict_cache_manager_factory.h"
#import "ios/chrome/browser/screen_time/features.h" #include "ios/chrome/browser/screen_time/screen_time_buildflags.h"
#include "ios/chrome/browser/search_engines/template_url_service_factory.h" #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
#include "ios/chrome/browser/signin/about_signin_internals_factory.h" #include "ios/chrome/browser/signin/about_signin_internals_factory.h"
#include "ios/chrome/browser/signin/account_consistency_service_factory.h" #include "ios/chrome/browser/signin/account_consistency_service_factory.h"
...@@ -64,9 +64,14 @@ ...@@ -64,9 +64,14 @@
#include "ios/chrome/browser/unified_consent/unified_consent_service_factory.h" #include "ios/chrome/browser/unified_consent/unified_consent_service_factory.h"
#include "ios/chrome/browser/webdata_services/web_data_service_factory.h" #include "ios/chrome/browser/webdata_services/web_data_service_factory.h"
#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 #if BUILDFLAG(IOS_CREDENTIAL_PROVIDER_ENABLED)
#include "ios/chrome/browser/credential_provider/credential_provider_service_factory.h"
#endif
#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
#import "ios/chrome/browser/screen_time/features.h"
#import "ios/chrome/browser/screen_time/screen_time_history_deleter_factory.h" #import "ios/chrome/browser/screen_time/screen_time_history_deleter_factory.h"
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 #endif
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
...@@ -108,7 +113,6 @@ void EnsureBrowserStateKeyedServiceFactoriesBuilt() { ...@@ -108,7 +113,6 @@ void EnsureBrowserStateKeyedServiceFactoriesBuilt() {
BrowserDownloadServiceFactory::GetInstance(); BrowserDownloadServiceFactory::GetInstance();
BrowsingDataRemoverFactory::GetInstance(); BrowsingDataRemoverFactory::GetInstance();
ConsentAuditorFactory::GetInstance(); ConsentAuditorFactory::GetInstance();
CredentialProviderServiceFactory::GetInstance();
DeviceSharingManagerFactory::GetInstance(); DeviceSharingManagerFactory::GetInstance();
DiscoverFeedServiceFactory::GetInstance(); DiscoverFeedServiceFactory::GetInstance();
GoogleLogoServiceFactory::GetInstance(); GoogleLogoServiceFactory::GetInstance();
...@@ -142,11 +146,15 @@ void EnsureBrowserStateKeyedServiceFactoriesBuilt() { ...@@ -142,11 +146,15 @@ void EnsureBrowserStateKeyedServiceFactoriesBuilt() {
PolicyBlocklistServiceFactory::GetInstance(); PolicyBlocklistServiceFactory::GetInstance();
} }
#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 #if BUILDFLAG(IOS_CREDENTIAL_PROVIDER_ENABLED)
if (@available(iOS 14, *)) { CredentialProviderServiceFactory::GetInstance();
if (IsScreenTimeIntegrationEnabled()) { #endif
#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
if (IsScreenTimeIntegrationEnabled()) {
if (@available(iOS 14, *)) {
ScreenTimeHistoryDeleterFactory::GetInstance(); ScreenTimeHistoryDeleterFactory::GetInstance();
} }
} }
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 #endif
} }
...@@ -6,74 +6,75 @@ import("//build/buildflag_header.gni") ...@@ -6,74 +6,75 @@ import("//build/buildflag_header.gni")
import("//build/config/ios/ios_sdk.gni") import("//build/config/ios/ios_sdk.gni")
import("//ios/build/chrome_build.gni") import("//ios/build/chrome_build.gni")
source_set("credential_provider") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"archivable_credential+password_form.h",
"archivable_credential+password_form.mm",
"credential_provider_service.h",
"credential_provider_service.mm",
"credential_provider_service_factory.h",
"credential_provider_service_factory.mm",
"credential_provider_support.cc",
"credential_provider_support.h",
"credential_provider_util.h",
"credential_provider_util.mm",
]
deps = [
":buildflags",
"//base",
"//components/autofill/core/common",
"//components/keyed_service/core",
"//components/keyed_service/ios",
"//components/password_manager/core/browser",
"//components/password_manager/core/browser:affiliation",
"//components/signin/public/identity_manager",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/passwords",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/sync",
"//ios/chrome/common/app_group",
"//ios/chrome/common/credential_provider",
"//ios/public/provider/chrome/browser/signin",
"//url",
]
frameworks = [
"AuthenticationServices.framework",
"Foundation.framework",
]
}
buildflag_header("buildflags") { buildflag_header("buildflags") {
header = "credential_provider_buildflags.h" header = "credential_provider_buildflags.h"
header_dir = "ios/chrome/browser/ui/util"
flags = [ flags = [
"IOS_CREDENTIAL_PROVIDER_ENABLED=$ios_enable_credential_provider_extension", "IOS_CREDENTIAL_PROVIDER_ENABLED=$ios_enable_credential_provider_extension",
] ]
} }
source_set("unit_tests") { if (ios_enable_credential_provider_extension) {
configs += [ "//build/config/compiler:enable_arc" ] source_set("credential_provider") {
testonly = true configs += [ "//build/config/compiler:enable_arc" ]
sources = [ sources = [
"archivable_credential+password_form_unittest.mm", "archivable_credential+password_form.h",
"credential_provider_service_unittest.mm", "archivable_credential+password_form.mm",
] "credential_provider_service.h",
deps = [ "credential_provider_service.mm",
":credential_provider", "credential_provider_service_factory.h",
"//base/test:test_support", "credential_provider_service_factory.mm",
"//components/autofill/core/common", "credential_provider_support.cc",
"//components/password_manager/core/browser:test_support", "credential_provider_support.h",
"//ios/chrome/browser/browser_state:test_support", "credential_provider_util.h",
"//ios/chrome/browser/signin", "credential_provider_util.mm",
"//ios/chrome/browser/signin:test_support", ]
"//ios/chrome/common/app_group", deps = [
"//ios/chrome/common/credential_provider", ":buildflags",
"//ios/chrome/common/credential_provider:ui", "//base",
"//ios/public/provider/chrome/browser/signin:fake_chrome_identity", "//components/autofill/core/common",
"//ios/public/provider/chrome/browser/signin:test_support", "//components/keyed_service/core",
"//ios/web/public/test", "//components/keyed_service/ios",
"//testing/gtest", "//components/password_manager/core/browser",
"//url", "//components/password_manager/core/browser:affiliation",
] "//components/signin/public/identity_manager",
"//ios/chrome/browser/browser_state",
"//ios/chrome/browser/passwords",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/sync",
"//ios/chrome/common/app_group",
"//ios/chrome/common/credential_provider",
"//ios/public/provider/chrome/browser/signin",
"//url",
]
frameworks = [
"AuthenticationServices.framework",
"Foundation.framework",
]
}
source_set("unit_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"archivable_credential+password_form_unittest.mm",
"credential_provider_service_unittest.mm",
]
deps = [
":credential_provider",
"//base/test:test_support",
"//components/autofill/core/common",
"//components/password_manager/core/browser:test_support",
"//ios/chrome/browser/browser_state:test_support",
"//ios/chrome/browser/signin",
"//ios/chrome/browser/signin:test_support",
"//ios/chrome/common/app_group",
"//ios/chrome/common/credential_provider",
"//ios/chrome/common/credential_provider:ui",
"//ios/public/provider/chrome/browser/signin:fake_chrome_identity",
"//ios/public/provider/chrome/browser/signin:test_support",
"//ios/web/public/test",
"//testing/gtest",
"//url",
]
}
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "ios/chrome/browser/credential_provider/credential_provider_support.h" #include "ios/chrome/browser/credential_provider/credential_provider_support.h"
#include "ios/chrome/browser/ui/util/credential_provider_buildflags.h" #include "ios/chrome/browser/credential_provider/credential_provider_buildflags.h"
bool IsCredentialProviderExtensionSupported() { bool IsCredentialProviderExtensionSupported() {
return BUILDFLAG(IOS_CREDENTIAL_PROVIDER_ENABLED); return BUILDFLAG(IOS_CREDENTIAL_PROVIDER_ENABLED);
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//ios/build/chrome_build.gni")
source_set("flags") { source_set("flags") {
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
sources = [ sources = [
...@@ -49,7 +51,7 @@ source_set("flags") { ...@@ -49,7 +51,7 @@ source_set("flags") {
"//ios/chrome/browser/drag_and_drop", "//ios/chrome/browser/drag_and_drop",
"//ios/chrome/browser/open_in:features", "//ios/chrome/browser/open_in:features",
"//ios/chrome/browser/policy:feature_flags", "//ios/chrome/browser/policy:feature_flags",
"//ios/chrome/browser/screen_time:feature_flags", "//ios/chrome/browser/screen_time:buildflags",
"//ios/chrome/browser/ui:feature_flags", "//ios/chrome/browser/ui:feature_flags",
"//ios/chrome/browser/ui/content_suggestions:feature_flags", "//ios/chrome/browser/ui/content_suggestions:feature_flags",
"//ios/chrome/browser/ui/download:features", "//ios/chrome/browser/ui/download:features",
...@@ -67,6 +69,10 @@ source_set("flags") { ...@@ -67,6 +69,10 @@ source_set("flags") {
"//ios/web/common:web_view_creation_util", "//ios/web/common:web_view_creation_util",
"//ios/web/public", "//ios/web/public",
] ]
if (ios_enable_screen_time) {
deps += [ "//ios/chrome/browser/screen_time:feature_flags" ]
}
} }
source_set("unit_tests") { source_set("unit_tests") {
......
...@@ -62,7 +62,7 @@ ...@@ -62,7 +62,7 @@
#include "ios/chrome/browser/flags/ios_chrome_flag_descriptions.h" #include "ios/chrome/browser/flags/ios_chrome_flag_descriptions.h"
#import "ios/chrome/browser/open_in/features.h" #import "ios/chrome/browser/open_in/features.h"
#include "ios/chrome/browser/policy/policy_features.h" #include "ios/chrome/browser/policy/policy_features.h"
#include "ios/chrome/browser/screen_time/features.h" #include "ios/chrome/browser/screen_time/screen_time_buildflags.h"
#include "ios/chrome/browser/system_flags.h" #include "ios/chrome/browser/system_flags.h"
#import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h"
#import "ios/chrome/browser/ui/download/features.h" #import "ios/chrome/browser/ui/download/features.h"
...@@ -81,6 +81,10 @@ ...@@ -81,6 +81,10 @@
#include "ios/web/common/user_agent.h" #include "ios/web/common/user_agent.h"
#include "ios/web/common/web_view_creation_util.h" #include "ios/web/common/web_view_creation_util.h"
#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
#include "ios/chrome/browser/screen_time/features.h"
#endif
#if !defined(OFFICIAL_BUILD) #if !defined(OFFICIAL_BUILD)
#include "components/variations/variations_switches.h" #include "components/variations/variations_switches.h"
#endif #endif
...@@ -614,10 +618,12 @@ const flags_ui::FeatureEntry kFeatureEntries[] = { ...@@ -614,10 +618,12 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
flag_descriptions::kEnableCloseAllTabsConfirmationName, flag_descriptions::kEnableCloseAllTabsConfirmationName,
flag_descriptions::kEnableCloseAllTabsConfirmationDescription, flag_descriptions::kEnableCloseAllTabsConfirmationDescription,
flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableCloseAllTabsConfirmation)}, flags_ui::kOsIos, FEATURE_VALUE_TYPE(kEnableCloseAllTabsConfirmation)},
#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
{"screen-time-integration-ios", {"screen-time-integration-ios",
flag_descriptions::kScreenTimeIntegrationName, flag_descriptions::kScreenTimeIntegrationName,
flag_descriptions::kScreenTimeIntegrationDescription, flags_ui::kOsIos, flag_descriptions::kScreenTimeIntegrationDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kScreenTimeIntegration)}, FEATURE_VALUE_TYPE(kScreenTimeIntegration)},
#endif
{"mobile-identity-consistency", {"mobile-identity-consistency",
flag_descriptions::kMobileIdentityConsistencyName, flag_descriptions::kMobileIdentityConsistencyName,
flag_descriptions::kMobileIdentityConsistencyDescription, flags_ui::kOsIos, flag_descriptions::kMobileIdentityConsistencyDescription, flags_ui::kOsIos,
......
...@@ -2,12 +2,25 @@ ...@@ -2,12 +2,25 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/ios/ios_sdk.gni") import("//build/buildflag_header.gni")
import("//ios/build/chrome_build.gni")
source_set("screen_time") { buildflag_header("buildflags") {
# TODO(crbug.com/1123704): remove when it is recommended to build Chromium header = "screen_time_buildflags.h"
# with version 12.0 or later of Xcode. flags = [ "IOS_SCREEN_TIME_ENABLED=$ios_enable_screen_time" ]
if (xcode_version_int >= 1200) { }
if (ios_enable_screen_time) {
source_set("feature_flags") {
sources = [
"features.h",
"features.mm",
]
configs += [ "//build/config/compiler:enable_arc" ]
deps = [ "//base" ]
}
source_set("screen_time") {
sources = [ sources = [
"screen_time_history_deleter.h", "screen_time_history_deleter.h",
"screen_time_history_deleter.mm", "screen_time_history_deleter.mm",
...@@ -26,12 +39,3 @@ source_set("screen_time") { ...@@ -26,12 +39,3 @@ source_set("screen_time") {
] ]
} }
} }
source_set("feature_flags") {
sources = [
"features.h",
"features.mm",
]
configs += [ "//build/config/compiler:enable_arc" ]
deps = [ "//base" ]
}
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//ios/build/chrome_build.gni")
source_set("browser_container") { source_set("browser_container") {
sources = [ sources = [
"browser_container_coordinator.h", "browser_container_coordinator.h",
...@@ -18,16 +20,22 @@ source_set("browser_container") { ...@@ -18,16 +20,22 @@ source_set("browser_container") {
"//ios/chrome/browser/main", "//ios/chrome/browser/main",
"//ios/chrome/browser/overlays", "//ios/chrome/browser/overlays",
"//ios/chrome/browser/overlays/public/web_content_area", "//ios/chrome/browser/overlays/public/web_content_area",
"//ios/chrome/browser/screen_time:feature_flags", "//ios/chrome/browser/screen_time:buildflags",
"//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/commands",
"//ios/chrome/browser/ui/coordinators:chrome_coordinators", "//ios/chrome/browser/ui/coordinators:chrome_coordinators",
"//ios/chrome/browser/ui/link_to_text", "//ios/chrome/browser/ui/link_to_text",
"//ios/chrome/browser/ui/overlays", "//ios/chrome/browser/ui/overlays",
"//ios/chrome/browser/ui/screen_time",
"//ios/chrome/browser/web_state_list", "//ios/chrome/browser/web_state_list",
"//ios/web/public", "//ios/web/public",
"//url", "//url",
] ]
if (ios_enable_screen_time) {
deps += [
"//ios/chrome/browser/screen_time:feature_flags",
"//ios/chrome/browser/ui/screen_time",
]
}
} }
source_set("ui") { source_set("ui") {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "base/check.h" #include "base/check.h"
#import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/main/browser.h"
#import "ios/chrome/browser/overlays/public/overlay_presenter.h" #import "ios/chrome/browser/overlays/public/overlay_presenter.h"
#import "ios/chrome/browser/screen_time/features.h" #include "ios/chrome/browser/screen_time/screen_time_buildflags.h"
#import "ios/chrome/browser/ui/browser_container/browser_container_mediator.h" #import "ios/chrome/browser/ui/browser_container/browser_container_mediator.h"
#import "ios/chrome/browser/ui/browser_container/browser_container_view_controller.h" #import "ios/chrome/browser/ui/browser_container/browser_container_view_controller.h"
#import "ios/chrome/browser/ui/commands/activity_service_commands.h" #import "ios/chrome/browser/ui/commands/activity_service_commands.h"
...@@ -18,9 +18,10 @@ ...@@ -18,9 +18,10 @@
#import "ios/chrome/browser/ui/overlays/overlay_container_coordinator.h" #import "ios/chrome/browser/ui/overlays/overlay_container_coordinator.h"
#import "url/gurl.h" #import "url/gurl.h"
#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 #if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
#import "ios/chrome/browser/screen_time/features.h"
#import "ios/chrome/browser/ui/screen_time/screen_time_coordinator.h" #import "ios/chrome/browser/ui/screen_time/screen_time_coordinator.h"
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 #endif
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
...@@ -98,10 +99,10 @@ ...@@ -98,10 +99,10 @@
// Sets up the ScreenTime coordinator, which installs and manages the ScreenTime // Sets up the ScreenTime coordinator, which installs and manages the ScreenTime
// blocking view. // blocking view.
- (void)setUpScreenTimeIfEnabled { - (void)setUpScreenTimeIfEnabled {
#if BUILDFLAG(IOS_SCREEN_TIME_ENABLED)
if (!IsScreenTimeIntegrationEnabled()) if (!IsScreenTimeIntegrationEnabled())
return; return;
#if defined(__IPHONE_14_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0
if (@available(iOS 14, *)) { if (@available(iOS 14, *)) {
ScreenTimeCoordinator* screenTimeCoordinator = ScreenTimeCoordinator* screenTimeCoordinator =
[[ScreenTimeCoordinator alloc] [[ScreenTimeCoordinator alloc]
...@@ -112,7 +113,7 @@ ...@@ -112,7 +113,7 @@
screenTimeCoordinator.viewController; screenTimeCoordinator.viewController;
self.screenTimeCoordinator = screenTimeCoordinator; self.screenTimeCoordinator = screenTimeCoordinator;
} }
#endif // __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 #endif
} }
@end @end
...@@ -2,36 +2,36 @@ ...@@ -2,36 +2,36 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/ios/ios_sdk.gni") import("//ios/build/chrome_build.gni")
assert(
ios_enable_screen_time,
"ios_enable_screen_time must be true to depend on //ios/chrome/browser/ui/screen_time")
source_set("screen_time") { source_set("screen_time") {
# TODO(crbug.com/1123704): remove when it is recommended to build Chromium sources = [
# with version 12.0 or later of Xcode. "screen_time_consumer.h",
if (xcode_version_int >= 1200) { "screen_time_coordinator.h",
sources = [ "screen_time_coordinator.mm",
"screen_time_consumer.h", "screen_time_mediator.h",
"screen_time_coordinator.h", "screen_time_mediator.mm",
"screen_time_coordinator.mm", "screen_time_view_controller.h",
"screen_time_mediator.h", "screen_time_view_controller.mm",
"screen_time_mediator.mm", ]
"screen_time_view_controller.h", frameworks = [
"screen_time_view_controller.mm", "UIKit.framework",
] "ScreenTime.framework",
frameworks = [ ]
"UIKit.framework", configs += [ "//build/config/compiler:enable_arc" ]
"ScreenTime.framework", deps = [
] "//base",
configs += [ "//build/config/compiler:enable_arc" ] "//ios/chrome/browser/browser_state",
deps = [ "//ios/chrome/browser/main:public",
"//base", "//ios/chrome/browser/screen_time",
"//ios/chrome/browser/browser_state", "//ios/chrome/browser/ui/coordinators:chrome_coordinators",
"//ios/chrome/browser/main:public", "//ios/chrome/browser/web_state_list",
"//ios/chrome/browser/screen_time", "//ios/chrome/common/ui/util",
"//ios/chrome/browser/ui/coordinators:chrome_coordinators", "//ios/web/public",
"//ios/chrome/browser/web_state_list", "//net",
"//ios/chrome/common/ui/util", ]
"//ios/web/public",
"//net",
]
}
} }
...@@ -11,6 +11,10 @@ import("//ios/build/config.gni") ...@@ -11,6 +11,10 @@ import("//ios/build/config.gni")
import("//ios/chrome/tools/strings/generate_localizable_strings.gni") import("//ios/chrome/tools/strings/generate_localizable_strings.gni")
import("//tools/grit/repack.gni") import("//tools/grit/repack.gni")
assert(
ios_enable_content_widget_extension,
"ios_enable_content_widget_extension must be true to depend on //ios/chrome/content_widget_extension")
tweak_info_plist("tweak_info_plist") { tweak_info_plist("tweak_info_plist") {
info_plist = "Info.plist" info_plist = "Info.plist"
......
...@@ -12,6 +12,10 @@ import("//ios/chrome/extension_repack.gni") ...@@ -12,6 +12,10 @@ import("//ios/chrome/extension_repack.gni")
import("//ios/chrome/tools/strings/generate_localizable_strings.gni") import("//ios/chrome/tools/strings/generate_localizable_strings.gni")
import("//ios/public/provider/chrome/browser/build_config.gni") import("//ios/public/provider/chrome/browser/build_config.gni")
assert(
ios_enable_credential_provider_extension,
"ios_enable_credential_provider_extension must be true to depend on //ios/chrome/credential_provider_extension")
group("resources") { group("resources") {
deps = [ "//ios/chrome/credential_provider_extension/strings" ] deps = [ "//ios/chrome/credential_provider_extension/strings" ]
} }
......
...@@ -11,6 +11,10 @@ import("//ios/build/config.gni") ...@@ -11,6 +11,10 @@ import("//ios/build/config.gni")
import("//ios/chrome/tools/strings/generate_localizable_strings.gni") import("//ios/chrome/tools/strings/generate_localizable_strings.gni")
import("//tools/grit/repack.gni") import("//tools/grit/repack.gni")
assert(
ios_enable_search_widget_extension,
"ios_enable_search_widget_extension must be true to depend on //ios/chrome/search_widget_extension")
tweak_info_plist("tweak_info_plist") { tweak_info_plist("tweak_info_plist") {
info_plist = "Info.plist" info_plist = "Info.plist"
......
...@@ -12,6 +12,10 @@ import("//ios/chrome/extension_repack.gni") ...@@ -12,6 +12,10 @@ import("//ios/chrome/extension_repack.gni")
import("//ios/chrome/tools/strings/generate_localizable_strings.gni") import("//ios/chrome/tools/strings/generate_localizable_strings.gni")
import("//ios/public/provider/chrome/browser/build_config.gni") import("//ios/public/provider/chrome/browser/build_config.gni")
assert(
ios_enable_share_extension,
"ios_enable_share_extension must be true to depend on //ios/chrome/share_extension")
group("resources") { group("resources") {
deps = [ "//ios/chrome/share_extension/strings" ] deps = [ "//ios/chrome/share_extension/strings" ]
} }
......
...@@ -178,7 +178,6 @@ test("ios_chrome_unittests") { ...@@ -178,7 +178,6 @@ test("ios_chrome_unittests") {
"//ios/chrome/browser/complex_tasks:unit_tests", "//ios/chrome/browser/complex_tasks:unit_tests",
"//ios/chrome/browser/crash_report:unit_tests", "//ios/chrome/browser/crash_report:unit_tests",
"//ios/chrome/browser/crash_report/breadcrumbs:unit_tests", "//ios/chrome/browser/crash_report/breadcrumbs:unit_tests",
"//ios/chrome/browser/credential_provider:unit_tests",
"//ios/chrome/browser/device_sharing:unit_tests", "//ios/chrome/browser/device_sharing:unit_tests",
"//ios/chrome/browser/download:unit_tests", "//ios/chrome/browser/download:unit_tests",
"//ios/chrome/browser/drag_and_drop:unit_tests", "//ios/chrome/browser/drag_and_drop:unit_tests",
...@@ -337,12 +336,24 @@ test("ios_chrome_unittests") { ...@@ -337,12 +336,24 @@ test("ios_chrome_unittests") {
"//ios/chrome/common/credential_provider:unit_tests", "//ios/chrome/common/credential_provider:unit_tests",
"//ios/chrome/common/ui/reauthentication:unit_tests", "//ios/chrome/common/ui/reauthentication:unit_tests",
"//ios/chrome/common/ui/util:unit_tests", "//ios/chrome/common/ui/util:unit_tests",
"//ios/chrome/content_widget_extension:unit_tests",
"//ios/chrome/credential_provider_extension:unit_tests",
"//ios/chrome/search_widget_extension:unit_tests",
"//ios/public/provider/chrome/browser/signin:unit_tests", "//ios/public/provider/chrome/browser/signin:unit_tests",
"//ios/testing:http_server_bundle_data", "//ios/testing:http_server_bundle_data",
] ]
if (ios_enable_search_widget_extension) {
deps += [ "//ios/chrome/search_widget_extension:unit_tests" ]
}
if (ios_enable_content_widget_extension) {
deps += [ "//ios/chrome/content_widget_extension:unit_tests" ]
}
if (ios_enable_credential_provider_extension) {
deps += [
"//ios/chrome/browser/credential_provider:unit_tests",
"//ios/chrome/credential_provider_extension:unit_tests",
]
}
assert_no_deps = ios_assert_no_deps assert_no_deps = ios_assert_no_deps
} }
...@@ -15,10 +15,11 @@ ios_app_bundle("showcase") { ...@@ -15,10 +15,11 @@ ios_app_bundle("showcase") {
":features", ":features",
"//ios/showcase/core:main", "//ios/showcase/core:main",
] ]
bundle_deps = [ bundle_deps = [ "//ios/showcase/core/resources" ]
"//ios/chrome/credential_provider_extension:system_strings", if (ios_enable_credential_provider_extension) {
"//ios/showcase/core/resources", bundle_deps +=
] [ "//ios/chrome/credential_provider_extension:system_strings" ]
}
assert_no_deps = ios_assert_no_deps assert_no_deps = ios_assert_no_deps
} }
......
...@@ -2,6 +2,18 @@ ...@@ -2,6 +2,18 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/buildflag_header.gni")
import("//ios/build/chrome_build.gni")
buildflag_header("buildflags") {
header = "showcase_model_buildflags.h"
flags = [
"SHOWCASE_CREDENTIAL_PROVIDER_ENABLED=ios_enable_credential_provider_extension",
"SHOWCASE_CONTENT_WIDGET_ENABLED=$ios_enable_content_widget_extension",
"SHOWCASE_SEARCH_WIDGET_ENABLED=$ios_enable_search_widget_extension",
]
}
source_set("core") { source_set("core") {
sources = [ sources = [
"app_delegate.h", "app_delegate.h",
...@@ -12,6 +24,7 @@ source_set("core") { ...@@ -12,6 +24,7 @@ source_set("core") {
"showcase_view_controller.mm", "showcase_view_controller.mm",
] ]
deps = [ deps = [
":buildflags",
"//base", "//base",
"//base:i18n", "//base:i18n",
"//ios/chrome/browser/ui/main", "//ios/chrome/browser/ui/main",
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#import "ios/showcase/core/showcase_model.h" #import "ios/showcase/core/showcase_model.h"
#import "ios/showcase/core/showcase_model_buildflags.h"
#if !defined(__has_feature) || !__has_feature(objc_arc) #if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support." #error "This file requires ARC support."
#endif #endif
...@@ -31,11 +33,13 @@ ...@@ -31,11 +33,13 @@
showcase::kClassForInstantiationKey : @"StaleCredentialsViewController", showcase::kClassForInstantiationKey : @"StaleCredentialsViewController",
showcase::kUseCaseKey : @"Credential Provider Stale Credentials UI", showcase::kUseCaseKey : @"Credential Provider Stale Credentials UI",
}, },
#if BUILDFLAG(SHOWCASE_CREDENTIAL_PROVIDER_ENABLED)
@{ @{
showcase::kClassForDisplayKey : @"CredentialListViewController", showcase::kClassForDisplayKey : @"CredentialListViewController",
showcase::kClassForInstantiationKey : @"SCCredentialListCoordinator", showcase::kClassForInstantiationKey : @"SCCredentialListCoordinator",
showcase::kUseCaseKey : @"Credential Provider Credentials List UI", showcase::kUseCaseKey : @"Credential Provider Credentials List UI",
}, },
#endif
@{ @{
showcase::kClassForDisplayKey : @"ContentSuggestionsViewController", showcase::kClassForDisplayKey : @"ContentSuggestionsViewController",
showcase::kClassForInstantiationKey : @"SCContentSuggestionsCoordinator", showcase::kClassForInstantiationKey : @"SCContentSuggestionsCoordinator",
...@@ -66,16 +70,20 @@ ...@@ -66,16 +70,20 @@
showcase::kClassForInstantiationKey : @"UIKitTableViewCellViewController", showcase::kClassForInstantiationKey : @"UIKitTableViewCellViewController",
showcase::kUseCaseKey : @"UIKit Table Cells", showcase::kUseCaseKey : @"UIKit Table Cells",
}, },
#if BUILDFLAG(SHOWCASE_SEARCH_WIDGET_ENABLED)
@{ @{
showcase::kClassForDisplayKey : @"SearchWidgetViewController", showcase::kClassForDisplayKey : @"SearchWidgetViewController",
showcase::kClassForInstantiationKey : @"SCSearchWidgetCoordinator", showcase::kClassForInstantiationKey : @"SCSearchWidgetCoordinator",
showcase::kUseCaseKey : @"Search Widget", showcase::kUseCaseKey : @"Search Widget",
}, },
#endif
#if BUILDFLAG(SHOWCASE_CONTENT_WIDGET_ENABLED)
@{ @{
showcase::kClassForDisplayKey : @"ContentWidgetViewController", showcase::kClassForDisplayKey : @"ContentWidgetViewController",
showcase::kClassForInstantiationKey : @"SCContentWidgetCoordinator", showcase::kClassForInstantiationKey : @"SCContentWidgetCoordinator",
showcase::kUseCaseKey : @"Content Widget", showcase::kUseCaseKey : @"Content Widget",
}, },
#endif
@{ @{
showcase::kClassForDisplayKey : @"TextBadgeView", showcase::kClassForDisplayKey : @"TextBadgeView",
showcase::kClassForInstantiationKey : @"SCTextBadgeViewController", showcase::kClassForInstantiationKey : @"SCTextBadgeViewController",
......
...@@ -2,16 +2,21 @@ ...@@ -2,16 +2,21 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//ios/build/chrome_build.gni")
source_set("credential_provider") { source_set("credential_provider") {
sources = [ sources = []
"sc_credential_list_coordinator.h", deps = [ "//ios/showcase/common" ]
"sc_credential_list_coordinator.mm", if (ios_enable_credential_provider_extension) {
] sources += [
deps = [ "sc_credential_list_coordinator.h",
"//ios/chrome/common/credential_provider:ui", "sc_credential_list_coordinator.mm",
"//ios/chrome/credential_provider_extension/ui", ]
"//ios/showcase/common", deps += [
] "//ios/chrome/common/credential_provider:ui",
"//ios/chrome/credential_provider_extension/ui",
]
}
frameworks = [ "UIKit.framework" ] frameworks = [ "UIKit.framework" ]
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
} }
...@@ -23,7 +28,7 @@ source_set("eg2_tests") { ...@@ -23,7 +28,7 @@ source_set("eg2_tests") {
"//build/config/ios:xctest_config", "//build/config/ios:xctest_config",
] ]
testonly = true testonly = true
sources = [ "credential_provider_egtest.mm" ] sources = []
deps = [ deps = [
"//base", "//base",
"//ios/chrome/common/ui/confirmation_alert", "//ios/chrome/common/ui/confirmation_alert",
...@@ -32,5 +37,10 @@ source_set("eg2_tests") { ...@@ -32,5 +37,10 @@ source_set("eg2_tests") {
"//ios/third_party/earl_grey2:test_lib", "//ios/third_party/earl_grey2:test_lib",
"//ui/base", "//ui/base",
] ]
if (ios_enable_credential_provider_extension) {
sources += [ "credential_provider_egtest.mm" ]
}
frameworks = [ "UIKit.framework" ] frameworks = [ "UIKit.framework" ]
} }
...@@ -2,18 +2,25 @@ ...@@ -2,18 +2,25 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//ios/build/chrome_build.gni")
source_set("widget") { source_set("widget") {
sources = [ sources = []
"sc_content_widget_coordinator.h", deps = [ "//ios/showcase/common" ]
"sc_content_widget_coordinator.mm", if (ios_enable_content_widget_extension) {
"sc_search_widget_coordinator.h", sources += [
"sc_search_widget_coordinator.mm", "sc_content_widget_coordinator.h",
] "sc_content_widget_coordinator.mm",
deps = [ ]
"//ios/chrome/content_widget_extension:content_widget", deps += [ "//ios/chrome/content_widget_extension:content_widget" ]
"//ios/chrome/search_widget_extension:search_widget", }
"//ios/showcase/common", if (ios_enable_search_widget_extension) {
] sources += [
"sc_search_widget_coordinator.h",
"sc_search_widget_coordinator.mm",
]
deps += [ "//ios/chrome/search_widget_extension:search_widget" ]
}
frameworks = [ "UIKit.framework" ] frameworks = [ "UIKit.framework" ]
configs += [ "//build/config/compiler:enable_arc" ] configs += [ "//build/config/compiler:enable_arc" ]
} }
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