diff --git a/AUTHORS b/AUTHORS index 0436326..679f65d 100644 --- a/AUTHORS +++ b/AUTHORS
@@ -1072,6 +1072,7 @@ Seokju Kwon <seokju.kwon@gmail.com> Seokho Song <0xdevssh@gmail.com> SeongTae Jeong <ferendevelop.gl@gmail.com> +Sergei Romanov <rsv.981@gmail.com> Sergey Kipet <sergey.kipet@gmail.com> Sergey Putilin <p.sergey@samsung.com> Sergey Shekyan <shekyan@gmail.com>
diff --git a/DEPS b/DEPS index 6726e2d..c3eef31 100644 --- a/DEPS +++ b/DEPS
@@ -297,15 +297,15 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '6cec033662c7d8a36287d644cefbe519c75d1c07', + 'skia_revision': 'c54c285a35e7c9e07bd06bbc5633a8f720b50f9b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': '96dc9acf84c361a2243d13782b1ee421c7e31941', + 'v8_revision': 'a2f51771ed93f25aa4aa3f84acdabc7f10bd3e82', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ANGLE # and whatever else without interference from each other. - 'angle_revision': 'aa2a558ec2caf2aaa16ea5a76cf5e80ac9c33a4b', + 'angle_revision': '94a23a4ed65278805ce4e95e4945e50e67e0cc52', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -324,7 +324,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Fuchsia sdk # and whatever else without interference from each other. - 'fuchsia_version': 'version:9.20220823.1.1', + 'fuchsia_version': 'version:9.20220824.1.1', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling google-toolbox-for-mac # and whatever else without interference from each other. @@ -376,7 +376,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling devtools-frontend # and whatever else without interference from each other. - 'devtools_frontend_revision': '264e8ffac6860d580766e2aacd16e0ee18ef940c', + 'devtools_frontend_revision': '4752d2b7a705518fed33bc94d77279b5efc14f8b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling libprotobuf-mutator # and whatever else without interference from each other. @@ -412,7 +412,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': '55185fa6d1e8edb2b663d224d878c9809d39af2f', + 'dawn_revision': 'a85290b909107e2b8ba16d15973b5992a8620088', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -440,7 +440,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling nearby # and whatever else without interference from each other. - 'nearby_revision': 'bbd6986f06b8662bf48bb07fde5c41896dd6a706', + 'nearby_revision': '01a4daffd286651c408572e0096448d83f1e51f6', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling securemessage # and whatever else without interference from each other. @@ -952,7 +952,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': 'LTTmRlS5kbJrcKpqumRf5thU-ys_1p5VJrLp1W5ZfVAC', + 'version': 'MELv-PC9D_0B035PO-sa3Wcb4aj83og1iDjZSSa9ccYC', }, ], 'condition': 'checkout_android', @@ -1704,7 +1704,7 @@ 'dep_type': 'cipd', }, - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@e1b5a3034c2472a15d4633f5e80f4a4dff82e58b', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@188a44aaa198bba5bf09109fa98a5ad30d67ef92', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + 'ebe84bec02c041d28f902da0214bf442743fc907', @@ -1743,7 +1743,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'ce6d70059e89fc945c480c2e0da695eb839897e1', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'b63086b4b922bf1c4460dae7348ae316b050ae15', + Var('webrtc_git') + '/src.git' + '@' + '5d80958d5e8cbf0ba7b96ee6bb4edbbeace3a0dc', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1816,7 +1816,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@b35bb3405d84af3fd50330821dc7c0c93d82d85f', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@b47875fd45f0a518f30d03db0f3e5b347a8c0db8', 'condition': 'checkout_src_internal', }, @@ -1868,7 +1868,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'RV5EUB5F8MJCvXJt7KFSBAytjeCvB_b2NT6a70ICLssC', + 'version': '_mdOrvLHSmVw9emmQ_yYHOf2m_ZmhNLR_mVNIplEgg4C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java b/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java index 171fa27..3353a5a3 100644 --- a/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java +++ b/android_webview/java/src/org/chromium/android_webview/common/ProductionSupportedFlagList.java
@@ -366,6 +366,8 @@ Flag.baseFeature(MetricsFeatures.CONSOLIDATE_METRICS_SERVICE_INITIAL_LOG_LOGIC, "Controls whether the logic to build the initial UMA log is the same as" + " other logs."), + Flag.baseFeature(ContentFeatures.WEBVIEW_THROTTLE_BACKGROUND_BEGIN_FRAME, + "Enable to throttle begin frames when webview is not being drawn"), // Add new commandline switches and features above. The final entry should have a // trailing comma for cleaner diffs. };
diff --git a/ash/webui/camera_app_ui/camera_app_helper.mojom b/ash/webui/camera_app_ui/camera_app_helper.mojom index a8f385a7..f88e240 100644 --- a/ash/webui/camera_app_ui/camera_app_helper.mojom +++ b/ash/webui/camera_app_ui/camera_app_helper.mojom
@@ -219,4 +219,10 @@ // Converts the given |jpeg_data| to PDF format. ConvertToPdf(array<uint8> jpeg_data) => (array<uint8> pdf_data); + + // Triggers HaTS survey for the camera app if all the conditions match: + // 1. The camera app session is longer than 15 seconds + // 2. The user is chosen to take the survey + // 3. The user hasn't done any survey recently + MaybeTriggerSurvey(); };
diff --git a/ash/webui/camera_app_ui/camera_app_helper_impl.cc b/ash/webui/camera_app_ui/camera_app_helper_impl.cc index c49f645..92f83e8a 100644 --- a/ash/webui/camera_app_ui/camera_app_helper_impl.cc +++ b/ash/webui/camera_app_ui/camera_app_helper_impl.cc
@@ -382,6 +382,10 @@ std::move(callback).Run(std::move(pdf_data)); } +void CameraAppHelperImpl::MaybeTriggerSurvey() { + camera_app_ui_->delegate()->MaybeTriggerSurvey(); +} + void CameraAppHelperImpl::OnTabletModeStarted() { if (tablet_mode_monitor_.is_bound()) tablet_mode_monitor_->Update(true);
diff --git a/ash/webui/camera_app_ui/camera_app_helper_impl.h b/ash/webui/camera_app_ui/camera_app_helper_impl.h index ae52190..d2e8053 100644 --- a/ash/webui/camera_app_ui/camera_app_helper_impl.h +++ b/ash/webui/camera_app_ui/camera_app_helper_impl.h
@@ -92,6 +92,7 @@ ConvertToDocumentCallback callback) override; void ConvertToPdf(const std::vector<uint8_t>& jpeg_data, ConvertToPdfCallback callback) override; + void MaybeTriggerSurvey() override; private: void CheckExternalScreenState();
diff --git a/ash/webui/camera_app_ui/camera_app_ui_delegate.h b/ash/webui/camera_app_ui/camera_app_ui_delegate.h index 640e658ac..782b63be 100644 --- a/ash/webui/camera_app_ui/camera_app_ui_delegate.h +++ b/ash/webui/camera_app_ui/camera_app_ui_delegate.h
@@ -63,6 +63,9 @@ virtual void MonitorFileDeletion( const std::string& name, base::OnceCallback<void(FileMonitorResult)> callback) = 0; + + // Maybe triggers HaTS survey for the camera app if all the conditions match. + virtual void MaybeTriggerSurvey() = 0; }; } // namespace ash
diff --git a/ash/webui/camera_app_ui/resources/js/mojo/chrome_helper.ts b/ash/webui/camera_app_ui/resources/js/mojo/chrome_helper.ts index 24cacdd..ccbb031 100644 --- a/ash/webui/camera_app_ui/resources/js/mojo/chrome_helper.ts +++ b/ash/webui/camera_app_ui/resources/js/mojo/chrome_helper.ts
@@ -374,6 +374,13 @@ } /** + * Tries to trigger HaTS survey for CCA. + */ + maybeTriggerSurvey(): void { + this.remote.maybeTriggerSurvey(); + } + + /** * Creates a new instance of ChromeHelper if it is not set. Returns the * exist instance. *
diff --git a/base/allocator/partition_allocator/partition_alloc-inl.h b/base/allocator/partition_allocator/partition_alloc-inl.h index c90fa75..fa4f8400 100644 --- a/base/allocator/partition_allocator/partition_alloc-inl.h +++ b/base/allocator/partition_allocator/partition_alloc-inl.h
@@ -27,14 +27,27 @@ // This is a `memset` that resists being optimized away. Adapted from // boringssl/src/crypto/mem.c. (Copying and pasting is bad, but //base can't // depend on //third_party, and this is small enough.) +#if defined(COMPILER_MSVC) && !defined(__clang__) +// MSVC only supports inline assembly on x86. This preprocessor directive +// is intended to be a replacement for the same. +// +// TODO(crbug.com/1351310): Make sure inlining doesn't degrade this into +// a no-op or similar. The documentation doesn't say. +#pragma optimize("", off) +#endif PA_ALWAYS_INLINE void SecureMemset(void* ptr, uint8_t value, size_t size) { memset(ptr, value, size); +#if !defined(COMPILER_MSVC) || defined(__clang__) // As best as we can tell, this is sufficient to break any optimisations that // might try to eliminate "superfluous" memsets. If there's an easy way to // detect memset_s, it would be better to use that. __asm__ __volatile__("" : : "r"(ptr) : "memory"); +#endif // !defined(COMPILER_MSVC) || defined(__clang__) } +#if defined(COMPILER_MSVC) && !defined(__clang__) +#pragma optimize("", on) +#endif // Used to memset() memory for debugging purposes only. PA_ALWAYS_INLINE void DebugMemset(void* ptr, int value, size_t size) {
diff --git a/base/allocator/partition_allocator/partition_bucket.cc b/base/allocator/partition_allocator/partition_bucket.cc index d464ba0..fbb73b3 100644 --- a/base/allocator/partition_allocator/partition_bucket.cc +++ b/base/allocator/partition_allocator/partition_bucket.cc
@@ -704,7 +704,6 @@ std::memory_order_relaxed); root->next_super_page = super_page + kSuperPageSize; - // TODO(crbug.com/1307514): Add direct map support. uintptr_t state_bitmap = super_page + PartitionPageSize() + (is_direct_mapped()
diff --git a/base/allocator/partition_allocator/yield_processor.h b/base/allocator/partition_allocator/yield_processor.h index 0d987cbf..b25e2fccb 100644 --- a/base/allocator/partition_allocator/yield_processor.h +++ b/base/allocator/partition_allocator/yield_processor.h
@@ -16,6 +16,10 @@ #if BUILDFLAG(IS_NACL) // Inline assembly not allowed. #define PA_YIELD_PROCESSOR ((void)0) +#elif defined(COMPILER_MSVC) && !defined(__clang__) +// MSVC is in its own assemblyless world (crbug.com/1351310#c6). +#include <windows.h> +#define PA_YIELD_PROCESSOR (YieldProcessor()) #else #if defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_X86)
diff --git a/chrome/android/chrome_test_java_sources.gni b/chrome/android/chrome_test_java_sources.gni index f1bfb8e..e2d5a25 100644 --- a/chrome/android/chrome_test_java_sources.gni +++ b/chrome/android/chrome_test_java_sources.gni
@@ -450,6 +450,7 @@ "javatests/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegateTest.java", "javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsBridgeTest.java", "javatests/src/org/chromium/chrome/browser/site_settings/CookieControlsServiceBridgeTest.java", + "javatests/src/org/chromium/chrome/browser/site_settings/CookieSettingsTest.java", "javatests/src/org/chromium/chrome/browser/site_settings/ManageSpaceActivityTest.java", "javatests/src/org/chromium/chrome/browser/site_settings/PermissionInfoTest.java", "javatests/src/org/chromium/chrome/browser/site_settings/SingleWebsiteSettingsTest.java",
diff --git a/chrome/android/features/tab_ui/OWNERS b/chrome/android/features/tab_ui/OWNERS index dc24be9..1efdd962 100644 --- a/chrome/android/features/tab_ui/OWNERS +++ b/chrome/android/features/tab_ui/OWNERS
@@ -1,2 +1,3 @@ file://chrome/android/java/src/org/chromium/chrome/browser/tasks/OWNERS -per-file *IncognitoReauthPromoMessageService*=file://chrome/browser/incognito/OWNERS + +per-file ...IncognitoReauth*=file://chrome/browser/incognito/OWNERS
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java index 2a107a4..0f5aafc3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/MainSettings.java
@@ -9,6 +9,7 @@ import android.content.Context; import android.content.Intent; +import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -188,16 +189,21 @@ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { // If we are on Android O+ the Notifications preference should lead to the Android // Settings notifications page. - Preference notifications = findPreference(PREF_NOTIFICATIONS); - notifications.setOnPreferenceClickListener(preference -> { - Intent intent = new Intent(); - intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); - intent.putExtra(Settings.EXTRA_APP_PACKAGE, - ContextUtils.getApplicationContext().getPackageName()); - startActivity(intent); - // We handle the click so the default action isn't triggered. - return true; - }); + Intent intent = new Intent(); + intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); + intent.putExtra(Settings.EXTRA_APP_PACKAGE, + ContextUtils.getApplicationContext().getPackageName()); + PackageManager pm = getActivity().getPackageManager(); + if (intent.resolveActivity(pm) != null) { + Preference notifications = findPreference(PREF_NOTIFICATIONS); + notifications.setOnPreferenceClickListener(preference -> { + startActivity(intent); + // We handle the click so the default action isn't triggered. + return true; + }); + } else { + removePreferenceIfPresent(PREF_NOTIFICATIONS); + } } else { // The per-website notification settings page can be accessed from Site // Settings, so we don't need to show this here.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java index 4b729342..983fa26 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java
@@ -137,6 +137,11 @@ } @Override + public boolean isPrivacySandboxFirstPartySetsUIFeatureEnabled() { + return ChromeFeatureList.isEnabled(ChromeFeatureList.PRIVACY_SANDBOX_FPS_UI); + } + + @Override public String getChannelIdForOrigin(String origin) { return SiteChannelsManager.getInstance().getChannelIdForOrigin(origin); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java index f85b4b9..79d4056b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java
@@ -527,19 +527,34 @@ initUndoGroupSnackbarController(); } + /** + * Creates an instance of {@link IncognitoReauthCoordinatorFactory} for tabbed activity. + * + * Note that, it requires a valid instance of start surface to work properly if + * {@link ReturnToChromeUtil.isTabSwitcherOnlyRefactorEnabled} returns false. Start surface is + * only constructed if grid tab switcher is enabled. + * See {@link ChromeTabbedActivity#setupCompositorContentPreNativeForPhone} and + * {@link ChromeTabbedActivity#setupCompositorContentPreNativeForTablet} for more detail. + * + * TODO(crbug.com/1355870): Validate the Chrome behaviour when grid tab switcher is not enabled. + */ @Override protected IncognitoReauthCoordinatorFactory getIncognitoReauthCoordinatorFactory() { // TODO(crbug.com/1315676): When the refactor is enabled by default, use // |tabSwitcherCustomView| directly instead of the supplier. OneshotSupplier<TabSwitcherCustomViewManager> tabSwitcherCustomViewSupplier = new OneshotSupplierImpl<>(); - if (ReturnToChromeUtil.isTabSwitcherOnlyRefactorEnabled(mActivity) - && mActivityType == ActivityType.TABBED) { + if (ReturnToChromeUtil.isTabSwitcherOnlyRefactorEnabled(mActivity)) { ((OneshotSupplierImpl) tabSwitcherCustomViewSupplier) .set(mTabSwitcherSupplier.get().getTabSwitcherCustomViewManager()); } else { - tabSwitcherCustomViewSupplier = - mStartSurfaceSupplier.get().getTabSwitcherCustomViewManagerSupplier(); + if (mStartSurfaceSupplier.hasValue()) { + assert TabUiFeatureUtilities.isGridTabSwitcherEnabled(mActivity) + || TabUiFeatureUtilities.isTabletGridTabSwitcherEnabled(mActivity) + : "Grid tab switcher should be enabled."; + tabSwitcherCustomViewSupplier = + mStartSurfaceSupplier.get().getTabSwitcherCustomViewManagerSupplier(); + } } // TODO(crbug.com/1324211, crbug.com/1227656) : Refactor below to remove
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieSettingsTest.java new file mode 100644 index 0000000..a8cc76a --- /dev/null +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/CookieSettingsTest.java
@@ -0,0 +1,118 @@ +// Copyright 2022 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. + +package org.chromium.chrome.browser.site_settings; + +import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; +import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA; +import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; +import static androidx.test.espresso.matcher.ViewMatchers.withId; +import static androidx.test.espresso.matcher.ViewMatchers.withText; +import static org.chromium.ui.test.util.ViewUtils.onViewWaiting; +import static org.hamcrest.CoreMatchers.allOf; +import static org.hamcrest.CoreMatchers.is; + +import android.os.Bundle; +import android.view.View; +import androidx.test.filters.SmallTest; +import java.io.IOException; +import org.chromium.base.test.util.Batch; +import org.chromium.base.test.util.CommandLineFlags; +import org.chromium.base.test.util.Feature; +import org.chromium.chrome.browser.flags.ChromeFeatureList; +import org.chromium.chrome.browser.flags.ChromeSwitches; +import org.chromium.chrome.browser.settings.SettingsActivity; +import org.chromium.chrome.browser.settings.SettingsActivityTestRule; +import org.chromium.chrome.test.ChromeJUnit4ClassRunner; +import org.chromium.chrome.test.util.ChromeRenderTestRule; +import org.chromium.chrome.test.util.browser.Features.EnableFeatures; +import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference; +import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference.CookieSettingsState; +import org.chromium.components.browser_ui.site_settings.R; +import org.chromium.components.browser_ui.site_settings.SingleCategorySettings; +import org.chromium.components.browser_ui.site_settings.SiteSettingsCategory; +import org.chromium.content_public.browser.test.util.TestThreadUtils; +import org.chromium.ui.test.util.RenderTestRule; +import org.chromium.ui.test.util.RenderTestRule.Component; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; + +/** + * Render tests for the Cookie page and subpages under Settings > Site Settings > Cookies. + */ +@RunWith(ChromeJUnit4ClassRunner.class) +@Batch(Batch.PER_CLASS) +@CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) +public class CookieSettingsTest { + @Rule + public SettingsActivityTestRule<SingleCategorySettings> mSettingsActivityTestRule = + new SettingsActivityTestRule<>(SingleCategorySettings.class); + + @Rule + public ChromeRenderTestRule mRenderTestRule = + ChromeRenderTestRule.Builder.withPublicCorpus() + .setBugComponent(Component.UI_BROWSER_MOBILE_SETTINGS) + .build(); + + private SettingsActivity mSettingsActivity; + + @Before + public void setUp() { + Bundle fragmentArgs = new Bundle(); + fragmentArgs.putString(SingleCategorySettings.EXTRA_CATEGORY, + SiteSettingsCategory.preferenceKey(SiteSettingsCategory.Type.COOKIES)); + mSettingsActivity = mSettingsActivityTestRule.startSettingsActivity(fragmentArgs); + } + + @Test + @SmallTest + @Feature({"RenderTest"}) + public void testRenderCookiePage() throws IOException { + setCookiesEnabled(mSettingsActivity, false); + View view = mSettingsActivity.getMainFragment().getView(); + onViewWaiting(allOf(is(view), isDisplayed())); + + mRenderTestRule.render(view, "settings_cookie_page"); + } + + @Test + @SmallTest + @Feature({"RenderTest"}) + @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_FPS_UI) + public void testRenderCookieFPSSubpage() throws IOException { + onView(allOf(withId(R.id.expand_arrow), + isDescendantOfA(withId(R.id.block_third_party_with_aux)))) + .perform(click()); + + mRenderTestRule.render( + getRootView(R.string.website_settings_category_cookie_block_third_party_subtitle), + "settings_cookie_fps_subpage"); + } + + private void setCookiesEnabled(final SettingsActivity settingsActivity, final boolean enabled) { + TestThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + final SingleCategorySettings websitePreferences = + (SingleCategorySettings) settingsActivity.getMainFragment(); + final FourStateCookieSettingsPreference cookies = + (FourStateCookieSettingsPreference) websitePreferences.findPreference( + SingleCategorySettings.FOUR_STATE_COOKIE_TOGGLE_KEY); + + websitePreferences.onPreferenceChange( + cookies, enabled ? CookieSettingsState.ALLOW : CookieSettingsState.BLOCK); + } + }); + } + + private View getRootView(int text) { + View[] view = {null}; + onView(withText(text)).check(((v, e) -> view[0] = v.getRootView())); + TestThreadUtils.runOnUiThreadBlocking(() -> RenderTestRule.sanitize(view[0])); + return view[0]; + } +}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/SiteSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/SiteSettingsTest.java index 57a994e..dbe176f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/SiteSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/SiteSettingsTest.java
@@ -4,6 +4,9 @@ package org.chromium.chrome.browser.site_settings; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.refEq; + import static org.chromium.components.browser_ui.site_settings.AutoDarkMetrics.AutoDarkSettingsChangeSource.SITE_SETTINGS_GLOBAL; import static org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge.SITE_WILDCARD; import static org.chromium.components.content_settings.PrefNames.COOKIE_CONTROLS_MODE; @@ -13,6 +16,7 @@ import android.content.Context; import android.content.Intent; import android.os.Build; +import android.os.Bundle; import android.support.test.InstrumentationRegistry; import androidx.preference.Preference; @@ -29,6 +33,9 @@ import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; import org.chromium.base.ContextUtils; import org.chromium.base.metrics.RecordHistogram; @@ -42,6 +49,7 @@ import org.chromium.chrome.browser.browsing_data.BrowsingDataBridge; import org.chromium.chrome.browser.browsing_data.BrowsingDataType; import org.chromium.chrome.browser.browsing_data.TimePeriod; +import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.incognito.IncognitoUtils; import org.chromium.chrome.browser.notifications.channels.ChromeChannelDefinitions; @@ -63,6 +71,7 @@ import org.chromium.components.browser_ui.settings.ExpandablePreferenceGroup; import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.site_settings.ContentSettingsResources; +import org.chromium.components.browser_ui.site_settings.FPSCookieSettings; import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference; import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference.CookieSettingsState; import org.chromium.components.browser_ui.site_settings.R; @@ -103,6 +112,7 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE, ContentSwitches.HOST_RESOLVER_RULES + "=MAP * 127.0.0.1", "ignore-certificate-errors"}) @Batch(SiteSettingsTest.SITE_SETTINGS_BATCH_NAME) +@DisableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_FPS_UI) public class SiteSettingsTest { public static final String SITE_SETTINGS_BATCH_NAME = "site_settings"; @@ -113,6 +123,9 @@ public BlankCTATabInitialStateRule mBlankCTATabInitialStateRule = new BlankCTATabInitialStateRule(mPermissionRule, false); + @Mock + private SettingsLauncher mSettingsLauncher; + private PermissionUpdateWaiter mPermissionUpdateWaiter; private static final String[] NULL_ARRAY = new String[0]; @@ -128,6 +141,7 @@ public void setUp() throws TimeoutException { // Clean up cookies and permissions to ensure tests run in a clean environment. cleanUpCookiesAndPermissions(); + MockitoAnnotations.initMocks(this); } @After @@ -468,6 +482,52 @@ } /** + * Clicks on cookies radio buttons and verify the right FPS subpage is launched. + */ + @Test + @SmallTest + @Feature({"Preferences"}) + @EnableFeatures({ChromeFeatureList.PRIVACY_SANDBOX_FPS_UI}) + public void testCookiesFPSSubpageIsLaunched() throws Exception { + SettingsActivity settingsActivity = + SiteSettingsTestUtils.startSiteSettingsCategory(SiteSettingsCategory.Type.COOKIES); + + verifyFPSCookieSubpageIsLaunchedWithParams( + settingsActivity, CookieSettingsState.BLOCK_THIRD_PARTY); + verifyFPSCookieSubpageIsLaunchedWithParams( + settingsActivity, CookieSettingsState.BLOCK_THIRD_PARTY_INCOGNITO); + } + + private void verifyFPSCookieSubpageIsLaunchedWithParams( + final SettingsActivity settingsActivity, CookieSettingsState cookieSettingsState) { + TestThreadUtils.runOnUiThreadBlocking(new Runnable() { + @Override + public void run() { + final SingleCategorySettings websitePreferences = + (SingleCategorySettings) settingsActivity.getMainFragment(); + final FourStateCookieSettingsPreference cookies = + (FourStateCookieSettingsPreference) websitePreferences.findPreference( + SingleCategorySettings.FOUR_STATE_COOKIE_TOGGLE_KEY); + + Mockito.clearInvocations(mSettingsLauncher); + websitePreferences.setSettingsLauncher(mSettingsLauncher); + + SiteSettingsTestUtils.getCookieRadioButtonFrom(cookies, cookieSettingsState) + .getAuxButtonForTests() + .performClick(); + + Bundle fragmentArgs = new Bundle(); + fragmentArgs.putSerializable( + FPSCookieSettings.EXTRA_COOKIE_STATE, cookieSettingsState); + + Mockito.verify(mSettingsLauncher) + .launchSettingsActivity(eq(websitePreferences.getContext()), + eq(FPSCookieSettings.class), refEq(fragmentArgs)); + } + }); + } + + /** * Blocks cookies from being set and ensures that no cookies can be set. */ @Test @@ -978,6 +1038,39 @@ @Test @SmallTest @Feature({"Preferences"}) + @EnableFeatures(ChromeFeatureList.PRIVACY_SANDBOX_FPS_UI) + public void testExpectedCookieButtonsCheckedWhenFPSUiEnabled() { + SettingsActivity settingsActivity = + SiteSettingsTestUtils.startSiteSettingsCategory(SiteSettingsCategory.Type.COOKIES); + + TestThreadUtils.runOnUiThreadBlocking(() -> { + SingleCategorySettings preferences = + (SingleCategorySettings) settingsActivity.getMainFragment(); + FourStateCookieSettingsPreference fourStateCookieToggle = + (FourStateCookieSettingsPreference) preferences.findPreference( + SingleCategorySettings.FOUR_STATE_COOKIE_TOGGLE_KEY); + + clickButtonAndVerifyItsChecked(fourStateCookieToggle, CookieSettingsState.ALLOW); + clickButtonAndVerifyItsChecked( + fourStateCookieToggle, CookieSettingsState.BLOCK_THIRD_PARTY_INCOGNITO); + clickButtonAndVerifyItsChecked( + fourStateCookieToggle, CookieSettingsState.BLOCK_THIRD_PARTY); + clickButtonAndVerifyItsChecked(fourStateCookieToggle, CookieSettingsState.BLOCK); + }); + + settingsActivity.finish(); + } + + private void clickButtonAndVerifyItsChecked( + FourStateCookieSettingsPreference fourStateCookieToggle, CookieSettingsState state) { + fourStateCookieToggle.getButton(state).performClick(); + Assert.assertTrue( + "Button should be checked.", fourStateCookieToggle.getButton(state).isChecked()); + } + + @Test + @SmallTest + @Feature({"Preferences"}) public void testOnlyExpectedPreferencesDeviceLocation() { LocationSettingsTestUtil.setSystemLocationSettingEnabled(true);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/SiteSettingsTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/SiteSettingsTestUtils.java index a55e48c..e355dac 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/SiteSettingsTestUtils.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/SiteSettingsTestUtils.java
@@ -12,11 +12,15 @@ import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.site_settings.AllSiteSettings; +import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference; +import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference.CookieSettingsState; import org.chromium.components.browser_ui.site_settings.SingleCategorySettings; import org.chromium.components.browser_ui.site_settings.SingleWebsiteSettings; import org.chromium.components.browser_ui.site_settings.SiteSettings; import org.chromium.components.browser_ui.site_settings.SiteSettingsCategory; import org.chromium.components.browser_ui.site_settings.Website; +import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; +import org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionAndAuxButton; /** * Util functions for testing SiteSettings functionality. @@ -67,4 +71,11 @@ return (SettingsActivity) InstrumentationRegistry.getInstrumentation().startActivitySync( intent); } + + public static RadioButtonWithDescriptionAndAuxButton getCookieRadioButtonFrom( + FourStateCookieSettingsPreference cookiePage, CookieSettingsState cookieSettingsState) { + RadioButtonWithDescription button = cookiePage.getButton(cookieSettingsState); + + return ((RadioButtonWithDescriptionAndAuxButton) button); + } }
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index 349dc75..98d45650 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-106.0.5249.7_rc-r1-merged.afdo.bz2 +chromeos-chrome-amd64-106.0.5249.8_rc-r1-merged.afdo.bz2
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 3065365c..2cb13e7 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -404,10 +404,6 @@ "data_use_measurement/chrome_data_use_measurement.h", "defaults.cc", "defaults.h", - "device_reauth/chrome_biometric_authenticator_common.cc", - "device_reauth/chrome_biometric_authenticator_common.h", - "device_reauth/chrome_biometric_authenticator_factory.cc", - "device_reauth/chrome_biometric_authenticator_factory.h", "dips/cookie_access_filter.cc", "dips/cookie_access_filter.h", "dips/dips_bounce_detector.cc", @@ -2065,6 +2061,7 @@ "//components/certificate_transparency:proto", "//components/client_hints/browser", "//components/cloud_devices/common", + "//components/commerce/content/browser:browser", "//components/commerce/core:commerce_heuristics_data", "//components/commerce/core:commerce_subscription_db_content_proto", "//components/commerce/core:feature_list", @@ -5387,8 +5384,6 @@ "chromeos/extensions/login_screen/login/cleanup/cleanup_manager_lacros.h", "chromeos/extensions/login_screen/login/cleanup/cleanup_manager_lacros_factory.cc", "chromeos/extensions/login_screen/login/cleanup/cleanup_manager_lacros_factory.h", - "chromeos/extensions/public_session_permission_helper.cc", - "chromeos/extensions/public_session_permission_helper.h", "chromeos/extensions/wallpaper_api.cc", "chromeos/extensions/wallpaper_api.h", "chromeos/policy/dlp/clipboard_bubble.cc", @@ -5835,6 +5830,8 @@ "component_updater/recovery_improved_component_installer_win.cc", "component_updater/sw_reporter_installer_win.cc", "component_updater/sw_reporter_installer_win.h", + "device_reauth/win/biometric_authenticator_win.cc", + "device_reauth/win/biometric_authenticator_win.h", "download/download_status_updater_win.cc", "download/trusted_sources_manager_win.cc", "enterprise/signals/device_info_fetcher_win.cc", @@ -6244,6 +6241,15 @@ deps += [ "//chrome/browser/privacy:traffic_annotation_proto" ] } + if (is_android || is_mac || is_win) { + sources += [ + "device_reauth/chrome_biometric_authenticator_common.cc", + "device_reauth/chrome_biometric_authenticator_common.h", + "device_reauth/chrome_biometric_authenticator_factory.cc", + "device_reauth/chrome_biometric_authenticator_factory.h", + ] + } + if (is_mac || is_win) { # Support for the recovery improved component. sources += [
diff --git a/chrome/browser/ash/BUILD.gn b/chrome/browser/ash/BUILD.gn index 1a990dd..5129b3c 100644 --- a/chrome/browser/ash/BUILD.gn +++ b/chrome/browser/ash/BUILD.gn
@@ -1872,6 +1872,7 @@ "//chromeos/components/cdm_factory_daemon:cdm_factory_daemon_browser", "//chromeos/components/disks:prefs", "//chromeos/components/mojo_bootstrap", + "//chromeos/components/mojo_service_manager", "//chromeos/components/sensors", "//chromeos/constants", "//chromeos/dbus/dlcservice:dlcservice_proto", @@ -2027,6 +2028,8 @@ "//ui/wm", ] + data_deps = [ ":mojo_service_manager_policy" ] + if (is_cfm) { deps += [ "//chromeos/ash/components/chromebox_for_meetings", @@ -2039,6 +2042,11 @@ } } +copy("mojo_service_manager_policy") { + sources = [ "net/network_health/network_health_service_policy.json" ] + outputs = [ "$root_out_dir/mojo_service_manager/{{source_file_part}}" ] +} + static_library("arc_test_support") { testonly = true
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key_result.cc b/chrome/browser/ash/attestation/tpm_challenge_key_result.cc index 5a882fb4..bded151 100644 --- a/chrome/browser/ash/attestation/tpm_challenge_key_result.cc +++ b/chrome/browser/ash/attestation/tpm_challenge_key_result.cc
@@ -68,6 +68,9 @@ "OS platform service internal error."; const char TpmChallengeKeyResult::kUploadCertificateFailedErrorMsg[] = "Failed to upload machine certificate."; +const char TpmChallengeKeyResult::kDeviceTrustURLConflictError[] = + "Both policies DeviceContextAwareAccessSignalsAllowlist and " + "DeviceWebBasedAttestationAllowedUrls are enabled for this URL."; // static TpmChallengeKeyResult TpmChallengeKeyResult::MakeChallengeResponse( @@ -148,6 +151,8 @@ return kAttestationServiceInternalErrorMsg; case TpmChallengeKeyResultCode::kUploadCertificateFailedError: return kUploadCertificateFailedErrorMsg; + case TpmChallengeKeyResultCode::kDeviceTrustURLConflictError: + return kDeviceTrustURLConflictError; case TpmChallengeKeyResultCode::kSuccess: // Not an error message. NOTREACHED();
diff --git a/chrome/browser/ash/attestation/tpm_challenge_key_result.h b/chrome/browser/ash/attestation/tpm_challenge_key_result.h index bb92b22..4603efae 100644 --- a/chrome/browser/ash/attestation/tpm_challenge_key_result.h +++ b/chrome/browser/ash/attestation/tpm_challenge_key_result.h
@@ -37,7 +37,8 @@ kMarkCorporateKeyFailedError = 19, kAttestationServiceInternalError = 20, kUploadCertificateFailedError = 21, - kMaxValue = kUploadCertificateFailedError, + kDeviceTrustURLConflictError = 22, + kMaxValue = kDeviceTrustURLConflictError, }; // If |IsSuccess| returns false, |result_code| contains error code and @@ -68,6 +69,7 @@ static const char kMarkCorporateKeyFailedErrorMsg[]; static const char kAttestationServiceInternalErrorMsg[]; static const char kUploadCertificateFailedErrorMsg[]; + static const char kDeviceTrustURLConflictError[]; static TpmChallengeKeyResult MakeChallengeResponse( const std::string& challenge_response);
diff --git a/chrome/browser/ash/file_manager/file_tasks.cc b/chrome/browser/ash/file_manager/file_tasks.cc index 236d65c..a4ed8f8 100644 --- a/chrome/browser/ash/file_manager/file_tasks.cc +++ b/chrome/browser/ash/file_manager/file_tasks.cc
@@ -651,7 +651,7 @@ if (IsFilesAppId(task.app_id) && (parsed_action_id == "upload-office-to-drive")) { const bool opened = - chromeos::cloud_upload::CloudUploadDialog::Show(file_urls); + chromeos::cloud_upload::CloudUploadDialog::Show(profile, file_urls); if (done) { if (opened) { std::move(done).Run(
diff --git a/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc b/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc index ef76f2c..ffea3daa 100644 --- a/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc +++ b/chrome/browser/ash/kerberos/kerberos_credentials_manager.cc
@@ -462,7 +462,10 @@ auto it = std::find_if( add_account_runners_.begin(), add_account_runners_.end(), [runner](const auto& runner_ptr) { return runner_ptr.get() == runner; }); - DCHECK(it != add_account_runners_.end()); + + // Semantically, this `CHECK()` should never trigger. However, it protects + // the `erase()` call from semantically incorrect changes to this class. + CHECK(it != add_account_runners_.end()); add_account_runners_.erase(it); LogError("AddAccountAndAuthenticate", error);
diff --git a/chrome/browser/ash/kerberos/kerberos_credentials_manager.h b/chrome/browser/ash/kerberos/kerberos_credentials_manager.h index 7eed03b..ee14d20 100644 --- a/chrome/browser/ash/kerberos/kerberos_credentials_manager.h +++ b/chrome/browser/ash/kerberos/kerberos_credentials_manager.h
@@ -17,7 +17,7 @@ #include "chrome/browser/ash/authpolicy/kerberos_files_handler.h" #include "chromeos/ash/components/dbus/kerberos/kerberos_service.pb.h" #include "third_party/abseil-cpp/absl/types/optional.h" -// TODO(https://crbug.com/1164001): forward declare when moved ash +// TODO(https://crbug.com/1164001): forward declare when moved ash. #include "chromeos/components/onc/variable_expander.h" #include "components/keyed_service/core/keyed_service.h" #include "components/policy/core/common/policy_namespace.h"
diff --git a/chrome/browser/ash/login/saml/fake_saml_idp_mixin.cc b/chrome/browser/ash/login/saml/fake_saml_idp_mixin.cc index aed38e66..ab74f03 100644 --- a/chrome/browser/ash/login/saml/fake_saml_idp_mixin.cc +++ b/chrome/browser/ash/login/saml/fake_saml_idp_mixin.cc
@@ -40,8 +40,12 @@ constexpr char kSamlLoginAuthPath[] = "SAMLAuth"; constexpr char kSamlLoginWithDeviceAttestationPath[] = "SAML-with-device-attestation"; +constexpr char kSamlLoginWithDeviceTrustPath[] = "SAML-with-device-trust"; constexpr char kSamlLoginCheckDeviceAnswerPath[] = "SAML-check-device-answer"; +// Must be equal to SAML_VERIFIED_ACCESS_RESPONSE_HEADER from +// chrome/browser/enterprise/connectors/device_trust/navigation_throttle.cc. +constexpr char kDeviceTrustHeader[] = "x-device-trust"; // Must be equal to SAML_VERIFIED_ACCESS_CHALLENGE_HEADER from saml_handler.js. constexpr char kSamlVerifiedAccessChallengeHeader[] = "x-verified-access-challenge"; @@ -162,6 +166,10 @@ base::Base64Encode(saml_response_, &saml_response_); } +bool FakeSamlIdpMixin::DeviceTrustHeaderRecieved() const { + return device_trust_header_recieved_; +} + bool FakeSamlIdpMixin::IsLastChallengeResponseExists() const { return challenge_response_.has_value(); } @@ -191,6 +199,11 @@ kIdPHost, std::string("/") + kSamlLoginWithDeviceAttestationPath); } +GURL FakeSamlIdpMixin::GetSamlWithDeviceTrustUrl() const { + return saml_server_.GetURL(kIdPHost, + std::string("/") + kSamlLoginWithDeviceTrustPath); +} + GURL FakeSamlIdpMixin::GetSamlAuthPageUrl() const { return saml_server_.GetURL(kIdPHost, std::string("/") + kSamlLoginAuthPath); } @@ -230,6 +243,8 @@ return BuildResponseForLoginAuth(request, request_url); case RequestType::kLoginWithDeviceAttestation: return BuildResponseForLoginWithDeviceAttestation(request, request_url); + case RequestType::kLoginWithDeviceTrust: + return BuildResponseForLoginWithDeviceTrust(request, request_url); case RequestType::kLoginCheckDeviceAnswer: return BuildResponseForCheckDeviceAnswer(request, request_url); case RequestType::kUnknown: @@ -248,6 +263,8 @@ return RequestType::kLoginAuth; if (request_path == GetSamlWithDeviceAttestationUrl().path()) return RequestType::kLoginWithDeviceAttestation; + if (request_path == GetSamlWithDeviceTrustUrl().path()) + return RequestType::kLoginWithDeviceTrust; if (request_path == GetSamlWithCheckDeviceAnswerUrl().path()) return RequestType::kLoginCheckDeviceAnswer; @@ -306,6 +323,24 @@ } std::unique_ptr<HttpResponse> +FakeSamlIdpMixin::BuildResponseForLoginWithDeviceTrust( + const HttpRequest& request, + const GURL& request_url) { + std::string relay_state = GetRelayState(request); + + device_trust_header_recieved_ = + base::Contains(request.headers, kDeviceTrustHeader); + + GURL redirect_url = + net::AppendQueryParameter(GetSamlPageUrl(), kRelayState, relay_state); + + auto http_response = std::make_unique<BasicHttpResponse>(); + http_response->set_code(net::HTTP_TEMPORARY_REDIRECT); + http_response->AddCustomHeader("Location", redirect_url.spec()); + return http_response; +} + +std::unique_ptr<HttpResponse> FakeSamlIdpMixin::BuildResponseForCheckDeviceAnswer(const HttpRequest& request, const GURL& request_url) { std::string relay_state = GetRelayState(request);
diff --git a/chrome/browser/ash/login/saml/fake_saml_idp_mixin.h b/chrome/browser/ash/login/saml/fake_saml_idp_mixin.h index bb9396b..73b3bfd 100644 --- a/chrome/browser/ash/login/saml/fake_saml_idp_mixin.h +++ b/chrome/browser/ash/login/saml/fake_saml_idp_mixin.h
@@ -41,6 +41,7 @@ void SetCookieValue(const std::string& cookie_value); void SetRequireHttpBasicAuth(bool require_http_basic_auth); void SetSamlResponseFile(const std::string& xml_file); + bool DeviceTrustHeaderRecieved() const; bool IsLastChallengeResponseExists() const; void AssertChallengeResponseMatchesTpmResponse() const; @@ -49,6 +50,7 @@ GURL GetSamlPageUrl() const; GURL GetHttpSamlPageUrl() const; GURL GetSamlWithDeviceAttestationUrl() const; + GURL GetSamlWithDeviceTrustUrl() const; private: GURL GetSamlAuthPageUrl() const; @@ -63,7 +65,8 @@ kLogin, kLoginAuth, kLoginWithDeviceAttestation, - kLoginCheckDeviceAnswer + kLoginCheckDeviceAnswer, + kLoginWithDeviceTrust }; // Returns the RequestType that corresponds to `url`, or RequestType::Unknown @@ -81,6 +84,10 @@ const net::test_server::HttpRequest& request, const GURL& request_url) const; std::unique_ptr<net::test_server::HttpResponse> + BuildResponseForLoginWithDeviceTrust( + const net::test_server::HttpRequest& request, + const GURL& request_url); + std::unique_ptr<net::test_server::HttpResponse> BuildResponseForCheckDeviceAnswer( const net::test_server::HttpRequest& request, const GURL& request_url); @@ -107,6 +114,7 @@ bool require_http_basic_auth_ = false; + bool device_trust_header_recieved_ = false; absl::optional<std::string> challenge_response_; };
diff --git a/chrome/browser/ash/login/saml/saml_browsertest.cc b/chrome/browser/ash/login/saml/saml_browsertest.cc index c4ebc37a..ae033c3b 100644 --- a/chrome/browser/ash/login/saml/saml_browsertest.cc +++ b/chrome/browser/ash/login/saml/saml_browsertest.cc
@@ -55,6 +55,8 @@ #include "chrome/browser/ash/settings/scoped_testing_cros_settings.h" #include "chrome/browser/ash/settings/stub_cros_settings_provider.h" #include "chrome/browser/content_settings/host_content_settings_map_factory.h" +#include "chrome/browser/enterprise/connectors/connectors_prefs.h" +#include "chrome/browser/enterprise/connectors/device_trust/device_trust_features.h" #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -294,6 +296,9 @@ fake_gaia_.fake_gaia()->RegisterSamlUser( saml_test_users::kFifthUserExampleTestEmail, fake_saml_idp()->GetSamlPageUrl()); + fake_gaia_.fake_gaia()->RegisterSamlUser( + saml_test_users::kSixthUserCorpExampleTestEmail, + fake_saml_idp()->GetSamlWithDeviceTrustUrl()); fake_gaia_.fake_gaia()->SetFakeMergeSessionParams( saml_test_users::kFirstUserCorpExampleComEmail, kTestAuthSIDCookie1, @@ -1963,11 +1968,16 @@ void SetUpInProcessBrowserTestFixture() override; protected: - void SetAllowedUrlsPolicy(const std::vector<std::string>& allowed_urls); + virtual void SetAllowedUrlsPolicy( + const std::vector<std::string>& allowed_urls); + void SetDeviceContextAwareAccessSignalsAllowlistPolicy( + const std::vector<std::string>& allowed_urls); ScopedTestingCrosSettings settings_helper_; StubCrosSettingsProvider* settings_provider_ = nullptr; + policy::DevicePolicyCrosTestHelper policy_helper_; + attestation::MockMachineCertificateUploader mock_cert_uploader_; NiceMock<attestation::MockAttestationFlow> mock_attestation_flow_; ScopedStubInstallAttributes stub_install_attributes_; @@ -2002,6 +2012,21 @@ base::Value(std::move(allowed_urls_values))); } +void SAMLDeviceAttestationTest:: + SetDeviceContextAwareAccessSignalsAllowlistPolicy( + const std::vector<std::string>& allowed_urls) { + em::StringListPolicyProto* allowed_urls_proto = + policy_helper_.device_policy() + ->payload() + .mutable_device_login_screen_context_aware_access_signals_allowlist(); + allowed_urls_proto->mutable_policy_options()->set_mode( + em::PolicyOptions::MANDATORY); + for (const auto& url : allowed_urls) { + allowed_urls_proto->mutable_value()->add_entries(url.c_str()); + } + policy_helper_.RefreshDevicePolicy(); +} + class SAMLDeviceAttestationEnrolledTest : public SAMLDeviceAttestationTest { public: SAMLDeviceAttestationEnrolledTest() { @@ -2141,6 +2166,24 @@ fake_saml_idp()->AssertChallengeResponseMatchesTpmResponse()); } +// Verify that device attestation is not available for URLs that also match the +// ones on the DeviceContextAwareAccessSignalsAllowlist +IN_PROC_BROWSER_TEST_P(SAMLDeviceAttestationEnrolledTest, PolicyCASMatchError) { + SetAllowedUrlsPolicy({fake_saml_idp()->GetIdpHost()}); + SetDeviceContextAwareAccessSignalsAllowlistPolicy( + {fake_saml_idp()->GetIdpHost()}); + settings_provider_->SetBoolean(kDeviceAttestationEnabled, true); + + StartSamlAndWaitForIdpPageLoad( + saml_test_users::kFourthUserCorpExampleTestEmail); + + if (Test::HasFailure()) { + return; + } + + ASSERT_FALSE(fake_saml_idp()->IsLastChallengeResponseExists()); +} + IN_PROC_BROWSER_TEST_P(SAMLDeviceAttestationEnrolledTest, TimeoutError) { SetAllowedUrlsPolicy({"example2.com", fake_saml_idp()->GetIdpHost()}); settings_provider_->SetBoolean(kDeviceAttestationEnabled, true); @@ -2167,6 +2210,42 @@ ASSERT_FALSE(fake_saml_idp()->IsLastChallengeResponseExists()); } +class SAMLDeviceTrustTest : public SAMLDeviceAttestationTest { + public: + SAMLDeviceTrustTest() { + device_state_.SetState( + DeviceStateMixin::State::OOBE_COMPLETED_CLOUD_ENROLLED); + scoped_feature_list_.InitAndEnableFeature( + enterprise_connectors::kDeviceTrustConnectorEnabled); + } + + void SetUpInProcessBrowserTestFixture() override { + SAMLDeviceAttestationTest::SetUpInProcessBrowserTestFixture(); + stub_install_attributes_.Get()->SetCloudManaged("google.com", "device_id"); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +// Verify that Device Trust sends the header for a matching URL. +IN_PROC_BROWSER_TEST_P(SAMLDeviceTrustTest, SendHeaderForMatchingURL) { + SetDeviceContextAwareAccessSignalsAllowlistPolicy( + {fake_saml_idp()->GetIdpHost()}); + settings_provider_->SetBoolean(kDeviceAttestationEnabled, true); + + StartSamlAndWaitForIdpPageLoad( + saml_test_users::kSixthUserCorpExampleTestEmail); + + if (Test::HasFailure()) { + return; + } + + ASSERT_TRUE(fake_saml_idp()->DeviceTrustHeaderRecieved()); +} + +INSTANTIATE_TEST_SUITE_P(All, SAMLDeviceTrustTest, testing::Bool()); + INSTANTIATE_TEST_SUITE_P(All, SAMLDeviceAttestationEnrolledTest, testing::Bool());
diff --git a/chrome/browser/ash/login/users/chrome_user_manager_impl.cc b/chrome/browser/ash/login/users/chrome_user_manager_impl.cc index 8478e04f..49bebf5 100644 --- a/chrome/browser/ash/login/users/chrome_user_manager_impl.cc +++ b/chrome/browser/ash/login/users/chrome_user_manager_impl.cc
@@ -67,7 +67,6 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.h" #include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/extensions/permissions_updater.h" #include "chrome/browser/policy/networking/policy_cert_service_factory.h" @@ -170,15 +169,6 @@ return true; } -// Sets the necessary delegates in Public Session. They will be active for the -// whole user-session and they will go away together with the browser process -// during logout (the browser process is destroyed during logout), ie. they are -// not freed and they leak but that is fine. -void SetPublicAccountDelegates() { - extensions::ExtensionTabUtil::SetPlatformDelegate( - std::make_unique<extensions::ExtensionTabUtilDelegateChromeOS>()); -} - policy::MinimumVersionPolicyHandler* GetMinimumVersionPolicyHandler() { return g_browser_process->platform_part() ->browser_policy_connector_ash() @@ -283,11 +273,6 @@ return std::unique_ptr<ChromeUserManager>(new ChromeUserManagerImpl()); } -// static -void ChromeUserManagerImpl::ResetPublicAccountDelegatesForTesting() { - extensions::ExtensionTabUtil::SetPlatformDelegate(nullptr); -} - ChromeUserManagerImpl::ChromeUserManagerImpl() : ChromeUserManager(base::ThreadTaskRunnerHandle::IsSet() ? base::ThreadTaskRunnerHandle::Get() @@ -864,8 +849,6 @@ // controlled wallpaper was fetched/cleared but not updated in the login // screen, we need to update the wallpaper after the public user logged in. WallpaperControllerClientImpl::Get()->ShowUserWallpaper(user->GetAccountId()); - - SetPublicAccountDelegates(); } void ChromeUserManagerImpl::KioskAppLoggedIn(user_manager::User* user) {
diff --git a/chrome/browser/ash/login/users/chrome_user_manager_impl.h b/chrome/browser/ash/login/users/chrome_user_manager_impl.h index 5d5909c..473831c 100644 --- a/chrome/browser/ash/login/users/chrome_user_manager_impl.h +++ b/chrome/browser/ash/login/users/chrome_user_manager_impl.h
@@ -72,9 +72,6 @@ // Registers user manager preferences. static void RegisterPrefs(PrefRegistrySimple* registry); - // Resets platform specific delegates that were set for public accounts. - static void ResetPublicAccountDelegatesForTesting(); - // UserManagerInterface implementation: MultiProfileUserController* GetMultiProfileUserController() override; UserImageManager* GetUserImageManager(const AccountId& account_id) override;
diff --git a/chrome/browser/ash/login/users/test_users.cc b/chrome/browser/ash/login/users/test_users.cc index a7dcd81..b6d49b2 100644 --- a/chrome/browser/ash/login/users/test_users.cc +++ b/chrome/browser/ash/login/users/test_users.cc
@@ -12,6 +12,7 @@ const char kThirdUserCorpExampleComEmail[] = "carol@corp.example.com"; const char kFourthUserCorpExampleTestEmail[] = "dan@corp.example.test"; const char kFifthUserExampleTestEmail[] = "eve@example.test"; +const char kSixthUserCorpExampleTestEmail[] = "fatima@example.test"; } // namespace saml_test_users } // namespace ash
diff --git a/chrome/browser/ash/login/users/test_users.h b/chrome/browser/ash/login/users/test_users.h index 81df3904..63f249766 100644 --- a/chrome/browser/ash/login/users/test_users.h +++ b/chrome/browser/ash/login/users/test_users.h
@@ -17,6 +17,7 @@ extern const char kThirdUserCorpExampleComEmail[]; extern const char kFourthUserCorpExampleTestEmail[]; extern const char kFifthUserExampleTestEmail[]; +extern const char kSixthUserCorpExampleTestEmail[]; } // namespace saml_test_users } // namespace ash
diff --git a/chrome/browser/ash/net/network_diagnostics/network_diagnostics.cc b/chrome/browser/ash/net/network_diagnostics/network_diagnostics.cc index a9cc0bf..677d430 100644 --- a/chrome/browser/ash/net/network_diagnostics/network_diagnostics.cc +++ b/chrome/browser/ash/net/network_diagnostics/network_diagnostics.cc
@@ -24,8 +24,10 @@ #include "chrome/browser/ash/net/network_diagnostics/signal_strength_routine.h" #include "chrome/browser/ash/net/network_diagnostics/video_conferencing_routine.h" #include "chromeos/ash/components/dbus/debug_daemon/debug_daemon_client.h" +#include "chromeos/components/mojo_service_manager/connection.h" #include "components/device_event_log/device_event_log.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/cros_system_api/mojo/service_constants.h" namespace ash { namespace network_diagnostics { @@ -38,6 +40,11 @@ if (debug_daemon_client) { debug_daemon_client_ = debug_daemon_client; } + if (chromeos::mojo_service_manager::IsServiceManagerBound()) { + chromeos::mojo_service_manager::GetServiceManagerProxy()->Register( + chromeos::mojo_services::kChromiumNetworkDiagnosticsRoutines, + provider_receiver_.BindNewPipeAndPassRemote()); + } } NetworkDiagnostics::~NetworkDiagnostics() {} @@ -154,6 +161,13 @@ RunRoutine(std::move(routine), std::move(callback)); } +void NetworkDiagnostics::Request( + chromeos::mojo_service_manager::mojom::ProcessIdentityPtr identity, + mojo::ScopedMessagePipeHandle receiver) { + BindReceiver(mojo::PendingReceiver<mojom::NetworkDiagnosticsRoutines>( + std::move(receiver))); +} + void NetworkDiagnostics::RunRoutine( std::unique_ptr<NetworkDiagnosticsRoutine> routine, RoutineResultCallback callback) {
diff --git a/chrome/browser/ash/net/network_diagnostics/network_diagnostics.h b/chrome/browser/ash/net/network_diagnostics/network_diagnostics.h index 8a9d33e..30cb680 100644 --- a/chrome/browser/ash/net/network_diagnostics/network_diagnostics.h +++ b/chrome/browser/ash/net/network_diagnostics/network_diagnostics.h
@@ -10,6 +10,7 @@ #include "base/containers/flat_map.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/ash/net/network_diagnostics/network_diagnostics_routine.h" +#include "chromeos/components/mojo_service_manager/mojom/mojo_service_manager.mojom.h" #include "chromeos/services/network_health/public/mojom/network_diagnostics.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h" @@ -22,7 +23,8 @@ namespace network_diagnostics { class NetworkDiagnostics - : public chromeos::network_diagnostics::mojom::NetworkDiagnosticsRoutines { + : public chromeos::network_diagnostics::mojom::NetworkDiagnosticsRoutines, + public chromeos::mojo_service_manager::mojom::ServiceProvider { public: explicit NetworkDiagnostics(DebugDaemonClient* debug_daemon_client); NetworkDiagnostics(const NetworkDiagnostics&) = delete; @@ -58,6 +60,11 @@ void RunArcPing(RunArcPingCallback callback) override; private: + // chromeos::mojo_service_manager::mojom::ServiceProvider overrides. + void Request( + chromeos::mojo_service_manager::mojom::ProcessIdentityPtr identity, + mojo::ScopedMessagePipeHandle receiver) override; + void RunRoutine(std::unique_ptr<NetworkDiagnosticsRoutine> routine, RoutineResultCallback callback); void HandleResult( @@ -66,6 +73,9 @@ chromeos::network_diagnostics::mojom::RoutineResultPtr result); // An unowned pointer to the DebugDaemonClient instance. DebugDaemonClient* debug_daemon_client_; + // Receiver for mojo service manager service provider. + mojo::Receiver<chromeos::mojo_service_manager::mojom::ServiceProvider> + provider_receiver_{this}; // Receivers for external requests (WebUI, Feedback, CrosHealthdClient). mojo::ReceiverSet< chromeos::network_diagnostics::mojom::NetworkDiagnosticsRoutines>
diff --git a/chrome/browser/ash/net/network_health/network_health.cc b/chrome/browser/ash/net/network_health/network_health.cc index 670d9f92..ca3566f 100644 --- a/chrome/browser/ash/net/network_health/network_health.cc +++ b/chrome/browser/ash/net/network_health/network_health.cc
@@ -13,10 +13,12 @@ #include "base/time/time.h" #include "chrome/browser/ash/net/network_health/network_health_constants.h" #include "chromeos/ash/components/network/network_event_log.h" +#include "chromeos/components/mojo_service_manager/connection.h" #include "chromeos/services/network_config/in_process_instance.h" #include "chromeos/services/network_config/public/cpp/cros_network_config_util.h" #include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" #include "chromeos/services/network_health/public/mojom/network_health.mojom.h" +#include "third_party/cros_system_api/mojo/service_constants.h" namespace ash { namespace network_health { @@ -106,6 +108,11 @@ SetTimer(std::make_unique<base::RepeatingTimer>()); tracked_guids_timer_.Start(FROM_HERE, kUpdateTrackedGuidsInterval, this, &NetworkHealth::UpdateTrackedGuids); + if (chromeos::mojo_service_manager::IsServiceManagerBound()) { + chromeos::mojo_service_manager::GetServiceManagerProxy()->Register( + chromeos::mojo_services::kChromiumNetworkHealth, + provider_receiver_.BindNewPipeAndPassRemote()); + } } void NetworkHealth::SetTimer(std::unique_ptr<base::RepeatingTimer> timer) { @@ -121,6 +128,13 @@ receivers_.Add(this, std::move(receiver)); } +void NetworkHealth::Request( + chromeos::mojo_service_manager::mojom::ProcessIdentityPtr identity, + mojo::ScopedMessagePipeHandle receiver) { + BindReceiver( + mojo::PendingReceiver<mojom::NetworkHealthService>(std::move(receiver))); +} + const mojom::NetworkHealthState& NetworkHealth::GetNetworkHealthState() { NET_LOG(EVENT) << "Network Health State Requested"; return network_health_state_;
diff --git a/chrome/browser/ash/net/network_health/network_health.h b/chrome/browser/ash/net/network_health/network_health.h index 6e29f48d..da380071 100644 --- a/chrome/browser/ash/net/network_health/network_health.h +++ b/chrome/browser/ash/net/network_health/network_health.h
@@ -11,6 +11,7 @@ #include "base/timer/timer.h" #include "chrome/browser/ash/net/network_health/signal_strength_tracker.h" +#include "chromeos/components/mojo_service_manager/mojom/mojo_service_manager.mojom.h" #include "chromeos/services/network_config/public/cpp/cros_network_config_observer.h" #include "chromeos/services/network_health/public/mojom/network_health.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" @@ -24,7 +25,8 @@ class NetworkHealth : public chromeos::network_health::mojom::NetworkHealthService, - public chromeos::network_config::CrosNetworkConfigObserver { + public chromeos::network_config::CrosNetworkConfigObserver, + public chromeos::mojo_service_manager::mojom::ServiceProvider { public: NetworkHealth(); @@ -71,6 +73,11 @@ void SetTimer(std::unique_ptr<base::RepeatingTimer> timer); private: + // chromeos::mojo_service_manager::mojom::ServiceProvider overrides. + void Request( + chromeos::mojo_service_manager::mojom::ProcessIdentityPtr identity, + mojo::ScopedMessagePipeHandle receiver) override; + // Handler for receiving the network state list. void OnNetworkStateListReceived( std::vector<chromeos::network_config::mojom::NetworkStatePropertiesPtr>); @@ -139,6 +146,9 @@ // Updates the timestamp for active networks. void UpdateTrackedGuids(); + // Receiver for mojo service manager service provider. + mojo::Receiver<chromeos::mojo_service_manager::mojom::ServiceProvider> + provider_receiver_{this}; // Remotes for tracking observers that will be notified of network events in // the mojom::NetworkEventsObserver interface. mojo::RemoteSet<chromeos::network_health::mojom::NetworkEventsObserver>
diff --git a/chrome/browser/ash/net/network_health/network_health_service_policy.json b/chrome/browser/ash/net/network_health/network_health_service_policy.json new file mode 100644 index 0000000..c66567c --- /dev/null +++ b/chrome/browser/ash/net/network_health/network_health_service_policy.json
@@ -0,0 +1,17 @@ +[ + { + // This is the selinux security context of ash chrome. + "identity": "u:r:cros_browser:s0", + "own": [ + "ChromiumNetworkDiagnosticsRoutines", + "ChromiumNetworkHealth" + ] + }, + { + "identity": "u:r:cros_healthd:s0", + "request": [ + "ChromiumNetworkDiagnosticsRoutines", + "ChromiumNetworkHealth" + ] + } +]
diff --git a/chrome/browser/ash/web_applications/camera_app/camera_app_survey_handler.cc b/chrome/browser/ash/web_applications/camera_app/camera_app_survey_handler.cc new file mode 100644 index 0000000..55e18d0 --- /dev/null +++ b/chrome/browser/ash/web_applications/camera_app/camera_app_survey_handler.cc
@@ -0,0 +1,57 @@ +// Copyright 2022 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. + +#include "chrome/browser/ash/web_applications/camera_app/camera_app_survey_handler.h" +#include "base/feature_list.h" +#include "base/logging.h" +#include "chrome/browser/ash/hats/hats_config.h" +#include "chrome/browser/profiles/profile_manager.h" + +using ash::HatsNotificationController; +using ash::kHatsCameraAppSurvey; + +CameraAppSurveyHandler::CameraAppSurveyHandler() = default; + +CameraAppSurveyHandler::~CameraAppSurveyHandler() = default; + +// static +CameraAppSurveyHandler* CameraAppSurveyHandler::GetInstance() { + return base::Singleton<CameraAppSurveyHandler>::get(); +} + +void CameraAppSurveyHandler::MaybeTriggerSurvey() { + Profile* profile = ProfileManager::GetActiveUserProfile(); + + if (has_triggered_) { + return; + } + + if (!base::FeatureList::IsEnabled(kHatsCameraAppSurvey.feature)) { + VLOG(1) << "Camera App survey feature is not enabled"; + return; + } + + if (!HatsNotificationController::ShouldShowSurveyToProfile( + profile, kHatsCameraAppSurvey)) { + VLOG(1) << "Camera App survey should not show"; + return; + } + + has_triggered_ = true; + base::SysInfo::GetHardwareInfo( + base::BindOnce(&CameraAppSurveyHandler::OnHardwareInfoFetched, + weak_ptr_factory_.GetWeakPtr())); +} + +void CameraAppSurveyHandler::OnHardwareInfoFetched( + base::SysInfo::HardwareInfo info) { + Profile* profile = ProfileManager::GetActiveUserProfile(); + base::flat_map<std::string, std::string> survey_specific_data = { + {"board", base::SysInfo::GetLsbReleaseBoard()}, {"model", info.model}}; + // TODO(b/237737023): Add CUJ information if we want to collect more signals. + + hats_notification_controller_ = + base::MakeRefCounted<ash::HatsNotificationController>( + profile, kHatsCameraAppSurvey, survey_specific_data); +}
diff --git a/chrome/browser/ash/web_applications/camera_app/camera_app_survey_handler.h b/chrome/browser/ash/web_applications/camera_app/camera_app_survey_handler.h new file mode 100644 index 0000000..5aa88b9 --- /dev/null +++ b/chrome/browser/ash/web_applications/camera_app/camera_app_survey_handler.h
@@ -0,0 +1,41 @@ +// Copyright 2022 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 CHROME_BROWSER_ASH_WEB_APPLICATIONS_CAMERA_APP_CAMERA_APP_SURVEY_HANDLER_H_ +#define CHROME_BROWSER_ASH_WEB_APPLICATIONS_CAMERA_APP_CAMERA_APP_SURVEY_HANDLER_H_ + +#include "base/memory/singleton.h" +#include "base/memory/weak_ptr.h" +#include "base/system/sys_info.h" +#include "chrome/browser/ash/hats/hats_notification_controller.h" +#include "chrome/browser/profiles/profile.h" + +// Used to show a Happiness Tracking Survey when the camera app sends a trigger +// event. +class CameraAppSurveyHandler { + public: + CameraAppSurveyHandler(); + + CameraAppSurveyHandler(const CameraAppSurveyHandler&) = delete; + CameraAppSurveyHandler& operator=(const CameraAppSurveyHandler&) = delete; + + ~CameraAppSurveyHandler(); + + static CameraAppSurveyHandler* GetInstance(); + + void MaybeTriggerSurvey(); + + void OnHardwareInfoFetched(base::SysInfo::HardwareInfo info); + + private: + friend struct base::DefaultSingletonTraits<CameraAppSurveyHandler>; + + scoped_refptr<ash::HatsNotificationController> hats_notification_controller_; + + bool has_triggered_ = false; + + base::WeakPtrFactory<CameraAppSurveyHandler> weak_ptr_factory_{this}; +}; + +#endif // CHROME_BROWSER_ASH_WEB_APPLICATIONS_CAMERA_APP_CAMERA_APP_SURVEY_HANDLER_H_
diff --git a/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.cc b/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.cc index b164b38..142c3581 100644 --- a/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.cc +++ b/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.cc
@@ -23,6 +23,7 @@ #include "chrome/browser/apps/app_service/launch_utils.h" #include "chrome/browser/ash/file_manager/path_util.h" #include "chrome/browser/ash/system_web_apps/system_web_app_manager.h" +#include "chrome/browser/ash/web_applications/camera_app/camera_app_survey_handler.h" #include "chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_constants.h" #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" @@ -176,6 +177,7 @@ ChromeCameraAppUIDelegate::ChromeCameraAppUIDelegate(content::WebUI* web_ui) : web_ui_(web_ui), + session_start_time_(base::Time::Now()), file_task_runner_(base::ThreadPool::CreateSequencedTaskRunner( {base::MayBlock(), base::TaskPriority::USER_VISIBLE})) { file_task_runner_->PostTask( @@ -308,6 +310,15 @@ std::move(callback_on_current_thread))); } +void ChromeCameraAppUIDelegate::MaybeTriggerSurvey() { + static constexpr base::TimeDelta kMinSurveyDuration = base::Seconds(15); + + if (base::Time::Now() - session_start_time_ < kMinSurveyDuration) { + return; + } + CameraAppSurveyHandler::GetInstance()->MaybeTriggerSurvey(); +} + base::FilePath ChromeCameraAppUIDelegate::GetFilePathByName( const std::string& name) { // Check to avoid directory traversal attack.
diff --git a/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.h b/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.h index 1d95325..562834b5 100644 --- a/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.h +++ b/chrome/browser/ash/web_applications/camera_app/chrome_camera_app_ui_delegate.h
@@ -10,6 +10,7 @@ #include "ash/webui/camera_app_ui/camera_app_ui_delegate.h" #include "base/callback.h" #include "base/files/file_path_watcher.h" +#include "base/time/time.h" #include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h" #include "content/public/browser/media_stream_request.h" #include "content/public/browser/web_ui.h" @@ -105,6 +106,7 @@ void MonitorFileDeletion( const std::string& name, base::OnceCallback<void(FileMonitorResult)> callback) override; + void MaybeTriggerSurvey() override; private: base::FilePath GetFilePathByName(const std::string& name); @@ -116,6 +118,8 @@ content::WebUI* web_ui_; // Owns |this|. + base::Time session_start_time_; + scoped_refptr<base::SequencedTaskRunner> file_task_runner_; // It should only be created, used and destroyed on |file_task_runner_|. std::unique_ptr<FileMonitor> file_monitor_;
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index eb0b4673..dcc583a 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -1961,6 +1961,8 @@ "../ash/wallpaper_handlers/wallpaper_handlers_metric_utils.h", "../ash/web_applications/calculator_app/calculator_app_utils.cc", "../ash/web_applications/calculator_app/calculator_app_utils.h", + "../ash/web_applications/camera_app/camera_app_survey_handler.cc", + "../ash/web_applications/camera_app/camera_app_survey_handler.h", "../ash/web_applications/camera_app/camera_app_untrusted_ui_config.cc", "../ash/web_applications/camera_app/camera_app_untrusted_ui_config.h", "../ash/web_applications/camera_app/camera_system_web_app_info.cc", @@ -2107,8 +2109,6 @@ "extensions/device_local_account_util.h", "extensions/dictionary_event_router.cc", "extensions/dictionary_event_router.h", - "extensions/extension_tab_util_delegate_chromeos.cc", - "extensions/extension_tab_util_delegate_chromeos.h", "extensions/extensions_permissions_tracker.cc", "extensions/extensions_permissions_tracker.h", "extensions/external_cache.cc", @@ -2131,8 +2131,6 @@ "extensions/install_limiter_factory.h", "extensions/media_player_event_router.cc", "extensions/media_player_event_router.h", - "extensions/public_session_permission_helper.cc", - "extensions/public_session_permission_helper.h", "extensions/signin_screen_extensions_external_loader.cc", "extensions/signin_screen_extensions_external_loader.h", "extensions/signin_screen_policy_provider.cc", @@ -3485,7 +3483,6 @@ "extensions/default_app_order_unittest.cc", "extensions/device_local_account_external_policy_loader_unittest.cc", "extensions/device_local_account_management_policy_provider_unittest.cc", - "extensions/extension_tab_util_delegate_chromeos_unittest.cc", "extensions/external_cache_impl_unittest.cc", "extensions/file_manager/device_event_router_unittest.cc", "extensions/file_manager/drivefs_event_router_unittest.cc", @@ -3501,7 +3498,6 @@ "extensions/login_screen/login/cleanup/print_jobs_cleanup_handler_unittest.cc", "extensions/login_screen/login/login_api_ash_unittest.cc", "extensions/login_screen/login_screen_ui/ui_handler_unittest.cc", - "extensions/public_session_permission_helper_unittest.cc", "extensions/signin_screen_policy_provider_unittest.cc", "fileapi/external_file_url_loader_factory_unittest.cc", "fileapi/external_file_url_util_unittest.cc",
diff --git a/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.cc b/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.cc deleted file mode 100644 index cc31f49..0000000 --- a/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.cc +++ /dev/null
@@ -1,33 +0,0 @@ -// Copyright 2017 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. - -#include "chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.h" - -#include <memory> -#include <string> - -#include "chrome/browser/chromeos/extensions/device_local_account_management_policy_provider.h" -#include "chrome/browser/profiles/profiles_state.h" -#include "chrome/common/extensions/api/tabs.h" -#include "url/gurl.h" - -namespace extensions { - -ExtensionTabUtilDelegateChromeOS::ExtensionTabUtilDelegateChromeOS() {} - -ExtensionTabUtilDelegateChromeOS::~ExtensionTabUtilDelegateChromeOS() {} - -ExtensionTabUtil::ScrubTabBehaviorType -ExtensionTabUtilDelegateChromeOS::GetScrubTabBehavior( - const Extension* extension) { - if (!profiles::ArePublicSessionRestrictionsEnabled() || - chromeos::DeviceLocalAccountManagementPolicyProvider::IsWhitelisted( - extension->id())) { - return ExtensionTabUtil::kDontScrubTab; - } - - return ExtensionTabUtil::kScrubTabUrlToOrigin; -} - -} // namespace extensions
diff --git a/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.h b/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.h deleted file mode 100644 index 763d8c1..0000000 --- a/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.h +++ /dev/null
@@ -1,36 +0,0 @@ -// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTENSION_TAB_UTIL_DELEGATE_CHROMEOS_H_ -#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTENSION_TAB_UTIL_DELEGATE_CHROMEOS_H_ - -#include "chrome/browser/extensions/extension_tab_util.h" - -namespace extensions { -class Extension; - -// In Public Sessions, apps and extensions are force-installed by admin policy -// so the user does not get a chance to review the permissions for these apps. -// This is not acceptable from a security standpoint, so we scrub the URL -// returned by chrome.tabs API down to the origin unless the extension ID is -// whitelisted. -class ExtensionTabUtilDelegateChromeOS : public ExtensionTabUtil::Delegate { - public: - ExtensionTabUtilDelegateChromeOS(); - - ExtensionTabUtilDelegateChromeOS(const ExtensionTabUtilDelegateChromeOS&) = - delete; - ExtensionTabUtilDelegateChromeOS& operator=( - const ExtensionTabUtilDelegateChromeOS&) = delete; - - ~ExtensionTabUtilDelegateChromeOS() override; - - // ExtensionTabUtil::Delegate - ExtensionTabUtil::ScrubTabBehaviorType GetScrubTabBehavior( - const Extension* extension) override; -}; - -} // namespace extensions - -#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_EXTENSION_TAB_UTIL_DELEGATE_CHROMEOS_H_
diff --git a/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos_unittest.cc b/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos_unittest.cc deleted file mode 100644 index 48867fc..0000000 --- a/chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos_unittest.cc +++ /dev/null
@@ -1,71 +0,0 @@ -// Copyright 2017 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. - -#include "chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.h" - -#include <string> - -#include "chromeos/login/login_state/login_state.h" -#include "chromeos/login/login_state/scoped_test_public_session_login_state.h" -#include "extensions/common/extension.h" -#include "extensions/common/extension_builder.h" -#include "extensions/common/value_builder.h" -#include "testing/gtest/include/gtest/gtest.h" - -namespace extensions { - -namespace { - -const char kWhitelistedId[] = "cbkkbcmdlboombapidmoeolnmdacpkch"; -// Use an extension ID that will never be whitelisted. -const char kNonWhitelistedId[] = "bogus"; - -scoped_refptr<const Extension> CreateExtension(const std::string& id) { - return ExtensionBuilder("test").SetID(id).Build(); -} - -} // namespace - -class ExtensionTabUtilDelegateChromeOSTest : public testing::Test { - protected: - ExtensionTabUtilDelegateChromeOS delegate_; -}; - -TEST_F(ExtensionTabUtilDelegateChromeOSTest, - NoFilteringOutsidePublicSessionForWhitelisted) { - ASSERT_FALSE(chromeos::LoginState::IsInitialized()); - - auto extension = CreateExtension(kWhitelistedId); - EXPECT_EQ(delegate_.GetScrubTabBehavior(extension.get()), - ExtensionTabUtil::kDontScrubTab); -} - -TEST_F(ExtensionTabUtilDelegateChromeOSTest, - NoFilteringOutsidePublicSessionForNonWhitelisted) { - ASSERT_FALSE(chromeos::LoginState::IsInitialized()); - - auto extension = CreateExtension(kNonWhitelistedId); - EXPECT_EQ(delegate_.GetScrubTabBehavior(extension.get()), - ExtensionTabUtil::kDontScrubTab); -} - -TEST_F(ExtensionTabUtilDelegateChromeOSTest, - NoFilteringInsidePublicSessionForWhitelisted) { - chromeos::ScopedTestPublicSessionLoginState state; - - auto extension = CreateExtension(kWhitelistedId); - EXPECT_EQ(delegate_.GetScrubTabBehavior(extension.get()), - ExtensionTabUtil::kDontScrubTab); -} - -TEST_F(ExtensionTabUtilDelegateChromeOSTest, - FilterInsidePublicSessionNonWhitelisted) { - chromeos::ScopedTestPublicSessionLoginState state; - - auto extension = CreateExtension(kNonWhitelistedId); - EXPECT_EQ(delegate_.GetScrubTabBehavior(extension.get()), - ExtensionTabUtil::kScrubTabUrlToOrigin); -} - -} // namespace extensions
diff --git a/chrome/browser/chromeos/extensions/public_session_permission_helper.cc b/chrome/browser/chromeos/extensions/public_session_permission_helper.cc deleted file mode 100644 index e652d974..0000000 --- a/chrome/browser/chromeos/extensions/public_session_permission_helper.cc +++ /dev/null
@@ -1,276 +0,0 @@ -// Copyright 2017 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. - -#include "chrome/browser/chromeos/extensions/public_session_permission_helper.h" - -#include <map> -#include <memory> -#include <utility> -#include <vector> - -#include "base/bind.h" -#include "base/callback_helpers.h" -#include "base/containers/unique_ptr_adapters.h" -#include "base/lazy_instance.h" -#include "chrome/browser/chromeos/extensions/device_local_account_util.h" -#include "chrome/browser/extensions/extension_install_prompt.h" -#include "chrome/browser/profiles/profiles_state.h" -#include "chrome/grit/generated_resources.h" -#include "content/public/browser/browser_thread.h" -#include "content/public/browser/web_contents.h" -#include "extensions/common/extension.h" -#include "extensions/common/extension_id.h" -#include "extensions/common/permissions/api_permission_set.h" -#include "extensions/common/permissions/manifest_permission_set.h" -#include "extensions/common/permissions/permission_message.h" -#include "extensions/common/permissions/permission_set.h" -#include "extensions/common/url_pattern_set.h" -#include "ui/base/l10n/l10n_util.h" - -using extensions::mojom::APIPermissionID; - -namespace extensions { -namespace permission_helper { - -namespace { - -std::unique_ptr<ExtensionInstallPrompt> CreateExtensionInstallPrompt( - content::WebContents* web_contents) { - return std::make_unique<ExtensionInstallPrompt>(web_contents); -} - -bool PermissionCheckNeeded(const Extension* extension) { - return !extensions::IsAllowlistedForPublicSession(extension->id()); -} - -// This class is the internal implementation of HandlePermissionRequest(). It -// contains the actual prompt showing and resolving logic, and it caches the -// user choices. -class PublicSessionPermissionHelper { - public: - PublicSessionPermissionHelper(); - PublicSessionPermissionHelper(PublicSessionPermissionHelper&& other); - - PublicSessionPermissionHelper(const PublicSessionPermissionHelper&) = delete; - PublicSessionPermissionHelper& operator=( - const PublicSessionPermissionHelper&) = delete; - - ~PublicSessionPermissionHelper(); - - bool HandlePermissionRequestImpl(const Extension& extension, - const PermissionIDSet& requested_permissions, - content::WebContents* web_contents, - RequestResolvedCallback callback, - PromptFactory prompt_factory); - - bool PermissionAllowedImpl(const Extension* extension, - APIPermissionID permission); - - private: - void ResolvePermissionPrompt( - const ExtensionInstallPrompt* prompt, - const PermissionIDSet& unprompted_permissions, - ExtensionInstallPrompt::DoneCallbackPayload payload); - - PermissionIDSet FilterAllowedPermissions(const PermissionIDSet& permissions); - - struct RequestCallback { - RequestCallback(RequestResolvedCallback callback, - const PermissionIDSet& permission_list); - RequestCallback(RequestCallback&& other); - RequestCallback& operator=(RequestCallback&& other); - ~RequestCallback(); - RequestResolvedCallback callback; - PermissionIDSet permission_list; - }; - using RequestCallbackList = std::vector<RequestCallback>; - - std::set<std::unique_ptr<ExtensionInstallPrompt>, base::UniquePtrComparator> - prompts_; - PermissionIDSet prompted_permission_set_; - PermissionIDSet allowed_permission_set_; - PermissionIDSet denied_permission_set_; - RequestCallbackList callbacks_; -}; - -PublicSessionPermissionHelper::PublicSessionPermissionHelper() {} - -PublicSessionPermissionHelper::PublicSessionPermissionHelper( - PublicSessionPermissionHelper&& other) = default; - -PublicSessionPermissionHelper::~PublicSessionPermissionHelper() {} - -bool PublicSessionPermissionHelper::HandlePermissionRequestImpl( - const Extension& extension, - const PermissionIDSet& requested_permissions, - content::WebContents* web_contents, - RequestResolvedCallback callback, - PromptFactory prompt_factory) { - DCHECK(profiles::ArePublicSessionRestrictionsEnabled()); - if (!PermissionCheckNeeded(&extension)) { - if (!callback.is_null()) - std::move(callback).Run(requested_permissions); - return true; - } - - PermissionIDSet unresolved_permissions = PermissionIDSet::Difference( - requested_permissions, allowed_permission_set_); - unresolved_permissions = PermissionIDSet::Difference( - unresolved_permissions, denied_permission_set_); - if (unresolved_permissions.empty()) { - // All requested permissions are already resolved. - if (!callback.is_null()) - std::move(callback).Run(FilterAllowedPermissions(requested_permissions)); - return true; - } - - // Since not all permissions are resolved yet, queue the callback to be called - // when all of them are resolved. - if (!callback.is_null()) - callbacks_.push_back( - RequestCallback(std::move(callback), requested_permissions)); - - PermissionIDSet unprompted_permissions = PermissionIDSet::Difference( - unresolved_permissions, prompted_permission_set_); - if (unprompted_permissions.empty()) { - // Some permissions aren't resolved yet, but they are currently being - // prompted for, so no need to show a prompt. - return false; - } - - // Some permissions need prompting, setup the prompt and show it. - APIPermissionSet new_apis; - for (const auto& permission : unprompted_permissions) { - prompted_permission_set_.insert(permission.id()); - new_apis.insert(permission.id()); - } - auto permission_set = std::make_unique<PermissionSet>( - std::move(new_apis), ManifestPermissionSet(), URLPatternSet(), - URLPatternSet()); - auto prompt = std::move(prompt_factory).Run(web_contents); - - auto permissions_prompt = std::make_unique<ExtensionInstallPrompt::Prompt>( - ExtensionInstallPrompt::PERMISSIONS_PROMPT); - - // This Unretained is safe because the lifetime of this object is until - // process exit. - prompt->ShowDialog( - base::BindOnce(&PublicSessionPermissionHelper::ResolvePermissionPrompt, - base::Unretained(this), prompt.get(), - std::move(unprompted_permissions)), - &extension, - nullptr, // Use the extension icon. - std::move(permissions_prompt), std::move(permission_set), - ExtensionInstallPrompt::GetDefaultShowDialogCallback()); - prompts_.insert(std::move(prompt)); - - return false; -} - -bool PublicSessionPermissionHelper::PermissionAllowedImpl( - const Extension* extension, - APIPermissionID permission) { - DCHECK(profiles::ArePublicSessionRestrictionsEnabled()); - return !PermissionCheckNeeded(extension) || - allowed_permission_set_.ContainsID(permission); -} - -void PublicSessionPermissionHelper::ResolvePermissionPrompt( - const ExtensionInstallPrompt* prompt, - const PermissionIDSet& unprompted_permissions, - ExtensionInstallPrompt::DoneCallbackPayload payload) { - PermissionIDSet& add_to_set = - payload.result == ExtensionInstallPrompt::Result::ACCEPTED - ? allowed_permission_set_ - : denied_permission_set_; - for (const auto& permission : unprompted_permissions) { - prompted_permission_set_.erase(permission.id()); - add_to_set.insert(permission.id()); - } - - // Here a list of callbacks to be invoked is created first from callbacks_, - // then those callbacks are invoked later because a callback can change - // callbacks_ while we're traversing them. - RequestCallbackList callbacks_to_invoke; - for (auto callback = callbacks_.begin(); callback != callbacks_.end(); ) { - if (prompted_permission_set_.ContainsAnyID(callback->permission_list)) { - // The request is still waiting on other permissions to be resolved - wait - // until all of them are resolved before calling the callback. - callback++; - continue; - } - callbacks_to_invoke.push_back(std::move(*callback)); - callback = callbacks_.erase(callback); - } - for (auto callback = callbacks_to_invoke.begin(); - callback != callbacks_to_invoke.end(); callback++) { - std::move(callback->callback) - .Run(FilterAllowedPermissions(callback->permission_list)); - } - - // Dispose of the prompt as it's not needed anymore. - auto iter = prompts_.find(prompt); - DCHECK(iter != prompts_.end()); - prompts_.erase(iter); -} - -PermissionIDSet PublicSessionPermissionHelper::FilterAllowedPermissions( - const PermissionIDSet& permissions) { - PermissionIDSet allowed_permissions; - for (auto iter = permissions.begin(); iter != permissions.end(); iter++) { - if (allowed_permission_set_.ContainsID(*iter)) { - allowed_permissions.insert(iter->id()); - } - } - return allowed_permissions; -} - -PublicSessionPermissionHelper::RequestCallback::RequestCallback( - RequestResolvedCallback callback, - const PermissionIDSet& permission_list) - : callback(std::move(callback)), permission_list(permission_list) {} - -PublicSessionPermissionHelper::RequestCallback::RequestCallback( - RequestCallback&& other) = default; - -PublicSessionPermissionHelper::RequestCallback& -PublicSessionPermissionHelper::RequestCallback::operator=( - RequestCallback&& other) = default; - -PublicSessionPermissionHelper::RequestCallback::~RequestCallback() = default; - -base::LazyInstance<std::map<ExtensionId, PublicSessionPermissionHelper>>::Leaky - g_helpers = LAZY_INSTANCE_INITIALIZER; - -} // namespace - -bool HandlePermissionRequest(const Extension& extension, - const PermissionIDSet& requested_permissions, - content::WebContents* web_contents, - RequestResolvedCallback callback, - PromptFactory prompt_factory) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - PromptFactory factory = prompt_factory.is_null() - ? base::BindOnce(&CreateExtensionInstallPrompt) - : std::move(prompt_factory); - return g_helpers.Get()[extension.id()].HandlePermissionRequestImpl( - extension, requested_permissions, web_contents, std::move(callback), - std::move(factory)); -} - -bool PermissionAllowed(const Extension* extension, APIPermissionID permission) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); - return g_helpers.Get()[extension->id()].PermissionAllowedImpl(extension, - permission); -} - -void ResetPermissionsForTesting() { - // Clear out the std::map between tests. Just setting g_helpers to - // LAZY_INSTANCE_INITIALIZER again causes a memory leak (because of the - // LazyInstance::Leaky). - g_helpers.Get().clear(); -} - -} // namespace permission_helper -} // namespace extensions
diff --git a/chrome/browser/chromeos/extensions/public_session_permission_helper.h b/chrome/browser/chromeos/extensions/public_session_permission_helper.h deleted file mode 100644 index f4960900..0000000 --- a/chrome/browser/chromeos/extensions/public_session_permission_helper.h +++ /dev/null
@@ -1,75 +0,0 @@ -// Copyright 2017 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 CHROME_BROWSER_CHROMEOS_EXTENSIONS_PUBLIC_SESSION_PERMISSION_HELPER_H_ -#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_PUBLIC_SESSION_PERMISSION_HELPER_H_ - -#include <memory> -#include <set> - -#include "base/callback_forward.h" -#include "extensions/common/mojom/api_permission_id.mojom-shared.h" -#include "extensions/common/permissions/api_permission.h" -#include "extensions/common/permissions/api_permission_set.h" - -class ExtensionInstallPrompt; - -namespace content { -class WebContents; -} - -namespace extensions { - -class Extension; - -namespace permission_helper { - -using RequestResolvedCallback = - base::OnceCallback<void(const PermissionIDSet&)>; -using PromptFactory = - base::OnceCallback<std::unique_ptr<ExtensionInstallPrompt>( - content::WebContents*)>; - -// In Public Sessions, extensions (and apps) are force-installed by admin policy -// so the user does not get a chance to review the permissions for these -// extensions. This is not acceptable from a security/privacy standpoint, so -// when an extension uses one of the sensitive APIs for the first time, we show -// the user a dialog where they can choose whether to allow the extension access -// to the API. -// -// This function sets up the prompt asking the user for additional -// permission(s), handles the result, caches it, and then runs the callback with -// the allowed permissions as the argument. It returns true if this -// permission(s) is already resolved, and false otherwise. -// -// The user will be prompted about a certain permission only once, and that -// choice will be cached and used in any subsequent requests that use the same -// permission. If a request comes for a permission that is currently being -// prompted, its callback will be queued up to be invoked when the prompt is -// resolved. -// -// Caller must ensure that web_contents is valid. Must be called on UI thread. -// -// Callback can be null (permission_helper::RequestResolvedCallback()), in which -// case it's not invoked but the permission prompt is still shown. -// -// Passing in a null prompt_factory (permission_helper::PromptFactory()) -// callback gets the default behaviour (ie. it is is used only for tests). -bool HandlePermissionRequest(const Extension& extension, - const PermissionIDSet& requested_permissions, - content::WebContents* web_contents, - RequestResolvedCallback callback, - PromptFactory prompt_factory); - -// Returns true if user granted this permission to the extension. -bool PermissionAllowed(const Extension* extension, - mojom::APIPermissionID permission); - -// Used to completely reset state in between tests. -void ResetPermissionsForTesting(); - -} // namespace permission_helper -} // namespace extensions - -#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_PUBLIC_SESSION_PERMISSION_HELPER_H_
diff --git a/chrome/browser/chromeos/extensions/public_session_permission_helper_unittest.cc b/chrome/browser/chromeos/extensions/public_session_permission_helper_unittest.cc deleted file mode 100644 index b4d1177..0000000 --- a/chrome/browser/chromeos/extensions/public_session_permission_helper_unittest.cc +++ /dev/null
@@ -1,331 +0,0 @@ -// Copyright 2017 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. - -#include "chrome/browser/chromeos/extensions/public_session_permission_helper.h" - -#include <memory> -#include <string> -#include <utility> -#include <vector> - -#include "base/bind.h" -#include "base/memory/ptr_util.h" -#include "base/memory/weak_ptr.h" -#include "base/run_loop.h" -#include "chrome/browser/extensions/extension_install_prompt.h" -#include "chrome/common/extensions/extension_test_util.h" -#include "chrome/test/base/chrome_render_view_host_test_harness.h" -#include "chromeos/login/login_state/scoped_test_public_session_login_state.h" -#include "content/public/browser/web_contents.h" -#include "extensions/browser/extension_dialog_auto_confirm.h" -#include "extensions/common/extension.h" -#include "extensions/common/manifest.h" -#include "extensions/common/permissions/api_permission.h" -#include "extensions/common/permissions/permission_set.h" -#include "testing/gtest/include/gtest/gtest.h" - -using extension_test_util::LoadManifestUnchecked; -using content::WebContents; -using extensions::APIPermission; -using extensions::Extension; -using extensions::Manifest; -using Result = ExtensionInstallPrompt::Result; -using DoneCallbackPayload = ExtensionInstallPrompt::DoneCallbackPayload; -using extensions::mojom::APIPermissionID; - -namespace extensions { -namespace permission_helper { -namespace { - -auto permission_a = APIPermissionID::kAudio; -auto permission_b = APIPermissionID::kBookmark; -bool did_show_dialog; - -const char kWhitelistedId[] = "cbkkbcmdlboombapidmoeolnmdacpkch"; -const char kNonWhitelistedId[] = "bogus"; - -scoped_refptr<Extension> LoadManifestHelper(const std::string& id) { - std::string error; - scoped_refptr<Extension> extension = - LoadManifestUnchecked("common/background_page", "manifest.json", - mojom::ManifestLocation::kInvalidLocation, - Extension::NO_FLAGS, id, &error); - EXPECT_TRUE(extension.get()) << error; - return extension; -} - -bool get_did_show_dialog_and_reset() { - bool tmp = did_show_dialog; - did_show_dialog = false; - return tmp; -} - -base::OnceCallback<void(const PermissionIDSet&)> BindQuitLoop( - base::RunLoop* loop) { - return base::BindOnce( - [](base::RunLoop* loop, const PermissionIDSet&) { loop->Quit(); }, loop); -} - -class ProgrammableInstallPrompt - : public ExtensionInstallPrompt, - public base::SupportsWeakPtr<ProgrammableInstallPrompt> { - public: - explicit ProgrammableInstallPrompt(WebContents* contents) - : ExtensionInstallPrompt(contents) {} - - ProgrammableInstallPrompt(const ProgrammableInstallPrompt&) = delete; - ProgrammableInstallPrompt& operator=(const ProgrammableInstallPrompt&) = - delete; - - ~ProgrammableInstallPrompt() override {} - - void ShowDialog( - DoneCallback done_callback, - const extensions::Extension* extension, - const SkBitmap* icon, - std::unique_ptr<Prompt> prompt, - std::unique_ptr<const extensions::PermissionSet> custom_permissions, - const ShowDialogCallback& show_dialog_callback) override { - done_callback_ = std::move(done_callback); - did_show_dialog = true; - } - - void Resolve(ExtensionInstallPrompt::DoneCallbackPayload payload) { - std::move(done_callback_).Run(payload); - } - - private: - ExtensionInstallPrompt::DoneCallback done_callback_; -}; - -} // namespace - -class PublicSessionPermissionHelperTest - : public ChromeRenderViewHostTestHarness { - public: - PublicSessionPermissionHelperTest() {} - - PublicSessionPermissionHelperTest(const PublicSessionPermissionHelperTest&) = - delete; - PublicSessionPermissionHelperTest& operator=( - const PublicSessionPermissionHelperTest&) = delete; - - ~PublicSessionPermissionHelperTest() override {} - - // testing::Test - void SetUp() override; - void TearDown() override; - - // Class helpers. - void RequestResolved(const PermissionIDSet& allowed_permissions); - std::unique_ptr<ExtensionInstallPrompt> ReturnPrompt( - std::unique_ptr<ExtensionInstallPrompt> prompt, - WebContents* web_contents); - base::WeakPtr<ProgrammableInstallPrompt> CallHandlePermissionRequest( - const scoped_refptr<Extension>& extension, - const PermissionIDSet& permissions); - - protected: - scoped_refptr<Extension> extension_a_; - scoped_refptr<Extension> extension_b_; - - std::vector<PermissionIDSet> allowed_permissions_; - - std::unique_ptr<chromeos::ScopedTestPublicSessionLoginState> login_state_; -}; - -void PublicSessionPermissionHelperTest::SetUp() { - ChromeRenderViewHostTestHarness::SetUp(); - login_state_ = - std::make_unique<chromeos::ScopedTestPublicSessionLoginState>(); - extension_a_ = LoadManifestHelper("extension_a"); - extension_b_ = LoadManifestHelper("extension_b"); -} - -void PublicSessionPermissionHelperTest::TearDown() { - login_state_.reset(); - ResetPermissionsForTesting(); - ChromeRenderViewHostTestHarness::TearDown(); -} - -void PublicSessionPermissionHelperTest::RequestResolved( - const PermissionIDSet& allowed_permissions) { - allowed_permissions_.push_back(allowed_permissions); -} - -std::unique_ptr<ExtensionInstallPrompt> -PublicSessionPermissionHelperTest::ReturnPrompt( - std::unique_ptr<ExtensionInstallPrompt> prompt, - WebContents* web_contents) { - return prompt; -} - -base::WeakPtr<ProgrammableInstallPrompt> -PublicSessionPermissionHelperTest::CallHandlePermissionRequest( - const scoped_refptr<Extension>& extension, - const PermissionIDSet& permissions) { - auto* prompt = new ProgrammableInstallPrompt(web_contents()); - auto prompt_weak_ptr = prompt->AsWeakPtr(); - auto factory_callback = base::BindOnce( - &PublicSessionPermissionHelperTest::ReturnPrompt, base::Unretained(this), - base::WrapUnique<ExtensionInstallPrompt>(prompt)); - HandlePermissionRequest( - *extension.get(), permissions, web_contents(), - base::BindOnce(&PublicSessionPermissionHelperTest::RequestResolved, - base::Unretained(this)), - std::move(factory_callback)); - // In case all permissions were already prompted, ReturnPrompt isn't called - // because of an early return in HandlePermissionRequest, and in that case the - // prompt is free'd as soon as HandlePermissionRequest returns (because it's - // owned by a unique_ptr). Using a weak ptr we can detect when this happens. - return prompt_weak_ptr; -} - -TEST_F(PublicSessionPermissionHelperTest, TestPermissionAllowed) { - // Allow permission_a for extension_a. - auto prompt = CallHandlePermissionRequest(extension_a_, {permission_a}); - EXPECT_TRUE(prompt); - EXPECT_TRUE(get_did_show_dialog_and_reset()); - prompt->Resolve(DoneCallbackPayload(Result::ACCEPTED)); - EXPECT_TRUE(allowed_permissions_.at(0).Equals({permission_a})); - - // permission_a was already allowed for extension_a hence no prompt is being - // shown, and the ProgrammableInstallPrompt that is passed in is already - // free'd after CallHandlePermissionRequest returns so the returned weak - // pointer should evaluate to false. - EXPECT_FALSE(CallHandlePermissionRequest(extension_a_, {permission_a})); - EXPECT_FALSE(get_did_show_dialog_and_reset()); - EXPECT_TRUE(allowed_permissions_.at(1).Equals({permission_a})); - - // permission_a was allowed only for extension_a. - prompt = CallHandlePermissionRequest(extension_b_, {permission_a}); - EXPECT_TRUE(prompt); - EXPECT_TRUE(get_did_show_dialog_and_reset()); - prompt->Resolve(DoneCallbackPayload(Result::USER_CANCELED)); - EXPECT_TRUE(allowed_permissions_.at(2).Equals({})); -} - -TEST_F(PublicSessionPermissionHelperTest, TestPermissionDenied) { - // Deny permission_a for extension_a. - auto prompt = CallHandlePermissionRequest(extension_a_, {permission_a}); - EXPECT_TRUE(prompt); - EXPECT_TRUE(get_did_show_dialog_and_reset()); - prompt->Resolve(DoneCallbackPayload(Result::USER_CANCELED)); - EXPECT_TRUE(allowed_permissions_.at(0).Equals({})); - - // Still denied (previous choice is remembered). - EXPECT_FALSE(CallHandlePermissionRequest(extension_a_, {permission_a})); - EXPECT_FALSE(get_did_show_dialog_and_reset()); - EXPECT_TRUE(allowed_permissions_.at(1).Equals({})); - - // permission_a was denied only for extension_a. - prompt = CallHandlePermissionRequest(extension_b_, {permission_a}); - EXPECT_TRUE(prompt); - EXPECT_TRUE(get_did_show_dialog_and_reset()); - prompt->Resolve(DoneCallbackPayload(Result::ACCEPTED)); - EXPECT_TRUE(allowed_permissions_.at(2).Equals({permission_a})); -} - -TEST_F(PublicSessionPermissionHelperTest, TestTwoPromptsA) { - // Open two permission prompts. - auto prompt1 = - CallHandlePermissionRequest(extension_a_, {permission_a, permission_b}); - EXPECT_TRUE(prompt1); - EXPECT_TRUE(get_did_show_dialog_and_reset()); - EXPECT_FALSE(CallHandlePermissionRequest(extension_a_, {permission_b})); - EXPECT_FALSE(get_did_show_dialog_and_reset()); - // prompt1 resolves both permission requests (second permission request - // doesn't show a prompt as permission_b is already prompted by first - // permission request). - prompt1->Resolve(DoneCallbackPayload(Result::ACCEPTED)); - EXPECT_TRUE(allowed_permissions_.at(0).Equals({permission_a, permission_b})); - EXPECT_TRUE(allowed_permissions_.at(1).Equals({permission_b})); -} - -TEST_F(PublicSessionPermissionHelperTest, TestTwoPromptsB) { - auto prompt1 = CallHandlePermissionRequest(extension_a_, {permission_a}); - EXPECT_TRUE(prompt1); - EXPECT_TRUE(get_did_show_dialog_and_reset()); - auto prompt2 = - CallHandlePermissionRequest(extension_a_, {permission_a, permission_b}); - EXPECT_TRUE(prompt2); - EXPECT_TRUE(get_did_show_dialog_and_reset()); - // prompt2 resolves only permission_b because prompt1 already prompted for - // permission_a. - prompt2->Resolve(DoneCallbackPayload(Result::ACCEPTED)); - EXPECT_EQ(allowed_permissions_.size(), 0u); - prompt1->Resolve(DoneCallbackPayload(Result::ACCEPTED)); - EXPECT_TRUE(allowed_permissions_.at(0).Equals({permission_a})); - EXPECT_TRUE(allowed_permissions_.at(1).Equals({permission_a, permission_b})); -} - -TEST_F(PublicSessionPermissionHelperTest, TestTwoPromptsDeny) { - auto prompt1 = CallHandlePermissionRequest(extension_a_, {permission_a}); - EXPECT_TRUE(prompt1); - EXPECT_TRUE(get_did_show_dialog_and_reset()); - auto prompt2 = - CallHandlePermissionRequest(extension_a_, {permission_a, permission_b}); - EXPECT_TRUE(prompt2); - EXPECT_TRUE(get_did_show_dialog_and_reset()); - prompt1->Resolve(DoneCallbackPayload(Result::USER_CANCELED)); - EXPECT_TRUE(allowed_permissions_.at(0).Equals({})); - prompt2->Resolve(DoneCallbackPayload(Result::ACCEPTED)); - EXPECT_TRUE(allowed_permissions_.at(1).Equals({permission_b})); -} - -TEST_F(PublicSessionPermissionHelperTest, WhitelistedExtension) { - auto extension = LoadManifestHelper(kWhitelistedId); - // Whitelisted extension can use any permission. - EXPECT_TRUE(PermissionAllowed(extension.get(), permission_a)); - EXPECT_TRUE(PermissionAllowed(extension.get(), permission_b)); - // Whitelisted extension is already handled (no permission prompt needed). - EXPECT_TRUE(HandlePermissionRequest(*extension, {permission_a}, - web_contents(), RequestResolvedCallback(), - PromptFactory())); - EXPECT_TRUE(PermissionAllowed(extension.get(), permission_a)); - EXPECT_TRUE(PermissionAllowed(extension.get(), permission_b)); -} - -TEST_F(PublicSessionPermissionHelperTest, NonWhitelistedExtension) { - auto extension = LoadManifestHelper(kNonWhitelistedId); - EXPECT_FALSE(PermissionAllowed(extension.get(), permission_a)); - EXPECT_FALSE(PermissionAllowed(extension.get(), permission_b)); - // Prompt for permission_a, grant it, verify. - { - ScopedTestDialogAutoConfirm auto_confirm( - ScopedTestDialogAutoConfirm::ACCEPT); - // Permission not handled yet, need to show a prompt. - base::RunLoop loop; - EXPECT_FALSE(HandlePermissionRequest(*extension, {permission_a}, - web_contents(), BindQuitLoop(&loop), - PromptFactory())); - loop.Run(); - EXPECT_TRUE(PermissionAllowed(extension.get(), permission_a)); - EXPECT_FALSE(PermissionAllowed(extension.get(), permission_b)); - } - // Already handled (allow), doesn't show a prompt. - EXPECT_TRUE(HandlePermissionRequest(*extension, {permission_a}, - web_contents(), RequestResolvedCallback(), - PromptFactory())); - // Prompt for permission_b, deny it, verify. - { - ScopedTestDialogAutoConfirm auto_confirm( - ScopedTestDialogAutoConfirm::CANCEL); - // Permission not handled yet, need to show a prompt. - base::RunLoop loop; - EXPECT_FALSE(HandlePermissionRequest(*extension, {permission_b}, - web_contents(), BindQuitLoop(&loop), - PromptFactory())); - loop.Run(); - EXPECT_TRUE(PermissionAllowed(extension.get(), permission_a)); - EXPECT_FALSE(PermissionAllowed(extension.get(), permission_b)); - } - // Already handled (deny), doesn't show a prompt. - EXPECT_TRUE(HandlePermissionRequest(*extension, {permission_b}, - web_contents(), RequestResolvedCallback(), - PromptFactory())); -} - -} // namespace permission_helper -} // namespace extensions
diff --git a/chrome/browser/commerce/shopping_service_factory.cc b/chrome/browser/commerce/shopping_service_factory.cc index afc83af..7afdf70 100644 --- a/chrome/browser/commerce/shopping_service_factory.cc +++ b/chrome/browser/commerce/shopping_service_factory.cc
@@ -10,11 +10,17 @@ #include "chrome/browser/persisted_state_db/session_proto_db_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/identity_manager_factory.h" +#include "components/commerce/content/browser/commerce_tab_helper.h" #include "components/commerce/core/proto/commerce_subscription_db_content.pb.h" #include "components/commerce/core/shopping_service.h" #include "components/prefs/pref_service.h" #include "content/public/browser/storage_partition.h" +#if !BUILDFLAG(IS_ANDROID) +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_finder.h" +#endif + namespace commerce { // static @@ -71,4 +77,26 @@ return true; } +KeyedService* ShoppingServiceFactory::SetTestingFactoryAndUse( + content::BrowserContext* context, + TestingFactory testing_factory) { + KeyedService* mock_shopping_service = + ProfileKeyedServiceFactory::SetTestingFactoryAndUse( + context, std::move(testing_factory)); +#if !BUILDFLAG(IS_ANDROID) + Profile* profile = Profile::FromBrowserContext(context); + Browser* browser = chrome::FindBrowserWithProfile(profile); + for (int i = 0; i < browser->tab_strip_model()->GetTabCount(); i++) { + CommerceTabHelper::FromWebContents( + browser->tab_strip_model()->GetWebContentsAt(i)) + ->SetShoppingServiceForTesting(mock_shopping_service); // IN-TEST + } +#else + // TODO(crbug.com/1356028): Update the ShoppingService in CommerceTabHelper. + NOTIMPLEMENTED() << "No implementation for Android yet."; +#endif + + return mock_shopping_service; +} + } // namespace commerce
diff --git a/chrome/browser/commerce/shopping_service_factory.h b/chrome/browser/commerce/shopping_service_factory.h index 74836f9..68fefee 100644 --- a/chrome/browser/commerce/shopping_service_factory.h +++ b/chrome/browser/commerce/shopping_service_factory.h
@@ -8,6 +8,10 @@ #include "base/no_destructor.h" #include "chrome/browser/profiles/profile_keyed_service_factory.h" +namespace content { +class BrowserContext; +} // namespace content + namespace commerce { class ShoppingService; @@ -24,6 +28,12 @@ static ShoppingService* GetForBrowserContextIfExists( content::BrowserContext* context); + // Associates |testing_factory| with |context| and immediately returns the + // created KeyedService. Since the factory will be used immediately, it may + // not be empty. + KeyedService* SetTestingFactoryAndUse(content::BrowserContext* context, + TestingFactory testing_factory); + private: friend class base::NoDestructor<ShoppingServiceFactory>;
diff --git a/chrome/browser/device_reauth/android/biometric_authenticator_android.cc b/chrome/browser/device_reauth/android/biometric_authenticator_android.cc index 35d7f8f3..b464004f 100644 --- a/chrome/browser/device_reauth/android/biometric_authenticator_android.cc +++ b/chrome/browser/device_reauth/android/biometric_authenticator_android.cc
@@ -142,7 +142,7 @@ void BiometricAuthenticatorAndroid::AuthenticateWithMessage( device_reauth::BiometricAuthRequester requester, - const std::u16string message, + const std::u16string& message, AuthenticateCallback callback) { NOTIMPLEMENTED(); }
diff --git a/chrome/browser/device_reauth/android/biometric_authenticator_android.h b/chrome/browser/device_reauth/android/biometric_authenticator_android.h index f74b431..6bb9261 100644 --- a/chrome/browser/device_reauth/android/biometric_authenticator_android.h +++ b/chrome/browser/device_reauth/android/biometric_authenticator_android.h
@@ -69,7 +69,7 @@ // screen lock as fallback. Displays `message` in the authentication UI. // Note: this only supports one authentication request at a time. void AuthenticateWithMessage(device_reauth::BiometricAuthRequester requester, - const std::u16string message, + const std::u16string& message, AuthenticateCallback callback) override; // Should be called by the object using the authenticator if the purpose
diff --git a/chrome/browser/device_reauth/chrome_biometric_authenticator_common_unittest.cc b/chrome/browser/device_reauth/chrome_biometric_authenticator_common_unittest.cc index 25a73ab..34a0c6b 100644 --- a/chrome/browser/device_reauth/chrome_biometric_authenticator_common_unittest.cc +++ b/chrome/browser/device_reauth/chrome_biometric_authenticator_common_unittest.cc
@@ -34,7 +34,7 @@ bool use_last_valid) override; void AuthenticateWithMessage(BiometricAuthRequester requester, - const std::u16string message, + const std::u16string& message, AuthenticateCallback callback) override; void Cancel(BiometricAuthRequester requester) override; @@ -68,7 +68,7 @@ void FakeChromeBiometricAuthenticatorCommon::AuthenticateWithMessage( device_reauth::BiometricAuthRequester requester, - const std::u16string message, + const std::u16string& message, AuthenticateCallback callback) { NOTIMPLEMENTED(); }
diff --git a/chrome/browser/device_reauth/chrome_biometric_authenticator_factory.cc b/chrome/browser/device_reauth/chrome_biometric_authenticator_factory.cc index 3c9d6a8..56e666a 100644 --- a/chrome/browser/device_reauth/chrome_biometric_authenticator_factory.cc +++ b/chrome/browser/device_reauth/chrome_biometric_authenticator_factory.cc
@@ -11,6 +11,8 @@ #include "chrome/browser/device_reauth/android/biometric_authenticator_bridge_impl.h" #elif BUILDFLAG(IS_MAC) #include "chrome/browser/device_reauth/mac/biometric_authenticator_mac.h" +#elif BUILDFLAG(IS_WIN) +#include "chrome/browser/device_reauth/win/biometric_authenticator_win.h" #endif // static @@ -31,15 +33,20 @@ ChromeBiometricAuthenticatorFactory::GetOrCreateBiometricAuthenticator() { if (!biometric_authenticator_) { #if BUILDFLAG(IS_ANDROID) - biometric_authenticator_ = - (new BiometricAuthenticatorAndroid( - std::make_unique<BiometricAuthenticatorBridgeImpl>())) - ->GetWeakPtr(); + auto biometric_authenticator = + base::WrapRefCounted(new BiometricAuthenticatorAndroid( + std::make_unique<BiometricAuthenticatorBridgeImpl>())); #elif BUILDFLAG(IS_MAC) - biometric_authenticator_ = (new BiometricAuthenticatorMac())->GetWeakPtr(); + auto biometric_authenticator = + base::WrapRefCounted(new BiometricAuthenticatorMac()); +#elif BUILDFLAG(IS_WIN) + auto biometric_authenticator = base::WrapRefCounted( + new BiometricAuthenticatorWin(std::make_unique<AuthenticatorWin>())); #else - NOTREACHED(); + static_assert(false); #endif + biometric_authenticator_ = biometric_authenticator->GetWeakPtr(); + return biometric_authenticator; } return base::WrapRefCounted(biometric_authenticator_.get());
diff --git a/chrome/browser/device_reauth/mac/biometric_authenticator_mac.h b/chrome/browser/device_reauth/mac/biometric_authenticator_mac.h index e4c5891b..e21e81c 100644 --- a/chrome/browser/device_reauth/mac/biometric_authenticator_mac.h +++ b/chrome/browser/device_reauth/mac/biometric_authenticator_mac.h
@@ -41,7 +41,7 @@ // be displayed there) using his touchId or if it's not setUp default one with // password will appear. void AuthenticateWithMessage(device_reauth::BiometricAuthRequester requester, - const std::u16string message, + const std::u16string& message, AuthenticateCallback callback) override; // Should be called by the object using the authenticator if the purpose
diff --git a/chrome/browser/device_reauth/mac/biometric_authenticator_mac.mm b/chrome/browser/device_reauth/mac/biometric_authenticator_mac.mm index 0e51f583..5c335b7 100644 --- a/chrome/browser/device_reauth/mac/biometric_authenticator_mac.mm +++ b/chrome/browser/device_reauth/mac/biometric_authenticator_mac.mm
@@ -33,7 +33,7 @@ void BiometricAuthenticatorMac::AuthenticateWithMessage( device_reauth::BiometricAuthRequester requester, - const std::u16string message, + const std::u16string& message, AuthenticateCallback callback) { if (!NeedsToAuthenticate()) { DCHECK(callback_.is_null());
diff --git a/chrome/browser/device_reauth/win/biometric_authenticator_win.cc b/chrome/browser/device_reauth/win/biometric_authenticator_win.cc new file mode 100644 index 0000000..b532f93 --- /dev/null +++ b/chrome/browser/device_reauth/win/biometric_authenticator_win.cc
@@ -0,0 +1,76 @@ +// Copyright 2022 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. + +#include "chrome/browser/device_reauth/win/biometric_authenticator_win.h" + +#include "base/bind.h" +#include "base/notreached.h" +#include "base/threading/sequenced_task_runner_handle.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_window.h" + +AuthenticatorWin::~AuthenticatorWin() = default; + +bool AuthenticatorWin::AuthenticateUser(const std::u16string& message) { + bool success = false; + Browser* browser = chrome::FindBrowserWithActiveWindow(); + if (!browser) { + success = false; + } else { + gfx::NativeWindow window = browser->window()->GetNativeWindow(); + success = password_manager_util_win::AuthenticateUser(window, message); + } + return success; +} + +BiometricAuthenticatorWin::BiometricAuthenticatorWin( + std::unique_ptr<AuthenticatorWinInterface> authenticator) + : authenticator_(std::move(authenticator)) {} + +BiometricAuthenticatorWin::~BiometricAuthenticatorWin() = default; + +// static +scoped_refptr<BiometricAuthenticatorWin> +BiometricAuthenticatorWin::CreateForTesting( + std::unique_ptr<AuthenticatorWinInterface> authenticator) { + return base::WrapRefCounted( + new BiometricAuthenticatorWin(std::move(authenticator))); +} + +bool BiometricAuthenticatorWin::CanAuthenticate( + device_reauth::BiometricAuthRequester requester) { + NOTIMPLEMENTED(); + return false; +} + +void BiometricAuthenticatorWin::Authenticate( + device_reauth::BiometricAuthRequester requester, + AuthenticateCallback callback, + bool use_last_valid_auth) { + NOTIMPLEMENTED(); +} + +void BiometricAuthenticatorWin::AuthenticateWithMessage( + device_reauth::BiometricAuthRequester requester, + const std::u16string& message, + AuthenticateCallback callback) { + if (!NeedsToAuthenticate()) { + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), /*success=*/true)); + return; + } + + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(std::move(callback), + RecordAuthenticationResult( + authenticator_->AuthenticateUser(message)))); +} + +void BiometricAuthenticatorWin::Cancel( + device_reauth::BiometricAuthRequester requester) { + // TODO(crbug.com/1354552): Add implementation of the Cancel method. + NOTIMPLEMENTED(); +}
diff --git a/chrome/browser/device_reauth/win/biometric_authenticator_win.h b/chrome/browser/device_reauth/win/biometric_authenticator_win.h new file mode 100644 index 0000000..b472dc19 --- /dev/null +++ b/chrome/browser/device_reauth/win/biometric_authenticator_win.h
@@ -0,0 +1,69 @@ +// Copyright 2022 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 CHROME_BROWSER_DEVICE_REAUTH_WIN_BIOMETRIC_AUTHENTICATOR_WIN_H_ +#define CHROME_BROWSER_DEVICE_REAUTH_WIN_BIOMETRIC_AUTHENTICATOR_WIN_H_ + +#include "chrome/browser/device_reauth/chrome_biometric_authenticator_common.h" +#include "chrome/browser/device_reauth/chrome_biometric_authenticator_factory.h" +#include "chrome/browser/password_manager/password_manager_util_win.h" +#include "components/device_reauth/biometric_authenticator.h" + +// Used for testing. +class AuthenticatorWinInterface { + public: + virtual ~AuthenticatorWinInterface() = default; + virtual bool AuthenticateUser(const std::u16string& message) = 0; +}; + +class AuthenticatorWin : public AuthenticatorWinInterface { + public: + ~AuthenticatorWin() override; + bool AuthenticateUser(const std::u16string& message) override; +}; + +class BiometricAuthenticatorWin : public ChromeBiometricAuthenticatorCommon { + public: + // Creates an instance of BiometricAuthenticatorWin for testing purposes + // only. + static scoped_refptr<BiometricAuthenticatorWin> CreateForTesting( + std::unique_ptr<AuthenticatorWinInterface> authenticator); + + // Returns true, when biometrics are available. + bool CanAuthenticate( + device_reauth::BiometricAuthRequester requester) override; + + // Trigges an authentication flow based on biometrics. + // Note: this only supports one authentication request at a time. + // |use_last_valid_auth| if set to false, ignores the grace 60 seconds + // period between the last valid authentication and the current + // authentication, and re-invokes system authentication. + void Authenticate(device_reauth::BiometricAuthRequester requester, + AuthenticateCallback callback, + bool use_last_valid_auth) override; + + // Trigges an authentication flow based on biometrics. Request user to + // authenticate(a prompt with that information will appear on the screen and + // the `message` will be displayed there) using their windows hello or if it's + // not set up, default one with password will appear. + void AuthenticateWithMessage(device_reauth::BiometricAuthRequester requester, + const std::u16string& message, + AuthenticateCallback callback) override; + + // Should be called by the object using the authenticator if the purpose + // for which the auth was requested becomes obsolete or the object is + // destroyed. + void Cancel(device_reauth::BiometricAuthRequester requester) override; + + private: + friend class ChromeBiometricAuthenticatorFactory; + + explicit BiometricAuthenticatorWin( + std::unique_ptr<AuthenticatorWinInterface> authenticator); + ~BiometricAuthenticatorWin() override; + + std::unique_ptr<AuthenticatorWinInterface> authenticator_; +}; + +#endif // CHROME_BROWSER_DEVICE_REAUTH_WIN_BIOMETRIC_AUTHENTICATOR_WIN_H_
diff --git a/chrome/browser/device_reauth/win/biometric_authenticator_win_unittest.cc b/chrome/browser/device_reauth/win/biometric_authenticator_win_unittest.cc new file mode 100644 index 0000000..683b9cf --- /dev/null +++ b/chrome/browser/device_reauth/win/biometric_authenticator_win_unittest.cc
@@ -0,0 +1,138 @@ +// Copyright 2022 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. + +#include "chrome/browser/device_reauth/win/biometric_authenticator_win.h" + +#include "chrome/browser/device_reauth/chrome_biometric_authenticator_factory.h" + +#include "base/callback.h" +#include "base/memory/raw_ptr.h" +#include "base/test/mock_callback.h" +#include "base/test/task_environment.h" +#include "components/device_reauth/biometric_authenticator.h" +#include "components/password_manager/core/browser/password_access_authenticator.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace { + +using device_reauth::BiometricAuthenticator; +using device_reauth::BiometricAuthRequester; +using password_manager::PasswordAccessAuthenticator; +using testing::_; +using testing::Return; + +class MockSystemAuthenticator : public AuthenticatorWinInterface { + public: + MOCK_METHOD(bool, + AuthenticateUser, + (const std::u16string& message), + (override)); +}; + +} // namespace + +class BiometricAuthenticatorWinTest : public testing::Test { + public: + void SetUp() override { + std::unique_ptr<MockSystemAuthenticator> system_authenticator = + std::make_unique<MockSystemAuthenticator>(); + system_authenticator_ = system_authenticator.get(); + authenticator_ = BiometricAuthenticatorWin::CreateForTesting( + std::move(system_authenticator)); + } + + BiometricAuthenticatorWin* authenticator() { return authenticator_.get(); } + + MockSystemAuthenticator& system_authenticator() { + return *system_authenticator_; + } + + base::test::TaskEnvironment& task_environment() { return task_environment_; } + + private: + base::test::TaskEnvironment task_environment_{ + base::test::TaskEnvironment::TimeSource::MOCK_TIME}; + scoped_refptr<BiometricAuthenticatorWin> authenticator_; + + // This is owned by the authenticator. + raw_ptr<MockSystemAuthenticator> system_authenticator_ = nullptr; +}; + +// If time that passed since the last successful authentication is smaller than +// kAuthValidityPeriod, no reauthentication is needed. +TEST_F(BiometricAuthenticatorWinTest, + NoReauthenticationIfLessThanAuthValidityPeriod) { + EXPECT_CALL(system_authenticator(), AuthenticateUser) + .WillOnce(Return(/*auth_succeeded=*/true)); + authenticator()->AuthenticateWithMessage( + BiometricAuthRequester::kPasswordsInSettings, + /*message=*/u"Chrome is trying to show passwords.", base::DoNothing()); + + // The delay is smaller than kAuthValidityPeriod there shouldn't be + // another prompt, so the auth should be reported as successful. + task_environment().FastForwardBy( + PasswordAccessAuthenticator::kAuthValidityPeriod / 2); + + EXPECT_CALL(system_authenticator(), AuthenticateUser(_)).Times(0); + base::MockCallback<BiometricAuthenticator::AuthenticateCallback> + result_callback; + EXPECT_CALL(result_callback, Run(/*auth_succeeded=*/true)); + authenticator()->AuthenticateWithMessage( + BiometricAuthRequester::kPasswordsInSettings, + /*message=*/u"Chrome is trying to show passwords.", + result_callback.Get()); + + task_environment().RunUntilIdle(); +} + +// If the time since the last reauthentication is greater than +// kAuthValidityPeriod reauthentication is needed. +TEST_F(BiometricAuthenticatorWinTest, ReauthenticationIfMoreThan60Seconds) { + // Simulate a previous successful authentication + EXPECT_CALL(system_authenticator(), AuthenticateUser) + .WillOnce(Return(/*auth_succeeded=*/true)); + authenticator()->AuthenticateWithMessage( + BiometricAuthRequester::kPasswordsInSettings, + /*message=*/u"Chrome is trying to show passwords.", base::DoNothing()); + + task_environment().FastForwardBy( + PasswordAccessAuthenticator::kAuthValidityPeriod * 2); + + // The next call to `Authenticate()` should re-trigger an authentication. + EXPECT_CALL(system_authenticator(), AuthenticateUser(_)) + .WillOnce(Return(/*auth_succeeded=*/false)); + base::MockCallback<BiometricAuthenticator::AuthenticateCallback> + result_callback; + EXPECT_CALL(result_callback, Run(/*auth_succeeded=*/false)); + authenticator()->AuthenticateWithMessage( + BiometricAuthRequester::kPasswordsInSettings, + /*message=*/u"Chrome is trying to show passwords.", + result_callback.Get()); + + task_environment().RunUntilIdle(); +} + +// If previous authentication failed, kAuthValidityPeriod isn't started and +// reauthentication will be needed. +TEST_F(BiometricAuthenticatorWinTest, ReauthenticationIfPreviousFailed) { + EXPECT_CALL(system_authenticator(), AuthenticateUser) + .WillOnce(Return(/*auth_succeeded=*/false)); + authenticator()->AuthenticateWithMessage( + BiometricAuthRequester::kPasswordsInSettings, + /*message=*/u"Chrome is trying to show passwords.", base::DoNothing()); + + // The next call to `Authenticate()` should re-trigger an authentication. + EXPECT_CALL(system_authenticator(), AuthenticateUser(_)) + .WillOnce(Return(true)); + base::MockCallback<BiometricAuthenticator::AuthenticateCallback> + result_callback; + EXPECT_CALL(result_callback, Run(/*auth_succeeded=*/true)); + authenticator()->AuthenticateWithMessage( + BiometricAuthRequester::kPasswordsInSettings, + /*message=*/u"Chrome is trying to show passwords.", + result_callback.Get()); + + task_environment().RunUntilIdle(); +}
diff --git a/chrome/browser/enterprise/connectors/analysis/fake_content_analysis_delegate.cc b/chrome/browser/enterprise/connectors/analysis/fake_content_analysis_delegate.cc index 7b9060a..f6f79021 100644 --- a/chrome/browser/enterprise/connectors/analysis/fake_content_analysis_delegate.cc +++ b/chrome/browser/enterprise/connectors/analysis/fake_content_analysis_delegate.cc
@@ -12,7 +12,7 @@ #include "chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.h" #include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h" #include "components/enterprise/common/proto/connectors.pb.h" -#include "content/public/browser/browser_thread.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace enterprise_connectors { @@ -173,7 +173,9 @@ void FakeContentAnalysisDelegate::Response( base::FilePath path, - std::unique_ptr<safe_browsing::BinaryUploadService::Request> request) { + std::unique_ptr<safe_browsing::BinaryUploadService::Request> request, + absl::optional<FakeFilesRequestHandler::FakeFileRequestCallback> + file_request_callback) { auto response = (status_callback_.is_null() || result_ != safe_browsing::BinaryUploadService::Result::SUCCESS) @@ -190,9 +192,8 @@ break; case AnalysisConnector::FILE_ATTACHED: case AnalysisConnector::FILE_DOWNLOADED: - DCHECK(GetFilesRequestHandlerForTesting()); - GetFilesRequestHandlerForTesting()->FileRequestCallbackForTesting( - path, result_, response); + DCHECK(file_request_callback.has_value()); + std::move(file_request_callback.value()).Run(path, result_, response); break; case AnalysisConnector::PRINT: PageRequestCallback(result_, response); @@ -212,14 +213,15 @@ FROM_HERE, base::BindOnce(&FakeContentAnalysisDelegate::Response, weakptr_factory_.GetWeakPtr(), base::FilePath(), - std::move(request)), + std::move(request), absl::nullopt), response_delay); } void FakeContentAnalysisDelegate::FakeUploadFileForDeepScanning( safe_browsing::BinaryUploadService::Result result, const base::FilePath& path, - std::unique_ptr<safe_browsing::BinaryUploadService::Request> request) { + std::unique_ptr<safe_browsing::BinaryUploadService::Request> request, + FakeFilesRequestHandler::FakeFileRequestCallback callback) { DCHECK(!path.empty()); if (GetDataForTesting() .settings.cloud_or_local_settings.is_cloud_analysis()) { @@ -230,7 +232,8 @@ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::BindOnce(&FakeContentAnalysisDelegate::Response, - weakptr_factory_.GetWeakPtr(), path, std::move(request)), + weakptr_factory_.GetWeakPtr(), path, std::move(request), + std::move(callback)), response_delay); } @@ -243,7 +246,7 @@ FROM_HERE, base::BindOnce(&FakeContentAnalysisDelegate::Response, weakptr_factory_.GetWeakPtr(), base::FilePath(), - std::move(request)), + std::move(request), absl::nullopt), response_delay); }
diff --git a/chrome/browser/enterprise/connectors/analysis/fake_content_analysis_delegate.h b/chrome/browser/enterprise/connectors/analysis/fake_content_analysis_delegate.h index a5585218..96a536e8 100644 --- a/chrome/browser/enterprise/connectors/analysis/fake_content_analysis_delegate.h +++ b/chrome/browser/enterprise/connectors/analysis/fake_content_analysis_delegate.h
@@ -11,6 +11,7 @@ #include "base/files/file_path.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.h" +#include "chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.h" #include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h" #include "components/enterprise/common/proto/connectors.pb.h" @@ -92,7 +93,9 @@ // or fail. void Response( base::FilePath path, - std::unique_ptr<safe_browsing::BinaryUploadService::Request> request); + std::unique_ptr<safe_browsing::BinaryUploadService::Request> request, + absl::optional<FakeFilesRequestHandler::FakeFileRequestCallback> + file_request_callback); // ContentAnalysisDelegate overrides. void UploadTextForDeepScanning( @@ -109,7 +112,8 @@ virtual void FakeUploadFileForDeepScanning( safe_browsing::BinaryUploadService::Result result, const base::FilePath& path, - std::unique_ptr<safe_browsing::BinaryUploadService::Request> request); + std::unique_ptr<safe_browsing::BinaryUploadService::Request> request, + FakeFilesRequestHandler::FakeFileRequestCallback callback); static safe_browsing::BinaryUploadService::Result result_; static bool dialog_shown_;
diff --git a/chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.cc b/chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.cc index f74e57d..76c8648 100644 --- a/chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.cc +++ b/chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.h" +#include "base/bind.h" #include "base/memory/weak_ptr.h" namespace enterprise_connectors { @@ -47,7 +48,10 @@ safe_browsing::BinaryUploadService::Result result, const base::FilePath& path, std::unique_ptr<safe_browsing::BinaryUploadService::Request> request) { - fake_file_upload_callback_.Run(result, path, std::move(request)); + fake_file_upload_callback_.Run( + result, path, std::move(request), + base::BindOnce(&FakeFilesRequestHandler::FileRequestCallbackForTesting, + GetWeakPtr())); } base::WeakPtr<FakeFilesRequestHandler> FakeFilesRequestHandler::GetWeakPtr() {
diff --git a/chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.h b/chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.h index e8dc1a4..caf79b10 100644 --- a/chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.h +++ b/chrome/browser/enterprise/connectors/analysis/fake_files_request_handler.h
@@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_ENTERPRISE_CONNECTORS_ANALYSIS_FAKE_FILES_REQUEST_HANDLER_H_ #define CHROME_BROWSER_ENTERPRISE_CONNECTORS_ANALYSIS_FAKE_FILES_REQUEST_HANDLER_H_ +#include "base/callback_forward.h" #include "base/memory/weak_ptr.h" #include "chrome/browser/enterprise/connectors/analysis/files_request_handler.h" @@ -12,10 +13,16 @@ class FakeFilesRequestHandler : public FilesRequestHandler { public: + using FakeFileRequestCallback = base::OnceCallback<void( + base::FilePath path, + safe_browsing::BinaryUploadService::Result result, + enterprise_connectors::ContentAnalysisResponse response)>; + using FakeFileUploadCallback = base::RepeatingCallback<void( safe_browsing::BinaryUploadService::Result result, const base::FilePath& path, - std::unique_ptr<safe_browsing::BinaryUploadService::Request> request)>; + std::unique_ptr<safe_browsing::BinaryUploadService::Request> request, + FakeFileRequestCallback callback)>; FakeFilesRequestHandler( FakeFileUploadCallback fake_file_upload_callback,
diff --git a/chrome/browser/enterprise/connectors/analysis/file_transfer_analysis_delegate_unittest.cc b/chrome/browser/enterprise/connectors/analysis/file_transfer_analysis_delegate_unittest.cc index 166dcde..e69047ab 100644 --- a/chrome/browser/enterprise/connectors/analysis/file_transfer_analysis_delegate_unittest.cc +++ b/chrome/browser/enterprise/connectors/analysis/file_transfer_analysis_delegate_unittest.cc
@@ -692,18 +692,16 @@ void FakeFileUploadCallback( safe_browsing::BinaryUploadService::Result result, const base::FilePath& path, - std::unique_ptr<safe_browsing::BinaryUploadService::Request> request) { + std::unique_ptr<safe_browsing::BinaryUploadService::Request> request, + FakeFilesRequestHandler::FakeFileRequestCallback callback) { EXPECT_FALSE(path.empty()); EXPECT_EQ(request->device_token(), kDmToken); // Simulate a response. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, - base::BindOnce( - &FilesRequestHandler::FileRequestCallbackForTesting, - base::Unretained(file_transfer_analysis_delegate_ - ->GetFilesRequestHandlerForTesting()), - path, safe_browsing::BinaryUploadService::Result::SUCCESS, - ConnectorStatusCallback(path)), + base::BindOnce(std::move(callback), path, + safe_browsing::BinaryUploadService::Result::SUCCESS, + ConnectorStatusCallback(path)), kResponseDelay); }
diff --git a/chrome/browser/enterprise/connectors/analysis/files_request_handler.h b/chrome/browser/enterprise/connectors/analysis/files_request_handler.h index b44d8e9b..ad9fb249 100644 --- a/chrome/browser/enterprise/connectors/analysis/files_request_handler.h +++ b/chrome/browser/enterprise/connectors/analysis/files_request_handler.h
@@ -83,11 +83,6 @@ void ReportWarningBypass( absl::optional<std::u16string> user_justification) override; - void FileRequestCallbackForTesting( - base::FilePath path, - safe_browsing::BinaryUploadService::Result result, - enterprise_connectors::ContentAnalysisResponse response); - protected: FilesRequestHandler( safe_browsing::BinaryUploadService* upload_service, @@ -100,6 +95,11 @@ bool UploadDataImpl() override; + void FileRequestCallbackForTesting( + base::FilePath path, + safe_browsing::BinaryUploadService::Result result, + enterprise_connectors::ContentAnalysisResponse response); + private: // Prepares an upload request for the file at `path`. If the file // cannot be uploaded it will have a failure verdict added to `result_`.
diff --git a/chrome/browser/enterprise/connectors/analysis/files_request_handler_unittest.cc b/chrome/browser/enterprise/connectors/analysis/files_request_handler_unittest.cc index 6ffae41..04753ce 100644 --- a/chrome/browser/enterprise/connectors/analysis/files_request_handler_unittest.cc +++ b/chrome/browser/enterprise/connectors/analysis/files_request_handler_unittest.cc
@@ -303,7 +303,8 @@ bool is_cloud_analysis, safe_browsing::BinaryUploadService::Result result, const base::FilePath& path, - std::unique_ptr<safe_browsing::BinaryUploadService::Request> request) { + std::unique_ptr<safe_browsing::BinaryUploadService::Request> request, + FakeFilesRequestHandler::FakeFileRequestCallback callback) { EXPECT_FALSE(path.empty()); if (is_cloud_analysis) EXPECT_EQ(request->device_token(), kDmToken); @@ -311,8 +312,7 @@ // Simulate a response. base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, - base::BindOnce(&FilesRequestHandler::FileRequestCallbackForTesting, - fake_files_request_handler_->GetWeakPtr(), path, + base::BindOnce(std::move(callback), path, safe_browsing::BinaryUploadService::Result::SUCCESS, ConnectorStatusCallback(path)), kResponseDelay);
diff --git a/chrome/browser/enterprise/connectors/device_trust/device_trust_browsertest.cc b/chrome/browser/enterprise/connectors/device_trust/device_trust_browsertest.cc index 4361326c..ec6d7fe 100644 --- a/chrome/browser/enterprise/connectors/device_trust/device_trust_browsertest.cc +++ b/chrome/browser/enterprise/connectors/device_trust/device_trust_browsertest.cc
@@ -17,8 +17,10 @@ #include "chrome/browser/enterprise/connectors/connectors_service.h" #include "chrome/browser/enterprise/connectors/device_trust/common/metrics_utils.h" #include "chrome/browser/enterprise/connectors/device_trust/device_trust_features.h" +#include "chrome/browser/enterprise/connectors/device_trust/device_trust_service.h" #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/scoped_key_rotation_command_factory.h" #include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/scoped_key_persistence_delegate_factory.h" +#include "chrome/browser/enterprise/connectors/device_trust/navigation_throttle.h" #include "chrome/browser/enterprise/signals/device_info_fetcher.h" #include "chrome/browser/policy/chrome_browser_policy_connector.h" #include "chrome/browser/policy/dm_token_utils.h" @@ -34,6 +36,7 @@ #include "content/public/browser/navigation_handle.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/mock_navigation_handle.h" #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/http_request.h" #include "net/test/embedded_test_server/http_response.h" @@ -166,15 +169,16 @@ InProcessBrowserTest::TearDownOnMainThread(); } - void PopulatePref(bool as_empty_list = false) { + void PopulatePref(bool as_empty_list = false, + Browser* active_browser = nullptr) { base::Value list_value(base::Value::Type::LIST); if (!as_empty_list) { list_value.Append(kAllowedHost); } - prefs()->Set(kContextAwareAccessSignalsAllowlistPref, - std::move(list_value)); + prefs(active_browser) + ->Set(kContextAwareAccessSignalsAllowlistPref, std::move(list_value)); } void NavigateToUrl(const GURL& url) { @@ -230,14 +234,20 @@ return nullptr; } - content::WebContents* web_contents() { - return browser()->tab_strip_model()->GetActiveWebContents(); + content::WebContents* web_contents(Browser* active_browser = nullptr) { + if (!active_browser) + active_browser = browser(); + return active_browser->tab_strip_model()->GetActiveWebContents(); } bool is_enabled() { return std::get<0>(GetParam()); } bool use_v2_header() { return std::get<1>(GetParam()); } - PrefService* prefs() { return browser()->profile()->GetPrefs(); } + PrefService* prefs(Browser* active_browser = nullptr) { + if (!active_browser) + active_browser = browser(); + return active_browser->profile()->GetPrefs(); + } net::test_server::EmbeddedTestServerHandle test_server_handle_; base::test::ScopedFeatureList scoped_feature_list_; @@ -387,6 +397,23 @@ histogram_tester_.ExpectTotalCount(kLatencyFailureHistogramName, 0); } +// Tests that the device trust navigation throttle does not get created for a +// navigation handle in incognito mode. +IN_PROC_BROWSER_TEST_P(DeviceTrustBrowserTest, + CreateNavigationThrottleIncognitoMode) { + // Add incognito browser for the mock navigation handle. + auto* incognito_browser = CreateIncognitoBrowser(browser()->profile()); + content::MockNavigationHandle mock_nav_handle( + web_contents(incognito_browser)); + + // Add allowed domain to Prefs. + PopulatePref(true, incognito_browser); + + // Try to create the device trust navigation throttle. + EXPECT_TRUE(enterprise_connectors::DeviceTrustNavigationThrottle:: + MaybeCreateThrottleFor(&mock_nav_handle) == nullptr); +} + INSTANTIATE_TEST_SUITE_P(All, DeviceTrustBrowserTest, testing::Combine(testing::Bool(), testing::Bool()));
diff --git a/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service.cc b/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service.cc index c295fe85..685b943 100644 --- a/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service.cc +++ b/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service.cc
@@ -16,6 +16,9 @@ namespace { +// TODO when adding this service to the login-screen: Check if the preference is +// unmanaged, while we are in sign-in profile to address +// security-/privacy-concerns const base::Value::List& GetPolicyUrlPatterns(PrefService* prefs) { return prefs->GetValueList(kContextAwareAccessSignalsAllowlistPref); }
diff --git a/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc b/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc index 821826e..0a3d4fb 100644 --- a/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc +++ b/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc
@@ -23,6 +23,10 @@ #include "components/enterprise/browser/device_trust/device_trust_key_manager.h" #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ash/profiles/profile_helper.h" +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + namespace enterprise_connectors { // static @@ -48,7 +52,9 @@ } DeviceTrustConnectorServiceFactory::DeviceTrustConnectorServiceFactory() - : ProfileKeyedServiceFactory("DeviceTrustConnectorService") {} + : ProfileKeyedServiceFactory( + "DeviceTrustConnectorService", + ProfileSelections::BuildForRegularAndIncognitoNonExperimental()) {} DeviceTrustConnectorServiceFactory::~DeviceTrustConnectorServiceFactory() = default; @@ -56,6 +62,16 @@ KeyedService* DeviceTrustConnectorServiceFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { auto* profile = Profile::FromBrowserContext(context); + // Disallow service for Incognito except for the sign-in profile of ChromeOS + // (on the login screen). + if (context->IsOffTheRecord()) { +#if BUILDFLAG(IS_CHROMEOS_ASH) + if (!ash::ProfileHelper::IsSigninProfile(profile)) + return nullptr; +#else + return nullptr; +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + } DeviceTrustConnectorService* service = nullptr;
diff --git a/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory_unittest.cc b/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory_unittest.cc new file mode 100644 index 0000000..fee446f --- /dev/null +++ b/chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory_unittest.cc
@@ -0,0 +1,84 @@ +// Copyright 2022 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. + +#include "chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.h" + +#include <memory> + +#include "base/test/scoped_feature_list.h" +#include "build/build_config.h" +#include "chrome/browser/enterprise/connectors/connectors_prefs.h" +#include "chrome/browser/enterprise/connectors/device_trust/device_trust_features.h" +#include "chrome/test/base/testing_browser_process.h" +#include "chrome/test/base/testing_profile.h" +#include "components/prefs/testing_pref_service.h" +#include "content/public/test/browser_task_environment.h" +#include "testing/gtest/include/gtest/gtest.h" + +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ash/profiles/profile_helper.h" +#include "chrome/common/chrome_constants.h" +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + +namespace enterprise_connectors { + +class DeviceTrustConnectorServiceFactoryTest : public testing::Test { + protected: + void SetUp() override { + feature_list_.InitWithFeatureState(kDeviceTrustConnectorEnabled, true); + } + Profile* profile() { return &profile_; } + + private: + content::BrowserTaskEnvironment task_environment_; + TestingProfile profile_; + + base::test::ScopedFeatureList feature_list_; +}; + +#if BUILDFLAG(IS_CHROMEOS_ASH) +TEST_F(DeviceTrustConnectorServiceFactoryTest, CreateForRegularProfile) { + EXPECT_FALSE(profile()->IsOffTheRecord()); + EXPECT_TRUE(DeviceTrustConnectorServiceFactory::GetForProfile(profile())); +} + +TEST_F(DeviceTrustConnectorServiceFactoryTest, + CreatedForSigninProfileChromeOS) { + TestingProfile::Builder builder; + builder.SetPath(base::FilePath(FILE_PATH_LITERAL(chrome::kInitialProfile))); + std::unique_ptr<TestingProfile> testing_profile = builder.Build(); + + Profile* signin_profile = + testing_profile->GetPrimaryOTRProfile(/*create_if_needed=*/true); + + ASSERT_TRUE(signin_profile); + EXPECT_TRUE(signin_profile->IsOffTheRecord()); + EXPECT_TRUE(ash::ProfileHelper::IsSigninProfile(signin_profile)); + + // Make sure a DeviceTrustConnectorService cannot be created from an incognito + // Profile. + DeviceTrustConnectorService* device_trust_connector_service = + DeviceTrustConnectorServiceFactory::GetForProfile(signin_profile); + EXPECT_TRUE(device_trust_connector_service); +} +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + +TEST_F(DeviceTrustConnectorServiceFactoryTest, NullForIncognitoProfile) { + Profile* incognito_profile = + profile()->GetPrimaryOTRProfile(/*create_if_needed=*/true); + +#if BUILDFLAG(IS_CHROMEOS_ASH) + EXPECT_FALSE(ash::ProfileHelper::IsSigninProfile(incognito_profile)); +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + + ASSERT_TRUE(incognito_profile); + + // Make sure a DeviceTrustConnectorService cannot be created from an incognito + // Profile. + DeviceTrustConnectorService* device_trust_connector_service = + DeviceTrustConnectorServiceFactory::GetForProfile(incognito_profile); + EXPECT_FALSE(device_trust_connector_service); +} + +} // namespace enterprise_connectors
diff --git a/chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc b/chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc index bda6a89..5c5eb62 100644 --- a/chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc +++ b/chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc
@@ -48,7 +48,9 @@ } DeviceTrustServiceFactory::DeviceTrustServiceFactory() - : ProfileKeyedServiceFactory("DeviceTrustService") { + : ProfileKeyedServiceFactory( + "DeviceTrustService", + ProfileSelections::BuildForRegularAndIncognitoNonExperimental()) { DependsOn(DeviceTrustConnectorServiceFactory::GetInstance()); DependsOn(PolicyBlocklistFactory::GetInstance()); DependsOn(policy::ManagementServiceFactory::GetInstance()); @@ -102,6 +104,10 @@ auto* dt_connector_service = DeviceTrustConnectorServiceFactory::GetForProfile(profile); + // If `profile` is a OTR profile but not the login profile on ChromeOS login + // screen. Then `dt_connector_service` will be null. Hence a + // DeviceTrustService won't be created for OTR profiles besides the one + // mentioned before. if (!dt_connector_service) { return nullptr; }
diff --git a/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator.cc b/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator.cc index b534eb0..321e096 100644 --- a/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator.cc +++ b/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator.cc
@@ -7,6 +7,9 @@ #include "base/check.h" #include "base/time/time.h" #include "base/values.h" +#include "chrome/browser/ash/crosapi/crosapi_ash.h" +#include "chrome/browser/ash/crosapi/crosapi_manager.h" +#include "chrome/browser/ash/crosapi/networking_attributes_ash.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" #include "chrome/browser/enterprise/connectors/device_trust/signals/decorators/common/metrics_utils.h" #include "chrome/browser/enterprise/connectors/device_trust/signals/decorators/common/signals_decorator.h" @@ -43,6 +46,51 @@ signals.Set(device_signals::names::kEnrollmentDomain, browser_policy_connector_->GetEnterpriseDomainManager()); + if (!crosapi::CrosapiManager::Get() || + !crosapi::CrosapiManager::Get()->crosapi_ash() || + !crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->networking_attributes_ash()) { + LogSignalsCollectionLatency(kLatencyHistogramVariant, start_time); + + std::move(done_closure).Run(); + return; + } + + auto callback = + base::BindOnce(&AshSignalsDecorator::OnNetworkInfoRetrieved, + weak_ptr_factory_.GetWeakPtr(), std::ref(signals), + start_time, std::move(done_closure)); + + crosapi::CrosapiManager::Get() + ->crosapi_ash() + ->networking_attributes_ash() + ->GetNetworkDetails(std::move(callback)); +} + +void AshSignalsDecorator::OnNetworkInfoRetrieved( + base::Value::Dict& signals, + base::TimeTicks start_time, + base::OnceClosure done_closure, + crosapi::mojom::GetNetworkDetailsResultPtr result) { + using Result = crosapi::mojom::GetNetworkDetailsResult; + switch (result->which()) { + case Result::Tag::kErrorMessage: + break; + case Result::Tag::kNetworkDetails: + absl::optional<net::IPAddress> ipv4_address = + result->get_network_details()->ipv4_address; + absl::optional<net::IPAddress> ipv6_address = + result->get_network_details()->ipv6_address; + if (ipv6_address.has_value()) { + signals.Set(device_signals::names::kIpAddress, + ipv6_address.value().ToString()); + } else if (ipv4_address.has_value()) { + signals.Set(device_signals::names::kIpAddress, + ipv4_address.value().ToString()); + } + } + LogSignalsCollectionLatency(kLatencyHistogramVariant, start_time); std::move(done_closure).Run();
diff --git a/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator.h b/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator.h index 8e40fb00..fccb866 100644 --- a/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator.h +++ b/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator.h
@@ -5,7 +5,9 @@ #ifndef CHROME_BROWSER_ENTERPRISE_CONNECTORS_DEVICE_TRUST_SIGNALS_DECORATORS_ASH_ASH_SIGNALS_DECORATOR_H_ #define CHROME_BROWSER_ENTERPRISE_CONNECTORS_DEVICE_TRUST_SIGNALS_DECORATORS_ASH_ASH_SIGNALS_DECORATOR_H_ +#include "base/memory/weak_ptr.h" #include "chrome/browser/enterprise/connectors/device_trust/signals/decorators/common/signals_decorator.h" +#include "chromeos/crosapi/mojom/networking_attributes.mojom.h" #include "base/values.h" @@ -27,7 +29,15 @@ base::OnceClosure done_closure) override; private: + void OnNetworkInfoRetrieved( + base::Value::Dict& signals, + base::TimeTicks start_time, + base::OnceClosure done_closure, + crosapi::mojom::GetNetworkDetailsResultPtr result); + policy::BrowserPolicyConnectorAsh* const browser_policy_connector_; + + base::WeakPtrFactory<AshSignalsDecorator> weak_ptr_factory_{this}; }; } // namespace enterprise_connectors
diff --git a/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator_browsertest.cc b/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator_browsertest.cc new file mode 100644 index 0000000..aa52d82 --- /dev/null +++ b/chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator_browsertest.cc
@@ -0,0 +1,170 @@ +// Copyright 2022 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. + +#include "chrome/browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator.h" + +#include "base/run_loop.h" +#include "chrome/browser/ash/login/users/chrome_user_manager.h" +#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" +#include "chrome/browser/ash/policy/core/device_policy_cros_browser_test.h" +#include "chrome/browser/ash/profiles/profile_helper.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/browser_process_platform_part_ash.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chromeos/ash/components/dbus/shill/shill_device_client.h" +#include "chromeos/ash/components/dbus/shill/shill_ipconfig_client.h" +#include "chromeos/ash/components/dbus/shill/shill_profile_client.h" +#include "chromeos/ash/components/dbus/shill/shill_service_client.h" +#include "components/device_signals/core/common/signals_constants.h" +#include "components/policy/proto/device_management_backend.pb.h" +#include "components/user_manager/user.h" +#include "components/user_manager/user_manager.h" +#include "content/public/test/browser_test.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/cros_system_api/dbus/shill/dbus-constants.h" + +using testing::InvokeWithoutArgs; + +namespace policy { + +constexpr char kFakeDeviceId[] = "fake_device_id"; +constexpr char kFakeCustomerId[] = "fake_obfuscated_customer_id"; +constexpr char kFakeEnrollmentDomain[] = "fake.domain.google.com"; +constexpr char kFakeAffilationID[] = "fake_affiliation_id"; + +constexpr char kMacAddress[] = "0123456789AB"; +constexpr char kIpv4Address[] = "192.168.0.42"; +constexpr char kIpv6Address[] = "fe80::1262:d0ff:fef5:e8a9"; +constexpr char kWifiDevicePath[] = "/device/stub_wifi"; +constexpr char kWifiServicePath[] = "/service/stub_wifi"; +constexpr char kWifiIPConfigV4Path[] = "/ipconfig/stub_wifi-ipv4"; +constexpr char kWifiIPConfigV6Path[] = "/ipconfig/stub_wifi-ipv6"; + +void ValidateStaticSignals(const base::Value::Dict& signals) { + EXPECT_EQ(*signals.FindString(device_signals::names::kDeviceId), + kFakeDeviceId); + EXPECT_EQ(*signals.FindString(device_signals::names::kObfuscatedCustomerId), + kFakeCustomerId); + EXPECT_EQ(*signals.FindString(device_signals::names::kEnrollmentDomain), + kFakeEnrollmentDomain); +} + +void SetupFakeNetwork() { + ash::ShillDeviceClient::TestInterface* shill_device_client = + ash::ShillDeviceClient::Get()->GetTestInterface(); + ash::ShillIPConfigClient::TestInterface* shill_ipconfig_client = + ash::ShillIPConfigClient::Get()->GetTestInterface(); + ash::ShillServiceClient::TestInterface* shill_service_client = + ash::ShillServiceClient::Get()->GetTestInterface(); + ash::ShillProfileClient::TestInterface* shill_profile_client = + ash::ShillProfileClient::Get()->GetTestInterface(); + + shill_service_client->ClearServices(); + shill_device_client->ClearDevices(); + + shill_device_client->AddDevice(kWifiDevicePath, shill::kTypeWifi, + "stub_wifi_device"); + shill_device_client->SetDeviceProperty( + kWifiDevicePath, shill::kAddressProperty, base::Value(kMacAddress), + /* notify_changed= */ false); + + base::DictionaryValue ipconfig_v4_dictionary; + ipconfig_v4_dictionary.SetKey(shill::kAddressProperty, + base::Value(kIpv4Address)); + ipconfig_v4_dictionary.SetKey(shill::kMethodProperty, + base::Value(shill::kTypeIPv4)); + shill_ipconfig_client->AddIPConfig(kWifiIPConfigV4Path, + ipconfig_v4_dictionary); + + base::DictionaryValue ipconfig_v6_dictionary; + ipconfig_v6_dictionary.SetKey(shill::kAddressProperty, + base::Value(kIpv6Address)); + ipconfig_v6_dictionary.SetKey(shill::kMethodProperty, + base::Value(shill::kTypeIPv6)); + shill_ipconfig_client->AddIPConfig(kWifiIPConfigV6Path, + ipconfig_v6_dictionary); + + base::ListValue ip_configs; + ip_configs.Append(kWifiIPConfigV4Path); + ip_configs.Append(kWifiIPConfigV6Path); + shill_device_client->SetDeviceProperty(kWifiDevicePath, + shill::kIPConfigsProperty, ip_configs, + /*notify_changed=*/false); + + shill_service_client->AddService(kWifiServicePath, "wifi_guid", + "wifi_network_name", shill::kTypeWifi, + shill::kStateIdle, /* visible= */ true); + shill_service_client->SetServiceProperty( + kWifiServicePath, shill::kConnectableProperty, base::Value(true)); + + shill_profile_client->AddService( + ash::ShillProfileClient::GetSharedProfilePath(), kWifiServicePath); + + shill_service_client->SetServiceProperty(kWifiServicePath, + shill::kStateProperty, + base::Value(shill::kStateOnline)); + base::RunLoop().RunUntilIdle(); +} + +class AshSignalsDecoratorBrowserTest : public DevicePolicyCrosBrowserTest { + public: + AshSignalsDecoratorBrowserTest() { + device_state_.set_skip_initial_policy_setup(true); + } + ~AshSignalsDecoratorBrowserTest() override = default; +}; + +IN_PROC_BROWSER_TEST_F(AshSignalsDecoratorBrowserTest, TestStaticSignals) { + BrowserPolicyConnectorAsh* connector = + g_browser_process->platform_part()->browser_policy_connector_ash(); + device_policy()->policy_data().set_directory_api_id(kFakeDeviceId); + device_policy()->policy_data().set_obfuscated_customer_id(kFakeCustomerId); + device_policy()->policy_data().set_managed_by(kFakeEnrollmentDomain); + policy_helper()->RefreshPolicyAndWaitUntilDeviceCloudPolicyUpdated(); + + enterprise_connectors::AshSignalsDecorator decorator(connector); + + base::RunLoop run_loop; + + base::Value::Dict signals; + decorator.Decorate(signals, run_loop.QuitClosure()); + + run_loop.Run(); + + ValidateStaticSignals(signals); +} + +IN_PROC_BROWSER_TEST_F(AshSignalsDecoratorBrowserTest, TestIPSignal) { + BrowserPolicyConnectorAsh* connector = + g_browser_process->platform_part()->browser_policy_connector_ash(); + enterprise_connectors::AshSignalsDecorator decorator(connector); + + base::RunLoop run_loop; + base::Value::Dict signals; + + Profile* profile = + g_browser_process->profile_manager()->GetPrimaryUserProfile(); + const user_manager::User* user = + ash::ProfileHelper::Get()->GetUserByProfile(profile); + + device_policy()->policy_data().add_device_affiliation_ids(kFakeAffilationID); + policy_helper()->RefreshPolicyAndWaitUntilDeviceCloudPolicyUpdated(); + + std::set<std::string> user_affiliation_ids; + user_affiliation_ids.insert(kFakeAffilationID); + + ash::ChromeUserManager::Get()->SetUserAffiliation(user->GetAccountId(), + user_affiliation_ids); + + SetupFakeNetwork(); + + decorator.Decorate(signals, run_loop.QuitClosure()); + + run_loop.Run(); + + EXPECT_EQ(*signals.FindString(device_signals::names::kIpAddress), + kIpv6Address); +} + +} // namespace policy
diff --git a/chrome/browser/extensions/active_tab_apitest.cc b/chrome/browser/extensions/active_tab_apitest.cc index 63ff155..61873b4 100644 --- a/chrome/browser/extensions/active_tab_apitest.cc +++ b/chrome/browser/extensions/active_tab_apitest.cc
@@ -11,7 +11,6 @@ #include "chrome/browser/extensions/extension_action_runner.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/extensions/extension_service.h" -#include "chrome/browser/extensions/extension_tab_util.h" #include "chrome/browser/extensions/extension_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" @@ -30,11 +29,6 @@ #include "net/dns/mock_host_resolver.h" #include "net/test/embedded_test_server/embedded_test_server.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "chrome/browser/chromeos/extensions/extension_tab_util_delegate_chromeos.h" -#include "chromeos/login/login_state/scoped_test_public_session_login_state.h" -#endif - namespace extensions { namespace { @@ -94,29 +88,6 @@ EXPECT_TRUE(catcher.GetNextResult()) << message_; } -#if BUILDFLAG(IS_CHROMEOS_ASH) - // For the third pass grant the activeTab permission and do it in a public - // session. URL should be scrubbed down to origin. - { - // Setup state. - chromeos::ScopedTestPublicSessionLoginState login_state; - ExtensionTabUtil::SetPlatformDelegate( - std::make_unique<ExtensionTabUtilDelegateChromeOS>()); - - ExtensionTestMessageListener listener; - ResultCatcher catcher; - ExtensionActionRunner::GetForWebContents( - browser()->tab_strip_model()->GetActiveWebContents()) - ->RunAction(extension, true); - EXPECT_TRUE(catcher.GetNextResult()) << message_; - EXPECT_EQ(GURL(listener.message()).DeprecatedGetOriginAsURL().spec(), - listener.message()); - - // Clean up. - ExtensionTabUtil::SetPlatformDelegate(nullptr); - } -#endif - // Navigating to a different page on the same origin should revoke extension's // access to the tab, unless the runtime host permissions feature is enabled. {
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc index a3b44b11..529f189 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -49,12 +49,15 @@ #include "url/gurl.h" #include "url/scheme_host_port.h" +#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) +#include "chrome/browser/device_reauth/chrome_biometric_authenticator_factory.h" +#endif + #if BUILDFLAG(IS_WIN) #include "chrome/browser/password_manager/password_manager_util_win.h" #endif #if BUILDFLAG(IS_MAC) -#include "chrome/browser/device_reauth/chrome_biometric_authenticator_factory.h" #include "chrome/browser/password_manager/password_manager_util_mac.h" #endif @@ -436,10 +439,19 @@ password_manager::PasswordAccessAuthenticator::AuthResultCallback callback) { #if BUILDFLAG(IS_WIN) - DCHECK(web_contents_); - bool result = password_manager_util_win::AuthenticateUser( - web_contents_->GetTopLevelNativeWindow(), purpose); - std::move(callback).Run(result); + scoped_refptr<device_reauth::BiometricAuthenticator> biometric_authenticator = + ChromeBiometricAuthenticatorFactory::GetInstance() + ->GetOrCreateBiometricAuthenticator(); + base::OnceCallback<void()> on_reauth_completed = + base::BindOnce(&PasswordsPrivateDelegateImpl::OnReauthCompleted, + weak_ptr_factory_.GetWeakPtr()); + + biometric_authenticator->AuthenticateWithMessage( + device_reauth::BiometricAuthRequester::kPasswordsInSettings, + password_manager_util_win::GetMessageForLoginPrompt(purpose), + std::move(callback).Then(std::move(on_reauth_completed))); + + biometric_authenticator_ = std::move(biometric_authenticator); #elif BUILDFLAG(IS_MAC) if (base::FeatureList::IsEnabled( password_manager::features::kBiometricAuthenticationInSettings)) { @@ -456,11 +468,12 @@ password_manager_util_mac::GetMessageForBiometricLoginPrompt(purpose), std::move(callback).Then(std::move(on_reauth_completed))); - // If AuthenticateWithMessage is called again(UI isn't blocked so user might - // click multiple times on the button), it invalidates the old request which - // triggers PasswordsPrivateDelegateImpl::OnReauthCompleted which resets - // biometric_authenticator_. Having a local variable solves that problem as - // there's a second scoped_refptr for the authenticator object. + // If AuthenticateWithMessage is called again(UI on Mac isn't blocked so + // user might click multiple times on the button), it invalidates the old + // request which triggers PasswordsPrivateDelegateImpl::OnReauthCompleted + // which resets biometric_authenticator_. Having a local variable solves + // that problem as there's a second scoped_refptr for the authenticator + // object. biometric_authenticator_ = std::move(biometric_authenticator); } else { bool result = password_manager_util_mac::AuthenticateUser(purpose);
diff --git a/chrome/browser/extensions/chrome_extensions_browser_client.cc b/chrome/browser/extensions/chrome_extensions_browser_client.cc index db935ee..462d9ef 100644 --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
@@ -43,6 +43,7 @@ #include "chrome/browser/profiles/keep_alive/scoped_profile_keep_alive.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/renderer_host/chrome_navigation_ui_data.h" #include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service.h" #include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h" @@ -94,6 +95,10 @@ #include "chrome/browser/chromeos/policy/dlp/dlp_content_manager.h" #endif +#if BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chromeos/startup/browser_params_proxy.h" +#endif + namespace extensions { namespace { @@ -324,8 +329,10 @@ bool ChromeExtensionsBrowserClient::IsInDemoMode() { #if BUILDFLAG(IS_CHROMEOS_ASH) - const auto* const demo_session = ash::DemoSession::Get(); - return demo_session && demo_session->started(); + return ash::DemoSession::IsDeviceInDemoMode(); +#elif BUILDFLAG(IS_CHROMEOS_LACROS) + return chromeos::BrowserParamsProxy::Get()->DeviceMode() == + crosapi::mojom::DeviceMode::kDemo; #else return false; #endif @@ -350,11 +357,7 @@ } bool ChromeExtensionsBrowserClient::IsLoggedInAsPublicAccount() { -#if BUILDFLAG(IS_CHROMEOS_ASH) - return user_manager::UserManager::Get()->IsLoggedInAsPublicAccount(); -#else - return false; -#endif + return profiles::IsPublicSession(); } ExtensionSystemProvider*
diff --git a/chrome/browser/extensions/extension_tab_util.cc b/chrome/browser/extensions/extension_tab_util.cc index 87e14fc..87d01098 100644 --- a/chrome/browser/extensions/extension_tab_util.cc +++ b/chrome/browser/extensions/extension_tab_util.cc
@@ -103,17 +103,6 @@ return sessions::SessionTabHelper::IdForTab(web_contents).id(); } -std::unique_ptr<ExtensionTabUtil::Delegate>& -GetExtensionTabUtilDelegateWrapper() { - static base::NoDestructor<std::unique_ptr<ExtensionTabUtil::Delegate>> - delegate_wrapper; - return *delegate_wrapper; -} - -ExtensionTabUtil::Delegate* GetExtensionTabUtilDelegate() { - return GetExtensionTabUtilDelegateWrapper().get(); -} - ExtensionTabUtil::ScrubTabBehaviorType GetScrubTabBehaviorImpl( const Extension* extension, Feature::Context context, @@ -149,10 +138,6 @@ return ExtensionTabUtil::kScrubTabFully; } - if (GetExtensionTabUtilDelegate()) { - return GetExtensionTabUtilDelegate()->GetScrubTabBehavior(extension); - } - return ExtensionTabUtil::kDontScrubTab; } @@ -599,11 +584,6 @@ } // static -void ExtensionTabUtil::SetPlatformDelegate(std::unique_ptr<Delegate> delegate) { - GetExtensionTabUtilDelegateWrapper() = std::move(delegate); -} - -// static ExtensionTabUtil::ScrubTabBehavior ExtensionTabUtil::GetScrubTabBehavior( const Extension* extension, Feature::Context context,
diff --git a/chrome/browser/extensions/extension_tab_util.h b/chrome/browser/extensions/extension_tab_util.h index 82b93d6..c2bd31fe0 100644 --- a/chrome/browser/extensions/extension_tab_util.h +++ b/chrome/browser/extensions/extension_tab_util.h
@@ -72,15 +72,6 @@ std::unique_ptr<int> bookmark_id; }; - // Platform specific delegate. - class Delegate { - public: - virtual ~Delegate() {} - // Platform specific scrubbing of tab info for |extension|. - virtual ExtensionTabUtil::ScrubTabBehaviorType GetScrubTabBehavior( - const Extension* extension) = 0; - }; - // Opens a new tab given an extension function |function| and creation // parameters |params|. Returns a Tab object if successful, or NULL and // optionally sets |error| if an error occurs. @@ -154,10 +145,6 @@ static std::unique_ptr<api::tabs::MutedInfo> CreateMutedInfo( content::WebContents* contents); - // Platform specific logic moved to delegate. This should be set during - // startup. - static void SetPlatformDelegate(std::unique_ptr<Delegate> delegate); - // Gets the level of scrubbing of tab data that needs to happen for a given // extension and web contents. This is the preferred way to get // ScrubTabBehavior.
diff --git a/chrome/browser/extensions/extension_tab_util_unittest.cc b/chrome/browser/extensions/extension_tab_util_unittest.cc index df9befa6..2b16a03 100644 --- a/chrome/browser/extensions/extension_tab_util_unittest.cc +++ b/chrome/browser/extensions/extension_tab_util_unittest.cc
@@ -11,50 +11,6 @@ namespace extensions { -namespace { - -class ExtensionTabUtilTestDelegate : public ExtensionTabUtil::Delegate { - public: - ExtensionTabUtilTestDelegate() {} - - ExtensionTabUtilTestDelegate(const ExtensionTabUtilTestDelegate&) = delete; - ExtensionTabUtilTestDelegate& operator=(const ExtensionTabUtilTestDelegate&) = - delete; - - ~ExtensionTabUtilTestDelegate() override {} - - // ExtensionTabUtil::Delegate - ExtensionTabUtil::ScrubTabBehaviorType GetScrubTabBehavior( - const Extension* extension) override { - return ExtensionTabUtil::kScrubTabUrlToOrigin; - } -}; - -} // namespace - -// Test that the custom GetScrubTabBehavior delegate works - in this test it -// always returns kScrubTabUrlToOrigin -TEST(ExtensionTabUtilTest, Delegate) { - ExtensionTabUtil::SetPlatformDelegate( - std::make_unique<ExtensionTabUtilTestDelegate>()); - - // Build an extension that passes the permission checks for the generic - // GetScrubTabBehavior - auto extension = ExtensionBuilder("test").AddPermission("tabs").Build(); - - ExtensionTabUtil::ScrubTabBehavior scrub_tab_behavior = - ExtensionTabUtil::GetScrubTabBehavior( - extension.get(), Feature::Context::UNSPECIFIED_CONTEXT, - GURL("http://www.google.com")); - EXPECT_EQ(ExtensionTabUtil::kScrubTabUrlToOrigin, - scrub_tab_behavior.committed_info); - EXPECT_EQ(ExtensionTabUtil::kScrubTabUrlToOrigin, - scrub_tab_behavior.pending_info); - - // Unset the delegate. - ExtensionTabUtil::SetPlatformDelegate(nullptr); -} - TEST(ExtensionTabUtilTest, ScrubTabBehaviorForTabsPermission) { auto extension = ExtensionBuilder("Extension with tabs permission") .AddPermission("tabs")
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 001d9d8..8be768d 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -3510,7 +3510,7 @@ { "name": "filling-across-affiliated-websites", "owners": [ "vsemeniuk@google.com", "vasilii" ], - "expiry_milestone": 105 + "expiry_milestone": 109 }, { "name": "focus-follows-cursor", @@ -6234,7 +6234,7 @@ { "name": "touch-to-fill-password-submission", "owners": [ "kolos", "fhorschig" ], - "expiry_milestone": 106 + "expiry_milestone": 109 }, { "name": "traffic-counters",
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index cf4f1e8..f52c1fa1 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -383,6 +383,7 @@ &password_manager::features::kUnifiedPasswordManagerAndroid, &password_manager::features::kPasswordEditDialogWithDetails, &performance_hints::features::kContextMenuPerformanceInfo, + &privacy_sandbox::kPrivacySandboxFirstPartySetsUI, &privacy_sandbox::kPrivacySandboxSettings3, &query_tiles::features::kQueryTiles, &query_tiles::features::kQueryTilesInNTP,
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java index ddf10c0..bec914c3 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
@@ -483,6 +483,7 @@ "PrefetchNotificationSchedulingIntegration"; public static final String PRERENDER2 = "Prerender2"; public static final String PRIVACY_GUIDE = "PrivacyGuideAndroid"; + public static final String PRIVACY_SANDBOX_FPS_UI = "PrivacySandboxFirstPartySetsUI"; public static final String PRIVACY_SANDBOX_SETTINGS_3 = "PrivacySandboxSettings3"; public static final String PROBABILISTIC_CRYPTID_RENDERER = "ProbabilisticCryptidRenderer"; public static final String PUSH_MESSAGING_DISALLOW_SENDER_IDS =
diff --git a/chrome/browser/password_manager/android/BUILD.gn b/chrome/browser/password_manager/android/BUILD.gn index 5c75e32..40355f92 100644 --- a/chrome/browser/password_manager/android/BUILD.gn +++ b/chrome/browser/password_manager/android/BUILD.gn
@@ -244,6 +244,7 @@ android_library("settings_interface_java") { deps = [ + ":backend_interface_java", "//base:base_java", "//components/password_manager/core/browser:password_manager_java_enums", "//third_party/android_deps:guava_android_java",
diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/CredentialManagerLauncherFactory.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/CredentialManagerLauncherFactory.java index c16d661..ca97cf8 100644 --- a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/CredentialManagerLauncherFactory.java +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/CredentialManagerLauncherFactory.java
@@ -6,8 +6,13 @@ import static org.chromium.base.ThreadUtils.assertOnUiThread; +import android.content.Context; + import androidx.annotation.VisibleForTesting; +import org.chromium.chrome.browser.password_manager.CredentialManagerLauncher.CredentialManagerBackendException; +import org.chromium.chrome.browser.password_manager.CredentialManagerLauncher.CredentialManagerError; + /** * This factory returns an implementation for the launcher. The factory itself is also implemented * downstream. @@ -34,11 +39,23 @@ * * TODO(crbug.com/1346239): Check if backend could be instantiated and throw error */ - public CredentialManagerLauncher createLauncher() - throws CredentialManagerLauncher.CredentialManagerBackendException { + public CredentialManagerLauncher createLauncher() throws CredentialManagerBackendException { return null; } + /** + * Creates and returns new instance of the downstream implementation provided by subclasses. + * + * Downstream should override this method with actual implementation. + * + * @return An implementation of the {@link CredentialManagerLauncher} if one exists. + */ + protected CredentialManagerLauncher doCreateLauncher(Context context) + throws CredentialManagerBackendException { + throw new CredentialManagerBackendException("Downstream implementation is not present.", + CredentialManagerError.BACKEND_NOT_AVAILABLE); + } + @VisibleForTesting public static void setFactoryForTesting( CredentialManagerLauncherFactory credentialManagerLauncherFactory) {
diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordCheckupClientHelperFactory.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordCheckupClientHelperFactory.java index 3f3c6db1..c97cd9d 100644 --- a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordCheckupClientHelperFactory.java +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordCheckupClientHelperFactory.java
@@ -4,8 +4,13 @@ package org.chromium.chrome.browser.password_manager; +import android.content.Context; + import androidx.annotation.VisibleForTesting; +import org.chromium.chrome.browser.password_manager.CredentialManagerLauncher.CredentialManagerError; +import org.chromium.chrome.browser.password_manager.PasswordCheckupClientHelper.PasswordCheckBackendException; + /** * This factory returns an implementation for the helper. The factory itself is also implemented * downstream. @@ -29,11 +34,23 @@ * * TODO(crbug.com/1346239): Check if backend could be instantiated and throw error */ - public PasswordCheckupClientHelper createHelper() - throws PasswordCheckupClientHelper.PasswordCheckBackendException { + public PasswordCheckupClientHelper createHelper() throws PasswordCheckBackendException { return null; } + /** + * Creates and returns new instance of the downstream implementation provided by subclasses. + * + * Downstream should override this method with actual implementation. + * + * @return An implementation of the {@link PasswordCheckupClientHelper} if one exists. + */ + protected PasswordCheckupClientHelper doCreateHelper(Context context) + throws PasswordCheckBackendException { + throw new PasswordCheckBackendException("Downstream implementation is not present.", + CredentialManagerError.BACKEND_NOT_AVAILABLE); + } + @VisibleForTesting public static void setFactoryForTesting( PasswordCheckupClientHelperFactory passwordCheckupClientHelperFactory) {
diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordSettingsAccessorFactory.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordSettingsAccessorFactory.java index d89552e..2a649df 100644 --- a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordSettingsAccessorFactory.java +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordSettingsAccessorFactory.java
@@ -8,6 +8,8 @@ import androidx.annotation.VisibleForTesting; +import org.chromium.chrome.browser.password_manager.PasswordStoreAndroidBackend.BackendException; + /** * This factory returns an implementation for the password settings accessor. The factory itself is * also implemented downstream. @@ -44,6 +46,18 @@ return false; } + /** + * Creates and returns new instance of the downstream implementation provided by subclasses. + * + * Downstream should override this method with actual implementation. + * + * @return An implementation of the {@link PasswordSettingsAccessor} if one exists. + */ + protected PasswordSettingsAccessor doCreateAccessor() throws BackendException { + throw new BackendException("Downstream implementation is not present.", + AndroidBackendErrorType.BACKEND_NOT_AVAILABLE); + } + @VisibleForTesting public static void setupFactoryForTesting(PasswordSettingsAccessorFactory accessorFactory) { sInstance = accessorFactory;
diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordStoreAndroidBackendFactory.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordStoreAndroidBackendFactory.java index b1bfdb50..aa5df67 100644 --- a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordStoreAndroidBackendFactory.java +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordStoreAndroidBackendFactory.java
@@ -9,6 +9,8 @@ import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; +import org.chromium.chrome.browser.password_manager.PasswordStoreAndroidBackend.BackendException; + /** * This factory returns an implementation for the backend. The factory itself is implemented * downstream, too. @@ -47,6 +49,18 @@ return false; } + /** + * Creates and returns new instance of the downstream implementation provided by subclasses. + * + * Downstream should override this method with actual implementation. + * + * @return An implementation of the {@link PasswordStoreAndroidBackend} if one exists. + */ + protected PasswordStoreAndroidBackend doCreateBackend() throws BackendException { + throw new BackendException("Downstream implementation is not present.", + AndroidBackendErrorType.BACKEND_NOT_AVAILABLE); + } + @VisibleForTesting public static void setFactoryInstanceForTesting( @Nullable PasswordStoreAndroidBackendFactory factory) {
diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordSyncControllerDelegateFactory.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordSyncControllerDelegateFactory.java index d52bae2..f91a337e 100644 --- a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordSyncControllerDelegateFactory.java +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordSyncControllerDelegateFactory.java
@@ -6,9 +6,13 @@ import static org.chromium.base.ThreadUtils.assertOnUiThread; +import android.content.Context; + import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; +import org.chromium.chrome.browser.password_manager.PasswordStoreAndroidBackend.BackendException; + /** * This factory returns an implementation for the {@link PasswordSyncControllerDelegate}. * The factory itself is implemented downstream, too. @@ -38,6 +42,19 @@ return null; } + /** + * Creates and returns new instance of the downstream implementation provided by subclasses. + * + * Downstream should override this method with actual implementation. + * + * @return An implementation of the {@link PasswordSyncControllerDelegate} if one exists. + */ + protected PasswordSyncControllerDelegate doCreateDelegate(Context context) + throws BackendException { + throw new BackendException("Downstream implementation is not present.", + AndroidBackendErrorType.BACKEND_NOT_AVAILABLE); + } + @VisibleForTesting public static void setFactoryInstanceForTesting( @Nullable PasswordSyncControllerDelegateFactory factory) {
diff --git a/chrome/browser/password_manager/android/password_store_android_backend.cc b/chrome/browser/password_manager/android/password_store_android_backend.cc index 945abc14..3a8701cb 100644 --- a/chrome/browser/password_manager/android/password_store_android_backend.cc +++ b/chrome/browser/password_manager/android/password_store_android_backend.cc
@@ -204,6 +204,7 @@ case AndroidBackendErrorType::kPassphraseNotSupported: case AndroidBackendErrorType::kGMSVersionNotSupported: case AndroidBackendErrorType::kExternalError: + case AndroidBackendErrorType::kBackendNotAvailable: return SuccessStatus::kError; } NOTREACHED();
diff --git a/chrome/browser/password_manager/password_manager_util_win.cc b/chrome/browser/password_manager/password_manager_util_win.cc index 2ea00f0..be0ba18d 100644 --- a/chrome/browser/password_manager/password_manager_util_win.cc +++ b/chrome/browser/password_manager/password_manager_util_win.cc
@@ -272,7 +272,7 @@ } // namespace bool AuthenticateUser(gfx::NativeWindow window, - password_manager::ReauthPurpose purpose) { + const std::u16string& password_prompt) { bool retval = false; WCHAR cur_username[CREDUI_MAX_USERNAME_LENGTH + 1] = {}; DWORD cur_username_length = std::size(cur_username); @@ -291,25 +291,6 @@ // left empty on domain joined machines, CredUIPromptForWindowsCredentials() // fails to run. std::u16string product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); - std::u16string password_prompt; - switch (purpose) { - case password_manager::ReauthPurpose::VIEW_PASSWORD: - password_prompt = - l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_AUTHENTICATION_PROMPT); - break; - case password_manager::ReauthPurpose::COPY_PASSWORD: - password_prompt = l10n_util::GetStringUTF16( - IDS_PASSWORDS_PAGE_COPY_AUTHENTICATION_PROMPT); - break; - case password_manager::ReauthPurpose::EDIT_PASSWORD: - password_prompt = l10n_util::GetStringUTF16( - IDS_PASSWORDS_PAGE_EDIT_AUTHENTICATION_PROMPT); - break; - case password_manager::ReauthPurpose::EXPORT: - password_prompt = l10n_util::GetStringUTF16( - IDS_PASSWORDS_PAGE_EXPORT_AUTHENTICATION_PROMPT); - break; - } CREDUI_INFO cui; cui.cbSize = sizeof(cui); cui.hwndParent = window->GetHost()->GetAcceleratedWidget(); @@ -354,4 +335,24 @@ return retval; } +std::u16string GetMessageForLoginPrompt( + password_manager::ReauthPurpose purpose) { + switch (purpose) { + case password_manager::ReauthPurpose::VIEW_PASSWORD: + return l10n_util::GetStringUTF16( + IDS_PASSWORDS_PAGE_AUTHENTICATION_PROMPT); + case password_manager::ReauthPurpose::COPY_PASSWORD: + return l10n_util::GetStringUTF16( + IDS_PASSWORDS_PAGE_COPY_AUTHENTICATION_PROMPT); + + case password_manager::ReauthPurpose::EDIT_PASSWORD: + return l10n_util::GetStringUTF16( + IDS_PASSWORDS_PAGE_EDIT_AUTHENTICATION_PROMPT); + + case password_manager::ReauthPurpose::EXPORT: + return l10n_util::GetStringUTF16( + IDS_PASSWORDS_PAGE_EXPORT_AUTHENTICATION_PROMPT); + } +} + } // namespace password_manager_util_win
diff --git a/chrome/browser/password_manager/password_manager_util_win.h b/chrome/browser/password_manager/password_manager_util_win.h index c28cacfb..eabc79e 100644 --- a/chrome/browser/password_manager/password_manager_util_win.h +++ b/chrome/browser/password_manager/password_manager_util_win.h
@@ -12,9 +12,13 @@ // Attempts to (re-)authenticate the user of the OS account. Returns true if // the user was successfully authenticated, or if authentication was not -// possible. +// possible. Populates the user facing prompt with `password_prompt` message. bool AuthenticateUser(gfx::NativeWindow window, - password_manager::ReauthPurpose purpose); + const std::u16string& password_prompt); + +// Returns message that should be used in the AuthenticateUser method. +std::u16string GetMessageForLoginPrompt( + password_manager::ReauthPurpose purpose); } // namespace password_manager_util_win #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_MANAGER_UTIL_WIN_H_
diff --git a/chrome/browser/profiles/profile_keyed_service_factory_unittest.cc b/chrome/browser/profiles/profile_keyed_service_factory_unittest.cc index 42cf052..7d248669 100644 --- a/chrome/browser/profiles/profile_keyed_service_factory_unittest.cc +++ b/chrome/browser/profiles/profile_keyed_service_factory_unittest.cc
@@ -40,7 +40,7 @@ }; // Similar testing implementation of `ProfileKeyedServiceFactory` but for Ref -// counted Services `RefcountedProfileKeyedServiceFactory` +// counted Services `RefcountedProfileKeyedServiceFactory`. class RefcountedProfileKeyedServiceFactoryTest : public RefcountedProfileKeyedServiceFactory { public: @@ -64,11 +64,23 @@ } }; -class ProfileKeyedServiceFactoryUnittest : public testing::Test { +// Param: +// - bool system_experiment: used to activate/deactivate the +// `kSystemProfileSelectionDefaultNone` experiment. +class ProfileKeyedServiceFactoryUnittest + : public testing::Test, + public ::testing::WithParamInterface<bool> { public: void SetUp() override { testing::Test::SetUp(); profile_testing_helper_.SetUp(); + + // TODO(rsult): move the below code to be in the + // `ProfileKeyedServiceFactoryUnittest` constructor, once the System Profile + // can be created with the experiment activated. + bool activate_system_experiment = GetParam(); + feature_list_.InitWithFeatureState(kSystemProfileSelectionDefaultNone, + activate_system_experiment); } protected: @@ -80,6 +92,10 @@ expected_profile); } + bool IsSystemExperimentActive() const { + return base::FeatureList::IsEnabled(kSystemProfileSelectionDefaultNone); + } + TestingProfile* regular_profile() { return profile_testing_helper_.regular_profile(); } @@ -105,6 +121,7 @@ private: ProfileTestingHelper profile_testing_helper_; + base::test::ScopedFeatureList feature_list_; }; // Factory using default `ProfileKeyedServiceFactory` constructor @@ -113,7 +130,7 @@ DefaultFactoryTest() : ProfileKeyedServiceFactoryTest("DefaultFactory") {} }; -TEST_F(ProfileKeyedServiceFactoryUnittest, DefaultFactoryTest) { +TEST_P(ProfileKeyedServiceFactoryUnittest, DefaultFactoryTest) { DefaultFactoryTest factory; TestProfileToUse(factory, regular_profile(), regular_profile()); TestProfileToUse(factory, incognito_profile(), nullptr); @@ -122,7 +139,9 @@ TestProfileToUse(factory, guest_profile_otr(), nullptr); #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) - TestProfileToUse(factory, system_profile(), system_profile()); + bool system_experiment = IsSystemExperimentActive(); + TestProfileToUse(factory, system_profile(), + system_experiment ? nullptr : system_profile()); TestProfileToUse(factory, system_profile_otr(), nullptr); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) } @@ -137,7 +156,7 @@ ProfileSelections::BuildRedirectedInIncognito()) {} }; -TEST_F(ProfileKeyedServiceFactoryUnittest, +TEST_P(ProfileKeyedServiceFactoryUnittest, PredefinedProfileSelectionsFactoryTest) { PredefinedProfileSelectionsFactoryTest factory; TestProfileToUse(factory, regular_profile(), regular_profile()); @@ -147,8 +166,11 @@ TestProfileToUse(factory, guest_profile_otr(), guest_profile()); #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) - TestProfileToUse(factory, system_profile(), system_profile()); - TestProfileToUse(factory, system_profile_otr(), system_profile()); + bool system_experiment = IsSystemExperimentActive(); + TestProfileToUse(factory, system_profile(), + system_experiment ? nullptr : system_profile()); + TestProfileToUse(factory, system_profile_otr(), + system_experiment ? nullptr : system_profile()); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) } @@ -167,7 +189,7 @@ .Build()) {} }; -TEST_F(ProfileKeyedServiceFactoryUnittest, +TEST_P(ProfileKeyedServiceFactoryUnittest, CustomizedProfileSelectionsFactoryTest) { CustomizedProfileSelectionsFactoryTest factory; TestProfileToUse(factory, regular_profile(), regular_profile()); @@ -191,7 +213,7 @@ "DefaultRefcountedFactoryTest") {} }; -TEST_F(ProfileKeyedServiceFactoryUnittest, DefaultRefcountedFactoryTest) { +TEST_P(ProfileKeyedServiceFactoryUnittest, DefaultRefcountedFactoryTest) { DefaultRefcountedFactoryTest factory; TestProfileToUse(factory, regular_profile(), regular_profile()); TestProfileToUse(factory, incognito_profile(), nullptr); @@ -200,7 +222,9 @@ TestProfileToUse(factory, guest_profile_otr(), nullptr); #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) - TestProfileToUse(factory, system_profile(), system_profile()); + bool system_experiment = IsSystemExperimentActive(); + TestProfileToUse(factory, system_profile(), + system_experiment ? nullptr : system_profile()); TestProfileToUse(factory, system_profile_otr(), nullptr); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) } @@ -215,7 +239,7 @@ ProfileSelections::BuildForRegularAndIncognito()) {} }; -TEST_F(ProfileKeyedServiceFactoryUnittest, +TEST_P(ProfileKeyedServiceFactoryUnittest, PredefinedRefcountedProfileSelectionsFactoryTest) { PredefinedRefcountedProfileSelectionsFactoryTest factory; TestProfileToUse(factory, regular_profile(), regular_profile()); @@ -225,7 +249,14 @@ TestProfileToUse(factory, guest_profile_otr(), guest_profile_otr()); #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) - TestProfileToUse(factory, system_profile(), system_profile()); - TestProfileToUse(factory, system_profile_otr(), system_profile_otr()); + bool system_experiment = IsSystemExperimentActive(); + TestProfileToUse(factory, system_profile(), + system_experiment ? nullptr : system_profile()); + TestProfileToUse(factory, system_profile_otr(), + system_experiment ? nullptr : system_profile_otr()); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) } + +INSTANTIATE_TEST_SUITE_P(ExperimentalProfileKeyedServiceFactory, + ProfileKeyedServiceFactoryUnittest, + ::testing::Bool());
diff --git a/chrome/browser/profiles/profile_selections.cc b/chrome/browser/profiles/profile_selections.cc index bc63e58..7eae533 100644 --- a/chrome/browser/profiles/profile_selections.cc +++ b/chrome/browser/profiles/profile_selections.cc
@@ -8,6 +8,10 @@ #include "chrome/browser/profiles/profile.h" #include "components/profile_metrics/browser_profile_type.h" +const base::Feature kSystemProfileSelectionDefaultNone{ + "SystemProfileSlectionDefaultNone", + base::FeatureState::FEATURE_DISABLED_BY_DEFAULT}; + ProfileSelections::Builder::Builder() : selections_(base::WrapUnique(new ProfileSelections())) {} @@ -160,11 +164,20 @@ } if (profile->IsSystemProfile()) { - // If the default value for SystemProfile is overridden, use it. - // otherwise, redirect to the old behavior (same as regular profile). + // Default value depends on the experiment + // `kSystemProfileSelectionDefaultNone`. If experiment is active default + // value is ProfileSelection::kNone, otherwise the behavior is redirected to + // the `regular_profile_selection_` value (old default behavior). + ProfileSelection system_profile_default = + base::FeatureList::IsEnabled(kSystemProfileSelectionDefaultNone) + ? ProfileSelection::kNone + : regular_profile_selection_; + + // If the value for SystemProfileSelection is set, use it. + // Otherwise, use the default value set above. // This is used for both original system profile (not user visible) and for // the off-the-record system profile (used in the Profile Picker). - return system_profile_selection_.value_or(regular_profile_selection_); + return system_profile_selection_.value_or(system_profile_default); } NOTREACHED();
diff --git a/chrome/browser/profiles/profile_selections.h b/chrome/browser/profiles/profile_selections.h index 73d86ae5..4e452e0 100644 --- a/chrome/browser/profiles/profile_selections.h +++ b/chrome/browser/profiles/profile_selections.h
@@ -5,8 +5,20 @@ #ifndef CHROME_BROWSER_PROFILES_PROFILE_SELECTIONS_H_ #define CHROME_BROWSER_PROFILES_PROFILE_SELECTIONS_H_ +#include "base/feature_list.h" + #include "third_party/abseil-cpp/absl/types/optional.h" +// This feature flag will change the default beahvoir of +// `ProfileSelections::system_profile_selection_` when the value is not set. The +// old behavior simply follows `regular_profile_selection_` value, with the +// experiment active the default value will be `ProfileSelection::kNone`, +// meaning the default ProfileSelection for System Profile will be no profile. +// This feature flag will only affect builders that has are marked as +// `Experimental Builders` below, and any customized builder that will not +// explicitly use `ProfileSelections::Builder::WithSystem()`. +extern const base::Feature kSystemProfileSelectionDefaultNone; + class Profile; // The class `ProfileSelections` and enum `ProfileSelection` are not coupled @@ -37,6 +49,33 @@ ProfileSelections(const ProfileSelections& other); ~ProfileSelections(); + // Builder to construct the `ProfileSelections` parameters. + class Builder { + public: + Builder(); + ~Builder(); + + // Builder setters + Builder& WithRegular(ProfileSelection selection); + // Note: When Guest and Regular are not mutually exclusive on Ash and + // Lacros, a Profile can potentially return true for both + // `IsRegularProfile()` and `IsGuestSession()`. This is currently not + // supported by the API, meaning that extra code might need to be added to + // make sure all the cases are properly covered. Using the API, if both + // `IsRegularProfile()` and `IsGuestSession()` are true, Regular + // ProfileSelection logic will be used. + // TODO(crbug.com/1348572): remove this comment once `IsGuestSession()` is + // fixed. + Builder& WithGuest(ProfileSelection selection); + Builder& WithSystem(ProfileSelection selection); + + // Builds the `ProfileSelections`. + ProfileSelections Build(); + + private: + std::unique_ptr<ProfileSelections> selections_; + }; + // - Predefined `ProfileSelections` // Regular builders (independent of the experiments): @@ -207,33 +246,6 @@ bool force_guest = false, bool force_system = false); - // Builder to construct the `ProfileSelections` parameters. - class Builder { - public: - Builder(); - ~Builder(); - - // Builder setters - Builder& WithRegular(ProfileSelection selection); - // Note: When Guest and Regular are not mutually exclusive on Ash and - // Lacros, a Profile can potentially return true for both - // `IsRegularProfile()` and `IsGuestSession()`. This is currently not - // supported by the API, meaning that extra code might need to be added to - // make sure all the cases are properly covered. Using the API, if both - // `IsRegularProfile()` and `IsGuestSession()` are true, Regular - // ProfileSelection logic will be used. - // TODO(crbug.com/1348572): remove this comment once `IsGuestSession()` is - // fixed. - Builder& WithGuest(ProfileSelection selection); - Builder& WithSystem(ProfileSelection selection); - - // Builds the `ProfileSelections`. - ProfileSelections Build(); - - private: - std::unique_ptr<ProfileSelections> selections_; - }; - // Given a Profile and a ProfileSelection enum, returns the right profile // (can potentially return nullptr). Profile* ApplyProfileSelection(Profile* profile) const;
diff --git a/chrome/browser/profiles/profile_selections_unittest.cc b/chrome/browser/profiles/profile_selections_unittest.cc index 743057b0..3770b28 100644 --- a/chrome/browser/profiles/profile_selections_unittest.cc +++ b/chrome/browser/profiles/profile_selections_unittest.cc
@@ -162,16 +162,41 @@ } // Testing Experimental Builders. -// As long as the experiments are not active, force values will not have an -// effect on the expected values, the tests will be adapted to reflect that when -// taking into account the experiment. +// Params: +// - bool force_guest: used to bypass experiment and set a fixed value to the +// Guest ProfielSelection. +// - bool force_system: used to bypass experiment and set a fixed value to the +// System ProfielSelection. +// - bool system_experiment: used to activate/deactivate the +// `kSystemProfileSelectionDefaultNone` experiment. class ProfileSelectionsTestWithParams : public ProfileSelectionsTest, - public ::testing::WithParamInterface<std::tuple<bool, bool>> {}; + public ::testing::WithParamInterface<std::tuple<bool, bool, bool>> { + public: + void SetUp() override { + ProfileSelectionsTest::SetUp(); + + // TODO(rsult): move the below code to be in the + // `ProfileSelectionsTestWithParams` constructor, once the System Profile + // can be created with the experiment activated. + bool activate_system_experiment = std::get<2>(GetParam()); + feature_list_.InitWithFeatureState(kSystemProfileSelectionDefaultNone, + activate_system_experiment); + } + + protected: + bool IsSystemExperimentActive() const { + return base::FeatureList::IsEnabled(kSystemProfileSelectionDefaultNone); + } + + private: + base::test::ScopedFeatureList feature_list_; +}; TEST_P(ProfileSelectionsTestWithParams, BuildDefault) { bool force_guest = std::get<0>(GetParam()); bool force_system = std::get<1>(GetParam()); + ProfileSelections selections = ProfileSelections::BuildDefault(force_guest, force_system); @@ -182,7 +207,10 @@ TestProfileSelection(selections, guest_profile_otr(), nullptr); #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) - TestProfileSelection(selections, system_profile(), system_profile()); + bool system_experiment = IsSystemExperimentActive(); + TestProfileSelection( + selections, system_profile(), + force_system || !system_experiment ? system_profile() : nullptr); TestProfileSelection(selections, system_profile_otr(), nullptr); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) } @@ -190,6 +218,7 @@ TEST_P(ProfileSelectionsTestWithParams, BuildRedirectedInIncognito) { bool force_guest = std::get<0>(GetParam()); bool force_system = std::get<1>(GetParam()); + ProfileSelections selections = ProfileSelections::BuildRedirectedInIncognito(force_guest, force_system); @@ -200,14 +229,20 @@ TestProfileSelection(selections, guest_profile_otr(), guest_profile()); #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) - TestProfileSelection(selections, system_profile(), system_profile()); - TestProfileSelection(selections, system_profile_otr(), system_profile()); + bool system_experiment = IsSystemExperimentActive(); + TestProfileSelection( + selections, system_profile(), + force_system || !system_experiment ? system_profile() : nullptr); + TestProfileSelection( + selections, system_profile_otr(), + force_system || !system_experiment ? system_profile() : nullptr); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) } TEST_P(ProfileSelectionsTestWithParams, BuildForRegularAndIncognito) { bool force_guest = std::get<0>(GetParam()); bool force_system = std::get<1>(GetParam()); + ProfileSelections selections = ProfileSelections::BuildForRegularAndIncognito(force_guest, force_system); @@ -218,12 +253,18 @@ TestProfileSelection(selections, guest_profile_otr(), guest_profile_otr()); #if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) - TestProfileSelection(selections, system_profile(), system_profile()); - TestProfileSelection(selections, system_profile_otr(), system_profile_otr()); + bool system_experiment = IsSystemExperimentActive(); + TestProfileSelection( + selections, system_profile(), + force_system || !system_experiment ? system_profile() : nullptr); + TestProfileSelection( + selections, system_profile_otr(), + force_system || !system_experiment ? system_profile_otr() : nullptr); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID) } INSTANTIATE_TEST_SUITE_P(ExperimentalBuilders, ProfileSelectionsTestWithParams, ::testing::Combine(::testing::Bool(), + ::testing::Bool(), ::testing::Bool()));
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts b/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts index bb34b32c..43cccf3 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/passwords_import_dialog.ts
@@ -161,11 +161,13 @@ this.results_ = await this.passwordManager_.importPasswords(destinationStore); this.inProgress_ = false; + // TODO(crbug/1325290): set appropriate string for MAX_FILE_SIZE. switch (this.results_.status) { case chrome.passwordsPrivate.ImportResultsStatus.SUCCESS: this.handleSuccess_(); break; case chrome.passwordsPrivate.ImportResultsStatus.IO_ERROR: + case chrome.passwordsPrivate.ImportResultsStatus.MAX_FILE_SIZE: case chrome.passwordsPrivate.ImportResultsStatus.UNKNOWN_ERROR: this.descriptionText_ = this.i18n('importPasswordsUnknownError'); this.dialogState = ImportDialogState.ERROR;
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc index c156d3d..97d66e3 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc
@@ -35,6 +35,7 @@ #include "content/public/browser/global_routing_id.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "content/public/test/fenced_frame_test_util.h" #include "content/public/test/prerender_test_util.h" #include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_utils.h" @@ -560,8 +561,13 @@ return prerender_helper_; } + content::test::FencedFrameTestHelper& fenced_frame_helper() { + return fenced_frame_helper_; + } + private: content::test::PrerenderTestHelper prerender_helper_; + content::test::FencedFrameTestHelper fenced_frame_helper_; base::test::ScopedFeatureList scoped_feature_list_; }; @@ -2828,6 +2834,178 @@ } IN_PROC_BROWSER_TEST_F(SBNavigationObserverBrowserTest, + FencedFrameNavigationEventsAndReferrerChain) { + const auto test_server_ip(embedded_test_server()->host_port_pair().host()); + const auto main_frame_url = + embedded_test_server()->GetURL("a.test", "/title1.html"); + ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), main_frame_url)); + const auto outermost_rfh_id = + web_contents()->GetPrimaryMainFrame()->GetGlobalId(); + + const auto fenced_frame_gurl = + embedded_test_server()->GetURL("b.test", "/fenced_frames/title1.html"); + auto* ff_rfh = fenced_frame_helper().CreateFencedFrame( + web_contents()->GetPrimaryMainFrame(), fenced_frame_gurl); + ASSERT_TRUE(ff_rfh); + + // Expects the same non-null index. + auto index_a = FindNavigationEventIndex(main_frame_url, + content::GlobalRenderFrameHostId()); + auto index_b = FindNavigationEventIndex(main_frame_url, outermost_rfh_id); + ASSERT_TRUE(index_a.has_value()); + ASSERT_EQ(index_a, index_b); + + // Expects the same non-null index. + auto index_c = FindNavigationEventIndex(fenced_frame_gurl, + content::GlobalRenderFrameHostId()); + auto index_d = FindNavigationEventIndex(fenced_frame_gurl, outermost_rfh_id); + ASSERT_TRUE(index_c.has_value()); + ASSERT_EQ(index_c, index_d); + + // Main frame initial navigation and fenced frame initial navigation. + ASSERT_EQ(navigation_event_list()->NavigationEventsSize(), 2U); + // Main frame. + VerifyNavigationEvent(GURL(), // source_url + GURL(), // source_main_frame_url + main_frame_url, // original_request_url + main_frame_url, // destination_url + true, // is_user_initiated, + true, // has_committed + false, // has_server_redirect + navigation_event_list()->GetNavigationEvent(0)); + // Fenced frame initial navigation. The FencedFrame navigation is not + // user-initiated by setting the `src` attribute. + VerifyNavigationEvent(GURL(), // source_url + main_frame_url, // source_main_frame_url + fenced_frame_gurl, // original_request_url + fenced_frame_gurl, // destination_url + false, // is_user_initiated, + true, // has_committed + false, // has_server_redirect + navigation_event_list()->GetNavigationEvent(1)); + + ReferrerChain referrer_chain; + IdentifyReferrerChainByEventURL( + fenced_frame_gurl, sessions::SessionTabHelper::IdForTab(web_contents()), + outermost_rfh_id, &referrer_chain); + ASSERT_EQ(2, referrer_chain.size()); + + // The fenced frame's `NavigationEvent` will not have `source_url` because the + // last committed URL is empty (coming from `about:blank`), thus the entry's + // `referrer_url` is empty. + // The `source_main_frame_url` of the event is retrieved from the embedder + // page, and since it is different from the `source_url` of the event, it is + // stored at the entry's `referrer_main_frame_url`. + VerifyReferrerChainEntry( + fenced_frame_gurl, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + GURL(), // referrer_url + main_frame_url, // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + + VerifyReferrerChainEntry(main_frame_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + GURL(), // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, + referrer_chain.Get(1)); + + // Navigates the fenced frame. + const auto fenced_frame_gurl2 = + embedded_test_server()->GetURL("c.test", "/fenced_frames/title1.html"); + ff_rfh = fenced_frame_helper().NavigateFrameInFencedFrameTree( + ff_rfh, fenced_frame_gurl2); + ASSERT_TRUE(ff_rfh); + + // Main frame initial navigation, fenced frame initial navigation and fenced + // frame second navigation. + ASSERT_EQ(navigation_event_list()->NavigationEventsSize(), 3U); + // Main frame. + VerifyNavigationEvent(GURL(), // source_url + GURL(), // source_main_frame_url + main_frame_url, // original_request_url + main_frame_url, // destination_url + true, // is_user_initiated, + true, // has_committed + false, // has_server_redirect + navigation_event_list()->GetNavigationEvent(0)); + // Fenced frame initial navigation. + VerifyNavigationEvent(GURL(), // source_url + main_frame_url, // source_main_frame_url + fenced_frame_gurl, // original_request_url + fenced_frame_gurl, // destination_url + false, // is_user_initiated, + true, // has_committed + false, // has_server_redirect + navigation_event_list()->GetNavigationEvent(1)); + // Fenced frame second navigation. + VerifyNavigationEvent(fenced_frame_gurl, // source_url + main_frame_url, // source_main_frame_url + fenced_frame_gurl2, // original_request_url + fenced_frame_gurl2, // destination_url + false, // is_user_initiated, + true, // has_committed + false, // has_server_redirect + navigation_event_list()->GetNavigationEvent(2)); + + // Three entries. + referrer_chain.Clear(); + IdentifyReferrerChainByEventURL( + fenced_frame_gurl2, sessions::SessionTabHelper::IdForTab(web_contents()), + outermost_rfh_id, &referrer_chain); + ASSERT_EQ(3, referrer_chain.size()); + + // For the second fenced frame navigation, we have a valid `referrer_url`. + VerifyReferrerChainEntry( + fenced_frame_gurl2, // url + GURL(), // main_frame_url + ReferrerChainEntry::EVENT_URL, // type + test_server_ip, // ip_address + fenced_frame_gurl, // referrer_url + main_frame_url, // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(0)); + + // Almost identical to the initial fenced frame navigation entry, except for + // that the `type` is `CLIENT_REDIRECT` instead of `EVENT_URL`. Because of the + // new `type` we also have a non-empty `main_frame_url`. + VerifyReferrerChainEntry( + fenced_frame_gurl, // url + main_frame_url, // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + GURL(), // referrer_url + main_frame_url, // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::RENDERER_INITIATED_WITHOUT_USER_GESTURE, + referrer_chain.Get(1)); + + // Same as the main frame entry prior to the second fenced frame navigation. + VerifyReferrerChainEntry(main_frame_url, // url + GURL(), // main_frame_url + ReferrerChainEntry::CLIENT_REDIRECT, // type + test_server_ip, // ip_address + GURL(), // referrer_url + GURL(), // referrer_main_frame_url + false, // is_retargeting + std::vector<GURL>(), // server redirects + ReferrerChainEntry::BROWSER_INITIATED, + referrer_chain.Get(2)); +} + +IN_PROC_BROWSER_TEST_F(SBNavigationObserverBrowserTest, NavigateBackwardForward) { ASSERT_TRUE(ui_test_utils::NavigateToURL( browser(), embedded_test_server()->GetURL(kSingleFrameTestURL)));
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 05cc7d3..ffa507a 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -2582,6 +2582,8 @@ "webui/chromeos/certificate_manager_dialog_ui.h", "webui/chromeos/cloud_upload/cloud_upload_dialog.cc", "webui/chromeos/cloud_upload/cloud_upload_dialog.h", + "webui/chromeos/cloud_upload/cloud_upload_handler.cc", + "webui/chromeos/cloud_upload/cloud_upload_handler.h", "webui/chromeos/cloud_upload/cloud_upload_page_handler.cc", "webui/chromeos/cloud_upload/cloud_upload_page_handler.h", "webui/chromeos/cloud_upload/cloud_upload_ui.cc",
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc index 9ab15d8..9580d3c 100644 --- a/chrome/browser/ui/browser_navigator_browsertest.cc +++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -785,7 +785,7 @@ #if !BUILDFLAG(IS_CHROMEOS_LACROS) // This test verifies that "switch to tab" prefers the latest used browser, // if multiple exist. -IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, SwitchToTabLatestWindow) { +IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest, DISABLED_SwitchToTabLatestWindow) { // Navigate to a site. NavigateHelper(GURL("http://maps.google.com/"), browser(), WindowOpenDisposition::CURRENT_TAB, true);
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc index 702208b..e86a68d 100644 --- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc +++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -852,10 +852,13 @@ } bool ManagePasswordsUIController::ShowAuthenticationDialog() { +// TODO(crbug.com/1353344): Use biometric authentication to reveal password in +// the bubble. #if BUILDFLAG(IS_WIN) return password_manager_util_win::AuthenticateUser( web_contents()->GetNativeView(), - password_manager::ReauthPurpose::VIEW_PASSWORD); + password_manager_util_win::GetMessageForLoginPrompt( + password_manager::ReauthPurpose::VIEW_PASSWORD)); #elif BUILDFLAG(IS_MAC) return password_manager_util_mac::AuthenticateUser( password_manager::ReauthPurpose::VIEW_PASSWORD);
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc index 5bd2e111..f3e9915 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest_mac_win_linux.cc
@@ -73,6 +73,29 @@ helper_.CheckSiteNotHandlesFile(Site::kStandalone, "quux"); } +IN_PROC_BROWSER_TEST_F(WebAppIntegration, CheckLaunchFileExpectDialog) { + helper_.InstallOmniboxIcon(InstallableSite::kFileHandler); + helper_.ClosePwa(); + helper_.LaunchFileExpectDialog(Site::kFileHandler, FilesOptions::kOneTextFile, + AllowDenyOptions::kAllow, + AskAgainOptions::kAskAgain); + helper_.CheckWindowCreated(); +} + +IN_PROC_BROWSER_TEST_F(WebAppIntegration, CheckLaunchFileExpectNoDialog) { + helper_.InstallOmniboxIcon(InstallableSite::kFileHandler); + helper_.ClosePwa(); + // Open the file and set AskAgainOption to kRemember. + helper_.LaunchFileExpectDialog(Site::kFileHandler, FilesOptions::kOneTextFile, + AllowDenyOptions::kAllow, + AskAgainOptions::kRemember); + helper_.ClosePwa(); + // Open the file again. + helper_.LaunchFileExpectNoDialog(Site::kFileHandler, + FilesOptions::kOneTextFile); + helper_.CheckWindowCreated(); +} + // Generated tests: IN_PROC_BROWSER_TEST_F(
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc b/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc index b36d2c7..a46c139 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc
@@ -17,6 +17,7 @@ #include "base/files/file_util.h" #include "base/memory/raw_ptr.h" #include "base/notreached.h" +#include "base/path_service.h" #include "base/strings/pattern.h" #include "base/strings/strcat.h" #include "base/strings/string_util.h" @@ -39,6 +40,7 @@ #include "chrome/browser/ui/browser_list.h" #include "chrome/browser/ui/intent_picker_tab_helper.h" #include "chrome/browser/ui/startup/startup_browser_creator.h" +#include "chrome/browser/ui/startup/web_app_startup_utils.h" #include "chrome/browser/ui/views/frame/browser_view.h" #include "chrome/browser/ui/views/frame/browser_view_layout.h" #include "chrome/browser/ui/views/frame/toolbar_button_provider.h" @@ -47,6 +49,7 @@ #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h" #include "chrome/browser/ui/views/page_info/page_info_view_factory.h" #include "chrome/browser/ui/views/toolbar/toolbar_view.h" +#include "chrome/browser/ui/views/web_apps/file_handler_launch_dialog_view.h" #include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" #include "chrome/browser/ui/web_applications/web_app_dialog_utils.h" @@ -78,6 +81,7 @@ #include "chrome/browser/web_applications/web_app_sync_bridge.h" #include "chrome/browser/web_applications/web_app_utils.h" #include "chrome/common/chrome_features.h" +#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/webui_url_constants.h" @@ -109,6 +113,7 @@ #include "ui/accessibility/ax_action_data.h" #include "ui/views/controls/button/image_button.h" #include "ui/views/test/dialog_test.h" +#include "ui/views/test/widget_test.h" #include "ui/views/widget/widget.h" #include "ui/webui/resources/cr_components/app_management/app_management.mojom-forward.h" @@ -161,6 +166,8 @@ return Site::kWco; case InstallableSite::kIsolated: return Site::kIsolated; + case InstallableSite::kFileHandler: + return Site::kFileHandler; } } @@ -256,7 +263,15 @@ .relative_manifest_id = "basic.html", .app_name = "Isolated App", .wco_not_enabled_title = u"Isolated App", - .icon_color = SK_ColorGREEN}}}; + .icon_color = SK_ColorGREEN}}, + {Site::kFileHandler, + {.relative_scope_url = "/web_apps/file_handler/", + .relative_start_url = "/web_apps/file_handler/basic.html", + .relative_manifest_id = "web_apps/file_handler/basic.html", + .app_name = "File Handler", + .wco_not_enabled_title = u"File Handler", + .icon_color = SK_ColorBLACK}}, +}; struct DisplayConfig { std::string manifest_url_param; @@ -1221,6 +1236,50 @@ #endif } +base::FilePath WebAppIntegrationTestDriver::GetResourceFile( + base::FilePath::StringPieceType relative_path) { + base::FilePath base_dir; + if (!base::PathService::Get(chrome::DIR_TEST_DATA, &base_dir)) + return base::FilePath(); + base::FilePath full_path = base_dir.Append(relative_path); + { + base::ScopedAllowBlockingForTesting scoped_allow_blocking; + if (!PathExists(full_path)) + return base::FilePath(); + } + return full_path; +} + +std::vector<base::FilePath> WebAppIntegrationTestDriver::GetTestFilePaths( + FilesOptions files_options) { + std::vector<base::FilePath> file_paths; + base::FilePath txt_file_path = GetResourceFile( + FILE_PATH_LITERAL("web_apps/files/file_handler_test.txt")); + base::FilePath png_file_path = GetResourceFile( + FILE_PATH_LITERAL("web_apps/files/file_handler_test.png")); + switch (files_options) { + case FilesOptions::kOneTextFile: + file_paths.push_back(txt_file_path); + break; + case FilesOptions::kMultipleTextFiles: + file_paths.push_back(txt_file_path); + file_paths.push_back(txt_file_path); + break; + case FilesOptions::kOnePngFile: + file_paths.push_back(png_file_path); + break; + case FilesOptions::kMultiplePngFiles: + file_paths.push_back(png_file_path); + file_paths.push_back(png_file_path); + break; + case FilesOptions::kAllTextAndPngFiles: + file_paths.push_back(txt_file_path); + file_paths.push_back(png_file_path); + break; + } + return file_paths; +} + void WebAppIntegrationTestDriver::NavigateBrowser(Site site) { if (!BeforeStateChangeAction(__FUNCTION__)) return; @@ -1448,6 +1507,7 @@ #endif observer.Wait(); + site_remember_deny_open_file.erase(site); AfterStateChangeAction(); } @@ -1482,6 +1542,8 @@ // Wait for app settings page to be closed. destroyed_watcher.Wait(); + site_remember_deny_open_file.erase(site); + AfterStateChangeAction(); #else NOTREACHED() << "Not implemented on Chrome OS."; @@ -1519,6 +1581,7 @@ // the app_browser. app_menu_model.reset(); observer.Wait(); + site_remember_deny_open_file.erase(site); AfterStateChangeAction(); } @@ -1555,6 +1618,7 @@ ASSERT_GT(removed_count, 0U); } run_loop.Run(); + site_remember_deny_open_file.erase(site); AfterStateChangeAction(); } @@ -1579,6 +1643,7 @@ {profile()->GetPath(), StartupProfileMode::kBrowserWindow}); observer.Wait(); + site_remember_deny_open_file.erase(site); AfterStateChangeAction(); #else NOTREACHED() << "Not supported on non-Windows platforms"; @@ -1781,6 +1846,86 @@ AfterStateCheckAction(); } +void WebAppIntegrationTestDriver::LaunchFileExpectDialog( + Site site, + FilesOptions files_options, + AllowDenyOptions allow_deny, + AskAgainOptions ask_again) { + BeforeStateChangeAction(__FUNCTION__); + AppId app_id = GetAppIdBySiteMode(site); + views::NamedWidgetShownWaiter waiter(views::test::AnyWidgetTestPasskey{}, + "FileHandlerLaunchDialogView"); + FileHandlerLaunchDialogView::SetDefaultRememberSelectionForTesting( + ask_again == AskAgainOptions::kRemember); + std::vector<base::FilePath> file_paths = GetTestFilePaths(files_options); + + StartupBrowserCreator browser_creator; + base::CommandLine command_line(base::CommandLine::NO_PROGRAM); + command_line.AppendSwitchASCII(switches::kAppId, app_id); + for (auto file_path : file_paths) { + command_line.AppendArgPath(file_path); + } + browser_creator.Start(command_line, profile()->GetPath(), + {profile(), StartupProfileMode::kBrowserWindow}, {}); + BrowserAddedWaiter browser_added_waiter; + + // Check the file handling dialog shows up. + views::Widget* widget = waiter.WaitIfNeededAndGet(); + ASSERT_TRUE(widget != nullptr); + + views::test::WidgetDestroyedWaiter destroyed_waiter(widget); + views::Widget::ClosedReason close_reason; + if (allow_deny == AllowDenyOptions::kDeny) { + close_reason = views::Widget::ClosedReason::kCancelButtonClicked; + if (ask_again == AskAgainOptions::kRemember) { + site_remember_deny_open_file.emplace(site); + } + } else { + close_reason = views::Widget::ClosedReason::kAcceptButtonClicked; + } + // File handling dialog should be destroyed after choosing the action. + widget->CloseWithReason(close_reason); + destroyed_waiter.Wait(); + + if (allow_deny == AllowDenyOptions::kAllow) { + browser_added_waiter.Wait(); + app_browser_ = browser_added_waiter.browser_added(); + ActivateBrowserAndWait(app_browser_); + EXPECT_EQ(app_browser()->app_controller()->app_id(), app_id); + } + AfterStateChangeAction(); +} + +void WebAppIntegrationTestDriver::LaunchFileExpectNoDialog( + Site site, + FilesOptions files_options) { + BeforeStateChangeAction(__FUNCTION__); + AppId app_id = GetAppIdBySiteMode(site); + std::vector<base::FilePath> file_paths = GetTestFilePaths(files_options); + BrowserAddedWaiter browser_added_waiter; + base::RunLoop run_loop; + + web_app::startup::SetStartupDoneCallbackForTesting(run_loop.QuitClosure()); + StartupBrowserCreator browser_creator; + base::CommandLine command_line(base::CommandLine::NO_PROGRAM); + command_line.AppendSwitchASCII(switches::kAppId, app_id); + for (auto file_path : file_paths) { + command_line.AppendArgPath(file_path); + } + browser_creator.Start(command_line, profile()->GetPath(), + {profile(), StartupProfileMode::kBrowserWindow}, {}); + run_loop.Run(); + + // if the web app doesn't deny to open the file, wait for the app window. + if (!base::Contains(site_remember_deny_open_file, site)) { + app_browser_ = browser_added_waiter.browser_added(); + ActivateBrowserAndWait(app_browser_); + EXPECT_EQ(app_browser()->app_controller()->app_id(), app_id); + } + + AfterStateChangeAction(); +} + void WebAppIntegrationTestDriver::CheckWindowModeIsNotVisibleInAppSettings( Site site) { #if !BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.h b/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.h index bb30ae4..a79c5e58 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.h +++ b/chrome/browser/ui/views/web_apps/web_app_integration_test_driver.h
@@ -49,6 +49,7 @@ kNotPromotable, kWco, kIsolated, + kFileHandler, }; enum class InstallableSite { @@ -57,7 +58,8 @@ kStandaloneNestedB, kMinimalUi, kWco, - kIsolated + kIsolated, + kFileHandler, }; enum class Title { kStandaloneOriginal, kStandaloneUpdated }; @@ -78,6 +80,20 @@ enum class ShortcutOptions { kWithShortcut, kNoShortcut }; +enum class AllowDenyOptions { kAllow, kDeny }; + +enum class AskAgainOptions { kAskAgain, kRemember }; + +enum class FileExtension { kTxt, kPng }; + +enum class FilesOptions { + kOneTextFile, + kMultipleTextFiles, + kOnePngFile, + kMultiplePngFiles, + kAllTextAndPngFiles +}; + // These structs are used to store the current state of the world before & after // each state-change action. @@ -251,6 +267,11 @@ void CheckAppNotInList(Site site); void CheckAppIcon(Site site, Color color); void CheckAppTitle(Site site, Title title); + void LaunchFileExpectDialog(Site site, + FilesOptions files_options, + AllowDenyOptions allow_deny, + AskAgainOptions ask_again); + void LaunchFileExpectNoDialog(Site site, FilesOptions files_options); void CheckWindowModeIsNotVisibleInAppSettings(Site site); void CheckInstallable(); void CheckInstallIconShown(); @@ -347,6 +368,10 @@ void CheckAppSettingsAppState(Profile* profile, const AppState& app_state); + base::FilePath GetResourceFile(base::FilePath::StringPieceType relative_path); + + std::vector<base::FilePath> GetTestFilePaths(FilesOptions file_options); + Browser* browser(); Profile* profile() { if (!active_profile_) { @@ -405,6 +430,8 @@ std::unique_ptr<net::EmbeddedTestServer> isolated_app_test_server_ = nullptr; std::unique_ptr<base::RunLoop> window_controls_overlay_callback_for_testing_ = nullptr; + + base::flat_set<Site> site_remember_deny_open_file; }; // Simple base browsertest class usable by all non-sync web app integration
diff --git a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.cc b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.cc index 3bcdc12..cf6ff06 100644 --- a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.cc +++ b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.cc
@@ -7,19 +7,25 @@ #include "base/callback.h" #include "base/json/json_writer.h" #include "base/logging.h" +#include "chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_handler.h" #include "chrome/common/webui_url_constants.h" namespace chromeos::cloud_upload { namespace { -void OnUploadActionReceived(const std::string& action) { - LOG(ERROR) << "ACTION: " << action; +void OnUploadActionReceived(Profile* profile, + const storage::FileSystemURL& file_url, + const std::string& action) { + if (action == kUserActionUpload) { + UploadToCloud(profile, file_url); + } } } // namespace // static bool CloudUploadDialog::Show( + Profile* profile, const std::vector<storage::FileSystemURL>& file_urls) { // Allow no more than one upload dialog at a time. In the case of multiple // upload requests, they should either be handled simultaneously or queued. @@ -34,8 +40,8 @@ // The pointer is managed by an instance of `views::WebDialogView` and removed // in `SystemWebDialogDelegate::OnDialogClosed`. - CloudUploadDialog* dialog = - new CloudUploadDialog(file_url, base::BindOnce(&OnUploadActionReceived)); + CloudUploadDialog* dialog = new CloudUploadDialog( + file_url, base::BindOnce(&OnUploadActionReceived, profile, file_url)); dialog->ShowSystemDialog(); return true;
diff --git a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.h b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.h index bb0e48f..d35a10f 100644 --- a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.h +++ b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_dialog.h
@@ -10,6 +10,8 @@ #include "chrome/browser/ui/webui/chromeos/system_web_dialog_delegate.h" #include "storage/browser/file_system/file_system_url.h" +class Profile; + namespace chromeos::cloud_upload { // The string conversions of chromeos::cloud_upload::mojom::UserAction. @@ -27,7 +29,8 @@ // Creates and shows a new dialog for the cloud upload workflow. Returns true // if a new dialog has been effectively created. - static bool Show(const std::vector<storage::FileSystemURL>& file_urls); + static bool Show(Profile* profile, + const std::vector<storage::FileSystemURL>& file_urls); void OnDialogClosed(const std::string& json_retval) override;
diff --git a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_handler.cc b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_handler.cc new file mode 100644 index 0000000..58cc4d1d --- /dev/null +++ b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_handler.cc
@@ -0,0 +1,80 @@ +// Copyright 2022 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. + +#include "chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_handler.h" + +#include "chrome/browser/ash/file_manager/copy_or_move_io_task.h" +#include "chrome/browser/ash/file_manager/fileapi_util.h" +#include "chrome/browser/ash/file_manager/volume_manager.h" +#include "url/gurl.h" + +namespace chromeos::cloud_upload { +namespace { + +// The default folder where the file should be uploaded. +const char kDestinationFolder[] = "from Chromebook"; + +storage::FileSystemURL FilePathToFileSystemURL( + Profile* profile, + storage::FileSystemContext* file_system_context, + base::FilePath file_path) { + GURL url; + if (!file_manager::util::ConvertAbsoluteFilePathToFileSystemUrl( + profile, file_path, file_manager::util::GetFileManagerURL(), &url)) { + LOG(ERROR) << "Unable to ConvertAbsoluteFilePathToFileSystemUrl"; + return storage::FileSystemURL(); + } + + return file_system_context->CrackURLInFirstPartyContext(url); +} + +} // namespace + +base::FilePath GenerateDestinationPath(Profile* profile) { + drive::DriveIntegrationService* integration_service = + drive::DriveIntegrationServiceFactory::FindForProfile(profile); + return integration_service + ? integration_service->GetMountPointPath().Append("root").Append( + kDestinationFolder) + : base::FilePath(); +} + +void UploadToCloud(Profile* profile, const storage::FileSystemURL& file_url) { + file_manager::VolumeManager* const volume_manager = + file_manager::VolumeManager::Get(profile); + // TODO (b/243095484) Define error behavior. + if (!volume_manager || !volume_manager->io_task_controller()) { + LOG(ERROR) << "No volume_manager or task_controller"; + return; + } + + // Filesystem context. + storage::FileSystemContext* file_system_context = + file_manager::util::GetFileSystemContextForSourceURL( + profile, file_manager::util::GetFileManagerURL()); + + // Source and destination urls. + std::vector<storage::FileSystemURL> source_urls{file_url}; + base::FilePath destination_folder_path = GenerateDestinationPath(profile); + // TODO (b/243095484) Define error behavior. + if (destination_folder_path.empty()) { + LOG(ERROR) << "Unable to generate destination folder, the drive " + "integration service might not be available."; + return; + } + storage::FileSystemURL destination_folder_url = FilePathToFileSystemURL( + profile, file_system_context, destination_folder_path); + + // TODO (b/242685159) Change copy to move. + std::unique_ptr<file_manager::io_task::IOTask> task = + std::make_unique<file_manager::io_task::CopyOrMoveIOTask>( + file_manager::io_task::OperationType::kCopy, std::move(source_urls), + std::move(destination_folder_url), profile, file_system_context); + + const auto taskId = + volume_manager->io_task_controller()->Add(std::move(task)); + LOG(ERROR) << taskId; +} + +} // namespace chromeos::cloud_upload
diff --git a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_handler.h b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_handler.h new file mode 100644 index 0000000..f62a7ec --- /dev/null +++ b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_handler.h
@@ -0,0 +1,21 @@ +// Copyright 2022 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 CHROME_BROWSER_UI_WEBUI_CHROMEOS_CLOUD_UPLOAD_CLOUD_UPLOAD_HANDLER_H_ +#define CHROME_BROWSER_UI_WEBUI_CHROMEOS_CLOUD_UPLOAD_CLOUD_UPLOAD_HANDLER_H_ + +#include "base/files/file_path.h" +#include "storage/browser/file_system/file_system_url.h" + +class Profile; + +namespace chromeos::cloud_upload { + +base::FilePath GenerateDestinationPath(Profile* profile); + +void UploadToCloud(Profile* profile, const storage::FileSystemURL& file_url); + +} // namespace chromeos::cloud_upload + +#endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_CLOUD_UPLOAD_CLOUD_UPLOAD_HANDLER_H_
diff --git a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_page_handler.cc b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_page_handler.cc index 63b5775..a6c85a8 100644 --- a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_page_handler.cc +++ b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_page_handler.cc
@@ -5,20 +5,23 @@ #include "chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_page_handler.h" #include "base/files/file_path.h" +#include "chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_handler.h" namespace chromeos::cloud_upload { CloudUploadPageHandler::CloudUploadPageHandler( + Profile* profile, mojo::PendingReceiver<chromeos::cloud_upload::mojom::PageHandler> pending_page_handler, RespondAndCloseCallback callback) - : receiver_{this, std::move(pending_page_handler)}, + : profile_(profile), + receiver_{this, std::move(pending_page_handler)}, callback_{std::move(callback)} {} CloudUploadPageHandler::~CloudUploadPageHandler() = default; void CloudUploadPageHandler::GetUploadPath(GetUploadPathCallback callback) { - std::move(callback).Run(std::move(base::FilePath("/from Chromebook"))); + std::move(callback).Run(GenerateDestinationPath(profile_)); } void CloudUploadPageHandler::RespondAndClose(mojom::UserAction action) {
diff --git a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_page_handler.h b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_page_handler.h index 84109e0..2cb88572 100644 --- a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_page_handler.h +++ b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_page_handler.h
@@ -7,6 +7,7 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload.mojom-shared.h" #include "chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" @@ -24,6 +25,7 @@ using RespondAndCloseCallback = base::OnceCallback<void(mojom::UserAction action)>; explicit CloudUploadPageHandler( + Profile* profile, mojo::PendingReceiver<chromeos::cloud_upload::mojom::PageHandler> pending_page_handler, RespondAndCloseCallback callback); @@ -38,6 +40,7 @@ void RespondAndClose(mojom::UserAction action) override; private: + Profile* profile_; mojo::Receiver<chromeos::cloud_upload::mojom::PageHandler> receiver_; RespondAndCloseCallback callback_;
diff --git a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_ui.cc b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_ui.cc index d2a2620..37a060a0 100644 --- a/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_ui.cc +++ b/chrome/browser/ui/webui/chromeos/cloud_upload/cloud_upload_ui.cc
@@ -40,7 +40,7 @@ mojo::PendingReceiver<chromeos::cloud_upload::mojom::PageHandler> receiver) { page_handler_ = std::make_unique<CloudUploadPageHandler>( - std::move(receiver), + Profile::FromWebUI(web_ui()), std::move(receiver), // base::Unretained() because |page_handler_| will not out-live |this|. base::BindOnce(&CloudUploadUI::RespondAndCloseDialog, base::Unretained(this)));
diff --git a/chrome/browser/ui/webui/chromeos/login/saml_challenge_key_handler.cc b/chrome/browser/ui/webui/chromeos/login/saml_challenge_key_handler.cc index f76621b..a3268fa 100644 --- a/chrome/browser/ui/webui/chromeos/login/saml_challenge_key_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/saml_challenge_key_handler.cc
@@ -10,10 +10,16 @@ #include "base/metrics/histogram_functions.h" #include "base/values.h" #include "chrome/browser/ash/attestation/tpm_challenge_key_result.h" +#include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/ash/settings/cros_settings.h" +#include "chrome/browser/enterprise/connectors/connectors_prefs.h" #include "chrome/browser/profiles/profile.h" +#include "chromeos/ash/components/install_attributes/install_attributes.h" #include "chromeos/login/login_state/login_state.h" #include "components/content_settings/core/common/content_settings_pattern.h" +#include "components/prefs/pref_service.h" + +using enterprise_connectors::kContextAwareAccessSignalsAllowlistPref; namespace chromeos { @@ -24,24 +30,17 @@ const size_t kPatternsSizeWarningLevel = 500; -// Checks if `url` matches one of the `patterns`. -bool IsDeviceWebBasedAttestationEnabledForUrl(const GURL& url, - const base::ListValue* patterns) { - if (!patterns) { - return false; - } - +bool UrlMatchesPattern(const GURL& url, const base::Value::List& patterns) { if (!url.SchemeIs(url::kHttpsScheme)) { return false; } - if (patterns->GetListDeprecated().size() >= kPatternsSizeWarningLevel) { - LOG(WARNING) << "Allowed urls list size is " - << patterns->GetListDeprecated().size() + if (patterns.size() >= kPatternsSizeWarningLevel) { + LOG(WARNING) << "Allowed urls list size is " << patterns.size() << ". Check may be slow."; } - for (const base::Value& cur_pattern : patterns->GetListDeprecated()) { + for (const base::Value& cur_pattern : patterns) { if (ContentSettingsPattern::FromString(cur_pattern.GetString()) .Matches(url)) { return true; @@ -49,6 +48,20 @@ } return false; } + +bool AreContextAwareAccessSignalsEnabledForUrl(const GURL& url, + const Profile* profile) { + const PrefService* prefs = profile->GetPrefs(); + if (!prefs || !prefs->HasPrefPath(kContextAwareAccessSignalsAllowlistPref)) + return false; + + if (!ash::ProfileHelper::IsRegularProfile(profile) && + !prefs->IsManagedPreference(kContextAwareAccessSignalsAllowlistPref)) + return false; + + return UrlMatchesPattern( + url, prefs->GetValueList(kContextAwareAccessSignalsAllowlistPref)); +} } // namespace SamlChallengeKeyHandler::SamlChallengeKeyHandler() = default; @@ -107,13 +120,22 @@ break; } - if (!IsDeviceWebBasedAttestationEnabledForUrl(url, patterns)) { + if (!patterns || !UrlMatchesPattern(url, patterns->GetList())) { ReturnResult(attestation::TpmChallengeKeyResult::MakeError( attestation::TpmChallengeKeyResultCode:: kDeviceWebBasedAttestationUrlError)); return; } + // Prioritize Context Aware Signals over VerifiedAccess if both are defined + // for the same endpoint, since they are both reacting to the same VA + // Challenge + if (AreContextAwareAccessSignalsEnabledForUrl(url, profile_)) { + ReturnResult(attestation::TpmChallengeKeyResult::MakeError( + attestation::TpmChallengeKeyResultCode::kDeviceTrustURLConflictError)); + return; + } + BuildChallengeResponse(); }
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index c9f57d0..407fd91 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1661299134-dd8a33bd0fb7bbc61802480248f8e7daaa8f8f81.profdata +chrome-mac-arm-main-1661320161-e537fead2ff748486ad55a35e80eb00f3a61be3f.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index f981c1c..8b7e947 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1661299134-c7e43688780ec4dd5310db230063065cd74eea3b.profdata +chrome-mac-main-1661320161-5563ae332672575e425ea12c51c6bf780a25ff6b.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 1b84b6a9..6d487ab 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1661309567-aff083999221e91587afc383fe666d26924e1e78.profdata +chrome-win32-main-1661331552-f0339f0eff23f7dd93f1c3a150192b8dc0dcb5c2.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 474f15e..20618d2 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1661309567-4607aca817f42433c3a796294851df52420642fa.profdata +chrome-win64-main-1661331552-16f28d6ad03874c8f71b0bda4410d38c6b5c4271.profdata
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index ee7c564..6b51402a 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3115,6 +3115,17 @@ ] } + if (is_chromeos_ash) { + sources += [ "../browser/enterprise/connectors/device_trust/signals/decorators/ash/ash_signals_decorator_browsertest.cc" ] + + deps += [ + "//chrome/browser/enterprise/connectors/device_trust:features", + "//chrome/browser/enterprise/connectors/device_trust/common", + "//components/device_signals/core/common", + "//components/device_signals/core/common:features", + ] + } + if (is_win) { sources += [ "../browser/safe_browsing/chrome_cleaner/chrome_cleaner_dialog_controller_impl_browsertest_win.cc", @@ -4159,6 +4170,7 @@ "//chrome/browser/chromeos:dlp_policy_event_proto", "//chrome/browser/chromeos:key_permissions_proto", "//chrome/browser/chromeos:test_support", + "//chrome/browser/enterprise/connectors/device_trust:features", "//chrome/browser/image_decoder", "//chrome/browser/media/router:test_support", "//chrome/browser/metrics/structured", @@ -5163,7 +5175,6 @@ "../browser/content_settings/page_specific_content_settings_unittest.cc", "../browser/content_settings/sound_content_setting_observer_unittest.cc", "../browser/custom_handlers/chrome_protocol_handler_registry_unittest.cc", - "../browser/device_reauth/chrome_biometric_authenticator_common_unittest.cc", "../browser/download/chrome_download_manager_delegate_unittest.cc", "../browser/download/deferred_client_wrapper_unittest.cc", "../browser/download/download_history_unittest.cc", @@ -5966,6 +5977,7 @@ "../browser/chrome_browser_main_win_unittest.cc", "../browser/chrome_process_singleton_win_unittest.cc", "../browser/component_updater/sw_reporter_installer_win_unittest.cc", + "../browser/device_reauth/win/biometric_authenticator_win_unittest.cc", "../browser/install_verification/win/module_info_unittest.cc", "../browser/install_verification/win/module_list_unittest.cc", "../browser/install_verification/win/module_verification_test.cc", @@ -6189,6 +6201,10 @@ deps += [ "//chrome/browser/webshare:unit_tests" ] } + if (is_win || is_mac || is_android) { + sources += [ "../browser/device_reauth/chrome_biometric_authenticator_common_unittest.cc" ] + } + if (enable_dice_support) { sources += [ "../browser/password_manager/multi_profile_credentials_filter_unittest.cc", @@ -8308,6 +8324,7 @@ if (is_linux || is_chromeos_ash || is_mac || is_win) { sources += [ + "../browser/enterprise/connectors/device_trust/device_trust_connector_service_factory_unittest.cc", "../browser/enterprise/connectors/device_trust/device_trust_connector_service_unittest.cc", "../browser/enterprise/connectors/device_trust/device_trust_service_unittest.cc", "../browser/enterprise/connectors/device_trust/navigation_throttle_unittest.cc",
diff --git a/chrome/test/data/web_apps/file_handler/basic-192.png b/chrome/test/data/web_apps/file_handler/basic-192.png new file mode 100644 index 0000000..fcd38798 --- /dev/null +++ b/chrome/test/data/web_apps/file_handler/basic-192.png Binary files differ
diff --git a/chrome/test/data/web_apps/file_handler/basic-48.png b/chrome/test/data/web_apps/file_handler/basic-48.png new file mode 100644 index 0000000..2d6ebb3 --- /dev/null +++ b/chrome/test/data/web_apps/file_handler/basic-48.png Binary files differ
diff --git a/chrome/test/data/web_apps/file_handler/basic.html b/chrome/test/data/web_apps/file_handler/basic.html new file mode 100644 index 0000000..81867ed --- /dev/null +++ b/chrome/test/data/web_apps/file_handler/basic.html
@@ -0,0 +1,23 @@ +<!DOCTYPE html> +<html> +<head> + <title>File Handler</title> + <script src="/web_apps/test_utils.js"></script> + <script> + // If a "manifest=/path/to/manifest.json" query argument is provided to + // the URL accessing this page, that path is injected as the manifest tag. + // Otherwise, "basic.json" is used as the manifest tag. + addManifestLinkTag(); + </script> +</head> +<body onload="startWorker('/web_apps/file_handler/service_worker.js', { scope: '/web_apps/file_handler/' })"> + <h1>File Handler</h1> + <div> + <p> + This site is used for dPWA integration tests, and is subject to modification to support that framework. See + <a + href="https://chromium.googlesource.com/chromium/src/+/main/docs/webapps/integration-testing-framework.md">https://chromium.googlesource.com/chromium/src/+/main/docs/webapps/integration-testing-framework.md</a> + </p> + </div> +</body> +</html>
diff --git a/chrome/test/data/web_apps/file_handler/basic.json b/chrome/test/data/web_apps/file_handler/basic.json new file mode 100644 index 0000000..db520bf --- /dev/null +++ b/chrome/test/data/web_apps/file_handler/basic.json
@@ -0,0 +1,35 @@ +{ + "name": "File Handler", + "icons": [ + { + "src": "basic-48.png", + "sizes": "48x48", + "type": "image/png" + }, + { + "src": "basic-192.png", + "sizes": "192x192", + "type": "image/png" + } + ], + "start_url": "/web_apps/file_handler/basic.html", + "scope": "/web_apps/file_handler/", + "display": "minimal-ui", + "file_handlers": [ + { + "action": "/web_apps/file_handler/text_handler.html", + "name": "Plain Text", + "accept": { + "text/plain": [".txt", ".md", ".csv", ".text"], + "application/octet-stream": [".qux", ".quux"] + } + }, + { + "action": "/web_apps/file_handler/image_handler.html", + "accept": { + "image/png": [".png"] + }, + "launch_type": "multiple-clients" + } + ] +}
diff --git a/chrome/test/data/web_apps/file_handler/image_handler.html b/chrome/test/data/web_apps/file_handler/image_handler.html new file mode 100644 index 0000000..5cbe1437 --- /dev/null +++ b/chrome/test/data/web_apps/file_handler/image_handler.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> + <title>File Handler - Image Handler</title> + <script src="/web_apps/test_utils.js"></script> +</head> +<body> + <h1>File Handler - Image Handler</h1> + <div> + <p> + TODO: Add code to verify the images loaded are correct. + </p> + <p> + This site is used for dPWA integration tests, and is subject to modification to support that framework. See + <a + href="https://chromium.googlesource.com/chromium/src/+/main/docs/webapps/integration-testing-framework.md">https://chromium.googlesource.com/chromium/src/+/main/docs/webapps/integration-testing-framework.md</a> + </p> + </div> +</body> +</html>
diff --git a/chrome/test/data/web_apps/file_handler/manifest_window_controls_overlay.json b/chrome/test/data/web_apps/file_handler/manifest_window_controls_overlay.json new file mode 100644 index 0000000..426482b --- /dev/null +++ b/chrome/test/data/web_apps/file_handler/manifest_window_controls_overlay.json
@@ -0,0 +1,21 @@ +{ + "name": "File Handler", + "icons": [ + { + "src": "../basic-48.png", + "sizes": "48x48", + "type": "image/png" + }, + { + "src": "../basic-192.png", + "sizes": "192x192", + "type": "image/png" + } + ], + "start_url": "/web_apps/file_handler/basic.html", + "scope": "/web_apps/file_handler/", + "display": "standalone", + "display_override": [ + "window-controls-overlay" + ] + }
diff --git a/chrome/test/data/web_apps/file_handler/service_worker.js b/chrome/test/data/web_apps/file_handler/service_worker.js new file mode 100644 index 0000000..df04e70 --- /dev/null +++ b/chrome/test/data/web_apps/file_handler/service_worker.js
@@ -0,0 +1,11 @@ +// Copyright 2020 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. + +'use strict'; + +self.addEventListener('fetch', event => { + event.respondWith(fetch(event.request).catch(_ => { + return new Response('Offline test.'); + })); +});
diff --git a/chrome/test/data/web_apps/file_handler/text_handler.html b/chrome/test/data/web_apps/file_handler/text_handler.html new file mode 100644 index 0000000..3e32d6e2 --- /dev/null +++ b/chrome/test/data/web_apps/file_handler/text_handler.html
@@ -0,0 +1,20 @@ +<!DOCTYPE html> +<html> +<head> + <title>File Handler - Text Handler</title> + <script src="/web_apps/test_utils.js"></script> +</head> +<body> + <h1>File Handler - Text Handler</h1> + <div> + <p> + TODO: Add code to verify the text files loaded are correct. + </p> + <p> + This site is used for dPWA integration tests, and is subject to modification to support that framework. See + <a + href="https://chromium.googlesource.com/chromium/src/+/main/docs/webapps/integration-testing-framework.md">https://chromium.googlesource.com/chromium/src/+/main/docs/webapps/integration-testing-framework.md</a> + </p> + </div> +</body> +</html>
diff --git a/chrome/test/data/web_apps/files/file_handler_test.png b/chrome/test/data/web_apps/files/file_handler_test.png new file mode 100644 index 0000000..571a6f7 --- /dev/null +++ b/chrome/test/data/web_apps/files/file_handler_test.png Binary files differ
diff --git a/chrome/test/data/web_apps/files/file_handler_test.txt b/chrome/test/data/web_apps/files/file_handler_test.txt new file mode 100644 index 0000000..6de7b8c --- /dev/null +++ b/chrome/test/data/web_apps/files/file_handler_test.txt
@@ -0,0 +1 @@ +This is a test file.
diff --git a/chrome/test/interaction/webui_interaction_test_util_interactive_uitest.cc b/chrome/test/interaction/webui_interaction_test_util_interactive_uitest.cc index 38321d7..15bce1d 100644 --- a/chrome/test/interaction/webui_interaction_test_util_interactive_uitest.cc +++ b/chrome/test/interaction/webui_interaction_test_util_interactive_uitest.cc
@@ -306,8 +306,14 @@ } // This test checks that we can attach to a WebUI that is embedded in a tab. +#if BUILDFLAG(IS_WIN) +// Consistently fails on the Win11 bot. https://crbug.com/1355948 +#define MAYBE_CompareScreenshot_TabWebUI DISABLED_CompareScreenshot_TabWebUI +#else +#define MAYBE_CompareScreenshot_TabWebUI CompareScreenshot_TabWebUI +#endif IN_PROC_BROWSER_TEST_F(WebUIInteractionTestUtilInteractiveUiTest, - CompareScreenshot_TabWebUI) { + MAYBE_CompareScreenshot_TabWebUI) { UNCALLED_MOCK_CALLBACK(ui::InteractionSequence::CompletedCallback, completed); UNCALLED_MOCK_CALLBACK(ui::InteractionSequence::AbortedCallback, aborted);
diff --git a/chrome/test/webapps/data/enums.md b/chrome/test/webapps/data/enums.md index 2e6b232..43c0318 100644 --- a/chrome/test/webapps/data/enums.md +++ b/chrome/test/webapps/data/enums.md
@@ -20,7 +20,7 @@ | #Enum Name | Values (* = default) | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | -| Site | Standalone* | StandaloneSubSite | MinimalUi | NotPromotable | StandaloneNestedA | StandaloneNestedB | Wco | Isolated | | +| Site | Standalone* | StandaloneSubSite | MinimalUi | NotPromotable | StandaloneNestedA | StandaloneNestedB | Wco | Isolated | FileHandler | | | PromotableSite | Standalone* | MinimalUi | StandaloneNestedA | StandaloneNestedB | Wco | | | | Title | StandaloneOriginal | StandaloneUpdated | | | | | | | Color | Red | Green | | | | | |
diff --git a/chromeos/ash/components/audio/cras_audio_handler.cc b/chromeos/ash/components/audio/cras_audio_handler.cc index c253f6e..dac9c49 100644 --- a/chromeos/ash/components/audio/cras_audio_handler.cc +++ b/chromeos/ash/components/audio/cras_audio_handler.cc
@@ -720,6 +720,15 @@ void CrasAudioHandler::SetActiveDevice(const AudioDevice& active_device, bool notify, DeviceActivateType activate_by) { + if (activate_by == ACTIVATE_BY_USER) { + if (active_device.is_input) { + base::RecordAction( + base::UserMetricsAction("StatusArea_Audio_SwitchInputDevice")); + } else { + base::RecordAction( + base::UserMetricsAction("StatusArea_Audio_SwitchOutputDevice")); + } + } if (active_device.is_input) CrasAudioClient::Get()->SetActiveInputNode(active_device.id); else
diff --git a/chromeos/ash/components/audio/cras_audio_handler.h b/chromeos/ash/components/audio/cras_audio_handler.h index b78292de..06acd43 100644 --- a/chromeos/ash/components/audio/cras_audio_handler.h +++ b/chromeos/ash/components/audio/cras_audio_handler.h
@@ -16,6 +16,7 @@ #include "base/component_export.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" +#include "base/metrics/user_metrics.h" #include "base/observer_list.h" #include "base/timer/timer.h" #include "chromeos/ash/components/audio/audio_device.h"
diff --git a/chromeos/profiles/atom.afdo.newest.txt b/chromeos/profiles/atom.afdo.newest.txt index bb8fbcc..59afd91 100644 --- a/chromeos/profiles/atom.afdo.newest.txt +++ b/chromeos/profiles/atom.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-atom-106-5239.0-1661164408-benchmark-106.0.5249.7-r1-redacted.afdo.xz +chromeos-chrome-amd64-atom-106-5239.0-1661164408-benchmark-106.0.5249.8-r1-redacted.afdo.xz
diff --git a/chromeos/profiles/bigcore.afdo.newest.txt b/chromeos/profiles/bigcore.afdo.newest.txt index f0c9ece6..9d02a96 100644 --- a/chromeos/profiles/bigcore.afdo.newest.txt +++ b/chromeos/profiles/bigcore.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-bigcore-106-5229.0-1661162659-benchmark-106.0.5249.7-r1-redacted.afdo.xz +chromeos-chrome-amd64-bigcore-106-5229.0-1661162659-benchmark-106.0.5249.8-r1-redacted.afdo.xz
diff --git a/components/autofill_assistant/browser/service/mock_url_loader.h b/components/autofill_assistant/browser/service/mock_url_loader.h index 1a8c2b3bc..b21b1ca 100644 --- a/components/autofill_assistant/browser/service/mock_url_loader.h +++ b/components/autofill_assistant/browser/service/mock_url_loader.h
@@ -62,11 +62,16 @@ MOCK_METHOD2(AttachStringForUpload, void(const std::string& upload_data, const std::string& upload_content_type)); + MOCK_METHOD1(AttachStringForUpload, void(const std::string& upload_data)); MOCK_METHOD4(AttachFileForUpload, void(const base::FilePath& upload_file_path, const std::string& upload_content_type, uint64_t offset, uint64_t length)); + MOCK_METHOD3(AttachFileForUpload, + void(const base::FilePath& upload_file_path, + uint64_t offset, + uint64_t length)); MOCK_METHOD2(SetRetryOptions, void(int max_retries, int retry_mode)); MOCK_METHOD1(SetURLLoaderFactoryOptions, void(uint32_t options)); MOCK_METHOD1(SetRequestID, void(int32_t request_id));
diff --git a/components/autofill_assistant/browser/service/service_request_sender_impl_unittest.cc b/components/autofill_assistant/browser/service/service_request_sender_impl_unittest.cc index c2a296f..8557ffd4 100644 --- a/components/autofill_assistant/browser/service/service_request_sender_impl_unittest.cc +++ b/components/autofill_assistant/browser/service/service_request_sender_impl_unittest.cc
@@ -37,6 +37,7 @@ using ::network::URLLoaderCompletionStatus; using ::testing::_; using ::testing::Field; +using ::testing::Matcher; using ::testing::NiceMock; using ::testing::Return; using ::testing::ReturnRef; @@ -316,7 +317,9 @@ auto loader = std::make_unique<NiceMock<MockURLLoader>>(); EXPECT_CALL(*loader_factory, OnCreateLoader).Times(0); EXPECT_CALL(*loader, SetRetryOptions).Times(0); - EXPECT_CALL(*loader, AttachStringForUpload).Times(0); + EXPECT_CALL(*loader, AttachStringForUpload(Matcher<const std::string&>(_), + Matcher<const std::string&>(_))) + .Times(0); EXPECT_CALL(*loader, DownloadToStringOfUnboundedSizeUntilCrashAndDie) .Times(0); EXPECT_CALL(*loader, ResponseInfo).Times(0); @@ -446,7 +449,8 @@ const ::net::NetworkTrafficAnnotationTag& annotation_tag) { return std::move(loader); }); - EXPECT_CALL(*loader, AttachStringForUpload); + EXPECT_CALL(*loader, AttachStringForUpload(Matcher<const std::string&>(_), + Matcher<const std::string&>(_))); EXPECT_CALL(*loader, DownloadToStringOfUnboundedSizeUntilCrashAndDie) .WillOnce(RunOnceCallback<1>(std::make_unique<std::string>("response"))); EXPECT_CALL(*loader, ResponseInfo) @@ -527,7 +531,8 @@ const ::net::NetworkTrafficAnnotationTag& annotation_tag) { return std::move(loader); }); - EXPECT_CALL(*loader, AttachStringForUpload); + EXPECT_CALL(*loader, AttachStringForUpload(Matcher<const std::string&>(_), + Matcher<const std::string&>(_))); EXPECT_CALL(*loader, DownloadToStringOfUnboundedSizeUntilCrashAndDie) .WillOnce( RunOnceCallback<1>(std::make_unique<std::string>("packed_response"))); @@ -614,7 +619,8 @@ const ::net::NetworkTrafficAnnotationTag& annotation_tag) { return std::move(loader); }); - EXPECT_CALL(*loader, AttachStringForUpload); + EXPECT_CALL(*loader, AttachStringForUpload(Matcher<const std::string&>(_), + Matcher<const std::string&>(_))); EXPECT_CALL(*loader, DownloadToStringOfUnboundedSizeUntilCrashAndDie) .WillOnce( RunOnceCallback<1>(std::make_unique<std::string>("packed_response"))); @@ -667,7 +673,8 @@ const ::net::NetworkTrafficAnnotationTag& annotation_tag) { return std::move(loader); }); - EXPECT_CALL(*loader, AttachStringForUpload); + EXPECT_CALL(*loader, AttachStringForUpload(Matcher<const std::string&>(_), + Matcher<const std::string&>(_))); EXPECT_CALL(*loader, DownloadToStringOfUnboundedSizeUntilCrashAndDie) .WillOnce(RunOnceCallback<1>(std::make_unique<std::string>("response"))); EXPECT_CALL(*loader, ResponseInfo)
diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/browser_ui/site_settings/android/BUILD.gn index 1aab440..f48b53f7 100644 --- a/components/browser_ui/site_settings/android/BUILD.gn +++ b/components/browser_ui/site_settings/android/BUILD.gn
@@ -49,6 +49,7 @@ "java/src/org/chromium/components/browser_ui/site_settings/ClearWebsiteStorageDialog.java", "java/src/org/chromium/components/browser_ui/site_settings/ContentSettingException.java", "java/src/org/chromium/components/browser_ui/site_settings/ContentSettingsResources.java", + "java/src/org/chromium/components/browser_ui/site_settings/FPSCookieSettings.java", "java/src/org/chromium/components/browser_ui/site_settings/ForwardingManagedPreferenceDelegate.java", "java/src/org/chromium/components/browser_ui/site_settings/FourStateCookieSettingsPreference.java", "java/src/org/chromium/components/browser_ui/site_settings/GroupedWebsitesSettings.java", @@ -179,6 +180,7 @@ "java/res/drawable-xxxhdpi/permission_protected_media.png", "java/res/drawable-xxxhdpi/settings_sensors.png", "java/res/drawable-xxxhdpi/web_asset.png", + "java/res/drawable/ic_block.xml", "java/res/drawable/ic_person_24dp.xml", "java/res/drawable/settings_bluetooth.xml", "java/res/layout/add_site_dialog.xml", @@ -192,6 +194,7 @@ "java/res/values/ids.xml", "java/res/xml/all_site_preferences.xml", "java/res/xml/all_site_preferences_v2.xml", + "java/res/xml/fps_cookie_settings.xml", "java/res/xml/grouped_websites_preferences.xml", "java/res/xml/single_website_preferences.xml", "java/res/xml/site_settings_preferences.xml",
diff --git a/components/browser_ui/site_settings/android/java/res/drawable/ic_block.xml b/components/browser_ui/site_settings/android/java/res/drawable/ic_block.xml new file mode 100644 index 0000000..da15948 --- /dev/null +++ b/components/browser_ui/site_settings/android/java/res/drawable/ic_block.xml
@@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2022 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. --> + +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24.0" + android:viewportHeight="24.0" > + <path + android:fillColor="@color/default_icon_color_white_tint_list" + android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM4,12c0,-4.42 3.58,-8 8,-8 1.85,0 3.55,0.63 4.9,1.69L5.69,16.9C4.63,15.55 4,13.85 4,12zM12,20c-1.85,0 -3.55,-0.63 -4.9,-1.69L18.31,7.1C19.37,8.45 20,10.15 20,12c0,4.42 -3.58,8 -8,8z" /> +</vector>
diff --git a/components/browser_ui/site_settings/android/java/res/layout/four_state_cookie_settings_preference.xml b/components/browser_ui/site_settings/android/java/res/layout/four_state_cookie_settings_preference.xml index 8787b61..2042ac6 100644 --- a/components/browser_ui/site_settings/android/java/res/layout/four_state_cookie_settings_preference.xml +++ b/components/browser_ui/site_settings/android/java/res/layout/four_state_cookie_settings_preference.xml
@@ -39,6 +39,22 @@ app:primaryText="@string/website_settings_category_cookie_block_third_party_title" app:descriptionText="@string/website_settings_category_cookie_block_third_party_addition" /> + <org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionAndAuxButton + android:id="@+id/block_third_party_incognito_with_aux" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:visibility="gone" + app:primaryText="@string/website_settings_category_cookie_block_third_party_incognito_title" + app:descriptionText="@string/website_settings_category_cookie_block_third_party_addition" /> + + <org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionAndAuxButton + android:id="@+id/block_third_party_with_aux" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:visibility="gone" + app:primaryText="@string/website_settings_category_cookie_block_third_party_title" + app:descriptionText="@string/website_settings_category_cookie_block_third_party_addition" /> + <org.chromium.components.browser_ui.widget.RadioButtonWithDescription android:id="@+id/block" android:layout_width="match_parent"
diff --git a/components/browser_ui/site_settings/android/java/res/xml/fps_cookie_settings.xml b/components/browser_ui/site_settings/android/java/res/xml/fps_cookie_settings.xml new file mode 100644 index 0000000..5fa637e --- /dev/null +++ b/components/browser_ui/site_settings/android/java/res/xml/fps_cookie_settings.xml
@@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright 2022 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. --> + +<PreferenceScreen + xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="subtitle" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="bullet_one" + android:summary="@string/website_settings_category_cookie_subpage_bullet_one" + android:icon="@drawable/permission_cookie" + app:iconTint="@color/default_icon_color_tint_list" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="bullet_two" + android:summary="@string/website_settings_category_cookie_subpage_bullet_two" + android:icon="@drawable/ic_block" + app:iconTint="@color/default_icon_color_tint_list" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.ChromeSwitchPreference + android:key="allow_fps" + android:title="@string/website_settings_category_cookie_fps_toggle_title" + android:summary="@string/website_settings_category_cookie_fps_toggle_description" + android:persistent="false" + app:allowDividerBelow="false" /> + +</PreferenceScreen> \ No newline at end of file
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/FPSCookieSettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/FPSCookieSettings.java new file mode 100644 index 0000000..5e87be9 --- /dev/null +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/FPSCookieSettings.java
@@ -0,0 +1,49 @@ +// Copyright 2022 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. + +package org.chromium.components.browser_ui.site_settings; + +import android.os.Bundle; + +import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; +import org.chromium.components.browser_ui.settings.SettingsUtils; +import org.chromium.components.browser_ui.settings.TextMessagePreference; +import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference.CookieSettingsState; + +/** + * First Party Sets preference page. It's a FourStateCookieSettingsPreference subpage. + */ +public class FPSCookieSettings extends SiteSettingsPreferenceFragment { + public static final String PREF_ALLOW_FPS = "allow_fps"; + public static final String SUBTITLE = "subtitle"; + + public static final String EXTRA_COOKIE_STATE = "cookie_state"; + + // UI Elements. + private ChromeSwitchPreference mAllowFPSButton; + private TextMessagePreference mSubtitle; + + @Override + public void onCreatePreferences(Bundle bundle, String s) { + SettingsUtils.addPreferencesFromResource(this, R.xml.fps_cookie_settings); + + CookieSettingsState state = (CookieSettingsState) getArguments().getSerializable( + FPSCookieSettings.EXTRA_COOKIE_STATE); + getActivity().setTitle(getContext().getString(R.string.cookies_title)); + + // TODO(crbug.com/1349370): Add button initial value and the handler logic + mAllowFPSButton = (ChromeSwitchPreference) findPreference(PREF_ALLOW_FPS); + mSubtitle = (TextMessagePreference) findPreference(SUBTITLE); + + if (state == CookieSettingsState.BLOCK_THIRD_PARTY) { + mSubtitle.setTitle( + R.string.website_settings_category_cookie_block_third_party_subtitle); + mAllowFPSButton.setVisible(true); + } else { + mSubtitle.setTitle( + R.string.website_settings_category_cookie_block_third_party_incognito_subtitle); + mAllowFPSButton.setVisible(false); + } + } +}
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/FourStateCookieSettingsPreference.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/FourStateCookieSettingsPreference.java index 0affbd42..ee18a13 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/FourStateCookieSettingsPreference.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/FourStateCookieSettingsPreference.java
@@ -17,14 +17,18 @@ import org.chromium.base.ApiCompatibilityUtils; import org.chromium.components.browser_ui.settings.ManagedPreferencesUtils; import org.chromium.components.browser_ui.widget.RadioButtonWithDescription; +import org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionAndAuxButton; import org.chromium.components.browser_ui.widget.text.TextViewWithCompoundDrawables; import org.chromium.components.content_settings.CookieControlsMode; /** * A 4-state radio group Preference used for the Cookies subpage of SiteSettings. */ -public class FourStateCookieSettingsPreference - extends Preference implements RadioGroup.OnCheckedChangeListener { +public class FourStateCookieSettingsPreference extends Preference + implements RadioGroup.OnCheckedChangeListener, + RadioButtonWithDescriptionAndAuxButton.OnAuxButtonClickedListener { + private OnCookiesDetailsRequested mListener; + public enum CookieSettingsState { UNINITIALIZED, ALLOW, @@ -34,9 +38,22 @@ } /** + * Used to notify cookie details subpages requests. + */ + public interface OnCookiesDetailsRequested { + /** + * Notify that Cookie details are requested. + */ + void onCookiesDetailsRequested(CookieSettingsState cookieSettingsState); + } + + /** * Signals used to determine the view and button states. */ public static class Params { + // Whether the PrivacySandboxFirstPartySetsUI feature is enabled. + public boolean isPrivacySandboxFirstPartySetsUIEnabled; + // Whether the cookies content setting is enabled. public boolean allowCookies; // An enum indicating when to block third-party cookies. @@ -119,10 +136,31 @@ super.onBindViewHolder(holder); mAllowButton = (RadioButtonWithDescription) holder.findViewById(R.id.allow); - mBlockThirdPartyIncognitoButton = - (RadioButtonWithDescription) holder.findViewById(R.id.block_third_party_incognito); - mBlockThirdPartyButton = - (RadioButtonWithDescription) holder.findViewById(R.id.block_third_party); + + if (mInitializationParams.isPrivacySandboxFirstPartySetsUIEnabled) { + holder.findViewById(R.id.block_third_party_incognito).setVisibility(View.GONE); + holder.findViewById(R.id.block_third_party).setVisibility(View.GONE); + mBlockThirdPartyIncognitoButton = + (RadioButtonWithDescriptionAndAuxButton) holder.findViewById( + R.id.block_third_party_incognito_with_aux); + mBlockThirdPartyButton = (RadioButtonWithDescriptionAndAuxButton) holder.findViewById( + R.id.block_third_party_with_aux); + mBlockThirdPartyIncognitoButton.setVisibility(View.VISIBLE); + mBlockThirdPartyButton.setVisibility(View.VISIBLE); + // TODO(crbug.com/1349370): Change the buttons class into a + // RadioButtonWithDescriptionAndAuxButton and remove the following casts when the + // PrivacySandboxFirstPartySetsUI feature is launched + ((RadioButtonWithDescriptionAndAuxButton) mBlockThirdPartyIncognitoButton) + .setAuxButtonClickedListener(this); + ((RadioButtonWithDescriptionAndAuxButton) mBlockThirdPartyButton) + .setAuxButtonClickedListener(this); + } else { + mBlockThirdPartyIncognitoButton = (RadioButtonWithDescription) holder.findViewById( + R.id.block_third_party_incognito); + mBlockThirdPartyButton = + (RadioButtonWithDescription) holder.findViewById(R.id.block_third_party); + } + mBlockButton = (RadioButtonWithDescription) holder.findViewById(R.id.block); mRadioGroup = (RadioGroup) holder.findViewById(R.id.radio_button_layout); mRadioGroup.setOnCheckedChangeListener(this); @@ -139,6 +177,21 @@ } } + public void setCookiesDetailsRequestedListener(OnCookiesDetailsRequested listener) { + mListener = listener; + } + + @Override + public void onAuxButtonClicked(int clickedButtonId) { + if (clickedButtonId == mBlockThirdPartyIncognitoButton.getId()) { + mListener.onCookiesDetailsRequested(CookieSettingsState.BLOCK_THIRD_PARTY_INCOGNITO); + } else if (clickedButtonId == mBlockThirdPartyButton.getId()) { + mListener.onCookiesDetailsRequested(CookieSettingsState.BLOCK_THIRD_PARTY); + } else { + assert false : "Should not be reached."; + } + } + private CookieSettingsState getActiveState(Params params) { // These conditions only check the preference combinations that deterministically decide // your cookie settings state. In the future we would refactor the backend preferences to @@ -186,7 +239,8 @@ return args; } - private RadioButtonWithDescription getButton(CookieSettingsState state) { + @VisibleForTesting + public RadioButtonWithDescription getButton(CookieSettingsState state) { switch (state) { case ALLOW: return mAllowButton;
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java index 8b77a37..09c0344d4 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java
@@ -48,9 +48,11 @@ import org.chromium.components.browser_ui.settings.ChromeBasePreference; import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.ExpandablePreferenceGroup; +import org.chromium.components.browser_ui.settings.FragmentSettingsLauncher; import org.chromium.components.browser_ui.settings.ManagedPreferenceDelegate; import org.chromium.components.browser_ui.settings.ManagedPreferencesUtils; import org.chromium.components.browser_ui.settings.SearchUtils; +import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.settings.SettingsUtils; import org.chromium.components.browser_ui.site_settings.AutoDarkMetrics.AutoDarkSettingsChangeSource; import org.chromium.components.browser_ui.site_settings.FourStateCookieSettingsPreference.CookieSettingsState; @@ -87,12 +89,20 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment implements Preference.OnPreferenceChangeListener, Preference.OnPreferenceClickListener, AddExceptionPreference.SiteAddedCallback, - PreferenceManager.OnPreferenceTreeClickListener { + PreferenceManager.OnPreferenceTreeClickListener, FragmentSettingsLauncher, + FourStateCookieSettingsPreference.OnCookiesDetailsRequested { // The key to use to pass which category this preference should display, // e.g. Location/Popups/All sites (if blank). public static final String EXTRA_CATEGORY = "category"; public static final String EXTRA_TITLE = "title"; + private SettingsLauncher mSettingsLauncher; + + @Override + public void setSettingsLauncher(SettingsLauncher settingsLauncher) { + mSettingsLauncher = settingsLauncher; + } + /** * If present, the list of websites will be filtered by domain using * {@link UrlUtilities#getDomainAndRegistry}. @@ -142,6 +152,14 @@ @Nullable private Set<String> mSelectedDomains; + @Override + public void onCookiesDetailsRequested(CookieSettingsState cookieSettingsState) { + Bundle fragmentArgs = new Bundle(); + fragmentArgs.putSerializable(FPSCookieSettings.EXTRA_COOKIE_STATE, cookieSettingsState); + mSettingsLauncher.launchSettingsActivity( + getActivity(), FPSCookieSettings.class, fragmentArgs); + } + // Note: these values must match the SiteLayout enum in enums.xml. @IntDef({SiteLayout.MOBILE, SiteLayout.DESKTOP}) @Retention(RetentionPolicy.SOURCE) @@ -1052,6 +1070,7 @@ private void configureFourStateCookieToggle( FourStateCookieSettingsPreference fourStateCookieToggle) { fourStateCookieToggle.setOnPreferenceChangeListener(this); + fourStateCookieToggle.setCookiesDetailsRequestedListener(this); FourStateCookieSettingsPreference.Params params = new FourStateCookieSettingsPreference.Params(); params.allowCookies = WebsitePreferenceBridge.isCategoryEnabled( @@ -1062,6 +1081,8 @@ params.cookiesContentSettingEnforced = mCategory.isManaged(); params.cookieControlsModeEnforced = prefService.isManagedPreference(COOKIE_CONTROLS_MODE); params.isIncognitoModeEnabled = getSiteSettingsDelegate().isIncognitoModeEnabled(); + params.isPrivacySandboxFirstPartySetsUIEnabled = + getSiteSettingsDelegate().isPrivacySandboxFirstPartySetsUIFeatureEnabled(); fourStateCookieToggle.setState(params); }
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java index 33a321f..b1094ba 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java
@@ -61,6 +61,11 @@ boolean isQuietNotificationPromptsFeatureEnabled(); /** + * @return true if the PrivacySandboxFirstPartySetsUI Feature is enabled. + */ + boolean isPrivacySandboxFirstPartySetsUIFeatureEnabled(); + + /** * @return The id of the notification channel associated with the given origin. */ // TODO(crbug.com/1069895): Remove this once WebLayer supports notifications.
diff --git a/components/browser_ui/strings/android/site_settings.grdp b/components/browser_ui/strings/android/site_settings.grdp index 67c1cb6..7e9fdfad 100644 --- a/components/browser_ui/strings/android/site_settings.grdp +++ b/components/browser_ui/strings/android/site_settings.grdp
@@ -376,6 +376,24 @@ <message name="IDS_WEBSITE_SETTINGS_COOKIE_INFO" desc="Text describing cookie and third-party cookie settings."> Cookies are files created by websites you visit. Sites use them to remember your preferences. Third-party cookies are created by other sites. These sites own some of the content, like ads or images, that you see on the webpage you visit. </message> + <message name="IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_SUBPAGE_BULLET_ONE" desc="Description for the first bullet of cookie settings subpage."> + Sites can use cookies to improve your browsing experience, for example, to keep you signed in or to remember items in your shopping cart + </message> + <message name="IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_SUBPAGE_BULLET_TWO" desc="Description for the second bullet of cookie settings subpage."> + While in Incognito, sites can't use your cookies to see your browsing activity across different sites, for example, to personalize ads. Features on some sites may not work. + </message> + <message name="IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_BLOCK_THIRD_PARTY_INCOGNITO_SUBTITLE" desc="Text used as subtitle for the block third-party cookies subpage in Incognito option in settings"> + Block third-party cookies in Incognito: + </message> + <message name="IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_BLOCK_THIRD_PARTY_SUBTITLE" desc="Text used as subtitle for the block third-party cookies subpage option in settings"> + Block third-party cookies: + </message> + <message name="IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_FPS_TOGGLE_TITLE" desc="First Party Sets toggle title in the cookie site settings subpage."> + Allow related sites to remember you across sites + </message> + <message name="IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_FPS_TOGGLE_DESCRIPTION" desc="First Party Sets toggle description in the cookie site settings subpage."> + Related sites use cookies to help with things like keeping you signed in + </message> <!-- Desktop Site --> <message name="IDS_WEBSITE_SETTINGS_CATEGORY_DESKTOP_SITE_ALLOWED" desc="Summary text explaining that desktop view of sites will be requested by default.">
diff --git a/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_BLOCK_THIRD_PARTY_INCOGNITO_SUBTITLE.png.sha1 b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_BLOCK_THIRD_PARTY_INCOGNITO_SUBTITLE.png.sha1 new file mode 100644 index 0000000..82a3d4e --- /dev/null +++ b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_BLOCK_THIRD_PARTY_INCOGNITO_SUBTITLE.png.sha1
@@ -0,0 +1 @@ +5640702ecf275f81391df0d99cb3eca1154b0ffd \ No newline at end of file
diff --git a/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_BLOCK_THIRD_PARTY_SUBTITLE.png.sha1 b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_BLOCK_THIRD_PARTY_SUBTITLE.png.sha1 new file mode 100644 index 0000000..62fc6521 --- /dev/null +++ b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_BLOCK_THIRD_PARTY_SUBTITLE.png.sha1
@@ -0,0 +1 @@ +162d79130016d905148d34a236ceea14697b0c35 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_FPS_TOGGLE_DESCRIPTION.png.sha1 b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_FPS_TOGGLE_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..62fc6521 --- /dev/null +++ b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_FPS_TOGGLE_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +162d79130016d905148d34a236ceea14697b0c35 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_FPS_TOGGLE_TITLE.png.sha1 b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_FPS_TOGGLE_TITLE.png.sha1 new file mode 100644 index 0000000..62fc6521 --- /dev/null +++ b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_FPS_TOGGLE_TITLE.png.sha1
@@ -0,0 +1 @@ +162d79130016d905148d34a236ceea14697b0c35 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_SUBPAGE_BULLET_ONE.png.sha1 b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_SUBPAGE_BULLET_ONE.png.sha1 new file mode 100644 index 0000000..62fc6521 --- /dev/null +++ b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_SUBPAGE_BULLET_ONE.png.sha1
@@ -0,0 +1 @@ +162d79130016d905148d34a236ceea14697b0c35 \ No newline at end of file
diff --git a/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_SUBPAGE_BULLET_TWO.png.sha1 b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_SUBPAGE_BULLET_TWO.png.sha1 new file mode 100644 index 0000000..62fc6521 --- /dev/null +++ b/components/browser_ui/strings/android/site_settings_grdp/IDS_WEBSITE_SETTINGS_CATEGORY_COOKIE_SUBPAGE_BULLET_TWO.png.sha1
@@ -0,0 +1 @@ +162d79130016d905148d34a236ceea14697b0c35 \ No newline at end of file
diff --git a/components/commerce/content/browser/commerce_tab_helper.cc b/components/commerce/content/browser/commerce_tab_helper.cc index 4b1b7a9..45fc485 100644 --- a/components/commerce/content/browser/commerce_tab_helper.cc +++ b/components/commerce/content/browser/commerce_tab_helper.cc
@@ -56,6 +56,16 @@ web_wrapper_->ClearWebContentsPointer(); } +void CommerceTabHelper::SetShoppingServiceForTesting(KeyedService* service) { + auto* shopping_service = static_cast<commerce::ShoppingService*>(service); + + shopping_service_ = shopping_service; + + if (shopping_service_) { + shopping_service_->WebWrapperCreated(web_wrapper_.get()); + } +} + WEB_CONTENTS_USER_DATA_KEY_IMPL(CommerceTabHelper); } // namespace commerce
diff --git a/components/commerce/content/browser/commerce_tab_helper.h b/components/commerce/content/browser/commerce_tab_helper.h index 35f2c0dd..e984579d 100644 --- a/components/commerce/content/browser/commerce_tab_helper.h +++ b/components/commerce/content/browser/commerce_tab_helper.h
@@ -43,6 +43,8 @@ void WebContentsDestroyed() override; + void SetShoppingServiceForTesting(KeyedService* service); + private: friend class content::WebContentsUserData<CommerceTabHelper>;
diff --git a/components/commerce/core/mock_shopping_service.cc b/components/commerce/core/mock_shopping_service.cc index 01a1e4d8..2c5fb70e 100644 --- a/components/commerce/core/mock_shopping_service.cc +++ b/components/commerce/core/mock_shopping_service.cc
@@ -6,6 +6,11 @@ namespace commerce { +// static +std::unique_ptr<KeyedService> MockShoppingService::Build() { + return std::make_unique<MockShoppingService>(); +} + MockShoppingService::MockShoppingService() : commerce::ShoppingService(nullptr, nullptr,
diff --git a/components/commerce/core/mock_shopping_service.h b/components/commerce/core/mock_shopping_service.h index 356c35c..75604be 100644 --- a/components/commerce/core/mock_shopping_service.h +++ b/components/commerce/core/mock_shopping_service.h
@@ -16,6 +16,8 @@ // A mock ShoppingService that allows us to decide the response. class MockShoppingService : public commerce::ShoppingService { public: + static std::unique_ptr<KeyedService> Build(); + MockShoppingService(); ~MockShoppingService() override;
diff --git a/components/device_event_log/device_event_log_impl.cc b/components/device_event_log/device_event_log_impl.cc index 6e276060..dc9d53f 100644 --- a/components/device_event_log/device_event_log_impl.cc +++ b/components/device_event_log/device_event_log_impl.cc
@@ -178,23 +178,23 @@ return line; } -void LogEntryToDictionary(const DeviceEventLogImpl::LogEntry& log_entry, - base::DictionaryValue* output) { - output->SetString("timestamp", DateAndTimeWithMicroseconds(log_entry.time)); - output->SetString("timestampshort", TimeWithSeconds(log_entry.time)); - output->SetString("level", kLogLevelName[log_entry.log_level]); - output->SetString("type", GetLogTypeString(log_entry.log_type)); - output->SetString("file", base::StringPrintf("%s:%d ", log_entry.file.c_str(), - log_entry.file_line)); - output->SetString("event", log_entry.event); +base::Value::Dict LogEntryToDictionary( + const DeviceEventLogImpl::LogEntry& log_entry) { + base::Value::Dict entry_dict; + entry_dict.Set("timestamp", DateAndTimeWithMicroseconds(log_entry.time)); + entry_dict.Set("timestampshort", TimeWithSeconds(log_entry.time)); + entry_dict.Set("level", kLogLevelName[log_entry.log_level]); + entry_dict.Set("type", GetLogTypeString(log_entry.log_type)); + entry_dict.Set("file", base::StringPrintf("%s:%d ", log_entry.file.c_str(), + log_entry.file_line)); + entry_dict.Set("event", log_entry.event); + return entry_dict; } std::string LogEntryAsJSON(const DeviceEventLogImpl::LogEntry& log_entry) { - base::DictionaryValue entry_dict; - LogEntryToDictionary(log_entry, &entry_dict); std::string json; JSONStringValueSerializer serializer(&json); - if (!serializer.Serialize(entry_dict)) { + if (!serializer.Serialize(LogEntryToDictionary(log_entry))) { LOG(ERROR) << "Failed to serialize to JSON"; } return json;
diff --git a/components/device_reauth/biometric_authenticator.h b/components/device_reauth/biometric_authenticator.h index e13030b..f832024 100644 --- a/components/device_reauth/biometric_authenticator.h +++ b/components/device_reauth/biometric_authenticator.h
@@ -79,7 +79,7 @@ // |message| contains text that will be displayed to the end user on // authentication request virtual void AuthenticateWithMessage(BiometricAuthRequester requester, - const std::u16string message, + const std::u16string& message, AuthenticateCallback callback) = 0; // Cancels an in-progress authentication if the filling surface requesting
diff --git a/components/device_reauth/mock_biometric_authenticator.h b/components/device_reauth/mock_biometric_authenticator.h index ae47d4f..a8ac1fc 100644 --- a/components/device_reauth/mock_biometric_authenticator.h +++ b/components/device_reauth/mock_biometric_authenticator.h
@@ -24,7 +24,7 @@ MOCK_METHOD(void, AuthenticateWithMessage, (BiometricAuthRequester, - const std::u16string, + const std::u16string&, AuthenticateCallback), (override)); MOCK_METHOD(void, Cancel, (BiometricAuthRequester), (override));
diff --git a/components/device_signals/core/common/signals_constants.cc b/components/device_signals/core/common/signals_constants.cc index bf2c5c7..1f552aa 100644 --- a/components/device_signals/core/common/signals_constants.cc +++ b/components/device_signals/core/common/signals_constants.cc
@@ -66,6 +66,10 @@ // the device. const char kInstalledHotfixes[] = "hotfixes"; +// Name of the signal for getting information about the ip address on the +// device. +const char kIpAddress[] = "ipAddress"; + // Name of the signal for getting information about whether the disk // on the device is encrypted. const char kIsDiskEncrypted[] = "isDiskEncrypted";
diff --git a/components/device_signals/core/common/signals_constants.h b/components/device_signals/core/common/signals_constants.h index ad4ade35..5d5dba8 100644 --- a/components/device_signals/core/common/signals_constants.h +++ b/components/device_signals/core/common/signals_constants.h
@@ -26,6 +26,7 @@ extern const char kFirewallOn[]; extern const char kImei[]; extern const char kInstalledHotfixes[]; +extern const char kIpAddress[]; extern const char kIsDiskEncrypted[]; extern const char kIsJailbroken[]; extern const char kIsPasswordProtected[];
diff --git a/components/metrics/generate_expired_histograms_array.gni b/components/metrics/generate_expired_histograms_array.gni index 8815d1a..03507bd 100644 --- a/components/metrics/generate_expired_histograms_array.gni +++ b/components/metrics/generate_expired_histograms_array.gni
@@ -95,6 +95,7 @@ "//tools/metrics/histograms/metadata/interstitial/histograms.xml", "//tools/metrics/histograms/metadata/ios/histograms.xml", "//tools/metrics/histograms/metadata/kerberos/histograms.xml", + "//tools/metrics/histograms/metadata/kiosk/histograms.xml", "//tools/metrics/histograms/metadata/language/histograms.xml", "//tools/metrics/histograms/metadata/leveldb_proto/histograms.xml", "//tools/metrics/histograms/metadata/local/histograms.xml",
diff --git a/components/password_manager/core/browser/android_backend_error.h b/components/password_manager/core/browser/android_backend_error.h index baf2641c7..311a9e4 100644 --- a/components/password_manager/core/browser/android_backend_error.h +++ b/components/password_manager/core/browser/android_backend_error.h
@@ -9,6 +9,8 @@ namespace password_manager { +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused." before the enum and update enums.xml // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.password_manager enum class AndroidBackendErrorType { kUncategorized = 0, @@ -28,7 +30,9 @@ kExternalError = 7, // Task was cleaned-up without a proper response. kCleanedUpWithoutResponse = 8, - kMaxValue = kCleanedUpWithoutResponse, + // Backend downstream implementation is not available. + kBackendNotAvailable = 9, + kMaxValue = kBackendNotAvailable, }; struct AndroidBackendError {
diff --git a/components/permissions/contexts/sensor_permission_context.cc b/components/permissions/contexts/sensor_permission_context.cc index 50cf295..2ccc8cc 100644 --- a/components/permissions/contexts/sensor_permission_context.cc +++ b/components/permissions/contexts/sensor_permission_context.cc
@@ -38,11 +38,7 @@ } bool SensorPermissionContext::IsRestrictedToSecureOrigins() const { - // This is to allow non-secure origins that use DeviceMotion and - // DeviceOrientation Event to be able to access sensors that are provided - // by generic_sensor. The Generic Sensor API is not allowed in non-secure - // origins and this is enforced by the renderer. - return false; + return true; } } // namespace permissions
diff --git a/components/services/storage/BUILD.gn b/components/services/storage/BUILD.gn index 53a59c8..b5fa44e 100644 --- a/components/services/storage/BUILD.gn +++ b/components/services/storage/BUILD.gn
@@ -163,9 +163,14 @@ testonly = true sources = [ "//components/test/data/storage/shared_storage.v0.init_too_old.sql", + "//components/test/data/storage/shared_storage.v1.empty_values_mapping.5origins.sql", + "//components/test/data/storage/shared_storage.v1.empty_values_mapping.6origins.sql", + "//components/test/data/storage/shared_storage.v1.empty_values_mapping.7origins.sql", + "//components/test/data/storage/shared_storage.v1.empty_values_mapping.8origins.sql", "//components/test/data/storage/shared_storage.v1.init_too_new.sql", "//components/test/data/storage/shared_storage.v1.iterator.sql", "//components/test/data/storage/shared_storage.v1.no_budget_table.sql", + "//components/test/data/storage/shared_storage.v1.single_origin.sql", "//components/test/data/storage/shared_storage.v1.sql", ] outputs = [ "{{bundle_resources_dir}}/" +
diff --git a/components/services/storage/shared_storage/shared_storage_database.cc b/components/services/storage/shared_storage/shared_storage_database.cc index 3041e654..4329f7e 100644 --- a/components/services/storage/shared_storage/shared_storage_database.cc +++ b/components/services/storage/shared_storage/shared_storage_database.cc
@@ -160,9 +160,9 @@ budget_interval_(options->budget_interval), origin_staleness_threshold_(options->origin_staleness_threshold), clock_(base::DefaultClock::GetInstance()) { - DCHECK(db_path_.empty() || db_path_.IsAbsolute()); - db_file_status_ = db_path_.empty() ? DBFileStatus::kNoPreexistingFile - : DBFileStatus::kNotChecked; + DCHECK(!is_filebacked() || db_path_.IsAbsolute()); + db_file_status_ = is_filebacked() ? DBFileStatus::kNotChecked + : DBFileStatus::kNoPreexistingFile; } SharedStorageDatabase::~SharedStorageDatabase() { @@ -175,7 +175,7 @@ return false; // The file already doesn't exist. - if (db_path_.empty()) + if (!is_filebacked()) return true; return base::DeleteFile(db_path_); @@ -1028,7 +1028,7 @@ return false; // The in-memory case is included in `DBFileStatus::kNoPreexistingFile`. - DCHECK(!db_path_.empty()); + DCHECK(is_filebacked()); // We do not expect `DBExists()` to be called in the case where // `db_file_status_ == DBFileStatus::kPreexistingFile`, as then @@ -1070,7 +1070,7 @@ db_.set_error_callback(base::BindRepeating( &SharedStorageDatabase::DatabaseErrorCallback, base::Unretained(this))); - if (!db_path_.empty()) { + if (is_filebacked()) { if (!db_.is_open() && !db_.Open(db_path_)) return false; @@ -1144,6 +1144,7 @@ return InitStatus::kError; } + LogInitHistograms(); return InitStatus::kSuccess; } @@ -1354,4 +1355,126 @@ return NumEntries(context_origin) < max_entries_per_origin_; } +void SharedStorageDatabase::LogInitHistograms() { + base::UmaHistogramBoolean("Storage.SharedStorage.Database.IsFileBacked", + is_filebacked()); + + if (is_filebacked()) { + int64_t file_size = 0L; + if (GetFileSize(db_path_, &file_size)) { + int64_t file_size_kb = file_size / 1024; + base::UmaHistogramCounts10M( + "Storage.SharedStorage.Database.FileBacked.FileSize.KB", + file_size_kb); + + int64_t file_size_gb = file_size_kb / (1024 * 1024); + if (file_size_gb) { + base::UmaHistogramCounts1000( + "Storage.SharedStorage.Database.FileBacked.FileSize.GB", + file_size_gb); + } + } + + static constexpr char kOriginCountSql[] = + "SELECT COUNT(*) FROM per_origin_mapping"; + + sql::Statement origin_count_statement( + db_.GetCachedStatement(SQL_FROM_HERE, kOriginCountSql)); + + if (origin_count_statement.Step()) { + int64_t origin_count = origin_count_statement.ColumnInt64(0); + base::UmaHistogramCounts100000( + "Storage.SharedStorage.Database.FileBacked.NumOrigins", origin_count); + + static constexpr char kQuartileSql[] = + "SELECT AVG(length) FROM " + "(SELECT length FROM per_origin_mapping " + "ORDER BY length LIMIT ? OFFSET ?)"; + + sql::Statement median_statement( + db_.GetCachedStatement(SQL_FROM_HERE, kQuartileSql)); + median_statement.BindInt64(0, 2 - (origin_count % 2)); + median_statement.BindInt64(1, (origin_count - 1) / 2); + + if (median_statement.Step()) { + base::UmaHistogramCounts100000( + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin." + "Median", + median_statement.ColumnInt64(0)); + } + + // We use Method 1 from https://en.wikipedia.org/wiki/Quartile to + // calculate upper and lower quartiles. + int64_t quartile_limit = 2 - (origin_count % 4) / 2; + int64_t quartile_offset = (origin_count > 1) ? (origin_count - 2) / 4 : 0; + sql::Statement q1_statement( + db_.GetCachedStatement(SQL_FROM_HERE, kQuartileSql)); + q1_statement.BindInt64(0, quartile_limit); + q1_statement.BindInt64(1, quartile_offset); + + if (q1_statement.Step()) { + base::UmaHistogramCounts100000( + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Q1", + q1_statement.ColumnInt64(0)); + } + + // We use Method 1 from https://en.wikipedia.org/wiki/Quartile to + // calculate upper and lower quartiles. + static constexpr char kUpperQuartileSql[] = + "SELECT AVG(length) FROM " + "(SELECT length FROM per_origin_mapping " + "ORDER BY length DESC LIMIT ? OFFSET ?)"; + + sql::Statement q3_statement( + db_.GetCachedStatement(SQL_FROM_HERE, kUpperQuartileSql)); + q3_statement.BindInt64(0, quartile_limit); + q3_statement.BindInt64(1, quartile_offset); + + if (q3_statement.Step()) { + base::UmaHistogramCounts100000( + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Q3", + q3_statement.ColumnInt64(0)); + } + + static constexpr char kMinSql[] = + "SELECT MIN(length) FROM per_origin_mapping"; + + sql::Statement min_statement( + db_.GetCachedStatement(SQL_FROM_HERE, kMinSql)); + + if (min_statement.Step()) { + base::UmaHistogramCounts100000( + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin." + "Min", + min_statement.ColumnInt64(0)); + } + + static constexpr char kMaxSql[] = + "SELECT MAX(length) FROM per_origin_mapping"; + + sql::Statement max_statement( + db_.GetCachedStatement(SQL_FROM_HERE, kMaxSql)); + + if (max_statement.Step()) { + base::UmaHistogramCounts100000( + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin." + "Max", + max_statement.ColumnInt64(0)); + } + } + + static constexpr char kValueCountSql[] = + "SELECT COUNT(*) FROM values_mapping"; + + sql::Statement value_count_statement( + db_.GetCachedStatement(SQL_FROM_HERE, kValueCountSql)); + + if (value_count_statement.Step()) { + base::UmaHistogramCounts10M( + "Storage.SharedStorage.Database.FileBacked.NumEntries.Total", + value_count_statement.ColumnInt64(0)); + } + } +} + } // namespace storage
diff --git a/components/services/storage/shared_storage/shared_storage_database.h b/components/services/storage/shared_storage/shared_storage_database.h index bb8bf57..40b9cc0d 100644 --- a/components/services/storage/shared_storage/shared_storage_database.h +++ b/components/services/storage/shared_storage/shared_storage_database.h
@@ -180,6 +180,12 @@ return &db_; } + // Returns whether or not the database is file-backed (rather than in-memory). + [[nodiscard]] bool is_filebacked() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + return !db_path_.empty(); + } + // Releases all non-essential memory associated with this database connection. void TrimMemory(); @@ -455,6 +461,11 @@ [[nodiscard]] bool HasCapacity(const std::string& context_origin) VALID_CONTEXT_REQUIRED(sequence_checker_); + // Logs following initialization various histograms, including e.g. the number + // of origins currently in `per_origin_mapping`, as well as each of the + // lengths listed in `per_origin_mapping`. + void LogInitHistograms() VALID_CONTEXT_REQUIRED(sequence_checker_); + // Database containing the actual data. sql::Database db_ GUARDED_BY_CONTEXT(sequence_checker_);
diff --git a/components/services/storage/shared_storage/shared_storage_database_unittest.cc b/components/services/storage/shared_storage/shared_storage_database_unittest.cc index 2ec2cdbf..ba8b486 100644 --- a/components/services/storage/shared_storage/shared_storage_database_unittest.cc +++ b/components/services/storage/shared_storage/shared_storage_database_unittest.cc
@@ -16,6 +16,7 @@ #include "base/run_loop.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" +#include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/test/simple_test_clock.h" #include "base/test/task_environment.h" @@ -53,6 +54,25 @@ const int kMaxStringLength = 100; const int kMaxBatchSizeForIteratorTest = 25; +constexpr char kFileSizeKBHistogram[] = + "Storage.SharedStorage.Database.FileBacked.FileSize.KB"; +constexpr char kNumEntriesMaxHistogram[] = + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Max"; +constexpr char kNumEntriesMinHistogram[] = + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Min"; +constexpr char kNumEntriesMedianHistogram[] = + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Median"; +constexpr char kNumEntriesQ1Histogram[] = + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Q1"; +constexpr char kNumEntriesQ3Histogram[] = + "Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Q3"; +constexpr char kNumEntriesTotalHistogram[] = + "Storage.SharedStorage.Database.FileBacked.NumEntries.Total"; +constexpr char kNumOriginsHistogram[] = + "Storage.SharedStorage.Database.FileBacked.NumOrigins"; +constexpr char kIsFileBackedHistogram[] = + "Storage.SharedStorage.Database.IsFileBacked"; + } // namespace class SharedStorageDatabaseTest : public testing::Test { @@ -110,12 +130,14 @@ scoped_refptr<storage::MockSpecialStoragePolicy> special_storage_policy_; std::unique_ptr<SharedStorageDatabase> db_; base::SimpleTestClock clock_; + base::HistogramTester histogram_tester_; }; // Test loading version 1 database. TEST_F(SharedStorageDatabaseTest, Version1_LoadFromFile) { db_ = LoadFromFile("shared_storage.v1.sql"); ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); // Override the clock and set to the last time in the file that is used to // make a budget withdrawal. @@ -229,6 +251,16 @@ EXPECT_EQ(OperationResult::kNotFound, result.result); EXPECT_EQ(base::Time(), result.time); + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, true, 1); + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 40, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 9, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 18, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMinHistogram, 1, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ1Histogram, 1, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMedianHistogram, 2, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ3Histogram, 3, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMaxHistogram, 4, 1); + EXPECT_TRUE(db_->Destroy()); } @@ -236,6 +268,7 @@ TEST_F(SharedStorageDatabaseTest, Version1_LoadFromFileNoBudgetTables) { db_ = LoadFromFile("shared_storage.v1.no_budget_table.sql"); ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); url::Origin google_com = url::Origin::Create(GURL("http://google.com/")); EXPECT_EQ(db_->Get(google_com, u"key1").data, u"value1"); @@ -328,6 +361,16 @@ EXPECT_DOUBLE_EQ(kBitBudget, db_->GetRemainingBudget(withgoogle_com).bits); EXPECT_DOUBLE_EQ(kBitBudget, db_->GetRemainingBudget(youtube_com).bits); + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, true, 1); + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 40, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 9, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 18, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMinHistogram, 1, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ1Histogram, 1, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMedianHistogram, 2, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ3Histogram, 3, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMaxHistogram, 4, 1); + EXPECT_TRUE(db_->Destroy()); } @@ -336,6 +379,7 @@ // is too high. db_ = LoadFromFile("shared_storage.v1.init_too_new.sql"); ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); ASSERT_TRUE(SqlDB()); // Call an operation so that the database will attempt to be lazy-initialized. @@ -367,6 +411,7 @@ // is too low and we're forcing there not to be a retry attempt. db_ = LoadFromFile("shared_storage.v0.init_too_old.sql"); ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); ASSERT_TRUE(SqlDB()); // Call an operation so that the database will attempt to be lazy-initialized. @@ -393,6 +438,13 @@ db_ = std::make_unique<SharedStorageDatabase>( db_path, special_storage_policy_, std::move(options)); db_->OverrideClockForTesting(&clock_); + + ASSERT_EQ(GetParam().in_memory_only, !db_->is_filebacked()); + } + + void TearDown() override { + CheckInitHistograms(); + SharedStorageDatabaseTest::TearDown(); } void InitSharedStorageFeature() override { @@ -408,6 +460,16 @@ {"SharedStorageOriginStalenessThreshold", TimeDeltaToString(base::Days(kOriginStalenessThresholdDays))}}); } + + void CheckInitHistograms() { + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, + db_->is_filebacked(), 1); + if (db_->is_filebacked()) { + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 29, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 0, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 0, 1); + } + } }; INSTANTIATE_TEST_SUITE_P(All, @@ -1329,6 +1391,7 @@ TEST_F(SharedStorageDatabaseIteratorTest, Keys) { db_ = LoadFromFile("shared_storage.v1.iterator.sql"); ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); url::Origin google_com = url::Origin::Create(GURL("http://google.com/")); TestSharedStorageEntriesListenerUtility utility( @@ -1354,11 +1417,22 @@ // Batch size is 25 for this test. EXPECT_EQ(2U, utility.BatchCountForId(id2)); utility.VerifyNoErrorForId(id2); + + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, true, 1); + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 40, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 2, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 227, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMinHistogram, 26, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ1Histogram, 26, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMedianHistogram, 113.5, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ3Histogram, 201, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMaxHistogram, 201, 1); } TEST_F(SharedStorageDatabaseIteratorTest, Entries) { db_ = LoadFromFile("shared_storage.v1.iterator.sql"); ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); url::Origin google_com = url::Origin::Create(GURL("http://google.com/")); TestSharedStorageEntriesListenerUtility utility( @@ -1385,6 +1459,171 @@ // Batch size is 25 for this test. EXPECT_EQ(2U, utility.BatchCountForId(id2)); utility.VerifyNoErrorForId(id2); + + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, true, 1); + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 40, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 2, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 227, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMinHistogram, 26, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ1Histogram, 26, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMedianHistogram, 113.5, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ3Histogram, 201, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMaxHistogram, 201, 1); +} + +// Tests correct calculation of five-number summary when there is only one +// origin. +TEST_F(SharedStorageDatabaseTest, SingleOrigin) { + db_ = LoadFromFile("shared_storage.v1.single_origin.sql"); + ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); + + url::Origin google_com = url::Origin::Create(GURL("http://google.com/")); + + std::vector<url::Origin> origins; + for (const auto& info : db_->FetchOrigins()) + origins.push_back(info->origin); + EXPECT_THAT(origins, ElementsAre(google_com)); + + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, true, 1); + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 29, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 1, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 10, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMinHistogram, 10, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ1Histogram, 10, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMedianHistogram, 10, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ3Histogram, 10, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMaxHistogram, 10, 1); +} + +// Tests correct calculation of five-number summary when number of origins is +// greater than one and has remainder 1 modulo 4. +TEST_F(SharedStorageDatabaseTest, FiveOrigins) { + db_ = LoadFromFile("shared_storage.v1.empty_values_mapping.5origins.sql"); + ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); + + url::Origin abc_xyz = url::Origin::Create(GURL("http://abc.xyz")); + url::Origin chromium_org = url::Origin::Create(GURL("http://chromium.org/")); + url::Origin google_com = url::Origin::Create(GURL("http://google.com/")); + url::Origin google_org = url::Origin::Create(GURL("http://google.org/")); + url::Origin gv_com = url::Origin::Create(GURL("http://gv.com")); + + std::vector<url::Origin> origins; + for (const auto& info : db_->FetchOrigins()) + origins.push_back(info->origin); + EXPECT_THAT(origins, ElementsAre(abc_xyz, chromium_org, google_com, + google_org, gv_com)); + + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, true, 1); + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 29, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 5, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 0, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMinHistogram, 10, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ1Histogram, 12.5, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMedianHistogram, 20, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ3Histogram, 145, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMaxHistogram, 250, 1); +} + +// Tests correct calculation of five-number summary when number of origins has +// remainder 2 modulo 4. +TEST_F(SharedStorageDatabaseTest, SixOrigins) { + db_ = LoadFromFile("shared_storage.v1.empty_values_mapping.6origins.sql"); + ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); + + url::Origin abc_xyz = url::Origin::Create(GURL("http://abc.xyz")); + url::Origin chromium_org = url::Origin::Create(GURL("http://chromium.org/")); + url::Origin google_com = url::Origin::Create(GURL("http://google.com/")); + url::Origin google_org = url::Origin::Create(GURL("http://google.org/")); + url::Origin gv_com = url::Origin::Create(GURL("http://gv.com")); + url::Origin waymo_com = url::Origin::Create(GURL("http://waymo.com")); + + std::vector<url::Origin> origins; + for (const auto& info : db_->FetchOrigins()) + origins.push_back(info->origin); + EXPECT_THAT(origins, ElementsAre(abc_xyz, chromium_org, google_com, + google_org, gv_com, waymo_com)); + + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, true, 1); + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 29, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 6, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 0, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMinHistogram, 10, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ1Histogram, 15, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMedianHistogram, 30, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ3Histogram, 250, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMaxHistogram, 1599, 1); +} + +// Tests correct calculation of five-number summary when number of origins has +// remainder 3 modulo 4. +TEST_F(SharedStorageDatabaseTest, SevenOrigins) { + db_ = LoadFromFile("shared_storage.v1.empty_values_mapping.7origins.sql"); + ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); + + url::Origin abc_xyz = url::Origin::Create(GURL("http://abc.xyz")); + url::Origin chromium_org = url::Origin::Create(GURL("http://chromium.org/")); + url::Origin google_com = url::Origin::Create(GURL("http://google.com/")); + url::Origin google_org = url::Origin::Create(GURL("http://google.org/")); + url::Origin gv_com = url::Origin::Create(GURL("http://gv.com")); + url::Origin waymo_com = url::Origin::Create(GURL("http://waymo.com")); + url::Origin with_google_com = + url::Origin::Create(GURL("http://withgoogle.com")); + + std::vector<url::Origin> origins; + for (const auto& info : db_->FetchOrigins()) + origins.push_back(info->origin); + EXPECT_THAT(origins, + ElementsAre(abc_xyz, chromium_org, google_com, google_org, gv_com, + waymo_com, with_google_com)); + + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, true, 1); + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 29, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 7, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 0, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMinHistogram, 10, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ1Histogram, 15, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMedianHistogram, 40, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ3Histogram, 1001, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMaxHistogram, 1599, 1); +} + +// Tests correct calculation of five-number summary when number of origins has +// remainder 0 modulo 4. +TEST_F(SharedStorageDatabaseTest, EightOrigins) { + db_ = LoadFromFile("shared_storage.v1.empty_values_mapping.8origins.sql"); + ASSERT_TRUE(db_); + ASSERT_TRUE(db_->is_filebacked()); + + url::Origin abc_xyz = url::Origin::Create(GURL("http://abc.xyz")); + url::Origin chromium_org = url::Origin::Create(GURL("http://chromium.org/")); + url::Origin google_com = url::Origin::Create(GURL("http://google.com/")); + url::Origin google_org = url::Origin::Create(GURL("http://google.org/")); + url::Origin gv_com = url::Origin::Create(GURL("http://gv.com")); + url::Origin waymo_com = url::Origin::Create(GURL("http://waymo.com")); + url::Origin with_google_com = + url::Origin::Create(GURL("http://withgoogle.com")); + url::Origin youtube_com = url::Origin::Create(GURL("http://youtube.com/")); + + std::vector<url::Origin> origins; + for (const auto& info : db_->FetchOrigins()) + origins.push_back(info->origin); + EXPECT_THAT(origins, + ElementsAre(abc_xyz, chromium_org, google_com, google_org, gv_com, + waymo_com, with_google_com, youtube_com)); + + histogram_tester_.ExpectUniqueSample(kIsFileBackedHistogram, true, 1); + histogram_tester_.ExpectUniqueSample(kFileSizeKBHistogram, 29, 1); + histogram_tester_.ExpectUniqueSample(kNumOriginsHistogram, 8, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesTotalHistogram, 0, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMinHistogram, 10, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ1Histogram, 17.5, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMedianHistogram, 70, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesQ3Histogram, 625.5, 1); + histogram_tester_.ExpectUniqueSample(kNumEntriesMaxHistogram, 1599, 1); } } // namespace storage
diff --git a/components/stylus_handwriting/android/BUILD.gn b/components/stylus_handwriting/android/BUILD.gn index dbb1b44..f51ce34 100644 --- a/components/stylus_handwriting/android/BUILD.gn +++ b/components/stylus_handwriting/android/BUILD.gn
@@ -55,10 +55,13 @@ "//base:base_java_test_support", "//base:base_junit_test_support", "//content/public/android:content_full_java", + "//mojo/public/mojom/base:base_java", "//third_party/android_deps:com_android_support_support_annotations_java", "//third_party/blink/public:blink_headers_java", + "//third_party/blink/public/mojom:mojom_platform_java", "//third_party/junit:junit", "//third_party/mockito:mockito_java", "//ui/android:ui_no_recycler_view_java", + "//ui/gfx/geometry/mojom:mojom_java", ] }
diff --git a/components/stylus_handwriting/android/java/src/org/chromium/components/stylus_handwriting/DirectWritingServiceCallback.java b/components/stylus_handwriting/android/java/src/org/chromium/components/stylus_handwriting/DirectWritingServiceCallback.java index 19a56c5..41615ba 100644 --- a/components/stylus_handwriting/android/java/src/org/chromium/components/stylus_handwriting/DirectWritingServiceCallback.java +++ b/components/stylus_handwriting/android/java/src/org/chromium/components/stylus_handwriting/DirectWritingServiceCallback.java
@@ -37,22 +37,22 @@ // The following GESTURE_ and ACTION_ constants are defined as per the bundle data sent by the // Direct Writing service when any gesture is recognized. - private static final String GESTURE_ACTION_RECOGNITION_INFO = "recognition_info"; - private static final String GESTURE_BUNDLE_KEY_START_POINT = "start_point"; - private static final String GESTURE_BUNDLE_KEY_END_POINT = "end_point"; - private static final String GESTURE_BUNDLE_KEY_LOWEST_POINT = "lowest_point"; - private static final String GESTURE_BUNDLE_KEY_HIGHEST_POINT = "highest_point"; - private static final String GESTURE_BUNDLE_KEY_GESTURE_TYPE = "gesture_type"; - private static final String GESTURE_BUNDLE_KEY_TEXT_ALTERNATIVE = "text_alternative"; - private static final String GESTURE_BUNDLE_KEY_TEXT_INSERTION = "text_insertion"; + static final String GESTURE_ACTION_RECOGNITION_INFO = "recognition_info"; + static final String GESTURE_BUNDLE_KEY_START_POINT = "start_point"; + static final String GESTURE_BUNDLE_KEY_END_POINT = "end_point"; + static final String GESTURE_BUNDLE_KEY_LOWEST_POINT = "lowest_point"; + static final String GESTURE_BUNDLE_KEY_HIGHEST_POINT = "highest_point"; + static final String GESTURE_BUNDLE_KEY_GESTURE_TYPE = "gesture_type"; + static final String GESTURE_BUNDLE_KEY_TEXT_ALTERNATIVE = "text_alternative"; + static final String GESTURE_BUNDLE_KEY_TEXT_INSERTION = "text_insertion"; // Gesture types in Bundle for GESTURE_BUNDLE_KEY_GESTURE_TYPE - private static final String GESTURE_TYPE_BACKSPACE = "backspace"; - private static final String GESTURE_TYPE_ZIGZAG = "zigzag"; - private static final String GESTURE_TYPE_V_SPACE = "v_space"; - private static final String GESTURE_TYPE_WEDGE_SPACE = "wedge_space"; - private static final String GESTURE_TYPE_U_TYPE_REMOVE_SPACE = "u_type_remove_space"; - private static final String GESTURE_TYPE_ARCH_TYPE_REMOVE_SPACE = "arch_type_remove_space"; + static final String GESTURE_TYPE_BACKSPACE = "backspace"; + static final String GESTURE_TYPE_ZIGZAG = "zigzag"; + static final String GESTURE_TYPE_V_SPACE = "v_space"; + static final String GESTURE_TYPE_WEDGE_SPACE = "wedge_space"; + static final String GESTURE_TYPE_U_TYPE_REMOVE_SPACE = "u_type_remove_space"; + static final String GESTURE_TYPE_ARCH_TYPE_REMOVE_SPACE = "arch_type_remove_space"; private EditorInfo mEditorInfo; private int mLastSelectionStart;
diff --git a/components/stylus_handwriting/android/junit/src/org/chromium/components/stylus_handwriting/DirectWritingServiceCallbackTest.java b/components/stylus_handwriting/android/junit/src/org/chromium/components/stylus_handwriting/DirectWritingServiceCallbackTest.java index 477f5ad..e06b12c 100644 --- a/components/stylus_handwriting/android/junit/src/org/chromium/components/stylus_handwriting/DirectWritingServiceCallbackTest.java +++ b/components/stylus_handwriting/android/junit/src/org/chromium/components/stylus_handwriting/DirectWritingServiceCallbackTest.java
@@ -5,10 +5,12 @@ package org.chromium.components.stylus_handwriting; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.ArgumentMatchers.argThat; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; @@ -28,6 +30,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.robolectric.RuntimeEnvironment; @@ -35,13 +38,19 @@ import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.util.Feature; +import org.chromium.blink.mojom.StylusWritingGestureAction; +import org.chromium.blink.mojom.StylusWritingGestureData; import org.chromium.blink_public.web.WebTextInputFlags; import org.chromium.blink_public.web.WebTextInputMode; import org.chromium.content.browser.input.ImeUtils; import org.chromium.content_public.browser.StylusWritingImeCallback; +import org.chromium.mojo_base.mojom.String16; import org.chromium.ui.base.ime.TextInputAction; import org.chromium.ui.base.ime.TextInputType; +import java.util.Arrays; +import java.util.List; + /** * Unit tests for {@link DirectWritingServiceCallback}. */ @@ -49,6 +58,14 @@ @Config(manifest = Config.NONE) public class DirectWritingServiceCallbackTest { private static final String SAMPLE_INPUT = "sample input"; + private static final String FALLBACK_TEXT = "fallback"; + private static final float[] GESTURE_START_POINT = new float[] {20.f, 50.f}; + private static final float[] GESTURE_END_POINT = new float[] {100.f, 50.f}; + private static final List<String> TWO_POINT_GESTURES = + Arrays.asList(DirectWritingServiceCallback.GESTURE_TYPE_ZIGZAG, + DirectWritingServiceCallback.GESTURE_TYPE_BACKSPACE, + DirectWritingServiceCallback.GESTURE_TYPE_U_TYPE_REMOVE_SPACE, + DirectWritingServiceCallback.GESTURE_TYPE_ARCH_TYPE_REMOVE_SPACE); @Mock private StylusWritingImeCallback mImeCallback; @@ -58,6 +75,81 @@ private DirectWritingServiceCallback mDwServiceCallback = new DirectWritingServiceCallback(); private Context mContext; + private static String mojoStringToJavaString(String16 mojoString) { + short[] data = mojoString.data; + char[] chars = new char[data.length]; + for (int i = 0; i < chars.length; i++) { + chars[i] = (char) data[i]; + } + return String.valueOf(chars); + } + + private static Bundle getGestureBundle(String gestureType) { + Bundle bundle = new Bundle(); + bundle.putString(DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_GESTURE_TYPE, gestureType); + bundle.putString( + DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_TEXT_ALTERNATIVE, FALLBACK_TEXT); + bundle.putFloatArray(getGestureStartPointKey(gestureType), GESTURE_START_POINT); + + if (isTwoPointGesture(gestureType)) { + bundle.putFloatArray( + DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_END_POINT, GESTURE_END_POINT); + } + return bundle; + } + + private static boolean isTwoPointGesture(String gestureType) { + return TWO_POINT_GESTURES.contains(gestureType); + } + + private static String getGestureStartPointKey(String gestureType) { + if (gestureType.equals(DirectWritingServiceCallback.GESTURE_TYPE_V_SPACE)) { + return DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_LOWEST_POINT; + } else if (gestureType.equals(DirectWritingServiceCallback.GESTURE_TYPE_WEDGE_SPACE)) { + return DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_HIGHEST_POINT; + } else { + return DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_START_POINT; + } + } + + private void setImeCallbackAndVerifyMojoGestureData(Bundle gestureBundle, + @StylusWritingGestureAction.EnumType int expectedAction, String expectedTextToInsert) { + mDwServiceCallback.updateEditableBounds(new Rect(0, 0, 400, 400), new Point(50, 50)); + mDwServiceCallback.setImeCallback(mImeCallback); + mDwServiceCallback.onTextViewExtraCommand( + DirectWritingServiceCallback.GESTURE_ACTION_RECOGNITION_INFO, gestureBundle); + shadowOf(Looper.getMainLooper()).idle(); + ArgumentCaptor<StylusWritingGestureData> gestureDataCaptor = + ArgumentCaptor.forClass(StylusWritingGestureData.class); + verify(mImeCallback).handleStylusWritingGestureAction(gestureDataCaptor.capture()); + StylusWritingGestureData gestureData = gestureDataCaptor.getValue(); + assertEquals(expectedAction, gestureData.action); + assertEquals(GESTURE_START_POINT[0], gestureData.startPoint.x, /* tolerance */ 0.1); + assertEquals(GESTURE_START_POINT[1], gestureData.startPoint.y, /* tolerance */ 0.1); + + if (isTwoPointGesture(gestureBundle.getString( + DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_GESTURE_TYPE, ""))) { + assertEquals(GESTURE_END_POINT[0], gestureData.endPoint.x, /* tolerance */ 0.1); + assertEquals(GESTURE_END_POINT[1], gestureData.endPoint.y, /* tolerance */ 0.1); + } else { + assertNull(gestureData.endPoint); + } + + assertEquals(FALLBACK_TEXT, mojoStringToJavaString(gestureData.textAlternative)); + if (expectedTextToInsert == null) { + assertNull(gestureData.textToInsert); + } else { + assertEquals(expectedTextToInsert, mojoStringToJavaString(gestureData.textToInsert)); + } + } + + private void sendGestureAndVerifyGestureNotHandled(Bundle bundle) { + mDwServiceCallback.onTextViewExtraCommand( + DirectWritingServiceCallback.GESTURE_ACTION_RECOGNITION_INFO, bundle); + shadowOf(Looper.getMainLooper()).idle(); + verify(mImeCallback, never()).handleStylusWritingGestureAction(any()); + } + @Before public void setup() { MockitoAnnotations.initMocks(this); @@ -191,4 +283,144 @@ assertEquals(editorInfo.imeOptions, mDwServiceCallback.getImeOptions()); assertEquals(editorInfo.inputType, mDwServiceCallback.getInputType()); } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_deleteByStrike() { + // Stylus gesture Delete is handled only after Ime callback is set. + Bundle bundle = getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_BACKSPACE); + sendGestureAndVerifyGestureNotHandled(bundle); + + setImeCallbackAndVerifyMojoGestureData( + bundle, StylusWritingGestureAction.DELETE_TEXT, null); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_deleteByScribble() { + // Stylus gesture Delete is handled only after Ime callback is set. + Bundle bundle = getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_ZIGZAG); + sendGestureAndVerifyGestureNotHandled(bundle); + + setImeCallbackAndVerifyMojoGestureData( + bundle, StylusWritingGestureAction.DELETE_TEXT, null); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_deletePointsClampedToEditBounds() { + mDwServiceCallback.setImeCallback(mImeCallback); + // Set Edit field bounds smaller than gesture x-coordinates. + Rect editBounds = new Rect(30, 30, 80, 80); + mDwServiceCallback.updateEditableBounds(editBounds, new Point(50, 50)); + + Bundle bundle = getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_BACKSPACE); + mDwServiceCallback.onTextViewExtraCommand( + DirectWritingServiceCallback.GESTURE_ACTION_RECOGNITION_INFO, bundle); + shadowOf(Looper.getMainLooper()).idle(); + verify(mImeCallback).handleStylusWritingGestureAction(argThat(gestureData -> { + assertEquals(StylusWritingGestureAction.DELETE_TEXT, gestureData.action); + // assert that start-x and end-x are clamped to Edit bounds. + assertEquals(editBounds.left, gestureData.startPoint.x); + assertEquals(editBounds.right, gestureData.endPoint.x); + return true; + })); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_insertVSpace() { + // Stylus gesture add space is handled only after Ime callback is set. + Bundle bundle = getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_V_SPACE); + sendGestureAndVerifyGestureNotHandled(bundle); + + setImeCallbackAndVerifyMojoGestureData( + bundle, StylusWritingGestureAction.ADD_SPACE_OR_TEXT, " "); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_insertVText() { + Bundle bundle = getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_V_SPACE); + // Set text to be inserted with V gesture. + String textToInsert = "text"; + bundle.putString( + DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_TEXT_INSERTION, textToInsert); + setImeCallbackAndVerifyMojoGestureData( + bundle, StylusWritingGestureAction.ADD_SPACE_OR_TEXT, textToInsert); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_insertWedgeSpace() { + // Stylus gesture add wedge space is handled only after Ime callback is set. + Bundle bundle = getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_WEDGE_SPACE); + sendGestureAndVerifyGestureNotHandled(bundle); + + setImeCallbackAndVerifyMojoGestureData( + bundle, StylusWritingGestureAction.ADD_SPACE_OR_TEXT, " "); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_insertWedgeText() { + Bundle bundle = getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_WEDGE_SPACE); + // Set text to be inserted with wedge gesture. + String textToInsert = "text"; + bundle.putString( + DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_TEXT_INSERTION, textToInsert); + setImeCallbackAndVerifyMojoGestureData( + bundle, StylusWritingGestureAction.ADD_SPACE_OR_TEXT, textToInsert); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_UTypeRemoveSpaces() { + // Stylus gesture remove spaces is handled only after Ime callback is set. + Bundle bundle = + getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_U_TYPE_REMOVE_SPACE); + sendGestureAndVerifyGestureNotHandled(bundle); + + setImeCallbackAndVerifyMojoGestureData( + bundle, StylusWritingGestureAction.REMOVE_SPACES, null); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_archTypeRemoveSpaces() { + // Stylus gesture remove spaces is handled only after Ime callback is set. + Bundle bundle = + getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_ARCH_TYPE_REMOVE_SPACE); + sendGestureAndVerifyGestureNotHandled(bundle); + + setImeCallbackAndVerifyMojoGestureData( + bundle, StylusWritingGestureAction.REMOVE_SPACES, null); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testStylusGestureMessage_invalidGestureType() { + mDwServiceCallback.setImeCallback(mImeCallback); + // Gesture type other than the expected ones are not handled. + Bundle bundle = spy(new Bundle()); + bundle.putString( + DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_GESTURE_TYPE, "invalid_gesture"); + // verify that gesture bundle is accessed but gesture is not handled for invalid gesture. + sendGestureAndVerifyGestureNotHandled(bundle); + verify(bundle).getString(DirectWritingServiceCallback.GESTURE_BUNDLE_KEY_GESTURE_TYPE, ""); + } + + @Test + @Feature({"Stylus Handwriting"}) + public void testOnTextViewExtraCommand_invalidAction() { + mDwServiceCallback.setImeCallback(mImeCallback); + // Text view extra command only handles gesture recognition. Other actions are ignored. + Bundle bundle = spy( + getGestureBundle(DirectWritingServiceCallback.GESTURE_TYPE_ARCH_TYPE_REMOVE_SPACE)); + mDwServiceCallback.onTextViewExtraCommand("invalid", bundle); + shadowOf(Looper.getMainLooper()).idle(); + // verify that Gesture bundle is never accessed, and not handled for invalid action. + verify(bundle, never()).getString(any(), any()); + verify(mImeCallback, never()).handleStylusWritingGestureAction(any()); + } }
diff --git a/components/sync_device_info/device_info.cc b/components/sync_device_info/device_info.cc index 2b1a5ed..239a824 100644 --- a/components/sync_device_info/device_info.cc +++ b/components/sync_device_info/device_info.cc
@@ -6,7 +6,6 @@ #include <utility> -#include "base/values.h" #include "components/sync/protocol/device_info_specifics.pb.h" #include "components/sync/protocol/sync_enums.pb.h" @@ -159,44 +158,6 @@ return paask_info_; } -std::string DeviceInfo::GetOSString() const { - switch (device_type_) { - case sync_pb::SyncEnums_DeviceType_TYPE_WIN: - return "win"; - case sync_pb::SyncEnums_DeviceType_TYPE_MAC: - return "mac"; - case sync_pb::SyncEnums_DeviceType_TYPE_LINUX: - return "linux"; - case sync_pb::SyncEnums_DeviceType_TYPE_CROS: - return "chrome_os"; - case sync_pb::SyncEnums_DeviceType_TYPE_PHONE: - case sync_pb::SyncEnums_DeviceType_TYPE_TABLET: - // TODO(lipalani): crbug.com/170375. Add support for ios - // phones and tablets. - return "android"; - case sync_pb::SyncEnums_DeviceType_TYPE_UNSET: - case sync_pb::SyncEnums_DeviceType_TYPE_OTHER: - return "unknown"; - } -} - -std::string DeviceInfo::GetDeviceTypeString() const { - switch (device_type_) { - case sync_pb::SyncEnums_DeviceType_TYPE_WIN: - case sync_pb::SyncEnums_DeviceType_TYPE_MAC: - case sync_pb::SyncEnums_DeviceType_TYPE_LINUX: - case sync_pb::SyncEnums_DeviceType_TYPE_CROS: - return "desktop_or_laptop"; - case sync_pb::SyncEnums_DeviceType_TYPE_PHONE: - return "phone"; - case sync_pb::SyncEnums_DeviceType_TYPE_TABLET: - return "tablet"; - case sync_pb::SyncEnums_DeviceType_TYPE_UNSET: - case sync_pb::SyncEnums_DeviceType_TYPE_OTHER: - return "unknown"; - } -} - const std::string& DeviceInfo::fcm_registration_token() const { return fcm_registration_token_; } @@ -205,20 +166,6 @@ return interested_data_types_; } -std::unique_ptr<base::DictionaryValue> DeviceInfo::ToValue() const { - std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue()); - value->SetString("name", client_name_); - value->SetString("id", public_id_); - value->SetString("os", GetOSString()); - value->SetString("type", GetDeviceTypeString()); - value->SetString("chromeVersion", chrome_version_); - value->SetInteger("lastUpdatedTimestamp", last_updated_timestamp().ToTimeT()); - value->SetBoolean("sendTabToSelfReceivingEnabled", - send_tab_to_self_receiving_enabled()); - value->SetBoolean("hasSharingInfo", sharing_info().has_value()); - return value; -} - void DeviceInfo::set_public_id(const std::string& id) { public_id_ = id; }
diff --git a/components/sync_device_info/device_info.h b/components/sync_device_info/device_info.h index fd02204..d23cc99 100644 --- a/components/sync_device_info/device_info.h +++ b/components/sync_device_info/device_info.h
@@ -15,10 +15,6 @@ #include "components/sync/base/model_type.h" #include "third_party/abseil-cpp/absl/types/optional.h" -namespace base { -class DictionaryValue; -} - namespace sync_pb { enum SharingSpecificFields_EnabledFeatures : int; enum SyncEnums_DeviceType : int; @@ -177,12 +173,6 @@ // Returns the data types for which this device receives invalidations. const ModelTypeSet& interested_data_types() const; - // Gets the OS in string form. - std::string GetOSString() const; - - // Gets the device type in string form. - std::string GetDeviceTypeString() const; - // Apps can set ids for a device that is meaningful to them but // not unique enough so the user can be tracked. Exposing |guid| // would lead to a stable unique id for a device which can potentially @@ -203,10 +193,6 @@ void set_interested_data_types(const ModelTypeSet& data_types); - // Converts the |DeviceInfo| values to a JS friendly DictionaryValue, - // which extension APIs can expose to third party apps. - std::unique_ptr<base::DictionaryValue> ToValue() const; - private: const std::string guid_;
diff --git a/components/test/data/storage/shared_storage.v1.empty_values_mapping.5origins.sql b/components/test/data/storage/shared_storage.v1.empty_values_mapping.5origins.sql new file mode 100644 index 0000000..a4d49e977 --- /dev/null +++ b/components/test/data/storage/shared_storage.v1.empty_values_mapping.5origins.sql
@@ -0,0 +1,18 @@ +-- components_unittests --gtest_filter=SharedStorageDatabaseTest.FiveOrigins +-- +-- .dump of a version 1 Shared Storage database. +BEGIN TRANSACTION; +CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); +INSERT INTO "meta" VALUES('version','1'); +INSERT INTO "meta" VALUES('last_compatible_version','1'); +CREATE TABLE values_mapping(context_origin TEXT NOT NULL,key TEXT NOT NULL,value TEXT,PRIMARY KEY(context_origin,key)) WITHOUT ROWID; +CREATE TABLE per_origin_mapping(context_origin TEXT NOT NULL PRIMARY KEY,last_used_time INTEGER NOT NULL,length INTEGER NOT NULL) WITHOUT ROWID; +INSERT INTO "per_origin_mapping" VALUES ('http://google.com',13266954476192362,20); +INSERT INTO "per_origin_mapping" VALUES ('http://chromium.org',13268941676192362,40); +INSERT INTO "per_origin_mapping" VALUES ('http://gv.com',13268941793856733,15); +INSERT INTO "per_origin_mapping" VALUES ('http://abc.xyz',13269481776356965,250); +INSERT INTO "per_origin_mapping" VALUES ('http://google.org',13269546476192362,10); +CREATE TABLE budget_mapping(id INTEGER NOT NULL PRIMARY KEY,context_origin TEXT NOT NULL,time_stamp INTEGER NOT NULL,bits_debit REAL NOT NULL); +CREATE INDEX IF NOT EXISTS per_origin_mapping_last_used_time_idx ON per_origin_mapping(last_used_time); +CREATE INDEX IF NOT EXISTS budget_mapping_origin_time_stamp_idx ON budget_mapping(context_origin,time_stamp); +COMMIT;
diff --git a/components/test/data/storage/shared_storage.v1.empty_values_mapping.6origins.sql b/components/test/data/storage/shared_storage.v1.empty_values_mapping.6origins.sql new file mode 100644 index 0000000..f1f9bd0 --- /dev/null +++ b/components/test/data/storage/shared_storage.v1.empty_values_mapping.6origins.sql
@@ -0,0 +1,19 @@ +-- components_unittests --gtest_filter=SharedStorageDatabaseTest.SixOrigins +-- +-- .dump of a version 1 Shared Storage database. +BEGIN TRANSACTION; +CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); +INSERT INTO "meta" VALUES('version','1'); +INSERT INTO "meta" VALUES('last_compatible_version','1'); +CREATE TABLE values_mapping(context_origin TEXT NOT NULL,key TEXT NOT NULL,value TEXT,PRIMARY KEY(context_origin,key)) WITHOUT ROWID; +CREATE TABLE per_origin_mapping(context_origin TEXT NOT NULL PRIMARY KEY,last_used_time INTEGER NOT NULL,length INTEGER NOT NULL) WITHOUT ROWID; +INSERT INTO "per_origin_mapping" VALUES ('http://google.com',13266954476192362,20); +INSERT INTO "per_origin_mapping" VALUES ('http://chromium.org',13268941676192362,40); +INSERT INTO "per_origin_mapping" VALUES ('http://gv.com',13268941793856733,15); +INSERT INTO "per_origin_mapping" VALUES ('http://abc.xyz',13269481776356965,250); +INSERT INTO "per_origin_mapping" VALUES ('http://waymo.com',13269546064355176,1599); +INSERT INTO "per_origin_mapping" VALUES ('http://google.org',13269546476192362,10); +CREATE TABLE budget_mapping(id INTEGER NOT NULL PRIMARY KEY,context_origin TEXT NOT NULL,time_stamp INTEGER NOT NULL,bits_debit REAL NOT NULL); +CREATE INDEX IF NOT EXISTS per_origin_mapping_last_used_time_idx ON per_origin_mapping(last_used_time); +CREATE INDEX IF NOT EXISTS budget_mapping_origin_time_stamp_idx ON budget_mapping(context_origin,time_stamp); +COMMIT;
diff --git a/components/test/data/storage/shared_storage.v1.empty_values_mapping.7origins.sql b/components/test/data/storage/shared_storage.v1.empty_values_mapping.7origins.sql new file mode 100644 index 0000000..4aa48d1 --- /dev/null +++ b/components/test/data/storage/shared_storage.v1.empty_values_mapping.7origins.sql
@@ -0,0 +1,20 @@ +-- components_unittests --gtest_filter=SharedStorageDatabaseTest.SevenOrigins +-- +-- .dump of a version 1 Shared Storage database. +BEGIN TRANSACTION; +CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); +INSERT INTO "meta" VALUES('version','1'); +INSERT INTO "meta" VALUES('last_compatible_version','1'); +CREATE TABLE values_mapping(context_origin TEXT NOT NULL,key TEXT NOT NULL,value TEXT,PRIMARY KEY(context_origin,key)) WITHOUT ROWID; +CREATE TABLE per_origin_mapping(context_origin TEXT NOT NULL PRIMARY KEY,last_used_time INTEGER NOT NULL,length INTEGER NOT NULL) WITHOUT ROWID; +INSERT INTO "per_origin_mapping" VALUES ('http://google.com',13266954476192362,20); +INSERT INTO "per_origin_mapping" VALUES ('http://chromium.org',13268941676192362,40); +INSERT INTO "per_origin_mapping" VALUES ('http://gv.com',13268941793856733,15); +INSERT INTO "per_origin_mapping" VALUES ('http://abc.xyz',13269481776356965,250); +INSERT INTO "per_origin_mapping" VALUES ('http://withgoogle.com',13269545986263676,1001); +INSERT INTO "per_origin_mapping" VALUES ('http://waymo.com',13269546064355176,1599); +INSERT INTO "per_origin_mapping" VALUES ('http://google.org',13269546476192362,10); +CREATE TABLE budget_mapping(id INTEGER NOT NULL PRIMARY KEY,context_origin TEXT NOT NULL,time_stamp INTEGER NOT NULL,bits_debit REAL NOT NULL); +CREATE INDEX IF NOT EXISTS per_origin_mapping_last_used_time_idx ON per_origin_mapping(last_used_time); +CREATE INDEX IF NOT EXISTS budget_mapping_origin_time_stamp_idx ON budget_mapping(context_origin,time_stamp); +COMMIT;
diff --git a/components/test/data/storage/shared_storage.v1.empty_values_mapping.8origins.sql b/components/test/data/storage/shared_storage.v1.empty_values_mapping.8origins.sql new file mode 100644 index 0000000..abcceb50 --- /dev/null +++ b/components/test/data/storage/shared_storage.v1.empty_values_mapping.8origins.sql
@@ -0,0 +1,21 @@ +-- components_unittests --gtest_filter=SharedStorageDatabaseTest.EightOrigins +-- +-- .dump of a version 1 Shared Storage database. +BEGIN TRANSACTION; +CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); +INSERT INTO "meta" VALUES('version','1'); +INSERT INTO "meta" VALUES('last_compatible_version','1'); +CREATE TABLE values_mapping(context_origin TEXT NOT NULL,key TEXT NOT NULL,value TEXT,PRIMARY KEY(context_origin,key)) WITHOUT ROWID; +CREATE TABLE per_origin_mapping(context_origin TEXT NOT NULL PRIMARY KEY,last_used_time INTEGER NOT NULL,length INTEGER NOT NULL) WITHOUT ROWID; +INSERT INTO "per_origin_mapping" VALUES ('http://google.com',13266954476192362,20); +INSERT INTO "per_origin_mapping" VALUES ('http://youtube.com',13266954593856733,100); +INSERT INTO "per_origin_mapping" VALUES ('http://chromium.org',13268941676192362,40); +INSERT INTO "per_origin_mapping" VALUES ('http://gv.com',13268941793856733,15); +INSERT INTO "per_origin_mapping" VALUES ('http://abc.xyz',13269481776356965,250); +INSERT INTO "per_origin_mapping" VALUES ('http://withgoogle.com',13269545986263676,1001); +INSERT INTO "per_origin_mapping" VALUES ('http://waymo.com',13269546064355176,1599); +INSERT INTO "per_origin_mapping" VALUES ('http://google.org',13269546476192362,10); +CREATE TABLE budget_mapping(id INTEGER NOT NULL PRIMARY KEY,context_origin TEXT NOT NULL,time_stamp INTEGER NOT NULL,bits_debit REAL NOT NULL); +CREATE INDEX IF NOT EXISTS per_origin_mapping_last_used_time_idx ON per_origin_mapping(last_used_time); +CREATE INDEX IF NOT EXISTS budget_mapping_origin_time_stamp_idx ON budget_mapping(context_origin,time_stamp); +COMMIT;
diff --git a/components/test/data/storage/shared_storage.v1.single_origin.sql b/components/test/data/storage/shared_storage.v1.single_origin.sql new file mode 100644 index 0000000..e13284ba --- /dev/null +++ b/components/test/data/storage/shared_storage.v1.single_origin.sql
@@ -0,0 +1,24 @@ +-- components_unittests --gtest_filter=SharedStorageDatabaseTest.SingleOrigin +-- +-- .dump of a version 1 Shared Storage database. +BEGIN TRANSACTION; +CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); +INSERT INTO "meta" VALUES('version','1'); +INSERT INTO "meta" VALUES('last_compatible_version','1'); +CREATE TABLE values_mapping(context_origin TEXT NOT NULL,key TEXT NOT NULL,value TEXT,PRIMARY KEY(context_origin,key)) WITHOUT ROWID; +INSERT INTO "values_mapping" VALUES ('http://google.com','key1','value1'); +INSERT INTO "values_mapping" VALUES ('http://google.com','key2','value2'); +INSERT INTO "values_mapping" VALUES ('http://google.com','key3','value3'); +INSERT INTO "values_mapping" VALUES ('http://google.com','key4','value4'); +INSERT INTO "values_mapping" VALUES ('http://google.com','key5','value5'); +INSERT INTO "values_mapping" VALUES ('http://google.com','key6','value6'); +INSERT INTO "values_mapping" VALUES ('http://google.com','key7','value7'); +INSERT INTO "values_mapping" VALUES ('http://google.com','key8','value8'); +INSERT INTO "values_mapping" VALUES ('http://google.com','key9','value9'); +INSERT INTO "values_mapping" VALUES ('http://google.com','key10','value10'); +CREATE TABLE per_origin_mapping(context_origin TEXT NOT NULL PRIMARY KEY,last_used_time INTEGER NOT NULL,length INTEGER NOT NULL) WITHOUT ROWID; +INSERT INTO "per_origin_mapping" VALUES ('http://google.com',13266954476192362,10); +CREATE TABLE budget_mapping(id INTEGER NOT NULL PRIMARY KEY,context_origin TEXT NOT NULL,time_stamp INTEGER NOT NULL,bits_debit REAL NOT NULL); +CREATE INDEX IF NOT EXISTS per_origin_mapping_last_used_time_idx ON per_origin_mapping(last_used_time); +CREATE INDEX IF NOT EXISTS budget_mapping_origin_time_stamp_idx ON budget_mapping(context_origin,time_stamp); +COMMIT;
diff --git a/components/tracing/common/trace_startup_config.cc b/components/tracing/common/trace_startup_config.cc index a1db0ce..b99ade3 100644 --- a/components/tracing/common/trace_startup_config.cc +++ b/components/tracing/common/trace_startup_config.cc
@@ -300,30 +300,29 @@ bool TraceStartupConfig::ParseTraceConfigFileContent( const std::string& content) { - std::unique_ptr<base::Value> value(base::JSONReader::ReadDeprecated(content)); + absl::optional<base::Value> value(base::JSONReader::Read(content)); if (!value || !value->is_dict()) return false; - std::unique_ptr<base::DictionaryValue> dict( - static_cast<base::DictionaryValue*>(value.release())); + auto& dict = value->GetDict(); - base::DictionaryValue* trace_config_dict = nullptr; - if (!dict->GetDictionary(kTraceConfigParam, &trace_config_dict)) + auto* trace_config_dict = dict.FindDict(kTraceConfigParam); + if (!trace_config_dict) return false; - trace_config_ = base::trace_event::TraceConfig(*trace_config_dict); + trace_config_ = base::trace_event::TraceConfig( + base::Value(std::move(*trace_config_dict))); startup_duration_in_seconds_ = - dict->FindIntKey(kStartupDurationParam).value_or(0); + dict.FindInt(kStartupDurationParam).value_or(0); if (startup_duration_in_seconds_ < 0) startup_duration_in_seconds_ = 0; - std::string result_file_or_dir_str; - if (dict->GetString(kResultFileParam, &result_file_or_dir_str)) { - result_file_ = base::FilePath::FromUTF8Unsafe(result_file_or_dir_str); - } else if (dict->GetString(kResultDirectoryParam, &result_file_or_dir_str)) { - result_file_ = base::FilePath::FromUTF8Unsafe(result_file_or_dir_str); + if (auto* result_file = dict.FindString(kResultFileParam)) { + result_file_ = base::FilePath::FromUTF8Unsafe(*result_file); + } else if (auto* result_dir = dict.FindString(kResultDirectoryParam)) { + result_file_ = base::FilePath::FromUTF8Unsafe(*result_dir); // Java time to get an int instead of a double. result_file_ = result_file_.AppendASCII( base::NumberToString(base::Time::Now().ToJavaTime()) +
diff --git a/components/variations/service/variations_service.cc b/components/variations/service/variations_service.cc index 03c100c..ff618ca 100644 --- a/components/variations/service/variations_service.cc +++ b/components/variations/service/variations_service.cc
@@ -11,19 +11,14 @@ #include <vector> #include "base/base64.h" -#include "base/base_switches.h" #include "base/bind.h" -#include "base/build_time.h" #include "base/callback.h" #include "base/command_line.h" -#include "base/debug/crash_logging.h" #include "base/feature_list.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "base/observer_list.h" -#include "base/strings/string_split.h" #include "base/strings/string_util.h" -#include "base/system/sys_info.h" #include "base/timer/elapsed_timer.h" #include "base/trace_event/trace_event.h" #include "base/values.h" @@ -33,7 +28,6 @@ #include "build/chromeos_buildflags.h" #include "components/encrypted_messages/encrypted_message.pb.h" #include "components/encrypted_messages/message_encrypter.h" -#include "components/metrics/clean_exit_beacon.h" #include "components/metrics/metrics_state_manager.h" #include "components/network_time/network_time_tracker.h" #include "components/pref_registry/pref_registry_syncable.h" @@ -42,25 +36,20 @@ #include "components/variations/pref_names.h" #include "components/variations/proto/variations_seed.pb.h" #include "components/variations/seed_response.h" -#include "components/variations/variations_seed_processor.h" #include "components/variations/variations_seed_simulator.h" #include "components/variations/variations_switches.h" #include "components/variations/variations_url_constants.h" #include "components/version_info/channel.h" #include "components/version_info/version_info.h" -#include "net/base/load_flags.h" #include "net/base/net_errors.h" -#include "net/base/network_change_notifier.h" #include "net/base/url_util.h" #include "net/http/http_response_headers.h" #include "net/http/http_status_code.h" -#include "net/http/http_util.h" #include "net/traffic_annotation/network_traffic_annotation.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/simple_url_loader.h" #include "services/network/public/mojom/url_response_head.mojom.h" -#include "ui/base/device_form_factor.h" #include "url/gurl.h" #if BUILDFLAG(IS_ANDROID) @@ -995,13 +984,12 @@ if (!variations_overridden_country.empty()) return variations_overridden_country; - const base::Value* list_value = - local_state_->GetList(prefs::kVariationsPermanentConsistencyCountry); + const auto& list_value = + local_state_->GetValueList(prefs::kVariationsPermanentConsistencyCountry); std::string stored_country; - base::Value::ConstListView list_view = list_value->GetListDeprecated(); - if (list_view.size() == 2 && list_view[1].is_string()) { - stored_country = list_view[1].GetString(); + if (list_value.size() == 2 && list_value[1].is_string()) { + stored_country = list_value[1].GetString(); } return stored_country;
diff --git a/content/browser/android/synchronous_compositor_host.cc b/content/browser/android/synchronous_compositor_host.cc index 9dd1d77..92d9ca3 100644 --- a/content/browser/android/synchronous_compositor_host.cc +++ b/content/browser/android/synchronous_compositor_host.cc
@@ -4,6 +4,7 @@ #include "content/browser/android/synchronous_compositor_host.h" +#include <algorithm> #include <atomic> #include <memory> #include <utility> @@ -207,6 +208,7 @@ const gfx::Rect& viewport_rect_for_tile_priority, const gfx::Transform& transform_for_tile_priority) { invalidate_needs_draw_ = false; + num_invalidates_since_last_draw_ = 0u; scoped_refptr<FrameFuture> frame_future = new FrameFuture(); if (!allow_async_draw_) { allow_async_draw_ = allow_async_draw_ || IsReadyForSynchronousCall(); @@ -335,6 +337,7 @@ blink::mojom::SyncCompositorDemandDrawSwParams::New(); // Unused. uint32_t metadata_version = 0u; invalidate_needs_draw_ = false; + num_invalidates_since_last_draw_ = 0u; if (!IsReadyForSynchronousCall() || !GetSynchronousCompositor()->DemandDrawSw(std::move(params), &common_renderer_params, @@ -620,6 +623,7 @@ if (need_invalidate_count_ != params->need_invalidate_count) { need_invalidate_count_ = params->need_invalidate_count; if (invalidate_needs_draw_) { + num_invalidates_since_last_draw_++; client_->PostInvalidate(this); } else { GetSynchronousCompositor()->WillSkipDraw(); @@ -715,12 +719,35 @@ } void SynchronousCompositorHost::SendBeginFrame(viz::BeginFrameArgs args) { + static bool enable_thorttling = base::FeatureList::IsEnabled( + ::features::kWebViewThrottleBackgroundBeginFrame); + if (enable_thorttling && num_invalidates_since_last_draw_ > 5u) { + // Throttle begin frames if there has been no draws in response to + // invalidates. This can happen if webview is detached or offscreen. There + // are cases where renderer is still expected to make progress. In this + // case renderer receives no back pressure so reduce the frequency of begin + // frames to avoid unnecessary work. + if (num_begin_frames_to_skip_) { + TRACE_EVENT_INSTANT0("cc", + "SynchronousCompositorHost::SendBeginFrame_skipped", + TRACE_EVENT_SCOPE_THREAD); + num_begin_frames_to_skip_--; + return; + } else { + num_begin_frames_to_skip_ = + std::min(num_invalidates_since_last_draw_ / 5, 250u); + } + } else { + num_begin_frames_to_skip_ = 0u; + } + TRACE_EVENT2("cc", "SynchronousCompositorHost::SendBeginFrame", "frame_number", args.frame_id.sequence_number, "frame_time_us", args.frame_time); if (!bridge_->WaitAfterVSyncOnUIThread()) return; + blink::mojom::SynchronousCompositor* compositor = GetSynchronousCompositor(); DCHECK(compositor); compositor->BeginFrame(args, timing_details_);
diff --git a/content/browser/android/synchronous_compositor_host.h b/content/browser/android/synchronous_compositor_host.h index 46912ae..e0b88a7 100644 --- a/content/browser/android/synchronous_compositor_host.h +++ b/content/browser/android/synchronous_compositor_host.h
@@ -207,6 +207,9 @@ // issued. Used to control action dispatch at the next |OnBeginFrame()| call. uint32_t outstanding_begin_frame_requests_ = 0; + uint32_t num_invalidates_since_last_draw_ = 0u; + uint32_t num_begin_frames_to_skip_ = 0u; + // The begin frame source being observed. Null if none. raw_ptr<viz::BeginFrameSource> begin_frame_source_ = nullptr; viz::BeginFrameArgs last_begin_frame_args_;
diff --git a/content/browser/loader/navigation_early_hints_manager.cc b/content/browser/loader/navigation_early_hints_manager.cc index 325fd8c..2b32db55 100644 --- a/content/browser/loader/navigation_early_hints_manager.cc +++ b/content/browser/loader/navigation_early_hints_manager.cc
@@ -300,7 +300,7 @@ NavigationEarlyHintsManager::InflightPreload::InflightPreload( std::unique_ptr<blink::ThrottlingURLLoader> loader, std::unique_ptr<PreloadURLLoaderClient> client) - : loader(std::move(loader)), client(std::move(client)) {} + : client(std::move(client)), loader(std::move(loader)) {} NavigationEarlyHintsManager::InflightPreload::~InflightPreload() = default;
diff --git a/content/browser/loader/navigation_early_hints_manager.h b/content/browser/loader/navigation_early_hints_manager.h index dbce164..01b38f4 100644 --- a/content/browser/loader/navigation_early_hints_manager.h +++ b/content/browser/loader/navigation_early_hints_manager.h
@@ -167,8 +167,10 @@ InflightPreload(InflightPreload&&) = delete; InflightPreload& operator=(InflightPreload&&) = delete; - std::unique_ptr<blink::ThrottlingURLLoader> loader; + // `loader` holds a raw_ptr on `client`, so it needs to be declared last to + // avoid holding a dangling reference to `client` at destruction. std::unique_ptr<PreloadURLLoaderClient> client; + std::unique_ptr<blink::ThrottlingURLLoader> loader; }; // Using flat_map because the number of preloads are expected to be small. // Early Hints preloads should be requested for critical subresources such as
diff --git a/content/browser/renderer_host/pending_beacon_host.cc b/content/browser/renderer_host/pending_beacon_host.cc index c73d2cd..636b0dc 100644 --- a/content/browser/renderer_host/pending_beacon_host.cc +++ b/content/browser/renderer_host/pending_beacon_host.cc
@@ -11,6 +11,7 @@ #include "services/network/public/cpp/data_element.h" #include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/shared_url_loader_factory.h" +#include "services/network/public/mojom/fetch_api.mojom.h" namespace content { @@ -93,11 +94,6 @@ mojo::ReportBadMessage("Unexpected BeaconMethod from renderer"); return; } - if (!content_type.empty() && - !network::cors::IsCorsSafelistedContentType(content_type)) { - mojo::ReportBadMessage("Unexpected Content-Type from renderer"); - return; - } content_type_ = content_type; @@ -143,13 +139,19 @@ Beacon::GenerateResourceRequest() const { DCHECK(method_ == blink::mojom::BeaconMethod::kGet || method_ == blink::mojom::BeaconMethod::kPost); + auto request = std::make_unique<network::ResourceRequest>(); + + request->url = url_; + request->mode = network::mojom::RequestMode::kCors; + request->request_initiator = + beacon_host_->render_frame_host().GetLastCommittedOrigin(); + request->credentials_mode = network::mojom::CredentialsMode::kSameOrigin; + if (method_ == blink::mojom::BeaconMethod::kGet) { request->method = net::HttpRequestHeaders::kGetMethod; - request->url = url_; } else { request->method = net::HttpRequestHeaders::kPostMethod; - request->url = url_; request->keepalive = true; if (!content_type_.empty()) { request->headers.SetHeader(net::HttpRequestHeaders::kContentType, @@ -164,6 +166,7 @@ request_element_->Clone()); } } + return request; };
diff --git a/content/browser/renderer_host/pending_beacon_host.h b/content/browser/renderer_host/pending_beacon_host.h index 264fd18c..7a22df1 100644 --- a/content/browser/renderer_host/pending_beacon_host.h +++ b/content/browser/renderer_host/pending_beacon_host.h
@@ -11,6 +11,7 @@ #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver.h" #include "services/network/public/cpp/shared_url_loader_factory.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/mojom/frame/pending_beacon.mojom.h" namespace network { @@ -94,10 +95,11 @@ DOCUMENT_USER_DATA_KEY_DECL(); }; -// Browser-side representation of a pending beacon. These are stored in -// a PendingBeaconHost. Their lifetime is until they are sent - this happens -// either when the PendingBeaconHost is destroyed, or the beacon's `SendNow` -// method is called. +// `Beacon` is the browser-side representation of a PendingBeacon. +// It is created and stored in a `PendingBeaconHost`. Hence, their lifetime is +// until they are sent, which happens in one of the following scenarios: +// - When the PendingBeaconHost is destroyed. +// - When the beacon's `SendNow()` method is called. class Beacon : public blink::mojom::PendingBeacon { public: // Browser-side pending beacon constructor. Parameters correspond to the @@ -114,6 +116,12 @@ void Deactivate() override; // Sets request data for the pending beacon. + // It is only allowed when this beacon's `BeaconMethod` is kPost. + // `request_body` must + // - Contain only single data element. Complex body is not allowed. + // - Contain NO `kChunkedDataPipe` data element. + // The above restrictions come from how PendingBeaconService handles + // requests. void SetRequestData(scoped_refptr<network::ResourceRequestBody> request_body, const std::string& content_type) override; @@ -142,11 +150,14 @@ private: mojo::Receiver<blink::mojom::PendingBeacon> receiver_; - // The beacon host that owns this beacon. raw_ptr is safe here as the host's - // lifetime will always be longer than the individual beacon's. + // Points to the PendingBeaconHost that owns the instance of this beacon. + // raw_ptr is safe here as the `beacon_host_`'s lifetime will always be longer + // than the individual beacons it owns. raw_ptr<PendingBeaconHost> beacon_host_; + // The request URL this beacon will be sent to. GURL url_; - [[maybe_unused]] const blink::mojom::BeaconMethod method_; + // The request method that will be used to send this beacon. + const blink::mojom::BeaconMethod method_; // The request content type for POST beacon. If `method_` is GET, this field // should not be used.
diff --git a/content/browser/renderer_host/pending_beacon_host_unittest.cc b/content/browser/renderer_host/pending_beacon_host_unittest.cc index cffb3aa..753fd8d 100644 --- a/content/browser/renderer_host/pending_beacon_host_unittest.cc +++ b/content/browser/renderer_host/pending_beacon_host_unittest.cc
@@ -6,6 +6,7 @@ #include <vector> +#include "base/files/file_path.h" #include "base/memory/scoped_refptr.h" #include "base/test/bind.h" #include "content/browser/renderer_host/pending_beacon_service.h" @@ -13,10 +14,13 @@ #include "mojo/public/cpp/system/functions.h" #include "net/http/http_request_headers.h" #include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h" +#include "services/network/public/mojom/fetch_api.mojom.h" #include "services/network/test/test_url_loader_factory.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "third_party/blink/public/mojom/frame/pending_beacon.mojom-shared.h" #include "third_party/blink/public/mojom/frame/pending_beacon.mojom.h" +#include "url/origin.h" namespace content { @@ -37,6 +41,7 @@ PendingBeaconHost* CreateHost() { test_url_loader_factory_ = std::make_unique<network::TestURLLoaderFactory>(); + NavigateAndCommit(GURL(kBeaconPageURL)); PendingBeaconHost::CreateForCurrentDocument( main_rfh(), test_url_loader_factory_->GetSafeWeakWrapper(), @@ -51,6 +56,15 @@ return blink::mojom::BeaconMethod::kPost; } + // Verifies if the total number of network requests sent via + // `test_url_loader_factory_` equals to `expected`. + void ExpectTotalNetworkRequests(const base::Location& location, + const int expected) { + EXPECT_EQ(test_url_loader_factory_->NumPending(), expected) + << location.ToString(); + } + + static constexpr char kBeaconPageURL[] = "http://test-pending-beacon"; std::unique_ptr<network::TestURLLoaderFactory> test_url_loader_factory_; }; @@ -63,6 +77,12 @@ const GURL& url) { test_url_loader_factory_->SetInterceptor(base::BindLambdaForTesting( [location, method, url](const network::ResourceRequest& request) { + EXPECT_EQ(request.mode, network::mojom::RequestMode::kCors); + EXPECT_EQ(request.request_initiator, + url::Origin::Create(GURL(kBeaconPageURL))); + EXPECT_EQ(request.credentials_mode, + network::mojom::CredentialsMode::kSameOrigin); + EXPECT_EQ(request.method, method) << location.ToString(); EXPECT_EQ(request.url, url) << location.ToString(); if (method == net::HttpRequestHeaders::kPostMethod) { @@ -70,14 +90,6 @@ } })); } - - // Verifies if the total number of network requests sent via - // `test_url_loader_factory_` equals to `expected`. - void ExpectTotalNetworkRequests(const base::Location& location, - const int expected) { - EXPECT_EQ(test_url_loader_factory_->NumPending(), expected) - << location.ToString(); - } }; INSTANTIATE_TEST_SUITE_P( @@ -183,7 +195,7 @@ ExpectTotalNetworkRequests(FROM_HERE, total - 1); } -class BeaconTest : public PendingBeaconHostTestBase { +class BeaconTestBase : public PendingBeaconHostTestBase { protected: void TearDown() override { host_ = nullptr; @@ -206,12 +218,41 @@ data.size()); } + scoped_refptr<network::ResourceRequestBody> CreateFileRequestBody( + uint64_t offset = 0, + uint64_t length = 10) { + scoped_refptr<network::ResourceRequestBody> body = + base::MakeRefCounted<network::ResourceRequestBody>(); + body->AppendFileRange(base::FilePath(FILE_PATH_LITERAL("file.txt")), offset, + length, base::Time()); + return body; + } + + scoped_refptr<network::ResourceRequestBody> CreateComplexRequestBody() { + auto body = CreateRequestBody("part1"); + body->AppendFileRange(base::FilePath(FILE_PATH_LITERAL("part2.txt")), 0, 10, + base::Time()); + return body; + } + + scoped_refptr<network::ResourceRequestBody> CreateStreamingRequestBody() { + mojo::PendingRemote<network::mojom::ChunkedDataPipeGetter> remote; + auto unused_receiver = remote.InitWithNewPipeAndPassReceiver(); + scoped_refptr<network::ResourceRequestBody> body = + base::MakeRefCounted<network::ResourceRequestBody>(); + body->SetToChunkedDataPipe( + std::move(remote), network::ResourceRequestBody::ReadOnlyOnce(false)); + return body; + } + private: // Owned by `main_rfh()`. PendingBeaconHost* host_; }; -TEST_F(BeaconTest, AttemptToSetDataForGetBeaconAndTerminated) { +using GetBeaconTest = BeaconTestBase; + +TEST_F(GetBeaconTest, AttemptToSetRequestDataForGetBeaconAndTerminated) { auto beacon_remote = CreateBeaconAndPassRemote(net::HttpRequestHeaders::kGetMethod); // Intercepts Mojo bad-message error. @@ -228,7 +269,9 @@ EXPECT_EQ(bad_message, "Unexpected BeaconMethod from renderer"); } -TEST_F(BeaconTest, AttemptToSetUnsafeContentTypeAndTerminated) { +using PostBeaconTest = BeaconTestBase; + +TEST_F(PostBeaconTest, AttemptToSetRequestDataWithComplexBodyAndTerminated) { auto beacon_remote = CreateBeaconAndPassRemote(net::HttpRequestHeaders::kPostMethod); // Intercepts Mojo bad-message error. @@ -239,14 +282,30 @@ bad_message = error; })); - beacon_remote->SetRequestData(CreateRequestBody("data"), - "application/unsafe"); + beacon_remote->SetRequestData(CreateComplexRequestBody(), ""); beacon_remote.FlushForTesting(); - EXPECT_EQ(bad_message, "Unexpected Content-Type from renderer"); + EXPECT_EQ(bad_message, "Complex body is not supported yet"); } -TEST_F(BeaconTest, AttemptToSetURLForPostBeaconAndTerminated) { +TEST_F(PostBeaconTest, AttemptToSetRequestDataWithStreamingBodyAndTerminated) { + auto beacon_remote = + CreateBeaconAndPassRemote(net::HttpRequestHeaders::kPostMethod); + // Intercepts Mojo bad-message error. + std::string bad_message; + mojo::SetDefaultProcessErrorHandler( + base::BindLambdaForTesting([&](const std::string& error) { + ASSERT_TRUE(bad_message.empty()); + bad_message = error; + })); + + beacon_remote->SetRequestData(CreateStreamingRequestBody(), ""); + beacon_remote.FlushForTesting(); + + EXPECT_EQ(bad_message, "Streaming body is not supported."); +} + +TEST_F(PostBeaconTest, AttemptToSetRequestURLForPostBeaconAndTerminated) { auto beacon_remote = CreateBeaconAndPassRemote(net::HttpRequestHeaders::kPostMethod); // Intercepts Mojo bad-message error. @@ -263,4 +322,117 @@ EXPECT_EQ(bad_message, "Unexpected BeaconMethod from renderer"); } +class PostBeaconRequestDataTest : public BeaconTestBase { + protected: + // Registers a callback to verify if the most-recent network request's content + // matches the given `expected_body` and `expected_content_type`. + void SetExpectNetworkRequest( + const base::Location& location, + scoped_refptr<network::ResourceRequestBody> expected_body, + const absl::optional<std::string>& expected_content_type = + absl::nullopt) { + test_url_loader_factory_->SetInterceptor(base::BindLambdaForTesting( + [location, expected_body, + expected_content_type](const network::ResourceRequest& request) { + ASSERT_EQ(request.method, net::HttpRequestHeaders::kPostMethod) + << location.ToString(); + ASSERT_EQ(request.request_body->elements()->size(), 1u) + << location.ToString(); + + const auto& expected_element = expected_body->elements()->at(0); + const auto& element = request.request_body->elements()->at(0); + EXPECT_EQ(element.type(), expected_element.type()); + if (expected_element.type() == network::DataElement::Tag::kBytes) { + const auto& expected_bytes = + expected_element.As<network::DataElementBytes>(); + const auto& bytes = element.As<network::DataElementBytes>(); + EXPECT_EQ(bytes.AsStringPiece(), expected_bytes.AsStringPiece()) + << location.ToString(); + } else if (expected_element.type() == + network::DataElement::Tag::kFile) { + const auto& expected_file = + expected_element.As<network::DataElementFile>(); + const auto& file = element.As<network::DataElementFile>(); + EXPECT_EQ(file.path(), expected_file.path()) << location.ToString(); + EXPECT_EQ(file.offset(), expected_file.offset()) + << location.ToString(); + EXPECT_EQ(file.length(), expected_file.length()) + << location.ToString(); + } + + if (!expected_content_type.has_value()) { + EXPECT_FALSE(request.headers.HasHeader( + net::HttpRequestHeaders::kContentType)) + << location.ToString(); + return; + } + std::string content_type; + EXPECT_TRUE(request.headers.GetHeader( + net::HttpRequestHeaders::kContentType, &content_type)) + << location.ToString(); + EXPECT_EQ(content_type, expected_content_type) << location.ToString(); + })); + } + + mojo::Remote<blink::mojom::PendingBeacon> CreateBeaconAndPassRemote() { + return BeaconTestBase::CreateBeaconAndPassRemote( + net::HttpRequestHeaders::kPostMethod); + } +}; + +TEST_F(PostBeaconRequestDataTest, SendBytesWithCorsSafelistedContentType) { + auto beacon_remote = CreateBeaconAndPassRemote(); + + auto body = CreateRequestBody("data"); + beacon_remote->SetRequestData(body, "text/plain"); + + SetExpectNetworkRequest(FROM_HERE, body, "text/plain"); + beacon_remote->SendNow(); + ExpectTotalNetworkRequests(FROM_HERE, 1); +} + +TEST_F(PostBeaconRequestDataTest, SendBytesWithEmptyContentType) { + auto beacon_remote = CreateBeaconAndPassRemote(); + + auto body = CreateRequestBody("data"); + beacon_remote->SetRequestData(body, ""); + + SetExpectNetworkRequest(FROM_HERE, body); + beacon_remote->SendNow(); + ExpectTotalNetworkRequests(FROM_HERE, 1); +} + +TEST_F(PostBeaconRequestDataTest, SendBlobWithCorsSafelistedContentType) { + auto beacon_remote = CreateBeaconAndPassRemote(); + + auto body = CreateFileRequestBody(); + beacon_remote->SetRequestData(body, "text/plain"); + + SetExpectNetworkRequest(FROM_HERE, body, "text/plain"); + beacon_remote->SendNow(); + ExpectTotalNetworkRequests(FROM_HERE, 1); +} + +TEST_F(PostBeaconRequestDataTest, SendBlobWithEmptyContentType) { + auto beacon_remote = CreateBeaconAndPassRemote(); + + auto body = CreateFileRequestBody(); + beacon_remote->SetRequestData(body, ""); + + SetExpectNetworkRequest(FROM_HERE, body); + beacon_remote->SendNow(); + ExpectTotalNetworkRequests(FROM_HERE, 1); +} + +TEST_F(PostBeaconRequestDataTest, SendBlobWithNonCorsSafelistedContentType) { + auto beacon_remote = CreateBeaconAndPassRemote(); + + auto body = CreateFileRequestBody(); + beacon_remote->SetRequestData(body, "application/unsafe"); + + SetExpectNetworkRequest(FROM_HERE, body, "application/unsafe"); + beacon_remote->SendNow(); + ExpectTotalNetworkRequests(FROM_HERE, 1); +} + } // namespace content
diff --git a/content/browser/renderer_host/pending_beacon_service.cc b/content/browser/renderer_host/pending_beacon_service.cc index 66f27a1..a174c1e9 100644 --- a/content/browser/renderer_host/pending_beacon_service.cc +++ b/content/browser/renderer_host/pending_beacon_service.cc
@@ -74,14 +74,25 @@ kPendingBeaconNetworkTag); if (element.has_value()) { + const auto& content_type = beacon->content_type(); if (element->type() == network::DataElement::Tag::kBytes) { const auto& bytes = element->As<network::DataElementBytes>(); - simple_url_loader->AttachStringForUpload( - std::string(bytes.AsStringPiece()), beacon->content_type()); + if (content_type.empty()) { + simple_url_loader->AttachStringForUpload( + std::string(bytes.AsStringPiece())); + } else { + simple_url_loader->AttachStringForUpload( + std::string(bytes.AsStringPiece()), content_type); + } } else if (element->type() == network::DataElement::Tag::kFile) { const auto& file = element->As<network::DataElementFile>(); - simple_url_loader->AttachFileForUpload( - file.path(), beacon->content_type(), file.offset(), file.length()); + if (content_type.empty()) { + simple_url_loader->AttachFileForUpload(file.path(), file.offset(), + file.length()); + } else { + simple_url_loader->AttachFileForUpload(file.path(), content_type, + file.offset(), file.length()); + } } else { NOTREACHED(); }
diff --git a/content/browser/service_worker/service_worker_single_script_update_checker.h b/content/browser/service_worker/service_worker_single_script_update_checker.h index 67f382fe..8fc79b81 100644 --- a/content/browser/service_worker/service_worker_single_script_update_checker.h +++ b/content/browser/service_worker/service_worker_single_script_update_checker.h
@@ -208,7 +208,6 @@ bool network_accessed_ = false; network::CrossOriginEmbedderPolicy cross_origin_embedder_policy_; - std::unique_ptr<blink::ThrottlingURLLoader> network_loader_; // The endpoint called by `network_loader_`. That needs to be alive while // `network_loader_` is alive. mojo::Remote<network::mojom::URLLoaderClient> network_client_remote_; @@ -217,6 +216,11 @@ mojo::ScopedDataPipeConsumerHandle network_consumer_; mojo::SimpleWatcher network_watcher_; + // `network_loader_` needs to be declared after `network_client_remote_` + // because the former holds a `raw_ptr` on the latter, and thus it needs to + // be destroyed first to avoid holding a dangling pointer. + std::unique_ptr<blink::ThrottlingURLLoader> network_loader_; + std::unique_ptr<ServiceWorkerCacheWriter> cache_writer_; ResultCallback callback_;
diff --git a/content/browser/webid/idp_network_request_manager.cc b/content/browser/webid/idp_network_request_manager.cc index a92d903..ebf40741 100644 --- a/content/browser/webid/idp_network_request_manager.cc +++ b/content/browser/webid/idp_network_request_manager.cc
@@ -5,6 +5,7 @@ #include "content/browser/webid/idp_network_request_manager.h" #include "base/base64.h" +#include "base/containers/flat_set.h" #include "base/json/json_writer.h" #include "base/strings/escape.h" #include "content/browser/renderer_host/render_frame_host_impl.h" @@ -223,13 +224,18 @@ if (!accounts->is_list()) return false; + base::flat_set<std::string> account_ids; for (auto& account : accounts->GetListDeprecated()) { if (!account.is_dict()) return false; auto parsed_account = ParseAccount(account, client_id); - if (parsed_account) + if (parsed_account) { + if (account_ids.count(parsed_account->id)) + return false; account_list.push_back(parsed_account.value()); + account_ids.insert(parsed_account->id); + } } return !account_list.empty(); }
diff --git a/content/browser/webid/idp_network_request_manager_unittest.cc b/content/browser/webid/idp_network_request_manager_unittest.cc index 27af482..f2949c5 100644 --- a/content/browser/webid/idp_network_request_manager_unittest.cc +++ b/content/browser/webid/idp_network_request_manager_unittest.cc
@@ -21,6 +21,7 @@ #include "services/network/public/mojom/client_security_state.mojom.h" #include "services/network/test/test_url_loader_factory.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/re2/src/re2/re2.h" #include "ui/gfx/geometry/size.h" #include "url/gurl.h" @@ -50,6 +51,43 @@ const char kTestClientMetadataEndpoint[] = "https://idp.test/client_metadata_endpoint"; +const char kSingleAccountEndpointValidJson[] = R"({ + "accounts" : [ + { + "id" : "1234", + "email": "ken@idp.test", + "name": "Ken R. Example", + "given_name": "Ken", + "picture": "https://idp.test/profile/1" + } + ] + })"; + +// Replaces the first line with the passed-in JSON key in `input` with +// `new_line`. +std::string ReplaceFirstLineWithKeyFromJson(const std::string& key, + const std::string& new_line, + const std::string& input, + bool replace_all) { + std::string pattern = R"(^[ ]*")" + key + R"(".*$)"; + std::string result = input; + RE2::Options options; + options.set_posix_syntax(true); + options.set_one_line(false); + RE2 re2(pattern, options); + if (replace_all) + RE2::GlobalReplace(&result, re2, new_line); + else + RE2::Replace(&result, re2, new_line); + return result; +} + +// Removes all lines with the passed-in JSON key in `input`. +std::string RemoveAllLinesWithKeyFromJson(const std::string& key, + const std::string& input) { + return ReplaceFirstLineWithKeyFromJson(key, "", input, /*replace_all=*/true); +} + class IdpNetworkRequestManagerTest : public ::testing::Test { public: std::unique_ptr<IdpNetworkRequestManager> CreateTestManager() { @@ -107,7 +145,7 @@ } std::tuple<FetchStatus, AccountList> SendAccountsRequestAndWaitForResponse( - const char* test_accounts, + const std::string& test_accounts, const char* client_id = "", bool send_id_and_referrer = false) { GURL accounts_endpoint(kTestAccountsEndpoint); @@ -205,17 +243,7 @@ } TEST_F(IdpNetworkRequestManagerTest, ParseAccountSingle) { - const auto* test_single_account_json = R"({ - "accounts" : [ - { - "id" : "1234", - "email": "ken@idp.test", - "name": "Ken R. Example", - "given_name": "Ken", - "picture": "https://idp.test/profile/1" - } - ] - })"; + const auto* test_single_account_json = kSingleAccountEndpointValidJson; FetchStatus accounts_response; AccountList accounts; @@ -280,45 +308,74 @@ TEST_F(IdpNetworkRequestManagerTest, ParseAccountRequiredFields) { { - const auto* test_accounts_missing_account_id_json = R"({"accounts" : [{ - "email": "ken@idp.test", - "name": "Ken R. Example" - }]})"; + std::string test_account_missing_account_id_json = + RemoveAllLinesWithKeyFromJson("id", kSingleAccountEndpointValidJson); FetchStatus accounts_response; AccountList accounts; std::tie(accounts_response, accounts) = SendAccountsRequestAndWaitForResponse( - test_accounts_missing_account_id_json); + test_account_missing_account_id_json); EXPECT_EQ(FetchStatus::kInvalidResponseError, accounts_response); EXPECT_TRUE(accounts.empty()); } { - const auto* test_accounts_missing_email_json = R"({"accounts" : [{ + std::string test_account_missing_email_json = + RemoveAllLinesWithKeyFromJson("email", kSingleAccountEndpointValidJson); + FetchStatus accounts_response; + AccountList accounts; + std::tie(accounts_response, accounts) = + SendAccountsRequestAndWaitForResponse(test_account_missing_email_json); + + EXPECT_EQ(FetchStatus::kInvalidResponseError, accounts_response); + EXPECT_TRUE(accounts.empty()); + } + { + std::string test_account_missing_name_json = + RemoveAllLinesWithKeyFromJson("name", kSingleAccountEndpointValidJson); + FetchStatus accounts_response; + AccountList accounts; + std::tie(accounts_response, accounts) = + SendAccountsRequestAndWaitForResponse(test_account_missing_name_json); + + EXPECT_EQ(FetchStatus::kInvalidResponseError, accounts_response); + EXPECT_TRUE(accounts.empty()); + } +} + +// Test that parsing accounts fails if two accounts have the same account id. +TEST_F(IdpNetworkRequestManagerTest, ParseAccountDuplicateIds) { + const auto* accounts_json = R"({ + "accounts" : [ + { "id" : "1234", + "email": "ken@idp.test", "name": "Ken R. Example" - }]})"; - FetchStatus accounts_response; - AccountList accounts; - std::tie(accounts_response, accounts) = - SendAccountsRequestAndWaitForResponse(test_accounts_missing_email_json); - - EXPECT_EQ(FetchStatus::kInvalidResponseError, accounts_response); - EXPECT_TRUE(accounts.empty()); - } - { - const auto* test_accounts_missing_name_json = R"({"accounts" : [{ + }, + { "id" : "1234", - "email": "ken@idp.test" - }]})"; - FetchStatus accounts_response; - AccountList accounts; - std::tie(accounts_response, accounts) = - SendAccountsRequestAndWaitForResponse(test_accounts_missing_name_json); + "email": "ken@idp.test", + "name": "Ken R. Example" + } + ] + })"; - EXPECT_EQ(FetchStatus::kInvalidResponseError, accounts_response); - EXPECT_TRUE(accounts.empty()); - } + FetchStatus accounts_response; + AccountList accounts; + std::tie(accounts_response, accounts) = + SendAccountsRequestAndWaitForResponse(accounts_json); + + EXPECT_EQ(FetchStatus::kInvalidResponseError, accounts_response); + EXPECT_TRUE(accounts.empty()); + + // Test that JSON is valid with exception of duplicate id. + std::string accounts_json_different_account_ids = + ReplaceFirstLineWithKeyFromJson("id", R"("id": "5678",)", accounts_json, + /*replace_all=*/false); + + std::tie(accounts_response, accounts) = SendAccountsRequestAndWaitForResponse( + accounts_json_different_account_ids); + EXPECT_EQ(FetchStatus::kSuccess, accounts_response); } TEST_F(IdpNetworkRequestManagerTest, ParseAccountPictureUrl) {
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 2f1ec10..1b4701ad7 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -1247,6 +1247,10 @@ // https://w3c.github.io/web-nfc/ const base::Feature kWebNfc{"WebNFC", base::FEATURE_ENABLED_BY_DEFAULT}; +// Throttle begin frame if Android WebView isn't getting draws. +const base::Feature kWebViewThrottleBackgroundBeginFrame{ + "WebViewThrottleBackgroundBeginFrame", base::FEATURE_DISABLED_BY_DEFAULT}; + // When the context menu is triggered, the browser allows motion in a small // region around the initial touch location menu to allow for finger jittering. // This param holds the movement threshold in DIPs to consider drag an
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 9a7319e..2da8c594 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -323,6 +323,7 @@ CONTENT_EXPORT extern const base::Feature kUserMediaScreenCapturing; CONTENT_EXPORT extern const base::Feature kWarmUpNetworkProcess; CONTENT_EXPORT extern const base::Feature kWebNfc; +CONTENT_EXPORT extern const base::Feature kWebViewThrottleBackgroundBeginFrame; extern const char kDragAndDropMovementThresholdDipParam[];
diff --git a/ios/chrome/app/application_delegate/app_state.mm b/ios/chrome/app/application_delegate/app_state.mm index a577385..b0d5a04 100644 --- a/ios/chrome/app/application_delegate/app_state.mm +++ b/ios/chrome/app/application_delegate/app_state.mm
@@ -28,7 +28,7 @@ #import "ios/chrome/app/application_delegate/user_activity_handler.h" #import "ios/chrome/app/deferred_initialization_runner.h" #import "ios/chrome/app/main_application_delegate.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browsing_data/sessions_storage_util.h" #include "ios/chrome/browser/chrome_constants.h"
diff --git a/ios/chrome/app/application_delegate/metrics_mediator.mm b/ios/chrome/app/application_delegate/metrics_mediator.mm index 4c170ec7..5a2c2cd 100644 --- a/ios/chrome/app/application_delegate/metrics_mediator.mm +++ b/ios/chrome/app/application_delegate/metrics_mediator.mm
@@ -24,7 +24,7 @@ #import "ios/chrome/app/application_delegate/metric_kit_subscriber.h" #import "ios/chrome/app/application_delegate/startup_information.h" #include "ios/chrome/app/startup/ios_enable_sandbox_dump_buildflags.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/crash_report/crash_helper.h" #include "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/app/application_delegate/metrics_mediator_unittest.mm b/ios/chrome/app/application_delegate/metrics_mediator_unittest.mm index 4b8adec11..d50bb014 100644 --- a/ios/chrome/app/application_delegate/metrics_mediator_unittest.mm +++ b/ios/chrome/app/application_delegate/metrics_mediator_unittest.mm
@@ -12,7 +12,7 @@ #import "components/previous_session_info/previous_session_info.h" #import "components/previous_session_info/previous_session_info_private.h" #import "ios/chrome/app/application_delegate/startup_information.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/main/test_browser.h"
diff --git a/ios/chrome/app/enterprise_app_agent.mm b/ios/chrome/app/enterprise_app_agent.mm index 7f63587..ab7facd 100644 --- a/ios/chrome/app/enterprise_app_agent.mm +++ b/ios/chrome/app/enterprise_app_agent.mm
@@ -12,7 +12,7 @@ #include "ios/chrome/app/application_delegate/startup_information.h" #import "ios/chrome/app/enterprise_loading_screen_view_controller.h" #import "ios/chrome/app/tests_hook.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/policy/browser_policy_connector_ios.h" #include "ios/chrome/browser/policy/chrome_browser_cloud_management_controller_ios.h" #import "ios/chrome/browser/policy/chrome_browser_cloud_management_controller_observer_bridge.h"
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm index 73d33ab7..c14e8242 100644 --- a/ios/chrome/app/main_controller.mm +++ b/ios/chrome/app/main_controller.mm
@@ -57,7 +57,7 @@ #import "ios/chrome/app/startup_tasks.h" #include "ios/chrome/app/tests_hook.h" #import "ios/chrome/browser/accessibility/window_accessibility_change_notifier_app_agent.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.h"
diff --git a/ios/chrome/app/startup_tasks.mm b/ios/chrome/app/startup_tasks.mm index 99a7f77..e1fbf24c 100644 --- a/ios/chrome/app/startup_tasks.mm +++ b/ios/chrome/app/startup_tasks.mm
@@ -10,7 +10,7 @@ #include "base/metrics/histogram_functions.h" #include "base/task/thread_pool.h" #import "ios/chrome/app/deferred_initialization_runner.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/ios_chrome_io_thread.h" #import "ios/chrome/browser/omaha/omaha_service.h"
diff --git a/ios/chrome/browser/BUILD.gn b/ios/chrome/browser/BUILD.gn index 8c1692c..fba5383 100644 --- a/ios/chrome/browser/BUILD.gn +++ b/ios/chrome/browser/BUILD.gn
@@ -25,15 +25,6 @@ ] } -source_set("application_context") { - configs += [ "//build/config/compiler:enable_arc" ] - sources = [ - "application_context.h", - "application_context.mm", - ] - deps = [ "//base" ] -} - source_set("browser") { configs += [ "//build/config/compiler:enable_arc" ] sources = [ @@ -121,11 +112,11 @@ "//url", ] public_deps = [ - ":application_context", ":chrome_paths", ":chrome_url_constants", ":pref_names", ":utils", + "//ios/chrome/browser/application_context", ] allow_circular_includes_from = [ "//ios/chrome/browser/sync/glue", @@ -182,8 +173,6 @@ source_set("browser_impl") { configs += [ "//build/config/compiler:enable_arc" ] sources = [ - "application_context_impl.h", - "application_context_impl.mm", "ios_chrome_main_parts.h", "ios_chrome_main_parts.mm", "ios_thread_profiler.cc", @@ -224,6 +213,7 @@ "//components/variations/service", "//components/version_info", "//ios/chrome/app:tests_hook", + "//ios/chrome/browser/application_context:application_context_impl", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/browser_state:browser_state_impl", "//ios/chrome/browser/component_updater",
diff --git a/ios/chrome/browser/application_context.h b/ios/chrome/browser/application_context.h deleted file mode 100644 index b44048a..0000000 --- a/ios/chrome/browser/application_context.h +++ /dev/null
@@ -1,192 +0,0 @@ -// Copyright 2014 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 IOS_CHROME_BROWSER_APPLICATION_CONTEXT_H_ -#define IOS_CHROME_BROWSER_APPLICATION_CONTEXT_H_ - -#import <Foundation/Foundation.h> - -#include <string> - -#include "base/memory/scoped_refptr.h" - -namespace breadcrumbs { -class BreadcrumbPersistentStorageManager; -} - -namespace component_updater { -class ComponentUpdateService; -} - -namespace gcm { -class GCMDriver; -} - -namespace ios { -class ChromeBrowserStateManager; -} - -namespace metrics { -class MetricsService; -} - -namespace metrics_services_manager { -class MetricsServicesManager; -} - -namespace net { -class NetLog; -class URLRequestContextGetter; -} - -namespace net_log { -class NetExportFileWriter; -} - -namespace network { -class NetworkConnectionTracker; -class SharedURLLoaderFactory; -namespace mojom { -class NetworkContext; -} -} // namespace network - -namespace network_time { -class NetworkTimeTracker; -} - -namespace segmentation_platform { -class OTRWebStateObserver; -} - -namespace ukm { -class UkmRecorder; -} - -namespace variations { -class VariationsService; -} - -class ApplicationContext; -class BrowserPolicyConnectorIOS; -class PromosManager; -class IOSChromeIOThread; -class PrefService; -class PushNotificationService; -class SafeBrowsingService; -@protocol SingleSignOnService; - -// Gets the global application context. Cannot return null. -ApplicationContext* GetApplicationContext(); - -class ApplicationContext { - public: - ApplicationContext(); - - ApplicationContext(const ApplicationContext&) = delete; - ApplicationContext& operator=(const ApplicationContext&) = delete; - - virtual ~ApplicationContext(); - - // Invoked when application enters foreground. Cancels the effect of - // OnAppEnterBackground(), in particular removes the boolean preference - // indicating that the ChromeBrowserStates have been shutdown. - virtual void OnAppEnterForeground() = 0; - - // Invoked when application enters background. Saves any state that must be - // saved before shutdown can continue. - virtual void OnAppEnterBackground() = 0; - - // Returns whether the last complete shutdown was clean (i.e. happened while - // the application was backgrounded). - virtual bool WasLastShutdownClean() = 0; - - // Gets the local state associated with this application. - virtual PrefService* GetLocalState() = 0; - - // Gets the URL request context associated with this application. - virtual net::URLRequestContextGetter* GetSystemURLRequestContext() = 0; - - // Gets the shared URL loader factory associated with this application. - virtual scoped_refptr<network::SharedURLLoaderFactory> - GetSharedURLLoaderFactory() = 0; - - // Gets the NetworkContext object associated with the same context as - // GetSystemURLRequestContext(). - virtual network::mojom::NetworkContext* GetSystemNetworkContext() = 0; - - // Gets the locale used by the application. - virtual const std::string& GetApplicationLocale() = 0; - - // Gets the ChromeBrowserStateManager used by this application. - virtual ios::ChromeBrowserStateManager* GetChromeBrowserStateManager() = 0; - - // Gets the manager for the various metrics-related service, constructing it - // if necessary. - virtual metrics_services_manager::MetricsServicesManager* - GetMetricsServicesManager() = 0; - - // Gets the MetricsService used by this application. - virtual metrics::MetricsService* GetMetricsService() = 0; - - // Gets the UkmRecorder used by this application. - virtual ukm::UkmRecorder* GetUkmRecorder() = 0; - - // Gets the VariationsService used by this application. - virtual variations::VariationsService* GetVariationsService() = 0; - - // Gets the NetLog. - virtual net::NetLog* GetNetLog() = 0; - - virtual net_log::NetExportFileWriter* GetNetExportFileWriter() = 0; - - // Gets the NetworkTimeTracker. - virtual network_time::NetworkTimeTracker* GetNetworkTimeTracker() = 0; - - // Gets the IOSChromeIOThread. - virtual IOSChromeIOThread* GetIOSChromeIOThread() = 0; - - // Gets the GCMDriver. - virtual gcm::GCMDriver* GetGCMDriver() = 0; - - // Gets the ComponentUpdateService. - virtual component_updater::ComponentUpdateService* - GetComponentUpdateService() = 0; - - // Gets the SafeBrowsingService. - virtual SafeBrowsingService* GetSafeBrowsingService() = 0; - - // Returns the NetworkConnectionTracker instance for this ApplicationContext. - virtual network::NetworkConnectionTracker* GetNetworkConnectionTracker() = 0; - - // Returns the BrowserPolicyConnectorIOS that starts and manages the policy - // system. May be |nullptr| if policy is not enabled. - virtual BrowserPolicyConnectorIOS* GetBrowserPolicyConnector() = 0; - - // Gets the Promos Manager. For v1, this will be a Fullscreen Promos Manager. - // May be |nullptr| if feature kFullscreenPromosManager is not enabled. - virtual PromosManager* GetPromosManager() = 0; - - // Returns the BreadcrumbPersistentStorageManager writing breadcrumbs to disk. - // Will be null if breadcrumb collection is not enabled. - virtual breadcrumbs::BreadcrumbPersistentStorageManager* - GetBreadcrumbPersistentStorageManager() = 0; - - // Returns the SingleSignOnService instance used by this application. - virtual id<SingleSignOnService> GetSSOService() = 0; - - // Returns the application's OTRWebStateObserver for segmentation platform. - virtual segmentation_platform::OTRWebStateObserver* - GetSegmentationOTRWebStateObserver() = 0; - - // Returns the application's PushNotificationService that handles all - // interactions with the push notification server - virtual PushNotificationService* GetPushNotificationService() = 0; - - protected: - // Sets the global ApplicationContext instance. - static void SetApplicationContext(ApplicationContext* context); -}; - -#endif // IOS_CHROME_BROWSER_APPLICATION_CONTEXT_H_
diff --git a/ios/chrome/browser/application_context/BUILD.gn b/ios/chrome/browser/application_context/BUILD.gn index 771edae..b9a2356 100644 --- a/ios/chrome/browser/application_context/BUILD.gn +++ b/ios/chrome/browser/application_context/BUILD.gn
@@ -3,6 +3,68 @@ # found in the LICENSE file. source_set("application_context") { - sources = [ "application_context.h" ] - public_deps = [ "//ios/chrome/browser:application_context" ] + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "application_context.h", + "application_context.mm", + ] + deps = [ "//base" ] +} + +source_set("application_context_impl") { + configs += [ "//build/config/compiler:enable_arc" ] + sources = [ + "application_context_impl.h", + "application_context_impl.mm", + ] + deps = [ + ":application_context", + "//base", + "//components/breadcrumbs/core", + "//components/breadcrumbs/core:feature_flags", + "//components/component_updater", + "//components/gcm_driver", + "//components/history/core/browser", + "//components/keyed_service/core", + "//components/metrics", + "//components/metrics_services_manager", + "//components/net_log", + "//components/network_time", + "//components/prefs", + "//components/sessions", + "//components/translate/core/browser", + "//components/ukm", + "//components/update_client", + "//components/variations/service", + "//components/version_info", + "//ios/chrome/app:tests_hook", + "//ios/chrome/browser", + "//ios/chrome/browser:chrome_paths", + "//ios/chrome/browser:pref_names", + "//ios/chrome/browser/browser_state", + "//ios/chrome/browser/browser_state:browser_state_impl", + "//ios/chrome/browser/component_updater", + "//ios/chrome/browser/crash_report/breadcrumbs", + "//ios/chrome/browser/crash_report/breadcrumbs:application_breadcrumbs_logger", + "//ios/chrome/browser/gcm", + "//ios/chrome/browser/history", + "//ios/chrome/browser/metrics", + "//ios/chrome/browser/policy", + "//ios/chrome/browser/prefs", + "//ios/chrome/browser/prefs:browser_prefs", + "//ios/chrome/browser/promos_manager", + "//ios/chrome/browser/promos_manager:features", + "//ios/chrome/browser/push_notification:push_notification_service", + "//ios/chrome/browser/segmentation_platform", + "//ios/chrome/browser/update_client", + "//ios/chrome/common", + "//ios/components/security_interstitials/safe_browsing", + "//ios/public/provider/chrome/browser/app_distribution:app_distribution_api", + "//ios/public/provider/chrome/browser/push_notification:push_notification_api", + "//ios/public/provider/chrome/browser/signin:signin_sso_api", + "//ios/web", + "//net", + "//services/network:network_service", + "//ui/base", + ] }
diff --git a/ios/chrome/browser/application_context/application_context.h b/ios/chrome/browser/application_context/application_context.h index b8e7b69..8e87019 100644 --- a/ios/chrome/browser/application_context/application_context.h +++ b/ios/chrome/browser/application_context/application_context.h
@@ -1,13 +1,192 @@ -// Copyright 2022 The Chromium Authors. +// Copyright 2014 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 IOS_CHROME_BROWSER_APPLICATION_CONTEXT_APPLICATION_CONTEXT_H_ #define IOS_CHROME_BROWSER_APPLICATION_CONTEXT_APPLICATION_CONTEXT_H_ -#import "ios/chrome/browser/application_context.h" +#import <Foundation/Foundation.h> -// This file is a temporary fix for compilation. As of now it is just a -// forwarded include. +#include <string> + +#include "base/memory/scoped_refptr.h" + +namespace breadcrumbs { +class BreadcrumbPersistentStorageManager; +} + +namespace component_updater { +class ComponentUpdateService; +} + +namespace gcm { +class GCMDriver; +} + +namespace ios { +class ChromeBrowserStateManager; +} + +namespace metrics { +class MetricsService; +} + +namespace metrics_services_manager { +class MetricsServicesManager; +} + +namespace net { +class NetLog; +class URLRequestContextGetter; +} // namespace net + +namespace net_log { +class NetExportFileWriter; +} + +namespace network { +class NetworkConnectionTracker; +class SharedURLLoaderFactory; +namespace mojom { +class NetworkContext; +} +} // namespace network + +namespace network_time { +class NetworkTimeTracker; +} + +namespace segmentation_platform { +class OTRWebStateObserver; +} + +namespace ukm { +class UkmRecorder; +} + +namespace variations { +class VariationsService; +} + +class ApplicationContext; +class BrowserPolicyConnectorIOS; +class PromosManager; +class IOSChromeIOThread; +class PrefService; +class PushNotificationService; +class SafeBrowsingService; +@protocol SingleSignOnService; + +// Gets the global application context. Cannot return null. +ApplicationContext* GetApplicationContext(); + +class ApplicationContext { + public: + ApplicationContext(); + + ApplicationContext(const ApplicationContext&) = delete; + ApplicationContext& operator=(const ApplicationContext&) = delete; + + virtual ~ApplicationContext(); + + // Invoked when application enters foreground. Cancels the effect of + // OnAppEnterBackground(), in particular removes the boolean preference + // indicating that the ChromeBrowserStates have been shutdown. + virtual void OnAppEnterForeground() = 0; + + // Invoked when application enters background. Saves any state that must be + // saved before shutdown can continue. + virtual void OnAppEnterBackground() = 0; + + // Returns whether the last complete shutdown was clean (i.e. happened while + // the application was backgrounded). + virtual bool WasLastShutdownClean() = 0; + + // Gets the local state associated with this application. + virtual PrefService* GetLocalState() = 0; + + // Gets the URL request context associated with this application. + virtual net::URLRequestContextGetter* GetSystemURLRequestContext() = 0; + + // Gets the shared URL loader factory associated with this application. + virtual scoped_refptr<network::SharedURLLoaderFactory> + GetSharedURLLoaderFactory() = 0; + + // Gets the NetworkContext object associated with the same context as + // GetSystemURLRequestContext(). + virtual network::mojom::NetworkContext* GetSystemNetworkContext() = 0; + + // Gets the locale used by the application. + virtual const std::string& GetApplicationLocale() = 0; + + // Gets the ChromeBrowserStateManager used by this application. + virtual ios::ChromeBrowserStateManager* GetChromeBrowserStateManager() = 0; + + // Gets the manager for the various metrics-related service, constructing it + // if necessary. + virtual metrics_services_manager::MetricsServicesManager* + GetMetricsServicesManager() = 0; + + // Gets the MetricsService used by this application. + virtual metrics::MetricsService* GetMetricsService() = 0; + + // Gets the UkmRecorder used by this application. + virtual ukm::UkmRecorder* GetUkmRecorder() = 0; + + // Gets the VariationsService used by this application. + virtual variations::VariationsService* GetVariationsService() = 0; + + // Gets the NetLog. + virtual net::NetLog* GetNetLog() = 0; + + virtual net_log::NetExportFileWriter* GetNetExportFileWriter() = 0; + + // Gets the NetworkTimeTracker. + virtual network_time::NetworkTimeTracker* GetNetworkTimeTracker() = 0; + + // Gets the IOSChromeIOThread. + virtual IOSChromeIOThread* GetIOSChromeIOThread() = 0; + + // Gets the GCMDriver. + virtual gcm::GCMDriver* GetGCMDriver() = 0; + + // Gets the ComponentUpdateService. + virtual component_updater::ComponentUpdateService* + GetComponentUpdateService() = 0; + + // Gets the SafeBrowsingService. + virtual SafeBrowsingService* GetSafeBrowsingService() = 0; + + // Returns the NetworkConnectionTracker instance for this ApplicationContext. + virtual network::NetworkConnectionTracker* GetNetworkConnectionTracker() = 0; + + // Returns the BrowserPolicyConnectorIOS that starts and manages the policy + // system. May be |nullptr| if policy is not enabled. + virtual BrowserPolicyConnectorIOS* GetBrowserPolicyConnector() = 0; + + // Gets the Promos Manager. For v1, this will be a Fullscreen Promos Manager. + // May be |nullptr| if feature kFullscreenPromosManager is not enabled. + virtual PromosManager* GetPromosManager() = 0; + + // Returns the BreadcrumbPersistentStorageManager writing breadcrumbs to disk. + // Will be null if breadcrumb collection is not enabled. + virtual breadcrumbs::BreadcrumbPersistentStorageManager* + GetBreadcrumbPersistentStorageManager() = 0; + + // Returns the SingleSignOnService instance used by this application. + virtual id<SingleSignOnService> GetSSOService() = 0; + + // Returns the application's OTRWebStateObserver for segmentation platform. + virtual segmentation_platform::OTRWebStateObserver* + GetSegmentationOTRWebStateObserver() = 0; + + // Returns the application's PushNotificationService that handles all + // interactions with the push notification server + virtual PushNotificationService* GetPushNotificationService() = 0; + + protected: + // Sets the global ApplicationContext instance. + static void SetApplicationContext(ApplicationContext* context); +}; #endif // IOS_CHROME_BROWSER_APPLICATION_CONTEXT_APPLICATION_CONTEXT_H_
diff --git a/ios/chrome/browser/application_context.mm b/ios/chrome/browser/application_context/application_context.mm similarity index 88% rename from ios/chrome/browser/application_context.mm rename to ios/chrome/browser/application_context/application_context.mm index c7b85823..712c3ac 100644 --- a/ios/chrome/browser/application_context.mm +++ b/ios/chrome/browser/application_context/application_context.mm
@@ -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 "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -11,7 +11,7 @@ namespace { // Global ApplicationContext instance. ApplicationContext* g_application_context = nullptr; -} +} // namespace ApplicationContext* GetApplicationContext() { return g_application_context;
diff --git a/ios/chrome/browser/application_context_impl.h b/ios/chrome/browser/application_context/application_context_impl.h similarity index 94% rename from ios/chrome/browser/application_context_impl.h rename to ios/chrome/browser/application_context/application_context_impl.h index aef64f1..d58ba92 100644 --- a/ios/chrome/browser/application_context_impl.h +++ b/ios/chrome/browser/application_context/application_context_impl.h
@@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef IOS_CHROME_BROWSER_APPLICATION_CONTEXT_IMPL_H_ -#define IOS_CHROME_BROWSER_APPLICATION_CONTEXT_IMPL_H_ +#ifndef IOS_CHROME_BROWSER_APPLICATION_CONTEXT_APPLICATION_CONTEXT_IMPL_H_ +#define IOS_CHROME_BROWSER_APPLICATION_CONTEXT_APPLICATION_CONTEXT_IMPL_H_ #include <memory> #include <string> #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" namespace base { class CommandLine; class SequencedTaskRunner; -} +} // namespace base namespace breadcrumbs { class BreadcrumbPersistentStorageManager; @@ -140,4 +140,4 @@ std::unique_ptr<PushNotificationService> push_notification_service_; }; -#endif // IOS_CHROME_BROWSER_APPLICATION_CONTEXT_IMPL_H_ +#endif // IOS_CHROME_BROWSER_APPLICATION_CONTEXT_APPLICATION_CONTEXT_IMPL_H_
diff --git a/ios/chrome/browser/application_context_impl.mm b/ios/chrome/browser/application_context/application_context_impl.mm similarity index 83% rename from ios/chrome/browser/application_context_impl.mm rename to ios/chrome/browser/application_context/application_context_impl.mm index 676f85b..8b791be 100644 --- a/ios/chrome/browser/application_context_impl.mm +++ b/ios/chrome/browser/application_context/application_context_impl.mm
@@ -2,84 +2,84 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ios/chrome/browser/application_context_impl.h" +#import "ios/chrome/browser/application_context/application_context_impl.h" -#include <algorithm> -#include <vector> +#import <algorithm> +#import <vector> -#include "base/bind.h" -#include "base/check_op.h" -#include "base/command_line.h" -#include "base/feature_list.h" -#include "base/files/file_path.h" -#include "base/memory/ptr_util.h" -#include "base/metrics/histogram_functions.h" -#include "base/path_service.h" -#include "base/strings/sys_string_conversions.h" -#include "base/task/sequenced_task_runner.h" -#include "base/task/thread_pool.h" -#include "base/time/default_clock.h" -#include "base/time/default_tick_clock.h" -#include "components/breadcrumbs/core/breadcrumb_persistent_storage_manager.h" -#include "components/breadcrumbs/core/features.h" -#include "components/component_updater/component_updater_service.h" -#include "components/component_updater/timer_update_scheduler.h" -#include "components/gcm_driver/gcm_client_factory.h" -#include "components/gcm_driver/gcm_desktop_utils.h" -#include "components/gcm_driver/gcm_driver.h" -#include "components/history/core/browser/history_service.h" -#include "components/keyed_service/core/service_access_type.h" -#include "components/metrics/metrics_service.h" -#include "components/metrics_services_manager/metrics_services_manager.h" -#include "components/net_log/net_export_file_writer.h" -#include "components/network_time/network_time_tracker.h" -#include "components/prefs/pref_registry_simple.h" -#include "components/prefs/pref_service.h" -#include "components/sessions/core/session_id_generator.h" -#include "components/translate/core/browser/translate_download_manager.h" -#include "components/ukm/ukm_service.h" -#include "components/update_client/configurator.h" -#include "components/update_client/update_query_params.h" -#include "components/variations/service/variations_service.h" -#include "components/version_info/channel.h" -#include "ios/chrome/app/tests_hook.h" -#include "ios/chrome/browser/application_context.h" -#include "ios/chrome/browser/browser_state/chrome_browser_state.h" -#include "ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.h" -#include "ios/chrome/browser/chrome_paths.h" -#include "ios/chrome/browser/component_updater/ios_component_updater_configurator.h" +#import "base/bind.h" +#import "base/check_op.h" +#import "base/command_line.h" +#import "base/feature_list.h" +#import "base/files/file_path.h" +#import "base/memory/ptr_util.h" +#import "base/metrics/histogram_functions.h" +#import "base/path_service.h" +#import "base/strings/sys_string_conversions.h" +#import "base/task/sequenced_task_runner.h" +#import "base/task/thread_pool.h" +#import "base/time/default_clock.h" +#import "base/time/default_tick_clock.h" +#import "components/breadcrumbs/core/breadcrumb_persistent_storage_manager.h" +#import "components/breadcrumbs/core/features.h" +#import "components/component_updater/component_updater_service.h" +#import "components/component_updater/timer_update_scheduler.h" +#import "components/gcm_driver/gcm_client_factory.h" +#import "components/gcm_driver/gcm_desktop_utils.h" +#import "components/gcm_driver/gcm_driver.h" +#import "components/history/core/browser/history_service.h" +#import "components/keyed_service/core/service_access_type.h" +#import "components/metrics/metrics_service.h" +#import "components/metrics_services_manager/metrics_services_manager.h" +#import "components/net_log/net_export_file_writer.h" +#import "components/network_time/network_time_tracker.h" +#import "components/prefs/pref_registry_simple.h" +#import "components/prefs/pref_service.h" +#import "components/sessions/core/session_id_generator.h" +#import "components/translate/core/browser/translate_download_manager.h" +#import "components/ukm/ukm_service.h" +#import "components/update_client/configurator.h" +#import "components/update_client/update_query_params.h" +#import "components/variations/service/variations_service.h" +#import "components/version_info/channel.h" +#import "ios/chrome/app/tests_hook.h" +#import "ios/chrome/browser/application_context/application_context.h" +#import "ios/chrome/browser/browser_state/chrome_browser_state.h" +#import "ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.h" +#import "ios/chrome/browser/chrome_paths.h" +#import "ios/chrome/browser/component_updater/ios_component_updater_configurator.h" #import "ios/chrome/browser/crash_report/breadcrumbs/application_breadcrumbs_logger.h" -#include "ios/chrome/browser/gcm/ios_chrome_gcm_profile_service_factory.h" -#include "ios/chrome/browser/history/history_service_factory.h" -#include "ios/chrome/browser/ios_chrome_io_thread.h" -#include "ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.h" -#include "ios/chrome/browser/policy/browser_policy_connector_ios.h" -#include "ios/chrome/browser/policy/configuration_policy_handler_list_factory.h" -#include "ios/chrome/browser/pref_names.h" -#include "ios/chrome/browser/prefs/browser_prefs.h" -#include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" +#import "ios/chrome/browser/gcm/ios_chrome_gcm_profile_service_factory.h" +#import "ios/chrome/browser/history/history_service_factory.h" +#import "ios/chrome/browser/ios_chrome_io_thread.h" +#import "ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.h" +#import "ios/chrome/browser/policy/browser_policy_connector_ios.h" +#import "ios/chrome/browser/policy/configuration_policy_handler_list_factory.h" +#import "ios/chrome/browser/pref_names.h" +#import "ios/chrome/browser/prefs/browser_prefs.h" +#import "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" #import "ios/chrome/browser/promos_manager/features.h" #import "ios/chrome/browser/promos_manager/promos_manager.h" #import "ios/chrome/browser/push_notification/push_notification_service.h" -#include "ios/chrome/browser/segmentation_platform/otr_web_state_observer.h" -#include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h" -#include "ios/chrome/common/channel_info.h" -#include "ios/components/security_interstitials/safe_browsing/safe_browsing_service_impl.h" -#include "ios/public/provider/chrome/browser/app_distribution/app_distribution_api.h" +#import "ios/chrome/browser/segmentation_platform/otr_web_state_observer.h" +#import "ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h" +#import "ios/chrome/common/channel_info.h" +#import "ios/components/security_interstitials/safe_browsing/safe_browsing_service_impl.h" +#import "ios/public/provider/chrome/browser/app_distribution/app_distribution_api.h" #import "ios/public/provider/chrome/browser/push_notification/push_notification_api.h" -#include "ios/public/provider/chrome/browser/signin/signin_sso_api.h" -#include "ios/web/public/thread/web_task_traits.h" -#include "ios/web/public/thread/web_thread.h" -#include "mojo/public/cpp/bindings/pending_receiver.h" -#include "net/log/net_log.h" -#include "net/log/net_log_capture_mode.h" -#include "net/socket/client_socket_pool_manager.h" -#include "net/url_request/url_request_context_getter.h" -#include "services/metrics/public/cpp/ukm_recorder.h" -#include "services/network/network_change_manager.h" -#include "services/network/public/cpp/network_connection_tracker.h" -#include "services/network/public/mojom/network_service.mojom.h" -#include "ui/base/resource/resource_bundle.h" +#import "ios/public/provider/chrome/browser/signin/signin_sso_api.h" +#import "ios/web/public/thread/web_task_traits.h" +#import "ios/web/public/thread/web_thread.h" +#import "mojo/public/cpp/bindings/pending_receiver.h" +#import "net/log/net_log.h" +#import "net/log/net_log_capture_mode.h" +#import "net/socket/client_socket_pool_manager.h" +#import "net/url_request/url_request_context_getter.h" +#import "services/metrics/public/cpp/ukm_recorder.h" +#import "services/network/network_change_manager.h" +#import "services/network/public/cpp/network_connection_tracker.h" +#import "services/network/public/mojom/network_service.mojom.h" +#import "ui/base/resource/resource_bundle.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/chrome/browser/autocomplete/autocomplete_provider_client_impl.mm b/ios/chrome/browser/autocomplete/autocomplete_provider_client_impl.mm index 429265d..dc3d18ef 100644 --- a/ios/chrome/browser/autocomplete/autocomplete_provider_client_impl.mm +++ b/ios/chrome/browser/autocomplete/autocomplete_provider_client_impl.mm
@@ -18,7 +18,7 @@ #include "components/signin/public/identity_manager/identity_manager.h" #include "components/sync/driver/sync_service.h" #include "components/unified_consent/url_keyed_data_collection_consent_helper.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autocomplete/autocomplete_classifier_factory.h" #include "ios/chrome/browser/autocomplete/in_memory_url_index_factory.h" #import "ios/chrome/browser/autocomplete/omnibox_pedal_implementation.h"
diff --git a/ios/chrome/browser/autofill/address_normalizer_factory.mm b/ios/chrome/browser/autofill/address_normalizer_factory.mm index 954d0d04..bd99589e9 100644 --- a/ios/chrome/browser/autofill/address_normalizer_factory.mm +++ b/ios/chrome/browser/autofill/address_normalizer_factory.mm
@@ -6,7 +6,7 @@ #include "base/memory/ptr_util.h" #include "base/no_destructor.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autofill/validation_rules_storage_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "third_party/libaddressinput/chromium/chrome_metadata_source.h"
diff --git a/ios/chrome/browser/autofill/autocomplete_history_manager_factory.mm b/ios/chrome/browser/autofill/autocomplete_history_manager_factory.mm index fca8db2..1dec32c 100644 --- a/ios/chrome/browser/autofill/autocomplete_history_manager_factory.mm +++ b/ios/chrome/browser/autofill/autocomplete_history_manager_factory.mm
@@ -11,7 +11,7 @@ #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" #include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/history/history_service_factory.h"
diff --git a/ios/chrome/browser/autofill/autofill_tab_helper.mm b/ios/chrome/browser/autofill/autofill_tab_helper.mm index 9174af6a..117411a 100644 --- a/ios/chrome/browser/autofill/autofill_tab_helper.mm +++ b/ios/chrome/browser/autofill/autofill_tab_helper.mm
@@ -8,7 +8,7 @@ #include "base/memory/ptr_util.h" #import "components/autofill/ios/browser/autofill_agent.h" #include "components/autofill/ios/browser/autofill_driver_ios.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/infobars/infobar_manager_impl.h" #import "ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.h"
diff --git a/ios/chrome/browser/autofill/personal_data_manager_factory.mm b/ios/chrome/browser/autofill/personal_data_manager_factory.mm index eb40710..d84e656 100644 --- a/ios/chrome/browser/autofill/personal_data_manager_factory.mm +++ b/ios/chrome/browser/autofill/personal_data_manager_factory.mm
@@ -14,7 +14,7 @@ #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/sync/base/command_line_switches.h" #include "components/variations/service/variations_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autofill/strike_database_factory.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/autofill/strike_database_factory.mm b/ios/chrome/browser/autofill/strike_database_factory.mm index b0b980f..d0657d9 100644 --- a/ios/chrome/browser/autofill/strike_database_factory.mm +++ b/ios/chrome/browser/autofill/strike_database_factory.mm
@@ -9,7 +9,7 @@ #include "base/no_destructor.h" #include "components/autofill/core/browser/strike_database.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/browser_state/chrome_browser_state_impl.mm b/ios/chrome/browser/browser_state/chrome_browser_state_impl.mm index 004cea36..de4d69e 100644 --- a/ios/chrome/browser/browser_state/chrome_browser_state_impl.mm +++ b/ios/chrome/browser/browser_state/chrome_browser_state_impl.mm
@@ -25,7 +25,7 @@ #include "components/proxy_config/pref_proxy_config_tracker.h" #include "components/sync_preferences/pref_service_syncable.h" #include "components/user_prefs/user_prefs.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" #include "ios/chrome/browser/browser_state/bookmark_model_loaded_observer.h" #include "ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_impl.h"
diff --git a/ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm b/ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm index 96f3f11..7dd47c10 100644 --- a/ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm +++ b/ios/chrome/browser/browser_state/chrome_browser_state_impl_io_data.mm
@@ -19,7 +19,7 @@ #include "components/prefs/json_pref_store.h" #include "components/prefs/pref_filter.h" #include "components/prefs/pref_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_constants.h" #include "ios/chrome/browser/ios_chrome_io_thread.h"
diff --git a/ios/chrome/browser/browser_state/chrome_browser_state_io_data.mm b/ios/chrome/browser/browser_state/chrome_browser_state_io_data.mm index 58c577e..2e8aa4b 100644 --- a/ios/chrome/browser/browser_state/chrome_browser_state_io_data.mm +++ b/ios/chrome/browser/browser_state/chrome_browser_state_io_data.mm
@@ -32,7 +32,7 @@ #include "components/prefs/pref_service.h" #include "components/proxy_config/ios/proxy_service_factory.h" #include "components/signin/public/base/signin_pref_names.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/content_settings/cookie_settings_factory.h"
diff --git a/ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.mm b/ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.mm index f5941bfc..3d5a8a4 100644 --- a/ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.mm +++ b/ios/chrome/browser/browser_state/chrome_browser_state_manager_impl.mm
@@ -20,7 +20,7 @@ #include "components/prefs/pref_service.h" #include "components/signin/ios/browser/active_state_manager.h" #include "components/signin/public/identity_manager/identity_manager.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_impl.h" #include "ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_impl.h"
diff --git a/ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.mm b/ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.mm index 0036e6b..82e561c 100644 --- a/ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.mm +++ b/ios/chrome/browser/browser_state/chrome_browser_state_removal_controller.mm
@@ -15,7 +15,7 @@ #include "base/task/thread_pool.h" #include "components/prefs/pref_service.h" #include "google_apis/gaia/gaia_auth_util.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/chrome_constants.h"
diff --git a/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_impl.mm b/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_impl.mm index ab3b83e..599271f1 100644 --- a/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_impl.mm +++ b/ios/chrome/browser/browser_state/off_the_record_chrome_browser_state_impl.mm
@@ -14,7 +14,7 @@ #include "components/proxy_config/pref_proxy_config_tracker.h" #include "components/sync_preferences/pref_service_syncable.h" #include "components/user_prefs/user_prefs.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/net/ios_chrome_url_request_context_getter.h" #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" #include "ios/web/public/thread/web_task_traits.h"
diff --git a/ios/chrome/browser/browser_state/test_chrome_browser_state.mm b/ios/chrome/browser/browser_state/test_chrome_browser_state.mm index 7c278a1..952b917 100644 --- a/ios/chrome/browser/browser_state/test_chrome_browser_state.mm +++ b/ios/chrome/browser/browser_state/test_chrome_browser_state.mm
@@ -26,7 +26,7 @@ #include "components/sync_preferences/testing_pref_service_syncable.h" #include "components/user_prefs/user_prefs.h" #include "components/webdata_services/web_data_service_wrapper.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_keyed_service_factories.h" #include "ios/chrome/browser/prefs/browser_prefs.h" #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h"
diff --git a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm index 59c59d84..a9a11854 100644 --- a/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm +++ b/ios/chrome/browser/browsing_data/browsing_data_remover_impl.mm
@@ -35,7 +35,7 @@ #include "components/sessions/core/tab_restore_service.h" #include "components/signin/ios/browser/account_consistency_service.h" #include "components/signin/public/base/signin_pref_names.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/autofill/strike_database_factory.h" #include "ios/chrome/browser/bookmarks/bookmark_remover_helper.h"
diff --git a/ios/chrome/browser/commerce/shopping_persisted_data_tab_helper.mm b/ios/chrome/browser/commerce/shopping_persisted_data_tab_helper.mm index 9beb0b9..d3d9279 100644 --- a/ios/chrome/browser/commerce/shopping_persisted_data_tab_helper.mm +++ b/ios/chrome/browser/commerce/shopping_persisted_data_tab_helper.mm
@@ -10,7 +10,7 @@ #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "components/optimization_guide/core/optimization_metadata.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/commerce/price_alert_util.h" #import "ios/chrome/browser/optimization_guide/optimization_guide_service.h"
diff --git a/ios/chrome/browser/component_updater/ios_component_updater_configurator.mm b/ios/chrome/browser/component_updater/ios_component_updater_configurator.mm index 7d04dd06..77e199a2 100644 --- a/ios/chrome/browser/component_updater/ios_component_updater_configurator.mm +++ b/ios/chrome/browser/component_updater/ios_component_updater_configurator.mm
@@ -25,7 +25,7 @@ #include "components/update_client/unzip/unzip_impl.h" #include "components/update_client/unzipper.h" #include "components/update_client/update_query_params.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/common/channel_info.h" #include "services/network/public/cpp/shared_url_loader_factory.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/ios/chrome/browser/discover_feed/discover_feed_service_factory.mm b/ios/chrome/browser/discover_feed/discover_feed_service_factory.mm index 996523c..1ca06fc9 100644 --- a/ios/chrome/browser/discover_feed/discover_feed_service_factory.mm +++ b/ios/chrome/browser/discover_feed/discover_feed_service_factory.mm
@@ -6,7 +6,7 @@ #include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/discover_feed/discover_feed_configuration.h" #include "ios/chrome/browser/discover_feed/discover_feed_service.h"
diff --git a/ios/chrome/browser/download/OWNERS b/ios/chrome/browser/download/OWNERS index 6cadd6b..67ae87b 100644 --- a/ios/chrome/browser/download/OWNERS +++ b/ios/chrome/browser/download/OWNERS
@@ -1,2 +1,2 @@ -ewannpv@chromium.org +sdefresne@chromium.org gambard@chromium.org
diff --git a/ios/chrome/browser/favicon/favicon_loader.h b/ios/chrome/browser/favicon/favicon_loader.h index f10c4925..bb7565f 100644 --- a/ios/chrome/browser/favicon/favicon_loader.h +++ b/ios/chrome/browser/favicon/favicon_loader.h
@@ -31,48 +31,50 @@ ~FaviconLoader() override; - // Tries to find a FaviconAttributes in |favicon_cache_| with |page_url|: - // If found, invokes |faviconBlockHandler| and exits. - // If not found, invokes |faviconBlockHandler| with a default placeholder + // Tries to find a FaviconAttributes in `favicon_cache_` with `page_url`: + // If found, invokes `favicon_block_handler` and exits. + // If not found, invokes `favicon_block_handler` with a default placeholder // then invokes it again asynchronously with the favicon fetched by trying // following methods: - // 1. Use |large_icon_service_| to fetch from local DB managed by + // 1. Use `large_icon_service_` to fetch from local DB managed by // HistoryService; - // 2. Use |large_icon_service_| to fetch from Google Favicon server if - // |fallback_to_google_server|=YES (|size_in_points| is ignored when + // 2. Use `large_icon_service_` to fetch from Google Favicon server if + // `fallback_to_google_server=true` (`size_in_points` is ignored when // fetching from the Google server); - // 3. Create a favicon base on the fallback style from |large_icon_service|. - void FaviconForPageUrl(const GURL& page_url, - float size_in_points, - float min_size_in_points, - bool fallback_to_google_server, - FaviconAttributesCompletionBlock faviconBlockHandler); + // 3. Create a favicon base on the fallback style from `large_icon_service`. + void FaviconForPageUrl( + const GURL& page_url, + float size_in_points, + float min_size_in_points, + bool fallback_to_google_server, + FaviconAttributesCompletionBlock favicon_block_handler); - // Tries to find a FaviconAttributes in |favicon_cache_| with |page_url|: - // If found, invokes |faviconBlockHandler| and exits. - // If not found, invokes |faviconBlockHandler| with a default placeholder + // Tries to find a FaviconAttributes in `favicon_cache_` with `page_url`: + // If found, invokes `favicon_block_handler` and exits. + // If not found, invokes `favicon_block_handler` with a default placeholder // then invokes it again asynchronously with the favicon fetched by trying // following methods: - // 1. Use |large_icon_service_| to fetch from local DB managed by + // 1. Use `large_icon_service_` to fetch from local DB managed by // HistoryService; - // 2. Create a favicon base on the fallback style from |large_icon_service|. + // 2. Create a favicon base on the fallback style from `large_icon_service`. void FaviconForPageUrlOrHost( const GURL& page_url, float size_in_points, FaviconAttributesCompletionBlock favicon_block_handler); - // Tries to find a FaviconAttributes in |favicon_cache_| with |icon_url|: - // If found, invokes |faviconBlockHandler| and exits. - // If not found, invokes |faviconBlockHandler| with a default placeholder + // Tries to find a FaviconAttributes in `favicon_cache_` with `icon_url`: + // If found, invokes `favicon_block_handler` and exits. + // If not found, invokes `favicon_block_handler` with a default placeholder // then invokes it again asynchronously with the favicon fetched by trying // following methods: - // 1. Use |large_icon_service_| to fetch from local DB managed by + // 1. Use `large_icon_service_` to fetch from local DB managed by // HistoryService; - // 2. Create a favicon base on the fallback style from |large_icon_service|. - void FaviconForIconUrl(const GURL& icon_url, - float size_in_points, - float min_size_in_points, - FaviconAttributesCompletionBlock faviconBlockHandler); + // 2. Create a favicon base on the fallback style from `large_icon_service`. + void FaviconForIconUrl( + const GURL& icon_url, + float size_in_points, + float min_size_in_points, + FaviconAttributesCompletionBlock favicon_block_handler); // Cancel all incomplete requests. void CancellAllRequests(); @@ -87,7 +89,7 @@ // Tracks tasks sent to FaviconService. base::CancelableTaskTracker cancelable_task_tracker_; // Holds cached favicons. This NSCache is populated as favicons or fallback - // attributes are retrieved from |large_icon_service_|. Contents will be + // attributes are retrieved from `large_icon_service_`. Contents will be // removed during low-memory conditions based on its inherent LRU removal // algorithm. Keyed by NSString of URL (page URL or icon URL) spec. NSCache<NSString*, FaviconAttributes*>* favicon_cache_;
diff --git a/ios/chrome/browser/favicon/favicon_loader.mm b/ios/chrome/browser/favicon/favicon_loader.mm index febf7b0d..2611789 100644 --- a/ios/chrome/browser/favicon/favicon_loader.mm +++ b/ios/chrome/browser/favicon/favicon_loader.mm
@@ -62,14 +62,14 @@ bool fallback_to_google_server, // retrieve favicon from Google Server if // GetLargeIconOrFallbackStyle() doesn't // return valid favicon. - FaviconAttributesCompletionBlock faviconBlockHandler) { - DCHECK(faviconBlockHandler); + FaviconAttributesCompletionBlock favicon_block_handler) { + DCHECK(favicon_block_handler); NSString* key = [NSString stringWithFormat:@"%d %@", (int)round(size_in_points), base::SysUTF8ToNSString(page_url.spec())]; FaviconAttributes* value = [favicon_cache_ objectForKey:key]; if (value) { - faviconBlockHandler(value); + favicon_block_handler(value); return; } @@ -91,7 +91,7 @@ DCHECK(favicon.size.width <= size_in_points && favicon.size.height <= size_in_points); - faviconBlockHandler(attributes); + favicon_block_handler(attributes); return; } else if (fallback_to_google_server) { void (^favicon_loaded_from_server_block)( @@ -106,7 +106,7 @@ // fallback style will be used. FaviconForPageUrl( block_page_url, size_in_points, min_size_in_points, - /*continueToGoogleServer=*/false, faviconBlockHandler); + /*continueToGoogleServer=*/false, favicon_block_handler); }; large_icon_service_ @@ -130,11 +130,11 @@ is_default_background_color]; [favicon_cache_ setObject:attributes forKey:key]; - faviconBlockHandler(attributes); + favicon_block_handler(attributes); }; // First, synchronously return a fallback image. - faviconBlockHandler([FaviconAttributes attributesWithDefaultImage]); + favicon_block_handler([FaviconAttributes attributesWithDefaultImage]); // Now fetch the image synchronously. DCHECK(large_icon_service_); @@ -208,14 +208,14 @@ const GURL& icon_url, float size_in_points, float min_size_in_points, - FaviconAttributesCompletionBlock faviconBlockHandler) { - DCHECK(faviconBlockHandler); + FaviconAttributesCompletionBlock favicon_block_handler) { + DCHECK(favicon_block_handler); NSString* key = [NSString stringWithFormat:@"%d %@", (int)round(size_in_points), base::SysUTF8ToNSString(icon_url.spec())]; FaviconAttributes* value = [favicon_cache_ objectForKey:key]; if (value) { - faviconBlockHandler(value); + favicon_block_handler(value); return; } @@ -236,7 +236,7 @@ FaviconAttributes* attributes = [FaviconAttributes attributesWithImage:favicon]; [favicon_cache_ setObject:attributes forKey:key]; - faviconBlockHandler(attributes); + favicon_block_handler(attributes); return; } // Did not get valid favicon back and are not attempting to retrieve one @@ -251,11 +251,11 @@ is_default_background_color]; [favicon_cache_ setObject:attributes forKey:key]; - faviconBlockHandler(attributes); + favicon_block_handler(attributes); }; // First, return a fallback synchronously. - faviconBlockHandler([FaviconAttributes + favicon_block_handler([FaviconAttributes attributesWithImage:[UIImage imageNamed:@"default_world_favicon"]]); // Now call the service for a better async icon.
diff --git a/ios/chrome/browser/favicon/favicon_loader_unittest.mm b/ios/chrome/browser/favicon/favicon_loader_unittest.mm index 409953a..20674db4 100644 --- a/ios/chrome/browser/favicon/favicon_loader_unittest.mm +++ b/ios/chrome/browser/favicon/favicon_loader_unittest.mm
@@ -46,8 +46,8 @@ favicon_base::IconType::kTouchIcon, /*google_server_client_param=*/"test_chrome") {} - // Returns LargeIconResult with valid bitmap if |page_url| is - // |kTestFaviconURL|, or LargeIconResult with fallback style. + // Returns LargeIconResult with valid bitmap if `page_url` is + // `kTestFaviconURL`, or LargeIconResult with fallback style. base::CancelableTaskTracker::TaskId GetLargeIconRawBitmapOrFallbackStyleForPageUrl( const GURL& page_url, @@ -79,7 +79,7 @@ return 1; } - // Returns the same as |GetLargeIconRawBitmapOrFallbackStyleForPageUrl|. + // Returns the same as `GetLargeIconRawBitmapOrFallbackStyleForPageUrl`. base::CancelableTaskTracker::TaskId GetLargeIconRawBitmapOrFallbackStyleForIconUrl( const GURL& icon_url,
diff --git a/ios/chrome/browser/favicon/large_icon_cache.h b/ios/chrome/browser/favicon/large_icon_cache.h index f443551..7f8eccd4 100644 --- a/ios/chrome/browser/favicon/large_icon_cache.h +++ b/ios/chrome/browser/favicon/large_icon_cache.h
@@ -34,7 +34,7 @@ ~LargeIconCache() override; - // |LargeIconService| does everything on callbacks, and iOS needs to load the + // `LargeIconService` does everything on callbacks, and iOS needs to load the // icons immediately on page load. This caches the LargeIconResult so we can // immediately load. void SetCachedResult(const GURL& url, const favicon_base::LargeIconResult&);
diff --git a/ios/chrome/browser/favicon/large_icon_cache_unittest.cc b/ios/chrome/browser/favicon/large_icon_cache_unittest.cc index 8ee2cd7..ab532b1 100644 --- a/ios/chrome/browser/favicon/large_icon_cache_unittest.cc +++ b/ios/chrome/browser/favicon/large_icon_cache_unittest.cc
@@ -23,7 +23,7 @@ favicon_base::FaviconRawBitmapResult result; result.expired = false; - // Create bitmap and fill with |color|. + // Create bitmap and fill with `color`. scoped_refptr<base::RefCountedBytes> data(new base::RefCountedBytes()); SkBitmap bitmap; bitmap.allocN32Pixels(w, h);
diff --git a/ios/chrome/browser/gcm/ios_chrome_gcm_profile_service_factory.mm b/ios/chrome/browser/gcm/ios_chrome_gcm_profile_service_factory.mm index 0cb442f..830b636 100644 --- a/ios/chrome/browser/gcm/ios_chrome_gcm_profile_service_factory.mm +++ b/ios/chrome/browser/gcm/ios_chrome_gcm_profile_service_factory.mm
@@ -14,7 +14,7 @@ #include "components/gcm_driver/gcm_client_factory.h" #include "components/gcm_driver/gcm_profile_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/signin/identity_manager_factory.h" #include "ios/chrome/common/channel_info.h"
diff --git a/ios/chrome/browser/ios_chrome_field_trials.mm b/ios/chrome/browser/ios_chrome_field_trials.mm index ba3082a..e6c85ff 100644 --- a/ios/chrome/browser/ios_chrome_field_trials.mm +++ b/ios/chrome/browser/ios_chrome_field_trials.mm
@@ -7,7 +7,7 @@ #import "base/check.h" #import "base/path_service.h" #import "components/metrics/persistent_histograms.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/chrome_paths.h" #import "ios/chrome/browser/ui/first_run/fre_field_trial.h" #import "ios/chrome/browser/ui/first_run/trending_queries_field_trial.h"
diff --git a/ios/chrome/browser/ios_chrome_main_parts.mm b/ios/chrome/browser/ios_chrome_main_parts.mm index 5aa9a568..8d73ee6 100644 --- a/ios/chrome/browser/ios_chrome_main_parts.mm +++ b/ios/chrome/browser/ios_chrome_main_parts.mm
@@ -46,7 +46,7 @@ #include "components/variations/variations_crash_keys.h" #include "components/variations/variations_ids_provider.h" #include "components/variations/variations_switches.h" -#include "ios/chrome/browser/application_context_impl.h" +#import "ios/chrome/browser/application_context/application_context_impl.h" #include "ios/chrome/browser/browser_state/browser_state_keyed_service_factories.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h"
diff --git a/ios/chrome/browser/language/language_model_manager_factory.mm b/ios/chrome/browser/language/language_model_manager_factory.mm index 8d30a88..8996a289 100644 --- a/ios/chrome/browser/language/language_model_manager_factory.mm +++ b/ios/chrome/browser/language/language_model_manager_factory.mm
@@ -15,7 +15,7 @@ #include "components/language/core/language_model/fluent_language_model.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/mailto_handler/BUILD.gn b/ios/chrome/browser/mailto_handler/BUILD.gn index 4f5a095..a1a8ffe 100644 --- a/ios/chrome/browser/mailto_handler/BUILD.gn +++ b/ios/chrome/browser/mailto_handler/BUILD.gn
@@ -32,7 +32,7 @@ ":mailto_handler", "//base", "//components/keyed_service/ios", - "//ios/chrome/browser:application_context", + "//ios/chrome/browser/application_context", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/signin", "//ios/chrome/browser/sync",
diff --git a/ios/chrome/browser/mailto_handler/mailto_handler_service_factory.mm b/ios/chrome/browser/mailto_handler/mailto_handler_service_factory.mm index 1fa07c8..c6d5a303f 100644 --- a/ios/chrome/browser/mailto_handler/mailto_handler_service_factory.mm +++ b/ios/chrome/browser/mailto_handler/mailto_handler_service_factory.mm
@@ -5,7 +5,7 @@ #import "ios/chrome/browser/mailto_handler/mailto_handler_service_factory.h" #import "components/keyed_service/ios/browser_state_dependency_manager.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/mailto_handler/mailto_handler_configuration.h"
diff --git a/ios/chrome/browser/metrics/BUILD.gn b/ios/chrome/browser/metrics/BUILD.gn index 322ca12..859d343 100644 --- a/ios/chrome/browser/metrics/BUILD.gn +++ b/ios/chrome/browser/metrics/BUILD.gn
@@ -29,7 +29,7 @@ "//components/metrics", "//components/prefs", "//components/variations", - "//ios/chrome/browser:application_context", + "//ios/chrome/browser/application_context", ] } source_set("metrics") {
diff --git a/ios/chrome/browser/metrics/chrome_browser_state_client.mm b/ios/chrome/browser/metrics/chrome_browser_state_client.mm index 18ae8f14..0afd617 100644 --- a/ios/chrome/browser/metrics/chrome_browser_state_client.mm +++ b/ios/chrome/browser/metrics/chrome_browser_state_client.mm
@@ -6,7 +6,7 @@ #include "base/time/time.h" #include "components/network_time/network_time_tracker.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h"
diff --git a/ios/chrome/browser/metrics/chrome_browser_state_client_unittest.mm b/ios/chrome/browser/metrics/chrome_browser_state_client_unittest.mm index aa2862f0..5d83af4 100644 --- a/ios/chrome/browser/metrics/chrome_browser_state_client_unittest.mm +++ b/ios/chrome/browser/metrics/chrome_browser_state_client_unittest.mm
@@ -8,7 +8,7 @@ #include "base/time/default_tick_clock.h" #include "base/time/time.h" #include "components/network_time/network_time_tracker.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager.h"
diff --git a/ios/chrome/browser/metrics/incognito_web_state_observer.mm b/ios/chrome/browser/metrics/incognito_web_state_observer.mm index 16a3d90..6eeeaee 100644 --- a/ios/chrome/browser/metrics/incognito_web_state_observer.mm +++ b/ios/chrome/browser/metrics/incognito_web_state_observer.mm
@@ -6,7 +6,7 @@ #include <vector> -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #import "ios/chrome/browser/main/all_web_state_list_observation_registrar.h"
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.mm b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.mm index cc526503..75c5f8e 100644 --- a/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.mm +++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.mm
@@ -8,7 +8,7 @@ #include "components/prefs/pref_service.h" #include "components/variations/synthetic_trials.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm index 2767b89..1182bcb2 100644 --- a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm +++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client.mm
@@ -59,7 +59,7 @@ #include "components/variations/variations_associated_data.h" #include "components/version_info/version_info.h" #include "google_apis/google_api_keys.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/chrome_paths.h"
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client_unittest.mm b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client_unittest.mm index 8c4dc56d..07ce31e3 100644 --- a/ios/chrome/browser/metrics/ios_chrome_metrics_service_client_unittest.mm +++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_client_unittest.mm
@@ -18,7 +18,7 @@ #include "components/metrics/unsent_log_store.h" #include "components/prefs/testing_pref_service.h" #include "components/ukm/ukm_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager.h"
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm b/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm index 846a330..5680dd1 100644 --- a/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm +++ b/ios/chrome/browser/metrics/ios_chrome_metrics_services_manager_client.mm
@@ -15,7 +15,7 @@ #include "components/metrics/metrics_state_manager.h" #include "components/prefs/pref_service.h" #include "components/variations/service/variations_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/chrome_paths.h" #import "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/metrics/ios_chrome_signin_and_sync_status_metrics_provider.mm b/ios/chrome/browser/metrics/ios_chrome_signin_and_sync_status_metrics_provider.mm index 5977d53..e8f079fd 100644 --- a/ios/chrome/browser/metrics/ios_chrome_signin_and_sync_status_metrics_provider.mm +++ b/ios/chrome/browser/metrics/ios_chrome_signin_and_sync_status_metrics_provider.mm
@@ -7,7 +7,7 @@ #include <vector> #include "base/metrics/histogram_functions.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/metrics/ios_profile_session_durations_service.h"
diff --git a/ios/chrome/browser/metrics/ios_profile_session_metrics_provider.mm b/ios/chrome/browser/metrics/ios_profile_session_metrics_provider.mm index 7a4a769..af266cc 100644 --- a/ios/chrome/browser/metrics/ios_profile_session_metrics_provider.mm +++ b/ios/chrome/browser/metrics/ios_profile_session_metrics_provider.mm
@@ -6,7 +6,7 @@ #include "base/metrics/histogram_functions.h" #include "base/ranges/algorithm.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/metrics/ios_profile_session_durations_service.h"
diff --git a/ios/chrome/browser/metrics/metrics_app_interface.mm b/ios/chrome/browser/metrics/metrics_app_interface.mm index c6f9a0e..c22aa0acf 100644 --- a/ios/chrome/browser/metrics/metrics_app_interface.mm +++ b/ios/chrome/browser/metrics/metrics_app_interface.mm
@@ -15,7 +15,7 @@ #include "components/network_time/network_time_tracker.h" #include "components/ukm/ukm_service.h" #include "components/ukm/ukm_test_helper.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.h"
diff --git a/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider.mm b/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider.mm index 108744ab..450ec24 100644 --- a/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider.mm +++ b/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider.mm
@@ -19,7 +19,7 @@ #include "components/metrics/metrics_service.h" #import "components/previous_session_info/previous_session_info.h" #include "components/version_info/version_info.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/crash_report/crash_helper.h" #include "ios/chrome/browser/crash_report/features.h" #include "ios/chrome/browser/crash_report/main_thread_freeze_detector.h"
diff --git a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.mm b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.mm index 6d070d5..a46eeb2 100644 --- a/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.mm +++ b/ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory_util.mm
@@ -36,7 +36,7 @@ #include "components/signin/public/identity_manager/identity_manager.h" #include "components/version_info/version_info.h" #include "google_apis/google_api_keys.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/favicon/ios_chrome_large_icon_service_factory.h" #include "ios/chrome/browser/history/history_service_factory.h"
diff --git a/ios/chrome/browser/ntp_tiles/ios_popular_sites_factory.mm b/ios/chrome/browser/ntp_tiles/ios_popular_sites_factory.mm index 8ba5851..2f53673 100644 --- a/ios/chrome/browser/ntp_tiles/ios_popular_sites_factory.mm +++ b/ios/chrome/browser/ntp_tiles/ios_popular_sites_factory.mm
@@ -7,7 +7,7 @@ #include "base/bind.h" #include "base/files/file_path.h" #include "components/ntp_tiles/popular_sites_impl.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/search_engines/template_url_service_factory.h" #include "ios/web/public/thread/web_thread.h"
diff --git a/ios/chrome/browser/omaha/omaha_service.mm b/ios/chrome/browser/omaha/omaha_service.mm index 93bf2722..7a837b4 100644 --- a/ios/chrome/browser/omaha/omaha_service.mm +++ b/ios/chrome/browser/omaha/omaha_service.mm
@@ -27,7 +27,7 @@ #import "components/prefs/pref_service.h" #import "components/version_info/version_info.h" #import "ios/chrome/app/tests_hook.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #import "ios/chrome/browser/browser_state_metrics/browser_state_metrics.h" #import "ios/chrome/browser/install_time_util.h"
diff --git a/ios/chrome/browser/omaha/omaha_service_unittest.mm b/ios/chrome/browser/omaha/omaha_service_unittest.mm index 9626170..a8280c3 100644 --- a/ios/chrome/browser/omaha/omaha_service_unittest.mm +++ b/ios/chrome/browser/omaha/omaha_service_unittest.mm
@@ -16,7 +16,7 @@ #include "components/metrics/metrics_pref_names.h" #include "components/prefs/pref_registry_simple.h" #include "components/version_info/version_info.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state_manager.h" #include "ios/chrome/browser/install_time_util.h" #import "ios/chrome/browser/upgrade/upgrade_constants.h"
diff --git a/ios/chrome/browser/open_in/OWNERS b/ios/chrome/browser/open_in/OWNERS index 6cadd6b..9fbce5a 100644 --- a/ios/chrome/browser/open_in/OWNERS +++ b/ios/chrome/browser/open_in/OWNERS
@@ -1,2 +1,2 @@ -ewannpv@chromium.org +alionadangla@chromium.org gambard@chromium.org
diff --git a/ios/chrome/browser/optimization_guide/BUILD.gn b/ios/chrome/browser/optimization_guide/BUILD.gn index 30279ad..936a26a 100644 --- a/ios/chrome/browser/optimization_guide/BUILD.gn +++ b/ios/chrome/browser/optimization_guide/BUILD.gn
@@ -30,8 +30,8 @@ "//components/optimization_guide/proto:optimization_guide_proto", "//components/prefs", "//components/variations", - "//ios/chrome/browser:application_context", "//ios/chrome/browser:chrome_paths", + "//ios/chrome/browser/application_context", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/download/background_service", "//ios/chrome/browser/main:public", @@ -81,7 +81,7 @@ "//components/unified_consent", "//components/variations", "//components/variations:test_support", - "//ios/chrome/browser:application_context", + "//ios/chrome/browser/application_context", "//ios/chrome/browser/browser_state:test_support", "//ios/chrome/browser/main:public", "//ios/chrome/browser/main:test_support",
diff --git a/ios/chrome/browser/optimization_guide/optimization_guide_service.mm b/ios/chrome/browser/optimization_guide/optimization_guide_service.mm index a4bba31..1eb96dd 100644 --- a/ios/chrome/browser/optimization_guide/optimization_guide_service.mm +++ b/ios/chrome/browser/optimization_guide/optimization_guide_service.mm
@@ -25,7 +25,7 @@ #import "components/optimization_guide/core/top_host_provider.h" #import "components/prefs/pref_service.h" #import "components/variations/synthetic_trials.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_paths.h" #import "ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.h"
diff --git a/ios/chrome/browser/optimization_guide/optimization_guide_service_factory.mm b/ios/chrome/browser/optimization_guide/optimization_guide_service_factory.mm index 7b10b2db..ab28feb 100644 --- a/ios/chrome/browser/optimization_guide/optimization_guide_service_factory.mm +++ b/ios/chrome/browser/optimization_guide/optimization_guide_service_factory.mm
@@ -9,7 +9,7 @@ #import "components/keyed_service/ios/browser_state_dependency_manager.h" #import "components/optimization_guide/core/optimization_guide_features.h" #include "components/optimization_guide/core/prediction_manager.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/main/browser_list_factory.h"
diff --git a/ios/chrome/browser/optimization_guide/prediction_manager_browsertest.mm b/ios/chrome/browser/optimization_guide/prediction_manager_browsertest.mm index 8202673..bce40094 100644 --- a/ios/chrome/browser/optimization_guide/prediction_manager_browsertest.mm +++ b/ios/chrome/browser/optimization_guide/prediction_manager_browsertest.mm
@@ -17,7 +17,7 @@ #import "components/sync_preferences/testing_pref_service_syncable.h" #include "components/variations/hashing.h" #include "components/variations/scoped_variations_ids_provider.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/optimization_guide/optimization_guide_service.h" #include "ios/chrome/browser/optimization_guide/optimization_guide_service_factory.h"
diff --git a/ios/chrome/browser/passwords/ios_chrome_affiliation_service_factory.mm b/ios/chrome/browser/passwords/ios_chrome_affiliation_service_factory.mm index 1ea78fd..caefb3a 100644 --- a/ios/chrome/browser/passwords/ios_chrome_affiliation_service_factory.mm +++ b/ios/chrome/browser/passwords/ios_chrome_affiliation_service_factory.mm
@@ -14,7 +14,7 @@ #include "components/keyed_service/ios/browser_state_keyed_service_factory.h" #include "components/password_manager/core/browser/password_manager_constants.h" #include "components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
diff --git a/ios/chrome/browser/passwords/ios_chrome_password_manager_client.mm b/ios/chrome/browser/passwords/ios_chrome_password_manager_client.mm index c4bc459..d8220be 100644 --- a/ios/chrome/browser/passwords/ios_chrome_password_manager_client.mm +++ b/ios/chrome/browser/passwords/ios_chrome_password_manager_client.mm
@@ -28,7 +28,7 @@ #include "components/sync/driver/sync_service.h" #include "components/translate/core/browser/translate_manager.h" #import "components/ukm/ios/ukm_url_recorder.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/passwords/ios_chrome_password_change_success_tracker_factory.h" #include "ios/chrome/browser/passwords/ios_chrome_password_reuse_manager_factory.h"
diff --git a/ios/chrome/browser/passwords/ios_chrome_password_store_factory.mm b/ios/chrome/browser/passwords/ios_chrome_password_store_factory.mm index 4c7d6d36..89131522 100644 --- a/ios/chrome/browser/passwords/ios_chrome_password_store_factory.mm +++ b/ios/chrome/browser/passwords/ios_chrome_password_store_factory.mm
@@ -21,7 +21,7 @@ #include "components/password_manager/core/browser/password_store_factory_util.h" #include "components/password_manager/core/common/password_manager_features.h" #include "components/sync/driver/sync_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/passwords/credentials_cleaner_runner_factory.h"
diff --git a/ios/chrome/browser/policy/chrome_browser_cloud_management_controller_ios.mm b/ios/chrome/browser/policy/chrome_browser_cloud_management_controller_ios.mm index 05b245dc..f2251909 100644 --- a/ios/chrome/browser/policy/chrome_browser_cloud_management_controller_ios.mm +++ b/ios/chrome/browser/policy/chrome_browser_cloud_management_controller_ios.mm
@@ -12,7 +12,7 @@ #include "components/enterprise/browser/reporting/report_scheduler.h" #include "components/policy/core/common/cloud/machine_level_user_cloud_policy_manager.h" #include "components/policy/core/common/features.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/chrome_paths.h" #include "ios/chrome/browser/policy/browser_dm_token_storage_ios.h" #include "ios/chrome/browser/policy/browser_policy_connector_ios.h"
diff --git a/ios/chrome/browser/policy/cloud/user_policy_signin_service_factory.mm b/ios/chrome/browser/policy/cloud/user_policy_signin_service_factory.mm index 560f81d1..555885d 100644 --- a/ios/chrome/browser/policy/cloud/user_policy_signin_service_factory.mm +++ b/ios/chrome/browser/policy/cloud/user_policy_signin_service_factory.mm
@@ -10,7 +10,7 @@ #include "components/policy/core/common/policy_pref_names.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/policy/browser_policy_connector_ios.h" #include "ios/chrome/browser/policy/cloud/user_policy_signin_service.h"
diff --git a/ios/chrome/browser/policy/policy_app_interface.mm b/ios/chrome/browser/policy/policy_app_interface.mm index 6a76134..44331eb 100644 --- a/ios/chrome/browser/policy/policy_app_interface.mm +++ b/ios/chrome/browser/policy/policy_app_interface.mm
@@ -30,7 +30,7 @@ #import "components/policy/core/common/policy_namespace.h" #import "components/policy/core/common/policy_types.h" #import "components/policy/policy_constants.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #import "ios/chrome/browser/chrome_paths.h"
diff --git a/ios/chrome/browser/policy/policy_conversions_client_ios.mm b/ios/chrome/browser/policy/policy_conversions_client_ios.mm index 6e0163f..f22bbec 100644 --- a/ios/chrome/browser/policy/policy_conversions_client_ios.mm +++ b/ios/chrome/browser/policy/policy_conversions_client_ios.mm
@@ -7,7 +7,7 @@ #include "base/check.h" #include "base/values.h" #include "components/policy/core/browser/policy_conversions_client.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/policy/browser_policy_connector_ios.h"
diff --git a/ios/chrome/browser/policy/policy_watcher_browser_agent.mm b/ios/chrome/browser/policy/policy_watcher_browser_agent.mm index bc293dc7..e9134116 100644 --- a/ios/chrome/browser/policy/policy_watcher_browser_agent.mm +++ b/ios/chrome/browser/policy/policy_watcher_browser_agent.mm
@@ -16,7 +16,7 @@ #include "components/prefs/pref_service.h" #include "components/sync/base/pref_names.h" #import "ios/chrome/app/application_delegate/app_state.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/policy/policy_watcher_browser_agent_observer.h" #include "ios/chrome/browser/pref_names.h"
diff --git a/ios/chrome/browser/policy/reporting/browser_report_generator_ios.mm b/ios/chrome/browser/policy/reporting/browser_report_generator_ios.mm index 4cc9a2c1..0e12319 100644 --- a/ios/chrome/browser/policy/reporting/browser_report_generator_ios.mm +++ b/ios/chrome/browser/policy/reporting/browser_report_generator_ios.mm
@@ -8,7 +8,7 @@ #include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" #include "components/policy/proto/device_management_backend.pb.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/common/channel_info.h"
diff --git a/ios/chrome/browser/policy/reporting/profile_report_generator_ios.mm b/ios/chrome/browser/policy/reporting/profile_report_generator_ios.mm index 637c10a..83ea6c3 100644 --- a/ios/chrome/browser/policy/reporting/profile_report_generator_ios.mm +++ b/ios/chrome/browser/policy/reporting/profile_report_generator_ios.mm
@@ -6,7 +6,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/policy/core/browser/policy_conversions.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/policy/browser_policy_connector_ios.h"
diff --git a/ios/chrome/browser/policy/reporting/report_scheduler_ios.mm b/ios/chrome/browser/policy/reporting/report_scheduler_ios.mm index 585c8c3..abe80c6 100644 --- a/ios/chrome/browser/policy/reporting/report_scheduler_ios.mm +++ b/ios/chrome/browser/policy/reporting/report_scheduler_ios.mm
@@ -5,7 +5,7 @@ #include "ios/chrome/browser/policy/reporting/report_scheduler_ios.h" #include "components/policy/core/common/cloud/dm_token.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif
diff --git a/ios/chrome/browser/policy_url_blocking/policy_url_blocking_service.mm b/ios/chrome/browser/policy_url_blocking/policy_url_blocking_service.mm index 3510b35..bf5a4ad6 100644 --- a/ios/chrome/browser/policy_url_blocking/policy_url_blocking_service.mm +++ b/ios/chrome/browser/policy_url_blocking/policy_url_blocking_service.mm
@@ -7,7 +7,7 @@ #include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/policy/core/common/policy_pref_names.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/web/public/browser_state.h"
diff --git a/ios/chrome/browser/prefs/ios_chrome_pref_service_factory.mm b/ios/chrome/browser/prefs/ios_chrome_pref_service_factory.mm index 8f6d4c4..9a0342e 100644 --- a/ios/chrome/browser/prefs/ios_chrome_pref_service_factory.mm +++ b/ios/chrome/browser/prefs/ios_chrome_pref_service_factory.mm
@@ -21,7 +21,7 @@ #include "components/proxy_config/proxy_config_pref_names.h" #include "components/sync_preferences/pref_service_syncable.h" #include "components/sync_preferences/pref_service_syncable_factory.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/prefs/ios_chrome_pref_model_associator_client.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/reading_list/reading_list_download_service.mm b/ios/chrome/browser/reading_list/reading_list_download_service.mm index 105af2b..ff5bbe3 100644 --- a/ios/chrome/browser/reading_list/reading_list_download_service.mm +++ b/ios/chrome/browser/reading_list/reading_list_download_service.mm
@@ -17,7 +17,7 @@ #include "components/reading_list/core/offline_url_utils.h" #include "components/reading_list/core/reading_list_entry.h" #include "components/reading_list/core/reading_list_model.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/reading_list/reading_list_distiller_page_factory.h" #include "net/base/network_change_notifier.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
diff --git a/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.mm b/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.mm index d110d37..93caf5e 100644 --- a/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.mm +++ b/ios/chrome/browser/rlz/rlz_tracker_delegate_impl.mm
@@ -12,7 +12,7 @@ #include "components/omnibox/browser/omnibox_log.h" #include "components/search_engines/template_url.h" #include "components/search_engines/template_url_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/google/google_brand.h" #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
diff --git a/ios/chrome/browser/safe_browsing/chrome_password_protection_service.mm b/ios/chrome/browser/safe_browsing/chrome_password_protection_service.mm index 3061222..3d24615 100644 --- a/ios/chrome/browser/safe_browsing/chrome_password_protection_service.mm +++ b/ios/chrome/browser/safe_browsing/chrome_password_protection_service.mm
@@ -34,7 +34,7 @@ #include "components/sync/protocol/user_event_specifics.pb.h" #include "components/sync_user_events/user_event_service.h" #include "components/variations/service/variations_service.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/history/history_service_factory.h" #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h"
diff --git a/ios/chrome/browser/safe_browsing/chrome_password_protection_service_factory.mm b/ios/chrome/browser/safe_browsing/chrome_password_protection_service_factory.mm index 796747e..738635b 100644 --- a/ios/chrome/browser/safe_browsing/chrome_password_protection_service_factory.mm +++ b/ios/chrome/browser/safe_browsing/chrome_password_protection_service_factory.mm
@@ -7,7 +7,7 @@ #include "base/no_destructor.h" #include "components/keyed_service/core/service_access_type.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/history/history_service_factory.h"
diff --git a/ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.mm b/ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.mm index 1d63407..56d84f1 100644 --- a/ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.mm +++ b/ios/chrome/browser/safe_browsing/real_time_url_lookup_service_factory.mm
@@ -12,7 +12,7 @@ #include "components/safe_browsing/core/browser/sync/sync_utils.h" #include "components/safe_browsing/core/browser/verdict_cache_manager.h" #include "components/safe_browsing/core/common/utils.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/safe_browsing/user_population_helper.h" #import "ios/chrome/browser/safe_browsing/verdict_cache_manager_factory.h"
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_blocking_page.mm b/ios/chrome/browser/safe_browsing/safe_browsing_blocking_page.mm index 85ba2c2e..96f7e56 100644 --- a/ios/chrome/browser/safe_browsing/safe_browsing_blocking_page.mm +++ b/ios/chrome/browser/safe_browsing/safe_browsing_blocking_page.mm
@@ -16,7 +16,7 @@ #include "components/security_interstitials/core/base_safe_browsing_error_ui.h" #include "components/security_interstitials/core/metrics_helper.h" #include "components/security_interstitials/core/safe_browsing_loud_error_ui.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/safe_browsing/safe_browsing_metrics_collector_factory.h" #include "ios/components/security_interstitials/ios_blocking_page_metrics_helper.h"
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_client_impl.mm b/ios/chrome/browser/safe_browsing/safe_browsing_client_impl.mm index dc901aac..c43d228 100644 --- a/ios/chrome/browser/safe_browsing/safe_browsing_client_impl.mm +++ b/ios/chrome/browser/safe_browsing/safe_browsing_client_impl.mm
@@ -8,7 +8,7 @@ #import "base/memory/weak_ptr.h" #import "components/safe_browsing/core/browser/realtime/url_lookup_service.h" #import "components/security_interstitials/core/unsafe_resource.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/prerender/prerender_service.h" #import "ios/web/public/web_state.h"
diff --git a/ios/chrome/browser/safe_browsing/safe_browsing_metrics_collector_factory.mm b/ios/chrome/browser/safe_browsing/safe_browsing_metrics_collector_factory.mm index c356d9f03..302ac3d 100644 --- a/ios/chrome/browser/safe_browsing/safe_browsing_metrics_collector_factory.mm +++ b/ios/chrome/browser/safe_browsing/safe_browsing_metrics_collector_factory.mm
@@ -6,7 +6,7 @@ #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/safe_browsing/core/browser/safe_browsing_metrics_collector.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/components/security_interstitials/safe_browsing/safe_browsing_service.h"
diff --git a/ios/chrome/browser/safe_browsing/user_population_helper.mm b/ios/chrome/browser/safe_browsing/user_population_helper.mm index 4678f74..edab2ce 100644 --- a/ios/chrome/browser/safe_browsing/user_population_helper.mm +++ b/ios/chrome/browser/safe_browsing/user_population_helper.mm
@@ -6,7 +6,7 @@ #include "components/safe_browsing/core/browser/user_population.h" #include "components/sync/driver/sync_service.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/policy/browser_policy_connector_ios.h" #include "ios/chrome/browser/sync/sync_service_factory.h"
diff --git a/ios/chrome/browser/search_engines/template_url_service_factory.mm b/ios/chrome/browser/search_engines/template_url_service_factory.mm index b8afb06b..4dbe4f78 100644 --- a/ios/chrome/browser/search_engines/template_url_service_factory.mm +++ b/ios/chrome/browser/search_engines/template_url_service_factory.mm
@@ -11,7 +11,7 @@ #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/search_engines/default_search_manager.h" #include "components/search_engines/template_url_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/history/history_service_factory.h"
diff --git a/ios/chrome/browser/search_engines/ui_thread_search_terms_data.mm b/ios/chrome/browser/search_engines/ui_thread_search_terms_data.mm index 45ffb7cc..802ba34 100644 --- a/ios/chrome/browser/search_engines/ui_thread_search_terms_data.mm +++ b/ios/chrome/browser/search_engines/ui_thread_search_terms_data.mm
@@ -11,7 +11,7 @@ #include "components/google/core/common/google_util.h" #include "components/omnibox/browser/omnibox_field_trial.h" #include "components/version_info/version_info.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/google/google_brand.h" #include "ios/chrome/browser/system_flags.h" #include "ios/chrome/common/channel_info.h"
diff --git a/ios/chrome/browser/segmentation_platform/BUILD.gn b/ios/chrome/browser/segmentation_platform/BUILD.gn index ea4d35a..d702090d 100644 --- a/ios/chrome/browser/segmentation_platform/BUILD.gn +++ b/ios/chrome/browser/segmentation_platform/BUILD.gn
@@ -28,8 +28,8 @@ "//components/segmentation_platform/public", "//components/segmentation_platform/public/proto", "//components/variations", - "//ios/chrome/browser:application_context", "//ios/chrome/browser:chrome_paths", + "//ios/chrome/browser/application_context", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/history", "//ios/chrome/browser/main:public",
diff --git a/ios/chrome/browser/segmentation_platform/segmentation_platform_service_factory.mm b/ios/chrome/browser/segmentation_platform/segmentation_platform_service_factory.mm index 707bec95..c35b579 100644 --- a/ios/chrome/browser/segmentation_platform/segmentation_platform_service_factory.mm +++ b/ios/chrome/browser/segmentation_platform/segmentation_platform_service_factory.mm
@@ -19,7 +19,7 @@ #import "components/segmentation_platform/internal/ukm_data_manager.h" #import "components/segmentation_platform/public/config.h" #import "components/segmentation_platform/public/features.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/history/history_service_factory.h"
diff --git a/ios/chrome/browser/sessions/ios_chrome_tab_restore_service_client.mm b/ios/chrome/browser/sessions/ios_chrome_tab_restore_service_client.mm index cc36cf0..1019461f 100644 --- a/ios/chrome/browser/sessions/ios_chrome_tab_restore_service_client.mm +++ b/ios/chrome/browser/sessions/ios_chrome_tab_restore_service_client.mm
@@ -8,7 +8,7 @@ #include "base/callback.h" #include "components/sessions/ios/ios_live_tab.h" #include "components/tab_groups/tab_group_id.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/chrome_url_constants.h"
diff --git a/ios/chrome/browser/signin/BUILD.gn b/ios/chrome/browser/signin/BUILD.gn index 7d75a89c0..252a03f4 100644 --- a/ios/chrome/browser/signin/BUILD.gn +++ b/ios/chrome/browser/signin/BUILD.gn
@@ -177,7 +177,7 @@ ":trusted_vault", "//base", "//components/keyed_service/ios", - "//ios/chrome/browser:application_context", + "//ios/chrome/browser/application_context", "//ios/chrome/browser/browser_state", "//ios/public/provider/chrome/browser/signin:trusted_vault_api", ]
diff --git a/ios/chrome/browser/signin/authentication_service.mm b/ios/chrome/browser/signin/authentication_service.mm index 947278a..5f52db5e 100644 --- a/ios/chrome/browser/signin/authentication_service.mm +++ b/ios/chrome/browser/signin/authentication_service.mm
@@ -22,7 +22,7 @@ #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_user_settings.h" #include "google_apis/gaia/gaia_auth_util.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/crash_report/crash_keys_helper.h" #import "ios/chrome/browser/policy/policy_util.h" #include "ios/chrome/browser/pref_names.h"
diff --git a/ios/chrome/browser/signin/chrome_account_manager_service.mm b/ios/chrome/browser/signin/chrome_account_manager_service.mm index 36fd6f35..7d42d57 100644 --- a/ios/chrome/browser/signin/chrome_account_manager_service.mm +++ b/ios/chrome/browser/signin/chrome_account_manager_service.mm
@@ -8,7 +8,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/prefs/pref_service.h" #include "components/signin/public/base/signin_pref_names.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/signin/resized_avatar_cache.h" #import "ios/chrome/browser/ui/util/ui_util.h" #import "ios/chrome/browser/ui/util/uikit_ui_util.h"
diff --git a/ios/chrome/browser/signin/chrome_account_manager_service_factory.mm b/ios/chrome/browser/signin/chrome_account_manager_service_factory.mm index a3d28037..6ee6bf0 100644 --- a/ios/chrome/browser/signin/chrome_account_manager_service_factory.mm +++ b/ios/chrome/browser/signin/chrome_account_manager_service_factory.mm
@@ -6,7 +6,7 @@ #include "base/no_destructor.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/signin/chrome_account_manager_service.h"
diff --git a/ios/chrome/browser/signin/identity_manager_factory.mm b/ios/chrome/browser/signin/identity_manager_factory.mm index c927769d8..6d7c8b0 100644 --- a/ios/chrome/browser/signin/identity_manager_factory.mm +++ b/ios/chrome/browser/signin/identity_manager_factory.mm
@@ -15,7 +15,7 @@ #include "components/signin/public/base/signin_client.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/identity_manager_builder.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/signin/chrome_account_manager_service_factory.h" #include "ios/chrome/browser/signin/device_accounts_provider_impl.h"
diff --git a/ios/chrome/browser/signin/ios_chrome_signin_client.mm b/ios/chrome/browser/signin/ios_chrome_signin_client.mm index 5a30613..858be51 100644 --- a/ios/chrome/browser/signin/ios_chrome_signin_client.mm +++ b/ios/chrome/browser/signin/ios_chrome_signin_client.mm
@@ -7,7 +7,7 @@ #include "base/strings/utf_string_conversions.h" #include "components/metrics/metrics_service.h" #include "components/signin/core/browser/cookie_settings_util.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h"
diff --git a/ios/chrome/browser/signin/signin_browser_state_info_updater.mm b/ios/chrome/browser/signin/signin_browser_state_info_updater.mm index 45364763..75b7304 100644 --- a/ios/chrome/browser/signin/signin_browser_state_info_updater.mm +++ b/ios/chrome/browser/signin/signin_browser_state_info_updater.mm
@@ -12,7 +12,7 @@ #include "base/strings/utf_string_conversions.h" #include "components/signin/public/identity_manager/account_info.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h"
diff --git a/ios/chrome/browser/signin/signin_browser_state_info_updater_unittest.mm b/ios/chrome/browser/signin/signin_browser_state_info_updater_unittest.mm index 60bd04be..b6a92b2 100644 --- a/ios/chrome/browser/signin/signin_browser_state_info_updater_unittest.mm +++ b/ios/chrome/browser/signin/signin_browser_state_info_updater_unittest.mm
@@ -17,7 +17,7 @@ #include "components/signin/public/identity_manager/account_info.h" #include "components/signin/public/identity_manager/identity_test_environment.h" #include "google_apis/gaia/google_service_auth_error.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_info_cache.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
diff --git a/ios/chrome/browser/signin/trusted_vault_client_backend_factory.mm b/ios/chrome/browser/signin/trusted_vault_client_backend_factory.mm index 581b5ed5..552c0eb 100644 --- a/ios/chrome/browser/signin/trusted_vault_client_backend_factory.mm +++ b/ios/chrome/browser/signin/trusted_vault_client_backend_factory.mm
@@ -5,7 +5,7 @@ #import "ios/chrome/browser/signin/trusted_vault_client_backend_factory.h" #import "components/keyed_service/ios/browser_state_dependency_manager.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/signin/trusted_vault_client_backend.h"
diff --git a/ios/chrome/browser/ssl/ios_ssl_error_handler.mm b/ios/chrome/browser/ssl/ios_ssl_error_handler.mm index d9862ae..4ecfa765 100644 --- a/ios/chrome/browser/ssl/ios_ssl_error_handler.mm +++ b/ios/chrome/browser/ssl/ios_ssl_error_handler.mm
@@ -14,7 +14,7 @@ #include "components/security_interstitials/core/metrics_helper.h" #include "components/security_interstitials/core/ssl_error_options_mask.h" #include "components/security_interstitials/core/ssl_error_ui.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/ssl/captive_portal_metrics.h" #include "ios/chrome/browser/ssl/ios_captive_portal_blocking_page.h" #include "ios/chrome/browser/ssl/ios_ssl_blocking_page.h"
diff --git a/ios/chrome/browser/sync/consent_auditor_factory.mm b/ios/chrome/browser/sync/consent_auditor_factory.mm index 647e117..d91804b 100644 --- a/ios/chrome/browser/sync/consent_auditor_factory.mm +++ b/ios/chrome/browser/sync/consent_auditor_factory.mm
@@ -25,7 +25,7 @@ #include "components/sync/model/client_tag_based_model_type_processor.h" #include "components/sync/model/model_type_store_service.h" #include "components/version_info/version_info.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/sync/model_type_store_service_factory.h" #include "ios/chrome/common/channel_info.h"
diff --git a/ios/chrome/browser/sync/device_info_sync_service_factory.mm b/ios/chrome/browser/sync/device_info_sync_service_factory.mm index 2344de45..675d1cb 100644 --- a/ios/chrome/browser/sync/device_info_sync_service_factory.mm +++ b/ios/chrome/browser/sync/device_info_sync_service_factory.mm
@@ -19,7 +19,7 @@ #include "components/sync_device_info/device_info_sync_client.h" #include "components/sync_device_info/device_info_sync_service_impl.h" #include "components/sync_device_info/local_device_info_provider_impl.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/sync/model_type_store_service_factory.h"
diff --git a/ios/chrome/browser/sync/glue/BUILD.gn b/ios/chrome/browser/sync/glue/BUILD.gn index 83fe828..e92ea80a 100644 --- a/ios/chrome/browser/sync/glue/BUILD.gn +++ b/ios/chrome/browser/sync/glue/BUILD.gn
@@ -12,7 +12,7 @@ "//base", "//components/browser_sync", "//components/sync", - "//ios/chrome/browser:application_context", + "//ios/chrome/browser/application_context", "//ios/chrome/browser/browser_state", "//ios/web", ]
diff --git a/ios/chrome/browser/sync/glue/sync_start_util.mm b/ios/chrome/browser/sync/glue/sync_start_util.mm index 4f074b0c..9bbff259 100644 --- a/ios/chrome/browser/sync/glue/sync_start_util.mm +++ b/ios/chrome/browser/sync/glue/sync_start_util.mm
@@ -8,7 +8,7 @@ #include "base/files/file_path.h" #include "base/location.h" #include "components/sync/driver/sync_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/sync/sync_service_factory.h"
diff --git a/ios/chrome/browser/sync/sync_service_factory.mm b/ios/chrome/browser/sync/sync_service_factory.mm index 2f95cfb..6da284b 100644 --- a/ios/chrome/browser/sync/sync_service_factory.mm +++ b/ios/chrome/browser/sync/sync_service_factory.mm
@@ -17,7 +17,7 @@ #include "components/sync/base/sync_util.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service_impl.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" #include "ios/chrome/browser/bookmarks/bookmark_sync_service_factory.h"
diff --git a/ios/chrome/browser/tabs/ios_synced_window_delegate_getter.mm b/ios/chrome/browser/tabs/ios_synced_window_delegate_getter.mm index bfe8ece..6421eec 100644 --- a/ios/chrome/browser/tabs/ios_synced_window_delegate_getter.mm +++ b/ios/chrome/browser/tabs/ios_synced_window_delegate_getter.mm
@@ -7,7 +7,7 @@ #include <vector> #include "base/check.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/main/browser_list.h"
diff --git a/ios/chrome/browser/translate/translate_ranker_factory.mm b/ios/chrome/browser/translate/translate_ranker_factory.mm index bc6ae25..dfbf4dd 100644 --- a/ios/chrome/browser/translate/translate_ranker_factory.mm +++ b/ios/chrome/browser/translate/translate_ranker_factory.mm
@@ -8,7 +8,7 @@ #include "components/keyed_service/core/keyed_service.h" #include "components/keyed_service/ios/browser_state_dependency_manager.h" #include "components/translate/core/browser/translate_ranker_impl.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
diff --git a/ios/chrome/browser/translate/translate_ranker_metrics_provider.mm b/ios/chrome/browser/translate/translate_ranker_metrics_provider.mm index 14995d9..3d6fa92 100644 --- a/ios/chrome/browser/translate/translate_ranker_metrics_provider.mm +++ b/ios/chrome/browser/translate/translate_ranker_metrics_provider.mm
@@ -5,7 +5,7 @@ #include "ios/chrome/browser/translate/translate_ranker_metrics_provider.h" #include "components/translate/core/browser/translate_ranker.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/translate/translate_ranker_factory.h"
diff --git a/ios/chrome/browser/translate/translate_service_ios.mm b/ios/chrome/browser/translate/translate_service_ios.mm index c53615b..b6aa697 100644 --- a/ios/chrome/browser/translate/translate_service_ios.mm +++ b/ios/chrome/browser/translate/translate_service_ios.mm
@@ -10,7 +10,7 @@ #include "components/prefs/pref_service.h" #include "components/translate/core/browser/translate_download_manager.h" #include "components/translate/core/browser/translate_manager.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/translate/chrome_ios_translate_client.h" #include "ios/components/webui/web_ui_url_constants.h"
diff --git a/ios/chrome/browser/ui/authentication/enterprise/enterprise_utils.mm b/ios/chrome/browser/ui/authentication/enterprise/enterprise_utils.mm index 61114fa2..80724f6 100644 --- a/ios/chrome/browser/ui/authentication/enterprise/enterprise_utils.mm +++ b/ios/chrome/browser/ui/authentication/enterprise/enterprise_utils.mm
@@ -10,7 +10,7 @@ #include "components/signin/public/base/signin_pref_names.h" #include "components/sync/base/pref_names.h" #include "components/sync/driver/sync_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/policy/policy_util.h" #include "ios/chrome/browser/pref_names.h" #import "ios/chrome/browser/signin/authentication_service.h"
diff --git a/ios/chrome/browser/ui/authentication/signin/signin_utils.mm b/ios/chrome/browser/ui/authentication/signin/signin_utils.mm index b79d3e0..b994ce5 100644 --- a/ios/chrome/browser/ui/authentication/signin/signin_utils.mm +++ b/ios/chrome/browser/ui/authentication/signin/signin_utils.mm
@@ -14,7 +14,7 @@ #import "components/signin/ios/browser/features.h" #import "components/signin/public/base/signin_pref_names.h" #import "ios/chrome/app/tests_hook.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/main/browser.h" #import "ios/chrome/browser/policy/policy_util.h"
diff --git a/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm b/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm index 6a4bee61..38bd28e 100644 --- a/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm +++ b/ios/chrome/browser/ui/authentication/unified_consent/unified_consent_view_controller.mm
@@ -10,7 +10,7 @@ #include "base/ios/ns_range.h" #include "base/notreached.h" #include "components/google/core/common/google_util.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/ui/authentication/authentication_constants.h" #import "ios/chrome/browser/ui/authentication/unified_consent/unified_consent_constants.h"
diff --git a/ios/chrome/browser/ui/autofill/autofill_app_interface.mm b/ios/chrome/browser/ui/autofill/autofill_app_interface.mm index a05e0a2..0c0b843c 100644 --- a/ios/chrome/browser/ui/autofill/autofill_app_interface.mm +++ b/ios/chrome/browser/ui/autofill/autofill_app_interface.mm
@@ -19,7 +19,7 @@ #include "components/keyed_service/core/service_access_type.h" #include "components/password_manager/core/browser/password_store_consumer.h" #include "components/password_manager/core/browser/password_store_interface.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h"
diff --git a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm index 7035199..e781b34 100644 --- a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm +++ b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm
@@ -35,7 +35,7 @@ #import "components/translate/core/browser/translate_manager.h" #import "components/ukm/ios/ukm_url_recorder.h" #import "components/variations/service/variations_service.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/autofill/address_normalizer_factory.h" #import "ios/chrome/browser/autofill/autocomplete_history_manager_factory.h" #import "ios/chrome/browser/autofill/autofill_log_router_factory.h"
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address+AutofillProfile.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address+AutofillProfile.mm index cd375a9..ce54af0a 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address+AutofillProfile.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address+AutofillProfile.mm
@@ -7,7 +7,7 @@ #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/data_model/autofill_profile.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address+AutofillProfile_unittest.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address+AutofillProfile_unittest.mm index a0fb3c22..ce3a05f5 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address+AutofillProfile_unittest.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_address+AutofillProfile_unittest.mm
@@ -8,7 +8,7 @@ #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/data_model/autofill_profile.h" #include "components/autofill/core/browser/geo/country_names.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "testing/platform_test.h" #include "url/gurl.h"
diff --git a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_credit_card+CreditCard.mm b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_credit_card+CreditCard.mm index a1ad4a3d..becc2c1a 100644 --- a/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_credit_card+CreditCard.mm +++ b/ios/chrome/browser/ui/autofill/manual_fill/manual_fill_credit_card+CreditCard.mm
@@ -9,7 +9,7 @@ #include "components/autofill/core/browser/autofill_data_util.h" #include "components/autofill/core/browser/data_model/credit_card.h" #import "components/autofill/ios/browser/credit_card_util.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm index 3924645..0c62478 100644 --- a/ios/chrome/browser/ui/browser_view/browser_view_controller.mm +++ b/ios/chrome/browser/ui/browser_view/browser_view_controller.mm
@@ -21,7 +21,7 @@ #import "components/strings/grit/components_strings.h" #import "components/ukm/ios/ukm_url_recorder.h" #import "ios/chrome/app/application_delegate/app_state.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/bookmarks/bookmark_model_factory.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/chrome_url_constants.h"
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_favicon_mediator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_favicon_mediator.mm index eefa6751..4994242 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_favicon_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_favicon_mediator.mm
@@ -6,7 +6,7 @@ #include "base/bind.h" #include "components/favicon/core/large_icon_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_consumer.h" #import "ios/chrome/browser/ui/content_suggestions/content_suggestions_feature.h"
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm index 4da3721..e4162e8c 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_mediator.mm
@@ -25,7 +25,7 @@ #import "components/reading_list/ios/reading_list_model_bridge_observer.h" #import "components/search_engines/template_url.h" #import "components/strings/grit/components_strings.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/ntp/new_tab_page_tab_helper.h"
diff --git a/ios/chrome/browser/ui/content_suggestions/new_tab_page_app_interface.mm b/ios/chrome/browser/ui/content_suggestions/new_tab_page_app_interface.mm index 216d168..2fc6e55 100644 --- a/ios/chrome/browser/ui/content_suggestions/new_tab_page_app_interface.mm +++ b/ios/chrome/browser/ui/content_suggestions/new_tab_page_app_interface.mm
@@ -13,7 +13,7 @@ #include "components/ntp_snippets/mock_content_suggestions_provider.h" #include "components/search_engines/template_url.h" #include "components/search_engines/template_url_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/notification_promo.h" #include "ios/chrome/browser/ntp_snippets/ios_chrome_content_suggestions_service_factory.h"
diff --git a/ios/chrome/browser/ui/download/OWNERS b/ios/chrome/browser/ui/download/OWNERS index 6cadd6b..67ae87b 100644 --- a/ios/chrome/browser/ui/download/OWNERS +++ b/ios/chrome/browser/ui/download/OWNERS
@@ -1,2 +1,2 @@ -ewannpv@chromium.org +sdefresne@chromium.org gambard@chromium.org
diff --git a/ios/chrome/browser/ui/first_run/BUILD.gn b/ios/chrome/browser/ui/first_run/BUILD.gn index fba2a8813..b7e5b1c 100644 --- a/ios/chrome/browser/ui/first_run/BUILD.gn +++ b/ios/chrome/browser/ui/first_run/BUILD.gn
@@ -137,8 +137,8 @@ "//components/policy/core/common:common_constants", "//components/signin/public/identity_manager", "//ios/chrome/app:tests_hook", - "//ios/chrome/browser:application_context", "//ios/chrome/browser:utils", + "//ios/chrome/browser/application_context", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/crash_report", "//ios/chrome/browser/first_run",
diff --git a/ios/chrome/browser/ui/first_run/first_run_app_interface.mm b/ios/chrome/browser/ui/first_run/first_run_app_interface.mm index a7658a0..22463b2 100644 --- a/ios/chrome/browser/ui/first_run/first_run_app_interface.mm +++ b/ios/chrome/browser/ui/first_run/first_run_app_interface.mm
@@ -10,7 +10,7 @@ #import "ios/chrome/app/main_controller.h" #include "ios/chrome/app/main_controller.h" #import "ios/chrome/app/main_controller_private.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/sync/sync_setup_service.h" #include "ios/chrome/browser/sync/sync_setup_service_factory.h" #include "ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.h"
diff --git a/ios/chrome/browser/ui/first_run/first_run_util.mm b/ios/chrome/browser/ui/first_run/first_run_util.mm index e26dbe2..7dd5ecf8 100644 --- a/ios/chrome/browser/ui/first_run/first_run_util.mm +++ b/ios/chrome/browser/ui/first_run/first_run_util.mm
@@ -13,7 +13,7 @@ #import "components/policy/core/common/policy_loader_ios_constants.h" #include "components/signin/public/identity_manager/identity_manager.h" #import "ios/chrome/app/tests_hook.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/crash_report/crash_helper.h" #include "ios/chrome/browser/first_run/first_run.h"
diff --git a/ios/chrome/browser/ui/first_run/signin/BUILD.gn b/ios/chrome/browser/ui/first_run/signin/BUILD.gn index 26cb01c..b8c9a844 100644 --- a/ios/chrome/browser/ui/first_run/signin/BUILD.gn +++ b/ios/chrome/browser/ui/first_run/signin/BUILD.gn
@@ -15,7 +15,7 @@ "//components/metrics", "//components/prefs", "//components/web_resource", - "//ios/chrome/browser:application_context", + "//ios/chrome/browser/application_context", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/first_run", "//ios/chrome/browser/main",
diff --git a/ios/chrome/browser/ui/first_run/signin/signin_screen_coordinator.mm b/ios/chrome/browser/ui/first_run/signin/signin_screen_coordinator.mm index a5ac866..ac1d7b6 100644 --- a/ios/chrome/browser/ui/first_run/signin/signin_screen_coordinator.mm +++ b/ios/chrome/browser/ui/first_run/signin/signin_screen_coordinator.mm
@@ -5,7 +5,7 @@ #import "ios/chrome/browser/ui/first_run/signin/signin_screen_coordinator.h" #import "base/strings/sys_string_conversions.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/first_run/first_run_metrics.h" #import "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/ui/first_run/signin/signin_screen_mediator.mm b/ios/chrome/browser/ui/first_run/signin/signin_screen_mediator.mm index a633be8..a53f746 100644 --- a/ios/chrome/browser/ui/first_run/signin/signin_screen_mediator.mm +++ b/ios/chrome/browser/ui/first_run/signin/signin_screen_mediator.mm
@@ -10,7 +10,7 @@ #import "components/metrics/metrics_pref_names.h" #import "components/prefs/pref_service.h" #import "components/web_resource/web_resource_pref_names.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/first_run/first_run_metrics.h" #import "ios/chrome/browser/signin/authentication_service.h" #import "ios/chrome/browser/signin/chrome_account_manager_service_observer_bridge.h"
diff --git a/ios/chrome/browser/ui/first_run/welcome/welcome_screen_mediator.mm b/ios/chrome/browser/ui/first_run/welcome/welcome_screen_mediator.mm index eab89319..f117b7be 100644 --- a/ios/chrome/browser/ui/first_run/welcome/welcome_screen_mediator.mm +++ b/ios/chrome/browser/ui/first_run/welcome/welcome_screen_mediator.mm
@@ -7,7 +7,7 @@ #import "components/metrics/metrics_pref_names.h" #import "components/prefs/pref_service.h" #import "components/web_resource/web_resource_pref_names.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/ui/first_run/first_run_util.h" #import "ios/chrome/browser/ui/first_run/welcome/welcome_screen_consumer.h"
diff --git a/ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.mm b/ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.mm index 9a00ad1..2121ed7 100644 --- a/ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.mm +++ b/ios/chrome/browser/ui/first_run/welcome_to_chrome_view_controller.mm
@@ -17,7 +17,7 @@ #include "components/prefs/pref_service.h" #include "components/sync/driver/sync_service.h" #include "components/web_resource/web_resource_pref_names.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/first_run/first_run_configuration.h"
diff --git a/ios/chrome/browser/ui/icons/OWNERS b/ios/chrome/browser/ui/icons/OWNERS index f0962fcf..ac1d6d9 100644 --- a/ios/chrome/browser/ui/icons/OWNERS +++ b/ios/chrome/browser/ui/icons/OWNERS
@@ -1,2 +1,2 @@ -ewannpv@chromium.org -marq@chromium.org \ No newline at end of file +gambard@chromium.org +marq@chromium.org
diff --git a/ios/chrome/browser/ui/incognito_reauth/incognito_reauth_scene_agent.mm b/ios/chrome/browser/ui/incognito_reauth/incognito_reauth_scene_agent.mm index 0e6b45f..be579476 100644 --- a/ios/chrome/browser/ui/incognito_reauth/incognito_reauth_scene_agent.mm +++ b/ios/chrome/browser/ui/incognito_reauth/incognito_reauth_scene_agent.mm
@@ -13,7 +13,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/main/browser.h" #include "ios/chrome/browser/pref_names.h" #import "ios/chrome/browser/ui/incognito_reauth/incognito_reauth_util.h"
diff --git a/ios/chrome/browser/ui/main/browser_view_wrangler.mm b/ios/chrome/browser/ui/main/browser_view_wrangler.mm index f54035ca4..4e5104e 100644 --- a/ios/chrome/browser/ui/main/browser_view_wrangler.mm +++ b/ios/chrome/browser/ui/main/browser_view_wrangler.mm
@@ -9,7 +9,7 @@ #import "base/ios/ios_util.h" #include "base/strings/sys_string_conversions.h" #import "ios/chrome/app/application_delegate/app_state.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/crash_report/crash_report_helper.h" #import "ios/chrome/browser/device_sharing/device_sharing_browser_agent.h"
diff --git a/ios/chrome/browser/ui/main/scene_controller.mm b/ios/chrome/browser/ui/main/scene_controller.mm index 6d1d59b1..3d8161bd 100644 --- a/ios/chrome/browser/ui/main/scene_controller.mm +++ b/ios/chrome/browser/ui/main/scene_controller.mm
@@ -39,7 +39,7 @@ #import "ios/chrome/app/chrome_overlay_window.h" #import "ios/chrome/app/deferred_initialization_runner.h" #import "ios/chrome/app/tests_hook.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browsing_data/browsing_data_remove_mask.h" #include "ios/chrome/browser/browsing_data/browsing_data_remover.h"
diff --git a/ios/chrome/browser/ui/ntp/incognito_view.mm b/ios/chrome/browser/ui/ntp/incognito_view.mm index 9922e9a..4270c77f 100644 --- a/ios/chrome/browser/ui/ntp/incognito_view.mm +++ b/ios/chrome/browser/ui/ntp/incognito_view.mm
@@ -8,7 +8,7 @@ #include "components/content_settings/core/common/features.h" #include "components/google/core/common/google_util.h" #include "components/strings/grit/components_strings.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/drag_and_drop/url_drag_drop_handler.h" #import "ios/chrome/browser/ui/icons/chrome_symbol.h" #import "ios/chrome/browser/ui/ntp/new_tab_page_url_loader_delegate.h"
diff --git a/ios/chrome/browser/ui/ntp/metrics.mm b/ios/chrome/browser/ui/ntp/metrics.mm index ecf41e3..2fbacc6 100644 --- a/ios/chrome/browser/ui/ntp/metrics.mm +++ b/ios/chrome/browser/ui/ntp/metrics.mm
@@ -9,7 +9,7 @@ #include "components/ntp_tiles/metrics.h" #include "components/ntp_tiles/ntp_tile_impression.h" #include "components/ntp_tiles/tile_visual_type.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/ui/favicon/favicon_attributes_with_payload.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/ui/ntp/revamped_incognito_view.mm b/ios/chrome/browser/ui/ntp/revamped_incognito_view.mm index e72f7d22..9eb981d 100644 --- a/ios/chrome/browser/ui/ntp/revamped_incognito_view.mm +++ b/ios/chrome/browser/ui/ntp/revamped_incognito_view.mm
@@ -8,7 +8,7 @@ #include "components/content_settings/core/common/features.h" #include "components/google/core/common/google_util.h" #include "components/strings/grit/components_strings.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/drag_and_drop/url_drag_drop_handler.h" #import "ios/chrome/browser/ui/icons/chrome_symbol.h" #import "ios/chrome/browser/ui/ntp/new_tab_page_url_loader_delegate.h"
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_text_field_experimental.mm b/ios/chrome/browser/ui/omnibox/omnibox_text_field_experimental.mm index 7caa970..048af6ec 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_text_field_experimental.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_text_field_experimental.mm
@@ -15,7 +15,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/grit/components_scaled_resources.h" #include "components/omnibox/browser/autocomplete_input.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autocomplete/autocomplete_scheme_classifier_impl.h" #include "ios/chrome/browser/system_flags.h" #import "ios/chrome/browser/ui/omnibox/omnibox_util.h"
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm b/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm index a8b3b82..eee0367c 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_text_field_ios.mm
@@ -15,7 +15,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/grit/components_scaled_resources.h" #include "components/omnibox/browser/autocomplete_input.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autocomplete/autocomplete_scheme_classifier_impl.h" #include "ios/chrome/browser/system_flags.h" #import "ios/chrome/browser/ui/omnibox/omnibox_util.h"
diff --git a/ios/chrome/browser/ui/omnibox/omnibox_text_field_legacy.mm b/ios/chrome/browser/ui/omnibox/omnibox_text_field_legacy.mm index 8508b783..8205f97b 100644 --- a/ios/chrome/browser/ui/omnibox/omnibox_text_field_legacy.mm +++ b/ios/chrome/browser/ui/omnibox/omnibox_text_field_legacy.mm
@@ -15,7 +15,7 @@ #include "base/strings/sys_string_conversions.h" #include "components/grit/components_scaled_resources.h" #include "components/omnibox/browser/autocomplete_input.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autocomplete/autocomplete_scheme_classifier_impl.h" #include "ios/chrome/browser/system_flags.h" #import "ios/chrome/browser/ui/omnibox/omnibox_util.h"
diff --git a/ios/chrome/browser/ui/open_in/OWNERS b/ios/chrome/browser/ui/open_in/OWNERS index 6cadd6b..9fbce5a 100644 --- a/ios/chrome/browser/ui/open_in/OWNERS +++ b/ios/chrome/browser/ui/open_in/OWNERS
@@ -1,2 +1,2 @@ -ewannpv@chromium.org +alionadangla@chromium.org gambard@chromium.org
diff --git a/ios/chrome/browser/ui/page_info/OWNERS b/ios/chrome/browser/ui/page_info/OWNERS deleted file mode 100644 index 6cadd6b..0000000 --- a/ios/chrome/browser/ui/page_info/OWNERS +++ /dev/null
@@ -1,2 +0,0 @@ -ewannpv@chromium.org -gambard@chromium.org
diff --git a/ios/chrome/browser/ui/policy/signin_policy_scene_agent.mm b/ios/chrome/browser/ui/policy/signin_policy_scene_agent.mm index a99a3202..6f88da9c 100644 --- a/ios/chrome/browser/ui/policy/signin_policy_scene_agent.mm +++ b/ios/chrome/browser/ui/policy/signin_policy_scene_agent.mm
@@ -13,7 +13,7 @@ #import "components/signin/public/identity_manager/objc/identity_manager_observer_bridge.h" #import "ios/chrome/app/application_delegate/app_state.h" #import "ios/chrome/app/application_delegate/app_state_observer.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/policy/policy_util.h" #import "ios/chrome/browser/policy/policy_watcher_browser_agent.h" #import "ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.h"
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_coordinator.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_coordinator.mm index cd12f96..67942cd 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_coordinator.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_coordinator.mm
@@ -11,7 +11,7 @@ #import "base/metrics/user_metrics_action.h" #import "components/feature_engagement/public/event_constants.h" #import "components/feature_engagement/public/tracker.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/bookmarks/bookmark_model_factory.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/feature_engagement/tracker_factory.h"
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_mediator.mm b/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_mediator.mm index b7fb2d5f..d2fc7cd 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_mediator.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_mediator.mm
@@ -9,7 +9,7 @@ #include "components/autofill/core/browser/data_model/credit_card.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/common/autofill_payments_features.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/ui/autofill/autofill_ui_type.h" #import "ios/chrome/browser/ui/autofill/autofill_ui_type_util.h" #import "ios/chrome/browser/ui/settings/autofill/autofill_add_credit_card_mediator_delegate.h"
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.mm index 14dfe27..01f40ee 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_edit_table_view_controller.mm
@@ -16,7 +16,7 @@ #include "components/autofill/core/common/autofill_payments_features.h" #import "components/autofill/ios/browser/credit_card_util.h" #include "components/strings/grit/components_strings.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/ui/autofill/autofill_ui_type.h" #import "ios/chrome/browser/ui/autofill/autofill_ui_type_util.h" #import "ios/chrome/browser/ui/autofill/cells/autofill_edit_item.h"
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.mm index 242ec57..f418a44 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_credit_card_table_view_controller.mm
@@ -15,7 +15,7 @@ #import "components/password_manager/core/common/password_manager_features.h" #include "components/prefs/pref_service.h" #include "components/strings/grit/components_strings.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.mm index a78c966f..e8f393f 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller.mm
@@ -10,7 +10,7 @@ #include "components/autofill/core/browser/field_types.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/common/autofill_features.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/ui/autofill/autofill_ui_type.h" #import "ios/chrome/browser/ui/autofill/autofill_ui_type_util.h" #import "ios/chrome/browser/ui/autofill/cells/autofill_edit_item.h"
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller_unittest.mm index 6b46b89..6eba9e6 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_profile_edit_table_view_controller_unittest.mm
@@ -13,7 +13,7 @@ #include "components/autofill/core/browser/data_model/autofill_profile.h" #include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/common/autofill_features.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/ui/settings/personal_data_manager_finished_profile_tasks_waiter.h"
diff --git a/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.mm b/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.mm index 3b652136..fec14ec3 100644 --- a/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/autofill/autofill_profile_table_view_controller.mm
@@ -15,7 +15,7 @@ #include "components/password_manager/core/common/password_manager_features.h" #include "components/prefs/pref_service.h" #include "components/strings/grit/components_strings.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/net/crurl.h"
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm index 8427756..b227dfc 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager.mm
@@ -25,7 +25,7 @@ #include "components/signin/public/identity_manager/identity_manager.h" #include "components/strings/grit/components_strings.h" #include "components/sync/driver/sync_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browsing_data/browsing_data_counter_wrapper.h" #include "ios/chrome/browser/browsing_data/browsing_data_features.h"
diff --git a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager_unittest.mm b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager_unittest.mm index 2e0f61d7..9211c12 100644 --- a/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager_unittest.mm +++ b/ios/chrome/browser/ui/settings/clear_browsing_data/clear_browsing_data_manager_unittest.mm
@@ -16,7 +16,7 @@ #import "components/sync/driver/test_sync_service.h" #import "components/sync_preferences/pref_service_mock_factory.h" #import "components/sync_preferences/pref_service_syncable.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/browsing_data/browsing_data_features.h" #import "ios/chrome/browser/browsing_data/cache_counter.h"
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm index 2c51e68..e241c53 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_coordinator.mm
@@ -9,7 +9,7 @@ #import "components/signin/public/identity_manager/identity_manager.h" #import "components/strings/grit/components_strings.h" #include "components/sync/driver/sync_service_utils.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.mm b/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.mm index bd5b4a5..a32cc8b 100644 --- a/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.mm +++ b/ios/chrome/browser/ui/settings/google_services/google_services_settings_mediator.mm
@@ -16,7 +16,7 @@ #include "components/signin/public/base/signin_pref_names.h" #include "components/sync/driver/sync_service.h" #include "components/unified_consent/pref_names.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/commerce/price_alert_util.h" #import "ios/chrome/browser/policy/policy_util.h" #include "ios/chrome/browser/pref_names.h"
diff --git a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm index bd31f12..c10ca8a 100644 --- a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm
@@ -11,7 +11,7 @@ #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service_utils.h" #include "components/sync/driver/sync_user_settings.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/ui/settings/language/language_settings_mediator.mm b/ios/chrome/browser/ui/settings/language/language_settings_mediator.mm index 959eb59..246a11c 100644 --- a/ios/chrome/browser/ui/settings/language/language_settings_mediator.mm +++ b/ios/chrome/browser/ui/settings/language/language_settings_mediator.mm
@@ -19,7 +19,7 @@ #include "components/prefs/pref_service.h" #include "components/translate/core/browser/translate_pref_names.h" #include "components/translate/core/browser/translate_prefs.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/language/language_model_manager_factory.h" #include "ios/chrome/browser/translate/chrome_ios_translate_client.h"
diff --git a/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm index 4d14f9d..ef8846e 100644 --- a/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/language/language_settings_table_view_controller.mm
@@ -13,7 +13,7 @@ #include "components/password_manager/core/common/password_manager_features.h" #include "components/prefs/pref_service.h" #include "components/translate/core/browser/translate_pref_names.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/net/crurl.h" #import "ios/chrome/browser/ui/list_model/list_item+Controller.h" #import "ios/chrome/browser/ui/settings/cells/settings_cells_constants.h"
diff --git a/ios/chrome/browser/ui/settings/password/password_manager_view_controller.mm b/ios/chrome/browser/ui/settings/password/password_manager_view_controller.mm index 34ce5938..2154ff4 100644 --- a/ios/chrome/browser/ui/settings/password/password_manager_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password/password_manager_view_controller.mm
@@ -26,7 +26,7 @@ #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service_utils.h" #include "components/sync/driver/sync_user_settings.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/ui/settings/privacy/privacy_safe_browsing_mediator.mm b/ios/chrome/browser/ui/settings/privacy/privacy_safe_browsing_mediator.mm index e7f7411..d5167c1b 100644 --- a/ios/chrome/browser/ui/settings/privacy/privacy_safe_browsing_mediator.mm +++ b/ios/chrome/browser/ui/settings/privacy/privacy_safe_browsing_mediator.mm
@@ -11,7 +11,7 @@ #include "base/notreached.h" #include "components/prefs/pref_service.h" #include "components/safe_browsing/core/common/safe_browsing_prefs.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/policy/policy_util.h" #include "ios/chrome/browser/pref_names.h" #import "ios/chrome/browser/ui/icons/chrome_symbol.h"
diff --git a/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller.mm b/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller.mm index 83d5104..0262a5c 100644 --- a/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller.mm
@@ -20,7 +20,7 @@ #include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/strings/grit/components_strings.h" #include "components/sync/driver/sync_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browsing_data/browsing_data_features.h" #import "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller_unittest.mm index 6507930..319236db 100644 --- a/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/privacy/privacy_table_view_controller_unittest.mm
@@ -20,7 +20,7 @@ #include "components/sync_preferences/pref_service_mock_factory.h" #include "components/sync_preferences/pref_service_syncable.h" #import "components/sync_preferences/testing_pref_service_syncable.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/main/test_browser.h" #import "ios/chrome/browser/policy/policy_util.h"
diff --git a/ios/chrome/browser/ui/settings/privacy/safe_browsing/BUILD.gn b/ios/chrome/browser/ui/settings/privacy/safe_browsing/BUILD.gn index 5d7a451..6ffc973a 100644 --- a/ios/chrome/browser/ui/settings/privacy/safe_browsing/BUILD.gn +++ b/ios/chrome/browser/ui/settings/privacy/safe_browsing/BUILD.gn
@@ -34,7 +34,7 @@ "//components/signin/public/identity_manager/objc", "//components/strings:components_strings_grit", "//ios/chrome/app/strings", - "//ios/chrome/browser:application_context", + "//ios/chrome/browser/application_context", "//ios/chrome/browser/browser_state", "//ios/chrome/browser/main:public", "//ios/chrome/browser/net:crurl",
diff --git a/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm b/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm index 1b2c02e..8aa21a9 100644 --- a/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm +++ b/ios/chrome/browser/ui/settings/safety_check/safety_check_coordinator.mm
@@ -11,7 +11,7 @@ #include "base/metrics/user_metrics.h" #include "base/strings/sys_string_conversions.h" #include "components/safe_browsing/core/common/features.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/main/browser.h" #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager.h"
diff --git a/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator.mm b/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator.mm index 9b83f682..149d1d7 100644 --- a/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator.mm +++ b/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator.mm
@@ -21,7 +21,7 @@ #include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/safety_check/safety_check.h" #include "components/version_info/version_info.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/omaha/omaha_service.h" #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager.h" #include "ios/chrome/browser/passwords/ios_chrome_password_check_manager_factory.h"
diff --git a/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator_unittest.mm b/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator_unittest.mm index b22b20dd..4d92eaf 100644 --- a/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator_unittest.mm +++ b/ios/chrome/browser/ui/settings/safety_check/safety_check_mediator_unittest.mm
@@ -22,7 +22,7 @@ #include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/strings/grit/components_strings.h" #include "components/sync_preferences/pref_service_mock_factory.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/main/test_browser.h"
diff --git a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm index b7ae484..377e158f 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm
@@ -29,7 +29,7 @@ #import "components/signin/public/identity_manager/objc/identity_manager_observer_bridge.h" #include "components/strings/grit/components_strings.h" #include "components/sync/driver/sync_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/main/browser.h" #include "ios/chrome/browser/net/crurl.h"
diff --git a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm index bb98442..00a2ffe 100644 --- a/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync/sync_encryption_passphrase_table_view_controller.mm
@@ -17,7 +17,7 @@ #include "components/strings/grit/components_strings.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_user_settings.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm b/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm index 15910fe..50f1368 100644 --- a/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/sync/sync_encryption_table_view_controller.mm
@@ -16,7 +16,7 @@ #include "components/sync/base/sync_prefs.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_user_settings.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/ui/settings/translate_table_view_controller.mm b/ios/chrome/browser/ui/settings/translate_table_view_controller.mm index 7f1bc25..1869b91 100644 --- a/ios/chrome/browser/ui/settings/translate_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/translate_table_view_controller.mm
@@ -16,7 +16,7 @@ #include "components/prefs/pref_service.h" #include "components/translate/core/browser/translate_pref_names.h" #include "components/translate/core/browser/translate_prefs.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/net/crurl.h" #import "ios/chrome/browser/translate/chrome_ios_translate_client.h" #import "ios/chrome/browser/ui/commands/browser_commands.h"
diff --git a/ios/chrome/browser/ui/util/terms_util.mm b/ios/chrome/browser/ui/util/terms_util.mm index 2de7757..6bee605 100644 --- a/ios/chrome/browser/ui/util/terms_util.mm +++ b/ios/chrome/browser/ui/util/terms_util.mm
@@ -7,7 +7,7 @@ #include "base/mac/bundle_locations.h" #include "base/mac/foundation_util.h" #include "base/strings/sys_string_conversions.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/grit/ios_strings.h" #import "ui/base/l10n/l10n_util.h"
diff --git a/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm b/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm index 18b78ef..f8528d0 100644 --- a/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm +++ b/ios/chrome/browser/ui/webui/autofill_and_password_manager_internals/internals_ui_handler.mm
@@ -9,7 +9,7 @@ #include "components/version_info/version_info.h" #include "components/version_ui/version_handler_helper.h" #include "components/version_ui/version_ui_constants.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/common/channel_info.h" #import "ios/web/public/web_client.h"
diff --git a/ios/chrome/browser/ui/webui/flags_ui.mm b/ios/chrome/browser/ui/webui/flags_ui.mm index 6fc2754..6d3f1d71 100644 --- a/ios/chrome/browser/ui/webui/flags_ui.mm +++ b/ios/chrome/browser/ui/webui/flags_ui.mm
@@ -23,7 +23,7 @@ #include "components/strings/grit/components_chromium_strings.h" #include "components/strings/grit/components_strings.h" #include "components/version_info/version_info.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/browser/flags/about_flags.h"
diff --git a/ios/chrome/browser/ui/webui/interstitials/interstitial_ui_util.mm b/ios/chrome/browser/ui/webui/interstitials/interstitial_ui_util.mm index bb686a3..f226b717 100644 --- a/ios/chrome/browser/ui/webui/interstitials/interstitial_ui_util.mm +++ b/ios/chrome/browser/ui/webui/interstitials/interstitial_ui_util.mm
@@ -14,7 +14,7 @@ #include "components/security_interstitials/core/ssl_error_options_mask.h" #include "components/security_interstitials/core/unsafe_resource.h" #include "crypto/rsa_private_key.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/safe_browsing/safe_browsing_blocking_page.h"
diff --git a/ios/chrome/browser/ui/webui/local_state/local_state_ui.mm b/ios/chrome/browser/ui/webui/local_state/local_state_ui.mm index 256abb0..a9e4bc4 100644 --- a/ios/chrome/browser/ui/webui/local_state/local_state_ui.mm +++ b/ios/chrome/browser/ui/webui/local_state/local_state_ui.mm
@@ -11,7 +11,7 @@ #include "components/grit/dev_ui_components_resources.h" #include "components/local_state/local_state_utils.h" #include "components/prefs/pref_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #include "ios/web/public/webui/web_ui_ios.h"
diff --git a/ios/chrome/browser/ui/webui/management/management_ui.mm b/ios/chrome/browser/ui/webui/management/management_ui.mm index 9d24b25..f9448697 100644 --- a/ios/chrome/browser/ui/webui/management/management_ui.mm +++ b/ios/chrome/browser/ui/webui/management/management_ui.mm
@@ -14,7 +14,7 @@ #import "components/policy/proto/device_management_backend.pb.h" #import "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/policy/browser_policy_connector_ios.h"
diff --git a/ios/chrome/browser/ui/webui/net_export/net_export_ui.mm b/ios/chrome/browser/ui/webui/net_export/net_export_ui.mm index 5eff356..d073ff20 100644 --- a/ios/chrome/browser/ui/webui/net_export/net_export_ui.mm +++ b/ios/chrome/browser/ui/webui/net_export/net_export_ui.mm
@@ -16,7 +16,7 @@ #include "components/grit/dev_ui_components_resources.h" #include "components/net_log/net_export_file_writer.h" #include "components/net_log/net_export_ui_constants.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #import "ios/chrome/browser/webui/net_export_tab_helper.h"
diff --git a/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm b/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm index 685613b..9b3a2b1 100644 --- a/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm +++ b/ios/chrome/browser/ui/webui/policy/policy_ui_handler.mm
@@ -30,7 +30,7 @@ #import "components/prefs/pref_service.h" #import "components/strings/grit/components_strings.h" #import "components/version_info/version_info.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/policy/browser_policy_connector_ios.h" #import "ios/chrome/browser/policy/browser_state_policy_connector.h"
diff --git a/ios/chrome/browser/ui/webui/translate_internals/ios_translate_internals_handler.mm b/ios/chrome/browser/ui/webui/translate_internals/ios_translate_internals_handler.mm index 2d52368b..b107af10 100644 --- a/ios/chrome/browser/ui/webui/translate_internals/ios_translate_internals_handler.mm +++ b/ios/chrome/browser/ui/webui/translate_internals/ios_translate_internals_handler.mm
@@ -5,7 +5,7 @@ #import "ios/chrome/browser/ui/webui/translate_internals/ios_translate_internals_handler.h" #include "components/translate/core/common/language_detection_details.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/main/all_web_state_list_observation_registrar.h" #import "ios/chrome/browser/main/browser.h"
diff --git a/ios/chrome/browser/ui/webui/ukm_internals_ui.mm b/ios/chrome/browser/ui/webui/ukm_internals_ui.mm index 8339bef..4bce2f8 100644 --- a/ios/chrome/browser/ui/webui/ukm_internals_ui.mm +++ b/ios/chrome/browser/ui/webui/ukm_internals_ui.mm
@@ -9,7 +9,7 @@ #include "components/metrics_services_manager/metrics_services_manager.h" #include "components/ukm/debug/ukm_debug_data_extractor.h" #include "components/ukm/ukm_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" #include "ios/chrome/grit/ios_resources.h"
diff --git a/ios/chrome/browser/unified_consent/unified_consent_service_factory.mm b/ios/chrome/browser/unified_consent/unified_consent_service_factory.mm index 4d24888..00c195a 100644 --- a/ios/chrome/browser/unified_consent/unified_consent_service_factory.mm +++ b/ios/chrome/browser/unified_consent/unified_consent_service_factory.mm
@@ -13,7 +13,7 @@ #include "components/sync_preferences/pref_service_syncable.h" #include "components/unified_consent/unified_consent_metrics.h" #include "components/unified_consent/unified_consent_service.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/pref_names.h" #include "ios/chrome/browser/signin/identity_manager_factory.h"
diff --git a/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.mm b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.mm index c33778e..0f653aee 100644 --- a/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.mm +++ b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.mm
@@ -7,7 +7,7 @@ #include "base/no_destructor.h" #include "base/strings/stringprintf.h" #include "components/version_info/version_info.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/common/channel_info.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/variations/ios_chrome_variations_service_client.mm b/ios/chrome/browser/variations/ios_chrome_variations_service_client.mm index afa4ba0..789acc9b 100644 --- a/ios/chrome/browser/variations/ios_chrome_variations_service_client.mm +++ b/ios/chrome/browser/variations/ios_chrome_variations_service_client.mm
@@ -6,7 +6,7 @@ #include "base/version.h" #include "components/version_info/version_info.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/common/channel_info.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
diff --git a/ios/chrome/browser/variations/variations_app_interface.mm b/ios/chrome/browser/variations/variations_app_interface.mm index c5283bb..6497cc5 100644 --- a/ios/chrome/browser/variations/variations_app_interface.mm +++ b/ios/chrome/browser/variations/variations_app_interface.mm
@@ -10,7 +10,7 @@ #include "components/prefs/pref_service.h" #include "components/variations/pref_names.h" #include "components/variations/variations_test_utils.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/test/app/chrome_test_util.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/web/chrome_web_client.mm b/ios/chrome/browser/web/chrome_web_client.mm index d750f31..4143e0a 100644 --- a/ios/chrome/browser/web/chrome_web_client.mm +++ b/ios/chrome/browser/web/chrome_web_client.mm
@@ -24,7 +24,7 @@ #import "components/password_manager/ios/password_manager_java_script_feature.h" #import "components/strings/grit/components_strings.h" #import "components/version_info/version_info.h" -#import "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/chrome/browser/browser_about_rewriter.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" #import "ios/chrome/browser/chrome_switches.h"
diff --git a/ios/chrome/browser/web/error_page_util.mm b/ios/chrome/browser/web/error_page_util.mm index a7a95d5..a908c1b 100644 --- a/ios/chrome/browser/web/error_page_util.mm +++ b/ios/chrome/browser/web/error_page_util.mm
@@ -14,7 +14,7 @@ #include "components/error_page/common/error.h" #include "components/error_page/common/localized_error.h" #include "components/grit/components_resources.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #import "ios/net/protocol_handler_util.h" #include "net/base/net_errors.h" #include "ui/base/resource/resource_bundle.h"
diff --git a/ios/chrome/browser/web/font_size/font_size_tab_helper.mm b/ios/chrome/browser/web/font_size/font_size_tab_helper.mm index a22c22ad..2704e82c 100644 --- a/ios/chrome/browser/web/font_size/font_size_tab_helper.mm +++ b/ios/chrome/browser/web/font_size/font_size_tab_helper.mm
@@ -17,7 +17,7 @@ #include "components/prefs/pref_service.h" #include "components/prefs/scoped_user_pref_update.h" #include "components/ukm/ios/ukm_url_recorder.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/pref_names.h" #include "ios/chrome/browser/web/features.h"
diff --git a/ios/chrome/browser/webdata_services/web_data_service_factory.mm b/ios/chrome/browser/webdata_services/web_data_service_factory.mm index 4af18e9..d02c9c2 100644 --- a/ios/chrome/browser/webdata_services/web_data_service_factory.mm +++ b/ios/chrome/browser/webdata_services/web_data_service_factory.mm
@@ -15,7 +15,7 @@ #include "components/search_engines/keyword_web_data_service.h" #include "components/signin/public/webdata/token_web_data.h" #include "components/webdata_services/web_data_service_wrapper.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/browser_state_otr_helper.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/web/public/thread/web_task_traits.h"
diff --git a/ios/chrome/test/app/chrome_test_util.mm b/ios/chrome/test/app/chrome_test_util.mm index 75456a8..ee45027 100644 --- a/ios/chrome/test/app/chrome_test_util.mm +++ b/ios/chrome/test/app/chrome_test_util.mm
@@ -19,7 +19,7 @@ #import "ios/chrome/app/main_application_delegate_testing.h" #import "ios/chrome/app/main_controller.h" #import "ios/chrome/app/main_controller_private.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/browser/infobars/infobar_manager_impl.h"
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm index 658939f..44b992e 100644 --- a/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm +++ b/ios/chrome/test/earl_grey/chrome_earl_grey_app_interface.mm
@@ -26,7 +26,7 @@ #include "components/variations/variations_associated_data.h" #include "components/variations/variations_ids_provider.h" #import "ios/chrome/app/main_controller.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/autofill/personal_data_manager_factory.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/content_settings/host_content_settings_map_factory.h"
diff --git a/ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager.mm b/ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager.mm index 8db803a..2434db32 100644 --- a/ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager.mm +++ b/ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager.mm
@@ -4,7 +4,7 @@ #include "ios/chrome/test/ios_chrome_scoped_testing_chrome_browser_state_manager.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #include "ios/chrome/browser/browser_state/chrome_browser_state_manager.h" #include "ios/chrome/test/testing_application_context.h"
diff --git a/ios/chrome/test/testing_application_context.h b/ios/chrome/test/testing_application_context.h index d0617db..fbdd15b6 100644 --- a/ios/chrome/test/testing_application_context.h +++ b/ios/chrome/test/testing_application_context.h
@@ -9,7 +9,7 @@ #include <string> #include "base/threading/thread_checker.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" namespace network { class TestNetworkConnectionTracker;
diff --git a/ios/chrome/test/variations_smoke_test/variations_smoke_test_app_interface.mm b/ios/chrome/test/variations_smoke_test/variations_smoke_test_app_interface.mm index bdbddf6..1263a97 100644 --- a/ios/chrome/test/variations_smoke_test/variations_smoke_test_app_interface.mm +++ b/ios/chrome/test/variations_smoke_test/variations_smoke_test_app_interface.mm
@@ -10,7 +10,7 @@ #include "base/time/time.h" #include "components/prefs/pref_service.h" #include "components/variations/pref_names.h" -#include "ios/chrome/browser/application_context.h" +#import "ios/chrome/browser/application_context/application_context.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support."
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index 7408d5f..8c41db2 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -054d71e2e59aab124e855cb42d00e15c16280038 \ No newline at end of file +bb7d940a9f16cb33fda60914080377fb11085242 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 index 5633e00..ba1ff02 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -fc14d74be86753f808721a285677b3b3e554008c \ No newline at end of file +c641eaf5c32f2e7fc58c60d6da4c7af979ee4bca \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 index 7a7d56f..10d8f94 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -a82190a2eff8cdd423ad962b8a84d714bbda96fa \ No newline at end of file +0adbef9954b5b97341835c405f78ee3805e99d02 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 index 1f07ec3..de05205 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -2c8d156a4e0c4e8a9fa6072537add16f8df02e91 \ No newline at end of file +4d7d8c74f11597ee3a594d24a57fcb3c35015cf1 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 index 387a986..a8e830d 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -5a14fb0d9807b421ba16ce80991ea3f3bac7e7a5 \ No newline at end of file +af4787dedcf75002a9c6464a5aebcc46caa612d7 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 index 702191e0..8e882c78 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -dd4ff095fb406dabe9d832b2a38afbd15722768a \ No newline at end of file +59d7caa8fd003d0785faee7462af5c1c8cc5c539 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 index 3cb5818d..f8b9b1d 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -c07a6103eff309d8c3a0ebab4b420e46bbb0f07f \ No newline at end of file +b3aa412a5a355f2ba81397cd695bfac7dea170c7 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 index a25c087..7b678e9 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -69c2e47d892885ae485e8d1cd48d0689d83396f0 \ No newline at end of file +996915948f5561931829716507cc7b887a3e617e \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 index e6ec28f7..5356040 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -ffe65c8bf1ee9010afd61dd2ab158abb3990e8c5 \ No newline at end of file +3f309a3c81b0849ad40fdde61f6c65a31df49aee \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 index ae864a5..b709986 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -768c0b50e5f20da22811111d1a80e10c5998e860 \ No newline at end of file +970691d5c442ce56b45947fc0b2c4da97e285270 \ No newline at end of file
diff --git a/net/docs/bug-triage.md b/net/docs/bug-triage.md index 1db4d62..69f8d9c 100644 --- a/net/docs/bug-triage.md +++ b/net/docs/bug-triage.md
@@ -8,7 +8,7 @@ ## 1. Review untriaged bugs Look through [this list of untriaged -bugs](https://bugs.chromium.org/p/chromium/issues/list?sort=pri%20-stars%20-opened&q=status%3Aunconfirmed%2Cuntriaged%20-Needs%3DFeedback%20-Label%3ANetwork-Triaged%20-has%3ANextAction%20component%3DInternals%3ENetwork%2CInternals%3ENetwork%3ECache%2CInternals%3ENetwork%3ESSL%2CInternals%3ENetwork%3EQUIC%2CInternals%3ENetwork%3EAuth%2CInternals%3ENetwork%3EHTTP2%2CInternals%3ENetwork%3EProxy%2CInternals%3ENetwork%3ELibrary%2CInternals%3ENetwork%3ELogging%2CInternals%3ENetwork%3EConnectivity%2CInternals%3ENetwork%3EDomainSecurityPolicy%2CInternals%3ENetwork%3EFTP%2CInternals%3ENetwork%3EDNS). +bugs](https://bugs.chromium.org/p/chromium/issues/list?sort=pri%20-stars%20-opened&q=status%3Aunconfirmed%2Cuntriaged%20-Needs%3DFeedback%20-Label%3ANetwork-Triaged%20-has%3ANextAction%20component%3DInternals%3ENetwork%3EReportingAndNEL%2CInternals%3ENetwork%3ECache%3ESimple%2CInternals%3ENetwork%2CInternals%3ENetwork%3ECache%2CInternals%3ENetwork%3ESSL%2CInternals%3ENetwork%3EQUIC%2CInternals%3ENetwork%3EAuth%2CInternals%3ENetwork%3EHTTP2%2CInternals%3ENetwork%3EProxy%2CInternals%3ENetwork%3ELibrary%2CInternals%3ENetwork%3ELogging%2CInternals%3ENetwork%3EConnectivity%2CInternals%3ENetwork%3EDomainSecurityPolicy%2CInternals%3ENetwork%3EFTP%2CInternals%3ENetwork%3EDNS). The goal is for this query to be empty. Bugs can be removed from the triage queue by doing any of the following: @@ -72,7 +72,7 @@ ## 2. Follow-up on issues with the Needs-Feedback label Look through [this list of Needs=Feedback -bugs](https://bugs.chromium.org/p/chromium/issues/list?sort=-modified%20-modified&q=Needs%3DFeedback%20component%3DInternals%3ENetwork%2CInternals%3ENetwork%3ECache%2CInternals%3ENetwork%3ESSL%2CInternals%3ENetwork%3EQUIC%2CInternals%3ENetwork%3EAuth%2CInternals%3ENetwork%3EHTTP2%2CInternals%3ENetwork%3EProxy%2CInternals%3ENetwork%3ELibrary%2CInternals%3ENetwork%3ELogging%2CInternals%3ENetwork%3EConnectivity%2CInternals%3ENetwork%3EDomainSecurityPolicy%2CInternals%3ENetwork%3EFTP%2CInternals%3ENetwork%3EDNS). +bugs](https://bugs.chromium.org/p/chromium/issues/list?sort=-modified%20-modified&q=Needs%3DFeedback%20component%3DInternals%3ENetwork%3EReportingAndNEL%2CInternals%3ENetwork%3ECache%3ESimple%2CInternals%3ENetwork%2CInternals%3ENetwork%3ECache%2CInternals%3ENetwork%3ESSL%2CInternals%3ENetwork%3EQUIC%2CInternals%3ENetwork%3EAuth%2CInternals%3ENetwork%3EHTTP2%2CInternals%3ENetwork%3EProxy%2CInternals%3ENetwork%3ELibrary%2CInternals%3ENetwork%3ELogging%2CInternals%3ENetwork%3EConnectivity%2CInternals%3ENetwork%3EDomainSecurityPolicy%2CInternals%3ENetwork%3EFTP%2CInternals%3ENetwork%3EDNS). * If the requested feedback was provided, review the new information and repeat the same steps as (1) to re-triage based on the new information. @@ -82,7 +82,7 @@ ## 3. Ensure P0 and P1 bugs have an owner Look through [the list of unowned high priority -bugs](https://bugs.chromium.org/p/chromium/issues/list?sort=pri%20-stars%20-opened&q=Pri%3A0%2C1%20-has%3Aowner%20-label%3ANetwork-Triaged%20component%3DInternals%3ENetwork%2CInternals%3ENetwork%3ECache%2CInternals%3ENetwork%3ESSL%2CInternals%3ENetwork%3EQUIC%2CInternals%3ENetwork%3EAuth%2CInternals%3ENetwork%3EHTTP2%2CInternals%3ENetwork%3EProxy%2CInternals%3ENetwork%3ELibrary%2CInternals%3ENetwork%3ELogging%2CInternals%3ENetwork%3EConnectivity%2CInternals%3ENetwork%3EDomainSecurityPolicy%2CInternals%3ENetwork%3EFTP%2CInternals%3ENetwork%3EDNS). +bugs](https://bugs.chromium.org/p/chromium/issues/list?sort=pri%20-stars%20-opened&q=Pri%3A0%2C1%20-has%3Aowner%20-label%3ANetwork-Triaged%20component%3DInternals%3ENetwork%3EReportingAndNEL%2CInternals%3ENetwork%3ECache%3ESimple%2CInternals%3ENetwork%2CInternals%3ENetwork%3ECache%2CInternals%3ENetwork%3ESSL%2CInternals%3ENetwork%3EQUIC%2CInternals%3ENetwork%3EAuth%2CInternals%3ENetwork%3EHTTP2%2CInternals%3ENetwork%3EProxy%2CInternals%3ENetwork%3ELibrary%2CInternals%3ENetwork%3ELogging%2CInternals%3ENetwork%3EConnectivity%2CInternals%3ENetwork%3EDomainSecurityPolicy%2CInternals%3ENetwork%3EFTP%2CInternals%3ENetwork%3EDNS). These bugs should either have an owner, or be downgraded to a lower priority. ## 4. (Optional) Look through crash reports @@ -109,6 +109,7 @@ Internals>Network Internals>Network>Auth Internals>Network>Cache +Internals>Network>Cache>Simple Internals>Network>DNS Internals>Network>Connectivity Internals>Network>DomainSecurityPolicy @@ -118,6 +119,7 @@ Internals>Network>Logging Internals>Network>Proxy Internals>Network>QUIC +Internals>Network>ReportingAndNEL Internals>Network>SSL ``` @@ -134,7 +136,6 @@ Internals>Network>EV Internals>Network>NetInfo Internals>Network>NetworkQuality -Internals>Network>ReportingAndNEL Internals>Network>TrustTokens Internals>Network>VPN ``` @@ -155,7 +156,11 @@ Dashboard](https://chromiumdash.appspot.com/components/Internals/Network?project=Chromium) * There is also an [internal dashboard with bug trends for Web - Platform](https://goto.google.com/vufyq) that includes network issues. + Platform](https://goto.google.com/blink-untriaged-by-team) that includes network issues. + +* And another [internal dashboard breaking down the bug trends for the + networking stack by components] + (https://goto.google.com/chrome-network-untriaged-by-component) * The issue tracker doesn't track any official mappings between components and OWNERS. This [internal document](https://goto.google.com/kojfj) enumerates
diff --git a/net/reporting/reporting_service_unittest.cc b/net/reporting/reporting_service_unittest.cc index 4307df3..d7b1c81f 100644 --- a/net/reporting/reporting_service_unittest.cc +++ b/net/reporting/reporting_service_unittest.cc
@@ -281,7 +281,16 @@ context()->cache()->GetExpiredSources().contains(*kReportingSource_)); } -TEST_P(ReportingServiceTest, SendReportsAndRemoveSourceWithPendingReports) { +// Flaky in ChromeOS: crbug.com/1356127 +#if BUILDFLAG(IS_CHROMEOS) +#define MAYBE_SendReportsAndRemoveSourceWithPendingReports \ + DISABLED_SendReportsAndRemoveSourceWithPendingReports +#else +#define MAYBE_SendReportsAndRemoveSourceWithPendingReports \ + SendReportsAndRemoveSourceWithPendingReports +#endif +TEST_P(ReportingServiceTest, + MAYBE_SendReportsAndRemoveSourceWithPendingReports) { base::test::ScopedFeatureList feature_list; feature_list.InitAndEnableFeature(net::features::kDocumentReporting); auto parsed_header =
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc index 0f84d0d..65ab1b1 100644 --- a/remoting/host/client_session.cc +++ b/remoting/host/client_session.cc
@@ -742,8 +742,11 @@ void ClientSession::OnLocalKeyPressed(uint32_t usb_keycode) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); bool is_local = remote_input_filter_.LocalKeyPressed(usb_keycode); - if (is_local && desktop_environment_options_.terminate_upon_input()) + if (is_local && desktop_environment_options_.terminate_upon_input()) { + LOG(WARNING) + << "Disconnecting CRD session because local input was detected."; DisconnectSession(protocol::OK); + } } void ClientSession::OnLocalPointerMoved(const webrtc::DesktopVector& position, @@ -751,10 +754,13 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); bool is_local = remote_input_filter_.LocalPointerMoved(position, type); if (is_local) { - if (desktop_environment_options_.terminate_upon_input()) + if (desktop_environment_options_.terminate_upon_input()) { + LOG(WARNING) + << "Disconnecting CRD session because local input was detected."; DisconnectSession(protocol::OK); - else + } else { desktop_and_cursor_composer_notifier_.OnLocalInput(); + } } }
diff --git a/services/network/public/cpp/simple_url_loader.cc b/services/network/public/cpp/simple_url_loader.cc index 2068b9da..6911946 100644 --- a/services/network/public/cpp/simple_url_loader.cc +++ b/services/network/public/cpp/simple_url_loader.cc
@@ -243,11 +243,16 @@ void SetAllowHttpErrorResults(bool allow_http_error_results) override; void AttachStringForUpload(const std::string& upload_data, const std::string& upload_content_type) override; + void AttachStringForUpload(const std::string& upload_data) override; void AttachFileForUpload( const base::FilePath& upload_file_path, const std::string& upload_content_type, uint64_t offset = 0, uint64_t length = std::numeric_limits<uint64_t>::max()) override; + void AttachFileForUpload( + const base::FilePath& upload_file_path, + uint64_t offset = 0, + uint64_t length = std::numeric_limits<uint64_t>::max()) override; void SetRetryOptions(int max_retries, int retry_mode) override; void SetURLLoaderFactoryOptions(uint32_t options) override; void SetRequestID(int32_t request_id) override; @@ -314,6 +319,14 @@ absl::optional<URLLoaderCompletionStatus> completion_status; }; + void AttachStringForUpload(const std::string& upload_data, + const std::string* const upload_content_type); + void AttachFileForUpload( + const base::FilePath& upload_file_path, + const std::string* const upload_content_type, + uint64_t offset = 0, + uint64_t length = std::numeric_limits<uint64_t>::max()); + // Prepares internal state to start a request, and then calls StartRequest(). // Only used for the initial request (Not retries). void Start(mojom::URLLoaderFactory* url_loader_factory); @@ -1362,7 +1375,7 @@ void SimpleURLLoaderImpl::AttachStringForUpload( const std::string& upload_data, - const std::string& upload_content_type) { + const std::string* const upload_content_type) { // Currently only allow a single string to be attached. DCHECK(!resource_request_->request_body); DCHECK(resource_request_->method != net::HttpRequestHeaders::kGetMethod && @@ -1383,13 +1396,26 @@ created_from_); } - resource_request_->headers.SetHeader(net::HttpRequestHeaders::kContentType, - upload_content_type); + if (upload_content_type) { + resource_request_->headers.SetHeader(net::HttpRequestHeaders::kContentType, + *upload_content_type); + } +} + +void SimpleURLLoaderImpl::AttachStringForUpload( + const std::string& upload_data, + const std::string& upload_content_type) { + AttachStringForUpload(upload_data, &upload_content_type); +} + +void SimpleURLLoaderImpl::AttachStringForUpload( + const std::string& upload_data) { + AttachStringForUpload(upload_data, nullptr); } void SimpleURLLoaderImpl::AttachFileForUpload( const base::FilePath& upload_file_path, - const std::string& upload_content_type, + const std::string* const upload_content_type, uint64_t offset, uint64_t length) { DCHECK(!upload_file_path.empty()); @@ -1407,8 +1433,25 @@ resource_request_->request_body->AppendFileRange(upload_file_path, offset, length, base::Time()); - resource_request_->headers.SetHeader(net::HttpRequestHeaders::kContentType, - upload_content_type); + if (upload_content_type) { + resource_request_->headers.SetHeader(net::HttpRequestHeaders::kContentType, + *upload_content_type); + } +} + +void SimpleURLLoaderImpl::AttachFileForUpload( + const base::FilePath& upload_file_path, + const std::string& upload_content_type, + uint64_t offset, + uint64_t length) { + AttachFileForUpload(upload_file_path, &upload_content_type, offset, length); +} + +void SimpleURLLoaderImpl::AttachFileForUpload( + const base::FilePath& upload_file_path, + uint64_t offset, + uint64_t length) { + AttachFileForUpload(upload_file_path, nullptr, offset, length); } void SimpleURLLoaderImpl::SetRetryOptions(int max_retries, int retry_mode) {
diff --git a/services/network/public/cpp/simple_url_loader.h b/services/network/public/cpp/simple_url_loader.h index 9ab9afb..82103428 100644 --- a/services/network/public/cpp/simple_url_loader.h +++ b/services/network/public/cpp/simple_url_loader.h
@@ -296,6 +296,7 @@ virtual void AttachStringForUpload( const std::string& upload_data, const std::string& upload_content_type) = 0; + virtual void AttachStringForUpload(const std::string& upload_data) = 0; // Helper method to attach a file for upload, so the consumer won't need to // open the file itself off-thread. May only be called once, and only if the @@ -311,6 +312,13 @@ const std::string& upload_content_type, uint64_t offset = 0, uint64_t length = std::numeric_limits<uint64_t>::max()) = 0; + virtual void AttachFileForUpload(const base::FilePath& upload_file_path, + uint64_t offset, + uint64_t length) = 0; + void AttachFileForUpload(const base::FilePath& upload_file_path) { + AttachFileForUpload(upload_file_path, 0, + std::numeric_limits<uint64_t>::max()); + } // Sets the when to try and the max number of times to retry a request, if // any. |max_retries| is the number of times to retry the request, not
diff --git a/testing/buildbot/filters/linux-chromeos.browser_tests.require_lacros.filter b/testing/buildbot/filters/linux-chromeos.browser_tests.require_lacros.filter index 6f2f5e9e..e479e88 100644 --- a/testing/buildbot/filters/linux-chromeos.browser_tests.require_lacros.filter +++ b/testing/buildbot/filters/linux-chromeos.browser_tests.require_lacros.filter
@@ -47,3 +47,5 @@ -ChromeVoxUserActionMonitorTest.Gestures # TODO(crbug.com/1339456) Disabled when switch to LacrosOnly. -DesksTemplatesClientLacrosTest.SystemUILaunchBrowser +# TODO(crbug.com/1356103) Disabled when switch to LacrosOnly. +-SwitchAccessPointScanManagerTest.PointScanRightClick
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 2ff9f79..41b5c1e8 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -11200,6 +11200,21 @@ ] } ], + "WebViewThrottleBackgroundBeginFrame": [ + { + "platforms": [ + "android_webview" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "WebViewThrottleBackgroundBeginFrame" + ] + } + ] + } + ], "WebViewUseMetricsUploadService": [ { "platforms": [
diff --git a/third_party/abseil-cpp/CMake/AbseilHelpers.cmake b/third_party/abseil-cpp/CMake/AbseilHelpers.cmake index 96d815d..3fb8637 100644 --- a/third_party/abseil-cpp/CMake/AbseilHelpers.cmake +++ b/third_party/abseil-cpp/CMake/AbseilHelpers.cmake
@@ -32,6 +32,14 @@ set(ABSL_INTERNAL_INCLUDE_WARNING_GUARD "") endif() +function(_target_compile_features_if_available TARGET TYPE FEATURE) + if(FEATURE IN_LIST CMAKE_CXX_COMPILE_FEATURES) + target_compile_features(${TARGET} ${TYPE} ${FEATURE}) + else() + message(WARNING "Feature ${FEATURE} is unknown for the CXX compiler") + endif() +endfunction() + # absl_cc_library() # # CMake function to imitate Bazel's cc_library rule. @@ -270,7 +278,7 @@ # Abseil libraries require C++14 as the current minimum standard. # Top-level application CMake projects should ensure a consistent C++ # standard for all compiled sources by setting CMAKE_CXX_STANDARD. - target_compile_features(${_NAME} PUBLIC cxx_std_14) + _target_compile_features_if_available(${_NAME} PUBLIC cxx_std_14) else() # Note: This is legacy (before CMake 3.8) behavior. Setting the # target-level CXX_STANDARD property to ABSL_CXX_STANDARD (which is @@ -318,7 +326,7 @@ # Abseil libraries require C++14 as the current minimum standard. # Top-level application CMake projects should ensure a consistent C++ # standard for all compiled sources by setting CMAKE_CXX_STANDARD. - target_compile_features(${_NAME} INTERFACE cxx_std_14) + _target_compile_features_if_available(${_NAME} INTERFACE cxx_std_14) # (INTERFACE libraries can't have the CXX_STANDARD property set, so there # is no legacy behavior else case). @@ -430,7 +438,7 @@ # Abseil libraries require C++14 as the current minimum standard. # Top-level application CMake projects should ensure a consistent C++ # standard for all compiled sources by setting CMAKE_CXX_STANDARD. - target_compile_features(${_NAME} PUBLIC cxx_std_14) + _target_compile_features_if_available(${_NAME} PUBLIC cxx_std_14) else() # Note: This is legacy (before CMake 3.8) behavior. Setting the # target-level CXX_STANDARD property to ABSL_CXX_STANDARD (which is
diff --git a/third_party/abseil-cpp/README.chromium b/third_party/abseil-cpp/README.chromium index fecbed0..de9bba7 100644 --- a/third_party/abseil-cpp/README.chromium +++ b/third_party/abseil-cpp/README.chromium
@@ -4,7 +4,7 @@ License: Apache 2.0 License File: LICENSE Version: 0 -Revision: 547802119dfa444540d8f2bb8a9f50bf64252a0f +Revision: c00a27581eb7277b120c5c3e121af9edb9ddddfd Security Critical: yes Description:
diff --git a/third_party/abseil-cpp/absl/base/config.h b/third_party/abseil-cpp/absl/base/config.h index 9626548..95131068 100644 --- a/third_party/abseil-cpp/absl/base/config.h +++ b/third_party/abseil-cpp/absl/base/config.h
@@ -915,9 +915,14 @@ // ABSL_INTERNAL_HAVE_ARM_NEON is used for compile-time detection of NEON (ARM // SIMD). +// +// If __CUDA_ARCH__ is defined, then we are compiling CUDA code in device mode. +// In device mode, NEON intrinsics are not available, regardless of host +// platform. +// https://llvm.org/docs/CompileCudaWithLLVM.html#detecting-clang-vs-nvcc-from-code #ifdef ABSL_INTERNAL_HAVE_ARM_NEON #error ABSL_INTERNAL_HAVE_ARM_NEON cannot be directly set -#elif defined(__ARM_NEON) +#elif defined(__ARM_NEON) && !defined(__CUDA_ARCH__) #define ABSL_INTERNAL_HAVE_ARM_NEON 1 #endif
diff --git a/third_party/abseil-cpp/absl/numeric/bits.h b/third_party/abseil-cpp/absl/numeric/bits.h index 628cdf50..df81b9a 100644 --- a/third_party/abseil-cpp/absl/numeric/bits.h +++ b/third_party/abseil-cpp/absl/numeric/bits.h
@@ -131,10 +131,9 @@ // fractional part discarded. template <class T> ABSL_INTERNAL_CONSTEXPR_CLZ inline - typename std::enable_if<std::is_unsigned<T>::value, T>::type + typename std::enable_if<std::is_unsigned<T>::value, int>::type bit_width(T x) noexcept { - return std::numeric_limits<T>::digits - - static_cast<unsigned int>(countl_zero(x)); + return std::numeric_limits<T>::digits - countl_zero(x); } // Returns: If x == 0, 0; otherwise the maximal value y such that
diff --git a/third_party/abseil-cpp/absl/strings/ascii.cc b/third_party/abseil-cpp/absl/strings/ascii.cc index 93bb03e9..868df2d 100644 --- a/third_party/abseil-cpp/absl/strings/ascii.cc +++ b/third_party/abseil-cpp/absl/strings/ascii.cc
@@ -157,13 +157,13 @@ void AsciiStrToLower(std::string* s) { for (auto& ch : *s) { - ch = absl::ascii_tolower(ch); + ch = absl::ascii_tolower(static_cast<unsigned char>(ch)); } } void AsciiStrToUpper(std::string* s) { for (auto& ch : *s) { - ch = absl::ascii_toupper(ch); + ch = absl::ascii_toupper(static_cast<unsigned char>(ch)); } } @@ -183,17 +183,17 @@ for (; input_it < input_end; ++input_it) { if (is_ws) { // Consecutive whitespace? Keep only the last. - is_ws = absl::ascii_isspace(*input_it); + is_ws = absl::ascii_isspace(static_cast<unsigned char>(*input_it)); if (is_ws) --output_it; } else { - is_ws = absl::ascii_isspace(*input_it); + is_ws = absl::ascii_isspace(static_cast<unsigned char>(*input_it)); } *output_it = *input_it; ++output_it; } - str->erase(output_it - &(*str)[0]); + str->erase(static_cast<size_t>(output_it - &(*str)[0])); } ABSL_NAMESPACE_END
diff --git a/third_party/abseil-cpp/absl/strings/charconv.cc b/third_party/abseil-cpp/absl/strings/charconv.cc index fefcfc9..65d1beb1 100644 --- a/third_party/abseil-cpp/absl/strings/charconv.cc +++ b/third_party/abseil-cpp/absl/strings/charconv.cc
@@ -65,6 +65,8 @@ template <> struct FloatTraits<double> { + using mantissa_t = uint64_t; + // The number of mantissa bits in the given float type. This includes the // implied high bit. static constexpr int kTargetMantissaBits = 53; @@ -103,7 +105,7 @@ // a normal value is made, or it must be less narrow than that, in which case // `exponent` must be exactly kMinNormalExponent, and a subnormal value is // made. - static double Make(uint64_t mantissa, int exponent, bool sign) { + static double Make(mantissa_t mantissa, int exponent, bool sign) { #ifndef ABSL_BIT_PACK_FLOATS // Support ldexp no matter which namespace it's in. Some platforms // incorrectly don't put it in namespace std. @@ -116,8 +118,10 @@ if (mantissa > kMantissaMask) { // Normal value. // Adjust by 1023 for the exponent representation bias, and an additional - // 52 due to the implied decimal point in the IEEE mantissa represenation. - dbl += uint64_t{exponent + 1023u + kTargetMantissaBits - 1} << 52; + // 52 due to the implied decimal point in the IEEE mantissa + // representation. + dbl += static_cast<uint64_t>(exponent + 1023 + kTargetMantissaBits - 1) + << 52; mantissa &= kMantissaMask; } else { // subnormal value @@ -134,16 +138,20 @@ // members and methods. template <> struct FloatTraits<float> { + using mantissa_t = uint32_t; + static constexpr int kTargetMantissaBits = 24; static constexpr int kMaxExponent = 104; static constexpr int kMinNormalExponent = -149; + static float MakeNan(const char* tagp) { // Support nanf no matter which namespace it's in. Some platforms // incorrectly don't put it in namespace std. using namespace std; // NOLINT return nanf(tagp); } - static float Make(uint32_t mantissa, int exponent, bool sign) { + + static float Make(mantissa_t mantissa, int exponent, bool sign) { #ifndef ABSL_BIT_PACK_FLOATS // Support ldexpf no matter which namespace it's in. Some platforms // incorrectly don't put it in namespace std. @@ -157,7 +165,8 @@ // Normal value. // Adjust by 127 for the exponent representation bias, and an additional // 23 due to the implied decimal point in the IEEE mantissa represenation. - flt += uint32_t{exponent + 127u + kTargetMantissaBits - 1} << 23; + flt += static_cast<uint32_t>(exponent + 127 + kTargetMantissaBits - 1) + << 23; mantissa &= kMantissaMask; } else { // subnormal value @@ -242,9 +251,9 @@ // Returns the bit width of the given uint128. (Equivalently, returns 128 // minus the number of leading zero bits.) -unsigned BitWidth(uint128 value) { +int BitWidth(uint128 value) { if (Uint128High64(value) == 0) { - return static_cast<unsigned>(bit_width(Uint128Low64(value))); + return bit_width(Uint128Low64(value)); } return 128 - countl_zero(Uint128High64(value)); } @@ -337,8 +346,10 @@ *value = negative ? -0.0 : 0.0; return; } - *value = FloatTraits<FloatType>::Make(calculated.mantissa, - calculated.exponent, negative); + *value = FloatTraits<FloatType>::Make( + static_cast<typename FloatTraits<FloatType>::mantissa_t>( + calculated.mantissa), + calculated.exponent, negative); } // Returns the given uint128 shifted to the right by `shift` bits, and rounds @@ -519,7 +530,7 @@ const strings_internal::ParsedFloat& parsed_hex) { uint64_t mantissa = parsed_hex.mantissa; int exponent = parsed_hex.exponent; - auto mantissa_width = static_cast<unsigned>(bit_width(mantissa)); + int mantissa_width = bit_width(mantissa); const int shift = NormalizedShiftSize<FloatType>(mantissa_width, exponent); bool result_exact; exponent += shift;
diff --git a/third_party/abseil-cpp/absl/strings/cord.cc b/third_party/abseil-cpp/absl/strings/cord.cc index b34c03a..523379e4 100644 --- a/third_party/abseil-cpp/absl/strings/cord.cc +++ b/third_party/abseil-cpp/absl/strings/cord.cc
@@ -20,6 +20,7 @@ #include <cstdio> #include <cstdlib> #include <iomanip> +#include <ios> #include <iostream> #include <limits> #include <ostream> @@ -184,7 +185,7 @@ assert(tag >= n); tag -= n; memset(data_.as_chars() + tag, 0, n); - set_inline_size(static_cast<char>(tag)); + set_inline_size(tag); } inline void Cord::InlineRep::remove_prefix(size_t n) { @@ -1098,7 +1099,7 @@ : current_leaf_; const char* data = payload->IsExternal() ? payload->external()->base : payload->flat()->Data(); - const size_t offset = current_chunk_.data() - data; + const size_t offset = static_cast<size_t>(current_chunk_.data() - data); auto* tree = CordRepSubstring::Substring(payload, offset, n); subcord.contents_.EmplaceTree(VerifyTree(tree), method); @@ -1308,7 +1309,7 @@ std::ostream& operator<<(std::ostream& out, const Cord& cord) { for (absl::string_view chunk : cord.Chunks()) { - out.write(chunk.data(), chunk.size()); + out.write(chunk.data(), static_cast<std::streamsize>(chunk.size())); } return out; }
diff --git a/third_party/abseil-cpp/absl/strings/cord_buffer.h b/third_party/abseil-cpp/absl/strings/cord_buffer.h index 09a74ad..15494b31 100644 --- a/third_party/abseil-cpp/absl/strings/cord_buffer.h +++ b/third_party/abseil-cpp/absl/strings/cord_buffer.h
@@ -411,8 +411,12 @@ // Power2 functions static bool IsPow2(size_t size) { return absl::has_single_bit(size); } - static size_t Log2Floor(size_t size) { return absl::bit_width(size) - 1; } - static size_t Log2Ceil(size_t size) { return absl::bit_width(size - 1); } + static size_t Log2Floor(size_t size) { + return static_cast<size_t>(absl::bit_width(size) - 1); + } + static size_t Log2Ceil(size_t size) { + return static_cast<size_t>(absl::bit_width(size - 1)); + } // Implementation of `CreateWithCustomLimit()`. // This implementation allows for future memory allocation hints to
diff --git a/third_party/abseil-cpp/absl/strings/escaping.cc b/third_party/abseil-cpp/absl/strings/escaping.cc index 4dc69702..7d97944 100644 --- a/third_party/abseil-cpp/absl/strings/escaping.cc +++ b/third_party/abseil-cpp/absl/strings/escaping.cc
@@ -42,11 +42,11 @@ inline bool is_octal_digit(char c) { return ('0' <= c) && (c <= '7'); } -inline int hex_digit_to_int(char c) { +inline unsigned int hex_digit_to_int(char c) { static_assert('0' == 0x30 && 'A' == 0x41 && 'a' == 0x61, "Character set must be ASCII."); - assert(absl::ascii_isxdigit(c)); - int x = static_cast<unsigned char>(c); + assert(absl::ascii_isxdigit(static_cast<unsigned char>(c))); + unsigned int x = static_cast<unsigned char>(c); if (x > '9') { x += 9; } @@ -121,27 +121,29 @@ case '7': { // octal digit: 1 to 3 digits const char* octal_start = p; - unsigned int ch = *p - '0'; - if (p < last_byte && is_octal_digit(p[1])) ch = ch * 8 + *++p - '0'; + unsigned int ch = static_cast<unsigned int>(*p - '0'); // digit 1 if (p < last_byte && is_octal_digit(p[1])) - ch = ch * 8 + *++p - '0'; // now points at last digit + ch = ch * 8 + static_cast<unsigned int>(*++p - '0'); // digit 2 + if (p < last_byte && is_octal_digit(p[1])) + ch = ch * 8 + static_cast<unsigned int>(*++p - '0'); // digit 3 if (ch > 0xff) { if (error) { *error = "Value of \\" + - std::string(octal_start, p + 1 - octal_start) + + std::string(octal_start, + static_cast<size_t>(p + 1 - octal_start)) + " exceeds 0xff"; } return false; } if ((ch == 0) && leave_nulls_escaped) { // Copy the escape sequence for the null character - const ptrdiff_t octal_size = p + 1 - octal_start; + const size_t octal_size = static_cast<size_t>(p + 1 - octal_start); *d++ = '\\'; memmove(d, octal_start, octal_size); d += octal_size; break; } - *d++ = ch; + *d++ = static_cast<char>(ch); break; } case 'x': @@ -149,32 +151,34 @@ if (p >= last_byte) { if (error) *error = "String cannot end with \\x"; return false; - } else if (!absl::ascii_isxdigit(p[1])) { + } else if (!absl::ascii_isxdigit(static_cast<unsigned char>(p[1]))) { if (error) *error = "\\x cannot be followed by a non-hex digit"; return false; } unsigned int ch = 0; const char* hex_start = p; - while (p < last_byte && absl::ascii_isxdigit(p[1])) + while (p < last_byte && + absl::ascii_isxdigit(static_cast<unsigned char>(p[1]))) // Arbitrarily many hex digits ch = (ch << 4) + hex_digit_to_int(*++p); if (ch > 0xFF) { if (error) { *error = "Value of \\" + - std::string(hex_start, p + 1 - hex_start) + + std::string(hex_start, + static_cast<size_t>(p + 1 - hex_start)) + " exceeds 0xff"; } return false; } if ((ch == 0) && leave_nulls_escaped) { // Copy the escape sequence for the null character - const ptrdiff_t hex_size = p + 1 - hex_start; + const size_t hex_size = static_cast<size_t>(p + 1 - hex_start); *d++ = '\\'; memmove(d, hex_start, hex_size); d += hex_size; break; } - *d++ = ch; + *d++ = static_cast<char>(ch); break; } case 'u': { @@ -184,18 +188,20 @@ if (p + 4 >= end) { if (error) { *error = "\\u must be followed by 4 hex digits: \\" + - std::string(hex_start, p + 1 - hex_start); + std::string(hex_start, + static_cast<size_t>(p + 1 - hex_start)); } return false; } for (int i = 0; i < 4; ++i) { // Look one char ahead. - if (absl::ascii_isxdigit(p[1])) { + if (absl::ascii_isxdigit(static_cast<unsigned char>(p[1]))) { rune = (rune << 4) + hex_digit_to_int(*++p); // Advance p. } else { if (error) { *error = "\\u must be followed by 4 hex digits: \\" + - std::string(hex_start, p + 1 - hex_start); + std::string(hex_start, + static_cast<size_t>(p + 1 - hex_start)); } return false; } @@ -220,20 +226,22 @@ if (p + 8 >= end) { if (error) { *error = "\\U must be followed by 8 hex digits: \\" + - std::string(hex_start, p + 1 - hex_start); + std::string(hex_start, + static_cast<size_t>(p + 1 - hex_start)); } return false; } for (int i = 0; i < 8; ++i) { // Look one char ahead. - if (absl::ascii_isxdigit(p[1])) { + if (absl::ascii_isxdigit(static_cast<unsigned char>(p[1]))) { // Don't change rune until we're sure this // is within the Unicode limit, but do advance p. uint32_t newrune = (rune << 4) + hex_digit_to_int(*++p); if (newrune > 0x10FFFF) { if (error) { *error = "Value of \\" + - std::string(hex_start, p + 1 - hex_start) + + std::string(hex_start, + static_cast<size_t>(p + 1 - hex_start)) + " exceeds Unicode limit (0x10FFFF)"; } return false; @@ -243,7 +251,8 @@ } else { if (error) { *error = "\\U must be followed by 8 hex digits: \\" + - std::string(hex_start, p + 1 - hex_start); + std::string(hex_start, + static_cast<size_t>(p + 1 - hex_start)); } return false; } @@ -291,7 +300,7 @@ error)) { return false; } - dest->erase(dest_size); + dest->erase(static_cast<size_t>(dest_size)); return true; } @@ -311,7 +320,7 @@ std::string dest; bool last_hex_escape = false; // true if last output char was \xNN. - for (unsigned char c : src) { + for (char c : src) { bool is_hex_escape = false; switch (c) { case '\n': dest.append("\\" "n"); break; @@ -320,28 +329,30 @@ case '\"': dest.append("\\" "\""); break; case '\'': dest.append("\\" "'"); break; case '\\': dest.append("\\" "\\"); break; - default: + default: { // Note that if we emit \xNN and the src character after that is a hex // digit then that digit must be escaped too to prevent it being // interpreted as part of the character code by C. - if ((!utf8_safe || c < 0x80) && - (!absl::ascii_isprint(c) || - (last_hex_escape && absl::ascii_isxdigit(c)))) { + const unsigned char uc = static_cast<unsigned char>(c); + if ((!utf8_safe || uc < 0x80) && + (!absl::ascii_isprint(uc) || + (last_hex_escape && absl::ascii_isxdigit(uc)))) { if (use_hex) { dest.append("\\" "x"); - dest.push_back(numbers_internal::kHexChar[c / 16]); - dest.push_back(numbers_internal::kHexChar[c % 16]); + dest.push_back(numbers_internal::kHexChar[uc / 16]); + dest.push_back(numbers_internal::kHexChar[uc % 16]); is_hex_escape = true; } else { dest.append("\\"); - dest.push_back(numbers_internal::kHexChar[c / 64]); - dest.push_back(numbers_internal::kHexChar[(c % 64) / 8]); - dest.push_back(numbers_internal::kHexChar[c % 8]); + dest.push_back(numbers_internal::kHexChar[uc / 64]); + dest.push_back(numbers_internal::kHexChar[(uc % 64) / 8]); + dest.push_back(numbers_internal::kHexChar[uc % 8]); } } else { dest.push_back(c); break; } + } } last_hex_escape = is_hex_escape; } @@ -350,7 +361,7 @@ } /* clang-format off */ -constexpr char c_escaped_len[256] = { +constexpr unsigned char c_escaped_len[256] = { 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 4, 4, 2, 4, 4, // \t, \n, \r 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, // ", ' @@ -375,7 +386,8 @@ // that UTF-8 bytes are not handled specially. inline size_t CEscapedLength(absl::string_view src) { size_t escaped_len = 0; - for (unsigned char c : src) escaped_len += c_escaped_len[c]; + for (char c : src) + escaped_len += c_escaped_len[static_cast<unsigned char>(c)]; return escaped_len; } @@ -391,8 +403,8 @@ cur_dest_len + escaped_len); char* append_ptr = &(*dest)[cur_dest_len]; - for (unsigned char c : src) { - int char_len = c_escaped_len[c]; + for (char c : src) { + size_t char_len = c_escaped_len[static_cast<unsigned char>(c)]; if (char_len == 1) { *append_ptr++ = c; } else if (char_len == 2) { @@ -424,9 +436,9 @@ } } else { *append_ptr++ = '\\'; - *append_ptr++ = '0' + c / 64; - *append_ptr++ = '0' + (c % 64) / 8; - *append_ptr++ = '0' + c % 8; + *append_ptr++ = '0' + static_cast<unsigned char>(c) / 64; + *append_ptr++ = '0' + (static_cast<unsigned char>(c) % 64) / 8; + *append_ptr++ = '0' + static_cast<unsigned char>(c) % 8; } } } @@ -440,7 +452,7 @@ size_t destidx = 0; int decode = 0; int state = 0; - unsigned int ch = 0; + unsigned char ch = 0; unsigned int temp = 0; // If "char" is signed by default, using *src as an array index results in @@ -500,13 +512,13 @@ // how to handle those cases. GET_INPUT(first, 4); - temp = decode; + temp = static_cast<unsigned char>(decode); GET_INPUT(second, 3); - temp = (temp << 6) | decode; + temp = (temp << 6) | static_cast<unsigned char>(decode); GET_INPUT(third, 2); - temp = (temp << 6) | decode; + temp = (temp << 6) | static_cast<unsigned char>(decode); GET_INPUT(fourth, 1); - temp = (temp << 6) | decode; + temp = (temp << 6) | static_cast<unsigned char>(decode); } else { // We really did have four good data bytes, so advance four // characters in the string. @@ -518,11 +530,11 @@ // temp has 24 bits of input, so write that out as three bytes. if (destidx + 3 > szdest) return false; - dest[destidx + 2] = temp; + dest[destidx + 2] = static_cast<char>(temp); temp >>= 8; - dest[destidx + 1] = temp; + dest[destidx + 1] = static_cast<char>(temp); temp >>= 8; - dest[destidx] = temp; + dest[destidx] = static_cast<char>(temp); destidx += 3; } } else { @@ -583,18 +595,18 @@ } // Each input character gives us six bits of output. - temp = (temp << 6) | decode; + temp = (temp << 6) | static_cast<unsigned char>(decode); ++state; if (state == 4) { // If we've accumulated 24 bits of output, write that out as // three bytes. if (dest) { if (destidx + 3 > szdest) return false; - dest[destidx + 2] = temp; + dest[destidx + 2] = static_cast<char>(temp); temp >>= 8; - dest[destidx + 1] = temp; + dest[destidx + 1] = static_cast<char>(temp); temp >>= 8; - dest[destidx] = temp; + dest[destidx] = static_cast<char>(temp); } destidx += 3; state = 0; @@ -619,7 +631,7 @@ if (dest) { if (destidx + 1 > szdest) return false; temp >>= 4; - dest[destidx] = temp; + dest[destidx] = static_cast<char>(temp); } ++destidx; expected_equals = 2; @@ -630,9 +642,9 @@ if (dest) { if (destidx + 2 > szdest) return false; temp >>= 2; - dest[destidx + 1] = temp; + dest[destidx + 1] = static_cast<char>(temp); temp >>= 8; - dest[destidx] = temp; + dest[destidx] = static_cast<char>(temp); } destidx += 2; expected_equals = 1; @@ -822,9 +834,9 @@ // or a string. This works because we use the [] operator to access // individual characters at a time. template <typename T> -void HexStringToBytesInternal(const char* from, T to, ptrdiff_t num) { - for (int i = 0; i < num; i++) { - to[i] = (kHexValueLenient[from[i * 2] & 0xFF] << 4) + +void HexStringToBytesInternal(const char* from, T to, size_t num) { + for (size_t i = 0; i < num; i++) { + to[i] = static_cast<char>(kHexValueLenient[from[i * 2] & 0xFF] << 4) + (kHexValueLenient[from[i * 2 + 1] & 0xFF]); } } @@ -832,7 +844,7 @@ // This is a templated function so that T can be either a char* or a // std::string. template <typename T> -void BytesToHexStringInternal(const unsigned char* src, T dest, ptrdiff_t num) { +void BytesToHexStringInternal(const unsigned char* src, T dest, size_t num) { auto dest_ptr = &dest[0]; for (auto src_ptr = src; src_ptr != (src + num); ++src_ptr, dest_ptr += 2) { const char* hex_p = &numbers_internal::kHexTable[*src_ptr * 2];
diff --git a/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc b/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc index ebf8c07..282b639 100644 --- a/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc +++ b/third_party/abseil-cpp/absl/strings/internal/charconv_bigint.cc
@@ -242,7 +242,7 @@ // decimal exponent to compensate. --exponent_adjust; } - int digit = (*begin - '0'); + char digit = (*begin - '0'); --significant_digits; if (significant_digits == 0 && std::next(begin) != end && (digit == 0 || digit == 5)) { @@ -255,7 +255,7 @@ // 500000...000000000001 to correctly round up, rather than to nearest. ++digit; } - queued = 10 * queued + digit; + queued = 10 * queued + static_cast<uint32_t>(digit); ++digits_queued; if (digits_queued == kMaxSmallPowerOfTen) { MultiplyBy(kTenToNth[kMaxSmallPowerOfTen]); @@ -341,8 +341,8 @@ std::string result; // Build result in reverse order while (copy.size() > 0) { - int next_digit = copy.DivMod<10>(); - result.push_back('0' + next_digit); + uint32_t next_digit = copy.DivMod<10>(); + result.push_back('0' + static_cast<char>(next_digit)); } if (result.empty()) { result.push_back('0');
diff --git a/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc b/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc index d29acaf..98823def 100644 --- a/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc +++ b/third_party/abseil-cpp/absl/strings/internal/charconv_parse.cc
@@ -190,11 +190,11 @@ template <> unsigned ToDigit<10>(char ch) { - return ch - '0'; + return static_cast<unsigned>(ch - '0'); } template <> unsigned ToDigit<16>(char ch) { - return kAsciiToInt[static_cast<unsigned char>(ch)]; + return static_cast<unsigned>(kAsciiToInt[static_cast<unsigned char>(ch)]); } template <>
diff --git a/third_party/abseil-cpp/absl/strings/internal/cord_internal.h b/third_party/abseil-cpp/absl/strings/internal/cord_internal.h index 29954112..601457e 100644 --- a/third_party/abseil-cpp/absl/strings/internal/cord_internal.h +++ b/third_party/abseil-cpp/absl/strings/internal/cord_internal.h
@@ -129,8 +129,9 @@ } // Returns the current reference count using acquire semantics. - inline int32_t Get() const { - return count_.load(std::memory_order_acquire) >> kNumFlags; + inline size_t Get() const { + return static_cast<size_t>(count_.load(std::memory_order_acquire) >> + kNumFlags); } // Returns whether the atomic integer is 1.
diff --git a/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc b/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc index cacbf3da..7ce36128 100644 --- a/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc +++ b/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.cc
@@ -17,6 +17,7 @@ #include <cassert> #include <cstdint> #include <iostream> +#include <ostream> #include <string> #include "absl/base/attributes.h" @@ -55,8 +56,10 @@ // Prints the entire tree structure or 'rep'. External callers should // not specify 'depth' and leave it to its default (0) value. // Rep may be a CordRepBtree tree, or a SUBSTRING / EXTERNAL / FLAT node. -void DumpAll(const CordRep* rep, bool include_contents, std::ostream& stream, - int depth = 0) { +void DumpAll(const CordRep* rep, + bool include_contents, + std::ostream& stream, + size_t depth = 0) { // Allow for full height trees + substring -> flat / external nodes. assert(depth <= CordRepBtree::kMaxDepth + 2); std::string sharing = const_cast<CordRep*>(rep)->refcount.IsOne()
diff --git a/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h b/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h index 2cbc09e..eed5609 100644 --- a/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h +++ b/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree.h
@@ -95,8 +95,9 @@ // local stack variable compared to Cord's current near 400 bytes stack use. // The maximum `height` value of a node is then `kMaxDepth - 1` as node height // values start with a value of 0 for leaf nodes. - static constexpr int kMaxDepth = 12; - static constexpr int kMaxHeight = kMaxDepth - 1; + static constexpr size_t kMaxDepth = 12; + // See comments on height() for why this is an int and not a size_t. + static constexpr int kMaxHeight = static_cast<int>(kMaxDepth - 1); // `Action` defines the action for unwinding changes done at the btree's leaf // level that need to be propagated up to the parent node(s). Each operation
diff --git a/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc b/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc index 9b896a3d..6ed20c2 100644 --- a/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc +++ b/third_party/abseil-cpp/absl/strings/internal/cord_rep_btree_navigator.cc
@@ -90,7 +90,7 @@ // edges that must be skipped. while (height > 0) { node = edge->btree(); - index_[height] = index; + index_[height] = static_cast<uint8_t>(index); node_[--height] = node; index = node->begin(); edge = node->Edge(index); @@ -101,7 +101,7 @@ edge = node->Edge(index); } } - index_[0] = index; + index_[0] = static_cast<uint8_t>(index); return {edge, n}; } @@ -126,7 +126,7 @@ do { length -= edge->length; while (++index == node->end()) { - index_[height] = index; + index_[height] = static_cast<uint8_t>(index); if (++height > height_) { subtree->set_end(subtree_end); if (length == 0) return {subtree, 0}; @@ -154,7 +154,7 @@ // edges that must be read, adding 'down' nodes to `subtree`. while (height > 0) { node = edge->btree(); - index_[height] = index; + index_[height] = static_cast<uint8_t>(index); node_[--height] = node; index = node->begin(); edge = node->Edge(index); @@ -178,7 +178,7 @@ subtree->edges_[subtree_end++] = Substring(edge, 0, length); } subtree->set_end(subtree_end); - index_[0] = index; + index_[0] = static_cast<uint8_t>(index); return {tree, length}; }
diff --git a/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc b/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc index dac3fd8b..530f33b 100644 --- a/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc +++ b/third_party/abseil-cpp/absl/strings/internal/cordz_info.cc
@@ -35,7 +35,7 @@ using ::absl::base_internal::SpinLockHolder; #ifdef ABSL_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL -constexpr int CordzInfo::kMaxStackDepth; +constexpr size_t CordzInfo::kMaxStackDepth; #endif ABSL_CONST_INIT CordzInfo::List CordzInfo::global_list_{absl::kConstInit}; @@ -291,7 +291,7 @@ : src->method_; } -int CordzInfo::FillParentStack(const CordzInfo* src, void** stack) { +size_t CordzInfo::FillParentStack(const CordzInfo* src, void** stack) { assert(stack); if (src == nullptr) return 0; if (src->parent_stack_depth_) { @@ -302,11 +302,14 @@ return src->stack_depth_; } -CordzInfo::CordzInfo(CordRep* rep, const CordzInfo* src, +CordzInfo::CordzInfo(CordRep* rep, + const CordzInfo* src, MethodIdentifier method) : rep_(rep), - stack_depth_(absl::GetStackTrace(stack_, /*max_depth=*/kMaxStackDepth, - /*skip_count=*/1)), + stack_depth_( + static_cast<size_t>(absl::GetStackTrace(stack_, + /*max_depth=*/kMaxStackDepth, + /*skip_count=*/1))), parent_stack_depth_(FillParentStack(src, parent_stack_)), method_(method), parent_method_(GetParentMethod(src)),
diff --git a/third_party/abseil-cpp/absl/strings/internal/cordz_info.h b/third_party/abseil-cpp/absl/strings/internal/cordz_info.h index 026d5b9..8e86f22 100644 --- a/third_party/abseil-cpp/absl/strings/internal/cordz_info.h +++ b/third_party/abseil-cpp/absl/strings/internal/cordz_info.h
@@ -196,7 +196,7 @@ std::atomic<CordzInfo*> head ABSL_GUARDED_BY(mutex){nullptr}; }; - static constexpr int kMaxStackDepth = 64; + static constexpr size_t kMaxStackDepth = 64; explicit CordzInfo(CordRep* rep, const CordzInfo* src, MethodIdentifier method); @@ -216,7 +216,7 @@ // `stack_` depending on `parent_stack_` being empty, returning the size of // the parent stack. // Returns 0 if `src` is null. - static int FillParentStack(const CordzInfo* src, void** stack); + static size_t FillParentStack(const CordzInfo* src, void** stack); void ODRCheck() const { #ifndef NDEBUG @@ -244,8 +244,8 @@ void* stack_[kMaxStackDepth]; void* parent_stack_[kMaxStackDepth]; - const int stack_depth_; - const int parent_stack_depth_; + const size_t stack_depth_; + const size_t parent_stack_depth_; const MethodIdentifier method_; const MethodIdentifier parent_method_; CordzUpdateTracker update_tracker_;
diff --git a/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h b/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h index 5707190..9f558df 100644 --- a/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h +++ b/third_party/abseil-cpp/absl/strings/internal/cordz_statistics.h
@@ -45,12 +45,12 @@ }; // The size of the cord in bytes. This matches the result of Cord::size(). - int64_t size = 0; + size_t size = 0; // The estimated memory used by the sampled cord. This value matches the // value as reported by Cord::EstimatedMemoryUsage(). // A value of 0 implies the property has not been recorded. - int64_t estimated_memory_usage = 0; + size_t estimated_memory_usage = 0; // The effective memory used by the sampled cord, inversely weighted by the // effective indegree of each allocated node. This is a representation of the @@ -59,14 +59,14 @@ // by multiple Cord instances, and for cases where a Cord includes the same // node multiple times (either directly or indirectly). // A value of 0 implies the property has not been recorded. - int64_t estimated_fair_share_memory_usage = 0; + size_t estimated_fair_share_memory_usage = 0; // The total number of nodes referenced by this cord. // For ring buffer Cords, this includes the 'ring buffer' node. // For btree Cords, this includes all 'CordRepBtree' tree nodes as well as all // the substring, flat and external nodes referenced by the tree. // A value of 0 implies the property has not been recorded. - int64_t node_count = 0; + size_t node_count = 0; // Detailed node counts per type NodeCounts node_counts;
diff --git a/third_party/abseil-cpp/absl/strings/internal/memutil.cc b/third_party/abseil-cpp/absl/strings/internal/memutil.cc index 2519c68..44996a75 100644 --- a/third_party/abseil-cpp/absl/strings/internal/memutil.cc +++ b/third_party/abseil-cpp/absl/strings/internal/memutil.cc
@@ -54,10 +54,11 @@ cont: c = *p++; - if (slen-- == 0) return p - 1 - s; + if (slen-- == 0) + return static_cast<size_t>(p - 1 - s); for (spanp = accept; (sc = *spanp++) != '\0';) if (sc == c) goto cont; - return p - 1 - s; + return static_cast<size_t>(p - 1 - s); } size_t memcspn(const char* s, size_t slen, const char* reject) { @@ -68,9 +69,10 @@ while (slen-- != 0) { c = *p++; for (spanp = reject; (sc = *spanp++) != '\0';) - if (sc == c) return p - 1 - s; + if (sc == c) + return static_cast<size_t>(p - 1 - s); } - return p - s; + return static_cast<size_t>(p - s); } char* mempbrk(const char* s, size_t slen, const char* accept) { @@ -97,8 +99,9 @@ const char* hayend = phaystack + haylen - neelen + 1; // A static cast is used here to work around the fact that memchr returns // a void* on Posix-compliant systems and const void* on Windows. - while ((match = static_cast<const char*>( - memchr(phaystack, pneedle[0], hayend - phaystack)))) { + while ( + (match = static_cast<const char*>(memchr( + phaystack, pneedle[0], static_cast<size_t>(hayend - phaystack))))) { if (memcmp(match, pneedle, neelen) == 0) return match; else
diff --git a/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc b/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc index 02aeeeb..007e8e8 100644 --- a/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc +++ b/third_party/abseil-cpp/absl/strings/internal/str_format/arg.cc
@@ -77,7 +77,7 @@ v >>= 3; } while (v); start_ = p; - size_ = storage_ + sizeof(storage_) - p; + size_ = static_cast<size_t>(storage_ + sizeof(storage_) - p); } // Print the signed or unsigned integer as decimal. @@ -86,7 +86,8 @@ void PrintAsDec(T v) { static_assert(std::is_integral<T>::value, ""); start_ = storage_; - size_ = numbers_internal::FastIntToBuffer(v, storage_) - storage_; + size_ = static_cast<size_t>(numbers_internal::FastIntToBuffer(v, storage_) - + storage_); } void PrintAsDec(int128 v) { @@ -115,7 +116,7 @@ if (add_neg) { *--p = '-'; } - size_ = storage_ + sizeof(storage_) - p; + size_ = static_cast<size_t>(storage_ + sizeof(storage_) - p); start_ = p; } @@ -138,7 +139,7 @@ ++p; } start_ = p; - size_ = storage_ + sizeof(storage_) - p; + size_ = static_cast<size_t>(storage_ + sizeof(storage_) - p); } // Print the unsigned integer as hex using uppercase. @@ -154,7 +155,7 @@ v >>= 4; } while (v); start_ = p; - size_ = storage_ + sizeof(storage_) - p; + size_ = static_cast<size_t>(storage_ + sizeof(storage_) - p); } // The printed value including the '-' sign if available. @@ -208,10 +209,12 @@ return {}; } -bool ConvertCharImpl(unsigned char v, const FormatConversionSpecImpl conv, - FormatSinkImpl *sink) { +bool ConvertCharImpl(char v, + const FormatConversionSpecImpl conv, + FormatSinkImpl* sink) { size_t fill = 0; - if (conv.width() >= 0) fill = conv.width(); + if (conv.width() >= 0) + fill = static_cast<size_t>(conv.width()); ReducePadding(1, &fill); if (!conv.has_left_flag()) sink->Append(fill, ' '); sink->Append(1, v); @@ -225,7 +228,8 @@ // Print as a sequence of Substrings: // [left_spaces][sign][base_indicator][zeroes][formatted][right_spaces] size_t fill = 0; - if (conv.width() >= 0) fill = conv.width(); + if (conv.width() >= 0) + fill = static_cast<size_t>(conv.width()); string_view formatted = as_digits.without_neg_or_zero(); ReducePadding(formatted, &fill); @@ -236,10 +240,9 @@ string_view base_indicator = BaseIndicator(as_digits, conv); ReducePadding(base_indicator, &fill); - int precision = conv.precision(); - bool precision_specified = precision >= 0; - if (!precision_specified) - precision = 1; + bool precision_specified = conv.precision() >= 0; + size_t precision = + precision_specified ? static_cast<size_t>(conv.precision()) : size_t{1}; if (conv.has_alt_flag() && conv.conversion_char() == FormatConversionCharInternal::o) { @@ -247,7 +250,7 @@ // "For o conversion, it increases the precision (if necessary) to // force the first digit of the result to be zero." if (formatted.empty() || *formatted.begin() != '0') { - int needed = static_cast<int>(formatted.size()) + 1; + size_t needed = formatted.size() + 1; precision = std::max(precision, needed); } } @@ -287,7 +290,7 @@ // FormatConversionChar is declared, but not defined. switch (static_cast<uint8_t>(conv.conversion_char())) { case static_cast<uint8_t>(FormatConversionCharInternal::c): - return ConvertCharImpl(static_cast<unsigned char>(v), conv, sink); + return ConvertCharImpl(static_cast<char>(v), conv, sink); case static_cast<uint8_t>(FormatConversionCharInternal::o): as_digits.PrintAsOct(static_cast<U>(v)); @@ -375,7 +378,7 @@ len = std::strlen(v); } else { // If precision is set, we look for the NUL-terminator on the valid range. - len = std::find(v, v + conv.precision(), '\0') - v; + len = static_cast<size_t>(std::find(v, v + conv.precision(), '\0') - v); } return {ConvertStringArg(string_view(v, len), conv, sink)}; }
diff --git a/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc b/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc index c988ba8..77a4222 100644 --- a/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc +++ b/third_party/abseil-cpp/absl/strings/internal/str_format/bind.cc
@@ -32,7 +32,8 @@ return false; } // -1 because positions are 1-based - return FormatArgImplFriend::ToInt(pack[position - 1], value); + return FormatArgImplFriend::ToInt(pack[static_cast<size_t>(position) - 1], + value); } class ArgContext { @@ -56,7 +57,7 @@ const FormatArgImpl* arg = nullptr; int arg_position = unbound->arg_position; if (static_cast<size_t>(arg_position - 1) >= pack_.size()) return false; - arg = &pack_[arg_position - 1]; // 1-based + arg = &pack_[static_cast<size_t>(arg_position - 1)]; // 1-based if (unbound->flags != Flags::kBasic) { int width = unbound->width.value();
diff --git a/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc b/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc index f93153d5..2a0ceb1 100644 --- a/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc +++ b/third_party/abseil-cpp/absl/strings/internal/str_format/extension.cc
@@ -58,7 +58,8 @@ bool FormatSinkImpl::PutPaddedString(string_view value, int width, int precision, bool left) { size_t space_remaining = 0; - if (width >= 0) space_remaining = width; + if (width >= 0) + space_remaining = static_cast<size_t>(width); size_t n = value.size(); if (precision >= 0) n = std::min(n, static_cast<size_t>(precision)); string_view shown(value.data(), n);
diff --git a/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc b/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc index b1c406847..3895001a 100644 --- a/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc +++ b/third_party/abseil-cpp/absl/strings/internal/str_format/float_conversion.cc
@@ -92,27 +92,30 @@ // Calculates `10 * (*v) + carry` and stores the result in `*v` and returns // the carry. +// Requires: `0 <= carry <= 9` template <typename Int> -inline Int MultiplyBy10WithCarry(Int *v, Int carry) { +inline char MultiplyBy10WithCarry(Int* v, char carry) { using BiggerInt = absl::conditional_t<sizeof(Int) == 4, uint64_t, uint128>; - BiggerInt tmp = 10 * static_cast<BiggerInt>(*v) + carry; + BiggerInt tmp = + 10 * static_cast<BiggerInt>(*v) + static_cast<BiggerInt>(carry); *v = static_cast<Int>(tmp); - return static_cast<Int>(tmp >> (sizeof(Int) * 8)); + return static_cast<char>(tmp >> (sizeof(Int) * 8)); } // Calculates `(2^64 * carry + *v) / 10`. // Stores the quotient in `*v` and returns the remainder. // Requires: `0 <= carry <= 9` -inline uint64_t DivideBy10WithCarry(uint64_t *v, uint64_t carry) { +inline char DivideBy10WithCarry(uint64_t* v, char carry) { constexpr uint64_t divisor = 10; // 2^64 / divisor = chunk_quotient + chunk_remainder / divisor constexpr uint64_t chunk_quotient = (uint64_t{1} << 63) / (divisor / 2); constexpr uint64_t chunk_remainder = uint64_t{} - chunk_quotient * divisor; + const uint64_t carry_u64 = static_cast<uint64_t>(carry); const uint64_t mod = *v % divisor; - const uint64_t next_carry = chunk_remainder * carry + mod; - *v = *v / divisor + carry * chunk_quotient + next_carry / divisor; - return next_carry % divisor; + const uint64_t next_carry = chunk_remainder * carry_u64 + mod; + *v = *v / divisor + carry_u64 * chunk_quotient + next_carry / divisor; + return static_cast<char>(next_carry % divisor); } using MaxFloatType = @@ -125,11 +128,11 @@ // // Requires `0 <= exp` and `exp <= numeric_limits<MaxFloatType>::max_exponent`. class BinaryToDecimal { - static constexpr int ChunksNeeded(int exp) { + static constexpr size_t ChunksNeeded(int exp) { // We will left shift a uint128 by `exp` bits, so we need `128+exp` total // bits. Round up to 32. // See constructor for details about adding `10%` to the value. - return (128 + exp + 31) / 32 * 11 / 10; + return static_cast<size_t>((128 + exp + 31) / 32 * 11 / 10); } public: @@ -140,7 +143,7 @@ assert(exp > 0); assert(exp <= std::numeric_limits<MaxFloatType>::max_exponent); static_assert( - static_cast<int>(StackArray::kMaxCapacity) >= + StackArray::kMaxCapacity >= ChunksNeeded(std::numeric_limits<MaxFloatType>::max_exponent), ""); @@ -149,9 +152,9 @@ [=](absl::Span<uint32_t> input) { f(BinaryToDecimal(input, v, exp)); }); } - int TotalDigits() const { - return static_cast<int>((decimal_end_ - decimal_start_) * kDigitsPerChunk + - CurrentDigits().size()); + size_t TotalDigits() const { + return (decimal_end_ - decimal_start_) * kDigitsPerChunk + + CurrentDigits().size(); } // See the current block of digits. @@ -190,30 +193,31 @@ // the decimal representation is around 7% less efficient in space than the // binary one. We allocate an extra 10% memory to account for this. See // ChunksNeeded for this calculation. - int chunk_index = exp / 32; + size_t after_chunk_index = static_cast<size_t>(exp / 32 + 1); decimal_start_ = decimal_end_ = ChunksNeeded(exp); const int offset = exp % 32; // Left shift v by exp bits. - data_[chunk_index] = static_cast<uint32_t>(v << offset); + data_[after_chunk_index - 1] = static_cast<uint32_t>(v << offset); for (v >>= (32 - offset); v; v >>= 32) - data_[++chunk_index] = static_cast<uint32_t>(v); + data_[++after_chunk_index - 1] = static_cast<uint32_t>(v); - while (chunk_index >= 0) { + while (after_chunk_index > 0) { // While we have more than one chunk available, go in steps of 1e9. - // `data_[chunk_index]` holds the highest non-zero binary chunk, so keep - // the variable updated. + // `data_[after_chunk_index - 1]` holds the highest non-zero binary chunk, + // so keep the variable updated. uint32_t carry = 0; - for (int i = chunk_index; i >= 0; --i) { - uint64_t tmp = uint64_t{data_[i]} + (uint64_t{carry} << 32); - data_[i] = static_cast<uint32_t>(tmp / uint64_t{1000000000}); + for (size_t i = after_chunk_index; i > 0; --i) { + uint64_t tmp = uint64_t{data_[i - 1]} + (uint64_t{carry} << 32); + data_[i - 1] = static_cast<uint32_t>(tmp / uint64_t{1000000000}); carry = static_cast<uint32_t>(tmp % uint64_t{1000000000}); } // If the highest chunk is now empty, remove it from view. - if (data_[chunk_index] == 0) --chunk_index; + if (data_[after_chunk_index - 1] == 0) + --after_chunk_index; --decimal_start_; - assert(decimal_start_ != chunk_index); + assert(decimal_start_ != after_chunk_index - 1); data_[decimal_start_] = carry; } @@ -225,13 +229,13 @@ } private: - static constexpr int kDigitsPerChunk = 9; + static constexpr size_t kDigitsPerChunk = 9; - int decimal_start_; - int decimal_end_; + size_t decimal_start_; + size_t decimal_end_; char digits_[kDigitsPerChunk]; - int size_ = 0; + size_t size_ = 0; absl::Span<uint32_t> data_; }; @@ -251,25 +255,26 @@ static_assert(StackArray::kMaxCapacity >= (Limits::digits + 128 - Limits::min_exponent + 31) / 32, ""); - StackArray::RunWithCapacity((Limits::digits + exp + 31) / 32, - [=](absl::Span<uint32_t> input) { - f(FractionalDigitGenerator(input, v, exp)); - }); + StackArray::RunWithCapacity( + static_cast<size_t>((Limits::digits + exp + 31) / 32), + [=](absl::Span<uint32_t> input) { + f(FractionalDigitGenerator(input, v, exp)); + }); } // Returns true if there are any more non-zero digits left. - bool HasMoreDigits() const { return next_digit_ != 0 || chunk_index_ >= 0; } + bool HasMoreDigits() const { return next_digit_ != 0 || after_chunk_index_; } // Returns true if the remainder digits are greater than 5000... bool IsGreaterThanHalf() const { - return next_digit_ > 5 || (next_digit_ == 5 && chunk_index_ >= 0); + return next_digit_ > 5 || (next_digit_ == 5 && after_chunk_index_); } // Returns true if the remainder digits are exactly 5000... - bool IsExactlyHalf() const { return next_digit_ == 5 && chunk_index_ < 0; } + bool IsExactlyHalf() const { return next_digit_ == 5 && !after_chunk_index_; } struct Digits { - int digit_before_nine; - int num_nines; + char digit_before_nine; + size_t num_nines; }; // Get the next set of digits. @@ -288,35 +293,37 @@ private: // Return the next digit. - int GetOneDigit() { - if (chunk_index_ < 0) return 0; + char GetOneDigit() { + if (!after_chunk_index_) + return 0; - uint32_t carry = 0; - for (int i = chunk_index_; i >= 0; --i) { - carry = MultiplyBy10WithCarry(&data_[i], carry); + char carry = 0; + for (size_t i = after_chunk_index_; i > 0; --i) { + carry = MultiplyBy10WithCarry(&data_[i - 1], carry); } // If the lowest chunk is now empty, remove it from view. - if (data_[chunk_index_] == 0) --chunk_index_; + if (data_[after_chunk_index_ - 1] == 0) + --after_chunk_index_; return carry; } FractionalDigitGenerator(absl::Span<uint32_t> data, uint128 v, int exp) - : chunk_index_(exp / 32), data_(data) { + : after_chunk_index_(static_cast<size_t>(exp / 32 + 1)), data_(data) { const int offset = exp % 32; // Right shift `v` by `exp` bits. - data_[chunk_index_] = static_cast<uint32_t>(v << (32 - offset)); + data_[after_chunk_index_ - 1] = static_cast<uint32_t>(v << (32 - offset)); v >>= offset; // Make sure we don't overflow the data. We already calculated that // non-zero bits fit, so we might not have space for leading zero bits. - for (int pos = chunk_index_; v; v >>= 32) + for (size_t pos = after_chunk_index_ - 1; v; v >>= 32) data_[--pos] = static_cast<uint32_t>(v); // Fill next_digit_, as GetDigits expects it to be populated always. next_digit_ = GetOneDigit(); } - int next_digit_; - int chunk_index_; + char next_digit_; + size_t after_chunk_index_; absl::Span<uint32_t> data_; }; @@ -362,7 +369,7 @@ auto low = static_cast<uint64_t>(v); while (high != 0) { - uint64_t carry = DivideBy10WithCarry(&high, 0); + char carry = DivideBy10WithCarry(&high, 0); carry = DivideBy10WithCarry(&low, carry); *--p = carry + '0'; } @@ -373,13 +380,15 @@ // shifting. // Performs rounding if necessary to fit within `precision`. // Returns the pointer to one after the last character written. -char *PrintFractionalDigitsFast(uint64_t v, char *start, int exp, - int precision) { +char* PrintFractionalDigitsFast(uint64_t v, + char* start, + int exp, + size_t precision) { char *p = start; v <<= (64 - exp); while (precision > 0) { if (!v) return p; - *p++ = MultiplyBy10WithCarry(&v, uint64_t{0}) + '0'; + *p++ = MultiplyBy10WithCarry(&v, 0) + '0'; --precision; } @@ -393,8 +402,6 @@ RoundToEven(p - 1); } - assert(precision == 0); - // Precision can only be zero here. return p; } @@ -402,8 +409,10 @@ // after shifting. // Performs rounding if necessary to fit within `precision`. // Returns the pointer to one after the last character written. -char *PrintFractionalDigitsFast(uint128 v, char *start, int exp, - int precision) { +char* PrintFractionalDigitsFast(uint128 v, + char* start, + int exp, + size_t precision) { char *p = start; v <<= (128 - exp); auto high = static_cast<uint64_t>(v >> 64); @@ -412,7 +421,7 @@ // While we have digits to print and `low` is not empty, do the long // multiplication. while (precision > 0 && low != 0) { - uint64_t carry = MultiplyBy10WithCarry(&low, uint64_t{0}); + char carry = MultiplyBy10WithCarry(&low, 0); carry = MultiplyBy10WithCarry(&high, carry); *p++ = carry + '0'; @@ -424,7 +433,7 @@ // above. while (precision > 0) { if (!high) return p; - *p++ = MultiplyBy10WithCarry(&high, uint64_t{0}) + '0'; + *p++ = MultiplyBy10WithCarry(&high, 0) + '0'; --precision; } @@ -438,14 +447,12 @@ RoundToEven(p - 1); } - assert(precision == 0); - // Precision can only be zero here. return p; } struct FormatState { char sign_char; - int precision; + size_t precision; const FormatConversionSpecImpl &conv; FormatSinkImpl *sink; @@ -455,9 +462,9 @@ }; struct Padding { - int left_spaces; - int zeros; - int right_spaces; + size_t left_spaces; + size_t zeros; + size_t right_spaces; }; Padding ExtraWidthToPadding(size_t total_size, const FormatState &state) { @@ -465,7 +472,7 @@ static_cast<size_t>(state.conv.width()) <= total_size) { return {0, 0, 0}; } - int missing_chars = state.conv.width() - total_size; + size_t missing_chars = static_cast<size_t>(state.conv.width()) - total_size; if (state.conv.has_left_flag()) { return {0, 0, missing_chars}; } else if (state.conv.has_zero_flag()) { @@ -475,8 +482,10 @@ } } -void FinalPrint(const FormatState &state, absl::string_view data, - int padding_offset, int trailing_zeros, +void FinalPrint(const FormatState& state, + absl::string_view data, + size_t padding_offset, + size_t trailing_zeros, absl::string_view data_postfix) { if (state.conv.width() < 0) { // No width specified. Fast-path. @@ -487,10 +496,10 @@ return; } - auto padding = ExtraWidthToPadding((state.sign_char != '\0' ? 1 : 0) + - data.size() + data_postfix.size() + - static_cast<size_t>(trailing_zeros), - state); + auto padding = + ExtraWidthToPadding((state.sign_char != '\0' ? 1 : 0) + data.size() + + data_postfix.size() + trailing_zeros, + state); state.sink->Append(padding.left_spaces, ' '); if (state.sign_char != '\0') state.sink->Append(1, state.sign_char); @@ -547,15 +556,16 @@ if (integral_digits_start[-1] != '0') --integral_digits_start; } - size_t size = fractional_digits_end - integral_digits_start; + size_t size = + static_cast<size_t>(fractional_digits_end - integral_digits_start); // In `alt` mode (flag #) we keep the `.` even if there are no fractional // digits. In non-alt mode, we strip it. if (!state.ShouldPrintDot()) --size; FinalPrint(state, absl::string_view(integral_digits_start, size), /*padding_offset=*/0, - static_cast<int>(state.precision - (fractional_digits_end - - fractional_digits_start)), + state.precision - static_cast<size_t>(fractional_digits_end - + fractional_digits_start), /*data_postfix=*/""); } @@ -567,21 +577,22 @@ void FormatFPositiveExpSlow(uint128 v, int exp, const FormatState &state) { BinaryToDecimal::RunConversion(v, exp, [&](BinaryToDecimal btd) { const size_t total_digits = - btd.TotalDigits() + - (state.ShouldPrintDot() ? static_cast<size_t>(state.precision) + 1 : 0); + btd.TotalDigits() + (state.ShouldPrintDot() ? state.precision + 1 : 0); const auto padding = ExtraWidthToPadding( total_digits + (state.sign_char != '\0' ? 1 : 0), state); state.sink->Append(padding.left_spaces, ' '); - if (state.sign_char != '\0') state.sink->Append(1, state.sign_char); + if (state.sign_char != '\0') + state.sink->Append(1, state.sign_char); state.sink->Append(padding.zeros, '0'); do { state.sink->Append(btd.CurrentDigits()); } while (btd.AdvanceDigits()); - if (state.ShouldPrintDot()) state.sink->Append(1, '.'); + if (state.ShouldPrintDot()) + state.sink->Append(1, '.'); state.sink->Append(state.precision, '0'); state.sink->Append(padding.right_spaces, ' '); }); @@ -594,8 +605,7 @@ // digits. void FormatFNegativeExpSlow(uint128 v, int exp, const FormatState &state) { const size_t total_digits = - /* 0 */ 1 + - (state.ShouldPrintDot() ? static_cast<size_t>(state.precision) + 1 : 0); + /* 0 */ 1 + (state.ShouldPrintDot() ? state.precision + 1 : 0); auto padding = ExtraWidthToPadding(total_digits + (state.sign_char ? 1 : 0), state); padding.zeros += 1; @@ -606,7 +616,7 @@ if (state.ShouldPrintDot()) state.sink->Append(1, '.'); // Print digits - int digits_to_go = state.precision; + size_t digits_to_go = state.precision; FractionalDigitGenerator::RunConversion( v, exp, [&](FractionalDigitGenerator digit_gen) { @@ -666,7 +676,8 @@ template <typename Int> void FormatF(Int mantissa, int exp, const FormatState &state) { if (exp >= 0) { - const int total_bits = sizeof(Int) * 8 - LeadingZeros(mantissa) + exp; + const int total_bits = + static_cast<int>(sizeof(Int) * 8) - LeadingZeros(mantissa) + exp; // Fallback to the slow stack-based approach if we can't do it in a 64 or // 128 bit state. @@ -686,9 +697,9 @@ // Grab the group of four bits (nibble) from `n`. E.g., nibble 1 corresponds to // bits 4-7. template <typename Int> -uint8_t GetNibble(Int n, int nibble_index) { +uint8_t GetNibble(Int n, size_t nibble_index) { constexpr Int mask_low_nibble = Int{0xf}; - int shift = nibble_index * 4; + int shift = static_cast<int>(nibble_index * 4); n &= mask_low_nibble << shift; return static_cast<uint8_t>((n >> shift) & 0xf); } @@ -696,9 +707,9 @@ // Add one to the given nibble, applying carry to higher nibbles. Returns true // if overflow, false otherwise. template <typename Int> -bool IncrementNibble(int nibble_index, Int *n) { - constexpr int kShift = sizeof(Int) * 8 - 1; - constexpr int kNumNibbles = sizeof(Int) * 8 / 4; +bool IncrementNibble(size_t nibble_index, Int* n) { + constexpr size_t kShift = sizeof(Int) * 8 - 1; + constexpr size_t kNumNibbles = sizeof(Int) * 8 / 4; Int before = *n >> kShift; // Here we essentially want to take the number 1 and move it into the requsted // nibble, then add it to *n to effectively increment the nibble. However, @@ -706,28 +717,32 @@ // i.e., if the nibble_index is out of range. So therefore we check for this // and if we are out of range we just add 0 which leaves *n unchanged, which // seems like the reasonable thing to do in that case. - *n += ((nibble_index >= kNumNibbles) ? 0 : (Int{1} << (nibble_index * 4))); + *n += ((nibble_index >= kNumNibbles) + ? 0 + : (Int{1} << static_cast<int>(nibble_index * 4))); Int after = *n >> kShift; return (before && !after) || (nibble_index >= kNumNibbles); } // Return a mask with 1's in the given nibble and all lower nibbles. template <typename Int> -Int MaskUpToNibbleInclusive(int nibble_index) { - constexpr int kNumNibbles = sizeof(Int) * 8 / 4; +Int MaskUpToNibbleInclusive(size_t nibble_index) { + constexpr size_t kNumNibbles = sizeof(Int) * 8 / 4; static const Int ones = ~Int{0}; - return ones >> std::max(0, 4 * (kNumNibbles - nibble_index - 1)); + ++nibble_index; + return ones >> static_cast<int>( + 4 * (std::max(kNumNibbles, nibble_index) - nibble_index)); } // Return a mask with 1's below the given nibble. template <typename Int> -Int MaskUpToNibbleExclusive(int nibble_index) { - return nibble_index <= 0 ? 0 : MaskUpToNibbleInclusive<Int>(nibble_index - 1); +Int MaskUpToNibbleExclusive(size_t nibble_index) { + return nibble_index == 0 ? 0 : MaskUpToNibbleInclusive<Int>(nibble_index - 1); } template <typename Int> -Int MoveToNibble(uint8_t nibble, int nibble_index) { - return Int{nibble} << (4 * nibble_index); +Int MoveToNibble(uint8_t nibble, size_t nibble_index) { + return Int{nibble} << static_cast<int>(4 * nibble_index); } // Given mantissa size, find optimal # of mantissa bits to put in initial digit. @@ -744,10 +759,10 @@ // a multiple of four. Once again, the goal is to have all fractional digits // represent real precision. template <typename Float> -constexpr int HexFloatLeadingDigitSizeInBits() { +constexpr size_t HexFloatLeadingDigitSizeInBits() { return std::numeric_limits<Float>::digits % 4 > 0 - ? std::numeric_limits<Float>::digits % 4 - : 4; + ? static_cast<size_t>(std::numeric_limits<Float>::digits % 4) + : size_t{4}; } // This function captures the rounding behavior of glibc for hex float @@ -757,16 +772,17 @@ // point that is not followed by 800000..., it disregards the parity and rounds // up if > 8 and rounds down if < 8. template <typename Int> -bool HexFloatNeedsRoundUp(Int mantissa, int final_nibble_displayed, +bool HexFloatNeedsRoundUp(Int mantissa, + size_t final_nibble_displayed, uint8_t leading) { // If the last nibble (hex digit) to be displayed is the lowest on in the // mantissa then that means that we don't have any further nibbles to inform // rounding, so don't round. - if (final_nibble_displayed <= 0) { + if (final_nibble_displayed == 0) { return false; } - int rounding_nibble_idx = final_nibble_displayed - 1; - constexpr int kTotalNibbles = sizeof(Int) * 8 / 4; + size_t rounding_nibble_idx = final_nibble_displayed - 1; + constexpr size_t kTotalNibbles = sizeof(Int) * 8 / 4; assert(final_nibble_displayed <= kTotalNibbles); Int mantissa_up_to_rounding_nibble_inclusive = mantissa & MaskUpToNibbleInclusive<Int>(rounding_nibble_idx); @@ -793,7 +809,7 @@ } int min_exponent; - int leading_digit_size_bits; + size_t leading_digit_size_bits; }; // Hex Float Rounding. First check if we need to round; if so, then we do that @@ -803,10 +819,12 @@ template <typename Int> void FormatARound(bool precision_specified, const FormatState &state, uint8_t *leading, Int *mantissa, int *exp) { - constexpr int kTotalNibbles = sizeof(Int) * 8 / 4; + constexpr size_t kTotalNibbles = sizeof(Int) * 8 / 4; // Index of the last nibble that we could display given precision. - int final_nibble_displayed = - precision_specified ? std::max(0, (kTotalNibbles - state.precision)) : 0; + size_t final_nibble_displayed = + precision_specified + ? (std::max(kTotalNibbles, state.precision) - state.precision) + : 0; if (HexFloatNeedsRoundUp(*mantissa, final_nibble_displayed, *leading)) { // Need to round up. bool overflow = IncrementNibble(final_nibble_displayed, mantissa); @@ -830,9 +848,9 @@ template <typename Int> void FormatANormalize(const HexFloatTypeParams float_traits, uint8_t *leading, Int *mantissa, int *exp) { - constexpr int kIntBits = sizeof(Int) * 8; + constexpr size_t kIntBits = sizeof(Int) * 8; static const Int kHighIntBit = Int{1} << (kIntBits - 1); - const int kLeadDigitBitsCount = float_traits.leading_digit_size_bits; + const size_t kLeadDigitBitsCount = float_traits.leading_digit_size_bits; // Normalize mantissa so that highest bit set is in MSB position, unless we // get interrupted by the exponent threshold. while (*mantissa && !(*mantissa & kHighIntBit)) { @@ -846,18 +864,18 @@ } // Extract bits for leading digit then shift them away leaving the // fractional part. - *leading = - static_cast<uint8_t>(*mantissa >> (kIntBits - kLeadDigitBitsCount)); - *exp -= (*mantissa != 0) ? kLeadDigitBitsCount : *exp; - *mantissa <<= kLeadDigitBitsCount; + *leading = static_cast<uint8_t>( + *mantissa >> static_cast<int>(kIntBits - kLeadDigitBitsCount)); + *exp -= (*mantissa != 0) ? static_cast<int>(kLeadDigitBitsCount) : *exp; + *mantissa <<= static_cast<int>(kLeadDigitBitsCount); } template <typename Int> void FormatA(const HexFloatTypeParams float_traits, Int mantissa, int exp, bool uppercase, const FormatState &state) { // Int properties. - constexpr int kIntBits = sizeof(Int) * 8; - constexpr int kTotalNibbles = sizeof(Int) * 8 / 4; + constexpr size_t kIntBits = sizeof(Int) * 8; + constexpr size_t kTotalNibbles = sizeof(Int) * 8 / 4; // Did the user specify a precision explicitly? const bool precision_specified = state.conv.precision() >= 0; @@ -903,16 +921,19 @@ } // ============ Fractional Digits ============ - int digits_emitted = 0; + size_t digits_emitted = 0; while (mantissa > 0) { *digits_iter++ = digits[GetNibble(mantissa, kTotalNibbles - 1)]; mantissa <<= 4; ++digits_emitted; } - int trailing_zeros = - precision_specified ? state.precision - digits_emitted : 0; - assert(trailing_zeros >= 0); - auto digits_result = string_view(digits_buffer, digits_iter - digits_buffer); + size_t trailing_zeros = 0; + if (precision_specified) { + assert(state.precision >= digits_emitted); + trailing_zeros = state.precision - digits_emitted; + } + auto digits_result = string_view( + digits_buffer, static_cast<size_t>(digits_iter - digits_buffer)); // =============== Exponent ================== constexpr size_t kBufSizeForExpDecRepr = @@ -925,11 +946,11 @@ numbers_internal::FastIntToBuffer(exp < 0 ? -exp : exp, exp_buffer + 2); // ============ Assemble Result ============== - FinalPrint(state, // - digits_result, // 0xN.NNN... - 2, // offset in `data` to start padding if needed. - trailing_zeros, // num remaining mantissa padding zeros - exp_buffer); // exponent + FinalPrint(state, + digits_result, // 0xN.NNN... + 2, // offset of any padding + static_cast<size_t>(trailing_zeros), // remaining mantissa padding + exp_buffer); // exponent } char *CopyStringTo(absl::string_view v, char *out) { @@ -961,10 +982,10 @@ int n = snprintf(&space[0], space.size(), fmt, w, p, v); if (n < 0) return false; if (static_cast<size_t>(n) < space.size()) { - result = absl::string_view(space.data(), n); + result = absl::string_view(space.data(), static_cast<size_t>(n)); break; } - space.resize(n + 1); + space.resize(static_cast<size_t>(n) + 1); } sink->Append(result); return true; @@ -972,13 +993,13 @@ // 128-bits in decimal: ceil(128*log(2)/log(10)) // or std::numeric_limits<__uint128_t>::digits10 -constexpr int kMaxFixedPrecision = 39; +constexpr size_t kMaxFixedPrecision = 39; -constexpr int kBufferLength = /*sign*/ 1 + - /*integer*/ kMaxFixedPrecision + - /*point*/ 1 + - /*fraction*/ kMaxFixedPrecision + - /*exponent e+123*/ 5; +constexpr size_t kBufferLength = /*sign*/ 1 + + /*integer*/ kMaxFixedPrecision + + /*point*/ 1 + + /*fraction*/ kMaxFixedPrecision + + /*exponent e+123*/ 5; struct Buffer { void push_front(char c) { @@ -1001,7 +1022,7 @@ char last_digit() const { return end[-1] == '.' ? end[-2] : end[-1]; } - int size() const { return static_cast<int>(end - begin); } + size_t size() const { return static_cast<size_t>(end - begin); } char data[kBufferLength]; char *begin; @@ -1030,8 +1051,9 @@ return false; } - return sink->PutPaddedString(string_view(text, ptr - text), conv.width(), -1, - conv.has_left_flag()); + return sink->PutPaddedString( + string_view(text, static_cast<size_t>(ptr - text)), conv.width(), -1, + conv.has_left_flag()); } // Round up the last digit of the value. @@ -1068,11 +1090,11 @@ } // Exponent digits. if (exp > 99) { - out->push_back(exp / 100 + '0'); + out->push_back(static_cast<char>(exp / 100) + '0'); out->push_back(exp / 10 % 10 + '0'); out->push_back(exp % 10 + '0'); } else { - out->push_back(exp / 10 + '0'); + out->push_back(static_cast<char>(exp / 10) + '0'); out->push_back(exp % 10 + '0'); } } @@ -1115,8 +1137,8 @@ // In Fixed mode, we add a '.' at the end. // In Precision mode, we add a '.' after the first digit. template <FormatStyle mode, typename Int> -int PrintIntegralDigits(Int digits, Buffer *out) { - int printed = 0; +size_t PrintIntegralDigits(Int digits, Buffer* out) { + size_t printed = 0; if (digits) { for (; digits; digits /= 10) out->push_front(digits % 10 + '0'); printed = out->size(); @@ -1135,10 +1157,10 @@ } // Back out 'extra_digits' digits and round up if necessary. -bool RemoveExtraPrecision(int extra_digits, bool has_leftover_value, - Buffer *out, int *exp_out) { - if (extra_digits <= 0) return false; - +void RemoveExtraPrecision(size_t extra_digits, + bool has_leftover_value, + Buffer* out, + int* exp_out) { // Back out the extra digits out->end -= extra_digits; @@ -1158,15 +1180,17 @@ if (needs_to_round_up) { RoundUp<FormatStyle::Precision>(out, exp_out); } - return true; } // Print the value into the buffer. // This will not include the exponent, which will be returned in 'exp_out' for // Precision mode. template <typename Int, typename Float, FormatStyle mode> -bool FloatToBufferImpl(Int int_mantissa, int exp, int precision, Buffer *out, - int *exp_out) { +bool FloatToBufferImpl(Int int_mantissa, + int exp, + size_t precision, + Buffer* out, + int* exp_out) { assert((CanFitMantissa<Float, Int>())); const int int_bits = std::numeric_limits<Int>::digits; @@ -1182,14 +1206,16 @@ // The value will overflow the Int return false; } - int digits_printed = PrintIntegralDigits<mode>(int_mantissa << exp, out); - int digits_to_zero_pad = precision; + size_t digits_printed = PrintIntegralDigits<mode>(int_mantissa << exp, out); + size_t digits_to_zero_pad = precision; if (mode == FormatStyle::Precision) { - *exp_out = digits_printed - 1; - digits_to_zero_pad -= digits_printed - 1; - if (RemoveExtraPrecision(-digits_to_zero_pad, false, out, exp_out)) { + *exp_out = static_cast<int>(digits_printed - 1); + if (digits_to_zero_pad < digits_printed - 1) { + RemoveExtraPrecision(digits_printed - 1 - digits_to_zero_pad, false, + out, exp_out); return true; } + digits_to_zero_pad -= digits_printed - 1; } for (; digits_to_zero_pad-- > 0;) out->push_back('0'); return true; @@ -1203,10 +1229,10 @@ const Int mask = (Int{1} << exp) - 1; // Print the integral part first. - int digits_printed = PrintIntegralDigits<mode>(int_mantissa >> exp, out); + size_t digits_printed = PrintIntegralDigits<mode>(int_mantissa >> exp, out); int_mantissa &= mask; - int fractional_count = precision; + size_t fractional_count = precision; if (mode == FormatStyle::Precision) { if (digits_printed == 0) { // Find the first non-zero digit, when in Precision mode. @@ -1222,20 +1248,21 @@ int_mantissa &= mask; } else { // We already have a digit, and a '.' - *exp_out = digits_printed - 1; - fractional_count -= *exp_out; - if (RemoveExtraPrecision(-fractional_count, int_mantissa != 0, out, - exp_out)) { + *exp_out = static_cast<int>(digits_printed - 1); + if (fractional_count < digits_printed - 1) { // If we had enough digits, return right away. // The code below will try to round again otherwise. + RemoveExtraPrecision(digits_printed - 1 - fractional_count, + int_mantissa != 0, out, exp_out); return true; } + fractional_count -= digits_printed - 1; } } auto get_next_digit = [&] { int_mantissa *= 10; - int digit = static_cast<int>(int_mantissa >> exp); + char digit = static_cast<char>(int_mantissa >> exp); int_mantissa &= mask; return digit; }; @@ -1245,7 +1272,7 @@ out->push_back(get_next_digit() + '0'); } - int next_digit = get_next_digit(); + char next_digit = get_next_digit(); if (next_digit > 5 || (next_digit == 5 && (int_mantissa || out->last_digit() % 2 == 1))) { RoundUp<mode>(out, exp_out); @@ -1255,24 +1282,25 @@ } template <FormatStyle mode, typename Float> -bool FloatToBuffer(Decomposed<Float> decomposed, int precision, Buffer *out, - int *exp) { +bool FloatToBuffer(Decomposed<Float> decomposed, + size_t precision, + Buffer* out, + int* exp) { if (precision > kMaxFixedPrecision) return false; // Try with uint64_t. if (CanFitMantissa<Float, std::uint64_t>() && FloatToBufferImpl<std::uint64_t, Float, mode>( - static_cast<std::uint64_t>(decomposed.mantissa), - static_cast<std::uint64_t>(decomposed.exponent), precision, out, exp)) + static_cast<std::uint64_t>(decomposed.mantissa), decomposed.exponent, + precision, out, exp)) return true; #if defined(ABSL_HAVE_INTRINSIC_INT128) // If that is not enough, try with __uint128_t. return CanFitMantissa<Float, __uint128_t>() && FloatToBufferImpl<__uint128_t, Float, mode>( - static_cast<__uint128_t>(decomposed.mantissa), - static_cast<__uint128_t>(decomposed.exponent), precision, out, - exp); + static_cast<__uint128_t>(decomposed.mantissa), decomposed.exponent, + precision, out, exp); #endif return false; } @@ -1280,12 +1308,15 @@ void WriteBufferToSink(char sign_char, absl::string_view str, const FormatConversionSpecImpl &conv, FormatSinkImpl *sink) { - int left_spaces = 0, zeros = 0, right_spaces = 0; - int missing_chars = - conv.width() >= 0 ? std::max(conv.width() - static_cast<int>(str.size()) - - static_cast<int>(sign_char != 0), - 0) - : 0; + size_t left_spaces = 0, zeros = 0, right_spaces = 0; + size_t missing_chars = 0; + if (conv.width() >= 0) { + const size_t conv_width_size_t = static_cast<size_t>(conv.width()); + const size_t existing_chars = + str.size() + static_cast<size_t>(sign_char != 0); + if (conv_width_size_t > existing_chars) + missing_chars = conv_width_size_t - existing_chars; + } if (conv.has_left_flag()) { right_spaces = missing_chars; } else if (conv.has_zero_flag()) { @@ -1321,7 +1352,8 @@ return true; } - int precision = conv.precision() < 0 ? 6 : conv.precision(); + size_t precision = + conv.precision() < 0 ? 6 : static_cast<size_t>(conv.precision()); int exp = 0; @@ -1348,12 +1380,12 @@ &buffer); } else if (c == FormatConversionCharInternal::g || c == FormatConversionCharInternal::G) { - precision = std::max(0, precision - 1); + precision = std::max(precision, size_t{1}) - 1; if (!FloatToBuffer<FormatStyle::Precision>(decomposed, precision, &buffer, &exp)) { return FallbackToSnprintf(v, conv, sink); } - if (precision + 1 > exp && exp >= -4) { + if ((exp < 0 || precision + 1 > static_cast<size_t>(exp)) && exp >= -4) { if (exp < 0) { // Have 1.23456, needs 0.00123456 // Move the first digit @@ -1388,9 +1420,11 @@ return false; } - WriteBufferToSink(sign_char, - absl::string_view(buffer.begin, buffer.end - buffer.begin), - conv, sink); + WriteBufferToSink( + sign_char, + absl::string_view(buffer.begin, + static_cast<size_t>(buffer.end - buffer.begin)), + conv, sink); return true; }
diff --git a/third_party/abseil-cpp/absl/strings/numbers.cc b/third_party/abseil-cpp/absl/strings/numbers.cc index e798fc6..2987158e 100644 --- a/third_party/abseil-cpp/absl/strings/numbers.cc +++ b/third_party/abseil-cpp/absl/strings/numbers.cc
@@ -190,32 +190,32 @@ if (i >= 1000) goto lt10_000; digits = i / 100; i -= digits * 100; - *buffer++ = '0' + digits; + *buffer++ = '0' + static_cast<char>(digits); goto lt100; } if (i < 1000000) { // 1,000,000 if (i >= 100000) goto lt1_000_000; digits = i / 10000; // 10,000 i -= digits * 10000; - *buffer++ = '0' + digits; + *buffer++ = '0' + static_cast<char>(digits); goto lt10_000; } if (i < 100000000) { // 100,000,000 if (i >= 10000000) goto lt100_000_000; digits = i / 1000000; // 1,000,000 i -= digits * 1000000; - *buffer++ = '0' + digits; + *buffer++ = '0' + static_cast<char>(digits); goto lt1_000_000; } // we already know that i < 1,000,000,000 digits = i / 100000000; // 100,000,000 i -= digits * 100000000; - *buffer++ = '0' + digits; + *buffer++ = '0' + static_cast<char>(digits); goto lt100_000_000; } char* numbers_internal::FastIntToBuffer(int32_t i, char* buffer) { - uint32_t u = i; + uint32_t u = static_cast<uint32_t>(i); if (i < 0) { *buffer++ = '-'; // We need to do the negation in modular (i.e., "unsigned") @@ -268,7 +268,7 @@ } char* numbers_internal::FastIntToBuffer(int64_t i, char* buffer) { - uint64_t u = i; + uint64_t u = static_cast<uint64_t>(i); if (i < 0) { *buffer++ = '-'; u = 0 - u; @@ -329,7 +329,7 @@ result = Mul32(result, 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5 * 5); expfive -= 13; } - constexpr int powers_of_five[13] = { + constexpr uint32_t powers_of_five[13] = { 1, 5, 5 * 5, @@ -404,14 +404,14 @@ // we multiply it by 65536 and see if the fractional part is close to 32768. // (The number doesn't have to be a power of two,but powers of two are faster) uint64_t d64k = d * 65536; - int dddddd; // A 6-digit decimal integer. + uint32_t dddddd; // A 6-digit decimal integer. if ((d64k % 65536) == 32767 || (d64k % 65536) == 32768) { // OK, it's fairly likely that precision was lost above, which is // not a surprise given only 52 mantissa bits are available. Therefore // redo the calculation using 128-bit numbers. (64 bits are not enough). // Start out with digits rounded down; maybe add one below. - dddddd = static_cast<int>(d64k / 65536); + dddddd = static_cast<uint32_t>(d64k / 65536); // mantissa is a 64-bit integer representing M.mmm... * 2^63. The actual // value we're representing, of course, is M.mmm... * 2^exp2. @@ -461,7 +461,7 @@ } } else { // Here, we are not close to the edge. - dddddd = static_cast<int>((d64k + 32768) / 65536); + dddddd = static_cast<uint32_t>((d64k + 32768) / 65536); } if (dddddd == 1000000) { dddddd = 100000; @@ -469,7 +469,7 @@ } exp_dig.exponent = exp; - int two_digits = dddddd / 10000; + uint32_t two_digits = dddddd / 10000; dddddd -= two_digits * 10000; numbers_internal::PutTwoDigits(two_digits, &exp_dig.digits[0]); @@ -499,7 +499,7 @@ if (std::signbit(d)) *out++ = '-'; *out++ = '0'; *out = 0; - return out - buffer; + return static_cast<size_t>(out - buffer); } if (d < 0) { *out++ = '-'; @@ -507,7 +507,7 @@ } if (d > std::numeric_limits<double>::max()) { strcpy(out, "inf"); // NOLINT(runtime/printf) - return out + 3 - buffer; + return static_cast<size_t>(out + 3 - buffer); } auto exp_dig = SplitToSix(d); @@ -519,7 +519,7 @@ case 5: memcpy(out, &digits[0], 6), out += 6; *out = 0; - return out - buffer; + return static_cast<size_t>(out - buffer); case 4: memcpy(out, &digits[0], 5), out += 5; if (digits[5] != '0') { @@ -527,7 +527,7 @@ *out++ = digits[5]; } *out = 0; - return out - buffer; + return static_cast<size_t>(out - buffer); case 3: memcpy(out, &digits[0], 4), out += 4; if ((digits[5] | digits[4]) != '0') { @@ -536,7 +536,7 @@ if (digits[5] != '0') *out++ = digits[5]; } *out = 0; - return out - buffer; + return static_cast<size_t>(out - buffer); case 2: memcpy(out, &digits[0], 3), out += 3; *out++ = '.'; @@ -545,7 +545,7 @@ while (out[-1] == '0') --out; if (out[-1] == '.') --out; *out = 0; - return out - buffer; + return static_cast<size_t>(out - buffer); case 1: memcpy(out, &digits[0], 2), out += 2; *out++ = '.'; @@ -554,7 +554,7 @@ while (out[-1] == '0') --out; if (out[-1] == '.') --out; *out = 0; - return out - buffer; + return static_cast<size_t>(out - buffer); case 0: memcpy(out, &digits[0], 1), out += 1; *out++ = '.'; @@ -563,7 +563,7 @@ while (out[-1] == '0') --out; if (out[-1] == '.') --out; *out = 0; - return out - buffer; + return static_cast<size_t>(out - buffer); case -4: out[2] = '0'; ++out; @@ -582,7 +582,7 @@ out += 6; while (out[-1] == '0') --out; *out = 0; - return out - buffer; + return static_cast<size_t>(out - buffer); } assert(exp < -4 || exp >= 6); out[0] = digits[0]; @@ -601,12 +601,12 @@ if (exp > 99) { int dig1 = exp / 100; exp -= dig1 * 100; - *out++ = '0' + dig1; + *out++ = '0' + static_cast<char>(dig1); } - PutTwoDigits(exp, out); + PutTwoDigits(static_cast<uint32_t>(exp), out); out += 2; *out = 0; - return out - buffer; + return static_cast<size_t>(out - buffer); } namespace { @@ -642,10 +642,12 @@ int base = *base_ptr; // Consume whitespace. - while (start < end && absl::ascii_isspace(start[0])) { + while (start < end && + absl::ascii_isspace(static_cast<unsigned char>(start[0]))) { ++start; } - while (start < end && absl::ascii_isspace(end[-1])) { + while (start < end && + absl::ascii_isspace(static_cast<unsigned char>(end[-1]))) { --end; } if (start >= end) { @@ -694,7 +696,7 @@ } else { return false; } - *text = absl::string_view(start, end - start); + *text = absl::string_view(start, static_cast<size_t>(end - start)); *base_ptr = base; return true; } @@ -920,17 +922,18 @@ const IntType vmax = std::numeric_limits<IntType>::max(); assert(vmax > 0); assert(base >= 0); - assert(vmax >= static_cast<IntType>(base)); + const IntType base_inttype = static_cast<IntType>(base); + assert(vmax >= base_inttype); const IntType vmax_over_base = LookupTables<IntType>::kVmaxOverBase[base]; assert(base < 2 || - std::numeric_limits<IntType>::max() / base == vmax_over_base); + std::numeric_limits<IntType>::max() / base_inttype == vmax_over_base); const char* start = text.data(); const char* end = start + text.size(); // loop over digits for (; start < end; ++start) { unsigned char c = static_cast<unsigned char>(start[0]); - int digit = kAsciiToInt[c]; - if (digit >= base) { + IntType digit = static_cast<IntType>(kAsciiToInt[c]); + if (digit >= base_inttype) { *value_p = value; return false; } @@ -938,7 +941,7 @@ *value_p = vmax; return false; } - value *= base; + value *= base_inttype; if (value > vmax - digit) { *value_p = vmax; return false;
diff --git a/third_party/abseil-cpp/absl/strings/str_cat.cc b/third_party/abseil-cpp/absl/strings/str_cat.cc index f4a7749..2f9df67 100644 --- a/third_party/abseil-cpp/absl/strings/str_cat.cc +++ b/third_party/abseil-cpp/absl/strings/str_cat.cc
@@ -56,7 +56,7 @@ *--writer = '0' + (value % 10); value /= 10; } - *--writer = '0' + value; + *--writer = '0' + static_cast<char>(value); if (neg) *--writer = '-'; ptrdiff_t fillers = writer - minfill; @@ -73,7 +73,7 @@ if (add_sign_again) *--writer = '-'; } - piece_ = absl::string_view(writer, end - writer); + piece_ = absl::string_view(writer, static_cast<size_t>(end - writer)); } // ----------------------------------------------------------------------
diff --git a/third_party/abseil-cpp/absl/strings/string_view.cc b/third_party/abseil-cpp/absl/strings/string_view.cc index adce3be9..e2261625 100644 --- a/third_party/abseil-cpp/absl/strings/string_view.cc +++ b/third_party/abseil-cpp/absl/strings/string_view.cc
@@ -32,7 +32,7 @@ memset(fill_buf, o.fill(), sizeof(fill_buf)); while (pad) { size_t n = std::min(pad, sizeof(fill_buf)); - o.write(fill_buf, n); + o.write(fill_buf, static_cast<std::streamsize>(n)); pad -= n; } } @@ -63,7 +63,7 @@ size_t lpad = 0; size_t rpad = 0; if (static_cast<size_t>(o.width()) > piece.size()) { - size_t pad = o.width() - piece.size(); + size_t pad = static_cast<size_t>(o.width()) - piece.size(); if ((o.flags() & o.adjustfield) == o.left) { rpad = pad; } else { @@ -71,7 +71,7 @@ } } if (lpad) WritePadding(o, lpad); - o.write(piece.data(), piece.size()); + o.write(piece.data(), static_cast<std::streamsize>(piece.size())); if (rpad) WritePadding(o, rpad); o.width(0); } @@ -86,7 +86,7 @@ } const char* result = strings_internal::memmatch(ptr_ + pos, length_ - pos, s.ptr_, s.length_); - return result ? result - ptr_ : npos; + return result ? static_cast<size_type>(result - ptr_) : npos; } string_view::size_type string_view::find(char c, size_type pos) const noexcept { @@ -95,7 +95,7 @@ } const char* result = static_cast<const char*>(memchr(ptr_ + pos, c, length_ - pos)); - return result != nullptr ? result - ptr_ : npos; + return result != nullptr ? static_cast<size_type>(result - ptr_) : npos; } string_view::size_type string_view::rfind(string_view s, @@ -104,7 +104,7 @@ if (s.empty()) return std::min(length_, pos); const char* last = ptr_ + std::min(length_ - s.length_, pos) + s.length_; const char* result = std::find_end(ptr_, last, s.ptr_, s.ptr_ + s.length_); - return result != last ? result - ptr_ : npos; + return result != last ? static_cast<size_type>(result - ptr_) : npos; } // Search range is [0..pos] inclusive. If pos == npos, search everything.
diff --git a/third_party/abseil-cpp/absl/strings/substitute.cc b/third_party/abseil-cpp/absl/strings/substitute.cc index 8980b19..33a3930 100644 --- a/third_party/abseil-cpp/absl/strings/substitute.cc +++ b/third_party/abseil-cpp/absl/strings/substitute.cc
@@ -40,7 +40,8 @@ absl::CEscape(format).c_str()); #endif return; - } else if (absl::ascii_isdigit(format[i + 1])) { + } else if (absl::ascii_isdigit( + static_cast<unsigned char>(format[i + 1]))) { int index = format[i + 1] - '0'; if (static_cast<size_t>(index) >= num_args) { #ifndef NDEBUG @@ -80,7 +81,7 @@ char* target = &(*output)[original_size]; for (size_t i = 0; i < format.size(); i++) { if (format[i] == '$') { - if (absl::ascii_isdigit(format[i + 1])) { + if (absl::ascii_isdigit(static_cast<unsigned char>(format[i + 1]))) { const absl::string_view src = args_array[format[i + 1] - '0']; target = std::copy(src.begin(), src.end(), target); ++i; // Skip next char. @@ -110,7 +111,8 @@ } while (num != 0); *--ptr = 'x'; *--ptr = '0'; - piece_ = absl::string_view(ptr, scratch_ + sizeof(scratch_) - ptr); + piece_ = absl::string_view( + ptr, static_cast<size_t>(scratch_ + sizeof(scratch_) - ptr)); } } @@ -132,7 +134,7 @@ beg = writer; } - piece_ = absl::string_view(beg, end - beg); + piece_ = absl::string_view(beg, static_cast<size_t>(end - beg)); } // TODO(jorg): Don't duplicate so much code between here and str_cat.cc @@ -147,7 +149,7 @@ *--writer = '0' + (value % 10); value /= 10; } - *--writer = '0' + value; + *--writer = '0' + static_cast<char>(value); if (neg) *--writer = '-'; ptrdiff_t fillers = writer - minfill; @@ -164,7 +166,7 @@ if (add_sign_again) *--writer = '-'; } - piece_ = absl::string_view(writer, end - writer); + piece_ = absl::string_view(writer, static_cast<size_t>(end - writer)); } } // namespace substitute_internal
diff --git a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/version b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/version index 7c9f279d..ea174469 100644 --- a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/version +++ b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/version
@@ -1 +1 @@ -2022b +2022c-1-gaca1a70
diff --git a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Africa/Freetown b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Africa/Freetown index edc5e17..8431ed6 100644 --- a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Africa/Freetown +++ b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Africa/Freetown Binary files differ
diff --git a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Pacific/Midway b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Pacific/Midway index f5a0aa9..b25364c 100644 --- a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Pacific/Midway +++ b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Pacific/Midway Binary files differ
diff --git a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Pacific/Saipan b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Pacific/Saipan index d72e72f..9539353 100644 --- a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Pacific/Saipan +++ b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/Pacific/Saipan Binary files differ
diff --git a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab index 3e1948cb..19515f7a 100644 --- a/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab +++ b/third_party/abseil-cpp/absl/time/internal/cctz/testdata/zoneinfo/zone1970.tab
@@ -351,3 +351,27 @@ VU -1740+16825 Pacific/Efate WS -1350-17144 Pacific/Apia ZA,LS,SZ -2615+02800 Africa/Johannesburg +# +# The next section contains experimental tab-separated comments for +# use by user agents like tzselect that identify continents and oceans. +# +# For example, the comment "#@AQ<tab>Antarctica/" means the country code +# AQ is in the continent Antarctica regardless of the Zone name, +# so Pacific/Auckland should be listed under Antarctica as well as +# under the Pacific because its line's country codes include AQ. +# +# If more than one country code is affected each is listed separated +# by commas, e.g., #@IS,SH<tab>Atlantic/". If a country code is in +# more than one continent or ocean, each is listed separated by +# commas, e.g., the second column of "#@CY,TR<tab>Asia/,Europe/". +# +# These experimental comments are present only for country codes where +# the continent or ocean is not already obvious from the Zone name. +# For example, there is no such comment for RU since it already +# corresponds to Zone names starting with both "Europe/" and "Asia/". +# +#@AQ Antarctica/ +#@IS,SH Atlantic/ +#@CY,TR Asia/,Europe/ +#@SJ Arctic/ +#@CC,CX,KM,MG,YT Indian/
diff --git a/third_party/abseil-cpp/absl/time/time.h b/third_party/abseil-cpp/absl/time/time.h index bd01867..11796b4 100644 --- a/third_party/abseil-cpp/absl/time/time.h +++ b/third_party/abseil-cpp/absl/time/time.h
@@ -495,7 +495,7 @@ ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Minutes(Duration d); ABSL_ATTRIBUTE_PURE_FUNCTION int64_t ToInt64Hours(Duration d); -// ToDoubleNanoSeconds() +// ToDoubleNanoseconds() // ToDoubleMicroseconds() // ToDoubleMilliseconds() // ToDoubleSeconds()
diff --git a/third_party/abseil-cpp/conanfile.py b/third_party/abseil-cpp/conanfile.py index 926ec5c..4bbc62ee 100755 --- a/third_party/abseil-cpp/conanfile.py +++ b/third_party/abseil-cpp/conanfile.py
@@ -30,7 +30,7 @@ raise ConanInvalidConfiguration("Abseil does not support MSVC < 14") def build(self): - tools.replace_in_file("CMakeLists.txt", "project(absl CXX)", "project(absl CXX)\ninclude(conanbuildinfo.cmake)\nconan_basic_setup()") + tools.replace_in_file("CMakeLists.txt", "project(absl LANGUAGES CXX)", "project(absl LANGUAGES CXX)\ninclude(conanbuildinfo.cmake)\nconan_basic_setup()") cmake = CMake(self) cmake.definitions["BUILD_TESTING"] = False cmake.configure()
diff --git a/third_party/abseil-cpp/symbols_arm64_dbg.def b/third_party/abseil-cpp/symbols_arm64_dbg.def index 6a5ae63a..f8693f8 100644 --- a/third_party/abseil-cpp/symbols_arm64_dbg.def +++ b/third_party/abseil-cpp/symbols_arm64_dbg.def
@@ -626,7 +626,7 @@ ??$assign@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@?$optional_data_base@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@optional_internal@absl@@IEAAX$$QEAV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@Z ??$bit_cast@_J_K$0A@@absl@@YA_JAEB_K@Z ??$bit_cast@_K_J$0A@@absl@@YA_KAEB_J@Z - ??$bit_width@_K@absl@@YA_K_K@Z + ??$bit_width@_K@absl@@YAH_K@Z ??$call_once@A6AXXZ$$V@absl@@YAXAEAVonce_flag@0@A6AXXZ@Z ??$construct@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEBQEAPEBV12345@@?$allocator@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@QEAAXPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEBQEAPEBV34567@@Z ??$construct@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEBQEAPEBV12345@X@?$allocator_traits@V?$allocator@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@Cr@std@@SAXAEAV?$allocator@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@12@PEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEBQEAPEBV45678@@Z @@ -1313,8 +1313,10 @@ ??BCord@absl@@QEBA?AV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@XZ ??BCordRepBtreeReader@cord_internal@absl@@QEBA_NXZ ??BTimeZone@absl@@QEBA?AVtime_zone@cctz@time_internal@1@XZ - ??Bint128@absl@@QEBAEXZ + ??Bint128@absl@@QEBADXZ ??Bint128@absl@@QEBANXZ + ??Bint128@absl@@QEBA_JXZ + ??Buint128@absl@@QEBADXZ ??Buint128@absl@@QEBAEXZ ??Buint128@absl@@QEBAIXZ ??Buint128@absl@@QEBANXZ @@ -1769,7 +1771,7 @@ ?Fill@?$RandenPool@G@random_internal@absl@@SAXV?$Span@G@3@@Z ?Fill@?$RandenPool@I@random_internal@absl@@SAXV?$Span@I@3@@Z ?Fill@?$RandenPool@_K@random_internal@absl@@SAXV?$Span@_K@3@@Z - ?FillParentStack@CordzInfo@cord_internal@absl@@CAHPEBV123@PEAPEAX@Z + ?FillParentStack@CordzInfo@cord_internal@absl@@CA_KPEBV123@PEAPEAX@Z ?Find@ByAnyChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByLength@absl@@QEBA?AVstring_view@2@V32@_K@Z @@ -1856,7 +1858,7 @@ ?Generate@Randen@random_internal@absl@@QEBAXPEAX@Z ?Generate@RandenHwAes@random_internal@absl@@SAXPEBXPEAX@Z ?Generate@RandenSlow@random_internal@absl@@SAXPEBXPEAX@Z - ?Get@RefcountAndFlags@cord_internal@absl@@QEBAHXZ + ?Get@RefcountAndFlags@cord_internal@absl@@QEBA_KXZ ?GetAllocatedCapacity@?$Storage@H$0CP@V?$allocator@H@Cr@std@@@inlined_vector_internal@absl@@QEBA_KXZ ?GetAllocatedCapacity@?$Storage@PEAUCordRep@cord_internal@absl@@$01V?$allocator@PEAUCordRep@cord_internal@absl@@@Cr@std@@@inlined_vector_internal@absl@@QEBA_KXZ ?GetAllocatedCapacity@?$Storage@PEAUCordRep@cord_internal@absl@@$0CP@V?$allocator@PEAUCordRep@cord_internal@absl@@@Cr@std@@@inlined_vector_internal@absl@@QEBA_KXZ
diff --git a/third_party/abseil-cpp/symbols_arm64_rel.def b/third_party/abseil-cpp/symbols_arm64_rel.def index 194817a..e5e5976 100644 --- a/third_party/abseil-cpp/symbols_arm64_rel.def +++ b/third_party/abseil-cpp/symbols_arm64_rel.def
@@ -400,7 +400,7 @@ ?Fill@?$RandenPool@G@random_internal@absl@@SAXV?$Span@G@3@@Z ?Fill@?$RandenPool@I@random_internal@absl@@SAXV?$Span@I@3@@Z ?Fill@?$RandenPool@_K@random_internal@absl@@SAXV?$Span@_K@3@@Z - ?FillParentStack@CordzInfo@cord_internal@absl@@CAHPEBV123@PEAPEAX@Z + ?FillParentStack@CordzInfo@cord_internal@absl@@CA_KPEBV123@PEAPEAX@Z ?Find@ByAnyChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByLength@absl@@QEBA?AVstring_view@2@V32@_K@Z
diff --git a/third_party/abseil-cpp/symbols_x64_dbg.def b/third_party/abseil-cpp/symbols_x64_dbg.def index d919611..d25ace8 100644 --- a/third_party/abseil-cpp/symbols_x64_dbg.def +++ b/third_party/abseil-cpp/symbols_x64_dbg.def
@@ -628,8 +628,8 @@ ??$bit_cast@N_K$0A@@absl@@YANAEB_K@Z ??$bit_cast@_J_K$0A@@absl@@YA_JAEB_K@Z ??$bit_cast@_K_J$0A@@absl@@YA_KAEB_J@Z - ??$bit_width@I@absl@@YAII@Z - ??$bit_width@_K@absl@@YA_K_K@Z + ??$bit_width@I@absl@@YAHI@Z + ??$bit_width@_K@absl@@YAH_K@Z ??$call_once@A6AXXZ$$V@absl@@YAXAEAVonce_flag@0@A6AXXZ@Z ??$construct@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEBQEAPEBV12345@@?$allocator@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@QEAAXPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEBQEAPEBV34567@@Z ??$construct@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEBQEAPEBV12345@X@?$allocator_traits@V?$allocator@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@Cr@std@@SAXAEAV?$allocator@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@12@PEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEBQEAPEBV45678@@Z @@ -1316,8 +1316,10 @@ ??BCord@absl@@QEBA?AV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@XZ ??BCordRepBtreeReader@cord_internal@absl@@QEBA_NXZ ??BTimeZone@absl@@QEBA?AVtime_zone@cctz@time_internal@1@XZ - ??Bint128@absl@@QEBAEXZ + ??Bint128@absl@@QEBADXZ ??Bint128@absl@@QEBANXZ + ??Bint128@absl@@QEBA_JXZ + ??Buint128@absl@@QEBADXZ ??Buint128@absl@@QEBAEXZ ??Buint128@absl@@QEBAIXZ ??Buint128@absl@@QEBANXZ @@ -1772,7 +1774,7 @@ ?Fill@?$RandenPool@G@random_internal@absl@@SAXV?$Span@G@3@@Z ?Fill@?$RandenPool@I@random_internal@absl@@SAXV?$Span@I@3@@Z ?Fill@?$RandenPool@_K@random_internal@absl@@SAXV?$Span@_K@3@@Z - ?FillParentStack@CordzInfo@cord_internal@absl@@CAHPEBV123@PEAPEAX@Z + ?FillParentStack@CordzInfo@cord_internal@absl@@CA_KPEBV123@PEAPEAX@Z ?Find@ByAnyChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByLength@absl@@QEBA?AVstring_view@2@V32@_K@Z @@ -1858,7 +1860,7 @@ ?Generate@Randen@random_internal@absl@@QEBAXPEAX@Z ?Generate@RandenHwAes@random_internal@absl@@SAXPEBXPEAX@Z ?Generate@RandenSlow@random_internal@absl@@SAXPEBXPEAX@Z - ?Get@RefcountAndFlags@cord_internal@absl@@QEBAHXZ + ?Get@RefcountAndFlags@cord_internal@absl@@QEBA_KXZ ?GetAllocatedCapacity@?$Storage@H$0CP@V?$allocator@H@Cr@std@@@inlined_vector_internal@absl@@QEBA_KXZ ?GetAllocatedCapacity@?$Storage@PEAUCordRep@cord_internal@absl@@$01V?$allocator@PEAUCordRep@cord_internal@absl@@@Cr@std@@@inlined_vector_internal@absl@@QEBA_KXZ ?GetAllocatedCapacity@?$Storage@PEAUCordRep@cord_internal@absl@@$0CP@V?$allocator@PEAUCordRep@cord_internal@absl@@@Cr@std@@@inlined_vector_internal@absl@@QEBA_KXZ
diff --git a/third_party/abseil-cpp/symbols_x64_rel.def b/third_party/abseil-cpp/symbols_x64_rel.def index 018f21d..b84f66c 100644 --- a/third_party/abseil-cpp/symbols_x64_rel.def +++ b/third_party/abseil-cpp/symbols_x64_rel.def
@@ -395,7 +395,7 @@ ?Fill@?$RandenPool@G@random_internal@absl@@SAXV?$Span@G@3@@Z ?Fill@?$RandenPool@I@random_internal@absl@@SAXV?$Span@I@3@@Z ?Fill@?$RandenPool@_K@random_internal@absl@@SAXV?$Span@_K@3@@Z - ?FillParentStack@CordzInfo@cord_internal@absl@@CAHPEBV123@PEAPEAX@Z + ?FillParentStack@CordzInfo@cord_internal@absl@@CA_KPEBV123@PEAPEAX@Z ?Find@ByAnyChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByLength@absl@@QEBA?AVstring_view@2@V32@_K@Z
diff --git a/third_party/abseil-cpp/symbols_x64_rel_asan.def b/third_party/abseil-cpp/symbols_x64_rel_asan.def index b76c645..2d5e4e9 100644 --- a/third_party/abseil-cpp/symbols_x64_rel_asan.def +++ b/third_party/abseil-cpp/symbols_x64_rel_asan.def
@@ -400,7 +400,7 @@ ?Fill@?$RandenPool@G@random_internal@absl@@SAXV?$Span@G@3@@Z ?Fill@?$RandenPool@I@random_internal@absl@@SAXV?$Span@I@3@@Z ?Fill@?$RandenPool@_K@random_internal@absl@@SAXV?$Span@_K@3@@Z - ?FillParentStack@CordzInfo@cord_internal@absl@@CAHPEBV123@PEAPEAX@Z + ?FillParentStack@CordzInfo@cord_internal@absl@@CA_KPEBV123@PEAPEAX@Z ?Find@ByAnyChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByChar@absl@@QEBA?AVstring_view@2@V32@_K@Z ?Find@ByLength@absl@@QEBA?AVstring_view@2@V32@_K@Z
diff --git a/third_party/abseil-cpp/symbols_x86_dbg.def b/third_party/abseil-cpp/symbols_x86_dbg.def index 96cf9792..e66ceb9 100644 --- a/third_party/abseil-cpp/symbols_x86_dbg.def +++ b/third_party/abseil-cpp/symbols_x86_dbg.def
@@ -622,8 +622,8 @@ ??$assign@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@?$optional_data_base@V?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@optional_internal@absl@@IAEX$$QAV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@@Z ??$bit_cast@_J_K$0A@@absl@@YA_JAB_K@Z ??$bit_cast@_K_J$0A@@absl@@YA_KAB_J@Z - ??$bit_width@I@absl@@YAII@Z - ??$bit_width@_K@absl@@YA_K_K@Z + ??$bit_width@I@absl@@YAHI@Z + ??$bit_width@_K@absl@@YAH_K@Z ??$call_once@A6AXXZ$$V@absl@@YAXAAVonce_flag@0@A6AXXZ@Z ??$construct@PAPBVImpl@time_zone@cctz@time_internal@absl@@ABQAPBV12345@@?$allocator@PAPBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@QAEXPAPAPBVImpl@time_zone@cctz@time_internal@absl@@ABQAPBV34567@@Z ??$construct@PAPBVImpl@time_zone@cctz@time_internal@absl@@ABQAPBV12345@X@?$allocator_traits@V?$allocator@PAPBVImpl@time_zone@cctz@time_internal@absl@@@Cr@std@@@Cr@std@@SAXAAV?$allocator@PAPBVImpl@time_zone@cctz@time_internal@absl@@@12@PAPAPBVImpl@time_zone@cctz@time_internal@absl@@ABQAPBV45678@@Z @@ -1304,8 +1304,10 @@ ??BCord@absl@@QBE?AV?$basic_string@DU?$char_traits@D@Cr@std@@V?$allocator@D@23@@Cr@std@@XZ ??BCordRepBtreeReader@cord_internal@absl@@QBE_NXZ ??BTimeZone@absl@@QBE?AVtime_zone@cctz@time_internal@1@XZ - ??Bint128@absl@@QBEEXZ + ??Bint128@absl@@QBEDXZ ??Bint128@absl@@QBENXZ + ??Bint128@absl@@QBE_JXZ + ??Buint128@absl@@QBEDXZ ??Buint128@absl@@QBEEXZ ??Buint128@absl@@QBEIXZ ??Buint128@absl@@QBENXZ @@ -1760,7 +1762,7 @@ ?Fill@?$RandenPool@G@random_internal@absl@@SAXV?$Span@G@3@@Z ?Fill@?$RandenPool@I@random_internal@absl@@SAXV?$Span@I@3@@Z ?Fill@?$RandenPool@_K@random_internal@absl@@SAXV?$Span@_K@3@@Z - ?FillParentStack@CordzInfo@cord_internal@absl@@CAHPBV123@PAPAX@Z + ?FillParentStack@CordzInfo@cord_internal@absl@@CAIPBV123@PAPAX@Z ?Find@ByAnyChar@absl@@QBE?AVstring_view@2@V32@I@Z ?Find@ByChar@absl@@QBE?AVstring_view@2@V32@I@Z ?Find@ByLength@absl@@QBE?AVstring_view@2@V32@I@Z @@ -1846,7 +1848,7 @@ ?Generate@Randen@random_internal@absl@@QBEXPAX@Z ?Generate@RandenHwAes@random_internal@absl@@SAXPBXPAX@Z ?Generate@RandenSlow@random_internal@absl@@SAXPBXPAX@Z - ?Get@RefcountAndFlags@cord_internal@absl@@QBEHXZ + ?Get@RefcountAndFlags@cord_internal@absl@@QBEIXZ ?GetAllocatedCapacity@?$Storage@H$0CP@V?$allocator@H@Cr@std@@@inlined_vector_internal@absl@@QBEIXZ ?GetAllocatedCapacity@?$Storage@PAUCordRep@cord_internal@absl@@$01V?$allocator@PAUCordRep@cord_internal@absl@@@Cr@std@@@inlined_vector_internal@absl@@QBEIXZ ?GetAllocatedCapacity@?$Storage@PAUCordRep@cord_internal@absl@@$0CP@V?$allocator@PAUCordRep@cord_internal@absl@@@Cr@std@@@inlined_vector_internal@absl@@QBEIXZ
diff --git a/third_party/abseil-cpp/symbols_x86_rel.def b/third_party/abseil-cpp/symbols_x86_rel.def index 30aeef0..40e3e42 100644 --- a/third_party/abseil-cpp/symbols_x86_rel.def +++ b/third_party/abseil-cpp/symbols_x86_rel.def
@@ -396,7 +396,7 @@ ?Fill@?$RandenPool@G@random_internal@absl@@SAXV?$Span@G@3@@Z ?Fill@?$RandenPool@I@random_internal@absl@@SAXV?$Span@I@3@@Z ?Fill@?$RandenPool@_K@random_internal@absl@@SAXV?$Span@_K@3@@Z - ?FillParentStack@CordzInfo@cord_internal@absl@@CAHPBV123@PAPAX@Z + ?FillParentStack@CordzInfo@cord_internal@absl@@CAIPBV123@PAPAX@Z ?Find@ByAnyChar@absl@@QBE?AVstring_view@2@V32@I@Z ?Find@ByChar@absl@@QBE?AVstring_view@2@V32@I@Z ?Find@ByLength@absl@@QBE?AVstring_view@2@V32@I@Z
diff --git a/third_party/blink/public/common/loader/throttling_url_loader.h b/third_party/blink/public/common/loader/throttling_url_loader.h index f736fe1..2c40612 100644 --- a/third_party/blink/public/common/loader/throttling_url_loader.h +++ b/third_party/blink/public/common/loader/throttling_url_loader.h
@@ -230,8 +230,7 @@ // NOTE: This may point to a native implementation (instead of a Mojo proxy // object). And it is possible that the implementation of |forwarding_client_| // destroys this object synchronously when this object is calling into it. - raw_ptr<network::mojom::URLLoaderClient, DanglingUntriaged> - forwarding_client_; + raw_ptr<network::mojom::URLLoaderClient> forwarding_client_; mojo::Remote<network::mojom::URLLoader> url_loader_; mojo::Receiver<network::mojom::URLLoaderClient> client_receiver_{this};
diff --git a/third_party/blink/public/mojom/frame/pending_beacon.mojom b/third_party/blink/public/mojom/frame/pending_beacon.mojom index 607107afa..2e038bad 100644 --- a/third_party/blink/public/mojom/frame/pending_beacon.mojom +++ b/third_party/blink/public/mojom/frame/pending_beacon.mojom
@@ -41,7 +41,9 @@ // Sets request data for the pending beacon. // It is only allowed when the receiving pending beacon's `BeaconMethod` is // kPost. - // `content_type` must be empty string or a safelisted one. + // `request_body` must + // - Contain only single data element. Complex body is not allowed. + // - Contain NO `kChunkedDataPipe` data element. SetRequestData(network.mojom.URLRequestBody request_body, string content_type);
diff --git a/third_party/blink/renderer/core/animation/css/css_animations.cc b/third_party/blink/renderer/core/animation/css/css_animations.cc index 1f7e9bf..94a317d 100644 --- a/third_party/blink/renderer/core/animation/css/css_animations.cc +++ b/third_party/blink/renderer/core/animation/css/css_animations.cc
@@ -512,6 +512,7 @@ if (CSSScrollTimeline* timeline = FindTimelineForNode(name, node, update)) return timeline; + // TODO(crbug.com/1356098): Use flat-tree siblings. for (Node* prev = node->previousSibling(); prev; prev = prev->previousSibling()) { if (CSSScrollTimeline* timeline =
diff --git a/third_party/blink/renderer/core/css/css_properties.json5 b/third_party/blink/renderer/core/css/css_properties.json5 index 5be49d8..79326bd 100644 --- a/third_party/blink/renderer/core/css/css_properties.json5 +++ b/third_party/blink/renderer/core/css/css_properties.json5
@@ -5448,7 +5448,7 @@ name: "-webkit-text-combine", property_methods: ["CSSValueFromComputedStyleInternal"], inherited: true, - name_for_methods: "TextCombine", + surrogate_for: "text-combine-upright", }, { name: "text-emphasis-color",
diff --git a/third_party/blink/renderer/core/css/style_engine.cc b/third_party/blink/renderer/core/css/style_engine.cc index 8cd614e..845b27fc 100644 --- a/third_party/blink/renderer/core/css/style_engine.cc +++ b/third_party/blink/renderer/core/css/style_engine.cc
@@ -2844,7 +2844,13 @@ Element* parent = FlatTreeTraversal::ParentElement(root_element); SelectorFilterRootScope filter_scope(parent); - root_element.RecalcStyle(change, style_recalc_context); + StyleRecalcChange sibling_change = + root_element.RecalcStyle(change, style_recalc_context); + + if (sibling_change.RecalcSiblingDescendants()) { + root_element.RecalcSubsequentSiblingStyles(change.Combine(sibling_change), + style_recalc_context); + } for (ContainerNode* ancestor = root_element.GetStyleRecalcParent(); ancestor; ancestor = ancestor->GetStyleRecalcParent()) {
diff --git a/third_party/blink/renderer/core/css/style_recalc_change.cc b/third_party/blink/renderer/core/css/style_recalc_change.cc index 245f1e4..fb15c96 100644 --- a/third_party/blink/renderer/core/css/style_recalc_change.cc +++ b/third_party/blink/renderer/core/css/style_recalc_change.cc
@@ -84,6 +84,9 @@ case kRecalcDescendants: builder.Append("kRecalcDescendants"); break; + case kRecalcSiblingDescendants: + builder.Append("kRecalcSiblingDescendants"); + break; } builder.Append(", flags="); if (!flags_) {
diff --git a/third_party/blink/renderer/core/css/style_recalc_change.h b/third_party/blink/renderer/core/css/style_recalc_change.h index e90fee7..37f569f 100644 --- a/third_party/blink/renderer/core/css/style_recalc_change.h +++ b/third_party/blink/renderer/core/css/style_recalc_change.h
@@ -73,6 +73,9 @@ kRecalcChildren, // Need to recalculate style for all descendants. kRecalcDescendants, + // Need to recalculate style for all of the following: descendants, + // subsequent siblings, and descendants of subsequent siblings. + kRecalcSiblingDescendants, }; StyleRecalcChange() = default; @@ -135,7 +138,10 @@ (kMarkReattach | kReattach); } bool RecalcChildren() const { return propagate_ > kUpdatePseudoElements; } - bool RecalcDescendants() const { return propagate_ == kRecalcDescendants; } + bool RecalcDescendants() const { return propagate_ >= kRecalcDescendants; } + bool RecalcSiblingDescendants() const { + return propagate_ == kRecalcSiblingDescendants; + } bool UpdatePseudoElements() const { return propagate_ != kNo; } // Returns true if we should and can do independent inheritance. The passed in // computed style is the existing style for the element we are considering.
diff --git a/third_party/blink/renderer/core/display_lock/display_lock_context.cc b/third_party/blink/renderer/core/display_lock/display_lock_context.cc index ba364cb..4a0a3ac4 100644 --- a/third_party/blink/renderer/core/display_lock/display_lock_context.cc +++ b/third_party/blink/renderer/core/display_lock/display_lock_context.cc
@@ -569,8 +569,8 @@ // can mark the dirty bits from the descendant top layer node up to this // display lock on the ancestor chain while we're in the middle of style // recalc. It seems plausible, but we have to be careful. - blocked_child_recalc_change_ = - blocked_child_recalc_change_.ForceRecalcDescendants(); + blocked_child_recalc_change_ = blocked_child_recalc_change_.EnsureAtLeast( + StyleRecalcChange::kRecalcDescendants); } // We also need to notify the AX cache (if it exists) to update the childrens
diff --git a/third_party/blink/renderer/core/dom/container_node.cc b/third_party/blink/renderer/core/dom/container_node.cc index ec3be5e..27dc67b 100644 --- a/third_party/blink/renderer/core/dom/container_node.cc +++ b/third_party/blink/renderer/core/dom/container_node.cc
@@ -1374,14 +1374,32 @@ DCHECK(GetDocument().InStyleRecalc()); DCHECK(!NeedsStyleRecalc()); + StyleRecalcChange local_change = change; for (Node* child = firstChild(); child; child = child->nextSibling()) { - if (!change.TraverseChild(*child)) + if (!local_change.TraverseChild(*child)) continue; if (auto* child_text_node = DynamicTo<Text>(child)) - child_text_node->RecalcTextStyle(change); + child_text_node->RecalcTextStyle(local_change); - if (auto* child_element = DynamicTo<Element>(child)) - child_element->RecalcStyle(change, style_recalc_context); + if (auto* child_element = DynamicTo<Element>(child)) { + local_change = local_change.Combine( + child_element->RecalcStyle(local_change, style_recalc_context)); + } + } +} + +void ContainerNode::RecalcSubsequentSiblingStyles( + const StyleRecalcChange change, + const StyleRecalcContext& style_recalc_context) { + DCHECK(GetDocument().InStyleRecalc()); + DCHECK(!NeedsStyleRecalc()); + + // TODO(crbug.com/1356098): Use flat-tree siblings. + for (Node* sibling = nextSibling(); sibling; + sibling = sibling->nextSibling()) { + if (auto* sibling_element = DynamicTo<Element>(sibling)) { + sibling_element->RecalcStyle(change, style_recalc_context); + } } }
diff --git a/third_party/blink/renderer/core/dom/container_node.h b/third_party/blink/renderer/core/dom/container_node.h index 9c00a385..8d68ab62 100644 --- a/third_party/blink/renderer/core/dom/container_node.h +++ b/third_party/blink/renderer/core/dom/container_node.h
@@ -290,6 +290,8 @@ Node* node_after_change); void RecalcDescendantStyles(const StyleRecalcChange, const StyleRecalcContext&); + void RecalcSubsequentSiblingStyles(const StyleRecalcChange, + const StyleRecalcContext&); void RebuildChildrenLayoutTrees(WhitespaceAttacher&); void RebuildLayoutTreeForChild(Node* child, WhitespaceAttacher&);
diff --git a/third_party/blink/renderer/core/dom/element.cc b/third_party/blink/renderer/core/dom/element.cc index ef0faa83..0713ac92 100644 --- a/third_party/blink/renderer/core/dom/element.cc +++ b/third_party/blink/renderer/core/dom/element.cc
@@ -3950,8 +3950,9 @@ // that children must also be recalculated, call ourself recursively // on any children (via RecalcDescendantStyles()), and/or update // pseudo-elements. -void Element::RecalcStyle(const StyleRecalcChange change, - const StyleRecalcContext& style_recalc_context) { +StyleRecalcChange Element::RecalcStyle( + const StyleRecalcChange change, + const StyleRecalcContext& style_recalc_context) { DCHECK(InActiveDocument()); DCHECK(GetDocument().InStyleRecalc()); DCHECK(!GetDocument().Lifecycle().InDetach()); @@ -3965,8 +3966,10 @@ StyleRecalcChange child_change = change.ForChildren(*this); if (change.ShouldRecalcStyleFor(*this)) { child_change = RecalcOwnStyle(change, style_recalc_context); - if (GetStyleChangeType() == kSubtreeStyleChange) - child_change = child_change.ForceRecalcDescendants(); + if (GetStyleChangeType() == kSubtreeStyleChange) { + child_change = + child_change.EnsureAtLeast(StyleRecalcChange::kRecalcDescendants); + } ClearNeedsStyleRecalc(); } else if (GetForceReattachLayoutTree() || (change.MarkReattachLayoutTree() && GetComputedStyle())) { @@ -3975,6 +3978,11 @@ ClearNeedsStyleRecalc(); } + const StyleRecalcChange sibling_change = + child_change.RecalcSiblingDescendants() + ? StyleRecalcChange(StyleRecalcChange::kRecalcSiblingDescendants) + : StyleRecalcChange(); + // We may need to update the internal CSSContainerValues of the // ContainerQueryEvaluator if e.g. the value of the 'rem' unit or container- // relative units changed. It are not guaranteed to reach RecalcOwnStyle for @@ -3988,7 +3996,7 @@ display_lock_style_scope.NotifyChildStyleRecalcWasBlocked(child_change); if (HasCustomStyleCallbacks()) DidRecalcStyle(child_change); - return; + return sibling_change; } if (LayoutObject* layout_object = GetLayoutObject()) { @@ -4035,7 +4043,7 @@ child_change); } } else if (SkipStyleRecalcForContainer(*style, child_change)) { - return; + return sibling_change; } } } @@ -4082,6 +4090,8 @@ if (HasCustomStyleCallbacks()) DidRecalcStyle(child_change); + + return sibling_change; } scoped_refptr<ComputedStyle> Element::PropagateInheritedProperties() { @@ -4161,11 +4171,13 @@ static const StyleRecalcChange ApplyComputedStyleDiff( const StyleRecalcChange change, ComputedStyle::Difference diff) { - if (change.RecalcDescendants() || + if (change.RecalcSiblingDescendants() || diff < ComputedStyle::Difference::kPseudoElementStyle) return change; + if (diff == ComputedStyle::Difference::kSiblingDescendantAffecting) + return change.EnsureAtLeast(StyleRecalcChange::kRecalcSiblingDescendants); if (diff == ComputedStyle::Difference::kDescendantAffecting) - return change.ForceRecalcDescendants(); + return change.EnsureAtLeast(StyleRecalcChange::kRecalcDescendants); if (diff == ComputedStyle::Difference::kInherited) return change.EnsureAtLeast(StyleRecalcChange::kRecalcChildren); if (diff == ComputedStyle::Difference::kIndependentInherited) @@ -4404,7 +4416,8 @@ // track of which elements depend on rem units like we do for viewport // styles, but we assume root font size changes are rare and just // recalculate everything. - child_change = child_change.ForceRecalcDescendants(); + child_change = + child_change.EnsureAtLeast(StyleRecalcChange::kRecalcDescendants); } } child_change = ApplyComputedStyleDiff(child_change, diff); @@ -4437,20 +4450,22 @@ } else if (evaluator) { DCHECK(old_style); evaluator->MarkFontDirtyIfNeeded(*old_style, *new_style); - if (diff != ComputedStyle::Difference::kEqual && - (!base::ValuesEquivalent(old_style->InheritedVariables(), - new_style->InheritedVariables()) || - !base::ValuesEquivalent(old_style->NonInheritedVariables(), - new_style->NonInheritedVariables()))) { - switch (evaluator->StyleContainerChanged(*this)) { - case ContainerQueryEvaluator::Change::kNone: - break; - case ContainerQueryEvaluator::Change::kNearestContainer: - child_change = change.ForceRecalcStyleContainerChildren(); - break; - case ContainerQueryEvaluator::Change::kDescendantContainers: - child_change = change.ForceRecalcStyleContainerDescendants(); - break; + if (RuntimeEnabledFeatures::CSSStyleQueriesEnabled()) { + if (diff != ComputedStyle::Difference::kEqual && + (!base::ValuesEquivalent(old_style->InheritedVariables(), + new_style->InheritedVariables()) || + !base::ValuesEquivalent(old_style->NonInheritedVariables(), + new_style->NonInheritedVariables()))) { + switch (evaluator->StyleContainerChanged(*this)) { + case ContainerQueryEvaluator::Change::kNone: + break; + case ContainerQueryEvaluator::Change::kNearestContainer: + child_change = change.ForceRecalcStyleContainerChildren(); + break; + case ContainerQueryEvaluator::Change::kDescendantContainers: + child_change = change.ForceRecalcStyleContainerDescendants(); + break; + } } } }
diff --git a/third_party/blink/renderer/core/dom/element.h b/third_party/blink/renderer/core/dom/element.h index 2e94b9e3..3aa520ef 100644 --- a/third_party/blink/renderer/core/dom/element.h +++ b/third_party/blink/renderer/core/dom/element.h
@@ -650,7 +650,11 @@ const ComputedStyle* ParentComputedStyle() const; - void RecalcStyle(const StyleRecalcChange, const StyleRecalcContext&); + // Returns a StyleRecalcChange to be combined with the outer + // StyleRecalcChange. This is used to recalculate the style of subsequent + // siblings. + StyleRecalcChange RecalcStyle(const StyleRecalcChange, + const StyleRecalcContext&); void RecalcStyleForTraversalRootAncestor(); void RebuildLayoutTreeForTraversalRootAncestor() { RebuildFirstLetterLayoutTree();
diff --git a/third_party/blink/renderer/core/frame/pending_post_beacon.cc b/third_party/blink/renderer/core/frame/pending_post_beacon.cc index faa0410..d3a9751 100644 --- a/third_party/blink/renderer/core/frame/pending_post_beacon.cc +++ b/third_party/blink/renderer/core/frame/pending_post_beacon.cc
@@ -87,13 +87,14 @@ exception_state); return; } - case ContentType::kBlob: + case ContentType::kBlob: { SetDataInternal(BeaconBlob(data->GetAsBlob()), exception_state); return; + } case ContentType::kReadableStream: { exception_state.ThrowTypeError( "PendingPostBeacon cannot have a ReadableStream body."); - break; + return; } } NOTIMPLEMENTED();
diff --git a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc index 0162423..ecbec6c 100644 --- a/third_party/blink/renderer/core/layout/ng/ng_block_node.cc +++ b/third_party/blink/renderer/core/layout/ng/ng_block_node.cc
@@ -681,9 +681,8 @@ const NGConstraintSpace& constraint_space, const NGBlockBreakToken* break_token) const { // We read and write the physical fragments vector in LayoutBox here, which - // isn't allowed if side-effects are disabled. However, if side-effects are - // disabled, we shouldn't be here anyway, since we shouldn't be performing - // block fragmentation then (and therefore never repeat content). + // isn't allowed if side-effects are disabled. Call-sites must make sure that + // we don't attempt to repeat content if side-effects are disabled. DCHECK(!NGDisableSideEffectsScope::IsDisabled()); // When laying out repeatable content, we cannot at the same time allow it to
diff --git a/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm.cc b/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm.cc index 06478e6..fd6fdf2 100644 --- a/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm.cc +++ b/third_party/blink/renderer/core/layout/ng/table/ng_table_layout_algorithm.cc
@@ -1043,10 +1043,13 @@ // look for repeatable headers and footers. This is especially important for // footers, since we need to reserve space for it after any preceding // non-repeated sections (typically tbody). We'll only repeat headers / - // footers if we're not already inside repeatable content, though. - // See crbug.com/1352931 + // footers if we're not already inside repeatable content, though. See + // crbug.com/1352931 for more details. Furthermore, we cannot repeat content + // if side-effects are disabled, as that machinery depends on updating and + // reading the physical fragments vector of the LayoutBox. if (ConstraintSpace().HasKnownFragmentainerBlockSize() && !ConstraintSpace().IsInsideRepeatableContent() && + !NGDisableSideEffectsScope::IsDisabled() && (grouped_children.header || grouped_children.footer)) { LayoutUnit max_section_block_size = ConstraintSpace().FragmentainerBlockSize() / 4;
diff --git a/third_party/blink/renderer/core/style/computed_style.cc b/third_party/blink/renderer/core/style/computed_style.cc index 731ceaad..980747d 100644 --- a/third_party/blink/renderer/core/style/computed_style.cc +++ b/third_party/blink/renderer/core/style/computed_style.cc
@@ -264,6 +264,15 @@ return false; } +static bool DiffAffectsScrollAnimations(const ComputedStyle& old_style, + const ComputedStyle& new_style) { + if ((old_style.ScrollTimelineName() != new_style.ScrollTimelineName()) || + (old_style.ScrollTimelineAxis() != new_style.ScrollTimelineAxis())) { + return true; + } + return false; +} + bool ComputedStyle::NeedsReattachLayoutTree(const Element& element, const ComputedStyle* old_style, const ComputedStyle* new_style) { @@ -363,6 +372,8 @@ const ComputedStyle& old_style, const ComputedStyle& new_style) { DCHECK_NE(&old_style, &new_style); + if (DiffAffectsScrollAnimations(old_style, new_style)) + return Difference::kSiblingDescendantAffecting; if (old_style.Display() != new_style.Display() && old_style.BlockifiesChildren() != new_style.BlockifiesChildren()) return Difference::kDescendantAffecting;
diff --git a/third_party/blink/renderer/core/style/computed_style.h b/third_party/blink/renderer/core/style/computed_style.h index 0873b0c..dfe07404 100644 --- a/third_party/blink/renderer/core/style/computed_style.h +++ b/third_party/blink/renderer/core/style/computed_style.h
@@ -372,6 +372,11 @@ // The container-name property affects which container is queried by // rules matching descedant elements. kDescendantAffecting, + // Properties which can affect the follow elements changed: + // descendants, subsequent siblings, and descendants of subsequent siblings. + // + // For example, scroll-timeline-* properties. + kSiblingDescendantAffecting, }; CORE_EXPORT static Difference ComputeDifference( const ComputedStyle* old_style,
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_track.h b/third_party/blink/renderer/modules/mediastream/media_stream_track.h index 156f5da..43403c3 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_track.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_track.h
@@ -32,6 +32,7 @@ class AudioSourceProvider; class ImageCapture; +class MediaConstraints; class MediaTrackCapabilities; class MediaTrackConstraints; class MediaStream;
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.h b/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.h index 1dfca97..597033c 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_track_impl.h
@@ -36,6 +36,7 @@ #include "third_party/blink/renderer/modules/mediastream/media_stream_track.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_set.h" +#include "third_party/blink/renderer/platform/mediastream/media_constraints.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_descriptor.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_source.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_scheduler.h"
diff --git a/third_party/blink/renderer/platform/mediastream/media_stream_component.h b/third_party/blink/renderer/platform/mediastream/media_stream_component.h index c9dd621..eaa5a0f 100644 --- a/third_party/blink/renderer/platform/mediastream/media_stream_component.h +++ b/third_party/blink/renderer/platform/mediastream/media_stream_component.h
@@ -39,7 +39,6 @@ #include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/prefinalizer.h" -#include "third_party/blink/renderer/platform/mediastream/media_constraints.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_source.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_track_platform.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
diff --git a/third_party/blink/renderer/platform/mediastream/transferred_media_stream_component_test.cc b/third_party/blink/renderer/platform/mediastream/transferred_media_stream_component_test.cc index 192fc36c..f27eb4b7 100644 --- a/third_party/blink/renderer/platform/mediastream/transferred_media_stream_component_test.cc +++ b/third_party/blink/renderer/platform/mediastream/transferred_media_stream_component_test.cc
@@ -41,8 +41,6 @@ MOCK_METHOD1(SetEnabled, void(bool)); MOCK_METHOD0(ContentHint, WebMediaStreamTrack::ContentHintType()); MOCK_METHOD1(SetContentHint, void(WebMediaStreamTrack::ContentHintType)); - MOCK_CONST_METHOD0(Constraints, const MediaConstraints&()); - MOCK_METHOD1(SetConstraints, void(const MediaConstraints&)); MOCK_CONST_METHOD0(GetPlatformTrack, MediaStreamTrackPlatform*()); MOCK_METHOD1(SetPlatformTrack, void(std::unique_ptr<MediaStreamTrackPlatform>));
diff --git a/third_party/blink/web_tests/FlagExpectations/highdpi b/third_party/blink/web_tests/FlagExpectations/highdpi index 58e57d8..cbed735 100644 --- a/third_party/blink/web_tests/FlagExpectations/highdpi +++ b/third_party/blink/web_tests/FlagExpectations/highdpi
@@ -188,7 +188,6 @@ external/wpt/common/blank.html [ Pass ] external/wpt/common/dispatcher/executor.html [ Pass ] external/wpt/compat/webkit-radial-gradient-radii.html [ Pass ] -external/wpt/compute-pressure/compute_pressure_detached_iframe.tentative.https.html [ Pass ] external/wpt/content-dpr/image-with-content-dpr-and-explicit-dimensions.html [ Pass ] external/wpt/contenteditable/plaintext-only.html [ Pass ] external/wpt/cors/image-tainting-in-cross-origin-iframe.sub.html [ Pass ] @@ -1847,3 +1846,6 @@ crbug.com/1339051 virtual/document-transition/wpt_internal/document-transition/old-content-object-view-box-clip-path-reference.html [ Failure ] crbug.com/1339051 virtual/document-transition/wpt_internal/document-transition/root-captured-as-different-tag.html [ Failure ] crbug.com/1339051 virtual/document-transition/wpt_internal/document-transition/web-animations-api.html [ Failure ] + +# Flaky +crbug.com/1355662 external/wpt/compute-pressure/compute_pressure_detached_iframe.tentative.https.html [ Failure ]
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 0c87a66..a297b22 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -3275,6 +3275,7 @@ crbug.com/626703 [ Win ] virtual/partitioned-cookies/http/tests/inspector-protocol/network/disabled-cache-navigation.js [ Failure ] # ====== New tests from wpt-importer added here ====== +crbug.com/626703 [ Mac10.15 ] virtual/document-transition/wpt_internal/document-transition/commit-timeout-crash.html [ Timeout ] crbug.com/626703 external/wpt/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-preferred.html [ Failure ] crbug.com/626703 virtual/dark-color-scheme/external/wpt/css/css-color-adjust/rendering/dark-color-scheme/color-scheme-iframe-preferred.html [ Failure ] crbug.com/626703 [ Mac10.15 ] external/wpt/service-workers/cache-storage/cross-partition.https.tentative.html [ Skip Timeout ] @@ -6920,3 +6921,13 @@ # Sheriff 2022-08-19 crbug.com/1354433 [ Mac ] external/wpt/html/browsers/the-window-object/window-properties.https.html [ Failure Pass ] + +# Sheriff 2022-08-24 +crbug.com/1356118 [ Mac ] virtual/fenced-frame-shadow-dom/external/wpt/html/anonymous-iframe/local-storage-initial-empty-document.tentative.https.window.html [ Failure Pass ] +crbug.com/1356118 [ Mac ] virtual/async-script-scheduling-finished-parsing/wpt_internal/async-script-scheduling/execution-order.sub.html [ Failure Pass ] + +# Temporarily disable tests to land IndexedDB frontend CLs +crbug.com/1296584 http/tests/devtools/indexeddb/database-data.js [ Skip ] +crbug.com/1296584 http/tests/devtools/indexeddb/database-structure.js [ Skip ] +crbug.com/1296584 http/tests/devtools/indexeddb/database-version-number.js [ Skip ] +crbug.com/1296584 http/tests/devtools/indexeddb/upgrade-events.js [ Skip ]
diff --git a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json index f91c7971..69a9135e 100644 --- a/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json +++ b/third_party/blink/web_tests/external/WPT_BASE_MANIFEST_8.json
@@ -2187,6 +2187,13 @@ {} ] ], + "repeated-table-footer-in-caption-nested-multicol.html": [ + "d630abe8bbb1e752d3a7c559e4c49864233c44f9", + [ + null, + {} + ] + ], "scrollable-spanner-in-nested.html": [ "b904aaddd29c77e41800d63a93f04a2e70dda310", [ @@ -325828,11 +325835,11 @@ [] ], "pending_beacon-helper.js": [ - "e3982898f8f2cdba927d51fedfc9186fd61f85a5", + "36f9c3bb3b4eb91c4da81413504bb78046b1938f", [] ], "set_beacon.py": [ - "41618adc54ed5e7ddf1a1bfaf81f76b11febf8fc", + "996299e2532c069723ca57a404a1c7477d8a8110", [] ] } @@ -343044,7 +343051,7 @@ ] ], "url-with-fetch.any.js": [ - "9bd8d383df4e1e1ea8ab3a59771a8b78e3a9b2c6", + "7f6ebed44b81080044b41259e58674e10dd87fde", [ "FileAPI/url/url-with-fetch.any.html", { @@ -377923,6 +377930,13 @@ {} ] ], + "custom-property-style-query-change.html": [ + "add85c4d9e267f4a106cf93787fb91f913da8515", + [ + null, + {} + ] + ], "deep-nested-inline-size-containers.html": [ "00bc8b0a6b2deae05e980a6c8cd7ddbab286906f", [ @@ -506830,7 +506844,7 @@ }, "pending_beacon": { "pending_beacon-basic.tentative.window.js": [ - "82ec58a6bf3b978231358c597aff7c343a1fe0e8", + "08369c886a0b8738f9be1167e749da50efee42e0", [ "pending_beacon/pending_beacon-basic.tentative.window.html", { @@ -506842,13 +506856,17 @@ [ "script", "/resources/testharnessreport.js" + ], + [ + "script", + "./resources/pending_beacon-helper.js" ] ] } ] ], "pending_beacon-deactivate.tentative.window.js": [ - "4d8fb6be5aa4ea081f78e03f8de8aa0acb12efa2", + "c499d32b98b272c3362561d68671f4d8d6a8f797", [ "pending_beacon/pending_beacon-deactivate.tentative.window.html", { @@ -506860,6 +506878,10 @@ [ "script", "/resources/testharnessreport.js" + ], + [ + "script", + "./resources/pending_beacon-helper.js" ] ] } @@ -506917,6 +506939,36 @@ } ] ], + "pending_get_beacon-cors.tentative.https.window.js": [ + "4e711bb7fcc3433cddf3b51fdfd0a9f18e57a456", + [ + "pending_beacon/pending_get_beacon-cors.tentative.https.window.html", + { + "script_metadata": [ + [ + "script", + "/resources/testharness.js" + ], + [ + "script", + "/resources/testharnessreport.js" + ], + [ + "script", + "/common/get-host-info.sub.js" + ], + [ + "script", + "/common/utils.js" + ], + [ + "script", + "./resources/pending_beacon-helper.js" + ] + ] + } + ] + ], "pending_get_beacon-send.tentative.window.js": [ "7f52c082800cea4a4cac2dc57c0c99f727bbe98e", [ @@ -506943,6 +506995,36 @@ } ] ], + "pending_post_beacon-cors.tentative.https.window.js": [ + "9545101f1362cb40a150d19c22a95818d19a8d95", + [ + "pending_beacon/pending_post_beacon-cors.tentative.https.window.html", + { + "script_metadata": [ + [ + "script", + "/resources/testharness.js" + ], + [ + "script", + "/resources/testharnessreport.js" + ], + [ + "script", + "/common/get-host-info.sub.js" + ], + [ + "script", + "/common/utils.js" + ], + [ + "script", + "./resources/pending_beacon-helper.js" + ] + ] + } + ] + ], "pending_post_beacon-sendwithdata.tentative.window.js": [ "081e1d4d62e3673756db53d4bc5d2d20ef56a57c", [
diff --git a/third_party/blink/web_tests/external/wpt/FileAPI/url/url-with-fetch.any.js b/third_party/blink/web_tests/external/wpt/FileAPI/url/url-with-fetch.any.js index 9bd8d383..7f6ebed4 100644 --- a/third_party/blink/web_tests/external/wpt/FileAPI/url/url-with-fetch.any.js +++ b/third_party/blink/web_tests/external/wpt/FileAPI/url/url-with-fetch.any.js
@@ -1,5 +1,26 @@ // META: script=resources/fetch-tests.js +async function garbageCollect() { + if (typeof TestUtils !== 'undefined' && TestUtils.gc) { + await TestUtils.gc(); + } else if (self.gc) { + await self.gc(); + } else if (self.GCController) { + // Present in some WebKit development environments + await GCController.collect(); + } else { + var gcRec = function (n) { + if (n < 1) + return {}; + var temp = {i: "ab" + i + (i / 100000)}; + temp += "foo"; + gcRec(n-1); + }; + for (var i = 0; i < 1000; i++) + gcRec(10); + } +} + function fetch_should_succeed(test, request) { return fetch(request).then(response => response.text()); } @@ -37,6 +58,24 @@ }); }, 'Revoke blob URL after creating Request, will fetch'); +promise_test(async t => { + const blob_contents = 'test blob contents'; + const blob = new Blob([blob_contents]); + const url = URL.createObjectURL(blob); + let request = new Request(url); + + // Revoke the object URL. Request should take a reference to the blob as + // soon as it receives it in open(), so the request succeeds even though we + // revoke the URL before calling fetch(). + URL.revokeObjectURL(url); + + request = request.clone(); + await garbageCollect(); + + const text = await fetch_should_succeed(t, request); + assert_equals(text, blob_contents); +}, 'Revoke blob URL after creating Request, then clone Request, will fetch'); + promise_test(function(t) { const blob_contents = 'test blob contents'; const blob = new Blob([blob_contents]);
diff --git a/third_party/blink/web_tests/external/wpt/css/css-multicol/crashtests/repeated-table-footer-in-caption-nested-multicol.html b/third_party/blink/web_tests/external/wpt/css/css-multicol/crashtests/repeated-table-footer-in-caption-nested-multicol.html new file mode 100644 index 0000000..d630abe --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-multicol/crashtests/repeated-table-footer-in-caption-nested-multicol.html
@@ -0,0 +1,12 @@ +<!DOCTYPE html> +<link rel="author" title="Morten Stenshorne" href="mailto:mstensho@chromium.org"> +<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=1354966"> +<div style="columns:2; column-fill:auto; height:100px;"> + <div style="display:table;"> + <div style="display:table-caption; columns:2; column-fill:auto; height:50px;"> + <div style="display:table;"> + <div style="display:table-footer-group; break-inside:avoid;"></div> + </div> + </div> + </div> +</div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/text-combine-webkit-crash.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/text-combine-webkit-crash.html new file mode 100644 index 0000000..228f066 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/text-combine-webkit-crash.html
@@ -0,0 +1,18 @@ +<!DOCTYPE html> +<html lang="en"> +<head> +<meta charset="utf-8"/> +<title>text-combine-upright and -webkit-text-combine do not crash when used together</title> +<link rel="author" title="Steinar H. Gunderson" href="mailto:sesse@chromium.org"/> +<link rel="help" href="https://crbug.com/1355087"/> +<body> +<div id="div"></div> +<script> + div.style.setProperty("-webkit-text-combine", "none"); + div.style.setProperty("text-combine-upright", "all"); + div.style.setProperty("background-color", "white"); + div.offsetTop; + div.style.setProperty("background-color", "black"); +</script> +</body> +</html>
diff --git a/third_party/blink/web_tests/external/wpt/pending_beacon/pending_beacon-basic.tentative.window.js b/third_party/blink/web_tests/external/wpt/pending_beacon/pending_beacon-basic.tentative.window.js index 82ec58a..08369c8 100644 --- a/third_party/blink/web_tests/external/wpt/pending_beacon/pending_beacon-basic.tentative.window.js +++ b/third_party/blink/web_tests/external/wpt/pending_beacon/pending_beacon-basic.tentative.window.js
@@ -1,5 +1,6 @@ // META: script=/resources/testharness.js // META: script=/resources/testharnessreport.js +// META: script=./resources/pending_beacon-helper.js 'use strict'; @@ -7,11 +8,6 @@ assert_throws_js(TypeError, () => new PendingBeacon('/')); }, `PendingBeacon cannot be constructed directly.`); -const BeaconTypes = [ - {type: PendingPostBeacon, name: 'PendingPostBeacon', expectedMethod: 'POST'}, - {type: PendingGetBeacon, name: 'PendingGetBeacon', expectedMethod: 'GET'}, -]; - for (const beaconType of BeaconTypes) { test(() => { assert_throws_js(TypeError, () => new beaconType.type());
diff --git a/third_party/blink/web_tests/external/wpt/pending_beacon/pending_beacon-deactivate.tentative.window.js b/third_party/blink/web_tests/external/wpt/pending_beacon/pending_beacon-deactivate.tentative.window.js index 4d8fb6be..c499d32 100644 --- a/third_party/blink/web_tests/external/wpt/pending_beacon/pending_beacon-deactivate.tentative.window.js +++ b/third_party/blink/web_tests/external/wpt/pending_beacon/pending_beacon-deactivate.tentative.window.js
@@ -1,13 +1,9 @@ // META: script=/resources/testharness.js // META: script=/resources/testharnessreport.js +// META: script=./resources/pending_beacon-helper.js 'use strict'; -const BeaconTypes = [ - {type: PendingPostBeacon, name: 'PendingPostBeacon', expectedMethod: 'POST'}, - {type: PendingGetBeacon, name: 'PendingGetBeacon', expectedMethod: 'GET'}, -]; - for (const beaconType of BeaconTypes) { test(() => { const beacon = new beaconType.type('https://www.google.com');
diff --git a/third_party/blink/web_tests/external/wpt/pending_beacon/pending_get_beacon-cors.tentative.https.window.js b/third_party/blink/web_tests/external/wpt/pending_beacon/pending_get_beacon-cors.tentative.https.window.js new file mode 100644 index 0000000..4e711bb7 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/pending_beacon/pending_get_beacon-cors.tentative.https.window.js
@@ -0,0 +1,30 @@ +// META: script=/resources/testharness.js +// META: script=/resources/testharnessreport.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=./resources/pending_beacon-helper.js + +'use strict'; + +const {HTTPS_ORIGIN, HTTPS_NOTSAMESITE_ORIGIN} = get_host_info(); + +parallelPromiseTest(async t => { + const uuid = token(); + const url = generateSetBeaconURL(uuid, {host: HTTPS_ORIGIN}); + + let beacon = new PendingGetBeacon(url); + beacon.sendNow(); + + await expectBeacon(uuid, {count: 1}); +}, 'PendingGetBeacon: same-origin'); + +parallelPromiseTest(async t => { + const uuid = token(); + const url = generateSetBeaconURL( + uuid, {host: HTTPS_NOTSAMESITE_ORIGIN, expectOrigin: HTTPS_ORIGIN}); + + let beacon = new PendingGetBeacon(url); + beacon.sendNow(); + + await expectBeacon(uuid, {count: 1}); +}, 'PendingGetBeacon: cross-origin');
diff --git a/third_party/blink/web_tests/external/wpt/pending_beacon/pending_post_beacon-cors.tentative.https.window.js b/third_party/blink/web_tests/external/wpt/pending_beacon/pending_post_beacon-cors.tentative.https.window.js new file mode 100644 index 0000000..7bdfc3b --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/pending_beacon/pending_post_beacon-cors.tentative.https.window.js
@@ -0,0 +1,68 @@ +// META: script=/resources/testharness.js +// META: script=/resources/testharnessreport.js +// META: script=/common/get-host-info.sub.js +// META: script=/common/utils.js +// META: script=./resources/pending_beacon-helper.js + +'use strict'; + +const {HTTPS_ORIGIN, HTTPS_NOTSAMESITE_ORIGIN} = get_host_info(); +const SMALL_SIZE = 500; + +for (const dataType in BeaconDataType) { + postBeaconSendDataTest( + dataType, generatePayload(SMALL_SIZE), + `PendingPostBeacon[${dataType}]: same-origin`, + {urlOptions: {host: HTTPS_ORIGIN, expectOrigin: HTTPS_ORIGIN}}); + + postBeaconSendDataTest( + dataType, generatePayload(SMALL_SIZE), + `PendingPostBeacon[${dataType}]: cross-origin, ` + + `CORS-safelisted Content-Type`, + { + urlOptions: { + host: HTTPS_NOTSAMESITE_ORIGIN, + expectOrigin: HTTPS_ORIGIN, + } + }); + + postBeaconSendDataTest( + dataType, generatePayload(SMALL_SIZE), + `PendingPostBeacon[${dataType}]: cross-origin, ` + + 'CORS-safelisted Content-Type => ' + + 'non-CORS response (from redirect handler) ' + + 'should be rejected by browser', + { + expectCount: 0, + urlOptions: { + useRedirectHandler: true, + host: HTTPS_NOTSAMESITE_ORIGIN, + } + }); + + postBeaconSendDataTest( + dataType, generatePayload(SMALL_SIZE), + `PendingPostBeacon[${dataType}]: cross-origin, ` + + 'CORS-safelisted Content-Type => no cookie expected', + { + setCookie: 'test_beacon_cookie', + urlOptions: { + host: HTTPS_NOTSAMESITE_ORIGIN, + expectOrigin: HTTPS_ORIGIN, + expectCredentials: false, + } + }); +} + +postBeaconSendDataTest( + BeaconDataType.Blob, generatePayload(SMALL_SIZE), + 'PendingPostBeacon[Blob]: cross-origin, non-CORS-safelisted Content-Type' + + ' => preflight expected', + { + urlOptions: { + host: HTTPS_NOTSAMESITE_ORIGIN, + contentType: 'application/octet-stream', + expectOrigin: HTTPS_ORIGIN, + expectPreflight: true, + } + });
diff --git a/third_party/blink/web_tests/external/wpt/pending_beacon/resources/pending_beacon-helper.js b/third_party/blink/web_tests/external/wpt/pending_beacon/resources/pending_beacon-helper.js index e3982898f..73c46a40 100644 --- a/third_party/blink/web_tests/external/wpt/pending_beacon/resources/pending_beacon-helper.js +++ b/third_party/blink/web_tests/external/wpt/pending_beacon/resources/pending_beacon-helper.js
@@ -8,6 +8,11 @@ }, description); } +const BeaconTypes = [ + {type: PendingPostBeacon, name: 'PendingPostBeacon', expectedMethod: 'POST'}, + {type: PendingGetBeacon, name: 'PendingGetBeacon', expectedMethod: 'GET'}, +]; + /** @enum {string} */ const BeaconDataType = { String: 'String', @@ -34,7 +39,8 @@ // @param {string} data - A string representation of the beacon data. Note that // it cannot contain UTF-16 surrogates for all `BeaconDataType` except BLOB. // @param {BeaconDataType} dataType - must be one of `BeaconDataType`. -function makeBeaconData(data, dataType) { +// @param {string} contentType - Request Content-Type. +function makeBeaconData(data, dataType, contentType) { switch (dataType) { case BeaconDataType.String: return data; @@ -51,10 +57,14 @@ return new URLSearchParams(`${BEACON_PAYLOAD_KEY}=${data}`); } return new URLSearchParams(); - case BeaconDataType.Blob: - return new Blob([data]); - case BeaconDataType.File: - return new File([data], 'file.txt', {type: 'text/plain'}); + case BeaconDataType.Blob: { + const options = {type: contentType || undefined}; + return new Blob([data], options); + } + case BeaconDataType.File: { + const options = {type: contentType || 'text/plain'}; + return new File([data], 'file.txt', options); + } default: throw Error(`Unsupported beacon dataType: ${dataType}`); } @@ -80,19 +90,39 @@ return data; } -function generateSetBeaconURL(uuid) { - return `/pending_beacon/resources/set_beacon.py?uuid=${uuid}`; +function generateSetBeaconURL(uuid, options) { + const host = (options && options.host) || ''; + let url = `${host}/pending_beacon/resources/set_beacon.py?uuid=${uuid}`; + if (options) { + if (options.expectOrigin !== undefined) { + url = `${url}&expectOrigin=${options.expectOrigin}`; + } + if (options.expectPreflight !== undefined) { + url = `${url}&expectPreflight=${options.expectPreflight}`; + } + if (options.expectCredentials !== undefined) { + url = `${url}&expectCredentials=${options.expectCredentials}`; + } + + if (options.useRedirectHandler) { + const redirect = `${host}/common/redirect.py` + + `?location=${encodeURIComponent(url)}`; + url = redirect; + } + } + return url; } async function poll(f, expected) { - const interval = 400; // milliseconds. - while (true) { + const interval = 100; // milliseconds. + for (let i = 0; i < 30; i++) { const result = await f(); if (expected(result)) { return result; } await new Promise(resolve => setTimeout(resolve, interval)); } + return {data: []}; } // Waits until the `options.count` number of beacon data available from the @@ -100,7 +130,8 @@ // If `options.data` is set, it will be used to compare with the data from the // response. async function expectBeacon(uuid, options) { - const expectedCount = options && options.count ? options.count : 1; + const expectedCount = + (options && options.count !== undefined) ? options.count : 1; const res = await poll( async () => { @@ -116,6 +147,10 @@ return; } + if (expectedCount == 0) { + return; + } + const decoder = options && options.percentDecoded ? (s) => { // application/x-www-form-urlencoded serializer encodes space as '+' // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent @@ -138,18 +173,30 @@ function postBeaconSendDataTest(dataType, testData, description, options) { parallelPromiseTest(async t => { const expectNoData = options && options.expectNoData; + const expectCount = (options && options.expectCount !== undefined) ? + options.expectCount : + 1; const uuid = token(); - const url = generateSetBeaconURL(uuid); + const url = + generateSetBeaconURL(uuid, (options && options.urlOptions) || {}); const beacon = new PendingPostBeacon(url); assert_equals(beacon.method, 'POST', 'must be POST to call setData().'); - beacon.setData(makeBeaconData(testData, dataType)); + if (options && options.setCookie) { + document.cookie = options.setCookie; + } + + beacon.setData(makeBeaconData( + testData, dataType, (options && options.contentType) || {})); beacon.sendNow(); const expectedData = expectNoData ? null : testData; const percentDecoded = !expectNoData && dataType === BeaconDataType.URLSearchParams; - await expectBeacon( - uuid, {count: 1, data: [expectedData], percentDecoded: percentDecoded}); + await expectBeacon(uuid, { + count: expectCount, + data: [expectedData], + percentDecoded: percentDecoded + }); }, `PendingPostBeacon(${dataType}): ${description}`); }
diff --git a/third_party/blink/web_tests/external/wpt/pending_beacon/resources/set_beacon.py b/third_party/blink/web_tests/external/wpt/pending_beacon/resources/set_beacon.py index 41618ad..1c71f23 100644 --- a/third_party/blink/web_tests/external/wpt/pending_beacon/resources/set_beacon.py +++ b/third_party/blink/web_tests/external/wpt/pending_beacon/resources/set_beacon.py
@@ -4,6 +4,9 @@ _BEACON_DATA_PATH = "beacon_data" _BEACON_FORM_PAYLOAD_KEY = b"payload" _BEACON_BODY_PAYLOAD_KEY = "payload=" +_BEACON_EXPECT_ORIGIN_KEY = b"expectOrigin" +_BEACON_EXPECT_PREFLIGHT_KEY = b"expectPreflight" +_BEACON_EXPECT_CREDS_KEY = b"expectCredentials" def main(request, response): @@ -23,6 +26,40 @@ return "Must provide a UUID to store beacon data" uuid = request.GET.first(_BEACON_ID_KEY) + expected_origin = request.GET.get(_BEACON_EXPECT_ORIGIN_KEY) + if b"origin" in request.headers: + origin = request.headers.get(b"origin") + if expected_origin: + assert origin == expected_origin, f"expected {expected_origin}, got {origin}" + response.headers.set(b"Access-Control-Allow-Origin", origin) + else: + assert expected_origin is None, f"expected None, got {expected_origin}" + + # Handles preflight request first. + if request.method == u"OPTIONS": + assert request.GET.get( + _BEACON_EXPECT_PREFLIGHT_KEY) == b"true", "Preflight not expected." + + # preflight must not have cookies. + assert b"Cookie" not in request.headers + + requested_headers = request.headers.get( + b"Access-Control-Request-Headers") + assert b"content-type" in requested_headers, f"expected content-type, got {requested_headers}" + response.headers.set(b"Access-Control-Allow-Headers", b"content-type") + + requested_method = request.headers.get(b"Access-Control-Request-Method") + assert requested_method == b"POST", f"expected POST, got {requested_method}" + response.headers.set(b"Access-Control-Allow-Methods", b"POST") + + return response + + expect_creds = request.GET.get(_BEACON_EXPECT_CREDS_KEY) == b"true" + if expect_creds: + assert b"Cookie" in request.headers + else: + assert b"Cookie" not in request.headers + data = None if request.method == u"POST": if b"multipart/form-data" in request.headers.get(b"Content-Type", b""): @@ -42,4 +79,5 @@ saved_data.append(data) request.server.stash.put( key=uuid, value=saved_data, path=_BEACON_DATA_PATH) - return ((200, "OK"), [], "") + + response.status = 200
diff --git a/third_party/blink/web_tests/external/wpt/scroll-animations/css/animation-timeline-named-scroll-progress-timeline.tentative.html b/third_party/blink/web_tests/external/wpt/scroll-animations/css/animation-timeline-named-scroll-progress-timeline.tentative.html index 61e8522b..915aaa1 100644 --- a/third_party/blink/web_tests/external/wpt/scroll-animations/css/animation-timeline-named-scroll-progress-timeline.tentative.html +++ b/third_party/blink/web_tests/external/wpt/scroll-animations/css/animation-timeline-named-scroll-progress-timeline.tentative.html
@@ -223,6 +223,34 @@ sibling.remove(); }, 'scroll-timeline-name on an element which is not a scroll-container'); +promise_test(async t => { + let [sibling, target] = createScrollerAndTarget(t); + let main = document.createElement('div'); + main.id = 'name'; + + // <div id='main'> + // <div id='sibling' class='scroller'> ... </div> + // <div id='target'></div> + // </div> + document.body.appendChild(main); + main.appendChild(sibling); + main.appendChild(target); + + target.style.animation = 'anim 10s linear timeline'; + sibling.scrollTop = 50; // 50%, in [50, 150]. + await waitForNextFrame(); + + // Unknown animation-timeline, current time held at zero. + assert_equals(getComputedStyle(target).translate, '50px'); + + // Ensure that #main (an ancestor of the scroller) needs style recalc. + main.style.background = 'lightgray'; + sibling.style.scrollTimelineName = 'timeline'; + assert_equals(getComputedStyle(target).translate, '100px'); + + main.remove(); +}, 'scroll-timeline-name affects subsequent siblings when changed'); + // TODO: Add more tests which change scroll-timeline-name property. // Those animations which use this timeline should be restyled propertly.
diff --git a/third_party/blink/web_tests/external/wpt/scroll-animations/css/at-scroll-timeline-dynamic.tentative.html b/third_party/blink/web_tests/external/wpt/scroll-animations/css/scroll-timeline-dynamic.tentative.html similarity index 69% rename from third_party/blink/web_tests/external/wpt/scroll-animations/css/at-scroll-timeline-dynamic.tentative.html rename to third_party/blink/web_tests/external/wpt/scroll-animations/css/scroll-timeline-dynamic.tentative.html index b646623..7bf35cd 100644 --- a/third_party/blink/web_tests/external/wpt/scroll-animations/css/at-scroll-timeline-dynamic.tentative.html +++ b/third_party/blink/web_tests/external/wpt/scroll-animations/css/scroll-timeline-dynamic.tentative.html
@@ -1,5 +1,5 @@ <!DOCTYPE html> -<link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#scroll-timeline-at-rule"> +<link rel="help" src="https://drafts.csswg.org/scroll-animations-1/#scroll-timelines"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/web-animations/testcommon.js"></script> @@ -49,29 +49,6 @@ return element; } - function insertSheet(text) { - let style = document.createElement('style'); - style.textContent = text; - container.append(style); - return style; - } - - // Insert an @scroll-timeline rule given 'options', where each option - // has a reasonable default. - function insertScrollTimeline(options) { - if (typeof(options) == 'undefined') - options = {}; - if (typeof(options.name) == 'undefined') - options.name = 'timeline'; - if (typeof(options.source) == 'undefined') - options.source = 'selector(#scroller1)'; - return insertSheet(` - @scroll-timeline ${options.name} { - source: ${options.source}; - } - `); - } - // Runs a test with dynamically added/removed elements or CSS rules. // Each test is instantiated twice: once for the initial style resolve where // the DOM change was effectuated, and once after scrolling. @@ -85,6 +62,8 @@ } finally { while (container.firstChild) container.firstChild.remove(); + scroller1.style = ''; + scroller2.style = ''; } }, description); }; @@ -114,14 +93,14 @@ await assert_width(element, '100px'); // Switch to scroll timeline. - let sheet1 = insertScrollTimeline(); - let sheet2 = insertSheet('#element { animation-timeline: timeline; }'); + scroller1.style.scrollTimelineName = 'timeline'; + element.style.animationTimeline = 'timeline'; await assert_width(element, '120px'); // Switching from ScrollTimeline -> DocumentTimeline should preserve // current time. - sheet1.remove(); - sheet2.remove(); + scroller1.style = ''; + element.style = ''; await assert_width(element, '120px'); }, 'Switching between document and scroll timelines'); @@ -129,28 +108,23 @@ let element = insertElement(); // Note: #scroller1 is at 20%, and #scroller2 is at 40%. - insertScrollTimeline({name: 'timeline1', source: 'selector(#scroller1)'}); - insertScrollTimeline({name: 'timeline2', source: 'selector(#scroller2)'}); - - insertSheet(` - .tl1 { animation-timeline: timeline1; } - .tl2 { animation-timeline: timeline2; } - `); + scroller1.style.scrollTimelineName = 'timeline1'; + scroller2.style.scrollTimelineName = 'timeline2'; await assert_width(element, '100px'); - element.classList.add('tl1'); + element.style.animationTimeline = 'timeline1'; await assert_width(element, '120px'); - element.classList.add('tl2'); + element.style.animationTimeline = 'timeline2'; await assert_width(element, '140px'); - element.classList.remove('tl2'); + element.style.animationTimeline = 'timeline1'; await assert_width(element, '120px'); // Switching from ScrollTimeline -> DocumentTimeline should preserve // current time. - element.classList.remove('tl1'); + element.style.animationTimeline = ''; await assert_width(element, '120px'); }, 'Changing computed value of animation-timeline changes effective timeline'); @@ -158,96 +132,95 @@ dynamic_rule_test(async (t, assert_width) => { let element = insertElement(); - insertScrollTimeline({source: 'selector(#scroller1)'}); - - insertSheet(` - .scroll { animation-timeline: timeline; } - .none { animation-timeline: none; } - `); + scroller1.style.scrollTimelineName = 'timeline'; // DocumentTimeline applies by default. await assert_width(element, '100px'); // DocumentTimeline -> none - element.classList.add('none'); + element.style.animationTimeline = 'none'; await assert_width(element, '0px'); // none -> DocumentTimeline - element.classList.remove('none'); + element.style.animationTimeline = ''; await assert_width(element, '100px'); // DocumentTimeline -> ScrollTimeline - element.classList.add('scroll'); + element.style.animationTimeline = 'timeline'; await assert_width(element, '120px'); // ScrollTimeline -> none - element.classList.add('none'); + element.style.animationTimeline = 'none'; await assert_width(element, '0px'); // none -> ScrollTimeline - element.classList.remove('none'); + element.style.animationTimeline = 'timeline'; await assert_width(element, '120px'); }, 'Changing to/from animation-timeline:none'); + dynamic_rule_test(async (t, assert_width) => { let element = insertElement(); - insertSheet('#element { animation-timeline: timeline; }'); + + element.style.animationTimeline = 'timeline'; // Unknown animation-timeline, current time held at zero. await assert_width(element, '100px'); - insertScrollTimeline({source: 'selector(#scroller1)'}); + scroller1.style.scrollTimelineName = 'timeline'; await assert_width(element, '120px'); - insertScrollTimeline({source: 'selector(#scroller2)'}); + scroller2.style.scrollTimelineName = 'timeline'; await assert_width(element, '140px'); - }, 'Changing the source descriptor switches effective timeline'); + }, 'Changing scroll-timeline on preceding elements affects target element'); + dynamic_rule_test(async (t, assert_width) => { let element = insertElement(); - let reverse = insertSheet('#element { animation-direction: reverse; }'); - insertSheet('#element { animation-timeline: timeline; }'); + + element.style.animationDirection = 'reverse'; + element.style.animationTimeline = 'timeline'; // Unknown animation-timeline, current time held at zero. await assert_width(element, '200px'); // Note: #scroller1 is at 20%. - insertScrollTimeline({source: 'selector(#scroller1)'}); + scroller1.style.scrollTimelineName = 'timeline'; await assert_width(element, '180px'); - // Note: #scroller1 is at 40%. - insertScrollTimeline({source: 'selector(#scroller2)'}); + // Note: #scroller2 is at 40%. + scroller2.style.scrollTimelineName = 'timeline'; await assert_width(element, '160px'); - reverse.remove(); + element.style.animationDirection = ''; await assert_width(element, '140px'); }, 'Reverse animation direction'); dynamic_rule_test(async (t, assert_width) => { let element = insertElement(); - insertSheet('#element { animation-timeline: timeline; }'); + element.style.animationTimeline = 'timeline'; // Unknown animation-timeline, current time held at zero. await assert_width(element, '100px'); // Note: #scroller1 is at 20%. - insertScrollTimeline({source: 'selector(#scroller1)'}); + scroller1.style.scrollTimelineName = 'timeline'; await assert_width(element, '120px'); - let paused = insertSheet('#element { animation-play-state: paused; }'); + element.style.animationPlayState = 'paused'; // We should still be at the same position after pausing. await assert_width(element, '120px'); - // Note: #scroller1 is at 40%. - insertScrollTimeline({source: 'selector(#scroller2)'}); + // Note: #scroller2 is at 40%. + scroller2.style.scrollTimelineName = 'timeline'; // Even when switching timelines, we should be at the same position until // we unpause. await assert_width(element, '120px'); // Unpausing should synchronize to the scroll position. - paused.remove(); + element.style.animationPlayState = ''; await assert_width(element, '140px'); }, 'Switching timelines while paused'); @@ -255,20 +228,18 @@ let element = insertElement(); // Note: #scroller1 is at 20%. - insertScrollTimeline({source: 'selector(#scroller1)'}); + scroller1.style.scrollTimelineName = 'timeline'; await assert_width(element, '100px'); - insertSheet(`#element { - animation-timeline: timeline; - animation-play-state: paused; - }`); + element.style.animationTimeline = 'timeline'; + element.style.animationPlayState = 'paused'; // Pausing should happen before the timeline is modified. (Tentative). // https://github.com/w3c/csswg-drafts/issues/5653 await assert_width(element, '100px'); - insertSheet('#element { animation-play-state: running; }'); + element.style.animationPlayState = 'running'; await assert_width(element, '120px'); }, 'Switching timelines and pausing at the same time'); </script>
diff --git a/third_party/blink/web_tests/wpt_internal/prerender/resources/web-nfc.https.html b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/resources/web-nfc.https.html similarity index 100% rename from third_party/blink/web_tests/wpt_internal/prerender/resources/web-nfc.https.html rename to third_party/blink/web_tests/external/wpt/speculation-rules/prerender/resources/web-nfc.https.html
diff --git a/third_party/blink/web_tests/wpt_internal/prerender/restriction-web-nfc.https.html b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-web-nfc.https.html similarity index 96% rename from third_party/blink/web_tests/wpt_internal/prerender/restriction-web-nfc.https.html rename to third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-web-nfc.https.html index 317d79ad..8e08255 100644 --- a/third_party/blink/web_tests/wpt_internal/prerender/restriction-web-nfc.https.html +++ b/third_party/blink/web_tests/external/wpt/speculation-rules/prerender/restriction-web-nfc.https.html
@@ -8,6 +8,8 @@ <body> <script> +setup(() => assertSpeculationRulesIsSupported()); + promise_test(async t => { const uid = token(); const bc = new PrerenderChannel('test-channel', uid);
diff --git a/third_party/blink/web_tests/platform/generic/external/wpt/FileAPI/url/sandboxed-iframe-expected.txt b/third_party/blink/web_tests/platform/generic/external/wpt/FileAPI/url/sandboxed-iframe-expected.txt index eaee6bf..5820516 100644 --- a/third_party/blink/web_tests/platform/generic/external/wpt/FileAPI/url/sandboxed-iframe-expected.txt +++ b/third_party/blink/web_tests/platform/generic/external/wpt/FileAPI/url/sandboxed-iframe-expected.txt
@@ -36,6 +36,7 @@ PASS fetch with method "CUSTOM" should fail PASS fetch should return Content-Type from Blob FAIL Revoke blob URL after creating Request, will fetch promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" +FAIL Revoke blob URL after creating Request, then clone Request, will fetch promise_test: Unhandled rejection with value: object "TypeError: Failed to fetch" PASS Revoke blob URL after calling fetch, fetch should succeed Harness: the test ran to completion.
diff --git a/third_party/nearby/README.chromium b/third_party/nearby/README.chromium index 85e56a8..a75e67d 100644 --- a/third_party/nearby/README.chromium +++ b/third_party/nearby/README.chromium
@@ -1,7 +1,7 @@ Name: Nearby Connections Library Short Name: Nearby URL: https://github.com/google/nearby -Version: bbd6986f06b8662bf48bb07fde5c41896dd6a706 +Version: 01a4daffd286651c408572e0096448d83f1e51f6 License: Apache 2.0 License File: LICENSE Security Critical: yes
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 4eea89f..0f395311 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -30522,13 +30522,21 @@ </action> <action name="StatusArea_Audio_SwitchInputDevice"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <description>Please enter the description of this user action.</description> + <owner>judyhsiao@google.com</owner> + <owner>aaronyu@google.com</owner> + <owner>chromeos-audio-sw@google.com</owner> + <description> + User selected an audio input device from the SystemTray. + </description> </action> <action name="StatusArea_Audio_SwitchOutputDevice"> - <owner>Please list the metric's owners. Add more owner tags as needed.</owner> - <description>Please enter the description of this user action.</description> + <owner>judyhsiao@google.com</owner> + <owner>aaronyu@google.com</owner> + <owner>chromeos-audio-sw@google.com</owner> + <description> + User selected an audio output device from the SystemTray. + </description> </action> <action name="StatusArea_Audio_Unmuted">
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 68ebe94..b57b17c 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -59818,6 +59818,7 @@ <int value="293996306" label="ArrayPrototypeValues:disabled"/> <int value="294150128" label="RelatedSearchesSimplifiedUx:enabled"/> <int value="294194537" label="ChromeOSAmbientModeAnimation:disabled"/> + <int value="294946885" label="WebViewThrottleBackgroundBeginFrame:disabled"/> <int value="295661985" label="video-capture-use-gpu-memory-buffer"/> <int value="296066418" label="CCTResizableForThirdParties:disabled"/> <int value="296215399" label="WindowsMixedReality:disabled"/> @@ -60492,6 +60493,7 @@ <int value="705946076" label="ContextMenuPerformanceInfoAndRemoteHintFetching:disabled"/> <int value="706280254" label="StoragePressureEvent:enabled"/> + <int value="708185835" label="WebViewThrottleBackgroundBeginFrame:enabled"/> <int value="709138900" label="InstantStart:enabled"/> <int value="709850261" label="disable-touch-editing"/> <int value="710700286" label="ImmersiveFullscreen:disabled"/>
diff --git a/tools/metrics/histograms/histograms_index.txt b/tools/metrics/histograms/histograms_index.txt index 5436c01..860943b 100644 --- a/tools/metrics/histograms/histograms_index.txt +++ b/tools/metrics/histograms/histograms_index.txt
@@ -62,6 +62,7 @@ tools/metrics/histograms/metadata/invalidation/histograms.xml tools/metrics/histograms/metadata/ios/histograms.xml tools/metrics/histograms/metadata/kerberos/histograms.xml +tools/metrics/histograms/metadata/kiosk/histograms.xml tools/metrics/histograms/metadata/language/histograms.xml tools/metrics/histograms/metadata/leveldb_proto/histograms.xml tools/metrics/histograms/metadata/local/histograms.xml
diff --git a/tools/metrics/histograms/metadata/chromeos/histograms.xml b/tools/metrics/histograms/metadata/chromeos/histograms.xml index fc225cb6..bc00c38 100644 --- a/tools/metrics/histograms/metadata/chromeos/histograms.xml +++ b/tools/metrics/histograms/metadata/chromeos/histograms.xml
@@ -1484,7 +1484,7 @@ </histogram> <histogram name="ChromeOS.SAML.APILogin" enum="ChromeOSSamlApiUsed" - expires_after="2022-10-02"> + expires_after="2023-04-02"> <owner>mslus@chromium.org</owner> <owner>emaxx@chromium.org</owner> <summary> @@ -1493,7 +1493,7 @@ </histogram> <histogram name="ChromeOS.SAML.InSessionPasswordChangeEvent" - enum="SamlInSessionPasswordChangeEvent" expires_after="2022-09-12"> + enum="SamlInSessionPasswordChangeEvent" expires_after="2023-03-12"> <owner>mslus@chromium.org</owner> <owner>rsorokin@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/kiosk/OWNERS b/tools/metrics/histograms/metadata/kiosk/OWNERS new file mode 100644 index 0000000..1a38fb5a --- /dev/null +++ b/tools/metrics/histograms/metadata/kiosk/OWNERS
@@ -0,0 +1,5 @@ +per-file OWNERS=file://tools/metrics/histograms/metadata/METRIC_REVIEWER_OWNERS + +# Prefer sending CLs to the kiosk owners. +# Use chromium-metrics-reviews@google.com as a backup. +file://chrome/browser/ash/app_mode/OWNERS
diff --git a/tools/metrics/histograms/metadata/kiosk/histograms.xml b/tools/metrics/histograms/metadata/kiosk/histograms.xml new file mode 100644 index 0000000..8a830d4 --- /dev/null +++ b/tools/metrics/histograms/metadata/kiosk/histograms.xml
@@ -0,0 +1,266 @@ +<!-- +Copyright 2022 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. +--> + +<!-- +This file is used to generate a comprehensive list of Kiosk histograms along +with a detailed description for each histogram. + +For best practices on writing histogram descriptions, see +https://chromium.googlesource.com/chromium/src.git/+/HEAD/tools/metrics/histograms/README.md + +Please follow the instructions in the OWNERS file in this directory to find a +reviewer. If no OWNERS file exists, please consider signing up at +go/reviewing-metrics (Googlers only), as all subdirectories are expected to +have an OWNERS file. As a last resort you can send the CL to +chromium-metrics-reviews@google.com. +--> + +<histogram-configuration> + +<histograms> + +<histogram name="Kiosk.DiskUsagePercentage" units="%" + expires_after="2023-07-01"> + <owner>vkovalova@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary> + ChromeOS only. Records the percentage of disk space in use. Starts being + recorded when a kiosk session is started. Emitted once per hour. + </summary> +</histogram> + +<histogram name="Kiosk.Extensions.InstallDuration" units="ms" + expires_after="2023-08-10"> + <owner>yixie@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary> + Records the duration for Kiosk launcher to wait for forced extensions to + install. + </summary> +</histogram> + +<histogram name="Kiosk.Extensions.InstallError.{InstallSource}" + enum="ExtensionInstallationFailureReason" expires_after="2022-10-01"> + <owner>yixie@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary> + Records the reason for a Kiosk forced {InstallSource} extension install + error. (Chrome OS only) + </summary> + <token key="InstallSource"> + <variant name="OffStore" summary="non-Web-Store"/> + <variant name="WebStore" summary="Web Store"/> + </token> +</histogram> + +<histogram name="Kiosk.Extensions.InstallTimedOut" enum="BooleanYesNo" + expires_after="2023-08-10"> + <owner>yixie@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary> + Records whether Kiosk launcher times out waiting for extensions to install. + Only recorded if forced extensions starts installing while a Web Kiosk is + launching. + </summary> +</histogram> + +<histogram name="Kiosk.Launch.CryptohomeFailure" enum="LoginFailureReason" + expires_after="2023-02-12"> + <owner>xiyuan@chromium.org</owner> + <owner>apotapchuk@chromium.org</owner> + <summary>Tracks cryptohome failure during kiosk launch.</summary> +</histogram> + +<histogram name="Kiosk.Launch.Error" enum="KioskLaunchError" + expires_after="2023-02-12"> + <owner>xiyuan@chromium.org</owner> + <owner>apotapchuk@chromium.org</owner> + <summary> + Tracks Chrome OS Kiosk launch errors. Recorded when a Kiosk app fails to + launch and returns to the login screen. + </summary> +</histogram> + +<histogram name="Kiosk.LaunchDuration.{KioskType}" units="ms" + expires_after="2023-08-10"> + <owner>yixie@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary>Records the total duration it takes to launch a kiosk app.</summary> + <token key="KioskType"> + <variant name="Arc"/> + <variant name="ChromeApp"/> + <variant name="Web"/> + </token> +</histogram> + +<histogram name="Kiosk.LaunchType" enum="KioskLaunchType" + expires_after="2023-04-24"> + <owner>xiyuan@chromium.org</owner> + <owner>aghuie@chromium.org</owner> + <summary> + Records kiosk launches, whether it is an enterprise or consumer kiosk and + whether it is an auto launch or manual launch. + </summary> +</histogram> + +<histogram name="Kiosk.NewBrowserWindow" enum="KioskBrowserWindowType" + expires_after="2023-07-01"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary> + ChromeOS only. Records a new browser window type once a new browser window + is attempted to be shown in a kiosk session. Currently distinguishes only + settings page from others, which get closed immediately. + </summary> +</histogram> + +<histogram name="Kiosk.RamUsagePercentage" units="%" expires_after="2023-07-01"> + <owner>vkovalova@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary> + ChromeOS only. Records the percentage of RAM in use. Starts being recorded + when a kiosk session is started. Emitted once per hour. + </summary> +</histogram> + +<histogram name="Kiosk.SecondaryApps.InstallSuccessful" enum="BooleanYesNo" + expires_after="2023-01-15"> + <owner>yixie@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary> + Records whether secondary apps are installed successfully in a Chrome App + Kiosk. Only recorded once per Kiosk session which has secondary apps. + </summary> +</histogram> + +<histogram name="Kiosk.Session.CountPerDay" units="sessions" + expires_after="2023-03-22"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@chromium.org</owner> + <summary> + ChromeOS only. Count of Kiosk sessions in the last 24h. Logged each time a + kiosk session is started. + </summary> +</histogram> + +<histogram name="Kiosk.Session.LowDiskHighestSeverity" + enum="KioskLowDiskSeverity" expires_after="2023-07-01"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@chromium.org</owner> + <summary> + ChromeOS only. Records the highest severity of low disk notification of a + kiosk session. Logged on every kiosk session start, even if there was no + notification during the last session. + </summary> +</histogram> + +<histogram name="Kiosk.Session.LowDiskSeverity" enum="KioskLowDiskSeverity" + expires_after="2023-07-01"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@chromium.org</owner> + <summary> + ChromeOS only. Records low disk notifications being issued. Logged once a + low disk notification is supposed to be shown. + </summary> +</histogram> + +<histogram name="Kiosk.Session.NetworkDrops" units="network drops" + expires_after="2023-06-01"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@chromium.org</owner> + <summary> + ChromeOS only. Number of network drops during a kiosk session. Logged on the + next kiosk session start. + </summary> +</histogram> + +<histogram name="Kiosk.SessionDuration.Crashed" units="ms" + expires_after="2023-04-20"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@chromium.org</owner> + <summary> + ChromeOS only. Duration of a kiosk session that ended with a crash. Metrics + in this histogram are capped to 1 day (24 hours) to measure the number of + long sessions compared to short ones. See also + Kiosk.SessionDurationInDays.Crashed. + + Note: Duration may be longer than actual session duration, because some + crashes can be detected only on the next session start up. In those cases a + duration effectively is a time between crashed session start and the + following kiosk session start. + </summary> +</histogram> + +<histogram name="Kiosk.SessionDuration.Normal" units="ms" + expires_after="2023-04-20"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@chromium.org</owner> + <summary> + ChromeOS only. Duration of a kiosk session that ended successfully. Metrics + in this histogram are capped to 1 day (24 hours) to measure the number of + long sessions compared to short ones. See also + Kiosk.SessionDurationInDays.Normal. + </summary> +</histogram> + +<histogram name="Kiosk.SessionDurationInDays.Crashed" units="days" + expires_after="2023-04-20"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@chromium.org</owner> + <summary> + ChromeOS only. Duration in days of a kiosk session that ended with a crash. + This metric only tracks kiosk sessions that last longer than 1 day. + + Note: Duration may be longer than actual session duration, because some + crashes can be detected only on the next session start up. In those cases a + duration effectively is a time between crashed session start and the + following kiosk session start. + </summary> +</histogram> + +<histogram name="Kiosk.SessionDurationInDays.Normal" units="days" + expires_after="2023-04-20"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@chromium.org</owner> + <summary> + ChromeOS only. Duration in days of a kiosk session that ended successfully. + This metric only tracks kiosk sessions that last longer than 1 day. + </summary> +</histogram> + +<histogram name="Kiosk.SessionState" enum="KioskSessionState" + expires_after="2023-03-22"> + <owner>pbond@chromium.org</owner> + <owner>chromeos-kiosk-eng@chromium.org</owner> + <summary> + ChromeOS only. Records kiosk session states, whether it is started, closed, + crashed, etc. Emitted when the kiosk session state changes. Crashed kiosk + sessions can be detected on the following kiosk start. + </summary> +</histogram> + +<histogram name="Kiosk.SwapUsagePercentage" units="%" + expires_after="2023-07-01"> + <owner>vkovalova@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary> + ChromeOS only. Records the percentage of swap memory in use. Starts being + recorded when a kiosk session is started. Emitted once per hour. + </summary> +</histogram> + +<histogram name="Kiosk.WebApp.InstallError" enum="WebAppInstallResultCode" + expires_after="2022-10-01"> + <owner>yixie@chromium.org</owner> + <owner>chromeos-kiosk-eng@google.com</owner> + <summary> + Records the reason for Web App install error in a Web Kiosk. + </summary> +</histogram> + +</histograms> + +</histogram-configuration>
diff --git a/tools/metrics/histograms/metadata/others/histograms.xml b/tools/metrics/histograms/metadata/others/histograms.xml index 2d032c81..9df01fb 100644 --- a/tools/metrics/histograms/metadata/others/histograms.xml +++ b/tools/metrics/histograms/metadata/others/histograms.xml
@@ -7223,245 +7223,6 @@ <summary>The scheme of the URL showing a JavaScript dialog.</summary> </histogram> -<histogram name="Kiosk.DiskUsagePercentage" units="%" - expires_after="2023-07-01"> - <owner>vkovalova@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary> - ChromeOS only. Records the percentage of disk space in use. Starts being - recorded when a kiosk session is started. Emitted once per hour. - </summary> -</histogram> - -<histogram name="Kiosk.Extensions.InstallDuration" units="ms" - expires_after="2023-08-10"> - <owner>yixie@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary> - Records the duration for Kiosk launcher to wait for forced extensions to - install. - </summary> -</histogram> - -<histogram name="Kiosk.Extensions.InstallError.{InstallSource}" - enum="ExtensionInstallationFailureReason" expires_after="2022-10-01"> - <owner>yixie@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary> - Records the reason for a Kiosk forced {InstallSource} extension install - error. (Chrome OS only) - </summary> - <token key="InstallSource"> - <variant name="OffStore" summary="non-Web-Store"/> - <variant name="WebStore" summary="Web Store"/> - </token> -</histogram> - -<histogram name="Kiosk.Extensions.InstallTimedOut" enum="BooleanYesNo" - expires_after="2023-08-10"> - <owner>yixie@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary> - Records whether Kiosk launcher times out waiting for extensions to install. - Only recorded if forced extensions starts installing while a Web Kiosk is - launching. - </summary> -</histogram> - -<histogram name="Kiosk.Launch.CryptohomeFailure" enum="LoginFailureReason" - expires_after="2023-02-12"> - <owner>xiyuan@chromium.org</owner> - <owner>apotapchuk@chromium.org</owner> - <summary>Tracks cryptohome failure during kiosk launch.</summary> -</histogram> - -<histogram name="Kiosk.Launch.Error" enum="KioskLaunchError" - expires_after="2023-02-12"> - <owner>xiyuan@chromium.org</owner> - <owner>apotapchuk@chromium.org</owner> - <summary> - Tracks Chrome OS Kiosk launch errors. Recorded when a Kiosk app fails to - launch and returns to the login screen. - </summary> -</histogram> - -<histogram name="Kiosk.LaunchDuration.{KioskType}" units="ms" - expires_after="2023-08-10"> - <owner>yixie@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary>Records the total duration it takes to launch a kiosk app.</summary> - <token key="KioskType"> - <variant name="Arc"/> - <variant name="ChromeApp"/> - <variant name="Web"/> - </token> -</histogram> - -<histogram name="Kiosk.LaunchType" enum="KioskLaunchType" - expires_after="2023-04-24"> - <owner>xiyuan@chromium.org</owner> - <owner>aghuie@chromium.org</owner> - <summary> - Records kiosk launches, whether it is an enterprise or consumer kiosk and - whether it is an auto launch or manual launch. - </summary> -</histogram> - -<histogram name="Kiosk.NewBrowserWindow" enum="KioskBrowserWindowType" - expires_after="2023-07-01"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary> - ChromeOS only. Records a new browser window type once a new browser window - is attempted to be shown in a kiosk session. Currently distinguishes only - settings page from others, which get closed immediately. - </summary> -</histogram> - -<histogram name="Kiosk.RamUsagePercentage" units="%" expires_after="2023-07-01"> - <owner>vkovalova@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary> - ChromeOS only. Records the percentage of RAM in use. Starts being recorded - when a kiosk session is started. Emitted once per hour. - </summary> -</histogram> - -<histogram name="Kiosk.SecondaryApps.InstallSuccessful" enum="BooleanYesNo" - expires_after="2023-01-15"> - <owner>yixie@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary> - Records whether secondary apps are installed successfully in a Chrome App - Kiosk. Only recorded once per Kiosk session which has secondary apps. - </summary> -</histogram> - -<histogram name="Kiosk.Session.CountPerDay" units="sessions" - expires_after="2023-03-22"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@chromium.org</owner> - <summary> - ChromeOS only. Count of Kiosk sessions in the last 24h. Logged each time a - kiosk session is started. - </summary> -</histogram> - -<histogram name="Kiosk.Session.LowDiskHighestSeverity" - enum="KioskLowDiskSeverity" expires_after="2023-07-01"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@chromium.org</owner> - <summary> - ChromeOS only. Records the highest severity of low disk notification of a - kiosk session. Logged on every kiosk session start, even if there was no - notification during the last session. - </summary> -</histogram> - -<histogram name="Kiosk.Session.LowDiskSeverity" enum="KioskLowDiskSeverity" - expires_after="2023-07-01"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@chromium.org</owner> - <summary> - ChromeOS only. Records low disk notifications being issued. Logged once a - low disk notification is supposed to be shown. - </summary> -</histogram> - -<histogram name="Kiosk.Session.NetworkDrops" units="network drops" - expires_after="2023-06-01"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@chromium.org</owner> - <summary> - ChromeOS only. Number of network drops during a kiosk session. Logged on the - next kiosk session start. - </summary> -</histogram> - -<histogram name="Kiosk.SessionDuration.Crashed" units="ms" - expires_after="2023-04-20"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@chromium.org</owner> - <summary> - ChromeOS only. Duration of a kiosk session that ended with a crash. Metrics - in this histogram are capped to 1 day (24 hours) to measure the number of - long sessions compared to short ones. See also - Kiosk.SessionDurationInDays.Crashed. - - Note: Duration may be longer than actual session duration, because some - crashes can be detected only on the next session start up. In those cases a - duration effectively is a time between crashed session start and the - following kiosk session start. - </summary> -</histogram> - -<histogram name="Kiosk.SessionDuration.Normal" units="ms" - expires_after="2023-04-20"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@chromium.org</owner> - <summary> - ChromeOS only. Duration of a kiosk session that ended successfully. Metrics - in this histogram are capped to 1 day (24 hours) to measure the number of - long sessions compared to short ones. See also - Kiosk.SessionDurationInDays.Normal. - </summary> -</histogram> - -<histogram name="Kiosk.SessionDurationInDays.Crashed" units="days" - expires_after="2023-04-20"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@chromium.org</owner> - <summary> - ChromeOS only. Duration in days of a kiosk session that ended with a crash. - This metric only tracks kiosk sessions that last longer than 1 day. - - Note: Duration may be longer than actual session duration, because some - crashes can be detected only on the next session start up. In those cases a - duration effectively is a time between crashed session start and the - following kiosk session start. - </summary> -</histogram> - -<histogram name="Kiosk.SessionDurationInDays.Normal" units="days" - expires_after="2023-04-20"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@chromium.org</owner> - <summary> - ChromeOS only. Duration in days of a kiosk session that ended successfully. - This metric only tracks kiosk sessions that last longer than 1 day. - </summary> -</histogram> - -<histogram name="Kiosk.SessionState" enum="KioskSessionState" - expires_after="2023-03-22"> - <owner>pbond@chromium.org</owner> - <owner>chromeos-kiosk-eng@chromium.org</owner> - <summary> - ChromeOS only. Records kiosk session states, whether it is started, closed, - crashed, etc. Emitted when the kiosk session state changes. Crashed kiosk - sessions can be detected on the following kiosk start. - </summary> -</histogram> - -<histogram name="Kiosk.SwapUsagePercentage" units="%" - expires_after="2023-07-01"> - <owner>vkovalova@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary> - ChromeOS only. Records the percentage of swap memory in use. Starts being - recorded when a kiosk session is started. Emitted once per hour. - </summary> -</histogram> - -<histogram name="Kiosk.WebApp.InstallError" enum="WebAppInstallResultCode" - expires_after="2022-10-01"> - <owner>yixie@chromium.org</owner> - <owner>chromeos-kiosk-eng@google.com</owner> - <summary> - Records the reason for Web App install error in a Web Kiosk. - </summary> -</histogram> - <histogram name="Launch.FlagsAtStartup" enum="LoginCustomFlags" expires_after="never"> <!-- expires-never: monitors use of all flags. -->
diff --git a/tools/metrics/histograms/metadata/signin/histograms.xml b/tools/metrics/histograms/metadata/signin/histograms.xml index d6ec046..7a8979ce2 100644 --- a/tools/metrics/histograms/metadata/signin/histograms.xml +++ b/tools/metrics/histograms/metadata/signin/histograms.xml
@@ -451,7 +451,7 @@ </histogram> <histogram name="Signin.Intercept.AccountInfoFetchDuration" units="ms" - expires_after="M106"> + expires_after="2023-01-22"> <owner>alexilin@chromium.org</owner> <owner>droger@chromium.org</owner> <summary> @@ -460,7 +460,7 @@ </histogram> <histogram name="Signin.Intercept.FRE.Event" - enum="SigninInterceptFREDialogEvent" expires_after="M106"> + enum="SigninInterceptFREDialogEvent" expires_after="2023-01-22"> <owner>alexilin@chromium.org</owner> <owner>chrome-signin-team@google.com</owner> <summary> @@ -480,7 +480,7 @@ </histogram> <histogram name="Signin.Intercept.ProfileCreationDuration" units="ms" - expires_after="M106"> + expires_after="2023-01-22"> <owner>alexilin@chromium.org</owner> <owner>droger@chromium.org</owner> <summary> @@ -490,7 +490,7 @@ </histogram> <histogram name="Signin.Intercept.ProfileSwitchDuration" units="ms" - expires_after="M106"> + expires_after="2023-01-22"> <owner>alexilin@chromium.org</owner> <owner>droger@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/storage/histograms.xml b/tools/metrics/histograms/metadata/storage/histograms.xml index c4702cd..8a4afdb 100644 --- a/tools/metrics/histograms/metadata/storage/histograms.xml +++ b/tools/metrics/histograms/metadata/storage/histograms.xml
@@ -555,6 +555,142 @@ </summary> </histogram> +<histogram name="Storage.SharedStorage.Database.FileBacked.FileSize.GB" + units="GB" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + The size in gigabytes of the SQL database file backing + `SharedStorageDatabase`. Measured only for file-backed databases of size at + least one gigabyte. Recorded in `SharedStorageDatabase::InitImpl()` via + `LogInitHistograms()` when initialization is successful. + </summary> +</histogram> + +<histogram name="Storage.SharedStorage.Database.FileBacked.FileSize.KB" + units="KB" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + The size in kilobytes of the SQL database file backing + `SharedStorageDatabase`. Measured for file-backed databases only. Recorded + in `SharedStorageDatabase::InitImpl()` via `LogInitHistograms()` when + initialization is successful. + </summary> +</histogram> + +<histogram + name="Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Max" + units="Entries" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + Maximum origin length, according to the `per_origin_mapping` of + `SharedStorageDatabase`. Measured for file-backed databases only. Recorded + in `SharedStorageDatabase::InitImpl()` via `LogInitHistograms()` when + initialization is successful. + </summary> +</histogram> + +<histogram + name="Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Median" + units="Entries" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + Median origin length, according to the `per_origin_mapping` of + `SharedStorageDatabase`. Measured for file-backed databases only. Recorded + in `SharedStorageDatabase::InitImpl()` via `LogInitHistograms()` when + initialization is successful. + </summary> +</histogram> + +<histogram + name="Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Min" + units="Entries" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + Minimum origin length, according to the `per_origin_mapping` of + `SharedStorageDatabase`. Measured for file-backed databases only. Recorded + in `SharedStorageDatabase::InitImpl()` via `LogInitHistograms()` when + initialization is successful. + </summary> +</histogram> + +<histogram + name="Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Q1" + units="Entries" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + Lower quartile of the origin lengths, as listed in the `per_origin_mapping` + of `SharedStorageDatabase` (calculated through Method 1 from + https://en.wikipedia.org/wiki/Quartile). Measured for file-backed databases + only. Recorded in `SharedStorageDatabase::InitImpl()` via + `LogInitHistograms()` when initialization is successful. + </summary> +</histogram> + +<histogram + name="Storage.SharedStorage.Database.FileBacked.NumEntries.PerOrigin.Q3" + units="Entries" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + Upper quartile of the origin lengths, as listed in the `per_origin_mapping` + of `SharedStorageDatabase` (calculated through Method 1 from + https://en.wikipedia.org/wiki/Quartile). Measured for file-backed databases + only. Recorded in `SharedStorageDatabase::InitImpl()` via + `LogInitHistograms()` when initialization is successful. + </summary> +</histogram> + +<histogram name="Storage.SharedStorage.Database.FileBacked.NumEntries.Total" + units="Entries" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + The total count of entries in the `values_mapping` of + `SharedStorageDatabase`. Measured for file-backed databases only. Recorded + in `SharedStorageDatabase::InitImpl()` via `LogInitHistograms()` when + initialization is successful. + </summary> +</histogram> + +<histogram name="Storage.SharedStorage.Database.FileBacked.NumOrigins" + units="Origins" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + Number of origins in the `per_origin_mapping` of `SharedStorageDatabase`. + Measured for file-backed databases only. Recorded in + `SharedStorageDatabase::InitImpl()` via `LogInitHistograms()` when + initialization is successful. + </summary> +</histogram> + +<histogram name="Storage.SharedStorage.Database.IsFileBacked" + units="BooleanIsFileBacked" expires_after="2023-07-31"> + <owner>cammie@chromium.org</owner> + <owner>yaoxia@chromium.org</owner> + <owner>chrome-ads-histograms@google.com</owner> + <summary> + Whether or not the database is file-backed. Recorded in + `SharedStorageDatabase::InitImpl()` via `LogInitHistograms()` when + initialization is successful. + </summary> +</histogram> + <histogram name="Storage.SharedStorage.Document.Timing.AddModule" units="ms" expires_after="2023-07-31"> <owner>cammie@chromium.org</owner>
diff --git a/tools/perf/benchmarks/benchmark_smoke_unittest.py b/tools/perf/benchmarks/benchmark_smoke_unittest.py index 0274de9..fbb148d 100644 --- a/tools/perf/benchmarks/benchmark_smoke_unittest.py +++ b/tools/perf/benchmarks/benchmark_smoke_unittest.py
@@ -27,6 +27,7 @@ from benchmarks import jetstream from benchmarks import jetstream2 +from benchmarks import kraken from benchmarks import octane from benchmarks import rasterize_and_record_micro from benchmarks import speedometer @@ -105,6 +106,7 @@ jetstream, # Take 206 seconds. jetstream2, # Causes CQ shard to timeout, crbug.com/992837 v8_browsing, # Flaky on Android, crbug.com/628368. + kraken, # Crashes on CQ blocking LKGM, b/243415984 } # The list of benchmark names to be excluded from our smoke tests.
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 40c53ed..4866540 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -13,16 +13,16 @@ "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux_arm/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "mac": { - "hash": "361cf8b371291916d5f0314367707fa587ae2647", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/695a70b29174a7dc11107885a7f713d75b3856d4/trace_processor_shell" + "hash": "70c67bc92a5d8b81431b10ed8e485fc4063e3935", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/mac/a82ecd97e644d25ac660fffe894e2b4adee3493f/trace_processor_shell" }, "mac_arm64": { "hash": "e1ad4861384b06d911a65f035317914b8cc975c6", "full_remote_path": "perfetto-luci-artifacts/v25.0/mac-arm64/trace_processor_shell" }, "linux": { - "hash": "1a46112d1c1788ab0037e53458d9104fd932452e", - "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/695a70b29174a7dc11107885a7f713d75b3856d4/trace_processor_shell" + "hash": "f691d2e3d4bad34388f5ad4cca91a40ea4152f4f", + "full_remote_path": "chromium-telemetry/perfetto_binaries/trace_processor_shell/linux/a82ecd97e644d25ac660fffe894e2b4adee3493f/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc index cad4025..6eb5502 100644 --- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
@@ -356,17 +356,11 @@ SizeConstraintsChanged(); } -void WaylandToplevelWindow::HandleToplevelConfigure(int32_t width_dip, - int32_t height_dip, - bool is_maximized, - bool is_fullscreen, - bool is_activated) { - HandleAuraToplevelConfigure(0, 0, width_dip, height_dip, - { - .is_maximized = is_maximized, - .is_fullscreen = is_fullscreen, - .is_activated = is_activated, - }); +void WaylandToplevelWindow::HandleToplevelConfigure( + int32_t width_dip, + int32_t height_dip, + const WindowStates& window_states) { + HandleAuraToplevelConfigure(0, 0, width_dip, height_dip, window_states); } void WaylandToplevelWindow::HandleAuraToplevelConfigure(
diff --git a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h index 6a68d54..9a38b72 100644 --- a/ui/ozone/platform/wayland/host/wayland_toplevel_window.h +++ b/ui/ozone/platform/wayland/host/wayland_toplevel_window.h
@@ -95,9 +95,7 @@ void UpdateWindowScale(bool update_bounds) override; void HandleToplevelConfigure(int32_t width, int32_t height, - bool is_maximized, - bool is_fullscreen, - bool is_activated) override; + const WindowStates& window_states) override; void HandleAuraToplevelConfigure(int32_t x, int32_t y, int32_t width,
diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc index 8799a4b2..1e7aab70 100644 --- a/ui/ozone/platform/wayland/host/wayland_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_window.cc
@@ -523,9 +523,7 @@ void WaylandWindow::HandleToplevelConfigure(int32_t widht, int32_t height, - bool is_maximized, - bool is_fullscreen, - bool is_activated) { + const WindowStates& window_states) { NOTREACHED() << "Only shell toplevels must receive HandleToplevelConfigure calls."; }
diff --git a/ui/ozone/platform/wayland/host/wayland_window.h b/ui/ozone/platform/wayland/host/wayland_window.h index eeeda370..404431a 100644 --- a/ui/ozone/platform/wayland/host/wayland_window.h +++ b/ui/ozone/platform/wayland/host/wayland_window.h
@@ -219,11 +219,6 @@ // The width and height come in DIP of the output that the surface is // currently bound to. virtual void HandleSurfaceConfigure(uint32_t serial); - virtual void HandleToplevelConfigure(int32_t width, - int32_t height, - bool is_maximized, - bool is_fullscreen, - bool is_activated); struct WindowStates { bool is_maximized = false; @@ -231,7 +226,17 @@ bool is_activated = false; bool is_snapped_primary = false; bool is_snapped_secondary = false; + struct { + bool left = false; + bool right = false; + bool top = false; + bool bottom = false; + } tiled_edges; }; + + virtual void HandleToplevelConfigure(int32_t width, + int32_t height, + const WindowStates& window_states); virtual void HandleAuraToplevelConfigure(int32_t x, int32_t y, int32_t width,
diff --git a/ui/ozone/platform/wayland/host/xdg_activation.cc b/ui/ozone/platform/wayland/host/xdg_activation.cc index ad964e91..16febe1 100644 --- a/ui/ozone/platform/wayland/host/xdg_activation.cc +++ b/ui/ozone/platform/wayland/host/xdg_activation.cc
@@ -87,9 +87,9 @@ } if (token_.get() != nullptr) { - // TODO(crbug.com/1175327): chain the incoming request and try to serve it - // after the current one is done. - LOG(WARNING) << "Another activation request is in progress!"; + // If the earlier activation request is still being served, store the + // incoming request and try to serve it after the current one is done. + activation_queue_.emplace(surface); return; } @@ -114,6 +114,10 @@ void XdgActivation::OnActivateDone(wl_surface* surface, std::string token) { xdg_activation_v1_activate(xdg_activation_v1_.get(), token.c_str(), surface); token_.reset(); + if (!activation_queue_.empty()) { + Activate(activation_queue_.front()); + activation_queue_.pop(); + } } XdgActivation::Token::Token(wl::Object<xdg_activation_token_v1> token,
diff --git a/ui/ozone/platform/wayland/host/xdg_activation.h b/ui/ozone/platform/wayland/host/xdg_activation.h index 3256996..ab133e2 100644 --- a/ui/ozone/platform/wayland/host/xdg_activation.h +++ b/ui/ozone/platform/wayland/host/xdg_activation.h
@@ -5,6 +5,7 @@ #ifndef UI_OZONE_PLATFORM_WAYLAND_HOST_XDG_ACTIVATION_H_ #define UI_OZONE_PLATFORM_WAYLAND_HOST_XDG_ACTIVATION_H_ +#include "base/containers/queue.h" #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "ui/ozone/platform/wayland/common/wayland_object.h" @@ -31,8 +32,10 @@ // Requests activation of the `surface`. // The actual activation happens asynchronously, after a round trip to the // server. - // Does nothing if no other window is currently active, or if there is already - // an unfinished activation request. + // If there is another unfinished activation request, the method chains the + // new request in the `activation_queue_` and handles it after the current + // request is completed. + // Does nothing if no other window is currently active. void Activate(wl_surface* surface) const; private: @@ -44,6 +47,8 @@ wl::Object<xdg_activation_v1> xdg_activation_v1_; // The actual activation token. mutable std::unique_ptr<Token> token_; + // Surfaces to activate next. + mutable base::queue<raw_ptr<wl_surface>> activation_queue_; const raw_ptr<WaylandConnection> connection_;
diff --git a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc index 4012114..85bbea64 100644 --- a/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc +++ b/ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
@@ -247,15 +247,29 @@ auto* surface = static_cast<XDGToplevelWrapperImpl*>(data); DCHECK(surface); - bool is_maximized = - CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_MAXIMIZED); - bool is_fullscreen = - CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_FULLSCREEN); - bool is_activated = - CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_ACTIVATED); + WaylandWindow::WindowStates window_states{ + .is_maximized = + CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_MAXIMIZED), + .is_fullscreen = + CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_FULLSCREEN), + .is_activated = + CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_ACTIVATED), + }; - surface->wayland_window_->HandleToplevelConfigure( - width, height, is_maximized, is_fullscreen, is_activated); + if (xdg_toplevel_get_version(xdg_toplevel) >= + XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION) { + // All four tiled states have the same since version, so it is enough to + // check only one. + window_states.tiled_edges = { + .left = CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_TILED_LEFT), + .right = CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_TILED_RIGHT), + .top = CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_TILED_TOP), + .bottom = + CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_TILED_BOTTOM)}; + } + + surface->wayland_window_->HandleToplevelConfigure(width, height, + window_states); } // static
diff --git a/ui/ozone/platform/wayland/host/zxdg_toplevel_v6_wrapper_impl.cc b/ui/ozone/platform/wayland/host/zxdg_toplevel_v6_wrapper_impl.cc index b48a5e67..81abd2af 100644 --- a/ui/ozone/platform/wayland/host/zxdg_toplevel_v6_wrapper_impl.cc +++ b/ui/ozone/platform/wayland/host/zxdg_toplevel_v6_wrapper_impl.cc
@@ -165,15 +165,16 @@ auto* surface = static_cast<ZXDGToplevelV6WrapperImpl*>(data); DCHECK(surface); - bool is_maximized = - CheckIfWlArrayHasValue(states, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED); - bool is_fullscreen = - CheckIfWlArrayHasValue(states, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN); - bool is_activated = - CheckIfWlArrayHasValue(states, ZXDG_TOPLEVEL_V6_STATE_ACTIVATED); - surface->wayland_window_->HandleToplevelConfigure( - width, height, is_maximized, is_fullscreen, is_activated); + width, height, + { + .is_maximized = + CheckIfWlArrayHasValue(states, ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED), + .is_fullscreen = + CheckIfWlArrayHasValue(states, ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN), + .is_activated = + CheckIfWlArrayHasValue(states, ZXDG_TOPLEVEL_V6_STATE_ACTIVATED), + }); } // static
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index 269c7a6..ccca4625 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -310,10 +310,14 @@ } DesktopNativeWidgetAura::~DesktopNativeWidgetAura() { - if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) - delete native_widget_delegate_; - else + if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) { + // Use `ClearAndDelete` here to stop referencing the underlying pointer and + // free its memory. Compared to raw delete calls, this avoids the raw_ptr + // to be temporarily dangling. + native_widget_delegate_.ClearAndDelete(); + } else { CloseNow(); + } } // static
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h index 4bb4896a..4b1116b 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -278,7 +278,7 @@ ui::mojom::DragOperation& output_drag_op); std::unique_ptr<aura::WindowTreeHost> host_; - raw_ptr<DesktopWindowTreeHost, DanglingUntriaged> desktop_window_tree_host_; + raw_ptr<DesktopWindowTreeHost> desktop_window_tree_host_; // See class documentation for Widget in widget.h for a note about ownership. Widget::InitParams::Ownership ownership_; @@ -292,8 +292,7 @@ // WARNING: this may be NULL, in particular during shutdown it becomes NULL. raw_ptr<aura::Window, DanglingUntriaged> content_window_; - raw_ptr<internal::NativeWidgetDelegate, DanglingUntriaged> - native_widget_delegate_; + raw_ptr<internal::NativeWidgetDelegate> native_widget_delegate_; std::unique_ptr<wm::FocusController> focus_client_; std::unique_ptr<aura::client::ScreenPositionClient> position_client_;
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 46dc46ed..3f8b42f 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc
@@ -1131,10 +1131,14 @@ NativeWidgetAura::~NativeWidgetAura() { destroying_ = true; - if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) - delete delegate_; - else + if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) { + // Use `ClearAndDelete` here to stop referencing the underlying pointer and + // free its memory. Compared to raw delete calls, this avoids the raw_ptr + // to be temporarily dangling. + delegate_.ClearAndDelete(); + } else { CloseNow(); + } } ////////////////////////////////////////////////////////////////////////////////
diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h index f896b00..da3db65b 100644 --- a/ui/views/widget/native_widget_aura.h +++ b/ui/views/widget/native_widget_aura.h
@@ -238,7 +238,7 @@ private: void SetInitialFocus(ui::WindowShowState show_state); - raw_ptr<internal::NativeWidgetDelegate, DanglingUntriaged> delegate_; + raw_ptr<internal::NativeWidgetDelegate> delegate_; // WARNING: set to NULL when destroyed. As the Widget is not necessarily // destroyed along with |window_| all usage of |window_| should first verify
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java b/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java index efc62c0..032f343a 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java
@@ -72,6 +72,11 @@ } @Override + public boolean isPrivacySandboxFirstPartySetsUIFeatureEnabled() { + return false; + } + + @Override public String getChannelIdForOrigin(String origin) { return null; }