diff --git a/.gn b/.gn index c268132..6129071 100644 --- a/.gn +++ b/.gn
@@ -193,7 +193,6 @@ "//sandbox/win:*", # 7 errors # //third_party/blink/*, https://crbug.com/800764 - "//third_party/blink/renderer/core/animation:*", # 506 errors "//third_party/blink/renderer/core/exported:*", # 470 errors "//third_party/breakpad:*", # 34 errors
diff --git a/DEPS b/DEPS index b9d2498..dcce32e 100644 --- a/DEPS +++ b/DEPS
@@ -206,11 +206,11 @@ # 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': 'aea82732415c78b5182f78909738782b9b2e18f1', + 'skia_revision': 'c493eabd56d076b149a758b29cdd709fc55e7d69', # 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': '73fe59b55662be0ff07e79da1ece8b9e42415dca', + 'v8_revision': 'da8c46c5dbf221ecaa3fe1b3c8f90c9329202734', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -218,7 +218,7 @@ # 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': '0cec8f7429b432b73cc9a3fb9e6a831792743582', + 'angle_revision': '5dafe107a36e403d8e0ae9def7b6a3692e067b1d', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -277,7 +277,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': '95f8e66392b8aa1005af7803d38240ee30612fe8', + 'devtools_frontend_revision': '6ddda3e8e6f2574c511aa835df7964b3c2f1ed9c', # 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. @@ -325,11 +325,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'shaderc_revision': '011139094ec790ff7f32ea2d80286255fc9ed18b', + 'shaderc_revision': '813ef3dc0d5e10bfdf836c651099fcb2203c24ae', # 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': '42103bc2e911144745d8d8930b07ba7e58553a34', + 'dawn_revision': '8036d99531230802ed8284ce46acee2eab3bbaab', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -368,7 +368,7 @@ 'ukey2_revision': '0275885d8e6038c39b8a8ca55e75d1d4d1727f47', # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'tint_revision': 'f81c1081ea7d27ea55f373c0bfaf651e491da7e6', + 'tint_revision': '1bafdc3c45e746da7f21ff02b6eb9a50a09f6db1', # TODO(crbug.com/941824): The values below need to be kept in sync # between //DEPS and //buildtools/DEPS, so if you're updating one, @@ -1497,7 +1497,7 @@ }, 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'e6fa238f76e50a8caa0547074f75443bbfd7b986', + Var('webrtc_git') + '/src.git' + '@' + '71002a226ac53f5a8ae2eb403fa4269adecc52c1', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1569,7 +1569,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@82a2948010cbeb8333a36c020f6d695af372dc0d', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@ac42b796854975f1855166b9324995696f2db230', 'condition': 'checkout_src_internal', }, @@ -1588,7 +1588,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': '8FLJniKLOIvgXmnehF5KQa4m-kep06p-rTGFZXejsuoC', + 'version': 'd_W31KKgRgYuvgrFL3we1kiiq2UPrniL8Q6CCbFkclAC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/android_webview/browser/BUILD.gn b/android_webview/browser/BUILD.gn index 964240c2..83161dd9 100644 --- a/android_webview/browser/BUILD.gn +++ b/android_webview/browser/BUILD.gn
@@ -208,6 +208,7 @@ "//components/page_load_metrics/browser", "//components/policy/content/", "//components/policy/core/browser", + "//components/power_metrics", "//components/pref_registry", "//components/prefs", "//components/printing/browser",
diff --git a/android_webview/browser/DEPS b/android_webview/browser/DEPS index 20121c3..a69ae374 100644 --- a/android_webview/browser/DEPS +++ b/android_webview/browser/DEPS
@@ -27,6 +27,7 @@ "+components/policy/core/browser", "+components/policy/core/common", "+components/policy/content", + "+components/power_metrics", "+components/pref_registry", "+components/printing/browser", "+components/printing/common",
diff --git a/android_webview/browser/aw_browser_process.cc b/android_webview/browser/aw_browser_process.cc index 7a424b3b..4c72e05 100644 --- a/android_webview/browser/aw_browser_process.cc +++ b/android_webview/browser/aw_browser_process.cc
@@ -91,8 +91,17 @@ } VisibilityMetricsLogger* AwBrowserProcess::visibility_metrics_logger() { - if (!visibility_metrics_logger_) + if (!visibility_metrics_logger_) { visibility_metrics_logger_ = std::make_unique<VisibilityMetricsLogger>(); + + // Now that we may become visible, also initialize AndroidBatteryMetrics. + battery_metrics_ = std::make_unique<power_metrics::AndroidBatteryMetrics>(); + visibility_metrics_logger_->SetOnVisibilityChangedCallback( + base::BindRepeating([](bool visible) { + AwBrowserProcess::GetInstance() + ->battery_metrics_->OnAppVisibilityChanged(visible); + })); + } return visibility_metrics_logger_.get(); }
diff --git a/android_webview/browser/aw_browser_process.h b/android_webview/browser/aw_browser_process.h index 5ec3b20..3125b19 100644 --- a/android_webview/browser/aw_browser_process.h +++ b/android_webview/browser/aw_browser_process.h
@@ -13,6 +13,7 @@ #include "android_webview/browser/safe_browsing/aw_safe_browsing_allowlist_manager.h" #include "android_webview/browser/safe_browsing/aw_safe_browsing_ui_manager.h" #include "base/feature_list.h" +#include "components/power_metrics/android_battery_metrics.h" #include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_service.h" #include "components/safe_browsing/android/remote_database_manager.h" @@ -110,6 +111,7 @@ safe_browsing_allowlist_manager_; std::unique_ptr<VisibilityMetricsLogger> visibility_metrics_logger_; + std::unique_ptr<power_metrics::AndroidBatteryMetrics> battery_metrics_; std::unique_ptr<AwContentsLifecycleNotifier> aw_contents_lifecycle_notifier_; DISALLOW_COPY_AND_ASSIGN(AwBrowserProcess);
diff --git a/android_webview/browser/metrics/visibility_metrics_logger.cc b/android_webview/browser/metrics/visibility_metrics_logger.cc index 854e4c5..4686d59 100644 --- a/android_webview/browser/metrics/visibility_metrics_logger.cc +++ b/android_webview/browser/metrics/visibility_metrics_logger.cc
@@ -178,6 +178,8 @@ client_visibility_[client] = info; DCHECK(!was_visible || visible_client_count_ > 0); + bool any_client_was_visible = visible_client_count_ > 0; + if (!was_visible && is_visible) { ++visible_client_count_; } else if (was_visible && !is_visible) { @@ -189,6 +191,18 @@ } else if (was_visible_web && !is_visible_web) { --visible_webcontent_client_count_; } + + bool any_client_is_visible = visible_client_count_ > 0; + if (on_visibility_changed_callback_ && + any_client_was_visible != any_client_is_visible) { + on_visibility_changed_callback_.Run(any_client_is_visible); + } +} + +void VisibilityMetricsLogger::SetOnVisibilityChangedCallback( + OnVisibilityChangedCallback callback) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + on_visibility_changed_callback_ = std::move(callback); } void VisibilityMetricsLogger::RecordMetrics() {
diff --git a/android_webview/browser/metrics/visibility_metrics_logger.h b/android_webview/browser/metrics/visibility_metrics_logger.h index 7ee6df1..344fb65 100644 --- a/android_webview/browser/metrics/visibility_metrics_logger.h +++ b/android_webview/browser/metrics/visibility_metrics_logger.h
@@ -7,6 +7,7 @@ #include <map> +#include "base/callback.h" #include "base/synchronization/lock.h" #include "base/time/time.h" @@ -82,6 +83,13 @@ void RecordMetrics(); + // Set a callback that is executed when global visibility changes, i.e. when: + // - false => true: no client was visible and one becomes visible. + // - true => false: >=1 clients were visible and all became hidden. + using OnVisibilityChangedCallback = + base::RepeatingCallback<void(bool /*visible*/)>; + void SetOnVisibilityChangedCallback(OnVisibilityChangedCallback); + private: static base::HistogramBase* GetGlobalVisibilityHistogram(); static base::HistogramBase* GetPerWebViewVisibilityHistogram(); @@ -132,6 +140,8 @@ WebViewOpenWebScreenPortion::kZeroPercent; base::TimeDelta open_web_screen_portion_tracked_duration_ [static_cast<size_t>(WebViewOpenWebScreenPortion::kMaxValue) + 1] = {}; + + OnVisibilityChangedCallback on_visibility_changed_callback_; }; } // namespace android_webview
diff --git a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java index 4d9db1d1..982a98bb 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java +++ b/android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java
@@ -32,6 +32,7 @@ import org.chromium.base.ContextUtils; import org.chromium.base.Log; import org.chromium.base.PathUtils; +import org.chromium.base.PowerMonitor; import org.chromium.base.ThreadUtils; import org.chromium.base.TimeUtils; import org.chromium.base.annotations.CalledByNative; @@ -154,6 +155,8 @@ BrowserStartupController.getInstance().startBrowserProcessesSync( LibraryProcessType.PROCESS_WEBVIEW, !multiProcess); } + + PowerMonitor.create(); }); } }
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/devui/FlagsFragmentTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/devui/FlagsFragmentTest.java index cca9c80..0a90daa 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/devui/FlagsFragmentTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/devui/FlagsFragmentTest.java
@@ -61,6 +61,7 @@ import org.chromium.android_webview.services.DeveloperUiService; import org.chromium.android_webview.test.AwJUnit4ClassRunner; import org.chromium.base.test.util.CallbackHelper; +import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.Feature; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -398,6 +399,7 @@ @Test @MediumTest @Feature({"AndroidWebView"}) + @DisabledTest(message = "https://crbug.com/1141442") public void testToggledFlagsFloatToTop() throws Throwable { ListView flagsList = mRule.getActivity().findViewById(R.id.flags_list); int totalNumFlags = flagsList.getCount();
diff --git a/ash/app_list/app_list_controller_impl_unittest.cc b/ash/app_list/app_list_controller_impl_unittest.cc index 79ffa98..aa559dd 100644 --- a/ash/app_list/app_list_controller_impl_unittest.cc +++ b/ash/app_list/app_list_controller_impl_unittest.cc
@@ -49,8 +49,6 @@ #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/test/with_feature_override.h" -#include "chromeos/constants/chromeos_features.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/base/ui_base_features.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/events/test/event_generator.h" @@ -725,24 +723,9 @@ EXPECT_FALSE(item_view->IsNotificationIndicatorShownForTest()); } -class HotseatAppListControllerImplTest : public base::test::WithFeatureOverride, - public AppListControllerImplTest { - public: - HotseatAppListControllerImplTest() - : WithFeatureOverride(chromeos::features::kShelfHotseat) {} - ~HotseatAppListControllerImplTest() override = default; - - private: - base::test::ScopedFeatureList feature_list_; - DISALLOW_COPY_AND_ASSIGN(HotseatAppListControllerImplTest); -}; - -// Tests with both hotseat disabled and enabled. -INSTANTIATE_FEATURE_OVERRIDE_TEST_SUITE(HotseatAppListControllerImplTest); - // Verifies that the pinned app should still show after canceling the drag from // AppsGridView to Shelf (https://crbug.com/1021768). -TEST_P(HotseatAppListControllerImplTest, DragItemFromAppsGridView) { +TEST_F(AppListControllerImplTest, DragItemFromAppsGridView) { // Turn on the tablet mode. Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); EXPECT_TRUE(IsTabletMode()); @@ -784,7 +767,7 @@ // Tests for HomeScreenDelegate::GetInitialAppListItemScreenBoundsForWindow // implemtenation. -TEST_P(HotseatAppListControllerImplTest, GetItemBoundsForWindow) { +TEST_F(AppListControllerImplTest, GetItemBoundsForWindow) { // Populate app list model with 25 items, of which items at indices in // |folders| are folders containing a single item. const std::set<int> folders = {5, 23}; @@ -885,8 +868,7 @@ // Verifies that apps grid and hotseat bounds do not overlap when switching from // side shelf app list to tablet mode. -TEST_P(HotseatAppListControllerImplTest, - NoOverlapWithHotseatOnSwitchFromSideShelf) { +TEST_F(AppListControllerImplTest, NoOverlapWithHotseatOnSwitchFromSideShelf) { Shell::Get()->tablet_mode_controller()->SetEnabledForTest(false); Shelf* const shelf = GetPrimaryShelf(); shelf->SetAlignment(ShelfAlignment::kRight);
diff --git a/ash/keyboard/keyboard_controller_impl_unittest.cc b/ash/keyboard/keyboard_controller_impl_unittest.cc index 9d5d52f..4aa5d57 100644 --- a/ash/keyboard/keyboard_controller_impl_unittest.cc +++ b/ash/keyboard/keyboard_controller_impl_unittest.cc
@@ -25,9 +25,7 @@ #include "base/run_loop.h" #include "base/stl_util.h" #include "base/test/bind_test_util.h" -#include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" -#include "chromeos/constants/chromeos_features.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/window.h" #include "ui/display/manager/display_manager.h" @@ -132,9 +130,6 @@ ~KeyboardControllerImplTest() override = default; void SetUp() override { - base::test::ScopedFeatureList feature_list; - feature_list.InitAndEnableFeature(chromeos::features::kShelfHotseat); - AshTestBase::SetUp(); // Set the initial observer config to the default config.
diff --git a/ash/login/ui/pin_request_view.cc b/ash/login/ui/pin_request_view.cc index b33e94c..ee74711 100644 --- a/ash/login/ui/pin_request_view.cc +++ b/ash/login/ui/pin_request_view.cc
@@ -100,6 +100,7 @@ : views::LabelButton(listener, text) { SetInstallFocusRingOnFocus(true); focus_ring()->SetColor(ShelfConfig::Get()->shelf_focus_border_color()); + SetFocusBehavior(FocusBehavior::ALWAYS); } FocusableLabelButton(const FocusableLabelButton&) = delete; @@ -366,7 +367,6 @@ help_button_->layer()->SetFillsBoundsOpaquely(false); help_button_->SetTextSubpixelRenderingEnabled(false); help_button_->SetEnabledTextColors(kTextColor); - help_button_->SetFocusBehavior(FocusBehavior::ALWAYS); help_button_->SetVisible(request.help_button_enabled); footer->AddChildView(help_button_);
diff --git a/ash/public/cpp/ash_features.cc b/ash/public/cpp/ash_features.cc index f4328b6f..d9ae13ba 100644 --- a/ash/public/cpp/ash_features.cc +++ b/ash/public/cpp/ash_features.cc
@@ -8,7 +8,6 @@ #include "base/command_line.h" #include "base/feature_list.h" #include "build/build_config.h" -#include "chromeos/constants/chromeos_switches.h" namespace ash { namespace features { @@ -279,8 +278,7 @@ } bool IsAppScalingEnabled() { - return base::FeatureList::IsEnabled(kShelfAppScaling) && - chromeos::switches::ShouldShowShelfHotseat(); + return base::FeatureList::IsEnabled(kShelfAppScaling); } bool IsNotificationsInContextMenuEnabled() {
diff --git a/ash/resources/vector_icons/BUILD.gn b/ash/resources/vector_icons/BUILD.gn index cc9adba..5b18625 100644 --- a/ash/resources/vector_icons/BUILD.gn +++ b/ash/resources/vector_icons/BUILD.gn
@@ -141,8 +141,15 @@ "palette_tray_icon_laser_pointer.icon", "palette_tray_icon_magnify.icon", "palette_tray_icon_metalayer.icon", + "phone_hub_enable_hotspot_off.icon", + "phone_hub_enable_hotspot_on.icon", + "phone_hub_locate_phone_off.icon", + "phone_hub_locate_phone_on.icon", "phone_hub_mobile_no_connection.icon", "phone_hub_mobile_no_sim.icon", + "phone_hub_phone.icon", + "phone_hub_silence_phone_off.icon", + "phone_hub_silence_phone_on.icon", "pin_request_lock.icon", "pinned.icon", "privacy_screen.icon",
diff --git a/ash/resources/vector_icons/phone_hub_enable_hotspot_off.icon b/ash/resources/vector_icons/phone_hub_enable_hotspot_off.icon new file mode 100644 index 0000000..ece1111d --- /dev/null +++ b/ash/resources/vector_icons/phone_hub_enable_hotspot_off.icon
@@ -0,0 +1,37 @@ +CANVAS_DIMENSIONS, 20, +MOVE_TO, 2, 2.09f, +LINE_TO, 17.56f, 17.64f, +R_LINE_TO, -1.41f, 1.41f, +R_LINE_TO, -9.09f, -9.09f, +CUBIC_TO, 7.02f, 10.14f, 7, 10.32f, 7, 10.5f, +R_CUBIC_TO, 0, 0.91f, 0.4f, 1.72f, 1.04f, 2.27f, +R_LINE_TO, -1.49f, 1.34f, +CUBIC_TO, 5.59f, 13.2f, 5, 11.92f, 5, 10.5f, +R_CUBIC_TO, 0, -0.76f, 0.17f, -1.47f, 0.47f, -2.12f, +LINE_TO, 4.36f, 7.27f, +CUBIC_TO, 3.81f, 8.22f, 3.5f, 9.33f, 3.5f, 10.5f, +R_CUBIC_TO, 0, 1.81f, 0.74f, 3.44f, 1.93f, 4.62f, +R_LINE_TO, -1.49f, 1.34f, +CUBIC_TO, 2.43f, 14.92f, 1.5f, 12.82f, 1.5f, 10.5f, +R_CUBIC_TO, 0, -1.73f, 0.52f, -3.34f, 1.4f, -4.68f, +LINE_TO, 0.59f, 3.5f, +LINE_TO, 2, 2.09f, +CLOSE, +MOVE_TO, 10, 2, +R_CUBIC_TO, 4.69f, 0, 8.5f, 3.81f, 8.5f, 8.5f, +R_CUBIC_TO, 0, 1.45f, -0.36f, 2.81f, -1, 4, +R_LINE_TO, -1.5f, -1.5f, +CUBIC_TO, 16.32f, 12.23f, 16.5f, 11.39f, 16.5f, 10.5f, +CUBIC_TO, 16.5f, 6.91f, 13.59f, 4, 10, 4, +R_CUBIC_TO, -0.89f, 0, -1.73f, 0.18f, -2.5f, 0.5f, +LINE_TO, 6, 3, +CUBIC_TO, 7.19f, 2.36f, 8.55f, 2, 10, 2, +CLOSE, +R_MOVE_TO, 0, 3.5f, +R_CUBIC_TO, 2.76f, 0, 5, 2.24f, 5, 5, +R_CUBIC_TO, 0, 0.46f, -0.06f, 0.9f, -0.18f, 1.32f, +R_LINE_TO, -1.87f, -1.87f, +R_CUBIC_TO, -0.23f, -1.22f, -1.18f, -2.17f, -2.4f, -2.4f, +LINE_TO, 8.68f, 5.68f, +CUBIC_TO, 9.1f, 5.56f, 9.54f, 5.5f, 10, 5.5f, +CLOSE
diff --git a/ash/resources/vector_icons/phone_hub_enable_hotspot_on.icon b/ash/resources/vector_icons/phone_hub_enable_hotspot_on.icon new file mode 100644 index 0000000..57aea58 --- /dev/null +++ b/ash/resources/vector_icons/phone_hub_enable_hotspot_on.icon
@@ -0,0 +1,31 @@ +CANVAS_DIMENSIONS, 20, +MOVE_TO, 10, 2, +R_CUBIC_TO, 4.69f, 0, 8.5f, 3.81f, 8.5f, 8.5f, +R_CUBIC_TO, 0, 2.32f, -0.93f, 4.42f, -2.44f, 5.96f, +R_LINE_TO, -1.49f, -1.34f, +CUBIC_TO, 15.76f, 13.94f, 16.5f, 12.31f, 16.5f, 10.5f, +CUBIC_TO, 16.5f, 6.91f, 13.59f, 4, 10, 4, +R_CUBIC_TO, -3.59f, 0, -6.5f, 2.91f, -6.5f, 6.5f, +R_CUBIC_TO, 0, 1.81f, 0.74f, 3.44f, 1.93f, 4.62f, +R_LINE_TO, -1.49f, 1.34f, +CUBIC_TO, 2.43f, 14.92f, 1.5f, 12.82f, 1.5f, 10.5f, +CUBIC_TO, 1.5f, 5.81f, 5.31f, 2, 10, 2, +CLOSE, +R_MOVE_TO, 0, 3.5f, +R_CUBIC_TO, 2.76f, 0, 5, 2.24f, 5, 5, +R_CUBIC_TO, 0, 1.42f, -0.59f, 2.7f, -1.54f, 3.61f, +R_LINE_TO, -1.49f, -1.34f, +CUBIC_TO, 12.6f, 12.22f, 13, 11.41f, 13, 10.5f, +R_CUBIC_TO, 0, -1.66f, -1.34f, -3, -3, -3, +R_CUBIC_TO, -1.66f, 0, -3, 1.34f, -3, 3, +R_CUBIC_TO, 0, 0.91f, 0.4f, 1.72f, 1.04f, 2.27f, +R_LINE_TO, -1.49f, 1.34f, +CUBIC_TO, 5.59f, 13.2f, 5, 11.92f, 5, 10.5f, +R_CUBIC_TO, 0, -2.76f, 2.24f, -5, 5, -5, +CLOSE, +MOVE_TO, 10, 9, +R_CUBIC_TO, 0.83f, 0, 1.5f, 0.67f, 1.5f, 1.5f, +R_CUBIC_TO, 0, 0.83f, -0.67f, 1.5f, -1.5f, 1.5f, +R_CUBIC_TO, -0.83f, 0, -1.5f, -0.67f, -1.5f, -1.5f, +R_CUBIC_TO, 0, -0.83f, 0.67f, -1.5f, 1.5f, -1.5f, +CLOSE
diff --git a/ash/resources/vector_icons/phone_hub_locate_phone_off.icon b/ash/resources/vector_icons/phone_hub_locate_phone_off.icon new file mode 100644 index 0000000..38649e71 --- /dev/null +++ b/ash/resources/vector_icons/phone_hub_locate_phone_off.icon
@@ -0,0 +1,55 @@ +CANVAS_DIMENSIONS, 20, +MOVE_TO, 2, 2.09f, +LINE_TO, 17.56f, 17.64f, +R_LINE_TO, -1.41f, 1.41f, +R_LINE_TO, -1.29f, -1.29f, +R_CUBIC_TO, -0.28f, 0.68f, -0.93f, 1.18f, -1.7f, 1.23f, +LINE_TO, 13, 19, +H_LINE_TO, 5, +R_CUBIC_TO, -1.05f, 0, -1.92f, -0.82f, -1.99f, -1.85f, +LINE_TO, 3, 17, +LINE_TO, 3, 5.91f, +R_LINE_TO, -2.41f, -2.41f, +LINE_TO, 2, 2.09f, +CLOSE, +MOVE_TO, 13, 16, +H_LINE_TO, 5, +R_V_LINE_TO, 1, +R_H_LINE_TO, 8, +R_V_LINE_TO, -1, +CLOSE, +R_MOVE_TO, -1.91f, -2, +LINE_TO, 5, 7.91f, +LINE_TO, 5, 14, +R_H_LINE_TO, 6.09f, +CLOSE, +R_MOVE_TO, 5.1f, -8.5f, +R_CUBIC_TO, 2.22f, 2.22f, 2.38f, 5.74f, 0.47f, 8.15f, +R_LINE_TO, -1.17f, -1.16f, +R_CUBIC_TO, 1.23f, -1.7f, 1.14f, -4.08f, -0.3f, -5.66f, +R_LINE_TO, -0.16f, -0.17f, +LINE_TO, 16.18f, 5.5f, +CLOSE, +R_MOVE_TO, -2.03f, 2.02f, +R_CUBIC_TO, 1.11f, 1.11f, 1.25f, 2.81f, 0.44f, 4.08f, +R_LINE_TO, -1.21f, -1.22f, +R_CUBIC_TO, 0.19f, -0.53f, 0.1f, -1.14f, -0.28f, -1.59f, +LINE_TO, 13, 8.67f, +R_LINE_TO, 1.15f, -1.15f, +CLOSE, +MOVE_TO, 5, 1, +R_LINE_TO, 8, 0.01f, +R_CUBIC_TO, 1.05f, 0, 1.92f, 0.81f, 1.99f, 1.84f, +LINE_TO, 15, 3, +R_V_LINE_TO, 3.5f, +R_H_LINE_TO, -2, +V_LINE_TO, 6, +H_LINE_TO, 9, +LINE_TO, 7, 4, +R_H_LINE_TO, 6, +V_LINE_TO, 3, +H_LINE_TO, 6, +LINE_TO, 4.18f, 1.18f, +R_CUBIC_TO, 0.21f, -0.09f, 0.43f, -0.15f, 0.67f, -0.17f, +LINE_TO, 5, 1, +CLOSE
diff --git a/ash/resources/vector_icons/phone_hub_locate_phone_on.icon b/ash/resources/vector_icons/phone_hub_locate_phone_on.icon new file mode 100644 index 0000000..91e2bef --- /dev/null +++ b/ash/resources/vector_icons/phone_hub_locate_phone_on.icon
@@ -0,0 +1,45 @@ +CANVAS_DIMENSIONS, 20, +MOVE_TO, 5, 1, +R_LINE_TO, 8, 0.01f, +R_CUBIC_TO, 1.05f, 0, 1.92f, 0.81f, 1.99f, 1.84f, +LINE_TO, 15, 3, +R_V_LINE_TO, 3.5f, +R_H_LINE_TO, -2, +V_LINE_TO, 6, +H_LINE_TO, 5, +R_V_LINE_TO, 8, +R_H_LINE_TO, 8, +R_V_LINE_TO, -0.5f, +R_H_LINE_TO, 2, +V_LINE_TO, 17, +R_CUBIC_TO, 0, 1.05f, -0.82f, 1.92f, -1.85f, 1.99f, +LINE_TO, 13, 19, +H_LINE_TO, 5, +R_CUBIC_TO, -1.05f, 0, -1.92f, -0.82f, -1.99f, -1.85f, +LINE_TO, 3, 17, +V_LINE_TO, 3, +R_CUBIC_TO, 0, -1.05f, 0.82f, -1.92f, 1.85f, -1.99f, +LINE_TO, 5, 1, +CLOSE, +R_MOVE_TO, 8, 15, +H_LINE_TO, 5, +R_V_LINE_TO, 1, +R_H_LINE_TO, 8, +R_V_LINE_TO, -1, +CLOSE, +R_MOVE_TO, 3.18f, -10.5f, +R_CUBIC_TO, 2.39f, 2.39f, 2.39f, 6.28f, 0, 8.67f, +R_LINE_TO, -1.15f, -1.15f, +CUBIC_TO, 16.78f, 11.26f, 16.78f, 8.4f, 15.03f, 6.65f, +CLOSE, +R_MOVE_TO, -2.03f, 2.02f, +R_CUBIC_TO, 1.28f, 1.28f, 1.28f, 3.35f, 0, 4.63f, +LINE_TO, 13, 10.99f, +R_CUBIC_TO, 0.64f, -0.64f, 0.64f, -1.68f, 0, -2.32f, +CLOSE, +MOVE_TO, 13, 3, +H_LINE_TO, 5, +R_V_LINE_TO, 1, +R_H_LINE_TO, 8, +V_LINE_TO, 3, +CLOSE
diff --git a/ash/resources/vector_icons/phone_hub_phone.icon b/ash/resources/vector_icons/phone_hub_phone.icon new file mode 100644 index 0000000..f49805b --- /dev/null +++ b/ash/resources/vector_icons/phone_hub_phone.icon
@@ -0,0 +1,29 @@ +CANVAS_DIMENSIONS, 20, +MOVE_TO, 14, 1.01f, +LINE_TO, 6, 1, +R_CUBIC_TO, -1.1f, 0, -2, 0.9f, -2, 2, +R_V_LINE_TO, 14, +R_CUBIC_TO, 0, 1.1f, 0.9f, 2, 2, 2, +R_H_LINE_TO, 8, +R_CUBIC_TO, 1.1f, 0, 2, -0.9f, 2, -2, +V_LINE_TO, 3, +R_CUBIC_TO, 0, -1.1f, -0.9f, -1.99f, -2, -1.99f, +CLOSE, +MOVE_TO, 14, 17, +H_LINE_TO, 6, +R_V_LINE_TO, -1, +R_H_LINE_TO, 8, +R_V_LINE_TO, 1, +CLOSE, +R_MOVE_TO, 0, -3, +H_LINE_TO, 6, +V_LINE_TO, 6, +R_H_LINE_TO, 8, +R_V_LINE_TO, 8, +CLOSE, +MOVE_TO, 6, 4, +V_LINE_TO, 3, +R_H_LINE_TO, 8, +R_V_LINE_TO, 1, +H_LINE_TO, 6, +CLOSE
diff --git a/ash/resources/vector_icons/phone_hub_silence_phone_off.icon b/ash/resources/vector_icons/phone_hub_silence_phone_off.icon new file mode 100644 index 0000000..d201d6e9 --- /dev/null +++ b/ash/resources/vector_icons/phone_hub_silence_phone_off.icon
@@ -0,0 +1,54 @@ +CANVAS_DIMENSIONS, 20, +MOVE_TO, 2, 2.09f, +LINE_TO, 17.56f, 17.64f, +R_LINE_TO, -1.41f, 1.41f, +LINE_TO, 13.09f, 16, +H_LINE_TO, 2, +R_V_LINE_TO, -2, +R_H_LINE_TO, 2, +V_LINE_TO, 9.5f, +R_CUBIC_TO, 0, -0.8f, 0.11f, -1.56f, 0.32f, -2.26f, +LINE_TO, 0.59f, 3.5f, +LINE_TO, 2, 2.09f, +CLOSE, +MOVE_TO, 12, 17, +R_CUBIC_TO, 0, 1.1f, -0.9f, 2, -2, 2, +R_CUBIC_TO, -1.05f, 0, -1.92f, -0.82f, -1.99f, -1.85f, +LINE_TO, 8, 17, +R_H_LINE_TO, 4, +CLOSE, +R_MOVE_TO, 6, -3, +R_V_LINE_TO, 1, +R_LINE_TO, -1, -1, +R_H_LINE_TO, 1, +CLOSE, +R_MOVE_TO, -9.88f, -2.97f, +LINE_TO, 6.03f, 8.94f, +CUBIC_TO, 6.01f, 9.12f, 6, 9.31f, 6, 9.5f, +V_LINE_TO, 14, +R_H_LINE_TO, 5.09f, +R_LINE_TO, -1, -1, +H_LINE_TO, 7.75f, +R_V_LINE_TO, -1.54f, +LINE_TO, 8.12f, 11.03f, +CLOSE, +MOVE_TO, 10, 1, +R_CUBIC_TO, 0.83f, 0, 1.5f, 0.67f, 1.5f, 1.5f, +R_V_LINE_TO, 0.68f, +R_CUBIC_TO, 2.87f, 0.68f, 4.5f, 3.25f, 4.5f, 6.32f, +V_LINE_TO, 13, +R_LINE_TO, -2, -2, +V_LINE_TO, 9.5f, +CUBIC_TO, 14, 7.02f, 12.49f, 5, 10, 5, +R_CUBIC_TO, -0.61f, 0, -1.17f, 0.12f, -1.65f, 0.34f, +R_LINE_TO, -1.49f, -1.49f, +CUBIC_TO, 7.34f, 3.55f, 7.89f, 3.32f, 8.5f, 3.18f, +V_LINE_TO, 2.5f, +R_CUBIC_TO, 0, -0.83f, 0.67f, -1.5f, 1.5f, -1.5f, +CLOSE, +R_MOVE_TO, 2.75f, 6, +R_V_LINE_TO, 1.54f, +LINE_TO, 12.19f, 9.19f, +LINE_TO, 10, 7, +R_H_LINE_TO, 2.75f, +CLOSE
diff --git a/ash/resources/vector_icons/phone_hub_silence_phone_on.icon b/ash/resources/vector_icons/phone_hub_silence_phone_on.icon new file mode 100644 index 0000000..16d6a68 --- /dev/null +++ b/ash/resources/vector_icons/phone_hub_silence_phone_on.icon
@@ -0,0 +1,40 @@ +CANVAS_DIMENSIONS, 20, +MOVE_TO, 7.75f, 7, +R_H_LINE_TO, 5, +R_V_LINE_TO, 1.54f, +R_LINE_TO, -2.5f, 2.91f, +R_H_LINE_TO, 2.5f, +V_LINE_TO, 13, +R_H_LINE_TO, -5, +R_V_LINE_TO, -1.54f, +R_LINE_TO, 2.5f, -2.91f, +R_H_LINE_TO, -2.5f, +V_LINE_TO, 7, +CLOSE, +MOVE_TO, 18, 14, +R_V_LINE_TO, 2, +H_LINE_TO, 2, +R_V_LINE_TO, -2, +R_H_LINE_TO, 2, +V_LINE_TO, 9.5f, +R_CUBIC_TO, 0, -3.08f, 1.64f, -5.64f, 4.5f, -6.32f, +V_LINE_TO, 2.5f, +R_CUBIC_TO, 0, -0.83f, 0.67f, -1.5f, 1.5f, -1.5f, +R_CUBIC_TO, 0.83f, 0, 1.5f, 0.67f, 1.5f, 1.5f, +R_V_LINE_TO, 0.68f, +R_CUBIC_TO, 2.87f, 0.68f, 4.5f, 3.25f, 4.5f, 6.32f, +V_LINE_TO, 14, +R_H_LINE_TO, 2, +CLOSE, +R_MOVE_TO, -4, -4.5f, +CUBIC_TO, 14, 7.02f, 12.49f, 5, 10, 5, +CUBIC_TO_SHORTHAND, 6, 7.02f, 6, 9.5f, +V_LINE_TO, 14, +R_H_LINE_TO, 8, +V_LINE_TO, 9.5f, +CLOSE, +MOVE_TO, 10, 19, +R_CUBIC_TO, 1.1f, 0, 2, -0.9f, 2, -2, +H_LINE_TO, 8, +R_CUBIC_TO, 0, 1.1f, 0.9f, 2, 2, 2, +CLOSE
diff --git a/ash/shelf/back_button_unittest.cc b/ash/shelf/back_button_unittest.cc index 403b283..bd97ed1 100644 --- a/ash/shelf/back_button_unittest.cc +++ b/ash/shelf/back_button_unittest.cc
@@ -21,7 +21,6 @@ #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/run_loop.h" #include "base/test/scoped_feature_list.h" -#include "chromeos/constants/chromeos_features.h" #include "ui/base/accelerators/accelerator.h" #include "ui/base/accelerators/test_accelerator_target.h" #include "ui/events/test/event_generator.h" @@ -46,14 +45,6 @@ ShelfViewTestAPI* test_api() { return test_api_.get(); } void SetUp() override { - if (GetParam()) { - scoped_feature_list_.InitAndEnableFeature( - chromeos::features::kShelfHotseat); - } else { - scoped_feature_list_.InitAndDisableFeature( - chromeos::features::kShelfHotseat); - } - AshTestBase::SetUp(); // Set a11y setting to show back button in tablet mode, if the feature to // hide it is enabled. @@ -83,8 +74,6 @@ std::unique_ptr<ShelfViewTestAPI> test_api_; private: - base::test::ScopedFeatureList scoped_feature_list_; - DISALLOW_COPY_AND_ASSIGN(BackButtonTest); }; @@ -102,10 +91,8 @@ public ::testing::WithParamInterface<TestAccessibilityFeature> { public: BackButtonVisibilityWithAccessibilityFeaturesTest() { - scoped_feature_list_.InitWithFeatures( - {chromeos::features::kShelfHotseat, - features::kHideShelfControlsInTabletMode}, - {}); + scoped_feature_list_.InitAndEnableFeature( + features::kHideShelfControlsInTabletMode); } ~BackButtonVisibilityWithAccessibilityFeaturesTest() override = default; @@ -140,26 +127,20 @@ } // namespace -// The parameter indicates whether the kShelfHotseat feature is enabled. -INSTANTIATE_TEST_SUITE_P(All, BackButtonTest, testing::Bool()); - // Verify that the back button is visible in tablet mode. -TEST_P(BackButtonTest, Visibility) { +TEST_F(BackButtonTest, Visibility) { EXPECT_FALSE(back_button()); EXPECT_FALSE(IsBackButtonVisible()); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); test_api()->RunMessageLoopUntilAnimationsDone(); - // Ensure the back button is not yet visible when hotseat is enabled. - EXPECT_EQ(!GetParam(), IsBackButtonVisible()); - ASSERT_EQ(GetParam(), !back_button()); + // The back button should only be visible for in-app shelf in tablet mode. + EXPECT_FALSE(IsBackButtonVisible()); + ASSERT_TRUE(!back_button()); - if (GetParam()) { - // When hotseat is enabled, the back button is only usable in in-app shelf. - std::unique_ptr<views::Widget> widget = CreateTestWidget(); - test_api()->RunMessageLoopUntilAnimationsDone(); - } + std::unique_ptr<views::Widget> widget = CreateTestWidget(); + test_api()->RunMessageLoopUntilAnimationsDone(); EXPECT_TRUE(IsBackButtonVisible()); EXPECT_EQ(1.f, back_button()->layer()->opacity()); @@ -172,15 +153,14 @@ // Verify that the back button is visible in tablet mode, if the initial shelf // alignment is on the left or right. -TEST_P(BackButtonTest, VisibilityWithVerticalShelf) { +TEST_F(BackButtonTest, VisibilityWithVerticalShelf) { test_api()->shelf_view()->shelf()->SetAlignment(ShelfAlignment::kLeft); EXPECT_FALSE(back_button()); EXPECT_FALSE(IsBackButtonVisible()); Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); - // When hotseat is enabled, the back button is only usable in in-app shelf. - if (GetParam()) - std::unique_ptr<views::Widget> widget = CreateTestWidget(); + // Create a test widget to transition to in-app shelf. + std::unique_ptr<views::Widget> widget = CreateTestWidget(); test_api()->RunMessageLoopUntilAnimationsDone(); EXPECT_TRUE(back_button()); @@ -193,12 +173,11 @@ EXPECT_FALSE(IsBackButtonVisible()); } -TEST_P(BackButtonTest, BackKeySequenceGenerated) { +TEST_F(BackButtonTest, BackKeySequenceGenerated) { // Enter tablet mode; the back button is not visible in non tablet mode. Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); - // When hotseat is enabled, the back button is only usable in in-app shelf. - if (GetParam()) - std::unique_ptr<views::Widget> widget = CreateTestWidget(); + // Create a test widget to transition to in-app shelf. + std::unique_ptr<views::Widget> widget = CreateTestWidget(); ShelfNavigationWidget::TestApi navigation_widget_test_api( GetPrimaryShelf()->navigation_widget()); @@ -243,7 +222,7 @@ } // Tests that the back button does not show a context menu. -TEST_P(BackButtonTest, NoContextMenuOnBackButton) { +TEST_F(BackButtonTest, NoContextMenuOnBackButton) { ui::test::EventGenerator* generator = GetEventGenerator(); // Enable tablet mode to show the back button. Wait for tablet mode animations @@ -251,9 +230,8 @@ // home button. Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); - // When hotseat is enabled, the back button is only usable in in-app shelf. - if (GetParam()) - std::unique_ptr<views::Widget> widget = CreateTestWidget(); + // Create a test widget to transition to in-app shelf. + std::unique_ptr<views::Widget> widget = CreateTestWidget(); // Wait for the navigation widget's animation. ShelfNavigationWidget::TestApi navigation_widget_test_api(
diff --git a/ash/shelf/home_button_unittest.cc b/ash/shelf/home_button_unittest.cc index 706490ab..9d696fc8 100644 --- a/ash/shelf/home_button_unittest.cc +++ b/ash/shelf/home_button_unittest.cc
@@ -30,9 +30,7 @@ #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/command_line.h" #include "base/run_loop.h" -#include "base/test/scoped_command_line.h" #include "base/test/scoped_feature_list.h" -#include "chromeos/constants/chromeos_features.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/events/test/event_generator.h" #include "ui/views/animation/bounds_animator.h" @@ -45,29 +43,17 @@ return ui::GestureEvent(0, 0, ui::EF_NONE, base::TimeTicks(), details); } -class HomeButtonTest - : public AshTestBase, - public testing::WithParamInterface<std::tuple<bool, bool>> { +class HomeButtonTest : public AshTestBase, + public testing::WithParamInterface<bool> { public: HomeButtonTest() = default; ~HomeButtonTest() override = default; // AshTestBase: void SetUp() override { - std::vector<base::Feature> enabled_features; - std::vector<base::Feature> disabled_features; - - if (IsHotseatEnabled()) - enabled_features.push_back(chromeos::features::kShelfHotseat); - else - disabled_features.push_back(chromeos::features::kShelfHotseat); - - if (IsHideShelfControlsInTabletModeEnabled()) - enabled_features.push_back(features::kHideShelfControlsInTabletMode); - else - disabled_features.push_back(features::kHideShelfControlsInTabletMode); - - scoped_feature_list_.InitWithFeatures(enabled_features, disabled_features); + scoped_feature_list_.InitWithFeatureState( + features::kHideShelfControlsInTabletMode, + IsHideShelfControlsInTabletModeEnabled()); AshTestBase::SetUp(); } @@ -94,11 +80,7 @@ ->OnGestureEvent(event); } - bool IsHotseatEnabled() const { return std::get<0>(GetParam()); } - - bool IsHideShelfControlsInTabletModeEnabled() const { - return std::get<1>(GetParam()); - } + bool IsHideShelfControlsInTabletModeEnabled() const { return GetParam(); } const HomeButton* home_button() const { return GetPrimaryShelf() @@ -123,10 +105,8 @@ class HomeButtonAnimationTest : public AshTestBase { public: HomeButtonAnimationTest() { - scoped_feature_list_.InitWithFeatures( - {chromeos::features::kShelfHotseat, - features::kHideShelfControlsInTabletMode}, - {}); + scoped_feature_list_.InitAndEnableFeature( + features::kHideShelfControlsInTabletMode); } ~HomeButtonAnimationTest() override = default; @@ -163,10 +143,8 @@ public ::testing::WithParamInterface<TestAccessibilityFeature> { public: HomeButtonVisibilityWithAccessibilityFeaturesTest() { - scoped_feature_list_.InitWithFeatures( - {chromeos::features::kShelfHotseat, - features::kHideShelfControlsInTabletMode}, - {}); + scoped_feature_list_.InitAndEnableFeature( + features::kHideShelfControlsInTabletMode); } ~HomeButtonVisibilityWithAccessibilityFeaturesTest() override = default; @@ -198,11 +176,9 @@ } // namespace -// The parameters indicate whether the kShelfHotseat and -// kHideShelfControlsInTabletMode features are enabled. -INSTANTIATE_TEST_SUITE_P(All, - HomeButtonTest, - testing::Combine(testing::Bool(), testing::Bool())); +// The parameter indicates whether the kHideShelfControlsInTabletMode feature +// is enabled. +INSTANTIATE_TEST_SUITE_P(All, HomeButtonTest, testing::Bool()); TEST_P(HomeButtonTest, SwipeUpToOpenFullscreenAppList) { Shelf* shelf = GetPrimaryShelf(); @@ -287,9 +263,9 @@ ShelfNavigationWidget::TestApi test_api(shelf->navigation_widget()); // Home button is expected to be hidden in tablet mode if shelf controls - // should be hidden - this feature is available only with hotseat enabled. + // should be hidden. const bool should_show_home_button = - !(IsHotseatEnabled() && IsHideShelfControlsInTabletModeEnabled()); + !IsHideShelfControlsInTabletModeEnabled(); EXPECT_EQ(should_show_home_button, test_api.IsHomeButtonVisible()); ASSERT_EQ(should_show_home_button, static_cast<bool>(home_button())); if (!should_show_home_button) @@ -330,32 +306,28 @@ ShelfNavigationWidget::TestApi test_api(shelf->navigation_widget()); // Home button is expected to be hidden in tablet mode if shelf controls - // should be hidden - this feature is available only with hotseat enabled. + // should be hidden. const bool should_show_home_button = - !(IsHotseatEnabled() && IsHideShelfControlsInTabletModeEnabled()); + !IsHideShelfControlsInTabletModeEnabled(); EXPECT_EQ(should_show_home_button, test_api.IsHomeButtonVisible()); EXPECT_EQ(should_show_home_button, static_cast<bool>(home_button())); - // When hotseat is enabled, home button position changes between in-app shelf - // and home shelf, so test in-app when hotseat is enabled. - if (IsHotseatEnabled()) { - // Wait for the navigation widget's animation. - shelf_test_api.RunMessageLoopUntilAnimationsDone( - test_api.GetBoundsAnimator()); + // Wait for the navigation widget's animation. + shelf_test_api.RunMessageLoopUntilAnimationsDone( + test_api.GetBoundsAnimator()); - EXPECT_EQ(should_show_home_button, test_api.IsHomeButtonVisible()); - ASSERT_EQ(should_show_home_button, static_cast<bool>(home_button())); + EXPECT_EQ(should_show_home_button, test_api.IsHomeButtonVisible()); + ASSERT_EQ(should_show_home_button, static_cast<bool>(home_button())); - if (should_show_home_button) { - EXPECT_EQ(home_button()->bounds().x(), - ShelfConfig::Get()->control_button_edge_spacing( - true /* is_primary_axis_edge */)); - } - - // Switch to in-app shelf. - std::unique_ptr<views::Widget> widget = CreateTestWidget(); + if (should_show_home_button) { + EXPECT_EQ(home_button()->bounds().x(), + ShelfConfig::Get()->control_button_edge_spacing( + true /* is_primary_axis_edge */)); } + // Switch to in-app shelf. + std::unique_ptr<views::Widget> widget = CreateTestWidget(); + // Wait for the navigation widget's animation. shelf_test_api.RunMessageLoopUntilAnimationsDone( test_api.GetBoundsAnimator()); @@ -576,7 +548,7 @@ ShelfNavigationWidget::TestApi test_api( GetPrimaryShelf()->navigation_widget()); const bool should_show_home_button = - !(IsHotseatEnabled() && IsHideShelfControlsInTabletModeEnabled()); + !IsHideShelfControlsInTabletModeEnabled(); EXPECT_EQ(should_show_home_button, test_api.IsHomeButtonVisible()); ASSERT_EQ(should_show_home_button, static_cast<bool>(home_button()));
diff --git a/ash/shelf/hotseat_widget.cc b/ash/shelf/hotseat_widget.cc index 1bd75aa9..bbe42c5 100644 --- a/ash/shelf/hotseat_widget.cc +++ b/ash/shelf/hotseat_widget.cc
@@ -26,7 +26,6 @@ #include "ash/wm/overview/overview_observer.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/metrics/histogram_macros.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/aura/scoped_window_targeter.h" #include "ui/aura/window_targeter.h" #include "ui/compositor/animation_metrics_reporter.h" @@ -674,8 +673,7 @@ } bool HotseatWidget::ShouldShowHotseatBackground() { - return chromeos::switches::ShouldShowShelfHotseat() && - Shell::Get()->tablet_mode_controller() && + return Shell::Get()->tablet_mode_controller() && Shell::Get()->tablet_mode_controller()->InTabletMode(); }
diff --git a/ash/shelf/hotseat_widget_unittest.cc b/ash/shelf/hotseat_widget_unittest.cc index 1bbe9c2f..c5f5698 100644 --- a/ash/shelf/hotseat_widget_unittest.cc +++ b/ash/shelf/hotseat_widget_unittest.cc
@@ -44,7 +44,6 @@ #include "ash/wm/work_area_insets.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" -#include "chromeos/constants/chromeos_features.h" #include "chromeos/services/assistant/public/cpp/assistant_service.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/client/aura_constants.h" @@ -86,7 +85,6 @@ std::vector<base::Feature> enabled_features; std::vector<base::Feature> disabled_features; - enabled_features.push_back(chromeos::features::kShelfHotseat); if (navigation_buttons_shown_in_tablet_mode_) { disabled_features.push_back(features::kHideShelfControlsInTabletMode); } else {
diff --git a/ash/shelf/scrollable_shelf_view.cc b/ash/shelf/scrollable_shelf_view.cc index 3446ae1c..405883e6 100644 --- a/ash/shelf/scrollable_shelf_view.cc +++ b/ash/shelf/scrollable_shelf_view.cc
@@ -18,7 +18,6 @@ #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/metrics/histogram_functions.h" #include "base/numerics/ranges.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h" #include "ui/base/l10n/l10n_util.h" #include "ui/compositor/animation_throughput_reporter.h" @@ -555,14 +554,12 @@ if (activated) { focus_ring_activated_ = true; SetPaneFocusAndFocusDefault(); - if (Shell::Get()->IsInTabletMode() && - chromeos::switches::ShouldShowShelfHotseat()) + if (Shell::Get()->IsInTabletMode()) GetShelf()->shelf_widget()->ForceToShowHotseat(); } else { // Shows the gradient shader when the focus ring is disabled. focus_ring_activated_ = false; - if (Shell::Get()->IsInTabletMode() && - chromeos::switches::ShouldShowShelfHotseat()) + if (Shell::Get()->IsInTabletMode()) GetShelf()->shelf_widget()->ForceToHideHotseat(); } @@ -1141,7 +1138,6 @@ // In tablet mode, when the hotseat is not extended but one of the buttons // gets focused, it should update the visibility of the hotseat. if (Shell::Get()->IsInTabletMode() && - chromeos::switches::ShouldShowShelfHotseat() && !shelf_widget->hotseat_widget()->IsExtended()) { shelf_widget->shelf_layout_manager()->UpdateVisibilityState(); } @@ -1160,11 +1156,9 @@ void ScrollableShelfView::HandleAccessibleActionScrollToMakeVisible( ShelfButton* button) { - if (Shell::Get()->IsInTabletMode() && - chromeos::switches::ShouldShowShelfHotseat()) { - // Only in tablet mode with hotseat enabled, may scrollable shelf be hidden. + // Scrollable shelf can only be hidden in tablet mode. + if (Shell::Get()->IsInTabletMode()) GetShelf()->shelf_widget()->ForceToShowHotseat(); - } } std::unique_ptr<ScrollableShelfView::ScopedActiveInkDropCount> @@ -2109,9 +2103,8 @@ gfx::Rect ScrollableShelfView::CalculateVisibleSpace( LayoutStrategy layout_strategy) const { - const bool in_hotseat_tablet = chromeos::switches::ShouldShowShelfHotseat() && - Shell::Get()->IsInTabletMode(); - if (layout_strategy == kNotShowArrowButtons && !in_hotseat_tablet) + const bool in_tablet_mode = Shell::Get()->IsInTabletMode(); + if (layout_strategy == kNotShowArrowButtons && !in_tablet_mode) return GetAvailableLocalBounds(/*use_target_bounds=*/false); const bool should_show_left_arrow = @@ -2145,15 +2138,14 @@ gfx::Insets ScrollableShelfView::CalculateRipplePaddingInsets() const { // Indicates whether it is in tablet mode with hotseat enabled. - const bool in_hotseat_tablet = chromeos::switches::ShouldShowShelfHotseat() && - Shell::Get()->IsInTabletMode(); + const bool in_tablet_mode = Shell::Get()->IsInTabletMode(); const int ripple_padding = ShelfConfig::Get()->scrollable_shelf_ripple_padding(); const int before_padding = - (in_hotseat_tablet && !ShouldShowLeftArrow()) ? 0 : ripple_padding; + (in_tablet_mode && !ShouldShowLeftArrow()) ? 0 : ripple_padding; const int after_padding = - (in_hotseat_tablet && !ShouldShowRightArrow()) ? 0 : ripple_padding; + (in_tablet_mode && !ShouldShowRightArrow()) ? 0 : ripple_padding; if (ShouldAdaptToRTL()) return gfx::Insets(0, after_padding, 0, before_padding); @@ -2173,9 +2165,8 @@ const bool is_in_tablet_mode = Shell::Get()->tablet_mode_controller() && Shell::Get()->IsInTabletMode(); - if (!chromeos::switches::ShouldShowShelfHotseat() || !is_in_tablet_mode) { + if (!is_in_tablet_mode) return gfx::RoundedCornersF(); - } const bool is_horizontal_alignment = GetShelf()->IsHorizontalAlignment(); const float radius = (is_horizontal_alignment ? height() : width()) / 2.f;
diff --git a/ash/shelf/scrollable_shelf_view_unittest.cc b/ash/shelf/scrollable_shelf_view_unittest.cc index 6a344eac..89e1af37 100644 --- a/ash/shelf/scrollable_shelf_view_unittest.cc +++ b/ash/shelf/scrollable_shelf_view_unittest.cc
@@ -23,7 +23,6 @@ #include "base/test/icu_test_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" -#include "chromeos/constants/chromeos_features.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" #include "ui/display/manager/display_manager.h" #include "ui/events/event_utils.h" @@ -199,6 +198,28 @@ EXPECT_LE(ripple_right, shelf_container_bounds_in_screen.right()); } + bool HasRoundedCornersOnAppButtonAfterMouseRightClick( + ShelfAppButton* button) { + const gfx::Point location_within_button = + button->GetBoundsInScreen().CenterPoint(); + GetEventGenerator()->MoveMouseTo(location_within_button); + GetEventGenerator()->ClickRightButton(); + + ui::Layer* layer = scrollable_shelf_view_->shelf_container_view()->layer(); + + // The gfx::RoundedCornersF object is considered empty when all of the + // corners are squared (no effective radius). + const bool has_rounded_corners = !(layer->rounded_corner_radii().IsEmpty()); + + // Click outside of |button|. Expects that the rounded corners should always + // be empty. + GetEventGenerator()->GestureTapAt( + button->GetBoundsInScreen().bottom_center()); + EXPECT_TRUE(layer->rounded_corner_radii().IsEmpty()); + + return has_rounded_corners; + } + ScrollableShelfView* scrollable_shelf_view_ = nullptr; ShelfView* shelf_view_ = nullptr; std::unique_ptr<ShelfViewTestAPI> test_api_; @@ -516,51 +537,10 @@ EXPECT_LE(view_index, scrollable_shelf_view_->last_tappable_app_index()); } -class HotseatScrollableShelfViewTest : public ScrollableShelfViewTest { - public: - HotseatScrollableShelfViewTest() = default; - ~HotseatScrollableShelfViewTest() override = default; - - void SetUp() override { - scoped_feature_list_.InitWithFeatures({chromeos::features::kShelfHotseat}, - {}); - ScrollableShelfViewTest::SetUp(); - } - - void TearDown() override { - ScrollableShelfViewTest::TearDown(); - scoped_feature_list_.Reset(); - } - - bool HasRoundedCornersOnAppButtonAfterMouseRightClick( - ShelfAppButton* button) { - const gfx::Point location_within_button = - button->GetBoundsInScreen().CenterPoint(); - GetEventGenerator()->MoveMouseTo(location_within_button); - GetEventGenerator()->ClickRightButton(); - - ui::Layer* layer = scrollable_shelf_view_->shelf_container_view()->layer(); - - // The gfx::RoundedCornersF object is considered empty when all of the - // corners are squared (no effective radius). - const bool has_rounded_corners = !(layer->rounded_corner_radii().IsEmpty()); - - // Click outside of |button|. Expects that the rounded corners should always - // be empty. - GetEventGenerator()->GestureTapAt( - button->GetBoundsInScreen().bottom_center()); - EXPECT_TRUE(layer->rounded_corner_radii().IsEmpty()); - - return has_rounded_corners; - } - - base::test::ScopedFeatureList scoped_feature_list_; -}; - // Verifies that after adding the second display, shelf icons showing on // the primary display are also visible on the second display // (https://crbug.com/1035596). -TEST_F(HotseatScrollableShelfViewTest, CheckTappableIndicesOnSecondDisplay) { +TEST_F(ScrollableShelfViewTest, CheckTappableIndicesOnSecondDisplay) { constexpr int icon_number = 5; for (int i = 0; i < icon_number; i++) AddAppShortcut(); @@ -584,7 +564,7 @@ // Verifies that the scrollable shelf in oveflow mode has the correct layout // after switching to tablet mode (https://crbug.com/1017979). -TEST_F(HotseatScrollableShelfViewTest, CorrectUIAfterSwitchingToTablet) { +TEST_F(ScrollableShelfViewTest, CorrectUIAfterSwitchingToTablet) { // Add enough app shortcuts to ensure that at least three pages of icons show. for (int i = 0; i < 25; i++) AddAppShortcut(); @@ -612,7 +592,7 @@ // Verifies that the scrollable shelf without overflow has the correct layout in // tablet mode. -TEST_F(HotseatScrollableShelfViewTest, CorrectUIInTabletWithoutOverflow) { +TEST_F(ScrollableShelfViewTest, CorrectUIInTabletWithoutOverflow) { Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); for (int i = 0; i < 3; i++) @@ -638,7 +618,7 @@ // Verifies that the scrollable shelf without overflow has the correct layout in // tablet mode. -TEST_F(HotseatScrollableShelfViewTest, CheckRoundedCornersSetForInkDrop) { +TEST_F(ScrollableShelfViewTest, CheckRoundedCornersSetForInkDrop) { Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); AddAppShortcutsUntilOverflow(); ASSERT_EQ(ScrollableShelfView::kShowRightArrowButton,
diff --git a/ash/shelf/shelf_background_animator.cc b/ash/shelf/shelf_background_animator.cc index d35af356..6f7e746cc 100644 --- a/ash/shelf/shelf_background_animator.cc +++ b/ash/shelf/shelf_background_animator.cc
@@ -19,7 +19,6 @@ #include "ash/style/default_colors.h" #include "ash/wallpaper/wallpaper_controller_impl.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/gfx/animation/slide_animation.h" #include "ui/gfx/color_analysis.h" #include "ui/gfx/color_palette.h" @@ -231,8 +230,7 @@ break; case ShelfBackgroundType::kOverview: shelf_target_color = - (chromeos::switches::ShouldShowShelfHotseat() && - Shell::Get()->tablet_mode_controller()->InTabletMode()) + Shell::Get()->tablet_mode_controller()->InTabletMode() ? ShelfConfig::Get()->GetMaximizedShelfColor() : ShelfConfig::Get()->GetDefaultShelfColor(); break;
diff --git a/ash/shelf/shelf_config.cc b/ash/shelf/shelf_config.cc index dfcbc53..865b828c 100644 --- a/ash/shelf/shelf_config.cc +++ b/ash/shelf/shelf_config.cc
@@ -17,7 +17,6 @@ #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/metrics/histogram_functions.h" #include "base/scoped_observer.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/gfx/color_analysis.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/color_utils.h" @@ -159,12 +158,10 @@ void ShelfConfig::Init() { Shell* const shell = Shell::Get(); - if (chromeos::switches::ShouldShowShelfHotseat()) { - shell->app_list_controller()->AddObserver(this); - display::Screen::GetScreen()->AddObserver(this); - shell->system_tray_model()->virtual_keyboard()->AddObserver(this); - shell->overview_controller()->AddObserver(this); - } + shell->app_list_controller()->AddObserver(this); + display::Screen::GetScreen()->AddObserver(this); + shell->system_tray_model()->virtual_keyboard()->AddObserver(this); + shell->overview_controller()->AddObserver(this); shell->tablet_mode_controller()->AddObserver(this); in_tablet_mode_ = shell->IsInTabletMode(); @@ -175,9 +172,6 @@ Shell* const shell = Shell::Get(); shell->tablet_mode_controller()->RemoveObserver(this); - if (!chromeos::switches::ShouldShowShelfHotseat()) - return; - shell->overview_controller()->RemoveObserver(this); shell->system_tray_model()->virtual_keyboard()->RemoveObserver(this); display::Screen::GetScreen()->RemoveObserver(this); @@ -207,9 +201,6 @@ DCHECK(!in_tablet_mode_); in_tablet_mode_ = true; - if (!chromeos::switches::ShouldShowShelfHotseat()) - return; - UpdateConfig(is_app_list_visible_, /*tablet_mode_changed=*/true); } @@ -221,9 +212,6 @@ // unnecessary work-area bounds changes. in_tablet_mode_ = false; - if (!chromeos::switches::ShouldShowShelfHotseat()) - return; - UpdateConfig(is_app_list_visible_, /*tablet_mode_changed=*/true); } @@ -284,10 +272,8 @@ } int ShelfConfig::GetHotseatSize(HotseatDensity density) const { - if (!chromeos::switches::ShouldShowShelfHotseat() || - !Shell::Get()->IsInTabletMode()) { + if (!in_tablet_mode_) return shelf_size(); - } return GetShelfButtonSize(density); } @@ -321,9 +307,6 @@ } int ShelfConfig::control_size() const { - if (!chromeos::switches::ShouldShowShelfHotseat()) - return 40; - if (!in_tablet_mode_) return 36; @@ -331,8 +314,7 @@ } int ShelfConfig::control_border_radius() const { - return (chromeos::switches::ShouldShowShelfHotseat() && is_in_app() && - in_tablet_mode_) + return (is_in_app() && in_tablet_mode_) ? control_size() / 2 - in_app_control_button_height_inset_ : control_size() / 2; } @@ -350,10 +332,7 @@ } base::TimeDelta ShelfConfig::shelf_animation_duration() const { - if (chromeos::switches::ShouldShowShelfHotseat()) - return hotseat_background_animation_duration(); - - return base::TimeDelta::FromMilliseconds(200); + return hotseat_background_animation_duration(); } int ShelfConfig::status_area_hit_region_padding() const { @@ -389,10 +368,9 @@ display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); const bool new_is_dense = - chromeos::switches::ShouldShowShelfHotseat() && - (!in_tablet_mode_ || - (screen_size.width() <= kDenseShelfScreenSizeThreshold || - screen_size.height() <= kDenseShelfScreenSizeThreshold)); + !in_tablet_mode_ || + (screen_size.width() <= kDenseShelfScreenSizeThreshold || + screen_size.height() <= kDenseShelfScreenSizeThreshold); const bool can_hide_shelf_controls = in_tablet_mode_ && features::IsHideShelfControlsInTabletModeEnabled(); @@ -430,10 +408,6 @@ } int ShelfConfig::GetShelfSize(bool ignore_in_app_state) const { - // Before the hotseat redesign, the shelf always has the same size. - if (!chromeos::switches::ShouldShowShelfHotseat()) - return 56; - // In clamshell mode, the shelf always has the same size. if (!in_tablet_mode_) return 48; @@ -448,7 +422,7 @@ const session_manager::SessionState session_state = Shell::Get()->session_controller()->GetSessionState(); - if (chromeos::switches::ShouldShowShelfHotseat() && in_tablet_mode_ && + if (in_tablet_mode_ && session_state == session_manager::SessionState::ACTIVE) { return is_in_app() ? SK_ColorTRANSPARENT : GetDefaultShelfColor(); } else if (session_state == session_manager::SessionState::OOBE) { @@ -466,20 +440,15 @@ } AshColorProvider::BaseLayerType ShelfConfig::GetShelfBaseLayerType() const { - if (!chromeos::switches::ShouldShowShelfHotseat()) { - return in_tablet_mode_ ? AshColorProvider::BaseLayerType::kTransparent60 - : AshColorProvider::BaseLayerType::kTransparent80; - } + if (!in_tablet_mode_) + return AshColorProvider::BaseLayerType::kTransparent80; - if (in_tablet_mode_) { - if (is_in_app()) { - return AshColorProvider::Get()->IsDarkModeEnabled() - ? AshColorProvider::BaseLayerType::kTransparent90 - : AshColorProvider::BaseLayerType::kOpaque; - } + if (!is_in_app()) return AshColorProvider::BaseLayerType::kTransparent60; - } - return AshColorProvider::BaseLayerType::kTransparent80; + + return AshColorProvider::Get()->IsDarkModeEnabled() + ? AshColorProvider::BaseLayerType::kTransparent90 + : AshColorProvider::BaseLayerType::kOpaque; } SkColor ShelfConfig::GetDefaultShelfColor() const { @@ -494,17 +463,13 @@ } int ShelfConfig::GetShelfControlButtonBlurRadius() const { - if (features::IsBackgroundBlurEnabled() && - chromeos::switches::ShouldShowShelfHotseat() && in_tablet_mode_ && - !is_in_app()) { + if (features::IsBackgroundBlurEnabled() && in_tablet_mode_ && !is_in_app()) return shelf_blur_radius_; - } return 0; } int ShelfConfig::GetAppIconEndPadding() const { - return chromeos::switches::ShouldShowShelfHotseat() ? app_icon_end_padding_ - : 0; + return app_icon_end_padding_; } int ShelfConfig::GetAppIconGroupMargin() const {
diff --git a/ash/shelf/shelf_config_unittest.cc b/ash/shelf/shelf_config_unittest.cc index 8361e26..0df0f3f 100644 --- a/ash/shelf/shelf_config_unittest.cc +++ b/ash/shelf/shelf_config_unittest.cc
@@ -12,8 +12,6 @@ #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/command_line.h" #include "base/macros.h" -#include "base/test/scoped_feature_list.h" -#include "chromeos/constants/chromeos_features.h" #include "ui/views/widget/widget.h" namespace ash { @@ -23,12 +21,6 @@ ShelfConfigTest() = default; ~ShelfConfigTest() override = default; - void SetUp() override { - scoped_feature_list_.InitAndEnableFeature( - chromeos::features::kShelfHotseat); - AshTestBase::SetUp(); - } - protected: bool is_dense() { return ShelfConfig::Get()->is_dense_; } @@ -39,9 +31,6 @@ void SetTabletMode(bool is_tablet_mode) { Shell::Get()->tablet_mode_controller()->SetEnabledForTest(is_tablet_mode); } - - private: - base::test::ScopedFeatureList scoped_feature_list_; }; // Make sure ShelfConfig is dense when screen becomes small in tablet mode.
diff --git a/ash/shelf/shelf_control_button.cc b/ash/shelf/shelf_control_button.cc index df5386ad..dc9db455 100644 --- a/ash/shelf/shelf_control_button.cc +++ b/ash/shelf/shelf_control_button.cc
@@ -10,7 +10,6 @@ #include "ash/shelf/shelf_button_delegate.h" #include "ash/shell.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/accessibility/ax_node_data.h" #include "ui/gfx/canvas.h" #include "ui/gfx/paint_vector_icon.h" @@ -41,8 +40,7 @@ gfx::RectF visual_bounds = rect; visual_bounds.ClampToCenteredSize( gfx::SizeF(shelf_config->control_size(), shelf_config->control_size())); - if (chromeos::switches::ShouldShowShelfHotseat() && - Shell::Get()->IsInTabletMode() && shelf_config->is_in_app()) { + if (Shell::Get()->IsInTabletMode() && shelf_config->is_in_app()) { visual_bounds.Inset(0, shelf_config->in_app_control_button_height_inset()); }
diff --git a/ash/shelf/shelf_layout_manager.cc b/ash/shelf/shelf_layout_manager.cc index 4aa086b7..30f95c0 100644 --- a/ash/shelf/shelf_layout_manager.cc +++ b/ash/shelf/shelf_layout_manager.cc
@@ -58,8 +58,6 @@ #include "base/logging.h" #include "base/macros.h" #include "base/metrics/histogram_macros.h" -#include "chromeos/constants/chromeos_features.h" -#include "chromeos/constants/chromeos_switches.h" #include "components/prefs/pref_service.h" #include "ui/base/hit_test.h" #include "ui/base/ui_base_switches.h" @@ -154,11 +152,6 @@ return parent && parent->id() == kShellWindowId_AppListContainer; } -bool IsHotseatEnabled() { - return Shell::Get()->IsInTabletMode() && - chromeos::switches::ShouldShowShelfHotseat(); -} - int GetOffset(int offset, bool from_touchpad) { PrefService* prefs = Shell::Get()->session_controller()->GetLastActiveUserPrefService(); @@ -173,7 +166,8 @@ // gestures. ash::HomeLauncherGestureHandler::Mode GetHomeLauncherGestureHandlerModeForDrag() { - if (IsHotseatEnabled() && Shell::Get()->home_screen_controller() && + if (Shell::Get()->IsInTabletMode() && + Shell::Get()->home_screen_controller() && Shell::Get()->home_screen_controller()->IsHomeScreenVisible() && Shell::Get()->overview_controller() && !Shell::Get()->overview_controller()->InOverviewSession()) { @@ -464,7 +458,6 @@ gfx::Rect ShelfLayoutManager::GetIdealBoundsForWorkAreaCalculation() const { if (!Shell::Get()->IsInTabletMode() || - !chromeos::switches::ShouldShowShelfHotseat() || state_.session_state != session_manager::SessionState::ACTIVE) { return GetIdealBounds(); } @@ -697,7 +690,7 @@ void ShelfLayoutManager::ProcessGestureEventOfInAppHotseat( ui::GestureEvent* event, aura::Window* target) { - if (!IsHotseatEnabled()) + if (!Shell::Get()->IsInTabletMode()) return; DCHECK_EQ(hotseat_state(), HotseatState::kExtended); @@ -922,13 +915,7 @@ if (!is_background_blur_enabled_) return false; - if (chromeos::switches::ShouldShowShelfHotseat()) { - return shelf_background_type_ == ShelfBackgroundType::kDefaultBg && - state_.session_state == session_manager::SessionState::ACTIVE; - } - - return (shelf_background_type_ == ShelfBackgroundType::kHomeLauncher || - shelf_background_type_ == ShelfBackgroundType::kDefaultBg) && + return shelf_background_type_ == ShelfBackgroundType::kDefaultBg && state_.session_state == session_manager::SessionState::ACTIVE; } @@ -1191,9 +1178,6 @@ void ShelfLayoutManager::OnCenterVisibilityChanged( message_center::Visibility visibility) { - if (!chromeos::switches::ShouldShowShelfHotseat()) - return; - // Uses base::CancelableClosure to handle two edge cases: (1) // ShelfLayoutManager is destructed before the callback runs. (2) The previous // callback is still pending. @@ -1326,7 +1310,7 @@ HotseatState ShelfLayoutManager::CalculateHotseatState( ShelfVisibilityState visibility_state, ShelfAutoHideState auto_hide_state) const { - if (!IsHotseatEnabled() || !shelf_->IsHorizontalAlignment()) + if (!Shell::Get()->IsInTabletMode() || !shelf_->IsHorizontalAlignment()) return HotseatState::kShownClamshell; auto* app_list_controller = Shell::Get()->app_list_controller(); @@ -1630,11 +1614,11 @@ const int default_shelf_inset = GetShelfInset(state.visibility_state, ShelfConfig::Get()->shelf_size()); - // When hotseat is enabled, keep horizontal shelf inset at in-app shelf size + // In tablet mode, keep horizontal shelf inset at in-app shelf size // to avoid work area updates when the shelf size changes when going to and // from home screen (shelf size rules differ on home screen). const int horizontal_inset = - IsHotseatEnabled() + Shell::Get()->IsInTabletMode() ? GetShelfInset(state.visibility_state, ShelfConfig::Get()->in_app_shelf_size()) : default_shelf_inset; @@ -1654,12 +1638,11 @@ CalculateTargetBounds(state_, hotseat_target_state); gfx::Rect shelf_bounds_for_workarea_calculation = shelf_->shelf_widget()->GetTargetBounds(); - // When the hotseat is enabled, only use the in-app shelf bounds when - // calculating the work area. This prevents windows resizing unnecessarily. If - // the shelf is not visible then use the regular calculations. Note that on - // the home screen, the shelf is deemed visible as it is visible with a - // transparent background. - if (IsHotseatEnabled() && IsVisible()) { + // In tablet mode, only use the in-app shelf bounds when calculating the work + // area. This prevents windows resizing unnecessarily. If the shelf is not + // visible then use the regular calculations. Note that on the home screen, + // the shelf is deemed visible as it is visible with a transparent background. + if (Shell::Get()->IsInTabletMode() && IsVisible()) { shelf_bounds_for_workarea_calculation = GetIdealBoundsForWorkAreaCalculation(); } @@ -1694,9 +1677,9 @@ } float translate = 0.f; - if (IsHotseatEnabled()) { - // The drag up gesture should not taper off when the hotseat is enabled - // because there should be a linear transition to the home launcher gesture. + if (Shell::Get()->IsInTabletMode()) { + // The drag up gesture should not taper off in tablet mode to have a linear + // transition to the home launcher gesture. translate = drag_amount_; } else { const bool resist = shelf_->SelectValueForShelfAlignment( @@ -1724,7 +1707,7 @@ const int shelf_position = baseline + translate; if (horizontal) { - if (!IsHotseatEnabled()) { + if (!Shell::Get()->IsInTabletMode()) { shelf_->shelf_widget()->UpdateTargetBoundsForGesture(shelf_position); shelf_->navigation_widget()->UpdateTargetBoundsForGesture(shelf_position); shelf_->hotseat_widget()->UpdateTargetBoundsForGesture(shelf_position); @@ -2006,8 +1989,7 @@ float ShelfLayoutManager::ComputeTargetOpacity(const State& state) const { // The shelf should not become transparent during the animation to or from // HomeLauncher. - if (chromeos::switches::ShouldShowShelfHotseat() && - Shell::Get()->IsInTabletMode() && + if (Shell::Get()->IsInTabletMode() && Shell::Get()->app_list_controller()->home_launcher_transition_state() != AppListControllerImpl::HomeLauncherTransitionState::kFinished) { return 1.0f; @@ -2062,12 +2044,12 @@ const bool up_on_shown_hotseat = hotseat_state() == HotseatState::kShownHomeLauncher && scroll_y < 0; - if (IsHotseatEnabled() && up_on_shown_hotseat) { + if (Shell::Get()->IsInTabletMode() && up_on_shown_hotseat) { return GetHomeLauncherGestureHandlerModeForDrag() == HomeLauncherGestureHandler::Mode::kSwipeHomeToOverview; } - if (IsHotseatEnabled()) { + if (Shell::Get()->IsInTabletMode()) { if (hotseat_state() != HotseatState::kShownHomeLauncher && hotseat_state() != HotseatState::kNone) { // If hotseat is hidden or extended (in-app or in-overview), do not let @@ -2323,7 +2305,7 @@ void ShelfLayoutManager::MaybeSetupHotseatDrag( const ui::LocatedEvent& event_in_screen) { - if (!IsHotseatEnabled()) + if (!Shell::Get()->IsInTabletMode()) return; // Do not allow Hotseat dragging when the hotseat is shown within the shelf. @@ -2408,9 +2390,8 @@ else CancelDrag(window_drag_result); - // Hotseat gestures are meaningful only in tablet mode with hotseat enabled. - if (chromeos::switches::ShouldShowShelfHotseat() && - Shell::Get()->IsInTabletMode()) { + // Hotseat gestures are only meaningful in tablet mode. + if (Shell::Get()->IsInTabletMode()) { base::Optional<InAppShelfGestures> gesture_to_record = CalculateHotseatGestureToRecord(window_drag_result, transitioned_from_overview_to_home, @@ -2724,7 +2705,7 @@ bool ShelfLayoutManager::MaybeEndDragFromOverviewToHome( const ui::LocatedEvent& event_in_screen) { - if (!IsHotseatEnabled()) + if (!Shell::Get()->IsInTabletMode()) return false; if (!allow_fling_from_overview_to_home_ ||
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index c01fc15..9236190 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -76,9 +76,6 @@ #include "base/stl_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/user_action_tester.h" -#include "base/test/scoped_feature_list.h" -#include "chromeos/constants/chromeos_features.h" -#include "chromeos/constants/chromeos_switches.h" #include "chromeos/ui/base/window_properties.h" #include "components/prefs/pref_service.h" #include "ui/aura/client/aura_constants.h" @@ -198,38 +195,20 @@ } // namespace -class ShelfLayoutManagerTest : public ShelfLayoutManagerTestBase, - public testing::WithParamInterface<bool> { +class ShelfLayoutManagerTest : public ShelfLayoutManagerTestBase { public: ShelfLayoutManagerTest() = default; - // testing::Test: - void SetUp() override { - if (testing::UnitTest::GetInstance()->current_test_info()->value_param()) { - if (GetParam()) { - scoped_feature_list_.InitAndEnableFeature( - chromeos::features::kShelfHotseat); - } - } - ShelfLayoutManagerTestBase::SetUp(); - } - void SetUpKioskSession() { SessionInfo info; info.is_running_in_app_mode = true; info.state = session_manager::SessionState::ACTIVE; Shell::Get()->session_controller()->SetSessionInfo(info); } - - private: - base::test::ScopedFeatureList scoped_feature_list_; }; -// Used to test the Hotseat, ScrollableShelf, and DenseShelf features. -INSTANTIATE_TEST_SUITE_P(All, ShelfLayoutManagerTest, testing::Bool()); - // Makes sure SetVisible updates work area and widget appropriately. -TEST_P(ShelfLayoutManagerTest, SetVisible) { +TEST_F(ShelfLayoutManagerTest, SetVisible) { ShelfWidget* shelf_widget = GetShelfWidget(); ShelfLayoutManager* manager = shelf_widget->shelf_layout_manager(); // Force an initial layout. @@ -282,7 +261,7 @@ } // Makes sure LayoutShelf invoked while animating cleans things up. -TEST_P(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { +TEST_F(ShelfLayoutManagerTest, LayoutShelfWhileAnimating) { Shelf* shelf = GetPrimaryShelf(); ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); // Force an initial layout. @@ -306,7 +285,7 @@ // Test that switching to a different visibility state does not restart the // shelf show / hide animation if it is already running. (crbug.com/250918) -TEST_P(ShelfLayoutManagerTest, SetStateWhileAnimating) { +TEST_F(ShelfLayoutManagerTest, SetStateWhileAnimating) { ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); SetState(layout_manager, SHELF_VISIBLE); ShelfWidget* shelf_widget = GetShelfWidget(); @@ -333,7 +312,7 @@ } // Various assertions around auto-hide. -TEST_P(ShelfLayoutManagerTest, AutoHide) { +TEST_F(ShelfLayoutManagerTest, AutoHide) { ui::test::EventGenerator* generator = GetEventGenerator(); const gfx::Rect stable_work_area = @@ -433,7 +412,7 @@ // Test the behavior of the shelf when it is auto hidden and it is on the // boundary between the primary and the secondary display. -TEST_P(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) { +TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnScreenBoundary) { UpdateDisplay("800x600,800x600"); Shell::Get()->display_manager()->SetLayoutForCurrentDisplays( display::test::CreateDisplayLayout(display_manager(), @@ -521,7 +500,7 @@ } // Assertions around the login screen. -TEST_P(ShelfLayoutManagerTest, VisibleWhenLoginScreenShowing) { +TEST_F(ShelfLayoutManagerTest, VisibleWhenLoginScreenShowing) { Shelf* shelf = GetPrimaryShelf(); auto* wallpaper_controller = Shell::Get()->wallpaper_controller(); WallpaperShownWaiter waiter; @@ -551,7 +530,7 @@ } // Assertions around the lock screen showing. -TEST_P(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) { +TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) { Shelf* shelf = GetPrimaryShelf(); ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); @@ -669,7 +648,7 @@ } // Assertions around SetAutoHideBehavior. -TEST_P(ShelfLayoutManagerTest, SetAutoHideBehavior) { +TEST_F(ShelfLayoutManagerTest, SetAutoHideBehavior) { Shelf* shelf = GetPrimaryShelf(); views::Widget* widget = CreateTestWidget(); @@ -704,7 +683,7 @@ } // Verifies the shelf is visible when status/shelf is focused. -TEST_P(ShelfLayoutManagerTest, VisibleWhenStatusOrShelfFocused) { +TEST_F(ShelfLayoutManagerTest, VisibleWhenStatusOrShelfFocused) { Shelf* shelf = GetPrimaryShelf(); views::Widget* widget = CreateTestWidget(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); @@ -730,7 +709,7 @@ // Checks that the status area follows along the auto-hidden shelf when the // user swipes it up or down. -TEST_P(ShelfLayoutManagerTest, StatusAreaMoveWithSwipeOnAutoHiddenShelf) { +TEST_F(ShelfLayoutManagerTest, StatusAreaMoveWithSwipeOnAutoHiddenShelf) { Shelf* shelf = GetPrimaryShelf(); CreateTestWidget(); TabletModeControllerTestApi().EnterTabletMode(); @@ -787,7 +766,7 @@ } // Checks that the shelf keeps hidden during the Kiosk mode. -TEST_P(ShelfLayoutManagerTest, HiddenShelfInKioskMode_FullScreen) { +TEST_F(ShelfLayoutManagerTest, HiddenShelfInKioskMode_FullScreen) { SetUpKioskSession(); // Create a window and make it full screen; the shelf should be hidden. @@ -807,7 +786,7 @@ // Checks that the shelf keeps hidden during the Kiosk mode. (Some windows might // not be fullscreen, e.g., the a11y setting window.) -TEST_P(ShelfLayoutManagerTest, HiddenShelfInKioskMode_Default) { +TEST_F(ShelfLayoutManagerTest, HiddenShelfInKioskMode_Default) { SetUpKioskSession(); // Create a default window; the shelf should be hidden. @@ -824,7 +803,7 @@ EXPECT_EQ(SHELF_HIDDEN, GetPrimaryShelf()->GetVisibilityState()); } -TEST_P(ShelfLayoutManagerTest, +TEST_F(ShelfLayoutManagerTest, NavigationWidgetDoesNotMoveWithoutAutoHiddenShelf) { Shelf* shelf = GetPrimaryShelf(); CreateTestWidget(); @@ -853,7 +832,7 @@ shelf->navigation_widget()->GetWindowBoundsInScreen()); } -TEST_P(ShelfLayoutManagerTest, StatusWidgetDoesNotMoveWithoutAutoHiddenShelf) { +TEST_F(ShelfLayoutManagerTest, StatusWidgetDoesNotMoveWithoutAutoHiddenShelf) { Shelf* shelf = GetPrimaryShelf(); CreateTestWidget(); TabletModeControllerTestApi().EnterTabletMode(); @@ -884,7 +863,7 @@ // Checks that the navigation widget follows along the auto-hidden shelf when // the user swipes it up or down. -TEST_P(ShelfLayoutManagerTest, NavigationWidgetMoveWithSwipeOnAutoHiddenShelf) { +TEST_F(ShelfLayoutManagerTest, NavigationWidgetMoveWithSwipeOnAutoHiddenShelf) { Shell::Get() ->accessibility_controller() ->SetTabletModeShelfNavigationButtonsEnabled(true); @@ -949,7 +928,7 @@ } // Ensure a SHELF_VISIBLE shelf stays visible when the app list is shown. -TEST_P(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) { +TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfVisibleState) { Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kNever); @@ -973,7 +952,7 @@ // Ensure a SHELF_AUTO_HIDE shelf is shown temporarily (SHELF_AUTO_HIDE_SHOWN) // when the app list is shown, but the visibility state doesn't change. -TEST_P(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) { +TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfAutoHideState) { Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); @@ -1004,7 +983,7 @@ // Makes sure that when we have dual displays, with one or both shelves are set // to AutoHide, viewing the AppList on one of them doesn't unhide the other // hidden shelf. -TEST_P(ShelfLayoutManagerTest, DualDisplayOpenAppListWithShelfAutoHideState) { +TEST_F(ShelfLayoutManagerTest, DualDisplayOpenAppListWithShelfAutoHideState) { // Create two displays. UpdateDisplay("0+0-200x200,+200+0-100x100"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); @@ -1065,7 +1044,7 @@ // Ensure a SHELF_HIDDEN shelf (for a fullscreen window) is shown temporarily // when the app list is shown, and hidden again when the app list is dismissed. -TEST_P(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) { +TEST_F(ShelfLayoutManagerTest, OpenAppListWithShelfHiddenState) { Shelf* shelf = GetPrimaryShelf(); // Create a window and make it full screen; the shelf should be hidden. @@ -1093,7 +1072,7 @@ // Tests the correct behavior of the shelf when there is a system modal window // open when we have a single display. -TEST_P(ShelfLayoutManagerTest, ShelfWithSystemModalWindowSingleDisplay) { +TEST_F(ShelfLayoutManagerTest, ShelfWithSystemModalWindowSingleDisplay) { Shelf* shelf = GetPrimaryShelf(); ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); layout_manager->LayoutShelf(); @@ -1116,7 +1095,7 @@ // Tests the correct behavior of the shelf when there is a system modal window // open when we have dual display. -TEST_P(ShelfLayoutManagerTest, ShelfWithSystemModalWindowDualDisplay) { +TEST_F(ShelfLayoutManagerTest, ShelfWithSystemModalWindowDualDisplay) { // Create two displays. UpdateDisplay("200x200,100x100"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); @@ -1162,7 +1141,7 @@ // Tests that the shelf is only hidden for a fullscreen window at the front and // toggles visibility when another window is activated. -TEST_P(ShelfLayoutManagerTest, FullscreenWindowInFrontHidesShelf) { +TEST_F(ShelfLayoutManagerTest, FullscreenWindowInFrontHidesShelf) { Shelf* shelf = GetPrimaryShelf(); EXPECT_EQ(WorkspaceWindowState::kDefault, GetWorkspaceWindowState()); EXPECT_TRUE(GetNonLockScreenContainersContainerLayer()->GetMasksToBounds()); @@ -1191,7 +1170,7 @@ // Test the behavior of the shelf when a window on one display is fullscreen // but the other display has the active window. -TEST_P(ShelfLayoutManagerTest, FullscreenWindowOnSecondDisplay) { +TEST_F(ShelfLayoutManagerTest, FullscreenWindowOnSecondDisplay) { UpdateDisplay("800x600,800x600"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); @@ -1220,7 +1199,7 @@ } // Test for Pinned mode. -TEST_P(ShelfLayoutManagerTest, PinnedWindowHidesShelf) { +TEST_F(ShelfLayoutManagerTest, PinnedWindowHidesShelf) { Shelf* shelf = GetPrimaryShelf(); aura::Window* window1 = CreateTestWindow(); @@ -1237,7 +1216,7 @@ } // Tests SHELF_ALIGNMENT_(LEFT, RIGHT). -TEST_P(ShelfLayoutManagerTest, SetAlignment) { +TEST_F(ShelfLayoutManagerTest, SetAlignment) { Shelf* shelf = GetPrimaryShelf(); ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); // Force an initial layout. @@ -1316,7 +1295,7 @@ // Verifies that the shelf looks the way it should after an alignment change. // See crbug/1051824 . -TEST_P(ShelfLayoutManagerTest, ShelfWidgetLayoutUpdatedAfterAlignmentChange) { +TEST_F(ShelfLayoutManagerTest, ShelfWidgetLayoutUpdatedAfterAlignmentChange) { Shelf* shelf = GetPrimaryShelf(); ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); ShelfWidget* shelf_widget = shelf->shelf_widget(); @@ -1349,7 +1328,7 @@ EXPECT_EQ(ShelfConfig::Get()->shelf_size(), cross_axis_visible_pixels); } -TEST_P(ShelfLayoutManagerTest, GestureDrag) { +TEST_F(ShelfLayoutManagerTest, GestureDrag) { // Slop is an implementation detail of gesture recognition, and complicates // these tests. Ignore it. ui::GestureConfiguration::GetInstance() @@ -1384,7 +1363,7 @@ } } -TEST_P(ShelfLayoutManagerTest, MouseDrag) { +TEST_F(ShelfLayoutManagerTest, MouseDrag) { Shelf* shelf = GetPrimaryShelf(); gfx::Rect shelf_bounds_in_screen = GetVisibleShelfWidgetBoundsInScreen(); @@ -1447,7 +1426,7 @@ // If swiping up on shelf ends with fling event, the app list state should // depends on the fling velocity. -TEST_P(ShelfLayoutManagerTest, FlingUpOnShelfForAppList) { +TEST_F(ShelfLayoutManagerTest, FlingUpOnShelfForAppList) { Shelf* shelf = GetPrimaryShelf(); EXPECT_EQ(ShelfAlignment::kBottom, shelf->alignment()); EXPECT_EQ(ShelfAutoHideBehavior::kNever, shelf->auto_hide_behavior()); @@ -1494,7 +1473,7 @@ // Tests that duplicate swipe up from bottom bezel should not make app list // undraggable. (See https://crbug.com/896934) -TEST_P(ShelfLayoutManagerTest, DuplicateDragUpFromBezel) { +TEST_F(ShelfLayoutManagerTest, DuplicateDragUpFromBezel) { GetAppListTestHelper()->CheckVisibility(false); GetAppListTestHelper()->CheckState(AppListViewState::kClosed); @@ -1534,7 +1513,7 @@ } // Change the shelf alignment during dragging should dismiss the app list. -TEST_P(ShelfLayoutManagerTest, ChangeShelfAlignmentDuringAppListDragging) { +TEST_F(ShelfLayoutManagerTest, ChangeShelfAlignmentDuringAppListDragging) { Shelf* shelf = GetPrimaryShelf(); EXPECT_EQ(ShelfAlignment::kBottom, shelf->alignment()); EXPECT_EQ(ShelfAutoHideBehavior::kNever, shelf->auto_hide_behavior()); @@ -1552,7 +1531,7 @@ GetAppListTestHelper()->CheckVisibility(false); } -TEST_P(ShelfLayoutManagerTest, SwipingUpOnShelfInLaptopModeForAppList) { +TEST_F(ShelfLayoutManagerTest, SwipingUpOnShelfInLaptopModeForAppList) { Shelf* shelf = GetPrimaryShelf(); EXPECT_EQ(ShelfAlignment::kBottom, shelf->alignment()); EXPECT_EQ(ShelfAutoHideBehavior::kNever, shelf->auto_hide_behavior()); @@ -1632,7 +1611,7 @@ } // Swiping on shelf when fullscreen app list is opened should have no effect. -TEST_P(ShelfLayoutManagerTest, SwipingOnShelfIfAppListOpened) { +TEST_F(ShelfLayoutManagerTest, SwipingOnShelfIfAppListOpened) { Shelf* shelf = GetPrimaryShelf(); ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); layout_manager->OnAppListVisibilityChanged(true, GetPrimaryDisplayId()); @@ -1672,7 +1651,7 @@ EXPECT_EQ(ShelfAutoHideBehavior::kNever, shelf->auto_hide_behavior()); } -TEST_P(ShelfLayoutManagerTest, WindowVisibilityDisablesAutoHide) { +TEST_F(ShelfLayoutManagerTest, WindowVisibilityDisablesAutoHide) { UpdateDisplay("800x600,800x600"); Shelf* shelf = GetPrimaryShelf(); ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); @@ -1725,7 +1704,7 @@ // Tests the shelf animates back to its original visible bounds when it is // dragged down but there are no visible windows. -TEST_P(ShelfLayoutManagerTest, +TEST_F(ShelfLayoutManagerTest, ShelfAnimatesWhenGestureCompleteNoVisibleWindow) { Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); @@ -1756,7 +1735,7 @@ // Tests that the shelf animates to the visible bounds after a swipe up on // the auto hidden shelf. -TEST_P(ShelfLayoutManagerTest, ShelfAnimatesToVisibleWhenGestureInComplete) { +TEST_F(ShelfLayoutManagerTest, ShelfAnimatesToVisibleWhenGestureInComplete) { Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); @@ -1793,7 +1772,7 @@ // Tests that the shelf animates to the auto hidden bounds after a swipe down // on the visible shelf. -TEST_P(ShelfLayoutManagerTest, ShelfAnimatesToHiddenWhenGestureOutComplete) { +TEST_F(ShelfLayoutManagerTest, ShelfAnimatesToHiddenWhenGestureOutComplete) { Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); @@ -1833,7 +1812,7 @@ } } -TEST_P(ShelfLayoutManagerTest, AutohideShelfForAutohideWhenActiveWindow) { +TEST_F(ShelfLayoutManagerTest, AutohideShelfForAutohideWhenActiveWindow) { Shelf* shelf = GetPrimaryShelf(); views::Widget* widget_one = CreateTestWidget(); @@ -1886,7 +1865,7 @@ EXPECT_FALSE(GetNonLockScreenContainersContainerLayer()->GetMasksToBounds()); } -TEST_P(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { +TEST_F(ShelfLayoutManagerTest, ShelfFlickerOnTrayActivation) { Shelf* shelf = GetPrimaryShelf(); // Create a visible window so auto-hide behavior is enforced. @@ -1905,7 +1884,7 @@ EXPECT_TRUE(GetPrimaryUnifiedSystemTray()->IsBubbleShown()); } -TEST_P(ShelfLayoutManagerTest, WorkAreaChangeWorkspace) { +TEST_F(ShelfLayoutManagerTest, WorkAreaChangeWorkspace) { // Make sure the shelf is always visible. Shelf* shelf = GetPrimaryShelf(); ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); @@ -1945,7 +1924,7 @@ widget_one->GetNativeWindow()->bounds().size().GetArea()); } -TEST_P(ShelfLayoutManagerTest, BackgroundTypeWhenLockingScreen) { +TEST_F(ShelfLayoutManagerTest, BackgroundTypeWhenLockingScreen) { // Creates a maximized window to have a background type other than default. std::unique_ptr<aura::Window> window(CreateTestWindow()); window->Show(); @@ -1961,7 +1940,7 @@ GetShelfWidget()->GetBackgroundType()); } -TEST_P(ShelfLayoutManagerTest, WorkspaceMask) { +TEST_F(ShelfLayoutManagerTest, WorkspaceMask) { std::unique_ptr<aura::Window> w1(CreateTestWindow()); w1->Show(); EXPECT_EQ(WorkspaceWindowState::kDefault, GetWorkspaceWindowState()); @@ -1994,7 +1973,7 @@ EXPECT_TRUE(GetNonLockScreenContainersContainerLayer()->GetMasksToBounds()); } -TEST_P(ShelfLayoutManagerTest, ShelfBackgroundColor) { +TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColor) { EXPECT_EQ(ShelfBackgroundType::kDefaultBg, GetShelfWidget()->GetBackgroundType()); @@ -2045,7 +2024,7 @@ // Tests that the shelf background gets updated when the AppList stays open // during the tablet mode transition with a visible window. -TEST_P(ShelfLayoutManagerTest, TabletModeTransitionWithAppListVisible) { +TEST_F(ShelfLayoutManagerTest, TabletModeTransitionWithAppListVisible) { // Home Launcher requires an internal display. display::test::DisplayManagerTestApi(Shell::Get()->display_manager()) .SetFirstDisplayAsInternalDisplay(); @@ -2072,7 +2051,7 @@ // Verify that the auto-hide shelf has default background by default and still // has the default background when a window is maximized in clamshell mode. -TEST_P(ShelfLayoutManagerTest, ShelfBackgroundColorAutoHide) { +TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColorAutoHide) { EXPECT_EQ(ShelfBackgroundType::kDefaultBg, GetShelfWidget()->GetBackgroundType()); @@ -2090,7 +2069,7 @@ // Verify that the shelf has a maximized background when a window is in the // fullscreen state. -TEST_P(ShelfLayoutManagerTest, ShelfBackgroundColorFullscreen) { +TEST_F(ShelfLayoutManagerTest, ShelfBackgroundColorFullscreen) { EXPECT_EQ(ShelfBackgroundType::kDefaultBg, GetShelfWidget()->GetBackgroundType()); @@ -2106,7 +2085,7 @@ } // Verify the hit bounds of the status area extend to the edge of the shelf. -TEST_P(ShelfLayoutManagerTest, StatusAreaHitBoxCoversEdge) { +TEST_F(ShelfLayoutManagerTest, StatusAreaHitBoxCoversEdge) { StatusAreaWidget* status_area_widget = GetShelfWidget()->status_area_widget(); ui::test::EventGenerator* generator = GetEventGenerator(); display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay(); @@ -2143,7 +2122,7 @@ // Tests that when the auto-hide behaviour is changed during an animation the // target bounds are updated to reflect the new state. -TEST_P(ShelfLayoutManagerTest, +TEST_F(ShelfLayoutManagerTest, ShelfAutoHideToggleDuringAnimationUpdatesBounds) { aura::Window* status_window = GetShelfWidget()->status_area_widget()->GetNativeView(); @@ -2162,7 +2141,7 @@ // Tests that during shutdown, that window activation changes are properly // handled, and do not crash (crbug.com/458768) -TEST_P(ShelfLayoutManagerTest, ShutdownHandlesWindowActivation) { +TEST_F(ShelfLayoutManagerTest, ShutdownHandlesWindowActivation) { GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); aura::Window* window1 = CreateTestWindowInShellWithId(0); @@ -2182,7 +2161,7 @@ delete window1; } -TEST_P(ShelfLayoutManagerTest, ShelfLayoutInUnifiedDesktop) { +TEST_F(ShelfLayoutManagerTest, ShelfLayoutInUnifiedDesktop) { Shell::Get()->display_manager()->SetUnifiedDesktopEnabled(true); UpdateDisplay("500x400, 500x400"); @@ -2195,7 +2174,7 @@ } // Tests that tapping the home button is successful on the autohidden shelf. -TEST_P(ShelfLayoutManagerTest, PressHomeButtonOnAutoHideShelf) { +TEST_F(ShelfLayoutManagerTest, PressHomeButtonOnAutoHideShelf) { // Enable accessibility feature that forces home button to be shown even with // kHideShelfControlsInTabletMode enabled. Shell::Get() @@ -2243,7 +2222,7 @@ // Tests that the auto-hide shelf has expected behavior when pressing the // AppList button while the shelf is being dragged by gesture (see // https://crbug.com/953877). -TEST_P(ShelfLayoutManagerTest, PressHomeBtnWhenAutoHideShelfBeingDragged) { +TEST_F(ShelfLayoutManagerTest, PressHomeBtnWhenAutoHideShelfBeingDragged) { // Create a widget to hide the shelf in auto-hide mode. CreateTestWidget(); GetPrimaryShelf()->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); @@ -2310,7 +2289,7 @@ // Tests that the shelf has expected bounds when dragging the shelf by gesture // and pressing the AppList button by mouse during drag (see // https://crbug.com/968768). -TEST_P(ShelfLayoutManagerTest, MousePressAppListBtnWhenShelfBeingDragged) { +TEST_F(ShelfLayoutManagerTest, MousePressAppListBtnWhenShelfBeingDragged) { // Drag the shelf upward. Notice that in order to drag shelf instead of // AppList from shelf, we need to drag the shelf downward a little bit then // upward. Because the bug is related with RootView, the event should be sent @@ -2354,7 +2333,7 @@ } // Tests that tap outside of the AUTO_HIDE_SHOWN shelf should hide it. -TEST_P(ShelfLayoutManagerTest, TapOutsideOfAutoHideShownShelf) { +TEST_F(ShelfLayoutManagerTest, TapOutsideOfAutoHideShownShelf) { views::Widget* widget = CreateTestWidget(); Shelf* shelf = GetPrimaryShelf(); ui::test::EventGenerator* generator = GetEventGenerator(); @@ -2401,7 +2380,7 @@ // Tests that swiping up on the AUTO_HIDE_HIDDEN shelf, with various speeds, // offsets, and angles, always shows the shelf. -TEST_P(ShelfLayoutManagerTest, SwipeUpAutoHideHiddenShelf) { +TEST_F(ShelfLayoutManagerTest, SwipeUpAutoHideHiddenShelf) { ui::test::EventGenerator* generator = GetEventGenerator(); Shelf* shelf = GetPrimaryShelf(); @@ -2445,7 +2424,7 @@ } // Tests the auto-hide shelf status when moving the mouse in and out. -TEST_P(ShelfLayoutManagerTest, AutoHideShelfOnMouseMove) { +TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnMouseMove) { // Create one window, or the shelf won't auto-hide. CreateTestWidget(); Shelf* shelf = GetPrimaryShelf(); @@ -2491,7 +2470,7 @@ // Verifies that after showing the system tray by shortcut, the shelf item still // responds to the gesture event. (see https://crbug.com/921182) -TEST_P(ShelfLayoutManagerTest, ShelfItemRespondToGestureEvent) { +TEST_F(ShelfLayoutManagerTest, ShelfItemRespondToGestureEvent) { // Prepare for the auto-hide shelf test. views::Widget* widget = CreateTestWidget(); widget->Maximize(); @@ -2529,7 +2508,7 @@ } // Tests the auto-hide shelf status with mouse events. -TEST_P(ShelfLayoutManagerTest, AutoHideShelfOnMouseEvents) { +TEST_F(ShelfLayoutManagerTest, AutoHideShelfOnMouseEvents) { views::Widget* widget = CreateTestWidget(); widget->Maximize(); Shelf* shelf = GetPrimaryShelf(); @@ -2579,7 +2558,7 @@ } // Tests that tap shelf item in auto-hide shelf should do nothing. -TEST_P(ShelfLayoutManagerTest, TapShelfItemInAutoHideShelf) { +TEST_F(ShelfLayoutManagerTest, TapShelfItemInAutoHideShelf) { Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); @@ -2606,7 +2585,7 @@ } // Tests the a11y feedback for entering/exiting fullscreen workspace state. -TEST_P(ShelfLayoutManagerTest, A11yAlertOnWorkspaceState) { +TEST_F(ShelfLayoutManagerTest, A11yAlertOnWorkspaceState) { TestAccessibilityControllerClient client; std::unique_ptr<aura::Window> window1( AshTestBase::CreateToplevelTestWindow()); @@ -2651,7 +2630,7 @@ } // Verifies the auto-hide shelf is shown if there is only a single PIP window. -TEST_P(ShelfLayoutManagerTest, AutoHideShelfShownForSinglePipWindow) { +TEST_F(ShelfLayoutManagerTest, AutoHideShelfShownForSinglePipWindow) { Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); EXPECT_EQ(SHELF_AUTO_HIDE, shelf->GetVisibilityState()); @@ -2674,7 +2653,7 @@ } // Verifies that shelf components are placed properly in right-to-left UI. -TEST_P(ShelfLayoutManagerTest, RtlPlacement) { +TEST_F(ShelfLayoutManagerTest, RtlPlacement) { // Helper function to check that the given widget is placed symmetrically // between LTR and RTL. auto check_mirrored_placement = [](views::Widget* widget) { @@ -2706,46 +2685,6 @@ base::i18n::SetICUDefaultLocale(locale); } -// Tests that after dragging window from top of the home screen down, and back -// up again, home screen is visible. -TEST_P(ShelfLayoutManagerTest, HomeToInAppAndBackHomeDrag) { - TabletModeControllerTestApi().EnterTabletMode(); - - // Create a test window, and press home button to go home. - std::unique_ptr<aura::Window> window = - AshTestBase::CreateTestWindow(gfx::Rect(0, 0, 400, 400)); - wm::ActivateWindow(window.get()); - - PressHomeButton(); - - GetAppListTestHelper()->CheckVisibility(true); - - if (!chromeos::switches::ShouldShowShelfHotseat()) { - // Start downward drag from the top of the display. - ui::test::EventGenerator* generator = GetEventGenerator(); - const gfx::Rect display_bounds = - display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); - generator->MoveTouch(display_bounds.top_center()); - generator->PressTouch(); - - // Move touch to the display center - verify that the active window was - // transformed. - EXPECT_TRUE(window->layer()->transform().IsIdentity()); - generator->MoveTouchBy(0, 50); - EXPECT_TRUE(window->IsVisible()); - EXPECT_FALSE(window->layer()->transform().IsIdentity()); - - // Move touch back to the top of display, and release touch. - generator->MoveTouch(display_bounds.top_center()); - generator->ReleaseTouch(); - - // Verify that home screen is shown. - GetAppListTestHelper()->CheckVisibility(true); - EXPECT_FALSE(window->IsVisible()); - EXPECT_TRUE(window->layer()->transform().IsIdentity()); - } -} - class ShelfLayoutManagerWindowDraggingTest : public ShelfLayoutManagerTestBase { public: ShelfLayoutManagerWindowDraggingTest() = default; @@ -2753,8 +2692,6 @@ // ShelfLayoutManagerTestBase: void SetUp() override { - scoped_feature_list_.InitWithFeatures({chromeos::features::kShelfHotseat}, - {}); ShelfLayoutManagerTestBase::SetUp(); TabletModeControllerTestApi().EnterTabletMode(); @@ -2764,9 +2701,6 @@ bool IsWindowDragInProgress() { return GetShelfLayoutManager()->IsWindowDragInProgress(); } - - private: - base::test::ScopedFeatureList scoped_feature_list_; }; // Test that when swiping up on the shelf, we may or may not drag up the MRU @@ -2807,7 +2741,7 @@ // Starts the drag from the center of the shelf's bottom. const gfx::Rect widget_bounds = test_case.widget->GetWindowBoundsInScreen(); // NOTE: Navigation widget might have zero size (depending on whether - // home and back buttons are shown) - use the sheld widget bottom value to + // home and back buttons are shown) - use the shelf widget bottom value to // ensure the drag starts from the bottom of the shelf. gfx::Point start(widget_bounds.CenterPoint().x(), shelf_widget_bottom); StartScroll(start); @@ -3618,7 +3552,7 @@ // Make sure we don't update the work area during overview animation // (crbug.com/947343). -TEST_P(ShelfLayoutManagerTest, NoShelfUpdateDuringOverviewAnimation) { +TEST_F(ShelfLayoutManagerTest, NoShelfUpdateDuringOverviewAnimation) { // Finish lid detection task. base::RunLoop().RunUntilIdle(); TabletModeControllerTestApi().EnterTabletMode(); @@ -3645,7 +3579,7 @@ } // Tests that shelf bounds are updated properly after overview animation. -TEST_P(ShelfLayoutManagerTest, ShelfBoundsUpdateAfterOverviewAnimation) { +TEST_F(ShelfLayoutManagerTest, ShelfBoundsUpdateAfterOverviewAnimation) { // Run overview animations. ui::ScopedAnimationDurationScaleMode regular_animations( ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); @@ -3891,7 +3825,7 @@ // Tests that the mousewheel scroll and the two finger gesture when the mouse is // over the shelf shows the app list in peeking state. -TEST_P(ShelfLayoutManagerTest, ScrollUpFromShelfToShowPeekingAppList) { +TEST_F(ShelfLayoutManagerTest, ScrollUpFromShelfToShowPeekingAppList) { const struct { views::View* view; bool with_mousewheel_scroll; @@ -3961,7 +3895,7 @@ // Tests that the shelf background is opaque in both screens after app list is // dismissed in a secondary display. (See https://crbug.com/1060686) -TEST_P(ShelfLayoutManagerTest, ShelfBackgroundOpaqueAfetrAppListUpdate) { +TEST_F(ShelfLayoutManagerTest, ShelfBackgroundOpaqueAfetrAppListUpdate) { UpdateDisplay("800x600,800x600"); AppListControllerImpl* app_list_controller = Shell::Get()->app_list_controller(); @@ -3998,7 +3932,7 @@ DimShelfLayoutManagerTestBase() = default; bool AutoDimEventHandlerInitialized() { - return GetPrimaryShelf()->auto_dim_event_handler_ ? true : false; + return GetPrimaryShelf()->auto_dim_event_handler_.get(); } bool ShelfDimmed() { return GetShelfLayoutManager()->dimmed_for_inactivity_; } @@ -4007,7 +3941,10 @@ void ResetDimShelf() { GetPrimaryShelf()->UndimShelf(); } - bool HasDimShelfTimer() { return GetPrimaryShelf()->HasDimShelfTimer(); } + bool HasDimShelfTimer() { + return AutoDimEventHandlerInitialized() && + GetPrimaryShelf()->HasDimShelfTimer(); + } float GetWidgetOpacity(views::Widget* widget) { return widget->GetNativeView()->layer()->opacity(); @@ -4128,62 +4065,24 @@ : kExpectedDefaultShelfOpacity); } -// Paramaterized tests for shelf dimming with and without hotseat enabled. -class HotseatDimShelfLayoutManagerTest - : public DimShelfLayoutManagerTestBase, - public testing::WithParamInterface<bool> { - public: - HotseatDimShelfLayoutManagerTest() = default; - - // testing::Test: - void SetUp() override { - if (GetParam()) { - scoped_feature_list_.InitAndEnableFeature( - chromeos::features::kShelfHotseat); - } else { - scoped_feature_list_.InitAndDisableFeature( - chromeos::features::kShelfHotseat); - } - - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableDimShelf); - DimShelfLayoutManagerTestBase::SetUp(); - } - - private: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -// Used to test shelf dimming in conjunction with hotseat. -INSTANTIATE_TEST_SUITE_P(All, - HotseatDimShelfLayoutManagerTest, - testing::Bool()); - // Tests that navigation and status area widgets are dimmed. Verifies the shelf // view is not dimmed when the hotseat is in the kExtended state. Verifies that // the shelf background/hotseat widget are not dimmed. -TEST_P(HotseatDimShelfLayoutManagerTest, InAppShelfDimAlpha) { - ASSERT_TRUE(AutoDimEventHandlerInitialized()); +TEST_P(DimShelfLayoutManagerTest, InAppShelfDimAlpha) { + const bool dim_shelf_enabled = GetParam(); + ASSERT_EQ(dim_shelf_enabled, AutoDimEventHandlerInitialized()); + TabletModeControllerTestApi().EnterTabletMode(); views::Widget* widget = CreateTestWidget(); widget->Maximize(); ASSERT_FALSE(ShelfDimmed()); - const bool shelf_hotseat_enabled = GetParam(); - EXPECT_EQ(shelf_hotseat_enabled, - chromeos::switches::ShouldShowShelfHotseat()); + EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state()); + SwipeUpOnShelf(); + EXPECT_EQ(HotseatState::kExtended, GetShelfLayoutManager()->hotseat_state()); - if (shelf_hotseat_enabled) { - EXPECT_EQ(HotseatState::kHidden, GetShelfLayoutManager()->hotseat_state()); - SwipeUpOnShelf(); - EXPECT_EQ(HotseatState::kExtended, - GetShelfLayoutManager()->hotseat_state()); - } else { - EXPECT_EQ(HotseatState::kShownClamshell, - GetShelfLayoutManager()->hotseat_state()); - } - - TriggerDimShelf(); + if (dim_shelf_enabled) + TriggerDimShelf(); EXPECT_EQ(GetWidgetOpacity(GetPrimaryShelf()->shelf_widget()), kExpectedDefaultShelfOpacity); @@ -4191,35 +4090,30 @@ kExpectedDefaultShelfOpacity); EXPECT_EQ( GetPrimaryShelf()->hotseat_widget()->GetShelfView()->layer()->opacity(), - shelf_hotseat_enabled ? kExpectedDefaultShelfOpacity - : kExpectedFloatingShelfDimOpacity); + kExpectedDefaultShelfOpacity); EXPECT_EQ(GetWidgetOpacity(GetPrimaryShelf()->navigation_widget()), - kExpectedFloatingShelfDimOpacity); + dim_shelf_enabled ? kExpectedFloatingShelfDimOpacity + : kExpectedDefaultShelfOpacity); EXPECT_EQ( GetWidgetOpacity(GetPrimaryShelf()->shelf_widget()->status_area_widget()), - kExpectedFloatingShelfDimOpacity); + dim_shelf_enabled ? kExpectedFloatingShelfDimOpacity + : kExpectedDefaultShelfOpacity); } // Tests that shelf view, navigation widget, and status area widget are // dimmed but the shelf background and hotseat are not. -TEST_P(HotseatDimShelfLayoutManagerTest, TabletModeHomeShelfDimAlpha) { - ASSERT_TRUE(AutoDimEventHandlerInitialized()); +TEST_P(DimShelfLayoutManagerTest, TabletModeHomeShelfDimAlpha) { + const bool dim_shelf_enabled = GetParam(); + ASSERT_EQ(dim_shelf_enabled, AutoDimEventHandlerInitialized()); + TabletModeControllerTestApi().EnterTabletMode(); EXPECT_FALSE(ShelfDimmed()); - const bool shelf_hotseat_enabled = GetParam(); - EXPECT_EQ(shelf_hotseat_enabled, - chromeos::switches::ShouldShowShelfHotseat()); + EXPECT_EQ(HotseatState::kShownHomeLauncher, + GetShelfLayoutManager()->hotseat_state()); - if (shelf_hotseat_enabled) { - EXPECT_EQ(HotseatState::kShownHomeLauncher, - GetShelfLayoutManager()->hotseat_state()); - } else { - EXPECT_EQ(HotseatState::kShownClamshell, - GetShelfLayoutManager()->hotseat_state()); - } - - TriggerDimShelf(); + if (dim_shelf_enabled) + TriggerDimShelf(); EXPECT_EQ(GetWidgetOpacity(GetPrimaryShelf()->shelf_widget()), kExpectedDefaultShelfOpacity); @@ -4227,17 +4121,21 @@ kExpectedDefaultShelfOpacity); EXPECT_EQ( GetPrimaryShelf()->hotseat_widget()->GetShelfView()->layer()->opacity(), - kExpectedFloatingShelfDimOpacity); + dim_shelf_enabled ? kExpectedFloatingShelfDimOpacity + : kExpectedDefaultShelfOpacity); EXPECT_EQ(GetWidgetOpacity(GetPrimaryShelf()->navigation_widget()), - kExpectedFloatingShelfDimOpacity); + dim_shelf_enabled ? kExpectedFloatingShelfDimOpacity + : kExpectedDefaultShelfOpacity); EXPECT_EQ( GetWidgetOpacity(GetPrimaryShelf()->shelf_widget()->status_area_widget()), - kExpectedFloatingShelfDimOpacity); + dim_shelf_enabled ? kExpectedFloatingShelfDimOpacity + : kExpectedDefaultShelfOpacity); } // Shelf dimming should not trigger when shelf is hidden in tablet mode. -TEST_P(HotseatDimShelfLayoutManagerTest, AutoHiddenShelfTabletModeDimAlpha) { - ASSERT_TRUE(AutoDimEventHandlerInitialized()); +TEST_P(DimShelfLayoutManagerTest, AutoHiddenShelfTabletModeDimAlpha) { + const bool dim_shelf_enabled = GetParam(); + ASSERT_EQ(dim_shelf_enabled, AutoDimEventHandlerInitialized()); TabletModeControllerTestApi().EnterTabletMode(); Shelf* shelf = GetPrimaryShelf(); @@ -4248,20 +4146,23 @@ // Shelf should not be dimmed when auto hidden. EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); - TriggerDimShelf(); + if (dim_shelf_enabled) + TriggerDimShelf(); EXPECT_FALSE(ShelfDimmed()); // Minimizing the widget should show the shelf. The shelf can now be dimmed. widget->Minimize(); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); EXPECT_FALSE(ShelfDimmed()); - TriggerDimShelf(); - EXPECT_TRUE(ShelfDimmed()); + if (dim_shelf_enabled) + TriggerDimShelf(); + EXPECT_EQ(dim_shelf_enabled, ShelfDimmed()); } // Shelf dimming should not trigger when shelf is hidden in clamshell mode. -TEST_P(HotseatDimShelfLayoutManagerTest, AutoHiddenShelfClamshellModeDimAlpha) { - ASSERT_TRUE(AutoDimEventHandlerInitialized()); +TEST_P(DimShelfLayoutManagerTest, AutoHiddenShelfClamshellModeDimAlpha) { + const bool dim_shelf_enabled = GetParam(); + ASSERT_EQ(dim_shelf_enabled, AutoDimEventHandlerInitialized()); Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); @@ -4272,31 +4173,35 @@ // Shelf should not be dimmed when auto hidden. The dim shelf timer should // persist after failing to dim the shelf. EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->GetAutoHideState()); - TriggerDimShelf(); + if (dim_shelf_enabled) + TriggerDimShelf(); EXPECT_FALSE(ShelfDimmed()); - EXPECT_TRUE(HasDimShelfTimer()); + EXPECT_EQ(dim_shelf_enabled, HasDimShelfTimer()); // Minimizing the widget should show the shelf. The shelf can now be dimmed // and the dim shelf timer should no longer be active. widget->Minimize(); EXPECT_EQ(SHELF_AUTO_HIDE_SHOWN, shelf->GetAutoHideState()); ASSERT_FALSE(ShelfDimmed()); - EXPECT_TRUE(HasDimShelfTimer()); - TriggerDimShelf(); - EXPECT_TRUE(ShelfDimmed()); + EXPECT_EQ(dim_shelf_enabled, HasDimShelfTimer()); + if (dim_shelf_enabled) + TriggerDimShelf(); + EXPECT_EQ(dim_shelf_enabled, ShelfDimmed()); EXPECT_FALSE(HasDimShelfTimer()); } // Shelf should be undimmed when transitioning into the visible state and create // a dim shelf timer. -TEST_P(HotseatDimShelfLayoutManagerTest, AutoHiddenShelfUndimOnShow) { - ASSERT_TRUE(AutoDimEventHandlerInitialized()); +TEST_P(DimShelfLayoutManagerTest, AutoHiddenShelfUndimOnShow) { + const bool dim_shelf_enabled = GetParam(); + ASSERT_EQ(dim_shelf_enabled, AutoDimEventHandlerInitialized()); Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); EXPECT_FALSE(ShelfDimmed()); - TriggerDimShelf(); - EXPECT_TRUE(ShelfDimmed()); + if (dim_shelf_enabled) + TriggerDimShelf(); + EXPECT_EQ(dim_shelf_enabled, ShelfDimmed()); views::Widget* widget = CreateTestWidget(); // Maximize and minimize the widget to cycle between shelf auto hidden states. @@ -4308,21 +4213,24 @@ // Hiding and showing the auto hidden shelf should set the shelf to the // undimmed state but also create a dim shelf timer. ASSERT_FALSE(ShelfDimmed()); - EXPECT_TRUE(HasDimShelfTimer()); - TriggerDimShelf(); - EXPECT_TRUE(ShelfDimmed()); + EXPECT_EQ(dim_shelf_enabled, HasDimShelfTimer()); + if (dim_shelf_enabled) + TriggerDimShelf(); + EXPECT_EQ(dim_shelf_enabled, ShelfDimmed()); EXPECT_FALSE(HasDimShelfTimer()); } // Shelf should be undimmed when auto hidden shelf is disabled. -TEST_P(HotseatDimShelfLayoutManagerTest, AutoHiddenShelfUndimOnDisable) { - ASSERT_TRUE(AutoDimEventHandlerInitialized()); +TEST_P(DimShelfLayoutManagerTest, AutoHiddenShelfUndimOnDisable) { + const bool dim_shelf_enabled = GetParam(); + ASSERT_EQ(dim_shelf_enabled, AutoDimEventHandlerInitialized()); Shelf* shelf = GetPrimaryShelf(); shelf->SetAutoHideBehavior(ShelfAutoHideBehavior::kAlways); EXPECT_FALSE(ShelfDimmed()); - TriggerDimShelf(); - EXPECT_TRUE(ShelfDimmed()); + if (dim_shelf_enabled) + TriggerDimShelf(); + EXPECT_EQ(dim_shelf_enabled, ShelfDimmed()); // Create and maximize a widget to cycle force auto hidden shelf. views::Widget* widget = CreateTestWidget();
diff --git a/ash/shelf/shelf_navigation_widget.cc b/ash/shelf/shelf_navigation_widget.cc index 882ac5c..6e7863e 100644 --- a/ash/shelf/shelf_navigation_widget.cc +++ b/ash/shelf/shelf_navigation_widget.cc
@@ -22,7 +22,6 @@ #include "base/bind.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_macros.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/base/l10n/l10n_util.h" #include "ui/compositor/animation_throughput_reporter.h" #include "ui/compositor/layer_animation_observer.h" @@ -82,20 +81,14 @@ if (!ShelfConfig::Get()->shelf_controls_shown()) return false; - return chromeos::switches::ShouldShowShelfHotseat() - ? Shell::Get()->IsInTabletMode() && ShelfConfig::Get()->is_in_app() - : Shell::Get()->IsInTabletMode(); + + return Shell::Get()->IsInTabletMode() && ShelfConfig::Get()->is_in_app(); } bool IsHomeButtonShown() { return ShelfConfig::Get()->shelf_controls_shown(); } -bool IsHotseatEnabled() { - return Shell::Get()->IsInTabletMode() && - chromeos::switches::ShouldShowShelfHotseat(); -} - // An implicit animation observer that hides a view once the view's opacity // animation finishes. // It deletes itself when the animation is done. @@ -337,8 +330,7 @@ return; } - if (chromeos::switches::ShouldShowShelfHotseat() && - Shell::Get()->IsInTabletMode() && ShelfConfig::Get()->is_in_app()) { + if (Shell::Get()->IsInTabletMode() && ShelfConfig::Get()->is_in_app()) { opaque_background_.SetVisible(false); return; } @@ -603,7 +595,7 @@ SetBounds(target_bounds_); } - if (update_bounds && IsHotseatEnabled()) + if (update_bounds && Shell::Get()->IsInTabletMode()) GetLayer()->SetClipRect(clip_rect_); views::View* const back_button = delegate_->back_button(); @@ -720,7 +712,7 @@ } gfx::Rect ShelfNavigationWidget::CalculateClipRect() const { - if (IsHotseatEnabled()) + if (Shell::Get()->IsInTabletMode()) return gfx::Rect(CalculateIdealSize(/*only_visible_area=*/true)); return gfx::Rect(target_bounds_.size()); @@ -732,7 +724,7 @@ return gfx::Size(); int control_button_number; - if (IsHotseatEnabled() && !only_visible_area) { + if (Shell::Get()->IsInTabletMode() && !only_visible_area) { // There are home button and back button. So the maximum is 2. control_button_number = 2; } else {
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index 32dec88..d63fc25c 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc
@@ -62,8 +62,6 @@ #include "base/test/scoped_feature_list.h" #include "base/test/scoped_mock_time_message_loop_task_runner.h" #include "base/time/time.h" -#include "chromeos/constants/chromeos_features.h" -#include "chromeos/constants/chromeos_switches.h" #include "components/prefs/pref_service.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -584,25 +582,6 @@ DISALLOW_COPY_AND_ASSIGN(ShelfViewTest); }; -// TODO(https://crbug.com/1009638): remove this class and all its descendants -// when scrollable shelf is launched. -class ShelfViewNotScrollableTest : public ShelfViewTest { - public: - ShelfViewNotScrollableTest() = default; - ~ShelfViewNotScrollableTest() override = default; - - void SetUp() override { - scoped_feature_list_.InitWithFeatures({}, - {chromeos::features::kShelfHotseat}); - ShelfViewTest::SetUp(); - } - - private: - base::test::ScopedFeatureList scoped_feature_list_; - - DISALLOW_COPY_AND_ASSIGN(ShelfViewNotScrollableTest); -}; - const char* ShelfViewTest::kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName = ShelfButtonPressedMetricTracker:: @@ -1119,31 +1098,6 @@ EXPECT_EQ(nullptr, tooltip_manager->GetCurrentAnchorView()); } -TEST_F(ShelfViewNotScrollableTest, ButtonTitlesTest) { - Shell::Get()->tablet_mode_controller()->SetEnabledForTest(true); - test_api_->RunMessageLoopUntilAnimationsDone(); - - EXPECT_EQ(base::UTF8ToUTF16("Launcher"), shelf_view_->shelf_widget() - ->navigation_widget() - ->GetHomeButton() - ->GetAccessibleName()); - EXPECT_EQ(l10n_util::GetStringUTF16(IDS_ASH_SHELF_BACK_BUTTON_TITLE), - shelf_view_->shelf_widget() - ->navigation_widget() - ->GetBackButton() - ->GetAccessibleName()); - - for (int i = 0; i < test_api_->GetButtonCount(); i++) { - ShelfAppButton* button = test_api_->GetButton(i); - if (button) { - EXPECT_EQ(shelf_view_->GetTitleForView(button), - button->GetAccessibleName()) - << "Each button's tooltip text should read the same as its " - << "accessible name"; - } - } -} - // Verify a fix for crash caused by a tooltip update for a deleted shelf // button, see crbug.com/288838. TEST_F(ShelfViewTest, RemovingItemClosesTooltip) { @@ -1230,32 +1184,7 @@ EXPECT_TRUE(home_button->IsShowingAppList()); } -class HotseatShelfViewTest : public ShelfViewTest, - public testing::WithParamInterface<bool> { - public: - HotseatShelfViewTest() = default; - ~HotseatShelfViewTest() override = default; - - // AshTestBase: - void SetUp() override { - if (GetParam()) { - feature_list_.InitAndEnableFeature(chromeos::features::kShelfHotseat); - } else { - feature_list_.InitAndDisableFeature(chromeos::features::kShelfHotseat); - } - ShelfViewTest::SetUp(); - } - - private: - base::test::ScopedFeatureList feature_list_; - DISALLOW_COPY_AND_ASSIGN(HotseatShelfViewTest); -}; - -// Tests with both hotseat enabled and disabled. -INSTANTIATE_TEST_SUITE_P(All, HotseatShelfViewTest, testing::Bool()); - -TEST_P(HotseatShelfViewTest, ShouldHideTooltipTest) { - +TEST_F(ShelfViewTest, ShouldHideTooltipTest) { ShelfID app_button_id = AddAppShortcut(); ShelfID platform_button_id = AddApp(); // TODO(manucornet): It should not be necessary to call this manually. The @@ -1355,7 +1284,7 @@ // Test that by moving the mouse cursor off the button onto the bubble it closes // the bubble. -TEST_P(HotseatShelfViewTest, ShouldHideTooltipWhenHoveringOnTooltip) { +TEST_F(ShelfViewTest, ShouldHideTooltipWhenHoveringOnTooltip) { ShelfTooltipManager* tooltip_manager = test_api_->tooltip_manager(); tooltip_manager->set_timer_delay_for_test(0); ui::test::EventGenerator* generator = GetEventGenerator(); @@ -2253,14 +2182,11 @@ // Test class that enables notification indicators. class NotificationIndicatorTest : public ShelfViewTest { public: - NotificationIndicatorTest() = default; - ~NotificationIndicatorTest() override = default; - - void SetUp() override { - scoped_feature_list_.InitWithFeatures({::features::kNotificationIndicator}, - {}); - ShelfViewTest::SetUp(); + NotificationIndicatorTest() { + scoped_feature_list_.InitAndEnableFeature( + ::features::kNotificationIndicator); } + ~NotificationIndicatorTest() override = default; private: base::test::ScopedFeatureList scoped_feature_list_; @@ -3029,9 +2955,7 @@ public: ShelfViewFocusWithNoShelfNavigationTest() { scoped_feature_list_.InitWithFeatures( - {chromeos::features::kShelfHotseat, - features::kHideShelfControlsInTabletMode}, - {}); + {features::kHideShelfControlsInTabletMode}, {}); } ~ShelfViewFocusWithNoShelfNavigationTest() override = default;
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index 301beaf..a187aa3 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc
@@ -37,7 +37,6 @@ #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/work_area_insets.h" #include "base/command_line.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_owner.h" #include "ui/compositor/scoped_layer_animation_settings.h" @@ -76,11 +75,6 @@ &dummy_focus_traversable, &dummy_focus_traversable_view); } -bool IsHotseatEnabled() { - return Shell::Get()->IsInTabletMode() && - chromeos::switches::ShouldShowShelfHotseat(); -} - // Sets the shelf opacity to 0 when the shelf is done hiding to avoid getting // rid of blur. class HideAnimationObserver : public ui::ImplicitAnimationObserver { @@ -318,8 +312,7 @@ const bool tablet_mode = Shell::Get()->IsInTabletMode(); const bool in_app = ShelfConfig::Get()->is_in_app(); - bool show_opaque_background = - !tablet_mode || in_app || !chromeos::switches::ShouldShowShelfHotseat(); + bool show_opaque_background = !tablet_mode || in_app; if (show_opaque_background != opaque_background()->visible()) opaque_background()->SetVisible(show_opaque_background); @@ -344,7 +337,7 @@ // or whenever we are "in app". if (background_type == ShelfBackgroundType::kMaximized || background_type == ShelfBackgroundType::kInApp || - (tablet_mode && in_app && chromeos::switches::ShouldShowShelfHotseat())) { + (tablet_mode && in_app)) { opaque_background()->SetRoundedCornerRadius({0, 0, 0, 0}); } else { opaque_background()->SetRoundedCornerRadius({ @@ -369,7 +362,6 @@ } if (!Shell::Get()->IsInTabletMode() || !ShelfConfig::Get()->is_in_app() || - !chromeos::switches::ShouldShowShelfHotseat() || hide_background_for_transitions_) { drag_handle_->SetVisible(false); return; @@ -702,20 +694,9 @@ if (id.IsNull()) return gfx::Rect(); - if (chromeos::switches::ShouldShowShelfHotseat()) { - return hotseat_widget() - ->scrollable_shelf_view() - ->GetTargetScreenBoundsOfItemIcon(id); - } - - gfx::Rect bounds( - hotseat_widget()->GetShelfView()->GetIdealBoundsOfItemIcon(id)); - gfx::Point screen_origin; - views::View::ConvertPointToScreen(hotseat_widget()->GetShelfView(), - &screen_origin); - return gfx::Rect(screen_origin.x() + bounds.x(), - screen_origin.y() + bounds.y(), bounds.width(), - bounds.height()); + return hotseat_widget() + ->scrollable_shelf_view() + ->GetTargetScreenBoundsOfItemIcon(id); } gfx::Rect ShelfWidget::GetVisibleShelfBounds() const { @@ -871,7 +852,7 @@ void ShelfWidget::UpdateTargetBoundsForGesture(int shelf_position) { if (shelf_->IsHorizontalAlignment()) { - if (!IsHotseatEnabled()) + if (!Shell::Get()->IsInTabletMode()) target_bounds_.set_y(shelf_position); } else { target_bounds_.set_x(shelf_position);
diff --git a/ash/shortcut_viewer/strings/shortcut_viewer_strings_iw.xtb b/ash/shortcut_viewer/strings/shortcut_viewer_strings_iw.xtb index 5b07e7d..fbc4b15 100644 --- a/ash/shortcut_viewer/strings/shortcut_viewer_strings_iw.xtb +++ b/ash/shortcut_viewer/strings/shortcut_viewer_strings_iw.xtb
@@ -186,6 +186,7 @@ <translation id="8234414138295101081">סיבוב המסך ב-90 מעלות</translation> <translation id="8241665785394195545">סוגר ימני</translation> <translation id="8264941229485248811">הצגה או הסתרה של בודק 'כלים למפתחים'</translation> +<translation id="8322502972606429618">הצגת הדברים האחרונים שהועתקו ללוח העריכה</translation> <translation id="836869401750819675">פתיחת הדף 'הורדות'</translation> <translation id="8388247778047144397">גרירת הקישור לאזור ריק בשורת הכרטיסיות</translation> <translation id="8389638407792712197">פתיחת חלון חדש</translation>
diff --git a/ash/shortcut_viewer/strings/shortcut_viewer_strings_tr.xtb b/ash/shortcut_viewer/strings/shortcut_viewer_strings_tr.xtb index f519ff94..e4d9896 100644 --- a/ash/shortcut_viewer/strings/shortcut_viewer_strings_tr.xtb +++ b/ash/shortcut_viewer/strings/shortcut_viewer_strings_tr.xtb
@@ -186,6 +186,7 @@ <translation id="8234414138295101081">Ekranı 90 derece döndürür</translation> <translation id="8241665785394195545">sağ parantez</translation> <translation id="8264941229485248811">Geliştirici Araçları denetleyicisini gösterir veya gizler</translation> +<translation id="8322502972606429618">Panoya kopyalanan son birkaç şeyi gösterir</translation> <translation id="836869401750819675">İndirilenler sayfasını açar</translation> <translation id="8388247778047144397">Bağlantıyı sekme şeridindeki boş bir alana sürükleyin</translation> <translation id="8389638407792712197">Yeni pencere açar</translation>
diff --git a/ash/strings/ash_strings_en-GB.xtb b/ash/strings/ash_strings_en-GB.xtb index 0f77252..71f7f87 100644 --- a/ash/strings/ash_strings_en-GB.xtb +++ b/ash/strings/ash_strings_en-GB.xtb
@@ -58,6 +58,7 @@ <translation id="1455242230282523554">Show language settings</translation> <translation id="1460620680449458626">Volume is muted.</translation> <translation id="1467432559032391204">Left</translation> +<translation id="1475439723810528286">Tap anywhere to capture full screen</translation> <translation id="1479909375538722835">Floating accessibility menu</translation> <translation id="1484102317210609525"><ph name="DEVICE_NAME" /> (HDMI/DP)</translation> <translation id="1503394326855300303">This owner account has to be the first signed-in account in a multiple sign-in session.</translation> @@ -121,6 +122,7 @@ <translation id="209965399369889474">Not connected to network</translation> <translation id="2126242104232412123">New desk</translation> <translation id="2127372758936585790">Low-power charger</translation> +<translation id="2132302418721800944">Record full screen</translation> <translation id="2135456203358955318">Docked magnifier</translation> <translation id="2144487987174258011">Restart to update Adobe Flash Player</translation> <translation id="2180011262286780504">The ability to screen capture has been disabled by your administrator.</translation> @@ -192,6 +194,7 @@ <translation id="2872961005593481000">Shut down</translation> <translation id="2878884018241093801">No recent items</translation> <translation id="2903844815300039659">Connected to <ph name="NAME" />, <ph name="STRENGTH" /></translation> +<translation id="2914580577416829331">Screen captures</translation> <translation id="2942350706960889382">Docked Magnifier</translation> <translation id="2942516765047364088">Shelf position</translation> <translation id="2946119680249604491">Add connection</translation> @@ -367,6 +370,7 @@ <translation id="4513946894732546136">Feedback</translation> <translation id="4527045527269911712">Bluetooth device "<ph name="DEVICE_NAME" />" would like permission to pair.</translation> <translation id="453661520163887813"><ph name="TIME" /> until full</translation> +<translation id="4538824937723742295">Take full-screen screenshot</translation> <translation id="4544483149666270818">Select a window to record</translation> <translation id="4560576029703263363">On</translation> <translation id="4561267230861221837">3G</translation> @@ -422,12 +426,14 @@ <translation id="4969092041573468113"><ph name="HOURS" />h <ph name="MINUTES" />m <ph name="SECONDS" />s</translation> <translation id="4975771730019223894">App badging</translation> <translation id="5030687792513154421">Time is up</translation> +<translation id="5033299697334913360">Click anywhere to capture full screen</translation> <translation id="5035236842988137213"><ph name="DEVICE_NAME" /> connected to a new phone</translation> <translation id="5035389544768382859">Confirm display configuration</translation> <translation id="5083553833479578423">Unlock more Assistant features.</translation> <translation id="5136175204352732067">Different keyboard connected</translation> <translation id="5168181903108465623">Cast devices available</translation> <translation id="5170568018924773124">Show in folder</translation> +<translation id="5176318573511391780">Record partial screen</translation> <translation id="5207949376430453814">Highlight text caret</translation> <translation id="5208059991603368177">On</translation> <translation id="5222676887888702881">Sign out</translation> @@ -488,6 +494,7 @@ <translation id="5837036133683224804">Stop <ph name="ROUTE_TITLE" /> on <ph name="RECEIVER_NAME" /></translation> <translation id="5860033963881614850">Off</translation> <translation id="5876666360658629066">Enter parental code</translation> +<translation id="5881540930187678962">Set up Phone Hub later</translation> <translation id="5895138241574237353">Restart</translation> <translation id="589817443623831496">Point scanning</translation> <translation id="5901316534475909376">Shift+Esc</translation> @@ -542,6 +549,7 @@ <translation id="6424520630891723617"><ph name="SECURITY_STATUS" />, signal strength <ph name="SIGNAL_STRENGTH" /></translation> <translation id="642644398083277086">Clear all notifications</translation> <translation id="643147933154517414">All finished</translation> +<translation id="6431865393913628856">Screen record</translation> <translation id="6445835306623867477"><ph name="ROUTE_TITLE" /> on <ph name="RECEIVER_NAME" /></translation> <translation id="6452181791372256707">Reject</translation> <translation id="6453179446719226835">Language has been changed</translation> @@ -627,6 +635,7 @@ <translation id="7346909386216857016">OK, got it</translation> <translation id="7348093485538360975">On-Screen Keyboard</translation> <translation id="735745346212279324">VPN disconnected</translation> +<translation id="7371404428569700291">Record window</translation> <translation id="7377169924702866686">Caps Lock is on.</translation> <translation id="7378203170292176219">Drag to select an area to record</translation> <translation id="7378594059915113390">Media controls</translation> @@ -815,6 +824,7 @@ <translation id="9084606467167974638">Toggle menu position</translation> <translation id="9089416786594320554">Input methods</translation> <translation id="9091626656156419976">Removed display <ph name="DISPLAY_NAME" /></translation> +<translation id="9092749890156285613">Recent screen captures and downloads</translation> <translation id="9151726767154816831">Restart and powerwash to update</translation> <translation id="9166331175924255663">Toggle Nearby Share high visibility.</translation> <translation id="9168436347345867845">Do it later</translation>
diff --git a/ash/strings/ash_strings_fil.xtb b/ash/strings/ash_strings_fil.xtb index 48a9337c..b0f1d0a 100644 --- a/ash/strings/ash_strings_fil.xtb +++ b/ash/strings/ash_strings_fil.xtb
@@ -58,6 +58,7 @@ <translation id="1455242230282523554">Ipakita ang mga setting ng wika</translation> <translation id="1460620680449458626">Naka-mute ang volume.</translation> <translation id="1467432559032391204">Kaliwa</translation> +<translation id="1475439723810528286">Mag-tap kahit saan para i-capture ang full screen</translation> <translation id="1479909375538722835">Nakalutang na menu ng accessibility</translation> <translation id="1484102317210609525"><ph name="DEVICE_NAME" /> (HDMI/DP)</translation> <translation id="1503394326855300303">Ang account ng may-ari na ito ay dapat ang unang naka-sign in na account sa isang session ng multiple na pag-sign in.</translation> @@ -121,6 +122,7 @@ <translation id="209965399369889474">Hindi nakakonekta sa network</translation> <translation id="2126242104232412123">Bagong desk</translation> <translation id="2127372758936585790">Low-power charger</translation> +<translation id="2132302418721800944">I-record ang full screen</translation> <translation id="2135456203358955318">Naka-dock na magnifier</translation> <translation id="2144487987174258011">I-restart upang i-update ang Adobe Flash Player</translation> <translation id="2180011262286780504">Na-disable ng iyong administrator ang kakayahang mag-screen capture.</translation> @@ -192,6 +194,7 @@ <translation id="2872961005593481000">Shut down</translation> <translation id="2878884018241093801">Walang kamakailang item</translation> <translation id="2903844815300039659">Nakakonekta sa <ph name="NAME" />, <ph name="STRENGTH" /></translation> +<translation id="2914580577416829331">Mga pag-capture ng screen</translation> <translation id="2942350706960889382">Naka-dock na Magnifier</translation> <translation id="2942516765047364088">Posisyon ng shelf</translation> <translation id="2946119680249604491">Magdagdag ng koneksyon</translation> @@ -367,6 +370,7 @@ <translation id="4513946894732546136">Feedback</translation> <translation id="4527045527269911712">Gusto ng bluetooth device na "<ph name="DEVICE_NAME" />" na magpares.</translation> <translation id="453661520163887813"><ph name="TIME" /> na lang bago mapuno</translation> +<translation id="4538824937723742295">Kumuha ng screenshot ng full screen</translation> <translation id="4544483149666270818">Pumili ng window na ire-record</translation> <translation id="4560576029703263363">Naka-on</translation> <translation id="4561267230861221837">3G</translation> @@ -422,12 +426,14 @@ <translation id="4969092041573468113"><ph name="HOURS" />h <ph name="MINUTES" />m <ph name="SECONDS" />s</translation> <translation id="4975771730019223894">Pag-badge ng app</translation> <translation id="5030687792513154421">Tapos na ang oras</translation> +<translation id="5033299697334913360">Mag-click kahit saan para i-capture ang full screen</translation> <translation id="5035236842988137213">Kumonekta ang <ph name="DEVICE_NAME" /> sa isang bagong telepono</translation> <translation id="5035389544768382859">Kumpirmahin ang Configuration ng Display</translation> <translation id="5083553833479578423">Mag-unlock ng higit pang feature ng Assistant.</translation> <translation id="5136175204352732067">Ibang keyboard ang nakakonekta</translation> <translation id="5168181903108465623">I-cast ang mga available na device</translation> <translation id="5170568018924773124">Ipinakita sa folder</translation> +<translation id="5176318573511391780">I-record ang hindi buong screen</translation> <translation id="5207949376430453814">I-highlight ang text caret</translation> <translation id="5208059991603368177">Naka-on</translation> <translation id="5222676887888702881">Mag-sign out</translation> @@ -488,6 +494,7 @@ <translation id="5837036133683224804">Ihinto ang <ph name="ROUTE_TITLE" /> sa <ph name="RECEIVER_NAME" /></translation> <translation id="5860033963881614850">Naka-off</translation> <translation id="5876666360658629066">Ilagay ang code ng magulang</translation> +<translation id="5881540930187678962">I-set up ang Phone Hub sa ibang pagkakataon</translation> <translation id="5895138241574237353">I-restart</translation> <translation id="589817443623831496">Pag-point scan</translation> <translation id="5901316534475909376">Shift+Esc</translation> @@ -542,6 +549,7 @@ <translation id="6424520630891723617"><ph name="SECURITY_STATUS" />, Lakas ng Signal <ph name="SIGNAL_STRENGTH" /></translation> <translation id="642644398083277086">I-clear ang lahat ng notification</translation> <translation id="643147933154517414">Tapos na ang lahat</translation> +<translation id="6431865393913628856">Pag-record ng screen</translation> <translation id="6445835306623867477"><ph name="ROUTE_TITLE" /> sa <ph name="RECEIVER_NAME" /></translation> <translation id="6452181791372256707">Tanggihan</translation> <translation id="6453179446719226835">Napalitan na ang wika</translation> @@ -627,6 +635,7 @@ <translation id="7346909386216857016">Ok, nakuha ko</translation> <translation id="7348093485538360975">Nasa screen na keyboard</translation> <translation id="735745346212279324">Nakadiskonekta ang VPN</translation> +<translation id="7371404428569700291">I-record ang window</translation> <translation id="7377169924702866686">Naka-on ang Caps Lock.</translation> <translation id="7378203170292176219">Mag-drag para pumili ng bahaging ire-record</translation> <translation id="7378594059915113390">Mga Kontrol ng Media</translation> @@ -815,6 +824,7 @@ <translation id="9084606467167974638">I-toggle ang posisyon ng menu</translation> <translation id="9089416786594320554">Mga input method</translation> <translation id="9091626656156419976">Naalis ang display na <ph name="DISPLAY_NAME" /></translation> +<translation id="9092749890156285613">Mga kamakailang pag-capture ng screen at pag-download</translation> <translation id="9151726767154816831">I-restart at i-powerwash upang i-update</translation> <translation id="9166331175924255663">I-toggle ang mataas na visibility ng Nearby Share.</translation> <translation id="9168436347345867845">Gawin ito sa ibang pagkakataon</translation>
diff --git a/ash/strings/ash_strings_hy.xtb b/ash/strings/ash_strings_hy.xtb index 87d3753..385a7be5 100644 --- a/ash/strings/ash_strings_hy.xtb +++ b/ash/strings/ash_strings_hy.xtb
@@ -58,6 +58,7 @@ <translation id="1455242230282523554">Ցուցադրել լեզվի կարգավորումները</translation> <translation id="1460620680449458626">Ձայնն անջատված է:</translation> <translation id="1467432559032391204">Ձախ</translation> +<translation id="1475439723810528286">Լիաէկրան ռեժիմում լուսանկարելու համար հպեք էկրանի ցանկացած կետի</translation> <translation id="1479909375538722835">Հատուկ գործառույթների լողացող ընտրացանկ</translation> <translation id="1484102317210609525"><ph name="DEVICE_NAME" /> (HDMI/DP)</translation> <translation id="1503394326855300303">Բազմակի մուտքի աշխատաշրջանում տիրոջ հաշիվը պետք է առաջին մուտք գործած հաշիվը լինի:</translation> @@ -121,6 +122,7 @@ <translation id="209965399369889474">Սարքը միացած չէ ցանցին</translation> <translation id="2126242104232412123">Նոր աշխատանքային տարածք</translation> <translation id="2127372758936585790">Մարտկոցի լիցքը սպառվում է</translation> +<translation id="2132302418721800944">Տեսագրել լիաէկրան ռեժիմում</translation> <translation id="2135456203358955318">Ամրացված խոշորացույց</translation> <translation id="2144487987174258011">Վերագործարկեք Adobe Flash Player-ի թարմացումն ավարտելու համար</translation> <translation id="2180011262286780504">Ձեր ադմինիստրատորն անջատել է էկրանի լուսանկարման գործառույթը։</translation> @@ -192,6 +194,7 @@ <translation id="2872961005593481000">Անջատել</translation> <translation id="2878884018241093801">Վերջին տարրեր չկան</translation> <translation id="2903844815300039659">Միացած է <ph name="NAME" /> ցանցին։ <ph name="STRENGTH" /></translation> +<translation id="2914580577416829331">Էկրանի լուսանկարներ</translation> <translation id="2942350706960889382">Ամրացված խոշորացույց</translation> <translation id="2942516765047364088">Դարակի դիրքը</translation> <translation id="2946119680249604491">Ավելացնել կապակցում</translation> @@ -367,6 +370,7 @@ <translation id="4513946894732546136">Հետադարձ կապ</translation> <translation id="4527045527269911712">«<ph name="DEVICE_NAME" />» Bluetooth սարքը զուգավորվելու թույլտվություն է խնդրում:</translation> <translation id="453661520163887813">Լրիվ կլիցքավորվի <ph name="TIME" />-ից</translation> +<translation id="4538824937723742295">Լիաէկրան սքրինշոթ անել</translation> <translation id="4544483149666270818">Ընտրեք պատուհանը՝ տեսագրելու համար</translation> <translation id="4560576029703263363">Միացված է</translation> <translation id="4561267230861221837">3G</translation> @@ -422,12 +426,14 @@ <translation id="4969092041573468113"><ph name="HOURS" /> ժ <ph name="MINUTES" /> ր <ph name="SECONDS" /> վ</translation> <translation id="4975771730019223894">Նշանակների ավելացում հավելվածներին</translation> <translation id="5030687792513154421">Ժամանակը սպառվեց</translation> +<translation id="5033299697334913360">Լիաէկրան ռեժիմում լուսանկարելու համար սեղմեք էկրանի որևէ կետ</translation> <translation id="5035236842988137213"><ph name="DEVICE_NAME" /> սարքը կապվեց նոր հեռախոսի հետ</translation> <translation id="5035389544768382859">Հաստատեք էկրանի կազմաձևումը</translation> <translation id="5083553833479578423">Օգտվեք Օգնականի այլ գործառույթներից</translation> <translation id="5136175204352732067">Այլ ստեղնաշար է միացվել</translation> <translation id="5168181903108465623">Առկա են հեռարձակման սարքեր</translation> <translation id="5170568018924773124">Ցույց տալ պանակում</translation> +<translation id="5176318573511391780">Տեսագրել էկրանի մի մասը</translation> <translation id="5207949376430453814">Ընդգծել տեքստի նշորդը</translation> <translation id="5208059991603368177">Միացված է</translation> <translation id="5222676887888702881">Դուրս գրվել</translation> @@ -488,6 +494,7 @@ <translation id="5837036133683224804">Դադարեցնել <ph name="ROUTE_TITLE" /> ներդիրի հեռարձակումը «<ph name="RECEIVER_NAME" />» սարքին</translation> <translation id="5860033963881614850">Անջատ.</translation> <translation id="5876666360658629066">Մուտքագրեք ծնողի մուտքի կոդը</translation> +<translation id="5881540930187678962">Կարգավորեք Հեռախոսի կառավարման կենտրոնն ավելի ուշ</translation> <translation id="5895138241574237353">Վերագործարկել</translation> <translation id="589817443623831496">Կետերի որոնում</translation> <translation id="5901316534475909376">Shift+Esc</translation> @@ -542,6 +549,7 @@ <translation id="6424520630891723617"><ph name="SECURITY_STATUS" />, ազդանշանի ուժգնությունը՝ <ph name="SIGNAL_STRENGTH" /></translation> <translation id="642644398083277086">Մաքրել բոլոր ծանուցումները</translation> <translation id="643147933154517414">Ամեն ինչ պատրաստ է</translation> +<translation id="6431865393913628856">Էկրանի տեսագրում</translation> <translation id="6445835306623867477"><ph name="ROUTE_TITLE" /> ներդիրը հեռարձակվում է «<ph name="RECEIVER_NAME" />» սարքին</translation> <translation id="6452181791372256707">Մերժել</translation> <translation id="6453179446719226835">Լեզուն փոխվել է</translation> @@ -627,6 +635,7 @@ <translation id="7346909386216857016">Եղավ</translation> <translation id="7348093485538360975">Էկրանի ստեղնաշար</translation> <translation id="735745346212279324">VPN-ն ապակապակցված է</translation> +<translation id="7371404428569700291">Տեսագրել պատուհանը</translation> <translation id="7377169924702866686">Caps Lock-ը միացված է:</translation> <translation id="7378203170292176219">Քաշեք՝ տեսագրման հատվածն ընտրելու համար</translation> <translation id="7378594059915113390">Մեդիա կարգավորումներ</translation> @@ -815,6 +824,7 @@ <translation id="9084606467167974638">Փոխել ընտրացանկի դիրքը</translation> <translation id="9089416786594320554">Ներածման եղանակներ</translation> <translation id="9091626656156419976"><ph name="DISPLAY_NAME" /> էկրանը հեռացվեց</translation> +<translation id="9092749890156285613">Էկրանի վերջին լուսանկարները և ներբեռնումները</translation> <translation id="9151726767154816831">Թարմացնելու համար վերագործարկեք և կատարեք Powerwash:</translation> <translation id="9166331175924255663">Միացնել/անջատել «Փոխանակում մոտակա սարքերի հետ» գործառույթի բարձր տեսանելիությունը</translation> <translation id="9168436347345867845">Ավելի ուշ</translation>
diff --git a/ash/strings/ash_strings_si.xtb b/ash/strings/ash_strings_si.xtb index e9d13f52..ace5b2f9 100644 --- a/ash/strings/ash_strings_si.xtb +++ b/ash/strings/ash_strings_si.xtb
@@ -58,6 +58,7 @@ <translation id="1455242230282523554">භාෂා සැකසීම් පෙන්වන්න</translation> <translation id="1460620680449458626">හඬ නිහඬයි.</translation> <translation id="1467432559032391204">වම</translation> +<translation id="1475439723810528286">පූර්ණ තිරය ග්රහණය කිරීමට ඕනෑම තැනක තට්ටු කරන්න</translation> <translation id="1479909375538722835">පාවෙන ප්රවේශ්යතා මෙනුව</translation> <translation id="1484102317210609525"><ph name="DEVICE_NAME" /> (HDMI/DP)</translation> <translation id="1503394326855300303">මෙම හිමිකරු ගිණුම බහුවිධ පිවිසීමේ සැසියක් තුළ පළමු පිවිසීමේ ගිණුම විය යුතුය.</translation> @@ -121,6 +122,7 @@ <translation id="209965399369889474">ජාලයට සම්බන්ධ වී නැත</translation> <translation id="2126242104232412123">නව මේසය</translation> <translation id="2127372758936585790">බලය අඩු චාජරයකි</translation> +<translation id="2132302418721800944">පූර්ණ තිරය පටිගත කරන්න</translation> <translation id="2135456203358955318">ඈඳන ලද විශාලකය</translation> <translation id="2144487987174258011">Adobe Flash Player යාවත්කාලීන කිරීමට නැවත ආරම්භ කරන්න</translation> <translation id="2180011262286780504">ඔබගේ පරිපාලක විසින් තිර ග්රහණය කිරීමේ හැකියාව අබල කර ඇත.</translation> @@ -192,6 +194,7 @@ <translation id="2872961005593481000">වසන්න</translation> <translation id="2878884018241093801">මෑත අයිතම නැත</translation> <translation id="2903844815300039659"><ph name="NAME" /> වෙත සම්බන්ධිතයි, <ph name="STRENGTH" /></translation> +<translation id="2914580577416829331">තිර ග්රහණ</translation> <translation id="2942350706960889382">ඈඳන ලද විශාලකය</translation> <translation id="2942516765047364088">රාක්ක ස්ථානය</translation> <translation id="2946119680249604491">සබඳතාව එක් කරන්න</translation> @@ -367,6 +370,7 @@ <translation id="4513946894732546136">ප්රතිපෝෂණ</translation> <translation id="4527045527269911712">"<ph name="DEVICE_NAME" />" Bluetooth උපාංගය යුගල වඊමට අවසර ඉල්ලයි.</translation> <translation id="453661520163887813">පිරෙන තෙක් <ph name="TIME" /></translation> +<translation id="4538824937723742295">පූර්ණ තිරයේ තිර රුවක් ගන්න</translation> <translation id="4544483149666270818">පටිගත කිරීමට කවුළුවක් තෝරන්න</translation> <translation id="4560576029703263363">සක්රියයි</translation> <translation id="4561267230861221837">3G</translation> @@ -422,12 +426,14 @@ <translation id="4969092041573468113">පැ<ph name="HOURS" /> මි<ph name="MINUTES" /> ත<ph name="SECONDS" /></translation> <translation id="4975771730019223894">යෙදුම් ලාංඡනය</translation> <translation id="5030687792513154421">වේලාව අවසන්</translation> +<translation id="5033299697334913360">පූර්ණ තිරය ග්රහණය කිරීමට ඕනෑම තැනක ක්ලික් කරන්න</translation> <translation id="5035236842988137213"><ph name="DEVICE_NAME" /> නව දුරකථනයකට සම්බන්ධයි</translation> <translation id="5035389544768382859">සංදර්ශක වින්යාසය තහවුරු කරන්න</translation> <translation id="5083553833479578423">තව සහායක අංග අගුලු හරින්න</translation> <translation id="5136175204352732067">වෙනස් යතුරු පුවරුවක් සම්බන්ධ කර ඇත</translation> <translation id="5168181903108465623">විකාශ උපාංග ලබා ගත හැකිය</translation> <translation id="5170568018924773124">ෆෝල්ඩරයේ පෙන්වන්න</translation> +<translation id="5176318573511391780">අර්ධ තිරය පටිගත කරන්න</translation> <translation id="5207949376430453814">පෙළ කාකපාදය උද්දීපනය කරන්න</translation> <translation id="5208059991603368177">ක්රියාත්මකයි</translation> <translation id="5222676887888702881">පිටවීම</translation> @@ -488,6 +494,7 @@ <translation id="5837036133683224804"><ph name="RECEIVER_NAME" /> මත <ph name="ROUTE_TITLE" /> නවත්වන්න</translation> <translation id="5860033963881614850">අක්රීය</translation> <translation id="5876666360658629066">මාපිය කේතය ඇතුළත් කරන්න</translation> +<translation id="5881540930187678962">පසුව Phone Hub පිහිටුවන්න</translation> <translation id="5895138241574237353">යළි අරඹන්න</translation> <translation id="589817443623831496">පොයින්ට් ස්කෑන් කිරීම</translation> <translation id="5901316534475909376">Shift+Esc</translation> @@ -542,6 +549,7 @@ <translation id="6424520630891723617"><ph name="SECURITY_STATUS" />, සංඥා ප්රබලතාව <ph name="SIGNAL_STRENGTH" /></translation> <translation id="642644398083277086">සියලු දැනුම්දීම් හිස් කරන්න</translation> <translation id="643147933154517414">සියල්ල නිමයි</translation> +<translation id="6431865393913628856">තිර පටිගත කිරීම</translation> <translation id="6445835306623867477"><ph name="RECEIVER_NAME" /> මත <ph name="ROUTE_TITLE" /></translation> <translation id="6452181791372256707">පිළිකෙව්</translation> <translation id="6453179446719226835">භාෂාව වෙනස් වී ඇත</translation> @@ -627,6 +635,7 @@ <translation id="7346909386216857016">හරි, තේරුම් ගත්තා!</translation> <translation id="7348093485538360975">තිරය-මත යතුරු පුවරුව</translation> <translation id="735745346212279324">VPN විසන්ධි විය</translation> +<translation id="7371404428569700291">පටිගත කිරීමේ කවුළුව</translation> <translation id="7377169924702866686">කැප්ස් ලොක් සක්රීයයි.</translation> <translation id="7378203170292176219">පටිගත කිරීමට ප්රදේශයක් තේරීමට අදින්න</translation> <translation id="7378594059915113390">මාධ්ය පාලක</translation> @@ -815,6 +824,7 @@ <translation id="9084606467167974638">මෙනු ස්ථානය ටොගල් කරන්න</translation> <translation id="9089416786594320554">ආදාන ක්රම</translation> <translation id="9091626656156419976">සංදර්ශකය <ph name="DISPLAY_NAME" /> ඉවත් කරන්න</translation> +<translation id="9092749890156285613">මෑත තිර ග්රහණ සහ බාගැනීම්</translation> <translation id="9151726767154816831">යාවත් කිරීමට යළි අරඹා powerwash කරන්න</translation> <translation id="9166331175924255663">ළඟ බෙදා ගැනීමේ ඉහළ දෘශ්යතාව ටොගල් කරන්න.</translation> <translation id="9168436347345867845">පසුව එය කරන්න</translation>
diff --git a/ash/system/overview/overview_button_tray_unittest.cc b/ash/system/overview/overview_button_tray_unittest.cc index 608fe12..5a57349 100644 --- a/ash/system/overview/overview_button_tray_unittest.cc +++ b/ash/system/overview/overview_button_tray_unittest.cc
@@ -30,7 +30,6 @@ #include "base/test/metrics/user_action_tester.h" #include "base/test/scoped_feature_list.h" #include "base/time/time.h" -#include "chromeos/constants/chromeos_features.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/window_types.h" #include "ui/aura/window.h" @@ -488,10 +487,8 @@ public testing::WithParamInterface<TestAccessibilityFeature> { public: OverviewButtonTrayWithShelfControlsHiddenTest() { - scoped_features_.InitWithFeatures( - {chromeos::features::kShelfHotseat, - features::kHideShelfControlsInTabletMode}, - {}); + scoped_features_.InitAndEnableFeature( + features::kHideShelfControlsInTabletMode); } OverviewButtonTrayWithShelfControlsHiddenTest( const OverviewButtonTrayWithShelfControlsHiddenTest& other) = delete;
diff --git a/ash/system/phonehub/enable_hotspot_quick_action_controller.cc b/ash/system/phonehub/enable_hotspot_quick_action_controller.cc index 6f7b4e0..c835277 100644 --- a/ash/system/phonehub/enable_hotspot_quick_action_controller.cc +++ b/ash/system/phonehub/enable_hotspot_quick_action_controller.cc
@@ -27,7 +27,8 @@ QuickActionItem* EnableHotspotQuickActionController::CreateItem() { DCHECK(!item_); item_ = new QuickActionItem(this, IDS_ASH_PHONE_HUB_ENABLE_HOTSPOT_TITLE, - kSystemMenuPhoneIcon); + kPhoneHubEnableHotspotOnIcon, + kPhoneHubEnableHotspotOffIcon); // When the UI has just opened, scan to see if there is a connection // available. if (tether_controller_->GetStatus() == Status::kConnectionUnavailable)
diff --git a/ash/system/phonehub/locate_phone_quick_action_controller.cc b/ash/system/phonehub/locate_phone_quick_action_controller.cc index fc57ba0..e05dd54 100644 --- a/ash/system/phonehub/locate_phone_quick_action_controller.cc +++ b/ash/system/phonehub/locate_phone_quick_action_controller.cc
@@ -43,7 +43,8 @@ QuickActionItem* LocatePhoneQuickActionController::CreateItem() { DCHECK(!item_); item_ = new QuickActionItem(this, IDS_ASH_PHONE_HUB_LOCATE_PHONE_TITLE, - kSystemMenuPhoneIcon); + kPhoneHubLocatePhoneOnIcon, + kPhoneHubLocatePhoneOffIcon); OnPhoneRingingStateChanged(); return item_; }
diff --git a/ash/system/phonehub/phone_hub_tray.cc b/ash/system/phonehub/phone_hub_tray.cc index 5d6481e..ae7833f 100644 --- a/ash/system/phonehub/phone_hub_tray.cc +++ b/ash/system/phonehub/phone_hub_tray.cc
@@ -49,12 +49,11 @@ : TrayBackgroundView(shelf), ui_controller_(new PhoneHubUiController()) { observed_phone_hub_ui_controller_.Add(ui_controller_.get()); - // TODO(tengs): Update icon to spec. auto icon = std::make_unique<views::ImageView>(); icon->SetTooltipText( l10n_util::GetStringUTF16(IDS_ASH_PHONE_HUB_TRAY_ACCESSIBLE_NAME)); icon->SetImage(CreateVectorIcon( - kSystemMenuPhoneIcon, + kPhoneHubPhoneIcon, AshColorProvider::Get()->GetContentLayerColor( AshColorProvider::ContentLayerType::kIconColorPrimary)));
diff --git a/ash/system/phonehub/silence_phone_quick_action_controller.cc b/ash/system/phonehub/silence_phone_quick_action_controller.cc index 678da30..8d4769fe 100644 --- a/ash/system/phonehub/silence_phone_quick_action_controller.cc +++ b/ash/system/phonehub/silence_phone_quick_action_controller.cc
@@ -47,7 +47,8 @@ QuickActionItem* SilencePhoneQuickActionController::CreateItem() { DCHECK(!item_); item_ = new QuickActionItem(this, IDS_ASH_PHONE_HUB_SILENCE_PHONE_TITLE, - kSystemMenuPhoneIcon); + kPhoneHubSilencePhoneOnIcon, + kPhoneHubSilencePhoneOffIcon); OnDndStateChanged(); return item_; }
diff --git a/ash/system/status_area_widget.cc b/ash/system/status_area_widget.cc index 715a9e8e..94058c38 100644 --- a/ash/system/status_area_widget.cc +++ b/ash/system/status_area_widget.cc
@@ -36,7 +36,6 @@ #include "base/i18n/time_formatting.h" #include "base/metrics/histogram_macros.h" #include "chromeos/constants/chromeos_features.h" -#include "chromeos/constants/chromeos_switches.h" #include "chromeos/services/assistant/public/cpp/features.h" #include "media/base/media_switches.h" #include "ui/compositor/scoped_layer_animation_settings.h" @@ -374,7 +373,6 @@ return CollapseState::NOT_COLLAPSIBLE; bool is_collapsible = - chromeos::switches::ShouldShowShelfHotseat() && Shell::Get()->tablet_mode_controller()->InTabletMode() && ShelfConfig::Get()->is_in_app();
diff --git a/ash/system/status_area_widget_delegate.cc b/ash/system/status_area_widget_delegate.cc index 8bb7c4a..a68e165c 100644 --- a/ash/system/status_area_widget_delegate.cc +++ b/ash/system/status_area_widget_delegate.cc
@@ -13,7 +13,6 @@ #include "ash/system/status_area_widget.h" #include "ash/system/tray/tray_constants.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/compositor/layer.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/gfx/animation/tween.h" @@ -245,9 +244,10 @@ // is enabled). int right_edge = kPaddingBetweenItems; - if (is_child_on_edge && chromeos::switches::ShouldShowShelfHotseat()) + if (is_child_on_edge) { right_edge = ShelfConfig::Get()->control_button_edge_spacing( true /* is_primary_axis_edge */); + } // Swap edges if alignment is not horizontal (bottom-to-top). if (!shelf_->IsHorizontalAlignment()) {
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc index 40ecd4d..d5b591f 100644 --- a/ash/system/tray/tray_background_view.cc +++ b/ash/system/tray/tray_background_view.cc
@@ -30,7 +30,6 @@ #include "ash/window_factory.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/scoped_observer.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/accessibility/ax_node_data.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_element.h" @@ -491,9 +490,7 @@ MirrorInsetsIfNecessary(&local_contents_insets); insets += local_contents_insets; - if (chromeos::switches::ShouldShowShelfHotseat() && - Shell::Get()->tablet_mode_controller()->InTabletMode() && - ShelfConfig::Get()->is_in_app()) { + if (Shell::Get()->IsInTabletMode() && ShelfConfig::Get()->is_in_app()) { insets += gfx::Insets( ShelfConfig::Get()->in_app_control_button_height_inset(), 0); }
diff --git a/ash/system/tray/tray_utils.cc b/ash/system/tray/tray_utils.cc index 5a77ab2..682ff4c 100644 --- a/ash/system/tray/tray_utils.cc +++ b/ash/system/tray/tray_utils.cc
@@ -11,7 +11,6 @@ #include "ash/style/ash_color_provider.h" #include "ash/system/tray/tray_constants.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/gfx/font_list.h" #include "ui/views/controls/label.h" @@ -55,9 +54,6 @@ if (!is_bottom_alignment) return insets; - if (!chromeos::switches::ShouldShowShelfHotseat()) - return insets; - int height_compensation = kTrayBubbleInsetHotseatCompensation; switch (shelf->GetBackgroundType()) { case ShelfBackgroundType::kInApp:
diff --git a/ash/wm/overview/overview_session_unittest.cc b/ash/wm/overview/overview_session_unittest.cc index a27684de1..612f6857 100644 --- a/ash/wm/overview/overview_session_unittest.cc +++ b/ash/wm/overview/overview_session_unittest.cc
@@ -73,7 +73,6 @@ #include "base/test/metrics/user_action_tester.h" #include "base/test/scoped_feature_list.h" #include "base/time/time.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/window_types.h" #include "ui/aura/test/test_window_delegate.h" @@ -1851,9 +1850,7 @@ // account. const int bounds_left = 200 + 4; int expected_x = bounds_left + (400 - (bounds_left)) / 2; - int workarea_bottom_inset = ShelfConfig::Get()->shelf_size(); - if (chromeos::switches::ShouldShowShelfHotseat()) - workarea_bottom_inset = ShelfConfig::Get()->in_app_shelf_size(); + const int workarea_bottom_inset = ShelfConfig::Get()->in_app_shelf_size(); const int expected_y = (300 - workarea_bottom_inset) / 2; EXPECT_EQ(gfx::Point(expected_x, expected_y), no_windows_widget->GetWindowBoundsInScreen().CenterPoint());
diff --git a/ash/wm/overview/overview_window_drag_controller_unittest.cc b/ash/wm/overview/overview_window_drag_controller_unittest.cc index b124f6d..ffeb89b 100644 --- a/ash/wm/overview/overview_window_drag_controller_unittest.cc +++ b/ash/wm/overview/overview_window_drag_controller_unittest.cc
@@ -24,7 +24,6 @@ #include "ash/wm/window_util.h" #include "base/stl_util.h" #include "base/test/scoped_feature_list.h" -#include "chromeos/constants/chromeos_features.h" #include "ui/aura/window_tree_host.h" #include "ui/display/test/display_manager_test_api.h" #include "ui/events/test/event_generator.h" @@ -103,17 +102,11 @@ // SplitView feature is disabled. class NoClamshellSplitViewTest : public AshTestBase { public: - NoClamshellSplitViewTest() = default; - ~NoClamshellSplitViewTest() override = default; - - // AshTestBase: - void SetUp() override { - scoped_feature_list_.InitWithFeatures( - /*enabled_features=*/{}, - /*disabled_features=*/{features::kDragToSnapInClamshellMode}); - - AshTestBase::SetUp(); + NoClamshellSplitViewTest() { + scoped_feature_list_.InitAndDisableFeature( + features::kDragToSnapInClamshellMode); } + ~NoClamshellSplitViewTest() override = default; private: base::test::ScopedFeatureList scoped_feature_list_; @@ -281,9 +274,7 @@ // Tests the behavior of dragging a window in portrait tablet mode with virtual // desks enabled. -class OverviewWindowDragControllerDesksPortraitTabletTest - : public AshTestBase, - public testing::WithParamInterface<bool> { +class OverviewWindowDragControllerDesksPortraitTabletTest : public AshTestBase { public: OverviewWindowDragControllerDesksPortraitTabletTest() = default; ~OverviewWindowDragControllerDesksPortraitTabletTest() override = default; @@ -321,16 +312,6 @@ // AshTestBase: void SetUp() override { - if (GetParam()) { - scoped_feature_list_.InitWithFeatures( - /* enabled */ {chromeos::features::kShelfHotseat}, - /* disabled */ {}); - } else { - scoped_feature_list_.InitWithFeatures( - /* enabled */ {}, - /* disabled */ {chromeos::features::kShelfHotseat}); - } - AshTestBase::SetUp(); // Setup a portrait internal display in tablet mode. @@ -388,12 +369,10 @@ } private: - base::test::ScopedFeatureList scoped_feature_list_; - DISALLOW_COPY_AND_ASSIGN(OverviewWindowDragControllerDesksPortraitTabletTest); }; -TEST_P(OverviewWindowDragControllerDesksPortraitTabletTest, +TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, DragAndDropInEmptyArea) { auto window = CreateAppWindow(gfx::Rect(0, 0, 250, 100)); StartDraggingAndValidateDesksBarShifted(window.get()); @@ -407,7 +386,7 @@ EXPECT_EQ(0, desks_bar_widget()->GetWindowBoundsInScreen().y()); } -TEST_P(OverviewWindowDragControllerDesksPortraitTabletTest, +TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, DragAndDropInSnapAreas) { auto window = CreateAppWindow(gfx::Rect(0, 0, 250, 100)); StartDraggingAndValidateDesksBarShifted(window.get()); @@ -450,7 +429,7 @@ desks_bar_widget()->GetWindowBoundsInScreen().y()); } -TEST_P(OverviewWindowDragControllerDesksPortraitTabletTest, DragAndDropInDesk) { +TEST_F(OverviewWindowDragControllerDesksPortraitTabletTest, DragAndDropInDesk) { auto window = CreateAppWindow(gfx::Rect(0, 0, 250, 100)); StartDraggingAndValidateDesksBarShifted(window.get()); @@ -483,8 +462,4 @@ drag_indicators()->current_window_dragging_state()); } -INSTANTIATE_TEST_SUITE_P(All, - OverviewWindowDragControllerDesksPortraitTabletTest, - testing::Bool()); - } // namespace ash
diff --git a/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc b/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc index 7e7ed28c..038ce63 100644 --- a/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc +++ b/ash/wm/tablet_mode/tablet_mode_controller_unittest.cc
@@ -1564,48 +1564,21 @@ EXPECT_FALSE(IsTabletModeStarted()); } +// Tests that we get no animation smoothness histograms when entering or +// exiting tablet mode with no windows. TEST_P(TabletModeControllerTest, TabletModeTransitionHistogramsNotLogged) { ui::ScopedAnimationDurationScaleMode test_duration_mode( ui::ScopedAnimationDurationScaleMode::NON_ZERO_DURATION); base::HistogramTester histogram_tester; - // Tests that we get no animation smoothness histograms when entering or - // exiting tablet mode with no windows. - { - SCOPED_TRACE("No window"); - histogram_tester.ExpectTotalCount(kEnterHistogram, 0); - histogram_tester.ExpectTotalCount(kExitHistogram, 0); - tablet_mode_controller()->SetEnabledForTest(true); - tablet_mode_controller()->SetEnabledForTest(false); - WaitForSmoothnessMetrics(); - histogram_tester.ExpectTotalCount(kEnterHistogram, 0); - histogram_tester.ExpectTotalCount(kExitHistogram, 0); - } - - // The workspace size changes when going between clamshell and tablet mode. - // This means there will be an animation during the transition. - if (chromeos::switches::ShouldShowShelfHotseat()) - return; - - // Test that we get no animation smoothness histograms when entering or - // exiting tablet mode with a maximized window as no animation will take - // place. - auto window = CreateTestWindow(gfx::Rect(200, 200)); - { - SCOPED_TRACE("Window is maximized"); - WindowState::Get(window.get())->Maximize(); - window->layer()->GetAnimator()->StopAnimating(); - tablet_mode_controller()->SetEnabledForTest(true); - EXPECT_FALSE(window->layer()->GetAnimator()->is_animating()); - WaitForSmoothnessMetrics(); - histogram_tester.ExpectTotalCount(kEnterHistogram, 0); - histogram_tester.ExpectTotalCount(kExitHistogram, 0); - tablet_mode_controller()->SetEnabledForTest(false); - EXPECT_FALSE(window->layer()->GetAnimator()->is_animating()); - WaitForSmoothnessMetrics(); - histogram_tester.ExpectTotalCount(kEnterHistogram, 0); - histogram_tester.ExpectTotalCount(kExitHistogram, 0); - } + SCOPED_TRACE("No window"); + histogram_tester.ExpectTotalCount(kEnterHistogram, 0); + histogram_tester.ExpectTotalCount(kExitHistogram, 0); + tablet_mode_controller()->SetEnabledForTest(true); + tablet_mode_controller()->SetEnabledForTest(false); + WaitForSmoothnessMetrics(); + histogram_tester.ExpectTotalCount(kEnterHistogram, 0); + histogram_tester.ExpectTotalCount(kExitHistogram, 0); } TEST_P(TabletModeControllerTest, TabletModeTransitionHistogramsLogged) { @@ -1764,13 +1737,6 @@ waiter.Wait(); EXPECT_FALSE(IsScreenshotShown()); EXPECT_TRUE(IsShelfOpaque()); - - // The window will animate if the hotseat is enabled because the workspace - // area will change. As long as a screenshot is not shown, this is ok. - if (chromeos::switches::ShouldShowShelfHotseat()) - return; - EXPECT_FALSE(window->layer()->GetAnimator()->is_animating()); - EXPECT_TRUE(IsShelfOpaque()); } // Regression test for screenshot staying visible when entering tablet mode when
diff --git a/ash/wm/tablet_mode/tablet_mode_window_manager_unittest.cc b/ash/wm/tablet_mode/tablet_mode_window_manager_unittest.cc index f5fa6f34..6e45537 100644 --- a/ash/wm/tablet_mode/tablet_mode_window_manager_unittest.cc +++ b/ash/wm/tablet_mode/tablet_mode_window_manager_unittest.cc
@@ -46,7 +46,6 @@ #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/values.h" -#include "chromeos/constants/chromeos_switches.h" #include "chromeos/ui/base/window_state_type.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/test/test_window_delegate.h" @@ -466,13 +465,11 @@ // is remaining as it is (but not maximized). DestroyTabletModeWindowManager(); - if (chromeos::switches::ShouldShowShelfHotseat()) { - // Account for work-area updates when leaving tablet mode. - const gfx::Insets clamshell_insets = - WorkAreaInsets::ForWindow(window.get())->user_work_area_insets(); - const gfx::Insets offset_difference = clamshell_insets - tablet_insets; - maximized_size.Inset(offset_difference); - } + // Account for work-area updates when leaving tablet mode. + const gfx::Insets clamshell_insets = + WorkAreaInsets::ForWindow(window.get())->user_work_area_insets(); + const gfx::Insets offset_difference = clamshell_insets - tablet_insets; + maximized_size.Inset(offset_difference); EXPECT_FALSE(WindowState::Get(window.get())->IsMaximized()); EXPECT_EQ(maximized_size.ToString(), window->bounds().ToString());
diff --git a/ash/wm/window_util_unittest.cc b/ash/wm/window_util_unittest.cc index 329a55e..c406df050 100644 --- a/ash/wm/window_util_unittest.cc +++ b/ash/wm/window_util_unittest.cc
@@ -8,7 +8,6 @@ #include "ash/wm/window_positioning_utils.h" #include "ash/wm/window_state.h" #include "ash/wm/wm_event.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/aura/test/test_windows.h" #include "ui/aura/window.h" #include "ui/display/screen.h" @@ -66,22 +65,12 @@ CenterWindow(window.get()); // Centring window is considered as a user's action. EXPECT_TRUE(window_state->bounds_changed_by_user()); - if (chromeos::switches::ShouldShowShelfHotseat()) { - EXPECT_EQ("200,126 100x100", window->bounds().ToString()); - EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString()); - } else { - EXPECT_EQ("200,122 100x100", window->bounds().ToString()); - EXPECT_EQ("200,122 100x100", window->GetBoundsInScreen().ToString()); - } + EXPECT_EQ("200,126 100x100", window->bounds().ToString()); + EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString()); window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100), GetSecondaryDisplay()); CenterWindow(window.get()); - if (chromeos::switches::ShouldShowShelfHotseat()) { - EXPECT_EQ("250,126 100x100", window->bounds().ToString()); - EXPECT_EQ("750,126 100x100", window->GetBoundsInScreen().ToString()); - } else { - EXPECT_EQ("250,122 100x100", window->bounds().ToString()); - EXPECT_EQ("750,122 100x100", window->GetBoundsInScreen().ToString()); - } + EXPECT_EQ("250,126 100x100", window->bounds().ToString()); + EXPECT_EQ("750,126 100x100", window->GetBoundsInScreen().ToString()); } TEST_F(WindowUtilTest, AdjustBoundsToEnsureMinimumVisibility) {
diff --git a/ash/wm/workspace/backdrop_controller.cc b/ash/wm/workspace/backdrop_controller.cc index ddfbaa4..81518f35 100644 --- a/ash/wm/workspace/backdrop_controller.cc +++ b/ash/wm/workspace/backdrop_controller.cc
@@ -28,7 +28,6 @@ #include "base/auto_reset.h" #include "base/memory/weak_ptr.h" #include "chromeos/audio/chromeos_sounds.h" -#include "chromeos/constants/chromeos_switches.h" #include "ui/aura/client/aura_constants.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_element.h" @@ -397,9 +396,7 @@ // Updating the back drop widget should not affect the shelf's auto hide // state. - base::Optional<Shelf::ScopedAutoHideLock> auto_hide_lock; - if (chromeos::switches::ShouldShowShelfHotseat()) - auto_hide_lock.emplace(ash::Shelf::ForWindow(container_)); + Shelf::ScopedAutoHideLock auto_hide_lock(ash::Shelf::ForWindow(container_)); // We are either destroying the backdrop widget or changing the order of // windows which will cause recursion.
diff --git a/base/BUILD.gn b/base/BUILD.gn index 7cb334f9..44aaf379 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -1316,8 +1316,10 @@ } if (use_allocator == "partition") { - sources += - [ "allocator/allocator_shim_default_dispatch_to_partition_alloc.cc" ] + sources += [ + "allocator/allocator_shim_default_dispatch_to_partition_alloc.cc", + "allocator/allocator_shim_default_dispatch_to_partition_alloc.h", + ] } else if (use_allocator == "tcmalloc") { sources += [ "allocator/allocator_shim_default_dispatch_to_tcmalloc.cc" ] deps += [ "//base/allocator:tcmalloc" ] @@ -1781,6 +1783,8 @@ "allocator/partition_allocator/partition_ref_count.cc", "allocator/partition_allocator/partition_ref_count.h", "allocator/partition_allocator/partition_root.h", + "allocator/partition_allocator/partition_stats.cc", + "allocator/partition_allocator/partition_stats.h", "allocator/partition_allocator/partition_tag.h", "allocator/partition_allocator/partition_tag_bitmap.h", "allocator/partition_allocator/partition_tls.h",
diff --git a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc index 9dfd7d1..d6d6b531 100644 --- a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc +++ b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc
@@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/allocator/allocator_shim_default_dispatch_to_partition_alloc.h" + #include "base/allocator/allocator_shim.h" #include "base/allocator/allocator_shim_internals.h" #include "base/allocator/partition_allocator/partition_alloc.h" #include "base/allocator/partition_allocator/partition_alloc_constants.h" #include "base/allocator/partition_allocator/partition_alloc_features.h" +#include "base/allocator/partition_allocator/partition_stats.h" #include "base/bits.h" #include "base/no_destructor.h" #include "build/build_config.h" @@ -33,9 +36,10 @@ std::atomic<bool> g_initialization_lock; std::atomic<base::ThreadSafePartitionRoot*> g_root_; // Buffer for placement new. -uint8_t g_allocator_buffer[sizeof(base::ThreadSafePartitionRoot)]; +alignas(base::ThreadSafePartitionRoot) uint8_t + g_allocator_buffer[sizeof(base::ThreadSafePartitionRoot)]; -base::ThreadSafePartitionRoot& Allocator() { +base::ThreadSafePartitionRoot* Allocator() { // Double-checked locking. // // The proper way to proceed is: @@ -64,7 +68,7 @@ // initialization before any other thread is created). auto* root = g_root_.load(std::memory_order_acquire); if (LIKELY(root)) - return *root; + return root; bool expected = false; // Semantically equivalent to base::Lock::Acquire(). @@ -78,7 +82,7 @@ if (root) { // Semantically equivalent to base::Lock::Release(). g_initialization_lock.store(false, std::memory_order_release); - return *root; + return root; } auto* new_root = new (g_allocator_buffer) base::ThreadSafePartitionRoot( @@ -89,26 +93,26 @@ // Semantically equivalent to base::Lock::Release(). g_initialization_lock.store(false, std::memory_order_release); - return *new_root; + return new_root; } using base::allocator::AllocatorDispatch; void* PartitionMalloc(const AllocatorDispatch*, size_t size, void* context) { - return Allocator().AllocFlagsNoHooks(0, size); + return Allocator()->AllocFlagsNoHooks(0, size); } void* PartitionMallocUnchecked(const AllocatorDispatch*, size_t size, void* context) { - return Allocator().AllocFlagsNoHooks(base::PartitionAllocReturnNull, size); + return Allocator()->AllocFlagsNoHooks(base::PartitionAllocReturnNull, size); } void* PartitionCalloc(const AllocatorDispatch*, size_t n, size_t size, void* context) { - return Allocator().AllocFlagsNoHooks(base::PartitionAllocZeroFill, n * size); + return Allocator()->AllocFlagsNoHooks(base::PartitionAllocZeroFill, n * size); } base::ThreadSafePartitionRoot* AlignedAllocator() { @@ -177,8 +181,8 @@ void* address, size_t size, void* context) { - return Allocator().ReallocFlags(base::PartitionAllocNoHooks, address, size, - ""); + return Allocator()->ReallocFlags(base::PartitionAllocNoHooks, address, size, + ""); } void PartitionFree(const AllocatorDispatch*, void* address, void* context) { @@ -192,36 +196,32 @@ return base::ThreadSafePartitionRoot::GetUsableSize(address); } -class PartitionStatsDumperImpl : public base::PartitionStatsDumper { - public: - PartitionStatsDumperImpl() = default; - - void PartitionDumpTotals( - const char* partition_name, - const base::PartitionMemoryStats* memory_stats) override { - stats_ = *memory_stats; - } - - void PartitionsDumpBucketStats( - const char* partition_name, - const base::PartitionBucketMemoryStats*) override {} - - const base::PartitionMemoryStats& stats() const { return stats_; } - - private: - base::PartitionMemoryStats stats_; -}; - } // namespace namespace base { +namespace internal { + +// static +ThreadSafePartitionRoot* PartitionAllocMalloc::Allocator() { + return ::Allocator(); +} + +// static +ThreadSafePartitionRoot* PartitionAllocMalloc::AlignedAllocator() { + return ::AlignedAllocator(); +} + +} // namespace internal +} // namespace base + +namespace base { namespace allocator { #if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) void EnablePCScanIfNeeded() { if (!features::IsPartitionAllocPCScanEnabled()) return; - Allocator().EnablePCScan(); + Allocator()->EnablePCScan(); AlignedAllocator()->EnablePCScan(); } #endif @@ -265,10 +265,10 @@ #if defined(OS_POSIX) SHIM_ALWAYS_EXPORT struct mallinfo mallinfo(void) __THROW { - PartitionStatsDumperImpl allocator_dumper; - Allocator().DumpStats("malloc", true, &allocator_dumper); + base::SimplePartitionStatsDumper allocator_dumper; + Allocator()->DumpStats("malloc", true, &allocator_dumper); - PartitionStatsDumperImpl aligned_allocator_dumper; + base::SimplePartitionStatsDumper aligned_allocator_dumper; AlignedAllocator()->DumpStats("posix_memalign", true, &aligned_allocator_dumper);
diff --git a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.h b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.h new file mode 100644 index 0000000..13a0112 --- /dev/null +++ b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.h
@@ -0,0 +1,22 @@ +// 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. + +#ifndef BASE_ALLOCATOR_ALLOCATOR_SHIM_DEFAULT_DISPATCH_TO_PARTITION_ALLOC_H_ +#define BASE_ALLOCATOR_ALLOCATOR_SHIM_DEFAULT_DISPATCH_TO_PARTITION_ALLOC_H_ + +#include "base/allocator/partition_allocator/partition_alloc.h" + +namespace base { +namespace internal { + +class PartitionAllocMalloc { + public: + static ThreadSafePartitionRoot* Allocator(); + static ThreadSafePartitionRoot* AlignedAllocator(); +}; + +} // namespace internal +} // namespace base + +#endif // BASE_ALLOCATOR_ALLOCATOR_SHIM_DEFAULT_DISPATCH_TO_PARTITION_ALLOC_H_
diff --git a/base/allocator/partition_allocator/partition_alloc.cc b/base/allocator/partition_allocator/partition_alloc.cc index 266bfd6..0944a85 100644 --- a/base/allocator/partition_allocator/partition_alloc.cc +++ b/base/allocator/partition_allocator/partition_alloc.cc
@@ -19,6 +19,7 @@ #include "base/allocator/partition_allocator/partition_oom.h" #include "base/allocator/partition_allocator/partition_page.h" #include "base/allocator/partition_allocator/partition_root.h" +#include "base/allocator/partition_allocator/partition_stats.h" #include "base/check_op.h" #include "base/no_destructor.h" #include "base/synchronization/lock.h"
diff --git a/base/allocator/partition_allocator/partition_alloc.h b/base/allocator/partition_allocator/partition_alloc.h index 7c5e33c4..ca649a7 100644 --- a/base/allocator/partition_allocator/partition_alloc.h +++ b/base/allocator/partition_allocator/partition_alloc.h
@@ -262,8 +262,6 @@ } // namespace internal -class PartitionStatsDumper; - enum PartitionPurgeFlags { // Decommitting the ring list of empty slot spans is reasonably fast. PartitionPurgeDecommitEmptySlotSpans = 1 << 0, @@ -274,57 +272,6 @@ PartitionPurgeDiscardUnusedSystemPages = 1 << 1, }; -// Struct used to retrieve total memory usage of a partition. Used by -// PartitionStatsDumper implementation. -struct PartitionMemoryStats { - size_t total_mmapped_bytes; // Total bytes mmaped from the system. - size_t total_committed_bytes; // Total size of commmitted pages. - size_t total_resident_bytes; // Total bytes provisioned by the partition. - size_t total_active_bytes; // Total active bytes in the partition. - size_t total_decommittable_bytes; // Total bytes that could be decommitted. - size_t total_discardable_bytes; // Total bytes that could be discarded. - - bool has_thread_cache; - internal::ThreadCacheStats current_thread_cache_stats; - internal::ThreadCacheStats all_thread_caches_stats; -}; - -// Struct used to retrieve memory statistics about a partition bucket. Used by -// PartitionStatsDumper implementation. -struct PartitionBucketMemoryStats { - bool is_valid; // Used to check if the stats is valid. - bool is_direct_map; // True if this is a direct mapping; size will not be - // unique. - uint32_t bucket_slot_size; // The size of the slot in bytes. - uint32_t allocated_slot_span_size; // Total size the slot span allocated - // from the system (committed pages). - uint32_t active_bytes; // Total active bytes used in the bucket. - uint32_t resident_bytes; // Total bytes provisioned in the bucket. - uint32_t decommittable_bytes; // Total bytes that could be decommitted. - uint32_t discardable_bytes; // Total bytes that could be discarded. - uint32_t num_full_slot_spans; // Number of slot spans with all slots - // allocated. - uint32_t num_active_slot_spans; // Number of slot spans that have at least - // one provisioned slot. - uint32_t num_empty_slot_spans; // Number of slot spans that are empty - // but not decommitted. - uint32_t num_decommitted_slot_spans; // Number of slot spans that are empty - // and decommitted. -}; - -// Interface that is passed to PartitionDumpStats and -// PartitionDumpStats for using the memory statistics. -class BASE_EXPORT PartitionStatsDumper { - public: - // Called to dump total memory used by partition, once per partition. - virtual void PartitionDumpTotals(const char* partition_name, - const PartitionMemoryStats*) = 0; - - // Called to dump stats about buckets, for each bucket. - virtual void PartitionsDumpBucketStats(const char* partition_name, - const PartitionBucketMemoryStats*) = 0; -}; - namespace { // Precalculate some shift and mask constants used in the hot path. // Example: malloc(41) == 101001 binary.
diff --git a/base/allocator/partition_allocator/partition_alloc_perftest.cc b/base/allocator/partition_allocator/partition_alloc_perftest.cc index 291f62a..bf392de 100644 --- a/base/allocator/partition_allocator/partition_alloc_perftest.cc +++ b/base/allocator/partition_allocator/partition_alloc_perftest.cc
@@ -45,7 +45,7 @@ // Final size is 24 + (13 * 22) = 310 bytes. constexpr int kMultiBucketRounds = 22; -constexpr char kMetricPrefixMemoryAllocation[] = "MemoryAllocation"; +constexpr char kMetricPrefixMemoryAllocation[] = "MemoryAllocation."; constexpr char kMetricThroughput[] = "throughput"; constexpr char kMetricTimePerAllocation[] = "time_per_allocation"; @@ -330,7 +330,7 @@ } std::string name = - base::StringPrintf("%s.%s_%s_%d", kMetricPrefixMemoryAllocation, + base::StringPrintf("%s%s_%s_%d", kMetricPrefixMemoryAllocation, story_base_name, alloc_type_str, thread_count); DisplayResults(name + "_total", total_laps_per_second);
diff --git a/base/allocator/partition_allocator/partition_root.h b/base/allocator/partition_allocator/partition_root.h index 955357f7..61fde825 100644 --- a/base/allocator/partition_allocator/partition_root.h +++ b/base/allocator/partition_allocator/partition_root.h
@@ -10,6 +10,7 @@ #include "base/allocator/partition_allocator/partition_alloc_forward.h" #include "base/allocator/partition_allocator/partition_direct_map_extent.h" #include "base/allocator/partition_allocator/partition_lock.h" +#include "base/allocator/partition_allocator/partition_stats.h" #include "base/allocator/partition_allocator/partition_tag.h" #include "base/allocator/partition_allocator/pcscan.h" #include "base/allocator/partition_allocator/thread_cache.h" @@ -17,8 +18,6 @@ namespace base { -class PartitionStatsDumper; - // Options struct used to configure PartitionRoot and PartitionAllocator. struct PartitionOptions { enum class Alignment {
diff --git a/base/allocator/partition_allocator/partition_stats.cc b/base/allocator/partition_allocator/partition_stats.cc new file mode 100644 index 0000000..237dd07 --- /dev/null +++ b/base/allocator/partition_allocator/partition_stats.cc
@@ -0,0 +1,15 @@ +// 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. + +#include "base/allocator/partition_allocator/partition_stats.h" + +namespace base { + +void SimplePartitionStatsDumper::PartitionDumpTotals( + const char* partition_name, + const PartitionMemoryStats* memory_stats) { + stats_ = *memory_stats; +} + +} // namespace base
diff --git a/base/allocator/partition_allocator/partition_stats.h b/base/allocator/partition_allocator/partition_stats.h new file mode 100644 index 0000000..8e1456c --- /dev/null +++ b/base/allocator/partition_allocator/partition_stats.h
@@ -0,0 +1,83 @@ +// 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. + +#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_STATS_H_ +#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_STATS_H_ + +#include "base/allocator/partition_allocator/thread_cache.h" + +namespace base { + +// Struct used to retrieve total memory usage of a partition. Used by +// PartitionStatsDumper implementation. +struct PartitionMemoryStats { + size_t total_mmapped_bytes; // Total bytes mmap()-ed from the system. + size_t total_committed_bytes; // Total size of committed pages. + size_t total_resident_bytes; // Total bytes provisioned by the partition. + size_t total_active_bytes; // Total active bytes in the partition. + size_t total_decommittable_bytes; // Total bytes that could be decommitted. + size_t total_discardable_bytes; // Total bytes that could be discarded. + + bool has_thread_cache; + internal::ThreadCacheStats current_thread_cache_stats; + internal::ThreadCacheStats all_thread_caches_stats; +}; + +// Struct used to retrieve memory statistics about a partition bucket. Used by +// PartitionStatsDumper implementation. +struct PartitionBucketMemoryStats { + bool is_valid; // Used to check if the stats is valid. + bool is_direct_map; // True if this is a direct mapping; size will not be + // unique. + uint32_t bucket_slot_size; // The size of the slot in bytes. + uint32_t allocated_slot_span_size; // Total size the slot span allocated + // from the system (committed pages). + uint32_t active_bytes; // Total active bytes used in the bucket. + uint32_t resident_bytes; // Total bytes provisioned in the bucket. + uint32_t decommittable_bytes; // Total bytes that could be decommitted. + uint32_t discardable_bytes; // Total bytes that could be discarded. + uint32_t num_full_slot_spans; // Number of slot spans with all slots + // allocated. + uint32_t num_active_slot_spans; // Number of slot spans that have at least + // one provisioned slot. + uint32_t num_empty_slot_spans; // Number of slot spans that are empty + // but not decommitted. + uint32_t num_decommitted_slot_spans; // Number of slot spans that are empty + // and decommitted. +}; + +// Interface that is passed to PartitionDumpStats and +// PartitionDumpStats for using the memory statistics. +class BASE_EXPORT PartitionStatsDumper { + public: + // Called to dump total memory used by partition, once per partition. + virtual void PartitionDumpTotals(const char* partition_name, + const PartitionMemoryStats*) = 0; + + // Called to dump stats about buckets, for each bucket. + virtual void PartitionsDumpBucketStats(const char* partition_name, + const PartitionBucketMemoryStats*) = 0; +}; + +// Simple version of PartitionStatsDumper, storing the returned stats in stats_. +// Does not handle per-bucket stats. +class BASE_EXPORT SimplePartitionStatsDumper : public PartitionStatsDumper { + public: + SimplePartitionStatsDumper() = default; + + void PartitionDumpTotals(const char* partition_name, + const PartitionMemoryStats* memory_stats) override; + + void PartitionsDumpBucketStats(const char* partition_name, + const PartitionBucketMemoryStats*) override {} + + const PartitionMemoryStats& stats() const { return stats_; } + + private: + PartitionMemoryStats stats_; +}; + +} // namespace base + +#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_PARTITION_STATS_H_
diff --git a/base/threading/hang_watcher.cc b/base/threading/hang_watcher.cc index 84eb7cfa3..3c5daf6 100644 --- a/base/threading/hang_watcher.cc +++ b/base/threading/hang_watcher.cc
@@ -263,7 +263,9 @@ static debug::CrashKeyString* crash_key = AllocateCrashKeyString( "seconds-since-last-memory-pressure", kCrashKeyContentSize); - if (last_critical_memory_pressure_.is_null()) { + const base::TimeTicks last_critical_memory_pressure_time = + last_critical_memory_pressure_.load(std::memory_order_relaxed); + if (last_critical_memory_pressure_time.is_null()) { constexpr char kNoMemoryPressureMsg[] = "No critical memory pressure"; static_assert( base::size(kNoMemoryPressureMsg) <= @@ -272,7 +274,7 @@ return debug::ScopedCrashKeyString(crash_key, kNoMemoryPressureMsg); } else { base::TimeDelta time_since_last_critical_memory_pressure = - base::TimeTicks::Now() - last_critical_memory_pressure_; + base::TimeTicks::Now() - last_critical_memory_pressure_time; return debug::ScopedCrashKeyString( crash_key, base::NumberToString( time_since_last_critical_memory_pressure.InSeconds())); @@ -282,11 +284,10 @@ void HangWatcher::OnMemoryPressure( base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level) { - DCHECK_CALLED_ON_VALID_THREAD(hang_watcher_thread_checker_); - if (memory_pressure_level == base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) { - last_critical_memory_pressure_ = base::TimeTicks::Now(); + last_critical_memory_pressure_.store(base::TimeTicks::Now(), + std::memory_order_relaxed); } }
diff --git a/base/threading/hang_watcher.h b/base/threading/hang_watcher.h index b9ee12b..fa74a0e 100644 --- a/base/threading/hang_watcher.h +++ b/base/threading/hang_watcher.h
@@ -334,8 +334,9 @@ base::MemoryPressureListener memory_pressure_listener_; // The last time at which a critical memory pressure signal was received, or - // null if no signal was ever received. - base::TimeTicks last_critical_memory_pressure_; + // null if no signal was ever received. Atomic because it's set and read from + // different threads. + std::atomic<base::TimeTicks> last_critical_memory_pressure_; // The time after which all deadlines in |watch_states_| need to be for a hang // to be reported.
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc index c327f48..4dda8989 100644 --- a/base/trace_event/malloc_dump_provider.cc +++ b/base/trace_event/malloc_dump_provider.cc
@@ -24,6 +24,10 @@ #include <windows.h> #endif +#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) +#include "base/allocator/allocator_shim_default_dispatch_to_partition_alloc.h" +#endif + namespace base { namespace trace_event { @@ -59,6 +63,27 @@ CHECK(::HeapUnlock(crt_heap) == TRUE); } #endif // defined(OS_WIN) + +#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) +void ReportDetailedPartitionAllocStats(ProcessMemoryDump* pmd) { + SimplePartitionStatsDumper allocator_dumper; + internal::PartitionAllocMalloc::Allocator()->DumpStats("malloc", false, + &allocator_dumper); + + if (allocator_dumper.stats().has_thread_cache) { + const auto& stats = allocator_dumper.stats().all_thread_caches_stats; + auto* thread_cache_dump = pmd->CreateAllocatorDump("malloc/thread_cache"); + ReportPartitionAllocThreadCacheStats(thread_cache_dump, stats); + const auto& main_thread_stats = + allocator_dumper.stats().current_thread_cache_stats; + auto* main_thread_cache_dump = + pmd->CreateAllocatorDump("malloc/thread_cache/main_thread"); + ReportPartitionAllocThreadCacheStats(main_thread_cache_dump, + main_thread_stats); + } +} +#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + } // namespace // static @@ -87,6 +112,12 @@ size_t resident_size = 0; size_t allocated_objects_size = 0; size_t allocated_objects_count = 0; +#if BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { + ReportDetailedPartitionAllocStats(pmd); + } +#endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + #if BUILDFLAG(USE_TCMALLOC) bool res = allocator::GetNumericProperty("generic.heap_size", &total_virtual_size); @@ -183,5 +214,28 @@ emit_metrics_on_memory_dump_ = false; } +#if BUILDFLAG(USE_PARTITION_ALLOC) +void ReportPartitionAllocThreadCacheStats( + MemoryAllocatorDump* dump, + const internal::ThreadCacheStats& stats) { + dump->AddScalar("alloc_count", "scalar", stats.alloc_count); + dump->AddScalar("alloc_hits", "scalar", stats.alloc_hits); + dump->AddScalar("alloc_misses", "scalar", stats.alloc_misses); + + dump->AddScalar("alloc_miss_empty", "scalar", stats.alloc_miss_empty); + dump->AddScalar("alloc_miss_too_large", "scalar", stats.alloc_miss_too_large); + + dump->AddScalar("cache_fill_count", "scalar", stats.cache_fill_count); + dump->AddScalar("cache_fill_hits", "scalar", stats.cache_fill_hits); + dump->AddScalar("cache_fill_misses", "scalar", stats.cache_fill_misses); + dump->AddScalar("cache_fill_bucket_full", "scalar", + stats.cache_fill_bucket_full); + dump->AddScalar("cache_fill_too_large", "scalar", stats.cache_fill_too_large); + + dump->AddScalar("size", "bytes", stats.bucket_total_memory); + dump->AddScalar("metadata_overhead", "bytes", stats.metadata_overhead); +} +#endif // BUILDFLAG(USE_PARTITION_ALLOC) + } // namespace trace_event } // namespace base
diff --git a/base/trace_event/malloc_dump_provider.h b/base/trace_event/malloc_dump_provider.h index f6c83b4..c84d936 100644 --- a/base/trace_event/malloc_dump_provider.h +++ b/base/trace_event/malloc_dump_provider.h
@@ -6,6 +6,7 @@ #define BASE_TRACE_EVENT_MALLOC_DUMP_PROVIDER_H_ #include "base/memory/singleton.h" +#include "base/partition_alloc_buildflags.h" #include "base/synchronization/lock.h" #include "base/trace_event/memory_dump_provider.h" #include "build/build_config.h" @@ -15,6 +16,10 @@ #define MALLOC_MEMORY_TRACING_SUPPORTED #endif +#if BUILDFLAG(USE_PARTITION_ALLOC) +#include "base/allocator/partition_allocator/partition_stats.h" +#endif + namespace base { namespace trace_event { @@ -50,6 +55,14 @@ base::Lock emit_metrics_on_memory_dump_lock_; }; +#if BUILDFLAG(USE_PARTITION_ALLOC) +class MemoryAllocatorDump; + +BASE_EXPORT void ReportPartitionAllocThreadCacheStats( + MemoryAllocatorDump* dump, + const internal::ThreadCacheStats& stats); +#endif // BUILDFLAG(USE_PARTITION_ALLOC) + } // namespace trace_event } // namespace base
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index e8257f5..ed625f4 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -0.20201026.0.1 +0.20201026.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index e8257f5..ed625f4 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -0.20201026.0.1 +0.20201026.1.1
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java index 24fe0cb..b587d7f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/ProfileSyncService.java
@@ -206,6 +206,11 @@ mNativeProfileSyncServiceAndroid, ProfileSyncService.this); } + public boolean isAuthenticatedAccountPrimary() { + return ProfileSyncServiceJni.get().isAuthenticatedAccountPrimary( + mNativeProfileSyncServiceAndroid, ProfileSyncService.this); + } + /** * Gets the set of data types that are "preferred" in sync. Those are the * chosen ones (see getChosenDataTypes), plus any that are implied by them. @@ -657,6 +662,8 @@ long nativeProfileSyncServiceAndroid, ProfileSyncService caller); boolean getDecoupledFromAndroidMasterSync( long nativeProfileSyncServiceAndroid, ProfileSyncService caller); + boolean isAuthenticatedAccountPrimary( + long nativeProfileSyncServiceAndroid, ProfileSyncService caller); boolean isEngineInitialized( long nativeProfileSyncServiceAndroid, ProfileSyncService caller); boolean isEncryptEverythingAllowed(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java index 16268627..13a55236 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java
@@ -104,22 +104,27 @@ if (isSyncEnabled == mProfileSyncService.isSyncRequested()) return; if (isSyncEnabled) { mProfileSyncService.requestStart(); + return; + } + + if (Profile.getLastUsedRegularProfile().isChild()) { + // For child accounts, Sync needs to stay enabled, so we reenable it in settings. + // TODO(bauerb): Remove the dependency on child account code and instead go through + // prefs (here and in the Sync customization UI). + AndroidSyncSettings.get().enableChromeSync(); } else { - if (Profile.getLastUsedRegularProfile().isChild()) { - // For child accounts, Sync needs to stay enabled, so we reenable it in settings. - // TODO(bauerb): Remove the dependency on child account code and instead go through - // prefs (here and in the Sync customization UI). - AndroidSyncSettings.get().enableChromeSync(); - } else { - if (AndroidSyncSettings.get().doesMasterSyncSettingAllowChromeSync()) { - RecordHistogram.recordEnumeratedHistogram("Sync.StopSource", - StopSource.ANDROID_CHROME_SYNC, StopSource.STOP_SOURCE_LIMIT); - } else { - RecordHistogram.recordEnumeratedHistogram("Sync.StopSource", - StopSource.ANDROID_MASTER_SYNC, StopSource.STOP_SOURCE_LIMIT); - } - mProfileSyncService.requestStop(); + // On sign-out, Sync.StopSource is already recorded in the native code, so only + // record it here if there's still a primary (syncing) account. + // TODO(crbug.com/1105795): Revisit how these metrics are recorded. + if (mProfileSyncService.isAuthenticatedAccountPrimary()) { + int source = !AndroidSyncSettings.get().doesMasterSyncSettingAllowChromeSync() + ? StopSource.ANDROID_MASTER_SYNC + : StopSource.ANDROID_CHROME_SYNC; + RecordHistogram.recordEnumeratedHistogram( + "Sync.StopSource", source, StopSource.STOP_SOURCE_LIMIT); } + + mProfileSyncService.requestStop(); } }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncSettingsUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncSettingsUtils.java index 009effc..9090649c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncSettingsUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/SyncSettingsUtils.java
@@ -297,7 +297,6 @@ : UiUtils.getTintedDrawable(context, R.drawable.ic_sync_green_legacy_40dp, R.color.default_icon_color); } - if (profileSyncService.isSyncDisabledByEnterprisePolicy()) { return useNewIcon ? AppCompatResources.getDrawable(context, R.drawable.ic_sync_off_48dp) @@ -305,17 +304,7 @@ R.color.default_icon_color); } - if (!profileSyncService.isFirstSetupComplete() || profileSyncService.hasUnrecoverableError() - || profileSyncService.getAuthError() != GoogleServiceAuthError.State.NONE) { - return useNewIcon - ? AppCompatResources.getDrawable(context, R.drawable.ic_sync_error_48dp) - : UiUtils.getTintedDrawable( - context, R.drawable.ic_sync_error_legacy_40dp, R.color.default_red); - } - - if (profileSyncService.isEngineInitialized() - && (profileSyncService.isPassphraseRequiredForPreferredDataTypes() - || profileSyncService.isTrustedVaultKeyRequiredForPreferredDataTypes())) { + if (getSyncError() != SyncError.NO_ERROR) { return useNewIcon ? AppCompatResources.getDrawable(context, R.drawable.ic_sync_error_48dp) : UiUtils.getTintedDrawable(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java index 3aab595..2a89f2c2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/page_info/PageInfoViewTest.java
@@ -151,11 +151,13 @@ int expected = hasPermissions ? ContentSettingValues.ALLOW : ContentSettingValues.ASK; TestThreadUtils.runOnUiThreadBlocking(() -> { assertEquals(expected, - WebsitePreferenceBridgeJni.get().getNotificationSettingForOrigin( - Profile.getLastUsedRegularProfile(), url)); + WebsitePreferenceBridgeJni.get().getSettingForOrigin( + Profile.getLastUsedRegularProfile(), ContentSettingsType.NOTIFICATIONS, + url, url)); assertEquals(expected, - WebsitePreferenceBridgeJni.get().getGeolocationSettingForOrigin( - Profile.getLastUsedRegularProfile(), url, "*")); + WebsitePreferenceBridgeJni.get().getSettingForOrigin( + Profile.getLastUsedRegularProfile(), ContentSettingsType.GEOLOCATION, + url, "*")); }); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineSettingsTest.java index d81acad..4d3373c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/search_engines/settings/SearchEngineSettingsTest.java
@@ -96,8 +96,9 @@ // first and ensure that location permission is NOT granted. String keyword3 = pref.getKeywordFromIndexForTesting(3); String url = templateUrlService.getSearchEngineUrlFromTemplateUrl(keyword3); - WebsitePreferenceBridgeJni.get().setGeolocationSettingForOrigin( - Profile.getLastUsedRegularProfile(), url, url, ContentSettingValues.BLOCK); + WebsitePreferenceBridgeJni.get().setSettingForOrigin( + Profile.getLastUsedRegularProfile(), ContentSettingsType.GEOLOCATION, url, url, + ContentSettingValues.BLOCK); keyword3 = pref.setValueForTesting("3"); Assert.assertEquals(keyword3, TemplateUrlServiceFactory.get() @@ -113,12 +114,14 @@ // setting to allow for search engine 3 before changing to search engine 2. // Otherwise the block setting will cause the content setting for search engine 2 // to be reset when we switch to it. - WebsitePreferenceBridgeJni.get().setGeolocationSettingForOrigin( - Profile.getLastUsedRegularProfile(), url, url, ContentSettingValues.ALLOW); + WebsitePreferenceBridgeJni.get().setSettingForOrigin( + Profile.getLastUsedRegularProfile(), ContentSettingsType.GEOLOCATION, url, url, + ContentSettingValues.ALLOW); keyword2 = pref.getKeywordFromIndexForTesting(2); url = templateUrlService.getSearchEngineUrlFromTemplateUrl(keyword2); - WebsitePreferenceBridgeJni.get().setGeolocationSettingForOrigin( - Profile.getLastUsedRegularProfile(), url, url, ContentSettingValues.ALLOW); + WebsitePreferenceBridgeJni.get().setSettingForOrigin( + Profile.getLastUsedRegularProfile(), ContentSettingsType.GEOLOCATION, url, url, + ContentSettingValues.ALLOW); keyword2 = pref.setValueForTesting("2"); Assert.assertEquals(keyword2, TemplateUrlServiceFactory.get()
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/PermissionInfoTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/PermissionInfoTest.java index d9c8490..75eba43 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/PermissionInfoTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/PermissionInfoTest.java
@@ -16,6 +16,7 @@ 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.profiles.OTRProfileID; import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; @@ -26,6 +27,7 @@ import org.chromium.components.content_settings.ContentSettingsType; import org.chromium.content_public.browser.test.util.TestThreadUtils; +import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; /** Tests for the PermissionInfoTest. */ @@ -43,121 +45,173 @@ mActivityTestRule.startMainActivityOnBlankPage(); } - private Profile getProfile(boolean incognito) { - return incognito ? Profile.getLastUsedRegularProfile().getOffTheRecordProfile() - : Profile.getLastUsedRegularProfile(); + private static Profile getRegularProfile() { + return TestThreadUtils.runOnUiThreadBlockingNoException( + (Callable<Profile>) () -> Profile.getLastUsedRegularProfile()); + } + + private static Profile getNonPrimaryOTRProfile() { + return TestThreadUtils.runOnUiThreadBlockingNoException((Callable<Profile>) () -> { + OTRProfileID otrProfileID = OTRProfileID.createUnique("CCT:Incognito"); + return Profile.getLastUsedRegularProfile().getOffTheRecordProfile(otrProfileID); + }); + } + + private static Profile getPrimaryOTRProfile() { + return TestThreadUtils.runOnUiThreadBlockingNoException( + (Callable<Profile>) () + -> Profile.getLastUsedRegularProfile().getPrimaryOTRProfile()); } private void setGeolocation( - String origin, String embedder, @ContentSettingValues int setting, boolean incognito) { - PermissionInfo info = - new PermissionInfo(ContentSettingsType.GEOLOCATION, origin, embedder, incognito); - TestThreadUtils.runOnUiThreadBlocking( - () -> info.setContentSetting(getProfile(incognito), setting)); + String origin, String embedder, @ContentSettingValues int setting, Profile profile) { + PermissionInfo info = new PermissionInfo(ContentSettingsType.GEOLOCATION, origin, embedder); + TestThreadUtils.runOnUiThreadBlocking(() -> info.setContentSetting(profile, setting)); } private @ContentSettingValues int getGeolocation( - String origin, String embedder, boolean incognito) throws ExecutionException { + String origin, String embedder, Profile profile) throws ExecutionException { return TestThreadUtils.runOnUiThreadBlocking(() -> { - PermissionInfo info = new PermissionInfo( - ContentSettingsType.GEOLOCATION, origin, embedder, incognito); - return info.getContentSetting(getProfile(incognito)); + PermissionInfo info = + new PermissionInfo(ContentSettingsType.GEOLOCATION, origin, embedder); + return info.getContentSetting(profile); }); } private void setNotifications( - String origin, String embedder, @ContentSettingValues int setting, boolean incognito) { + String origin, String embedder, @ContentSettingValues int setting, Profile profile) { PermissionInfo info = - new PermissionInfo(ContentSettingsType.NOTIFICATIONS, origin, embedder, incognito); - TestThreadUtils.runOnUiThreadBlocking( - () -> info.setContentSetting(getProfile(incognito), setting)); + new PermissionInfo(ContentSettingsType.NOTIFICATIONS, origin, embedder); + TestThreadUtils.runOnUiThreadBlocking(() -> info.setContentSetting(profile, setting)); } private @ContentSettingValues int getNotifications( - String origin, String embedder, boolean incognito) throws ExecutionException { + String origin, String embedder, Profile profile) throws ExecutionException { return TestThreadUtils.runOnUiThreadBlocking(() -> { - PermissionInfo info = new PermissionInfo( - ContentSettingsType.NOTIFICATIONS, origin, embedder, incognito); - return info.getContentSetting(getProfile(incognito)); + PermissionInfo info = + new PermissionInfo(ContentSettingsType.NOTIFICATIONS, origin, embedder); + return info.getContentSetting(profile); + }); + } + + private void resetNotificationsSettingsForTest() { + TestThreadUtils.runOnUiThreadBlocking(() -> { + WebsitePreferenceBridgeJni.get().resetNotificationsSettingsForTest( + Profile.getLastUsedRegularProfile()); }); } @Test @SmallTest @Feature({"Preferences"}) - public void testResetDSEGeolocation() throws Throwable { + public void testResetDSEGeolocation_RegularProfile_DefaultsToAllowFromBlock() throws Throwable { // Resetting the DSE geolocation permission should change it to ALLOW. - boolean incognito = false; - setGeolocation(DSE_ORIGIN, null, ContentSettingValues.BLOCK, incognito); + Profile regularProfile = getRegularProfile(); + setGeolocation(DSE_ORIGIN, null, ContentSettingValues.BLOCK, regularProfile); Assert.assertEquals( - ContentSettingValues.BLOCK, getGeolocation(DSE_ORIGIN, null, incognito)); - setGeolocation(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, incognito); + ContentSettingValues.BLOCK, getGeolocation(DSE_ORIGIN, null, regularProfile)); + setGeolocation(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, regularProfile); Assert.assertEquals( - ContentSettingValues.ALLOW, getGeolocation(DSE_ORIGIN, null, incognito)); - - // Resetting in incognito should not have the same behavior. - incognito = true; - setGeolocation(DSE_ORIGIN, null, ContentSettingValues.BLOCK, incognito); - Assert.assertEquals( - ContentSettingValues.BLOCK, getGeolocation(DSE_ORIGIN, null, incognito)); - setGeolocation(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, incognito); - Assert.assertEquals(ContentSettingValues.ASK, getGeolocation(DSE_ORIGIN, null, incognito)); + ContentSettingValues.ALLOW, getGeolocation(DSE_ORIGIN, null, regularProfile)); // Resetting a different top level origin should not have the same behavior - incognito = false; - setGeolocation(OTHER_ORIGIN, null, ContentSettingValues.BLOCK, incognito); + setGeolocation(OTHER_ORIGIN, null, ContentSettingValues.BLOCK, regularProfile); Assert.assertEquals( - ContentSettingValues.BLOCK, getGeolocation(OTHER_ORIGIN, null, incognito)); - setGeolocation(OTHER_ORIGIN, null, ContentSettingValues.DEFAULT, incognito); + ContentSettingValues.BLOCK, getGeolocation(OTHER_ORIGIN, null, regularProfile)); + setGeolocation(OTHER_ORIGIN, null, ContentSettingValues.DEFAULT, regularProfile); Assert.assertEquals( - ContentSettingValues.ASK, getGeolocation(OTHER_ORIGIN, null, incognito)); + ContentSettingValues.ASK, getGeolocation(OTHER_ORIGIN, null, regularProfile)); + } + + @Test + @SmallTest + @Feature({"Preferences"}) + public void testResetDSEGeolocation_InPrimaryOTRProfile_DefaultsToAskFromBlock() + throws Throwable { + Profile primaryOTRProfile = getPrimaryOTRProfile(); + setGeolocation(DSE_ORIGIN, null, ContentSettingValues.BLOCK, primaryOTRProfile); + Assert.assertEquals( + ContentSettingValues.BLOCK, getGeolocation(DSE_ORIGIN, null, primaryOTRProfile)); + setGeolocation(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, primaryOTRProfile); + Assert.assertEquals( + ContentSettingValues.ASK, getGeolocation(DSE_ORIGIN, null, primaryOTRProfile)); + } + + @Test + @SmallTest + @Feature({"Preferences"}) + public void testResetDSEGeolocation_InNonPrimaryOTRProfile_DefaultsToAskFromBlock() + throws Throwable { + Profile nonPrimaryOTRProfile = getNonPrimaryOTRProfile(); + setGeolocation(DSE_ORIGIN, null, ContentSettingValues.BLOCK, nonPrimaryOTRProfile); + Assert.assertEquals( + ContentSettingValues.BLOCK, getGeolocation(DSE_ORIGIN, null, nonPrimaryOTRProfile)); + setGeolocation(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, nonPrimaryOTRProfile); + Assert.assertEquals( + ContentSettingValues.ASK, getGeolocation(DSE_ORIGIN, null, nonPrimaryOTRProfile)); } @Test @SmallTest @Feature({"Preferences"}) @EnableFeatures(ChromeFeatureList.GRANT_NOTIFICATIONS_TO_DSE) - public void testResetDSENotifications() throws Throwable { + public void testResetDSENotifications_InRegularProfile_DefaultsToAllowFromBlock() + throws Throwable { + Profile regularProfile = getRegularProfile(); + // On Android O+ we need to clear notification channels so they don't interfere with the // test. - TestThreadUtils.runOnUiThreadBlocking(() -> { - WebsitePreferenceBridgeJni.get().resetNotificationsSettingsForTest( - Profile.getLastUsedRegularProfile()); - }); + resetNotificationsSettingsForTest(); + setNotifications(DSE_ORIGIN, null, ContentSettingValues.BLOCK, regularProfile); + Assert.assertEquals( + ContentSettingValues.BLOCK, getNotifications(DSE_ORIGIN, null, regularProfile)); + setNotifications(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, regularProfile); + Assert.assertEquals( + ContentSettingValues.ALLOW, getNotifications(DSE_ORIGIN, null, regularProfile)); - // Resetting the DSE notifications permission should change it to ALLOW. - boolean incognito = false; - setNotifications(DSE_ORIGIN, null, ContentSettingValues.BLOCK, incognito); + // For other origins it defaults to ASK + resetNotificationsSettingsForTest(); + setNotifications(OTHER_ORIGIN, null, ContentSettingValues.BLOCK, regularProfile); Assert.assertEquals( - ContentSettingValues.BLOCK, getNotifications(DSE_ORIGIN, null, incognito)); - setNotifications(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, incognito); + ContentSettingValues.BLOCK, getNotifications(OTHER_ORIGIN, null, regularProfile)); + setNotifications(OTHER_ORIGIN, null, ContentSettingValues.DEFAULT, regularProfile); Assert.assertEquals( - ContentSettingValues.ALLOW, getNotifications(DSE_ORIGIN, null, incognito)); + ContentSettingValues.ASK, getNotifications(OTHER_ORIGIN, null, regularProfile)); + } + + @Test + @SmallTest + @Feature({"Preferences"}) + @EnableFeatures(ChromeFeatureList.GRANT_NOTIFICATIONS_TO_DSE) + public void testResetDSENotification_InPrimaryOTRProfile_DefaultsToAskFromBlock() + throws Throwable { + Profile primaryOTRProfile = getPrimaryOTRProfile(); // Resetting in incognito should not have the same behavior. - TestThreadUtils.runOnUiThreadBlocking(() -> { - WebsitePreferenceBridgeJni.get().resetNotificationsSettingsForTest( - Profile.getLastUsedRegularProfile()); - }); - incognito = true; - setNotifications(DSE_ORIGIN, null, ContentSettingValues.BLOCK, incognito); + resetNotificationsSettingsForTest(); + setNotifications(DSE_ORIGIN, null, ContentSettingValues.BLOCK, primaryOTRProfile); Assert.assertEquals( - ContentSettingValues.BLOCK, getNotifications(DSE_ORIGIN, null, incognito)); - setNotifications(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, incognito); + ContentSettingValues.BLOCK, getNotifications(DSE_ORIGIN, null, primaryOTRProfile)); + setNotifications(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, primaryOTRProfile); Assert.assertEquals( - ContentSettingValues.ASK, getNotifications(DSE_ORIGIN, null, incognito)); + ContentSettingValues.ASK, getNotifications(DSE_ORIGIN, null, primaryOTRProfile)); + } - // // Resetting a different top level origin should not have the same behavior - TestThreadUtils.runOnUiThreadBlocking(() -> { - WebsitePreferenceBridgeJni.get().resetNotificationsSettingsForTest( - Profile.getLastUsedRegularProfile()); - }); - incognito = false; - setNotifications(OTHER_ORIGIN, null, ContentSettingValues.BLOCK, incognito); + @Test + @SmallTest + @Feature({"Preferences"}) + @EnableFeatures(ChromeFeatureList.GRANT_NOTIFICATIONS_TO_DSE) + public void testResetDSENotification_InNonPrimaryOTRProfile_DefaultsToAskFromBlock() + throws Throwable { + Profile nonPrimaryOTRProfile = getNonPrimaryOTRProfile(); + + // Resetting in incognito should not have the same behavior. + resetNotificationsSettingsForTest(); + setNotifications(DSE_ORIGIN, null, ContentSettingValues.BLOCK, nonPrimaryOTRProfile); + Assert.assertEquals(ContentSettingValues.BLOCK, + getNotifications(DSE_ORIGIN, null, nonPrimaryOTRProfile)); + setNotifications(DSE_ORIGIN, null, ContentSettingValues.DEFAULT, nonPrimaryOTRProfile); Assert.assertEquals( - ContentSettingValues.BLOCK, getNotifications(OTHER_ORIGIN, null, incognito)); - setNotifications(OTHER_ORIGIN, null, ContentSettingValues.DEFAULT, incognito); - Assert.assertEquals( - ContentSettingValues.ASK, getNotifications(OTHER_ORIGIN, null, incognito)); + ContentSettingValues.ASK, getNotifications(DSE_ORIGIN, null, nonPrimaryOTRProfile)); } }
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 9a7fff0..7c3f3651 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
@@ -1238,8 +1238,9 @@ "exampleToBlock.com", "/chrome/test/data/notifications/notification_tester.html"); TestThreadUtils.runOnUiThreadBlocking(() -> { - WebsitePreferenceBridgeJni.get().setNotificationSettingForOrigin( - getBrowserContextHandle(), urlToBlock, ContentSettingValues.BLOCK); + WebsitePreferenceBridgeJni.get().setSettingForOrigin(getBrowserContextHandle(), + ContentSettingsType.NOTIFICATIONS, urlToBlock, urlToBlock, + ContentSettingValues.BLOCK); }); final SettingsActivity settingsActivity = SiteSettingsTestUtils.startSiteSettingsCategory(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/WebsitePermissionsFetcherTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/WebsitePermissionsFetcherTest.java index ed5afc0c..35aa289 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/WebsitePermissionsFetcherTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/site_settings/WebsitePermissionsFetcherTest.java
@@ -312,18 +312,20 @@ TestThreadUtils.runOnUiThreadBlocking(() -> { Profile profile = Profile.getLastUsedRegularProfile(); for (String url : PERMISSION_URLS) { - WebsitePreferenceBridgeJni.get().setGeolocationSettingForOrigin( - profile, url, url, ContentSettingValues.BLOCK); - WebsitePreferenceBridgeJni.get().setMidiSettingForOrigin( - profile, url, url, ContentSettingValues.ALLOW); - WebsitePreferenceBridgeJni.get().setProtectedMediaIdentifierSettingForOrigin( - profile, url, url, ContentSettingValues.BLOCK); - WebsitePreferenceBridgeJni.get().setNotificationSettingForOrigin( - profile, url, ContentSettingValues.ALLOW); - WebsitePreferenceBridgeJni.get().setMicrophoneSettingForOrigin( - profile, url, ContentSettingValues.ALLOW); - WebsitePreferenceBridgeJni.get().setCameraSettingForOrigin( - profile, url, ContentSettingValues.BLOCK); + WebsitePreferenceBridgeJni.get().setSettingForOrigin(profile, + ContentSettingsType.GEOLOCATION, url, url, ContentSettingValues.BLOCK); + WebsitePreferenceBridgeJni.get().setSettingForOrigin(profile, + ContentSettingsType.MIDI_SYSEX, url, url, ContentSettingValues.ALLOW); + WebsitePreferenceBridgeJni.get().setSettingForOrigin(profile, + ContentSettingsType.PROTECTED_MEDIA_IDENTIFIER, url, url, + ContentSettingValues.BLOCK); + WebsitePreferenceBridgeJni.get().setSettingForOrigin(profile, + ContentSettingsType.NOTIFICATIONS, url, url, ContentSettingValues.ALLOW); + WebsitePreferenceBridgeJni.get().setSettingForOrigin(profile, + ContentSettingsType.MEDIASTREAM_MIC, url, url, ContentSettingValues.ALLOW); + WebsitePreferenceBridgeJni.get().setSettingForOrigin(profile, + ContentSettingsType.MEDIASTREAM_CAMERA, url, url, + ContentSettingValues.BLOCK); } // This should not time out. See crbug.com/732907.
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderUnitTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderUnitTest.java index 1daf19b..e7b155a3 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderUnitTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/omnibox/geo/GeolocationHeaderUnitTest.java
@@ -10,6 +10,7 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import android.content.Context; @@ -38,6 +39,7 @@ import org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge; import org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridgeJni; import org.chromium.components.content_settings.ContentSettingValues; +import org.chromium.components.content_settings.ContentSettingsType; import org.chromium.components.embedder_support.browser_context.BrowserContextHandle; import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.components.embedder_support.util.UrlUtilitiesJni; @@ -133,8 +135,8 @@ GeolocationHeader.setAppPermissionGrantedForTesting(true); when(mTab.isIncognito()).thenReturn(false); when(mTab.getWebContents()).thenReturn(mWebContentsMock); - when(mWebsitePreferenceBridgeJniMock.getGeolocationSettingForOrigin( - any(BrowserContextHandle.class), anyString(), anyString())) + when(mWebsitePreferenceBridgeJniMock.getSettingForOrigin(any(BrowserContextHandle.class), + eq(ContentSettingsType.GEOLOCATION), anyString(), anyString())) .thenReturn(ContentSettingValues.ALLOW); when(mWebsitePreferenceBridgeJniMock.isPermissionControlledByDSE( any(BrowserContextHandle.class), anyInt(), anyString()))
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 6a759cf2..9a3d862 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -8590,6 +8590,33 @@ <message name="IDS_NOTIFICATION_REPLY_PLACEHOLDER" desc="Placeholder text shown in the text box before any text is entered when replying directly to a notification."> Send message </message> + <message name="IDS_NOTIFICATION_MUTED_MESSAGE" desc="Informative message describing that notification content is currently hidden while the screen is being shared. Shown as the body of a notification."> + Details are hidden while you share your screen + </message> + <if expr="not use_titlecase"> + <message name="IDS_NOTIFICATION_MUTED_TITLE" desc="Title of a notification showing how many new notifications are currently hidden. The number is always greater than zero."> + {MUTED_NOTIFICATIONS_COUNT, plural, + =1 {New notification} + other {# new notifications}} + </message> + <message name="IDS_NOTIFICATION_MUTED_ACTION_SHOW" desc="Action button text to show the content of previously muted notifications."> + {MUTED_NOTIFICATIONS_COUNT, plural, + =1 {Show} + other {Show all}} + </message> + </if> + <if expr="use_titlecase"> + <message name="IDS_NOTIFICATION_MUTED_TITLE" desc="Title of a notification showing how many new notifications are currently hidden. The number is always greater than zero."> + {MUTED_NOTIFICATIONS_COUNT, plural, + =1 {New Notification} + other {# New Notifications}} + </message> + <message name="IDS_NOTIFICATION_MUTED_ACTION_SHOW" desc="Action button text to show the content of previously muted notifications."> + {MUTED_NOTIFICATIONS_COUNT, plural, + =1 {Show} + other {Show All}} + </message> + </if> <if expr="is_android"> <message name="IDS_NOTIFICATION_BUTTON_MANAGE" desc="Text of a button shown on notification permission requests, that opens the Chrome notifications settings page. This allows users to edit notification settings when a site asks them to allow notifications."> Manage
diff --git a/chrome/app/generated_resources_grd/IDS_NOTIFICATION_MUTED_ACTION_SHOW.png.sha1 b/chrome/app/generated_resources_grd/IDS_NOTIFICATION_MUTED_ACTION_SHOW.png.sha1 new file mode 100644 index 0000000..4637de0 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NOTIFICATION_MUTED_ACTION_SHOW.png.sha1
@@ -0,0 +1 @@ +e0d5c4f96b826c34a02e2f5094dde95b8f323ac2 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NOTIFICATION_MUTED_MESSAGE.png.sha1 b/chrome/app/generated_resources_grd/IDS_NOTIFICATION_MUTED_MESSAGE.png.sha1 new file mode 100644 index 0000000..3f4b8df --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NOTIFICATION_MUTED_MESSAGE.png.sha1
@@ -0,0 +1 @@ +45a34671e21557b95a08b462938ac4821f72fbe5 \ No newline at end of file
diff --git a/chrome/app/generated_resources_grd/IDS_NOTIFICATION_MUTED_TITLE.png.sha1 b/chrome/app/generated_resources_grd/IDS_NOTIFICATION_MUTED_TITLE.png.sha1 new file mode 100644 index 0000000..56e82ae1 --- /dev/null +++ b/chrome/app/generated_resources_grd/IDS_NOTIFICATION_MUTED_TITLE.png.sha1
@@ -0,0 +1 @@ +20a842f89a2be58c5e027da759a88a1d2343ac45 \ No newline at end of file
diff --git a/chrome/app/resources/generated_resources_ca.xtb b/chrome/app/resources/generated_resources_ca.xtb index d3c0340..6cefc0a7 100644 --- a/chrome/app/resources/generated_resources_ca.xtb +++ b/chrome/app/resources/generated_resources_ca.xtb
@@ -4743,7 +4743,7 @@ <translation id="6556903358015358733">Tema i fons de pantalla</translation> <translation id="6557290421156335491">Les meves dreceres</translation> <translation id="6560151649238390891">El suggeriment s'ha inserit</translation> -<translation id="6561560012278703671">Utilitza missatges més silenciosos (bloqueja les sol·licituds de notificacions per evitar interrupcions)</translation> +<translation id="6561560012278703671">Utilitza missatges més discrets (bloqueja les sol·licituds de notificacions per evitar interrupcions)</translation> <translation id="6561726789132298588">retorn</translation> <translation id="6562117348069327379">Emmagatzema els registres del sistema al directori Baixades.</translation> <translation id="656293578423618167">El camí o el nom del fitxer és massa llarg. Deseu-ho amb un nom més curt o en una altra ubicació.</translation>
diff --git a/chrome/app/resources/generated_resources_en-GB.xtb b/chrome/app/resources/generated_resources_en-GB.xtb index 26f09948..c16904c 100644 --- a/chrome/app/resources/generated_resources_en-GB.xtb +++ b/chrome/app/resources/generated_resources_en-GB.xtb
@@ -133,6 +133,7 @@ <translation id="1145292499998999162">Plug-in blocked</translation> <translation id="1145593918056169051">Printer has stopped</translation> <translation id="114721135501989771">Get Google smarts in Chrome</translation> +<translation id="1147322039136785890">Now it's <ph name="SUPERVISED_USER_NAME" />'s turn</translation> <translation id="1147991416141538220">To ask for access, contact the administrator of this device.</translation> <translation id="1149401351239820326">Expiry month</translation> <translation id="1149725087019908252">Scanning <ph name="FILE_NAME" /></translation> @@ -2081,6 +2082,7 @@ <translation id="3428419049384081277">You're signed in!</translation> <translation id="3428747202529429621">Keeps you safe on Chrome and may be used to improve your security in other Google apps when you are signed in</translation> <translation id="3428800329481094896">Fetching the Linux container SSH keys</translation> +<translation id="3429271624041785769">Web content languages</translation> <translation id="3429275422858276529">Bookmark this page to easily find it later</translation> <translation id="3432227430032737297">Remove all shown</translation> <translation id="3432757130254800023">Send audio and video to displays on the local network</translation> @@ -2507,6 +2509,7 @@ <translation id="3879748587602334249">Download manager</translation> <translation id="3881478300875776315">Show fewer lines</translation> <translation id="3882165008614329320">Existing video from camera or file</translation> +<translation id="3884152383786131369">Web content available in multiple languages will use the first supported language from this list. These preferences are synced with your browser settings. <ph name="BEGIN_LINK_LEARN_MORE" />Learn more<ph name="END_LINK_LEARN_MORE" /></translation> <translation id="3886446263141354045">Your request to access this site has been sent to <ph name="NAME" /></translation> <translation id="3888550877729210209">Taking notes with <ph name="LOCK_SCREEN_APP_NAME" /></translation> <translation id="3890064827463908288">Turn on Chrome Sync to use Wi-Fi Sync</translation> @@ -4365,6 +4368,7 @@ <translation id="6112727384379533756">Add a ticket</translation> <translation id="6112931163620622315">Check your phone</translation> <translation id="6112952769866305444">Edit person, <ph name="PROFILE_NAME" />, <ph name="USERNAME" /></translation> +<translation id="6113434369102685411">Set your default search engine for Chrome browser and <ph name="DEVICE_TYPE" /> Launcher</translation> <translation id="6113942107547980621">To use Smart Lock, switch to the primary user profile on your phone</translation> <translation id="6116921718742659598">Change language and input settings</translation> <translation id="6120205520491252677">Pin this page to Start screen...</translation> @@ -5231,6 +5235,7 @@ <translation id="7140928199327930795">No other available devices.</translation> <translation id="7141105143012495934">Sign-in failed because your account details could not be retrieved. Please contact your administrator or try again.</translation> <translation id="7143207342074048698">Connecting</translation> +<translation id="7143358760238281735">No apps available</translation> <translation id="7144878232160441200">Retry</translation> <translation id="714876143603641390">LAN connectivity</translation> <translation id="7149893636342594995">Last 24 Hours</translation> @@ -5702,6 +5707,7 @@ <translation id="7707922173985738739">Use mobile data</translation> <translation id="7709152031285164251">Failed - <ph name="INTERRUPT_REASON" /></translation> <translation id="7710568461918838723">&Cast...</translation> +<translation id="7712739869553853093">Print preview dialogue</translation> <translation id="7712836429117959503">Unknown extension with ID <ph name="EXTENSION_ID" /></translation> <translation id="7714307061282548371">Cookies from <ph name="DOMAIN" /> allowed</translation> <translation id="7714464543167945231">Certificate</translation> @@ -6604,6 +6610,7 @@ <translation id="8736288397686080465">This site has been updated in the background.</translation> <translation id="8737685506611670901">Open <ph name="PROTOCOL" /> links instead of <ph name="REPLACED_HANDLER_TITLE" /></translation> <translation id="8737709691285775803">Shill</translation> +<translation id="8740247629089392745">You can hand this Chromebook to <ph name="SUPERVISED_USER_NAME" />. Setup is almost done, then it's time to explore.</translation> <translation id="8742998548129056176">This is general information about your device and how you use it (such as battery level, system and app activity, and errors). The data will be used to improve Android, and some aggregated information will also help Google apps and partners, such as Android developers, to make their apps and products better.</translation> <translation id="8743390665131937741">Full-screen zoom level:</translation> <translation id="8743864605301774756">Updated 1hr ago</translation>
diff --git a/chrome/app/resources/generated_resources_fil.xtb b/chrome/app/resources/generated_resources_fil.xtb index c7ca740..3ea1ac59 100644 --- a/chrome/app/resources/generated_resources_fil.xtb +++ b/chrome/app/resources/generated_resources_fil.xtb
@@ -133,6 +133,7 @@ <translation id="1145292499998999162">Na-block ang plugin</translation> <translation id="1145593918056169051">Huminto ang printer</translation> <translation id="114721135501989771">Magkaroon ng mga smart na feature ng Google sa Chrome</translation> +<translation id="1147322039136785890">Si <ph name="SUPERVISED_USER_NAME" /> naman</translation> <translation id="1147991416141538220">Para humiling ng access, makipag-ugnayan sa administrator ng device na ito.</translation> <translation id="1149401351239820326">Buwan ng pag-expire</translation> <translation id="1149725087019908252">Sina-scan ang <ph name="FILE_NAME" /></translation> @@ -2081,6 +2082,7 @@ <translation id="3428419049384081277">Naka-sign in ka!</translation> <translation id="3428747202529429621">Pinapanatili kang ligtas sa Chrome at puwedeng gamitin para paigtingin ang iyong seguridad sa iba pang Google app kapag naka-sign in ka</translation> <translation id="3428800329481094896">Kinukuha ang mga ssh key ng Linux container</translation> +<translation id="3429271624041785769">Mga wika ng content sa web</translation> <translation id="3429275422858276529">I-bookmark ang page na ito upang madali itong mahanap sa ibang pagkakaton</translation> <translation id="3432227430032737297">Alisin ang Lahat ng Ipinapakita</translation> <translation id="3432757130254800023">Magpadala ng audio at video sa mga display sa lokal na network</translation> @@ -2507,6 +2509,7 @@ <translation id="3879748587602334249">Download manager</translation> <translation id="3881478300875776315">Magpakita ng mas kaunting linya</translation> <translation id="3882165008614329320">Kasalukuyang video mula sa camera o file</translation> +<translation id="3884152383786131369">Gagamitin ng content sa web na nasa maraming wika ang unang sinusuportahang wika mula sa listahang ito. Naka-sync ang mga kagustuhang ito sa iyong mga setting ng browser. <ph name="BEGIN_LINK_LEARN_MORE" />Matuto pa<ph name="END_LINK_LEARN_MORE" /></translation> <translation id="3886446263141354045">Ipinadala ang iyong kahilingang i-access ang site na ito kay <ph name="NAME" /></translation> <translation id="3888550877729210209">Nagtatala gamit ang <ph name="LOCK_SCREEN_APP_NAME" /></translation> <translation id="3890064827463908288">I-on ang Chrome Sync para gamitin ang Wi-Fi Sync</translation> @@ -4365,6 +4368,7 @@ <translation id="6112727384379533756">Magdagdag ng ticket</translation> <translation id="6112931163620622315">Tingnan ang iyong telepono</translation> <translation id="6112952769866305444">I-edit ang tao, <ph name="PROFILE_NAME" />, <ph name="USERNAME" /></translation> +<translation id="6113434369102685411">Itakda ang iyong default na search engine para sa Chrome browser at <ph name="DEVICE_TYPE" /> Launcher</translation> <translation id="6113942107547980621">Para gamitin ang Smart Lock, lumipat sa profile ng pangunahing user sa iyong telepono</translation> <translation id="6116921718742659598">Baguhin ang mga setting ng wika at input</translation> <translation id="6120205520491252677">I-pin ang pahinang ito screen ng Simula...</translation> @@ -5231,6 +5235,7 @@ <translation id="7140928199327930795">Walang ibang available na mga device.</translation> <translation id="7141105143012495934">Hindi nakapag-sign dahil hindi maibalik ang mga detalye ng iyong account. Mangyaring makipag-ugnayan sa iyong administrator o subukang muli.</translation> <translation id="7143207342074048698">Kumokonekta</translation> +<translation id="7143358760238281735">Walang available na app</translation> <translation id="7144878232160441200">Subukang muli</translation> <translation id="714876143603641390">Pagkakonekta sa Lan</translation> <translation id="7149893636342594995">Nakalipas na 24 na oras</translation> @@ -5702,6 +5707,7 @@ <translation id="7707922173985738739">Gumamit ng mobile data</translation> <translation id="7709152031285164251">Nabigo - <ph name="INTERRUPT_REASON" /></translation> <translation id="7710568461918838723">&Cast...</translation> +<translation id="7712739869553853093">Dialog ng preview ng pag-print</translation> <translation id="7712836429117959503">Hindi kilalang extension na may ID na <ph name="EXTENSION_ID" /></translation> <translation id="7714307061282548371">Pinapayagan ang cookies mula sa <ph name="DOMAIN" /></translation> <translation id="7714464543167945231">Certificate</translation> @@ -6605,6 +6611,7 @@ <translation id="8736288397686080465">Na-update ang site na ito sa background.</translation> <translation id="8737685506611670901">Buksan ang mga link ng <ph name="PROTOCOL" /> sa halip na ang <ph name="REPLACED_HANDLER_TITLE" /></translation> <translation id="8737709691285775803">Shill</translation> +<translation id="8740247629089392745">Puwede mong ibigay ang Chromebook na ito kay <ph name="SUPERVISED_USER_NAME" />. Malapit nang matapos ang pag-set up, puwede nang mag-explore pagkatapos nito.</translation> <translation id="8742998548129056176">Ito ay pangkalahatang impormasyon tungkol sa iyong device at kung paano mo ito ginagamit (gaya ng antas ng baterya, aktibidad ng system at app, at mga error). Gagamitin ang data para mapahusay ang Android, at makakatulong din ang ilang pinagsama-samang impormasyon sa mga app at partner ng Google, gaya ng mga developer ng Android, na mapahusay ang kanilang mga app at produkto.</translation> <translation id="8743390665131937741">Antas ng fullscreen na pag-zoom:</translation> <translation id="8743864605301774756">Na-update 1 oras ang nakalipas</translation>
diff --git a/chrome/app/resources/generated_resources_hy.xtb b/chrome/app/resources/generated_resources_hy.xtb index fa4be4e3..75708bc 100644 --- a/chrome/app/resources/generated_resources_hy.xtb +++ b/chrome/app/resources/generated_resources_hy.xtb
@@ -133,6 +133,7 @@ <translation id="1145292499998999162">Փլագինն արգելափակված է</translation> <translation id="1145593918056169051">Տպիչի աշխատանքն ընդհատվեց</translation> <translation id="114721135501989771">Google-ի տեխնոլոգիաներ Chrome-ում</translation> +<translation id="1147322039136785890">Այժմ <ph name="SUPERVISED_USER_NAME" />-ի հերթն է</translation> <translation id="1147991416141538220">Օգտագործելու թույլտվություն խնդրելու համար կապվեք այս սարքի ադմինիստրատորի հետ:</translation> <translation id="1149401351239820326">Ժամկետի սպառման ամիսը</translation> <translation id="1149725087019908252">«<ph name="FILE_NAME" />» ֆայլի ստուգում</translation> @@ -449,7 +450,7 @@ <translation id="1509281256533087115">Մուտք գործեք ցանկացած <ph name="DEVICE_NAME_AND_VENDOR" /> սարք USB-ի միջոցով</translation> <translation id="1509960214886564027">Շատ կայքերում գործառույթները կարող են չաշխատել։</translation> <translation id="1510238584712386396">Գործարկիչ</translation> -<translation id="151070646350206700">Կայքերը չեն ընդհատի ձեր աշխատանքը՝ ծանուցումներ ուղարկելու հարցումներով</translation> +<translation id="151070646350206700">Կայքերը չեն ընդհատի ձեր աշխատանքը ծանուցումներ ուղարկելու հարցումներով</translation> <translation id="1510785804673676069">Եթե դուք օգտվում եք միջնորդ սերվերից, ստուգեք նրա կարգավորումները կամ խնդրեք ցանցի ադմինիստրատորին կարգավորել այն: Եթե միջնորդ սերվեր չեք օգտագործում, կարգաբերեք ձեր @@ -2082,6 +2083,7 @@ <translation id="3428419049384081277">Դուք մուտք եք գործել</translation> <translation id="3428747202529429621">Ապահովում է ձեր անվտանգությունը Chrome-ում և Google հավելվածներում, երբ մտել եք ձեր հաշիվ</translation> <translation id="3428800329481094896">Բեռնվում են Լինուքսի կոնտեյների SSH բանալիները</translation> +<translation id="3429271624041785769">Վեբ բովանդակության լեզուներ</translation> <translation id="3429275422858276529">Էջանշեք այս կայքէջը՝ ավելի ուշ այն հեշտությամբ գտնելու համար</translation> <translation id="3432227430032737297">Հեռացնել բոլոր ցուցադրվածները</translation> <translation id="3432757130254800023">Ուղարկել աուդիո և վիդեո ֆայլերը տեղային ցանցի սարքերին</translation> @@ -2508,6 +2510,7 @@ <translation id="3879748587602334249">Ներբեռնման կառավարիչ</translation> <translation id="3881478300875776315">Ցույց տալ ավելի քիչ տողեր</translation> <translation id="3882165008614329320">Տեսանյութ տեսախցիկից կամ ֆայլից</translation> +<translation id="3884152383786131369">Տարբեր լեզուներով հասանելի վեբ բովանդակությունը կօգտագործի ցանկում նշված աջակցվող առաջին լեզուն։ Այս պարամետրերը համաժամացվում են ձեր դիտարկիչի կարգավորումների հետ։ <ph name="BEGIN_LINK_LEARN_MORE" />Իմանալ ավելին<ph name="END_LINK_LEARN_MORE" /></translation> <translation id="3886446263141354045">Այս կայք մուտք գործելու ձեր հարցումն ուղարկվել է <ph name="NAME" />-ին</translation> <translation id="3888550877729210209">Կատարեք նշումներ <ph name="LOCK_SCREEN_APP_NAME" />-ի միջոցով</translation> <translation id="3890064827463908288">Միացրեք Chrome Sync-ը՝ Wi-Fi համաժամացումն օգտագործելու համար։</translation> @@ -4369,6 +4372,7 @@ <translation id="6112727384379533756">Ավելացնել տոմս</translation> <translation id="6112931163620622315">Ստուգեք հեռախոսը</translation> <translation id="6112952769866305444">Փոփոխել պրոֆիլը <ph name="PROFILE_NAME" />, <ph name="USERNAME" /></translation> +<translation id="6113434369102685411">Ընտրեք կանխադրված որոնողական համակարգ Chrome դիտարկիչի և <ph name="DEVICE_TYPE" />-ի գործարկիչի համար</translation> <translation id="6113942107547980621">Smart Lock-ն օգտագործելու համար ձեր հեռախոսում անցեք հիմնական օգտատիրոջ պրոֆիլ</translation> <translation id="6116921718742659598">Փոխել լեզուն և ներածման կարգավորումները</translation> <translation id="6120205520491252677">Ամրացնել այս էջը մեկնարկի էկրանին…</translation> @@ -5235,6 +5239,7 @@ <translation id="7140928199327930795">Այլ մատչելի սարքեր չկան:</translation> <translation id="7141105143012495934">Մուտքը չհաջողվեց, քանի որ ձեր հաշվի տվյալները չհաջողվեց առբերել: Կապվեք ադմինիստրատորի հետ կամ նորից փորձեք:</translation> <translation id="7143207342074048698">Միացում</translation> +<translation id="7143358760238281735">Հավելվածներ չկան</translation> <translation id="7144878232160441200">Նորից փորձել</translation> <translation id="714876143603641390">LAN-ի կապ</translation> <translation id="7149893636342594995">Վերջին 24 ժամվա</translation> @@ -5706,6 +5711,7 @@ <translation id="7707922173985738739">Օգտագործել բջջային ինտերնետ</translation> <translation id="7709152031285164251">Չհաջողվեց՝ <ph name="INTERRUPT_REASON" /></translation> <translation id="7710568461918838723">&Հեռարձակել...</translation> +<translation id="7712739869553853093">Տպել նախադիտման պատուհանը</translation> <translation id="7712836429117959503"><ph name="EXTENSION_ID" /> ID-ով անհայտ ընդլայնում</translation> <translation id="7714307061282548371"><ph name="DOMAIN" /> կայքի քուքիները թույլատրված են</translation> <translation id="7714464543167945231">Վկայագիր</translation> @@ -6606,6 +6612,7 @@ <translation id="8736288397686080465">Այս կայքը թարմացվել է հետին պլանում:</translation> <translation id="8737685506611670901">Բացել <ph name="PROTOCOL" /> -ի հղումները <ph name="REPLACED_HANDLER_TITLE" />-ի փոխարեն</translation> <translation id="8737709691285775803">Shill</translation> +<translation id="8740247629089392745">Դուք կարող եք տալ այս Chromebook-ը <ph name="SUPERVISED_USER_NAME" />-ին։ Կարգավորումը գրեթե ավարտված է։ Սարքը շուտով պատրաստ կլինի օգտագործման։</translation> <translation id="8742998548129056176">Սրանք ընդհանուր տեղեկություններ են ձեր սարքի և դրա օգտագործման (օրինակ՝ մարտկոցի լիցքի, համակարգի ու հավելվածների օգտագործման և սխալների) մասին։ Տեղեկություններն օգտագործվելու են Android-ի ծառայությունների աշխատանքը բարելավելու համար։ Տվյալների մի մասը օգտակար կլինի մեր գործընկերների, օրինակ, Android ծրագրավորողների համար և կօգնի բարելավել նաև նրանց հավելվածներն ու արտադրանքները։</translation> <translation id="8743390665131937741">Լիաէկրան խոշորացույցի մասշտաբը՝</translation> <translation id="8743864605301774756">Թարմացվել է 1 ժամ առաջ</translation>
diff --git a/chrome/app/resources/generated_resources_iw.xtb b/chrome/app/resources/generated_resources_iw.xtb index 36991f0b..c4ae68f 100644 --- a/chrome/app/resources/generated_resources_iw.xtb +++ b/chrome/app/resources/generated_resources_iw.xtb
@@ -448,6 +448,7 @@ <translation id="1509281256533087115">גישה לכל מכשיר של <ph name="DEVICE_NAME_AND_VENDOR" /> באמצעות USB</translation> <translation id="1509960214886564027">ייתכן שהתכונות של חלק גדול מהאתרים לא יפעלו כראוי</translation> <translation id="1510238584712386396">מרכז האפליקציות</translation> +<translation id="151070646350206700">אתרים לא יכולים להפריע לך ולהציג בקשות לשליחת התראות</translation> <translation id="1510785804673676069">אם אתה משתמש בשרת proxy, בדוק את הגדרות שרת ה-proxy או צור קשר עם מנהל הרשת כדי לוודא ששרת ה-proxy פועל. אם אינך סבור שעליך להשתמש בשרת proxy, שנה את <ph name="LINK_START" />הגדרות שרת ה-proxy שלך<ph name="LINK_END" />.</translation> <translation id="1511997356770098059">אי אפשר לאחסן פרטי כניסה במפתח האבטחה הזה</translation> <translation id="1512210426710821809">הדרך היחידה לבטל את הפעולה זו היא להתקין מחדש את <ph name="IDS_SHORT_PRODUCT_OS_NAME" />.</translation> @@ -931,6 +932,7 @@ <translation id="205560151218727633">הלוגו של Google Assistant</translation> <translation id="2058456167109518507">אותר מכשיר</translation> <translation id="2059913712424898428">אזור זמן</translation> +<translation id="2060375639911876205">הסרת פרופיל של eSIM</translation> <translation id="2065405795449409761">Chrome נשלט על-ידי תוכנת בדיקה אוטומטית.</translation> <translation id="2071393345806050157">אין קובץ יומן מקומי.</translation> <translation id="2073148037220830746">{NUM_EXTENSIONS,plural, =1{יש ללחוץ כדי להתקין את התוסף}two{יש ללחוץ כדי להתקין את התוספים האלה}many{יש ללחוץ כדי להתקין את התוספים האלה}other{יש ללחוץ כדי להתקין את התוספים האלה}}</translation> @@ -2726,6 +2728,7 @@ <translation id="4131410914670010031">שחור ולבן</translation> <translation id="413193092008917129">תרחישים של אבחון רשת</translation> <translation id="4132183752438206707">חיפוש אפליקציות בחנות Google Play</translation> +<translation id="4132364317545104286">שינוי שם של פרופיל eSIM</translation> <translation id="4133076602192971179">כדי לשנות את הסיסמה, יש לפתוח את האפליקציה</translation> <translation id="4136203100490971508">תאורת הלילה תכבה באופן אוטומטי בשעת הזריחה</translation> <translation id="41365691917097717">בחירה להמשיך תגרום להפעלת ניפוי באגים באמצעות ADB במהלך היצירה והבדיקה של אפליקציות ל-Android. חשוב לשים לב שהפעולה הזו מאפשרת את ההתקנה של אפליקציות ל-Android שלא אומתו על ידי Google. כדי להשבית את התכונה, יש לאפס את המכשיר להגדרות המקוריות.</translation> @@ -3239,6 +3242,7 @@ <translation id="4778644898150334464">שימוש בסיסמה אחרת</translation> <translation id="4779083564647765204">מרחק מתצוגה</translation> <translation id="4779136857077979611">אוניגירי</translation> +<translation id="4779766576531456629">שינוי שם של הרשת הסלולרית של eSIM</translation> <translation id="4780321648949301421">שמירת הדף בשם...</translation> <translation id="4785719467058219317">בחרת להשתמש במפתח אבטחה שלא רשום עבור האתר הזה</translation> <translation id="4788092183367008521">כדאי לבדוק את החיבור לרשת ולנסות שוב.</translation> @@ -3682,6 +3686,7 @@ <translation id="5324780743567488672">היעזרות במיקום להגדרה אוטומטית של אזור הזמן</translation> <translation id="5327248766486351172">שם</translation> <translation id="5327570636534774768">המכשיר הזה מסומן כמנוהל על ידי דומיין אחר. צריך לבטל את ניהול התצורה שלו מהדומיין הזה לפני ההגדרה של מצב ההדגמה.</translation> +<translation id="5327912693242073631">תכונות שצריכות התראות לא יפעלו</translation> <translation id="532943162177641444">הקש על ההודעה בטלפון <ph name="PHONE_NAME" /> כדי להגדיר את הנקודה לשיתוף אינטרנט בנייד שבה המכשיר הזה יכול להשתמש.</translation> <translation id="5329858601952122676">&מחיקה</translation> <translation id="5331069282670671859">אין לך אישורים בקטגוריה הזו</translation> @@ -3733,6 +3738,7 @@ <translation id="5390112241331447203">הכללה של הקובץ system_logs.txt שנשלח בדוחות המשוב.</translation> <translation id="5390677308841849479">אדום כהה וכתום</translation> <translation id="5390743329570580756">שלח עבור</translation> +<translation id="5392192690789334093">מורשים לשלוח התראות</translation> <translation id="5397794290049113714">אתה</translation> <translation id="5398497406011404839">סימניות מוסתרות</translation> <translation id="5398572795982417028">התייחסות לדף מחוץ לטווח, המגבלה היא <ph name="MAXIMUM_PAGE" /></translation> @@ -4035,6 +4041,7 @@ <translation id="5739235828260127894">בהמתנה לאימות. <ph name="LINK_BEGIN" />מידע נוסף<ph name="LINK_END" /></translation> <translation id="5739458112391494395">גדול מאוד</translation> <translation id="5740328398383587084">שיתוף בקרבת מקום</translation> +<translation id="5740820643029013514">שימוש במצב שקט יותר של העברת הודעות (מומלץ)</translation> <translation id="574104302965107104">שיקוף מסך</translation> <translation id="574209121243317957">גובה צליל</translation> <translation id="5746169159649715125">שמור כקובץ PDF</translation> @@ -4254,6 +4261,7 @@ <translation id="6002210667729577411">העברת הקבוצה לחלון חדש</translation> <translation id="6002452033851752583">הסיסמה נמחקה מחשבון Google שלך</translation> <translation id="6002458620803359783">קולות מועדפים</translation> +<translation id="6003143259071779217">הסרת הרשת הסלולרית של eSIM</translation> <translation id="6006484371116297560">קלאסי</translation> <translation id="6007240208646052708">לא ניתן לבצע חיפוש קולי בשפה שלך.</translation> <translation id="6009781704028455063">חיישן מובנה</translation> @@ -4522,6 +4530,7 @@ <translation id="6308937455967653460">שמור קישור& בשם...</translation> <translation id="6309443618838462258">שיטת הקלט הזו לא מאושרת על ידי מנהל המערכת</translation> <translation id="6309510305002439352">המיקרופון מושבת</translation> +<translation id="6310472381159916879">הסרת הפרופיל</translation> <translation id="6311220991371174222">לא ניתן להפעיל את Chrome מכיוון שמשהו השתבש בפתיחת הפרופיל שלך. יש לנסות להפעיל מחדש את Chrome.</translation> <translation id="6312403991423642364">שגיאת רשת לא ידועה</translation> <translation id="6312567056350025599">{NUM_DAYS,plural, =1{בדיקת הבטיחות פעלה לפני יום אחד}two{בדיקת הבטיחות פעלה לפני {NUM_DAYS} ימים}many{בדיקת הבטיחות פעלה לפני {NUM_DAYS} ימים}other{בדיקת הבטיחות פעלה לפני {NUM_DAYS} ימים}}</translation> @@ -4711,6 +4720,7 @@ <translation id="6532663472409656417">רשום בארגון</translation> <translation id="6535331821390304775">תמיד יש לאפשר ל-<ph name="ORIGIN" /> לפתוח קישורים מהסוג הזה באפליקציה המשויכת להם</translation> <translation id="6537613839935722475">שם יכול לכלול אותיות, מספרים ומקפים (-)</translation> +<translation id="6537880577641744343">Commander</translation> <translation id="6538635548667167211">ההגדרה הנוכחית של השימוש בחבילת הגלישה היא 'נתונים'</translation> <translation id="654039047105555694"><ph name="BEGIN_BOLD" />הערה:<ph name="END_BOLD" /> הפעל אפשרות זו רק אם אתה בטוח בכך, או אם התבקשת לעשות זאת, משום שאיסוף נתונים עלול לפגוע בביצועים.</translation> <translation id="6541638731489116978">גישת האתר לחיישני תנועה נחסמה.</translation> @@ -5841,6 +5851,7 @@ <translation id="7855678561139483478">העברת כרטיסייה לחלון חדש</translation> <translation id="7857117644404132472">להוספת מקרה חריג</translation> <translation id="7857949311770343000">האם זהו דף הכרטיסייה החדשה שציפית לראות?</translation> +<translation id="7858328180167661092"><ph name="APP_NAME" /> (Windows)</translation> <translation id="785948723952233770">לא תהיה תמיכה באפשרות הזו אחרי דצמבר. עליך לפנות למנהל המערכת שלך.</translation> <translation id="786073089922909430">שירות: <ph name="ARC_PROCESS_NAME" /></translation> <translation id="7861215335140947162">&הורדות</translation> @@ -6165,6 +6176,7 @@ <translation id="8236917170563564587">שיתוף הכרטיסייה הזו</translation> <translation id="8237647586961940482">ורוד כהה ואדום</translation> <translation id="8239032431519548577">ההרשמה ל-Enterprise הושלמה</translation> +<translation id="8239932336306009582">לא מורשים לשלוח התראות</translation> <translation id="8241040075392580210">מוצל</translation> <translation id="8241806945692107836">קביעת תצורת המכשיר...</translation> <translation id="8241868517363889229">לקרוא ולשנות את הסימניות שלך</translation> @@ -6294,6 +6306,7 @@ <translation id="8386091599636877289">המדיניות לא נמצאה.</translation> <translation id="8386903983509584791">הסריקה הושלמה</translation> <translation id="8387361103813440603">לא מורשים לראות את המיקום</translation> +<translation id="8389264703141926739">חסימת התראות</translation> <translation id="8389416080014625855">יצירת קוד QR לדף הזה</translation> <translation id="8389492867173948260">מתן הרשאה לתוסף הזה לקרוא ולשנות את כל הנתונים שלך באתרים שאליהם נכנסת:</translation> <translation id="8390449457866780408">השרת אינו זמין.</translation> @@ -6503,6 +6516,7 @@ <translation id="8645354835496065562">המשך התרת הגישה לחיישנים</translation> <translation id="8645920082661222035">המערכת חוזה אירועים מסוכנים ומזהירה אותך לגביהם לפני שהם מתרחשים</translation> <translation id="8646209145740351125">השבתת סנכרון</translation> +<translation id="864637694230589560">בדרך כלל, אתרים שולחים התראות כדי לאפשר לך להתעדכן במבזקי החדשות או לקבל הודעות בצ'אט</translation> <translation id="8647834505253004544">כתובת האינטרנט לא חוקית</translation> <translation id="8648252583955599667"><ph name="GET_HELP_LINK" /> או <ph name="RE_SCAN_LINK" /></translation> <translation id="8648408795949963811">טמפרטורת הצבע של תאורת לילה</translation>
diff --git a/chrome/app/resources/generated_resources_mn.xtb b/chrome/app/resources/generated_resources_mn.xtb index f26d6528..29a2dce 100644 --- a/chrome/app/resources/generated_resources_mn.xtb +++ b/chrome/app/resources/generated_resources_mn.xtb
@@ -3193,7 +3193,7 @@ <translation id="4708794300267213770">Унтаад сэрэх үед дэлгэцийн түгжээг харуулах</translation> <translation id="4708849949179781599"><ph name="PRODUCT_NAME" />-аас гарах</translation> <translation id="4711638718396952945">Тохиргоог дахин сэргээх</translation> -<translation id="4716483597559580346">Хамгаалалтыг сайжруулахын тулд үйлдвэрийн тохиргоонд нь буцааж оруулах</translation> +<translation id="4716483597559580346">Хамгаалалтыг сайжруулахын тулд powerwash хийх</translation> <translation id="471880041731876836">Танд энэ сайтад зочлох зөвшөөрөл алга</translation> <translation id="4720113199587244118">Төхөөрөмжүүд нэмэх</translation> <translation id="4720185134442950733">Мобайл дата сүлжээ</translation> @@ -4126,7 +4126,7 @@ <translation id="5849570051105887917">Нүүр хуудас бэлтгэх код</translation> <translation id="5851868085455377790">Сертификатыг олгосон</translation> <translation id="5852112051279473187">Өө! Энэ төхөөрөмжийг оруулж байх үед ямар нэг зүйл ажиллахаа больсон байна. Дахин оролдож үзэх эсвэл өөрийн тусламж үзүүлэх төлөөлөгчтэй холбоо барина уу.</translation> -<translation id="5852137567692933493">Дахин асаах эсвэл үйлдвэрийн тохиргоонд нь буцааж оруулах</translation> +<translation id="5852137567692933493">Дахин асаах эсвэл powerwash хийх</translation> <translation id="5854912040170951372">Slice</translation> <translation id="5855267860608268405">Мэдэгдэж байгаа Wi-Fi сүлжээнүүд</translation> <translation id="5855643921295613558">0.6 секунд</translation> @@ -5811,7 +5811,7 @@ <ph name="LIST_ITEM" />Хөгжүүлэгч болон системийн үндсэн нэвтрэлтийн нууц үгийг захиалгат утгад тохируулснаар та төхөөрөмжид гар аргаар SSH болно <ph name="END_LIST" /> <ph name="BR" /> - Идэвхжүүлснээр байгууллагын удирддаг төхөөрөмжийг үйлдвэрийн тохиргоонд нь буцааж оруулах эсвэл өгөгдлийг нь арчсан ч гэсэн алдаа засах ихэнх онцлог идэвхтэй хэвээр байх болно. Алдаа засах онцлогийг бүхэлд нь идэвхгүй болгохын тулд Chrome үйлдлийн системийн сэргээх үйл явцыг (https://support.google.com/chromebook/answer/1080595)-д дуусгана уу. + Идэвхжүүлснээр байгууллагын удирддаг төхөөрөмжийг powerwash хийх эсвэл өгөгдлийг нь арчсан ч гэсэн алдаа засах ихэнх онцлог идэвхтэй хэвээр байх болно. Алдаа засах онцлогийг бүхэлд нь идэвхгүй болгохын тулд Chrome үйлдлийн системийн сэргээх үйл явцыг (https://support.google.com/chromebook/answer/1080595)-д дуусгана уу. <ph name="BR" /> <ph name="BR" /> Алдаа засах онцлогийн талаар нэмэлт мэдээлэл авахын тулд дараахыг харна уу:<ph name="BR" />
diff --git a/chrome/app/resources/generated_resources_si.xtb b/chrome/app/resources/generated_resources_si.xtb index 9d913cb6..35499ac 100644 --- a/chrome/app/resources/generated_resources_si.xtb +++ b/chrome/app/resources/generated_resources_si.xtb
@@ -133,6 +133,7 @@ <translation id="1145292499998999162">ප්ලගින අවහිර කරන ලදී</translation> <translation id="1145593918056169051">මුද්රකය නැවතී ඇත</translation> <translation id="114721135501989771">Chromeවල Google ස්මාට් ගන්න</translation> +<translation id="1147322039136785890">දැන් <ph name="SUPERVISED_USER_NAME" />ගේ වාරයයි</translation> <translation id="1147991416141538220">ප්රවේශය ඉල්ලීමට, මෙම උපාංගයේ පරිපාලකයා සම්බන්ධ කර ගන්න.</translation> <translation id="1149401351239820326">කල් ඉකුත් වන මාසය</translation> <translation id="1149725087019908252"><ph name="FILE_NAME" /> ස්කෑන් කිරීම</translation> @@ -2078,6 +2079,7 @@ <translation id="3428419049384081277">ඔබ පුරනය වී ඇත!</translation> <translation id="3428747202529429621">ඔබ පුරනය වී සිටින විට Chrome මත ඔබව ආරක්ෂිතව තබා ගන්නා අතර සහ අනෙකුත් Google යෙදුම් තුළ ඔබේ ආරක්ෂාව වැඩිදියුණු කිරීමට භාවිත කළ හැක</translation> <translation id="3428800329481094896">ලිනක්ස් භාජන ssh යතුරු ලබා ගැනීම</translation> +<translation id="3429271624041785769">වෙබ් අන්තර්ගත භාෂා</translation> <translation id="3429275422858276529">පහසුවෙන් පසුව සොයා ගැනීමට මෙම පිටුව පිටුසන් කරන්න</translation> <translation id="3432227430032737297">පෙන්වන සියල්ල ඉවත් කරන්න</translation> <translation id="3432757130254800023">පෙදෙසි ජාලයේ ඇති දර්ශක වෙත ශ්රව්ය සහ වීඩියෝ යවන්න</translation> @@ -2505,6 +2507,7 @@ <translation id="3879748587602334249">බාගැනීමේ කළමනාකරු</translation> <translation id="3881478300875776315">පේළි අඩුවෙන් පෙන්වන්න</translation> <translation id="3882165008614329320">කැමරාවෙන් හෝ ගොනුවෙන් පවතින වීඩියෝව</translation> +<translation id="3884152383786131369">භාෂා කිහිපයකින් ලබා ගත හැකි වෙබ් අන්තර්ගතය මෙම ලැයිස්තුවෙන් පළමු සහාය දක්වන භාෂාව භාවිත කරයි. මෙම මනාප ඔබගේ බ්රව්සර සැකසීම් සමඟ සමමුහුර්ත කර ඇත. <ph name="BEGIN_LINK_LEARN_MORE" />තව දැන ගන්න<ph name="END_LINK_LEARN_MORE" /></translation> <translation id="3886446263141354045">මෙම අඩවියට පිවිසීමට ඔබ කළ ඉල්ලීම <ph name="NAME" /> වෙත යවන ලදී</translation> <translation id="3888550877729210209"><ph name="LOCK_SCREEN_APP_NAME" /> සමඟ සටහන් ගැනීම</translation> <translation id="3890064827463908288">Wi-Fi සමමුහුර්තකරණය භාවිත කිරීමට Chrome සමමුහුර්තකරණය ක්රියාත්මක කරන්න</translation> @@ -4364,6 +4367,7 @@ <translation id="6112727384379533756">ප්රවේශපත්රයක් එක් කරන්න</translation> <translation id="6112931163620622315">ඔබේ දුරකථනය පරික්ෂා කරන්න</translation> <translation id="6112952769866305444">පුද්ගලයා සංස්කරණය කරන්න, <ph name="PROFILE_NAME" />, <ph name="USERNAME" /></translation> +<translation id="6113434369102685411">Chrome බ්රව්සරය සහ <ph name="DEVICE_TYPE" /> දියත්කරණය සඳහා ඔබගේ පෙරනිමි සෙවුම් යන්ත්රය සකසන්න</translation> <translation id="6113942107547980621">ස්මාර්ට් අගුල භාවිත කිරීමට, ඔබේ දුරකථනයේ ප්රාථමික පරිශීලක පැතිකඩට මාරු කරන්න</translation> <translation id="6116921718742659598">භාශාව හා ආදාන සැකසුම් වෙනස් කරන්න</translation> <translation id="6120205520491252677">මෙම පිටුව ආරම්භක තිරයට අමුණන්න...</translation> @@ -5228,6 +5232,7 @@ <translation id="7140928199327930795">වෙනත් උපාංග නොමැත.</translation> <translation id="7141105143012495934">ඔබේ ගිණුම් විස්තර යළි ලබා ගැනීමට නොහැකි වූ බැවින් පිරීම අසාර්ථකයි. කරුණාකර ඔබගේ පරිපාලක අමතන්න නැතහොත් නැවත උත්සාහ කරන්න.</translation> <translation id="7143207342074048698">සම්බන්ධ වෙමින්…</translation> +<translation id="7143358760238281735">ලබා ගත හැකි යෙදුම් නැත</translation> <translation id="7144878232160441200">නැවත උත්සහ කරන්න</translation> <translation id="714876143603641390">LAN සබැඳුම් හැකියාව</translation> <translation id="7149893636342594995">පසුගිය පැය 24</translation> @@ -5699,6 +5704,7 @@ <translation id="7707922173985738739">ජංගම දත්ත භාවිත කරන්න</translation> <translation id="7709152031285164251">අසාර්ථකයි - <ph name="INTERRUPT_REASON" /></translation> <translation id="7710568461918838723">&විකාශය...</translation> +<translation id="7712739869553853093">මුද්රණ පෙරදසුන අසාර්ථක විය</translation> <translation id="7712836429117959503">ID <ph name="EXTENSION_ID" /> සමඟ නොදන්නා දිගුවක්</translation> <translation id="7714307061282548371"><ph name="DOMAIN" /> වෙතින් කුකීවලට ඉඩ දෙන ලදී</translation> <translation id="7714464543167945231">සහතිකය</translation> @@ -6599,6 +6605,7 @@ <translation id="8736288397686080465">මෙම අඩවිය පසුබිමේ යාවත්කාලීන කර ඇත.</translation> <translation id="8737685506611670901"><ph name="REPLACED_HANDLER_TITLE" /> වෙනුවට <ph name="PROTOCOL" /> සබැඳිය විවෘත කරන්න</translation> <translation id="8737709691285775803">ශිල්</translation> +<translation id="8740247629089392745">ඔබට මෙම Chromebook <ph name="SUPERVISED_USER_NAME" /> වෙත භාර දිය හැකිය. පිහිටුවීම දැනටමත් නිමයි, එසේ නම් එය ගවේෂණය කිරීමට වේලාවයි.</translation> <translation id="8742998548129056176">මේ (බැටරි මට්ටම, පද්ධති සහ යෙදුම් ක්රියාකාරකම්, සහ දෝෂ වැනි) ඔබේ උපාංගය සහ ඔබ එය භාවිත කරන ආකාරය පිළිබඳ සාමාන්ය තොරතුරු වෙයි. Android වැඩි දියුණු කිරීමට දත්ත භාවිත කරන අතර සමහර රැස් කළ තොරතුරු Google යෙදුම් සහ Android සංවර්ධකයන් වැනි, හවුල්කරුවන්ට ඔවුන්ගේ යෙදුම් සහ නිෂ්පාදන වඩා යහපත් කිරීමට ද උදවු කරයි.</translation> <translation id="8743390665131937741">පූර්ණ තිර විශාලන මට්ටම:</translation> <translation id="8743864605301774756">පැය 1කට පෙර යාවත්කාලීනයි</translation>
diff --git a/chrome/app/resources/generated_resources_tr.xtb b/chrome/app/resources/generated_resources_tr.xtb index 3d2050f..bf7650c 100644 --- a/chrome/app/resources/generated_resources_tr.xtb +++ b/chrome/app/resources/generated_resources_tr.xtb
@@ -448,6 +448,7 @@ <translation id="1509281256533087115">USB üzerinden herhangi bir <ph name="DEVICE_NAME_AND_VENDOR" /> cihazına erişme</translation> <translation id="1509960214886564027">Birçok sitedeki özellikler bozulabilir</translation> <translation id="1510238584712386396">Başlatıcı</translation> +<translation id="151070646350206700">Siteler bildirim gönderme isteğinde bulunarak işinizi bölemez</translation> <translation id="1510785804673676069">Bir proxy sunucusu kullanıyorsanız, proxy ayarlarınızı kontrol edin veya proxy sunucunuzun çalıştığını kontrol etmek için ağ yöneticinize başvurun. Bir proxy sunucusu kullanmanız gerekmediğini @@ -934,6 +935,7 @@ <translation id="205560151218727633">Google Asistan logosu</translation> <translation id="2058456167109518507">Cihaz algılandı</translation> <translation id="2059913712424898428">Saat dilimi</translation> +<translation id="2060375639911876205">eSIM profilini kaldır</translation> <translation id="2065405795449409761">Chrome otomatik test yazılımı tarafından kontrol ediliyor.</translation> <translation id="2071393345806050157">Yerel günlük dosyası yok.</translation> <translation id="2073148037220830746">{NUM_EXTENSIONS,plural, =1{Uzantıyı yüklemek için tıklayın}other{Bu uzantıları yüklemek için tıklayın}}</translation> @@ -2728,6 +2730,7 @@ <translation id="4131410914670010031">Siyah beyaz</translation> <translation id="413193092008917129">Ağ Teşhis Rutinleri</translation> <translation id="4132183752438206707">Aradığınız uygulamalar Google Play Store'da</translation> +<translation id="4132364317545104286">eSIM profilini yeniden adlandır</translation> <translation id="4133076602192971179">Şifrenizi değiştirmek için uygulamayı açın</translation> <translation id="4136203100490971508">Gece Işığı güneş doğduğunda otomatik olarak kapatılır</translation> <translation id="41365691917097717">Devam edilirse ADB hata ayıklama işlevi, Android uygulaması oluşturmak ve test etmek için etkinleştirilir. Bu işlemin Google tarafından doğrulanmamış Android uygulamalarının yüklenmesine izin verdiğini, fabrika ayarlarına sıfırlama işlemi yapılmadan devre dışı bırakılamayacağını unutmayın.</translation> @@ -3241,6 +3244,7 @@ <translation id="4778644898150334464">Başka şifre kullan</translation> <translation id="4779083564647765204">Yakınlaştır</translation> <translation id="4779136857077979611">Onigiri</translation> +<translation id="4779766576531456629">eSIM Hücresel ağını yeniden adlandır</translation> <translation id="4780321648949301421">Sayfayı Farklı Kaydet...</translation> <translation id="4785719467058219317">Bu web sitesine kaydettirilmemiş bir anahtar kullanıyorsunuz</translation> <translation id="4788092183367008521">Lütfen ağ bağlantınızı kontrol edin ve tekrar deneyin.</translation> @@ -3684,6 +3688,7 @@ <translation id="5324780743567488672">Konumumu kullanarak saat dilimini otomatik olarak ayarla</translation> <translation id="5327248766486351172">Ad</translation> <translation id="5327570636534774768">Bu cihaz farklı bir alan adı tarafından yönetim için işaretlendi. Demo modunu kurmadan önce cihazın söz konusu alan adından yetkilendirmesini kaldırın.</translation> +<translation id="5327912693242073631">Bildirimlerin kullanılmasını gerektiren özellikler çalışmaz</translation> <translation id="532943162177641444">Bu cihaz tarafından kullanılabilecek mobil hotspot'u ayarlamak için <ph name="PHONE_NAME" /> telefonunuzdaki bildirime dokunun.</translation> <translation id="5329858601952122676">&Sil</translation> <translation id="5331069282670671859">Bu kategoride hiç sertifikanız yok</translation> @@ -3735,6 +3740,7 @@ <translation id="5390112241331447203">Geri bildirim raporlarında gönderilen system_logs.txt dosyasını dahil et.</translation> <translation id="5390677308841849479">Koyu kırmızı ve turuncu</translation> <translation id="5390743329570580756">Gönder</translation> +<translation id="5392192690789334093">Bildirim göndermesine izin verilen siteler</translation> <translation id="5397794290049113714">Siz</translation> <translation id="5398497406011404839">Gizli yer işaretleri</translation> <translation id="5398572795982417028">Sınırların dışında sayfa referansı. Sınır: <ph name="MAXIMUM_PAGE" /></translation> @@ -4038,6 +4044,7 @@ <translation id="5739235828260127894">Doğrulama bekleniyor. <ph name="LINK_BEGIN" />Daha fazla bilgi<ph name="LINK_END" /></translation> <translation id="5739458112391494395">Çok büyük</translation> <translation id="5740328398383587084">Yakındakilerle Paylaş</translation> +<translation id="5740820643029013514">Sessiz mesajlaşmayı kullan (önerilir)</translation> <translation id="574104302965107104">Ekran yansıtma</translation> <translation id="574209121243317957">Ses Kalınlığı</translation> <translation id="5746169159649715125">PDF olarak kaydet</translation> @@ -4257,6 +4264,7 @@ <translation id="6002210667729577411">Grubu yeni pencereye taşı</translation> <translation id="6002452033851752583">Şifre Google Hesabınızdan silindi</translation> <translation id="6002458620803359783">Tercih Edilen Sesler</translation> +<translation id="6003143259071779217">eSIM Hücresel ağını kaldır</translation> <translation id="6006484371116297560">Klasik</translation> <translation id="6007240208646052708">Sesli arama özelliği dilinizde kullanılamaz.</translation> <translation id="6009781704028455063">Yerleşik sensör</translation> @@ -4525,6 +4533,7 @@ <translation id="6308937455967653460">Bağlantıyı far&klı kaydet...</translation> <translation id="6309443618838462258">Yöneticiniz bu giriş yöntemine izin vermiyor</translation> <translation id="6309510305002439352">Mikrofon kapalı</translation> +<translation id="6310472381159916879">Profili kaldır</translation> <translation id="6311220991371174222">Profiliniz açılırken bir sorun oluştuğundan Chrome başlatılamıyor. Chrome'u yeniden başlatmayı deneyin.</translation> <translation id="6312403991423642364">Bilinmeyen ağ hatası</translation> <translation id="6312567056350025599">{NUM_DAYS,plural, =1{Güvenlik kontrolü 1 gün önce çalıştırıldı}other{Güvenlik kontrolü {NUM_DAYS} gün önce çalıştırıldı}}</translation> @@ -4714,6 +4723,7 @@ <translation id="6532663472409656417">Kurumsal Olarak Kayıtlı</translation> <translation id="6535331821390304775">Bu tür bağlantıları ilişkilendirilmiş uygulamada açması için <ph name="ORIGIN" /> sitesine her zaman izin ver</translation> <translation id="6537613839935722475">Ad harf, sayı ve kısa çizgi (-) içerebilir</translation> +<translation id="6537880577641744343">Commander</translation> <translation id="6538635548667167211">Mevcut veri kullanımı, Mobil Veri olarak ayarlı</translation> <translation id="654039047105555694"><ph name="BEGIN_BOLD" />Not:<ph name="END_BOLD" /> Veri toplama işlemi performansı düşürebileceğinden sadece etkinleştirmenin sonuçlarını biliyorsanız veya etkinleştirmeniz istenmişse bunu yapın.</translation> <translation id="6541638731489116978">Bu sitenin, hareket sensörlerinize erişimi engellenmiştir.</translation> @@ -5844,6 +5854,7 @@ <translation id="7855678561139483478">Sekmeyi yeni pencereye taşı</translation> <translation id="7857117644404132472">İstisna ekle</translation> <translation id="7857949311770343000">Bu, beklediğiniz yeni sekme sayfası mı?</translation> +<translation id="7858328180167661092"><ph name="APP_NAME" /> (Windows)</translation> <translation id="785948723952233770">Bu seçenek, Aralık ayından sonra desteklenmeyecektir. Yöneticinizle iletişime geçin.</translation> <translation id="786073089922909430">Hizmet: <ph name="ARC_PROCESS_NAME" /></translation> <translation id="7861215335140947162">&İndirilenler</translation> @@ -6166,6 +6177,7 @@ <translation id="8236917170563564587">Onun yerine bu sekmeyi paylaş</translation> <translation id="8237647586961940482">Koyu pembe ve kırmızı</translation> <translation id="8239032431519548577">Kurumsal kayıt tamamlandı</translation> +<translation id="8239932336306009582">Bildirim göndermesine izin verilmeyen siteler</translation> <translation id="8241040075392580210">Parçalı Bulutlu</translation> <translation id="8241806945692107836">Cihaz yapılandırması belirleniyor...</translation> <translation id="8241868517363889229">Yer işaretlerinizi okuma ve değiştirme</translation> @@ -6295,6 +6307,7 @@ <translation id="8386091599636877289">Politika bulunamadı.</translation> <translation id="8386903983509584791">Tarama tamamlandı</translation> <translation id="8387361103813440603">Konumunuzu görmesine izin verilmeyen siteler</translation> +<translation id="8389264703141926739">Bildirimleri engelle</translation> <translation id="8389416080014625855">Bu Sayfa için QR kodu oluştur</translation> <translation id="8389492867173948260">Bu uzantının ziyaret ettiğiniz web sitelerindeki tüm verilerinizi okuması ve değiştirmesine izin verin:</translation> <translation id="8390449457866780408">Sunucu kullanılamıyor.</translation> @@ -6504,6 +6517,7 @@ <translation id="8645354835496065562">Sensör erişimine izin vermeye devam et</translation> <translation id="8645920082661222035">Tehlikeli etkinlikleri meydana gelmeden önce tahmin ederek sizi uyarır</translation> <translation id="8646209145740351125">Senkronizasyonu devre dışı bırak</translation> +<translation id="864637694230589560">Siteler genellikle son dakika haberleri veya sohbet mesajları konusunda sizi bilgilendirmek için bildirim gönderir</translation> <translation id="8647834505253004544">Geçerli bir web adresi değil</translation> <translation id="8648252583955599667"><ph name="GET_HELP_LINK" /> veya <ph name="RE_SCAN_LINK" /></translation> <translation id="8648408795949963811">Gece Işığı renk sıcaklığı</translation>
diff --git a/chrome/app/resources/generated_resources_vi.xtb b/chrome/app/resources/generated_resources_vi.xtb index 87060fb..60b8640 100644 --- a/chrome/app/resources/generated_resources_vi.xtb +++ b/chrome/app/resources/generated_resources_vi.xtb
@@ -448,7 +448,7 @@ <translation id="1509281256533087115">Truy cập mọi <ph name="DEVICE_NAME_AND_VENDOR" /> qua USB</translation> <translation id="1509960214886564027">Các tính năng trên nhiều trang web có thể hoạt động không đúng cách</translation> <translation id="1510238584712386396">Trình chạy</translation> -<translation id="151070646350206700">Trang web không được phép làm phiền bạn bằng cách đề nghị gửi thông báo</translation> +<translation id="151070646350206700">Các trang web không thể làm phiền bạn bằng cách đề nghị gửi thông báo</translation> <translation id="1510785804673676069">Nếu bạn sử dụng máy chủ proxy, hãy kiểm tra cài đặt proxy của bạn hoặc liên hệ với quản trị viên mạng để kiểm tra xem máy chủ proxy có đang hoạt động không. Nếu bạn cho rằng mình không cần sử dụng @@ -3244,7 +3244,7 @@ <translation id="4778644898150334464">Dùng mật khẩu khác</translation> <translation id="4779083564647765204">Thu phóng</translation> <translation id="4779136857077979611">Cơm nắm Onigiri</translation> -<translation id="4779766576531456629">Đổi tên mạng di động eSIM</translation> +<translation id="4779766576531456629">Đổi tên mạng di động của eSIM</translation> <translation id="4780321648949301421">Lưu trang làm...</translation> <translation id="4785719467058219317">Bạn đang sử dụng một khóa bảo mật chưa đăng ký với trang web này</translation> <translation id="4788092183367008521">Vui lòng kiểm tra kết nối mạng và thử lại.</translation> @@ -4043,7 +4043,7 @@ <translation id="5739235828260127894">Đang chờ xác minh. <ph name="LINK_BEGIN" />Tìm hiểu thêm<ph name="LINK_END" /></translation> <translation id="5739458112391494395">Rất lớn</translation> <translation id="5740328398383587084">Chia sẻ lân cận</translation> -<translation id="5740820643029013514">Dùng thông báo nhẹ nhàng hơn (khuyên dùng)</translation> +<translation id="5740820643029013514">Dùng thông báo yên tĩnh hơn (khuyên dùng)</translation> <translation id="574104302965107104">Phản chiếu màn hình</translation> <translation id="574209121243317957">Cao độ</translation> <translation id="5746169159649715125">Lưu dưới dạng PDF</translation> @@ -4263,7 +4263,7 @@ <translation id="6002210667729577411">Di chuyển nhóm sang cửa sổ mới</translation> <translation id="6002452033851752583">Đã xóa mật khẩu khỏi Tài khoản Google của bạn</translation> <translation id="6002458620803359783">Giọng nói ưu tiên</translation> -<translation id="6003143259071779217">Xóa mạng di động eSIM</translation> +<translation id="6003143259071779217">Xóa mạng di động của eSIM</translation> <translation id="6006484371116297560">Cổ điển</translation> <translation id="6007240208646052708">Chưa có dịch vụ tìm kiếm bằng giọng nói cho ngôn ngữ của bạn.</translation> <translation id="6009781704028455063">Cảm biến tích hợp</translation>
diff --git a/chrome/app/resources/generated_resources_zh-TW.xtb b/chrome/app/resources/generated_resources_zh-TW.xtb index 1cde4b6f..b283d59 100644 --- a/chrome/app/resources/generated_resources_zh-TW.xtb +++ b/chrome/app/resources/generated_resources_zh-TW.xtb
@@ -448,7 +448,7 @@ <translation id="1509281256533087115">透過 USB 存取任何 <ph name="DEVICE_NAME_AND_VENDOR" /></translation> <translation id="1509960214886564027">許多網站的功能可能無法正常運作</translation> <translation id="1510238584712386396">啟動器</translation> -<translation id="151070646350206700">網站無法要求傳送通知,以免對你造成干擾</translation> +<translation id="151070646350206700">網站傳送的通知不會打擾使用者</translation> <translation id="1510785804673676069">如果你使用 Proxy 伺服器,請檢查你的 Proxy 設定或 與網路管理員聯絡,確認 Proxy 伺服器是否運作正 常。如果你不是使用 Proxy 伺服器,請調整你的
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index c63ae9b9..4e2b66cc 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -922,9 +922,6 @@ <message name="IDS_SETTINGS_CLEAR_COOKIES" desc="Checkbox for deleting Cookies and other site data"> Cookies and other site data </message> - <message name="IDS_SETTINGS_CLEAR_COOKIES_FLASH" desc="Checkbox for deleting Cookies and other site data"> - Cookies and other site and plugin data - </message> <message name="IDS_SETTINGS_CLEAR_PASSWORDS" desc="Checkbox for deleting Passwords and other sign-in data"> Passwords and other sign-in data </message> @@ -1878,21 +1875,6 @@ <message name="IDS_SETTINGS_SITE_SETTINGS_PAYMENT_HANDLERS_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the payment handlers content setting."> Not allowed to install payment handlers </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_DESCRIPTION" desc="Description of the Flash content setting."> - Sites usually use Flash to play audio, video, or video games. Flash Player will no longer be supported after December 2020. - </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED" desc="Label for the enabled option of the Flash content setting."> - Sites can ask to use Flash - </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED" desc="Label for the disabled option of the Flash content setting."> - Block Flash (recommended) - </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the Flash content setting."> - Allowed to use Flash - </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the Flash content setting."> - Not allowed to use Flash - </message> <message name="IDS_SETTINGS_SITE_SETTINGS_POPUPS_DESCRIPTION" desc="Description of the pop-ups content setting."> Sites might send pop-ups to show ads, or use redirects to lead you to websites you may not want to visit </message> @@ -2148,9 +2130,6 @@ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT" desc="Label for the javascript site settings."> JavaScript </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH" desc="Label for the Flash site settings."> - Flash - </message> <message name="IDS_SETTINGS_SITE_SETTINGS_PAYMENT_HANDLER" desc="Label for the payment handler site settings."> Payment Handlers </message> @@ -2354,21 +2333,6 @@ <message name="IDS_SETTINGS_SITE_SETTINGS_COOKIES_ALLOW_SITES_RECOMMENDED" desc="The 'allow cookies' label in site settings -- the recommended setting for when sites want to read/write cookie information."> Allow sites to save and read cookie data (recommended) </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCK" desc="The 'block' label for Flash in site settings."> - Block sites from running Flash - </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCK_RECOMMENDED" desc="The 'block' label for Flash in site settings -- the recommended setting due to impending deprecation."> - Block sites from running Flash (recommended) - </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_PERMISSIONS_ARE_EPHEMERAL" desc="The notice that Flash permissions are ephemeral, at the top of the Flash settings page."> - Your Flash settings will be kept until you quit Chrome. - </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED" desc="The warning message for users that tells wildcard patterns are no longer allowed in Flash"> - Settings with "*" wildcards are no longer supported. Contact the extension developer or your administrator to <ph name="BEGIN_LINK"><a is="action-link" href="$1" target="_blank"></ph>change these settings<ph name="END_LINK"></a></ph>. - </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED_IN_POLICIES" desc="The warning message for users that tells wildcard patterns are no longer allowed in Flash. mail.google.com is allowed whereas [*.]google.com is not."> - Settings with "*" wildcards are no longer supported. Contact your administrator to <ph name="BEGIN_LINK"><a is="action-link" href="$1" target="_blank"></ph>change these settings<ph name="END_LINK"></a></ph>. - </message> <message name="IDS_SETTINGS_SITE_SETTINGS_ALLOW_RECENTLY_CLOSED_SITES" desc="The allow label for background sync in site settings."> Allow recently closed sites to finish sending and receiving data </message> @@ -2697,9 +2661,6 @@ <message name="IDS_SETTINGS_SITE_SETTINGS_COOKIE_SEARCH" desc="A placeholder label shown inside the Cookie Data filter textbox as a hint that the user can enter a substring to search for."> Search cookies </message> - <message name="IDS_SETTINGS_SITE_SETTINGS_ADOBE_FLASH_SETTINGS" desc="The text for the link that points the user to the Adobe Flash Player Storage settings on the web"> - Adobe Flash Player Storage settings - </message> <message name="IDS_SETTINGS_SITE_SETTINGS_HANDLER_IS_DEFAULT" desc="A label showing that a certain handler for a given protocol is the default."> Default </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED.png.sha1 deleted file mode 100644 index f7b6dff..0000000 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -87dfacaaccb7f0f6fd168f8fac8f5e7aa88a803f \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED_EXCEPTIONS.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED_EXCEPTIONS.png.sha1 deleted file mode 100644 index afb1e70..0000000 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED_EXCEPTIONS.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -3b3ed455d5b4575a47a2b8320eed38d78f2585fd \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED.png.sha1 deleted file mode 100644 index f7b6dff..0000000 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -87dfacaaccb7f0f6fd168f8fac8f5e7aa88a803f \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED_EXCEPTIONS.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED_EXCEPTIONS.png.sha1 deleted file mode 100644 index afb1e70..0000000 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED_EXCEPTIONS.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -3b3ed455d5b4575a47a2b8320eed38d78f2585fd \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_DESCRIPTION.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_DESCRIPTION.png.sha1 deleted file mode 100644 index f7b6dff..0000000 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_DESCRIPTION.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -87dfacaaccb7f0f6fd168f8fac8f5e7aa88a803f \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED.png.sha1 deleted file mode 100644 index 473f915..0000000 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -df65d42762a67f94b17fbc7657ee9a8c2e0bd31b \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED_IN_POLICIES.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED_IN_POLICIES.png.sha1 deleted file mode 100644 index 46ce26fe2..0000000 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED_IN_POLICIES.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -505b65dbea0520fcb83f1957dc366dd7acd4a150 \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index ea44f33f..cd2e901 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -3586,6 +3586,8 @@ "metrics/tab_stats_tracker.cc", "metrics/tab_stats_tracker.h", "metrics/tab_stats_tracker_delegate.h", + "notifications/muted_notification_handler.cc", + "notifications/muted_notification_handler.h", "notifications/notification_system_observer.cc", "notifications/notification_system_observer.h", "notifications/profile_notification.cc",
diff --git a/chrome/browser/browsing_data/access_context_audit_service.cc b/chrome/browser/browsing_data/access_context_audit_service.cc index 74b9531..c14e61f 100644 --- a/chrome/browser/browsing_data/access_context_audit_service.cc +++ b/chrome/browser/browsing_data/access_context_audit_service.cc
@@ -54,7 +54,11 @@ AccessContextAuditService::AccessContextAuditService(Profile* profile) : clock_(base::DefaultClock::GetInstance()), profile_(profile) {} -AccessContextAuditService::~AccessContextAuditService() = default; + +AccessContextAuditService::~AccessContextAuditService() { + // This destructor may do I/O, so destroy it on the database task runner. + database_task_runner_->ReleaseSoon(FROM_HERE, std::move(database_)); +} bool AccessContextAuditService::Init( const base::FilePath& database_dir,
diff --git a/chrome/browser/chromeos/cert_provisioning/cert_provisioning_platform_keys_helpers_unittest.cc b/chrome/browser/chromeos/cert_provisioning/cert_provisioning_platform_keys_helpers_unittest.cc index e66d270..fc7fcd92a0 100644 --- a/chrome/browser/chromeos/cert_provisioning/cert_provisioning_platform_keys_helpers_unittest.cc +++ b/chrome/browser/chromeos/cert_provisioning/cert_provisioning_platform_keys_helpers_unittest.cc
@@ -174,9 +174,9 @@ run_loop.Run(); } -//================= CertPrivisioningCertGetter ================================= +//================= CertProvisioningCertGetter ================================= -class CertPrivisioningCertGetter : public PlatformKeysHelpersTest {}; +class CertProvisioningCertGetter : public PlatformKeysHelpersTest {}; using CertMap = base::flat_map<CertProfileId, scoped_refptr<net::X509Certificate>>; @@ -205,7 +205,7 @@ platform_keys::Status status_ = platform_keys::Status::kSuccess; }; -TEST_F(CertPrivisioningCertGetter, NoCertificates) { +TEST_F(CertProvisioningCertGetter, NoCertificates) { const CertScope kCertScope = CertScope::kDevice; GetterCallbackObserver callback_observer; @@ -217,7 +217,7 @@ EXPECT_EQ(callback_observer.GetStatus(), platform_keys::Status::kSuccess); } -TEST_F(CertPrivisioningCertGetter, SingleCertificateWithId) { +TEST_F(CertProvisioningCertGetter, SingleCertificateWithId) { const CertScope kCertScope = CertScope::kDevice; const char kCertProfileId[] = "cert_profile_id_1"; CertMap cert_map; @@ -234,7 +234,7 @@ EXPECT_EQ(callback_observer.GetStatus(), platform_keys::Status::kSuccess); } -TEST_F(CertPrivisioningCertGetter, ManyCertificatesWithId) { +TEST_F(CertProvisioningCertGetter, ManyCertificatesWithId) { const CertScope kCertScope = CertScope::kDevice; std::vector<std::string> ids{"cert_profile_id_0", "cert_profile_id_1", "cert_profile_id_2"}; @@ -253,7 +253,7 @@ EXPECT_EQ(callback_observer.GetStatus(), platform_keys::Status::kSuccess); } -TEST_F(CertPrivisioningCertGetter, ManyCertificatesWithoutId) { +TEST_F(CertProvisioningCertGetter, ManyCertificatesWithoutId) { const CertScope kCertScope = CertScope::kDevice; size_t cert_count = 4; for (size_t i = 0; i < cert_count; ++i) { @@ -269,7 +269,7 @@ EXPECT_EQ(callback_observer.GetStatus(), platform_keys::Status::kSuccess); } -TEST_F(CertPrivisioningCertGetter, CertificatesWithAndWithoutIds) { +TEST_F(CertProvisioningCertGetter, CertificatesWithAndWithoutIds) { const CertScope kCertScope = CertScope::kDevice; CertMap cert_map;
diff --git a/chrome/browser/chromeos/first_run/chromeos_first_run_browsertest.cc b/chrome/browser/chromeos/first_run/chromeos_first_run_browsertest.cc index 715c359..0cbb4ee 100644 --- a/chrome/browser/chromeos/first_run/chromeos_first_run_browsertest.cc +++ b/chrome/browser/chromeos/first_run/chromeos_first_run_browsertest.cc
@@ -11,7 +11,6 @@ #include "chrome/browser/chromeos/first_run/step_names.h" #include "chrome/browser/chromeos/login/test/js_checker.h" #include "chrome/test/base/in_process_browser_test.h" -#include "chromeos/constants/chromeos_features.h" #include "content/public/test/browser_test.h" #include "content/public/test/test_utils.h" #include "ui/aura/window.h" @@ -66,16 +65,9 @@ FirstRunUIBrowserTest() : initialized_(false), finalized_(false) { - if (IsHomeButtonHiddenInTabletMode()) { - // kHideShelfControlsInTabletMode is predicated on hotseat being enabled. - scoped_feature_list_.InitWithFeatures( - {ash::features::kHideShelfControlsInTabletMode, - chromeos::features::kShelfHotseat}, - {}); - } else { - scoped_feature_list_.InitWithFeatures( - {}, {ash::features::kHideShelfControlsInTabletMode}); - } + scoped_feature_list_.InitWithFeatureState( + ash::features::kHideShelfControlsInTabletMode, + IsHomeButtonHiddenInTabletMode()); } void SetUpOnMainThread() override {
diff --git a/chrome/browser/chromeos/login/screens/mock_welcome_screen.h b/chrome/browser/chromeos/login/screens/mock_welcome_screen.h index 8ae3c9e5..0d8e88a 100644 --- a/chrome/browser/chromeos/login/screens/mock_welcome_screen.h +++ b/chrome/browser/chromeos/login/screens/mock_welcome_screen.h
@@ -45,6 +45,8 @@ MOCK_METHOD(void, SetInputMethodId, (const std::string& input_method_id)); MOCK_METHOD(void, SetTimezoneId, (const std::string& timezone_id)); MOCK_METHOD(void, ShowDemoModeConfirmationDialog, ()); + MOCK_METHOD(void, ShowEditRequisitionDialog, (const std::string&)); + MOCK_METHOD(void, ShowRemoraRequisitionDialog, ()); private: WelcomeScreen* screen_ = nullptr;
diff --git a/chrome/browser/chromeos/login/screens/welcome_screen.cc b/chrome/browser/chromeos/login/screens/welcome_screen.cc index 929ac561..9c048dc5 100644 --- a/chrome/browser/chromeos/login/screens/welcome_screen.cc +++ b/chrome/browser/chromeos/login/screens/welcome_screen.cc
@@ -24,7 +24,10 @@ #include "chrome/browser/chromeos/login/screen_manager.h" #include "chrome/browser/chromeos/login/ui/input_events_blocker.h" #include "chrome/browser/chromeos/login/wizard_controller.h" +#include "chrome/browser/chromeos/policy/enrollment_requisition_manager.h" +#include "chrome/browser/chromeos/system/timezone_resolver_manager.h" #include "chrome/browser/chromeos/system/timezone_util.h" +#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" #include "chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h" @@ -269,6 +272,26 @@ return timezone_; } +void WelcomeScreen::SetDeviceRequisition(const std::string& requisition) { + std::string initial_requisition = + policy::EnrollmentRequisitionManager::GetDeviceRequisition(); + policy::EnrollmentRequisitionManager::SetDeviceRequisition(requisition); + + if (policy::EnrollmentRequisitionManager::IsRemoraRequisition()) { + // CfM devices default to static timezone. + g_browser_process->local_state()->SetInteger( + prefs::kResolveDeviceTimezoneByGeolocationMethod, + static_cast<int>(chromeos::system::TimeZoneResolverManager:: + TimeZoneResolveMethod::DISABLED)); + } + + // Exit Chrome to force the restart as soon as a new requisition is set. + if (initial_requisition != + policy::EnrollmentRequisitionManager::GetDeviceRequisition()) { + chrome::AttemptRestart(); + } +} + void WelcomeScreen::AddObserver(Observer* observer) { if (observer) observers_.AddObserver(observer); @@ -397,7 +420,17 @@ } else if (action == ash::LoginAcceleratorAction::kEnableDebugging) { OnEnableDebugging(); return true; + } else if (action == ash::LoginAcceleratorAction::kEditDeviceRequisition) { + if (view_) + view_->ShowEditRequisitionDialog( + policy::EnrollmentRequisitionManager::GetDeviceRequisition()); + return true; + } else if (action == ash::LoginAcceleratorAction::kDeviceRequisitionRemora) { + if (view_) + view_->ShowRemoraRequisitionDialog(); + return true; } + return false; }
diff --git a/chrome/browser/chromeos/login/screens/welcome_screen.h b/chrome/browser/chromeos/login/screens/welcome_screen.h index 90630b1..02248f6 100644 --- a/chrome/browser/chromeos/login/screens/welcome_screen.h +++ b/chrome/browser/chromeos/login/screens/welcome_screen.h
@@ -97,6 +97,8 @@ void SetTimezone(const std::string& timezone_id); std::string GetTimezone() const; + void SetDeviceRequisition(const std::string& requisition); + void AddObserver(Observer* observer); void RemoveObserver(Observer* observer);
diff --git a/chrome/browser/chromeos/policy/system_proxy_manager.cc b/chrome/browser/chromeos/policy/system_proxy_manager.cc index f31b570d..c948b496 100644 --- a/chrome/browser/chromeos/policy/system_proxy_manager.cc +++ b/chrome/browser/chromeos/policy/system_proxy_manager.cc
@@ -207,6 +207,11 @@ return; } + if (local_state_->GetBoolean(prefs::kKerberosEnabled)) { + SendKerberosAuthenticationDetails(); + return; + } + system_proxy::SetAuthenticationDetailsRequest request; request.set_traffic_type(system_proxy::TrafficOrigin::USER); chromeos::SystemProxyClient::Get()->SetAuthenticationDetails( @@ -235,7 +240,9 @@ user_credentials.set_password(password); system_proxy::SetAuthenticationDetailsRequest request; - request.set_traffic_type(system_proxy::TrafficOrigin::ALL); + request.set_traffic_type(IsArcEnabled() + ? system_proxy::TrafficOrigin::ALL + : system_proxy::TrafficOrigin::SYSTEM); *request.mutable_credentials() = user_credentials; *request.mutable_protection_space() = protection_space; @@ -250,7 +257,9 @@ } system_proxy::SetAuthenticationDetailsRequest request; - request.set_traffic_type(system_proxy::TrafficOrigin::SYSTEM); + request.set_traffic_type(IsArcEnabled() + ? system_proxy::TrafficOrigin::ALL + : system_proxy::TrafficOrigin::SYSTEM); request.set_kerberos_enabled( local_state_->GetBoolean(prefs::kKerberosEnabled)); if (primary_profile_) {
diff --git a/chrome/browser/chromeos/policy/system_proxy_manager_unittest.cc b/chrome/browser/chromeos/policy/system_proxy_manager_unittest.cc index e281483..ed7260f 100644 --- a/chrome/browser/chromeos/policy/system_proxy_manager_unittest.cc +++ b/chrome/browser/chromeos/policy/system_proxy_manager_unittest.cc
@@ -160,22 +160,35 @@ // Tests that |SystemProxyManager| sends the correct Kerberos details and // updates to System-proxy. TEST_F(SystemProxyManagerTest, KerberosConfig) { + int expected_set_auth_details_call_count = 0; SetPolicy(true /* system_proxy_enabled */, "" /* system_services_username */, "" /* system_services_password */); + EXPECT_EQ(++expected_set_auth_details_call_count, + client_test_interface()->GetSetAuthenticationDetailsCallCount()); + local_state_.Get()->SetBoolean(prefs::kKerberosEnabled, true); - EXPECT_EQ(2, client_test_interface()->GetSetAuthenticationDetailsCallCount()); + EXPECT_EQ(++expected_set_auth_details_call_count, + client_test_interface()->GetSetAuthenticationDetailsCallCount()); system_proxy::SetAuthenticationDetailsRequest request = client_test_interface()->GetLastAuthenticationDetailsRequest(); EXPECT_FALSE(request.has_credentials()); EXPECT_TRUE(request.kerberos_enabled()); + EXPECT_EQ(request.traffic_type(), system_proxy::TrafficOrigin::SYSTEM); // Set an active principal name. profile_->GetPrefs()->SetString(prefs::kKerberosActivePrincipalName, kKerberosActivePrincipalName); - EXPECT_EQ(3, client_test_interface()->GetSetAuthenticationDetailsCallCount()); + EXPECT_EQ(++expected_set_auth_details_call_count, + client_test_interface()->GetSetAuthenticationDetailsCallCount()); + + profile_->GetPrefs()->SetBoolean(arc::prefs::kArcEnabled, true); + EXPECT_EQ(++expected_set_auth_details_call_count, + client_test_interface()->GetSetAuthenticationDetailsCallCount()); + request = client_test_interface()->GetLastAuthenticationDetailsRequest(); EXPECT_EQ(kKerberosActivePrincipalName, request.active_principal_name()); + EXPECT_EQ(request.traffic_type(), system_proxy::TrafficOrigin::ALL); // Remove the active principal name. profile_->GetPrefs()->SetString(prefs::kKerberosActivePrincipalName, ""); @@ -269,6 +282,16 @@ ASSERT_TRUE(request.has_credentials()); EXPECT_EQ(kBrowserUsername, request.credentials().username()); EXPECT_EQ(kBrowserPassword, request.credentials().password()); + EXPECT_EQ(request.traffic_type(), system_proxy::TrafficOrigin::SYSTEM); + + // Enable ARC and verify that the credentials are sent both for user and + // system traffic. + profile_->GetPrefs()->SetBoolean(arc::prefs::kArcEnabled, true); + task_environment_.RunUntilIdle(); + client_test_interface()->SendAuthenticationRequiredSignal(details); + task_environment_.RunUntilIdle(); + request = client_test_interface()->GetLastAuthenticationDetailsRequest(); + EXPECT_EQ(request.traffic_type(), system_proxy::TrafficOrigin::ALL); } // Tests that |SystemProxyManager| sends requests to start and shut down the
diff --git a/chrome/browser/content_settings/content_settings_default_provider_unittest.cc b/chrome/browser/content_settings/content_settings_default_provider_unittest.cc index 5d5eba5..1450e9e 100644 --- a/chrome/browser/content_settings/content_settings_default_provider_unittest.cc +++ b/chrome/browser/content_settings/content_settings_default_provider_unittest.cc
@@ -214,38 +214,6 @@ website_settings->Get(ContentSettingsType::FILE_SYSTEM_WRITE_GUARD) ->default_value_pref_name())); } - -TEST_F(ContentSettingsDefaultProviderTest, DiscardObsoletePluginsAllow) { - PrefService* prefs = profile_.GetPrefs(); - const std::string& plugins_pref_path = WebsiteSettingsRegistry::GetInstance() - ->Get(ContentSettingsType::PLUGINS) - ->default_value_pref_name(); - - // The ALLOW value of the plugins content setting should be discarded. - { - prefs->SetInteger(plugins_pref_path, CONTENT_SETTING_ALLOW); - DefaultProvider provider(prefs, false); - EXPECT_FALSE(prefs->HasPrefPath(plugins_pref_path)); - } - - // Other values of the plugins content setting should be preserved. - { - prefs->SetInteger(plugins_pref_path, CONTENT_SETTING_BLOCK); - DefaultProvider provider(prefs, false); - EXPECT_TRUE(prefs->HasPrefPath(plugins_pref_path)); - EXPECT_EQ(CONTENT_SETTING_BLOCK, prefs->GetInteger(plugins_pref_path)); - } - - { - prefs->SetInteger(plugins_pref_path, - CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); - DefaultProvider provider(prefs, false); - - EXPECT_TRUE(prefs->HasPrefPath(plugins_pref_path)); - EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, - prefs->GetInteger(plugins_pref_path)); - } -} #endif // !defined(OS_ANDROID) TEST_F(ContentSettingsDefaultProviderTest, OffTheRecord) {
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc index 796cdf6d..c9198e2 100644 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc
@@ -192,24 +192,6 @@ GURL(chrome::kChromeUINewTabURL), GURL(chrome::kChromeUINewTabURL), ContentSettingsType::JAVASCRIPT, std::string())); -#if BUILDFLAG(ENABLE_PLUGINS) - host_content_settings_map->SetDefaultContentSetting( - ContentSettingsType::PLUGINS, CONTENT_SETTING_ALLOW); - EXPECT_EQ(CONTENT_SETTING_ALLOW, - host_content_settings_map->GetDefaultContentSetting( - ContentSettingsType::PLUGINS, NULL)); - host_content_settings_map->SetDefaultContentSetting( - ContentSettingsType::PLUGINS, CONTENT_SETTING_BLOCK); - EXPECT_EQ(CONTENT_SETTING_BLOCK, - host_content_settings_map->GetDefaultContentSetting( - ContentSettingsType::PLUGINS, NULL)); - host_content_settings_map->SetDefaultContentSetting( - ContentSettingsType::PLUGINS, CONTENT_SETTING_DETECT_IMPORTANT_CONTENT); - EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, - host_content_settings_map->GetDefaultContentSetting( - ContentSettingsType::PLUGINS, NULL)); -#endif - host_content_settings_map->SetDefaultContentSetting( ContentSettingsType::POPUPS, CONTENT_SETTING_ALLOW); EXPECT_EQ(CONTENT_SETTING_ALLOW, @@ -239,11 +221,6 @@ EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( host, host, ContentSettingsType::COOKIES, std::string())); -#if BUILDFLAG(ENABLE_PLUGINS) - EXPECT_EQ(CONTENT_SETTING_BLOCK, - host_content_settings_map->GetContentSetting( - host, host, ContentSettingsType::PLUGINS, std::string())); -#endif // Check returning all settings for a host. host_content_settings_map->SetContentSettingDefaultScope( @@ -252,14 +229,6 @@ EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( host, host, ContentSettingsType::JAVASCRIPT, std::string())); -#if BUILDFLAG(ENABLE_PLUGINS) - host_content_settings_map->SetContentSettingDefaultScope( - host, GURL(), ContentSettingsType::PLUGINS, std::string(), - CONTENT_SETTING_ALLOW); - EXPECT_EQ(CONTENT_SETTING_ALLOW, - host_content_settings_map->GetContentSetting( - host, host, ContentSettingsType::PLUGINS, std::string())); -#endif EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( host, host, ContentSettingsType::POPUPS, std::string())); @@ -282,22 +251,11 @@ host_content_settings_map->SetContentSettingDefaultScope( host2, GURL(), ContentSettingsType::JAVASCRIPT, std::string(), CONTENT_SETTING_BLOCK); -#if BUILDFLAG(ENABLE_PLUGINS) - host_content_settings_map->SetContentSettingDefaultScope( - host2, GURL(), ContentSettingsType::PLUGINS, std::string(), - CONTENT_SETTING_BLOCK); -#endif ContentSettingsForOneType host_settings; host_content_settings_map->GetSettingsForOneType( ContentSettingsType::JAVASCRIPT, std::string(), &host_settings); // |host_settings| contains the default setting and 2 exception. EXPECT_EQ(3U, host_settings.size()); -#if BUILDFLAG(ENABLE_PLUGINS) - host_content_settings_map->GetSettingsForOneType( - ContentSettingsType::PLUGINS, std::string(), &host_settings); - // |host_settings| contains the default setting and 2 exceptions. - EXPECT_EQ(3U, host_settings.size()); -#endif host_content_settings_map->GetSettingsForOneType( ContentSettingsType::POPUPS, std::string(), &host_settings); // |host_settings| contains only the default setting. @@ -393,11 +351,6 @@ host_content_settings_map->SetContentSettingDefaultScope( host, GURL(), ContentSettingsType::COOKIES, std::string(), CONTENT_SETTING_BLOCK); -#if BUILDFLAG(ENABLE_PLUGINS) - host_content_settings_map->SetContentSettingDefaultScope( - host, GURL(), ContentSettingsType::PLUGINS, std::string(), - CONTENT_SETTING_BLOCK); -#endif host_content_settings_map->SetContentSettingDefaultScope( host2, GURL(), ContentSettingsType::COOKIES, std::string(), CONTENT_SETTING_BLOCK); @@ -408,12 +361,6 @@ ContentSettingsType::COOKIES, std::string(), &host_settings); // |host_settings| contains only the default setting. EXPECT_EQ(1U, host_settings.size()); -#if BUILDFLAG(ENABLE_PLUGINS) - host_content_settings_map->GetSettingsForOneType( - ContentSettingsType::PLUGINS, std::string(), &host_settings); - // |host_settings| contains the default setting and an exception. - EXPECT_EQ(2U, host_settings.size()); -#endif } TEST_F(HostContentSettingsMapTest, Patterns) { @@ -633,20 +580,6 @@ host_ending_with_dot, host_ending_with_dot, ContentSettingsType::JAVASCRIPT, std::string())); -#if BUILDFLAG(ENABLE_PLUGINS) - EXPECT_EQ(CONTENT_SETTING_BLOCK, - host_content_settings_map->GetContentSetting( - host_ending_with_dot, host_ending_with_dot, - ContentSettingsType::PLUGINS, std::string())); - host_content_settings_map->SetContentSettingDefaultScope( - host_ending_with_dot, GURL(), ContentSettingsType::PLUGINS, std::string(), - CONTENT_SETTING_DEFAULT); - EXPECT_EQ(CONTENT_SETTING_BLOCK, - host_content_settings_map->GetContentSetting( - host_ending_with_dot, host_ending_with_dot, - ContentSettingsType::PLUGINS, std::string())); -#endif - EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetContentSetting( host_ending_with_dot, host_ending_with_dot, @@ -1261,20 +1194,6 @@ host_content_settings_map->GetDefaultContentSetting( ContentSettingsType::JAVASCRIPT, NULL)); -#if BUILDFLAG(ENABLE_PLUGINS) - // Set preference to manage the default-content-setting for Plugins. - prefs->SetManagedPref(prefs::kManagedDefaultPluginsSetting, - std::make_unique<base::Value>(CONTENT_SETTING_BLOCK)); - EXPECT_EQ(CONTENT_SETTING_BLOCK, - host_content_settings_map->GetDefaultContentSetting( - ContentSettingsType::PLUGINS, NULL)); - - // Remove the preference to manage the default-content-setting for Plugins. - prefs->RemoveManagedPref(prefs::kManagedDefaultPluginsSetting); - EXPECT_EQ(CONTENT_SETTING_BLOCK, - host_content_settings_map->GetDefaultContentSetting( - ContentSettingsType::PLUGINS, NULL)); -#endif EXPECT_EQ(CONTENT_SETTING_BLOCK, host_content_settings_map->GetDefaultContentSetting( ContentSettingsType::ADS, NULL)); @@ -1937,109 +1856,7 @@ HostContentSettingsMap::EPHEMERAL_PROVIDER); } -#if BUILDFLAG(ENABLE_PLUGINS) -// Test that existing Flash preferences should get copied into the -// |ContentSettingsType::PLUGINS_DATA| setting on the creation of a new -// |HostContentSettingsMap|. -TEST_F(HostContentSettingsMapTest, PluginDataMigration) { - // Avoid the test if Flash permissions are ephemeral. - if (content_settings::ContentSettingsRegistry::GetInstance() - ->Get(ContentSettingsType::PLUGINS) - ->storage_behavior() == - content_settings::ContentSettingsInfo::EPHEMERAL) { - return; - } - TestingProfile profile; - // Set a website-specific Flash preference and a pattern exception. - std::unique_ptr<base::Value> value = base::JSONReader::ReadDeprecated( - "{\"https://urlwithflashchanged.com:443,*\":{\"setting\":1}, " - "\"[*.]patternurl.com:443,*\":{\"setting\":1}}"); - profile.GetPrefs()->Set(GetPrefName(ContentSettingsType::PLUGINS), *value); - - HostContentSettingsMap* map = - HostContentSettingsMapFactory::GetForProfile(&profile); - - // Check it was copied successfully. - const GURL url1("https://urlwithflashchanged.com"); - EXPECT_NE(nullptr, map->GetWebsiteSetting(url1, url1, - ContentSettingsType::PLUGINS_DATA, - std::string(), nullptr)); - // Check other urls were not affected. - const GURL url2("https://urlwithflashdefault.com"); - EXPECT_EQ(nullptr, map->GetWebsiteSetting(url2, url2, - ContentSettingsType::PLUGINS_DATA, - std::string(), nullptr)); - // Check patterns are also unaffected. - const GURL pattern("[*.]patternurl.com"); - EXPECT_EQ(nullptr, map->GetWebsiteSetting(pattern, pattern, - ContentSettingsType::PLUGINS_DATA, - std::string(), nullptr)); -} - -// If there are existing |ContentSettingsType::PLUGINS_DATA| preferences -// stored, check we skip the migration. -TEST_F(HostContentSettingsMapTest, PluginDataMigrated) { - TestingProfile profile; - // Set a website-specific Flash preference and another preference indicating - // that the Flash setting has changed for a different website. - std::unique_ptr<base::Value> value = base::JSONReader::ReadDeprecated( - "{\"https://unmigratedurl.com:443,*\":{\"setting\":1}}"); - profile.GetPrefs()->Set(GetPrefName(ContentSettingsType::PLUGINS), *value); - value = base::JSONReader::ReadDeprecated( - "{\"https://" - "example.com:443,*\":{\"setting\":{\"flashPreviouslyChanged\":true}}}"); - profile.GetPrefs()->Set(GetPrefName(ContentSettingsType::PLUGINS_DATA), - *value); - - HostContentSettingsMap* map = - HostContentSettingsMapFactory::GetForProfile(&profile); - - // Check it was copied successfully. - const GURL flash_data_url("https://example.com"); - EXPECT_NE(nullptr, map->GetWebsiteSetting(flash_data_url, flash_data_url, - ContentSettingsType::PLUGINS_DATA, - std::string(), nullptr)); - // Check the migration code was not run (i.e. the other Flash preference set - // above was not migrated). Theoretically this should never happen, but this - // scenario is useful for testing. - const GURL unmigrated_url("https://unmigratedurl.com"); - EXPECT_EQ(nullptr, map->GetWebsiteSetting(unmigrated_url, unmigrated_url, - ContentSettingsType::PLUGINS_DATA, - std::string(), nullptr)); -} - -// Tests that Flash permissions are reset after restarting. -// Flash, and consequently, Flash permissions are not available on Android. -#if !defined(OS_ANDROID) -TEST_F(HostContentSettingsMapTest, FlashPermissionsAreEphemeral) { - TestingProfile profile; - HostContentSettingsMap* map = - HostContentSettingsMapFactory::GetForProfile(&profile); - const GURL url("https://example.com"); - - map->SetDefaultContentSetting(ContentSettingsType::PLUGINS, - CONTENT_SETTING_ASK); - - base::test::ScopedFeatureList feature_list; - content_settings::ContentSettingsRegistry::GetInstance()->ResetForTest(); - - ReloadProviders(profile.GetPrefs(), map); - map->SetContentSettingDefaultScope(url, url, ContentSettingsType::PLUGINS, - std::string(), CONTENT_SETTING_ALLOW); - EXPECT_EQ(CONTENT_SETTING_ALLOW, - map->GetContentSetting(url, url, ContentSettingsType::PLUGINS, - std::string())); - - ReloadProviders(profile.GetPrefs(), map); - EXPECT_EQ(CONTENT_SETTING_ASK, - map->GetContentSetting(url, url, ContentSettingsType::PLUGINS, - std::string())); -} -#endif // !defined(OS_ANDROID) - -// Tests that restarting only removes ephemeral permissions. Flash, and -// consequently, Flash permissions are not available on Android. -#if !defined(OS_ANDROID) +// Tests that restarting only removes ephemeral permissions. TEST_F(HostContentSettingsMapTest, MixedEphemeralAndPersistentPermissions) { TestingProfile profile; HostContentSettingsMap* map = @@ -2050,7 +1867,8 @@ // The following two types are used as samples of ephemeral and persistent // permission types. They can be replaced with any other type if required. - const ContentSettingsType ephemeral_type = ContentSettingsType::PLUGINS; + const ContentSettingsType ephemeral_type = + ContentSettingsType::PERIODIC_BACKGROUND_SYNC; const ContentSettingsType persistent_type = ContentSettingsType::GEOLOCATION; EXPECT_EQ(content_settings::ContentSettingsInfo::EPHEMERAL, @@ -2064,41 +1882,38 @@ const GURL url("https://example.com"); - // Set default permission of both to ASK and expect it for a website. - map->SetDefaultContentSetting(ephemeral_type, CONTENT_SETTING_ASK); + // |PERIODIC_BACKGROUND_SYNC| does not support ASK, set to ALLOW. + map->SetDefaultContentSetting(ephemeral_type, CONTENT_SETTING_ALLOW); map->SetDefaultContentSetting(persistent_type, CONTENT_SETTING_ASK); - EXPECT_EQ(CONTENT_SETTING_ASK, + EXPECT_EQ(CONTENT_SETTING_ALLOW, map->GetContentSetting(url, url, ephemeral_type, std::string())); EXPECT_EQ(CONTENT_SETTING_ASK, map->GetContentSetting(url, url, persistent_type, std::string())); // Set permission for both types and expect receiving it correctly. map->SetContentSettingDefaultScope(url, url, ephemeral_type, std::string(), - CONTENT_SETTING_ALLOW); + CONTENT_SETTING_BLOCK); map->SetContentSettingDefaultScope(url, url, persistent_type, std::string(), CONTENT_SETTING_BLOCK); + EXPECT_EQ(CONTENT_SETTING_BLOCK, + map->GetContentSetting(url, url, ephemeral_type, std::string())); + EXPECT_EQ(CONTENT_SETTING_BLOCK, + map->GetContentSetting(url, url, persistent_type, std::string())); + + // Restart and expect reset of ephemeral permission to |ALLOW|, while keeping + // the permission of persistent type. + ReloadProviders(profile.GetPrefs(), map); + EXPECT_EQ(CONTENT_SETTING_ALLOW, map->GetContentSetting(url, url, ephemeral_type, std::string())); EXPECT_EQ(CONTENT_SETTING_BLOCK, map->GetContentSetting(url, url, persistent_type, std::string())); - - // Restart and expect reset of ephemeral permission to ASK, while keeping - // the permission of persistent type. - ReloadProviders(profile.GetPrefs(), map); - - EXPECT_EQ(CONTENT_SETTING_ASK, - map->GetContentSetting(url, url, ephemeral_type, std::string())); - EXPECT_EQ(CONTENT_SETTING_BLOCK, - map->GetContentSetting(url, url, persistent_type, std::string())); } -#endif // !defined(OS_ANDROID) // Test that directly writing a value to PrefProvider doesn't affect ephmeral -// types. Flash, and consequently, Flash permissions are not available on -// Android. -#if !defined(OS_ANDROID) +// types. TEST_F(HostContentSettingsMapTest, EphemeralTypeDoesntReadFromPrefProvider) { TestingProfile profile; HostContentSettingsMap* map = @@ -2107,9 +1922,11 @@ content_settings::ContentSettingsRegistry::GetInstance()->ResetForTest(); ReloadProviders(profile.GetPrefs(), map); - // ContentSettingsType::PLUGINS is used as a sample of ephemeral permission - // type. It can be replaced with any other type if required. - const ContentSettingsType ephemeral_type = ContentSettingsType::PLUGINS; + // ContentSettingsType::PERIODIC_BACKGROUND_SYNC is used as a sample of + // ephemeral permission type. It can be replaced with any other type if + // required. + const ContentSettingsType ephemeral_type = + ContentSettingsType::PERIODIC_BACKGROUND_SYNC; EXPECT_EQ(content_settings::ContentSettingsInfo::EPHEMERAL, content_settings::ContentSettingsRegistry::GetInstance() @@ -2119,29 +1936,25 @@ const GURL url("https://example.com"); const ContentSettingsPattern pattern = ContentSettingsPattern::FromURL(url); - map->SetDefaultContentSetting(ephemeral_type, CONTENT_SETTING_ASK); + map->SetDefaultContentSetting(ephemeral_type, CONTENT_SETTING_ALLOW); content_settings::PrefProvider pref_provider(profile.GetPrefs(), true, true, false); pref_provider.SetWebsiteSetting( pattern, pattern, ephemeral_type, std::string(), - std::make_unique<base::Value>(CONTENT_SETTING_ALLOW), {}); + std::make_unique<base::Value>(CONTENT_SETTING_BLOCK), {}); - EXPECT_EQ(CONTENT_SETTING_ASK, + EXPECT_EQ(CONTENT_SETTING_ALLOW, map->GetContentSetting(url, url, ephemeral_type, std::string())); ReloadProviders(profile.GetPrefs(), map); - EXPECT_EQ(CONTENT_SETTING_ASK, + EXPECT_EQ(CONTENT_SETTING_ALLOW, map->GetContentSetting(url, url, ephemeral_type, std::string())); pref_provider.ShutdownOnUIThread(); } -#endif // !defined(OS_ANDROID) - -#endif // BUILDFLAG(ENABLE_PLUGINS) - TEST_F(HostContentSettingsMapTest, GetPatternsFromScopingType) { const GURL primary_url("http://a.b.example1.com:8080"); const GURL secondary_url("http://a.b.example2.com:8080");
diff --git a/chrome/browser/extensions/chrome_app_sorting.cc b/chrome/browser/extensions/chrome_app_sorting.cc index 2d9bab5..2bd3572 100644 --- a/chrome/browser/extensions/chrome_app_sorting.cc +++ b/chrome/browser/extensions/chrome_app_sorting.cc
@@ -376,7 +376,7 @@ if (web_app_registrar_ && web_app_registrar_->IsInstalled(extension_id)) { web_app_sync_bridge_->SetUserLaunchOrdinal(extension_id, new_app_launch_ordinal); - // Fall through on purpose to ensure Extensions system has correct data. + return; } std::unique_ptr<base::Value> new_value = @@ -462,7 +462,7 @@ if (web_app_registrar_ && web_app_registrar_->IsInstalled(extension_id)) { web_app_sync_bridge_->SetUserPageOrdinal(extension_id, new_page_ordinal); - // Fall through on purpose to ensure Extensions system has correct data. + return; } std::unique_ptr<base::Value> new_value =
diff --git a/chrome/browser/net/load_timing_browsertest.cc b/chrome/browser/net/load_timing_browsertest.cc index 7f0b823..e4ea88df 100644 --- a/chrome/browser/net/load_timing_browsertest.cc +++ b/chrome/browser/net/load_timing_browsertest.cc
@@ -28,6 +28,7 @@ #include "content/public/browser/browser_thread.h" #include "content/public/test/browser_test.h" #include "content/public/test/browser_test_utils.h" +#include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/spawned_test_server/spawned_test_server.h" #include "third_party/blink/public/common/features.h" #include "url/gurl.h" @@ -151,19 +152,13 @@ navigation_deltas.receive_headers_end); } -// Flaky on Win10: crbug.com/997823 -#if defined(OS_WIN) -#define MAYBE_Proxy DISABLED_Proxy -#else -#define MAYBE_Proxy Proxy -#endif -IN_PROC_BROWSER_TEST_F(LoadTimingBrowserTest, MAYBE_Proxy) { - ASSERT_TRUE(spawned_test_server()->Start()); +IN_PROC_BROWSER_TEST_F(LoadTimingBrowserTest, Proxy) { + ASSERT_TRUE(embedded_test_server()->Start()); browser()->profile()->GetPrefs()->Set( proxy_config::prefs::kProxy, ProxyConfigDictionary::CreateFixedServers( - spawned_test_server()->host_port_pair().ToString(), std::string())); + embedded_test_server()->host_port_pair().ToString(), std::string())); ProfileNetworkContextServiceFactory::GetForContext(browser()->profile()) ->FlushProxyConfigMonitorForTesting();
diff --git a/chrome/browser/notifications/muted_notification_handler.cc b/chrome/browser/notifications/muted_notification_handler.cc new file mode 100644 index 0000000..a248f51 --- /dev/null +++ b/chrome/browser/notifications/muted_notification_handler.cc
@@ -0,0 +1,56 @@ +// 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. + +#include "chrome/browser/notifications/muted_notification_handler.h" + +#include <utility> + +#include "base/callback.h" +#include "base/notreached.h" +#include "chrome/browser/notifications/notification_display_service.h" +#include "chrome/browser/notifications/notification_display_service_factory.h" +#include "chrome/browser/profiles/profile.h" + +namespace { +constexpr int kShowActionIndex = 0; +} // namespace + +MutedNotificationHandler::MutedNotificationHandler(Delegate* delegate) + : delegate_(delegate) { + DCHECK(delegate_); +} + +MutedNotificationHandler::~MutedNotificationHandler() = default; + +void MutedNotificationHandler::OnClick( + Profile* profile, + const GURL& origin, + const std::string& notification_id, + const base::Optional<int>& action_index, + const base::Optional<base::string16>& reply, + base::OnceClosure completed_closure) { + if (!action_index) + delegate_->OnAction(Action::kBodyClick); + else if (*action_index == kShowActionIndex) + delegate_->OnAction(Action::kShowClick); + else + NOTREACHED(); + + std::move(completed_closure).Run(); +} + +void MutedNotificationHandler::OnClose(Profile* profile, + const GURL& origin, + const std::string& notification_id, + bool by_user, + base::OnceClosure completed_closure) { + if (by_user) + delegate_->OnAction(Action::kUserClose); + std::move(completed_closure).Run(); +} + +void MutedNotificationHandler::OpenSettings(Profile* profile, + const GURL& origin) { + NOTREACHED(); +}
diff --git a/chrome/browser/notifications/muted_notification_handler.h b/chrome/browser/notifications/muted_notification_handler.h new file mode 100644 index 0000000..20d0b29 --- /dev/null +++ b/chrome/browser/notifications/muted_notification_handler.h
@@ -0,0 +1,63 @@ +// 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. + +#ifndef CHROME_BROWSER_NOTIFICATIONS_MUTED_NOTIFICATION_HANDLER_H_ +#define CHROME_BROWSER_NOTIFICATIONS_MUTED_NOTIFICATION_HANDLER_H_ + +#include <string> + +#include "base/callback_forward.h" +#include "base/optional.h" +#include "base/strings/string16.h" +#include "chrome/browser/notifications/notification_handler.h" +#include "url/gurl.h" + +class Profile; + +// Handles NOTIFICATIONS_MUTED notification actions. +class MutedNotificationHandler : public NotificationHandler { + public: + // Actions taken by the user on a muted notification. + enum class Action { + // The user explicitly closed the notification. + kUserClose, + // The user clicked on the notification body. + kBodyClick, + // The user clicked on the "Show" action button. + kShowClick, + }; + + // Delegate for handling muted notification actions. + class Delegate { + public: + virtual ~Delegate() = default; + + // Called when the user performed an |action| on a muted notification. + virtual void OnAction(Action action) = 0; + }; + + explicit MutedNotificationHandler(Delegate* delegate); + MutedNotificationHandler(const MutedNotificationHandler&) = delete; + MutedNotificationHandler& operator=(const MutedNotificationHandler&) = delete; + ~MutedNotificationHandler() override; + + // NotificationHandler: + void OnClick(Profile* profile, + const GURL& origin, + const std::string& notification_id, + const base::Optional<int>& action_index, + const base::Optional<base::string16>& reply, + base::OnceClosure completed_closure) override; + void OnClose(Profile* profile, + const GURL& origin, + const std::string& notification_id, + bool by_user, + base::OnceClosure completed_closure) override; + void OpenSettings(Profile* profile, const GURL& origin) override; + + private: + Delegate* delegate_; +}; + +#endif // CHROME_BROWSER_NOTIFICATIONS_MUTED_NOTIFICATION_HANDLER_H_
diff --git a/chrome/browser/notifications/muted_notification_handler_unittest.cc b/chrome/browser/notifications/muted_notification_handler_unittest.cc new file mode 100644 index 0000000..961fbb5f --- /dev/null +++ b/chrome/browser/notifications/muted_notification_handler_unittest.cc
@@ -0,0 +1,81 @@ +// 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. + +#include "chrome/browser/notifications/muted_notification_handler.h" + +#include <string> + +#include "base/callback.h" +#include "base/optional.h" +#include "base/test/mock_callback.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +class MockMutedNotificationHandlerDelegate + : public MutedNotificationHandler::Delegate { + public: + MockMutedNotificationHandlerDelegate() = default; + MockMutedNotificationHandlerDelegate( + const MockMutedNotificationHandlerDelegate&) = delete; + MockMutedNotificationHandlerDelegate& operator=( + const MockMutedNotificationHandlerDelegate&) = delete; + ~MockMutedNotificationHandlerDelegate() override = default; + + // MutedNotificationHandler::Delegate: + MOCK_METHOD(void, OnAction, (MutedNotificationHandler::Action), (override)); +}; + +class MutedNotificationHandlerTest : public testing::Test { + public: + MutedNotificationHandlerTest() = default; + ~MutedNotificationHandlerTest() override = default; + + MockMutedNotificationHandlerDelegate& delegate() { return delegate_; } + + MutedNotificationHandler& handler() { return handler_; } + + private: + MockMutedNotificationHandlerDelegate delegate_; + MutedNotificationHandler handler_{&delegate_}; +}; + +TEST_F(MutedNotificationHandlerTest, OnUserClose) { + base::MockCallback<base::OnceClosure> callback; + EXPECT_CALL(callback, Run()); + EXPECT_CALL(delegate(), + OnAction(MutedNotificationHandler::Action::kUserClose)); + handler().OnClose(/*profile=*/nullptr, GURL(), + /*notification_id=*/std::string(), /*by_user=*/true, + callback.Get()); +} + +TEST_F(MutedNotificationHandlerTest, OnNonUserClose) { + base::MockCallback<base::OnceClosure> callback; + EXPECT_CALL(callback, Run()); + EXPECT_CALL(delegate(), OnAction).Times(0); + handler().OnClose(/*profile=*/nullptr, GURL(), + /*notification_id=*/std::string(), /*by_user=*/false, + callback.Get()); +} + +TEST_F(MutedNotificationHandlerTest, OnClickBody) { + base::MockCallback<base::OnceClosure> callback; + EXPECT_CALL(callback, Run()); + EXPECT_CALL(delegate(), + OnAction(MutedNotificationHandler::Action::kBodyClick)); + handler().OnClick( + /*profile=*/nullptr, GURL(), /*notification_id=*/std::string(), + /*action_index=*/base::nullopt, /*reply=*/base::nullopt, callback.Get()); +} + +TEST_F(MutedNotificationHandlerTest, OnClickShow) { + base::MockCallback<base::OnceClosure> callback; + EXPECT_CALL(callback, Run()); + EXPECT_CALL(delegate(), + OnAction(MutedNotificationHandler::Action::kShowClick)); + handler().OnClick( + /*profile=*/nullptr, GURL(), /*notification_id=*/std::string(), + /*action_index=*/0, /*reply=*/base::nullopt, callback.Get()); +}
diff --git a/chrome/browser/notifications/notification_blocker.h b/chrome/browser/notifications/notification_blocker.h index dcee218..054cdd4 100644 --- a/chrome/browser/notifications/notification_blocker.h +++ b/chrome/browser/notifications/notification_blocker.h
@@ -35,6 +35,10 @@ virtual bool ShouldBlockNotification( const message_center::Notification& notification) = 0; + // Called when |notification| got blocked because this blocker is active. + virtual void OnBlockedNotification( + const message_center::Notification& notification) {} + // Observer methods. void AddObserver(Observer* observer); void RemoveObserver(Observer* observer);
diff --git a/chrome/browser/notifications/notification_display_queue.cc b/chrome/browser/notifications/notification_display_queue.cc index 98d8499..f21adc1 100644 --- a/chrome/browser/notifications/notification_display_queue.cc +++ b/chrome/browser/notifications/notification_display_queue.cc
@@ -43,6 +43,11 @@ RemoveQueuedNotification(notification.id()); queued_notifications_.emplace_back(notification_type, notification, std::move(metadata)); + // Notify blockers that a new notification has been blocked. + for (auto& blocker : blockers_) { + if (blocker->ShouldBlockNotification(notification)) + blocker->OnBlockedNotification(notification); + } } void NotificationDisplayQueue::RemoveQueuedNotification(
diff --git a/chrome/browser/notifications/notification_display_queue_unittest.cc b/chrome/browser/notifications/notification_display_queue_unittest.cc index 02e19e0..7470d2f0 100644 --- a/chrome/browser/notifications/notification_display_queue_unittest.cc +++ b/chrome/browser/notifications/notification_display_queue_unittest.cc
@@ -38,6 +38,10 @@ return url::IsSameOriginWith(notification.origin_url(), *blocked_origin_); } + MOCK_METHOD(void, + OnBlockedNotification, + (const message_center::Notification&), + (override)); void SetShouldBlockNotifications(bool should_block) { should_block_ = should_block; @@ -205,6 +209,9 @@ notification_blocker_1->SetShouldBlockNotifications(true); notification_blocker_2->SetShouldBlockNotifications(true); + EXPECT_CALL(*notification_blocker_1, OnBlockedNotification); + EXPECT_CALL(*notification_blocker_2, OnBlockedNotification); + message_center::Notification notification = CreateNotification("id"); queue().EnqueueNotification(NotificationHandler::Type::TRANSIENT, notification, /*metadata=*/nullptr); @@ -224,6 +231,8 @@ message_center::Notification notification_2 = CreateNotification("id2"); message_center::Notification notification_3 = CreateNotification("id3"); + EXPECT_CALL(notification_blocker(), OnBlockedNotification).Times(3); + queue().EnqueueNotification(NotificationHandler::Type::TRANSIENT, notification_1, /*metadata=*/nullptr); queue().EnqueueNotification(NotificationHandler::Type::TRANSIENT, @@ -291,3 +300,33 @@ testing::Mock::VerifyAndClearExpectations(&service()); EXPECT_EQ(0u, queue().GetQueuedNotificationIds().size()); } + +TEST_F(NotificationDisplayQueueTest, MultipleBlockersNotifyBlocked) { + auto blocker_1 = std::make_unique<FakeNotificationBlocker>(); + FakeNotificationBlocker* notification_blocker_1 = blocker_1.get(); + auto blocker_2 = std::make_unique<FakeNotificationBlocker>(); + FakeNotificationBlocker* notification_blocker_2 = blocker_2.get(); + + NotificationDisplayQueue::NotificationBlockers blockers; + blockers.push_back(std::move(blocker_1)); + blockers.push_back(std::move(blocker_2)); + queue().SetNotificationBlockers(std::move(blockers)); + + notification_blocker_1->SetShouldBlockNotifications(true); + notification_blocker_2->SetShouldBlockNotifications(false); + + EXPECT_CALL(*notification_blocker_1, OnBlockedNotification).Times(1); + EXPECT_CALL(*notification_blocker_2, OnBlockedNotification).Times(0); + + queue().EnqueueNotification(NotificationHandler::Type::TRANSIENT, + CreateNotification("id1"), /*metadata=*/nullptr); + + notification_blocker_2->SetShouldBlockNotifications(true); + notification_blocker_1->SetShouldBlockNotifications(false); + + EXPECT_CALL(*notification_blocker_1, OnBlockedNotification).Times(0); + EXPECT_CALL(*notification_blocker_2, OnBlockedNotification).Times(1); + + queue().EnqueueNotification(NotificationHandler::Type::TRANSIENT, + CreateNotification("id2"), /*metadata=*/nullptr); +}
diff --git a/chrome/browser/notifications/notification_display_service_impl.cc b/chrome/browser/notifications/notification_display_service_impl.cc index 3e3aa96..e0f6bdc0 100644 --- a/chrome/browser/notifications/notification_display_service_impl.cc +++ b/chrome/browser/notifications/notification_display_service_impl.cc
@@ -40,6 +40,7 @@ #endif #if !defined(OS_ANDROID) +#include "chrome/browser/notifications/muted_notification_handler.h" #include "chrome/browser/notifications/screen_capture_notification_blocker.h" #endif @@ -98,8 +99,13 @@ if (base::FeatureList::IsEnabled( features::kMuteNotificationsDuringScreenShare)) { + auto screen_capture_blocker = + std::make_unique<ScreenCaptureNotificationBlocker>(this); + AddNotificationHandler(NotificationHandler::Type::NOTIFICATIONS_MUTED, + std::make_unique<MutedNotificationHandler>( + screen_capture_blocker.get())); notification_queue_.AddNotificationBlocker( - std::make_unique<ScreenCaptureNotificationBlocker>()); + std::move(screen_capture_blocker)); } #endif @@ -296,6 +302,14 @@ OnNotificationPlatformBridgeReady(); } +void NotificationDisplayServiceImpl::OverrideNotificationHandlerForTesting( + NotificationHandler::Type notification_type, + std::unique_ptr<NotificationHandler> handler) { + DCHECK(handler); + DCHECK_EQ(1u, notification_handlers_.count(notification_type)); + notification_handlers_[notification_type] = std::move(handler); +} + void NotificationDisplayServiceImpl::OnNotificationPlatformBridgeReady() { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); bridge_delegator_initialized_ = true;
diff --git a/chrome/browser/notifications/notification_display_service_impl.h b/chrome/browser/notifications/notification_display_service_impl.h index 0ee1c030..1f432d2 100644 --- a/chrome/browser/notifications/notification_display_service_impl.h +++ b/chrome/browser/notifications/notification_display_service_impl.h
@@ -102,6 +102,12 @@ void SetNotificationPlatformBridgeDelegatorForTesting( std::unique_ptr<NotificationPlatformBridgeDelegator> bridge_delegator); + // Sets an implementation object to handle notification operations for + // |notification_type| and overrides any existing ones. + void OverrideNotificationHandlerForTesting( + NotificationHandler::Type notification_type, + std::unique_ptr<NotificationHandler> handler); + private: // Called when the NotificationPlatformBridgeDelegator has been initialized. void OnNotificationPlatformBridgeReady(); @@ -125,14 +131,14 @@ // Boolean tracking whether the |bridge_delegator_| has been initialized. bool bridge_delegator_initialized_ = false; - // Map containing the notification handlers responsible for processing events. - std::map<NotificationHandler::Type, std::unique_ptr<NotificationHandler>> - notification_handlers_; - // Notification queue that holds on to notifications instead of displaying // them if certain blockers are temporarily active. NotificationDisplayQueue notification_queue_{this}; + // Map containing the notification handlers responsible for processing events. + std::map<NotificationHandler::Type, std::unique_ptr<NotificationHandler>> + notification_handlers_; + base::ObserverList<Observer> observers_; base::WeakPtrFactory<NotificationDisplayServiceImpl> weak_factory_{this};
diff --git a/chrome/browser/notifications/notification_handler.h b/chrome/browser/notifications/notification_handler.h index 78264f0c..08855633 100644 --- a/chrome/browser/notifications/notification_handler.h +++ b/chrome/browser/notifications/notification_handler.h
@@ -38,7 +38,8 @@ SHARING = 6, ANNOUNCEMENT = 7, NEARBY_SHARE = 8, - MAX = NEARBY_SHARE, + NOTIFICATIONS_MUTED = 9, + MAX = NOTIFICATIONS_MUTED, }; virtual ~NotificationHandler();
diff --git a/chrome/browser/notifications/notification_interactive_uitest.cc b/chrome/browser/notifications/notification_interactive_uitest.cc index 162f46b6..76f8c5b5 100644 --- a/chrome/browser/notifications/notification_interactive_uitest.cc +++ b/chrome/browser/notifications/notification_interactive_uitest.cc
@@ -31,6 +31,7 @@ #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_switches.h" +#include "chrome/grit/generated_resources.h" #include "chrome/test/base/interactive_test_utils.h" #include "chrome/test/base/ui_test_utils.h" #include "components/content_settings/core/common/content_settings_pattern.h" @@ -47,6 +48,7 @@ #include "media/base/media_switches.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/base/window_open_disposition.h" #include "ui/message_center/message_center.h" #include "ui/message_center/notification_blocker.h" @@ -801,35 +803,66 @@ // We should see displayed notifications by default. std::string result = CreateSimpleNotification(browser(), /*wait=*/false); EXPECT_NE("-1", result); - ASSERT_EQ(1, GetNotificationCount()); + message_center::NotificationList::Notifications notifications = + message_center::MessageCenter::Get()->GetVisibleNotifications(); + ASSERT_EQ(1u, notifications.size()); + EXPECT_EQ(base::ASCIIToUTF16("My Title"), (*notifications.begin())->title()); + EXPECT_EQ(base::ASCIIToUTF16("My Body"), (*notifications.begin())->message()); // Open a new tab to a diffent origin from the one that shows notifications. chrome::NewTab(browser()); ui_test_utils::NavigateToURL( browser(), https_server.GetURL("/notifications/notification_tester.html")); - const int screen_cast_tab = browser()->tab_strip_model()->active_index(); + const int screen_capture_tab = browser()->tab_strip_model()->active_index(); - // Start a screen cast session. + // Start a screen capture session. content::WebContents* web_contents = GetActiveWebContents(browser()); EXPECT_TRUE(content::ExecuteScriptAndExtractString( - web_contents, "startScreenCast();", &result)); + web_contents, "startScreenCapture();", &result)); ASSERT_EQ("success", result); - // Showing a notification during the screen cast session should not show it. + // Showing a notification during the screen capture session should show the + // "Notifications muted" notification. browser()->tab_strip_model()->ActivateTabAt(notification_tab); result = CreateSimpleNotification(browser(), /*wait=*/false); EXPECT_NE("-1", result); - ASSERT_EQ(1, GetNotificationCount()); + notifications = + message_center::MessageCenter::Get()->GetVisibleNotifications(); + ASSERT_EQ(2u, notifications.size()); + EXPECT_EQ(l10n_util::GetPluralStringFUTF16(IDS_NOTIFICATION_MUTED_TITLE, + /*count=*/1), + (*notifications.begin())->title()); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_NOTIFICATION_MUTED_MESSAGE), + (*notifications.begin())->message()); - // Stop the screen cast session. - browser()->tab_strip_model()->ActivateTabAt(screen_cast_tab); + // Showing another notification during the screen captuure session should + // update the "Notifications muted" notification title. + result = CreateSimpleNotification(browser(), /*wait=*/false); + EXPECT_NE("-1", result); + notifications = + message_center::MessageCenter::Get()->GetVisibleNotifications(); + ASSERT_EQ(2u, notifications.size()); + EXPECT_EQ(l10n_util::GetPluralStringFUTF16(IDS_NOTIFICATION_MUTED_TITLE, + /*count=*/2), + (*notifications.begin())->title()); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_NOTIFICATION_MUTED_MESSAGE), + (*notifications.begin())->message()); + + // Stop the screen capture session. + browser()->tab_strip_model()->ActivateTabAt(screen_capture_tab); EXPECT_TRUE(content::ExecuteScriptAndExtractString( - web_contents, "stopScreenCast();", &result)); + web_contents, "stopScreenCapture();", &result)); ASSERT_EQ("success", result); - // After stopping the screen cast session we expect the queued notification to - // be shown. - ASSERT_EQ(2, GetNotificationCount()); + // Stopping the screen capture session should display the queued notifications + // and close the "Notifications muted" notification. + notifications = + message_center::MessageCenter::Get()->GetVisibleNotifications(); + ASSERT_EQ(3u, notifications.size()); + for (const auto* notification : notifications) { + EXPECT_EQ(base::ASCIIToUTF16("My Title"), notification->title()); + EXPECT_EQ(base::ASCIIToUTF16("My Body"), notification->message()); + } } #endif // !defined(OS_ANDROID)
diff --git a/chrome/browser/notifications/screen_capture_notification_blocker.cc b/chrome/browser/notifications/screen_capture_notification_blocker.cc index 0db988b..7d9a508 100644 --- a/chrome/browser/notifications/screen_capture_notification_blocker.cc +++ b/chrome/browser/notifications/screen_capture_notification_blocker.cc
@@ -7,12 +7,22 @@ #include <algorithm> #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" +#include "chrome/browser/notifications/notification_display_service.h" +#include "chrome/grit/generated_resources.h" #include "content/public/browser/web_contents.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/message_center/public/cpp/notification.h" #include "url/gurl.h" #include "url/origin.h" -ScreenCaptureNotificationBlocker::ScreenCaptureNotificationBlocker() { +namespace { +const char kMuteNotificationId[] = "notifications_muted"; +} // namespace + +ScreenCaptureNotificationBlocker::ScreenCaptureNotificationBlocker( + NotificationDisplayService* notification_display_service) + : notification_display_service_(notification_display_service) { + DCHECK(notification_display_service_); observer_.Add(MediaCaptureDevicesDispatcher::GetInstance() ->GetMediaStreamCaptureIndicator() .get()); @@ -22,6 +32,10 @@ bool ScreenCaptureNotificationBlocker::ShouldBlockNotification( const message_center::Notification& notification) { + // Don't block if the user clicked on "Show" for the current session. + if (state_ == NotifyState::kShowAll) + return false; + // Don't block if no WebContents currently captures the screen. if (capturing_web_contents_.empty()) return false; @@ -35,6 +49,30 @@ }); } +void ScreenCaptureNotificationBlocker::OnBlockedNotification( + const message_center::Notification& notification) { + ++muted_notification_count_; + if (state_ == NotifyState::kNotifyMuted) + DisplayMuteNotification(); +} + +void ScreenCaptureNotificationBlocker::OnAction( + MutedNotificationHandler::Action action) { + DCHECK(state_ == NotifyState::kNotifyMuted); + CloseMuteNotification(); + + switch (action) { + case MutedNotificationHandler::Action::kUserClose: + case MutedNotificationHandler::Action::kBodyClick: + // Nothing to do here. + break; + case MutedNotificationHandler::Action::kShowClick: + state_ = NotifyState::kShowAll; + NotifyBlockingStateChanged(); + break; + } +} + void ScreenCaptureNotificationBlocker::OnIsCapturingDisplayChanged( content::WebContents* web_contents, bool is_capturing_display) { @@ -43,5 +81,38 @@ else capturing_web_contents_.erase(web_contents); + if (capturing_web_contents_.empty()) { + muted_notification_count_ = 0; + state_ = NotifyState::kNotifyMuted; + CloseMuteNotification(); + } + NotifyBlockingStateChanged(); } + +void ScreenCaptureNotificationBlocker::DisplayMuteNotification() { + message_center::RichNotificationData rich_notification_data; + rich_notification_data.renotify = true; + rich_notification_data.buttons.emplace_back(l10n_util::GetPluralStringFUTF16( + IDS_NOTIFICATION_MUTED_ACTION_SHOW, muted_notification_count_)); + + message_center::Notification notification( + message_center::NOTIFICATION_TYPE_SIMPLE, kMuteNotificationId, + l10n_util::GetPluralStringFUTF16(IDS_NOTIFICATION_MUTED_TITLE, + muted_notification_count_), + l10n_util::GetStringUTF16(IDS_NOTIFICATION_MUTED_MESSAGE), + /*icon=*/gfx::Image(), + /*display_source=*/base::string16(), + /*origin_url=*/GURL(), message_center::NotifierId(), + rich_notification_data, + /*delegate=*/nullptr); + + notification_display_service_->Display( + NotificationHandler::Type::NOTIFICATIONS_MUTED, notification, + /*metadata=*/nullptr); +} + +void ScreenCaptureNotificationBlocker::CloseMuteNotification() { + notification_display_service_->Close( + NotificationHandler::Type::NOTIFICATIONS_MUTED, kMuteNotificationId); +}
diff --git a/chrome/browser/notifications/screen_capture_notification_blocker.h b/chrome/browser/notifications/screen_capture_notification_blocker.h index 868bf74..78ed8c43 100644 --- a/chrome/browser/notifications/screen_capture_notification_blocker.h +++ b/chrome/browser/notifications/screen_capture_notification_blocker.h
@@ -9,12 +9,15 @@ #include "base/gtest_prod_util.h" #include "base/scoped_observer.h" #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" +#include "chrome/browser/notifications/muted_notification_handler.h" #include "chrome/browser/notifications/notification_blocker.h" namespace content { class WebContents; } // namespace content +class NotificationDisplayService; + // This notification blocker listens to the events when the user starts // capturing a display. It will block notifications while such a capture is // ongoing. Note that this does not include casting the whole display and only @@ -22,9 +25,11 @@ // TODO(crbug.com/1131375): Also block notifications while casting a screen. class ScreenCaptureNotificationBlocker : public NotificationBlocker, + public MutedNotificationHandler::Delegate, public MediaStreamCaptureIndicator::Observer { public: - ScreenCaptureNotificationBlocker(); + explicit ScreenCaptureNotificationBlocker( + NotificationDisplayService* notification_display_service); ScreenCaptureNotificationBlocker(const ScreenCaptureNotificationBlocker&) = delete; ScreenCaptureNotificationBlocker& operator=( @@ -34,6 +39,11 @@ // NotificationBlocker: bool ShouldBlockNotification( const message_center::Notification& notification) override; + void OnBlockedNotification( + const message_center::Notification& notification) override; + + // MutedNotificationHandler::Delegate: + void OnAction(MutedNotificationHandler::Action action) override; // MediaStreamCaptureIndicator::Observer: void OnIsCapturingDisplayChanged(content::WebContents* web_contents, @@ -43,6 +53,26 @@ FRIEND_TEST_ALL_PREFIXES(ScreenCaptureNotificationBlockerTest, ObservesMediaStreamCaptureIndicator); + void DisplayMuteNotification(); + void CloseMuteNotification(); + + enum class NotifyState { + // We will show "muted" notifications instead of the actual notifications. + kNotifyMuted, + // The user clicked on "Show" and we show all notifications as usual. + kShowAll, + }; + + NotifyState state_ = NotifyState::kNotifyMuted; + + // Counter for the number of notifications that have been muted during the + // current screen capturing session. + int muted_notification_count_ = 0; + + // The |notification_display_service_| owns a NotificationDisplayQueue which + // owns |this| so a raw pointer is safe here. + NotificationDisplayService* notification_display_service_; + ScopedObserver<MediaStreamCaptureIndicator, MediaStreamCaptureIndicator::Observer> observer_{this};
diff --git a/chrome/browser/notifications/screen_capture_notification_blocker_unittest.cc b/chrome/browser/notifications/screen_capture_notification_blocker_unittest.cc index db31cf3..1f7036e 100644 --- a/chrome/browser/notifications/screen_capture_notification_blocker_unittest.cc +++ b/chrome/browser/notifications/screen_capture_notification_blocker_unittest.cc
@@ -4,13 +4,24 @@ #include "chrome/browser/notifications/screen_capture_notification_blocker.h" +#include "base/optional.h" +#include "base/scoped_observer.h" +#include "base/test/scoped_feature_list.h" +#include "chrome/browser/browser_features.h" #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" +#include "chrome/browser/notifications/muted_notification_handler.h" +#include "chrome/browser/notifications/notification_blocker.h" +#include "chrome/browser/notifications/notification_handler.h" +#include "chrome/browser/notifications/stub_notification_display_service.h" +#include "chrome/grit/generated_resources.h" #include "chrome/test/base/testing_profile.h" #include "content/public/test/browser_task_environment.h" #include "content/public/test/navigation_simulator.h" #include "content/public/test/test_web_contents_factory.h" +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/base/l10n/l10n_util.h" #include "ui/message_center/public/cpp/notification.h" #include "url/gurl.h" @@ -27,12 +38,47 @@ } // namespace +namespace { +constexpr int kShowActionIndex = 0; +} // namespace + +class MockNotificationBlockerObserver : public NotificationBlocker::Observer { + public: + MockNotificationBlockerObserver() = default; + MockNotificationBlockerObserver(const MockNotificationBlockerObserver&) = + delete; + MockNotificationBlockerObserver& operator=( + const MockNotificationBlockerObserver&) = delete; + ~MockNotificationBlockerObserver() override = default; + + // NotificationBlocker::Observer: + MOCK_METHOD(void, OnBlockingStateChanged, (), (override)); +}; + class ScreenCaptureNotificationBlockerTest : public testing::Test { public: - ScreenCaptureNotificationBlockerTest() = default; + ScreenCaptureNotificationBlockerTest() { + scoped_feature_list_.InitAndEnableFeature( + features::kMuteNotificationsDuringScreenShare); + + notification_service_ = + std::make_unique<StubNotificationDisplayService>(&profile_); + auto blocker = std::make_unique<ScreenCaptureNotificationBlocker>( + notification_service_.get()); + blocker_ = blocker.get(); + + notification_service_->OverrideNotificationHandlerForTesting( + NotificationHandler::Type::NOTIFICATIONS_MUTED, + std::make_unique<MutedNotificationHandler>(blocker_)); + + NotificationDisplayQueue::NotificationBlockers blockers; + blockers.push_back(std::move(blocker)); + notification_service_->SetBlockersForTesting(std::move(blockers)); + } + ~ScreenCaptureNotificationBlockerTest() override = default; - ScreenCaptureNotificationBlocker& blocker() { return blocker_; } + ScreenCaptureNotificationBlocker& blocker() { return *blocker_; } content::WebContents* CreateWebContents(const GURL& url) { content::WebContents* contents = @@ -41,11 +87,35 @@ return contents; } + void SimulateClick(const base::Optional<int>& action_index) { + base::Optional<message_center::Notification> notification = + GetMutedNotification(); + ASSERT_TRUE(notification); + notification_service_->SimulateClick( + NotificationHandler::Type::NOTIFICATIONS_MUTED, notification->id(), + action_index, + /*reply=*/base::nullopt); + } + + base::Optional<message_center::Notification> GetMutedNotification() { + std::vector<message_center::Notification> notifications = + notification_service_->GetDisplayedNotificationsForType( + NotificationHandler::Type::NOTIFICATIONS_MUTED); + // Only one instance of the notification should be on screen. + EXPECT_LE(notifications.size(), 1u); + + if (notifications.empty()) + return base::nullopt; + return notifications[0]; + } + private: content::BrowserTaskEnvironment task_environment_; + base::test::ScopedFeatureList scoped_feature_list_; TestingProfile profile_; content::TestWebContentsFactory web_contents_factory_; - ScreenCaptureNotificationBlocker blocker_; + std::unique_ptr<StubNotificationDisplayService> notification_service_; + ScreenCaptureNotificationBlocker* blocker_; }; TEST_F(ScreenCaptureNotificationBlockerTest, ShouldNotBlockWhenNotCapturing) { @@ -125,3 +195,128 @@ .get(); EXPECT_TRUE(blocker().observer_.IsObserving(indicator)); } + +TEST_F(ScreenCaptureNotificationBlockerTest, ShowsMutedNotification) { + EXPECT_FALSE(GetMutedNotification()); + + blocker().OnIsCapturingDisplayChanged( + CreateWebContents(GURL("https://example1.com")), true); + blocker().OnBlockedNotification( + CreateNotification(GURL("https://example2.com"))); + + base::Optional<message_center::Notification> notification = + GetMutedNotification(); + ASSERT_TRUE(notification); + + EXPECT_TRUE(notification->renotify()); + EXPECT_EQ(message_center::NOTIFICATION_TYPE_SIMPLE, notification->type()); + EXPECT_EQ(l10n_util::GetPluralStringFUTF16(IDS_NOTIFICATION_MUTED_TITLE, + /*count=*/1), + notification->title()); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_NOTIFICATION_MUTED_MESSAGE), + notification->message()); + ASSERT_EQ(1u, notification->buttons().size()); + EXPECT_EQ(l10n_util::GetPluralStringFUTF16(IDS_NOTIFICATION_MUTED_ACTION_SHOW, + /*count=*/1), + notification->buttons()[0].title); +} + +TEST_F(ScreenCaptureNotificationBlockerTest, UpdatesMutedNotification) { + constexpr int kCount = 10; + blocker().OnIsCapturingDisplayChanged( + CreateWebContents(GURL("https://example1.com")), true); + + for (int i = 0; i < kCount; ++i) { + blocker().OnBlockedNotification( + CreateNotification(GURL("https://example2.com"))); + } + + base::Optional<message_center::Notification> notification = + GetMutedNotification(); + ASSERT_TRUE(notification); + + EXPECT_EQ( + l10n_util::GetPluralStringFUTF16(IDS_NOTIFICATION_MUTED_TITLE, kCount), + notification->title()); + EXPECT_EQ(l10n_util::GetStringUTF16(IDS_NOTIFICATION_MUTED_MESSAGE), + notification->message()); + ASSERT_EQ(1u, notification->buttons().size()); + EXPECT_EQ(l10n_util::GetPluralStringFUTF16(IDS_NOTIFICATION_MUTED_ACTION_SHOW, + kCount), + notification->buttons()[0].title); +} + +TEST_F(ScreenCaptureNotificationBlockerTest, ClosesMutedNotification) { + content::WebContents* contents = + CreateWebContents(GURL("https://example1.com")); + // No notification initially. + blocker().OnIsCapturingDisplayChanged(contents, true); + EXPECT_FALSE(GetMutedNotification()); + + // Expect a notification once we block one. + blocker().OnBlockedNotification( + CreateNotification(GURL("https://example2.com"))); + EXPECT_TRUE(GetMutedNotification()); + + // Expect notification to be closed when capturing stops. + blocker().OnIsCapturingDisplayChanged(contents, false); + EXPECT_FALSE(GetMutedNotification()); +} + +TEST_F(ScreenCaptureNotificationBlockerTest, + ClosesMutedNotificationOnBodyClick) { + blocker().OnIsCapturingDisplayChanged( + CreateWebContents(GURL("https://example1.com")), true); + blocker().OnBlockedNotification( + CreateNotification(GURL("https://example2.com"))); + + // Expect notification to be closed after clicking on its body. + SimulateClick(/*action_index=*/base::nullopt); + EXPECT_FALSE(GetMutedNotification()); +} + +TEST_F(ScreenCaptureNotificationBlockerTest, ShowsMutedNotificationAfterClose) { + blocker().OnIsCapturingDisplayChanged( + CreateWebContents(GURL("https://example1.com")), true); + blocker().OnBlockedNotification( + CreateNotification(GURL("https://example2.com"))); + + // Blocking another notification after closing the muted one should show a new + // one with an updated message. + SimulateClick(/*action_index=*/base::nullopt); + blocker().OnBlockedNotification( + CreateNotification(GURL("https://example2.com"))); + + base::Optional<message_center::Notification> notification = + GetMutedNotification(); + ASSERT_TRUE(notification); + EXPECT_EQ(l10n_util::GetPluralStringFUTF16(IDS_NOTIFICATION_MUTED_TITLE, + /*count=*/2), + notification->title()); +} + +TEST_F(ScreenCaptureNotificationBlockerTest, ShowAction) { + MockNotificationBlockerObserver observer; + ScopedObserver<NotificationBlocker, NotificationBlocker::Observer> + scoped_observer(&observer); + scoped_observer.Add(&blocker()); + + EXPECT_CALL(observer, OnBlockingStateChanged); + blocker().OnIsCapturingDisplayChanged( + CreateWebContents(GURL("https://example1.com")), true); + testing::Mock::VerifyAndClearExpectations(&observer); + + message_center::Notification notification = + CreateNotification(GURL("https://example2.com")); + blocker().OnBlockedNotification(notification); + EXPECT_TRUE(blocker().ShouldBlockNotification(notification)); + + // Showing should close the "Notifications muted" notification and allow + // showing future web notifications. + EXPECT_CALL(observer, OnBlockingStateChanged); + SimulateClick(kShowActionIndex); + testing::Mock::VerifyAndClearExpectations(&observer); + + EXPECT_FALSE(GetMutedNotification()); + EXPECT_FALSE(blocker().ShouldBlockNotification(notification)); +}
diff --git a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc index 26b003a..b2e774a 100644 --- a/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc +++ b/chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc
@@ -92,6 +92,7 @@ using page_load_metrics::PageLoadMetricsTestWaiter; using TimingField = page_load_metrics::PageLoadMetricsTestWaiter::TimingField; using WebFeature = blink::mojom::WebFeature; +using testing::SizeIs; using testing::UnorderedElementsAre; using NoStatePrefetch = ukm::builders::NoStatePrefetch; @@ -1642,7 +1643,7 @@ const auto& entries = test_ukm_recorder_->GetEntriesByName( ukm::builders::Blink_UseCounter::kEntryName); - EXPECT_EQ(5u, entries.size()); + EXPECT_THAT(entries, SizeIs(4)); std::vector<int64_t> ukm_features; for (const auto* entry : entries) { test_ukm_recorder_->ExpectEntrySourceHasUrl(entry, url); @@ -1660,10 +1661,7 @@ static_cast<int64_t>(WebFeature::kFullscreenSecureOrigin), static_cast<int64_t>(WebFeature::kNavigatorVibrate), static_cast<int64_t>( - WebFeature::kApplicationCacheManifestSelectSecureOrigin), - static_cast<int64_t>( - WebFeature:: - kAddressSpaceLocalEmbeddedInUnknownNonSecureContext))); + WebFeature::kApplicationCacheManifestSelectSecureOrigin))); } // Test UseCounter UKM mixed content features observed. @@ -1686,7 +1684,7 @@ const auto& entries = test_ukm_recorder_->GetEntriesByName( ukm::builders::Blink_UseCounter::kEntryName); - EXPECT_EQ(8u, entries.size()); + EXPECT_THAT(entries, SizeIs(7)); std::vector<int64_t> ukm_features; for (const auto* entry : entries) { test_ukm_recorder_->ExpectEntrySourceHasUrl(entry, url); @@ -1697,20 +1695,16 @@ DCHECK(metric); ukm_features.push_back(*metric); } - EXPECT_THAT( - ukm_features, - UnorderedElementsAre( - static_cast<int64_t>(WebFeature::kPageVisits), - static_cast<int64_t>(WebFeature::kFullscreenSecureOrigin), - static_cast<int64_t>(WebFeature::kNavigatorVibrate), - static_cast<int64_t>( - WebFeature::kApplicationCacheManifestSelectSecureOrigin), - static_cast<int64_t>(WebFeature::kMixedContentImage), - static_cast<int64_t>(WebFeature::kMixedContentAudio), - static_cast<int64_t>(WebFeature::kMixedContentVideo), - static_cast<int64_t>( - WebFeature:: - kAddressSpaceLocalEmbeddedInUnknownNonSecureContext))); + EXPECT_THAT(ukm_features, + UnorderedElementsAre( + static_cast<int64_t>(WebFeature::kPageVisits), + static_cast<int64_t>(WebFeature::kFullscreenSecureOrigin), + static_cast<int64_t>(WebFeature::kNavigatorVibrate), + static_cast<int64_t>( + WebFeature::kApplicationCacheManifestSelectSecureOrigin), + static_cast<int64_t>(WebFeature::kMixedContentImage), + static_cast<int64_t>(WebFeature::kMixedContentAudio), + static_cast<int64_t>(WebFeature::kMixedContentVideo))); } // Test UseCounter Features observed in a child frame are recorded, exactly
diff --git a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.cc b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.cc index 5185d9c..1f183f97 100644 --- a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.cc +++ b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.cc
@@ -80,17 +80,17 @@ DCHECK(driver_); if (is_password_field) { driver_->FillIntoFocusedField(is_password_field, password); + + // `client_` is guaranteed to be valid here. + // Both the `client_` and `PasswordAccessoryController` are attached to + // WebContents. And AllPasswordBottomSheetController is owned by + // PasswordAccessoryController. + DCHECK(client_); + client_->OnPasswordSelected(password); } else { driver_->FillIntoFocusedField(is_password_field, username); } - // `client_` is guaranteed to be valid here. - // Both the `client_` and `PasswordAccessoryController` are attached to - // WebContents. And AllPasswordBottomSheetController is owned by - // PasswordAccessoryController. - DCHECK(client_); - client_->OnPasswordSelected(password); - // Consumes the dismissal callback to destroy the native controller and java // controller after the user selects a credential. OnDismiss();
diff --git a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller_unittest.cc b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller_unittest.cc index 6728462d..cda0f2b 100644 --- a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller_unittest.cc +++ b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller_unittest.cc
@@ -92,6 +92,11 @@ class AllPasswordsBottomSheetControllerTest : public testing::Test { protected: AllPasswordsBottomSheetControllerTest() { + createAllPasswordsController(FocusedFieldType::kFillablePasswordField); + } + + void createAllPasswordsController( + autofill::mojom::FocusedFieldType focused_field_type) { std::unique_ptr<MockAllPasswordsBottomSheetView> mock_view_unique_ptr = std::make_unique<MockAllPasswordsBottomSheetView>(); mock_view_ = mock_view_unique_ptr.get(); @@ -99,8 +104,7 @@ std::make_unique<AllPasswordsBottomSheetController>( util::PassKey<AllPasswordsBottomSheetControllerTest>(), std::move(mock_view_unique_ptr), driver_.AsWeakPtr(), store_.get(), - dissmissal_callback_.Get(), - FocusedFieldType::kFillablePasswordField, + dissmissal_callback_.Get(), focused_field_type, mock_pwd_manager_client_.get()); } @@ -178,3 +182,12 @@ all_passwords_controller()->OnCredentialSelected( base::UTF8ToUTF16(kUsername1), base::UTF8ToUTF16(kPassword)); } + +TEST_F(AllPasswordsBottomSheetControllerTest, + PhishGuardIsNotCalledForUsername) { + createAllPasswordsController(FocusedFieldType::kFillableUsernameField); + EXPECT_CALL(client(), OnPasswordSelected).Times(0); + + all_passwords_controller()->OnCredentialSelected( + base::UTF8ToUTF16(kUsername1), base::UTF8ToUTF16(kPassword)); +}
diff --git a/chrome/browser/privacy_budget/privacy_budget_browsertest.cc b/chrome/browser/privacy_budget/privacy_budget_browsertest.cc index 0f3b44ad..73819d0d1 100644 --- a/chrome/browser/privacy_budget/privacy_budget_browsertest.cc +++ b/chrome/browser/privacy_budget/privacy_budget_browsertest.cc
@@ -155,7 +155,7 @@ // adjust this test to deal. ASSERT_EQ(1u, merged_entries.size()); - constexpr uint64_t input_digest = 0; + constexpr uint64_t input_digest = 9; EXPECT_THAT(merged_entries.begin()->second->metrics, IsSupersetOf({ Key(blink::IdentifiableSurface::FromTypeAndToken(
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 2b78362..cdf2557 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -149,10 +149,10 @@ this); // Incognito is not available for ephemeral Guest profiles. - CHECK(!profile_->IsEphemeralGuestProfile()); + CHECK(!IsIncognitoProfile() || !profile_->IsEphemeralGuestProfile()); // Always crash when incognito is not available. - CHECK(!profile_->IsIncognitoProfile() || + CHECK(!IsIncognitoProfile() || IncognitoModePrefs::GetAvailability(profile_->GetPrefs()) != IncognitoModePrefs::DISABLED);
diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc index 4829292..7fb84ac 100644 --- a/chrome/browser/profiles/profile_browsertest.cc +++ b/chrome/browser/profiles/profile_browsertest.cc
@@ -26,6 +26,7 @@ #include "base/task/post_task.h" #include "base/task/thread_pool/thread_pool_instance.h" #include "base/test/bind_test_util.h" +#include "base/test/scoped_feature_list.h" #include "base/threading/thread_restrictions.h" #include "base/values.h" #include "base/version.h" @@ -40,6 +41,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/common/chrome_constants.h" +#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/in_process_browser_test.h" @@ -913,3 +915,62 @@ EXPECT_EQ(nullptr, Browser::Create(Browser::CreateParams( otr_profile, /* user_gesture = */ false))); } + +#if !defined(OS_ANDROID) && !defined(OS_CHROMEOS) +class EphemeralGuestProfileBrowserTest : public ProfileBrowserTest { + public: + EphemeralGuestProfileBrowserTest() { + scoped_feature_list_.InitAndEnableFeature( + features::kEnableEphemeralGuestProfilesOnDesktop); + } + + private: + base::test::ScopedFeatureList scoped_feature_list_; +}; + +// Tests profile type functions on an ephemeral Guest profile. +IN_PROC_BROWSER_TEST_F(EphemeralGuestProfileBrowserTest, TestProfileType) { + Profile* guest_profile = CreateGuestBrowser()->profile(); + + EXPECT_TRUE(guest_profile->IsRegularProfile()); + EXPECT_FALSE(guest_profile->IsOffTheRecord()); + EXPECT_FALSE(guest_profile->IsGuestSession()); + EXPECT_TRUE(guest_profile->IsEphemeralGuestProfile()); +} + +// Tests if ephemeral Guest profile paths are persistent as long as one does not +// close all Guest browsers. +IN_PROC_BROWSER_TEST_F(EphemeralGuestProfileBrowserTest, + TestProfilePathIsStableWhileNotClosed) { + Browser* guest1 = CreateGuestBrowser(); + base::FilePath guest_path1 = guest1->profile()->GetPath(); + + Browser* guest2 = CreateGuestBrowser(); + base::FilePath guest_path2 = guest2->profile()->GetPath(); + + EXPECT_EQ(guest_path1, guest_path2); + + CloseBrowserSynchronously(guest1); + + Browser* guest3 = CreateGuestBrowser(); + base::FilePath guest_path3 = guest3->profile()->GetPath(); + + EXPECT_EQ(guest_path1, guest_path3); +} + +// Tests if closing all ephemeral Guest profiles will result in a new path for +// the next ephemeral Guest profile. +IN_PROC_BROWSER_TEST_F(EphemeralGuestProfileBrowserTest, + TestGuestGetsNewPathAfterClosing) { + Browser* guest1 = CreateGuestBrowser(); + base::FilePath guest_path1 = guest1->profile()->GetPath(); + + CloseBrowserSynchronously(guest1); + + Browser* guest2 = CreateGuestBrowser(); + base::FilePath guest_path2 = guest2->profile()->GetPath(); + + EXPECT_NE(guest_path1, guest_path2); +} + +#endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc index 0fe2430..1eb25742 100644 --- a/chrome/browser/profiles/profile_manager_unittest.cc +++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -617,7 +617,13 @@ Profile* profile = profile_manager->GetLastUsedProfileAllowedByPolicy(); ASSERT_TRUE(profile); - EXPECT_TRUE(profile->IsOffTheRecord()); + if (IsEphemeral()) { + EXPECT_TRUE(profile->IsEphemeralGuestProfile()); + EXPECT_FALSE(profile->IsOffTheRecord()); + } else { + EXPECT_TRUE(profile->IsGuestSession()); + EXPECT_TRUE(profile->IsOffTheRecord()); + } } #if defined(OS_CHROMEOS) @@ -649,9 +655,6 @@ expected_path = expected_path.Append(kExpectedGuestProfileName); #endif EXPECT_EQ(expected_path, guest_path); - - // TODO(https://crbug.com/1125474): Add browser test to ensure two ephemeral - // Guest profile do not share the path. } INSTANTIATE_TEST_SUITE_P(All,
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_en-GB.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_en-GB.xtb index c7906c2..b65cf68c 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_en-GB.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_en-GB.xtb
@@ -456,6 +456,7 @@ <translation id="4402014469255336455">Deep Sky Blue</translation> <translation id="4406249099130339147">Punctuation echo:</translation> <translation id="4432457053224379116">Indian Red</translation> +<translation id="4432896207833262240">Marked content</translation> <translation id="4437615272777527928">Type to search the menus. Use the up and down arrows to cycle through results. Use the left and right arrows to adjust the text caret, and to move between menus.</translation> <translation id="4457472090507035117">Select current voice:</translation> <translation id="4476183483923481720">new line</translation>
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_fil.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_fil.xtb index 85f79f5..c9d59a5 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_fil.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_fil.xtb
@@ -456,6 +456,7 @@ <translation id="4402014469255336455">Deep Sky Blue</translation> <translation id="4406249099130339147">Echo ng bantas:</translation> <translation id="4432457053224379116">Indian Red</translation> +<translation id="4432896207833262240">Minarkahang content</translation> <translation id="4437615272777527928">Mag-type para maghanap sa mga menu. Gamitin ang mga pataas at pababang arrow para makita ang mga resulta. Gamitin ang mga pakaliwa at pakanang arrow para maisaayos ang text caret, at para magpalipat-lipat sa mga menu.</translation> <translation id="4457472090507035117">Piliin ang kasalukuyang boses:</translation> <translation id="4476183483923481720">bagong linya</translation>
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb index 68356ce3..63d0dc5 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_hy.xtb
@@ -456,6 +456,7 @@ <translation id="4402014469255336455">Մուգ երկնագույն</translation> <translation id="4406249099130339147">Կետադրական նշանների արձագանք՝</translation> <translation id="4432457053224379116">Հնդկական կարմիր</translation> +<translation id="4432896207833262240">Նշված բովանդակություն</translation> <translation id="4437615272777527928">Մուտքագրեք տեքստը, որն անհրաժեշտ է գտնել ընտրացանկերում։ Մեկ արդյունքից մյուսն անցնելու համար օգտագործեք «վեր» և «վար» սլաքները։ Տեքստի նշորդը տեղաշարժելու և մեկ ընտրացանկից մյուսն անցնելու համար օգտագործեք «ձախ» և «աջ» սլաքները։</translation> <translation id="4457472090507035117">Ընտրեք ընթացիկ ձայնը`</translation> <translation id="4476183483923481720">նոր տող</translation>
diff --git a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_si.xtb b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_si.xtb index 1e57006..8cef483 100644 --- a/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_si.xtb +++ b/chrome/browser/resources/chromeos/accessibility/strings/accessibility_strings_si.xtb
@@ -456,6 +456,7 @@ <translation id="4402014469255336455">ගැඹුරු අහස් නිල්</translation> <translation id="4406249099130339147">විරාම ලකුණු දෝංකාරය:</translation> <translation id="4432457053224379116">ඉන්දියානු රතු</translation> +<translation id="4432896207833262240">ලකුණු කළ අන්තර්ගතය</translation> <translation id="4437615272777527928">මෙනුවල සෙවීමට ටයිප් කරන්න. ප්රතිඵල අතරින් එහා මෙහා වීමට ඉහළ සහ පහළ ඊතල භාවිත කරන්න. පාඨ කැරට් ගැළපීමට සහ මෙනු අතර එහා මෙහා යාමට වම් සහ දකුණු ඊතල භාවිත කරන්න.</translation> <translation id="4457472090507035117">වත්මන් හඬ තෝරන්න:</translation> <translation id="4476183483923481720">නව පේළිය</translation>
diff --git a/chrome/browser/resources/chromeos/login/cr_ui.js b/chrome/browser/resources/chromeos/login/cr_ui.js index b231a38..061d84d 100644 --- a/chrome/browser/resources/chromeos/login/cr_ui.js +++ b/chrome/browser/resources/chromeos/login/cr_ui.js
@@ -175,14 +175,6 @@ }; /** - * Updates the device requisition string shown in the requisition prompt. - * @param {string} requisition The device requisition. - */ - Oobe.updateDeviceRequisition = function(requisition) { - Oobe.getInstance().updateDeviceRequisition(requisition); - }; - - /** * Clears password field in user-pod. */ Oobe.clearUserPodPassword = function() { @@ -299,7 +291,7 @@ * Hotrod requisition for telemetry. */ Oobe.remoraRequisitionForTesting = function() { - chrome.send('setDeviceRequisition', ['remora']); + chrome.send('WelcomeScreen.setDeviceRequisition', ['remora']); }; /**
diff --git a/chrome/browser/resources/chromeos/login/enterprise_enrollment.js b/chrome/browser/resources/chromeos/login/enterprise_enrollment.js index 36730ec..6558a77 100644 --- a/chrome/browser/resources/chromeos/login/enterprise_enrollment.js +++ b/chrome/browser/resources/chromeos/login/enterprise_enrollment.js
@@ -177,7 +177,6 @@ ready() { this.initializeLoginScreen('OAuthEnrollmentScreen', { - changeRequisitonProhibited: true, resetAllowed: true, });
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome.js b/chrome/browser/resources/chromeos/login/oobe_welcome.js index d4085ea..1310e2d 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome.js +++ b/chrome/browser/resources/chromeos/login/oobe_welcome.js
@@ -82,6 +82,8 @@ 'onInputMethodIdSetFromBackend', 'refreshA11yInfo', 'showDemoModeConfirmationDialog', + 'showEditRequisitionDialog', + 'showRemoraRequisitionDialog', ], /** @@ -420,6 +422,49 @@ this.userActed('setupDemoModeGesture'); }, + /** + * Shows the device requisition prompt. + */ + showEditRequisitionDialog(requisition) { + if (!this.deviceRequisitionDialog_) { + this.deviceRequisitionDialog_ = + new cr.ui.dialogs.PromptDialog(document.body); + this.deviceRequisitionDialog_.setOkLabel( + loadTimeData.getString('deviceRequisitionPromptOk')); + this.deviceRequisitionDialog_.setCancelLabel( + loadTimeData.getString('deviceRequisitionPromptCancel')); + } + this.deviceRequisitionDialog_.show( + loadTimeData.getString('deviceRequisitionPromptText'), requisition, + function(value) { + chrome.send( + 'WelcomeScreen.setDeviceRequisition', + [value == '' ? 'none' : value]); + }); + }, + + /** + * Shows the special remora/shark device requisition prompt. + */ + showRemoraRequisitionDialog() { + if (!this.deviceRequisitionRemoraDialog_) { + this.deviceRequisitionRemoraDialog_ = + new cr.ui.dialogs.ConfirmDialog(document.body); + this.deviceRequisitionRemoraDialog_.setOkLabel( + loadTimeData.getString('deviceRequisitionRemoraPromptOk')); + this.deviceRequisitionRemoraDialog_.setCancelLabel( + loadTimeData.getString('deviceRequisitionRemoraPromptCancel')); + } + this.deviceRequisitionRemoraDialog_.show( + loadTimeData.getString('deviceRequisitionRemoraPromptText'), + function() { // onShow + chrome.send('WelcomeScreen.setDeviceRequisition', ['remora']); + }, + function() { // onCancel + chrome.send('WelcomeScreen.setDeviceRequisition', ['none']); + }); + }, + onKeyboardsChanged_() { this.currentKeyboard = getSelectedTitle(this.keyboards); },
diff --git a/chrome/browser/resources/discards/graph_doc.js b/chrome/browser/resources/discards/graph_doc.js index a2a86dde9..52d39db 100644 --- a/chrome/browser/resources/discards/graph_doc.js +++ b/chrome/browser/resources/discards/graph_doc.js
@@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {FavIconInfo, FrameInfo, GraphChangeStreamInterface, PageInfo, ProcessInfo, WorkerInfo} from './chrome/browser/ui/webui/discards/discards.mojom-webui.js'; +// This file is loaded into a <webview> and cannot reference any chrome: +// resources. The only communication to and from this implementation and the +// WebUI is through postMessage. // Radius of a node circle. const /** number */ kNodeRadius = 6;
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html index 24891b9..3fec1244 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
@@ -627,69 +627,6 @@ </template> </settings-subpage> </template> - <template is="dom-if" route-path="/content/flash" no-search> - <settings-subpage page-title="$i18n{siteSettingsFlash}" - search-label="$i18n{siteSettingsAllSitesSearch}" - search-term="{{searchFilter_}}"> - <div class="cr-row first no-outline"> - $i18n{siteSettingsFlashPermissionsEphemeral} - </div> - <div class="cr-row-gap cr-secondary-text" - hidden="[[!pluginsHasDiscardedExceptions_]]"> - $i18nRaw{warningAboutIgnoredWildcardedPatternsForFlash} - </div> - <template is="dom-if" if="[[enableContentSettingsRedesign_]]"> - <div class="content-settings-header"> - <h2>$i18n{siteSettingsFlashDescription}</h2> - </div> - <settings-category-default-radio-group - category="[[ContentSettingsTypes.PLUGINS]]" - allow-option-label="$i18n{siteSettingsFlashAllowed}" - allow-option-icon="cr:extension" - block-option-label="$i18n{siteSettingsFlashBlocked}" - block-option-icon="settings:block"> - </settings-category-default-radio-group> - </template> - <template is="dom-if" if="[[!enableContentSettingsRedesign_]]"> - <category-default-setting - category="[[ContentSettingsTypes.PLUGINS]]" - toggle-off-label="$i18n{siteSettingsFlashBlockRecommended}" - toggle-on-label="$i18n{siteSettingsFlashAskFirst}"> - </category-default-setting> - </template> -<if expr="chromeos"> - <a class="cr-row inherit-color no-outline" tabindex="-1" - target="_blank" - href="https://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html"> - <div class="flex">$i18n{adobeFlashStorage}</div> - <cr-icon-button class="icon-external" - aria-label="$i18n{adobeFlashStorage}"></cr-icon-button> - </a> -</if> - <template is="dom-if" if="[[enableContentSettingsRedesign_]]"> - <category-setting-exceptions - category="[[ContentSettingsTypes.PLUGINS]]" - allow-header="$i18n{siteSettingsFlashAllowedExceptions}" - block-header="$i18n{siteSettingsFlashBlockedExceptions}" - read-only-list - search-filter="[[searchFilter_]]" - site-lists-have-discarded-exceptions= - "{{pluginsHasDiscardedExceptions_}}"> - </category-setting-exceptions> - </template> - <template is="dom-if" if="[[!enableContentSettingsRedesign_]]"> - <category-setting-exceptions - category="[[ContentSettingsTypes.PLUGINS]]" - block-header="$i18n{siteSettingsBlock}" - allow-header="$i18n{siteSettingsAllow}" - read-only-list - search-filter="[[searchFilter_]]" - site-lists-have-discarded-exceptions= - "{{pluginsHasDiscardedExceptions_}}"> - </category-setting-exceptions> - </template> - </settings-subpage> - </template> <template is="dom-if" route-path="/content/popups" no-search> <settings-subpage page-title="$i18n{siteSettingsCategoryPopups}" search-label="$i18n{siteSettingsAllSitesSearch}"
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.js b/chrome/browser/resources/settings/privacy_page/privacy_page.js index ae7466a..acd4ee3 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_page.js +++ b/chrome/browser/resources/settings/privacy_page/privacy_page.js
@@ -205,16 +205,6 @@ /** @private */ siteDataFilter_: String, - - /** - * Boolean which keeps a track if any of the displayed lists has discarded - * content setting patterns and hides the warning message accordingly. - * @private - */ - pluginsHasDiscardedExceptions_: { - type: Boolean, - value: false, - }, }, /** @private {?PrivacyPageBrowserProxy} */
diff --git a/chrome/browser/resources/settings/route.js b/chrome/browser/resources/settings/route.js index 628c280..24f09c0 100644 --- a/chrome/browser/resources/settings/route.js +++ b/chrome/browser/resources/settings/route.js
@@ -54,7 +54,6 @@ r.SITE_SETTINGS_LOCATION = r.SITE_SETTINGS.createChild('location'); r.SITE_SETTINGS_MICROPHONE = r.SITE_SETTINGS.createChild('microphone'); r.SITE_SETTINGS_NOTIFICATIONS = r.SITE_SETTINGS.createChild('notifications'); - r.SITE_SETTINGS_FLASH = r.SITE_SETTINGS.createChild('flash'); r.SITE_SETTINGS_POPUPS = r.SITE_SETTINGS.createChild('popups'); r.SITE_SETTINGS_UNSANDBOXED_PLUGINS = r.SITE_SETTINGS.createChild('unsandboxedPlugins');
diff --git a/chrome/browser/resources/settings/settings_routes.js b/chrome/browser/resources/settings/settings_routes.js index 3a33f7c..39ede59 100644 --- a/chrome/browser/resources/settings/settings_routes.js +++ b/chrome/browser/resources/settings/settings_routes.js
@@ -56,7 +56,6 @@ * SITE_SETTINGS_CLIPBOARD: !Route, * SITE_SETTINGS_COOKIES: !Route, * SITE_SETTINGS_DATA_DETAILS: !Route, - * SITE_SETTINGS_FLASH: !Route, * SITE_SETTINGS_FONT_ACCESS: !Route, * SITE_SETTINGS_HANDLERS: !Route, * SITE_SETTINGS_HID_DEVICES: !Route,
diff --git a/chrome/browser/resources/settings/site_settings/README.md b/chrome/browser/resources/settings/site_settings/README.md index fb80457..6fb139f 100644 --- a/chrome/browser/resources/settings/site_settings/README.md +++ b/chrome/browser/resources/settings/site_settings/README.md
@@ -93,7 +93,7 @@ the browser. The class is declared in -[site_settings_prefs_browser_proxy.js](https://cs.chromium.org/chromium/src/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js?q=clearFlashPref&dr=CSs&l=236) +[site_settings_prefs_browser_proxy.js](https://cs.chromium.org/chromium/src/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js) and the browser implementation resides in [site_settings_handler.h](https://cs.chromium.org/chromium/src/chrome/browser/ui/webui/settings/site_settings_handler.h?type=cs&g=0). Make sure to
diff --git a/chrome/browser/resources/settings/site_settings/all_sites.js b/chrome/browser/resources/settings/site_settings/all_sites.js index af98625ed..cae973a 100644 --- a/chrome/browser/resources/settings/site_settings/all_sites.js +++ b/chrome/browser/resources/settings/site_settings/all_sites.js
@@ -644,9 +644,6 @@ const contentSettingsTypes = this.getCategoryList(); this.browserProxy.setOriginPermissions( origin, contentSettingsTypes, ContentSetting.DEFAULT); - if (contentSettingsTypes.includes(ContentSettingsTypes.PLUGINS)) { - this.browserProxy.clearFlashPref(origin); - } }, /**
diff --git a/chrome/browser/resources/settings/site_settings/category_default_setting.js b/chrome/browser/resources/settings/site_settings/category_default_setting.js index 1f4e519..0a9d210 100644 --- a/chrome/browser/resources/settings/site_settings/category_default_setting.js +++ b/chrome/browser/resources/settings/site_settings/category_default_setting.js
@@ -194,13 +194,6 @@ this.category, this.categoryEnabled ? ContentSetting.ASK : ContentSetting.BLOCK); break; - case ContentSettingsTypes.PLUGINS: - // "Run important content" vs. "Block". - this.browserProxy.setDefaultValueForContentType( - this.category, - this.categoryEnabled ? ContentSetting.IMPORTANT_CONTENT : - ContentSetting.BLOCK); - break; default: assertNotReached('Invalid category: ' + this.category); }
diff --git a/chrome/browser/resources/settings/site_settings/constants.js b/chrome/browser/resources/settings/site_settings/constants.js index 8a36821..a0870de 100644 --- a/chrome/browser/resources/settings/site_settings/constants.js +++ b/chrome/browser/resources/settings/site_settings/constants.js
@@ -32,7 +32,6 @@ MIXEDSCRIPT: 'mixed-script', NOTIFICATIONS: 'notifications', PAYMENT_HANDLER: 'payment-handler', - PLUGINS: 'plugins', // AKA Flash. POPUPS: 'popups', PROTECTED_CONTENT: 'protected-content', PROTOCOL_HANDLERS: 'register-protocol-handler',
diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.js b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.js index 78ca938..065cb80c 100644 --- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.js +++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.js
@@ -113,9 +113,6 @@ case ContentSettingsTypes.WINDOW_PLACEMENT: // "Ask" vs "Blocked". return ContentSetting.ASK; - case ContentSettingsTypes.PLUGINS: - // "Run important content" vs. "Block". - return ContentSetting.IMPORTANT_CONTENT; default: assertNotReached('Invalid category: ' + this.category); return ContentSetting.ALLOW;
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html index 41e59a52..f30d06c 100644 --- a/chrome/browser/resources/settings/site_settings/site_details.html +++ b/chrome/browser/resources/settings/site_settings/site_details.html
@@ -141,9 +141,6 @@ <site-details-permission category="[[ContentSettingsTypes.JAVASCRIPT]]" icon="settings:code" label="$i18n{siteSettingsJavascript}"> </site-details-permission> - <site-details-permission category="[[ContentSettingsTypes.PLUGINS]]" - icon="cr:extension" label="$i18n{siteSettingsFlash}"> - </site-details-permission> <site-details-permission category="[[ContentSettingsTypes.IMAGES]]" icon="settings:photo" label="$i18n{siteSettingsImages}"> </site-details-permission>
diff --git a/chrome/browser/resources/settings/site_settings/site_details.js b/chrome/browser/resources/settings/site_settings/site_details.js index a3d09b68..6e7b51bf 100644 --- a/chrome/browser/resources/settings/site_settings/site_details.js +++ b/chrome/browser/resources/settings/site_settings/site_details.js
@@ -295,9 +295,6 @@ onResetSettings_(e) { this.browserProxy.setOriginPermissions( this.origin_, this.getCategoryList(), ContentSetting.DEFAULT); - if (this.getCategoryList().includes(ContentSettingsTypes.PLUGINS)) { - this.browserProxy.clearFlashPref(this.origin_); - } this.onCloseDialog_(e); },
diff --git a/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js b/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js index 2043789f..5dcfeb2 100644 --- a/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js +++ b/chrome/browser/resources/settings/site_settings/site_settings_prefs_browser_proxy.js
@@ -245,13 +245,6 @@ setOriginPermissions(origin, contentTypes, blanketSetting) {} /** - * Clears the flag that's set when the user has changed the Flash permission - * for this particular origin. - * @param {string} origin The origin to clear the Flash preference for. - */ - clearFlashPref(origin) {} - - /** * Resets the category permission for a given origin (expressed as primary * and secondary patterns). Only use this if intending to remove an * exception - use setOriginPermissions() for origin-scoped settings. @@ -469,11 +462,6 @@ } /** @override */ - clearFlashPref(origin) { - chrome.send('clearFlashPref', [origin]); - } - - /** @override */ resetCategoryPermissionForPattern( primaryPattern, secondaryPattern, contentType, incognito) { chrome.send(
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.js b/chrome/browser/resources/settings/site_settings_page/site_settings_page.js index 2d7471a..2546de8 100644 --- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.js +++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.js
@@ -229,14 +229,6 @@ icon: 'settings:pdf', }, { - route: routes.SITE_SETTINGS_FLASH, - id: Id.PLUGINS, - label: 'siteSettingsFlash', - icon: 'cr:extension', - enabledLabel: 'siteSettingsFlashAskFirst', - disabledLabel: 'siteSettingsFlashBlock', - }, - { route: routes.SITE_SETTINGS_POPUPS, id: Id.POPUPS, label: 'siteSettingsPopups', @@ -394,7 +386,6 @@ contentBasic: buildItemListFromIds([ Id.COOKIES, Id.JAVASCRIPT, - Id.PLUGINS, Id.IMAGES, Id.POPUPS, ]),
diff --git a/chrome/browser/sharing/sharing_message_bridge_impl.cc b/chrome/browser/sharing/sharing_message_bridge_impl.cc index 083e974..e30a7db 100644 --- a/chrome/browser/sharing/sharing_message_bridge_impl.cc +++ b/chrome/browser/sharing/sharing_message_bridge_impl.cc
@@ -47,6 +47,12 @@ return entity_data; } +std::unique_ptr<syncer::EntityData> CopyToEntityData( + const sync_pb::SharingMessageSpecifics& specifics) { + return MoveToEntityData( + std::make_unique<sync_pb::SharingMessageSpecifics>(specifics)); +} + } // namespace SharingMessageBridgeImpl::SharingMessageBridgeImpl( @@ -85,13 +91,17 @@ MoveToEntityData(std::move(specifics)); const syncer::ClientTagHash client_tag_hash = GetClientTagHashFromStorageKey(message_id); - const auto result = commit_callbacks_.emplace( + + DCHECK(pending_commits_.find(client_tag_hash) == pending_commits_.end()); + pending_commits_.emplace( client_tag_hash, - std::make_unique<TimedCallback>( - std::move(on_commit_callback), - base::BindOnce(&SharingMessageBridgeImpl::ProcessCommitTimeout, - base::Unretained(this), client_tag_hash))); - DCHECK(result.second); + PendingCommit( + std::make_unique<TimedCallback>( + std::move(on_commit_callback), + base::BindOnce(&SharingMessageBridgeImpl::ProcessCommitTimeout, + base::Unretained(this), client_tag_hash)), + entity_data->specifics.sharing_message())); + change_processor()->Put(message_id, std::move(entity_data), metadata_change_list.get()); } @@ -134,13 +144,31 @@ void SharingMessageBridgeImpl::GetData(StorageKeyList storage_keys, DataCallback callback) { - return GetAllDataForDebugging(std::move(callback)); + auto batch = std::make_unique<syncer::MutableDataBatch>(); + + for (const std::string& storage_key : storage_keys) { + auto iter = + pending_commits_.find(GetClientTagHashFromStorageKey(storage_key)); + if (iter == pending_commits_.end()) { + continue; + } + batch->Put(storage_key, CopyToEntityData(iter->second.specifics)); + } + + std::move(callback).Run(std::move(batch)); } void SharingMessageBridgeImpl::GetAllDataForDebugging(DataCallback callback) { - // This data type does not store any data, we can always run the callback - // with empty data. - std::move(callback).Run(std::make_unique<syncer::MutableDataBatch>()); + auto batch = std::make_unique<syncer::MutableDataBatch>(); + + for (const auto& cth_to_commit : pending_commits_) { + std::unique_ptr<syncer::EntityData> entity_data = + CopyToEntityData(cth_to_commit.second.specifics); + const std::string storage_key = GetStorageKey(*entity_data); + batch->Put(storage_key, std::move(entity_data)); + } + + std::move(callback).Run(std::move(batch)); } std::string SharingMessageBridgeImpl::GetClientTag( @@ -189,11 +217,11 @@ sync_pb::SharingMessageCommitError sync_error_message; sync_error_message.set_error_code(sharing_message_error_code); - for (auto& cth_and_callback : commit_callbacks_) { - change_processor()->UntrackEntityForClientTagHash(cth_and_callback.first); - cth_and_callback.second->Run(sync_error_message); + for (auto& cth_and_commit : pending_commits_) { + change_processor()->UntrackEntityForClientTagHash(cth_and_commit.first); + cth_and_commit.second.timed_callback->Run(sync_error_message); } - commit_callbacks_.clear(); + pending_commits_.clear(); } void SharingMessageBridgeImpl::ApplyStopSyncChanges( @@ -201,15 +229,15 @@ sync_pb::SharingMessageCommitError sync_disabled_error_message; sync_disabled_error_message.set_error_code( sync_pb::SharingMessageCommitError::SYNC_TURNED_OFF); - for (auto& cth_and_callback : commit_callbacks_) { - change_processor()->UntrackEntityForClientTagHash(cth_and_callback.first); - cth_and_callback.second->Run(sync_disabled_error_message); + for (auto& cth_and_commit : pending_commits_) { + change_processor()->UntrackEntityForClientTagHash(cth_and_commit.first); + cth_and_commit.second.timed_callback->Run(sync_disabled_error_message); } - commit_callbacks_.clear(); + pending_commits_.clear(); } void SharingMessageBridgeImpl::ProcessCommitTimeout( - syncer::ClientTagHash client_tag_hash) { + const syncer::ClientTagHash& client_tag_hash) { change_processor()->UntrackEntityForClientTagHash(client_tag_hash); sync_pb::SharingMessageCommitError error_message; error_message.set_error_code( @@ -220,14 +248,14 @@ void SharingMessageBridgeImpl::ProcessCommitResponse( const syncer::ClientTagHash& client_tag_hash, const sync_pb::SharingMessageCommitError& commit_error_message) { - const auto iter = commit_callbacks_.find(client_tag_hash); - if (iter == commit_callbacks_.end()) { + const auto iter = pending_commits_.find(client_tag_hash); + if (iter == pending_commits_.end()) { // This may happen if tasks from OnUpdateReceived and OneShotTimer were // added at one time. return; } - iter->second->Run(commit_error_message); - commit_callbacks_.erase(iter); + iter->second.timed_callback->Run(commit_error_message); + pending_commits_.erase(iter); } SharingMessageBridgeImpl::TimedCallback::TimedCallback( @@ -252,3 +280,16 @@ timer_.Stop(); } } + +SharingMessageBridgeImpl::PendingCommit::PendingCommit( + std::unique_ptr<TimedCallback> timed_callback, + sync_pb::SharingMessageSpecifics specifics) + : timed_callback(std::move(timed_callback)), + specifics(std::move(specifics)) {} + +SharingMessageBridgeImpl::PendingCommit::~PendingCommit() = default; + +SharingMessageBridgeImpl::PendingCommit::PendingCommit(PendingCommit&&) = + default; +SharingMessageBridgeImpl::PendingCommit& +SharingMessageBridgeImpl::PendingCommit::operator=(PendingCommit&&) = default;
diff --git a/chrome/browser/sharing/sharing_message_bridge_impl.h b/chrome/browser/sharing/sharing_message_bridge_impl.h index 60f7d3d..6e677e8 100644 --- a/chrome/browser/sharing/sharing_message_bridge_impl.h +++ b/chrome/browser/sharing/sharing_message_bridge_impl.h
@@ -50,9 +50,7 @@ void ApplyStopSyncChanges(std::unique_ptr<syncer::MetadataChangeList> metadata_change_list) override; - size_t GetCallbacksCountForTesting() const { - return commit_callbacks_.size(); - } + size_t GetCallbacksCountForTesting() const { return pending_commits_.size(); } private: class TimedCallback { @@ -61,9 +59,11 @@ // |timeout_callback| if timeout happens. TimedCallback(CommitFinishedCallback commit_callback, base::OnceClosure timeout_callback); - ~TimedCallback(); + TimedCallback(const TimedCallback&) = delete; + TimedCallback& operator=(const TimedCallback&) = delete; + // Runs callback object with the given |commit_error| and stops the timer. void Run(const sync_pb::SharingMessageCommitError& commit_error); @@ -72,9 +72,26 @@ CommitFinishedCallback commit_callback_; }; + struct PendingCommit { + PendingCommit(std::unique_ptr<TimedCallback> timed_callback, + sync_pb::SharingMessageSpecifics specifics); + ~PendingCommit(); + PendingCommit(PendingCommit&&); + PendingCommit& operator=(PendingCommit&&); + + PendingCommit(const PendingCommit&) = delete; + PendingCommit& operator=(const PendingCommit&) = delete; + + // Make |timed_callback| moveable. + std::unique_ptr<TimedCallback> timed_callback; + + // Copy of committed sharing message for possible retries. + sync_pb::SharingMessageSpecifics specifics; + }; + // Process timeout which happened for a callback with associated // |client_tag_hash|. - void ProcessCommitTimeout(syncer::ClientTagHash client_tag_hash); + void ProcessCommitTimeout(const syncer::ClientTagHash& client_tag_hash); // Sends commit outcome via callback for |client_tag_hash| and removes it from // callbacks mapping. @@ -82,8 +99,9 @@ const syncer::ClientTagHash& client_tag_hash, const sync_pb::SharingMessageCommitError& commit_error); - std::map<syncer::ClientTagHash, std::unique_ptr<TimedCallback>> - commit_callbacks_; + // Contains the data for all pending commits. It is used to restore the + // committed data on retries if needed and to detect timeouts. + std::map<syncer::ClientTagHash, PendingCommit> pending_commits_; }; #endif // CHROME_BROWSER_SHARING_SHARING_MESSAGE_BRIDGE_IMPL_H_
diff --git a/chrome/browser/sharing/sharing_message_bridge_impl_unittest.cc b/chrome/browser/sharing/sharing_message_bridge_impl_unittest.cc index 959bce2..166d71fb 100644 --- a/chrome/browser/sharing/sharing_message_bridge_impl_unittest.cc +++ b/chrome/browser/sharing/sharing_message_bridge_impl_unittest.cc
@@ -10,8 +10,10 @@ #include "base/test/mock_callback.h" #include "base/test/task_environment.h" #include "chrome/browser/sharing/features.h" +#include "components/sync/model/data_batch.h" #include "components/sync/model/metadata_batch.h" #include "components/sync/model/metadata_change_list.h" +#include "components/sync/model/model_type_sync_bridge.h" #include "components/sync/test/model/mock_model_type_change_processor.h" #include "net/base/network_change_notifier.h" #include "testing/gmock/include/gmock/gmock.h" @@ -21,12 +23,15 @@ using sync_pb::SharingMessageCommitError; using sync_pb::SharingMessageSpecifics; +using syncer::DataBatch; using syncer::SyncCommitError; using testing::_; using testing::InvokeWithoutArgs; using testing::NotNull; +using testing::Pair; using testing::Return; using testing::SaveArg; +using testing::UnorderedElementsAre; // Action SaveArgPointeeMove<k>(pointer) saves the value pointed to by the k-th // (0-based) argument of the mock function by moving it to *pointer. @@ -50,6 +55,20 @@ } }; +std::unordered_map<std::string, std::string> ExtractStorageKeyAndPayloads( + std::unique_ptr<DataBatch> batch) { + std::unordered_map<std::string, std::string> storage_key_to_payload; + DCHECK(batch); + while (batch->HasNext()) { + const syncer::KeyAndData& pair = batch->Next(); + const SharingMessageSpecifics& specifics = + pair.second->specifics.sharing_message(); + const std::string& storage_key = pair.first; + storage_key_to_payload.emplace(storage_key, specifics.payload()); + } + return storage_key_to_payload; +} + class SharingMessageBridgeTest : public testing::Test { protected: SharingMessageBridgeTest() @@ -140,6 +159,18 @@ EXPECT_EQ(bridge()->GetCallbacksCountForTesting(), 0u); histogram_tester.ExpectUniqueSample("Sync.SharingMessage.CommitResult", SharingMessageCommitError::NONE, 1); + + // Check that GetData doesn't return anything after successful commit. + base::MockCallback<syncer::ModelTypeSyncBridge::DataCallback> data_callback; + std::unique_ptr<DataBatch> data_batch; + EXPECT_CALL(data_callback, Run(_)) + .WillOnce([&data_batch](std::unique_ptr<DataBatch> batch) { + data_batch = std::move(batch); + }); + + bridge()->GetData({storage_key}, data_callback.Get()); + ASSERT_THAT(data_batch, NotNull()); + EXPECT_FALSE(data_batch->HasNext()); } TEST_F(SharingMessageBridgeTest, ShouldInvokeCallbackOnFailure) { @@ -265,6 +296,44 @@ EXPECT_EQ(1u, bridge()->GetCallbacksCountForTesting()); } +TEST_F(SharingMessageBridgeTest, ShouldReturnUnsyncedData) { + const std::string payload1 = "payload_1"; + const std::string payload2 = "payload_2"; + + base::MockCallback<SharingMessageBridge::CommitFinishedCallback> callback; + EXPECT_CALL(callback, Run(_)).Times(0); + bridge()->SendSharingMessage(CreateSpecifics(payload1), callback.Get()); + bridge()->SendSharingMessage(CreateSpecifics(payload2), callback.Get()); + + base::MockCallback<syncer::ModelTypeSyncBridge::DataCallback> data_callback; + std::unique_ptr<DataBatch> data_batch; + EXPECT_CALL(data_callback, Run(_)) + .Times(2) + .WillRepeatedly([&data_batch](std::unique_ptr<DataBatch> batch) { + data_batch = std::move(batch); + }); + + bridge()->GetAllDataForDebugging(data_callback.Get()); + ASSERT_THAT(data_batch, NotNull()); + std::unordered_map<std::string, std::string> storage_key_to_payload = + ExtractStorageKeyAndPayloads(std::move(data_batch)); + EXPECT_THAT(storage_key_to_payload, + UnorderedElementsAre(Pair(_, payload1), Pair(_, payload2))); + + syncer::ModelTypeSyncBridge::StorageKeyList storage_key_list; + for (const auto& sk_to_payload : storage_key_to_payload) { + storage_key_list.push_back(sk_to_payload.first); + } + + // Add another one invalid storage key. + storage_key_list.push_back("invalid_storage_key"); + bridge()->GetData(std::move(storage_key_list), data_callback.Get()); + ASSERT_THAT(data_batch, NotNull()); + storage_key_to_payload = ExtractStorageKeyAndPayloads(std::move(data_batch)); + EXPECT_THAT(storage_key_to_payload, + UnorderedElementsAre(Pair(_, payload1), Pair(_, payload2))); +} + TEST_P(SharingMessageBridgeErrorsTest, ShouldInvokeCallbackOnSyncCommitFailure) { base::HistogramTester histogram_tester;
diff --git a/chrome/browser/sync/profile_sync_service_android.cc b/chrome/browser/sync/profile_sync_service_android.cc index 301624cf0..e76677e 100644 --- a/chrome/browser/sync/profile_sync_service_android.cc +++ b/chrome/browser/sync/profile_sync_service_android.cc
@@ -399,6 +399,13 @@ return sync_service_->GetDecoupledFromAndroidMasterSync(); } +jboolean ProfileSyncServiceAndroid::IsAuthenticatedAccountPrimary( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + return sync_service_->IsAuthenticatedAccountPrimary(); +} + jboolean ProfileSyncServiceAndroid::IsPassphrasePrompted( JNIEnv* env, const JavaParamRef<jobject>& obj) {
diff --git a/chrome/browser/sync/profile_sync_service_android.h b/chrome/browser/sync/profile_sync_service_android.h index 50d8921..9c825e72 100644 --- a/chrome/browser/sync/profile_sync_service_android.h +++ b/chrome/browser/sync/profile_sync_service_android.h
@@ -135,6 +135,9 @@ jboolean GetDecoupledFromAndroidMasterSync( JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); + jboolean IsAuthenticatedAccountPrimary( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& obj); // Pure SyncPrefs calls. jboolean IsPassphrasePrompted(
diff --git a/chrome/browser/sync/test/integration/single_client_sharing_message_sync_test.cc b/chrome/browser/sync/test/integration/single_client_sharing_message_sync_test.cc index 8ae3564d..a9a9f10b 100644 --- a/chrome/browser/sync/test/integration/single_client_sharing_message_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_sharing_message_sync_test.cc
@@ -84,6 +84,8 @@ } }; +// Waits until all expected sharing messages are successfully committed. Sharing +// messages are equal if they have the same payload. class SharingMessageEqualityChecker : public SingleClientStatusChangeChecker { public: SharingMessageEqualityChecker( @@ -103,34 +105,98 @@ // becomes bigger then all hope is lost of passing, stop now. EXPECT_GE(expected_specifics_.size(), entities.size()); - if (expected_specifics_.size() > entities.size()) { + if (expected_specifics_.size() != entities.size()) { return false; } - // Number of events on server matches expected, exit condition can be - // satisfied. Let's verify that content matches as well. It is safe to - // modify |expected_specifics_|. - for (const sync_pb::SyncEntity& entity : entities) { - const SharingMessageSpecifics& server_specifics = - entity.specifics().sharing_message(); - // It is likely to have the same order, it is ok to use find here. - auto iter = std::find_if( - expected_specifics_.begin(), expected_specifics_.end(), - [&server_specifics](const SharingMessageSpecifics& specifics) { - return specifics.payload() == server_specifics.payload(); - }); - EXPECT_TRUE(iter != expected_specifics_.end()); - if (iter == expected_specifics_.end()) + for (const SharingMessageSpecifics& specifics : expected_specifics_) { + auto iter = + std::find_if(entities.begin(), entities.end(), + [&specifics](const sync_pb::SyncEntity& entity) { + return specifics.payload() == + entity.specifics().sharing_message().payload(); + }); + if (iter == entities.end()) { + *os << "Server doesn't have expected sharing message with payload: " + << specifics.payload(); return false; - expected_specifics_.erase(iter); + } + // Remove found entity to check for duplicate payloads. + entities.erase(iter); } + DCHECK(entities.empty()); return true; } private: - fake_server::FakeServer* fake_server_; - std::vector<SharingMessageSpecifics> expected_specifics_; + fake_server::FakeServer* const fake_server_ = nullptr; + const std::vector<SharingMessageSpecifics> expected_specifics_; +}; + +// Waits for the sharing message callback with expected error code to be called. +// The provided callback must be called only once. +class SharingMessageCallbackChecker : public SingleClientStatusChangeChecker { + public: + SharingMessageCallbackChecker( + syncer::ProfileSyncService* service, + sync_pb::SharingMessageCommitError::ErrorCode expected_error_code) + : SingleClientStatusChangeChecker(service), + expected_error_code_(expected_error_code) {} + + bool IsExitConditionSatisfied(std::ostream* os) override { + *os << "Waiting for callback"; + + return last_error_code_ && + last_error_code_->error_code() == expected_error_code_; + } + + SharingMessageBridge::CommitFinishedCallback GetCommitFinishedCallback() { + return base::BindOnce(&SharingMessageCallbackChecker::OnCommitFinished, + weak_ptr_factory_.GetWeakPtr()); + } + + private: + void OnCommitFinished(const sync_pb::SharingMessageCommitError& error_code) { + EXPECT_FALSE(last_error_code_.has_value()); + last_error_code_ = error_code; + } + + const sync_pb::SharingMessageCommitError::ErrorCode expected_error_code_; + base::Optional<sync_pb::SharingMessageCommitError> last_error_code_; + + base::WeakPtrFactory<SharingMessageCallbackChecker> weak_ptr_factory_{this}; +}; + +// Used to wait until the sharing message commit was sent to the server +// (regardless of the commit result). Waits until the last commit message has at +// least one sharing message with the expected payload. +class SharingMessageCommitChecker : public SingleClientStatusChangeChecker { + public: + SharingMessageCommitChecker(syncer::ProfileSyncService* service, + fake_server::FakeServer* fake_server, + const std::string& expected_payload) + : SingleClientStatusChangeChecker(service), + fake_server_(fake_server), + expected_payload_(expected_payload) {} + + bool IsExitConditionSatisfied(std::ostream* os) override { + *os << "Waiting for sharing message to be committed."; + + sync_pb::ClientToServerMessage message; + fake_server_->GetLastCommitMessage(&message); + for (const sync_pb::SyncEntity& entity : message.commit().entries()) { + if (entity.specifics().sharing_message().payload() == expected_payload_) { + return true; + } + } + + return false; + } + + private: + fake_server::FakeServer* const fake_server_ = nullptr; + const std::string expected_payload_; }; class SingleClientSharingMessageSyncTest : public SyncTest { @@ -152,12 +218,10 @@ }; IN_PROC_BROWSER_TEST_F(SingleClientSharingMessageSyncTest, ShouldSubmit) { - base::MockOnceCallback<void(const sync_pb::SharingMessageCommitError&)> - callback; - EXPECT_CALL(callback, - Run(HasErrorCode(sync_pb::SharingMessageCommitError::NONE))); - ASSERT_TRUE(SetupSync()); + SharingMessageCallbackChecker callback_checker( + GetSyncService(0), sync_pb::SharingMessageCommitError::NONE); + ASSERT_EQ(0u, GetFakeServer() ->GetSyncEntitiesByModelType(syncer::SHARING_MESSAGE) .size()); @@ -167,9 +231,11 @@ SharingMessageSpecifics specifics; specifics.set_payload("payload"); sharing_message_bridge->SendSharingMessage( - std::make_unique<SharingMessageSpecifics>(specifics), callback.Get()); + std::make_unique<SharingMessageSpecifics>(specifics), + callback_checker.GetCommitFinishedCallback()); EXPECT_TRUE(WaitForSharingMessage({specifics})); + EXPECT_TRUE(callback_checker.Wait()); } // ChromeOS does not support late signin after profile creation, so the test @@ -190,31 +256,28 @@ ASSERT_TRUE( GetSyncService(0)->GetActiveDataTypes().Has(syncer::SHARING_MESSAGE)); - base::MockOnceCallback<void(const sync_pb::SharingMessageCommitError&)> - callback; - EXPECT_CALL(callback, - Run(HasErrorCode(sync_pb::SharingMessageCommitError::NONE))); + SharingMessageCallbackChecker callback_checker( + GetSyncService(0), sync_pb::SharingMessageCommitError::NONE); SharingMessageBridge* sharing_message_bridge = SharingMessageBridgeFactory::GetForBrowserContext(GetProfile(0)); SharingMessageSpecifics specifics; specifics.set_payload("payload"); sharing_message_bridge->SendSharingMessage( - std::make_unique<SharingMessageSpecifics>(specifics), callback.Get()); + std::make_unique<SharingMessageSpecifics>(specifics), + callback_checker.GetCommitFinishedCallback()); EXPECT_TRUE(WaitForSharingMessage({specifics})); + EXPECT_TRUE(callback_checker.Wait()); } #endif // !defined(OS_CHROMEOS) IN_PROC_BROWSER_TEST_F(SingleClientSharingMessageSyncTest, ShouldPropagateCommitFailure) { - base::MockOnceCallback<void(const sync_pb::SharingMessageCommitError&)> - callback; - EXPECT_CALL( - callback, - Run(HasErrorCode(sync_pb::SharingMessageCommitError::SYNC_SERVER_ERROR))); - ASSERT_TRUE(SetupSync()); + SharingMessageCallbackChecker callback_checker( + GetSyncService(0), sync_pb::SharingMessageCommitError::SYNC_SERVER_ERROR); + GetFakeServer()->TriggerCommitError(sync_pb::SyncEnums::TRANSIENT_ERROR); SharingMessageBridge* sharing_message_bridge = @@ -222,32 +285,30 @@ SharingMessageSpecifics specifics; specifics.set_payload("payload"); sharing_message_bridge->SendSharingMessage( - std::make_unique<SharingMessageSpecifics>(specifics), callback.Get()); + std::make_unique<SharingMessageSpecifics>(specifics), + callback_checker.GetCommitFinishedCallback()); - ASSERT_TRUE(NextCycleIterationChecker(GetSyncService(0)).Wait()); + EXPECT_TRUE(callback_checker.Wait()); } IN_PROC_BROWSER_TEST_F(SingleClientSharingMessageSyncTest, ShouldCleanPendingMessagesAfterSyncPaused) { - base::MockOnceCallback<void(const sync_pb::SharingMessageCommitError&)> - callback; - EXPECT_CALL( - callback, - Run(HasErrorCode(sync_pb::SharingMessageCommitError::SYNC_TURNED_OFF))); - ASSERT_TRUE(SetupSync()); + SharingMessageCallbackChecker callback_checker( + GetSyncService(0), sync_pb::SharingMessageCommitError::SYNC_TURNED_OFF); SharingMessageBridge* sharing_message_bridge = SharingMessageBridgeFactory::GetForBrowserContext(GetProfile(0)); SharingMessageSpecifics specifics; specifics.set_payload("payload"); sharing_message_bridge->SendSharingMessage( - std::make_unique<SharingMessageSpecifics>(specifics), callback.Get()); + std::make_unique<SharingMessageSpecifics>(specifics), + callback_checker.GetCommitFinishedCallback()); GetClient(0)->StopSyncServiceAndClearData(); GetClient(0)->StartSyncService(); - ASSERT_TRUE(NextCycleIterationChecker(GetSyncService(0)).Wait()); + EXPECT_TRUE(callback_checker.Wait()); EXPECT_TRUE(GetFakeServer() ->GetSyncEntitiesByModelType(syncer::SHARING_MESSAGE) .empty()); @@ -261,50 +322,51 @@ SetOAuth2TokenResponse(kInvalidGrantOAuth2Token, net::HTTP_BAD_REQUEST, net::OK); - base::MockOnceCallback<void(const sync_pb::SharingMessageCommitError&)> - callback; - EXPECT_CALL( - callback, - Run(HasErrorCode(sync_pb::SharingMessageCommitError::SYNC_TURNED_OFF))); + SharingMessageCallbackChecker callback_checker( + GetSyncService(0), sync_pb::SharingMessageCommitError::SYNC_TURNED_OFF); SharingMessageBridge* sharing_message_bridge = SharingMessageBridgeFactory::GetForBrowserContext(GetProfile(0)); SharingMessageSpecifics specifics; specifics.set_payload("payload"); sharing_message_bridge->SendSharingMessage( - std::make_unique<SharingMessageSpecifics>(specifics), callback.Get()); + std::make_unique<SharingMessageSpecifics>(specifics), + callback_checker.GetCommitFinishedCallback()); EXPECT_TRUE(DisabledSharingMessageChecker(GetSyncService(0)).Wait()); + EXPECT_TRUE(callback_checker.Wait()); } -// TODO(crbug.com/1097054): enable the test once the issue is fixed, without -// that it may be flaky because SharingMessage data type might not generate -// retries. IN_PROC_BROWSER_TEST_F( SingleClientSharingMessageSyncTest, - DISABLED_ShouldRetrySendingSharingMessageDataTypeOnTransientAuthError) { + ShouldRetrySendingSharingMessageDataTypeOnTransientAuthError) { + const std::string payload = "payload"; + ASSERT_TRUE(SetupSync()); GetFakeServer()->SetHttpError(net::HTTP_UNAUTHORIZED); SetOAuth2TokenResponse(kEmptyOAuth2Token, net::HTTP_INTERNAL_SERVER_ERROR, net::OK); - base::MockOnceCallback<void(const sync_pb::SharingMessageCommitError&)> - callback; - EXPECT_CALL(callback, - Run(HasErrorCode(sync_pb::SharingMessageCommitError::NONE))); + SharingMessageCallbackChecker callback_checker( + GetSyncService(0), sync_pb::SharingMessageCommitError::NONE); SharingMessageBridge* sharing_message_bridge = SharingMessageBridgeFactory::GetForBrowserContext(GetProfile(0)); SharingMessageSpecifics specifics; - specifics.set_payload("payload"); + specifics.set_payload(payload); sharing_message_bridge->SendSharingMessage( - std::make_unique<SharingMessageSpecifics>(specifics), callback.Get()); + std::make_unique<SharingMessageSpecifics>(specifics), + callback_checker.GetCommitFinishedCallback()); + ASSERT_TRUE( + SharingMessageCommitChecker(GetSyncService(0), GetFakeServer(), payload) + .Wait()); ASSERT_TRUE(RetryingAccessTokenFetchChecker(GetSyncService(0)).Wait()); - GetFakeServer()->ClearHttpError(); SetOAuth2TokenResponse(kValidOAuth2Token, net::HTTP_OK, net::OK); + GetFakeServer()->ClearHttpError(); EXPECT_TRUE(WaitForSharingMessage({specifics})); + EXPECT_TRUE(callback_checker.Wait()); } } // namespace
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_hy.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_hy.xtb index d42cfbc..b39b980 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_hy.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_hy.xtb
@@ -273,7 +273,7 @@ <translation id="2979025552038692506">Ընտրված ինկոգնիտո ներդիր</translation> <translation id="2987620471460279764">Այլ սարքից ուղարկված տեքստ</translation> <translation id="2989523299700148168">Վերջերս այցելած</translation> -<translation id="2992473221983447149">Պատկերավոր նկարագրություններ</translation> +<translation id="2992473221983447149">Պատկերների նկարագրություն</translation> <translation id="2996291259634659425">Անցաբառի ստեղծում</translation> <translation id="2996809686854298943">Պահանջվում է URL-ը</translation> <translation id="3006881078666935414">Օգտագործման տվյալներ չկան</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_iw.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_iw.xtb index eb6a4f51..0ec23258 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_iw.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_iw.xtb
@@ -273,6 +273,7 @@ <translation id="2979025552038692506">כרטיסיית הגלישה בסתר שנבחרה</translation> <translation id="2987620471460279764">טקסט ששותף ממכשיר אחר</translation> <translation id="2989523299700148168">מנועי חיפוש שהשתמשת בהם לאחרונה</translation> +<translation id="2992473221983447149">תיאורי תמונות</translation> <translation id="2996291259634659425">יצירת ביטוי סיסמה</translation> <translation id="2996809686854298943">דרושה כתובת אתר</translation> <translation id="3006881078666935414">אין נתוני שימוש</translation> @@ -285,6 +286,7 @@ <translation id="3060635849835183725">{BOOKMARKS_COUNT,plural, =1{סימניה אחת (<ph name="BOOKMARKS_COUNT_ONE" />)}two{<ph name="BOOKMARKS_COUNT_MANY" /> סימניות}many{<ph name="BOOKMARKS_COUNT_MANY" /> סימניות}other{<ph name="BOOKMARKS_COUNT_MANY" /> סימניות}}</translation> <translation id="3062802207422175757">ב-Chrome מחכים לך מאמרים בנושאים שמעניינים אותך</translation> <translation id="3089395242580810162">פתיחה בכרטיסיית גלישה בסתר</translation> +<translation id="3098745985164956033">חלק מהתמונות נשלחות אל Google כדי לשפר עבורך את התיאורים</translation> <translation id="3114507951000454849">קראת חדשות היום? <ph name="NEWS_ICON" /></translation> <translation id="3123734510202723619">הודעות</translation> <translation id="3137521801621304719">צא ממצב גלישה בסתר</translation> @@ -775,6 +777,7 @@ <translation id="6545017243486555795">נקה את כל הנתונים</translation> <translation id="6560414384669816528">שימוש ב-Sogou לחיפוש</translation> <translation id="656065428026159829">אפשרויות נוספות</translation> +<translation id="6565959834589222080">המכשיר יתחבר לרשת Wi-Fi כאשר תהיה זמינה</translation> <translation id="6566259936974865419">Chrome חסך לך <ph name="GIGABYTES" /> GB</translation> <translation id="6573096386450695060">אני רוצה לאפשר תמיד</translation> <translation id="6573431926118603307">כרטיסיות שפתחת ב-Chrome במכשירים האחרים שלך יופיעו כאן.</translation> @@ -1086,6 +1089,7 @@ <translation id="8788968922598763114">פתח מחדש את הכרטיסייה האחרונה שנסגרה</translation> <translation id="8798449543960971550">נקראו</translation> <translation id="8812260976093120287">באתרים מסוימים ניתן לשלם דרך המכשיר באמצעות אפליקציות התשלום הנתמכות שמופיעות למעלה.</translation> +<translation id="881688628773363275">לא ניתן לצפות בתוכן של כרטיסיית 'התצוגה המקדימה'.</translation> <translation id="8820817407110198400">סימניות</translation> <translation id="883806473910249246">אירעה שגיאה בזמן הורדת התוכן.</translation> <translation id="8840953339110955557">ייתכן שהדף הזה שונה מהגירסה המקוונת.</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_kk.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_kk.xtb index 1a7f1d5c..f6d8a82 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_kk.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_kk.xtb
@@ -286,7 +286,7 @@ <translation id="3060635849835183725">{BOOKMARKS_COUNT,plural, =1{<ph name="BOOKMARKS_COUNT_ONE" /> бетбелгі}other{<ph name="BOOKMARKS_COUNT_MANY" /> бетбелгі}}</translation> <translation id="3062802207422175757">Chrome браузеріндегі қызығушылықтарыңызға сай мақалалар</translation> <translation id="3089395242580810162">Инкогнито қойындысында ашу</translation> -<translation id="3098745985164956033">Сипаттамаларды жақсарту үшін Google-ға суреттер жіберіледі.</translation> +<translation id="3098745985164956033">Сипаттамаларды жақсарту үшін Google-ға біраз суреттер жіберіледі.</translation> <translation id="3114507951000454849">Бүгінгінің жаңалықтарын оқыңыз <ph name="NEWS_ICON" /></translation> <translation id="3123734510202723619">Хабарландырулар</translation> <translation id="3137521801621304719">Жасырын режимнен шығу</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_tr.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_tr.xtb index bfdffca..e7e50cc 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_tr.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_tr.xtb
@@ -273,6 +273,7 @@ <translation id="2979025552038692506">Seçili Gizli Sekme</translation> <translation id="2987620471460279764">Başka cihazdan paylaşılan metin</translation> <translation id="2989523299700148168">Son ziyaret edilenler</translation> +<translation id="2992473221983447149">Resim açıklamaları</translation> <translation id="2996291259634659425">Parola oluşturun</translation> <translation id="2996809686854298943">URL gerekli</translation> <translation id="3006881078666935414">Kullanım verisi yok</translation> @@ -285,6 +286,7 @@ <translation id="3060635849835183725">{BOOKMARKS_COUNT,plural, =1{<ph name="BOOKMARKS_COUNT_ONE" /> yer işareti}other{<ph name="BOOKMARKS_COUNT_MANY" /> yer işareti}}</translation> <translation id="3062802207422175757">İlgilendiğiniz makaleler Chrome'da</translation> <translation id="3089395242580810162">Gizli sekmede aç</translation> +<translation id="3098745985164956033">Bazı resimler size daha iyi açıklamalar sunmak için Google'a gönderilir</translation> <translation id="3114507951000454849">Bugünkü haberleri <ph name="NEWS_ICON" /> okuyun</translation> <translation id="3123734510202723619">Duyurular</translation> <translation id="3137521801621304719">Gizli moddan çık</translation> @@ -775,6 +777,7 @@ <translation id="6545017243486555795">Tüm Verileri Temizle</translation> <translation id="6560414384669816528">Sogou ile arama</translation> <translation id="656065428026159829">Daha fazla göster</translation> +<translation id="6565959834589222080">Mevcut olduğunda kablosuz bağlantı kullanılır</translation> <translation id="6566259936974865419">Chrome <ph name="GIGABYTES" /> GB tasarruf sağladı</translation> <translation id="6573096386450695060">Her zaman izin ver</translation> <translation id="6573431926118603307">Diğer cihazlarınızda Chrome ile açtığınız sekmeler burada görünür.</translation> @@ -1086,6 +1089,7 @@ <translation id="8788968922598763114">Son kapatılan sekmeyi yeniden açar</translation> <translation id="8798449543960971550">Okunanlar</translation> <translation id="8812260976093120287">Bazı web sitelerinde, yukarıdaki desteklenen ödeme uygulamalarıyla cihazınızdan ödeme yapabilirsiniz.</translation> +<translation id="881688628773363275">Önizleme sekmesinin içeriği görüntülenemiyor.</translation> <translation id="8820817407110198400">Favoriler</translation> <translation id="883806473910249246">İçerik indirilirken bir hata oluştu.</translation> <translation id="8840953339110955557">Bu sayfa, web'deki sürümden farklı olabilir.</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_vi.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_vi.xtb index bcc732d..df6f03c 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_vi.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_vi.xtb
@@ -1089,7 +1089,7 @@ <translation id="8788968922598763114">Mở lại thẻ đóng sau cùng</translation> <translation id="8798449543960971550">Đọc</translation> <translation id="8812260976093120287">Trên một số trang web, bạn có thể thanh toán bằng các ứng dụng thanh toán được hỗ trợ bên trên trên thiết bị của bạn.</translation> -<translation id="881688628773363275">Không xem được nội dung trên thẻ Xem trước.</translation> +<translation id="881688628773363275">Không thể xem nội dung trên thẻ Xem trước.</translation> <translation id="8820817407110198400">Dấu trang</translation> <translation id="883806473910249246">Đã xảy ra lỗi khi tải nội dung xuống.</translation> <translation id="8840953339110955557">Trang này có thể khác với phiên bản trực tuyến.</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-TW.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-TW.xtb index 114cee40..55e57bdb 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-TW.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-TW.xtb
@@ -1089,7 +1089,7 @@ <translation id="8788968922598763114">重新開啟最近關閉的分頁</translation> <translation id="8798449543960971550">讀取</translation> <translation id="8812260976093120287">在部分網站上,你可以在你的裝置上使用上述支援的付款應用程式付款。</translation> -<translation id="881688628773363275">無法檢視預覽分頁的內容。</translation> +<translation id="881688628773363275">無法檢視分頁的預覽內容。</translation> <translation id="8820817407110198400">書籤</translation> <translation id="883806473910249246">下載這項內容時發生錯誤。</translation> <translation id="8840953339110955557">這個網頁可能會和線上版本有所不同。</translation>
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc index 1a5777b..93aabdb 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -92,7 +92,6 @@ #include "chrome/common/pref_names.h" #include "chrome/common/web_application_info.h" #include "chrome/test/base/ui_test_utils.h" -#include "chromeos/constants/chromeos_features.h" #include "components/crx_file/id_util.h" #include "content/public/browser/web_contents.h" #include "content/public/test/browser_test.h" @@ -2521,8 +2520,8 @@ void SetUp() override { // Disable contextual nudges to prevent in-app to home nudge from being // announced in the ChromeVox test. - scoped_feature_list_.InitWithFeatures({chromeos::features::kShelfHotseat}, - {ash::features::kContextualNudges}); + scoped_feature_list_.InitAndDisableFeature( + ash::features::kContextualNudges); ShelfAppBrowserTest::SetUp(); }
diff --git a/chrome/browser/ui/browser_focus_uitest.cc b/chrome/browser/ui/browser_focus_uitest.cc index 15bc9ef..70b27ba3 100644 --- a/chrome/browser/ui/browser_focus_uitest.cc +++ b/chrome/browser/ui/browser_focus_uitest.cc
@@ -223,13 +223,7 @@ } // Tabs remember focus. -#if defined(THREAD_SANITIZER) -// TODO(crbug.com/995181): This test is flaky on Linux TSan. -#define MAYBE_TabsRememberFocus DISABLED_TabsRememberFocus -#else -#define MAYBE_TabsRememberFocus TabsRememberFocus -#endif -IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_TabsRememberFocus) { +IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocus) { ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); const GURL url = embedded_test_server()->GetURL(kSimplePage); ui_test_utils::NavigateToURL(browser(), url);
diff --git a/chrome/browser/ui/views/download/download_item_view.cc b/chrome/browser/ui/views/download/download_item_view.cc index e3b1a2a..5d7397dd 100644 --- a/chrome/browser/ui/views/download/download_item_view.cc +++ b/chrome/browser/ui/views/download/download_item_view.cc
@@ -145,7 +145,8 @@ public: METADATA_HEADER(TransparentButton); - explicit TransparentButton(DownloadItemView* parent) : Button(nullptr) { + explicit TransparentButton(DownloadItemView* parent) + : Button(Button::PressedCallback()) { SetFocusForPlatform(); views::InstallRectHighlightPathGenerator(this); SetInkDropMode(InkDropMode::ON);
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc index 33f0766..e55ec58 100644 --- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc +++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -548,7 +548,8 @@ int pushed_image_id, int mask_image_id, ViewID view_id) { - views::ImageButton* button = new views::ImageButton(nullptr); + views::ImageButton* button = + new views::ImageButton(views::Button::PressedCallback()); const ui::ThemeProvider* tp = frame()->GetThemeProvider(); button->SetImage(views::Button::STATE_NORMAL, tp->GetImageSkiaNamed(normal_image_id));
diff --git a/chrome/browser/ui/views/menu_interactive_uitest.cc b/chrome/browser/ui/views/menu_interactive_uitest.cc index d71edd0..34236cd 100644 --- a/chrome/browser/ui/views/menu_interactive_uitest.cc +++ b/chrome/browser/ui/views/menu_interactive_uitest.cc
@@ -36,7 +36,7 @@ class TestButton : public Button { public: - TestButton() : Button(nullptr) {} + TestButton() : Button(Button::PressedCallback()) {} TestButton(const TestButton&) = delete; TestButton& operator=(const TestButton&) = delete; ~TestButton() override = default;
diff --git a/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc b/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc index bdcad36..a777eaf 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_suggestion_button_row_view.cc
@@ -51,7 +51,8 @@ SetCornerRadius(GetInsets().height() + GetLayoutConstant(LOCATION_BAR_ICON_SIZE)); - SetInkDropHighlightOpacity(CalculateInkDropHighlightOpacity()); + SetInkDropHighlightOpacity( + GetOmniboxStateOpacity(OmniboxPartState::HOVERED)); focus_ring()->SetHasFocusPredicate([=](View* view) { return view->GetVisible() && popup_contents_view_->model()->selection() == selection_; @@ -65,7 +66,7 @@ ~OmniboxSuggestionRowButton() override = default; SkColor GetInkDropBaseColor() const override { - return color_utils::GetColorWithMaxContrast(background()->get_color()); + return color_utils::GetColorWithMaxContrast(omnibox_bg_color_.value()); } void OnOmniboxBackgroundChange(SkColor omnibox_bg_color) { @@ -123,17 +124,6 @@ OmniboxPopupContentsView* popup_contents_view_; OmniboxPopupModel::Selection selection_; base::Optional<SkColor> omnibox_bg_color_; - - float CalculateInkDropHighlightOpacity() { - // Ink drop highlight opacity is result of mixing a layer with hovered - // opacity and a layer with selected opacity. OmniboxPartState::SELECTED - // opacity gets the same color as the selected omnibox row background (the - // button would be the same color as the row) and overlaying it with - // OmniboxPartState::HOVERED opacity makes the hovered button easily visible - // in the selected or hovered row. - return 1 - (1 - GetOmniboxStateOpacity(OmniboxPartState::HOVERED)) * - (1 - GetOmniboxStateOpacity(OmniboxPartState::SELECTED)); - } }; OmniboxSuggestionButtonRowView::OmniboxSuggestionButtonRowView(
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc index aaa1316..1c0a4131 100644 --- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.cc
@@ -27,10 +27,7 @@ #include "chrome/browser/chromeos/login/screens/reset_screen.h" #include "chrome/browser/chromeos/login/ui/login_display_host.h" #include "chrome/browser/chromeos/login/wizard_controller.h" -#include "chrome/browser/chromeos/policy/enrollment_requisition_manager.h" #include "chrome/browser/chromeos/system/input_device_settings.h" -#include "chrome/browser/chromeos/system/timezone_resolver_manager.h" -#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/ui/ash/ash_util.h" #include "chrome/browser/ui/ash/keyboard/chrome_keyboard_controller_client.h" #include "chrome/browser/ui/webui/chromeos/login/demo_setup_screen_handler.h" @@ -126,7 +123,6 @@ #else version_info_updater_.StartUpdate(false); #endif - UpdateDeviceRequisition(); UpdateKeyboardState(); UpdateClientAreaSize(); } @@ -144,8 +140,6 @@ AddCallback("screenStateInitialize", &CoreOobeHandler::HandleInitialized); AddCallback("updateCurrentScreen", &CoreOobeHandler::HandleUpdateCurrentScreen); - AddCallback("setDeviceRequisition", - &CoreOobeHandler::HandleSetDeviceRequisition); AddCallback("skipToLoginForTesting", &CoreOobeHandler::HandleSkipToLoginForTesting); AddCallback("skipToUpdateForTesting", @@ -247,27 +241,6 @@ LoginDisplayHost::default_host()->HideOobeDialog(); } -void CoreOobeHandler::HandleSetDeviceRequisition( - const std::string& requisition) { - std::string initial_requisition = - policy::EnrollmentRequisitionManager::GetDeviceRequisition(); - policy::EnrollmentRequisitionManager::SetDeviceRequisition(requisition); - - if (policy::EnrollmentRequisitionManager::IsRemoraRequisition()) { - // CfM devices default to static timezone. - g_browser_process->local_state()->SetInteger( - prefs::kResolveDeviceTimezoneByGeolocationMethod, - static_cast<int>(chromeos::system::TimeZoneResolverManager:: - TimeZoneResolveMethod::DISABLED)); - } - - // Exit Chrome to force the restart as soon as a new requisition is set. - if (initial_requisition != - policy::EnrollmentRequisitionManager::GetDeviceRequisition()) { - chrome::AttemptRestart(); - } -} - void CoreOobeHandler::HandleSkipToLoginForTesting() { WizardController* controller = WizardController::default_controller(); if (controller && controller->is_initialized()) @@ -364,11 +337,6 @@ CallJS("cr.ui.Oobe.setLabelText", id, text); } -void CoreOobeHandler::UpdateDeviceRequisition() { - CallJS("cr.ui.Oobe.updateDeviceRequisition", - policy::EnrollmentRequisitionManager::GetDeviceRequisition()); -} - void CoreOobeHandler::UpdateKeyboardState() { const bool is_keyboard_shown = ChromeKeyboardControllerClient::Get()->is_keyboard_visible();
diff --git a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h index 0b84f8d..415a3e47 100644 --- a/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h
@@ -154,7 +154,6 @@ void HandleHideOobeDialog(); void HandleInitialized(); void HandleUpdateCurrentScreen(const std::string& screen); - void HandleSetDeviceRequisition(const std::string& requisition); void HandleSkipToLoginForTesting(); void HandleSkipToUpdateForTesting(); void HandleLaunchHelpApp(double help_topic_id); @@ -184,9 +183,6 @@ // Updates label with specified id with specified text. void UpdateLabel(const std::string& id, const std::string& text); - // Updates the device requisition string on the UI side. - void UpdateDeviceRequisition(); - // Updates client area size based on the primary screen size. void UpdateClientAreaSize();
diff --git a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc index 2e6dc1a..9c7ac00 100644 --- a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc
@@ -113,6 +113,15 @@ CallJS("login.WelcomeScreen.showDemoModeConfirmationDialog"); } +void WelcomeScreenHandler::ShowEditRequisitionDialog( + const std::string& requisition) { + CallJS("login.WelcomeScreen.showEditRequisitionDialog", requisition); +} + +void WelcomeScreenHandler::ShowRemoraRequisitionDialog() { + CallJS("login.WelcomeScreen.showRemoraRequisitionDialog"); +} + // WelcomeScreenHandler, BaseScreenHandler implementation: -------------------- void WelcomeScreenHandler::DeclareLocalizedValues( @@ -184,6 +193,8 @@ &WelcomeScreenHandler::HandleSetInputMethodId); AddCallback("WelcomeScreen.setTimezoneId", &WelcomeScreenHandler::HandleSetTimezoneId); + AddCallback("WelcomeScreen.setDeviceRequisition", + &WelcomeScreenHandler::HandleSetDeviceRequisition); } void WelcomeScreenHandler::GetAdditionalParameters( @@ -270,6 +281,12 @@ screen_->SetTimezone(timezone_id); } +void WelcomeScreenHandler::HandleSetDeviceRequisition( + const std::string& requisition) { + if (screen_) + screen_->SetDeviceRequisition(requisition); +} + void WelcomeScreenHandler::OnAccessibilityStatusChanged( const AccessibilityStatusEventDetails& details) { if (details.notification_type == ACCESSIBILITY_MANAGER_SHUTDOWN)
diff --git a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h index 4cf03880..38c505d0 100644 --- a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h
@@ -48,6 +48,8 @@ // Shows dialog to confirm starting Demo mode. virtual void ShowDemoModeConfirmationDialog() = 0; + virtual void ShowEditRequisitionDialog(const std::string& requisition) = 0; + virtual void ShowRemoraRequisitionDialog() = 0; }; // WebUI implementation of WelcomeScreenView. It is used to interact with @@ -68,6 +70,8 @@ void ReloadLocalizedContent() override; void SetInputMethodId(const std::string& input_method_id) override; void ShowDemoModeConfirmationDialog() override; + void ShowEditRequisitionDialog(const std::string& requisition) override; + void ShowRemoraRequisitionDialog() override; // BaseScreenHandler: void DeclareLocalizedValues( @@ -88,6 +92,7 @@ void HandleEnableSpokenFeedback(bool /* enabled */); void HandleEnableSelectToSpeak(bool /* enabled */); void HandleEnableDockedMagnifier(bool /* enabled */); + void HandleSetDeviceRequisition(const std::string& requisition); // Notification of a change in the accessibility settings. void OnAccessibilityStatusChanged(
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc index 8d67180..94b8e4d 100644 --- a/chrome/browser/ui/webui/extensions/extensions_ui.cc +++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -350,8 +350,8 @@ : WebContentsObserver(web_ui->GetWebContents()), WebUIController(web_ui), webui_load_timer_(web_ui->GetWebContents(), - "Extensions.WebUi.DocumentLoadedInMainFrameTime.MD", - "Extensions.WebUi.LoadCompletedInMainFrame.MD") { + "Extensions.WebUi.DocumentLoadedInMainFrameTime", + "Extensions.WebUi.LoadCompletedInMainFrame") { Profile* profile = Profile::FromWebUI(web_ui); content::WebUIDataSource* source = nullptr;
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc index ab07783..fdb5773 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -386,7 +386,6 @@ {"clearCookiesSummarySignedIn", IDS_SETTINGS_CLEAR_COOKIES_AND_SITE_DATA_SUMMARY_BASIC_WITH_EXCEPTION}, {"clearCookiesCounter", IDS_DEL_COOKIES_COUNTER}, - {"clearCookiesFlash", IDS_SETTINGS_CLEAR_COOKIES_FLASH}, {"clearPasswords", IDS_SETTINGS_CLEAR_PASSWORDS}, {"clearFormData", IDS_SETTINGS_CLEAR_FORM_DATA}, {"clearHostedAppData", IDS_SETTINGS_CLEAR_HOSTED_APP_DATA}, @@ -1066,22 +1065,6 @@ l10n_util::GetStringFUTF16( IDS_SETTINGS_SIGNED_OUT_USER_HAS_COMPROMISED_CREDENTIALS_LABEL, base::ASCIIToUTF16(chrome::kSyncLearnMoreURL))); - // The warning message that will be shown if there is a content setting - // pattern with a wildcard in it. The check for wildcards is done on the js - // side. - base::string16 flash_warning_message; - if (base::FeatureList::IsEnabled( - content_settings::kDisallowExtensionsToSetPluginContentSettings)) { - flash_warning_message = l10n_util::GetStringFUTF16( - IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED_IN_POLICIES, - base::UTF8ToUTF16(chrome::kChromeFlashRoadmapURL)); - } else { - flash_warning_message = l10n_util::GetStringFUTF16( - IDS_SETTINGS_SITE_SETTINGS_FLASH_WILDCARD_UNSUPPORTED, - base::UTF8ToUTF16(chrome::kChromeFlashRoadmapURL)); - } - html_source->AddString("warningAboutIgnoredWildcardedPatternsForFlash", - flash_warning_message); bool is_guest_mode = false; #if defined(OS_CHROMEOS) @@ -1717,13 +1700,6 @@ {"siteSettingsSoundAllowRecommended", IDS_SETTINGS_SITE_SETTINGS_SOUND_ALLOW_RECOMMENDED}, {"siteSettingsSoundBlock", IDS_SETTINGS_SITE_SETTINGS_SOUND_BLOCK}, - {"siteSettingsFlash", IDS_SETTINGS_SITE_SETTINGS_FLASH}, - {"siteSettingsFlashAskFirst", IDS_SETTINGS_SITE_SETTINGS_ASK_FIRST}, - {"siteSettingsFlashBlock", IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCK}, - {"siteSettingsFlashBlockRecommended", - IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCK_RECOMMENDED}, - {"siteSettingsFlashPermissionsEphemeral", - IDS_SETTINGS_SITE_SETTINGS_FLASH_PERMISSIONS_ARE_EPHEMERAL}, {"siteSettingsPdfDocuments", IDS_SETTINGS_SITE_SETTINGS_PDF_DOCUMENTS}, {"siteSettingsPdfDownloadPdfs", IDS_SETTINGS_SITE_SETTINGS_PDF_DOWNLOAD_PDFS}, @@ -1979,7 +1955,6 @@ {"handlerIsDefault", IDS_SETTINGS_SITE_SETTINGS_HANDLER_IS_DEFAULT}, {"handlerSetDefault", IDS_SETTINGS_SITE_SETTINGS_HANDLER_SET_DEFAULT}, {"handlerRemove", IDS_SETTINGS_SITE_SETTINGS_REMOVE}, - {"adobeFlashStorage", IDS_SETTINGS_SITE_SETTINGS_ADOBE_FLASH_SETTINGS}, {"incognitoSiteOnly", IDS_SETTINGS_SITE_SETTINGS_INCOGNITO_ONLY}, {"incognitoSiteExceptionDesc", IDS_SETTINGS_SITE_SETTINGS_INCOGNITO_SITE_EXCEPTION_DESC}, @@ -2129,14 +2104,6 @@ IDS_SETTINGS_SITE_SETTINGS_PAYMENT_HANDLERS_ALLOWED_EXCEPTIONS}, {"siteSettingsPaymentHandlersBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_PAYMENT_HANDLERS_BLOCKED_EXCEPTIONS}, - {"siteSettingsFlashDescription", - IDS_SETTINGS_SITE_SETTINGS_FLASH_DESCRIPTION}, - {"siteSettingsFlashAllowed", IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED}, - {"siteSettingsFlashBlocked", IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED}, - {"siteSettingsFlashAllowedExceptions", - IDS_SETTINGS_SITE_SETTINGS_FLASH_ALLOWED_EXCEPTIONS}, - {"siteSettingsFlashBlockedExceptions", - IDS_SETTINGS_SITE_SETTINGS_FLASH_BLOCKED_EXCEPTIONS}, {"siteSettingsPopupsDescription", IDS_SETTINGS_SITE_SETTINGS_POPUPS_DESCRIPTION}, {"siteSettingsPopupsAllowed", IDS_SETTINGS_SITE_SETTINGS_POPUPS_ALLOWED},
diff --git a/chrome/browser/ui/webui/settings/site_settings_handler.cc b/chrome/browser/ui/webui/settings/site_settings_handler.cc index 100a294d..f72c9c74 100644 --- a/chrome/browser/ui/webui/settings/site_settings_handler.cc +++ b/chrome/browser/ui/webui/settings/site_settings_handler.cc
@@ -447,10 +447,6 @@ base::BindRepeating(&SiteSettingsHandler::HandleSetOriginPermissions, base::Unretained(this))); web_ui()->RegisterMessageCallback( - "clearFlashPref", - base::BindRepeating(&SiteSettingsHandler::HandleClearFlashPref, - base::Unretained(this))); - web_ui()->RegisterMessageCallback( "resetCategoryPermissionForPattern", base::BindRepeating( &SiteSettingsHandler::HandleResetCategoryPermissionForPattern,
diff --git a/chrome/browser/ui/webui/sync_internals_message_handler.cc b/chrome/browser/ui/webui/sync_internals_message_handler.cc index 69c157df..775a833 100644 --- a/chrome/browser/ui/webui/sync_internals_message_handler.cc +++ b/chrome/browser/ui/webui/sync_internals_message_handler.cc
@@ -13,6 +13,7 @@ #include "base/strings/string_number_conversions.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/profile_sync_service_factory.h" +#include "chrome/browser/sync/sync_invalidations_service_factory.h" #include "chrome/browser/sync/user_event_service_factory.h" #include "chrome/common/channel_info.h" #include "components/sync/base/model_type.h" @@ -21,8 +22,10 @@ #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_user_settings.h" #include "components/sync/engine/events/protocol_event.h" +#include "components/sync/invalidations/sync_invalidations_service.h" #include "components/sync/js/js_event_details.h" #include "components/sync/protocol/sync.pb.h" +#include "components/sync/protocol/sync_invalidations_payload.pb.h" #include "components/sync_user_events/user_event_service.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/web_ui.h" @@ -30,6 +33,7 @@ using base::DictionaryValue; using base::ListValue; using base::Value; +using syncer::SyncInvalidationsService; using syncer::SyncService; namespace { @@ -174,6 +178,13 @@ service->AddProtocolEventObserver(this); js_controller_ = service->GetJsController(); js_controller_->AddJsEventHandler(this); + + SyncInvalidationsService* invalidations_service = + GetSyncInvalidationsService(); + if (invalidations_service) { + invalidations_service->AddListener(this); + } + is_registered_ = true; } } @@ -342,6 +353,27 @@ DispatchEvent(syncer::sync_ui_util::kOnProtocolEvent, *value); } +void SyncInternalsMessageHandler::OnInvalidationReceived( + const std::string& payload) { + sync_pb::SyncInvalidationsPayload payload_message; + if (!payload_message.ParseFromString(payload)) { + return; + } + + base::ListValue data_types_list; + for (const auto& data_type_invalidation : + payload_message.data_type_invalidations()) { + const int field_number = data_type_invalidation.data_type_id(); + syncer::ModelType type = + syncer::GetModelTypeFromSpecificsFieldNumber(field_number); + if (IsRealDataType(type)) { + data_types_list.Append(syncer::ModelTypeToString(type)); + } + } + + DispatchEvent(syncer::sync_ui_util::kOnInvalidationReceived, data_types_list); +} + void SyncInternalsMessageHandler::HandleJsEvent( const std::string& name, const syncer::JsEventDetails& details) { @@ -361,6 +393,12 @@ Profile::FromWebUI(web_ui())->GetOriginalProfile()); } +SyncInvalidationsService* +SyncInternalsMessageHandler::GetSyncInvalidationsService() { + return SyncInvalidationsServiceFactory::GetForProfile( + Profile::FromWebUI(web_ui())->GetOriginalProfile()); +} + void SyncInternalsMessageHandler::DispatchEvent(const std::string& name, const Value& details_value) { CallJavascriptFunction(syncer::sync_ui_util::kDispatchEvent, Value(name), @@ -380,6 +418,13 @@ service->RemoveProtocolEventObserver(this); js_controller_->RemoveJsEventHandler(this); js_controller_ = nullptr; + + SyncInvalidationsService* invalidations_service = + GetSyncInvalidationsService(); + if (invalidations_service) { + invalidations_service->RemoveListener(this); + } + is_registered_ = false; } }
diff --git a/chrome/browser/ui/webui/sync_internals_message_handler.h b/chrome/browser/ui/webui/sync_internals_message_handler.h index b099567..2ca1461 100644 --- a/chrome/browser/ui/webui/sync_internals_message_handler.h +++ b/chrome/browser/ui/webui/sync_internals_message_handler.h
@@ -13,6 +13,7 @@ #include "base/values.h" #include "components/sync/driver/sync_service_observer.h" #include "components/sync/engine/events/protocol_event_observer.h" +#include "components/sync/invalidations/invalidations_listener.h" #include "components/sync/js/js_controller.h" #include "components/sync/js/js_event_handler.h" #include "components/version_info/channel.h" @@ -20,13 +21,15 @@ namespace syncer { class SyncService; +class SyncInvalidationsService; } // namespace syncer // The implementation for the chrome://sync-internals page. class SyncInternalsMessageHandler : public content::WebUIMessageHandler, public syncer::JsEventHandler, public syncer::SyncServiceObserver, - public syncer::ProtocolEventObserver { + public syncer::ProtocolEventObserver, + public syncer::InvalidationsListener { public: SyncInternalsMessageHandler(); ~SyncInternalsMessageHandler() override; @@ -86,6 +89,9 @@ // syncer::ProtocolEventObserver implementation. void OnProtocolEvent(const syncer::ProtocolEvent& e) override; + // syncer::InvalidationsListener implementation. + void OnInvalidationReceived(const std::string& payload) override; + protected: using AboutSyncDataDelegate = base::RepeatingCallback<std::unique_ptr<base::DictionaryValue>( @@ -102,9 +108,13 @@ void SendAboutInfo(); // Gets the ProfileSyncService of the underlying original profile. May return - // nullptr (e.g., if sync is disabled on the command line). + // nullptr (e.g. if sync is disabled on the command line). syncer::SyncService* GetSyncService(); + // Gets the SyncInvalidationsService of the underlying original profile. May + // return nullptr (e.g. if sync invalidations are not enabled). + syncer::SyncInvalidationsService* GetSyncInvalidationsService(); + // Sends a dispatch event to the UI. Javascript must be enabled. void DispatchEvent(const std::string& name, const base::Value& details_value);
diff --git a/chrome/browser/ui/webui/sync_internals_ui.cc b/chrome/browser/ui/webui/sync_internals_ui.cc index 4ba67ce..14105ef 100644 --- a/chrome/browser/ui/webui/sync_internals_ui.cc +++ b/chrome/browser/ui/webui/sync_internals_ui.cc
@@ -51,6 +51,8 @@ IDR_SYNC_DRIVER_SYNC_INTERNALS_USER_EVENTS_JS}, {syncer::sync_ui_util::kTrafficLogJS, IDR_SYNC_DRIVER_SYNC_INTERNALS_TRAFFIC_LOG_JS}, + {syncer::sync_ui_util::kInvalidationsJS, + IDR_SYNC_DRIVER_SYNC_INTERNALS_INVALIDATIONS_JS}, }; webui::AddResourcePathsBulk(source, kResources);
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index e330df1..04ac725d 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-master-1603691326-ded4cf98fc57f32e31937f939ee80f292f889c4d.profdata +chrome-linux-master-1603713364-255d86fa5592c315dc7718e8b4c93f0ba1279e07.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 332d043..e942d289 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-master-1603613972-73699eb7c90ca72304abe78e4e06ee3df85b698a.profdata +chrome-win32-master-1603680975-76e0bcad480e2e9cf63aee149b7c46a4d88220b4.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 97a94aa..88b8e39 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-master-1603659384-78fe2392c0cc8d75dc2caf4c010bfa3581cbc33b.profdata +chrome-win64-master-1603680975-635b85ea21411c9243264e732f5c4948ba16826c.profdata
diff --git a/chrome/credential_provider/DEPS b/chrome/credential_provider/DEPS index 2ad44f9..704784b 100644 --- a/chrome/credential_provider/DEPS +++ b/chrome/credential_provider/DEPS
@@ -2,7 +2,9 @@ "+chrome/common", "+chrome/installer/launcher_support", "+chrome/installer/util", + "+chrome/updater/protos", "+components/crash", + "+components/policy/proto", "+google_apis", "+third_party/boringssl/src/include", "+third_party/re2",
diff --git a/chrome/credential_provider/common/gcp_strings.cc b/chrome/credential_provider/common/gcp_strings.cc index 162bc3e..3259dbe 100644 --- a/chrome/credential_provider/common/gcp_strings.cc +++ b/chrome/credential_provider/common/gcp_strings.cc
@@ -47,6 +47,8 @@ // Google Update related registry paths. #define GCPW_UPDATE_CLIENT_GUID L"{32987697-A14E-4B89-84D6-630D5431E831}" +const wchar_t kGcpwUpdateClientGuid[] = GCPW_UPDATE_CLIENT_GUID; + const wchar_t kRegUpdaterClientStateAppPath[] = L"SOFTWARE\\Google\\Update\\ClientState\\" GCPW_UPDATE_CLIENT_GUID; const wchar_t kRegUpdaterClientsAppPath[] =
diff --git a/chrome/credential_provider/common/gcp_strings.h b/chrome/credential_provider/common/gcp_strings.h index 1df46a8..c9cd7237 100644 --- a/chrome/credential_provider/common/gcp_strings.h +++ b/chrome/credential_provider/common/gcp_strings.h
@@ -72,6 +72,9 @@ extern const wchar_t kDesktopName[]; extern const wchar_t kDesktopFullName[]; +// GUID used by Google Update client for GCPW application. +extern const wchar_t kGcpwUpdateClientGuid[]; + // Google Update related registry paths. extern const wchar_t kRegUpdaterClientStateAppPath[]; extern const wchar_t kRegUpdaterClientsAppPath[];
diff --git a/chrome/credential_provider/gaiacp/BUILD.gn b/chrome/credential_provider/gaiacp/BUILD.gn index ab5d988..9ded98d 100644 --- a/chrome/credential_provider/gaiacp/BUILD.gn +++ b/chrome/credential_provider/gaiacp/BUILD.gn
@@ -120,6 +120,8 @@ ":util", "../extension:extension_lib", "//base", + "//chrome/updater/protos:omaha_proto", + "//components/policy/proto", "//url", ] }
diff --git a/chrome/credential_provider/gaiacp/device_policies.cc b/chrome/credential_provider/gaiacp/device_policies.cc index d07e6204..1e321a2b 100644 --- a/chrome/credential_provider/gaiacp/device_policies.cc +++ b/chrome/credential_provider/gaiacp/device_policies.cc
@@ -4,6 +4,8 @@ #include "chrome/credential_provider/gaiacp/device_policies.h" +#include "base/strings/string_split.h" +#include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "chrome/credential_provider/common/gcp_strings.h" #include "chrome/credential_provider/gaiacp/gcp_utils.h" @@ -19,6 +21,18 @@ constexpr bool kDevicePolicyDefaultGcpwAutoUpdate = true; constexpr bool kDevicePolicyDefaultMultiUserLogin = true; +// Read the list of domains allowed to login from registry. +std::vector<base::string16> GetRegistryEmailDomains() { + base::string16 email_domains_reg = + GetGlobalFlagOrDefault(kEmailDomainsKey, L""); + base::string16 email_domains_reg_new = + GetGlobalFlagOrDefault(kEmailDomainsKeyNew, L""); + base::string16 email_domains = + email_domains_reg.empty() ? email_domains_reg_new : email_domains_reg; + return base::SplitString(email_domains, L",", + base::WhitespaceHandling::TRIM_WHITESPACE, + base::SplitResult::SPLIT_WANT_NONEMPTY); +} } // namespace // static @@ -46,6 +60,7 @@ enable_gcpw_auto_update(kDevicePolicyDefaultGcpwAutoUpdate), enable_multi_user_login(kDevicePolicyDefaultMultiUserLogin) { // Override with the policies set in the registry. + domains_allowed_to_login = GetRegistryEmailDomains(); base::string16 mdm_url = GetGlobalFlagOrDefault(kRegMdmUrl, kDefaultMdmUrl); DWORD reg_enable_dm_enrollment; @@ -84,4 +99,8 @@ (domains_allowed_to_login == other.domains_allowed_to_login); } +base::string16 DevicePolicies::GetAllowedDomainsStr() const { + return base::JoinString(domains_allowed_to_login, L","); +} + } // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/device_policies.h b/chrome/credential_provider/gaiacp/device_policies.h index 06bf31d..660fb58 100644 --- a/chrome/credential_provider/gaiacp/device_policies.h +++ b/chrome/credential_provider/gaiacp/device_policies.h
@@ -48,6 +48,9 @@ void MergeWith(const DevicePolicies& other); bool operator==(const DevicePolicies& other) const; + + // Get a string with comma separated values from domains_allowed_to_login. + base::string16 GetAllowedDomainsStr() const; }; } // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/device_policies_manager.cc b/chrome/credential_provider/gaiacp/device_policies_manager.cc index 4e9c85d..4c23768 100644 --- a/chrome/credential_provider/gaiacp/device_policies_manager.cc +++ b/chrome/credential_provider/gaiacp/device_policies_manager.cc
@@ -6,12 +6,15 @@ #include <limits> +#include "base/base64.h" #include "base/files/file.h" #include "base/files/file_util.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" +#include "base/path_service.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" +#include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "base/win/registry.h" @@ -23,14 +26,124 @@ #include "chrome/credential_provider/gaiacp/reg_utils.h" #include "chrome/credential_provider/gaiacp/user_policies_manager.h" #include "chrome/credential_provider/gaiacp/win_http_url_fetcher.h" +#include "chrome/updater/protos/omaha_settings.pb.h" +#include "components/policy/proto/device_management_backend.pb.h" + +using ::enterprise_management::PolicyData; +using ::enterprise_management::PolicyFetchResponse; +using ::wireless_android_enterprise_devicemanagement::ApplicationSettings; +using ::wireless_android_enterprise_devicemanagement:: + GcpwSpecificApplicationSettings; +using ::wireless_android_enterprise_devicemanagement::OmahaSettingsClientProto; + +namespace credential_provider { namespace { // Character used to separate the update channel and version components in the // update tracks value. const wchar_t kChannelAndVersionSeparator[] = L"-"; -} // namespace -namespace credential_provider { +// Name of the file used to store the policies on disk by Omaha that it receives +// from the DMServer. +constexpr char kOmahaPolicyFileName[] = "PolicyFetchResponse"; + +// Directory name where Omaha policies are stored. +constexpr char kOmahaPoliciesDirName[] = "Policies"; + +// The policy type for Omaha policy settings. +constexpr char kOmahaPolicyType[] = "google/machine-level-omaha"; + +// Gets the file path where Omaha policies for the device are stored. +base::FilePath GetOmahaPolicyFilePath() { + base::FilePath policy_dir; + if (!base::PathService::Get(base::DIR_PROGRAM_FILESX86, &policy_dir)) { + HRESULT hr = HRESULT_FROM_WIN32(::GetLastError()); + LOGFN(ERROR) << "PathService::Get(DIR_PROGRAM_FILESX86) hr=" << putHR(hr); + return base::FilePath(); + } + + std::string encoded_omaha_policy_type; + base::Base64Encode(kOmahaPolicyType, &encoded_omaha_policy_type); + policy_dir = policy_dir.Append(GetInstallParentDirectoryName()) + .AppendASCII(kOmahaPoliciesDirName) + .AppendASCII(encoded_omaha_policy_type); + + base::FilePath policy_file_path = + policy_dir.AppendASCII(kOmahaPolicyFileName); + return policy_file_path; +} + +// Returns a parsed proto of the Omaha policy fetch response stored on disk from +// the last time Omaha synced the policies from the backend server. +std::unique_ptr<PolicyFetchResponse> ReadOmahaPolicyFromDisk() { + LOGFN(VERBOSE); + + base::FilePath policy_file_path = GetOmahaPolicyFilePath(); + std::string policy_blob; + + if (!base::PathExists(policy_file_path) || + !base::ReadFileToString(policy_file_path, &policy_blob)) { + LOGFN(WARNING) << "Omaha policy not found in " << policy_file_path; + return nullptr; + } + + auto policy_fetch_response = std::make_unique<PolicyFetchResponse>(); + if (policy_blob.empty() || + !policy_fetch_response->ParseFromString(policy_blob)) { + LOGFN(ERROR) << "Omaha policy corrupted!"; + return nullptr; + } + + return policy_fetch_response; +} + +// Get the list of domains allowed to login as defined by the cloud policy +// fetched by Omaha. +bool GetAllowedDomainsToLoginFromCloudPolicy( + std::vector<base::string16>* domains) { + DCHECK(domains); + + std::unique_ptr<PolicyFetchResponse> policy_fetch_response = + ReadOmahaPolicyFromDisk(); + if (!policy_fetch_response) { + return false; + } + + PolicyData policy_data; + if (!policy_fetch_response->has_policy_data() || + !policy_data.ParseFromString(policy_fetch_response->policy_data()) || + !policy_data.has_policy_value()) { + LOGFN(ERROR) << "Cloud policy data not found!"; + return false; + } + + OmahaSettingsClientProto omaha_settings; + omaha_settings.ParseFromString(policy_data.policy_value()); + + bool found_gcpw_settings = false; + for (const ApplicationSettings& app_setting : + omaha_settings.application_settings()) { + if (app_setting.app_guid() == base::UTF16ToUTF8(kGcpwUpdateClientGuid) && + app_setting.has_gcpw_application_settings()) { + found_gcpw_settings = true; + const GcpwSpecificApplicationSettings& gcpw_settings = + app_setting.gcpw_application_settings(); + + domains->clear(); + for (const std::string& domain : + gcpw_settings.domains_allowed_to_login()) { + domains->push_back(base::UTF8ToUTF16(domain)); + } + LOGFN(VERBOSE) << "Cloud policy domains: " + << base::JoinString(*domains, L","); + + break; + } + } + + return found_gcpw_settings; +} +} // namespace // static DevicePoliciesManager* DevicePoliciesManager::Get() { @@ -87,6 +200,14 @@ device_policies->MergeWith(other_policies); } } + + // Read allowed domains cloud policy. + std::vector<base::string16> domains_from_policy; + if (GetAllowedDomainsToLoginFromCloudPolicy(&domains_from_policy)) { + device_policies->domains_allowed_to_login = domains_from_policy; + } else { + LOGFN(VERBOSE) << "Allowed domains cloud policy not found"; + } } void DevicePoliciesManager::EnforceGcpwUpdatePolicy() { @@ -166,4 +287,31 @@ } } +bool DevicePoliciesManager::SetAllowedDomainsOmahaPolicyForTesting( + const std::vector<base::string16>& domains) { + OmahaSettingsClientProto omaha_settings; + ApplicationSettings* app_settings = omaha_settings.add_application_settings(); + app_settings->set_app_guid(base::UTF16ToUTF8(kGcpwUpdateClientGuid)); + GcpwSpecificApplicationSettings* gcpw_settings = + app_settings->mutable_gcpw_application_settings(); + + for (const base::string16& domain : domains) { + gcpw_settings->add_domains_allowed_to_login(base::UTF16ToUTF8(domain)); + } + + PolicyData policy_data; + std::string policy_value = omaha_settings.SerializeAsString(); + policy_data.set_policy_value(policy_value); + + PolicyFetchResponse policy_fetch_response; + policy_fetch_response.set_error_code(200); + std::string policy_data_str = policy_data.SerializeAsString(); + policy_fetch_response.set_policy_data(policy_data_str); + + base::FilePath policy_file_path = GetOmahaPolicyFilePath(); + std::string policy_response_str = policy_fetch_response.SerializeAsString(); + base::CreateDirectory(policy_file_path.DirName()); + return base::WriteFile(policy_file_path, policy_response_str); +} + } // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/device_policies_manager.h b/chrome/credential_provider/gaiacp/device_policies_manager.h index 4df42674..cc15dc5 100644 --- a/chrome/credential_provider/gaiacp/device_policies_manager.h +++ b/chrome/credential_provider/gaiacp/device_policies_manager.h
@@ -26,6 +26,11 @@ // Make sure GCPW update is set up correctly. void EnforceGcpwUpdatePolicy(); + // Creates an Omaha policy with the list of allowed |domains| for GCPW to be + // used in tests. + bool SetAllowedDomainsOmahaPolicyForTesting( + const std::vector<base::string16>& domains); + protected: // Returns the storage used for the instance pointer. static DevicePoliciesManager** GetInstanceStorage();
diff --git a/chrome/credential_provider/gaiacp/device_policies_manager_unittests.cc b/chrome/credential_provider/gaiacp/device_policies_manager_unittests.cc index 2b708ee1..7e0b2fbd 100644 --- a/chrome/credential_provider/gaiacp/device_policies_manager_unittests.cc +++ b/chrome/credential_provider/gaiacp/device_policies_manager_unittests.cc
@@ -5,6 +5,8 @@ #include <windows.h> #include "base/strings/string_number_conversions.h" +#include "base/strings/string_split.h" +#include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "chrome/credential_provider/gaiacp/device_policies_manager.h" @@ -204,5 +206,150 @@ "100.1.2.3", "100.1.2.4"))); +// Base test for testing allowed domains policy scenarios. +class GcpDevicePoliciesAllowedDomainsBaseTest + : public GcpDevicePoliciesBaseTest { + public: + void SetUp() override; +}; + +void GcpDevicePoliciesAllowedDomainsBaseTest::SetUp() { + GcpDevicePoliciesBaseTest::SetUp(); + + // Delete any existing registry entries. Setting to empty deletes them. + SetGlobalFlagForTesting(L"ed", L""); + SetGlobalFlagForTesting(L"domains_allowed_to_login", L""); +} + +// Test that correct allowed domains policy is obtained whether they are set in +// the registry or through the cloud policy. +// Parameters are: +// 1. bool : Whether domains set through Omaha cloud policy. +// 2. int : 0 - Domains not set through registry. +// 1 - Domains set through deprecated "ed" registry entry. +// 2 - Domains set through "domains_allowed_to_login" registry entry. +// 3. string : List of domains from which users are allowed to login. +// 4. bool : Has existing user. +class GcpDevicePoliciesAllowedDomainsTest + : public GcpDevicePoliciesAllowedDomainsBaseTest, + public ::testing::WithParamInterface< + std::tuple<bool, int, const wchar_t*, bool>> {}; + +TEST_P(GcpDevicePoliciesAllowedDomainsTest, OmahaPolicyTest) { + bool has_omaha_domains_policy = std::get<0>(GetParam()); + bool has_registry_domains_policy = std::get<1>(GetParam()) != 0; + bool use_old_domains_reg_key = std::get<1>(GetParam()) == 1; + base::string16 allowed_domains_str(std::get<2>(GetParam())); + bool has_existing_user = std::get<3>(GetParam()); + + std::vector<base::string16> allowed_domains = base::SplitString( + allowed_domains_str, L",", base::WhitespaceHandling::TRIM_WHITESPACE, + base::SplitResult::SPLIT_WANT_NONEMPTY); + + if (has_omaha_domains_policy) { + ASSERT_TRUE( + DevicePoliciesManager::Get()->SetAllowedDomainsOmahaPolicyForTesting( + allowed_domains)); + } + + if (has_registry_domains_policy) { + if (use_old_domains_reg_key) { + SetGlobalFlagForTesting(L"ed", allowed_domains_str); + } else { + SetGlobalFlagForTesting(L"domains_allowed_to_login", allowed_domains_str); + } + } + + FakeUserPoliciesManager fake_user_policies_manager(true); + UserPolicies user_policy; + + if (has_existing_user) { + CComBSTR sid; + ASSERT_EQ(S_OK, + fake_os_user_manager()->CreateTestOSUser( + kDefaultUsername, L"password", L"Full Name", L"comment", + base::UTF8ToUTF16(kDefaultGaiaId), base::string16(), &sid)); + // Add a random user policy. + user_policy.enable_dm_enrollment = false; + user_policy.enable_gcpw_auto_update = false; + user_policy.enable_multi_user_login = false; + user_policy.gcpw_pinned_version = GcpwVersion("100.1.2.3"); + + fake_user_policies_manager.SetUserPolicies(OLE2W(sid), user_policy); + } + + DevicePolicies device_policies; + DevicePoliciesManager::Get()->GetDevicePolicies(&device_policies); + + if (has_omaha_domains_policy || has_registry_domains_policy) + ASSERT_EQ(allowed_domains, device_policies.domains_allowed_to_login); + + if (has_existing_user) { + ASSERT_EQ(user_policy.enable_dm_enrollment, + device_policies.enable_dm_enrollment); + ASSERT_EQ(user_policy.enable_gcpw_auto_update, + device_policies.enable_gcpw_auto_update); + ASSERT_EQ(user_policy.enable_multi_user_login, + device_policies.enable_multi_user_login); + ASSERT_EQ(user_policy.gcpw_pinned_version, + device_policies.gcpw_pinned_version); + } +} + +INSTANTIATE_TEST_SUITE_P( + All, + GcpDevicePoliciesAllowedDomainsTest, + ::testing::Combine( + ::testing::Bool(), + ::testing::Values(0, 1, 2), + ::testing::Values(L"", L"acme.com", L"acme.com,acme.org"), + ::testing::Bool())); + +// Test to ensure Omaha policies override the existing registry settings for +// allowed domains policy. +// Parameters are: +// 1. bool : If true, deprecated "ed" registry entry is used. Otherwise +// "domains_allowed_to_login" is used. +// 2. string : List of allowed domains for GCPW specified through registry. +// 3. string : List of allowed domains for GCPW specified through a Omaha cloud +// policy. +class GcpDevicePoliciesOmahaDomainsWinTest + : public GcpDevicePoliciesAllowedDomainsBaseTest, + public ::testing::WithParamInterface< + std::tuple<bool, const wchar_t*, const wchar_t*>> {}; + +TEST_P(GcpDevicePoliciesOmahaDomainsWinTest, TestConflict) { + bool use_old_domains_reg_key = std::get<0>(GetParam()); + base::string16 domains_registry_str(std::get<1>(GetParam())); + base::string16 domains_from_omaha_str(std::get<2>(GetParam())); + + std::vector<base::string16> allowed_domains_omaha = base::SplitString( + domains_from_omaha_str, L",", base::WhitespaceHandling::TRIM_WHITESPACE, + base::SplitResult::SPLIT_WANT_NONEMPTY); + + ASSERT_TRUE( + DevicePoliciesManager::Get()->SetAllowedDomainsOmahaPolicyForTesting( + allowed_domains_omaha)); + + if (use_old_domains_reg_key) { + SetGlobalFlagForTesting(L"ed", domains_registry_str); + } else { + SetGlobalFlagForTesting(L"domains_allowed_to_login", domains_registry_str); + } + + DevicePolicies device_policies; + DevicePoliciesManager::Get()->GetDevicePolicies(&device_policies); + + ASSERT_EQ(allowed_domains_omaha, device_policies.domains_allowed_to_login); +} + +INSTANTIATE_TEST_SUITE_P( + All, + GcpDevicePoliciesOmahaDomainsWinTest, + ::testing::Combine( + ::testing::Bool(), + ::testing::Values(L"", L"acme.com", L"acme.com,acme.org"), + ::testing::Values(L"", L"company.com", L"company.com,company.org"))); + } // namespace testing } // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base.cc b/chrome/credential_provider/gaiacp/gaia_credential_base.cc index 1141a3a3..cdb6cfd 100644 --- a/chrome/credential_provider/gaiacp/gaia_credential_base.cc +++ b/chrome/credential_provider/gaiacp/gaia_credential_base.cc
@@ -71,8 +71,6 @@ namespace { -constexpr wchar_t kEmailDomainsKey[] = L"ed"; // deprecated. -constexpr wchar_t kEmailDomainsKeyNew[] = L"domains_allowed_to_login"; constexpr wchar_t kPermittedAccounts[] = L"permitted_accounts"; constexpr wchar_t kPermittedAccountsSeparator[] = L","; constexpr char kGetAccessTokenBodyWithScopeFormat[] = @@ -116,6 +114,14 @@ } base::string16 GetEmailDomains() { + if (DevicePoliciesManager::Get()->CloudPoliciesEnabled()) { + DevicePolicies device_policies; + DevicePoliciesManager::Get()->GetDevicePolicies(&device_policies); + return device_policies.GetAllowedDomainsStr(); + } + + // TODO (crbug.com/1135458): Clean up directly reading from registry after + // cloud policies is launched. base::string16 email_domains_reg = GetEmailDomains(kEmailDomainsKey); base::string16 email_domains_reg_new = GetEmailDomains(kEmailDomainsKeyNew); return email_domains_reg.empty() ? email_domains_reg_new : email_domains_reg;
diff --git a/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc b/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc index 1a683ab9..0ff9efd 100644 --- a/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc +++ b/chrome/credential_provider/gaiacp/gaia_credential_base_unittests.cc
@@ -3780,5 +3780,73 @@ ::testing::Values(L"", L"beta"), ::testing::Values(L"", L"80.2.35.4"))); +// Test the allowed domains to login policy defined either through registry or +// through a cloud policy. +// Parameters are: +// 1. int : 0 - Domains set through cloud policy. +// 1 - Domains set through deprecated "ed" registry entry. +// 2 - Domains set through "domains_allowed_to_login" registry entry. +// 2. string : List of domains from which users are allowed to login. +class GcpGaiaCredentialBaseAllowedDomainsCloudPolicyTest + : public GcpGaiaCredentialBaseTest, + public ::testing::WithParamInterface<std::tuple<int, const wchar_t*>> { + public: + void SetUp() override; +}; + +void GcpGaiaCredentialBaseAllowedDomainsCloudPolicyTest::SetUp() { + GcpGaiaCredentialBaseTest::SetUp(); + + // Delete any existing registry entries. Setting to empty deletes them. + SetGlobalFlagForTesting(L"ed", L""); + SetGlobalFlagForTesting(L"domains_allowed_to_login", L""); +} + +TEST_P(GcpGaiaCredentialBaseAllowedDomainsCloudPolicyTest, OmahaPolicyTest) { + bool cloud_policies_enabled = std::get<0>(GetParam()) == 0; + bool use_old_domains_reg_key = std::get<0>(GetParam()) == 1; + base::string16 allowed_domains(std::get<1>(GetParam())); + + FakeDevicePoliciesManager fake_device_policies_manager( + cloud_policies_enabled); + + if (cloud_policies_enabled) { + DevicePolicies device_policies; + if (!allowed_domains.empty()) { + device_policies.domains_allowed_to_login = base::SplitString( + allowed_domains, L",", base::WhitespaceHandling::TRIM_WHITESPACE, + base::SplitResult::SPLIT_WANT_NONEMPTY); + } + fake_device_policies_manager.SetDevicePolicies(device_policies); + } else if (use_old_domains_reg_key) { + SetGlobalFlagForTesting(L"ed", allowed_domains); + } else { + SetGlobalFlagForTesting(L"domains_allowed_to_login", allowed_domains); + } + + // Create provider and start logon. + Microsoft::WRL::ComPtr<ICredentialProviderCredential> cred; + + ASSERT_EQ(S_OK, InitializeProviderAndGetCredential(0, &cred)); + + if (allowed_domains.empty()) { + ASSERT_EQ(S_OK, + StartLogonProcess(/*succeeds=*/false, IDS_EMAIL_MISMATCH_BASE)); + } else { + ASSERT_EQ(S_OK, StartLogonProcessAndWait()); + + // Finish logon successfully. + ASSERT_EQ(S_OK, FinishLogonProcess(true, true, 0)); + + ASSERT_EQ(S_OK, ReleaseProvider()); + } +} + +INSTANTIATE_TEST_SUITE_P( + All, + GcpGaiaCredentialBaseAllowedDomainsCloudPolicyTest, + ::testing::Combine(::testing::Values(0, 1, 2), + ::testing::Values(L"", L"acme.com,acme.org"))); + } // namespace testing } // namespace credential_provider
diff --git a/chrome/credential_provider/gaiacp/reg_utils.cc b/chrome/credential_provider/gaiacp/reg_utils.cc index e680a90..bf14a8e 100644 --- a/chrome/credential_provider/gaiacp/reg_utils.cc +++ b/chrome/credential_provider/gaiacp/reg_utils.cc
@@ -62,6 +62,8 @@ constexpr wchar_t kRegUpdateCredentialsOnChange[] = L"update_credentials_on_change"; constexpr wchar_t kRegUseShorterAccountName[] = L"use_shorter_account_name"; +constexpr wchar_t kEmailDomainsKey[] = L"ed"; // deprecated. +constexpr wchar_t kEmailDomainsKeyNew[] = L"domains_allowed_to_login"; namespace {
diff --git a/chrome/credential_provider/gaiacp/reg_utils.h b/chrome/credential_provider/gaiacp/reg_utils.h index cb722dbd..f9b7cea 100644 --- a/chrome/credential_provider/gaiacp/reg_utils.h +++ b/chrome/credential_provider/gaiacp/reg_utils.h
@@ -79,6 +79,10 @@ // should be in shorter form. extern const wchar_t kRegUseShorterAccountName[]; +// Registry keys where list of domains allowed to login is specified. +extern const wchar_t kEmailDomainsKey[]; // Older deprecated key. +extern const wchar_t kEmailDomainsKeyNew[]; + // Gets any HKLM registry key on the system. HRESULT GetMachineRegDWORD(const base::string16& key_name, const base::string16& name,
diff --git a/chrome/credential_provider/test/gls_runner_test_base.cc b/chrome/credential_provider/test/gls_runner_test_base.cc index 7d7fe6f35..1757293 100644 --- a/chrome/credential_provider/test/gls_runner_test_base.cc +++ b/chrome/credential_provider/test/gls_runner_test_base.cc
@@ -149,11 +149,15 @@ // the tests. InitializeRegistryOverrideForTesting(®istry_override_); - // Override location of "Program Files" system folder so we don't modify local - // machine settings. + // Override location of "Program Files" system folder and its x86 version so + // we don't modify local machine settings. ASSERT_TRUE(scoped_temp_program_files_dir_.CreateUniqueTempDir()); program_files_override_.reset(new base::ScopedPathOverride( base::DIR_PROGRAM_FILES, scoped_temp_program_files_dir_.GetPath())); + ASSERT_TRUE(scoped_temp_program_files_x86_dir_.CreateUniqueTempDir()); + program_files_x86_override_.reset(new base::ScopedPathOverride( + base::DIR_PROGRAM_FILESX86, + scoped_temp_program_files_x86_dir_.GetPath())); // Also override location of "ProgramData" system folder as we store user // policies there.
diff --git a/chrome/credential_provider/test/gls_runner_test_base.h b/chrome/credential_provider/test/gls_runner_test_base.h index ec3d47b..c303b91 100644 --- a/chrome/credential_provider/test/gls_runner_test_base.h +++ b/chrome/credential_provider/test/gls_runner_test_base.h
@@ -240,8 +240,10 @@ std::string default_token_handle_response_; base::ScopedTempDir scoped_temp_program_files_dir_; + base::ScopedTempDir scoped_temp_program_files_x86_dir_; base::ScopedTempDir scoped_temp_progdata_dir_; std::unique_ptr<base::ScopedPathOverride> program_files_override_; + std::unique_ptr<base::ScopedPathOverride> program_files_x86_override_; std::unique_ptr<base::ScopedPathOverride> programdata_override_; };
diff --git a/chrome/installer/mac/signing/pipeline.py b/chrome/installer/mac/signing/pipeline.py index bf0e85d..0ba1fe7f 100644 --- a/chrome/installer/mac/signing/pipeline.py +++ b/chrome/installer/mac/signing/pipeline.py
@@ -172,9 +172,8 @@ def _productbuild_distribution_path(paths, dist_config, component_pkg_path): - """Creates a distribution XML file for use by `productbuild`. This specifies - that an x64 machine is required, and copies the OS requirement from the copy - of Chrome being packaged. + """Creates a distribution XML file for use by `productbuild`. This copies + the OS requirement from the copy of Chrome being packaged. Args: paths: A |model.Paths| object. @@ -197,7 +196,7 @@ <!-- Top-level info about the distribution. --> <title>{app_product}</title> - <options customize="never" require-scripts="false" hostArchitectures="x86_64"/> + <options customize="never" require-scripts="false"/> <domains enable_anywhere="false" enable_currentUserHome="false" enable_localSystem="true"/> <volume-check> <allowed-os-versions>
diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index d6bb850..bba833d 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc
@@ -1472,7 +1472,7 @@ // where no deletion occurred because directory is non-empty. bool RemoveShortcutFolderIfEmpty(ShellUtil::ShortcutLocation location, ShellUtil::ShellChange level) { - // Explicitly whitelist locations, since accidental calls can be very harmful. + // Explicitly allow locations, since accidental calls can be very harmful. if (location != ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED && location != ShellUtil::SHORTCUT_LOCATION_START_MENU_CHROME_APPS_DIR && @@ -1764,7 +1764,7 @@ bool ShellUtil::MoveExistingShortcut(ShortcutLocation old_location, ShortcutLocation new_location, const ShortcutProperties& properties) { - // Explicitly whitelist locations to which this is applicable. + // Explicitly allow locations to which this is applicable. if (old_location != SHORTCUT_LOCATION_START_MENU_CHROME_DIR_DEPRECATED || new_location != SHORTCUT_LOCATION_START_MENU_ROOT) { NOTREACHED(); @@ -1788,7 +1788,7 @@ bool ShellUtil::CreateOrUpdateShortcut(ShortcutLocation location, const ShortcutProperties& properties, ShortcutOperation operation) { - // Explicitly whitelist locations to which this is applicable. + // Explicitly allow locations to which this is applicable. if (location != SHORTCUT_LOCATION_DESKTOP && location != SHORTCUT_LOCATION_QUICK_LAUNCH && location != SHORTCUT_LOCATION_START_MENU_ROOT &&
diff --git a/chrome/installer/util/shell_util.h b/chrome/installer/util/shell_util.h index 47bff108..ff0e8807 100644 --- a/chrome/installer/util/shell_util.h +++ b/chrome/installer/util/shell_util.h
@@ -586,8 +586,8 @@ typedef base::RefCountedData<base::AtomicFlag> SharedCancellationFlag; - // Appends Chrome shortcuts with non-whitelisted arguments to |shortcuts| if - // not nullptr. If |do_removal|, also removes non-whitelisted arguments from + // Appends Chrome shortcuts with disallowed arguments to |shortcuts| if + // not nullptr. If |do_removal|, also removes disallowed arguments from // those shortcuts. This method will abort and return false if |cancel| is // non-nullptr and gets set at any point during this call. static bool ShortcutListMaybeRemoveUnknownArgs(
diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index 36b2458..fb09c76 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc
@@ -629,7 +629,7 @@ ASSERT_TRUE(base::PathExists(shortcut1_path)); ShellUtil::ShortcutProperties expected_properties1(test_properties_); - // Shortcut 2: targets "chrome.exe"; has 1 whitelisted argument. + // Shortcut 2: targets "chrome.exe"; has 1 argument in the allow list. test_properties_.set_shortcut_name(L"Chrome 2"); test_properties_.set_arguments(L"--profile-directory=\"Profile 2\""); ASSERT_TRUE(ShellUtil::CreateOrUpdateShortcut(
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index 25482517..8e69d1b0 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -3970,6 +3970,7 @@ "../browser/media/kaleidoscope/kaleidoscope_metrics_recorder_unittest.cc", "../browser/media/kaleidoscope/kaleidoscope_service_unittest.cc", "../browser/media/kaleidoscope/kaleidoscope_switches_unittest.cc", + "../browser/notifications/muted_notification_handler_unittest.cc", "../browser/notifications/screen_capture_notification_blocker_unittest.cc", "../browser/password_manager/generated_password_leak_detection_pref_unittest.cc", "../browser/performance_manager/test_support/page_discarding_utils.cc",
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/tests/TabSwitcherControllerTest.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/tests/TabSwitcherControllerTest.java index 6f717798..6e51360d 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/tests/TabSwitcherControllerTest.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/pagecontroller/tests/TabSwitcherControllerTest.java
@@ -16,6 +16,7 @@ import org.junit.runner.RunWith; import org.chromium.base.test.BaseJUnit4ClassRunner; +import org.chromium.base.test.util.DisabledTest; import org.chromium.chrome.test.pagecontroller.controllers.ntp.NewTabPageController; import org.chromium.chrome.test.pagecontroller.controllers.tabswitcher.TabSwitcherController; import org.chromium.chrome.test.pagecontroller.controllers.tabswitcher.TabSwitcherMenuController; @@ -76,6 +77,7 @@ Assert.assertTrue(NewTabPageController.getInstance().isCurrentPageThis()); } + @DisabledTest(message = "https://crbug.com/1140998") @Test public void testOpenMenu() { mController.clickMenu();
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 51991df2..d160f84 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc
@@ -640,6 +640,10 @@ if (IsOffTheRecord()) return original_profile_->GetOffTheRecordProfile(otr_profile_id); + // Ephemeral Guest profiles do not support Incognito. + if (IsEphemeralGuestProfile() && otr_profile_id == OTRProfileID::PrimaryID()) + return nullptr; + if (!HasOffTheRecordProfile(otr_profile_id)) { TestingProfile::Builder builder; if (IsGuestSession() && otr_profile_id == OTRProfileID::PrimaryID()) @@ -979,7 +983,11 @@ } bool TestingProfile::IsGuestSession() const { - return guest_session_; + return guest_session_ && !IsEphemeralGuestProfileEnabled(); +} + +bool TestingProfile::IsEphemeralGuestProfile() const { + return guest_session_ && IsEphemeralGuestProfileEnabled(); } bool TestingProfile::IsNewProfile() const {
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h index ad8383f..3b03852 100644 --- a/chrome/test/base/testing_profile.h +++ b/chrome/test/base/testing_profile.h
@@ -367,6 +367,7 @@ void set_last_selected_directory(const base::FilePath& path) override; bool WasCreatedByVersionOrLater(const std::string& version) override; bool IsGuestSession() const override; + bool IsEphemeralGuestProfile() const override; bool IsNewProfile() const override; void SetExitType(ExitType exit_type) override {} ExitType GetLastSessionExitType() const override;
diff --git a/chrome/test/data/notifications/notification_tester.html b/chrome/test/data/notifications/notification_tester.html index 44025f97..c4b529a 100644 --- a/chrome/test/data/notifications/notification_tester.html +++ b/chrome/test/data/notifications/notification_tester.html
@@ -77,8 +77,8 @@ g_permissionGranted = true; } -// Starts a screen cast session and reports success to the test driver. -function startScreenCast() { +// Starts a screen capture session and reports success to the test driver. +function startScreenCapture() { navigator.mediaDevices.getDisplayMedia({video: true}).then((stream) => { g_mediaStream = stream; sendResultToTest('success'); @@ -87,8 +87,8 @@ }); } -// Stops a screen cast session and reports success to the test driver. -function stopScreenCast() { +// Stops a screen capture session and reports success to the test driver. +function stopScreenCapture() { if (!g_mediaStream) { sendResultToTest('error'); return;
diff --git a/chrome/test/data/webui/settings/category_default_setting_tests.js b/chrome/test/data/webui/settings/category_default_setting_tests.js index 1a31e55..371816f0 100644 --- a/chrome/test/data/webui/settings/category_default_setting_tests.js +++ b/chrome/test/data/webui/settings/category_default_setting_tests.js
@@ -123,44 +123,6 @@ false, ContentSetting.ASK); }); - test('test Flash content setting in DETECT/ASK setting', function() { - const prefsFlash = createSiteSettingsPrefs( - [createContentSettingTypeToValuePair( - ContentSettingsTypes.PLUGINS, createDefaultContentSetting({ - setting: ContentSetting.IMPORTANT_CONTENT, - }))], - []); - - return testCategoryEnabled( - testElement, ContentSettingsTypes.PLUGINS, prefsFlash, true, - ContentSetting.IMPORTANT_CONTENT); - }); - - test('test Flash content setting in legacy ALLOW setting', function() { - const prefsFlash = createSiteSettingsPrefs( - [createContentSettingTypeToValuePair( - ContentSettingsTypes.PLUGINS, createDefaultContentSetting({ - setting: ContentSetting.ALLOW, - }))], - []); - - return testCategoryEnabled( - testElement, ContentSettingsTypes.PLUGINS, prefsFlash, true, - ContentSetting.IMPORTANT_CONTENT); - }); - - test('test Flash content setting in BLOCK setting', function() { - const prefsFlash = createSiteSettingsPrefs( - [createContentSettingTypeToValuePair( - ContentSettingsTypes.PLUGINS, createDefaultContentSetting({ - setting: ContentSetting.BLOCK, - }))], - []); - - return testCategoryEnabled( - testElement, ContentSettingsTypes.PLUGINS, prefsFlash, false, - ContentSetting.IMPORTANT_CONTENT); - }); test('test content setting from extension', function() { testElement.category = ContentSettingsTypes.MIC;
diff --git a/chrome/test/data/webui/settings/privacy_page_test.js b/chrome/test/data/webui/settings/privacy_page_test.js index 16b365e3..4fcb202 100644 --- a/chrome/test/data/webui/settings/privacy_page_test.js +++ b/chrome/test/data/webui/settings/privacy_page_test.js
@@ -29,7 +29,6 @@ routes.SITE_SETTINGS_BACKGROUND_SYNC, routes.SITE_SETTINGS_CAMERA, routes.SITE_SETTINGS_CLIPBOARD, - routes.SITE_SETTINGS_FLASH, routes.SITE_SETTINGS_IMAGES, routes.SITE_SETTINGS_JAVASCRIPT, routes.SITE_SETTINGS_LOCATION,
diff --git a/chrome/test/data/webui/settings/settings_category_default_radio_group_tests.js b/chrome/test/data/webui/settings/settings_category_default_radio_group_tests.js index f0a9c67..9f68e18 100644 --- a/chrome/test/data/webui/settings/settings_category_default_radio_group_tests.js +++ b/chrome/test/data/webui/settings/settings_category_default_radio_group_tests.js
@@ -152,24 +152,6 @@ }); - test('imp. content flash disable click triggers update', async function() { - const enabledPref = createPref( - ContentSettingsTypes.PLUGINS, ContentSetting.IMPORTANT_CONTENT); - - await testCategoryEnabled( - testElement, browserProxy, enabledPref, ContentSettingsTypes.PLUGINS, - true, ContentSetting.IMPORTANT_CONTENT); - }); - - test('block flash enable click triggers update', async function() { - const disabledPref = - createPref(ContentSettingsTypes.PLUGINS, ContentSetting.BLOCK); - - await testCategoryEnabled( - testElement, browserProxy, disabledPref, ContentSettingsTypes.PLUGINS, - false, ContentSetting.IMPORTANT_CONTENT); - }); - test('radio group is disabled when pref is enforced', async function() { const enforcedPrefs = createSiteSettingsPrefs( [createContentSettingTypeToValuePair(
diff --git a/chrome/test/data/webui/settings/site_details_tests.js b/chrome/test/data/webui/settings/site_details_tests.js index 76e4c3f..7f21fd8b 100644 --- a/chrome/test/data/webui/settings/site_details_tests.js +++ b/chrome/test/data/webui/settings/site_details_tests.js
@@ -77,11 +77,6 @@ ContentSettingsTypes.SOUND, [createRawSiteException('https://foo.com:443')]), createContentSettingTypeToValuePair( - ContentSettingsTypes.PLUGINS, - [createRawSiteException('https://foo.com:443', { - source: SiteSettingSource.EXTENSION, - })]), - createContentSettingTypeToValuePair( ContentSettingsTypes.POPUPS, [createRawSiteException('https://foo.com:443', { setting: ContentSetting.BLOCK, @@ -394,8 +389,6 @@ if (siteDetailsPermission.category === ContentSettingsTypes.NOTIFICATIONS || siteDetailsPermission.category === - ContentSettingsTypes.PLUGINS || - siteDetailsPermission.category === ContentSettingsTypes.JAVASCRIPT || siteDetailsPermission.category === ContentSettingsTypes.IMAGES ||
diff --git a/chrome/test/data/webui/settings/site_list_tests.js b/chrome/test/data/webui/settings/site_list_tests.js index 334c167..bbf8c9d0 100644 --- a/chrome/test/data/webui/settings/site_list_tests.js +++ b/chrome/test/data/webui/settings/site_list_tests.js
@@ -33,12 +33,6 @@ let prefsGeolocationEmpty; /** - * An example of prefs controlledBy policy. - * @type {SiteSettingsPref} - */ -let prefsControlled; - -/** * An example pref with mixed schemes (present and absent). * @type {SiteSettingsPref} */ @@ -106,10 +100,6 @@ */ let prefsEmbargo; -/** - * An example prefs with 1 discarded content setting. - */ -let prefsDiscarded; /** * Creates all the test |SiteSettingsPref|s that are needed for the tests in @@ -132,14 +122,6 @@ ]), ]); - prefsControlled = createSiteSettingsPrefs( - [], [createContentSettingTypeToValuePair( - ContentSettingsTypes.PLUGINS, - [createRawSiteException('http://foo-block.com', { - embeddingOrigin: '', - setting: ContentSetting.BLOCK, - source: SiteSettingSource.POLICY, - })])]); prefsMixedSchemes = createSiteSettingsPrefs([], [ createContentSettingTypeToValuePair( @@ -295,16 +277,6 @@ isEmbargoed: true, })]), ]); - - prefsDiscarded = createSiteSettingsPrefs([], [ - createContentSettingTypeToValuePair( - ContentSettingsTypes.PLUGINS, - [createRawSiteException('https://[*.]example.com:443', { - embeddingOrigin: '', - setting: ContentSetting.BLOCK, - isDiscarded: true, - })]), - ]); } suite('SiteListProperties', function() { @@ -387,14 +359,6 @@ .$$('#siteDescription') .innerHTML); }); - - test('Discarded setting', async function() { - setUpCategory( - ContentSettingsTypes.PLUGINS, ContentSetting.BLOCK, prefsDiscarded); - const result = await browserProxy.whenCalled('getExceptionList'); - flush(); - assertTrue(testElement.hasDiscardedExceptions); - }); }); @@ -665,43 +629,6 @@ }); }); - test('update lists for incognito', function() { - const contentType = ContentSettingsTypes.PLUGINS; - const categorySubtype = ContentSetting.BLOCK; - setUpCategory(contentType, categorySubtype, prefsControlled); - const list = testElement.$$('#listContainer'); - return browserProxy.whenCalled('getExceptionList') - .then(function(actualContentType) { - flush(); - assertEquals(1, list.querySelector('iron-list').items.length); - assertFalse(hasAnIncognito(list)); - browserProxy.resetResolver('getExceptionList'); - browserProxy.setIncognito(true); - return browserProxy.whenCalled('getExceptionList'); - }) - .then(function() { - flush(); - assertEquals(2, list.querySelector('iron-list').items.length); - assertTrue(hasAnIncognito(list)); - browserProxy.resetResolver('getExceptionList'); - browserProxy.setIncognito(false); - return browserProxy.whenCalled('getExceptionList'); - }) - .then(function() { - flush(); - assertEquals(1, list.querySelector('iron-list').items.length); - assertFalse(hasAnIncognito(list)); - browserProxy.resetResolver('getExceptionList'); - browserProxy.setIncognito(true); - return browserProxy.whenCalled('getExceptionList'); - }) - .then(function() { - flush(); - assertEquals(2, list.querySelector('iron-list').items.length); - assertTrue(hasAnIncognito(list)); - }); - }); - test('initial INCOGNITO BLOCK state is correct', function() { const contentType = ContentSettingsTypes.COOKIES; const categorySubtype = ContentSetting.BLOCK;
diff --git a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js index 8ffa5cff..4cb5b726 100644 --- a/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js +++ b/chrome/test/data/webui/settings/test_site_settings_prefs_browser_proxy.js
@@ -23,7 +23,6 @@ export class TestSiteSettingsPrefsBrowserProxy extends TestBrowserProxy { constructor() { super([ - 'clearFlashPref', 'fetchBlockAutoplayStatus', 'fetchZoomLevels', 'getAllSites', @@ -192,11 +191,6 @@ } /** @override */ - clearFlashPref(origin) { - this.methodCalled('clearFlashPref', origin); - } - - /** @override */ getAllSites(contentTypes) { this.methodCalled('getAllSites', contentTypes); const origins_set = new Set();
diff --git a/chrome/updater/docs/using_scoped_xpc_service_mock.md b/chrome/updater/docs/using_scoped_xpc_service_mock.md new file mode 100644 index 0000000..f94f4d1d --- /dev/null +++ b/chrome/updater/docs/using_scoped_xpc_service_mock.md
@@ -0,0 +1,289 @@ +# Using the Scoped XPC Service Mock + +*Adam Norberg -- norberg@google.com -- 2020-10-16* + +[TOC] + +# Overview + +XPC is Apple's recommended technology for modern interprocess communication. +It is asynchronous and does not provide test hooks, so it is difficult to +test code that uses an XPC service. ScopedXPCServiceMock uses OCMock 3 to +mock the core behaviors of XPC to make it practical to write unit tests for +client code. + +# OCMock + +[OCMock 3](https://ocmock.org/reference/) is an engine for creating mock objects +for testing in Objective-C. A copy of version 3.1.5 is available in +[third_party/ocmock.](https://source.chromium.org/chromium/chromium/src/+/master:third_party/ocmock/) +Note that this is several versions behind the current public release of OCMock, +so some features described on OCMock's site are not present. + +ScopedXPCServiceMock doesn't understand what your service is supposed to do, so +you will need to implement mock behavior for the service yourself, using the +mock objects that ScopedXPCServiceMock creates and makes available to you. +The XPC subsystem itself, however, is mocked out for you. + +## Helpers in ScopedXPCServiceMock + +OCMockBlockCapturer and OCMockObjectCapturer are helper classes for capturing +arguments provided to mocked-out calls. The captured block or object can then +be used or inspected as required by the remainder of the test. This is probably +the easiest way to capture objects or blocks used as callbacks, so they can +be invoked at a later point in the test sequence. + +OCMock has a built-in feature for invoking a captured block immediately, but +does not assist in setting up a delayed invocation. OCMockBlockCapturer is +intended for capturing blocks that will be invoked at some later point in the +test; this can be used to verify that, for example, a client does not proceed +with a task before it has received a callback from the server, since the time +before the callback is invoked is available for verifying test expectations. +Using OCMockObjectCapturer with an object that provides callbacks is similar. + +Both classes function equivalently: + +* Instantiate an OCMockObjectCapturer or OCMockBlockCapturer in the test body + for each distinct argument that is to be captured. +* When stubbing out a method that takes as an argument an object or block you + intend to capture, provide `capturer.Capture()` as the argument (where + `capturer` is replaced with your capturer object). The `Capture()` method + vends an OCMArg that will transfer arguments it observes to the Capturer + that created it. +* Run your test. +* To retrieve objects or blocks captured with a Capturer, call `.Get()`, which + returns (by const reference) a `std::vector` containing all objects that + this specific capturer has observed, in order. Each call will create exactly + entry in this vector, including calls that provide `nil` to this + argument; these entries contain `nil`. `capturer.Get().size()` equals the + number of times the method to which this capturer is attached has been + invoked. + +Capturers maintain strong references to captured arguments for their lifespans. +These references are released when the Capturer is destroyed. + + +# Core Abstractions + +ScopedXPCServiceMock includes types to represent mocked connections and the +exported objects served over those connections. Because XPC mocking requires +class methods (NSXPCConnection's alloc and init behaviors), only one root +mock can exist; however, that root can represent a sequence of connections, +which can in turn issue a sequence of mock remote objects. Test cases that +establish multiple connections or make multiple calls to `.remoteObjectProxy` +(or `remoteObjectProxyWithErrorHandler:`) within a connection receive _distinct_ +mocks for each call. + +ScopedXPCServiceMock constructs ConnectionMockRecord instances, which are used +to configure the behavior of each mocked NSXPCConnection created. These mocks +are served in the same order they are created. Similarly, ConnectionMockRecord +creates RemoteObjectMockRecord instances that include the specific mock objects +that the mock connection appears to serve. Test code is responsible for adding +stubs to these mocks to perform the actions required for the test; the +block and object capturer helpers (see above) are intended for use when +creating these stubs. + +## ScopedXPCServiceMock + +ScopedXPCServiceMock mocks out NSXPCConnection as long as it exists, and cleans +up these mocks (returning NSXPCConnection to normal operation) when it is +destroyed. Multiple instances of ScopedXPCServiceMock cannot coexist. The +effects of ScopedXPCServiceMock are process-wide, not thread-bound, so tests +involving ScopedXPCServiceMock cannot be parallelized. + +The most common pattern for using ScopedXPCServiceMock is: + +1. Allocate the ScopedXPCServiceMock at the start of the test. +2. For each time a connection will be created during the test, call + `PrepareNewMockConnection`, and use the returned ConnectionMockRecord to + further configure test behaviors for this connection, including the behavior + of mock remote objects that the mock connection will vend. (See below.) +3. Run the test scenario to completion. +4. Call `VerifyAll`, which will cause the test to fail if any mocked connection + was not vended, any mocked remote object on any mocked connection was not + vended, or any expectations on the mocked remote objects are unment. In test + scenarios that are not expected to engage in these behaviors, `VerifyAll` + cannot be used; more granular verification is available on the individual + ConnectionMockRecord and RemoteObjectMockRecord instances. +5. Delete the ScopedXPCServiceMock (typically by falling out of scope). + +Allocating ScopedXPCServiceMock starts the override of NSXPCConnection, and +deallocating it cleans up. Attempting to create NSXPCConnections that have not +been prepared with corresponding calls to PrepareNewMockConnection will +intentionally crash. + +## ConnectionMockRecord + +ConnectionMockRecord represents the metadata associated with a mock connection. +The ScopedXPCServiceMock library takes care of emulating most NSXPCConnection +behaviors, so direct access to the underlying mock object is not expected to +be necessary, nor is it recommended. ConnectionMockRecord must only be +constructed by ScopedXPCServiceMock, inside calls to `PrepareNewMockConnection`. + +Each ConnectionMockRecord has an index, which represents the order it was +created in and will be vended in. (Indexes start at 0.) This is constant +during the life of the ConnectionMockRecord and can be used as an ID to fetch +or uniquely identify the ConnectionMockRecord relative to a ScopedXPCServiceMock +instance. + +Just like ScopedXPCServiceMock creates mock connections it will vend, +ConnectionMockRecord creates RemoteObjectMockRecord instances representing +remote objects the mock will vend. `PrepareNewMockRemoteObject` creates +such a mock, and increments the `PreparedObjectsCount`. When the code under +test requests a remote object proxy, and the mock connection vends a mock +remote object, `VendedObjectsCount` is incremented. + +`Verify` expects that the connection was initialized and torn down correctly, +expects that every mock remote object was vended, and checks expectations on +mock objects that were vended. + +ConnectionMockRecord does not provide facilities to emulate connection-wide +interruption or invalidation handlers. Attempts to assign to them crash. +If this toolset is to be used to test code that assigns to these handlers, +additional code must be written for ConnectionMockRecord. + +## RemoteObjectMockRecord + +RemoteObjectMockRecord is the narrowest mock abstraction provided by +ScopedXPCServiceMock. It is a `struct` because it is a straightforward container +associating a mock object with the error handler provided by the code under +test when the mock was vended. + +Use the `mock_object` field to configure the behavior of the mocked remote +object. This object is an OCMock 3 `OCMProtocolMock` initialized with the +protocol provided when ScopedXPCServiceMock itself was constructed. + +`xpc_error_handler` is not intended to be written directly by the test code. +It is populated when the mock remote object is vended due to a call to +`remoteObjectProxyWithErrorHandler:`, and it stores the provided error +handler. If the object is vended due to `.remoteObjectProxy`, or no actual +error handler is provided to `remoteObjectProxyWithErrorHandler`, this field +will remain `nullopt`. This field is intended to be used for simulating +XPC connection failures or other XPC errors. + +RemoteObjectMockRecord is a struct, so its fields are intended for direct use. + +# Step by step through a test case + +`update_service_out_of_process_test.mm` contains `SimpleProductUpdate`, a test +that simulates the process of updating one product. It uses a helper object +created for update tests, StateChangeTestEngine, to simulate callbacks from +the update engine itself and to check that the XPC service correctly reports +those callbacks, translated to Objective-C, later. This document is intended +to focus on uses of ScopedXPCServiceMock, so it will not go into detail on +StateChangeTestEngine. + +This unit test uses the MacUpdateServiceOutOfProcessTest test fixture, which +creates a ScopedXPCServiceMock named `mock_driver_` when allocated, along with +a `base::test::SingleThreadTaskEnvironment` to allow Chromium sequence behavior +to be intercepted and manipulated for testing. In `SetUp`, it prepares a +reference to the active RunLoop, and prepares to define `service_` later - a +field that will only be filled once the runloop starts running, because +allocating an UpdateServiceOutOfProcess causes it to initialize an +NSXPCConnection - so we must not allocate the service itself until after +we have prepared a suitable mock connection and the test is generally ready +for operation. + +This test only dials one XPC connection, from which exactly one remote +object will be requested. This is likely to be fairly common. The test first +specifies one connection that should vend one mock object, and saves borrowed +mutable pointers to the connection record (`conn_rec`), the mock record +(`mock_rec`), and the mock object itself (`mock_remote_object`). Note that +this code is compiled without ARC, so `mock_remote_object` is also a borrowed +pointer (the running code does not own the reference; the lifespan of the +referent is managed by some other object). These pointers will remain valid +for the lifespan of `mock_driver_`, which is longer than the entire scope +in which these pointers exist, so no other memory management is required. + +`UpdateService::Update` has _two_ output parameters: in addition to the +typical XPC reply block as the last argument, the real service accepts a +CRUUpdateStateObserving callback to provide intermediate status callbacks +as the update is processed. The XPC service definition explicitly defines +this argument as a proxy, and CRUUpdateStateObserving is itself an XPC-ready +protocol to permit this cross-process callback. Since the test is using mocks +to simulate service behavior, the test needs to capture the objects that will +be used for asynchronous callbacks. `reply_block_capturer` and +`update_state_observer_capturer` will be used for this purpose. + +Next, a StateChangeTestEngine is prepared, using a bunch of helper functions +that make the code more legible at the cost of obscuring what's happening here. +A StateChangeTestEngine provides a sequence of calls to a CRUUpdateStateObserver +but also provides a C++ callback that expects to see the states it provided +in Objective-C form translated to C++. To avoid recreating the translation logic +in the tests, the StateChangeTestEngine cannot calculate this expectation +itself; instead, it is initialized with a list of _pairs_ of states to use: +the Objective-C state to provide when emulating the service and the +corresponding C++ state to expect when checking its output. These states are +verbose, so constructing these pairs of states is encapsulated in helper +functions. (Repeating all these states manually would be both illegible and +error-prone.) This engine is intending to emulate an update check followed +by download and successful installation of a single product. + +There are now enough pieces in place to define the behavior of the mock object +that will pretened to be the remote XPC proxy. The behavior is specified in +an Objective-C block; however, blocks create const copies of variables they +capture, so we need to explicitly use _pointers_ to the reply block capturer, +the update state observer, and the state change engine, because we do not want +copies of these objects (which are uncopyable types anyway) - we want to feed +data from the test back into them. Once copied into the block, these variables +are constant pointers into mutable objects - the "const-ness" of the copied +variable is applied to the copied variable itself, which is the pointer. + +We are simulating a single update of a single product, so the mock object +expects exactly one call, into the method that checks for updates for one +product. It expects to see the app ID and priority we specified earlier. It also +expects to receive a callback object and a completion block; we use our capturer +helper objects to retain these arguments for later use. Note that preparing the +captures does not require the extra pointers we created, since it's not inside +a block. However, the `.andDo` macro does take a block, so we use the pointers +when specifying the details of how the test should handle this call. + +The block provided here hands off most of the test execution itself to +the StateChangeTestEngine. It pulls out the captured callback and reply +arguments and provides them to `StartSimulating`. We expect exactly one call +to this method, so we use the 0th captured item from each capturer. +StartSimulating wants a 0-argument "when done" callback, so we bind the reply +we intend to eventually give to the reply block when handing it off. + +After that, the call to be tested is itself enqueued. `state_change_engine` +provides a progress callback through `Watch` much the same way the `Capture` +methods work on the OCMock item capturer helpers. `Update` has its own +completion callback; this one checks that we got the success result we expected +and then tells the test runloop to stop. + +With the setup and test operations queued and ready, the test now runs. All +of this behavior is mediated through callbacks, so control doesn't return to +the test method until the runloop stops. (Note that test runloops have a built +in timeout, so we don't need to add anything else to make sure the test +eventually halts if something goes wrong with our callback dance, as it did +many times during development of this test - spotting a real bug along the way.) + +`run_loop_->Run` doesn't return until the runloop stops, so we follow up by +checking observable "final effects" of this call. StateChangeTestEngine already +verified all our partial progress callbacks, and the completion callback sent +to `service_->Update` already verified the result code, so here we check that +we saw exactly one request for a connection, one request for an object on +that connection, and one captured reply block. These checks are somewhat +redundant with the later `mock_driver_.VerifyAll` call; only the reply block +capturer count is not explicitly checked (again) during that call. + +`VerifyAll` expects the connection to have been correctly shut down by the time +it is invoked, so the service must explicitly be disposed of before verification +commences. + +## Discussion + +Test cases for other sequences of update check behavior would look broadly +similar. Testing a no-update case, or a case where installation fails, could +copy the entire test and change only the state pairs used to construct the +StateChangeTestEngine. Testing XPC errors would require more development +work, since StateChangeTestEngine does not (as of 2020-OCT-21) help with this; +this would involve retrieving the error callback from the RemoteObjectMockRecord +after the object has been vended and invoking it with a realistic XPC error. + +This test is verbose, as most of these tests will be, because +ScopedXPCServiceMock is designed specifically to emulate Apple's XPC behaviors +but has no opinion on what the client or server should actually _do_ with the +XPC connection. The test therefore must still specify all service behaviors +to mock and perform work to get the client running on an appropriate sequence, +then verify that the mock service replies were interpreted as intended. \ No newline at end of file
diff --git a/chromeos/constants/chromeos_features.cc b/chromeos/constants/chromeos_features.cc index 3a74bc8..2c2e1a6a 100644 --- a/chromeos/constants/chromeos_features.cc +++ b/chromeos/constants/chromeos_features.cc
@@ -543,10 +543,6 @@ const base::Feature kSessionManagerLongKillTimeout{ "SessionManagerLongKillTimeout", base::FEATURE_DISABLED_BY_DEFAULT}; -// Enables or disables the shelf hotseat. -const base::Feature kShelfHotseat{"ShelfHotseat", - base::FEATURE_ENABLED_BY_DEFAULT}; - // Enables or disables a toggle to enable Bluetooth debug logs. const base::Feature kShowBluetoothDebugLogToggle{ "ShowBluetoothDebugLogToggle", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chromeos/constants/chromeos_features.h b/chromeos/constants/chromeos_features.h index 2384ec7..05dde49b 100644 --- a/chromeos/constants/chromeos_features.h +++ b/chromeos/constants/chromeos_features.h
@@ -250,8 +250,6 @@ COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kSessionManagerLongKillTimeout; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) -extern const base::Feature kShelfHotseat; -COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kShowBluetoothDebugLogToggle; COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kShowBluetoothDeviceBattery;
diff --git a/chromeos/constants/chromeos_switches.cc b/chromeos/constants/chromeos_switches.cc index f30c3bfc..bceb5c3 100644 --- a/chromeos/constants/chromeos_switches.cc +++ b/chromeos/constants/chromeos_switches.cc
@@ -8,7 +8,6 @@ #include "base/command_line.h" #include "base/metrics/field_trial.h" -#include "chromeos/constants/chromeos_features.h" #include "third_party/icu/source/common/unicode/locid.h" namespace chromeos { @@ -629,10 +628,6 @@ kDisableSigninFrameClientCerts); } -bool ShouldShowShelfHotseat() { - return base::FeatureList::IsEnabled(features::kShelfHotseat); -} - bool ShouldShowShelfHoverPreviews() { return base::CommandLine::ForCurrentProcess()->HasSwitch(kShelfHoverPreviews); }
diff --git a/chromeos/constants/chromeos_switches.h b/chromeos/constants/chromeos_switches.h index a0d2f7f5..2814c64 100644 --- a/chromeos/constants/chromeos_switches.h +++ b/chromeos/constants/chromeos_switches.h
@@ -249,10 +249,6 @@ // the Chrome OS sign-in screen is enabled. COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsSigninFrameClientCertsEnabled(); -// Returns true if we should show the modular shelf with the hotseat UI and -// a smaller shelf in clamshell mode. -COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool ShouldShowShelfHotseat(); - // Returns true if we should show window previews when hovering over an app // on the shelf. COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool ShouldShowShelfHoverPreviews();
diff --git a/chromeos/strings/chromeos_strings_en-GB.xtb b/chromeos/strings/chromeos_strings_en-GB.xtb index f6a2cd7..9ee2074 100644 --- a/chromeos/strings/chromeos_strings_en-GB.xtb +++ b/chromeos/strings/chromeos_strings_en-GB.xtb
@@ -18,10 +18,12 @@ <translation id="1947737735496445907">Printed</translation> <translation id="1979103255016296513">Password change overdue</translation> <translation id="2049639323467105390">This device is managed by <ph name="DOMAIN" />.</translation> +<translation id="2141644705054017895"><ph name="PERCENTAGE_VALUE" />%</translation> <translation id="2161394479394250669">Cancel print job</translation> <translation id="2326139988748364651"><ph name="RESOLUTION_VALUE" /> DPI</translation> <translation id="2338501278241028356">Turn on Bluetooth to discover nearby devices</translation> <translation id="2375079107209812402"><ph name="ATTEMPTS_LEFT" /> attempts left</translation> +<translation id="2463748424736466148">{ATTEMPTS_LEFT,plural, =1{<ph name="ERROR_MESSAGE" /> {0} attempt left}other{<ph name="ERROR_MESSAGE" /> {0} attempts left}}</translation> <translation id="2517472476991765520">Scan</translation> <translation id="2805756323405976993">Apps</translation> <translation id="2872961005593481000">Shut down</translation> @@ -59,6 +61,7 @@ <translation id="4890353053343094602">Choose a new one immediately</translation> <translation id="4917889632206600977">Stopped – out of paper</translation> <translation id="4932733599132424254">Date</translation> +<translation id="5094480857972195099"><ph name="ENROLLMENT_DOMAIN" /> manages this user and may remotely manage settings and monitor user activity.</translation> <translation id="520299634122159966">No available scanners</translation> <translation id="5212543919916444558">I can't find anything on your screen that I can help with. Try tapping the mic to ask me anything.</translation>
diff --git a/chromeos/strings/chromeos_strings_fil.xtb b/chromeos/strings/chromeos_strings_fil.xtb index f51297f..19d9f107 100644 --- a/chromeos/strings/chromeos_strings_fil.xtb +++ b/chromeos/strings/chromeos_strings_fil.xtb
@@ -18,10 +18,12 @@ <translation id="1947737735496445907">Na-print</translation> <translation id="1979103255016296513">Overdue na ang pagpapalit ng password</translation> <translation id="2049639323467105390">Pinamamahalaan ng <ph name="DOMAIN" /> ang device na ito.</translation> +<translation id="2141644705054017895"><ph name="PERCENTAGE_VALUE" />%</translation> <translation id="2161394479394250669">Kanselahin ang pag-print</translation> <translation id="2326139988748364651"><ph name="RESOLUTION_VALUE" /> dpi</translation> <translation id="2338501278241028356">I-on ang Bluetooth upang tuklasin ang mga kalapit na device</translation> <translation id="2375079107209812402"><ph name="ATTEMPTS_LEFT" /> (na) pagsubok ang natitira</translation> +<translation id="2463748424736466148">{ATTEMPTS_LEFT,plural, =1{<ph name="ERROR_MESSAGE" /> {0} pagsubok na lang ang natitira}one{<ph name="ERROR_MESSAGE" /> {0} pagsubok na lang ang natitira}other{<ph name="ERROR_MESSAGE" /> {0} na pagsubok na lang ang natitira}}</translation> <translation id="2517472476991765520">I-scan</translation> <translation id="2805756323405976993">Mga App</translation> <translation id="2872961005593481000">Shut down</translation> @@ -59,6 +61,7 @@ <translation id="4890353053343094602">Pumili agad ng bago</translation> <translation id="4917889632206600977">Huminto - Wala nang papel</translation> <translation id="4932733599132424254">Petsa</translation> +<translation id="5094480857972195099">Pinapamahalaan ng <ph name="ENROLLMENT_DOMAIN" /> ang user na ito at puwede nitong pamahalaan ang mga setting at subaybayan ang aktibidad ng user sa remote na paraan.</translation> <translation id="520299634122159966">Walang available na scanner</translation> <translation id="5212543919916444558">Wala akong makitang kahit ano sa iyong screen kung saan ako makakatulong. Subukang i-tap ang mikropono para humiling sa akin ng kahit ano.</translation>
diff --git a/chromeos/strings/chromeos_strings_hy.xtb b/chromeos/strings/chromeos_strings_hy.xtb index 3bb1c78..2acc01e2 100644 --- a/chromeos/strings/chromeos_strings_hy.xtb +++ b/chromeos/strings/chromeos_strings_hy.xtb
@@ -18,10 +18,12 @@ <translation id="1947737735496445907">Տպված է</translation> <translation id="1979103255016296513">Գաղտնաբառի փոփոխման ժամկետն անցել է</translation> <translation id="2049639323467105390">Այս սարքը կառավարվում է <ph name="DOMAIN" />-ի կողմից:</translation> +<translation id="2141644705054017895"><ph name="PERCENTAGE_VALUE" />%</translation> <translation id="2161394479394250669">Չեղարկել տպման առաջադրանքը</translation> <translation id="2326139988748364651"><ph name="RESOLUTION_VALUE" /> DPI</translation> <translation id="2338501278241028356">Մոտակա սարքերը գտնելու համար միացրեք Bluetooth-ը</translation> <translation id="2375079107209812402">Մնաց <ph name="ATTEMPTS_LEFT" /> փորձ</translation> +<translation id="2463748424736466148">{ATTEMPTS_LEFT,plural, =1{<ph name="ERROR_MESSAGE" /> Մնացած փորձերի քանակը՝ {0}}one{<ph name="ERROR_MESSAGE" /> Մնացած փորձերի քանակը՝ {0}}other{<ph name="ERROR_MESSAGE" /> Մնացած փորձերի քանակը՝ {0}}}</translation> <translation id="2517472476991765520">Որոնել</translation> <translation id="2805756323405976993">Հավելվածներ</translation> <translation id="2872961005593481000">Անջատել</translation> @@ -59,6 +61,7 @@ <translation id="4890353053343094602">Հնարավորինս արագ փոխեք գաղտնաբառը</translation> <translation id="4917889632206600977">Դադարեցվել է – Թուղթ չկա</translation> <translation id="4932733599132424254">Ամսաթիվ</translation> +<translation id="5094480857972195099"><ph name="ENROLLMENT_DOMAIN" /> տիրույթը կառավարում է այս օգտատիրոջը։ Այն նաև կարող է հեռակա կառավարել կարգավորումներն ու վերահսկել օգտատիրոջ գործողությունները։</translation> <translation id="520299634122159966">Հասանելի սկաներներ չկան</translation> <translation id="5212543919916444558">Չհաջողվեց գտնել քարտեր էկրանին: Փորձեք օգտագործել խոսափողը` առաջադրանքներ տալու համար:</translation>
diff --git a/chromeos/strings/chromeos_strings_si.xtb b/chromeos/strings/chromeos_strings_si.xtb index 57267c4b..9de6604 100644 --- a/chromeos/strings/chromeos_strings_si.xtb +++ b/chromeos/strings/chromeos_strings_si.xtb
@@ -18,10 +18,12 @@ <translation id="1947737735496445907">මුද්රණය කරන ලදි</translation> <translation id="1979103255016296513">මුරපදය වෙනස් කිරීම කල් ගොස් ඇත</translation> <translation id="2049639323467105390">උපාංගය <ph name="DOMAIN" /> මගින් කළමනාකරණය කරනු ලබයි.</translation> +<translation id="2141644705054017895"><ph name="PERCENTAGE_VALUE" />%</translation> <translation id="2161394479394250669">මුද්රණ කාර්යය අවලංගු කරන්න</translation> <translation id="2326139988748364651"><ph name="RESOLUTION_VALUE" /> dpi</translation> <translation id="2338501278241028356">අවට උපාංග සොයා ගැනීමට බ්ලූටූත් ක්රියාත්මක කරන්න</translation> <translation id="2375079107209812402">උත්සාහයන් <ph name="ATTEMPTS_LEFT" />ක් ඉතුරුයි</translation> +<translation id="2463748424736466148">{ATTEMPTS_LEFT,plural, =1{උත්සාහයන් <ph name="ERROR_MESSAGE" /> {0}ක් ඉතිරිය}one{උත්සාහයන් <ph name="ERROR_MESSAGE" /> {0}ක් ඉතිරිය}other{උත්සාහයන් <ph name="ERROR_MESSAGE" /> {0}ක් ඉතිරිය}}</translation> <translation id="2517472476991765520">ස්කෑන් කරන්න</translation> <translation id="2805756323405976993">යෙදුම්</translation> <translation id="2872961005593481000">වසන්න</translation> @@ -59,6 +61,7 @@ <translation id="4890353053343094602">වහාම අලුත් එකක් තෝරන්න</translation> <translation id="4917889632206600977">නැවතිණි - කඩදාසි අවසන් වී ඇත</translation> <translation id="4932733599132424254">දිනය</translation> +<translation id="5094480857972195099"><ph name="ENROLLMENT_DOMAIN" /> මෙම පරිශීලකයා කළමනාකරණය කරන අතර දුරස්ථව සැකසීම් කළමනාකරණය කිරීමට සහ පරිශීලක ක්රියාකාරකම් නිරීක්ෂණය කිරීමට හැකිය.</translation> <translation id="520299634122159966">ලබා ගත හැකි ස්කෑනර නැත</translation> <translation id="5212543919916444558">මට ඔබට උදවු විය හැකි කිසිවක් ඔබේ තිරය මත සොයා ගැනීමට නොහැකිය. මගෙන් යම් දෙයක් ඇසීමට මයික්රෆෝනය තට්ටු කිරීම උත්සාහ කරන්න.</translation>
diff --git a/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc b/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc index 49fc7e87..8414d404 100644 --- a/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc +++ b/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.cc
@@ -114,6 +114,8 @@ pending_coded_size_ = dimensions; + decoder_state_ = DecoderState::kAwaitingAssignPictureBuffers; + auto pbf = mojom::PictureBufferFormat::New(); pbf->min_num_buffers = requested_num_of_buffers; pbf->coded_size = dimensions; @@ -439,9 +441,9 @@ mojom::VideoDecodeAccelerator::Result::INVALID_ARGUMENT); return; } - if (assign_picture_buffers_called_) { - VLOGF(1) << "AssignPictureBuffers is called twice without " - << "ImportBufferForPicture()"; + if (decoder_state_ != DecoderState::kAwaitingAssignPictureBuffers) { + VLOGF(1) << "AssignPictureBuffers is not called right after " + << "Client::ProvidePictureBuffers()"; client_->NotifyError( mojom::VideoDecodeAccelerator::Result::INVALID_ARGUMENT); return; @@ -449,7 +451,7 @@ coded_size_ = pending_coded_size_; output_buffer_count_ = static_cast<size_t>(count); - assign_picture_buffers_called_ = true; + decoder_state_ = DecoderState::kAwaitingFirstImport; } void GpuArcVideoDecodeAccelerator::ImportBufferForPicture( @@ -463,6 +465,12 @@ VLOGF(1) << "VDA not initialized."; return; } + if (decoder_state_ == DecoderState::kAwaitingAssignPictureBuffers) { + DVLOGF(3) << "AssignPictureBuffers() hasn't been called after calling " + << "Client::ProvidePictureBuffers(), ignored."; + return; + } + if (picture_buffer_id < 0 || static_cast<size_t>(picture_buffer_id) >= output_buffer_count_) { VLOGF(1) << "Invalid picture_buffer_id=" << picture_buffer_id; @@ -533,7 +541,7 @@ // This is the first time of ImportBufferForPicture() after // AssignPictureBuffers() is called. Call VDA::AssignPictureBuffers() here. - if (assign_picture_buffers_called_) { + if (decoder_state_ == DecoderState::kAwaitingFirstImport) { gfx::Size picture_size(gmb_handle.native_pixmap_handle.planes[0].stride, coded_size_.height()); std::vector<media::PictureBuffer> buffers; @@ -543,7 +551,7 @@ } vda_->AssignPictureBuffers(std::move(buffers)); - assign_picture_buffers_called_ = false; + decoder_state_ = DecoderState::kDecoding; } vda_->ImportBufferForPicture(picture_buffer_id, pixel_format, @@ -558,6 +566,11 @@ VLOGF(1) << "VDA not initialized."; return; } + if (decoder_state_ == DecoderState::kAwaitingAssignPictureBuffers) { + DVLOGF(3) << "AssignPictureBuffers() hasn't been called after calling " + << "Client::ProvidePictureBuffers(), ignored."; + return; + } vda_->ReusePictureBuffer(picture_buffer_id); }
diff --git a/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h b/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h index 6d8e579..c9f0e63 100644 --- a/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h +++ b/components/arc/video_accelerator/gpu_arc_video_decode_accelerator.h
@@ -78,6 +78,25 @@ void Flush(FlushCallback callback) override; void Reset(ResetCallback callback) override; private: + // The calling flow of changing resolution is: + // 1. VDA calls Client::ProvidePictureBuffers() + // 2. Client calls VDA::AssignPictureBuffers() + // 3. Client calls VDA::ImportBufferForPicture() for N times + // 4. Client calls VDA::ReusePictureBuffer() when a buffer is recycled. + // + // The enum state is used to check these two situations: + // 1. Client should not call VDA::AssignPictureBuffers() twice without calling + // VDA::ImportBufferForPicture() between them. + // 2. If VDA::ImportBufferForPicture() or VDA::ReusePictureBuffer() is + // called right after calling Client::ProvidePictureBuffers() without + // VDA::AssignPictureBuffers() be called, then the buffer contains previous + // resolution and should be ignored. + enum class DecoderState { + kAwaitingAssignPictureBuffers, + kAwaitingFirstImport, + kDecoding, + }; + using PendingCallback = base::OnceCallback<void(mojom::VideoDecodeAccelerator::Result)>; static_assert(std::is_same<ResetCallback, PendingCallback>::value, @@ -156,7 +175,8 @@ base::Optional<bool> secure_mode_ = base::nullopt; size_t output_buffer_count_ = 0; - bool assign_picture_buffers_called_ = false; + + DecoderState decoder_state_ = DecoderState::kDecoding; THREAD_CHECKER(thread_checker_); DISALLOW_COPY_AND_ASSIGN(GpuArcVideoDecodeAccelerator);
diff --git a/components/autofill/core/browser/autofill_handler.cc b/components/autofill/core/browser/autofill_handler.cc index c7474a2..7173b67 100644 --- a/components/autofill/core/browser/autofill_handler.cc +++ b/components/autofill/core/browser/autofill_handler.cc
@@ -30,6 +30,10 @@ // if not found. AutofillField* FindAutofillFillField(const FormStructure& form, const FormFieldData& field) { + for (const auto& f : form) { + if (field.unique_renderer_id == f->unique_renderer_id) + return f.get(); + } for (const auto& cur_field : form) { if (cur_field->SameFieldAs(field)) { return cur_field.get();
diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index d60bdca..68209539 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc
@@ -2125,6 +2125,60 @@ EXPECT_TRUE(external_delegate_->on_suggestions_returned_seen()); } +// Test that the correct section is filled. +TEST_F(AutofillManagerTest, FillTriggeredSection) { + // Set up our form data. + FormData form; + test::CreateTestAddressFormData(&form); + size_t index_of_trigger_field = form.fields.size(); + test::CreateTestAddressFormData(&form); + FormsSeen({form}); + + // Check that the form has been parsed into two sections. + ASSERT_NE(form.fields.size(), 0u); + ASSERT_EQ(index_of_trigger_field, form.fields.size() / 2); + { + FormStructure* form_structure; + AutofillField* autofill_field; + bool found = autofill_manager_->GetCachedFormAndField( + form, form.fields[index_of_trigger_field], &form_structure, + &autofill_field); + ASSERT_TRUE(found); + for (size_t i = 0; i < form.fields.size() / 2; ++i) { + size_t j = form.fields.size() / 2 + i; + ASSERT_EQ(form_structure->field(i)->name, form_structure->field(j)->name); + ASSERT_NE(form_structure->field(i)->section, + form_structure->field(j)->section); + ASSERT_TRUE(form_structure->field(i)->SameFieldAs(form.fields[j])); + ASSERT_TRUE(form_structure->field(j)->SameFieldAs(form.fields[i])); + } + } + + const char guid[] = "00000000-0000-0000-0000-000000000001"; + AutofillProfile* profile = personal_data_.GetProfileWithGUID(guid); + ASSERT_TRUE(profile); + EXPECT_EQ(1U, profile->use_count()); + EXPECT_NE(base::Time(), profile->use_date()); + + int response_page_id = 0; + FormData response_data; + FillAutofillFormDataAndSaveResults( + kDefaultPageID, form, form.fields[index_of_trigger_field], + MakeFrontendID(std::string(), guid), &response_page_id, &response_data); + // Extract the sections into individual forms to reduce boiler plate code. + size_t mid = response_data.fields.size() / 2; + FormData section1 = response_data; + FormData section2 = response_data; + section1.fields.erase(section1.fields.begin() + mid, section1.fields.end()); + section2.fields.erase(section2.fields.begin(), section2.fields.end() - mid); + // First section should be empty, second should be filled. + ExpectFilledForm(response_page_id, section1, kDefaultPageID, "", "", "", "", + "", "", "", "", "", "", "", "", "", "", "", true, false, + false); + ExpectFilledAddressFormElvis(response_page_id, section2, kDefaultPageID, + false); +} + // Tests that AutofillManager ignores loss of focus events sent from the // renderer if the renderer did not have a previously-interacted form. // TODO(crbug.com/1140473): Remove this test when workaround is no longer
diff --git a/components/autofill/core/browser/form_parsing/autofill_parsing_utils.cc b/components/autofill/core/browser/form_parsing/autofill_parsing_utils.cc index d9fc85a..ddd418e 100644 --- a/components/autofill/core/browser/form_parsing/autofill_parsing_utils.cc +++ b/components/autofill/core/browser/form_parsing/autofill_parsing_utils.cc
@@ -13,31 +13,4 @@ MatchingPattern::~MatchingPattern() = default; -autofill::MatchingPattern GetCompanyPatternEn() { - autofill::MatchingPattern m_p; - m_p.pattern_identifier = "kCompanyPatternEn"; - m_p.positive_pattern = "company|business|organization|organisation"; - m_p.positive_score = 1.1f; - m_p.negative_pattern = ""; - m_p.match_field_attributes = MATCH_NAME; - m_p.match_field_input_types = MATCH_TEXT; - m_p.language = "en"; - - return m_p; -} - -autofill::MatchingPattern GetCompanyPatternDe() { - autofill::MatchingPattern m_p; - - m_p.pattern_identifier = "kCompanyPatternDe"; - m_p.positive_pattern = "|(?<!con)firma|firmenname"; - m_p.positive_score = 1.1f; - m_p.negative_pattern = ""; - m_p.match_field_attributes = MATCH_LABEL | MATCH_NAME; - m_p.match_field_input_types = MATCH_TEXT; - m_p.language = "de"; - - return m_p; -} - -} // namespace autofill \ No newline at end of file +} // namespace autofill
diff --git a/components/autofill/core/browser/form_parsing/autofill_parsing_utils.h b/components/autofill/core/browser/form_parsing/autofill_parsing_utils.h index 8335c21..96d81d6c 100644 --- a/components/autofill/core/browser/form_parsing/autofill_parsing_utils.h +++ b/components/autofill/core/browser/form_parsing/autofill_parsing_utils.h
@@ -57,11 +57,6 @@ std::string language; }; -// Use these functions instead of storing "non standats type" constants that -// bots might complaining over. -MatchingPattern GetCompanyPatternEn(); -MatchingPattern GetCompanyPatternDe(); - } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_DATA_MODEL_AUTOFILL_PARSING_UTILS_H_
diff --git a/components/autofill/core/browser/pattern_provider/pattern_configuration_parser.cc b/components/autofill/core/browser/pattern_provider/pattern_configuration_parser.cc index f6e4f7fa..ff225e0 100644 --- a/components/autofill/core/browser/pattern_provider/pattern_configuration_parser.cc +++ b/components/autofill/core/browser/pattern_provider/pattern_configuration_parser.cc
@@ -60,6 +60,10 @@ new_pattern.match_field_input_types = match_field_input_types.value(); new_pattern.language = language; + // Shift to the right to match the MatchFieldTypes enum, which temporarily + // starts at 1<<2 instead of 1<<0. + new_pattern.match_field_input_types <<= 2; + std::vector<MatchingPattern>* pattern_list = &patterns[field_type][language]; pattern_list->push_back(new_pattern);
diff --git a/components/autofill/core/browser/pattern_provider/pattern_configuration_parser_unittest.cc b/components/autofill/core/browser/pattern_provider/pattern_configuration_parser_unittest.cc index d945187..a9cd570a 100644 --- a/components/autofill/core/browser/pattern_provider/pattern_configuration_parser_unittest.cc +++ b/components/autofill/core/browser/pattern_provider/pattern_configuration_parser_unittest.cc
@@ -94,7 +94,7 @@ ASSERT_EQ("fr", pattern->language); ASSERT_NEAR(2.0, pattern->positive_score, 1e-6); ASSERT_EQ(2, pattern->match_field_attributes); - ASSERT_EQ(3, pattern->match_field_input_types); + ASSERT_EQ(3 << 2, pattern->match_field_input_types); } // Test that the parser does not return anything if some |MatchingPattern|
diff --git a/components/autofill/core/browser/pattern_provider/pattern_provider.cc b/components/autofill/core/browser/pattern_provider/pattern_provider.cc index ceb1b26..17b4c9c 100644 --- a/components/autofill/core/browser/pattern_provider/pattern_provider.cc +++ b/components/autofill/core/browser/pattern_provider/pattern_provider.cc
@@ -12,12 +12,74 @@ #include "base/feature_list.h" #include "base/no_destructor.h" #include "components/autofill/core/browser/autofill_type.h" +#include "components/autofill/core/browser/form_parsing/autofill_parsing_utils.h" #include "components/autofill/core/browser/pattern_provider/pattern_configuration_parser.h" #include "components/autofill/core/common/autofill_features.h" namespace autofill { + namespace { -PatternProvider* g_pattern_provider = nullptr; +const char* kSourceCodeLanguage = "en"; + +// Adds the English patterns, restricted to MatchFieldType MATCH_NAME, to +// every other language. +void EnrichPatternsWithEnVersion( + PatternProvider::Map* type_and_lang_to_patterns) { + DCHECK(type_and_lang_to_patterns); + for (auto& p : *type_and_lang_to_patterns) { + std::map<std::string, std::vector<MatchingPattern>>& lang_to_patterns = + p.second; + + auto it = lang_to_patterns.find(kSourceCodeLanguage); + if (it == lang_to_patterns.end()) + continue; + std::vector<MatchingPattern> en_patterns = it->second; + for (MatchingPattern& en_pattern : en_patterns) { + en_pattern.match_field_attributes = MATCH_NAME; + } + + for (auto& q : lang_to_patterns) { + const std::string& page_language = q.first; + std::vector<MatchingPattern>& patterns = q.second; + + if (page_language != kSourceCodeLanguage) { + patterns.insert(patterns.end(), en_patterns.begin(), en_patterns.end()); + } + } + } +} + +// Sorts patterns in descending order by their score. +void SortPatternsByScore(PatternProvider::Map* type_and_lang_to_patterns) { + for (auto& p : *type_and_lang_to_patterns) { + std::map<std::string, std::vector<MatchingPattern>>& lang_to_patterns = + p.second; + for (auto& q : lang_to_patterns) { + std::vector<MatchingPattern>& patterns = q.second; + std::sort(patterns.begin(), patterns.end(), + [](const MatchingPattern& mp1, const MatchingPattern& mp2) { + return mp1.positive_score > mp2.positive_score; + }); + } + } +} +} + +PatternProvider* PatternProvider::g_pattern_provider = nullptr; + +// static +PatternProvider& PatternProvider::GetInstance() { + if (!g_pattern_provider) { + static base::NoDestructor<PatternProvider> instance; + g_pattern_provider = instance.get(); + field_type_parsing::PopulateFromResourceBundle(); + } + return *g_pattern_provider; +} + +// static +void PatternProvider::ResetPatternProvider() { + g_pattern_provider = nullptr; } PatternProvider::PatternProvider() = default; @@ -32,13 +94,14 @@ (overwrite_equal_version && pattern_version_ == version)) { patterns_ = patterns; pattern_version_ = version; - EnrichPatternsWithEnVersion(); + EnrichPatternsWithEnVersion(&patterns_); + SortPatternsByScore(&patterns_); } } const std::vector<MatchingPattern> PatternProvider::GetMatchPatterns( const std::string& pattern_name, - const std::string& page_language) { + const std::string& page_language) const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // TODO(crbug.com/1134496): Remove feature check once launched. @@ -56,12 +119,12 @@ } } } - return GetAllPatternsBaseOnType(pattern_name); + return GetAllPatternsByType(pattern_name); } else if ( base::FeatureList::IsEnabled( features:: kAutofillApplyNegativePatternsForFieldTypeDetectionHeuristics)) { - return GetAllPatternsBaseOnType(pattern_name); + return GetAllPatternsByType(pattern_name); } else { return {}; } @@ -69,74 +132,37 @@ const std::vector<MatchingPattern> PatternProvider::GetMatchPatterns( ServerFieldType type, - const std::string& page_language) { + const std::string& page_language) const { std::string pattern_name = AutofillType(type).ToString(); return GetMatchPatterns(pattern_name, page_language); } -// static. -PatternProvider& PatternProvider::GetInstance() { - if (!g_pattern_provider) { - static base::NoDestructor<PatternProvider> instance; - g_pattern_provider = instance.get(); - field_type_parsing::PopulateFromResourceBundle(); - } - return *g_pattern_provider; +const std::vector<MatchingPattern> PatternProvider::GetAllPatternsByType( + ServerFieldType type) const { + std::string type_str = AutofillType(type).ToString(); + return GetAllPatternsByType(type_str); } -// static. -void PatternProvider::SetPatternProviderForTesting( - PatternProvider* pattern_provider) { - DCHECK(pattern_provider); - g_pattern_provider = pattern_provider; -} +const std::vector<MatchingPattern> PatternProvider::GetAllPatternsByType( + const std::string& type) const { + auto it = patterns_.find(type); + if (it == patterns_.end()) + return {}; + const std::map<std::string, std::vector<MatchingPattern>>& type_patterns = + it->second; -// static. -void PatternProvider::ResetPatternProvider() { - g_pattern_provider = nullptr; -} - -void PatternProvider::EnrichPatternsWithEnVersion() { - for (auto& p : patterns_) { - std::map<std::string, std::vector<MatchingPattern>>& lg_to_patterns = - p.second; - - auto it = lg_to_patterns.find("en"); - if (it == lg_to_patterns.end()) - continue; - std::vector<MatchingPattern> en_patterns = it->second; - - for (MatchingPattern& en_pattern : en_patterns) { - en_pattern.match_field_attributes = MATCH_NAME; - } - - for (auto& q : lg_to_patterns) { - const std::string& page_language = q.first; - std::vector<MatchingPattern>& patterns = q.second; - - if (page_language != "en") { - patterns.insert(patterns.end(), en_patterns.begin(), en_patterns.end()); + std::vector<MatchingPattern> all_language_patterns; + for (const auto& p : type_patterns) { + const std::string& page_language = p.first; + const std::vector<MatchingPattern>& language_patterns = p.second; + for (const MatchingPattern& mp : language_patterns) { + if (page_language == kSourceCodeLanguage || + mp.language != kSourceCodeLanguage) { + all_language_patterns.push_back(mp); } } } -} - -const std::vector<MatchingPattern> PatternProvider::GetAllPatternsBaseOnType( - ServerFieldType type) { - std::string type_str = AutofillType(type).ToString(); - return GetAllPatternsBaseOnType(type_str); -} - -const std::vector<MatchingPattern> PatternProvider::GetAllPatternsBaseOnType( - const std::string& type) { - std::vector<MatchingPattern> match_patterns; - - for (const auto& inner_map : patterns_[type]) { - match_patterns.insert(match_patterns.end(), inner_map.second.begin(), - inner_map.second.end()); - } - - return match_patterns; + return all_language_patterns; } } // namespace autofill
diff --git a/components/autofill/core/browser/pattern_provider/pattern_provider.h b/components/autofill/core/browser/pattern_provider/pattern_provider.h index cc43e02..726307a1 100644 --- a/components/autofill/core/browser/pattern_provider/pattern_provider.h +++ b/components/autofill/core/browser/pattern_provider/pattern_provider.h
@@ -23,7 +23,9 @@ // ways to load the data in for further use. class PatternProvider { public: - // Shorthand for the map structure used to store patterns. + // The outer keys are field types or other pattern names. The inner keys are + // page languages in lower case. + // TODO(crbug/1142413): decide on uppercase or lowercase. using Map = std::map<std::string, std::map<std::string, std::vector<MatchingPattern>>>; @@ -35,57 +37,61 @@ const base::Version version, const bool overwrite_equal_version); - // Provides us with all patterns that can match our field type and page - // language. + // Find the patterns for a given ServerFieldType and for a given + // |page_language|. const std::vector<MatchingPattern> GetMatchPatterns( ServerFieldType type, - const std::string& page_language); + const std::string& page_language) const; + // Find the patterns for a given |pattern_name| and a given |page_language|. const std::vector<MatchingPattern> GetMatchPatterns( const std::string& pattern_name, - const std::string& page_language); + const std::string& page_language) const; - // Provides us with all patterns that can match our field type. - const std::vector<MatchingPattern> GetAllPatternsBaseOnType( - ServerFieldType type); + // Find all patterns, across all languages, for a given server field |type|. + const std::vector<MatchingPattern> GetAllPatternsByType( + ServerFieldType type) const; - const std::vector<MatchingPattern> GetAllPatternsBaseOnType( - const std::string& type); - // desc - void EnrichPatternsWithEnVersion(); + // Find all patterns, across all languages, for a given server field |type|. + const std::vector<MatchingPattern> GetAllPatternsByType( + const std::string& type) const; protected: - PatternProvider(); - ~PatternProvider(); - - // Local map to store a vector of patterns keyed by field type and - // page language. - Map patterns_; - - // Version for keeping track which pattern set is in use. - base::Version pattern_version_; - // Sets a provider to be used for tests. - static void SetPatternProviderForTesting(PatternProvider* pattern_provider); + static void SetPatternProviderForTesting(PatternProvider* pattern_provider) { + DCHECK(pattern_provider); + g_pattern_provider = pattern_provider; + } // Resets the provider pointer if the object behind it gets deleted. static void ResetPatternProvider(); + PatternProvider(); + ~PatternProvider(); + + const Map& patterns() const { return patterns_; } + private: - // Func to sort the incoming map by score. - void SortPatternsByScore(std::vector<MatchingPattern>& patterns); - - // Sequence checker to ensure thread-safety for pattern swapping. - // All functions accessing the |patterns_| member variable are - // expected to be called from the UI thread. - SEQUENCE_CHECKER(sequence_checker_); - FRIEND_TEST_ALL_PREFIXES(AutofillPatternProviderPipelineTest, TestParsingEquivalent); FRIEND_TEST_ALL_PREFIXES(AutofillPatternProviderPipelineTest, DefaultPatternProviderLoads); friend class base::NoDestructor<PatternProvider>; + + static PatternProvider* g_pattern_provider; + + // Sequence checker to ensure thread-safety for pattern swapping. + // All functions accessing the |patterns_| member variable are + // expected to be called from the UI thread. + SEQUENCE_CHECKER(sequence_checker_); + + // Local map to store a vector of patterns keyed by field type and + // page language. + Map patterns_; + + // Version for keeping track which pattern set is currently used. + base::Version pattern_version_; }; } // namespace autofill #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PATTERN_PROVIDER_PATTERN_PROVIDER_H_
diff --git a/components/autofill/core/browser/pattern_provider/pattern_provider_unittest.cc b/components/autofill/core/browser/pattern_provider/pattern_provider_unittest.cc index fe23cc0..6a257c7 100644 --- a/components/autofill/core/browser/pattern_provider/pattern_provider_unittest.cc +++ b/components/autofill/core/browser/pattern_provider/pattern_provider_unittest.cc
@@ -12,6 +12,8 @@ #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" #include "components/autofill/core/browser/autofill_type.h" +#include "components/autofill/core/browser/field_types.h" +#include "components/autofill/core/browser/form_parsing/autofill_parsing_utils.h" #include "components/autofill/core/browser/pattern_provider/pattern_configuration_parser.h" #include "components/autofill/core/browser/pattern_provider/pattern_provider.h" #include "components/autofill/core/browser/pattern_provider/test_pattern_provider.h" @@ -23,19 +25,52 @@ namespace { +MatchingPattern GetCompanyPatternEn() { + autofill::MatchingPattern m_p; + m_p.pattern_identifier = "kCompanyPatternEn"; + m_p.positive_pattern = "company|business|organization|organisation"; + m_p.positive_score = 1.1f; + m_p.negative_pattern = ""; + m_p.match_field_attributes = MATCH_NAME; + m_p.match_field_input_types = MATCH_TEXT; + m_p.language = "en"; + return m_p; +} + +MatchingPattern GetCompanyPatternDe() { + autofill::MatchingPattern m_p; + m_p.pattern_identifier = "kCompanyPatternDe"; + m_p.positive_pattern = "|(?<!con)firma|firmenname"; + m_p.positive_score = 1.1f; + m_p.negative_pattern = ""; + m_p.match_field_attributes = MATCH_LABEL | MATCH_NAME; + m_p.match_field_input_types = MATCH_TEXT; + m_p.language = "de"; + return m_p; +} + // Pattern Provider with custom values set for testing. class UnitTestPatternProvider : public PatternProvider { public: UnitTestPatternProvider(); + UnitTestPatternProvider(const std::vector<MatchingPattern>& de_patterns, + const std::vector<MatchingPattern>& en_patterns); ~UnitTestPatternProvider(); }; -UnitTestPatternProvider::UnitTestPatternProvider() { - auto& company_patterns = patterns_[AutofillType(COMPANY_NAME).ToString()]; - company_patterns["EN"].push_back(GetCompanyPatternEn()); - company_patterns["DE"].push_back(GetCompanyPatternDe()); +UnitTestPatternProvider::UnitTestPatternProvider() + : UnitTestPatternProvider({GetCompanyPatternDe()}, + {GetCompanyPatternEn()}) {} +UnitTestPatternProvider::UnitTestPatternProvider( + const std::vector<MatchingPattern>& de_patterns, + const std::vector<MatchingPattern>& en_patterns) { PatternProvider::SetPatternProviderForTesting(this); + Map patterns; + auto& company_patterns = patterns[AutofillType(COMPANY_NAME).ToString()]; + company_patterns["de"] = de_patterns; + company_patterns["en"] = en_patterns; + SetPatterns(patterns, base::Version(), true); } UnitTestPatternProvider::~UnitTestPatternProvider() { @@ -69,7 +104,7 @@ MatchingPattern kCompanyPatternEn = GetCompanyPatternEn(); MatchingPattern kCompanyPatternDe = GetCompanyPatternDe(); UnitTestPatternProvider* pattern_provider = new UnitTestPatternProvider(); - auto pattern_store = pattern_provider->GetMatchPatterns("COMPANY_NAME", "EN"); + auto pattern_store = pattern_provider->GetMatchPatterns("COMPANY_NAME", "en"); ASSERT_EQ(pattern_store.size(), 1u); EXPECT_EQ(pattern_store[0], kCompanyPatternEn); @@ -85,7 +120,7 @@ run_loop.Run(); PatternProvider& default_pattern_provider = PatternProvider::GetInstance(); - EXPECT_FALSE(default_pattern_provider.patterns_.empty()); + EXPECT_FALSE(default_pattern_provider.patterns().empty()); // Call the getter to ensure sequence checks work correctly. default_pattern_provider.GetMatchPatterns("EMAIL_ADDRESS", "en"); @@ -106,25 +141,111 @@ TestPatternProvider test_pattern_provider; - EXPECT_EQ(default_pattern_provider.patterns_, - test_pattern_provider.patterns_); + EXPECT_EQ(default_pattern_provider.patterns(), + test_pattern_provider.patterns()); } -TEST(AutofillPatternProvider, Based_On_Type_Match) { - MatchingPattern kCompanyPatternEn = GetCompanyPatternEn(); - MatchingPattern kCompanyPatternDe = GetCompanyPatternDe(); - std::vector<MatchingPattern> match_vector; - match_vector.push_back(kCompanyPatternDe); - match_vector.push_back(kCompanyPatternEn); +TEST(AutofillPatternProvider, BasedOnMatchType) { + UnitTestPatternProvider p; + ASSERT_GT(p.GetAllPatternsByType("COMPANY_NAME").size(), 0u); + EXPECT_EQ(p.GetAllPatternsByType("COMPANY_NAME"), + std::vector<MatchingPattern>( + {GetCompanyPatternDe(), GetCompanyPatternEn()})); + EXPECT_EQ(p.GetAllPatternsByType("COMPANY_NAME").size(), 2u); +} - UnitTestPatternProvider* pattern_provider = new UnitTestPatternProvider(); +TEST(AutofillPatternProvider, UnknownLanguages) { + { + base::test::ScopedFeatureList feature; + feature.InitWithFeatures( + // enabled + {features::kAutofillUsePageLanguageToSelectFieldParsingPatterns}, + // disabled + {features:: + kAutofillApplyNegativePatternsForFieldTypeDetectionHeuristics}); + UnitTestPatternProvider p; + EXPECT_EQ(p.GetMatchPatterns("COMPANY_NAME", ""), + p.GetAllPatternsByType("COMPANY_NAME")); + EXPECT_EQ(p.GetMatchPatterns("COMPANY_NAME", "blabla"), + p.GetAllPatternsByType("COMPANY_NAME")); + } - ASSERT_GT(pattern_provider->GetAllPatternsBaseOnType("COMPANY_NAME").size(), - 0u); - EXPECT_EQ(pattern_provider->GetAllPatternsBaseOnType("COMPANY_NAME"), - match_vector); - EXPECT_EQ(pattern_provider->GetAllPatternsBaseOnType("COMPANY_NAME").size(), - 2u); + { + base::test::ScopedFeatureList feature; + feature.InitWithFeatures( + // enabled + {features:: + kAutofillApplyNegativePatternsForFieldTypeDetectionHeuristics}, + // disabled + {features::kAutofillUsePageLanguageToSelectFieldParsingPatterns}); + UnitTestPatternProvider p; + EXPECT_EQ(p.GetMatchPatterns("COMPANY_NAME", ""), + p.GetAllPatternsByType("COMPANY_NAME")); + EXPECT_EQ(p.GetMatchPatterns("COMPANY_NAME", "blabla"), + p.GetAllPatternsByType("COMPANY_NAME")); + } +} + +TEST(AutofillPatternProvider, EnrichPatternsWithEnVersion) { + { + base::test::ScopedFeatureList feature; + feature.InitWithFeatures( + // enabled + {features::kAutofillUsePageLanguageToSelectFieldParsingPatterns}, + // disabled + {features:: + kAutofillApplyNegativePatternsForFieldTypeDetectionHeuristics}); + UnitTestPatternProvider p; + EXPECT_EQ(p.GetMatchPatterns("COMPANY_NAME", "en"), + std::vector<MatchingPattern>{GetCompanyPatternEn()}); + EXPECT_EQ(p.GetMatchPatterns("COMPANY_NAME", "de"), + std::vector<MatchingPattern>( + {GetCompanyPatternDe(), GetCompanyPatternEn()})); + } + + { + base::test::ScopedFeatureList feature; + feature.InitWithFeatures( + // enabled + {features:: + kAutofillApplyNegativePatternsForFieldTypeDetectionHeuristics}, + // disabled + {features::kAutofillUsePageLanguageToSelectFieldParsingPatterns}); + UnitTestPatternProvider p; + EXPECT_EQ(p.GetMatchPatterns("COMPANY_NAME", "en"), + std::vector<MatchingPattern>({GetCompanyPatternDe(), + GetCompanyPatternEn()})); + EXPECT_EQ(p.GetMatchPatterns("COMPANY_NAME", "de"), + std::vector<MatchingPattern>({GetCompanyPatternDe(), + GetCompanyPatternEn()})); + } +} + +TEST(AutofillPatternProvider, SortPatternsByScore) { + base::test::ScopedFeatureList feature; + feature.InitWithFeatures( + // enabled + {features::kAutofillUsePageLanguageToSelectFieldParsingPatterns, + features::kAutofillApplyNegativePatternsForFieldTypeDetectionHeuristics}, + // disabled + {}); + std::vector<MatchingPattern> de_input_patterns; + de_input_patterns.push_back(GetCompanyPatternDe()); + de_input_patterns.push_back(GetCompanyPatternDe()); + de_input_patterns.push_back(GetCompanyPatternDe()); + de_input_patterns.push_back(GetCompanyPatternDe()); + de_input_patterns[0].positive_score = 3.0; + de_input_patterns[1].positive_score = 1.0; + de_input_patterns[2].positive_score = 5.0; + de_input_patterns[3].positive_score = 3.0; + UnitTestPatternProvider p(de_input_patterns, {}); + const std::vector<MatchingPattern>& de_patterns = + p.GetMatchPatterns(COMPANY_NAME, "de"); + ASSERT_EQ(de_patterns.size(), de_input_patterns.size()); + EXPECT_EQ(de_patterns[0].positive_score, 5.0); + EXPECT_EQ(de_patterns[1].positive_score, 3.0); + EXPECT_EQ(de_patterns[2].positive_score, 3.0); + EXPECT_EQ(de_patterns[3].positive_score, 1.0); } } // namespace autofill
diff --git a/components/autofill/core/browser/pattern_provider/resources/regex_patterns.json b/components/autofill/core/browser/pattern_provider/resources/regex_patterns.json index 95ca87f70..5a17778c 100644 --- a/components/autofill/core/browser/pattern_provider/resources/regex_patterns.json +++ b/components/autofill/core/browser/pattern_provider/resources/regex_patterns.json
@@ -7,7 +7,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -19,7 +19,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -29,7 +29,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "pt": [ @@ -39,7 +39,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -51,7 +51,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -63,7 +63,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "de": [ @@ -73,7 +73,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -83,7 +83,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -93,7 +93,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "it": [ @@ -103,7 +103,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -113,7 +113,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ru": [ @@ -123,7 +123,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "zh": [ @@ -133,7 +133,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fa": [ @@ -143,7 +143,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ko": [ @@ -153,7 +153,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -165,7 +165,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "de": [ @@ -175,7 +175,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "es": [ @@ -185,7 +185,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "fr": [ @@ -195,7 +195,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "it": [ @@ -205,7 +205,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "ja": [ @@ -215,7 +215,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "pt": [ @@ -225,7 +225,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "ru": [ @@ -235,7 +235,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "zh": [ @@ -245,7 +245,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "tr": [ @@ -255,7 +255,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "ko": [ @@ -265,7 +265,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 68 + "match_field_input_types": 17 } ] }, @@ -277,7 +277,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "fr": [ @@ -287,7 +287,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "it": [ @@ -297,7 +297,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "ja": [ @@ -307,7 +307,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "zh": [ @@ -317,7 +317,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "tr": [ @@ -327,7 +327,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 68 + "match_field_input_types": 17 } ], "ko": [ @@ -337,7 +337,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 68 + "match_field_input_types": 17 } ] }, @@ -349,7 +349,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "de": [ @@ -359,7 +359,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -369,7 +369,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -379,7 +379,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "it": [ @@ -389,7 +389,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -399,7 +399,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "pt": [ @@ -409,7 +409,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ru": [ @@ -419,7 +419,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "zh": [ @@ -429,7 +429,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ko": [ @@ -439,7 +439,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -451,7 +451,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -461,7 +461,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "it": [ @@ -471,7 +471,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "zh": [ @@ -481,7 +481,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ko": [ @@ -491,7 +491,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 1, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -503,7 +503,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -513,7 +513,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -523,7 +523,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "it": [ @@ -533,7 +533,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -545,7 +545,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -557,7 +557,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "es": [ @@ -567,7 +567,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "de": [ @@ -577,7 +577,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ja": [ @@ -587,7 +587,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "zh": [ @@ -597,7 +597,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ko": [ @@ -607,7 +607,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "tr": [ @@ -617,7 +617,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "fa": [ @@ -627,7 +627,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ] }, @@ -639,7 +639,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 544 + "match_field_input_types": 136 } ] }, @@ -651,7 +651,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "de": [ @@ -661,7 +661,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "es": [ @@ -671,7 +671,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "fr": [ @@ -681,7 +681,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "it": [ @@ -691,7 +691,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "ja": [ @@ -701,7 +701,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "pt": [ @@ -711,7 +711,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "ru": [ @@ -721,7 +721,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "hi": [ @@ -731,7 +731,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "ml": [ @@ -741,7 +741,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "zh": [ @@ -751,7 +751,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "tr": [ @@ -761,7 +761,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "ko": [ @@ -771,7 +771,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -783,7 +783,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "pt": [ @@ -793,7 +793,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -805,7 +805,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "de": [ @@ -815,7 +815,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "es": [ @@ -825,7 +825,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "fr": [ @@ -835,7 +835,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "it": [ @@ -845,7 +845,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ja": [ @@ -855,7 +855,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "pt": [ @@ -865,7 +865,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ru": [ @@ -875,7 +875,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "zh": [ @@ -885,7 +885,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "fa": [ @@ -895,7 +895,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "hi": [ @@ -905,7 +905,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ml": [ @@ -915,7 +915,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "tr": [ @@ -925,7 +925,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ko": [ @@ -935,7 +935,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ] }, @@ -947,7 +947,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ja": [ @@ -957,7 +957,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "pt": [ @@ -967,7 +967,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ru": [ @@ -977,7 +977,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "zh": [ @@ -987,7 +987,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ml": [ @@ -997,7 +997,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "fa": [ @@ -1007,7 +1007,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "hi": [ @@ -1017,7 +1017,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "tr": [ @@ -1027,7 +1027,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ], "ko": [ @@ -1037,7 +1037,7 @@ "positive_score": 1.1, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 548 + "match_field_input_types": 137 } ] }, @@ -1049,7 +1049,7 @@ "positive_score": 0.8, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 580 + "match_field_input_types": 145 } ], "de": [ @@ -1059,7 +1059,7 @@ "positive_score": 0.8, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 580 + "match_field_input_types": 145 } ], "zh": [ @@ -1069,7 +1069,7 @@ "positive_score": 0.8, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 580 + "match_field_input_types": 145 } ], "ja": [ @@ -1079,7 +1079,7 @@ "positive_score": 0.8, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 580 + "match_field_input_types": 145 } ], "fr": [ @@ -1089,7 +1089,7 @@ "positive_score": 0.8, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 580 + "match_field_input_types": 145 } ], "pt": [ @@ -1099,7 +1099,7 @@ "positive_score": 0.8, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 580 + "match_field_input_types": 145 } ], "fa": [ @@ -1109,7 +1109,7 @@ "positive_score": 0.8, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 580 + "match_field_input_types": 145 } ], "ru": [ @@ -1119,7 +1119,7 @@ "positive_score": 0.8, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 580 + "match_field_input_types": 145 } ] }, @@ -1131,7 +1131,7 @@ "positive_score": 0.95, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 868 + "match_field_input_types": 217 } ], "ar": [ @@ -1141,7 +1141,7 @@ "positive_score": 0.95, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 868 + "match_field_input_types": 217 } ], "fa": [ @@ -1151,7 +1151,7 @@ "positive_score": 0.95, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 868 + "match_field_input_types": 217 } ], "fr": [ @@ -1161,7 +1161,7 @@ "positive_score": 0.95, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 868 + "match_field_input_types": 217 } ] }, @@ -1173,7 +1173,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "de": [ @@ -1183,7 +1183,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -1193,7 +1193,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -1203,7 +1203,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "it": [ @@ -1213,7 +1213,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -1223,7 +1223,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ru": [ @@ -1233,7 +1233,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "zh": [ @@ -1243,7 +1243,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -1255,7 +1255,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -1267,7 +1267,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ], "de": [ @@ -1277,7 +1277,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ], "ja": [ @@ -1287,7 +1287,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ], "ru": [ @@ -1297,7 +1297,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ], "zh": [ @@ -1307,7 +1307,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ], "ko": [ @@ -1317,7 +1317,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ], "es": [ @@ -1327,7 +1327,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ], "pt": [ @@ -1337,7 +1337,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ], "fr": [ @@ -1347,7 +1347,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ] }, @@ -1359,7 +1359,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 404 + "match_field_input_types": 101 } ] }, @@ -1371,7 +1371,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "de": [ @@ -1381,7 +1381,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "es": [ @@ -1391,7 +1391,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "fr": [ @@ -1401,7 +1401,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "it": [ @@ -1411,7 +1411,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "ja": [ @@ -1421,7 +1421,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "pt": [ @@ -1431,7 +1431,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "ru": [ @@ -1441,7 +1441,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "zh": [ @@ -1451,7 +1451,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ] }, @@ -1463,7 +1463,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "de": [ @@ -1473,7 +1473,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "es": [ @@ -1483,7 +1483,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "it": [ @@ -1493,7 +1493,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "ja": [ @@ -1503,7 +1503,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "pt": [ @@ -1513,7 +1513,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "ru": [ @@ -1523,7 +1523,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "zh": [ @@ -1533,7 +1533,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ] }, @@ -1545,7 +1545,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ] }, @@ -1557,7 +1557,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ] }, @@ -1569,7 +1569,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "de": [ @@ -1579,7 +1579,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "es": [ @@ -1589,7 +1589,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "fr": [ @@ -1599,7 +1599,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "it": [ @@ -1609,7 +1609,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "ja": [ @@ -1619,7 +1619,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "pt": [ @@ -1629,7 +1629,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ], "ru": [ @@ -1639,7 +1639,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 948 + "match_field_input_types": 237 } ] }, @@ -1651,7 +1651,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 788 + "match_field_input_types": 197 } ] }, @@ -1663,7 +1663,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 788 + "match_field_input_types": 197 } ] }, @@ -1675,7 +1675,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 788 + "match_field_input_types": 197 } ] }, @@ -1687,7 +1687,7 @@ "positive_score": 1.0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 36 + "match_field_input_types": 9 } ] }, @@ -1699,7 +1699,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "fr": [ @@ -1709,7 +1709,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "es": [ @@ -1719,7 +1719,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "ja": [ @@ -1729,7 +1729,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "ru": [ @@ -1739,7 +1739,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "zh": [ @@ -1749,7 +1749,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "ml": [ @@ -1759,7 +1759,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "fa": [ @@ -1769,7 +1769,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "hi": [ @@ -1779,7 +1779,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "tr": [ @@ -1789,7 +1789,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ], "ko": [ @@ -1799,7 +1799,7 @@ "positive_score": 1.4, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 12 + "match_field_input_types": 3 } ] }, @@ -1811,7 +1811,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "tr": [ @@ -1821,7 +1821,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "de": [ @@ -1831,7 +1831,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "zh": [ @@ -1841,7 +1841,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ko": [ @@ -1851,7 +1851,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -1863,7 +1863,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -1873,7 +1873,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -1883,7 +1883,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -1893,7 +1893,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "pt": [ @@ -1903,7 +1903,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fa": [ @@ -1913,7 +1913,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "zh": [ @@ -1923,7 +1923,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "tr": [ @@ -1933,7 +1933,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ko": [ @@ -1943,7 +1943,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -1955,7 +1955,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -1965,7 +1965,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "pt": [ @@ -1975,7 +1975,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -1987,7 +1987,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "de": [ @@ -1997,7 +1997,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -2007,7 +2007,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -2017,7 +2017,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -2027,7 +2027,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "pt": [ @@ -2037,7 +2037,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ru": [ @@ -2047,7 +2047,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fa": [ @@ -2057,7 +2057,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ko": [ @@ -2067,7 +2067,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ml": [ @@ -2077,7 +2077,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "tr": [ @@ -2087,7 +2087,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "hi": [ @@ -2097,7 +2097,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2109,7 +2109,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2121,7 +2121,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2133,7 +2133,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "de": [ @@ -2143,7 +2143,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -2153,7 +2153,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -2163,7 +2163,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "it": [ @@ -2173,7 +2173,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -2183,7 +2183,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "pt": [ @@ -2193,7 +2193,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ru": [ @@ -2203,7 +2203,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fa": [ @@ -2213,7 +2213,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "hi": [ @@ -2223,7 +2223,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ml": [ @@ -2233,7 +2233,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "tr": [ @@ -2243,7 +2243,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ko": [ @@ -2253,7 +2253,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2265,7 +2265,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2277,7 +2277,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2289,7 +2289,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "de": [ @@ -2299,7 +2299,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -2309,7 +2309,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "it": [ @@ -2319,7 +2319,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -2329,7 +2329,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ru": [ @@ -2339,7 +2339,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "el": [ @@ -2349,7 +2349,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "tr": [ @@ -2359,7 +2359,7 @@ "positive_score": 0.9, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2371,7 +2371,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "de": [ @@ -2381,7 +2381,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "es": [ @@ -2391,7 +2391,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "fr": [ @@ -2401,7 +2401,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "ja": [ @@ -2411,7 +2411,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "pt": [ @@ -2421,7 +2421,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "ru": [ @@ -2431,7 +2431,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "hi": [ @@ -2441,7 +2441,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "tr": [ @@ -2451,7 +2451,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "zh": [ @@ -2461,7 +2461,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "ml": [ @@ -2471,7 +2471,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "ko": [ @@ -2481,7 +2481,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -2493,7 +2493,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2505,7 +2505,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 308 + "match_field_input_types": 77 } ] }, @@ -2517,7 +2517,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -2529,7 +2529,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "ko": [ @@ -2539,7 +2539,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -2551,7 +2551,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -2563,7 +2563,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -2575,7 +2575,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "fr": [ @@ -2585,7 +2585,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "pt": [ @@ -2595,7 +2595,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -2607,7 +2607,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -2619,7 +2619,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ], "pt": [ @@ -2629,7 +2629,7 @@ "positive_score": 1.3, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 276 + "match_field_input_types": 69 } ] }, @@ -2641,7 +2641,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "fr": [ @@ -2651,7 +2651,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -2661,7 +2661,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -2671,7 +2671,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2683,7 +2683,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -2693,7 +2693,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -2703,7 +2703,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2715,7 +2715,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -2725,7 +2725,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -2735,7 +2735,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2747,7 +2747,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "es": [ @@ -2757,7 +2757,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ], "ja": [ @@ -2767,7 +2767,7 @@ "positive_score": 1.2, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2779,7 +2779,7 @@ "positive_score": 0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 }, { "pattern_identifier": "en_upi_virtual_payment_address_user@(bank_list)_preserving", @@ -2787,7 +2787,7 @@ "positive_score": 0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2799,7 +2799,7 @@ "positive_score": 0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2811,7 +2811,7 @@ "positive_score": 0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2823,7 +2823,7 @@ "positive_score": 0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2835,7 +2835,7 @@ "positive_score": 0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2847,7 +2847,7 @@ "positive_score": 0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] }, @@ -2859,8 +2859,8 @@ "positive_score": 0, "negative_pattern": "", "match_field_attributes": 3, - "match_field_input_types": 4 + "match_field_input_types": 1 } ] } -} \ No newline at end of file +}
diff --git a/components/autofill/core/common/autofill_features.cc b/components/autofill/core/common/autofill_features.cc index 87864e12..c2fae09 100644 --- a/components/autofill/core/common/autofill_features.cc +++ b/components/autofill/core/common/autofill_features.cc
@@ -117,6 +117,13 @@ "AutofillEnableSupportForMergingSubsetNames", base::FEATURE_DISABLED_BY_DEFAULT}; +// Controls whether honorific prefix is shown and editable in Autofill Settings +// on Android, iOS and Desktop. +// TODO(crbug.com/1141460): Remove once launched. +const base::Feature kAutofillEnableUIForHonorificPrefixesInSettings{ + "AutofillEnableUIForHonorificPrefixesInSettings", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Controls whether or not a minimum number of fields is required before // heuristic field type prediction is run for a form. const base::Feature kAutofillEnforceMinRequiredFieldsForHeuristics{
diff --git a/components/autofill/core/common/autofill_features.h b/components/autofill/core/common/autofill_features.h index 511ba09..688ec56 100644 --- a/components/autofill/core/common/autofill_features.h +++ b/components/autofill/core/common/autofill_features.h
@@ -39,6 +39,7 @@ extern const base::Feature kAutofillEnableSupportForMoreStructureInAddresses; extern const base::Feature kAutofillEnableSupportForMergingSubsetNames; extern const base::Feature kAutofillEnableSupportForHouseNumbers; +extern const base::Feature kAutofillEnableUIForHonorificPrefixesInSettings; extern const base::Feature kAutofillEnforceMinRequiredFieldsForHeuristics; extern const base::Feature kAutofillEnforceMinRequiredFieldsForQuery; extern const base::Feature kAutofillEnforceMinRequiredFieldsForUpload;
diff --git a/components/autofill_assistant/browser/controller_unittest.cc b/components/autofill_assistant/browser/controller_unittest.cc index 8f9a485..3ae43b7 100644 --- a/components/autofill_assistant/browser/controller_unittest.cc +++ b/components/autofill_assistant/browser/controller_unittest.cc
@@ -2858,4 +2858,23 @@ EXPECT_CALL(mock_runtime_manager_, SetUIState(UIState::kNotShown)).Times(1); controller_->SetUiShown(false); } + +TEST_F(ControllerTest, OnGetScriptsFailedWillShutdown) { + EXPECT_CALL(mock_observer_, OnStatusMessageChanged(l10n_util::GetStringFUTF8( + IDS_AUTOFILL_ASSISTANT_LOADING, + base::UTF8ToUTF16("initialurl.com")))) + .Times(1); + EXPECT_CALL(*mock_service_, OnGetScriptsForUrl(_, _, _)) + .WillOnce(RunOnceCallback<2>(net::HTTP_NOT_FOUND, "")); + EXPECT_CALL(mock_observer_, OnStatusMessageChanged(l10n_util::GetStringUTF8( + IDS_AUTOFILL_ASSISTANT_DEFAULT_ERROR))) + .Times(1); + EXPECT_CALL(mock_client_, HasHadUI()).WillOnce(Return(false)); + EXPECT_CALL(mock_client_, + Shutdown(Metrics::DropOutReason::GET_SCRIPTS_FAILED)) + .Times(1); + + Start(); + EXPECT_EQ(AutofillAssistantState::STOPPED, controller_->GetState()); +} } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/selector.cc b/components/autofill_assistant/browser/selector.cc index e460622c..e3a884a 100644 --- a/components/autofill_assistant/browser/selector.cc +++ b/components/autofill_assistant/browser/selector.cc
@@ -68,6 +68,9 @@ b.closest().relative_position()); } + case SelectorProto::Filter::kMatchCssSelector: + return a.match_css_selector() < b.match_css_selector(); + case SelectorProto::Filter::FILTER_NOT_SET: return false; } @@ -219,6 +222,7 @@ case SelectorProto::Filter::kPseudoElementContent: case SelectorProto::Filter::kLabelled: case SelectorProto::Filter::kClosest: + case SelectorProto::Filter::kMatchCssSelector: VLOG(1) << __func__ << " Selector feature not supported by autofill: " << *this; return base::nullopt; @@ -354,6 +358,10 @@ } return out; + case SelectorProto::Filter::kMatchCssSelector: + out << "matches: " << f.css_selector(); + return out; + case SelectorProto::Filter::FILTER_NOT_SET: // Either unset or set to an unsupported value. Let's assume the worse. out << "INVALID";
diff --git a/components/autofill_assistant/browser/selector_unittest.cc b/components/autofill_assistant/browser/selector_unittest.cc index 08639296..130f93d 100644 --- a/components/autofill_assistant/browser/selector_unittest.cc +++ b/components/autofill_assistant/browser/selector_unittest.cc
@@ -138,6 +138,16 @@ EXPECT_FALSE(Selector(selector) == Selector(label2)); } +TEST(SelectorTest, Comparison_MatchCssSelector) { + Selector a = Selector({"button"}); + a.proto.add_filters()->set_match_css_selector(".class1"); + Selector b = Selector({"button"}); + b.proto.add_filters()->set_match_css_selector(".class2"); + + EXPECT_FALSE(a == b); + EXPECT_TRUE(a == a); +} + TEST(SelectorTest, Comparison_Frames) { Selector ab({"a", "b"}); EXPECT_EQ(ab, ab);
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index d4cb0146..3eaf479 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -928,6 +928,9 @@ // always 0. If there are multiple elements at exactly the same distance, // an arbitrary one is returned. ProximityFilter closest = 10; + + // Only keep results that match the given CSS selector. + string match_css_selector = 11; } }
diff --git a/components/autofill_assistant/browser/web/element_finder.cc b/components/autofill_assistant/browser/web/element_finder.cc index add0332..c840c54a 100644 --- a/components/autofill_assistant/browser/web/element_finder.cc +++ b/components/autofill_assistant/browser/web/element_finder.cc
@@ -180,6 +180,11 @@ // https://www.w3.org/TR/2011/WD-html5-author-20110809/forms.html#category-label return true; + case SelectorProto::Filter::kMatchCssSelector: + AddLine({"elements = elements.filter((e) => e.webkitMatchesSelector(", + AddArgument(filter.match_css_selector()), "));"}); + return true; + case SelectorProto::Filter::kEnterFrame: case SelectorProto::Filter::kPseudoType: case SelectorProto::Filter::kPickOne: @@ -358,7 +363,8 @@ case SelectorProto::Filter::kValue: case SelectorProto::Filter::kBoundingBox: case SelectorProto::Filter::kPseudoElementContent: - case SelectorProto::Filter::kLabelled: { + case SelectorProto::Filter::kLabelled: + case SelectorProto::Filter::kMatchCssSelector: { std::vector<std::string> matches; if (!ConsumeAllMatchesOrFail(matches)) return;
diff --git a/components/autofill_assistant/browser/web/web_controller_browsertest.cc b/components/autofill_assistant/browser/web/web_controller_browsertest.cc index 0294b9d..cacc9a2 100644 --- a/components/autofill_assistant/browser/web/web_controller_browsertest.cc +++ b/components/autofill_assistant/browser/web/web_controller_browsertest.cc
@@ -1199,6 +1199,28 @@ EXPECT_EQ(ELEMENT_RESOLUTION_FAILED, status.proto_status()); } +IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, MatchCssSelectorFilter) { + Selector selector({"label"}); + selector.MatchingInnerText("terms and conditions"); + selector.proto.add_filters()->mutable_labelled(); + + RunStrictElementCheck(selector, true); + + auto* last_filter = selector.proto.add_filters(); + + last_filter->set_match_css_selector("input[type='checkbox']"); + RunStrictElementCheck(selector, true); + + last_filter->set_match_css_selector("input[type='text']"); + RunStrictElementCheck(selector, false); + + last_filter->set_match_css_selector(":checked"); + RunStrictElementCheck(selector, false); + + last_filter->set_match_css_selector(":not(:checked)"); + RunStrictElementCheck(selector, true); +} + IN_PROC_BROWSER_TEST_F(WebControllerBrowserTest, ValueCondition) { // One match RunLaxElementCheck(Selector({"#input1"}).MatchingValue("helloworld1"), true);
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/PermissionInfo.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/PermissionInfo.java index 960a8799..5897caf 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/PermissionInfo.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/PermissionInfo.java
@@ -16,22 +16,21 @@ * Permission information for a given origin. */ public class PermissionInfo implements Serializable { - private final boolean mIsIncognito; private final boolean mIsEmbargoed; private final String mEmbedder; private final String mOrigin; private final @ContentSettingsType int mContentSettingsType; - public PermissionInfo( - @ContentSettingsType int type, String origin, String embedder, boolean isIncognito) { - this(type, origin, embedder, isIncognito, false); + public PermissionInfo(@ContentSettingsType int type, String origin, String embedder) { + this(type, origin, embedder, false); } - public PermissionInfo(@ContentSettingsType int type, String origin, String embedder, - boolean isIncognito, boolean isEmbargoed) { + public PermissionInfo( + @ContentSettingsType int type, String origin, String embedder, boolean isEmbargoed) { + assert WebsitePermissionsFetcher.getPermissionsType(type) + == WebsitePermissionsFetcher.WebsitePermissionsType.PERMISSION_INFO; mOrigin = origin; mEmbedder = embedder; - mIsIncognito = isIncognito; mContentSettingsType = type; mIsEmbargoed = isEmbargoed; } @@ -48,10 +47,6 @@ return mEmbedder; } - public boolean isIncognito() { - return mIsIncognito; - } - public String getEmbedderSafe() { return mEmbedder != null ? mEmbedder : mOrigin; } @@ -65,47 +60,8 @@ */ public @ContentSettingValues @Nullable Integer getContentSetting( BrowserContextHandle browserContextHandle) { - switch (mContentSettingsType) { - case ContentSettingsType.AR: - return WebsitePreferenceBridgeJni.get().getArSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - case ContentSettingsType.MEDIASTREAM_CAMERA: - return WebsitePreferenceBridgeJni.get().getCameraSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - case ContentSettingsType.CLIPBOARD_READ_WRITE: - return WebsitePreferenceBridgeJni.get().getClipboardSettingForOrigin( - browserContextHandle, mOrigin); - case ContentSettingsType.GEOLOCATION: - return WebsitePreferenceBridgeJni.get().getGeolocationSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - case ContentSettingsType.IDLE_DETECTION: - return WebsitePreferenceBridgeJni.get().getIdleDetectionSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - case ContentSettingsType.MEDIASTREAM_MIC: - return WebsitePreferenceBridgeJni.get().getMicrophoneSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - case ContentSettingsType.MIDI_SYSEX: - return WebsitePreferenceBridgeJni.get().getMidiSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - case ContentSettingsType.NFC: - return WebsitePreferenceBridgeJni.get().getNfcSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - case ContentSettingsType.NOTIFICATIONS: - return WebsitePreferenceBridgeJni.get().getNotificationSettingForOrigin( - browserContextHandle, mOrigin); - case ContentSettingsType.PROTECTED_MEDIA_IDENTIFIER: - return WebsitePreferenceBridgeJni.get().getProtectedMediaIdentifierSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - case ContentSettingsType.SENSORS: - return WebsitePreferenceBridgeJni.get().getSensorsSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - case ContentSettingsType.VR: - return WebsitePreferenceBridgeJni.get().getVrSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe()); - default: - assert false; - return null; - } + return WebsitePreferenceBridgeJni.get().getSettingForOrigin( + browserContextHandle, mContentSettingsType, mOrigin, getEmbedderSafe()); } /** @@ -113,57 +69,7 @@ */ public void setContentSetting( BrowserContextHandle browserContextHandle, @ContentSettingValues int value) { - switch (mContentSettingsType) { - case ContentSettingsType.AR: - WebsitePreferenceBridgeJni.get().setArSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe(), value); - break; - case ContentSettingsType.MEDIASTREAM_CAMERA: - WebsitePreferenceBridgeJni.get().setCameraSettingForOrigin( - browserContextHandle, mOrigin, value); - break; - case ContentSettingsType.CLIPBOARD_READ_WRITE: - WebsitePreferenceBridgeJni.get().setClipboardSettingForOrigin( - browserContextHandle, mOrigin, value); - break; - case ContentSettingsType.GEOLOCATION: - WebsitePreferenceBridgeJni.get().setGeolocationSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe(), value); - break; - case ContentSettingsType.IDLE_DETECTION: - WebsitePreferenceBridgeJni.get().setIdleDetectionSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe(), value); - break; - case ContentSettingsType.MEDIASTREAM_MIC: - WebsitePreferenceBridgeJni.get().setMicrophoneSettingForOrigin( - browserContextHandle, mOrigin, value); - break; - case ContentSettingsType.MIDI_SYSEX: - WebsitePreferenceBridgeJni.get().setMidiSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe(), value); - break; - case ContentSettingsType.NFC: - WebsitePreferenceBridgeJni.get().setNfcSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe(), value); - break; - case ContentSettingsType.NOTIFICATIONS: - WebsitePreferenceBridgeJni.get().setNotificationSettingForOrigin( - browserContextHandle, mOrigin, value); - break; - case ContentSettingsType.PROTECTED_MEDIA_IDENTIFIER: - WebsitePreferenceBridgeJni.get().setProtectedMediaIdentifierSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe(), value); - break; - case ContentSettingsType.SENSORS: - WebsitePreferenceBridgeJni.get().setSensorsSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe(), value); - break; - case ContentSettingsType.VR: - WebsitePreferenceBridgeJni.get().setVrSettingForOrigin( - browserContextHandle, mOrigin, getEmbedderSafe(), value); - break; - default: - assert false; - } + WebsitePreferenceBridgeJni.get().setSettingForOrigin( + browserContextHandle, mContentSettingsType, mOrigin, getEmbedderSafe(), value); } }
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java index d66ea5f..3975f0a 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java
@@ -36,46 +36,22 @@ public List<PermissionInfo> getPermissionInfo( BrowserContextHandle browserContextHandle, @ContentSettingsType int type) { ArrayList<PermissionInfo> list = new ArrayList<PermissionInfo>(); + boolean managedOnly = false; // Camera, Location & Microphone can be managed by the custodian // of a supervised account or by enterprise policy. - if (type == ContentSettingsType.AR) { - WebsitePreferenceBridgeJni.get().getArOrigins(browserContextHandle, list); - } else if (type == ContentSettingsType.MEDIASTREAM_CAMERA) { - boolean managedOnly = !isContentSettingUserModifiable(browserContextHandle, type); - WebsitePreferenceBridgeJni.get().getCameraOrigins( - browserContextHandle, list, managedOnly); - } else if (type == ContentSettingsType.CLIPBOARD_READ_WRITE) { - WebsitePreferenceBridgeJni.get().getClipboardOrigins(browserContextHandle, list); - } else if (type == ContentSettingsType.GEOLOCATION) { - boolean managedOnly = !isContentSettingUserModifiable(browserContextHandle, type); - WebsitePreferenceBridgeJni.get().getGeolocationOrigins( - browserContextHandle, list, managedOnly); - } else if (type == ContentSettingsType.IDLE_DETECTION) { - WebsitePreferenceBridgeJni.get().getIdleDetectionOrigins(browserContextHandle, list); - } else if (type == ContentSettingsType.MEDIASTREAM_MIC) { - boolean managedOnly = !isContentSettingUserModifiable(browserContextHandle, type); - WebsitePreferenceBridgeJni.get().getMicrophoneOrigins( - browserContextHandle, list, managedOnly); - } else if (type == ContentSettingsType.MIDI_SYSEX) { - WebsitePreferenceBridgeJni.get().getMidiOrigins(browserContextHandle, list); - } else if (type == ContentSettingsType.NFC) { - WebsitePreferenceBridgeJni.get().getNfcOrigins(browserContextHandle, list); - } else if (type == ContentSettingsType.NOTIFICATIONS) { - WebsitePreferenceBridgeJni.get().getNotificationOrigins(browserContextHandle, list); - } else if (type == ContentSettingsType.PROTECTED_MEDIA_IDENTIFIER) { - WebsitePreferenceBridgeJni.get().getProtectedMediaIdentifierOrigins( - browserContextHandle, list); - } else if (type == ContentSettingsType.SENSORS) { - WebsitePreferenceBridgeJni.get().getSensorsOrigins(browserContextHandle, list); - } else if (type == ContentSettingsType.VR) { - WebsitePreferenceBridgeJni.get().getVrOrigins(browserContextHandle, list); - } else { - assert false; + switch (type) { + case ContentSettingsType.GEOLOCATION: + case ContentSettingsType.MEDIASTREAM_CAMERA: + case ContentSettingsType.MEDIASTREAM_MIC: + managedOnly = !isContentSettingUserModifiable(browserContextHandle, type); } + WebsitePreferenceBridgeJni.get().getOriginsForPermission( + browserContextHandle, type, list, managedOnly); return list; } - private static void insertInfoIntoList(@ContentSettingsType int type, + @CalledByNative + private static void insertPermissionInfoIntoList(@ContentSettingsType int type, ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { if (type == ContentSettingsType.MEDIASTREAM_CAMERA || type == ContentSettingsType.MEDIASTREAM_MIC) { @@ -85,77 +61,7 @@ } } } - list.add(new PermissionInfo(type, origin, embedder, false, isEmbargoed)); - } - - @CalledByNative - private static void insertArInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList(ContentSettingsType.AR, list, origin, embedder, isEmbargoed); - } - - @CalledByNative - private static void insertCameraInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList( - ContentSettingsType.MEDIASTREAM_CAMERA, list, origin, embedder, isEmbargoed); - } - - @CalledByNative - private static void insertClipboardInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList( - ContentSettingsType.CLIPBOARD_READ_WRITE, list, origin, embedder, isEmbargoed); - } - - @CalledByNative - private static void insertGeolocationInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList(ContentSettingsType.GEOLOCATION, list, origin, embedder, isEmbargoed); - } - - @CalledByNative - private static void insertIdleDetectionInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList(ContentSettingsType.IDLE_DETECTION, list, origin, embedder, isEmbargoed); - } - - @CalledByNative - private static void insertMicrophoneInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList( - ContentSettingsType.MEDIASTREAM_MIC, list, origin, embedder, isEmbargoed); - } - - @CalledByNative - private static void insertMidiInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList(ContentSettingsType.MIDI_SYSEX, list, origin, embedder, isEmbargoed); - } - - @CalledByNative - private static void insertNfcInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList(ContentSettingsType.NFC, list, origin, embedder, isEmbargoed); - } - - @CalledByNative - private static void insertNotificationIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList(ContentSettingsType.NOTIFICATIONS, list, origin, embedder, isEmbargoed); - } - - @CalledByNative - private static void insertProtectedMediaIdentifierInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList(ContentSettingsType.PROTECTED_MEDIA_IDENTIFIER, list, origin, embedder, - isEmbargoed); - } - - @CalledByNative - private static void insertSensorsInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList(ContentSettingsType.SENSORS, list, origin, embedder, isEmbargoed); + list.add(new PermissionInfo(type, origin, embedder, isEmbargoed)); } @CalledByNative @@ -165,12 +71,6 @@ } @CalledByNative - private static void insertVrInfoIntoList( - ArrayList<PermissionInfo> list, String origin, String embedder, boolean isEmbargoed) { - insertInfoIntoList(ContentSettingsType.VR, list, origin, embedder, isEmbargoed); - } - - @CalledByNative private static Object createStorageInfoList() { return new ArrayList<StorageInfo>(); } @@ -426,73 +326,10 @@ @NativeMethods public interface Natives { - void getArOrigins(BrowserContextHandle browserContextHandle, Object list); - void getCameraOrigins( - BrowserContextHandle browserContextHandle, Object list, boolean managedOnly); - void getClipboardOrigins(BrowserContextHandle browserContextHandle, Object list); - void getGeolocationOrigins( - BrowserContextHandle browserContextHandle, Object list, boolean managedOnly); - void getIdleDetectionOrigins(BrowserContextHandle browserContextHandle, Object list); - void getMicrophoneOrigins( - BrowserContextHandle browserContextHandle, Object list, boolean managedOnly); - void getMidiOrigins(BrowserContextHandle browserContextHandle, Object list); - void getNotificationOrigins(BrowserContextHandle browserContextHandle, Object list); - void getNfcOrigins(BrowserContextHandle browserContextHandle, Object list); - void getProtectedMediaIdentifierOrigins( - BrowserContextHandle browserContextHandle, Object list); - void getSensorsOrigins(BrowserContextHandle browserContextHandle, Object list); - void getVrOrigins(BrowserContextHandle browserContextHandle, Object list); - int getArSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - int getCameraSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - int getClipboardSettingForOrigin(BrowserContextHandle browserContextHandle, String origin); - int getGeolocationSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - int getIdleDetectionSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - int getMicrophoneSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - int getMidiSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - int getNfcSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - int getNotificationSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin); boolean isNotificationEmbargoedForOrigin( BrowserContextHandle browserContextHandle, String origin); - int getProtectedMediaIdentifierSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - int getSensorsSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - int getVrSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, String embedder); - void setArSettingForOrigin(BrowserContextHandle browserContextHandle, String origin, - String embedder, int value); - void setCameraSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, int value); - void setClipboardSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, int value); - void setGeolocationSettingForOrigin(BrowserContextHandle browserContextHandle, - String origin, String embedder, int value); - void setIdleDetectionSettingForOrigin(BrowserContextHandle browserContextHandle, - String origin, String embedder, int value); - void setMicrophoneSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, int value); - void setMidiSettingForOrigin(BrowserContextHandle browserContextHandle, String origin, - String embedder, int value); - void setNfcSettingForOrigin(BrowserContextHandle browserContextHandle, String origin, - String embedder, int value); - void setNotificationSettingForOrigin( - BrowserContextHandle browserContextHandle, String origin, int value); void reportNotificationRevokedForOrigin( BrowserContextHandle browserContextHandle, String origin, int newSettingValue); - void setProtectedMediaIdentifierSettingForOrigin(BrowserContextHandle browserContextHandle, - String origin, String embedder, int value); - void setSensorsSettingForOrigin(BrowserContextHandle browserContextHandle, String origin, - String embedder, int value); - void setVrSettingForOrigin(BrowserContextHandle browserContextHandle, String origin, - String embedder, int value); void clearBannerData(BrowserContextHandle browserContextHandle, String origin); void clearMediaLicenses(BrowserContextHandle browserContextHandle, String origin); void clearCookieData(BrowserContextHandle browserContextHandle, String path); @@ -510,6 +347,13 @@ void fetchStorageInfo(BrowserContextHandle browserContextHandle, Object callback); void fetchLocalStorageInfo(BrowserContextHandle browserContextHandle, Object callback, boolean includeImportant); + void getOriginsForPermission(BrowserContextHandle browserContextHandle, + @ContentSettingsType int contentSettingsType, Object list, boolean managedOnly); + int getSettingForOrigin(BrowserContextHandle browserContextHandle, + @ContentSettingsType int contentSettingsType, String origin, String embedder); + void setSettingForOrigin(BrowserContextHandle browserContextHandle, + @ContentSettingsType int contentSettingsType, String origin, String embedder, + int value); boolean isPermissionControlledByDSE(BrowserContextHandle browserContextHandle, @ContentSettingsType int contentSettingsType, String origin); boolean getAdBlockingActivated(BrowserContextHandle browserContextHandle, String origin);
diff --git a/components/browser_ui/site_settings/android/website_preference_bridge.cc b/components/browser_ui/site_settings/android/website_preference_bridge.cc index a933d11..52baef6b 100644 --- a/components/browser_ui/site_settings/android/website_preference_bridge.cc +++ b/components/browser_ui/site_settings/android/website_preference_bridge.cc
@@ -126,6 +126,7 @@ typedef void (*InfoListInsertionFunction)( JNIEnv*, + JniIntWrapper, const base::android::JavaRef<jobject>&, const base::android::JavaRef<jstring>&, const base::android::JavaRef<jstring>&, @@ -170,7 +171,8 @@ jembedder = ConvertUTF8ToJavaString(env, embedder); seen_origins.push_back(origin); - insertionFunc(env, list, ConvertOriginToJavaString(env, origin), jembedder, + insertionFunc(env, static_cast<int>(content_type), list, + ConvertOriginToJavaString(env, origin), jembedder, /*is_embargoed=*/false); } @@ -192,8 +194,9 @@ if (auto_blocker->GetEmbargoResult(GURL(origin), content_type) .content_setting == CONTENT_SETTING_BLOCK) { seen_origins.push_back(origin); - insertionFunc(env, list, ConvertOriginToJavaString(env, origin), - jembedder, /*is_embargoed=*/true); + insertionFunc(env, static_cast<int>(content_type), list, + ConvertOriginToJavaString(env, origin), jembedder, + /*is_embargoed=*/true); } } } @@ -319,175 +322,6 @@ } // anonymous namespace -static void JNI_WebsitePreferenceBridge_GetClipboardOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list) { - GetOrigins( - env, jbrowser_context_handle, ContentSettingsType::CLIPBOARD_READ_WRITE, - &Java_WebsitePreferenceBridge_insertClipboardInfoIntoList, list, false); -} - -static jint JNI_WebsitePreferenceBridge_GetClipboardSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::CLIPBOARD_READ_WRITE, origin, - origin); -} - -static void JNI_WebsitePreferenceBridge_SetClipboardSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - jint value) { - SetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::CLIPBOARD_READ_WRITE, origin, origin, - static_cast<ContentSetting>(value)); -} - -static void JNI_WebsitePreferenceBridge_GetGeolocationOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list, - jboolean managedOnly) { - GetOrigins(env, jbrowser_context_handle, ContentSettingsType::GEOLOCATION, - &Java_WebsitePreferenceBridge_insertGeolocationInfoIntoList, list, - managedOnly); -} - -static jint JNI_WebsitePreferenceBridge_GetGeolocationSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::GEOLOCATION, origin, - embedder); -} - -static void JNI_WebsitePreferenceBridge_SetGeolocationSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder, - jint value) { - SetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::GEOLOCATION, origin, embedder, - static_cast<ContentSetting>(value)); -} - -static void JNI_WebsitePreferenceBridge_GetIdleDetectionOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list) { - GetOrigins(env, jbrowser_context_handle, ContentSettingsType::IDLE_DETECTION, - &Java_WebsitePreferenceBridge_insertIdleDetectionInfoIntoList, - list, false); -} - -static jint JNI_WebsitePreferenceBridge_GetIdleDetectionSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::IDLE_DETECTION, origin, - embedder); -} - -static void JNI_WebsitePreferenceBridge_SetIdleDetectionSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder, - jint value) { - SetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::IDLE_DETECTION, origin, embedder, - static_cast<ContentSetting>(value)); -} - -static void JNI_WebsitePreferenceBridge_GetMidiOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list) { - GetOrigins(env, jbrowser_context_handle, ContentSettingsType::MIDI_SYSEX, - &Java_WebsitePreferenceBridge_insertMidiInfoIntoList, list, false); -} - -static jint JNI_WebsitePreferenceBridge_GetMidiSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::MIDI_SYSEX, origin, embedder); -} - -static void JNI_WebsitePreferenceBridge_SetMidiSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder, - jint value) { - SetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::MIDI_SYSEX, origin, embedder, - static_cast<ContentSetting>(value)); -} - -static void JNI_WebsitePreferenceBridge_GetProtectedMediaIdentifierOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list) { - GetOrigins( - env, jbrowser_context_handle, - ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER, - &Java_WebsitePreferenceBridge_insertProtectedMediaIdentifierInfoIntoList, - list, false); -} - -static jint -JNI_WebsitePreferenceBridge_GetProtectedMediaIdentifierSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER, - origin, embedder); -} - -static void -JNI_WebsitePreferenceBridge_SetProtectedMediaIdentifierSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder, - jint value) { - SetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER, origin, - embedder, static_cast<ContentSetting>(value)); -} - -static void JNI_WebsitePreferenceBridge_GetNotificationOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list) { - GetOrigins(env, jbrowser_context_handle, ContentSettingsType::NOTIFICATIONS, - &Java_WebsitePreferenceBridge_insertNotificationIntoList, list, - false); -} - -static jint JNI_WebsitePreferenceBridge_GetNotificationSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::NOTIFICATIONS, origin, - origin); -} - static jboolean JNI_WebsitePreferenceBridge_IsNotificationEmbargoedForOrigin( JNIEnv* env, const JavaParamRef<jobject>& jbrowser_context_handle, @@ -505,7 +339,7 @@ permissions::PermissionStatusSource::MULTIPLE_DISMISSALS); } -static void JNI_WebsitePreferenceBridge_SetNotificationSettingForOrigin( +static void SetNotificationSettingForOrigin( JNIEnv* env, const JavaParamRef<jobject>& jbrowser_context_handle, const JavaParamRef<jstring>& origin, @@ -568,69 +402,54 @@ unwrap(jbrowser_context_handle)); } -static void JNI_WebsitePreferenceBridge_GetCameraOrigins( +static jint JNI_WebsitePreferenceBridge_GetSettingForOrigin( JNIEnv* env, const JavaParamRef<jobject>& jbrowser_context_handle, + jint content_settings_type, + const JavaParamRef<jstring>& origin, + const JavaParamRef<jstring>& embedder) { + ContentSettingsType type = + static_cast<ContentSettingsType>(content_settings_type); + return GetSettingForOrigin(env, jbrowser_context_handle, type, origin, + embedder); +} + +static void JNI_WebsitePreferenceBridge_SetSettingForOrigin( + JNIEnv* env, + const JavaParamRef<jobject>& jbrowser_context_handle, + jint content_settings_type, + const JavaParamRef<jstring>& origin, + const JavaParamRef<jstring>& embedder, + jint value) { + ContentSettingsType type = + static_cast<ContentSettingsType>(content_settings_type); + + switch (type) { + case ContentSettingsType::NOTIFICATIONS: + return SetNotificationSettingForOrigin(env, jbrowser_context_handle, + origin, value); + case ContentSettingsType::MEDIASTREAM_MIC: + case ContentSettingsType::MEDIASTREAM_CAMERA: + return SetSettingForOrigin(env, jbrowser_context_handle, type, origin, + nullptr, static_cast<ContentSetting>(value)); + default: + SetSettingForOrigin(env, jbrowser_context_handle, type, origin, embedder, + static_cast<ContentSetting>(value)); + } +} + +static void JNI_WebsitePreferenceBridge_GetOriginsForPermission( + JNIEnv* env, + const JavaParamRef<jobject>& jbrowser_context_handle, + jint content_settings_type, const JavaParamRef<jobject>& list, jboolean managedOnly) { GetOrigins(env, jbrowser_context_handle, - ContentSettingsType::MEDIASTREAM_CAMERA, - &Java_WebsitePreferenceBridge_insertCameraInfoIntoList, list, + static_cast<ContentSettingsType>(content_settings_type), + &Java_WebsitePreferenceBridge_insertPermissionInfoIntoList, list, managedOnly); } -static void JNI_WebsitePreferenceBridge_GetMicrophoneOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list, - jboolean managedOnly) { - GetOrigins(env, jbrowser_context_handle, ContentSettingsType::MEDIASTREAM_MIC, - &Java_WebsitePreferenceBridge_insertMicrophoneInfoIntoList, list, - managedOnly); -} - -static jint JNI_WebsitePreferenceBridge_GetMicrophoneSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::MEDIASTREAM_MIC, origin, - embedder); -} - -static jint JNI_WebsitePreferenceBridge_GetCameraSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::MEDIASTREAM_CAMERA, origin, - embedder); -} - -static void JNI_WebsitePreferenceBridge_SetMicrophoneSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - jint value) { - // Here 'nullptr' indicates that microphone uses wildcard for embedder. - SetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::MEDIASTREAM_MIC, origin, nullptr, - static_cast<ContentSetting>(value)); -} - -static void JNI_WebsitePreferenceBridge_SetCameraSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - jint value) { - // Here 'nullptr' indicates that camera uses wildcard for embedder. - SetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::MEDIASTREAM_CAMERA, origin, nullptr, - static_cast<ContentSetting>(value)); -} - static jboolean JNI_WebsitePreferenceBridge_IsContentSettingsPatternValid( JNIEnv* env, const JavaParamRef<jstring>& pattern) { @@ -923,118 +742,8 @@ unwrap(jbrowser_context_handle), url); } -static void JNI_WebsitePreferenceBridge_GetArOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list) { - GetOrigins(env, jbrowser_context_handle, ContentSettingsType::AR, - &Java_WebsitePreferenceBridge_insertArInfoIntoList, list, false); -} - -static jint JNI_WebsitePreferenceBridge_GetArSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::AR, origin, embedder); -} - -static void JNI_WebsitePreferenceBridge_SetArSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder, - jint value) { - SetSettingForOrigin(env, jbrowser_context_handle, ContentSettingsType::AR, - origin, embedder, static_cast<ContentSetting>(value)); -} - -static void JNI_WebsitePreferenceBridge_GetNfcOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list) { - GetOrigins(env, jbrowser_context_handle, ContentSettingsType::NFC, - &Java_WebsitePreferenceBridge_insertNfcInfoIntoList, list, false); -} - -static jint JNI_WebsitePreferenceBridge_GetNfcSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::NFC, origin, embedder); -} - -static void JNI_WebsitePreferenceBridge_SetNfcSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder, - jint value) { - SetSettingForOrigin(env, jbrowser_context_handle, ContentSettingsType::NFC, - origin, embedder, static_cast<ContentSetting>(value)); -} - -static void JNI_WebsitePreferenceBridge_GetSensorsOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list) { - GetOrigins(env, jbrowser_context_handle, ContentSettingsType::SENSORS, - &Java_WebsitePreferenceBridge_insertSensorsInfoIntoList, list, - false); -} - -static jint JNI_WebsitePreferenceBridge_GetSensorsSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::SENSORS, origin, embedder); -} - -static void JNI_WebsitePreferenceBridge_SetSensorsSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder, - jint value) { - SetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::SENSORS, origin, embedder, - static_cast<ContentSetting>(value)); -} - -static void JNI_WebsitePreferenceBridge_GetVrOrigins( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jobject>& list) { - GetOrigins(env, jbrowser_context_handle, ContentSettingsType::VR, - &Java_WebsitePreferenceBridge_insertVrInfoIntoList, list, false); -} - -static jint JNI_WebsitePreferenceBridge_GetVrSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder) { - return GetSettingForOrigin(env, jbrowser_context_handle, - ContentSettingsType::VR, origin, embedder); -} - -static void JNI_WebsitePreferenceBridge_SetVrSettingForOrigin( - JNIEnv* env, - const JavaParamRef<jobject>& jbrowser_context_handle, - const JavaParamRef<jstring>& origin, - const JavaParamRef<jstring>& embedder, - jint value) { - SetSettingForOrigin(env, jbrowser_context_handle, ContentSettingsType::VR, - origin, embedder, static_cast<ContentSetting>(value)); -} - -// On Android O+ notification channels are not stored in the Chrome profile and -// so are persisted across tests. This function resets them. +// On Android O+ notification channels are not stored in the Chrome profile +// and so are persisted across tests. This function resets them. static void JNI_WebsitePreferenceBridge_ResetNotificationsSettingsForTest( JNIEnv* env, const JavaParamRef<jobject>& jbrowser_context_handle) { @@ -1213,4 +922,3 @@ ->GetDefaultContentSetting(ContentSettingsType::GEOLOCATION, nullptr) == CONTENT_SETTING_ALLOW; } -
diff --git a/components/browser_ui/strings/android/translations/browser_ui_strings_ca.xtb b/components/browser_ui/strings/android/translations/browser_ui_strings_ca.xtb index 122603f3..b5cd604e 100644 --- a/components/browser_ui/strings/android/translations/browser_ui_strings_ca.xtb +++ b/components/browser_ui/strings/android/translations/browser_ui_strings_ca.xtb
@@ -195,7 +195,7 @@ <translation id="6527303717912515753">Comparteix</translation> <translation id="6545864417968258051">Cerca de dispositius Bluetooth</translation> <translation id="6552800053856095716">{PERMISSIONS_SUMMARY_BLOCKED,plural, =1{S'han bloquejat <ph name="PERMISSION_1" />, <ph name="PERMISSION_2" /> i <ph name="NUM_MORE" /> més}other{S'han bloquejat <ph name="PERMISSION_1" />, <ph name="PERMISSION_2" /> i <ph name="NUM_MORE" /> més}}</translation> -<translation id="6561560012278703671">Utilitza missatges més silenciosos (bloqueja les sol·licituds de notificacions per evitar interrupcions)</translation> +<translation id="6561560012278703671">Utilitza missatges més discrets (bloqueja les sol·licituds de notificacions per evitar interrupcions)</translation> <translation id="6608650720463149374"><ph name="GIGABYTES" /> GB</translation> <translation id="6612358246767739896">Contingut protegit</translation> <translation id="662080504995468778">No surtis</translation>
diff --git a/components/password_manager/core/browser/form_parsing/form_parser.cc b/components/password_manager/core/browser/form_parsing/form_parser.cc index 013eb07..d1efdff6 100644 --- a/components/password_manager/core/browser/form_parsing/form_parser.cc +++ b/components/password_manager/core/browser/form_parsing/form_parser.cc
@@ -234,11 +234,7 @@ bool DoesPredictionCorrespondToField( const FormFieldData& field, const PasswordFieldPrediction& prediction) { -#if defined(OS_IOS) - return field.unique_id == prediction.unique_id; -#else return field.unique_renderer_id == prediction.renderer_id; -#endif } // Returns the first element of |fields| which corresponds to |prediction|, or
diff --git a/components/password_manager/core/browser/password_manager_unittest.cc b/components/password_manager/core/browser/password_manager_unittest.cc index e7cd9e4..dca9d28 100644 --- a/components/password_manager/core/browser/password_manager_unittest.cc +++ b/components/password_manager/core/browser/password_manager_unittest.cc
@@ -3406,9 +3406,7 @@ EXPECT_CALL(driver_, FormEligibleForGenerationFound(_)) .WillOnce(SaveArg<0>(&form_generation_data)); manager()->ProcessAutofillPredictions(&driver_, {&form_structure}); -#if !defined(OS_IOS) EXPECT_EQ(password_field_id, form_generation_data.new_password_renderer_id); -#endif } // Checks that username is saved on username first flow. @@ -3712,10 +3710,8 @@ .WillOnce(SaveArg<0>(&form_generation_data)); // The change is discovered by PasswordManager. manager()->OnPasswordFormsParsed(&driver_, {form_data}); -#if !defined(OS_IOS) EXPECT_EQ(new_password_field.unique_renderer_id, form_generation_data.new_password_renderer_id); -#endif } INSTANTIATE_TEST_SUITE_P(, PasswordManagerTest, testing::Bool());
diff --git a/components/password_manager/core/browser/password_manager_util.cc b/components/password_manager/core/browser/password_manager_util.cc index d89b885..1408145 100644 --- a/components/password_manager/core/browser/password_manager_util.cc +++ b/components/password_manager/core/browser/password_manager_util.cc
@@ -201,17 +201,13 @@ } base::StringPiece GetSignonRealmWithProtocolExcluded(const PasswordForm& form) { - base::StringPiece signon_realm_protocol_excluded = form.signon_realm; + base::StringPiece signon_realm = form.signon_realm; // Find the web origin (with protocol excluded) in the signon_realm. - const size_t after_protocol = - signon_realm_protocol_excluded.find(form.url.host_piece()); - DCHECK_NE(after_protocol, base::StringPiece::npos); + const size_t after_protocol = signon_realm.find(form.url.host_piece()); // Keep the string starting with position |after_protocol|. - signon_realm_protocol_excluded = - signon_realm_protocol_excluded.substr(after_protocol); - return signon_realm_protocol_excluded; + return signon_realm.substr(std::min(after_protocol, signon_realm.size())); } void FindBestMatches(
diff --git a/components/password_manager/core/common/password_manager_features.cc b/components/password_manager/core/common/password_manager_features.cc index 861797a..099d4b3 100644 --- a/components/password_manager/core/common/password_manager_features.cc +++ b/components/password_manager/core/common/password_manager_features.cc
@@ -66,7 +66,7 @@ // Enables the bulk Password Check feature for signed in users. const base::Feature kPasswordCheck = {"PasswordCheck", -#if defined(OS_ANDROID) || defined(OS_IOS) +#if defined(OS_ANDROID) base::FEATURE_DISABLED_BY_DEFAULT #else base::FEATURE_ENABLED_BY_DEFAULT
diff --git a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureList.java b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureList.java index 540f8b5..79b22ff 100644 --- a/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureList.java +++ b/components/payments/content/android/java/src/org/chromium/components/payments/PaymentFeatureList.java
@@ -25,7 +25,6 @@ public static final String SERVICE_WORKER_PAYMENT_APPS = "ServiceWorkerPaymentApps"; public static final String STRICT_HAS_ENROLLED_AUTOFILL_INSTRUMENT = "StrictHasEnrolledAutofillInstrument"; - public static final String WEB_LAYER_PAYMENTS = "WebLayerPayments"; public static final String WEB_PAYMENTS = "WebPayments"; public static final String WEB_PAYMENTS_ALWAYS_ALLOW_JUST_IN_TIME_PAYMENT_APP = "AlwaysAllowJustInTimePaymentApp";
diff --git a/components/payments/content/android/payment_feature_list.cc b/components/payments/content/android/payment_feature_list.cc index 13a817e..3a105c0 100644 --- a/components/payments/content/android/payment_feature_list.cc +++ b/components/payments/content/android/payment_feature_list.cc
@@ -38,7 +38,6 @@ &features::kWebPaymentsSingleAppUiSkip, &kAndroidAppPaymentUpdateEvents, &kScrollToExpandPaymentHandler, - &kWebLayerPayments, }; const base::Feature* FindFeatureExposedToJava(const std::string& feature_name) { @@ -59,8 +58,6 @@ // TODO(crbug.com/1094549): clean up after being stable. const base::Feature kScrollToExpandPaymentHandler{ "ScrollToExpandPaymentHandler", base::FEATURE_ENABLED_BY_DEFAULT}; -const base::Feature kWebLayerPayments{"WebLayerPayments", - base::FEATURE_DISABLED_BY_DEFAULT}; static jboolean JNI_PaymentFeatureList_IsEnabled( JNIEnv* env,
diff --git a/components/payments/content/android/payment_feature_list.h b/components/payments/content/android/payment_feature_list.h index 207bd4b..2d10c369 100644 --- a/components/payments/content/android/payment_feature_list.h +++ b/components/payments/content/android/payment_feature_list.h
@@ -14,7 +14,6 @@ // Android only payment features in alphabetical order: extern const base::Feature kAndroidAppPaymentUpdateEvents; extern const base::Feature kScrollToExpandPaymentHandler; -extern const base::Feature kWebLayerPayments; } // namespace android } // namespace payments
diff --git a/components/performance_manager/worker_watcher.cc b/components/performance_manager/worker_watcher.cc index ccc1ea95..4f72e27 100644 --- a/components/performance_manager/worker_watcher.cc +++ b/components/performance_manager/worker_watcher.cc
@@ -356,19 +356,117 @@ int64_t version_id, const std::string& client_uuid, const content::ServiceWorkerClientInfo& client_info) { - // TODO(pmonette): Handle service worker clients. + switch (client_info.type()) { + case blink::mojom::ServiceWorkerClientType::kWindow: { + // For window clients, it is necessary to wait until the navigation has + // committed to a render frame host. + bool inserted = client_frames_awaiting_commit_.insert(client_uuid).second; + DCHECK(inserted); + break; + } + case blink::mojom::ServiceWorkerClientType::kDedicatedWorker: { + blink::DedicatedWorkerToken dedicated_worker_token = + client_info.GetDedicatedWorkerToken(); + + bool inserted = service_worker_clients_[version_id] + .emplace(client_uuid, dedicated_worker_token) + .second; + DCHECK(inserted); + + // If the service worker is already started, connect it to the client. + WorkerNodeImpl* service_worker_node = GetServiceWorkerNode(version_id); + if (service_worker_node) + ConnectDedicatedWorkerClient(service_worker_node, + dedicated_worker_token); + break; + } + case blink::mojom::ServiceWorkerClientType::kSharedWorker: { + blink::SharedWorkerToken shared_worker_token = + client_info.GetSharedWorkerToken(); + + bool inserted = service_worker_clients_[version_id] + .emplace(client_uuid, shared_worker_token) + .second; + DCHECK(inserted); + + // If the service worker is already started, connect it to the client. + WorkerNodeImpl* service_worker_node = GetServiceWorkerNode(version_id); + if (service_worker_node) + ConnectSharedWorkerClient(service_worker_node, shared_worker_token); + break; + } + case blink::mojom::ServiceWorkerClientType::kAll: + NOTREACHED(); + break; + } } void WorkerWatcher::OnControlleeRemoved(int64_t version_id, const std::string& client_uuid) { - // TODO(pmonette): Handle service worker clients. + // Nothing to do for a frame client whose navigation never committed. + size_t removed = client_frames_awaiting_commit_.erase(client_uuid); + if (removed) { +#if DCHECK_IS_ON() + // |client_uuid| should not be part of this service worker's clients. + auto it = service_worker_clients_.find(version_id); + if (it != service_worker_clients_.end()) + DCHECK(!base::Contains(it->second, client_uuid)); +#endif // DCHECK_IS_ON() + return; + } + + // First get clients for this worker. + auto it = service_worker_clients_.find(version_id); + DCHECK(it != service_worker_clients_.end()); + + base::flat_map<std::string /*client_uuid*/, ServiceWorkerClient>& clients = + it->second; + + auto it2 = clients.find(client_uuid); + DCHECK(it2 != clients.end()); + const ServiceWorkerClient client = it2->second; + clients.erase(it2); + + if (clients.empty()) + service_worker_clients_.erase(it); + + // Now disconnect the client if the service worker is still running. + WorkerNodeImpl* worker_node = GetServiceWorkerNode(version_id); + if (!worker_node) + return; + + switch (client.type()) { + case blink::mojom::ServiceWorkerClientType::kWindow: + DisconnectFrameClient(worker_node, client.GetRenderFrameHostId()); + break; + case blink::mojom::ServiceWorkerClientType::kDedicatedWorker: + DisconnectDedicatedWorkerClient(worker_node, + client.GetDedicatedWorkerToken()); + break; + case blink::mojom::ServiceWorkerClientType::kSharedWorker: + DisconnectSharedWorkerClient(worker_node, client.GetSharedWorkerToken()); + break; + case blink::mojom::ServiceWorkerClientType::kAll: + NOTREACHED(); + break; + } } void WorkerWatcher::OnControlleeNavigationCommitted( int64_t version_id, const std::string& client_uuid, content::GlobalFrameRoutingId render_frame_host_id) { - // TODO(pmonette): Handle service worker clients. + size_t removed = client_frames_awaiting_commit_.erase(client_uuid); + DCHECK_EQ(removed, 1u); + + bool inserted = service_worker_clients_[version_id] + .emplace(client_uuid, render_frame_host_id) + .second; + DCHECK(inserted); + + WorkerNodeImpl* service_worker_node = GetServiceWorkerNode(version_id); + if (service_worker_node) + ConnectFrameClient(service_worker_node, render_frame_host_id); } void WorkerWatcher::ConnectFrameClient(
diff --git a/components/performance_manager/worker_watcher_unittest.cc b/components/performance_manager/worker_watcher_unittest.cc index 24b15d2..5a9736b 100644 --- a/components/performance_manager/worker_watcher_unittest.cc +++ b/components/performance_manager/worker_watcher_unittest.cc
@@ -306,7 +306,7 @@ // Starts an existing service worker. void StartServiceWorker(int64_t version_id, int worker_process_id); - // Destroys a service shared worker. + // Stops a service shared worker. void StopServiceWorker(int64_t version_id); // Adds a new client to an existing service worker and returns its generated @@ -826,10 +826,7 @@ } // This test creates one service worker with one client frame. -// -// TODO(pmonette): Enable this test when the WorkerWatcher starts tracking -// service worker clients. -TEST_F(WorkerWatcherTest, DISABLED_ServiceWorkerFrameClient) { +TEST_F(WorkerWatcherTest, ServiceWorkerFrameClient) { int render_process_id = process_node_source()->CreateProcessNode(); // Create and start the service worker. @@ -877,8 +874,6 @@ EXPECT_TRUE(graph->NodeInGraph(worker_node)); EXPECT_EQ(worker_node->worker_type(), WorkerNode::WorkerType::kService); EXPECT_EQ(worker_node->process_node(), process_node); - - // Now is it correctly hooked up. EXPECT_TRUE(IsWorkerClient(worker_node, client_frame_node)); })); @@ -927,9 +922,7 @@ service_worker_context()->DestroyServiceWorker(service_worker_version_id); } -// TODO(pmonette): Enable this test when the WorkerWatcher starts tracking -// service worker clients. -TEST_F(WorkerWatcherTest, DISABLED_AllTypesOfServiceWorkerClients) { +TEST_F(WorkerWatcherTest, AllTypesOfServiceWorkerClients) { int render_process_id = process_node_source()->CreateProcessNode(); // Create and start the service worker. @@ -1001,11 +994,7 @@ // starts after it has been assigned a client. In this case, the clients are not // connected to the service worker until it starts. It also tests that when the // service worker stops, its existing clients are also disconnected. -// -// TODO(pmonette): Enable this test when the WorkerWatcher starts tracking -// service worker clients. -TEST_F(WorkerWatcherTest, - DISABLED_ServiceWorkerStartsAndStopsWithExistingClients) { +TEST_F(WorkerWatcherTest, ServiceWorkerStartsAndStopsWithExistingClients) { int render_process_id = process_node_source()->CreateProcessNode(); // Create the worker. @@ -1308,9 +1297,7 @@ EXPECT_TRUE(graph->NodeInGraph(service_worker_node)); EXPECT_TRUE(IsWorkerClient(dedicated_worker_node, client_frame_node)); EXPECT_TRUE(IsWorkerClient(shared_worker_node, client_frame_node)); - // TODO(pmonette): Change this to EXPECT_TRUE() when the WorkerWatcher - // starts tracking service worker clients. - EXPECT_FALSE(IsWorkerClient(service_worker_node, client_frame_node)); + EXPECT_TRUE(IsWorkerClient(service_worker_node, client_frame_node)); })); frame_node_source()->DeleteFrameNode(render_frame_host_id);
diff --git a/components/policy/resources/policy_templates.json b/components/policy/resources/policy_templates.json index da4708c7a..bccb309a 100644 --- a/components/policy/resources/policy_templates.json +++ b/components/policy/resources/policy_templates.json
@@ -22666,7 +22666,7 @@ { 'name': 'SystemProxySettings', 'owners': ['acostinas@google.com', 'pmarko@chromium.org'], - 'future_on': ['chrome_os'], + 'supported_on': ['chrome_os:87-'], 'device_only': True, 'id': 672, 'type': 'dict',
diff --git a/components/policy/resources/policy_templates_it.xtb b/components/policy/resources/policy_templates_it.xtb index 5a45bcc..df5c78e9 100644 --- a/components/policy/resources/policy_templates_it.xtb +++ b/components/policy/resources/policy_templates_it.xtb
@@ -1324,7 +1324,7 @@ Se il criterio non viene impostato (o se viene impostato un URL non valido), <ph name="PRODUCT_NAME" /> non usa il criterio come fonte di regole per il cambio di browser. Nota: questo criterio rimanda a un file XML nello stesso formato del criterio <ph name="IEEM_SITELIST_POLICY" /> di <ph name="IE_PRODUCT_NAME" />. Se viene impostato, le regole vengono caricate da un file XML senza essere condivise con <ph name="IE_PRODUCT_NAME" />. Leggi ulteriori informazioni sul criterio <ph name="IEEM_SITELIST_POLICY" /> di <ph name="IE_PRODUCT_NAME" /> (https://docs.microsoft.com/internet-explorer/ie11-deploy-guide/what-is-enterprise-mode)</translation> -<translation id="2949765875529121431">La configurazione del criterio consente di specificare un elenco di nomi host che sono esenti dalla verifica dei criteri HSTS che potrebbero eseguire l'upgrade delle richieste da http a https. Solo i nomi host con etichetta singola sono consentiti in questo criterio. I nomi host devono essere canonicalizzati: ogni IDN deve essere convertito nel relativo formato A-label e tutte le lettere ASCII devono essere minuscole. Questo criterio viene applicato soltanto ai nomi host specificati e non ai relativi sottodomini.</translation> +<translation id="2949765875529121431">La configurazione del criterio consente di specificare un elenco di nomi host che sono esenti dalla verifica dei criteri HSTS che potrebbero eseguire l'upgrade delle richieste da HTTP a HTTPS. Solo i nomi host con etichetta singola sono consentiti in questo criterio. I nomi host devono essere canonicalizzati: ogni IDN deve essere convertito nel relativo formato A-label e tutte le lettere ASCII devono essere minuscole. Questo criterio viene applicato soltanto ai nomi host specificati e non ai relativi sottodomini.</translation> <translation id="2952347049958405264">Limitazioni:</translation> <translation id="2957047180944828740">Consente di specificare se consentire ai siti web non sicuri di effettuare richieste agli endpoint di rete con un livello di protezione più alto</translation> <translation id="2957506574938329824">Non consentire ad alcun sito di richiedere l'accesso ai dispositivi Bluetooth tramite l'API Web Bluetooth</translation> @@ -1520,7 +1520,7 @@ Se il criterio non viene configurato, la visualizzazione dell'aggiornamento del firmware <ph name="TPM_FIRMWARE_UPDATE_TPM" /> non è disponibile.</translation> <translation id="3235677869770186098">La configurazione del criterio consente di elencare i pattern URL che specificano i siti a cui viene concessa automaticamente l'autorizzazione di accesso a un dispositivo USB con gli ID fornitore e prodotto indicati nella schermata di accesso. Perché il criterio sia valido, ogni elemento nell'elenco richiede entrambi i campi "devices" e "urls". Ogni elemento nel campo "devices" può avere un campo "vendor_id" e un campo "product_id". Se il campo "vendor_id" non viene specificato, il criterio può corrispondere a qualsiasi dispositivo. Se il campo "product_id" non viene specificato, il criterio può corrispondere a qualsiasi dispositivo con l'ID fornitore specificato. Un criterio con un campo "product_id" senza un campo "vendor_id" non è valido. - Il modello di autorizzazione USB utilizza l'URL richiedente e l'URL di incorporamento per consentire all'URL richiedente di accedere al dispositivo USB. L'URL richiedente può essere diverso dall'URL di incorporamento quando il sito richiedente viene caricato in un iframe. Pertanto, il campo "urls" può contenere fino a 2 stringhe URL delimitate da una virgola per specificare rispettivamente l'URL richiedente e l'URL di incorporamento. Se viene specificato un solo URL, l'accesso ai dispositivi USB corrispondenti viene concesso quando l'URL del sito richiedente corrisponde all'URL, a prescindere dallo stato di incorporamento. Se gli URL non sono validi, il criterio viene ignorato. + Il modello di autorizzazione USB utilizza l'URL richiedente e l'URL di incorporamento per consentire all'URL richiedente di accedere al dispositivo USB. L'URL richiedente può essere diverso dall'URL di incorporamento quando il sito richiedente viene caricato in un iframe. Pertanto, il campo "urls" può contenere fino a 2 stringhe URL delimitate da una virgola per specificare rispettivamente l'URL richiedente e l'URL di incorporamento. Se viene specificato un solo URL, l'accesso ai dispositivi USB corrispondenti viene concesso quando l'URL del sito richiedente corrisponde all'URL in questione, a prescindere dallo stato di incorporamento. Se gli URL non sono validi, il criterio viene ignorato. Se il criterio non viene configurato, viene utilizzato il valore predefinito globale per tutti i siti (nessun accesso automatico).</translation> <translation id="3236046242843493070">Pattern URL per consentire installazioni di estensioni, applicazioni e script utente da</translation>
diff --git a/components/policy/resources/policy_templates_tr.xtb b/components/policy/resources/policy_templates_tr.xtb index c9670e76..d4577778 100644 --- a/components/policy/resources/policy_templates_tr.xtb +++ b/components/policy/resources/policy_templates_tr.xtb
@@ -411,6 +411,11 @@ URL kalıpları, https://www.chromium.org/administrators/url-blacklist-filter-format adresinde bulabileceğiniz '<ph name="URL_BLOCKLIST_POLICY_NAME" />' politikasıyla aynı biçimdedir. </translation> <translation id="1645793986494086629">Şema:</translation> +<translation id="1647558381546345298">Politika ayarlanırsa önbelleğe alınan medya dosyalarının diskte depolanması için <ph name="PRODUCT_NAME" /> tarafından kullanılan önbellek boyutu (kullanıcıların --media-cache-size flag'ini belirtip belirtmemesinden bağımsız olarak) yapılandırılır. Bu politikada belirtilen değer kesin bir sınır değil, daha ziyade önbellek sistemi için bir öneridir. Birkaç megabaytın altındaki değerler yukarı yuvarlanır. + + Politika değeri 0 olarak ayarlanırsa varsayılan önbellek boyutu kullanılır ve kullanıcılar bunu değiştiremez. + + Politika ayarlanmadan bırakılırsa varsayılan önbellek boyutu kullanılır ve kullanıcılar --media-cache-size flag'ini belirterek bunu değiştirebilir.</translation> <translation id="1648816843164517573">HSTS politika kontrolünü atlayacak olan isimlerin listesi</translation> <translation id="1654087023995670109">Tarayıcı misafir modunu zorunlu tut</translation> <translation id="1655229863189977773">Disk önbelleği boyutunu bayt olarak ayarla</translation> @@ -1317,6 +1322,7 @@ Politika ayarlanmadan bırakılırsa (veya geçersiz bir URL'ye ayarlanırsa) <ph name="PRODUCT_NAME" />, politikayı tarayıcılar arasında geçiş yapmak için bir kural kaynağı olarak kullanmaz. Not: Bu politika, <ph name="IE_PRODUCT_NAME" /> tarayıcısının <ph name="IEEM_SITELIST_POLICY" /> politikasıyla aynı biçimde bir XML dosyasına yönlendirir. Bu politika, bir XML dosyasından kurallar yükler, ancak bu kuralları <ph name="IE_PRODUCT_NAME" /> ile paylaşmaz. <ph name="IE_PRODUCT_NAME" /> tarayıcısının <ph name="IEEM_SITELIST_POLICY" /> politikası hakkında daha fazla bilgi edinin ( https://docs.microsoft.com/internet-explorer/ie11-deploy-guide/what-is-enterprise-mode)</translation> +<translation id="2949765875529121431">Politika ayarlanırsa istekleri HTTP'den HTTPS'ye yükseltilebilecek HSTS politika kontrolünden muaf tutulan ana makine adlarının bir listesi belirtilir. Bu politikada yalnızca tek etiketli ana makine adlarına izin verilir. Ana makine adları standartlaştırılmalıdır: Tüm IDN'ler, A-etiket biçimine dönüştürülmeli ve tüm ASCII harfleri küçük harf olmalıdır. Bu politika yalnızca belirtilen spesifik ana makine adları için geçerlidir; bu adların alt alanları için geçerli değildir.</translation> <translation id="2952347049958405264">Kısıtlamalar:</translation> <translation id="2957047180944828740">Güvenli olmayan web sitelerinin, daha özel ağ uç noktalarına istekte bulunmasına izin verilip verilmeyeceğini belirtir</translation> <translation id="2957506574938329824">Hiçbir sitenin Web Bluetooth API'sı aracılığıyla Bluetooth hizmetlerine erişim istemesine izin verme</translation> @@ -1425,6 +1431,9 @@ Bu politikanın ayarlansa da ayarlanmasa da, WPAD optimizasyonu ayarı kullanıcılar tarafından değiştirilemez.</translation> <translation id="3072045631333522102">Perakende modunda oturum açma ekranında kullanılacak ekran koruyucu</translation> +<translation id="3072788420987305247">Politika, Etkin değerine ayarlanır veya ayarlanmadan bırakılırsa medya içeriği oynatılırken kullanıcıların cihazı kilitlemesi halinde medya denetimleri kilit ekranında görüntülenir. + + Politika, Devre Dışı değerine ayarlanırsa medya denetimleri kilit ekranında devre dışı bırakılır.</translation> <translation id="3072847235228302527">Bir cihaz yerel hesabı için Hizmet Şartları'nı ayarlama</translation> <translation id="3086995894968271156">Cast Receiver'ı <ph name="PRODUCT_NAME" /> ürününde yapılandırın.</translation> <translation id="3091832372132789233">Öncelikle harici bir güç kaynağına bağlı cihazlar için pili şarj edin.</translation> @@ -1505,6 +1514,11 @@ * 4 olarak ayarlanırsa <ph name="TPM_FIRMWARE_UPDATE_TPM" /> donanım yazılımı kayıt işleminden sonra, kullanıcı oturum açmadan önce güncellenir. Politika ayarlanmadan bırakılırsa <ph name="TPM_FIRMWARE_UPDATE_TPM" /> donanım yazılımı güncellemesi kullanılamaz.</translation> +<translation id="3235677869770186098">Politikanın ayarlanması, giriş ekranında sağlanan tedarikçi ve ürün kimliklerine sahip USB cihazlarına erişmesine otomatik olarak izin verilen siteleri belirten URL kalıplarının listesini oluşturmanıza olanak tanır. Politikanın geçerli olabilmesi için listedeki her öğenin hem "cihazlar" hem de "URL'ler" alanı olması gerekir. "Cihazlar" alanındaki her öğe, "vendor_id" ve "product_id" alanı içerebilir. "Vendor_id" alanının atlanması her cihazla eşleşen bir politika oluşturur. "Product_id" alanının atlanması belirtilen satıcı kimliğiyle her cihazla eşleşen bir politika oluşturur. "Product_id" alanı olup "vendor_id" alanı olmayan politika geçersizdir. + + USB izin modeli, istekte bulunan URL'nin USB cihazına erişmesine izin vermek için istekte bulunan URL'yi ve yerleştirme URL'sini kullanır. İstekte bulunan site bir iFrame içinde yüklendiğinde, istekte bulunan URL yerleştirme URL'sinden farklı olabilir. Dolayısıyla, URL'ler alanı, sırasıyla istekte bulunan URL'yi ve yerleştirme URL'sini belirtmek için virgülle sınırlandırılmış en fazla 2 URL dizesi içerebilir. Yalnızca bir URL belirtilirse yerleştirme durumundan bağımsız olarak bu URL ile eşleşen istekte bulunan sitenin URL'sine karşılık gelen USB cihazlarına erişim izni verilir. URL'ler geçerli olmalıdır; aksi halde, politika yok sayılır. + + Politika ayarlanmadan bırakılırsa genel varsayılan değer tüm siteler için kullanılır (otomatik erişim olmaz).</translation> <translation id="3236046242843493070">Uzantı, uygulama ve kullanıcı komut dosyası yüklemelerine izin veren URL kalıpları</translation> <translation id="3240609035816615922">Yazıcı yapılandırması erişim politikası.</translation> <translation id="324062325008698789">Yazıcılar listesini yapılandırır</translation> @@ -2162,6 +2176,11 @@ <translation id="4157003184375321727">İşletim sistemi ve donanım yazılımı sürümünü rapor et</translation> <translation id="4157594634940419685">Yerel CUPS yazıcılarına erişim izni ver</translation> <translation id="4160962198980004898">Yuvaya yerleştirildiğinde cihaz MAC adresi kaynağı</translation> +<translation id="4166174702671320480">Politika, Etkin değerine ayarlanırsa bir atom grubundan gelen ve o gruptaki en yüksek öncelikle aynı kaynağı paylaşmayan politikalar yok sayılır. + + Politika, Devre Dışı değerine ayarlanırsa hiçbir politika, kaynağı yüzünden yok sayılmaz. Politikalar yalnızca bir çakışma olduğunda ve o politika en yüksek önceliğe sahip olmadığında yok sayılır. + + Bu politika bir bulut kaynağından ayarlanırsa belirli bir kullanıcıyı hedefleyemez.</translation> <translation id="4169692397912242417">Giriş ekranında sözlü geri bildirim erişilebilirlik özelliğini etkinleştirin. Bu politika true (doğru) değerine ayarlanırsa giriş ekranında sözlü geri bildirim her zaman etkinleştirilir. @@ -3362,6 +3381,9 @@ <translation id="5951418260805607969">Disk alanı azaldığında bildirim göster</translation> <translation id="5961137303188584693">Cihazın dahili NIC MAC adresi</translation> <translation id="5966615072639944554">Uzaktan doğrulama API'sını kullanmasına izin verilen uzantılar</translation> +<translation id="5975765799383881158">Politika, Etkin değerine ayarlanır veya ayarlanmadan bırakılırsa kullanıcılar Menü > Yardım > Sorun Bildirin adımlarını veya tuş kombinasyonunu kullanarak Google'a geri bildirim gönderebilir. + + Politika, Devre Dışı değerine ayarlanırsa kullanıcılar Google'a geri bildirim gönderemez.</translation> <translation id="5997543603646547632">Varsayılan olarak 24 saatlik saat biçimini kullan</translation> <translation id="5997846976342452720">Eklenti bulucunun devre dışı bırakılıp bırakılmayacağını belirt (kullanımdan kaldırıldı)</translation> <translation id="5998198091336830580">Bu politika, aşağıdaki atom grubunun bir parçasıdır (yalnızca grupta bulunan en yüksek öncelikli kaynaktan gelen politikalar geçerlidir):</translation> @@ -3961,6 +3983,11 @@ Politikayı Devre dışı değerine ayarlanırsa bunun yerine bir hata mesajı gösterilir.</translation> <translation id="6821268164692776674"><ph name="CLOUD_PRINT_NAME" /> ve "Google Drive'a kaydet" hedefleri</translation> +<translation id="682408981080798691">Politika, Etkin değerine ayarlanır veya ayarlanmadan bırakılırsa Oluşturucu Kod Bütünlüğü etkinleştirilir. + + Bilinmeyen ve zararlı olabilecek kod, <ph name="PRODUCT_NAME" /> ürününün oluşturucu işlemlerine yüklenebileceğinden, politikanın Devre Dışı değerine ayarlanması, <ph name="PRODUCT_NAME" /> ürününün güvenliğini ve kararlılığını olumsuz yönde etkiler. Politika yalnızca <ph name="PRODUCT_NAME" /> ürününün oluşturucu işlemlerinin içinde çalışması gereken üçüncü taraf yazılımı ile uyumluluk sorunları varsa devre dışı bırakılmalıdır. + + Not: İşlem çözüm politikaları hakkında daha fazla bilgi edinin (https://chromium.googlesource.com/chromium/src/+/master/docs/design/sandbox.md#Process-mitigation-policies).</translation> <translation id="6833023569065717572">Politikayı Doğru değerine ayarlarsanız cihazın oturum açma ekranında 24 saatlik saat biçimi kullanılır. Politikayı Yanlış değerine ayarlarsanız cihazın oturum açma ekranında 12 saatlik saat biçimi kullanılır.
diff --git a/components/prefs/pref_change_registrar.cc b/components/prefs/pref_change_registrar.cc index 97e59165..6048ef4 100644 --- a/components/prefs/pref_change_registrar.cc +++ b/components/prefs/pref_change_registrar.cc
@@ -16,6 +16,10 @@ // PrefChangeRegistrar might be subscribed to an OffTheRecordProfileImpl that // has been destroyed. This should not happen any more but be warned. // Feel free to contact battre@chromium.org in case this happens. + // + // This can also happen for non-OTR profiles, when the + // DestroyProfileOnBrowserClose flag is enabled. In that case, contact + // nicolaso@chromium.org. RemoveAll(); }
diff --git a/components/resources/autofill_regex_resources.grdp b/components/resources/autofill_regex_resources.grdp index eb901de..844aaaf 100644 --- a/components/resources/autofill_regex_resources.grdp +++ b/components/resources/autofill_regex_resources.grdp
@@ -1,4 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <grit-part> - <include name="IDR_AUTOFILL_REGEX_JSON" file="../autofill/core/browser/pattern_provider/resources/regex_patterns.json" type="BINDATA" compress="gzip" /> + <include name="IDR_AUTOFILL_REGEX_JSON" file="../autofill/core/browser/pattern_provider/resources/regex_patterns.json" type="BINDATA" compress="brotli" /> </grit-part>
diff --git a/components/shared_highlighting/core/common/BUILD.gn b/components/shared_highlighting/core/common/BUILD.gn index bae2e9bda..45907b4 100644 --- a/components/shared_highlighting/core/common/BUILD.gn +++ b/components/shared_highlighting/core/common/BUILD.gn
@@ -6,6 +6,12 @@ sources = [ "shared_highlighting_metrics.cc", "shared_highlighting_metrics.h", + "text_fragment.cc", + "text_fragment.h", + "text_fragments_constants.cc", + "text_fragments_constants.h", + "text_fragments_utils.cc", + "text_fragments_utils.h", ] deps = [ @@ -17,7 +23,11 @@ source_set("unit_tests") { testonly = true - sources = [ "shared_highlighting_metrics_unittest.cc" ] + sources = [ + "shared_highlighting_metrics_unittest.cc", + "text_fragment_unittest.cc", + "text_fragments_utils_unittest.cc", + ] deps = [ "//base/test:test_support", "//components/shared_highlighting/core/common",
diff --git a/components/shared_highlighting/core/common/DEPS b/components/shared_highlighting/core/common/DEPS index f7016ae5..4b4b95c82 100644 --- a/components/shared_highlighting/core/common/DEPS +++ b/components/shared_highlighting/core/common/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+base/metrics/histogram_functions.h", "+components/search_engines/search_engine_utils.h", + "+net/base", "+services/metrics/public", "+url", ] \ No newline at end of file
diff --git a/components/shared_highlighting/core/common/shared_highlighting_metrics.cc b/components/shared_highlighting/core/common/shared_highlighting_metrics.cc index 30f4136d..d7ff94c1 100644 --- a/components/shared_highlighting/core/common/shared_highlighting_metrics.cc +++ b/components/shared_highlighting/core/common/shared_highlighting_metrics.cc
@@ -21,6 +21,14 @@ } // namespace +void LogLinkGenerationErrorReason(LinkGenerationError reason) { + base::UmaHistogramEnumeration("SharedHighlights.LinkGenerated.Error", reason); +} + +void LogLinkGenerationStatus(bool link_generated) { + base::UmaHistogramBoolean("SharedHighlights.LinkGenerated", link_generated); +} + void LogTextFragmentAmbiguousMatch(bool ambiguous_match) { base::UmaHistogramBoolean("TextFragmentAnchor.AmbiguousMatch", ambiguous_match); @@ -48,17 +56,14 @@ } void LogGenerateErrorTabHidden() { - base::UmaHistogramEnumeration("SharedHighlights.LinkGenerated.Error", - LinkGenerationError::kTabHidden); + LogLinkGenerationErrorReason(LinkGenerationError::kTabHidden); } void LogGenerateErrorOmniboxNavigation() { - base::UmaHistogramEnumeration("SharedHighlights.LinkGenerated.Error", - LinkGenerationError::kOmniboxNavigation); + LogLinkGenerationErrorReason(LinkGenerationError::kOmniboxNavigation); } void LogGenerateErrorTabCrash() { - base::UmaHistogramEnumeration("SharedHighlights.LinkGenerated.Error", - LinkGenerationError::kTabCrash); + LogLinkGenerationErrorReason(LinkGenerationError::kTabCrash); } } // namespace shared_highlighting
diff --git a/components/shared_highlighting/core/common/shared_highlighting_metrics.h b/components/shared_highlighting/core/common/shared_highlighting_metrics.h index a9c1190..461a5f5f 100644 --- a/components/shared_highlighting/core/common/shared_highlighting_metrics.h +++ b/components/shared_highlighting/core/common/shared_highlighting_metrics.h
@@ -38,6 +38,12 @@ kMaxValue = kSearchEngine, }; +// Records the reason why the link generation failed. +void LogLinkGenerationErrorReason(LinkGenerationError reason); + +// Records whether the link generation attempt was successful or not. +void LogLinkGenerationStatus(bool link_generated); + // Records whether an individual text fragment could not be scrolled to because // there was an |ambiguous_match| (generally because more than one matching // passage was found).
diff --git a/components/shared_highlighting/core/common/shared_highlighting_metrics_unittest.cc b/components/shared_highlighting/core/common/shared_highlighting_metrics_unittest.cc index 1185c36..5b86125d0 100644 --- a/components/shared_highlighting/core/common/shared_highlighting_metrics_unittest.cc +++ b/components/shared_highlighting/core/common/shared_highlighting_metrics_unittest.cc
@@ -67,6 +67,51 @@ histogram_tester.ExpectTotalCount("TextFragmentAnchor.SelectorCount", 2); } +TEST(SharedHighlightingMetricsTest, LogLinkGenerationStatus) { + base::HistogramTester histogram_tester; + + LogLinkGenerationStatus(true); + histogram_tester.ExpectUniqueSample("SharedHighlights.LinkGenerated", true, + 1); + + LogLinkGenerationStatus(false); + histogram_tester.ExpectBucketCount("SharedHighlights.LinkGenerated", false, + 1); + histogram_tester.ExpectTotalCount("SharedHighlights.LinkGenerated", 2); +} + +TEST(SharedHighlightingMetricsTest, LogLinkGenerationErrorReason) { + base::HistogramTester histogram_tester; + + LogLinkGenerationErrorReason(LinkGenerationError::kIncorrectSelector); + histogram_tester.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", + LinkGenerationError::kIncorrectSelector, + 1); + + LogLinkGenerationErrorReason(LinkGenerationError::kEmptySelection); + histogram_tester.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", + LinkGenerationError::kEmptySelection, 1); + histogram_tester.ExpectTotalCount("SharedHighlights.LinkGenerated.Error", 2); +} + +TEST(SharedHighlightingMetricsTest, LogAndroidLinkGenerationErrorReason) { + base::HistogramTester histogram_tester; + + LogGenerateErrorTabHidden(); + histogram_tester.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", + LinkGenerationError::kTabHidden, 1); + + LogGenerateErrorOmniboxNavigation(); + histogram_tester.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", + LinkGenerationError::kOmniboxNavigation, + 1); + + LogGenerateErrorTabCrash(); + histogram_tester.ExpectBucketCount("SharedHighlights.LinkGenerated.Error", + LinkGenerationError::kTabCrash, 1); + histogram_tester.ExpectTotalCount("SharedHighlights.LinkGenerated.Error", 3); +} + } // namespace } // namespace shared_highlighting
diff --git a/components/shared_highlighting/core/common/text_fragment.cc b/components/shared_highlighting/core/common/text_fragment.cc new file mode 100644 index 0000000..206bcc44 --- /dev/null +++ b/components/shared_highlighting/core/common/text_fragment.cc
@@ -0,0 +1,73 @@ +// 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. + +#include "components/shared_highlighting/core/common/text_fragment.h" + +#include <sstream> + +#include "base/strings/string_util.h" +#include "components/shared_highlighting/core/common/text_fragments_constants.h" +#include "net/base/escape.h" + +namespace { + +std::string Escape(std::string str) { + std::string escaped = net::EscapeQueryParamValue(str, /*usePlus=*/false); + + // Hyphens must also be escaped since they are used to indicate prefix/suffix + // components. + std::string final_string; + base::ReplaceChars(escaped, "-", "%2D", &final_string); + return final_string; +} + +} // namespace + +namespace shared_highlighting { + +TextFragment::TextFragment(const std::string& text_start) + : TextFragment(text_start, std::string(), std::string(), std::string()) {} + +TextFragment::TextFragment(const std::string& text_start, + const std::string& text_end, + const std::string& prefix, + const std::string& suffix) + : text_start_(text_start), + text_end_(text_end), + prefix_(prefix), + suffix_(suffix) {} + +TextFragment::TextFragment(const TextFragment& other) + : TextFragment(other.text_start(), + other.text_end(), + other.prefix(), + other.suffix()) {} + +TextFragment::~TextFragment() = default; + +std::string TextFragment::ToString() { + if (text_start_.empty()) { + return std::string(); + } + std::stringstream ss; + ss << kFragmentParameterName; + + if (!prefix_.empty()) { + ss << Escape(prefix_) << "-,"; + } + + ss << Escape(text_start_); + + if (!text_end_.empty()) { + ss << "," << Escape(text_end_); + } + + if (!suffix_.empty()) { + ss << ",-" << Escape(suffix_); + } + + return ss.str(); +} + +} // namespace shared_highlighting
diff --git a/components/shared_highlighting/core/common/text_fragment.h b/components/shared_highlighting/core/common/text_fragment.h new file mode 100644 index 0000000..b6dd8ef --- /dev/null +++ b/components/shared_highlighting/core/common/text_fragment.h
@@ -0,0 +1,42 @@ +// 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. + +#ifndef COMPONENTS_SHARED_HIGHLIGHTING_CORE_COMMON_TEXT_FRAGMENT_H_ +#define COMPONENTS_SHARED_HIGHLIGHTING_CORE_COMMON_TEXT_FRAGMENT_H_ + +#include <string> + +namespace shared_highlighting { + +// Class representing a text fragment. +class TextFragment { + public: + explicit TextFragment(const std::string& text_start); + TextFragment(const std::string& text_start, + const std::string& text_end, + const std::string& prefix, + const std::string& suffix); + TextFragment(const TextFragment& other); + ~TextFragment(); + + const std::string text_start() const { return text_start_; } + const std::string text_end() const { return text_end_; } + const std::string prefix() const { return prefix_; } + const std::string suffix() const { return suffix_; } + + // Converts the current fragment to its URL parameter format: + // text=[prefix-,]textStart[,textEnd][,-suffix] + // Returns an empty string if |text_start| does not have a value. + std::string ToString(); + + private: + std::string text_start_; + std::string text_end_; + std::string prefix_; + std::string suffix_; +}; + +} // namespace shared_highlighting + +#endif // COMPONENTS_SHARED_HIGHLIGHTING_CORE_COMMON_TEXT_FRAGMENT_H_
diff --git a/components/shared_highlighting/core/common/text_fragment_unittest.cc b/components/shared_highlighting/core/common/text_fragment_unittest.cc new file mode 100644 index 0000000..e04fdee3 --- /dev/null +++ b/components/shared_highlighting/core/common/text_fragment_unittest.cc
@@ -0,0 +1,53 @@ +// 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. + +#include "components/shared_highlighting/core/common/text_fragment.h" + +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace shared_highlighting { +namespace { + +TEST(TextFragmentTest, FragmentToStringEmpty) { + EXPECT_EQ("", TextFragment("").ToString()); +} + +TEST(TextFragmentTest, FragmentToStringEmptyTextStart) { + EXPECT_EQ("", TextFragment("", "a", "b", "c").ToString()); +} + +TEST(TextFragmentTest, FragmentToStringOnlyTextStart) { + EXPECT_EQ("text=only%20start", TextFragment("only start").ToString()); +} + +TEST(TextFragmentTest, FragmentToStringWithTextEnd) { + EXPECT_EQ("text=only%20start,and%20end", + TextFragment("only start", "and end", "", "").ToString()); +} + +TEST(TextFragmentTest, FragmentToStringWithPrefix) { + EXPECT_EQ("text=and%20prefix-,only%20start", + TextFragment("only start", "", "and prefix", "").ToString()); +} + +TEST(TextFragmentTest, FragmentToStringWithPrefixAndSuffix) { + EXPECT_EQ( + "text=and%20prefix-,only%20start,-and%20suffix", + TextFragment("only start", "", "and prefix", "and suffix").ToString()); +} + +TEST(TextFragmentTest, FragmentToStringAllWithSpecialCharacters) { + TextFragment test_fragment("text, Start-&", "end of, & Text-", "pre-fix&, !", + "suff,i,x-+&"); + EXPECT_EQ( + "text=pre%2Dfix%26%2C%20!-," + "text%2C%20Start%2D%26" + ",end%20of%2C%20%26%20Text%2D" + ",-suff%2Ci%2Cx%2D%2B%26", + test_fragment.ToString()); +} + +} // namespace +} // namespace shared_highlighting
diff --git a/components/shared_highlighting/core/common/text_fragments_constants.cc b/components/shared_highlighting/core/common/text_fragments_constants.cc new file mode 100644 index 0000000..753d237 --- /dev/null +++ b/components/shared_highlighting/core/common/text_fragments_constants.cc
@@ -0,0 +1,13 @@ +// 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. + +#include "components/shared_highlighting/core/common/text_fragments_constants.h" + +namespace shared_highlighting { + +const char kFragmentsUrlDelimiter[] = ":~:"; + +const char kFragmentParameterName[] = "text="; + +} // namespace shared_highlighting
diff --git a/components/shared_highlighting/core/common/text_fragments_constants.h b/components/shared_highlighting/core/common/text_fragments_constants.h new file mode 100644 index 0000000..b427f76 --- /dev/null +++ b/components/shared_highlighting/core/common/text_fragments_constants.h
@@ -0,0 +1,18 @@ +// 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. + +#ifndef COMPONENTS_SHARED_HIGHLIGHTING_CORE_COMMON_TEXT_FRAGMENTS_CONSTANTS_H_ +#define COMPONENTS_SHARED_HIGHLIGHTING_CORE_COMMON_TEXT_FRAGMENTS_CONSTANTS_H_ + +namespace shared_highlighting { + +// Delimiter indicating the start of the text fragments in a URL. +extern const char kFragmentsUrlDelimiter[]; + +// Parameter name for a single text fragment in a URL. +extern const char kFragmentParameterName[]; + +} // namespace shared_highlighting + +#endif // COMPONENTS_SHARED_HIGHLIGHTING_CORE_COMMON_TEXT_FRAGMENTS_CONSTANTS_H_
diff --git a/components/shared_highlighting/core/common/text_fragments_utils.cc b/components/shared_highlighting/core/common/text_fragments_utils.cc new file mode 100644 index 0000000..4cf2200 --- /dev/null +++ b/components/shared_highlighting/core/common/text_fragments_utils.cc
@@ -0,0 +1,51 @@ +// 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. + +#include "components/shared_highlighting/core/common/text_fragments_utils.h" + +#include <sstream> + +#include "base/strings/string_util.h" +#include "components/shared_highlighting/core/common/text_fragment.h" +#include "components/shared_highlighting/core/common/text_fragments_constants.h" + +namespace shared_highlighting { + +GURL AppendFragmentDirectives(const GURL& base_url, + std::vector<TextFragment> fragments) { + if (!base_url.is_valid()) { + return GURL(); + } + + std::vector<std::string> fragment_strings; + for (auto it = std::begin(fragments); it != std::end(fragments); ++it) { + std::string fragment_string = (*it).ToString(); + if (!fragment_string.empty()) { + fragment_strings.push_back(fragment_string); + } + } + + std::string fragments_string = base::JoinString(fragment_strings, "&"); + if (fragments_string.empty()) { + return base_url; + } + + std::string new_ref = base_url.ref(); + if (new_ref.find(kFragmentsUrlDelimiter) == std::string::npos) { + new_ref += kFragmentsUrlDelimiter; + } else { + // The URL already had the :~: delimiter, so prepare appending the new + // fragments by appending an ampersand beforehand. + new_ref += "&"; + } + + new_ref += fragments_string; + + GURL::Replacements replacements; + replacements.SetRef(new_ref.c_str(), url::Component(0, new_ref.size())); + + return base_url.ReplaceComponents(replacements); +} + +} // namespace shared_highlighting
diff --git a/components/shared_highlighting/core/common/text_fragments_utils.h b/components/shared_highlighting/core/common/text_fragments_utils.h new file mode 100644 index 0000000..a11a436 --- /dev/null +++ b/components/shared_highlighting/core/common/text_fragments_utils.h
@@ -0,0 +1,23 @@ +// 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. + +#ifndef COMPONENTS_SHARED_HIGHLIGHTING_CORE_COMMON_TEXT_FRAGMENTS_UTILS_H_ +#define COMPONENTS_SHARED_HIGHLIGHTING_CORE_COMMON_TEXT_FRAGMENTS_UTILS_H_ + +#include <vector> + +#include "url/gurl.h" + +namespace shared_highlighting { + +class TextFragment; + +// Appends a set of text |fragments| with the correct format to the given +// |base_url|. Returns an empty GURL if |base_url| is invalid. +GURL AppendFragmentDirectives(const GURL& base_url, + std::vector<TextFragment> fragments); + +} // namespace shared_highlighting + +#endif // COMPONENTS_SHARED_HIGHLIGHTING_CORE_COMMON_TEXT_FRAGMENTS_UTILS_H_
diff --git a/components/shared_highlighting/core/common/text_fragments_utils_unittest.cc b/components/shared_highlighting/core/common/text_fragments_utils_unittest.cc new file mode 100644 index 0000000..d09263c2 --- /dev/null +++ b/components/shared_highlighting/core/common/text_fragments_utils_unittest.cc
@@ -0,0 +1,67 @@ +// 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. + +#include "components/shared_highlighting/core/common/text_fragments_utils.h" + +#include "components/shared_highlighting/core/common/text_fragment.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "url/gurl.h" + +namespace shared_highlighting { +namespace { + +TEST(TextFragmentsUtilsTest, AppendFragmentDirectivesOneFragment) { + GURL base_url("https://www.chromium.org"); + TextFragment test_fragment("only start"); + + GURL created_url = AppendFragmentDirectives(base_url, {test_fragment}); + EXPECT_EQ("https://www.chromium.org/#:~:text=only%20start", + created_url.spec()); +} + +TEST(TextFragmentsUtilsTest, AppendFragmentDirectivesURLWithPound) { + GURL base_url("https://www.chromium.org/#"); + TextFragment test_fragment("only start"); + + GURL created_url = AppendFragmentDirectives(base_url, {test_fragment}); + EXPECT_EQ("https://www.chromium.org/#:~:text=only%20start", + created_url.spec()); +} + +TEST(TextFragmentsUtilsTest, AppendFragmentDirectivesURLWithPoundAndValue) { + GURL base_url("https://www.chromium.org/#SomeAnchor"); + TextFragment test_fragment("only start"); + + GURL created_url = AppendFragmentDirectives(base_url, {test_fragment}); + EXPECT_EQ("https://www.chromium.org/#SomeAnchor:~:text=only%20start", + created_url.spec()); +} + +TEST(TextFragmentsUtilsTest, + AppendFragmentDirectivesURLWithPoundAndExistingFragment) { + GURL base_url("https://www.chromium.org/#SomeAnchor:~:text=some%20value"); + TextFragment test_fragment("only start"); + + GURL created_url = AppendFragmentDirectives(base_url, {test_fragment}); + EXPECT_EQ( + "https://www.chromium.org/" + "#SomeAnchor:~:text=some%20value&text=only%20start", + created_url.spec()); +} + +TEST(TextFragmentsUtilsTest, AppendFragmentDirectivesTwoFragments) { + GURL base_url("https://www.chromium.org"); + TextFragment first_test_fragment("only start"); + TextFragment second_test_fragment("only,- start #2"); + + GURL created_url = AppendFragmentDirectives( + base_url, {first_test_fragment, second_test_fragment}); + EXPECT_EQ( + "https://www.chromium.org/" + "#:~:text=only%20start&text=only%2C%2D%20start%20%232", + created_url.spec()); +} + +} // namespace +} // namespace shared_highlighting
diff --git a/components/strings/components_strings_iw.xtb b/components/strings/components_strings_iw.xtb index 858a9521..bcf9135 100644 --- a/components/strings/components_strings_iw.xtb +++ b/components/strings/components_strings_iw.xtb
@@ -414,6 +414,7 @@ <translation id="2609632851001447353">וריאציות</translation> <translation id="2618023639789766142">C10 (Envelope)</translation> <translation id="2625385379895617796">השעון שלך מקדים</translation> +<translation id="2629325967560697240">כדי ליהנות מאבטחה ברמה הגבוהה ביותר ב-Chrome, יש <ph name="BEGIN_ENHANCED_PROTECTION_LINK" />להפעיל את ההגנה המשופרת<ph name="END_ENHANCED_PROTECTION_LINK" /></translation> <translation id="2634124572758952069">לא ניתן היה למצוא את כתובת ה-IP של השרת של <ph name="HOST_NAME" />.</translation> <translation id="2639739919103226564">סטטוס:</translation> <translation id="2649204054376361687"><ph name="CITY" />, <ph name="COUNTRY" /></translation>
diff --git a/components/strings/components_strings_kk.xtb b/components/strings/components_strings_kk.xtb index 0f22323..dd01563 100644 --- a/components/strings/components_strings_kk.xtb +++ b/components/strings/components_strings_kk.xtb
@@ -414,7 +414,7 @@ <translation id="2609632851001447353">Нұсқалар</translation> <translation id="2618023639789766142">C10 (Envelope)</translation> <translation id="2625385379895617796">Сағатыңыз алда</translation> -<translation id="2629325967560697240">Chrome-ның ең жоғары деңгейдегі қауіпсіздігіне ие болу үшін <ph name="BEGIN_ENHANCED_PROTECTION_LINK" />жақсартылған қорғанысты<ph name="END_ENHANCED_PROTECTION_LINK" /> қосыңыз.</translation> +<translation id="2629325967560697240">Chrome-ның ең жоғарғы деңгейдегі қауіпсіздігіне ие болу үшін <ph name="BEGIN_ENHANCED_PROTECTION_LINK" />жақсартылған қорғанысты<ph name="END_ENHANCED_PROTECTION_LINK" /> қосыңыз.</translation> <translation id="2634124572758952069"><ph name="HOST_NAME" /> серверінің IP мекенжайын табу мүмкін емес.</translation> <translation id="2639739919103226564">Күйі:</translation> <translation id="2649204054376361687"><ph name="CITY" />, <ph name="COUNTRY" /></translation>
diff --git a/components/strings/components_strings_tr.xtb b/components/strings/components_strings_tr.xtb index 120f6fb..2d501e9 100644 --- a/components/strings/components_strings_tr.xtb +++ b/components/strings/components_strings_tr.xtb
@@ -411,6 +411,7 @@ <translation id="2609632851001447353">Varyasyonlar</translation> <translation id="2618023639789766142">C10 (Zarf)</translation> <translation id="2625385379895617796">Saatiniz ileri</translation> +<translation id="2629325967560697240">Chrome’un sağladığı en yüksek güvenlik düzeyinden faydalanmak için <ph name="BEGIN_ENHANCED_PROTECTION_LINK" />gelişmiş korumayı açın<ph name="END_ENHANCED_PROTECTION_LINK" /></translation> <translation id="2634124572758952069"><ph name="HOST_NAME" /> ana makinesinin sunucu IP adresi bulunamadı.</translation> <translation id="2639739919103226564">Durum:</translation> <translation id="2649204054376361687"><ph name="CITY" />, <ph name="COUNTRY" /></translation>
diff --git a/components/sync/BUILD.gn b/components/sync/BUILD.gn index 1ac42fc..d71f0852 100644 --- a/components/sync/BUILD.gn +++ b/components/sync/BUILD.gn
@@ -410,7 +410,7 @@ "driver/backend_migrator_unittest.cc", "driver/data_type_manager_impl_unittest.cc", "driver/glue/sync_engine_impl_unittest.cc", - "driver/model_association_manager_unittest.cc", + "driver/model_load_manager_unittest.cc", "driver/model_type_controller_unittest.cc", "driver/passphrase_type_metrics_provider_unittest.cc", "driver/profile_sync_service_startup_unittest.cc",
diff --git a/components/sync/driver/BUILD.gn b/components/sync/driver/BUILD.gn index 85cb000..4f8b54f 100644 --- a/components/sync/driver/BUILD.gn +++ b/components/sync/driver/BUILD.gn
@@ -24,8 +24,8 @@ "glue/sync_engine_backend.h", "glue/sync_engine_impl.cc", "glue/sync_engine_impl.h", - "model_association_manager.cc", - "model_association_manager.h", + "model_load_manager.cc", + "model_load_manager.h", "model_type_controller.cc", "model_type_controller.h", "non_ui_syncable_service_based_model_type_controller.cc",
diff --git a/components/sync/driver/data_type_manager_impl.cc b/components/sync/driver/data_type_manager_impl.cc index 143dadc9..938b8100 100644 --- a/components/sync/driver/data_type_manager_impl.cc +++ b/components/sync/driver/data_type_manager_impl.cc
@@ -70,7 +70,7 @@ state_(DataTypeManager::STOPPED), needs_reconfigure_(false), debug_info_listener_(debug_info_listener), - model_association_manager_(controllers, this), + model_load_manager_(controllers, this), observer_(observer), encryption_handler_(encryption_handler), download_started_(false) { @@ -127,14 +127,14 @@ break; case DataTypeController::PreconditionState::kMustStopAndClearData: - model_association_manager_.StopDatatype( + model_load_manager_.StopDatatype( type, DISABLE_SYNC, SyncError(FROM_HERE, syncer::SyncError::DATATYPE_POLICY_ERROR, "Datatype preconditions not met.", type)); break; case DataTypeController::PreconditionState::kMustStopAndKeepData: - model_association_manager_.StopDatatype( + model_load_manager_.StopDatatype( type, STOP_SYNC, SyncError(FROM_HERE, syncer::SyncError::UNREADY_ERROR, "Data type is unready.", type)); @@ -336,7 +336,7 @@ association_types_queue_ = base::queue<AssociationTypesInfo>(); download_started_ = false; - model_association_manager_.Initialize( + model_load_manager_.Initialize( /*desired_types=*/last_enabled_types_, /*preferred_types=*/last_requested_types_, last_requested_context_); } @@ -729,7 +729,7 @@ needs_reconfigure_ = true; last_requested_context_.reason = GetReasonForProgrammaticReconfigure(last_requested_context_.reason); - // Do this asynchronously so the ModelAssociationManager has a chance to + // Do this asynchronously so the ModelLoadManager has a chance to // finish stopping this type, otherwise DeactivateDataType() and Stop() // end up getting called twice on the controller. base::SequencedTaskRunnerHandle::Get()->PostTask( @@ -804,7 +804,7 @@ // Stop all data types. This may trigger association callback but the // callback will do nothing because state is set to STOPPING above. - model_association_manager_.Stop(reason); + model_load_manager_.Stop(reason); // Individual data type controllers might still be STOPPING, but we don't // reflect that in |state_| because, for all practical matters, the manager is
diff --git a/components/sync/driver/data_type_manager_impl.h b/components/sync/driver/data_type_manager_impl.h index 17a228b..e375ace 100644 --- a/components/sync/driver/data_type_manager_impl.h +++ b/components/sync/driver/data_type_manager_impl.h
@@ -18,7 +18,7 @@ #include "base/time/time.h" #include "components/sync/base/weak_handle.h" #include "components/sync/driver/configure_context.h" -#include "components/sync/driver/model_association_manager.h" +#include "components/sync/driver/model_load_manager.h" #include "components/sync/engine/model_type_configurer.h" namespace syncer { @@ -30,7 +30,7 @@ struct DataTypeConfigurationStats; class DataTypeManagerImpl : public DataTypeManager, - public ModelAssociationManagerDelegate { + public ModelLoadManagerDelegate { public: DataTypeManagerImpl( ModelTypeSet initial_types, @@ -55,17 +55,11 @@ ModelTypeSet GetPurgedDataTypes() const override; State state() const override; - // |ModelAssociationManagerDelegate| implementation. + // |ModelLoadManagerDelegate| implementation. void OnAllDataTypesReadyForConfigure() override; void OnSingleDataTypeWillStop(ModelType type, const SyncError& error) override; - // Used by unit tests. TODO(sync) : This would go away if we made - // this class be able to do Dependency injection. crbug.com/129212. - ModelAssociationManager* GetModelAssociationManagerForTesting() { - return &model_association_manager_; - } - protected: // Returns the priority types (control + priority user types). // Virtual for overriding during tests. @@ -96,7 +90,7 @@ // Those types that were already downloaded and didn't have an error at // configuration time. Corresponds with AssociationTypesInfo's // |ready_types|. These types can start associating as soon as the - // ModelAssociationManager is not busy. + // ModelLoadManager is not busy. READY_AT_CONFIG, // All other types, including first time sync types and those that have // encountered an error. These types must wait until the syncer has done @@ -193,7 +187,7 @@ ConfigureContext last_requested_context_; // A set of types that were enabled at the time initialization with the - // |model_association_manager_| was last attempted. + // |model_load_manager_| was last attempted. ModelTypeSet last_enabled_types_; // A set of types that should be redownloaded even if initial sync is @@ -215,7 +209,7 @@ const WeakHandle<DataTypeDebugInfoListener> debug_info_listener_; // The manager that handles the model association of the individual types. - ModelAssociationManager model_association_manager_; + ModelLoadManager model_load_manager_; // DataTypeManager must have only one observer -- the ProfileSyncService that // created it and manages its lifetime. @@ -267,7 +261,7 @@ // Association and time stats of data type configuration. std::map<ModelType, DataTypeConfigurationStats> configuration_stats_; - // Configuration process is started when ModelAssociationManager notifies + // Configuration process is started when ModelLoadManager notifies // DataTypeManager that all types are ready for configure. // This flag ensures that this process is started only once. bool download_started_;
diff --git a/components/sync/driver/model_association_manager.cc b/components/sync/driver/model_load_manager.cc similarity index 79% rename from components/sync/driver/model_association_manager.cc rename to components/sync/driver/model_load_manager.cc index d65251d91..dd6a56e 100644 --- a/components/sync/driver/model_association_manager.cc +++ b/components/sync/driver/model_load_manager.cc
@@ -2,10 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/sync/driver/model_association_manager.h" - -#include <stddef.h> -#include <stdint.h> +#include "components/sync/driver/model_load_manager.h" #include <map> #include <utility> @@ -26,8 +23,10 @@ DEVICE_INFO, PROXY_TABS, // Listed for completeness. - // Kick off the association of the non-UI types first so they can associate - // in parallel with the UI types. + // Kick off the loading of the non-UI types first so they can load in + // parallel with the UI types. + // TODO(crbug.com/1102837): Evaluate whether this still makes sense. Loading + // is non-blocking, so the order of kicking things off shouldn't matter. PASSWORDS, AUTOFILL, AUTOFILL_PROFILE, AUTOFILL_WALLET_DATA, AUTOFILL_WALLET_METADATA, AUTOFILL_WALLET_OFFER, EXTENSION_SETTINGS, APP_SETTINGS, TYPED_URLS, HISTORY_DELETE_DIRECTIVES, @@ -50,16 +49,16 @@ } // namespace -ModelAssociationManager::ModelAssociationManager( +ModelLoadManager::ModelLoadManager( const DataTypeController::TypeMap* controllers, - ModelAssociationManagerDelegate* processor) + ModelLoadManagerDelegate* processor) : controllers_(controllers), delegate_(processor) {} -ModelAssociationManager::~ModelAssociationManager() = default; +ModelLoadManager::~ModelLoadManager() = default; -void ModelAssociationManager::Initialize(ModelTypeSet desired_types, - ModelTypeSet preferred_types, - const ConfigureContext& context) { +void ModelLoadManager::Initialize(ModelTypeSet desired_types, + ModelTypeSet preferred_types, + const ConfigureContext& context) { // |desired_types| must be a subset of |preferred_types|. DCHECK(preferred_types.HasAll(desired_types)); @@ -80,12 +79,12 @@ } } - DVLOG(1) << "ModelAssociationManager: Initializing for " + DVLOG(1) << "ModelLoadManager: Initializing for " << ModelTypeSetToString(desired_types_); notified_about_ready_for_configure_ = false; - DVLOG(1) << "ModelAssociationManager: Stopping disabled types."; + DVLOG(1) << "ModelLoadManager: Stopping disabled types."; std::map<DataTypeController*, ShutdownReason> types_to_stop; for (const auto& type_and_dtc : *controllers_) { DataTypeController* dtc = type_and_dtc.second.get(); @@ -117,22 +116,21 @@ // TODO(mastiz): Add test coverage to this waiting logic, including the // case where the datatype is STOPPING when this function is called. base::RepeatingClosure barrier_closure = base::BarrierClosure( - types_to_stop.size(), - base::BindOnce(&ModelAssociationManager::LoadDesiredTypes, - weak_ptr_factory_.GetWeakPtr())); + types_to_stop.size(), base::BindOnce(&ModelLoadManager::LoadDesiredTypes, + weak_ptr_factory_.GetWeakPtr())); for (const auto& dtc_and_reason : types_to_stop) { DataTypeController* dtc = dtc_and_reason.first; const ShutdownReason reason = dtc_and_reason.second; - DVLOG(1) << "ModelAssociationManager: stop " << dtc->name() << " due to " + DVLOG(1) << "ModelLoadManager: stop " << dtc->name() << " due to " << ShutdownReasonToString(reason); StopDatatypeImpl(SyncError(), reason, dtc, barrier_closure); } } -void ModelAssociationManager::StopDatatype(ModelType type, - ShutdownReason shutdown_reason, - SyncError error) { +void ModelLoadManager::StopDatatype(ModelType type, + ShutdownReason shutdown_reason, + SyncError error) { DCHECK(error.IsSet()); desired_types_.Remove(type); @@ -146,7 +144,7 @@ NotifyDelegateIfReadyForConfigure(); } -void ModelAssociationManager::StopDatatypeImpl( +void ModelLoadManager::StopDatatypeImpl( const SyncError& error, ShutdownReason shutdown_reason, DataTypeController* dtc, @@ -162,7 +160,7 @@ dtc->Stop(shutdown_reason, std::move(callback)); } -void ModelAssociationManager::LoadDesiredTypes() { +void ModelLoadManager::LoadDesiredTypes() { // Load in kStartOrder. for (ModelType type : kStartOrder) { if (!desired_types_.Has(type)) @@ -174,17 +172,16 @@ DCHECK_NE(DataTypeController::STOPPING, dtc->state()); if (dtc->state() == DataTypeController::NOT_RUNNING) { DCHECK(!loaded_types_.Has(dtc->type())); - dtc->LoadModels( - configure_context_, - base::BindRepeating(&ModelAssociationManager::ModelLoadCallback, - weak_ptr_factory_.GetWeakPtr())); + dtc->LoadModels(configure_context_, + base::BindRepeating(&ModelLoadManager::ModelLoadCallback, + weak_ptr_factory_.GetWeakPtr())); } } // It's possible that all models are already loaded. NotifyDelegateIfReadyForConfigure(); } -void ModelAssociationManager::Stop(ShutdownReason shutdown_reason) { +void ModelLoadManager::Stop(ShutdownReason shutdown_reason) { // Ignore callbacks from controllers. weak_ptr_factory_.InvalidateWeakPtrs(); @@ -196,7 +193,7 @@ // We don't really wait until all datatypes have been fully stopped, which // is only required (and in fact waited for) when Initialize() is called. StopDatatypeImpl(SyncError(), shutdown_reason, dtc, base::DoNothing()); - DVLOG(1) << "ModelAssociationManager: Stopped " << dtc->name(); + DVLOG(1) << "ModelLoadManager: Stopped " << dtc->name(); } } @@ -204,13 +201,13 @@ loaded_types_.Clear(); } -void ModelAssociationManager::ModelLoadCallback(ModelType type, - const SyncError& error) { - DVLOG(1) << "ModelAssociationManager: ModelLoadCallback for " +void ModelLoadManager::ModelLoadCallback(ModelType type, + const SyncError& error) { + DVLOG(1) << "ModelLoadManager: ModelLoadCallback for " << ModelTypeToString(type); if (error.IsSet()) { - DVLOG(1) << "ModelAssociationManager: Type encountered an error."; + DVLOG(1) << "ModelLoadManager: Type encountered an error."; desired_types_.Remove(type); DataTypeController* dtc = controllers_->find(type)->second.get(); StopDatatypeImpl(error, STOP_SYNC, dtc, base::DoNothing()); @@ -228,7 +225,7 @@ NotifyDelegateIfReadyForConfigure(); } -void ModelAssociationManager::NotifyDelegateIfReadyForConfigure() { +void ModelLoadManager::NotifyDelegateIfReadyForConfigure() { if (notified_about_ready_for_configure_) return;
diff --git a/components/sync/driver/model_association_manager.h b/components/sync/driver/model_load_manager.h similarity index 66% rename from components/sync/driver/model_association_manager.h rename to components/sync/driver/model_load_manager.h index a934082..02517ca 100644 --- a/components/sync/driver/model_association_manager.h +++ b/components/sync/driver/model_load_manager.h
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ -#define COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ +#ifndef COMPONENTS_SYNC_DRIVER_MODEL_LOAD_MANAGER_H_ +#define COMPONENTS_SYNC_DRIVER_MODEL_LOAD_MANAGER_H_ #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -15,38 +15,36 @@ struct ConfigureContext; -// Interface for ModelAssociationManager to pass the results of async operations +// Interface for ModelLoadManager to pass the results of async operations // back to DataTypeManager. -class ModelAssociationManagerDelegate { +class ModelLoadManagerDelegate { public: // Called when all desired types are loaded, i.e. are ready to be configured // with ModelTypeConfigurer. A data type is ready when its progress marker is // available, which is the case once the local model has been loaded. // This function is called at most once after each call to - // ModelAssociationManager::Initialize(). + // ModelLoadManager::Initialize(). virtual void OnAllDataTypesReadyForConfigure() = 0; - // Called when the ModelAssociationManager has decided it must stop |type|, - // likely because it is no longer a desired data type, sync is shutting down, - // or some error occurred during loading. + // Called when the ModelLoadManager has decided it must stop |type|, likely + // because it is no longer a desired data type, sync is shutting down, or some + // error occurred during loading. virtual void OnSingleDataTypeWillStop(ModelType type, const SyncError& error) = 0; - virtual ~ModelAssociationManagerDelegate() = default; + virtual ~ModelLoadManagerDelegate() = default; }; -// |ModelAssociationManager| instructs DataTypeControllers to load models and -// to stop (DataTypeManager is responsible for activating/deactivating data -// types). Since the operations are async it uses an interface to inform -// DataTypeManager of the results of the operations. +// |ModelLoadManager| instructs DataTypeControllers to load models and to stop +// (DataTypeManager is responsible for activating/deactivating data types). +// Since the operations are async it uses an interface to inform DataTypeManager +// of the results of the operations. // This class is owned by DataTypeManager. -// TODO(crbug.com/1102837): Association was a Directory concept, this class -// should disappear or be refactored. -class ModelAssociationManager { +class ModelLoadManager { public: - ModelAssociationManager(const DataTypeController::TypeMap* controllers, - ModelAssociationManagerDelegate* delegate); - virtual ~ModelAssociationManager(); + ModelLoadManager(const DataTypeController::TypeMap* controllers, + ModelLoadManagerDelegate* delegate); + virtual ~ModelLoadManager(); // Stops any data types that are *not* in |desired_types|, then kicks off // loading of all |desired_types|. @@ -87,8 +85,8 @@ // Set of all registered controllers. const DataTypeController::TypeMap* const controllers_; - // The delegate in charge of handling model association results. - ModelAssociationManagerDelegate* const delegate_; + // The delegate in charge of handling model load results. + ModelLoadManagerDelegate* const delegate_; ConfigureContext configure_context_; @@ -100,11 +98,11 @@ bool notified_about_ready_for_configure_ = false; - base::WeakPtrFactory<ModelAssociationManager> weak_ptr_factory_{this}; + base::WeakPtrFactory<ModelLoadManager> weak_ptr_factory_{this}; - DISALLOW_COPY_AND_ASSIGN(ModelAssociationManager); + DISALLOW_COPY_AND_ASSIGN(ModelLoadManager); }; } // namespace syncer -#endif // COMPONENTS_SYNC_DRIVER_MODEL_ASSOCIATION_MANAGER_H__ +#endif // COMPONENTS_SYNC_DRIVER_MODEL_LOAD_MANAGER_H_
diff --git a/components/sync/driver/model_association_manager_unittest.cc b/components/sync/driver/model_load_manager_unittest.cc similarity index 73% rename from components/sync/driver/model_association_manager_unittest.cc rename to components/sync/driver/model_load_manager_unittest.cc index 4336733..2f1d542a 100644 --- a/components/sync/driver/model_association_manager_unittest.cc +++ b/components/sync/driver/model_load_manager_unittest.cc
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "components/sync/driver/model_association_manager.h" +#include "components/sync/driver/model_load_manager.h" #include <memory> @@ -29,11 +29,10 @@ } // namespace -class MockModelAssociationManagerDelegate - : public ModelAssociationManagerDelegate { +class MockModelLoadManagerDelegate : public ModelLoadManagerDelegate { public: - MockModelAssociationManagerDelegate() = default; - ~MockModelAssociationManagerDelegate() override = default; + MockModelLoadManagerDelegate() = default; + ~MockModelLoadManagerDelegate() override = default; MOCK_METHOD(void, OnAllDataTypesReadyForConfigure, (), (override)); MOCK_METHOD(void, OnSingleDataTypeWillStop, @@ -41,9 +40,9 @@ (override)); }; -class SyncModelAssociationManagerTest : public testing::Test { +class SyncModelLoadManagerTest : public testing::Test { public: - SyncModelAssociationManagerTest() = default; + SyncModelLoadManagerTest() = default; FakeDataTypeController* GetController(ModelType model_type) { auto it = controllers_.find(model_type); @@ -56,16 +55,16 @@ protected: base::test::SingleThreadTaskEnvironment task_environment_{ base::test::SingleThreadTaskEnvironment::MainThreadType::UI}; - testing::NiceMock<MockModelAssociationManagerDelegate> delegate_; + testing::NiceMock<MockModelLoadManagerDelegate> delegate_; DataTypeController::TypeMap controllers_; }; -// Start a type and make sure ModelAssociationManager callst the |Start| +// Start a type and make sure ModelLoadManager callst the |Start| // method and calls the callback when it is done. -TEST_F(SyncModelAssociationManagerTest, SimpleModelStart) { +TEST_F(SyncModelLoadManagerTest, SimpleModelStart) { controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); controllers_[APPS] = std::make_unique<FakeDataTypeController>(APPS); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet types(BOOKMARKS, APPS); EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); @@ -73,9 +72,9 @@ EXPECT_EQ(GetController(APPS)->state(), DataTypeController::NOT_RUNNING); // Initialize() kicks off model loading. - model_association_manager.Initialize(/*desired_types=*/types, - /*preferred_types=*/types, - BuildConfigureContext()); + model_load_manager.Initialize(/*desired_types=*/types, + /*preferred_types=*/types, + BuildConfigureContext()); EXPECT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); @@ -83,53 +82,53 @@ } // Start a type, let it finish and then call stop. -TEST_F(SyncModelAssociationManagerTest, StopAfterFinish) { +TEST_F(SyncModelLoadManagerTest, StopAfterFinish) { controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet types; types.Put(BOOKMARKS); EXPECT_CALL(delegate_, OnSingleDataTypeWillStop(BOOKMARKS, _)); - model_association_manager.Initialize(/*desired_types=*/types, - /*preferred_types=*/types, - BuildConfigureContext()); + model_load_manager.Initialize(/*desired_types=*/types, + /*preferred_types=*/types, + BuildConfigureContext()); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); - model_association_manager.Stop(STOP_SYNC); + model_load_manager.Stop(STOP_SYNC); EXPECT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::NOT_RUNNING); EXPECT_EQ(0, GetController(BOOKMARKS)->model()->clear_metadata_call_count()); } // Test that model that failed to load between initialization and association // is reported and stopped properly. -TEST_F(SyncModelAssociationManagerTest, ModelLoadFailBeforeAssociationStart) { +TEST_F(SyncModelLoadManagerTest, ModelLoadFailBeforeAssociationStart) { controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); GetController(BOOKMARKS)->model()->SimulateModelError( ModelError(FROM_HERE, "Test error")); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet types; types.Put(BOOKMARKS); EXPECT_CALL(delegate_, OnSingleDataTypeWillStop(BOOKMARKS, _)); - model_association_manager.Initialize(/*desired_types=*/types, - /*preferred_types=*/types, - BuildConfigureContext()); + model_load_manager.Initialize(/*desired_types=*/types, + /*preferred_types=*/types, + BuildConfigureContext()); EXPECT_EQ(DataTypeController::FAILED, GetController(BOOKMARKS)->state()); } // Test that a runtime error is handled by stopping the type. -TEST_F(SyncModelAssociationManagerTest, StopAfterConfiguration) { +TEST_F(SyncModelLoadManagerTest, StopAfterConfiguration) { controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet types; types.Put(BOOKMARKS); - model_association_manager.Initialize(/*desired_types=*/types, - /*preferred_types=*/types, - BuildConfigureContext()); + model_load_manager.Initialize(/*desired_types=*/types, + /*preferred_types=*/types, + BuildConfigureContext()); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); @@ -142,22 +141,22 @@ // Test that OnAllDataTypesReadyForConfigure is called when all datatypes that // require LoadModels before configuration are loaded. -TEST_F(SyncModelAssociationManagerTest, OnAllDataTypesReadyForConfigure) { +TEST_F(SyncModelLoadManagerTest, OnAllDataTypesReadyForConfigure) { // Create two controllers with delayed model load. controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); controllers_[APPS] = std::make_unique<FakeDataTypeController>(APPS); GetController(BOOKMARKS)->model()->EnableManualModelStart(); GetController(APPS)->model()->EnableManualModelStart(); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet types(BOOKMARKS, APPS); // OnAllDataTypesReadyForConfigure shouldn't be called, APPS data type is not // loaded yet. EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()).Times(0); - model_association_manager.Initialize(/*desired_types=*/types, - /*preferred_types=*/types, - BuildConfigureContext()); + model_load_manager.Initialize(/*desired_types=*/types, + /*preferred_types=*/types, + BuildConfigureContext()); EXPECT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_STARTING); @@ -177,7 +176,7 @@ DataTypeController::MODEL_LOADED); EXPECT_EQ(GetController(APPS)->state(), DataTypeController::MODEL_LOADED); - // Call ModelAssociationManager::Initialize with reduced set of datatypes. + // Call ModelLoadManager::Initialize with reduced set of datatypes. // All datatypes in reduced set are already loaded. // OnAllDataTypesReadyForConfigure() should be called. testing::Mock::VerifyAndClearExpectations(&delegate_); @@ -185,9 +184,9 @@ EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); ModelTypeSet reduced_types(APPS); - model_association_manager.Initialize(/*desired_types=*/reduced_types, - /*preferred_types=*/reduced_types, - BuildConfigureContext()); + model_load_manager.Initialize(/*desired_types=*/reduced_types, + /*preferred_types=*/reduced_types, + BuildConfigureContext()); EXPECT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::NOT_RUNNING); EXPECT_EQ(GetController(APPS)->state(), DataTypeController::MODEL_LOADED); @@ -196,20 +195,20 @@ // Test that OnAllDataTypesReadyForConfigure() is called correctly after // LoadModels fails for one of datatypes. -TEST_F(SyncModelAssociationManagerTest, +TEST_F(SyncModelLoadManagerTest, OnAllDataTypesReadyForConfigure_FailedLoadModels) { controllers_[APPS] = std::make_unique<FakeDataTypeController>(APPS); GetController(APPS)->model()->EnableManualModelStart(); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet types(APPS); // OnAllDataTypesReadyForConfigure shouldn't be called, APPS data type is not // loaded yet. EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()).Times(0); - model_association_manager.Initialize(/*desired_types=*/types, - /*preferred_types=*/types, - BuildConfigureContext()); + model_load_manager.Initialize(/*desired_types=*/types, + /*preferred_types=*/types, + BuildConfigureContext()); EXPECT_EQ(GetController(APPS)->state(), DataTypeController::MODEL_STARTING); @@ -225,7 +224,7 @@ // Test that if one of the types fails while another is still being loaded then // OnAllDataTypesReadyForConfgiure is still called correctly. -TEST_F(SyncModelAssociationManagerTest, +TEST_F(SyncModelLoadManagerTest, OnAllDataTypesReadyForConfigure_TypeFailedAfterLoadModels) { // Create two controllers with delayed model load. Both should block // configuration. @@ -234,16 +233,16 @@ GetController(BOOKMARKS)->model()->EnableManualModelStart(); GetController(APPS)->model()->EnableManualModelStart(); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet types(BOOKMARKS, APPS); // Apps will finish loading but bookmarks won't. // OnAllDataTypesReadyForConfigure shouldn't be called. EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()).Times(0); - model_association_manager.Initialize(/*desired_types=*/types, - /*preferred_types=*/types, - BuildConfigureContext()); + model_load_manager.Initialize(/*desired_types=*/types, + /*preferred_types=*/types, + BuildConfigureContext()); GetController(APPS)->model()->SimulateModelStartFinished(); @@ -271,44 +270,44 @@ } // Test that Stop clears metadata for disabled type. -TEST_F(SyncModelAssociationManagerTest, StopClearMetadata) { +TEST_F(SyncModelLoadManagerTest, StopClearMetadata) { controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::NOT_RUNNING); ModelTypeSet types(BOOKMARKS); // Initialize() kicks off model loading. - model_association_manager.Initialize(/*desired_types=*/types, - /*preferred_types=*/types, - BuildConfigureContext()); + model_load_manager.Initialize(/*desired_types=*/types, + /*preferred_types=*/types, + BuildConfigureContext()); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); - model_association_manager.Stop(DISABLE_SYNC); + model_load_manager.Stop(DISABLE_SYNC); EXPECT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::NOT_RUNNING); EXPECT_EQ(1, GetController(BOOKMARKS)->model()->clear_metadata_call_count()); } // Test that stopping a single type clears the metadata for the disabled type. -TEST_F(SyncModelAssociationManagerTest, StopDataType) { +TEST_F(SyncModelLoadManagerTest, StopDataType) { controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::NOT_RUNNING); // Initialize() kicks off model loading. - model_association_manager.Initialize( + model_load_manager.Initialize( /*desired_types=*/ModelTypeSet(BOOKMARKS), /*preferred_types=*/ModelTypeSet(BOOKMARKS), BuildConfigureContext()); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); - model_association_manager.StopDatatype( + model_load_manager.StopDatatype( BOOKMARKS, DISABLE_SYNC, SyncError(FROM_HERE, syncer::SyncError::UNREADY_ERROR, "Data type is unready.", BOOKMARKS)); @@ -318,13 +317,13 @@ } // Test that stopping a single type is ignored when the type is not running. -TEST_F(SyncModelAssociationManagerTest, StopDataType_NotRunning) { +TEST_F(SyncModelLoadManagerTest, StopDataType_NotRunning) { controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::NOT_RUNNING); - model_association_manager.StopDatatype( + model_load_manager.StopDatatype( BOOKMARKS, DISABLE_SYNC, SyncError(FROM_HERE, syncer::SyncError::UNREADY_ERROR, "Data type is unready.", BOOKMARKS)); @@ -335,18 +334,18 @@ // Test that Initialize stops controllers with KEEP_METADATA for preferred // types. -TEST_F(SyncModelAssociationManagerTest, KeepsMetadataForPreferredDataType) { +TEST_F(SyncModelLoadManagerTest, KeepsMetadataForPreferredDataType) { // Associate model with two data types. controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); controllers_[APPS] = std::make_unique<FakeDataTypeController>(APPS); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet preferred_types(BOOKMARKS, APPS); ModelTypeSet desired_types = preferred_types; EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); - model_association_manager.Initialize(desired_types, preferred_types, - BuildConfigureContext()); + model_load_manager.Initialize(desired_types, preferred_types, + BuildConfigureContext()); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); @@ -359,8 +358,8 @@ EXPECT_CALL(delegate_, OnSingleDataTypeWillStop(APPS, _)); EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); - model_association_manager.Initialize(desired_types, preferred_types, - BuildConfigureContext()); + model_load_manager.Initialize(desired_types, preferred_types, + BuildConfigureContext()); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); @@ -370,18 +369,18 @@ // Test that Initialize stops controllers with CLEAR_METADATA for // no-longer-preferred types. -TEST_F(SyncModelAssociationManagerTest, ClearsMetadataForNotPreferredDataType) { +TEST_F(SyncModelLoadManagerTest, ClearsMetadataForNotPreferredDataType) { // Associate model with two data types. controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>(BOOKMARKS); controllers_[APPS] = std::make_unique<FakeDataTypeController>(APPS); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet preferred_types(BOOKMARKS, APPS); ModelTypeSet desired_types = preferred_types; EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); - model_association_manager.Initialize(desired_types, preferred_types, - BuildConfigureContext()); + model_load_manager.Initialize(desired_types, preferred_types, + BuildConfigureContext()); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); @@ -395,8 +394,8 @@ EXPECT_CALL(delegate_, OnSingleDataTypeWillStop(APPS, _)); EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); - model_association_manager.Initialize(desired_types, preferred_types, - BuildConfigureContext()); + model_load_manager.Initialize(desired_types, preferred_types, + BuildConfigureContext()); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); @@ -404,15 +403,14 @@ EXPECT_EQ(1, GetController(APPS)->model()->clear_metadata_call_count()); } -TEST_F(SyncModelAssociationManagerTest, - SwitchFromOnDiskToInMemoryRestartsTypes) { +TEST_F(SyncModelLoadManagerTest, SwitchFromOnDiskToInMemoryRestartsTypes) { // Associate model with two data types. controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>( BOOKMARKS, /*enable_transport_only_model=*/true); controllers_[APPS] = std::make_unique<FakeDataTypeController>( APPS, /*enable_transport_only_model=*/true); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet preferred_types(BOOKMARKS, APPS); ModelTypeSet desired_types = preferred_types; @@ -422,8 +420,8 @@ EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); - model_association_manager.Initialize(desired_types, preferred_types, - configure_context); + model_load_manager.Initialize(desired_types, preferred_types, + configure_context); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); @@ -440,8 +438,8 @@ EXPECT_CALL(delegate_, OnSingleDataTypeWillStop(BOOKMARKS, _)); EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); - model_association_manager.Initialize(desired_types, preferred_types, - configure_context); + model_load_manager.Initialize(desired_types, preferred_types, + configure_context); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); @@ -451,7 +449,7 @@ EXPECT_EQ(0, GetController(APPS)->model()->clear_metadata_call_count()); } -TEST_F(SyncModelAssociationManagerTest, +TEST_F(SyncModelLoadManagerTest, SwitchFromTransportOnlyToFullSyncRestartsTypes) { // Associate model with two data types. controllers_[BOOKMARKS] = std::make_unique<FakeDataTypeController>( @@ -459,7 +457,7 @@ controllers_[APPS] = std::make_unique<FakeDataTypeController>( APPS, /*enable_transport_only_model=*/true); - ModelAssociationManager model_association_manager(&controllers_, &delegate_); + ModelLoadManager model_load_manager(&controllers_, &delegate_); ModelTypeSet preferred_types(BOOKMARKS, APPS); ModelTypeSet desired_types = preferred_types; @@ -469,8 +467,8 @@ EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); - model_association_manager.Initialize(desired_types, preferred_types, - configure_context); + model_load_manager.Initialize(desired_types, preferred_types, + configure_context); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED); @@ -487,8 +485,8 @@ EXPECT_CALL(delegate_, OnSingleDataTypeWillStop(BOOKMARKS, _)); EXPECT_CALL(delegate_, OnAllDataTypesReadyForConfigure()); - model_association_manager.Initialize(desired_types, preferred_types, - configure_context); + model_load_manager.Initialize(desired_types, preferred_types, + configure_context); ASSERT_EQ(GetController(BOOKMARKS)->state(), DataTypeController::MODEL_LOADED);
diff --git a/components/sync/driver/resources.grd b/components/sync/driver/resources.grd index 2e0366e..fd57888 100644 --- a/components/sync/driver/resources.grd +++ b/components/sync/driver/resources.grd
@@ -22,6 +22,7 @@ <include name="IDR_SYNC_DRIVER_SYNC_INTERNALS_SEARCH_JS" file="resources/search.js" type="BINDATA" /> <include name="IDR_SYNC_DRIVER_SYNC_INTERNALS_USER_EVENTS_JS" file="resources/user_events.js" type="BINDATA" /> <include name="IDR_SYNC_DRIVER_SYNC_INTERNALS_TRAFFIC_LOG_JS" file="resources/traffic_log.js" type="BINDATA" /> + <include name="IDR_SYNC_DRIVER_SYNC_INTERNALS_INVALIDATIONS_JS" file="resources/invalidations.js" type="BINDATA" /> </includes> </release> </grit>
diff --git a/components/sync/driver/resources/BUILD.gn b/components/sync/driver/resources/BUILD.gn index 4059f54..26b1802 100644 --- a/components/sync/driver/resources/BUILD.gn +++ b/components/sync/driver/resources/BUILD.gn
@@ -19,6 +19,7 @@ #":sync_node_browser", #":sync_search", + ":invalidations", ":traffic_log", ":user_events", ] @@ -94,3 +95,7 @@ "//ui/webui/resources/js:util", ] } + +js_library("invalidations") { + deps = [ "//ui/webui/resources/js:cr" ] +}
diff --git a/components/sync/driver/resources/index.html b/components/sync/driver/resources/index.html index 1f01aa2..948a86f4 100644 --- a/components/sync/driver/resources/index.html +++ b/components/sync/driver/resources/index.html
@@ -14,6 +14,7 @@ <link rel="stylesheet" href="sync_search.css"> <link rel="stylesheet" href="sync_node_browser.css"> <link rel="stylesheet" href="traffic_log.css"> +<link rel="stylesheet" href="invalidations.css"> <if expr="is_ios"> <!-- TODO(crbug.com/487000): Remove this once injected by web. --> @@ -46,6 +47,7 @@ <script src="user_events.js"></script> <script src="traffic_log.js"></script> <script src="strings.js"></script> +<script src="invalidations.js"></script> </head> <body> @@ -70,6 +72,7 @@ <tab id="sync-search-tab">Search</tab> <tab id="sync-user-events-tab" hidden>User Events</tab> <tab id="sync-traffic-log-tab">Traffic Log</tab> + <tab id="sync-invalidations-tab">Invalidations</tab> </tabs> <tabpanels> <tabpanel> @@ -93,6 +96,9 @@ <tabpanel> <include src="traffic_log.html"> </tabpanel> + <tabpanel> + <include src="invalidations.html"> + </tabpanel> </tabpanels> </tabbox>
diff --git a/components/sync/driver/resources/invalidations.css b/components/sync/driver/resources/invalidations.css new file mode 100644 index 0000000..6b4d60d7 --- /dev/null +++ b/components/sync/driver/resources/invalidations.css
@@ -0,0 +1,8 @@ +/* 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. + */ + +#invalidation-counters-table tr:nth-child(odd) { + background: rgb(239, 243, 255); +}
diff --git a/components/sync/driver/resources/invalidations.html b/components/sync/driver/resources/invalidations.html new file mode 100644 index 0000000..bde49e2 --- /dev/null +++ b/components/sync/driver/resources/invalidations.html
@@ -0,0 +1,15 @@ +<table id="invalidation-counters-table"> + <thead> + <th>Data type</th> + <th>Count</th> + <th>Last time</th> + </thead> + <tbody> + <tr jsselect="rows"> + <td jscontent="type"></td> + <td jscontent="count"></td> + <td jscontent="time"></td> + </tr> + </tbody> +</table> +<textarea id="invalidations-log" rows="10" cols="80"readonly></textarea>
diff --git a/components/sync/driver/resources/invalidations.js b/components/sync/driver/resources/invalidations.js new file mode 100644 index 0000000..c91b93531 --- /dev/null +++ b/components/sync/driver/resources/invalidations.js
@@ -0,0 +1,72 @@ +// 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. + +cr.define('chrome.sync.invalidations', function() { + 'use strict'; + + /** + * A map from data type to number of invalidations received. + */ + const invalidationCountersMap = {}; + + /** + * Redraws the counters table with the most recent information. + */ + function refreshInvalidationCountersDisplay() { + // Transform the counters map into an array. + const invalidationCountersArray = []; + Object.keys(invalidationCountersMap).sort().forEach(function(t) { + invalidationCountersArray.push({ + type: t, + count: invalidationCountersMap[t].count, + time: invalidationCountersMap[t].time, + }); + }); + + jstProcess( + new JsEvalContext({rows: invalidationCountersArray}), + $('invalidation-counters-table')); + } + + /** + * Appends a string to the textarea log. + * @param {string} logMessage The string to be appended. + */ + function appendToLog(logMessage) { + const invalidationsLog = $('invalidations-log'); + invalidationsLog.value += + '[' + new Date().getTime() + '] ' + logMessage + '\n'; + } + + /** + * Updates the counters for the received types. + * @param {Event} e Contains a list of invalidated types. + */ + function onInvalidationReceived(e) { + const logMessage = 'Received invalidation for ' + e.details.join(', '); + appendToLog(logMessage); + + for (const type of e.details) { + if (!(type in invalidationCountersMap)) { + invalidationCountersMap[type] = {count: 0, time: ''}; + } + + ++invalidationCountersMap[type].count; + invalidationCountersMap[type].time = new Date().toTimeString(); + } + + refreshInvalidationCountersDisplay(); + } + + function onLoad() { + chrome.sync.events.addEventListener( + 'onInvalidationReceived', onInvalidationReceived); + refreshInvalidationCountersDisplay(); + } + + return {onLoad: onLoad}; +}); + +document.addEventListener( + 'DOMContentLoaded', chrome.sync.invalidations.onLoad, false);
diff --git a/components/sync/driver/sync_internals_util.cc b/components/sync/driver/sync_internals_util.cc index db8cd1c..00da8eb 100644 --- a/components/sync/driver/sync_internals_util.cc +++ b/components/sync/driver/sync_internals_util.cc
@@ -47,6 +47,7 @@ const char kSyncSearchJS[] = "sync_search.js"; const char kUserEventsJS[] = "user_events.js"; const char kTrafficLogJS[] = "traffic_log.js"; +const char kInvalidationsJS[] = "invalidations.js"; // Message handlers. const char kDispatchEvent[] = "chrome.sync.dispatchEvent"; @@ -75,6 +76,7 @@ "onReceivedIncludeSpecificsInitialState"; const char kOnReceivedListOfTypes[] = "onReceivedListOfTypes"; const char kTypes[] = "types"; +const char kOnInvalidationReceived[] = "onInvalidationReceived"; namespace {
diff --git a/components/sync/driver/sync_internals_util.h b/components/sync/driver/sync_internals_util.h index e9e8ad580..b799649 100644 --- a/components/sync/driver/sync_internals_util.h +++ b/components/sync/driver/sync_internals_util.h
@@ -39,6 +39,7 @@ extern const char kSyncSearchJS[]; extern const char kUserEventsJS[]; extern const char kTrafficLogJS[]; +extern const char kInvalidationsJS[]; // Message handlers. // Must match the constants used in the resource files. @@ -66,6 +67,7 @@ extern const char kOnReceivedIncludeSpecificsInitialState[]; extern const char kOnReceivedListOfTypes[]; extern const char kTypes[]; +extern const char kOnInvalidationReceived[]; using IncludeSensitiveData = util::StrongAlias<class IncludeSensitiveDataTag, bool>;
diff --git a/content/browser/loader/prefetch_browsertest.cc b/content/browser/loader/prefetch_browsertest.cc index 6f25b815..d02271e 100644 --- a/content/browser/loader/prefetch_browsertest.cc +++ b/content/browser/loader/prefetch_browsertest.cc
@@ -5,8 +5,13 @@ #include <string> #include <vector> +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/files/scoped_temp_dir.h" +#include "base/run_loop.h" #include "base/strings/stringprintf.h" #include "base/test/scoped_feature_list.h" +#include "base/threading/thread_restrictions.h" #include "content/browser/loader/prefetch_browsertest_base.h" #include "content/browser/web_package/mock_signed_exchange_handler.h" #include "content/public/browser/browser_task_traits.h" @@ -20,6 +25,7 @@ #include "content/public/test/url_loader_monitor.h" #include "content/shell/browser/shell.h" #include "net/base/features.h" +#include "net/base/filename_util.h" #include "net/base/isolation_info.h" #include "net/dns/mock_host_resolver.h" #include "services/network/public/cpp/features.h" @@ -955,6 +961,49 @@ NavigateToURLAndWaitTitle(target_sxg_url, "done"); } +IN_PROC_BROWSER_TEST_P(PrefetchBrowserTest, FileToHttp) { + const char* target_path = "/target.html"; + RegisterResponse( + target_path, + ResponseEntry("<head><title>Prefetch Target</title></head>")); + + base::RunLoop prefetch_waiter; + auto request_counter = RequestCounter::CreateAndMonitor( + embedded_test_server(), target_path, &prefetch_waiter); + RegisterRequestHandler(embedded_test_server()); + ASSERT_TRUE(embedded_test_server()->Start()); + EXPECT_EQ(0, request_counter->GetRequestCount()); + EXPECT_EQ(0, GetPrefetchURLLoaderCallCount()); + + const GURL target_url = embedded_test_server()->GetURL(target_path); + + { + base::ScopedAllowBlockingForTesting allow_blocking; + base::ScopedTempDir temp_dir; + ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); + base::FilePath file_path = temp_dir.GetPath().AppendASCII("test.html"); + std::string file_content = base::StringPrintf( + "<body><link rel='prefetch' as='document' href='%s'></body>", + target_url.spec().c_str()); + ASSERT_TRUE(base::WriteFile(file_path, file_content)); + + // Loading a page that prefetches the target URL would increment the + // |request_counter|. + GURL file_url = net::FilePathToFileURL(file_path); + EXPECT_TRUE(NavigateToURL(shell(), file_url)); + prefetch_waiter.Run(); + EXPECT_EQ(1, request_counter->GetRequestCount()); + EXPECT_EQ(1, GetPrefetchURLLoaderCallCount()); + } + + // Shutdown the server. + EXPECT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); + + // Subsequent navigation to the target URL wouldn't hit the network for + // the target URL. The target content should still be read correctly. + NavigateToURLAndWaitTitle(target_url, "Prefetch Target"); +} + INSTANTIATE_TEST_SUITE_P(PrefetchBrowserTest, PrefetchBrowserTest, testing::Combine(testing::Bool(), testing::Bool()));
diff --git a/content/browser/loader/prefetch_url_loader_service.cc b/content/browser/loader/prefetch_url_loader_service.cc index 2412483..66fc3ba 100644 --- a/content/browser/loader/prefetch_url_loader_service.cc +++ b/content/browser/loader/prefetch_url_loader_service.cc
@@ -272,8 +272,9 @@ // Presence of |render_frame_host| is guaranteed by the caller - the caller // calls earlier EnsureCrossOriginFactory which has the same DCHECK. DCHECK(current_context.render_frame_host); - if (resource_request.request_initiator.value() != - current_context.render_frame_host->GetLastCommittedOrigin()) { + if (!resource_request.request_initiator->opaque() && + resource_request.request_initiator.value() != + current_context.render_frame_host->GetLastCommittedOrigin()) { mojo::ReportBadMessage( "Prefetch/IsValidCrossOrigin: frame origin mismatch"); return false;
diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc index aea2446c..478d3b7 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc
@@ -3512,6 +3512,22 @@ render_view_host_->ClosePageIgnoringUnloadEvents(); } +void RenderFrameHostImpl::ShowCreatedWindow( + const base::UnguessableToken& opener_frame_token, + WindowOpenDisposition disposition, + const gfx::Rect& initial_rect, + bool user_gesture, + ShowCreatedWindowCallback callback) { + // This needs to be sent to the opener frame's delegate since it stores + // the handle to this class's associated RenderWidgetHostView. + RenderFrameHostImpl* opener_frame_host = + FromFrameToken(GetProcess()->GetID(), opener_frame_token); + opener_frame_host->delegate()->ShowCreatedWindow( + opener_frame_host, GetRenderWidgetHost()->GetRoutingID(), disposition, + initial_rect, user_gesture); + std::move(callback).Run(); +} + void RenderFrameHostImpl::UpdateFaviconURL( std::vector<blink::mojom::FaviconURLPtr> favicon_urls) { delegate_->UpdateFaviconURL(this, std::move(favicon_urls)); @@ -4863,14 +4879,6 @@ keep_alive_handle_factory_->SetTimeout(keep_alive_timeout_); } -void RenderFrameHostImpl::ShowCreatedWindow(int pending_widget_routing_id, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture) { - delegate_->ShowCreatedWindow(this, pending_widget_routing_id, disposition, - initial_rect, user_gesture); -} - void RenderFrameHostImpl::UpdateState(const blink::PageState& state) { // TODO(creis): Verify the state's ISN matches the last committed FNE.
diff --git a/content/browser/renderer_host/render_frame_host_impl.h b/content/browser/renderer_host/render_frame_host_impl.h index 69dbb7e..ffa25f3 100644 --- a/content/browser/renderer_host/render_frame_host_impl.h +++ b/content/browser/renderer_host/render_frame_host_impl.h
@@ -1710,6 +1710,11 @@ blink::mojom::LocalMainFrameHost::UpdateTargetURLCallback callback) override; void RequestClose() override; + void ShowCreatedWindow(const base::UnguessableToken& opener_frame_token, + WindowOpenDisposition disposition, + const gfx::Rect& initial_rect, + bool user_gesture, + ShowCreatedWindowCallback callback) override; void ReportNoBinderForInterface(const std::string& error); @@ -2082,10 +2087,6 @@ const base::string16& message, int32_t line_no, const base::string16& source_id) override; - void ShowCreatedWindow(int32_t pending_widget_routing_id, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture) override; void UpdateState(const blink::PageState& state) override; void OpenURL(mojom::OpenURLParamsPtr params) override; void DidStopLoading() override;
diff --git a/content/browser/site_per_process_browsertest.cc b/content/browser/site_per_process_browsertest.cc index 058e4396..a645462 100644 --- a/content/browser/site_per_process_browsertest.cc +++ b/content/browser/site_per_process_browsertest.cc
@@ -8056,36 +8056,90 @@ EXPECT_EQ(orig_site_instance, child->current_frame_host()->GetSiteInstance()); } -// Intercepts calls to RenderFramHost's ShowCreatedWindow mojo method, and +// Intercepts calls to LocalMainFrame's ShowCreatedWindow mojo method, and // invokes the provided callback. class ShowCreatedWindowInterceptor - : public mojom::FrameHostInterceptorForTesting { + : public blink::mojom::LocalMainFrameHostInterceptorForTesting { public: ShowCreatedWindowInterceptor( RenderFrameHostImpl* render_frame_host, - base::RepeatingCallback<void(int32_t pending_widget_routing_id)> - test_callback) + base::OnceCallback<void(int32_t pending_widget_routing_id)> test_callback) : render_frame_host_(render_frame_host), test_callback_(std::move(test_callback)) { - render_frame_host_->frame_host_receiver_for_testing().SwapImplForTesting( - this); + render_frame_host_->local_main_frame_host_receiver_for_testing() + .SwapImplForTesting(this); } ~ShowCreatedWindowInterceptor() override = default; - FrameHost* GetForwardingInterface() override { return render_frame_host_; } + blink::mojom::LocalMainFrameHost* GetForwardingInterface() override { + return render_frame_host_; + } - void ShowCreatedWindow(int32_t pending_widget_routing_id, + void ShowCreatedWindow(const base::UnguessableToken& opener_frame_token, WindowOpenDisposition disposition, const gfx::Rect& initial_rect, - bool user_gesture) override { - test_callback_.Run(pending_widget_routing_id); + bool user_gesture, + ShowCreatedWindowCallback callback) override { + show_callback_ = std::move(callback); + opener_frame_token_ = opener_frame_token; + user_gesture_ = user_gesture; + initial_rect_ = initial_rect; + disposition_ = disposition; + std::move(test_callback_) + .Run(render_frame_host_->GetRenderWidgetHost()->GetRoutingID()); + } + + void ResumeShowCreatedWindow() { + GetForwardingInterface()->ShowCreatedWindow( + opener_frame_token_, disposition_, initial_rect_, user_gesture_, + std::move(show_callback_)); } private: RenderFrameHostImpl* render_frame_host_; - base::RepeatingCallback<void(int32_t pending_widget_routing_id)> - test_callback_; + base::OnceCallback<void(int32_t pending_widget_routing_id)> test_callback_; + ShowCreatedWindowCallback show_callback_; + base::UnguessableToken opener_frame_token_; + gfx::Rect initial_rect_; + bool user_gesture_ = false; + WindowOpenDisposition disposition_; +}; + +// Listens for the source WebContents opening the new WebContents then attaches +// a show listener to the widget. +class NewWindowCreatedObserver : public WebContentsObserver { + public: + NewWindowCreatedObserver( + WebContents* web_contents, + base::OnceCallback<void(int32_t pending_widget_routing_id)> test_callback) + : WebContentsObserver(web_contents), + test_callback_(std::move(test_callback)) {} + + // WebContentsObserver overrides. + void DidOpenRequestedURL(WebContents* new_contents, + RenderFrameHost* source_render_frame_host, + const GURL& url, + const Referrer& referrer, + WindowOpenDisposition disposition, + ui::PageTransition transition, + bool started_from_context_menu, + bool renderer_initiated) override { + show_interceptor_ = std::make_unique<ShowCreatedWindowInterceptor>( + static_cast<RenderFrameHostImpl*>(new_contents->GetMainFrame()), + std::move(test_callback_)); + + // Stop observing now. + Observe(nullptr); + } + + void ResumeShowCreatedWindow() { + show_interceptor_->ResumeShowCreatedWindow(); + } + + private: + std::unique_ptr<ShowCreatedWindowInterceptor> show_interceptor_; + base::OnceCallback<void(int32_t pending_widget_routing_id)> test_callback_; }; // Test for https://crbug.com/612276. Simultaneously open two new windows from @@ -8117,8 +8171,8 @@ // call. base::RunLoop run_loop1; int32_t routing_id1; - ShowCreatedWindowInterceptor interceptor1( - frame1, + NewWindowCreatedObserver interceptor1( + web_contents(), base::BindLambdaForTesting([&](int32_t pending_widget_routing_id) { routing_id1 = pending_widget_routing_id; run_loop1.Quit(); @@ -8128,8 +8182,8 @@ base::RunLoop run_loop2; int32_t routing_id2; - ShowCreatedWindowInterceptor interceptor2( - frame2, + NewWindowCreatedObserver interceptor2( + web_contents(), base::BindLambdaForTesting([&](int32_t pending_widget_routing_id) { routing_id2 = pending_widget_routing_id; run_loop2.Quit(); @@ -8149,14 +8203,9 @@ // pending contents map in the original bug). EXPECT_EQ(routing_id1, routing_id2); - // Now, simulate that both FrameHostMsg_ShowCreatedWindow messages arrive by - // showing both of the pending WebContents. - web_contents()->ShowCreatedWindow(frame1, routing_id1, - WindowOpenDisposition::NEW_FOREGROUND_TAB, - gfx::Rect(), true); - web_contents()->ShowCreatedWindow(frame2, routing_id2, - WindowOpenDisposition::NEW_FOREGROUND_TAB, - gfx::Rect(), true); + // Now, resuming processing the show messages. + interceptor1.ResumeShowCreatedWindow(); + interceptor2.ResumeShowCreatedWindow(); // Verify that both shells were properly created. EXPECT_EQ(3u, Shell::windows().size()); @@ -11119,8 +11168,9 @@ // // This test is disabled due to flakiness on all platforms, but especially on // Android. See https://crbug.com/945025. -IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, - DISABLED_TouchEventAckQueueOrdering) { +// Note: temporarily re-enabled to collect data on the try-bots ... it will be +// disabled again once we have some data. +IN_PROC_BROWSER_TEST_P(SitePerProcessBrowserTest, TouchEventAckQueueOrdering) { GURL main_url(embedded_test_server()->GetURL( "a.com", "/cross_site_iframe_factory.html?a(b)")); EXPECT_TRUE(NavigateToURL(shell(), main_url));
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index 2c7abb4..60da939 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3743,7 +3743,8 @@ opener->GetProcess()->GetID(), main_frame_widget_route_id); // The browser may have rejected the request to make a new window, or the - // renderer could be sending an invalid route id. Ignore the request then. + // renderer could be requesting to show a previously shown window (occurs when + // mojom::CreateNewWindowStatus::kReuse is used). Ignore the request then. if (!owned_created || !owned_created->contents) return; @@ -3777,19 +3778,10 @@ if (delegate->ShouldResumeRequestsForCreatedWindow()) created->ResumeLoadingCreatedWebContents(); - base::WeakPtr<WebContentsImpl> weak_created = - created->weak_factory_.GetWeakPtr(); delegate->AddNewContents(this, std::move(owned_created->contents), std::move(owned_created->target_url), disposition, adjusted_rect, user_gesture, nullptr); - // The delegate may delete |created| during AddNewContents(). - if (!weak_created) - return; } - - RenderWidgetHostImpl* rwh = created->GetMainFrame()->GetRenderWidgetHost(); - DCHECK_EQ(main_frame_widget_route_id, rwh->GetRoutingID()); - rwh->Send(new WidgetMsg_SetBounds_ACK(rwh->GetRoutingID())); } void WebContentsImpl::ShowCreatedWidget(int process_id,
diff --git a/content/common/frame.mojom b/content/common/frame.mojom index 9ede8f6..360dc51 100644 --- a/content/common/frame.mojom +++ b/content/common/frame.mojom
@@ -528,14 +528,6 @@ int32 line_number, mojo_base.mojom.String16 source_id); - // Causes a window previously opened via RenderMessageFilter::CreateNewWindow - // to be shown on the screen. This message is routed to the preexisting frame - // that opened the window, and |pending_widget_routing_id| corresponds to the - // widget routing id from the CreateNewWindow reply. - ShowCreatedWindow(int32 pending_widget_routing_id, - ui.mojom.WindowOpenDisposition disposition, - gfx.mojom.Rect rect, bool opened_by_user_gesture); - // Notifies the browser that this frame has new session history information. UpdateState(PageState state);
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index c00ddea7..3a0541b 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -830,7 +830,6 @@ base::FEATURE_DISABLED_BY_DEFAULT}; // The JavaScript API for payments on the web. -// TODO(rouslan): Remove this. const base::Feature kWebPayments{"WebPayments", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/content/public/common/content_switch_dependent_feature_overrides.cc b/content/public/common/content_switch_dependent_feature_overrides.cc index 56a9c584..6efeefe 100644 --- a/content/public/common/content_switch_dependent_feature_overrides.cc +++ b/content/public/common/content_switch_dependent_feature_overrides.cc
@@ -67,6 +67,9 @@ {switches::kEnableExperimentalWebPlatformFeatures, std::cref(features::kCriticalClientHint), base::FeatureList::OVERRIDE_ENABLE_FEATURE}, + {switches::kEnableExperimentalWebPlatformFeatures, + std::cref(net::features::kSchemefulSameSite), + base::FeatureList::OVERRIDE_ENABLE_FEATURE}, // Overrides for --enable-experimental-cookie-features. {switches::kEnableExperimentalCookieFeatures,
diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc index 6abad92..2e839f6 100644 --- a/content/public/test/render_view_test.cc +++ b/content/public/test/render_view_test.cc
@@ -518,7 +518,7 @@ RenderViewImpl* view = RenderViewImpl::Create( *agent_scheduling_group_, compositor_deps_.get(), std::move(view_params), - RenderWidget::ShowCallback(), base::ThreadTaskRunnerHandle::Get()); + /*was_created_by_renderer=*/false, base::ThreadTaskRunnerHandle::Get()); RenderFrameWasShownWaiter waiter(view->GetMainRenderFrame()); render_widget_host_->widget_remote_for_testing()->WasShown(
diff --git a/content/renderer/agent_scheduling_group.cc b/content/renderer/agent_scheduling_group.cc index 1bc4ef3..660daca 100644 --- a/content/renderer/agent_scheduling_group.cc +++ b/content/renderer/agent_scheduling_group.cc
@@ -155,7 +155,8 @@ params->web_preferences.enable_scroll_animator, PassKey()); RenderViewImpl::Create( - *this, &renderer, std::move(params), RenderWidget::ShowCallback(), + *this, &renderer, std::move(params), + /*was_created_by_renderer=*/false, // TODO(crbug.com/1111231): Use proper per-ASG task-runner. renderer.GetWebMainThreadScheduler()->DefaultTaskRunner()); }
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc index b415183..f384a56d 100644 --- a/content/renderer/render_frame_impl.cc +++ b/content/renderer/render_frame_impl.cc
@@ -1558,8 +1558,7 @@ RenderViewImpl* render_view, CompositorDependencies* compositor_deps, blink::WebFrame* opener, - mojom::CreateViewParamsPtr* params_ptr, - RenderWidget::ShowCallback show_callback) { + mojom::CreateViewParamsPtr* params_ptr) { mojom::CreateViewParamsPtr& params = *params_ptr; // A main frame RenderFrame must have a RenderWidget. @@ -1604,9 +1603,8 @@ mojom::ViewWidgetType::kTopLevel, /*hidden=*/true, render_view->widgets_never_composited()); - render_widget->InitForMainFrame(std::move(show_callback), web_frame_widget, - params->visual_properties.screen_info, - *render_view); + render_widget->InitForMainFrame( + web_frame_widget, params->visual_properties.screen_info, *render_view); // The WebFrame created here was already attached to the Page as its main // frame, and the WebFrameWidget has been initialized, so we can call @@ -1775,8 +1773,8 @@ /*hidden=*/true, render_view->widgets_never_composited()); render_widget->InitForMainFrame( - RenderWidget::ShowCallback(), web_frame_widget, - widget_params->visual_properties.screen_info, *render_view); + web_frame_widget, widget_params->visual_properties.screen_info, + *render_view); // The RenderWidget should start with valid VisualProperties, including a // non-zero size. While RenderWidget would not normally receive IPCs and // thus would not get VisualProperty updates while the frame is provisional, @@ -6541,24 +6539,6 @@ } #endif // ENABLE_PLUGINS -void RenderFrameImpl::ShowCreatedWindow(bool opened_by_user_gesture, - RenderWidget* render_widget_to_show, - WebNavigationPolicy policy, - const gfx::Rect& initial_rect) { - // |render_widget_to_show| is the main RenderWidget for a pending window - // created by this object, but not yet shown. The tab is currently offscreen, - // and still owned by the opener. Sending |FrameHostMsg_ShowCreatedWindow| - // will move it off the opener's pending list, and put it in its own tab or - // window. - // - // This call happens only for renderer-created windows; for example, when a - // tab is created by script via window.open(). - GetFrameHost()->ShowCreatedWindow( - render_widget_to_show->routing_id(), - RenderViewImpl::NavigationPolicyToDisposition(policy), initial_rect, - opened_by_user_gesture); -} - blink::WebComputedAXTree* RenderFrameImpl::GetOrCreateWebComputedAXTree() { if (!computed_ax_tree_) computed_ax_tree_ = std::make_unique<AomContentAxTree>(this);
diff --git a/content/renderer/render_frame_impl.h b/content/renderer/render_frame_impl.h index 329af00..161f911 100644 --- a/content/renderer/render_frame_impl.h +++ b/content/renderer/render_frame_impl.h
@@ -185,8 +185,7 @@ RenderViewImpl* render_view, CompositorDependencies* compositor_deps, blink::WebFrame* opener, - mojom::CreateViewParamsPtr* params, - RenderWidget::ShowCallback show_callback); + mojom::CreateViewParamsPtr* params); // Creates a new RenderFrame with |routing_id|. If |previous_routing_id| is // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into @@ -335,12 +334,6 @@ // gone, and clean up code that depends on it. bool in_frame_tree() { return in_frame_tree_; } - // A RenderView opened by this RenderFrame needs to be shown. - void ShowCreatedWindow(bool opened_by_user_gesture, - RenderWidget* render_widget_to_show, - blink::WebNavigationPolicy policy, - const gfx::Rect& initial_rect); - #if BUILDFLAG(ENABLE_PLUGINS) // Notification that a PPAPI plugin has been created. void PepperPluginCreated(RendererPpapiHost* host);
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc index a674ef13..4d626254 100644 --- a/content/renderer/render_view_browsertest.cc +++ b/content/renderer/render_view_browsertest.cc
@@ -1094,6 +1094,7 @@ // A popup that creates a view first and then navigates to a // normal HTTP URL. + bool consumed_user_gesture = false; blink::WebURLRequest popup_request(GURL("http://foo.com")); popup_request.SetRequestorOrigin(requestor_origin); popup_request.SetMode(network::mojom::RequestMode::kNavigate); @@ -1104,7 +1105,7 @@ blink::kWebNavigationPolicyNewForegroundTab, network::mojom::WebSandboxFlags::kNone, blink::FeaturePolicyFeatureState(), - blink::AllocateSessionStorageNamespaceId()); + blink::AllocateSessionStorageNamespaceId(), consumed_user_gesture); auto popup_navigation_info = std::make_unique<blink::WebNavigationInfo>(); popup_navigation_info->url_request = std::move(popup_request); popup_navigation_info->frame_type =
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index a4a4505..528a74c 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc
@@ -127,16 +127,12 @@ void RenderViewImpl::Initialize( CompositorDependencies* compositor_deps, mojom::CreateViewParamsPtr params, - RenderWidget::ShowCallback show_callback, + bool was_created_by_renderer, scoped_refptr<base::SingleThreadTaskRunner> task_runner) { DCHECK(RenderThread::IsMainThread()); agent_scheduling_group_.AddRoute(routing_id_, this); -#if defined(OS_ANDROID) - bool has_show_callback = !!show_callback; -#endif - WebFrame* opener_frame = nullptr; if (params->opener_frame_token) opener_frame = WebFrame::FromFrameToken(params->opener_frame_token.value()); @@ -159,8 +155,7 @@ if (local_main_frame) { main_render_frame_ = RenderFrameImpl::CreateMainFrame( - agent_scheduling_group_, this, compositor_deps, opener_frame, ¶ms, - std::move(show_callback)); + agent_scheduling_group_, this, compositor_deps, opener_frame, ¶ms); } else { RenderFrameProxy::CreateFrameProxy( agent_scheduling_group_, params->proxy_routing_id, GetRoutingID(), @@ -182,12 +177,7 @@ #if defined(OS_ANDROID) // TODO(sgurun): crbug.com/325351 Needed only for android webview's deprecated // HandleNavigation codepath. - // Renderer-created RenderViews have a ShowCallback because they send a Show - // request (ViewHostMsg_ShowWidget, ViewHostMsg_ShowFullscreenWidget, or - // FrameHostMsg_ShowCreatedWindow) to the browser to attach them to the UI - // there. Browser-created RenderViews do not send a Show request to the - // browser, so have no such callback. - was_created_by_renderer_ = has_show_callback; + was_created_by_renderer_ = was_created_by_renderer; #endif } @@ -255,7 +245,7 @@ AgentSchedulingGroup& agent_scheduling_group, CompositorDependencies* compositor_deps, mojom::CreateViewParamsPtr params, - RenderWidget::ShowCallback show_callback, + bool was_created_by_renderer, scoped_refptr<base::SingleThreadTaskRunner> task_runner) { DCHECK(params->view_id != MSG_ROUTING_NONE); // Frame and widget routing ids come together. @@ -275,7 +265,7 @@ } render_view->Initialize(compositor_deps, std::move(params), - std::move(show_callback), std::move(task_runner)); + was_created_by_renderer, std::move(task_runner)); return render_view; } @@ -381,7 +371,9 @@ WebNavigationPolicy policy, network::mojom::WebSandboxFlags sandbox_flags, const blink::FeaturePolicyFeatureState& opener_feature_state, - const blink::SessionStorageNamespaceId& session_storage_namespace_id) { + const blink::SessionStorageNamespaceId& session_storage_namespace_id, + bool& consumed_user_gesture) { + consumed_user_gesture = false; RenderFrameImpl* creator_frame = RenderFrameImpl::FromWebFrame(creator); mojom::CreateNewWindowParamsPtr params = mojom::CreateNewWindowParams::New(); @@ -445,7 +437,7 @@ // The browser allowed creation of a new window and consumed the user // activation. - bool was_consumed = creator->ConsumeTransientUserActivation( + consumed_user_gesture = creator->ConsumeTransientUserActivation( blink::UserActivationUpdateSource::kBrowser); // While this view may be a background extension page, it can spawn a visible @@ -495,15 +487,9 @@ view_params->never_composited = never_composited; view_params->visual_properties = reply->visual_properties; - // Unretained() is safe here because our calling function will also call - // show(). - RenderWidget::ShowCallback show_callback = - base::BindOnce(&RenderFrameImpl::ShowCreatedWindow, - base::Unretained(creator_frame), was_consumed); - RenderViewImpl* view = RenderViewImpl::Create( agent_scheduling_group_, compositor_deps_, std::move(view_params), - std::move(show_callback), + /*was_created_by_renderer=*/true, creator->GetTaskRunner(blink::TaskType::kInternalDefault)); if (reply->wait_for_debugger) {
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h index fefcfd4..f42c68d 100644 --- a/content/renderer/render_view_impl.h +++ b/content/renderer/render_view_impl.h
@@ -113,7 +113,7 @@ AgentSchedulingGroup& agent_scheduling_group, CompositorDependencies* compositor_deps, mojom::CreateViewParamsPtr params, - RenderWidget::ShowCallback show_callback, + bool was_created_by_renderer, scoped_refptr<base::SingleThreadTaskRunner> task_runner); // Instances of this object are created by and destroyed by the browser @@ -185,8 +185,8 @@ blink::WebNavigationPolicy policy, network::mojom::WebSandboxFlags sandbox_flags, const blink::FeaturePolicyFeatureState& opener_feature_state, - const blink::SessionStorageNamespaceId& session_storage_namespace_id) - override; + const blink::SessionStorageNamespaceId& session_storage_namespace_id, + bool& consumed_user_gesture) override; blink::WebPagePopup* CreatePopup(blink::WebLocalFrame* creator) override; base::StringPiece GetSessionStorageNamespaceId() override; void PrintPage(blink::WebLocalFrame* frame) override; @@ -307,7 +307,7 @@ // before any other code can interact with instances of this call. void Initialize(CompositorDependencies* compositor_deps, mojom::CreateViewParamsPtr params, - RenderWidget::ShowCallback show_callback, + bool was_created_by_renderer, scoped_refptr<base::SingleThreadTaskRunner> task_runner); // RenderWidgetDelegate implementation ----------------------------------
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index c27d40a..dbefa78 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc
@@ -147,22 +147,21 @@ blink::WebPagePopup* web_page_popup, const blink::ScreenInfo& screen_info) { for_popup_ = true; - Initialize(base::NullCallback(), web_page_popup, screen_info); + Initialize(web_page_popup, screen_info); } -void RenderWidget::InitForMainFrame(ShowCallback show_callback, - blink::WebFrameWidget* web_frame_widget, +void RenderWidget::InitForMainFrame(blink::WebFrameWidget* web_frame_widget, const blink::ScreenInfo& screen_info, RenderWidgetDelegate& delegate) { delegate_ = &delegate; - Initialize(std::move(show_callback), web_frame_widget, screen_info); + Initialize(web_frame_widget, screen_info); } void RenderWidget::InitForChildLocalRoot( blink::WebFrameWidget* web_frame_widget, const blink::ScreenInfo& screen_info) { for_child_local_root_frame_ = true; - Initialize(base::NullCallback(), web_frame_widget, screen_info); + Initialize(web_frame_widget, screen_info); } void RenderWidget::CloseForFrame(std::unique_ptr<RenderWidget> widget) { @@ -172,14 +171,11 @@ Close(std::move(widget)); } -void RenderWidget::Initialize(ShowCallback show_callback, - blink::WebWidget* web_widget, +void RenderWidget::Initialize(blink::WebWidget* web_widget, const blink::ScreenInfo& screen_info) { DCHECK_NE(routing_id_, MSG_ROUTING_NONE); DCHECK(web_widget); - show_callback_ = std::move(show_callback); - agent_scheduling_group_.AddRoute(routing_id_, this); webwidget_ = web_widget; @@ -283,38 +279,6 @@ GetWebWidget()->SetHandlingInputEvent(handling_input_event); } -// We are supposed to get a single call to Show for a newly created RenderWidget -// that was created via RenderWidget::CreateWebView. So, we wait until this -// point to dispatch the ShowWidget message. -// -// This method provides us with the information about how to display the newly -// created RenderWidget (i.e., as a blocked popup or as a new tab). -// -void RenderWidget::Show(WebNavigationPolicy policy) { - if (!show_callback_) { - if (delegate()) { - // When SupportsMultipleWindows is disabled, popups are reusing - // the view's RenderWidget. In some scenarios, this makes blink to call - // Show() twice. But otherwise, if it is enabled, we should not visit - // Show() more than once. - DCHECK(!delegate()->SupportsMultipleWindowsForWidget()); - return; - } else { - NOTREACHED() << "received extraneous Show call"; - } - } - - DCHECK(routing_id_ != MSG_ROUTING_NONE); - - // The opener is responsible for actually showing this widget. - std::move(show_callback_).Run(this, policy, initial_rect_); - - // NOTE: initial_rect_ may still have its default values at this point, but - // that's okay. It'll be ignored if as_popup is false, or the browser - // process will impose a default position otherwise. - SetPendingWindowRect(initial_rect_); -} - void RenderWidget::InitCompositing(const blink::ScreenInfo& screen_info) { TRACE_EVENT0("blink", "RenderWidget::InitializeLayerTreeView"); @@ -367,15 +331,8 @@ } void RenderWidget::SetWindowRect(const gfx::Rect& window_rect) { - if (show_callback_) { - // The widget is not shown yet. Delay the |window_rect| being sent to the - // browser until Show() is called so it can be sent with that IPC, once the - // browser is ready for the info. - initial_rect_ = window_rect; - } else { - Send(new WidgetHostMsg_RequestSetBounds(routing_id_, window_rect)); - SetPendingWindowRect(window_rect); - } + Send(new WidgetHostMsg_RequestSetBounds(routing_id_, window_rect)); + SetPendingWindowRect(window_rect); } void RenderWidget::OnDragTargetDragEnter(
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h index f069c94..43460f7 100644 --- a/content/renderer/render_widget.h +++ b/content/renderer/render_widget.h
@@ -104,11 +104,6 @@ ~RenderWidget() override; - using ShowCallback = - base::OnceCallback<void(RenderWidget* widget_to_show, - blink::WebNavigationPolicy policy, - const gfx::Rect& initial_rect)>; - // Time-To-First-Active-Paint(TTFAP) type enum { TTFAP_AFTER_PURGED, @@ -154,8 +149,7 @@ // Initialize a new RenderWidget that will be attached to a RenderFrame (via // the WebFrameWidget), for a frame that is a main frame. - void InitForMainFrame(ShowCallback show_callback, - blink::WebFrameWidget* web_frame_widget, + void InitForMainFrame(blink::WebFrameWidget* web_frame_widget, const blink::ScreenInfo& screen_info, RenderWidgetDelegate& delegate); @@ -196,7 +190,6 @@ // blink::WebWidgetClient void ScheduleAnimation() override; void BrowserClosedIpcChannelForPopupWidget() override; - void Show(blink::WebNavigationPolicy) override; void SetWindowRect(const gfx::Rect&) override; viz::FrameSinkId GetFrameSinkId() override; void RecordTimeToFirstActivePaint(base::TimeDelta duration) override; @@ -238,8 +231,7 @@ friend class RenderWidgetTest; friend class RenderViewImplTest; - void Initialize(ShowCallback show_callback, - blink::WebWidget* web_widget, + void Initialize(blink::WebWidget* web_widget, const blink::ScreenInfo& screen_info); // Initializes the compositor and dependent systems, as part of the // Initialize() process. @@ -298,9 +290,6 @@ // This is valid while |webwidget_| is valid. cc::LayerTreeHost* layer_tree_host_ = nullptr; - // The rect where this view should be initially shown. - gfx::Rect initial_rect_; - // True once Close() is called, during the self-destruction process, and to // verify destruction always goes through Close(). bool closing_ = false; @@ -319,10 +308,6 @@ // message to kill the render widget is coming for a popup. bool for_popup_ = false; - // A callback into the creator/opener of this widget, to be executed when - // WebWidgetClient::Show() occurs. - ShowCallback show_callback_; - DISALLOW_COPY_AND_ASSIGN(RenderWidget); };
diff --git a/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt index dba0514..a7b6d0ad 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webgl2_conformance_expectations.txt
@@ -638,50 +638,51 @@ # Mac Passthrough -crbug.com/982294 [ mac passthrough ] conformance2/textures/misc/tex-mipmap-levels.html [ Failure ] -crbug.com/982294 [ mac passthrough ] conformance2/textures/misc/tex-srgb-mipmap.html [ Failure ] -crbug.com/982294 [ mac passthrough ] conformance2/renderbuffers/multisampled-depth-renderbuffer-initialization.html [ Failure ] -crbug.com/982294 [ mac passthrough ] conformance2/rendering/blitframebuffer-resolve-to-back-buffer.html [ Failure ] -crbug.com/982294 [ mac passthrough ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_lines.html [ Failure ] -crbug.com/982294 [ mac passthrough ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_points.html [ Failure ] -crbug.com/982294 [ mac passthrough ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_triangles.html [ Failure ] -crbug.com/982294 [ mac passthrough ] deqp/functional/gles3/transformfeedback/random_interleaved_lines.html [ Failure ] -crbug.com/982294 [ mac passthrough ] deqp/functional/gles3/transformfeedback/random_interleaved_points.html [ Failure ] -crbug.com/982294 [ mac passthrough ] deqp/functional/gles3/transformfeedback/random_interleaved_triangles.html [ Failure ] +crbug.com/angleproject/5223 [ mac passthrough ] conformance2/textures/misc/tex-mipmap-levels.html [ Failure ] +crbug.com/angleproject/5227 [ mac passthrough ] conformance2/renderbuffers/multisampled-depth-renderbuffer-initialization.html [ Failure ] # Mac Passthrough / AMD -crbug.com/982294 [ mac passthrough amd ] conformance2/rendering/instanced-arrays.html [ Failure ] -crbug.com/982294 [ mac passthrough amd ] conformance2/rendering/vertex-id.html [ Failure ] -crbug.com/1090059 [ mac passthrough amd ] conformance/attribs/gl-bindAttribLocation-matrix.html [ Failure ] +crbug.com/anglerpoject/5224 [ mac passthrough amd ] conformance2/rendering/instanced-arrays.html [ Failure ] +crbug.com/anglerpoject/5225 [ mac passthrough amd ] conformance2/rendering/vertex-id.html [ Failure ] +crbug.com/982294 [ mac passthrough amd ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_lines.html [ Failure ] +crbug.com/982294 [ mac passthrough amd ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_points.html [ Failure ] +crbug.com/982294 [ mac passthrough amd ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_triangles.html [ Failure ] +crbug.com/982294 [ mac passthrough amd ] deqp/functional/gles3/transformfeedback/random_interleaved_lines.html [ Failure ] +crbug.com/982294 [ mac passthrough amd ] deqp/functional/gles3/transformfeedback/random_interleaved_points.html [ Failure ] +crbug.com/982294 [ mac passthrough amd ] deqp/functional/gles3/transformfeedback/random_interleaved_triangles.html [ Failure ] # Mac Passthrough / NVIDIA crbug.com/982294 [ mac passthrough nvidia ] conformance/renderbuffers/framebuffer-object-attachment.html [ Failure ] crbug.com/982294 [ mac passthrough nvidia ] conformance/textures/misc/tex-input-validation.html [ Failure ] -crbug.com/982294 [ mac passthrough nvidia ] conformance/textures/misc/texture-corner-case-videos.html [ Failure ] # Mac Passthrough / Intel -crbug.com/982294 [ mac passthrough intel ] conformance/rendering/negative-one-index.html [ Failure ] crbug.com/982294 [ mac passthrough intel ] conformance/textures/misc/gl-teximage.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] conformance2/textures/misc/tex-unpack-params.html [ Failure ] +crbug.com/anglerpoject/5222 [ mac passthrough intel ] conformance2/textures/misc/tex-unpack-params.html [ Failure ] crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/fbocolorbuffer/tex2d_00.html [ Failure ] crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/fboinvalidate/format_00.html [ Failure ] crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/fboinvalidate/format_02.html [ Failure ] crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/framebufferblit/default_framebuffer_05.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/texturespecification/basic_copyteximage2d.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/texturespecification/teximage3d_pbo_params.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/texturespecification/texsubimage3d_pbo_params.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/basic_types_separate_lines.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/basic_types_separate_points.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/basic_types_separate_triangles.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/interpolation_centroid.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/interpolation_flat.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/interpolation_smooth.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/point_size.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/position.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/random_separate_lines.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/random_separate_points.html [ Failure ] -crbug.com/982294 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/random_separate_triangles.html [ Failure ] +crbug.com/anglerpoject/5226 [ mac passthrough intel ] deqp/functional/gles3/texturespecification/basic_copyteximage2d.html [ Failure ] +crbug.com/anglerpoject/5222 [ mac passthrough intel ] deqp/functional/gles3/texturespecification/teximage3d_pbo_params.html [ Failure ] +crbug.com/anglerpoject/5222 [ mac passthrough intel ] deqp/functional/gles3/texturespecification/texsubimage3d_pbo_params.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_lines.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_points.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/basic_types_interleaved_triangles.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/basic_types_separate_lines.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/basic_types_separate_points.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/basic_types_separate_triangles.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/interpolation_centroid.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/interpolation_flat.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/interpolation_smooth.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/point_size.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/position.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/random_interleaved_lines.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/random_interleaved_points.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/random_interleaved_triangles.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/random_separate_lines.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/random_separate_points.html [ Failure ] +crbug.com/anglerpoject/5221 [ mac passthrough intel ] deqp/functional/gles3/transformfeedback/random_separate_triangles.html [ Failure ] crbug.com/1092734 [ mac passthrough intel ] conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_byte.html [ Failure ] crbug.com/1092734 [ mac passthrough intel ] conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_4_4_4_4.html [ Failure ] crbug.com/1092734 [ mac passthrough intel ] conformance/textures/webgl_canvas/tex-2d-rgba-rgba-unsigned_short_5_5_5_1.html [ Failure ]
diff --git a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt index 988bd3e..49498ae 100644 --- a/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt +++ b/content/test/gpu/gpu_tests/test_expectations/webgl_conformance_expectations.txt
@@ -442,16 +442,9 @@ # Mac / Passthrough command decoder / OpenGL crbug.com/989194 [ mac passthrough angle-opengl ] conformance/extensions/oes-texture-half-float.html [ Failure ] -# Mac / Passthrough command decoder / OpenGL / AMD -crbug.com/angleproject/3767 [ mac passthrough amd angle-opengl ] conformance/rendering/rendering-stencil-large-viewport.html [ Failure ] - -# Mac Pro (AMD) / Passthrough command decoder / OpenGL -crbug.com/992231 [ mac passthrough amd-0x679e angle-opengl ] conformance/context/context-size-change.html [ Failure ] - # Mac / Passthrough command decoder / OpenGL / NVIDIA crbug.com/982294 [ mac passthrough nvidia angle-opengl ] conformance/renderbuffers/framebuffer-object-attachment.html [ Failure ] crbug.com/982294 [ mac passthrough nvidia angle-opengl ] conformance/textures/misc/tex-input-validation.html [ Failure ] -crbug.com/982294 [ mac passthrough nvidia angle-opengl ] conformance/textures/misc/texture-corner-case-videos.html [ Failure ] # Mac ASAN flakes crbug.com/1059760 [ mac asan ] conformance/textures/image_bitmap_from_video/* [ RetryOnFailure ]
diff --git a/content/test/test_render_frame.cc b/content/test/test_render_frame.cc index ca15ba3d..7a2db28 100644 --- a/content/test/test_render_frame.cc +++ b/content/test/test_render_frame.cc
@@ -95,11 +95,6 @@ } } - void ShowCreatedWindow(int32_t pending_widget_routing_id, - WindowOpenDisposition disposition, - const gfx::Rect& initial_rect, - bool user_gesture) override {} - void set_overlay_routing_token(const base::UnguessableToken& token) { overlay_routing_token_ = token; }
diff --git a/content/web_test/renderer/web_view_test_proxy.cc b/content/web_test/renderer/web_view_test_proxy.cc index 4a108d9..f77b9ae 100644 --- a/content/web_test/renderer/web_view_test_proxy.cc +++ b/content/web_test/renderer/web_view_test_proxy.cc
@@ -43,7 +43,8 @@ blink::WebNavigationPolicy policy, network::mojom::WebSandboxFlags sandbox_flags, const blink::FeaturePolicyFeatureState& opener_feature_state, - const blink::SessionStorageNamespaceId& session_storage_namespace_id) { + const blink::SessionStorageNamespaceId& session_storage_namespace_id, + bool& consumed_user_gesture) { if (test_runner_->ShouldDumpNavigationPolicy()) { test_runner_->PrintMessage( "Default policy for createView for '" + @@ -61,7 +62,8 @@ } return RenderViewImpl::CreateView(creator, request, features, frame_name, policy, sandbox_flags, opener_feature_state, - session_storage_namespace_id); + session_storage_namespace_id, + consumed_user_gesture); } void WebViewTestProxy::PrintPage(blink::WebLocalFrame* frame) {
diff --git a/content/web_test/renderer/web_view_test_proxy.h b/content/web_test/renderer/web_view_test_proxy.h index 7909ff6e..3a075d6 100644 --- a/content/web_test/renderer/web_view_test_proxy.h +++ b/content/web_test/renderer/web_view_test_proxy.h
@@ -64,15 +64,16 @@ TestRunner* test_runner); // WebViewClient implementation. - blink::WebView* CreateView(blink::WebLocalFrame* creator, - const blink::WebURLRequest& request, - const blink::WebWindowFeatures& features, - const blink::WebString& frame_name, - blink::WebNavigationPolicy policy, - network::mojom::WebSandboxFlags sandbox_flags, - const blink::FeaturePolicyFeatureState&, - const blink::SessionStorageNamespaceId& - session_storage_namespace_id) override; + blink::WebView* CreateView( + blink::WebLocalFrame* creator, + const blink::WebURLRequest& request, + const blink::WebWindowFeatures& features, + const blink::WebString& frame_name, + blink::WebNavigationPolicy policy, + network::mojom::WebSandboxFlags sandbox_flags, + const blink::FeaturePolicyFeatureState&, + const blink::SessionStorageNamespaceId& session_storage_namespace_id, + bool& consumed_user_gesture) override; void PrintPage(blink::WebLocalFrame* frame) override; blink::WebString AcceptLanguages() override;
diff --git a/docs/patterns/fortesting-methods.md b/docs/patterns/fortesting-methods.md index 49718c00..cad25a80 100644 --- a/docs/patterns/fortesting-methods.md +++ b/docs/patterns/fortesting-methods.md
@@ -25,7 +25,7 @@ ## How to use this pattern: -``` +```cpp class Foo { public: // ... regular public API ... @@ -38,7 +38,7 @@ called in production code. There is a very similar antipattern in which the suffix is missing: -``` +```cpp class Foo { public: // ... regular public API ...
diff --git a/docs/patterns/friend-the-tests.md b/docs/patterns/friend-the-tests.md index e9310b9..65a49d5a 100644 --- a/docs/patterns/friend-the-tests.md +++ b/docs/patterns/friend-the-tests.md
@@ -34,7 +34,7 @@ ## How to use this pattern: -``` +```cpp class Foo { public: // ... public API ...
diff --git a/docs/patterns/inversion-of-control.md b/docs/patterns/inversion-of-control.md index d9516f7..3ad639a 100644 --- a/docs/patterns/inversion-of-control.md +++ b/docs/patterns/inversion-of-control.md
@@ -8,51 +8,57 @@ Examples in this document will be given by extending or modifying this example API, which is hopefully self-explanatory: - class StringKVStore { - public: - StringKVStore(); - virtual ~StringKVStore(); +```cpp +class StringKVStore { + public: + StringKVStore(); + virtual ~StringKVStore(); - using KeyPredicate = base::RepeatingCallback<bool(const string&)>; + using KeyPredicate = base::RepeatingCallback<bool(const string&)>; - void Put(const string& key, const string& value); - void Remove(const string& key); - void Clear(); + void Put(const string& key, const string& value); + void Remove(const string& key); + void Clear(); - string Get(const string& key) const; - set<string> GetKeys() const; - set<string> GetKeysMatching(const KeyPredicate& predicate) const; + string Get(const string& key) const; + set<string> GetKeys() const; + set<string> GetKeysMatching(const KeyPredicate& predicate) const; - void SaveToPersistentStore(); - }; + void SaveToPersistentStore(); +}; +``` ### What is inversion of control? Normally, client code calls into the library to do operations, so control flows from a high-level class to a low-level class: - void YourFunction() { - // GetKeys() calls into the StringKVStore library - for (const auto& key : kv_store_.GetKeys()) { - ... - } - } +```cpp +void YourFunction() { + // GetKeys() calls into the StringKVStore library + for (const auto& key : kv_store_.GetKeys()) { + ... + } +} +``` In "inverted" control flow, the library calls back into your code after you call into it, so control flows back from a low-level class to a high-level class: - bool IsKeyInteresting(const string& key) { ... } +```cpp +bool IsKeyInteresting(const string& key) { ... } - void YourFunction() { - StringKVStore::KeyPredicate predicate = - base::BindRepeating(&IsKeyInteresting); - // GetKeysMatching() calls into the StringKVStore library, but it calls - // back into IsKeyInteresting defined in this file! - for (const auto& key : kv_store_.GetKeysMatching(predicate)) { - ... - } - } +void YourFunction() { + StringKVStore::KeyPredicate predicate = + base::BindRepeating(&IsKeyInteresting); + // GetKeysMatching() calls into the StringKVStore library, but it calls + // back into IsKeyInteresting defined in this file! + for (const auto& key : kv_store_.GetKeysMatching(predicate)) { + ... + } +} +``` It is also often inverted in the Chromium dependency sense. For example, in Chromium, code in //content can't call, link against, or generally be aware of @@ -85,81 +91,93 @@ all you need. Callbacks can be used to split out part of the framework's logic into the client, like so: - void StringKVStore::GetKeysMatching(const KeyPredicate& predicate) { - set<string> keys; - for (const auto& key : internal_keys()) { - if (predicate.Run(key)) - keys.insert(key); - } - return keys; - } +```cpp +void StringKVStore::GetKeysMatching(const KeyPredicate& predicate) { + set<string> keys; + for (const auto& key : internal_keys()) { + if (predicate.Run(key)) + keys.insert(key); + } + return keys; +} +``` where `predicate` was supplied by the client of `StringKVStore::GetKeysMatching`. They can also be used for the framework library to notify clients of events, like so: - void StringKVStore::Put(const string& key, const string& value) { - ... - // In real code you would use CallbackList instead, but for explanatory - // purposes: - for (const auto& callback : key_changed_callbacks_) - callback.Run(...); - } +```cpp +void StringKVStore::Put(const string& key, const string& value) { + ... + // In real code you would use CallbackList instead, but for explanatory + // purposes: + for (const auto& callback : key_changed_callbacks_) + callback.Run(...); +} +``` making use of [Subscription]. Callbacks can also be used to supply an implementation of something deliberately omitted, like so: - class StringKVStore { - using SaveCallback = base::RepeatingCallback<void(string, string)>; - void SaveToPersistentStore(const SaveCallback& callback); - }; +```cpp +class StringKVStore { + using SaveCallback = base::RepeatingCallback<void(string, string)>; + void SaveToPersistentStore(const SaveCallback& callback); +}; +``` ### Observers An "observer" receives notifications of events happening on an object. For example, an interface like this might exist: - class StringKVStore::Observer { - public: - virtual void OnKeyChanged(StringKVStore* store, - const string& key, - const string& from_value, - const string& to_value) {} - virtual void OnKeyRemoved(StringKVStore* store, - const string& key, - const string& old_value) {} - ... - } +```cpp +class StringKVStore::Observer { + public: + virtual void OnKeyChanged(StringKVStore* store, + const string& key, + const string& from_value, + const string& to_value) {} + virtual void OnKeyRemoved(StringKVStore* store, + const string& key, + const string& old_value) {} + ... +} +``` and then on the StringKVStore class: - class StringKVStore { - public: - ... - void AddObserver(Observer* observer); - void RemoveObserver(Observer* observer); - } +```cpp +class StringKVStore { + public: + ... + void AddObserver(Observer* observer); + void RemoveObserver(Observer* observer); +} +``` So an example of a `StringKVStore::Observer` might be: - class HelloKeyWatcher : public StringKVStore::Observer { - public: - void OnKeyChanged(StringKVStore* store, - const string& key, - const string& from_value, - const string& to_value) override { - if (key == "hello") - ++hello_changes_; - } - void OnKeyRemoved(StringKVStore* store, - const string& key, - const string& old_value) override { - if (key == "hello") - hello_changes_ = 0; - } - } +```cpp +class HelloKeyWatcher : public StringKVStore::Observer { + public: + void OnKeyChanged(StringKVStore* store, + const string& key, + const string& from_value, + const string& to_value) override { + if (key == "hello") + ++hello_changes_; + } + void OnKeyRemoved(StringKVStore* store, + const string& key, + const string& old_value) override { + if (key == "hello") + hello_changes_ = 0; + } +} +``` where the `StringKVStore` arranges to call the relevant method on each `StringKVStore::Observer` that has been added to it whenever a matching event @@ -180,10 +198,12 @@ Here's an example: - class StringKVStore::ClearListener { - public: - virtual void OnCleared(StringKVStore* store) = 0; - } +```cpp +class StringKVStore::ClearListener { + public: + virtual void OnCleared(StringKVStore* store) = 0; +} +``` Use a listener when: @@ -200,29 +220,35 @@ One very common use of delegates is to allow clients to make policy decisions, like so: - class StringKVStore::Delegate { - public: - virtual bool ShouldPersistKey(StringKVStore* store, const string& key); - virtual bool IsValidValueForKey(StringKVStore* store, - const string& key, - const string& proposed_value); - }; +```cpp +class StringKVStore::Delegate { + public: + virtual bool ShouldPersistKey(StringKVStore* store, const string& key); + virtual bool IsValidValueForKey(StringKVStore* store, + const string& key, + const string& proposed_value); +}; +``` Another common use is to allow clients to inject their own subclasses of framework objects that need to be constructed by the framework, by putting a factory method on the delegate: - class StringKVStore::Delegate { - public: - virtual unique_ptr<StringKVStoreBackend> - CreateBackend(StringKVStore* store); - } +```cpp +class StringKVStore::Delegate { + public: + virtual unique_ptr<StringKVStoreBackend> + CreateBackend(StringKVStore* store); +} +``` And then these might exist: - class MemoryBackedStringKVStoreDelegate : public StringKVStore::Delegate; - class DiskBackedStringKVStoreDelegate : public StringKVStore::Delegate; - ... +```cpp +class MemoryBackedStringKVStoreDelegate : public StringKVStore::Delegate; +class DiskBackedStringKVStoreDelegate : public StringKVStore::Delegate; +... +``` Use a delegate when: @@ -342,9 +368,11 @@ than other approaches. In particular, beware of using delegates when static data would be appropriate. For example, consider this hypothetical interface: - class StringKVStore::Delegate { - virtual bool ShouldSaveAtDestruction() { return true; } - } +```cpp +class StringKVStore::Delegate { + virtual bool ShouldSaveAtDestruction() { return true; } +} +``` It should be clear from the naming that this method will only be called once per StringKVStore instance and that its value cannot meaningfully change within the
diff --git a/docs/patterns/passkey.md b/docs/patterns/passkey.md index 06ef891..bb78280 100644 --- a/docs/patterns/passkey.md +++ b/docs/patterns/passkey.md
@@ -10,7 +10,7 @@ class to be passed in when calling methods you wish to restrict the use of. It is used like this: -``` +```cpp class Foo { public: Foo();
diff --git a/docs/patterns/synchronous-runloop.md b/docs/patterns/synchronous-runloop.md index adf3512..b8a4822 100644 --- a/docs/patterns/synchronous-runloop.md +++ b/docs/patterns/synchronous-runloop.md
@@ -42,10 +42,10 @@ That means that if your code does this: ```c++ - base::RunLoop loop; - maybe-asynchronously { loop.Quit(); } - loop.Run(); - LOG(INFO) << "Hello!"; +base::RunLoop loop; +maybe-asynchronously { loop.Quit(); } +loop.Run(); +LOG(INFO) << "Hello!"; ``` then regardless of whether the maybe-asynchronous `loop.Quit()` is executed @@ -59,44 +59,44 @@ If the asynchronous thing in question takes a completion callback: ```c++ - base::RunLoop run_loop; - Reply reply; - DoThingAndReply( - base::BindLambdaForTesting([&](const Reply& r) { - reply = r; - run_loop.Quit(); - })); - run_loop.Run(); +base::RunLoop run_loop; +Reply reply; +DoThingAndReply( + base::BindLambdaForTesting([&](const Reply& r) { + reply = r; + run_loop.Quit(); + })); +run_loop.Run(); ``` or perhaps even just: ```c++ - base::RunLoop run_loop; - DoThing(run_loop.QuitClosure()); - run_loop.Run(); +base::RunLoop run_loop; +DoThing(run_loop.QuitClosure()); +run_loop.Run(); ``` If there exists a GizmoObserver interface with an OnThingDone event: ```c++ - class TestGizmoObserver : public GizmoObserver { - public: - TestGizmoObserver(base::RunLoop* loop, Gizmo* thing) - : GizmoObserver(thing), loop_(loop) {} +class TestGizmoObserver : public GizmoObserver { + public: + TestGizmoObserver(base::RunLoop* loop, Gizmo* thing) + : GizmoObserver(thing), loop_(loop) {} - // GizmoObserver: - void OnThingStarted(Gizmo* observed_gizmo) override { ... } - void OnThingProgressed(Gizmo* observed_gizmo) override { ... } - void OnThingDone(Gizmo* observed_gizmo) override { - loop_->Quit(); - } - }; + // GizmoObserver: + void OnThingStarted(Gizmo* observed_gizmo) override { ... } + void OnThingProgressed(Gizmo* observed_gizmo) override { ... } + void OnThingDone(Gizmo* observed_gizmo) override { + loop_->Quit(); + } +}; - base::RunLoop run_loop; - TestGizmoObserver observer(&run_loop, gizmo); - gizmo->StartDoingThing(); - run_loop.Run(); +base::RunLoop run_loop; +TestGizmoObserver observer(&run_loop, gizmo); +gizmo->StartDoingThing(); +run_loop.Run(); ``` This is sometimes wrapped up into a helper class that internally constructs the @@ -104,26 +104,26 @@ about observing any intermediate states too: ```c++ - class ThingDoneWaiter : public GizmoObserver { - public: - ThingDoneWaiter(Gizmo* thing) : GizmoObserver(thing) {} +class ThingDoneWaiter : public GizmoObserver { + public: + ThingDoneWaiter(Gizmo* thing) : GizmoObserver(thing) {} - void Wait() { - run_loop_.Run(); - } + void Wait() { + run_loop_.Run(); + } - // GizmoObserver: - void OnThingDone(Gizmo* observed_gizmo) { - run_loop_.Quit(); - } + // GizmoObserver: + void OnThingDone(Gizmo* observed_gizmo) { + run_loop_.Quit(); + } - private: - RunLoop run_loop_; - }; + private: + RunLoop run_loop_; +}; - ThingDoneWaiter waiter(gizmo); - gizmo->StartDoingThing(); - waiter.Wait(); +ThingDoneWaiter waiter(gizmo); +gizmo->StartDoingThing(); +waiter.Wait(); ``` ## Events vs States @@ -141,29 +141,29 @@ opposed to an event: ```c++ - class GizmoReadyWaiter : public GizmoObserver { - public: - GizmoReadyObserver(Gizmo* gizmo) - : gizmo_(gizmo) {} - ~GizmoReadyObserver() override = default; +class GizmoReadyWaiter : public GizmoObserver { + public: + GizmoReadyObserver(Gizmo* gizmo) + : gizmo_(gizmo) {} + ~GizmoReadyObserver() override = default; - void WaitForGizmoReady() { - if (!gizmo_->ready()) { - gizmo_observer_.Add(gizmo_); - run_loop_.Run(); - } + void WaitForGizmoReady() { + if (!gizmo_->ready()) { + gizmo_observer_.Add(gizmo_); + run_loop_.Run(); } + } - // GizmoObserver: - void OnGizmoReady(Gizmo* observed_gizmo) { - run_loop_.Quit(); - } + // GizmoObserver: + void OnGizmoReady(Gizmo* observed_gizmo) { + run_loop_.Quit(); + } - private: - RunLoop run_loop_; - Gizmo* gizmo_; - ScopedObserver<Gizmo, GizmoObserver> gizmo_observer_{this}; - }; + private: + RunLoop run_loop_; + Gizmo* gizmo_; + ScopedObserver<Gizmo, GizmoObserver> gizmo_observer_{this}; +}; ``` ## Sharp edges @@ -173,27 +173,27 @@ A common mis-use of this pattern is like so: ```c++ - gizmo->StartDoingThing(); - base::RunLoop run_loop; - TestGizmoObserver observer(&run_loop, gizmo); - run_loop.Run(); +gizmo->StartDoingThing(); +base::RunLoop run_loop; +TestGizmoObserver observer(&run_loop, gizmo); +run_loop.Run(); ``` This looks tempting because it seems that you can write a helper function: ```c++ - void TerribleHorribleNoGoodVeryBadWaitForThing(Gizmo* gizmo) { - base::RunLoop run_loop; - TestGizmoObserver observer(&run_loop, gizmo); - run_loop.Run(); - } +void TerribleHorribleNoGoodVeryBadWaitForThing(Gizmo* gizmo) { + base::RunLoop run_loop; + TestGizmoObserver observer(&run_loop, gizmo); + run_loop.Run(); +} ``` and then your test code can simply read: ```c++ - gizmo->StartDoingThing(); - TerribleHorribleNoGoodVeryBadWaitForThing(gizmo); +gizmo->StartDoingThing(); +TerribleHorribleNoGoodVeryBadWaitForThing(gizmo); ``` However, this is a recipe for a flaky test: if `gizmo->StartDoingThing()` @@ -210,18 +210,18 @@ start: ```c++ - void NiceFriendlyDoThingAndWait(Gizmo* gizmo) { - base::RunLoop run_loop; - TestGizmoObserver observer(&run_loop, gizmo); - gizmo->StartDoingThing(); - run_loop.Run(); - } +void NiceFriendlyDoThingAndWait(Gizmo* gizmo) { + base::RunLoop run_loop; + TestGizmoObserver observer(&run_loop, gizmo); + gizmo->StartDoingThing(); + run_loop.Run(); +} ``` with the test code being: ```c++ - NiceFriendlyDoThingAndWait(gizmo); +NiceFriendlyDoThingAndWait(gizmo); ``` Note that this is not an issue when waiting on a *state*, since the observer can @@ -233,17 +233,17 @@ if the code under test looks like this: ```c++ - void StartDoingThing() { PostTask(&StepOne); } - void StepOne() { PostTask(&StepTwo); } - void StepTwo() { /* done! */ } +void StartDoingThing() { PostTask(&StepOne); } +void StepOne() { PostTask(&StepTwo); } +void StepTwo() { /* done! */ } ``` it can be tempting to do: ```c++ - gizmo->StartDoingThing(); - base::RunLoop().RunUntilIdle(); - /* now it's done! */ +gizmo->StartDoingThing(); +base::RunLoop().RunUntilIdle(); +/* now it's done! */ ``` However, doing this is adding dependencies to your test code on the exact async @@ -301,43 +301,43 @@ ```c++ - class GizmoReadyWaiter : public GizmoObserver { - public: - GizmoReadyObserver(Gizmo* gizmo) - : gizmo_(gizmo) {} - ~GizmoReadyObserver() override = default; +class GizmoReadyWaiter : public GizmoObserver { + public: + GizmoReadyObserver(Gizmo* gizmo) + : gizmo_(gizmo) {} + ~GizmoReadyObserver() override = default; - void WaitForGizmoReady() { - ASSERT_TRUE(gizmo_) - << "Trying to call Wait() after the Gizmo was destroyed!"; - if (!gizmo_->ready()) { - gizmo_observer_.Add(gizmo_); - run_loop_.Run(); - } + void WaitForGizmoReady() { + ASSERT_TRUE(gizmo_) + << "Trying to call Wait() after the Gizmo was destroyed!"; + if (!gizmo_->ready()) { + gizmo_observer_.Add(gizmo_); + run_loop_.Run(); } + } - // GizmoObserver: - void OnGizmoReady(Gizmo* observed_gizmo) { - gizmo_observer_.Remove(observed_gizmo); - run_loop_.Quit(); - } - void OnGizmoDestroying(Gizmo* observed_gizmo) { - DCHECK_EQ(gizmo_, observed_gizmo); - gizmo_ = nullptr; - // Remove the observer now, to avoid a UAF in the destructor. - gizmo_observer_.Remove(observed_gizmo); - // Bail out so we don't time out in the test waiting for a ready state - // that will never come. - run_loop_.Quit(); - // Was this a possible expected outcome? If not, consider: - // ADD_FAILURE() << "The Gizmo was destroyed before it was ready!"; - } + // GizmoObserver: + void OnGizmoReady(Gizmo* observed_gizmo) { + gizmo_observer_.Remove(observed_gizmo); + run_loop_.Quit(); + } + void OnGizmoDestroying(Gizmo* observed_gizmo) { + DCHECK_EQ(gizmo_, observed_gizmo); + gizmo_ = nullptr; + // Remove the observer now, to avoid a UAF in the destructor. + gizmo_observer_.Remove(observed_gizmo); + // Bail out so we don't time out in the test waiting for a ready state + // that will never come. + run_loop_.Quit(); + // Was this a possible expected outcome? If not, consider: + // ADD_FAILURE() << "The Gizmo was destroyed before it was ready!"; + } - private: - RunLoop run_loop_; - Gizmo* gizmo_; - ScopedObserver<Gizmo, GizmoObserver> gizmo_observer_{this}; - }; + private: + RunLoop run_loop_; + Gizmo* gizmo_; + ScopedObserver<Gizmo, GizmoObserver> gizmo_observer_{this}; +}; ``` [base::RunLoop]: ../../base/run_loop.h
diff --git a/docs/patterns/testapi.md b/docs/patterns/testapi.md index 3367764..8afe146 100644 --- a/docs/patterns/testapi.md +++ b/docs/patterns/testapi.md
@@ -23,8 +23,7 @@ ## How to use this pattern: `//foo/commonly_used.h`: -``` - +```cpp class CommonlyUsed { public: // ... big public API ... @@ -38,7 +37,7 @@ ``` `//foo/commonly_used_test_api.h`: -``` +```cpp class CommonlyUsedTestApi { public: CommonlyUsedTestApi(CommonlyUsed* thing); @@ -53,8 +52,8 @@ ``` And then client code can do: -``` - CommonlyUsedTestApi(commonly_used).DoTestStuff(...); +```cpp +CommonlyUsedTestApi(commonly_used).DoTestStuff(...); ``` Then only link `commonly_used_test_api.{cc,h}` in test targets, so these methods
diff --git a/ios/chrome/app/strings/resources/ios_strings_ja.xtb b/ios/chrome/app/strings/resources/ios_strings_ja.xtb index 58880663..a0eaff1 100644 --- a/ios/chrome/app/strings/resources/ios_strings_ja.xtb +++ b/ios/chrome/app/strings/resources/ios_strings_ja.xtb
@@ -18,6 +18,7 @@ <translation id="1112015203684611006">印刷できませんでした。</translation> <translation id="1125564390852150847">新しいタブを作成。</translation> <translation id="1145536944570833626">既存のデータを削除します。</translation> +<translation id="1154690515305205900">選択したテキストへのリンクを作成できません。</translation> <translation id="1165039591588034296">エラー</translation> <translation id="1172898394251786223">次の項目</translation> <translation id="1176932207622159128">画像を保存できません</translation> @@ -212,6 +213,7 @@ <translation id="3268451620468152448">開いているタブ</translation> <translation id="3272527697863656322">キャンセル</translation> <translation id="3277021493514034324">サイトのアドレスがコピーされました</translation> +<translation id="3285962946108803577">ページを共有...</translation> <translation id="3290875554372353449">アカウントの選択</translation> <translation id="3311748811247479259">オフ</translation> <translation id="3324193307694657476">住所2行目</translation> @@ -612,6 +614,7 @@ <translation id="7658239707568436148">キャンセル</translation> <translation id="766891008101699113">ウェブをプライベートに閲覧するには新しいタブを追加してください。</translation> <translation id="7671141431838911305">インストール</translation> +<translation id="7690812411882623730">テキストリンクを作成できません</translation> <translation id="7701040980221191251">なし</translation> <translation id="7765158879357617694">移動</translation> <translation id="7771470029643830783">ログアウトすると、ブックマーク、履歴、パスワード、その他の Chrome データは、Google アカウントに同期されなくなります。
diff --git a/ios/chrome/app/strings/resources/ios_strings_mk.xtb b/ios/chrome/app/strings/resources/ios_strings_mk.xtb index 17083dbc6..d927c8e 100644 --- a/ios/chrome/app/strings/resources/ios_strings_mk.xtb +++ b/ios/chrome/app/strings/resources/ios_strings_mk.xtb
@@ -18,6 +18,7 @@ <translation id="1112015203684611006">Печатењето не успеа.</translation> <translation id="1125564390852150847">Создај нова картичка.</translation> <translation id="1145536944570833626">Избришете ги постоечките податоци.</translation> +<translation id="1154690515305205900">Не може да се создаде линк до нагласениот текст.</translation> <translation id="1165039591588034296">Грешка</translation> <translation id="1172898394251786223">Следно поле</translation> <translation id="1176932207622159128">Не може да се зачува сликата</translation> @@ -212,6 +213,7 @@ <translation id="3268451620468152448">Отворени картички</translation> <translation id="3272527697863656322">Откажи</translation> <translation id="3277021493514034324">Адресата на сајтот е копирана</translation> +<translation id="3285962946108803577">Сподели ја страницата…</translation> <translation id="3290875554372353449">Изберете сметка</translation> <translation id="3311748811247479259">Исклучено</translation> <translation id="3324193307694657476">Адреса 2</translation> @@ -612,6 +614,7 @@ <translation id="7658239707568436148">Откажи</translation> <translation id="766891008101699113">За приватно прелистување на интернет, додајте нова картичка.</translation> <translation id="7671141431838911305">ИНСТАЛИРАЈ</translation> +<translation id="7690812411882623730">Неуспешен линк до текстот</translation> <translation id="7701040980221191251">Нема</translation> <translation id="7765158879357617694">Премести</translation> <translation id="7771470029643830783">Ако се одјавите, обележувачите, историјата, лозинките и другите податоци од Chrome веќе нема да се синхронизираат со вашата сметка на Google.
diff --git a/ios/chrome/app/strings/resources/ios_strings_my.xtb b/ios/chrome/app/strings/resources/ios_strings_my.xtb index 6cd925b..d4a27a27 100644 --- a/ios/chrome/app/strings/resources/ios_strings_my.xtb +++ b/ios/chrome/app/strings/resources/ios_strings_my.xtb
@@ -18,6 +18,7 @@ <translation id="1112015203684611006">ပုံနှိပ်ခြင်း မအောင်မြင်ပါ။</translation> <translation id="1125564390852150847">တဘ်အသစ်ဖန်တီးပါ</translation> <translation id="1145536944570833626">လက်ရှိဒေတာများကို ဖျက်ပါ</translation> +<translation id="1154690515305205900">မြင်သာထင်သာဖြစ်အောင်လုပ်ထားသော စာသားသို့ လင့်ခ်ကို ပြုလုပ်၍မရပါ။</translation> <translation id="1165039591588034296">အမှား</translation> <translation id="1172898394251786223">ရှေ့ အကွက်</translation> <translation id="1176932207622159128">ရုပ်ပုံကို မသိမ်းဆည်းနိုင်ပါ။</translation> @@ -212,6 +213,7 @@ <translation id="3268451620468152448">တဲဘ်များ ဖွင့်ရန်</translation> <translation id="3272527697863656322">မလုပ်တော့</translation> <translation id="3277021493514034324">ဝဘ်ဆိုက်လိပ်စာကို မိတ္တူကူးယူထားသည်</translation> +<translation id="3285962946108803577">စာမျက်နှာကို မျှဝေရန်...</translation> <translation id="3290875554372353449">'အကောင့်' တစ်ခု ရွေးရန်</translation> <translation id="3311748811247479259">ပိတ်ထားသည်</translation> <translation id="3324193307694657476">လိပ်စာ 2</translation> @@ -611,6 +613,7 @@ <translation id="7658239707568436148">မလုပ်တော့</translation> <translation id="766891008101699113">ဝဘ်ကို သီးသန့်မုဒ်ဖြင့် ကြည့်ရန် တဘ်အသစ်ဖွင့်ပါ။</translation> <translation id="7671141431838911305">တပ်ဆင်မည်</translation> +<translation id="7690812411882623730">'စာသားနှင့် လင့်ခ်ချိတ်၍' မရပါ</translation> <translation id="7701040980221191251">မရှိ</translation> <translation id="7765158879357617694">ရွှေ့ရန်</translation> <translation id="7771470029643830783">အကောင့်မှထွက်ခြင်းဖြင့် သင်၏လိပ်စာများ၊ မှတ်တမ်း၊ စကားဝှက်များနှင့် အခြား Chrome ဒေတာများကို သင့် Google Account သို့ စင့်ခ်လုပ်တော့မည် မဟုတ်ပါ။
diff --git a/ios/chrome/app/strings/resources/ios_strings_si.xtb b/ios/chrome/app/strings/resources/ios_strings_si.xtb index 2c8e0c6..4fc1c81 100644 --- a/ios/chrome/app/strings/resources/ios_strings_si.xtb +++ b/ios/chrome/app/strings/resources/ios_strings_si.xtb
@@ -18,6 +18,7 @@ <translation id="1112015203684611006">මුද්රණය කිරීම අසාර්ථක විය.</translation> <translation id="1125564390852150847">නව පටිත්තක් තනන්න.</translation> <translation id="1145536944570833626">පවතින දත්ත මකන්න.</translation> +<translation id="1154690515305205900">උද්දීපනය කළ පෙළට සබැඳියක් තැනිය නොහැකිය.</translation> <translation id="1165039591588034296">දෝෂයක්</translation> <translation id="1172898394251786223">ඊළඟ ක්ෂේත්රය</translation> <translation id="1176932207622159128">රූපය සුරැකිය නොහැකිය</translation> @@ -212,6 +213,7 @@ <translation id="3268451620468152448">ටැබ විවෘත කරන්න</translation> <translation id="3272527697863656322">අවලංගු කරන්න</translation> <translation id="3277021493514034324">අඩවි ලිපිනය පිටපත් කරන ලදී</translation> +<translation id="3285962946108803577">පිටුව බෙදා ගන්න...</translation> <translation id="3290875554372353449">ගිණුමක් තෝරා ගන්න</translation> <translation id="3311748811247479259">අක්රිය</translation> <translation id="3324193307694657476">ලිපිනය 2</translation> @@ -612,6 +614,7 @@ <translation id="7658239707568436148">අවලංගු කරන්න</translation> <translation id="766891008101699113">වෙබය පෞද්ගලිකව බ්රවුස් කිරීමට, නව පටිත්තක් එක් කරන්න.</translation> <translation id="7671141431838911305">ස්ථාපනය</translation> +<translation id="7690812411882623730">පෙළට සබැඳි කළ නොහැකිය</translation> <translation id="7701040980221191251">නොමැත</translation> <translation id="7765158879357617694">චලනය කරන්න</translation> <translation id="7771470029643830783">වරනය වීමෙන්, ඔබේ පිටුසන්, ඉතිහාසය, මුරපද සහ අනෙකුත් Chrome දත්ත තවදුරටත් ඔබේ Google ගිණුමට සමමුහුර්ත නොවෙයි.
diff --git a/ios/chrome/app/strings/resources/ios_strings_uz.xtb b/ios/chrome/app/strings/resources/ios_strings_uz.xtb index 297f8ac0..79480096 100644 --- a/ios/chrome/app/strings/resources/ios_strings_uz.xtb +++ b/ios/chrome/app/strings/resources/ios_strings_uz.xtb
@@ -18,6 +18,7 @@ <translation id="1112015203684611006">Chop etilmadi.</translation> <translation id="1125564390852150847">Yangi sahifa ochish</translation> <translation id="1145536944570833626">Mavjud ma’lumotlarni o‘chirish.</translation> +<translation id="1154690515305205900">Belgilangan matnga havola yaratilmadi.</translation> <translation id="1165039591588034296">Xatolik</translation> <translation id="1172898394251786223">Keyingi maydoncha</translation> <translation id="1176932207622159128">Tasvir saqlanmadi</translation> @@ -212,6 +213,7 @@ <translation id="3268451620468152448">Ochiq ichki oynalar</translation> <translation id="3272527697863656322">Bekor qilish</translation> <translation id="3277021493514034324">Sayt manzilidan nusxa olindi</translation> +<translation id="3285962946108803577">Sahifani ulashish...</translation> <translation id="3290875554372353449">Hisobni tanlang</translation> <translation id="3311748811247479259">Yoqilmagan</translation> <translation id="3324193307694657476">Manzil, 2-qator</translation> @@ -612,6 +614,7 @@ <translation id="7658239707568436148">Bekor qilish</translation> <translation id="766891008101699113">Internetni pinhona kezish uchun yangi varaq oching.</translation> <translation id="7671141431838911305">O‘RNATISH</translation> +<translation id="7690812411882623730">Matn havolasi nusxalanmadi</translation> <translation id="7701040980221191251">Hech qanday</translation> <translation id="7765158879357617694">Ko‘chirib o‘tkazish</translation> <translation id="7771470029643830783">Hisobingizdan chiqsangiz, bukmarklar, tarix, parollar va boshqa Chrome maʼlumotlaringiz bilan Google hisobingiz sinxronizatsiyasi uziladi.
diff --git a/ios/chrome/browser/app_launcher/app_launcher_tab_helper.mm b/ios/chrome/browser/app_launcher/app_launcher_tab_helper.mm index c42f84a..4fd071c 100644 --- a/ios/chrome/browser/app_launcher/app_launcher_tab_helper.mm +++ b/ios/chrome/browser/app_launcher/app_launcher_tab_helper.mm
@@ -144,7 +144,7 @@ if (!delegate_) return; delegate_->ShowRepeatedAppLaunchAlert( - this, base::BindOnce(^(BOOL user_allowed) { + this, base::BindOnce(^(bool user_allowed) { if (!weak_this.get()) return; if (user_allowed && weak_this->delegate()) {
diff --git a/ios/chrome/browser/browser_state/BUILD.gn b/ios/chrome/browser/browser_state/BUILD.gn index 0daf288..0b7d6d6 100644 --- a/ios/chrome/browser/browser_state/BUILD.gn +++ b/ios/chrome/browser/browser_state/BUILD.gn
@@ -202,6 +202,7 @@ "//ios/chrome/browser/bookmarks", "//ios/chrome/browser/history", "//ios/chrome/browser/net", + "//ios/chrome/browser/policy:policy", "//ios/chrome/browser/prefs", "//ios/chrome/browser/prefs:browser_prefs", "//ios/chrome/browser/sync/glue",
diff --git a/ios/chrome/browser/browser_state/test_chrome_browser_state.h b/ios/chrome/browser/browser_state/test_chrome_browser_state.h index 45b9c37d..0538413 100644 --- a/ios/chrome/browser/browser_state/test_chrome_browser_state.h +++ b/ios/chrome/browser/browser_state/test_chrome_browser_state.h
@@ -16,6 +16,7 @@ #include "components/keyed_service/ios/refcounted_browser_state_keyed_service_factory.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" #include "ios/chrome/browser/net/net_types.h" +#include "ios/chrome/browser/policy/browser_state_policy_connector.h" namespace sync_preferences { class PrefServiceSyncable; @@ -106,6 +107,9 @@ void SetPrefService( std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs); + void SetPolicyConnector( + std::unique_ptr<BrowserStatePolicyConnector> policy_connector); + // Creates the TestChromeBrowserState using previously-set settings. std::unique_ptr<TestChromeBrowserState> Build(); @@ -117,6 +121,8 @@ base::FilePath state_path_; std::unique_ptr<sync_preferences::PrefServiceSyncable> pref_service_; + std::unique_ptr<BrowserStatePolicyConnector> policy_connector_; + TestingFactories testing_factories_; RefcountedTestingFactories refcounted_testing_factories_; @@ -129,7 +135,8 @@ const base::FilePath& path, std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs, TestingFactories testing_factories, - RefcountedTestingFactories refcounted_testing_factories); + RefcountedTestingFactories refcounted_testing_factories, + std::unique_ptr<BrowserStatePolicyConnector> policy_connector); private: friend class Builder; @@ -151,6 +158,8 @@ std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs_; sync_preferences::TestingPrefServiceSyncable* testing_prefs_; + std::unique_ptr<BrowserStatePolicyConnector> policy_connector_; + // The incognito ChromeBrowserState instance that is associated with this // non-incognito ChromeBrowserState instance. std::unique_ptr<TestChromeBrowserState> otr_browser_state_;
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 28ad685..3e49555ae 100644 --- a/ios/chrome/browser/browser_state/test_chrome_browser_state.mm +++ b/ios/chrome/browser/browser_state/test_chrome_browser_state.mm
@@ -105,12 +105,14 @@ const base::FilePath& path, std::unique_ptr<sync_preferences::PrefServiceSyncable> prefs, TestingFactories testing_factories, - RefcountedTestingFactories refcounted_testing_factories) + RefcountedTestingFactories refcounted_testing_factories, + std::unique_ptr<BrowserStatePolicyConnector> policy_connector) : ChromeBrowserState(base::ThreadPool::CreateSequencedTaskRunner( {base::MayBlock(), base::TaskShutdownBehavior::BLOCK_SHUTDOWN})), state_path_(path), prefs_(std::move(prefs)), testing_prefs_(nullptr), + policy_connector_(std::move(policy_connector)), otr_browser_state_(nullptr), original_browser_state_(nullptr) { for (const auto& pair : testing_factories) { @@ -236,9 +238,7 @@ } BrowserStatePolicyConnector* TestChromeBrowserState::GetPolicyConnector() { - // TODO(crbug.com/1055318): Determine what level of support is needed for - // unittesting and return a mock or fake here. - return nullptr; + return policy_connector_.get(); } PrefService* TestChromeBrowserState::GetPrefs() { @@ -354,11 +354,17 @@ pref_service_ = std::move(prefs); } +void TestChromeBrowserState::Builder::SetPolicyConnector( + std::unique_ptr<BrowserStatePolicyConnector> policy_connector) { + DCHECK(!build_called_); + policy_connector_ = std::move(policy_connector); +} + std::unique_ptr<TestChromeBrowserState> TestChromeBrowserState::Builder::Build() { DCHECK(!build_called_); build_called_ = true; return base::WrapUnique(new TestChromeBrowserState( state_path_, std::move(pref_service_), std::move(testing_factories_), - std::move(refcounted_testing_factories_))); + std::move(refcounted_testing_factories_), std::move(policy_connector_))); }
diff --git a/ios/chrome/browser/browser_state/test_chrome_browser_state_manager.cc b/ios/chrome/browser/browser_state/test_chrome_browser_state_manager.cc index d02fe6d6..ffd5230 100644 --- a/ios/chrome/browser/browser_state/test_chrome_browser_state_manager.cc +++ b/ios/chrome/browser/browser_state/test_chrome_browser_state_manager.cc
@@ -30,6 +30,8 @@ ChromeBrowserState* TestChromeBrowserStateManager::GetBrowserState( const base::FilePath& path) { + if (browser_state_ && browser_state_->GetStatePath() == path) + return browser_state_.get(); return nullptr; }
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_interaction_handler.mm b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_interaction_handler.mm index 9c226d9..6027fd8 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_interaction_handler.mm +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_interaction_handler.mm
@@ -20,7 +20,9 @@ std::make_unique<PasswordInfobarBannerInteractionHandler>( SavePasswordInfobarBannerOverlayRequestConfig::RequestSupport()), /*sheet_handler=*/nullptr, - std::make_unique<PasswordInfobarModalInteractionHandler>(browser)) {} + std::make_unique<PasswordInfobarModalInteractionHandler>( + browser, + password_modal::PasswordAction::kSave)) {} PasswordInfobarInteractionHandler::~PasswordInfobarInteractionHandler() = default;
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler.h b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler.h index 8258793d..c5fb1975 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler.h +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler.h
@@ -7,13 +7,17 @@ #import "ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/common/infobar_modal_interaction_handler.h" +#import "ios/chrome/browser/overlays/public/infobar_modal/password_infobar_modal_overlay_request_config.h" + class Browser; class IOSChromeSavePasswordInfoBarDelegate; class PasswordInfobarModalInteractionHandler : public InfobarModalInteractionHandler { public: - PasswordInfobarModalInteractionHandler(Browser* browser); + PasswordInfobarModalInteractionHandler( + Browser* browser, + password_modal::PasswordAction action_type); ~PasswordInfobarModalInteractionHandler() override; // Instructs the handler to update the credentials with |username| and @@ -60,6 +64,9 @@ // The Browser passed on initialization. Browser* browser_ = nullptr; + + // Type of Password Infobar Overlay this handler is managing. + password_modal::PasswordAction action_type_; }; #endif // IOS_CHROME_BROWSER_INFOBARS_OVERLAYS_BROWSER_AGENT_INTERACTION_HANDLERS_PASSWORDS_PASSWORD_INFOBAR_MODAL_INTERACTION_HANDLER_H_
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler.mm b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler.mm index ea0c7a9..a0dbdf13 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler.mm +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler.mm
@@ -19,8 +19,9 @@ PasswordInfobarModalInteractionHandler() = default; PasswordInfobarModalInteractionHandler::PasswordInfobarModalInteractionHandler( - Browser* browser) - : browser_(browser) { + Browser* browser, + password_modal::PasswordAction action_type) + : browser_(browser), action_type_(action_type) { DCHECK(browser_); } @@ -68,7 +69,7 @@ std::unique_ptr<InfobarModalOverlayRequestCallbackInstaller> PasswordInfobarModalInteractionHandler::CreateModalInstaller() { return std::make_unique<PasswordInfobarModalOverlayRequestCallbackInstaller>( - this); + this, action_type_); } IOSChromeSavePasswordInfoBarDelegate*
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler_unittest.mm b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler_unittest.mm index 9e353c4..e942500 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler_unittest.mm +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler_unittest.mm
@@ -41,8 +41,8 @@ [browser_.GetCommandDispatcher() startDispatchingToTarget:mock_command_receiver_ forProtocol:@protocol(ApplicationSettingsCommands)]; - handler_ = - std::make_unique<PasswordInfobarModalInteractionHandler>(&browser_); + handler_ = std::make_unique<PasswordInfobarModalInteractionHandler>( + &browser_, password_modal::PasswordAction::kSave); } ~PasswordInfobarModalInteractionHandlerTest() override { [browser_.GetCommandDispatcher()
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer.h b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer.h index 19a27bf..77478f3 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer.h +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer.h
@@ -8,6 +8,7 @@ #import "ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/common/infobar_modal_overlay_request_callback_installer.h" #include "base/memory/weak_ptr.h" +#import "ios/chrome/browser/overlays/public/infobar_modal/password_infobar_modal_overlay_request_config.h" class PasswordInfobarModalInteractionHandler; @@ -17,9 +18,11 @@ : public InfobarModalOverlayRequestCallbackInstaller { public: // Constructor for an instance that installs callbacks that forward - // interaction events to |interaction_handler|. + // interaction events to |interaction_handler| for an Password Infobar Overlay + // of type |action_type|. explicit PasswordInfobarModalOverlayRequestCallbackInstaller( - PasswordInfobarModalInteractionHandler* interaction_handler); + PasswordInfobarModalInteractionHandler* interaction_handler, + password_modal::PasswordAction action_type); ~PasswordInfobarModalOverlayRequestCallbackInstaller() override; private: @@ -57,6 +60,9 @@ // The handler for received responses. PasswordInfobarModalInteractionHandler* interaction_handler_ = nullptr; + // The type of Password Infobar Overlay this installer handles. + password_modal::PasswordAction password_action_; + base::WeakPtrFactory<PasswordInfobarModalOverlayRequestCallbackInstaller> weak_factory_{this}; };
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer.mm b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer.mm index 13ae01bd..54c03d1 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer.mm +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer.mm
@@ -24,11 +24,13 @@ PasswordInfobarModalOverlayRequestCallbackInstaller:: PasswordInfobarModalOverlayRequestCallbackInstaller( - PasswordInfobarModalInteractionHandler* interaction_handler) + PasswordInfobarModalInteractionHandler* interaction_handler, + password_modal::PasswordAction action_type) : InfobarModalOverlayRequestCallbackInstaller( PasswordInfobarModalOverlayRequestConfig::RequestSupport(), interaction_handler), - interaction_handler_(interaction_handler) { + interaction_handler_(interaction_handler), + password_action_(action_type) { DCHECK(interaction_handler_); } @@ -41,8 +43,16 @@ UpdateCredentialsCallback(OverlayRequest* request, OverlayResponse* response) { InfoBarIOS* infobar = GetOverlayRequestInfobar(request); - if (!infobar) + if (!infobar) { return; + } + // Since this installer is used for both Save and Update password overlays, + // the callback will be executed for both types. Return early if the request + // is not the same type. + if (request->GetConfig<PasswordInfobarModalOverlayRequestConfig>() + ->action() != password_action_) { + return; + } UpdateCredentialsInfo* info = response->GetInfo<UpdateCredentialsInfo>(); interaction_handler_->UpdateCredentials(GetOverlayRequestInfobar(request), info->username(), info->password()); @@ -52,8 +62,16 @@ NeverSaveCredentialsCallback(OverlayRequest* request, OverlayResponse* response) { InfoBarIOS* infobar = GetOverlayRequestInfobar(request); - if (!infobar) + if (!infobar) { return; + } + // Since this installer is used for both Save and Update password overlays, + // the callback will be executed for both types. Return early if the request + // is not the same type. + if (request->GetConfig<PasswordInfobarModalOverlayRequestConfig>() + ->action() != password_action_) { + return; + } // Inform the interaction handler to never save credentials, then add the // infobar removal callback as a completion. This causes the infobar and its // badge to be removed once the infobar modal's dismissal finishes. @@ -67,6 +85,13 @@ void PasswordInfobarModalOverlayRequestCallbackInstaller:: PresentPasswordsSettingsCallback(OverlayRequest* request, OverlayResponse* response) { + // Since this installer is used for both Save and Update password overlays, + // the callback will be executed for both types. Return early if the request + // is not the same type. + if (request->GetConfig<PasswordInfobarModalOverlayRequestConfig>() + ->action() != password_action_) { + return; + } // Add a completion callback to trigger the presentation of the password // settings view once the infobar modal's dismissal finishes. request->GetCallbackManager()->AddCompletionCallback( @@ -79,8 +104,16 @@ RemoveInfobarCompletionCallback(OverlayRequest* request, OverlayResponse* response) { InfoBarIOS* infobar = GetOverlayRequestInfobar(request); - if (!infobar) + if (!infobar) { return; + } + // Since this installer is used for both Save and Update password overlays, + // the callback will be executed for both types. Return early if the request + // is not the same type. + if (request->GetConfig<PasswordInfobarModalOverlayRequestConfig>() + ->action() != password_action_) { + return; + } InfoBarManagerImpl::FromWebState(request->GetQueueWebState()) ->RemoveInfoBar(infobar); } @@ -89,8 +122,12 @@ PresentPasswordSettingsCompletionCallback(OverlayRequest* request, OverlayResponse* response) { InfoBarIOS* infobar = GetOverlayRequestInfobar(request); - if (!infobar) + if (!infobar) { return; + } + DCHECK_EQ( + request->GetConfig<PasswordInfobarModalOverlayRequestConfig>()->action(), + password_action_); interaction_handler_->PresentPasswordsSettings(infobar); }
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer_unittest.mm b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer_unittest.mm index 7233cee..22b20e0 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer_unittest.mm +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_overlay_request_callback_installer_unittest.mm
@@ -39,7 +39,9 @@ : public PlatformTest { public: PasswordInfobarModalOverlayRequestCallbackInstallerTest() - : installer_(&mock_handler_) { + : installer_(&mock_handler_, password_modal::PasswordAction::kSave), + update_installer_(&mock_handler_, + password_modal::PasswordAction::kUpdate) { scoped_feature_list_.InitWithFeatures({kIOSInfobarUIReboot}, {kInfobarUIRebootOnlyiOS13}); // Create the infobar and add it to the WebState's manager. @@ -77,6 +79,7 @@ OverlayRequest* request_ = nullptr; MockPasswordInfobarModalInteractionHandler mock_handler_; PasswordInfobarModalOverlayRequestCallbackInstaller installer_; + PasswordInfobarModalOverlayRequestCallbackInstaller update_installer_; }; // Tests that a dispatched InfobarBannerMainActionResponse calls @@ -132,3 +135,20 @@ EXPECT_CALL(mock_handler_, PresentPasswordsSettings(infobar_)); queue()->CancelAllRequests(); } + +// Tests that dispatch responses for a save password RequestConfig do not cause +// the update callback installer to call it's interaction handler. +TEST_F(PasswordInfobarModalOverlayRequestCallbackInstallerTest, SaveNotUpdate) { + update_installer_.InstallCallbacks(request_); + // Dispatch a PresentPasswordSettings response. + request_->GetCallbackManager()->DispatchResponse( + OverlayResponse::CreateWithInfo<PresentPasswordSettings>()); + + // When the installer handles the PresentPasswordSettings response, it adds a + // completion callback to the request that instructs the interaction handler + // to present settings when the dismissal finishes. Cancel the request to + // trigger this completion callback and verify that the interaction handler's + // PresentPasswordSettings() was called. + EXPECT_CALL(mock_handler_, PresentPasswordsSettings(infobar_)).Times(1); + queue()->CancelAllRequests(); +}
diff --git a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/update_password_infobar_interaction_handler.mm b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/update_password_infobar_interaction_handler.mm index fe7ebe3..869e7f8 100644 --- a/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/update_password_infobar_interaction_handler.mm +++ b/ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/update_password_infobar_interaction_handler.mm
@@ -9,6 +9,7 @@ #import "ios/chrome/browser/infobars/overlays/browser_agent/interaction_handlers/passwords/password_infobar_modal_interaction_handler.h" #import "ios/chrome/browser/overlays/public/infobar_banner/save_password_infobar_banner_overlay.h" #import "ios/chrome/browser/overlays/public/infobar_banner/update_password_infobar_banner_overlay.h" +#import "ios/chrome/browser/overlays/public/infobar_modal/password_infobar_modal_overlay_request_config.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -22,7 +23,9 @@ UpdatePasswordInfobarBannerOverlayRequestConfig:: RequestSupport()), /*sheet_handler=*/nullptr, - std::make_unique<PasswordInfobarModalInteractionHandler>(browser)) {} + std::make_unique<PasswordInfobarModalInteractionHandler>( + browser, + password_modal::PasswordAction::kUpdate)) {} UpdatePasswordInfobarInteractionHandler:: ~UpdatePasswordInfobarInteractionHandler() = default;
diff --git a/ios/chrome/browser/policy/BUILD.gn b/ios/chrome/browser/policy/BUILD.gn index 0af5e89b..9a4c147 100644 --- a/ios/chrome/browser/policy/BUILD.gn +++ b/ios/chrome/browser/policy/BUILD.gn
@@ -87,6 +87,8 @@ source_set("test_support") { testonly = true sources = [ + "browser_state_policy_connector_mock.h", + "browser_state_policy_connector_mock.mm", "enterprise_policy_test_helper.cc", "enterprise_policy_test_helper.h", "test_platform_policy_provider.cc",
diff --git a/ios/chrome/browser/policy/browser_state_policy_connector.h b/ios/chrome/browser/policy/browser_state_policy_connector.h index 94f037a..c049860 100644 --- a/ios/chrome/browser/policy/browser_state_policy_connector.h +++ b/ios/chrome/browser/policy/browser_state_policy_connector.h
@@ -43,6 +43,8 @@ policy::SchemaRegistry* GetSchemaRegistry() const { return schema_registry_; } private: + friend class BrowserStatePolicyConnectorMock; + // |policy_providers_| contains a list of the policy providers available for // the PolicyService of this connector, in decreasing order of priority. //
diff --git a/ios/chrome/browser/policy/browser_state_policy_connector_mock.h b/ios/chrome/browser/policy/browser_state_policy_connector_mock.h new file mode 100644 index 0000000..bbd4d36 --- /dev/null +++ b/ios/chrome/browser/policy/browser_state_policy_connector_mock.h
@@ -0,0 +1,31 @@ +// 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. + +#ifndef IOS_CHROME_BROWSER_POLICY_BROWSER_STATE_POLICY_CONNECTOR_MOCK_H_ +#define IOS_CHROME_BROWSER_POLICY_BROWSER_STATE_POLICY_CONNECTOR_MOCK_H_ + +#include <memory> + +#include "ios/chrome/browser/policy/browser_state_policy_connector.h" + +namespace policy { +class PolicyService; +class SchemaRegistry; +} // namespace policy + +// BrowserStatePolicyConnector creates and manages the per-BrowserState policy +// components and their integration with PrefService. +class BrowserStatePolicyConnectorMock : public BrowserStatePolicyConnector { + public: + BrowserStatePolicyConnectorMock( + std::unique_ptr<policy::PolicyService> policy_service, + policy::SchemaRegistry* schema_registry); + ~BrowserStatePolicyConnectorMock(); + BrowserStatePolicyConnectorMock(const BrowserStatePolicyConnectorMock&) = + delete; + BrowserStatePolicyConnectorMock& operator=( + const BrowserStatePolicyConnectorMock&) = delete; +}; + +#endif // IOS_CHROME_BROWSER_POLICY_BROWSER_STATE_POLICY_CONNECTOR_MOCK_H_
diff --git a/ios/chrome/browser/policy/browser_state_policy_connector_mock.mm b/ios/chrome/browser/policy/browser_state_policy_connector_mock.mm new file mode 100644 index 0000000..0b888a7 --- /dev/null +++ b/ios/chrome/browser/policy/browser_state_policy_connector_mock.mm
@@ -0,0 +1,21 @@ +// 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. + +#import "ios/chrome/browser/policy/browser_state_policy_connector_mock.h" + +#include "components/policy/core/common/policy_service_impl.h" +#include "components/policy/core/common/schema_registry.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +BrowserStatePolicyConnectorMock::BrowserStatePolicyConnectorMock( + std::unique_ptr<policy::PolicyService> policy_service, + policy::SchemaRegistry* schema_registry) { + policy_service_ = std::move(policy_service); + schema_registry_ = schema_registry; +} + +BrowserStatePolicyConnectorMock::~BrowserStatePolicyConnectorMock() = default;
diff --git a/ios/chrome/browser/ui/activity_services/activities/generate_qr_code_activity.mm b/ios/chrome/browser/ui/activity_services/activities/generate_qr_code_activity.mm index 58fa0b6..c7900566 100644 --- a/ios/chrome/browser/ui/activity_services/activities/generate_qr_code_activity.mm +++ b/ios/chrome/browser/ui/activity_services/activities/generate_qr_code_activity.mm
@@ -55,7 +55,7 @@ } - (BOOL)canPerformWithActivityItems:(NSArray*)activityItems { - return self.handler; + return self.handler != nil; } + (UIActivityCategory)activityCategory {
diff --git a/ios/chrome/browser/ui/settings/cells/BUILD.gn b/ios/chrome/browser/ui/settings/cells/BUILD.gn index bcbeceb..8cdc8bf 100644 --- a/ios/chrome/browser/ui/settings/cells/BUILD.gn +++ b/ios/chrome/browser/ui/settings/cells/BUILD.gn
@@ -86,6 +86,7 @@ "passphrase_error_item_unittest.mm", "search_engine_item_unittest.mm", "settings_check_item_unittest.mm", + "settings_image_detail_text_item_unittest.mm", "settings_multiline_detail_item_unittest.mm", "version_item_unittest.mm", ]
diff --git a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h index 4e94366..cae2406 100644 --- a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h +++ b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h
@@ -28,6 +28,10 @@ // The detail text to display. @property(nonatomic, copy) NSString* detailText; +// UIColor for the cell's detailTextLabel. If not set, +// UIColor.cr_secondaryLabelColor is used. +@property(nonatomic, strong) UIColor* detailTextColor; + @end #endif // IOS_CHROME_BROWSER_UI_SETTINGS_CELLS_SETTINGS_IMAGE_DETAIL_TEXT_ITEM_H_
diff --git a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.mm b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.mm index 6245157..dc5075b 100644 --- a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.mm +++ b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.mm
@@ -30,6 +30,10 @@ cell.detailTextLabel.text = self.detailText; DCHECK(self.image); cell.image = self.image; + + if (self.detailTextColor) { + cell.detailTextLabel.textColor = self.detailTextColor; + } } @end
diff --git a/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item_unittest.mm new file mode 100644 index 0000000..78e3748 --- /dev/null +++ b/ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item_unittest.mm
@@ -0,0 +1,70 @@ +// 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. + +#import "ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h" + +#import "ios/chrome/browser/ui/settings/cells/settings_image_detail_text_cell.h" +#import "ios/chrome/browser/ui/table_view/chrome_table_view_styler.h" +#import "ios/chrome/common/ui/colors/UIColor+cr_semantic_colors.h" +#include "testing/gtest/include/gtest/gtest.h" +#import "testing/gtest_mac.h" +#include "testing/platform_test.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +using SettingsImageDetailTextItemTest = PlatformTest; + +// Tests that the text, detail text and image are honoured after a call to +// |configureCell:|. +TEST_F(SettingsImageDetailTextItemTest, ConfigureCell) { + SettingsImageDetailTextItem* item = + [[SettingsImageDetailTextItem alloc] initWithType:0]; + NSString* text = @"Test Text"; + NSString* detailText = @"Test Detail Text"; + UIImage* image = [[UIImage alloc] init]; + item.image = image; + item.text = text; + item.detailText = detailText; + + id cell = [[[item cellClass] alloc] init]; + ASSERT_TRUE([cell isMemberOfClass:[SettingsImageDetailTextCell class]]); + + SettingsImageDetailTextCell* imageDetailCell = + static_cast<SettingsImageDetailTextCell*>(cell); + + EXPECT_FALSE(imageDetailCell.textLabel.text); + EXPECT_FALSE(imageDetailCell.detailTextLabel.text); + + [item configureCell:cell withStyler:[[ChromeTableViewStyler alloc] init]]; + EXPECT_NSEQ(text, imageDetailCell.textLabel.text); + EXPECT_NSEQ(detailText, imageDetailCell.detailTextLabel.text); + EXPECT_NSEQ(UIColor.cr_secondaryLabelColor, + imageDetailCell.detailTextLabel.textColor); + EXPECT_NSEQ(image, imageDetailCell.image); +} + +// Tests that the detail text color is updated when detailTextColor is not +// nil. +TEST_F(SettingsImageDetailTextItemTest, setDetailTextColor) { + SettingsImageDetailTextItem* item = + [[SettingsImageDetailTextItem alloc] initWithType:0]; + NSString* text = @"Test Text"; + NSString* detailText = @"Test Detail Text"; + item.text = text; + item.detailText = detailText; + item.detailTextColor = UIColor.blueColor; + item.image = [[UIImage alloc] init]; + + id cell = [[[item cellClass] alloc] init]; + ASSERT_TRUE([cell isMemberOfClass:[SettingsImageDetailTextCell class]]); + + [item configureCell:cell withStyler:[[ChromeTableViewStyler alloc] init]]; + + SettingsImageDetailTextCell* imageDetailCell = + static_cast<SettingsImageDetailTextCell*>(cell); + + EXPECT_NSEQ(UIColor.blueColor, imageDetailCell.detailTextLabel.textColor); +}
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 0ac8a87..25a06d6 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
@@ -736,6 +736,7 @@ break; } } + __weak __typeof__(self) weakSelf = self; // This handles a discrepancy between password check and safety check. In // password check a user cannot start a check if they have no passwords, but // in safety check they can, but the |passwordCheckManager| won't even start @@ -749,9 +750,9 @@ dispatch_get_main_queue(), ^{ // Check if the check was cancelled while waiting, we do not want to // push a completed state to the UI if the check was cancelled. - if (self.checksRemaining) { - self.passwordCheckRowState = PasswordCheckRowStateDisabled; - [self reconfigurePasswordCheckItem]; + if (weakSelf.checksRemaining) { + weakSelf.passwordCheckRowState = PasswordCheckRowStateDisabled; + [weakSelf reconfigurePasswordCheckItem]; base::UmaHistogramEnumeration( kSafetyCheckMetricsPasswords, @@ -768,8 +769,8 @@ dispatch_get_main_queue(), ^{ // Check if the check was cancelled while waiting, we do not want to // push a completed state to the UI if the check was cancelled. - if (self.checksRemaining) - [self checkAndReconfigureSafeBrowsingState]; + if (weakSelf.checksRemaining) + [weakSelf checkAndReconfigureSafeBrowsingState]; }); } return; @@ -853,15 +854,16 @@ double minDelay = kUpdateRowMinDelay; if (secondsSinceStart < minDelay) { // Want to show the loading wheel for minimum time. + __weak __typeof__(self) weakSelf = self; dispatch_after( dispatch_time(DISPATCH_TIME_NOW, (int64_t)((minDelay - secondsSinceStart) * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ // Check if the check was cancelled while waiting, we do not want to // push a completed state to the UI if the check was cancelled. - if (self.checksRemaining) { - self.updateCheckRowState = newRowState; - [self reconfigureUpdateCheckItem]; + if (weakSelf.checksRemaining) { + weakSelf.updateCheckRowState = newRowState; + [weakSelf reconfigureUpdateCheckItem]; } }); } else {
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 15f5add..b793e0c 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm
@@ -56,6 +56,7 @@ #import "ios/chrome/browser/ui/settings/bandwidth_management_table_view_controller.h" #import "ios/chrome/browser/ui/settings/cells/account_sign_in_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_check_item.h" +#import "ios/chrome/browser/ui/settings/cells/settings_image_detail_text_item.h" #import "ios/chrome/browser/ui/settings/cells/settings_switch_cell.h" #import "ios/chrome/browser/ui/settings/cells/settings_switch_item.h" #import "ios/chrome/browser/ui/settings/content_settings_table_view_controller.h" @@ -80,7 +81,6 @@ #import "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h" #include "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_detail_icon_item.h" -#import "ios/chrome/browser/ui/table_view/cells/table_view_image_item.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_info_button_cell.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_info_button_item.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_text_item.h" @@ -565,11 +565,11 @@ } - (TableViewItem*)googleServicesCellItem { - TableViewImageItem* googleServicesItem = - [[TableViewImageItem alloc] initWithType:ItemTypeGoogleServices]; + SettingsImageDetailTextItem* googleServicesItem = + [[SettingsImageDetailTextItem alloc] initWithType:ItemTypeGoogleServices]; googleServicesItem.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - googleServicesItem.title = + googleServicesItem.text = l10n_util::GetNSString(IDS_IOS_GOOGLE_SERVICES_SETTINGS_TITLE); googleServicesItem.accessibilityIdentifier = kSettingsGoogleServicesCellId; googleServicesItem.image = @@ -594,11 +594,12 @@ - (TableViewItem*)syncAndGoogleServicesCellItem { // TODO(crbug.com/805214): This branded icon image needs to come from // BrandedImageProvider. - TableViewImageItem* googleServicesItem = - [[TableViewImageItem alloc] initWithType:ItemTypeSyncAndGoogleServices]; + SettingsImageDetailTextItem* googleServicesItem = + [[SettingsImageDetailTextItem alloc] + initWithType:ItemTypeSyncAndGoogleServices]; googleServicesItem.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - googleServicesItem.title = + googleServicesItem.text = l10n_util::GetNSString(IDS_IOS_GOOGLE_SERVICES_SYNC_SETTINGS_TITLE); googleServicesItem.accessibilityIdentifier = kSettingsGoogleSyncAndServicesCellId; @@ -1294,7 +1295,7 @@ // Updates the Sync & Google services item to display the right icon and status // message in the detail text of the cell. - (void)updateSyncAndGoogleServicesItem: - (TableViewImageItem*)googleServicesItem { + (SettingsImageDetailTextItem*)googleServicesItem { googleServicesItem.detailTextColor = nil; syncer::SyncService* syncService = ProfileSyncServiceFactory::GetForBrowserState(_browserState); @@ -1396,8 +1397,8 @@ NSIndexPath* googleServicesCellIndexPath = [self.tableViewModel indexPathForItemType:ItemTypeSyncAndGoogleServices sectionIdentifier:SectionIdentifierAccount]; - TableViewImageItem* googleServicesItem = - base::mac::ObjCCast<TableViewImageItem>( + SettingsImageDetailTextItem* googleServicesItem = + base::mac::ObjCCast<SettingsImageDetailTextItem>( [self.tableViewModel itemAtIndexPath:googleServicesCellIndexPath]); DCHECK(googleServicesItem); [self updateSyncAndGoogleServicesItem:googleServicesItem];
diff --git a/ios/chrome/test/BUILD.gn b/ios/chrome/test/BUILD.gn index 3c4333bc..476ceb28 100644 --- a/ios/chrome/test/BUILD.gn +++ b/ios/chrome/test/BUILD.gn
@@ -54,6 +54,7 @@ "//ios/chrome/browser/browser_state", "//ios/chrome/browser/browser_state:browser_state_impl", "//ios/chrome/browser/content_settings", + "//ios/chrome/browser/policy:policy", "//ios/chrome/browser/prefs:browser_prefs", "//ios/chrome/browser/safe_browsing:test_support", "//ios/chrome/browser/ui/util:multiwindow_util",
diff --git a/ios/chrome/test/testing_application_context.h b/ios/chrome/test/testing_application_context.h index ebdcd6b..40d1e7e 100644 --- a/ios/chrome/test/testing_application_context.h +++ b/ios/chrome/test/testing_application_context.h
@@ -70,6 +70,8 @@ base::ThreadChecker thread_checker_; std::string application_locale_; PrefService* local_state_; + // Must be destroyed after |local_state_|. + std::unique_ptr<BrowserPolicyConnectorIOS> browser_policy_connector_; ios::ChromeBrowserStateManager* chrome_browser_state_manager_; std::unique_ptr<network_time::NetworkTimeTracker> network_time_tracker_; bool was_last_shutdown_clean_;
diff --git a/ios/chrome/test/testing_application_context.mm b/ios/chrome/test/testing_application_context.mm index 0011950..bcdef3c3 100644 --- a/ios/chrome/test/testing_application_context.mm +++ b/ios/chrome/test/testing_application_context.mm
@@ -12,6 +12,8 @@ #include "base/time/default_tick_clock.h" #include "components/network_time/network_time_tracker.h" #include "components/safe_browsing/core/features.h" +#include "ios/chrome/browser/policy/browser_policy_connector_ios.h" +#include "ios/chrome/browser/policy/configuration_policy_handler_list_factory.h" #import "ios/chrome/browser/safe_browsing/fake_safe_browsing_service.h" #import "ios/public/provider/chrome/browser/chrome_browser_provider.h" #include "net/url_request/url_request_context_getter.h" @@ -209,9 +211,12 @@ TestingApplicationContext::GetBrowserPolicyConnector() { DCHECK(thread_checker_.CalledOnValidThread()); - // TODO(crbug.com/1055318): Determine what level of support is needed for - // unittesting and return a mock or fake here. - return nullptr; + if (!browser_policy_connector_.get()) { + browser_policy_connector_ = std::make_unique<BrowserPolicyConnectorIOS>( + base::Bind(&BuildPolicyHandlerList, true)); + } + + return browser_policy_connector_.get(); } BreadcrumbPersistentStorageManager*
diff --git a/ios/chrome/widget_kit_extension/OWNERS b/ios/chrome/widget_kit_extension/OWNERS new file mode 100644 index 0000000..93ecef3 --- /dev/null +++ b/ios/chrome/widget_kit_extension/OWNERS
@@ -0,0 +1 @@ +javierrobles@chromium.org
diff --git a/media/capture/BUILD.gn b/media/capture/BUILD.gn index 3c8a2fb..5cd3f9a 100644 --- a/media/capture/BUILD.gn +++ b/media/capture/BUILD.gn
@@ -474,6 +474,8 @@ "video/mac/pixel_buffer_transferer_mac_unittest.mm", "video/mac/test/mock_video_capture_device_avfoundation_frame_receiver_mac.h", "video/mac/test/mock_video_capture_device_avfoundation_frame_receiver_mac.mm", + "video/mac/test/pixel_buffer_test_utils_mac.cc", + "video/mac/test/pixel_buffer_test_utils_mac.h", "video/mac/test/video_capture_test_utils_mac.h", "video/mac/test/video_capture_test_utils_mac.mm", "video/mac/video_capture_device_avfoundation_mac_unittest.mm",
diff --git a/media/capture/OWNERS b/media/capture/OWNERS index 000874b..4f59853 100644 --- a/media/capture/OWNERS +++ b/media/capture/OWNERS
@@ -4,3 +4,5 @@ file://media/capture/content/OWNERS # For video/ file://media/capture/video/OWNERS +# For video/mac/ +file://media/capture/video/mac/OWNERS
diff --git a/media/capture/video/mac/pixel_buffer_transferer_mac_unittest.mm b/media/capture/video/mac/pixel_buffer_transferer_mac_unittest.mm index a6aeba6f..fa00dfca3 100644 --- a/media/capture/video/mac/pixel_buffer_transferer_mac_unittest.mm +++ b/media/capture/video/mac/pixel_buffer_transferer_mac_unittest.mm
@@ -9,11 +9,10 @@ #include "base/logging.h" #include "media/capture/video/mac/pixel_buffer_pool_mac.h" +#include "media/capture/video/mac/test/pixel_buffer_test_utils_mac.h" #include "media/capture/video/mac/video_capture_device_avfoundation_utils_mac.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -#include "third_party/libyuv/include/libyuv/convert_argb.h" -#include "third_party/libyuv/include/libyuv/convert_from_argb.h" namespace media { @@ -40,171 +39,6 @@ // media::PIXEL_FORMAT_I420 a.k.a. "y420" constexpr OSType kPixelFormatI420 = kCVPixelFormatType_420YpCbCr8Planar; -// ARGB has 4 bytes per pixel and no padding. -size_t GetArgbStride(size_t width) { - return width * 4; -} -// YUVS is a 4:2:2 pixel format that is packed to be 2 bytes per pixel. -// https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html?gi-language=c -size_t GetYuvsStride(size_t width) { - return width * 2; -} - -std::vector<uint8_t> CreateArgbBufferFromSingleRgbColor(int width, - int height, - uint8_t r, - uint8_t g, - uint8_t b) { - std::vector<uint8_t> argb_buffer; - argb_buffer.resize(GetArgbStride(width) * height); - for (size_t i = 0; i < argb_buffer.size(); i += 4) { - // ARGB little endian = BGRA in memory. - argb_buffer[i + 0] = b; - argb_buffer[i + 1] = g; - argb_buffer[i + 2] = r; - argb_buffer[i + 3] = 255u; - } - return argb_buffer; -} - -bool IsArgbPixelWhite(const std::vector<uint8_t>& argb_buffer, size_t i) { - // ARGB little endian = BGRA in memory. - uint8_t b = argb_buffer[i + 0]; - uint8_t g = argb_buffer[i + 1]; - uint8_t r = argb_buffer[i + 2]; - return (r + g + b) / 3 >= 255 / 2; -} - -bool ArgbBufferIsSingleColor(const std::vector<uint8_t>& argb_buffer, - uint8_t r, - uint8_t g, - uint8_t b) { - int signed_r = r; - int signed_g = g; - int signed_b = b; - // ~5% error tolerance. - constexpr int kErrorTolerance = 0.05 * 255; - for (size_t i = 0; i < argb_buffer.size(); i += 4) { - // ARGB little endian = BGRA in memory. - int pixel_b = argb_buffer[i + 0]; - int pixel_g = argb_buffer[i + 1]; - int pixel_r = argb_buffer[i + 2]; - if (std::abs(pixel_r - signed_r) > kErrorTolerance || - std::abs(pixel_g - signed_g) > kErrorTolerance || - std::abs(pixel_b - signed_b) > kErrorTolerance) { - return false; - } - } - return true; -} - -std::vector<uint8_t> CreateArgbCheckerPatternBuffer(int width, - int height, - int num_tiles_across) { - std::vector<uint8_t> argb_buffer; - int tile_width = width / num_tiles_across; - int tile_height = height / num_tiles_across; - argb_buffer.resize(GetArgbStride(width) * height); - for (size_t i = 0; i < argb_buffer.size(); i += 4) { - size_t pixel_number = i / 4; - size_t x = pixel_number % width; - size_t y = pixel_number / width; - bool is_white = ((x / tile_width) % 2 != 0) != ((y / tile_height) % 2 != 0); - // ARGB little endian = BGRA in memory. - argb_buffer[i + 0] = argb_buffer[i + 1] = argb_buffer[i + 2] = - is_white ? 255u : 100u; - argb_buffer[i + 3] = 255u; - } - return argb_buffer; -} - -std::tuple<int, int> GetCheckerPatternNumTilesAccross( - const std::vector<uint8_t>& argb_buffer, - int width, - int height) { - int num_tiles_across_x = 0; - bool prev_tile_is_white = false; - for (int x = 0; x < width; ++x) { - size_t i = (x * 4); - bool current_tile_is_white = IsArgbPixelWhite(argb_buffer, i); - if (x == 0 || prev_tile_is_white != current_tile_is_white) { - prev_tile_is_white = current_tile_is_white; - ++num_tiles_across_x; - } - } - int num_tiles_across_y = 0; - prev_tile_is_white = false; - for (int y = 0; y < height; ++y) { - size_t i = y * GetArgbStride(width); - bool current_tile_is_white = IsArgbPixelWhite(argb_buffer, i); - if (y == 0 || prev_tile_is_white != current_tile_is_white) { - prev_tile_is_white = current_tile_is_white; - ++num_tiles_across_y; - } - } - return std::make_pair(num_tiles_across_x, num_tiles_across_y); -} - -struct ByteArrayPixelBuffer { - std::vector<uint8_t> byte_array; - base::ScopedCFTypeRef<CVPixelBufferRef> pixel_buffer; -}; - -std::unique_ptr<ByteArrayPixelBuffer> CreateYuvsPixelBufferFromArgbBuffer( - int width, - int height, - const std::vector<uint8_t>& argb_buffer) { - std::unique_ptr<ByteArrayPixelBuffer> result = - std::make_unique<ByteArrayPixelBuffer>(); - size_t yuvs_stride = GetYuvsStride(width); - - // ARGB -> YUVS (a.k.a. YUY2). - result->byte_array.resize(yuvs_stride * height); - libyuv::ARGBToYUY2(&argb_buffer[0], GetArgbStride(width), - &result->byte_array[0], yuvs_stride, width, height); - - CVReturn error = CVPixelBufferCreateWithBytes( - nil, width, height, kPixelFormatYuvs, (void*)&result->byte_array[0], - yuvs_stride, nil, nil, nil, result->pixel_buffer.InitializeInto()); - CHECK(error == noErr); - return result; -} - -std::unique_ptr<ByteArrayPixelBuffer> CreateYuvsPixelBufferFromSingleRgbColor( - int width, - int height, - uint8_t r, - uint8_t g, - uint8_t b) { - return CreateYuvsPixelBufferFromArgbBuffer( - width, height, - CreateArgbBufferFromSingleRgbColor(width, height, r, g, b)); -} - -std::vector<uint8_t> CreateArgbBufferFromYuvsIOSurface( - IOSurfaceRef io_surface) { - DCHECK(io_surface); - size_t width = IOSurfaceGetWidth(io_surface); - size_t height = IOSurfaceGetHeight(io_surface); - size_t argb_stride = GetArgbStride(width); - size_t yuvs_stride = GetYuvsStride(width); - uint8_t* pixels = static_cast<uint8_t*>(IOSurfaceGetBaseAddress(io_surface)); - DCHECK(pixels); - std::vector<uint8_t> argb_buffer; - argb_buffer.resize(argb_stride * height); - libyuv::YUY2ToARGB(pixels, yuvs_stride, &argb_buffer[0], argb_stride, width, - height); - return argb_buffer; -} - -bool YuvsIOSurfaceIsSingleColor(IOSurfaceRef io_surface, - uint8_t r, - uint8_t g, - uint8_t b) { - return ArgbBufferIsSingleColor(CreateArgbBufferFromYuvsIOSurface(io_surface), - r, g, b); -} - } // namespace TEST(PixelBufferTransfererTest, CanCopyYuvsAndVerifyColor) {
diff --git a/media/capture/video/mac/test/pixel_buffer_test_utils_mac.cc b/media/capture/video/mac/test/pixel_buffer_test_utils_mac.cc new file mode 100644 index 0000000..5a2d707 --- /dev/null +++ b/media/capture/video/mac/test/pixel_buffer_test_utils_mac.cc
@@ -0,0 +1,184 @@ +// 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. + +#include "media/capture/video/mac/test/pixel_buffer_test_utils_mac.h" + +#include "third_party/libyuv/include/libyuv/convert_argb.h" +#include "third_party/libyuv/include/libyuv/convert_from_argb.h" + +namespace media { + +namespace { + +// media::PIXEL_FORMAT_YUY2 a.k.a. "yuvs" +constexpr OSType kPixelFormatYuvs = kCVPixelFormatType_422YpCbCr8_yuvs; + +// ARGB has 4 bytes per pixel and no padding. +size_t GetArgbStride(size_t width) { + return width * 4; +} + +// YUVS is a 4:2:2 pixel format that is packed to be 2 bytes per pixel. +// https://gstreamer.freedesktop.org/documentation/additional/design/mediatype-video-raw.html?gi-language=c +size_t GetYuvsStride(size_t width) { + return width * 2; +} + +} // namespace + +ByteArrayPixelBuffer::ByteArrayPixelBuffer() {} + +ByteArrayPixelBuffer::~ByteArrayPixelBuffer() {} + +std::vector<uint8_t> CreateArgbBufferFromSingleRgbColor(int width, + int height, + uint8_t r, + uint8_t g, + uint8_t b) { + std::vector<uint8_t> argb_buffer; + argb_buffer.resize(GetArgbStride(width) * height); + for (size_t i = 0; i < argb_buffer.size(); i += 4) { + // ARGB little endian = BGRA in memory. + argb_buffer[i + 0] = b; + argb_buffer[i + 1] = g; + argb_buffer[i + 2] = r; + argb_buffer[i + 3] = 255u; + } + return argb_buffer; +} + +bool IsArgbPixelWhite(const std::vector<uint8_t>& argb_buffer, size_t i) { + // ARGB little endian = BGRA in memory. + uint8_t b = argb_buffer[i + 0]; + uint8_t g = argb_buffer[i + 1]; + uint8_t r = argb_buffer[i + 2]; + return (r + g + b) / 3 >= 255 / 2; +} + +bool ArgbBufferIsSingleColor(const std::vector<uint8_t>& argb_buffer, + uint8_t r, + uint8_t g, + uint8_t b) { + int signed_r = r; + int signed_g = g; + int signed_b = b; + // ~5% error tolerance. + constexpr int kErrorTolerance = 0.05 * 255; + for (size_t i = 0; i < argb_buffer.size(); i += 4) { + // ARGB little endian = BGRA in memory. + int pixel_b = argb_buffer[i + 0]; + int pixel_g = argb_buffer[i + 1]; + int pixel_r = argb_buffer[i + 2]; + if (std::abs(pixel_r - signed_r) > kErrorTolerance || + std::abs(pixel_g - signed_g) > kErrorTolerance || + std::abs(pixel_b - signed_b) > kErrorTolerance) { + return false; + } + } + return true; +} + +std::vector<uint8_t> CreateArgbCheckerPatternBuffer(int width, + int height, + int num_tiles_across) { + std::vector<uint8_t> argb_buffer; + int tile_width = width / num_tiles_across; + int tile_height = height / num_tiles_across; + argb_buffer.resize(GetArgbStride(width) * height); + for (size_t i = 0; i < argb_buffer.size(); i += 4) { + size_t pixel_number = i / 4; + size_t x = pixel_number % width; + size_t y = pixel_number / width; + bool is_white = ((x / tile_width) % 2 != 0) != ((y / tile_height) % 2 != 0); + // ARGB little endian = BGRA in memory. + argb_buffer[i + 0] = argb_buffer[i + 1] = argb_buffer[i + 2] = + is_white ? 255u : 100u; + argb_buffer[i + 3] = 255u; + } + return argb_buffer; +} + +std::tuple<int, int> GetCheckerPatternNumTilesAccross( + const std::vector<uint8_t>& argb_buffer, + int width, + int height) { + int num_tiles_across_x = 0; + bool prev_tile_is_white = false; + for (int x = 0; x < width; ++x) { + size_t i = (x * 4); + bool current_tile_is_white = IsArgbPixelWhite(argb_buffer, i); + if (x == 0 || prev_tile_is_white != current_tile_is_white) { + prev_tile_is_white = current_tile_is_white; + ++num_tiles_across_x; + } + } + int num_tiles_across_y = 0; + prev_tile_is_white = false; + for (int y = 0; y < height; ++y) { + size_t i = y * GetArgbStride(width); + bool current_tile_is_white = IsArgbPixelWhite(argb_buffer, i); + if (y == 0 || prev_tile_is_white != current_tile_is_white) { + prev_tile_is_white = current_tile_is_white; + ++num_tiles_across_y; + } + } + return std::make_pair(num_tiles_across_x, num_tiles_across_y); +} + +std::unique_ptr<ByteArrayPixelBuffer> CreateYuvsPixelBufferFromArgbBuffer( + int width, + int height, + const std::vector<uint8_t>& argb_buffer) { + std::unique_ptr<ByteArrayPixelBuffer> result = + std::make_unique<ByteArrayPixelBuffer>(); + size_t yuvs_stride = GetYuvsStride(width); + + // ARGB -> YUVS (a.k.a. YUY2). + result->byte_array.resize(yuvs_stride * height); + libyuv::ARGBToYUY2(&argb_buffer[0], GetArgbStride(width), + &result->byte_array[0], yuvs_stride, width, height); + + CVReturn error = CVPixelBufferCreateWithBytes( + nil, width, height, kPixelFormatYuvs, (void*)&result->byte_array[0], + yuvs_stride, nil, nil, nil, result->pixel_buffer.InitializeInto()); + CHECK(error == noErr); + return result; +} + +std::unique_ptr<ByteArrayPixelBuffer> CreateYuvsPixelBufferFromSingleRgbColor( + int width, + int height, + uint8_t r, + uint8_t g, + uint8_t b) { + return CreateYuvsPixelBufferFromArgbBuffer( + width, height, + CreateArgbBufferFromSingleRgbColor(width, height, r, g, b)); +} + +std::vector<uint8_t> CreateArgbBufferFromYuvsIOSurface( + IOSurfaceRef io_surface) { + DCHECK(io_surface); + size_t width = IOSurfaceGetWidth(io_surface); + size_t height = IOSurfaceGetHeight(io_surface); + size_t argb_stride = GetArgbStride(width); + size_t yuvs_stride = GetYuvsStride(width); + uint8_t* pixels = static_cast<uint8_t*>(IOSurfaceGetBaseAddress(io_surface)); + DCHECK(pixels); + std::vector<uint8_t> argb_buffer; + argb_buffer.resize(argb_stride * height); + libyuv::YUY2ToARGB(pixels, yuvs_stride, &argb_buffer[0], argb_stride, width, + height); + return argb_buffer; +} + +bool YuvsIOSurfaceIsSingleColor(IOSurfaceRef io_surface, + uint8_t r, + uint8_t g, + uint8_t b) { + return ArgbBufferIsSingleColor(CreateArgbBufferFromYuvsIOSurface(io_surface), + r, g, b); +} + +} // namespace media
diff --git a/media/capture/video/mac/test/pixel_buffer_test_utils_mac.h b/media/capture/video/mac/test/pixel_buffer_test_utils_mac.h new file mode 100644 index 0000000..85ed2863 --- /dev/null +++ b/media/capture/video/mac/test/pixel_buffer_test_utils_mac.h
@@ -0,0 +1,81 @@ +// 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. + +#ifndef MEDIA_CAPTURE_VIDEO_MAC_TEST_PIXEL_BUFFER_TEST_UTILS_MAC_H_ +#define MEDIA_CAPTURE_VIDEO_MAC_TEST_PIXEL_BUFFER_TEST_UTILS_MAC_H_ + +#include <memory> +#include <tuple> +#include <vector> + +#import <CoreVideo/CoreVideo.h> +#import <IOSurface/IOSurface.h> + +#include "base/mac/scoped_cftyperef.h" + +namespace media { + +struct ByteArrayPixelBuffer { + ByteArrayPixelBuffer(); + ~ByteArrayPixelBuffer(); + + std::vector<uint8_t> byte_array; + base::ScopedCFTypeRef<CVPixelBufferRef> pixel_buffer; +}; + +// All pixels of the resulting buffer have the specified RGB. Alpha is 255. +std::vector<uint8_t> CreateArgbBufferFromSingleRgbColor(int width, + int height, + uint8_t r, + uint8_t g, + uint8_t b); + +// True if the RGB color is closer to white (255,255,255) than black (0,0,0). +bool IsArgbPixelWhite(const std::vector<uint8_t>& argb_buffer, size_t i); + +// True if all pixels are the specified RGB color, within some margin of error. +bool ArgbBufferIsSingleColor(const std::vector<uint8_t>& argb_buffer, + uint8_t r, + uint8_t g, + uint8_t b); + +// Creates a checker pattern with tiles being white (255,255,255) or dark gray +// (100,100,100). Alpha is 255. The top-left corner is white. +std::vector<uint8_t> CreateArgbCheckerPatternBuffer(int width, + int height, + int num_tiles_across); + +// Traverse the top and left border pixels, counting the number of tiles if this +// is a checker pattern. (Each pixel is characterized as white or non-white and +// this function counts the number of transitions between these colors.) +std::tuple<int, int> GetCheckerPatternNumTilesAccross( + const std::vector<uint8_t>& argb_buffer, + int width, + int height); + +// Creates a CVPixelBuffer that is backed by an in-memory byte array. +std::unique_ptr<ByteArrayPixelBuffer> CreateYuvsPixelBufferFromArgbBuffer( + int width, + int height, + const std::vector<uint8_t>& argb_buffer); +std::unique_ptr<ByteArrayPixelBuffer> CreateYuvsPixelBufferFromSingleRgbColor( + int width, + int height, + uint8_t r, + uint8_t g, + uint8_t b); + +// YUVS IOSurface -> ARGB byte array. +std::vector<uint8_t> CreateArgbBufferFromYuvsIOSurface(IOSurfaceRef io_surface); + +// True if all pixels of the YUVS IOSurface are the specified RGB color, within +// some margin of error. +bool YuvsIOSurfaceIsSingleColor(IOSurfaceRef io_surface, + uint8_t r, + uint8_t g, + uint8_t b); + +} // namespace media + +#endif // MEDIA_CAPTURE_VIDEO_MAC_TEST_PIXEL_BUFFER_TEST_UTILS_MAC_H_
diff --git a/media/capture/video/mac/video_capture_device_avfoundation_mac.h b/media/capture/video/mac/video_capture_device_avfoundation_mac.h index a4e4315..e7f5366 100644 --- a/media/capture/video/mac/video_capture_device_avfoundation_mac.h +++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.h
@@ -8,7 +8,8 @@ #import <AVFoundation/AVFoundation.h> #import <Foundation/Foundation.h> -#import "base/mac/scoped_nsobject.h" +#include "base/mac/scoped_dispatch_object.h" +#include "base/mac/scoped_nsobject.h" #include "base/synchronization/lock.h" #include "base/threading/thread_checker.h" #import "media/capture/video/mac/video_capture_device_avfoundation_protocol_mac.h" @@ -42,6 +43,10 @@ // The capture format that best matches the above attributes. base::scoped_nsobject<AVCaptureDeviceFormat> _bestCaptureFormat; + // A serial queue to deliver frames on, ensuring frames are delivered in + // order. + base::ScopedDispatchObject<dispatch_queue_t> _sampleQueue; + // Protects concurrent setting and using |frameReceiver_|. Note that the // GUARDED_BY decoration below does not have any effect. base::Lock _lock;
diff --git a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm index eebbe85..0645c67 100644 --- a/media/capture/video/mac/video_capture_device_avfoundation_mac.mm +++ b/media/capture/video/mac/video_capture_device_avfoundation_mac.mm
@@ -162,6 +162,11 @@ (media::VideoCaptureDeviceAVFoundationFrameReceiver*)frameReceiver { if ((self = [super init])) { _mainThreadTaskRunner = base::ThreadTaskRunnerHandle::Get(); + _sampleQueue.reset( + dispatch_queue_create("org.chromium.VideoCaptureDeviceAVFoundation." + "SampleDeliveryDispatchQueue", + DISPATCH_QUEUE_SERIAL), + base::scoped_policy::ASSUME); DCHECK(frameReceiver); _weakPtrFactoryForTakePhoto = std::make_unique<base::WeakPtrFactory<VideoCaptureDeviceAVFoundation>>( @@ -177,6 +182,7 @@ [self stopCapture]; _weakPtrFactoryForTakePhoto = nullptr; _mainThreadTaskRunner = nullptr; + _sampleQueue.reset(); [super dealloc]; } @@ -242,10 +248,7 @@ } [_captureVideoDataOutput setAlwaysDiscardsLateVideoFrames:true]; - [_captureVideoDataOutput - setSampleBufferDelegate:self - queue:dispatch_get_global_queue( - DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)]; + [_captureVideoDataOutput setSampleBufferDelegate:self queue:_sampleQueue]; [_captureSession addOutput:_captureVideoDataOutput]; return YES;
diff --git a/media/gpu/vaapi/vaapi_video_decoder.cc b/media/gpu/vaapi/vaapi_video_decoder.cc index 550353a..bdef574 100644 --- a/media/gpu/vaapi/vaapi_video_decoder.cc +++ b/media/gpu/vaapi/vaapi_video_decoder.cc
@@ -501,7 +501,11 @@ vaapi_wrapper_ = std::move(new_vaapi_wrapper); } - vaapi_wrapper_->CreateContext(pic_size); + if (!vaapi_wrapper_->CreateContext(pic_size)) { + VLOGF(1) << "Failed creating context"; + SetState(State::kError); + return; + } // If we reset during resolution change, then there is no decode tasks. In // this case we do nothing and wait for next input. Otherwise, continue
diff --git a/media/gpu/vaapi/vaapi_wrapper.h b/media/gpu/vaapi/vaapi_wrapper.h index d67b497..6fced32 100644 --- a/media/gpu/vaapi/vaapi_wrapper.h +++ b/media/gpu/vaapi/vaapi_wrapper.h
@@ -18,6 +18,7 @@ #include <set> #include <vector> +#include "base/compiler_specific.h" #include "base/files/file.h" #include "base/gtest_prod_util.h" #include "base/macros.h" @@ -236,7 +237,8 @@ const gfx::Size& size, SurfaceUsageHint surface_usage_hint, size_t num_surfaces, - std::vector<VASurfaceID>* va_surfaces); + std::vector<VASurfaceID>* va_surfaces) + WARN_UNUSED_RESULT; // Creates a single ScopedVASurface of |va_format| and |size| and, if // successful, creates a |va_context_id_| of the same size. Returns nullptr if @@ -255,7 +257,7 @@ // VPP VaapiWrapper, |size| is ignored and 0x0 is used to create the context. // The client is responsible for releasing it via DestroyContext() or // DestroyContextAndSurfaces(), or it will be released on dtor. - virtual bool CreateContext(const gfx::Size& size); + virtual bool CreateContext(const gfx::Size& size) WARN_UNUSED_RESULT; // Destroys the context identified by |va_context_id_|. virtual void DestroyContext(); @@ -302,7 +304,7 @@ // Synchronize the VASurface explicitly. This is useful when sharing a surface // between contexts. - bool SyncSurface(VASurfaceID va_surface_id); + bool SyncSurface(VASurfaceID va_surface_id) WARN_UNUSED_RESULT; // Calls SubmitBuffer_Locked() to request libva to allocate a new VABufferID // of |va_buffer_type| and |size|, and to map-and-copy the |data| into it. The @@ -310,11 +312,14 @@ // that this method does not submit the buffers for execution, they are simply // stored until ExecuteAndDestroyPendingBuffers()/Execute_Locked(). The // ownership of |data| stays with the caller. - bool SubmitBuffer(VABufferType va_buffer_type, size_t size, const void* data); + bool SubmitBuffer(VABufferType va_buffer_type, + size_t size, + const void* data) WARN_UNUSED_RESULT; // Convenient templatized version of SubmitBuffer() where |size| is deduced to // be the size of the type of |*data|. template <typename T> - bool SubmitBuffer(VABufferType va_buffer_type, const T* data) { + bool SubmitBuffer(VABufferType va_buffer_type, + const T* data) WARN_UNUSED_RESULT { return SubmitBuffer(va_buffer_type, sizeof(T), data); } // Batch-version of SubmitBuffer(), where the lock for accessing libva is @@ -324,7 +329,8 @@ size_t size; const void* data; }; - bool SubmitBuffers(const std::vector<VABufferDescriptor>& va_buffers); + bool SubmitBuffers(const std::vector<VABufferDescriptor>& va_buffers) + WARN_UNUSED_RESULT; // Destroys all |pending_va_buffers_| sent via SubmitBuffer*(). Useful when a // pending job is to be cancelled (on reset or error). @@ -332,20 +338,22 @@ // Executes job in hardware on target |va_surface_id| and destroys pending // buffers. Returns false if Execute() fails. - virtual bool ExecuteAndDestroyPendingBuffers(VASurfaceID va_surface_id); + virtual bool ExecuteAndDestroyPendingBuffers(VASurfaceID va_surface_id) + WARN_UNUSED_RESULT; // Maps each |va_buffers| ID and copies the data described by the associated // VABufferDescriptor into it; then calls Execute_Locked() on |va_surface_id|. bool MapAndCopyAndExecute( VASurfaceID va_surface_id, - const std::vector<std::pair<VABufferID, VABufferDescriptor>>& va_buffers); + const std::vector<std::pair<VABufferID, VABufferDescriptor>>& va_buffers) + WARN_UNUSED_RESULT; #if defined(USE_X11) // Put data from |va_surface_id| into |x_pixmap| of size // |dest_size|, converting/scaling to it. bool PutSurfaceIntoPixmap(VASurfaceID va_surface_id, Pixmap x_pixmap, - gfx::Size dest_size); + gfx::Size dest_size) WARN_UNUSED_RESULT; #endif // USE_X11 // Creates a ScopedVAImage from a VASurface |va_surface_id| and map it into @@ -360,7 +368,8 @@ // Uploads contents of |frame| into |va_surface_id| for encode. virtual bool UploadVideoFrameToSurface(const VideoFrame& frame, VASurfaceID va_surface_id, - const gfx::Size& va_surface_size); + const gfx::Size& va_surface_size) + WARN_UNUSED_RESULT; // Creates a buffer of |size| bytes to be used as encode output. virtual std::unique_ptr<ScopedVABuffer> CreateVABuffer(VABufferType type, @@ -372,7 +381,8 @@ // source surface passed to the encode job. Returns 0 if it fails for any // reason. virtual uint64_t GetEncodedChunkSize(VABufferID buffer_id, - VASurfaceID sync_surface_id); + VASurfaceID sync_surface_id) + WARN_UNUSED_RESULT; // Downloads the contents of the buffer with given |buffer_id| into a buffer // of size |target_size|, pointed to by |target_ptr|. The number of bytes @@ -385,7 +395,7 @@ VASurfaceID sync_surface_id, uint8_t* target_ptr, size_t target_size, - size_t* coded_data_size); + size_t* coded_data_size) WARN_UNUSED_RESULT; // Get the max number of reference frames for encoding supported by the // driver. @@ -393,7 +403,8 @@ // frames for both the reference picture list 0 (bottom 16 bits) and the // reference picture list 1 (top 16 bits). virtual bool GetVAEncMaxNumOfRefFrames(VideoCodecProfile profile, - size_t* max_ref_frames); + size_t* max_ref_frames) + WARN_UNUSED_RESULT; // Checks if the driver supports frame rotation. bool IsRotationSupported(); @@ -406,7 +417,8 @@ const VASurface& va_surface_dest, base::Optional<gfx::Rect> src_rect = base::nullopt, base::Optional<gfx::Rect> dest_rect = base::nullopt, - VideoRotation rotation = VIDEO_ROTATION_0); + VideoRotation rotation = VIDEO_ROTATION_0) + WARN_UNUSED_RESULT; // Initialize static data before sandbox is enabled. static void PreSandboxInitialization(); @@ -426,9 +438,10 @@ FRIEND_TEST_ALL_PREFIXES(VaapiUtilsTest, BadScopedVAImage); FRIEND_TEST_ALL_PREFIXES(VaapiUtilsTest, BadScopedVABufferMapping); - bool Initialize(CodecMode mode, VAProfile va_profile); + bool Initialize(CodecMode mode, VAProfile va_profile) WARN_UNUSED_RESULT; void Deinitialize(); - bool VaInitialize(const ReportErrorToUMACB& report_error_to_uma_cb); + bool VaInitialize(const ReportErrorToUMACB& report_error_to_uma_cb) + WARN_UNUSED_RESULT; // Tries to allocate |num_surfaces| VASurfaceIDs of |size| and |va_format|. // Fills |va_surfaces| and returns true if successful, or returns false. @@ -436,26 +449,26 @@ const gfx::Size& size, SurfaceUsageHint usage_hint, size_t num_surfaces, - std::vector<VASurfaceID>* va_surfaces); + std::vector<VASurfaceID>* va_surfaces) WARN_UNUSED_RESULT; // Carries out the vaBeginPicture()-vaRenderPicture()-vaEndPicture() on target // |va_surface_id|. Returns false if any of these calls fails. bool Execute_Locked(VASurfaceID va_surface_id, const std::vector<VABufferID>& va_buffers) - EXCLUSIVE_LOCKS_REQUIRED(va_lock_); + EXCLUSIVE_LOCKS_REQUIRED(va_lock_) WARN_UNUSED_RESULT; void DestroyPendingBuffers_Locked() EXCLUSIVE_LOCKS_REQUIRED(va_lock_); // Requests libva to allocate a new VABufferID of type |va_buffer.type|, then // maps-and-copies |va_buffer.size| contents of |va_buffer.data| to it. bool SubmitBuffer_Locked(const VABufferDescriptor& va_buffer) - EXCLUSIVE_LOCKS_REQUIRED(va_lock_); + EXCLUSIVE_LOCKS_REQUIRED(va_lock_) WARN_UNUSED_RESULT; // Maps |va_buffer_id| and, if successful, copies the contents of |va_buffer| // into it. bool MapAndCopy_Locked(VABufferID va_buffer_id, const VABufferDescriptor& va_buffer) - EXCLUSIVE_LOCKS_REQUIRED(va_lock_); + EXCLUSIVE_LOCKS_REQUIRED(va_lock_) WARN_UNUSED_RESULT; const CodecMode mode_;
diff --git a/net/base/features.cc b/net/base/features.cc index 21e1d41..90b9cfe 100644 --- a/net/base/features.cc +++ b/net/base/features.cc
@@ -135,22 +135,6 @@ const base::Feature kSameSiteDefaultChecksMethodRigorously{ "SameSiteDefaultChecksMethodRigorously", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kRecentHttpSameSiteAccessGrantsLegacyCookieSemantics{ - "RecentHttpSameSiteAccessGrantsLegacyCookieSemantics", - base::FEATURE_DISABLED_BY_DEFAULT}; -const base::FeatureParam<int> - kRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsMilliseconds{ - &kRecentHttpSameSiteAccessGrantsLegacyCookieSemantics, - "RecentHttpSameSiteAccessGrantsLegacyCookieSemanticsMilliseconds", 0}; - -const base::Feature kRecentCreationTimeGrantsLegacyCookieSemantics{ - "RecentCreationTimeGrantsLegacyCookieSemantics", - base::FEATURE_DISABLED_BY_DEFAULT}; -const base::FeatureParam<int> - kRecentCreationTimeGrantsLegacyCookieSemanticsMilliseconds{ - &kRecentCreationTimeGrantsLegacyCookieSemantics, - "RecentCreationTimeGrantsLegacyCookieSemanticsMilliseconds", 0}; - #if BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED) const base::Feature kCertVerifierBuiltinFeature{ "CertVerifierBuiltin", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/net/base/features.h b/net/base/features.h index 3410176..0baa0d6 100644 --- a/net/base/features.h +++ b/net/base/features.h
@@ -212,29 +212,6 @@ // This only has an effect if the cookie defaults to SameSite=Lax. NET_EXPORT extern const base::Feature kSameSiteDefaultChecksMethodRigorously; -// If this is set and has a non-zero param value, any access to a cookie will be -// granted Legacy access semantics if the last access to a cookie with the same -// (name, domain, path) from a context that is same-site and permits -// HttpOnly access occurred less than (param value) milliseconds ago. The last -// eligible access must have occurred in the current browser session (i.e. it -// does not persist across sessions). This feature does nothing if -// kCookiesWithoutSameSiteMustBeSecure is not enabled. -NET_EXPORT extern const base::Feature - kRecentHttpSameSiteAccessGrantsLegacyCookieSemantics; -NET_EXPORT extern const base::FeatureParam<int> - kRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsMilliseconds; - -// Recently created cookies are granted legacy access semantics. If this is set -// and has a non-zero integer param value, then for the first (param value) -// milliseconds after the cookie is created, the cookie will behave as if it -// were "legacy" i.e. not handled according to SameSiteByDefaultCookies/ -// CookiesWithoutSameSiteMustBeSecure rules. -// This does nothing if SameSiteByDefaultCookies is not enabled. -NET_EXPORT extern const base::Feature - kRecentCreationTimeGrantsLegacyCookieSemantics; -NET_EXPORT extern const base::FeatureParam<int> - kRecentCreationTimeGrantsLegacyCookieSemanticsMilliseconds; - #if BUILDFLAG(BUILTIN_CERT_VERIFIER_FEATURE_SUPPORTED) // When enabled, use the builtin cert verifier instead of the platform verifier. NET_EXPORT extern const base::Feature kCertVerifierBuiltinFeature;
diff --git a/net/cookies/cookie_monster.cc b/net/cookies/cookie_monster.cc index d72b57f..796d8552 100644 --- a/net/cookies/cookie_monster.cc +++ b/net/cookies/cookie_monster.cc
@@ -299,16 +299,6 @@ return cookies_count; } -// Returns whether the CookieOptions has at least as same-site of a context as -// |same_site_requirement|, and the options permit HttpOnly access. -bool IsHttpSameSiteContextAtLeast( - const CookieOptions& options, - CookieOptions::SameSiteCookieContext::ContextType same_site_requirement) { - return !options.exclude_httponly() && - options.same_site_cookie_context().GetContextForCookieInclusion() >= - same_site_requirement; -} - } // namespace CookieMonster::CookieMonster(scoped_refptr<PersistentCookieStore> store, @@ -570,7 +560,7 @@ const CookieList& cookie_list) { std::vector<CookieAccessSemantics> access_semantics_list; for (const CanonicalCookie& cookie : cookie_list) { - access_semantics_list.push_back(GetAccessSemanticsForCookieGet(cookie)); + access_semantics_list.push_back(GetAccessSemanticsForCookie(cookie)); } MaybeRunCookieCallback(std::move(callback), cookie_list, access_semantics_list); @@ -629,8 +619,7 @@ CanonicalCookie* cc = curit->second.get(); ++it; - if (delete_info.Matches(*cc, GetAccessSemanticsForCookie( - *cc, false /* legacy_access_granted */))) { + if (delete_info.Matches(*cc, GetAccessSemanticsForCookie(*cc))) { InternalDeleteCookie(curit, true, /*sync_to_store*/ DELETE_COOKIE_EXPLICIT); ++num_deleted; @@ -971,7 +960,7 @@ // given |url|. HTTP only cookies are filtered depending on the passed // cookie |options|. CookieAccessResult access_result = (*it)->IncludeForRequestURL( - url, options, GetAccessSemanticsForCookieGet(**it)); + url, options, GetAccessSemanticsForCookie(**it)); if (!access_result.status.IsInclude()) { if (options.return_excluded_cookies()) @@ -982,8 +971,6 @@ if (options.update_access_time()) InternalUpdateCookieAccessTime(*it, current_time); - MaybeRecordCookieAccessWithOptions(**it, options, false); - included_cookies->push_back({**it, access_result}); } } @@ -1089,31 +1076,6 @@ } } -// Find the creation time of an equivalent cookie with the same value -// ("identical", well, modulo other attributes that don't get compared) -// if any. This iterates through the matching range of the |cookies_| map an -// extra time, but this is ok because it is only used if -// RecentCreationTimeGrantsLegacyCookieSemantics is enabled. -base::Time CookieMonster::EffectiveCreationTimeForMaybePreexistingCookie( - const std::string& key, - const CanonicalCookie& cookie) const { - DCHECK(cookie_util::IsRecentCreationTimeGrantsLegacyCookieSemanticsEnabled()); - base::Time effective_creation_time = cookie.CreationDate(); - const auto range_its = cookies_.equal_range(key); - for (auto cur_it = range_its.first; cur_it != range_its.second; ++cur_it) { - CanonicalCookie* preexisting_maybe_identical_cookie = cur_it->second.get(); - if (cookie.IsEquivalent(*preexisting_maybe_identical_cookie)) { - if (preexisting_maybe_identical_cookie->Value() == cookie.Value()) { - effective_creation_time = - preexisting_maybe_identical_cookie->CreationDate(); - } - // There should only ever be at most one equivalent cookie in the store. - break; - } - } - return effective_creation_time; -} - CookieMonster::CookieMap::iterator CookieMonster::InternalInsertCookie( const std::string& key, std::unique_ptr<CanonicalCookie> cc, @@ -1187,14 +1149,8 @@ const std::string key(GetKey(cc->Domain())); - cc->IsSetPermittedInContext( - options, - GetAccessSemanticsForCookieSet( - *cc, options, - cookie_util::IsRecentCreationTimeGrantsLegacyCookieSemanticsEnabled() - ? EffectiveCreationTimeForMaybePreexistingCookie(key, *cc) - : base::Time()), - &access_result); + cc->IsSetPermittedInContext(options, GetAccessSemanticsForCookie(*cc), + &access_result); base::Time creation_date = cc->CreationDate(); if (creation_date.is_null()) { @@ -1264,8 +1220,6 @@ cc->SetCreationDate(creation_date_to_inherit); } - MaybeRecordCookieAccessWithOptions(*cc, options, true); - InternalInsertCookie(key, std::move(cc), true, access_result); } else { DVLOG(net::cookie_util::kVlogSetCookies) @@ -1312,8 +1266,7 @@ } CookieAccessResult access_result; - access_result.access_semantics = GetAccessSemanticsForCookie( - cookie, false /* legacy_semantics_granted */); + access_result.access_semantics = GetAccessSemanticsForCookie(cookie); InternalInsertCookie(key, std::make_unique<CanonicalCookie>(cookie), true, access_result); GarbageCollect(creation_time, key); @@ -1369,26 +1322,16 @@ }); } - // Skip this if the map is empty, to avoid unnecessarily constructing the - // UniqueCookieKey. - if (!last_http_same_site_accesses_.empty()) { - DCHECK(cookie_util:: - IsRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsEnabled()); - last_http_same_site_accesses_.erase(it->second->UniqueKey()); - } - if ((cc->IsPersistent() || persist_session_cookies_) && store_.get() && sync_to_store) { store_->DeleteCookie(*cc); } change_dispatcher_.DispatchChange( - CookieChangeInfo( - *cc, - CookieAccessResult(CookieEffectiveSameSite::UNDEFINED, - CookieInclusionStatus(), - GetAccessSemanticsForCookie( - *cc, false /* legacy_access_granted */)), - mapping.cause), + CookieChangeInfo(*cc, + CookieAccessResult(CookieEffectiveSameSite::UNDEFINED, + CookieInclusionStatus(), + GetAccessSemanticsForCookie(*cc)), + mapping.cause), mapping.notify); // If this is the last cookie in |cookies_| with this key, decrement the @@ -1738,95 +1681,12 @@ } CookieAccessSemantics CookieMonster::GetAccessSemanticsForCookie( - const CanonicalCookie& cookie, - bool legacy_semantics_granted) const { - if (legacy_semantics_granted) - return CookieAccessSemantics::LEGACY; + const CanonicalCookie& cookie) const { if (cookie_access_delegate()) return cookie_access_delegate()->GetAccessSemantics(cookie); return CookieAccessSemantics::UNKNOWN; } -CookieAccessSemantics CookieMonster::GetAccessSemanticsForCookieGet( - const CanonicalCookie& cookie) const { - bool legacy_semantics_granted = - cookie_util::DoesLastHttpSameSiteAccessGrantLegacySemantics( - LastAccessFromHttpSameSiteContext(cookie)) || - cookie_util::DoesCreationTimeGrantLegacySemantics(cookie.CreationDate()); - return GetAccessSemanticsForCookie(cookie, legacy_semantics_granted); -} - -CookieAccessSemantics CookieMonster::GetAccessSemanticsForCookieSet( - const CanonicalCookie& cookie, - const CookieOptions& options, - base::Time effective_creation_time) const { - // If the current cookie access is a set, directly treat the cookie as LEGACY - // if the |options| qualify, because there may not be a time entry in - // |last_http_same_site_accesses_| since it may be a new cookie without a - // previous access. It will still only be added to the map as a qualifying - // cookie access if the final inclusion status is include. - bool legacy_semantics_granted = - (cookie_util:: - IsRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsEnabled() && - IsHttpSameSiteContextAtLeast( - options, - CookieOptions::SameSiteCookieContext::ContextType::SAME_SITE_LAX)); - - // If the current cookie access is not itself http-and-same-site, but the last - // one that was, was recent enough, (and the corresponding feature is enabled) - // grant legacy semantics. - legacy_semantics_granted = - legacy_semantics_granted || - cookie_util::DoesLastHttpSameSiteAccessGrantLegacySemantics( - LastAccessFromHttpSameSiteContext(cookie)); - - // If the cookie's creation time (or that of an identical preexisting cookie) - // was recent enough (and the corresponding feature is enabled), grant legacy - // semantics. - legacy_semantics_granted = legacy_semantics_granted || - cookie_util::DoesCreationTimeGrantLegacySemantics( - effective_creation_time); - - return GetAccessSemanticsForCookie(cookie, legacy_semantics_granted); -} - -base::TimeTicks CookieMonster::LastAccessFromHttpSameSiteContext( - const CanonicalCookie& cookie) const { - // Return early to avoid unnecessarily constructing the UniqueCookieKey - if (last_http_same_site_accesses_.empty()) { - return base::TimeTicks(); - } - - const auto it = last_http_same_site_accesses_.find(cookie.UniqueKey()); - if (it != last_http_same_site_accesses_.end()) - return it->second; - return base::TimeTicks(); -} - -void CookieMonster::MaybeRecordCookieAccessWithOptions( - const CanonicalCookie& cookie, - const CookieOptions& options, - bool is_set) { - // Don't populate |last_http_same_site_accesses_| if the relevant feature is - // not enabled. - if (!cookie_util:: - IsRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsEnabled()) { - return; - } - - // Don't update time for accesses that don't update access time. (E.g. the - // time should not be updated when the cookie is accessed to populate the UI.) - if (!options.update_access_time()) - return; - CookieOptions::SameSiteCookieContext::ContextType same_site_requirement; - same_site_requirement = - is_set - ? CookieOptions::SameSiteCookieContext::ContextType::SAME_SITE_LAX - : CookieOptions::SameSiteCookieContext::ContextType::SAME_SITE_STRICT; - if (IsHttpSameSiteContextAtLeast(options, same_site_requirement)) - last_http_same_site_accesses_[cookie.UniqueKey()] = base::TimeTicks::Now(); -} - // Test to see if stats should be recorded, and record them if so. // The goal here is to get sampling for the average browser-hour of // activity. We won't take samples when the web isn't being surfed,
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h index 0ec31e3..2d45b2b 100644 --- a/net/cookies/cookie_monster.h +++ b/net/cookies/cookie_monster.h
@@ -438,14 +438,6 @@ base::Time* creation_date_to_inherit, CookieInclusionStatus* status); - // This is only used if the RecentCreationTimeGrantsLegacyCookieSemantics - // feature is enabled. It finds an equivalent cookie (based on name, domain, - // path) with the same value, if there is any, and returns its creation time, - // or the creation time of the |cookie| itself, if there is none. - base::Time EffectiveCreationTimeForMaybePreexistingCookie( - const std::string& key, - const CanonicalCookie& cookie) const; - // Inserts |cc| into cookies_. Returns an iterator that points to the inserted // cookie in cookies_. Guarantee: all iterators to cookies_ remain valid. CookieMap::iterator InternalInsertCookie( @@ -522,50 +514,12 @@ bool HasCookieableScheme(const GURL& url); - // Get the cookie's access semantics (LEGACY or NONLEGACY), considering any - // features granting legacy semantics for special conditions (if any are - // active and meet the conditions for granting legacy access, pass true for - // |legacy_semantics_granted|). If none are active, this then checks for a + // Get the cookie's access semantics (LEGACY or NONLEGACY), by checking for a // value from the cookie access delegate, if it is non-null. Otherwise returns // UNKNOWN. CookieAccessSemantics GetAccessSemanticsForCookie( - const CanonicalCookie& cookie, - bool legacy_semantics_granted) const; - - // This is called for getting a cookie. - CookieAccessSemantics GetAccessSemanticsForCookieGet( const CanonicalCookie& cookie) const; - // This is called for setting a cookie with the options specified by - // |options|. For setting a cookie, a same-site access is lax or better (since - // CookieOptions for setting a cookie will never be strict). - // |effective_creation_time| is the time that should be used for deciding - // whether the RecentCreationTimeGrantsLegacyCookieSemantics feature should - // grant legacy semantics. This may differ from the CreationDate() field of - // the cookie, if there was a preexisting equivalent cookie (in which case it - // is the creation time of that equivalent cookie). - CookieAccessSemantics GetAccessSemanticsForCookieSet( - const CanonicalCookie& cookie, - const CookieOptions& options, - base::Time effective_creation_time) const; - - // Looks up the last time a cookie matching the (name, domain, path) of - // |cookie| was accessed in a same-site context permitting HttpOnly - // cookie access. If there was none, this returns a null base::Time. - // Returns null value if RecentHttpSameSiteAccessGrantsLegacyCookieSemantics - // is not enabled. - base::TimeTicks LastAccessFromHttpSameSiteContext( - const CanonicalCookie& cookie) const; - - // Updates |last_http_same_site_accesses_| with the current time if the - // |options| are appropriate (same-site and permits HttpOnly access). - // |is_set| is true if the access is setting the cookie, false otherwise (e.g. - // if getting the cookie). Does nothing if - // RecentHttpSameSiteAccessGrantsLegacyCookieSemantics is not enabled. - void MaybeRecordCookieAccessWithOptions(const CanonicalCookie& cookie, - const CookieOptions& options, - bool is_set); - // Statistics support // This function should be called repeatedly, and will record @@ -663,17 +617,6 @@ // wanted. Thus this value is not initialized. base::Time earliest_access_time_; - // Records the last access to a cookie (either getting or setting) from a - // context that is both same-site and permits HttpOnly access. - // The access is considered same-site if it is at least laxly same-site for - // set, or strictly same-site for get. - // This information is used to determine if the feature - // kRecentSameSiteAccessGrantsLegacyCookieSemantics should grant legacy - // access semantics to a cookie for subsequent accesses. - // This map is not used if that feature is not enabled. - std::map<CanonicalCookie::UniqueCookieKey, base::TimeTicks> - last_http_same_site_accesses_; - std::vector<std::string> cookieable_schemes_; base::Time last_statistic_record_time_;
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc index 0295819e..216e071 100644 --- a/net/cookies/cookie_monster_unittest.cc +++ b/net/cookies/cookie_monster_unittest.cc
@@ -59,11 +59,6 @@ using base::TimeDelta; using CookieDeletionInfo = net::CookieDeletionInfo; using features::kCookiesWithoutSameSiteMustBeSecure; -using features::kRecentCreationTimeGrantsLegacyCookieSemantics; -using features::kRecentCreationTimeGrantsLegacyCookieSemanticsMilliseconds; -using features::kRecentHttpSameSiteAccessGrantsLegacyCookieSemantics; -using features:: - kRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsMilliseconds; using features::kSameSiteByDefaultCookies; namespace { @@ -4023,59 +4018,26 @@ ~CookieMonsterLegacyCookieAccessTest() override {} - // The third parameter is nullopt if - // kRecentHttpSameSiteAccessGrantsLegacyCookieSemantics is not enabled. - // Otherwise it gives the value of the corresponding parameter. - // Similarly for the fourth parameter, which is for - // kRecentCreationTimeGrantsLegacyCookieSemantics. - void SetFeatures( - bool is_same_site_by_default_cookies_enabled, - bool is_cookies_without_samesite_must_be_secure_enabled, - base::Optional<int> - milliseconds_for_http_same_site_access_grants_legacy_semantics, - base::Optional<int> - milliseconds_for_creation_time_grants_legacy_semantics) { + void SetFeatures(bool is_same_site_by_default_cookies_enabled, + bool is_cookies_without_samesite_must_be_secure_enabled) { feature_list_ = std::make_unique<base::test::ScopedFeatureList>(); - std::vector<base::test::ScopedFeatureList::FeatureAndParams> enabled; + std::vector<base::Feature> enabled; std::vector<base::Feature> disabled; if (is_same_site_by_default_cookies_enabled) { - enabled.push_back({kSameSiteByDefaultCookies, {}}); + enabled.push_back(kSameSiteByDefaultCookies); } else { disabled.push_back(kSameSiteByDefaultCookies); } if (is_cookies_without_samesite_must_be_secure_enabled) { - enabled.push_back({kCookiesWithoutSameSiteMustBeSecure, {}}); + enabled.push_back(kCookiesWithoutSameSiteMustBeSecure); } else { disabled.push_back(kCookiesWithoutSameSiteMustBeSecure); } - if (milliseconds_for_http_same_site_access_grants_legacy_semantics) { - enabled.push_back( - {kRecentHttpSameSiteAccessGrantsLegacyCookieSemantics, - {{kRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsMilliseconds - .name, - base::NumberToString( - milliseconds_for_http_same_site_access_grants_legacy_semantics - .value())}}}); - } else { - disabled.push_back(kRecentHttpSameSiteAccessGrantsLegacyCookieSemantics); - } - - if (milliseconds_for_creation_time_grants_legacy_semantics) { - enabled.push_back( - {kRecentCreationTimeGrantsLegacyCookieSemantics, - {{kRecentCreationTimeGrantsLegacyCookieSemanticsMilliseconds.name, - base::NumberToString( - milliseconds_for_creation_time_grants_legacy_semantics - .value())}}}); - } else { - disabled.push_back(kRecentCreationTimeGrantsLegacyCookieSemantics); - } - - feature_list_->InitWithFeaturesAndParameters(enabled, disabled); + feature_list_->InitWithFeatures(enabled, disabled); } protected: @@ -4091,7 +4053,7 @@ }; TEST_F(CookieMonsterLegacyCookieAccessTest, SetLegacyNoSameSiteCookie) { - SetFeatures(true, true, base::nullopt, base::nullopt); + SetFeatures(true, true); // Check that setting unspecified-SameSite cookie from cross-site context // fails if not set to Legacy semantics, but succeeds if set to legacy. EXPECT_FALSE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie=chocolate_chip", @@ -4113,13 +4075,13 @@ TEST_F(CookieMonsterLegacyCookieAccessTest, GetLegacyNoSameSiteCookie) { // Set an unspecified-SameSite cookie with SameSite features turned off. // Getting the cookie will succeed. - SetFeatures(false, false, base::nullopt, base::nullopt); + SetFeatures(false, false); ASSERT_TRUE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie=chocolate_chip", CookieOptions())); EXPECT_EQ("cookie=chocolate_chip", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); // Turn on the features. Now getting the cookie fails. - SetFeatures(true, true, base::nullopt, base::nullopt); + SetFeatures(true, true); access_delegate_->SetExpectationForCookieDomain( kDomain, CookieAccessSemantics::UNKNOWN); EXPECT_EQ("", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); @@ -4135,7 +4097,7 @@ TEST_F(CookieMonsterLegacyCookieAccessTest, SetLegacySameSiteNoneInsecureCookie) { - SetFeatures(true, true, base::nullopt, base::nullopt); + SetFeatures(true, true); access_delegate_->SetExpectationForCookieDomain( kDomain, CookieAccessSemantics::UNKNOWN); EXPECT_FALSE(CreateAndSetCookie(cm_.get(), kHttpsUrl, @@ -4160,14 +4122,14 @@ GetLegacySameSiteNoneInsecureCookie) { // Set an SameSite=None insecure cookie with SameSite features turned off. // Getting the cookie will succeed. - SetFeatures(false, false, base::nullopt, base::nullopt); + SetFeatures(false, false); ASSERT_TRUE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie=oatmeal_raisin; SameSite=None", CookieOptions())); EXPECT_EQ("cookie=oatmeal_raisin", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); // Turn on the features. Now getting the cookie fails. - SetFeatures(true, true, base::nullopt, base::nullopt); + SetFeatures(true, true); access_delegate_->SetExpectationForCookieDomain( kDomain, CookieAccessSemantics::UNKNOWN); EXPECT_EQ("", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); @@ -4183,7 +4145,7 @@ TEST_F(CookieMonsterLegacyCookieAccessTest, NonlegacyCookie) { // Nonlegacy cookie will have default as Lax. - SetFeatures(false, false, base::nullopt, base::nullopt); + SetFeatures(false, false); access_delegate_->SetExpectationForCookieDomain( kDomain, CookieAccessSemantics::NONLEGACY); EXPECT_FALSE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie=chocolate_chip", @@ -4198,164 +4160,4 @@ GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); } -// Test the RecentHttpSameSiteAccessGrantsLegacyCookieSemantics feature. -TEST_F(CookieMonsterLegacyCookieAccessTest, RecentHttpSameSiteAccess) { - SetFeatures(true, true, 100, base::nullopt); - // This feature overrides the CookieAccessDelegate setting. - access_delegate_->SetExpectationForCookieDomain( - kDomain, CookieAccessSemantics::NONLEGACY); - - // Set a cookie from a qualifying (HTTP and same-site) context. - CookieOptions http_lax_options; - http_lax_options.set_include_httponly(); - http_lax_options.set_same_site_cookie_context( - CookieOptions::SameSiteCookieContext( - CookieOptions::SameSiteCookieContext::ContextType::SAME_SITE_LAX)); - // This one only works because it's treated as Legacy, otherwise it would be - // rejected for being SameSite=None without secure. - EXPECT_TRUE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie=1;SameSite=None", - http_lax_options)); - // Subsequently getting the cookie from a cross-site context also works - // because we just accessed it in an eligible context. - EXPECT_EQ("cookie=1", - GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - // This one should work regardless. - EXPECT_TRUE( - CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie=2", http_lax_options)); - // Subsequently getting the cookie from a cross-site context works even though - // it defaults to Lax, because we just accessed it in an eligible context. - EXPECT_EQ("cookie=2", - GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - // After some delay less than the recency threshold, we can still get the - // cookie from a cross-site context because the last eligible access was - // recent enough. - task_environment_->FastForwardBy(TimeDelta::FromMilliseconds(90)); - EXPECT_EQ("cookie=2", - GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - // After a further delay that passes the recency threshold, we can no longer - // get the cookie from a cross-site context. - // Notably, the last access didn't reset the timer because it wasn't a - // same-site access. - task_environment_->FastForwardBy(TimeDelta::FromMilliseconds(20)); - EXPECT_EQ("", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - - // Deleting the cookie clears the last access time. - DeleteAll(cm_.get()); - - // Set a cookie from a same-site but not Http context. This should work - // because it's same-site, but does not activate the feature because it isn't - // http. - CookieOptions exclude_http_lax_options; - exclude_http_lax_options.set_exclude_httponly(); - exclude_http_lax_options.set_same_site_cookie_context( - CookieOptions::SameSiteCookieContext( - CookieOptions::SameSiteCookieContext::ContextType::SAME_SITE_LAX)); - EXPECT_TRUE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie=1", - exclude_http_lax_options)); - // There is no recent eligible last access time, because we deleted the - // cookie and subsequently re-set it from a non-eligible context. - EXPECT_EQ("", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - // Accessing it from a laxly same-site context works (because the cookie - // defaults to lax). - EXPECT_EQ("cookie=1", - GetCookiesWithOptions(cm_.get(), kHttpUrl, http_lax_options)); - // However that doesn't count as a recent http same-site access because it was - // only laxly (not strictly) same-site, so getting the cookie from a - // cross-site context does not currently work. - EXPECT_EQ("", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - // Attempting to set a cookie (unsuccessfully) from an eligible context does - // not count. - CookieOptions http_strict_options; - http_strict_options.set_include_httponly(); - http_strict_options.set_same_site_cookie_context( - CookieOptions::SameSiteCookieContext( - CookieOptions::SameSiteCookieContext::ContextType::SAME_SITE_STRICT)); - EXPECT_FALSE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie=2;Secure", - http_strict_options)); - EXPECT_EQ("", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - // Now get the cookie from an eligible, Http and strictly same-site context. - EXPECT_EQ("cookie=1", - GetCookiesWithOptions(cm_.get(), kHttpUrl, http_strict_options)); - // Subsequently getting the cookie from a cross-site context also works - // because we just accessed it in an eligible context. - EXPECT_EQ("cookie=1", - GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - // After some delay less than the recency threshold, we can still get the - // cookie from a cross-site context because the last eligible access was - // recent enough. - task_environment_->FastForwardBy(TimeDelta::FromMilliseconds(90)); - EXPECT_EQ("cookie=1", - GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - // After a further delay that passes the recency threshold, we can no longer - // get the cookie from a cross-site context. - // Notably, the last access didn't reset the timer because it wasn't a - // same-site access. - task_environment_->FastForwardBy(TimeDelta::FromMilliseconds(20)); - EXPECT_EQ("", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); -} - -// Test the RecentCreationTimeGrantsLegacyCookieSemantics feature. -TEST_F(CookieMonsterLegacyCookieAccessTest, RecentCreationTime) { - SetFeatures(true, true, base::nullopt, 100); - // This feature overrides the CookieAccessDelegate setting. - access_delegate_->SetExpectationForCookieDomain( - kDomain, CookieAccessSemantics::NONLEGACY); - - // While the grace period is active, even if the delegate returns NONLEGACY - // semantics, we are able to set unspecified-SameSite cookies from a - // cross-site context, and we are allowed to set SameSite=None cookies without - // Secure. We are also allowed to get such cookies. - EXPECT_TRUE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie1=chocolate_chip", - CookieOptions())); - EXPECT_TRUE(CreateAndSetCookie(cm_.get(), kHttpUrl, - "cookie2=oatmeal_raisin; SameSite=None", - CookieOptions())); - EXPECT_EQ("cookie1=chocolate_chip; cookie2=oatmeal_raisin", - GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - - // After some time passes, but we are still under the time threshold, - // the cookie is still accessible in a cross-site context. - task_environment_->FastForwardBy(TimeDelta::FromMilliseconds(90)); - EXPECT_EQ("cookie1=chocolate_chip; cookie2=oatmeal_raisin", - GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - // After the grace period expires, these cookies are now blocked. - task_environment_->FastForwardBy(TimeDelta::FromMilliseconds(20)); - EXPECT_EQ("", GetCookiesWithOptions(cm_.get(), kHttpUrl, CookieOptions())); - - // Also, now that there is a preexisting cookie in the store that's older than - // the grace period, the same cookie will not be granted legacy semantics - // again because the creation date of the preexisting identical cookie is - // inherited. (This disallows refreshing the grace period by repeatedly - // setting an identical cookie.) - EXPECT_FALSE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie1=chocolate_chip", - CookieOptions())); - EXPECT_FALSE(CreateAndSetCookie(cm_.get(), kHttpUrl, - "cookie2=oatmeal_raisin; SameSite=None", - CookieOptions())); - // However, an equivalent (but not identical) cookie can still be set with - // legacy semantics, because now the creation date isn't inherited from the - // preexisting cookie. - // TODO(chlily): It might not actually make sense to allow this... This could - // in effect allow repeatedly refreshing the grace period by setting a cookie - // with a different value and then immediately setting it back to the original - // value. - EXPECT_TRUE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie1=snickerdoodle", - CookieOptions())); - EXPECT_TRUE(CreateAndSetCookie(cm_.get(), kHttpUrl, - "cookie2=gingerbread; SameSite=None", - CookieOptions())); - - // Test the behavior when the time threshold is 0 (the default value). - SetFeatures(true, true, base::nullopt, 0); - // No legacy behavior is used if there is no active, non-zero grace period. - // In particular, if there is a zero grace period, we don't allow setting the - // cookie even if it was created at the very instant it was attempted to be - // set. - EXPECT_FALSE(CreateAndSetCookie(cm_.get(), kHttpUrl, "cookie1=chocolate_chip", - CookieOptions())); - EXPECT_FALSE(CreateAndSetCookie(cm_.get(), kHttpUrl, - "cookie2=oatmeal_raisin; SameSite=None", - CookieOptions())); -} - } // namespace net
diff --git a/net/cookies/cookie_util.cc b/net/cookies/cookie_util.cc index 86735d1d..5e32373 100644 --- a/net/cookies/cookie_util.cc +++ b/net/cookies/cookie_util.cc
@@ -630,51 +630,6 @@ return base::FeatureList::IsEnabled(features::kSchemefulSameSite); } -bool IsRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsEnabled() { - return IsSameSiteByDefaultCookiesEnabled() && - base::FeatureList::IsEnabled( - features::kRecentHttpSameSiteAccessGrantsLegacyCookieSemantics) && - features:: - kRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsMilliseconds - .Get() > 0; -} - -bool IsRecentCreationTimeGrantsLegacyCookieSemanticsEnabled() { - return IsSameSiteByDefaultCookiesEnabled() && - base::FeatureList::IsEnabled( - features::kRecentCreationTimeGrantsLegacyCookieSemantics) && - features::kRecentCreationTimeGrantsLegacyCookieSemanticsMilliseconds - .Get() > 0; -} - -bool DoesLastHttpSameSiteAccessGrantLegacySemantics( - base::TimeTicks last_http_same_site_access) { - if (last_http_same_site_access.is_null()) - return false; - if (!IsRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsEnabled()) - return false; - - base::TimeDelta recency_threshold = base::TimeDelta::FromMilliseconds( - features::kRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsMilliseconds - .Get()); - DCHECK(!recency_threshold.is_zero()); - return (base::TimeTicks::Now() - last_http_same_site_access) < - recency_threshold; -} - -bool DoesCreationTimeGrantLegacySemantics(base::Time creation_date) { - if (creation_date.is_null()) - return false; - if (!IsRecentCreationTimeGrantsLegacyCookieSemanticsEnabled()) - return false; - - base::TimeDelta recency_threshold = base::TimeDelta::FromMilliseconds( - features::kRecentCreationTimeGrantsLegacyCookieSemanticsMilliseconds - .Get()); - DCHECK(!recency_threshold.is_zero()); - return (base::Time::Now() - creation_date) < recency_threshold; -} - base::OnceCallback<void(CookieAccessResult)> AdaptCookieAccessResultToBool( base::OnceCallback<void(bool)> callback) { return base::BindOnce(
diff --git a/net/cookies/cookie_util.h b/net/cookies/cookie_util.h index b2b7992..a5ee41ba 100644 --- a/net/cookies/cookie_util.h +++ b/net/cookies/cookie_util.h
@@ -230,21 +230,6 @@ NET_EXPORT bool IsSameSiteByDefaultCookiesEnabled(); NET_EXPORT bool IsCookiesWithoutSameSiteMustBeSecureEnabled(); NET_EXPORT bool IsSchemefulSameSiteEnabled(); -bool IsRecentHttpSameSiteAccessGrantsLegacyCookieSemanticsEnabled(); -bool IsRecentCreationTimeGrantsLegacyCookieSemanticsEnabled(); - -// Determines whether the last same-site access to a cookie should grant legacy -// access semantics to the current attempted cookies access, based on the state -// of the feature kRecentSameSiteAccessGrantsLegacyCookieSemantics, the value of -// the feature param, and the time since the last eligible same-site access. -bool DoesLastHttpSameSiteAccessGrantLegacySemantics( - base::TimeTicks last_http_same_site_access); - -// Determines whether the creation time of a cookie should grant legacy -// access semantics to the current attempted cookies access, based on the state -// of the feature kRecentCreationTimeGrantsLegacyCookieSemantics, the value of -// the feature param, and the creation time of the cookie. -bool DoesCreationTimeGrantLegacySemantics(base::Time creation_date); // Takes a callback accepting a CookieAccessResult and returns a callback // that accepts a bool, setting the bool to true if the CookieInclusionStatus
diff --git a/services/network/cookie_settings.cc b/services/network/cookie_settings.cc index 581e3956..628c854 100644 --- a/services/network/cookie_settings.cc +++ b/services/network/cookie_settings.cc
@@ -8,55 +8,24 @@ #include "base/bind.h" #include "base/callback.h" -#include "base/strings/string_split.h" -#include "components/content_settings/core/common/content_settings_utils.h" #include "net/base/net_errors.h" #include "net/cookies/cookie_util.h" #include "net/cookies/static_cookie_policy.h" -#include "services/network/public/cpp/features.h" namespace network { namespace { + bool IsDefaultSetting(const ContentSettingPatternSource& setting) { return setting.primary_pattern.MatchesAllHosts() && setting.secondary_pattern.MatchesAllHosts(); } -void AppendEmergencyLegacyCookieAccess( - ContentSettingsForOneType* settings_for_legacy_cookie_access) { - if (!base::FeatureList::IsEnabled(features::kEmergencyLegacyCookieAccess)) - return; - - std::vector<std::string> patterns = - SplitString(features::kEmergencyLegacyCookieAccessParam.Get(), ",", - base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); - - for (const auto& pattern_str : patterns) { - // Only primary pattern and the setting actually looked at here. - settings_for_legacy_cookie_access->push_back(ContentSettingPatternSource( - ContentSettingsPattern::FromString(pattern_str), - ContentSettingsPattern::Wildcard(), - /* legacy, see CookieSettingsBase::GetCookieAccessSemanticsForDomain */ - base::Value::FromUniquePtrValue( - content_settings::ContentSettingToValue(CONTENT_SETTING_ALLOW)), - std::string(), false)); - } -} - } // namespace -CookieSettings::CookieSettings() { - AppendEmergencyLegacyCookieAccess(&settings_for_legacy_cookie_access_); -} +CookieSettings::CookieSettings() = default; CookieSettings::~CookieSettings() = default; -void CookieSettings::set_content_settings_for_legacy_cookie_access( - const ContentSettingsForOneType& settings) { - settings_for_legacy_cookie_access_ = settings; - AppendEmergencyLegacyCookieAccess(&settings_for_legacy_cookie_access_); -} - DeleteCookiePredicate CookieSettings::CreateDeleteCookieOnExitPredicate() const { if (!HasSessionOnlyOrigins())
diff --git a/services/network/cookie_settings.h b/services/network/cookie_settings.h index 84eae422..949ad15 100644 --- a/services/network/cookie_settings.h +++ b/services/network/cookie_settings.h
@@ -58,7 +58,9 @@ } void set_content_settings_for_legacy_cookie_access( - const ContentSettingsForOneType& settings); + const ContentSettingsForOneType& settings) { + settings_for_legacy_cookie_access_ = settings; + } void set_storage_access_grants(const ContentSettingsForOneType& settings) { storage_access_grants_ = settings;
diff --git a/services/network/cookie_settings_unittest.cc b/services/network/cookie_settings_unittest.cc index 4e902b5..0d0a06b 100644 --- a/services/network/cookie_settings_unittest.cc +++ b/services/network/cookie_settings_unittest.cc
@@ -502,45 +502,5 @@ } } -TEST_F(CookieSettingsTest, CookieAccessSemanticsEmergencyOverride) { - base::test::ScopedFeatureList feature_list; - - feature_list.InitWithFeaturesAndParameters( - {{net::features::kSameSiteByDefaultCookies, {}}, - {features::kEmergencyLegacyCookieAccess, - {{features::kEmergencyLegacyCookieAccessParamName, - "example.org, [*.]example.gov"}}}}, - {} /* disabled_features*/); - CookieSettings settings; - settings.set_content_settings_for_legacy_cookie_access( - {CreateSetting(kDomainWildcardPattern, "*", CONTENT_SETTING_ALLOW)}); - - const struct { - net::CookieAccessSemantics status; - std::string cookie_domain; - } kTestCases[] = { - // These three test cases are LEGACY because they match the setting. - {net::CookieAccessSemantics::LEGACY, kDomain}, - {net::CookieAccessSemantics::LEGACY, kDotDomain}, - // Subdomain also matches pattern. - {net::CookieAccessSemantics::LEGACY, kSubDomain}, - // This test case defaults into NONLEGACY. - {net::CookieAccessSemantics::NONLEGACY, kOtherDomain}, - - // things that got pushed via experiment config. - {net::CookieAccessSemantics::LEGACY, "example.org"}, - {net::CookieAccessSemantics::NONLEGACY, "sub.example.org"}, - {net::CookieAccessSemantics::LEGACY, "example.gov"}, - {net::CookieAccessSemantics::LEGACY, "sub.example.gov"}, - {net::CookieAccessSemantics::NONLEGACY, "example.gov.uk"}, - }; - - for (const auto& test : kTestCases) { - EXPECT_EQ(test.status, - settings.GetCookieAccessSemanticsForDomain(test.cookie_domain)) - << test.cookie_domain; - } -} - } // namespace } // namespace network
diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc index abbb1b3..40a5377c 100644 --- a/services/network/public/cpp/features.cc +++ b/services/network/public/cpp/features.cc
@@ -152,14 +152,6 @@ "DeriveOriginFromUrlForNeitherGetNorHeadRequestWhenHavingSpecialAccess", base::FEATURE_DISABLED_BY_DEFAULT}; -// Emergency switch for legacy cookie access semantics on given patterns, as -// specified by the param, comma separated. -const base::Feature kEmergencyLegacyCookieAccess{ - "EmergencyLegacyCookieAccess", base::FEATURE_DISABLED_BY_DEFAULT}; -const char kEmergencyLegacyCookieAccessParamName[] = "Patterns"; -const base::FeatureParam<std::string> kEmergencyLegacyCookieAccessParam{ - &kEmergencyLegacyCookieAccess, kEmergencyLegacyCookieAccessParamName, ""}; - // Controls whether a |request_initiator| that mismatches // |request_initiator_origin_lock| leads to 1) failing the HTTP request and 2) // calling mojo::ReportBadMessage (on desktop platforms, where NetworkService
diff --git a/services/network/public/cpp/features.h b/services/network/public/cpp/features.h index 1e602b3..a836a51 100644 --- a/services/network/public/cpp/features.h +++ b/services/network/public/cpp/features.h
@@ -59,13 +59,6 @@ extern const base::Feature kDeriveOriginFromUrlForNeitherGetNorHeadRequestWhenHavingSpecialAccess; COMPONENT_EXPORT(NETWORK_CPP) -extern const base::Feature kEmergencyLegacyCookieAccess; -COMPONENT_EXPORT(NETWORK_CPP) -extern const char kEmergencyLegacyCookieAccessParamName[]; -COMPONENT_EXPORT(NETWORK_CPP) -extern const base::FeatureParam<std::string> kEmergencyLegacyCookieAccessParam; - -COMPONENT_EXPORT(NETWORK_CPP) extern const base::Feature kRequestInitiatorSiteLockEnfocement; COMPONENT_EXPORT(NETWORK_CPP) extern const base::Feature kCertVerifierService;
diff --git a/third_party/blink/public/mojom/BUILD.gn b/third_party/blink/public/mojom/BUILD.gn index 192c4d22..8b48af2 100644 --- a/third_party/blink/public/mojom/BUILD.gn +++ b/third_party/blink/public/mojom/BUILD.gn
@@ -231,7 +231,7 @@ "//ui/base/cursor/mojom", "//ui/base/dragdrop/mojom", "//ui/base/ime/mojom", - "//ui/base/mojom/", + "//ui/base/mojom", "//ui/display/mojom", "//ui/events/mojom", "//ui/gfx/geometry/mojom", @@ -857,6 +857,7 @@ "//services/network/public/mojom:url_loader_base", "//third_party/blink/public/mojom/frame", "//third_party/blink/public/mojom/tokens", + "//ui/base/mojom", "//ui/events/mojom", ] }
diff --git a/third_party/blink/public/mojom/frame/frame.mojom b/third_party/blink/public/mojom/frame/frame.mojom index 1784b53..ffc2768 100644 --- a/third_party/blink/public/mojom/frame/frame.mojom +++ b/third_party/blink/public/mojom/frame/frame.mojom
@@ -47,6 +47,7 @@ import "third_party/blink/public/mojom/timing/resource_timing.mojom"; import "third_party/blink/public/mojom/tokens/tokens.mojom"; import "third_party/blink/public/mojom/web_feature/web_feature.mojom"; +import "ui/base/mojom/window_open_disposition.mojom"; import "ui/events/mojom/scroll_granularity.mojom"; import "ui/gfx/geometry/mojom/geometry.mojom"; import "ui/gfx/range/mojom/range.mojom"; @@ -1002,6 +1003,13 @@ // Request close of the window. This corresponds to a window.close() javascript API call. // Frame unload handlers should have already been called before this method is called. RequestClose(); + + // Causes a window previously opened via RenderMessageFilter::CreateNewWindow + // to be shown on the screen. This message contains the opener_frame_token + // which is always set. This is called on the main frame of the window to be shown. + ShowCreatedWindow(mojo_base.mojom.UnguessableToken opener_frame_token, + ui.mojom.WindowOpenDisposition disposition, + gfx.mojom.Rect rect, bool opened_by_user_gesture) => (); }; // Implemented in Browser, this interface defines remote-main-frame-specific
diff --git a/third_party/blink/public/mojom/web_feature/web_feature.mojom b/third_party/blink/public/mojom/web_feature/web_feature.mojom index f2862c8..b7c05d3 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -3038,6 +3038,7 @@ kColorSchemeDarkSupportedOnRoot = 3707, kWebBluetoothGetAvailability = 3708, kDigitalGoodsListPurchases = 3709, + kCompositedSVG = 3710, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/public/web/web_view_client.h b/third_party/blink/public/web/web_view_client.h index f7a223d..3b0f495 100644 --- a/third_party/blink/public/web/web_view_client.h +++ b/third_party/blink/public/web/web_view_client.h
@@ -40,6 +40,7 @@ #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/web/web_ax_enums.h" #include "third_party/blink/public/web/web_frame.h" +#include "third_party/blink/public/web/web_navigation_policy.h" #include "third_party/blink/public/web/web_widget_client.h" namespace blink { @@ -70,7 +71,8 @@ WebNavigationPolicy policy, network::mojom::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId& session_storage_namespace_id) { + const SessionStorageNamespaceId& session_storage_namespace_id, + bool& consumed_user_gesture) { return nullptr; }
diff --git a/third_party/blink/public/web/web_widget_client.h b/third_party/blink/public/web/web_widget_client.h index 0d789248..414f632 100644 --- a/third_party/blink/public/web/web_widget_client.h +++ b/third_party/blink/public/web/web_widget_client.h
@@ -53,7 +53,6 @@ #include "third_party/blink/public/platform/web_rect.h" #include "third_party/blink/public/platform/web_text_input_type.h" #include "third_party/blink/public/platform/web_touch_action.h" -#include "third_party/blink/public/web/web_navigation_policy.h" class SkBitmap; @@ -86,9 +85,6 @@ // Called when the cursor for the widget changes. virtual void DidChangeCursor(const ui::Cursor&) {} - // Called to show the widget according to the given policy. - virtual void Show(WebNavigationPolicy) {} - // Called to set the position of the widget's window in screen // coordinates. Note, the window includes any decorations such as borders, // scrollbars, URL bar, tab strip, etc. if they exist.
diff --git a/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py b/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py index 9f554ce..110b622 100644 --- a/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py +++ b/third_party/blink/renderer/bindings/scripts/bind_gen/interface.py
@@ -7135,9 +7135,7 @@ arg_decls=[ "ScriptState* script_state", "OriginTrialFeature feature", - "base::span<const std::pair<" - "const WrapperTypeInfo*, InstallFuncType>> " - "wrapper_type_info_list", + "base::span<const WrapperTypeInfo* const> wrapper_type_info_list", ], return_type="void") @@ -7166,8 +7164,6 @@ EmptyNode(), TextNode("#include \"{}\"".format(header_path)), EmptyNode(), - TextNode("#include <algorithm>"), - EmptyNode(), make_header_include_directives(source_node.accumulator), EmptyNode(), source_blink_ns, @@ -7179,16 +7175,7 @@ func_decl, ]) source_bindings_ns.body.extend([ - CxxNamespaceNode( - name="", - body=[ - TextNode("""\ -using InstallFuncType = - V8InterfaceBridgeBase::InstallContextDependentPropertiesFuncType;\ -"""), - EmptyNode(), - helper_func_def, - ]), + CxxNamespaceNode(name="", body=helper_func_def), EmptyNode(), func_def, ]) @@ -7220,22 +7207,18 @@ switch_node.append( case=None, body=[ - TextNode("// Ignore unknown, deprecated, and/or unused features."), + TextNode("// Ignore unknown, deprecated, and unused features."), TextNode("return;"), ], should_add_break=False) for feature, class_likes in sorted(feature_to_class_likes.items()): entries = [ - TextNode("{{" - "{0}::GetWrapperTypeInfo(), " - "{0}::InstallContextDependentProperties" - "}}, ".format(v8_bridge_class_name(class_like))) + TextNode("{}::GetWrapperTypeInfo(), ".format( + v8_bridge_class_name(class_like))) for class_like in sorted(class_likes, key=lambda x: x.identifier) ] table_def = ListNode([ - TextNode("static const std::pair<" - "const WrapperTypeInfo*, " - "InstallFuncType> wti_list[] = {"), + TextNode("static const WrapperTypeInfo* const wti_list[] = {"), ListNode(entries), TextNode("};"), ]) @@ -7247,9 +7230,8 @@ ]) func_def.body.extend([ - TextNode("base::span<const std::pair<" - "const WrapperTypeInfo*, " - "InstallFuncType>> selected_wti_list;"), + TextNode( + "base::span<const WrapperTypeInfo* const> selected_wti_list;"), EmptyNode(), switch_node, EmptyNode(), @@ -7271,23 +7253,30 @@ const DOMWrapperWorld& world = script_state->World(); V8InterfaceBridgeBase::FeatureSelector feature_selector(feature); -for (const auto& pair : wrapper_type_info_list) { - const WrapperTypeInfo* wrapper_type_info = pair.first; - InstallFuncType install_func = pair.second; - +for (const auto* wrapper_type_info : wrapper_type_info_list) { v8::Local<v8::Object> instance_object; v8::Local<v8::Object> prototype_object; v8::Local<v8::Function> interface_object; - v8::Local<v8::Template> interface_template; + v8::Local<v8::Template> interface_template = + wrapper_type_info->GetV8ClassTemplate(isolate, world); - if (!per_context_data->GetExistingConstructorAndPrototypeForType( - wrapper_type_info, &prototype_object, &interface_object)) { - continue; + switch (wrapper_type_info->idl_definition_kind) { + case WrapperTypeInfo::kIdlInterface: + if (!per_context_data->GetExistingConstructorAndPrototypeForType( + wrapper_type_info, &prototype_object, &interface_object)) { + continue; + } + break; + case WrapperTypeInfo::kIdlNamespace: + NOTIMPLEMENTED(); + break; + default: + NOTREACHED(); } - interface_template = wrapper_type_info->GetV8ClassTemplate(isolate, world); - install_func(context, world, instance_object, prototype_object, - interface_object, interface_template, feature_selector); + wrapper_type_info->install_context_dependent_props_func( + context, world, instance_object, prototype_object, interface_object, + interface_template, feature_selector); }\ """))
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index 0941392a..295ee71a 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -298,6 +298,7 @@ allow_circular_includes_from = [ ":core_generated", ":core_hot", + "//third_party/blink/renderer/core/animation", "//third_party/blink/renderer/core/probe", "//third_party/blink/renderer/core/xml:xpath_generated", ]
diff --git a/third_party/blink/renderer/core/animation/BUILD.gn b/third_party/blink/renderer/core/animation/BUILD.gn index 78eac0a..a690dc32 100644 --- a/third_party/blink/renderer/core/animation/BUILD.gn +++ b/third_party/blink/renderer/core/animation/BUILD.gn
@@ -278,5 +278,9 @@ "worklet_animation_controller.h", ] - deps = [ ":buildflags" ] + deps = [ + ":buildflags", + "//third_party/blink/renderer/core:core_generated", + "//third_party/blink/renderer/core/probe:probe", + ] }
diff --git a/third_party/blink/renderer/core/editing/visible_units_line_test.cc b/third_party/blink/renderer/core/editing/visible_units_line_test.cc index dff4176..be2fe78 100644 --- a/third_party/blink/renderer/core/editing/visible_units_line_test.cc +++ b/third_party/blink/renderer/core/editing/visible_units_line_test.cc
@@ -65,6 +65,13 @@ LogicalEndOfLine(CreateVisiblePosition(caret)).DeepEquivalent(); return GetCaretTextFromBody(result); } + + std::string TestStartOfLine(const std::string& input) { + const Position& caret = SetCaretTextToBody(input); + const Position& result = + StartOfLine(CreateVisiblePosition(caret)).DeepEquivalent(); + return GetCaretTextFromBody(result); + } }; class ParameterizedVisibleUnitsLineTest @@ -961,6 +968,52 @@ EXPECT_FALSE(InSameLine(position1, position2)); } +TEST_P(ParameterizedVisibleUnitsLineTest, StartOfLineWithBidi) { + LoadAhem(); + InsertStyleElement("p { font: 30px/3 Ahem; }"); + + EXPECT_EQ( + "<p dir=\"ltr\"><bdo dir=\"ltr\">|abc xyz</bdo></p>", + TestStartOfLine("<p dir=\"ltr\"><bdo dir=\"ltr\">abc |xyz</bdo></p>")) + << "LTR LTR"; + EXPECT_EQ( + "<p dir=\"ltr\"><bdo dir=\"rtl\">|abc xyz</bdo></p>", + TestStartOfLine("<p dir=\"ltr\"><bdo dir=\"rtl\">abc |xyz</bdo></p>")) + << "LTR RTL"; + EXPECT_EQ( + "<p dir=\"rtl\"><bdo dir=\"ltr\">|abc xyz</bdo></p>", + TestStartOfLine("<p dir=\"rtl\"><bdo dir=\"ltr\">abc |xyz</bdo></p>")) + << "RTL LTR"; + EXPECT_EQ( + "<p dir=\"rtl\"><bdo dir=\"rtl\">|abc xyz</bdo></p>", + TestStartOfLine("<p dir=\"rtl\"><bdo dir=\"rtl\">abc |xyz</bdo></p>")) + << "RTL RTL"; +} + +TEST_P(ParameterizedVisibleUnitsLineTest, StartOfLineWithPositionRelative) { + LoadAhem(); + InsertStyleElement( + "b { position:relative; left: -100px; }" + "p { font: 30px/3 Ahem; }"); + + EXPECT_EQ("<p><b>|abc</b> xyz</p>", TestStartOfLine("<p><b>abc</b> |xyz</p>")) + << "LTR-LTR"; + EXPECT_EQ("<p dir=\"rtl\"><b>|abc</b> xyz</p>", + TestStartOfLine("<p dir=\"rtl\"><b>abc</b> |xyz</p>")) + << "RTL-LTR"; + // Legacy results are wrong. See StartOfLineWithBidi + EXPECT_EQ(LayoutNGEnabled() ? "<p><bdo dir=\"rtl\"><b>|abc</b> xyz</bdo></p>" + : "<p><bdo dir=\"rtl\"><b>abc|</b> xyz</bdo></p>", + TestStartOfLine("<p><bdo dir=\"rtl\"><b>abc</b> |xyz</bdo></p>")) + << "LTR-RTL"; + EXPECT_EQ(LayoutNGEnabled() + ? "<p dir=\"rtl\"><bdo dir=\"rtl\"><b>|abc</b> xyz</bdo></p>" + : "<p dir=\"rtl\"><bdo dir=\"rtl\"><b>abc|</b> xyz</bdo></p>", + TestStartOfLine( + "<p dir=\"rtl\"><bdo dir=\"rtl\"><b>abc</b> |xyz</bdo></p>")) + << "RTL-RTL"; +} + // https://crbug.com/947462 TEST_F(VisibleUnitsLineTest, TextOverflowEllipsis) { LoadAhem();
diff --git a/third_party/blink/renderer/core/exported/web_frame_test.cc b/third_party/blink/renderer/core/exported/web_frame_test.cc index cfc474f..ce20b2d 100644 --- a/third_party/blink/renderer/core/exported/web_frame_test.cc +++ b/third_party/blink/renderer/core/exported/web_frame_test.cc
@@ -7082,7 +7082,8 @@ WebNavigationPolicy, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&) override { + const SessionStorageNamespaceId&, + bool& consumed_user_gesture) override { EXPECT_TRUE(false); return nullptr; }
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 9f707a0..1ed5a9e8 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -380,6 +380,26 @@ return WebMediaPlayer::SurfaceLayerMode::kAlways; } +ui::mojom::blink::WindowOpenDisposition NavigationPolicyToDisposition( + NavigationPolicy policy) { + switch (policy) { + case kNavigationPolicyDownload: + return ui::mojom::blink::WindowOpenDisposition::SAVE_TO_DISK; + case kNavigationPolicyCurrentTab: + return ui::mojom::blink::WindowOpenDisposition::CURRENT_TAB; + case kNavigationPolicyNewBackgroundTab: + return ui::mojom::blink::WindowOpenDisposition::NEW_BACKGROUND_TAB; + case kNavigationPolicyNewForegroundTab: + return ui::mojom::blink::WindowOpenDisposition::NEW_FOREGROUND_TAB; + case kNavigationPolicyNewWindow: + return ui::mojom::blink::WindowOpenDisposition::NEW_WINDOW; + case kNavigationPolicyNewPopup: + return ui::mojom::blink::WindowOpenDisposition::NEW_POPUP; + } + NOTREACHED() << "Unexpected NavigationPolicy"; + return ui::mojom::blink::WindowOpenDisposition::IGNORE_ACTION; +} + } // namespace // WebView ---------------------------------------------------------------- @@ -3464,6 +3484,26 @@ } } +void WebViewImpl::Show(const base::UnguessableToken& opener_frame_token, + NavigationPolicy policy, + const gfx::Rect& rect, + bool opened_by_user_gesture) { + // This is only called on local main frames. + DCHECK(local_main_frame_host_remote_); + DCHECK(web_widget_); + web_widget_->SetPendingWindowRect(rect); + local_main_frame_host_remote_->ShowCreatedWindow( + opener_frame_token, NavigationPolicyToDisposition(policy), rect, + opened_by_user_gesture, + WTF::Bind(&WebViewImpl::DidShowCreatedWindow, WTF::Unretained(this))); + + MainFrameDevToolsAgentImpl()->DidShowNewWindow(); +} + +void WebViewImpl::DidShowCreatedWindow() { + web_widget_->AckPendingWindowRect(); +} + void WebViewImpl::UpdateTargetURL(const WebURL& url, const WebURL& fallback_url) { KURL latest_url = KURL(url.IsEmpty() ? fallback_url : url);
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.h b/third_party/blink/renderer/core/exported/web_view_impl.h index 7ba87d7c..0811c8e 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.h +++ b/third_party/blink/renderer/core/exported/web_view_impl.h
@@ -55,6 +55,7 @@ #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/exported/web_page_popup_impl.h" #include "third_party/blink/renderer/core/frame/resize_viewport_anchor.h" +#include "third_party/blink/renderer/core/loader/navigation_policy.h" #include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/context_menu_provider.h" #include "third_party/blink/renderer/core/page/event_with_hit_test_results.h" @@ -491,6 +492,12 @@ // adjacent UI element in the containing window. void TakeFocus(bool reverse); + // Shows a previously created WebView (via window.open()). + void Show(const base::UnguessableToken& opener_frame_token, + NavigationPolicy policy, + const gfx::Rect& rect, + bool opened_by_user_gesture); + // This method is used for testing. // Resizes the unscaled (page scale = 1.0) visual viewport. Normally the // unscaled visual viewport is the same size as the main frame. The passed @@ -650,6 +657,10 @@ // Sends any outstanding TrackedFeaturesUpdate messages to the browser. void ReportActiveSchedulerTrackedFeatures(); + // Callback when this widget window has been displayed by the browser. + // Corresponds to a Show method call. + void DidShowCreatedWindow(); + // Can be null (e.g. unittests, shared workers, etc). WebViewClient* web_view_client_; Persistent<ChromeClient> chrome_client_; @@ -829,12 +840,16 @@ Persistent<ResizeViewportAnchor> resize_viewport_anchor_; // Handle to the local main frame host. Only valid when the MainFrame is - // local. + // local. It is ok to use WTF::Unretained(this) for callbacks made on this + // interface because the callbacks will be associated with the lifecycle + // of this AssociatedRemote and the lifetiime of the main LocalFrame. mojo::AssociatedRemote<mojom::blink::LocalMainFrameHost> local_main_frame_host_remote_; // Handle to the remote main frame host. Only valid when the MainFrame is - // remote. + // remote. It is ok to use WTF::Unretained(this) for callbacks made on this + // interface because the callbacks will be associated with the lifecycle + // of this AssociatedRemote and the lifetime of the main RemoteFrame. mojo::AssociatedRemote<mojom::blink::RemoteMainFrameHost> remote_main_frame_host_remote_;
diff --git a/third_party/blink/renderer/core/exported/web_view_test.cc b/third_party/blink/renderer/core/exported/web_view_test.cc index 5d991c8..6cc9a64 100644 --- a/third_party/blink/renderer/core/exported/web_view_test.cc +++ b/third_party/blink/renderer/core/exported/web_view_test.cc
@@ -3758,7 +3758,8 @@ WebNavigationPolicy, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&) override { + const SessionStorageNamespaceId&, + bool& consumed_user_gesture) override { return web_view_helper_.InitializeWithOpener(opener); } @@ -3842,7 +3843,8 @@ WebNavigationPolicy, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&) override { + const SessionStorageNamespaceId&, + bool& consumed_user_gesture) override { return web_view_; }
diff --git a/third_party/blink/renderer/core/frame/csp/source_list_directive.cc b/third_party/blink/renderer/core/frame/csp/source_list_directive.cc index 0631587..f71f324 100644 --- a/third_party/blink/renderer/core/frame/csp/source_list_directive.cc +++ b/third_party/blink/renderer/core/frame/csp/source_list_directive.cc
@@ -239,10 +239,7 @@ return true; } - if (EqualIgnoringASCIICase("'strict-dynamic'", token) || - (RuntimeEnabledFeatures:: - ExperimentalContentSecurityPolicyFeaturesEnabled() && - EqualIgnoringASCIICase("'csp3-strict-dynamic'", token))) { + if (EqualIgnoringASCIICase("'strict-dynamic'", token)) { AddSourceStrictDynamic(); return true; } @@ -365,14 +362,7 @@ // TODO(esprehn): Should be StringView(begin, nonceLength).startsWith(prefix). if (nonce_length <= prefix.length() || !EqualIgnoringASCIICase(prefix, StringView(begin, prefix.length()))) { - // Experimentally the prefix could also be "'csp3-nonce-" - prefix = "'csp3-nonce-"; - if (!RuntimeEnabledFeatures:: - ExperimentalContentSecurityPolicyFeaturesEnabled() || - nonce_length <= prefix.length() || - !EqualIgnoringASCIICase(prefix, StringView(begin, prefix.length()))) { return true; - } } const UChar* position = begin + prefix.length(); @@ -402,7 +392,7 @@ // respective entries in the kAlgorithmMap array in // ContentSecurityPolicy::FillInCSPHashValues(). - static const SupportedPrefixesStruct kSupportedPrefixes[] = { + constexpr SupportedPrefixesStruct kSupportedPrefixes[] = { {"'sha256-", kContentSecurityPolicyHashAlgorithmSha256}, {"'sha384-", kContentSecurityPolicyHashAlgorithmSha384}, {"'sha512-", kContentSecurityPolicyHashAlgorithmSha512}, @@ -411,44 +401,20 @@ {"'sha-512-", kContentSecurityPolicyHashAlgorithmSha512}, {"'ed25519-", kContentSecurityPolicyHashAlgorithmEd25519}}; - static const SupportedPrefixesStruct kSupportedPrefixesExperimental[] = { - {"'sha256-", kContentSecurityPolicyHashAlgorithmSha256}, - {"'sha384-", kContentSecurityPolicyHashAlgorithmSha384}, - {"'sha512-", kContentSecurityPolicyHashAlgorithmSha512}, - {"'sha-256-", kContentSecurityPolicyHashAlgorithmSha256}, - {"'sha-384-", kContentSecurityPolicyHashAlgorithmSha384}, - {"'sha-512-", kContentSecurityPolicyHashAlgorithmSha512}, - {"'ed25519-", kContentSecurityPolicyHashAlgorithmEd25519}, - {"'csp3-sha256-", kContentSecurityPolicyHashAlgorithmSha256}, - {"'csp3-sha384-", kContentSecurityPolicyHashAlgorithmSha384}, - {"'csp3-sha512-", kContentSecurityPolicyHashAlgorithmSha512}, - {"'csp3-sha-256-", kContentSecurityPolicyHashAlgorithmSha256}, - {"'csp3-sha-384-", kContentSecurityPolicyHashAlgorithmSha384}, - {"'csp3-sha-512-", kContentSecurityPolicyHashAlgorithmSha512}, - {"'csp3-ed25519-", kContentSecurityPolicyHashAlgorithmEd25519}}; - - auto* const supportedPrefixes = - RuntimeEnabledFeatures::ExperimentalContentSecurityPolicyFeaturesEnabled() - ? kSupportedPrefixesExperimental - : kSupportedPrefixes; - - const size_t supportedPrefixesLength = - RuntimeEnabledFeatures::ExperimentalContentSecurityPolicyFeaturesEnabled() - ? sizeof(kSupportedPrefixesExperimental) / - sizeof(kSupportedPrefixesExperimental[0]) - : sizeof(kSupportedPrefixes) / sizeof(kSupportedPrefixes[0]); + constexpr size_t kSupportedPrefixesLength = + sizeof(kSupportedPrefixes) / sizeof(kSupportedPrefixes[0]); StringView prefix; *hash_algorithm = kContentSecurityPolicyHashAlgorithmNone; size_t hash_length = end - begin; - for (size_t i = 0; i < supportedPrefixesLength; i++) { - prefix = supportedPrefixes[i].prefix; + for (size_t i = 0; i < kSupportedPrefixesLength; i++) { + prefix = kSupportedPrefixes[i].prefix; // TODO(esprehn): Should be StringView(begin, end - // begin).startsWith(prefix). if (hash_length > prefix.length() && EqualIgnoringASCIICase(prefix, StringView(begin, prefix.length()))) { - *hash_algorithm = supportedPrefixes[i].type; + *hash_algorithm = kSupportedPrefixes[i].type; break; } }
diff --git a/third_party/blink/renderer/core/frame/frame_test_helpers.cc b/third_party/blink/renderer/core/frame/frame_test_helpers.cc index 881d779..0c2bbeccb 100644 --- a/third_party/blink/renderer/core/frame/frame_test_helpers.cc +++ b/third_party/blink/renderer/core/frame/frame_test_helpers.cc
@@ -855,7 +855,8 @@ WebNavigationPolicy, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&) { + const SessionStorageNamespaceId&, + bool& consumed_user_gesture) { auto webview_helper = std::make_unique<WebViewHelper>(); WebView* result = webview_helper->InitializeWithOpener(opener); child_web_views_.push_back(std::move(webview_helper));
diff --git a/third_party/blink/renderer/core/frame/frame_test_helpers.h b/third_party/blink/renderer/core/frame/frame_test_helpers.h index 20e9b6f..bc6325c 100644 --- a/third_party/blink/renderer/core/frame/frame_test_helpers.h +++ b/third_party/blink/renderer/core/frame/frame_test_helpers.h
@@ -301,7 +301,8 @@ WebNavigationPolicy, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&) override; + const SessionStorageNamespaceId&, + bool& consumed_user_gesture) override; private: WTF::Vector<std::unique_ptr<WebViewHelper>> child_web_views_;
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc index 7f3ef29..2940caaf 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -1612,8 +1612,7 @@ window_rect.SaturatedMove(x, y); // Security check (the spec talks about UniversalBrowserWrite to disable this // check...) - page->GetChromeClient().SetWindowRectWithAdjustment(window_rect, *frame, - *frame); + page->GetChromeClient().SetWindowRectWithAdjustment(window_rect, *frame); } void LocalDOMWindow::moveTo(int x, int y) const { @@ -1629,8 +1628,7 @@ window_rect.SetLocation(IntPoint(x, y)); // Security check (the spec talks about UniversalBrowserWrite to disable this // check...) - page->GetChromeClient().SetWindowRectWithAdjustment(window_rect, *frame, - *frame); + page->GetChromeClient().SetWindowRectWithAdjustment(window_rect, *frame); } void LocalDOMWindow::resizeBy(int x, int y) const { @@ -1645,7 +1643,7 @@ IntRect fr = page->GetChromeClient().RootWindowRect(*frame); IntSize dest = fr.Size() + IntSize(x, y); IntRect update(fr.Location(), dest); - page->GetChromeClient().SetWindowRectWithAdjustment(update, *frame, *frame); + page->GetChromeClient().SetWindowRectWithAdjustment(update, *frame); } void LocalDOMWindow::resizeTo(int width, int height) const { @@ -1660,7 +1658,7 @@ IntRect fr = page->GetChromeClient().RootWindowRect(*frame); IntSize dest = IntSize(width, height); IntRect update(fr.Location(), dest); - page->GetChromeClient().SetWindowRectWithAdjustment(update, *frame, *frame); + page->GetChromeClient().SetWindowRectWithAdjustment(update, *frame); } int LocalDOMWindow::requestAnimationFrame(V8FrameRequestCallback* callback) {
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc index 8d3771c4..30653c1 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc
@@ -151,6 +151,7 @@ base::TimeTicks start_time, ExecutionContext* context, UkmParameters ukm_params, + const IdentifiableToken& input_digest, ScriptPromiseResolver* resolver) : CanvasAsyncBlobCreator(image, options, @@ -159,6 +160,7 @@ start_time, context, ukm_params, + input_digest, resolver) {} CanvasAsyncBlobCreator::CanvasAsyncBlobCreator( @@ -169,6 +171,7 @@ base::TimeTicks start_time, ExecutionContext* context, UkmParameters ukm_params, + const IdentifiableToken& input_digest, ScriptPromiseResolver* resolver) : fail_encoder_initialization_for_test_(false), enforce_idle_encoding_for_test_(false), @@ -180,6 +183,7 @@ static_bitmap_image_loaded_(false), callback_(callback), ukm_params_(ukm_params), + input_digest_(input_digest), script_promise_resolver_(resolver) { DCHECK(image); DCHECK(context); @@ -500,7 +504,8 @@ ->PostTask( FROM_HERE, WTF::Bind( - [](scoped_refptr<StaticBitmapImage> image, + [](IdentifiableToken input_digest, + scoped_refptr<StaticBitmapImage> image, UkmParameters ukm_params) { std::unique_ptr<ImageDataBuffer> data_buffer = ImageDataBuffer::Create(image); @@ -509,13 +514,13 @@ blink::IdentifiabilityMetricBuilder(ukm_params.source_id) .Set(blink::IdentifiableSurface::FromTypeAndToken( blink::IdentifiableSurface::Type::kCanvasReadback, - 0), + input_digest), blink::IdentifiabilityDigestOfBytes( base::make_span(data_buffer->Pixels(), data_buffer->ComputeByteSize()))) .Record(ukm_params.ukm_recorder); }, - image_, ukm_params_)); + input_digest_, image_, ukm_params_)); } void CanvasAsyncBlobCreator::CreateNullAndReturnResult() {
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.h b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.h index 4c4d6709..e2bc1639 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.h +++ b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.h
@@ -10,6 +10,7 @@ #include "base/location.h" #include "base/single_thread_task_runner.h" #include "services/metrics/public/cpp/ukm_recorder.h" +#include "third_party/blink/public/common/privacy_budget/identifiable_token.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/bindings/core/v8/v8_blob_callback.h" #include "third_party/blink/renderer/bindings/core/v8/v8_image_encode_options.h" @@ -63,6 +64,7 @@ base::TimeTicks start_time, ExecutionContext*, UkmParameters ukm_params, + const IdentifiableToken& input_digest, ScriptPromiseResolver*); CanvasAsyncBlobCreator(scoped_refptr<StaticBitmapImage>, const ImageEncodeOptions*, @@ -71,6 +73,7 @@ base::TimeTicks start_time, ExecutionContext*, UkmParameters ukm_params, + const IdentifiableToken& input_digest, ScriptPromiseResolver* = nullptr); virtual ~CanvasAsyncBlobCreator(); @@ -137,6 +140,7 @@ Member<V8BlobCallback> callback_; UkmParameters ukm_params_; + IdentifiableToken input_digest_; // Used for OffscreenCanvas only Member<ScriptPromiseResolver> script_promise_resolver_;
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator_test.cc b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator_test.cc index 0367493b..e4f218d4 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator_test.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator_test.cc
@@ -37,6 +37,7 @@ base::TimeTicks(), document->GetExecutionContext(), UkmParameters{document->UkmRecorder(), document->UkmSourceID()}, + 0, nullptr) { if (fail_encoder_initialization) fail_encoder_initialization_for_test_ = true; @@ -300,7 +301,7 @@ CanvasAsyncBlobCreator::ToBlobFunctionType:: kHTMLCanvasConvertToBlobPromise, base::TimeTicks(), GetFrame().DomWindow(), - UkmParameters{UkmRecorder(), 0}, nullptr); + UkmParameters{UkmRecorder(), 0}, 0, nullptr); ASSERT_TRUE(async_blob_creator->EncodeImageForConvertToBlobTest()); sk_sp<SkData> sk_data = SkData::MakeWithCopy(
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.cc b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.cc index 7dbeb26..a7d3197 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.cc +++ b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.cc
@@ -8,6 +8,7 @@ #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" #include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h" #include "third_party/blink/public/platform/platform.h" #include "third_party/blink/renderer/bindings/core/v8/v8_image_encode_options.h" #include "third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.h" @@ -287,7 +288,8 @@ ScriptPromise CanvasRenderingContextHost::convertToBlob( ScriptState* script_state, const ImageEncodeOptions* options, - ExceptionState& exception_state) { + ExceptionState& exception_state, + const CanvasRenderingContext* const context) { WTF::String object_name = "Canvas"; if (this->IsOffscreenCanvas()) object_name = "OffscreenCanvas"; @@ -338,7 +340,12 @@ } auto* async_creator = MakeGarbageCollected<CanvasAsyncBlobCreator>( image_bitmap, options, function_type, start_time, - ExecutionContext::From(script_state), ukm_params_, resolver); + ExecutionContext::From(script_state), ukm_params_, + IdentifiabilityStudySettings::Get()->IsTypeAllowed( + IdentifiableSurface::Type::kCanvasReadback) + ? IdentifiabilityInputDigest(context) + : 0, + resolver); async_creator->ScheduleAsyncBlobCreation(options->quality()); return resolver->Promise(); } @@ -351,4 +358,42 @@ return host_type_ == kOffscreenCanvasHost; } +IdentifiableToken CanvasRenderingContextHost::IdentifiabilityInputDigest( + const CanvasRenderingContext* const context) const { + const uint64_t context_digest = + context ? context->IdentifiableTextToken().ToUkmMetricValue() : 0; + const IdentifiabilityPaintOpDigest* const identifiability_paintop_digest = + ResourceProvider() + ? &(ResourceProvider()->GetIdentifiablityPaintOpDigest()) + : nullptr; + const uint64_t canvas_digest = + identifiability_paintop_digest + ? identifiability_paintop_digest->GetToken().ToUkmMetricValue() + : 0; + const uint64_t context_type = + context ? context->GetContextType() + : CanvasRenderingContext::kContextTypeUnknown; + const bool encountered_skipped_ops = + (context && context->IdentifiabilityEncounteredSkippedOps()) || + (identifiability_paintop_digest && + identifiability_paintop_digest->encountered_skipped_ops()); + const bool encountered_sensitive_ops = + context && context->IdentifiabilityEncounteredSensitiveOps(); + const bool encountered_partially_digested_image = + identifiability_paintop_digest && + identifiability_paintop_digest->encountered_partially_digested_image(); + // Bits [0-3] are the context type, bits [4-6] are skipped ops, sensitive + // ops, and partial image ops bits, respectively. The remaining bits are + // for the canvas digest. + uint64_t final_digest = + ((context_digest ^ canvas_digest) << 7) | context_type; + if (encountered_skipped_ops) + final_digest |= IdentifiableSurface::CanvasTaintBit::kSkipped; + if (encountered_sensitive_ops) + final_digest |= IdentifiableSurface::CanvasTaintBit::kSensitive; + if (encountered_partially_digested_image) + final_digest |= IdentifiableSurface::CanvasTaintBit::kPartiallyDigested; + return final_digest; +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.h b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.h index 378cc7b..f1f00d8 100644 --- a/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.h +++ b/third_party/blink/renderer/core/html/canvas/canvas_rendering_context_host.h
@@ -6,6 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_CANVAS_CANVAS_RENDERING_CONTEXT_HOST_H_ #include "services/metrics/public/cpp/ukm_recorder.h" +#include "third_party/blink/public/common/privacy_budget/identifiable_token.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/events/event_dispatcher.h" @@ -82,9 +83,10 @@ // For deferred canvases this will have the side effect of drawing recorded // commands in order to finalize the frame. - virtual ScriptPromise convertToBlob(ScriptState*, - const ImageEncodeOptions*, - ExceptionState&); + ScriptPromise convertToBlob(ScriptState*, + const ImageEncodeOptions*, + ExceptionState&, + const CanvasRenderingContext* const context); bool IsPaintable() const; @@ -119,6 +121,12 @@ void CreateCanvasResourceProvider2D(RasterModeHint hint); void CreateCanvasResourceProvider3D(); + // Computes the digest that corresponds to the "input" of this canvas, + // including the context type, and if applicable, canvas digest, and taint + // bits. + IdentifiableToken IdentifiabilityInputDigest( + const CanvasRenderingContext* const context) const; + bool did_fail_to_create_resource_provider_ = false; bool did_record_canvas_size_to_uma_ = false; HostType host_type_ = kNone;
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc index 5999b448..b245634e 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc
@@ -270,42 +270,10 @@ IdentifiableToken canvas_contents_token) const { if (IdentifiabilityStudySettings::Get()->IsTypeAllowed( blink::IdentifiableSurface::Type::kCanvasReadback)) { - const uint64_t context_digest = - context_ ? context_->IdentifiableTextToken().ToUkmMetricValue() : 0; - const IdentifiabilityPaintOpDigest* const identifiability_paintop_digest = - ResourceProvider() - ? &(ResourceProvider()->GetIdentifiablityPaintOpDigest()) - : nullptr; - const uint64_t canvas_digest = - identifiability_paintop_digest - ? identifiability_paintop_digest->GetToken().ToUkmMetricValue() - : 0; - const uint64_t context_type = - context_ ? context_->GetContextType() - : CanvasRenderingContext::kContextTypeUnknown; - const bool encountered_skipped_ops = - (context_ && context_->IdentifiabilityEncounteredSkippedOps()) || - (identifiability_paintop_digest && - identifiability_paintop_digest->encountered_skipped_ops()); - const bool encountered_sensitive_ops = - context_ && context_->IdentifiabilityEncounteredSensitiveOps(); - const bool encountered_partially_digested_image = - identifiability_paintop_digest && - identifiability_paintop_digest->encountered_partially_digested_image(); - // Bits [0-3] are the context type, bits [4-6] are skipped ops, sensitive - // ops, and partial image ops bits, respectively. The remaining bits are - // for the canvas digest. - uint64_t final_digest = - ((context_digest ^ canvas_digest) << 7) | context_type; - if (encountered_skipped_ops) - final_digest |= IdentifiableSurface::CanvasTaintBit::kSkipped; - if (encountered_sensitive_ops) - final_digest |= IdentifiableSurface::CanvasTaintBit::kSensitive; - if (encountered_partially_digested_image) - final_digest |= IdentifiableSurface::CanvasTaintBit::kPartiallyDigested; RecordIdentifiabilityMetric( blink::IdentifiableSurface::FromTypeAndToken( - blink::IdentifiableSurface::Type::kCanvasReadback, final_digest), + blink::IdentifiableSurface::Type::kCanvasReadback, + IdentifiabilityInputDigest(context_)), canvas_contents_token.ToUkmMetricValue()); } } @@ -432,7 +400,7 @@ const ImageEncodeOptions* options, ExceptionState& exception_state) { return CanvasRenderingContextHost::convertToBlob(script_state, options, - exception_state); + exception_state, context_); } bool HTMLCanvasElement::ShouldBeDirectComposited() const { @@ -1068,13 +1036,13 @@ image_bitmap, options, CanvasAsyncBlobCreator::kHTMLCanvasToBlobCallback, callback, start_time, GetExecutionContext(), - UkmParameters{GetDocument().UkmRecorder(), - GetDocument().UkmSourceID()}); + UkmParameters{GetDocument().UkmRecorder(), GetDocument().UkmSourceID()}, + IdentifiabilityStudySettings::Get()->IsTypeAllowed( + IdentifiableSurface::Type::kCanvasReadback) + ? IdentifiabilityInputDigest(context_) + : 0); } - // TODO(crbug.com/973801): Report real digest for toBlob(). - IdentifiabilityReportWithDigest(IdentifiableToken(0)); - if (async_creator) { async_creator->ScheduleAsyncBlobCreation(quality); } else {
diff --git a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h index f610dbf..4b05daa 100644 --- a/third_party/blink/renderer/core/html/canvas/html_canvas_element.h +++ b/third_party/blink/renderer/core/html/canvas/html_canvas_element.h
@@ -292,7 +292,7 @@ ScriptPromise convertToBlob(ScriptState*, const ImageEncodeOptions*, - ExceptionState&) override; + ExceptionState&); bool NeedsUnbufferedInputEvents() const { return needs_unbuffered_input_; }
diff --git a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc index cccc653..a455bc9 100644 --- a/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc +++ b/third_party/blink/renderer/core/layout/ng/inline/ng_inline_cursor.cc
@@ -958,12 +958,25 @@ PositionWithAffinity NGInlineCursor::PositionForStartOfLine() const { DCHECK(Current().IsLineBox()); - const PhysicalOffset point_in_line = Current().LineStartPoint(); - if (IsItemCursor()) { - return PositionForPointInInlineBox(point_in_line + - Current().OffsetInContainerBlock()); + NGInlineCursor first_leaf = CursorForDescendants(); + if (IsLtr(Current().BaseDirection())) + first_leaf.MoveToFirstNonPseudoLeaf(); + else + first_leaf.MoveToLastNonPseudoLeaf(); + if (!first_leaf) + return PositionWithAffinity(); + Node* const node = first_leaf.Current().GetLayoutObject()->NonPseudoNode(); + if (!node) { + NOTREACHED() << "MoveToFirstLeaf returns invalid node: " << first_leaf; + return PositionWithAffinity(); } - return CurrentPaintFragment()->PositionForPoint(point_in_line); + if (!IsA<Text>(node)) + return PositionWithAffinity(Position::BeforeNode(*node)); + const unsigned text_offset = + Current().BaseDirection() == first_leaf.Current().ResolvedDirection() + ? first_leaf.Current().TextOffset().start + : first_leaf.Current().TextOffset().end; + return first_leaf.PositionForPointInText(text_offset); } PositionWithAffinity NGInlineCursor::PositionForEndOfLine() const {
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc index a99314d..a9cc14a0 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_root.cc
@@ -625,6 +625,9 @@ } } has_descendant_with_compositing_reason_dirty_ = false; + + if (has_descendant_with_compositing_reason_) + UseCounter::Count(GetDocument(), WebFeature::kCompositedSVG); } return has_descendant_with_compositing_reason_; }
diff --git a/third_party/blink/renderer/core/layout/svg/layout_svg_root_test.cc b/third_party/blink/renderer/core/layout/svg/layout_svg_root_test.cc index 279ad772b..4876671 100644 --- a/third_party/blink/renderer/core/layout/svg/layout_svg_root_test.cc +++ b/third_party/blink/renderer/core/layout/svg/layout_svg_root_test.cc
@@ -219,4 +219,25 @@ EXPECT_FALSE(root.HasDescendantCompositingReasons()); } +TEST_P(CompositeSVGLayoutSVGRootTest, CompositedSVGMetric) { + SetBodyInnerHTML(R"HTML( + <style> + .anim { animation: anim 5s infinite; } + @keyframes anim { + from { transform: translateX(0); } + to { transform: translateX(100px); } + } + </style> + <svg style="width: 200px; height: 200px;"> + <rect id="rect" width="100" height="100" fill="green"/> + </svg> + )HTML"); + + EXPECT_FALSE(GetDocument().IsUseCounted(WebFeature::kCompositedSVG)); + auto* rect = GetDocument().getElementById("rect"); + rect->setAttribute(html_names::kClassAttr, "anim"); + UpdateAllLifecyclePhasesForTest(); + EXPECT_TRUE(GetDocument().IsUseCounted(WebFeature::kCompositedSVG)); +} + } // namespace blink
diff --git a/third_party/blink/renderer/core/loader/document_loader.cc b/third_party/blink/renderer/core/loader/document_loader.cc index 9fdb4df..9b371706 100644 --- a/third_party/blink/renderer/core/loader/document_loader.cc +++ b/third_party/blink/renderer/core/loader/document_loader.cc
@@ -1235,7 +1235,14 @@ HandleRedirect(redirect_response.CurrentRequestUrl()); } - MixedContentChecker::CheckMixedPrivatePublic(GetFrame(), response_); + if (!frame_->IsMainFrame()) { + // We only care about detecting embedded private subresources. + // + // TODO(crbug.com/1129326): Revisit this when we have a coherent story for + // top-level navigations. + MixedContentChecker::CheckMixedPrivatePublic(frame_, response_); + } + ApplyClientHintsConfig(params_->enabled_client_hints); PreloadHelper::LoadLinksFromHeader( response_.HttpHeaderField(http_names::kLink),
diff --git a/third_party/blink/renderer/core/loader/empty_clients.h b/third_party/blink/renderer/core/loader/empty_clients.h index 5db72aa..ab15a13 100644 --- a/third_party/blink/renderer/core/loader/empty_clients.h +++ b/third_party/blink/renderer/core/loader/empty_clients.h
@@ -97,7 +97,10 @@ void DidFocusPage() override {} bool CanTakeFocus(mojom::blink::FocusType) override { return false; } void TakeFocus(mojom::blink::FocusType) override {} - void Show(NavigationPolicy) override {} + void Show(const base::UnguessableToken& opener_frame_token, + NavigationPolicy navigation_policy, + const IntRect& initial_rect, + bool user_gesture) override {} void DidOverscroll(const gfx::Vector2dF&, const gfx::Vector2dF&, const gfx::PointF&, @@ -137,7 +140,8 @@ const WebWindowFeatures&, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&) override { + const SessionStorageNamespaceId&, + bool& consumed_user_gesture) override { return nullptr; } bool OpenJavaScriptAlertDelegate(LocalFrame*, const String&) override {
diff --git a/third_party/blink/renderer/core/mathml/mathml_element.cc b/third_party/blink/renderer/core/mathml/mathml_element.cc index 616b8c9..18b772e 100644 --- a/third_party/blink/renderer/core/mathml/mathml_element.cc +++ b/third_party/blink/renderer/core/mathml/mathml_element.cc
@@ -11,6 +11,8 @@ #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/dom/node_computed_style.h" #include "third_party/blink/renderer/core/html/html_element.h" +#include "third_party/blink/renderer/platform/wtf/text/character_visitor.h" +#include "third_party/blink/renderer/platform/wtf/text/string_to_number.h" namespace blink { @@ -40,12 +42,36 @@ name == mathml_names::kMathcolorAttr || name == mathml_names::kMathbackgroundAttr || name == mathml_names::kMathvariantAttr || + name == mathml_names::kScriptlevelAttr || name == mathml_names::kDisplayAttr || name == mathml_names::kDisplaystyleAttr) return true; return Element::IsPresentationAttribute(name); } +namespace { + +bool ParseScriptLevel(const AtomicString& attributeValue, + unsigned& scriptLevel, + bool& add) { + String value = attributeValue; + if (value.StartsWith("+") || value.StartsWith("-")) { + add = true; + value = value.Right(1); + } + + return WTF::VisitCharacters( + value, [&](const auto* position, unsigned length) { + WTF::NumberParsingResult result; + WTF::NumberParsingOptions options( + WTF::NumberParsingOptions::kAcceptMinusZeroForUnsigned); + scriptLevel = CharactersToUInt(position, length, options, &result); + return result == WTF::NumberParsingResult::kSuccess; + }); +} + +} // namespace + void MathMLElement::CollectStyleForPresentationAttribute( const QualifiedName& name, const AtomicString& value, @@ -66,6 +92,19 @@ } else if (name == mathml_names::kMathcolorAttr) { AddPropertyToPresentationAttributeStyle(style, CSSPropertyID::kColor, value); + } else if (name == mathml_names::kScriptlevelAttr) { + unsigned scriptLevel = 0; + bool add = false; + if (ParseScriptLevel(value, scriptLevel, add)) { + if (add) { + AddPropertyToPresentationAttributeStyle( + style, CSSPropertyID::kMathDepth, "add(" + value + ")"); + } else { + AddPropertyToPresentationAttributeStyle( + style, CSSPropertyID::kMathDepth, scriptLevel, + CSSPrimitiveValue::UnitType::kNumber); + } + } } else if (name == mathml_names::kDisplayAttr && HasTagName(mathml_names::kMathTag)) { if (EqualIgnoringASCIICase(value, "inline")) {
diff --git a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc index a9c45c1..2f15c75 100644 --- a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc +++ b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc
@@ -179,6 +179,13 @@ } } +ScriptPromise OffscreenCanvas::convertToBlob(ScriptState* script_state, + const ImageEncodeOptions* options, + ExceptionState& exception_state) { + return CanvasRenderingContextHost::convertToBlob(script_state, options, + exception_state, context_); +} + void OffscreenCanvas::RecordTransfer() { UMA_HISTOGRAM_BOOLEAN("Blink.OffscreenCanvas.Transferred", true); }
diff --git a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h index d715a44..54b01224 100644 --- a/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h +++ b/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h
@@ -69,6 +69,10 @@ // API Methods ImageBitmap* transferToImageBitmap(ScriptState*, ExceptionState&); + ScriptPromise convertToBlob(ScriptState* script_state, + const ImageEncodeOptions* options, + ExceptionState& exception_state); + const IntSize& Size() const override { return size_; } void SetSize(const IntSize&); void RecordTransfer();
diff --git a/third_party/blink/renderer/core/page/chrome_client.cc b/third_party/blink/renderer/core/page/chrome_client.cc index 4bebdab..4b42770 100644 --- a/third_party/blink/renderer/core/page/chrome_client.cc +++ b/third_party/blink/renderer/core/page/chrome_client.cc
@@ -52,9 +52,10 @@ CoreInitializer::GetInstance().InstallSupplements(frame); } -void ChromeClient::SetWindowRectWithAdjustment(const IntRect& pending_rect, - LocalFrame& frame, - LocalFrame& requesting_frame) { +IntRect ChromeClient::CalculateWindowRectWithAdjustment( + const IntRect& pending_rect, + LocalFrame& frame, + LocalFrame& requesting_frame) { IntRect screen(GetScreenInfo(frame).available_rect); IntRect window = pending_rect; @@ -112,7 +113,13 @@ WebFeature::kDOMWindowSetWindowRectCrossScreen); } - SetWindowRect(window, frame); + return window; +} + +void ChromeClient::SetWindowRectWithAdjustment(const IntRect& pending_rect, + LocalFrame& frame) { + IntRect rect = CalculateWindowRectWithAdjustment(pending_rect, frame, frame); + SetWindowRect(rect, frame); } bool ChromeClient::CanOpenUIElementIfDuringPageDismissal( @@ -141,15 +148,16 @@ const WebWindowFeatures& features, network::mojom::blink::WebSandboxFlags sandbox_flags, const FeaturePolicyFeatureState& opener_feature_state, - const SessionStorageNamespaceId& session_storage_namespace_id) { + const SessionStorageNamespaceId& session_storage_namespace_id, + bool& consumed_user_gesture) { if (!CanOpenUIElementIfDuringPageDismissal( frame->Tree().Top(), UIElementType::kPopup, g_empty_string)) { return nullptr; } - return CreateWindowDelegate(frame, r, frame_name, features, sandbox_flags, - opener_feature_state, - session_storage_namespace_id); + return CreateWindowDelegate( + frame, r, frame_name, features, sandbox_flags, opener_feature_state, + session_storage_namespace_id, consumed_user_gesture); } template <typename Delegate>
diff --git a/third_party/blink/renderer/core/page/chrome_client.h b/third_party/blink/renderer/core/page/chrome_client.h index 768087b..e18f6f31 100644 --- a/third_party/blink/renderer/core/page/chrome_client.h +++ b/third_party/blink/renderer/core/page/chrome_client.h
@@ -143,15 +143,19 @@ virtual void ScheduleAnimation(const LocalFrameView*, base::TimeDelta = base::TimeDelta()) = 0; - // Adjusts |pending_rect| for the minimum window size and |frame|'s screen, - // then calls SetWindowRect on |frame| with the adjusted rectangle. + // Adjusts |pending_rect| for the minimum window size and |frame|'s screen + // and returns the adjusted value. // Cross-screen window placements are passed on without same-screen clamping // if the |requesting_frame| (i.e. the opener or |frame| itself) has // experimental window placement features enabled. The browser will check // permissions before actually supporting cross-screen placement requests. + IntRect CalculateWindowRectWithAdjustment(const IntRect& pending_rect, + LocalFrame& frame, + LocalFrame& requesting_frame); + + // Calls CalculateWindowRectWithAdjustment, then SetWindowRect. void SetWindowRectWithAdjustment(const IntRect& pending_rect, - LocalFrame& frame, - LocalFrame& requesting_frame); + LocalFrame& frame); // This gives the rect of the top level window that the given LocalFrame is a // part of. @@ -212,8 +216,18 @@ const WebWindowFeatures&, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&); - virtual void Show(NavigationPolicy) = 0; + const SessionStorageNamespaceId&, + bool& consumed_user_gesture); + + // Show a previously created Page that was created via CreateWindow. This + // should only be called once the newly created window when it is ready to be + // shown. Under some circumstances CreateWindow's implementation may return a + // previously shown page. Calling this method should still work and the + // browser will discard the unnecessary show request. + virtual void Show(const base::UnguessableToken& opener_frame_token, + NavigationPolicy navigation_policy, + const IntRect& initial_rect, + bool consumed_user_gesture) = 0; // All the parameters should be in viewport space. That is, if an event // scrolls by 10 px, but due to a 2X page scale we apply a 5px scroll to the @@ -531,7 +545,8 @@ const WebWindowFeatures&, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&) = 0; + const SessionStorageNamespaceId&, + bool& consumed_user_gesture) = 0; private: bool CanOpenUIElementIfDuringPageDismissal(Frame& main_frame,
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.cc b/third_party/blink/renderer/core/page/chrome_client_impl.cc index 9e76c30f..375ec16 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl.cc
@@ -246,7 +246,8 @@ const WebWindowFeatures& features, network::mojom::blink::WebSandboxFlags sandbox_flags, const FeaturePolicyFeatureState& opener_feature_state, - const SessionStorageNamespaceId& session_storage_namespace_id) { + const SessionStorageNamespaceId& session_storage_namespace_id, + bool& consumed_user_gesture) { if (!web_view_->Client()) return nullptr; @@ -261,7 +262,8 @@ WebLocalFrameImpl::FromFrame(frame), WrappedResourceRequest(r.GetResourceRequest()), features, frame_name, static_cast<WebNavigationPolicy>(r.GetNavigationPolicy()), - sandbox_flags, opener_feature_state, session_storage_namespace_id)); + sandbox_flags, opener_feature_state, session_storage_namespace_id, + consumed_user_gesture)); if (!new_view) return nullptr; return new_view->GetPage(); @@ -302,13 +304,12 @@ overscroll_behavior); } -void ChromeClientImpl::Show(NavigationPolicy navigation_policy) { - // TODO(darin): Change caller to pass LocalFrame. - WebLocalFrameImpl* main_frame = web_view_->MainFrameImpl(); - DCHECK(main_frame); - main_frame->FrameWidgetImpl()->Client()->Show( - static_cast<WebNavigationPolicy>(navigation_policy)); - main_frame->DevToolsAgentImpl()->DidShowNewWindow(); +void ChromeClientImpl::Show(const base::UnguessableToken& opener_frame_token, + NavigationPolicy navigation_policy, + const IntRect& initial_rect, + bool user_gesture) { + web_view_->Show(opener_frame_token, navigation_policy, initial_rect, + user_gesture); } bool ChromeClientImpl::ShouldReportDetailedMessageForSource(
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl.h b/third_party/blink/renderer/core/page/chrome_client_impl.h index cab1134..be13a79e 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl.h +++ b/third_party/blink/renderer/core/page/chrome_client_impl.h
@@ -90,8 +90,12 @@ const WebWindowFeatures&, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&) override; - void Show(NavigationPolicy) override; + const SessionStorageNamespaceId&, + bool& consumed_user_gesture) override; + void Show(const base::UnguessableToken& opener_frame_token, + NavigationPolicy navigation_policy, + const IntRect& initial_rect, + bool user_gesture) override; void DidOverscroll(const gfx::Vector2dF& overscroll_delta, const gfx::Vector2dF& accumulated_overscroll, const gfx::PointF& position_in_viewport,
diff --git a/third_party/blink/renderer/core/page/chrome_client_impl_test.cc b/third_party/blink/renderer/core/page/chrome_client_impl_test.cc index fb8c767..5b91664 100644 --- a/third_party/blink/renderer/core/page/chrome_client_impl_test.cc +++ b/third_party/blink/renderer/core/page/chrome_client_impl_test.cc
@@ -66,7 +66,8 @@ WebNavigationPolicy, network::mojom::blink::WebSandboxFlags, const FeaturePolicyFeatureState&, - const SessionStorageNamespaceId&) override { + const SessionStorageNamespaceId&, + bool& consumed_user_gesture) override { return web_view_helper_.InitializeWithOpener(opener); } @@ -96,10 +97,12 @@ FrameLoadRequest request(frame->DomWindow(), ResourceRequest()); request.SetNavigationPolicy(kNavigationPolicyNewForegroundTab); WebWindowFeatures features; - EXPECT_EQ(nullptr, chrome_client_impl_->CreateWindow( - frame, request, "", features, - network::mojom::blink::WebSandboxFlags::kNone, - FeaturePolicyFeatureState(), "")); + bool consumed_user_gesture = false; + EXPECT_EQ(nullptr, + chrome_client_impl_->CreateWindow( + frame, request, "", features, + network::mojom::blink::WebSandboxFlags::kNone, + FeaturePolicyFeatureState(), "", consumed_user_gesture)); } class FakeColorChooserClient : public GarbageCollected<FakeColorChooserClient>,
diff --git a/third_party/blink/renderer/core/page/create_window.cc b/third_party/blink/renderer/core/page/create_window.cc index 8b023d4..5e27aecb 100644 --- a/third_party/blink/renderer/core/page/create_window.cc +++ b/third_party/blink/renderer/core/page/create_window.cc
@@ -307,9 +307,10 @@ CoreInitializer::GetInstance().CloneSessionStorage(old_page, new_namespace_id); + bool consumed_user_gesture = false; Page* page = old_page->GetChromeClient().CreateWindow( &opener_frame, request, frame_name, features, sandbox_flags, - opener_feature_state, new_namespace_id); + opener_feature_state, new_namespace_id, consumed_user_gesture); if (!page) return nullptr; @@ -342,10 +343,11 @@ if (features.height_set) window_rect.SetHeight(features.height); - page->GetChromeClient().SetWindowRectWithAdjustment(window_rect, frame, - opener_frame); - page->GetChromeClient().Show(request.GetNavigationPolicy()); - + IntRect rect = page->GetChromeClient().CalculateWindowRectWithAdjustment( + window_rect, frame, opener_frame); + page->GetChromeClient().Show(opener_frame.GetFrameToken(), + request.GetNavigationPolicy(), rect, + consumed_user_gesture); MaybeLogWindowOpen(opener_frame); return &frame; }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_menu_list.cc b/third_party/blink/renderer/modules/accessibility/ax_menu_list.cc index 8fff570..de3368e 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_menu_list.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_menu_list.cc
@@ -74,15 +74,15 @@ have_children_ = true; AXObjectCacheImpl& cache = AXObjectCache(); - AXObject* popup = cache.Create(ax::mojom::blink::Role::kMenuListPopup, this); + DCHECK(popup); + if (!popup->AccessibilityIsIncludedInTree()) { cache.Remove(popup->AXObjectID()); return; } children_.push_back(popup); - popup->AddChildren(); }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_menu_list_popup.cc b/third_party/blink/renderer/modules/accessibility/ax_menu_list_popup.cc index 5e6a9f8d..b4823a35 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_menu_list_popup.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_menu_list_popup.cc
@@ -109,8 +109,8 @@ for (auto* const option_element : html_select_element->GetOptionList()) { AXMenuListOption* option = MenuListOptionAXObject(option_element); if (option) { - option->SetParent(this); children_.push_back(option); + option->SetParent(this); } } }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_slider.cc b/third_party/blink/renderer/modules/accessibility/ax_slider.cc index 1f30dda..c5b0e28 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_slider.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_slider.cc
@@ -78,23 +78,24 @@ void AXSlider::AddChildren() { DCHECK(!IsDetached()); DCHECK(!have_children_); - have_children_ = true; AXObjectCacheImpl& cache = AXObjectCache(); - AXObject* thumb = cache.Create(ax::mojom::blink::Role::kSliderThumb, this); + DCHECK(thumb); // Before actually adding the value indicator to the hierarchy, // allow the platform to make a final decision about it. - if (!thumb->AccessibilityIsIncludedInTree()) + if (!thumb->AccessibilityIsIncludedInTree()) { cache.Remove(thumb->AXObjectID()); - else - children_.push_back(thumb); + return; + } + + children_.push_back(thumb); } AXObject* AXSlider::ElementAccessibilityHitTest(const IntPoint& point) const { - if (children_.size()) { + if (HasChildren()) { DCHECK(children_.size() == 1); if (children_[0]->GetBoundsInFrameCoordinates().Contains(point)) return children_[0].Get();
diff --git a/third_party/blink/renderer/modules/accessibility/ax_virtual_object.cc b/third_party/blink/renderer/modules/accessibility/ax_virtual_object.cc index 67bb64c..7df5823 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_virtual_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_virtual_object.cc
@@ -29,8 +29,14 @@ if (!accessible_node_) return; - for (const auto& child : accessible_node_->GetChildren()) - children_.push_back(AXObjectCache().GetOrCreate(child)); + for (const auto& child : accessible_node_->GetChildren()) { + AXObject* ax_child = AXObjectCache().GetOrCreate(child); + if (!ax_child) + continue; + + children_.push_back(ax_child); + ax_child->SetParent(this); + } } void AXVirtualObject::ChildrenChanged() {
diff --git a/third_party/blink/renderer/platform/instrumentation/partition_alloc_memory_dump_provider.cc b/third_party/blink/renderer/platform/instrumentation/partition_alloc_memory_dump_provider.cc index 50ac292..eece1d52 100644 --- a/third_party/blink/renderer/platform/instrumentation/partition_alloc_memory_dump_provider.cc +++ b/third_party/blink/renderer/platform/instrumentation/partition_alloc_memory_dump_provider.cc
@@ -7,6 +7,7 @@ #include "base/allocator/partition_allocator/partition_alloc.h" #include "base/format_macros.h" #include "base/strings/stringprintf.h" +#include "base/trace_event/malloc_dump_provider.h" #include "base/trace_event/process_memory_dump.h" #include "third_party/blink/renderer/platform/wtf/allocator/partitions.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -23,33 +24,6 @@ kPartitionsDumpName, partition_name); } -void ThreadCacheDump(base::trace_event::MemoryAllocatorDump* thread_cache_dump, - const base::internal::ThreadCacheStats& stats) { - thread_cache_dump->AddScalar("alloc_count", "scalar", stats.alloc_count); - thread_cache_dump->AddScalar("alloc_hits", "scalar", stats.alloc_hits); - thread_cache_dump->AddScalar("alloc_misses", "scalar", stats.alloc_misses); - - thread_cache_dump->AddScalar("alloc_miss_empty", "scalar", - stats.alloc_miss_empty); - thread_cache_dump->AddScalar("alloc_miss_too_large", "scalar", - stats.alloc_miss_too_large); - - thread_cache_dump->AddScalar("cache_fill_count", "scalar", - stats.cache_fill_count); - thread_cache_dump->AddScalar("cache_fill_hits", "scalar", - stats.cache_fill_hits); - thread_cache_dump->AddScalar("cache_fill_misses", "scalar", - stats.cache_fill_misses); - thread_cache_dump->AddScalar("cache_fill_bucket_full", "scalar", - stats.cache_fill_bucket_full); - thread_cache_dump->AddScalar("cache_fill_too_large", "scalar", - stats.cache_fill_too_large); - - thread_cache_dump->AddScalar("size", "bytes", stats.bucket_total_memory); - thread_cache_dump->AddScalar("metadata_overhead", "bytes", - stats.metadata_overhead); -} - // This class is used to invert the dependency of PartitionAlloc on the // PartitionAllocMemoryDumpProvider. This implements an interface that will // be called with memory statistics for each bucket in the allocator. @@ -102,12 +76,14 @@ const auto& thread_cache_stats = memory_stats->current_thread_cache_stats; auto* thread_cache_dump = memory_dump_->CreateAllocatorDump( dump_name + "/thread_cache/main_thread"); - ThreadCacheDump(thread_cache_dump, thread_cache_stats); + base::trace_event::ReportPartitionAllocThreadCacheStats(thread_cache_dump, + thread_cache_stats); const auto& all_thread_caches_stats = memory_stats->all_thread_caches_stats; - auto* all_thread_caches_dump = memory_dump_->CreateAllocatorDump( - dump_name + "/thread_cache/all_threads"); - ThreadCacheDump(all_thread_caches_dump, all_thread_caches_stats); + auto* all_thread_caches_dump = + memory_dump_->CreateAllocatorDump(dump_name + "/thread_cache"); + base::trace_event::ReportPartitionAllocThreadCacheStats( + all_thread_caches_dump, all_thread_caches_stats); } }
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index f594934..88dd194 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -1211,7 +1211,6 @@ crbug.com/6606 external/wpt/mathml/presentation-markup/tables/table-001.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/tables/table-002.html [ Failure ] crbug.com/6606 external/wpt/mathml/presentation-markup/tables/table-axis-height.html [ Failure ] -crbug.com/6606 external/wpt/mathml/relations/css-styling/attribute-mapping-002.html [ Failure ] crbug.com/6606 external/wpt/mathml/relations/css-styling/displaystyle-1.html [ Failure ] crbug.com/6606 external/wpt/mathml/relations/css-styling/ignored-properties-001.html [ Failure Timeout ] crbug.com/6606 external/wpt/mathml/relations/css-styling/mathvariant-bold-fraktur.html [ Failure ] @@ -4624,17 +4623,18 @@ crbug.com/1074441 virtual/legacy-samesite/external/wpt/cookies/samesite/iframe-reload.https.html?legacy-samesite [ Skip ] crbug.com/1074441 virtual/legacy-samesite/external/wpt/cookies/samesite/iframe.https.html?legacy-samesite [ Skip ] -# Tentative Schemeful Same-Site tests shouldn't pass while the feature is disabled. -crbug.com/1127348 external/wpt/cookies/schemeful-same-site/schemeful-websockets.sub.tentative.html [ Failure ] -crbug.com/1127348 external/wpt/cookies/schemeful-same-site/schemeful-iframe-subresource.tentative.html [ Failure ] -crbug.com/1127348 external/wpt/cookies/schemeful-same-site/schemeful-subresource.tentative.html [ Failure ] -crbug.com/1127348 external/wpt/cookies/schemeful-same-site/schemeful-navigation.tentative.html [ Failure ] -# Mark the virtual versions as passing so that we're informed about regressions. -crbug.com/1127348 virtual/schemeful-same-site/external/wpt/cookies/schemeful-same-site/schemeful-websockets.sub.tentative.html [ Pass ] -crbug.com/1127348 virtual/schemeful-same-site/external/wpt/cookies/schemeful-same-site/schemeful-iframe-subresource.tentative.html [ Pass ] -crbug.com/1127348 virtual/schemeful-same-site/external/wpt/cookies/schemeful-same-site/schemeful-subresource.tentative.html [ Pass ] -crbug.com/1127348 virtual/schemeful-same-site/external/wpt/cookies/schemeful-same-site/schemeful-navigation.tentative.html [ Pass ] +# The virtual tests run with Schemeful Same-Site disabled. These should fail to ensure the disabled feature code paths work. +crbug.com/1127348 virtual/schemeful-same-site/external/wpt/cookies/schemeful-same-site/schemeful-websockets.sub.tentative.html [ Failure ] +crbug.com/1127348 virtual/schemeful-same-site/external/wpt/cookies/schemeful-same-site/schemeful-iframe-subresource.tentative.html [ Failure ] +crbug.com/1127348 virtual/schemeful-same-site/external/wpt/cookies/schemeful-same-site/schemeful-subresource.tentative.html [ Failure ] +crbug.com/1127348 virtual/schemeful-same-site/external/wpt/cookies/schemeful-same-site/schemeful-navigation.tentative.html [ Failure ] +# These tests fail with Schemeful Same-Site due to their cross-schemeness. Skip them until there's a more permanent solution. +crbug.com/1141909 external/wpt/websockets/cookies/001.html?wss [ Skip ] +crbug.com/1141909 external/wpt/websockets/cookies/002.html?wss [ Skip ] +crbug.com/1141909 external/wpt/websockets/cookies/003.html?wss [ Skip ] +crbug.com/1141909 external/wpt/websockets/cookies/005.html?wss [ Skip ] +crbug.com/1141909 external/wpt/websockets/cookies/007.html?wss [ Skip ] # Sheriff failures 2017-11-15 crbug.com/785179 [ Win7 Debug ] http/tests/devtools/console/console-viewport-stick-to-bottom.js [ Skip ] @@ -5963,6 +5963,7 @@ crbug.com/1011811 http/tests/devtools/network/network-xhr-data-received-async-response-type-blob.js [ Pass Failure ] crbug.com/1011811 http/tests/devtools/network/download.js [ Pass Failure ] crbug.com/1011811 http/tests/devtools/sxg/sxg-disable-cache.js [ Pass Failure ] +crbug.com/1093791 http/tests/devtools/copy-network-request.js [ Pass Failure ] crbug.com/1080609 virtual/threaded/external/wpt/scroll-animations/element-based-offset.html [ Pass Failure ] crbug.com/1080609 virtual/threaded/external/wpt/scroll-animations/element-based-offset-clamp.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/VirtualTestSuites b/third_party/blink/web_tests/VirtualTestSuites index 736ee90f..2fa74fe 100644 --- a/third_party/blink/web_tests/VirtualTestSuites +++ b/third_party/blink/web_tests/VirtualTestSuites
@@ -241,11 +241,8 @@ }, { "prefix": "schemeful-same-site", - "bases": ["external/wpt/cookies", - "http/tests/inspector-protocol/network/same-site-issue-warn-cookie-strict-subresource-context-downgrade.js", - "http/tests/inspector-protocol/network/same-site-issue-warn-cookie-lax-subresource-context-downgrade.js", - "http/tests/inspector-protocol/network/same-site-issue-warn-cookie-navigation-context-downgrade.js"], - "args": ["--enable-features=SchemefulSameSite"] + "bases": ["external/wpt/cookies"], + "args": ["--disable-features=SchemefulSameSite"] }, { "prefix": "layout_ng_block_frag",
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 fbf7ba7..1c0af5a 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
@@ -44768,6 +44768,34 @@ ] } }, + "composite-bgcolor-animation": { + "bg-color-with-gradient.html": [ + "7ef5d611bcf2c131dbeef8e72877328ef1be7710", + [ + null, + [ + [ + "/css/composite-bgcolor-animation/bg-color-with-gradient-ref.html", + "==" + ] + ], + {} + ] + ], + "simple-bg-color.html": [ + "07bea44d21964b832cd9e4b4f32098ec41a2c206", + [ + null, + [ + [ + "/css/composite-bgcolor-animation/simple-bg-color-ref.html", + "==" + ] + ], + {} + ] + ] + }, "compositing": { "background-blending": { "background-blend-mode-gradient-image.html": [ @@ -177853,6 +177881,16 @@ "5cb26179b8dbe4423885bcc7c8d687bab224df91", [] ], + "composite-bgcolor-animation": { + "bg-color-with-gradient-ref.html": [ + "5c76f3408aebe6e2964215af3f98745e833e190e", + [] + ], + "simple-bg-color-ref.html": [ + "d8003b58e3ac1c5e917500a59b60c0d2e56287a3", + [] + ] + }, "compositing": { "Blending_in_a_group_with_filter-ref.html": [ "ad512028adae91920814b79714ea99ec51de4dc2", @@ -215268,6 +215306,10 @@ "0d6db5399118372da9ca783eeb2551e435ea85d7", [] ], + "window-tests-chooser.js": [ + "bb9e0bf128c7885ae2b3c32ceb98f28947460209", + [] + ], "window-tests-enumeration.js": [ "6e60910251fc59012d28f3c9a42adac7b7cb6d7a", [] @@ -232189,6 +232231,10 @@ "751e02b0c9a246f233693d6a045692c6a5e4f349", [] ], + "attribute-mapping-002-expected.txt": [ + "e947f70455890f895827a40ddd2c48ff16ff3388", + [] + ], "blur-filter-ref.html": [ "21fc165b7da477a619933185c2f45df3c3e9ab09", [] @@ -249497,7 +249543,7 @@ [] ], "requirements.txt": [ - "1eba114a31c21f3e48aafae5e9466cefbe741288", + "7567e81ada590486bda300e484564700c373d11a", [] ], "requirements_android_webview.txt": [ @@ -306046,6 +306092,20 @@ {} ] ], + "scroll-overflow-clip-quirks-001.html": [ + "ae70083ac32af4e89dc15d6dca9192c827f36ac3", + [ + null, + {} + ] + ], + "scroll-overflow-clip-quirks-002.html": [ + "8909125649a0f8731898d203593d591f8b2da41b", + [ + null, + {} + ] + ], "scrollIntoView-horizontal-partially-visible.html": [ "1e8bc50071f080a89b9e19bbad9f6c4fbda1cc29", [ @@ -306194,7 +306254,7 @@ ] ], "scrollingElement.html": [ - "84d313741ce88f5e3ae77e5c85f79a88348caddc", + "408fa47be9a3330aff88ef01e9b8be90fd4008ce", [ null, {} @@ -330354,6 +330414,32 @@ } ] ], + "font_access-chooser.tentative.https.window.js": [ + "047521a7f7ab86ddddeb8f95ee711757f81bccf4", + [ + "font-access/font_access-chooser.tentative.https.window.html", + { + "script_metadata": [ + [ + "script", + "/resources/testdriver.js" + ], + [ + "script", + "/resources/testdriver-vendor.js" + ], + [ + "script", + "resources/test-expectations.js" + ], + [ + "script", + "resources/window-tests-chooser.js" + ] + ] + } + ] + ], "font_access-enumeration.tentative.https.window.js": [ "677fe82c70233de2e1cbeab4beb41437319688b3", [ @@ -372688,7 +372774,7 @@ ] ], "attribute-mapping-002.html": [ - "e4532321e4a5b20944ff4181b2ad9b967ee31213", + "1fe9b34f98189c12683e13df931f63c572e00fdf", [ null, {}
diff --git a/third_party/blink/web_tests/external/wpt/css/cssom-view/scroll-overflow-clip-quirks-001.html b/third_party/blink/web_tests/external/wpt/css/cssom-view/scroll-overflow-clip-quirks-001.html new file mode 100644 index 0000000..ae70083a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/cssom-view/scroll-overflow-clip-quirks-001.html
@@ -0,0 +1,23 @@ +<!-- quirks --> +<title>CSSOM scrollingElement reflects the propagated scroll to viewport correctly</title> +<meta charset="utf-8"> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> +<link rel="author" title="Mozilla" href="https://mozilla.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://drafts.csswg.org/css-overflow/#overflow-propagation"> +<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement"> +<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5601"> +<style> + :root { + overflow: clip; + } + body { + overflow: scroll; + } +</style> +<script> +test(function() { + assert_equals(document.scrollingElement, null); +}); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/cssom-view/scroll-overflow-clip-quirks-002.html b/third_party/blink/web_tests/external/wpt/css/cssom-view/scroll-overflow-clip-quirks-002.html new file mode 100644 index 0000000..89091256 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/cssom-view/scroll-overflow-clip-quirks-002.html
@@ -0,0 +1,20 @@ +<!-- quirks --> +<title>CSSOM scrollingElement reflects the propagated scroll to viewport correctly</title> +<meta charset="utf-8"> +<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> +<link rel="author" title="Mozilla" href="https://mozilla.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<link rel="help" href="https://drafts.csswg.org/css-overflow/#overflow-propagation"> +<link rel="help" href="https://drafts.csswg.org/cssom-view/#dom-document-scrollingelement"> +<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/5601"> +<style> + body { + overflow: clip; + } +</style> +<script> +test(function() { + assert_equals(document.scrollingElement, document.body); +}); +</script>
diff --git a/third_party/blink/web_tests/external/wpt/css/cssom-view/scrollingElement.html b/third_party/blink/web_tests/external/wpt/css/cssom-view/scrollingElement.html index 84d31374..408fa47 100644 --- a/third_party/blink/web_tests/external/wpt/css/cssom-view/scrollingElement.html +++ b/third_party/blink/web_tests/external/wpt/css/cssom-view/scrollingElement.html
@@ -93,12 +93,16 @@ nonQuirksDoc.documentElement.style.display = rootDisplay; nonQuirksDoc.body.style.display = bodyDisplay; - // Tests for non-quirks mode document. assert_equals(nonQuirksDoc.scrollingElement, nonQuirksDoc.documentElement, "scrollingElement in standards mode should be the document element."); - nonQuirksDoc.documentElement.style.overflow = "scroll"; - nonQuirksDoc.body.style.overflow = "scroll"; - assert_equals(nonQuirksDoc.scrollingElement, nonQuirksDoc.documentElement); + + for (let rootOverflow of ["", "clip", "scroll", "hidden", "visible"]) { + for (let bodyOverflow of ["", "clip", "scroll", "hidden", "visible"]) { + nonQuirksDoc.documentElement.style.overflow = rootOverflow; + nonQuirksDoc.body.style.overflow = bodyOverflow; + assert_equals(nonQuirksDoc.scrollingElement, nonQuirksDoc.documentElement); + } + } nonQuirksDoc.removeChild(nonQuirksDoc.documentElement); assert_equals(nonQuirksDoc.scrollingElement, null);
diff --git a/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/attribute-mapping-002-expected.txt b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/attribute-mapping-002-expected.txt new file mode 100644 index 0000000..e947f70 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/attribute-mapping-002-expected.txt
@@ -0,0 +1,132 @@ +This is a testharness.js-based test. +Found 128 tests; 94 PASS, 34 FAIL, 0 TIMEOUT, 0 NOTRUN. +FAIL mathvariant on the math element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the math element is mapped to math-depth(...) +PASS invalid scriptlevel values on the math element are not mapped to math-depth(...) +PASS displaystyle on the math element is mapped to CSS math-style +FAIL mathvariant on the annotation element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the annotation element is mapped to math-depth(...) +PASS invalid scriptlevel values on the annotation element are not mapped to math-depth(...) +PASS displaystyle on the annotation element is mapped to CSS math-style +FAIL mathvariant on the annotation-xml element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the annotation-xml element is mapped to math-depth(...) +PASS invalid scriptlevel values on the annotation-xml element are not mapped to math-depth(...) +PASS displaystyle on the annotation-xml element is mapped to CSS math-style +FAIL mathvariant on the maction element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the maction element is mapped to math-depth(...) +PASS invalid scriptlevel values on the maction element are not mapped to math-depth(...) +PASS displaystyle on the maction element is mapped to CSS math-style +FAIL mathvariant on the menclose element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the menclose element is mapped to math-depth(...) +PASS invalid scriptlevel values on the menclose element are not mapped to math-depth(...) +PASS displaystyle on the menclose element is mapped to CSS math-style +FAIL mathvariant on the merror element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the merror element is mapped to math-depth(...) +PASS invalid scriptlevel values on the merror element are not mapped to math-depth(...) +PASS displaystyle on the merror element is mapped to CSS math-style +FAIL mathvariant on the mfrac element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mfrac element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mfrac element are not mapped to math-depth(...) +PASS displaystyle on the mfrac element is mapped to CSS math-style +FAIL mathvariant on the mi element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "math-auto" +PASS scriptlevel on the mi element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mi element are not mapped to math-depth(...) +PASS displaystyle on the mi element is mapped to CSS math-style +FAIL mathvariant on the mmultiscripts element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mmultiscripts element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mmultiscripts element are not mapped to math-depth(...) +PASS displaystyle on the mmultiscripts element is mapped to CSS math-style +FAIL mathvariant on the mn element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mn element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mn element are not mapped to math-depth(...) +PASS displaystyle on the mn element is mapped to CSS math-style +FAIL mathvariant on the mo element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mo element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mo element are not mapped to math-depth(...) +PASS displaystyle on the mo element is mapped to CSS math-style +FAIL mathvariant on the mover element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mover element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mover element are not mapped to math-depth(...) +PASS displaystyle on the mover element is mapped to CSS math-style +FAIL mathvariant on the mpadded element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mpadded element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mpadded element are not mapped to math-depth(...) +PASS displaystyle on the mpadded element is mapped to CSS math-style +FAIL mathvariant on the mphantom element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mphantom element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mphantom element are not mapped to math-depth(...) +PASS displaystyle on the mphantom element is mapped to CSS math-style +FAIL mathvariant on the mprescripts element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mprescripts element is mapped to math-depth(...) +FAIL invalid scriptlevel values on the mprescripts element are not mapped to math-depth(...) assert_equals: invalid scriptlevel value expected "0" but got "1" +PASS displaystyle on the mprescripts element is mapped to CSS math-style +FAIL mathvariant on the mroot element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mroot element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mroot element are not mapped to math-depth(...) +PASS displaystyle on the mroot element is mapped to CSS math-style +FAIL mathvariant on the mrow element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mrow element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mrow element are not mapped to math-depth(...) +PASS displaystyle on the mrow element is mapped to CSS math-style +FAIL mathvariant on the ms element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the ms element is mapped to math-depth(...) +PASS invalid scriptlevel values on the ms element are not mapped to math-depth(...) +PASS displaystyle on the ms element is mapped to CSS math-style +FAIL mathvariant on the mspace element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mspace element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mspace element are not mapped to math-depth(...) +PASS displaystyle on the mspace element is mapped to CSS math-style +FAIL mathvariant on the msqrt element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the msqrt element is mapped to math-depth(...) +PASS invalid scriptlevel values on the msqrt element are not mapped to math-depth(...) +PASS displaystyle on the msqrt element is mapped to CSS math-style +FAIL mathvariant on the mstyle element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mstyle element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mstyle element are not mapped to math-depth(...) +PASS displaystyle on the mstyle element is mapped to CSS math-style +FAIL mathvariant on the msub element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the msub element is mapped to math-depth(...) +PASS invalid scriptlevel values on the msub element are not mapped to math-depth(...) +PASS displaystyle on the msub element is mapped to CSS math-style +FAIL mathvariant on the msubsup element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the msubsup element is mapped to math-depth(...) +PASS invalid scriptlevel values on the msubsup element are not mapped to math-depth(...) +PASS displaystyle on the msubsup element is mapped to CSS math-style +FAIL mathvariant on the msup element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the msup element is mapped to math-depth(...) +PASS invalid scriptlevel values on the msup element are not mapped to math-depth(...) +PASS displaystyle on the msup element is mapped to CSS math-style +FAIL mathvariant on the mtable element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mtable element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mtable element are not mapped to math-depth(...) +PASS displaystyle on the mtable element is mapped to CSS math-style +FAIL mathvariant on the mtd element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mtd element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mtd element are not mapped to math-depth(...) +PASS displaystyle on the mtd element is mapped to CSS math-style +FAIL mathvariant on the mtext element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mtext element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mtext element are not mapped to math-depth(...) +PASS displaystyle on the mtext element is mapped to CSS math-style +FAIL mathvariant on the mtr element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the mtr element is mapped to math-depth(...) +PASS invalid scriptlevel values on the mtr element are not mapped to math-depth(...) +PASS displaystyle on the mtr element is mapped to CSS math-style +FAIL mathvariant on the munder element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the munder element is mapped to math-depth(...) +PASS invalid scriptlevel values on the munder element are not mapped to math-depth(...) +PASS displaystyle on the munder element is mapped to CSS math-style +FAIL mathvariant on the munderover element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the munderover element is mapped to math-depth(...) +PASS invalid scriptlevel values on the munderover element are not mapped to math-depth(...) +PASS displaystyle on the munderover element is mapped to CSS math-style +FAIL mathvariant on the none element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the none element is mapped to math-depth(...) +FAIL invalid scriptlevel values on the none element are not mapped to math-depth(...) assert_equals: invalid scriptlevel value expected "0" but got "1" +PASS displaystyle on the none element is mapped to CSS math-style +FAIL mathvariant on the semantics element is mapped to CSS text-transform assert_equals: attribute specified expected "math-fraktur" but got "none" +PASS scriptlevel on the semantics element is mapped to math-depth(...) +PASS invalid scriptlevel values on the semantics element are not mapped to math-depth(...) +PASS displaystyle on the semantics element is mapped to CSS math-style +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/attribute-mapping-002.html b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/attribute-mapping-002.html index e453232..1fe9b34 100644 --- a/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/attribute-mapping-002.html +++ b/third_party/blink/web_tests/external/wpt/mathml/relations/css-styling/attribute-mapping-002.html
@@ -44,27 +44,53 @@ test(function() { // none and mprescripts appear as scripts - assert_equals(style.getPropertyValue("math-depth"), tag === "none" || tag === "mprescripts" ? 1 : 0, "no attribute"); + assert_equals(style.getPropertyValue("math-depth"), tag === "none" || tag === "mprescripts" ? "1" : "0", "no attribute"); var absoluteScriptlevel = 2; element.setAttribute("scriptlevel", absoluteScriptlevel); - assert_equals(style.getPropertyValue("math-depth"), absoluteScriptlevel, "attribute specified (<U>)"); + assert_equals(style.getPropertyValue("math-depth"), "" + absoluteScriptlevel, "attribute specified <U>"); var positiveScriptlevelDelta = 1; element.setAttribute("scriptlevel", `+${positiveScriptlevelDelta}`); - assert_equals(style.getPropertyValue("math-depth"), positiveScriptlevelDelta, epsilon, "attribute specified (+<U>)"); + assert_equals(style.getPropertyValue("math-depth"), "" + positiveScriptlevelDelta, "attribute specified +<U>"); var negativeScriptlevelDelta = -3; - element.setAttribute("scriptlevel", negativeScriptlevelDelta); - assert_approx_equals(style.getPropertyValue("math-depth"), negativeScriptlevelDelta, "attribute specified (-<U>)"); + element.setAttribute("scriptlevel", `${negativeScriptlevelDelta}`); + assert_equals(style.getPropertyValue("math-depth"), "" + negativeScriptlevelDelta, "attribute specified -<U>"); element.setAttribute("scriptlevel", absoluteScriptlevel); element.setAttribute("mathsize", "42px"); - assert_approx_equals(fontSize(style), 42, epsilon, "mathsize wins over scriptlevel"); + assert_approx_equals(fontSize(style), 42, 1, "mathsize wins over scriptlevel"); }, `scriptlevel on the ${tag} element is mapped to math-depth(...)`); test(function() { + // none and mprescripts appear as scripts + let expected = 0; + element.setAttribute("scriptlevel", "" + expected); + assert_equals(style.getPropertyValue("math-depth"), "" + expected, "no attribute"); + + element.setAttribute("scriptlevel", " +1"); + assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value"); + + element.setAttribute("scriptlevel", " + 1"); + assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value"); + + element.setAttribute("scriptlevel", "2.0"); + assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value"); + + element.setAttribute("scriptlevel", "-3\""); + assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value"); + + element.setAttribute("scriptlevel", "200px"); + assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value"); + + element.setAttribute("scriptlevel", "add(2)"); + assert_equals(style.getPropertyValue("math-depth"), "" + expected, "invalid scriptlevel value"); + + }, `invalid scriptlevel values on the ${tag} element are not mapped to math-depth(...)`); + + test(function() { assert_equals(style.getPropertyValue("math-style"), "compact", "no attribute"); element.setAttribute("displaystyle", "true"); assert_equals(style.getPropertyValue("math-style"), "normal", "attribute specified");
diff --git a/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt b/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt index 1eba114a..7567e81 100644 --- a/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt +++ b/third_party/blink/web_tests/external/wpt/tools/wptrunner/requirements.txt
@@ -3,7 +3,8 @@ mozlog==6.1 mozdebug==0.2 # Pillow 7 requires Python 3 -pillow==6.2.2 # pyup: <7.0 +pillow==6.2.2; python_version <= '2.7' # pyup: <7.0 +pillow==8.0.1; python_version >= '3.0' urllib3[secure]==1.25.10 requests==2.24.0 six==1.15.0
diff --git a/third_party/blink/web_tests/http/tests/cookies/same-site/basics-insecure.html b/third_party/blink/web_tests/http/tests/cookies/same-site/basics-insecure.html index 66f40cf..1ad65cf 100644 --- a/third_party/blink/web_tests/http/tests/cookies/same-site/basics-insecure.html +++ b/third_party/blink/web_tests/http/tests/cookies/same-site/basics-insecure.html
@@ -16,10 +16,9 @@ return fetch("https://" + window.location.hostname + ":8443/cookies/resources/echo-json.php", {"credentials": "include"}) .then(r => r.json()) .then(j => { - assert_equals(j[STRICT_DOM], "2", "strict"); - assert_equals(j[LAX_DOM], "2", "lax"); - assert_equals(j[UNSPECIFIED_DOM], "2", "unspecified"); + assert_false(STRICT_DOM in j); + assert_false(LAX_DOM in j); + assert_false(UNSPECIFIED_DOM in j); }); -}, "HTTPS is same-site with HTTP."); +}, "HTTPS is not same-site with HTTP."); </script> -
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-lax-subresource-context-downgrade-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-lax-subresource-context-downgrade-expected.txt index 2ca030fe..6124245 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-lax-subresource-context-downgrade-expected.txt +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-lax-subresource-context-downgrade-expected.txt
@@ -11,6 +11,7 @@ path : /inspector-protocol/network/resources } cookieExclusionReasons : [ + [0] : ExcludeSameSiteLax ] cookieUrl : https://cookie.test:8443/inspector-protocol/network/resources/set-cookie.php?cookie=name%3Dvalue%3B%20SameSite%3DLax cookieWarningReasons : [
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-navigation-context-downgrade-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-navigation-context-downgrade-expected.txt index 7563897f..6c687ff3 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-navigation-context-downgrade-expected.txt +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-navigation-context-downgrade-expected.txt
@@ -11,6 +11,7 @@ path : /inspector-protocol/network/resources } cookieExclusionReasons : [ + [0] : ExcludeSameSiteStrict ] cookieUrl : https://cookie.test:8443/inspector-protocol/network/resources/hello-world.html cookieWarningReasons : [
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-strict-subresource-context-downgrade-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-strict-subresource-context-downgrade-expected.txt index 720e1b57..74a91e6f 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-strict-subresource-context-downgrade-expected.txt +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-strict-subresource-context-downgrade-expected.txt
@@ -11,6 +11,7 @@ path : /inspector-protocol/network/resources } cookieExclusionReasons : [ + [0] : ExcludeSameSiteStrict ] cookieUrl : https://cookie.test:8443/inspector-protocol/network/resources/set-cookie.php?cookie=name%3Dvalue%3B%20SameSite%3DStrict cookieWarningReasons : [
diff --git a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/csp3-experimental/csp3-strict-dynamic.html b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/csp3-experimental/csp3-strict-dynamic.html deleted file mode 100644 index 7afa7e6..0000000 --- a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/csp3-experimental/csp3-strict-dynamic.html +++ /dev/null
@@ -1,106 +0,0 @@ -<!DOCTYPE html> -<html> -<head> - <meta http-equiv="Content-Security-Policy" content="script-src 'nonce-abcdefg' 'csp3-strict-dynamic'"> - <script src="/resources/testharness.js" nonce="abcdefg"></script> - <script src="/resources/testharnessreport.js" nonce="abcdefg"></script> - <script src="../resources/securitypolicyviolation-helper.js" nonce="abcdefg"></script> -</head> -<body> - <!-- Need to individually wrap test cases in script blocks. Violation reports triggered by document.write() calls while the parser is waiting on blocking scipts are missing line numbers. See: https://crbug.com/649085. --> - <script nonce="abcdefg"> - async_test(function (t) { - var e = document.createElement('script'); - e.src = generateURL("append"); - e.onerror = t.unreached_func("Error should not be triggered."); - assert_script_loads(t, generateURL("append"), 17); - document.body.appendChild(e); - }, "Script injected via 'appendChild' is allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg"> - async_test(function (t) { - var e = document.createElement('script'); - e.src = generateURL("append-async"); - e.async = true; - e.onerror = t.unreached_func("Error should not be triggered."); - assert_script_loads(t, generateURL("append-async"), 27); - document.body.appendChild(e); - }, "Async script injected via 'appendChild' is allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg"> - async_test(function (t) { - var e = document.createElement('script'); - e.src = generateURL("append-defer"); - e.defer = true; - e.onerror = t.unreached_func("Error should not be triggered."); - assert_script_loads(t, generateURL("append-defer"), 37); - document.body.appendChild(e); - }, "Deferred script injected via 'appendChild' is allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg"> - async_test(function (t) { - assert_script_failed(t, generateURL("write"), 43); - document.write("<scr" + "ipt src='" + generateURL("write") + "'></scr" + "ipt>"); - }, "Script injected via 'document.write' is not allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg"> - async_test(function (t) { - assert_script_failed(t, generateURL("write-defer"), 49); - document.write("<scr" + "ipt defer src='" + generateURL("write-defer") + "'></scr" + "ipt>"); - }, "Deferred script injected via 'document.write' is not allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg"> - async_test(function (t) { - assert_script_failed(t, generateURL("write-async"), 55); - document.write("<scr" + "ipt async src='" + generateURL("write-async") + "'></scr" + "ipt>"); - }, "Async script injected via 'document.write' is not allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg" defer> - async_test(function (t) { - var e = document.createElement('script'); - e.src = generateURL("defer-append"); - e.onerror = t.unreached_func("Error should not be triggered."); - assert_script_loads(t, generateURL("defer-append"), 64); - document.body.appendChild(e); - }, "Script injected via deferred 'appendChild' is allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg" defer> - async_test(function (t) { - var e = document.createElement('script'); - e.src = generateURL("defer-append-async"); - e.async = true; - e.onerror = t.unreached_func("Error should not be triggered."); - assert_script_loads(t, generateURL("defer-append-async"), 74); - document.body.appendChild(e); - }, "Async script injected via deferred 'appendChild' is allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg" defer> - async_test(function (t) { - var e = document.createElement('script'); - e.src = generateURL("defer-append-defer"); - e.defer = true; - e.onerror = t.unreached_func("Error should not be triggered."); - assert_script_loads(t, generateURL("defer-append-defer"), 84); - document.body.appendChild(e); - }, "Deferred script injected via deferred 'appendChild' is allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg" defer> - async_test(function (t) { - assert_script_failed(t, generateURL("defer-write"), 90); - document.write("<scr" + "ipt src='" + generateURL("defer-write") + "'></scr" + "ipt>"); - }, "Script injected via deferred 'document.write' is not allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg" defer> - async_test(function (t) { - assert_script_failed(t, generateURL("defer-write-defer"), 96); - document.write("<scr" + "ipt defer src='" + generateURL("defer-write-defer") + "'></scr" + "ipt>"); - }, "Deferred script injected via deferred 'document.write' is not allowed with 'strict-dynamic'."); - </script> - <script nonce="abcdefg" defer> - async_test(function (t) { - assert_script_failed(t, generateURL("defer-write-async"), 102); - document.write("<scr" + "ipt async src='" + generateURL("defer-write-async") + "'></scr" + "ipt>"); - }, "Async script injected via deferred 'document.write' is not allowed with 'strict-dynamic'."); - </script> -</body> -</html>
diff --git a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/csp3-experimental/csp3_nonces.html b/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/csp3-experimental/csp3_nonces.html deleted file mode 100644 index 76a58aef7..0000000 --- a/third_party/blink/web_tests/http/tests/security/contentSecurityPolicy/csp3-experimental/csp3_nonces.html +++ /dev/null
@@ -1,23 +0,0 @@ -<!DOCTYPE HTML> -<html> - -<head> - <meta http-equiv="Content-Security-Policy" content="script-src 'nonce-abc' 'csp3-nonce-def'"> - <title>'csp3-nonce' should be matched as well</title> - <script src='/resources/testharness.js' nonce='abc'></script> - <script src='/resources/testharnessreport.js' nonce='abc'></script> -</head> - -<body> - <div id='log'></div> - <script nonce='abc'> - var t1 = async_test("Test that the csp3 nonce works"); - - window.addEventListener('securitypolicyviolation', t1.unreached_func("Should have not raised any event")); - </script> - <script nonce='def'> - t1.done(); - </script> -</body> - -</html>
diff --git a/third_party/blink/web_tests/virtual/schemeful-same-site/README.md b/third_party/blink/web_tests/virtual/schemeful-same-site/README.md index 2502511..625da44 100644 --- a/third_party/blink/web_tests/virtual/schemeful-same-site/README.md +++ b/third_party/blink/web_tests/virtual/schemeful-same-site/README.md
@@ -1,4 +1,4 @@ # virtual/schemeful-same-site -This directory is for tests that need the Schemeful Same-Site feature enabled. -Tests under `virtual/schemeful-same-site` are run with `--enable-features=SchemefulSameSite` +This directory is for tests that need the Schemeful Same-Site feature disabled. +Tests under `virtual/schemeful-same-site` are run with `--disable-features=SchemefulSameSite`
diff --git a/third_party/blink/web_tests/virtual/schemeful-same-site/external/wpt/cookies/README.txt b/third_party/blink/web_tests/virtual/schemeful-same-site/external/wpt/cookies/README.txt index 6283f99b..adc0872 100644 --- a/third_party/blink/web_tests/virtual/schemeful-same-site/external/wpt/cookies/README.txt +++ b/third_party/blink/web_tests/virtual/schemeful-same-site/external/wpt/cookies/README.txt
@@ -1 +1 @@ -This suite runs inspector protocol networks tests with SchemefulSameSite enabled. +This suite runs inspector protocol networks tests with SchemefulSameSite disabled.
diff --git a/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/README.txt b/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/README.txt deleted file mode 100644 index 6283f99b..0000000 --- a/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/README.txt +++ /dev/null
@@ -1 +0,0 @@ -This suite runs inspector protocol networks tests with SchemefulSameSite enabled.
diff --git a/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-lax-subresource-context-downgrade-expected.txt b/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-lax-subresource-context-downgrade-expected.txt deleted file mode 100644 index 6124245..0000000 --- a/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-lax-subresource-context-downgrade-expected.txt +++ /dev/null
@@ -1,30 +0,0 @@ -Verifies that a subresource accessing a SameSite=Lax cookie across schemes triggers a context downgrade inspector issue. - -Inspector issue:{ - issue : { - code : SameSiteCookieIssue - details : { - sameSiteCookieIssueDetails : { - cookie : { - domain : cookie.test - name : name - path : /inspector-protocol/network/resources - } - cookieExclusionReasons : [ - [0] : ExcludeSameSiteLax - ] - cookieUrl : https://cookie.test:8443/inspector-protocol/network/resources/set-cookie.php?cookie=name%3Dvalue%3B%20SameSite%3DLax - cookieWarningReasons : [ - [0] : WarnSameSiteLaxCrossDowngradeLax - ] - operation : SetCookie - request : { - requestId : <string> - url : https://cookie.test:8443/inspector-protocol/network/resources/set-cookie.php?cookie=name%3Dvalue%3B%20SameSite%3DLax - } - siteForCookies : http://cookie.test/ - } - } - } -} -
diff --git a/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-navigation-context-downgrade-expected.txt b/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-navigation-context-downgrade-expected.txt deleted file mode 100644 index 6c687ff3..0000000 --- a/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-navigation-context-downgrade-expected.txt +++ /dev/null
@@ -1,30 +0,0 @@ -Verifies that accessing a SameSite=Strict cookie across schemes triggers a context downgrade inspector issue. - -Inspector issue:{ - issue : { - code : SameSiteCookieIssue - details : { - sameSiteCookieIssueDetails : { - cookie : { - domain : cookie.test - name : name - path : /inspector-protocol/network/resources - } - cookieExclusionReasons : [ - [0] : ExcludeSameSiteStrict - ] - cookieUrl : https://cookie.test:8443/inspector-protocol/network/resources/hello-world.html - cookieWarningReasons : [ - [0] : WarnSameSiteStrictLaxDowngradeStrict - ] - operation : ReadCookie - request : { - requestId : <string> - url : https://cookie.test:8443/inspector-protocol/network/resources/hello-world.html - } - siteForCookies : https://cookie.test/ - } - } - } -} -
diff --git a/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-strict-subresource-context-downgrade-expected.txt b/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-strict-subresource-context-downgrade-expected.txt deleted file mode 100644 index 74a91e6f..0000000 --- a/third_party/blink/web_tests/virtual/schemeful-same-site/http/tests/inspector-protocol/network/same-site-issue-warn-cookie-strict-subresource-context-downgrade-expected.txt +++ /dev/null
@@ -1,30 +0,0 @@ -Verifies that a subresource accessing a SameSite=Strict cookie across schemes triggers a context downgrade inspector issue. - -Inspector issue:{ - issue : { - code : SameSiteCookieIssue - details : { - sameSiteCookieIssueDetails : { - cookie : { - domain : cookie.test - name : name - path : /inspector-protocol/network/resources - } - cookieExclusionReasons : [ - [0] : ExcludeSameSiteStrict - ] - cookieUrl : https://cookie.test:8443/inspector-protocol/network/resources/set-cookie.php?cookie=name%3Dvalue%3B%20SameSite%3DStrict - cookieWarningReasons : [ - [0] : WarnSameSiteLaxCrossDowngradeStrict - ] - operation : SetCookie - request : { - requestId : <string> - url : https://cookie.test:8443/inspector-protocol/network/resources/set-cookie.php?cookie=name%3Dvalue%3B%20SameSite%3DStrict - } - siteForCookies : http://cookie.test/ - } - } - } -} -
diff --git a/tools/bisect-builds.py b/tools/bisect-builds.py index 9efc7bfa..932603e1 100755 --- a/tools/bisect-builds.py +++ b/tools/bisect-builds.py
@@ -52,6 +52,11 @@ 'blink': BLINK_GITHASH_TO_SVN_URL, } +VERSION_HISTORY_URL = ('https://versionhistory.googleapis.com/v1/chrome' + '/platforms/win/channels/stable/versions/all/releases') + +OMAHA_REVISIONS_URL = ('https://omahaproxy.appspot.com/deps.json?version=%s') + # Search pattern to be matched in the JSON output from # CHROMIUM_GITHASH_TO_SVN_URL to get the chromium revision (svn revision). CHROMIUM_SEARCH_PATTERN_OLD = ( @@ -1041,6 +1046,48 @@ print('Could not determine latest revision. This could be bad...') return 999999999 + +def GetRevision(revision_text): + """Translates from a text description of a revision to an integral revision + number. Currently supported formats are a number (i.e.; '782793') or a + milestone specifier (i.e.; 'M85') or a full version string + (i.e. '85.0.4183.121').""" + + # Check if we already have a revision number, such as when -g or -b is + # omitted. + if type(revision_text) == type(0): + return revision_text + + # Translate from stable milestone name to the latest version number released + # for that milestone, i.e.; 'M85' to '85.0.4183.121'. + if revision_text[:1].upper() == 'M': + milestone = revision_text[1:] + response = urllib.urlopen(VERSION_HISTORY_URL) + version_history = json.loads(response.read()) + version_matcher = re.compile( + '.*versions/(\d*)\.(\d*)\.(\d*)\.(\d*)/releases.*') + for version in version_history['releases']: + match = version_matcher.match(version['name']) + # There will be multiple versions of each milestone, but we just grab the + # first one that we see which will be the most recent version. If you need + # more granularity then specify a full version number or revision number. + if match and match.groups()[0] == milestone: + revision_text = '.'.join(match.groups()) + break + if revision_text[:1].upper() == 'M': + raise Exception('No stable release matching %s found.' % revision_text) + + # Translate from version number to commit position, also known as revision + # number. + if len(revision_text.split('.')) == 4: + response = urllib.urlopen(OMAHA_REVISIONS_URL % revision_text) + revision_details = json.loads(response.read()) + revision_text = revision_details['chromium_base_position'] + + # Translate from text commit position to integer commit position. + return int(revision_text) + + def GetGitHashFromSVNRevision(svn_revision): crrev_url = CRREV_URL + str(svn_revision) url = urllib.urlopen(crrev_url) @@ -1088,11 +1135,14 @@ choices=choices, help='The buildbot archive to bisect [%s].' % '|'.join(choices)) - parser.add_option('-b', '--bad', + parser.add_option('-b', + '--bad', type='str', help='A bad revision to start bisection. ' - 'May be earlier or later than the good revision. ' - 'Default is HEAD.') + 'May be earlier or later than the good revision. ' + 'Default is HEAD. Can be a revision number, milestone ' + 'name (eg. M85, matches the most recent stable release of ' + 'that milestone) or version number (eg. 85.0.4183.121)') parser.add_option('-f', '--flash_path', type='str', help='Absolute path to a recent Adobe Pepper Flash ' @@ -1100,11 +1150,14 @@ 'on Windows C:\...\pepflashplayer.dll and on Linux ' '/opt/google/chrome/PepperFlash/' 'libpepflashplayer.so).') - parser.add_option('-g', '--good', + parser.add_option('-g', + '--good', type='str', help='A good revision to start bisection. ' + - 'May be earlier or later than the bad revision. ' + - 'Default is 0.') + 'May be earlier or later than the bad revision. ' + + 'Default is 0. Can be a revision number, milestone ' + 'name (eg. M85, matches the most recent stable release of ' + 'that milestone) or version number (eg. 85.0.4183.121)') parser.add_option('-p', '--profile', '--user-data-dir', type='str', default='profile', @@ -1195,8 +1248,8 @@ msg = 'Could not find Flash binary at %s' % opts.flash_path assert os.path.exists(opts.flash_path), msg - context.good_revision = int(context.good_revision) - context.bad_revision = int(context.bad_revision) + context.good_revision = GetRevision(context.good_revision) + context.bad_revision = GetRevision(context.bad_revision) if opts.times < 1: print('Number of times to run (%d) must be greater than or equal to 1.' % @@ -1216,6 +1269,9 @@ good_rev = context.good_revision bad_rev = context.bad_revision + print('Scanning from %d to %d (%d revisions).' % + (good_rev, bad_rev, abs(good_rev - bad_rev))) + (min_chromium_rev, max_chromium_rev, context) = Bisect( context, opts.times, opts.command, args, opts.profile, evaluator, opts.verify_range)
diff --git a/tools/clang/scripts/build.py b/tools/clang/scripts/build.py index d3f4790b..ae299e14 100755 --- a/tools/clang/scripts/build.py +++ b/tools/clang/scripts/build.py
@@ -644,6 +644,7 @@ '-DCOMPILER_RT_BUILD_BUILTINS=ON', '-DCOMPILER_RT_BUILD_CRT=OFF', '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF', + '-DCOMPILER_RT_BUILD_MEMPROF=OFF', '-DCOMPILER_RT_BUILD_SANITIZERS=OFF', '-DCOMPILER_RT_BUILD_XRAY=OFF', '-DCOMPILER_RT_ENABLE_IOS=OFF', @@ -656,6 +657,7 @@ '-DCOMPILER_RT_BUILD_BUILTINS=OFF', '-DCOMPILER_RT_BUILD_CRT=OFF', '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF', + '-DCOMPILER_RT_BUILD_MEMPROF=OFF', '-DCOMPILER_RT_BUILD_PROFILE=ON', '-DCOMPILER_RT_BUILD_SANITIZERS=OFF', '-DCOMPILER_RT_BUILD_XRAY=OFF', @@ -776,6 +778,7 @@ compiler_rt_args = [ '-DCOMPILER_RT_BUILD_CRT=OFF', '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF', + '-DCOMPILER_RT_BUILD_MEMPROF=OFF', '-DCOMPILER_RT_BUILD_PROFILE=ON', '-DCOMPILER_RT_BUILD_SANITIZERS=ON', '-DCOMPILER_RT_BUILD_XRAY=OFF', @@ -943,6 +946,7 @@ '-DCOMPILER_RT_BUILD_BUILTINS=OFF', '-DCOMPILER_RT_BUILD_CRT=OFF', '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF', + '-DCOMPILER_RT_BUILD_MEMPROF=OFF', '-DCOMPILER_RT_BUILD_PROFILE=ON', '-DCOMPILER_RT_BUILD_SANITIZERS=OFF', '-DCOMPILER_RT_BUILD_XRAY=OFF', @@ -988,6 +992,7 @@ '-DCOMPILER_RT_BUILD_BUILTINS=OFF', '-DCOMPILER_RT_BUILD_CRT=OFF', '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF', + '-DCOMPILER_RT_BUILD_MEMPROF=OFF', '-DCOMPILER_RT_BUILD_PROFILE=ON', '-DCOMPILER_RT_BUILD_SANITIZERS=ON', '-DCOMPILER_RT_BUILD_XRAY=OFF', @@ -1038,6 +1043,7 @@ '-DCOMPILER_RT_BUILD_BUILTINS=ON', '-DCOMPILER_RT_BUILD_CRT=OFF', '-DCOMPILER_RT_BUILD_LIBFUZZER=OFF', + '-DCOMPILER_RT_BUILD_MEMPROF=OFF', '-DCOMPILER_RT_BUILD_PROFILE=OFF', '-DCOMPILER_RT_BUILD_SANITIZERS=OFF', '-DCOMPILER_RT_BUILD_XRAY=OFF',
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index fa55c84..fc0a02de3 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -30006,6 +30006,7 @@ <int value="3707" label="ColorSchemeDarkSupportedOnRoot"/> <int value="3708" label="WebBluetoothGetAvailability"/> <int value="3709" label="DigitalGoodsListPurchases"/> + <int value="3710" label="CompositedSVG"/> </enum> <enum name="FeaturePolicyAllowlistType">
diff --git a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml index d1d2acd5..e6a5ff0 100644 --- a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml
@@ -3577,7 +3577,7 @@ </histogram> <histogram name="Extensions.WebUi.DocumentLoadedInMainFrameTime" units="ms" - expires_after="2020-12-01"> + expires_after="2021-12-01"> <owner>dpapad@chromium.org</owner> <owner>dbeam@chromium.org</owner> <summary> @@ -3588,7 +3588,7 @@ </histogram> <histogram name="Extensions.WebUi.LoadCompletedInMainFrame" units="ms" - expires_after="2020-12-01"> + expires_after="2021-12-01"> <owner>dpapad@chromium.org</owner> <owner>dbeam@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml b/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml index 01d6f73..ea9c4426 100644 --- a/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml +++ b/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml
@@ -6261,7 +6261,11 @@ </histogram_suffixes> <histogram_suffixes name="ExtensionWebUiPageType" separator="."> - <suffix name="MD" label="The Material Design chrome://extensions page."/> + <suffix name="MD" label="The Material Design chrome://extensions page."> + <obsolete> + Deprecated and removed from code as of 10/2020. + </obsolete> + </suffix> <suffix name="Uber" label="The Uber chrome://extensions page."> <obsolete> Deprecated and removed from code as of 04/2018.
diff --git a/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml b/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml index 3db1340..6c157faa 100644 --- a/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml
@@ -57,8 +57,8 @@ </histogram> <histogram name="WebRTC.Audio.Agc.DigitalGainApplied" units="dB" - expires_after="2019-03-01"> - <owner>aleloi@chromium.org</owner> + expires_after="2021-12-31"> + <owner>alessiob@chromium.org</owner> <summary> Logs adaptive digital compression gain that is applied by AgcManagerDirect. A log call is made once per second. The compression gain is applied to the @@ -67,8 +67,8 @@ </histogram> <histogram name="WebRTC.Audio.Agc.DigitalGainUpdated" units="dB" - expires_after="2019-03-01"> - <owner>aleloi@chromium.org</owner> + expires_after="2021-12-31"> + <owner>alessiob@chromium.org</owner> <summary> Logs adaptive digital compression gain that is applied by AgcManagerDirect. A log call is made every time the gain changes. The compression gain is @@ -77,8 +77,8 @@ </histogram> <histogram name="WebRTC.Audio.Agc2.DigitalGainApplied" units="dB" - expires_after="2019-09-01"> - <owner>aleloi@chromium.org</owner> + expires_after="2021-12-31"> + <owner>alessiob@chromium.org</owner> <summary> Logs adaptive digital compression gain that is applied by AdaptiveDigitalGainApplier in GainController2. A log call is made once per @@ -88,8 +88,8 @@ </histogram> <histogram name="WebRTC.Audio.Agc2.EstimatedNoiseLevel" units="dBFS (negated)" - expires_after="2019-09-01"> - <owner>aleloi@chromium.org</owner> + expires_after="2021-12-31"> + <owner>alessiob@chromium.org</owner> <summary> This histogram reports the noise level estimation done in GainController2. A value is reported every second. The unit is inverted dBFS. The scale goes @@ -98,8 +98,8 @@ </histogram> <histogram name="WebRTC.Audio.Agc2.FixedDigitalGainCurveRegion.Identity" - units="seconds" expires_after="2019-09-01"> - <owner>aleloi@chromium.org</owner> + units="seconds" expires_after="2021-12-31"> + <owner>alessiob@chromium.org</owner> <summary> The Fixed-Digital part of the AGC protects from saturation by reducing the level of too loud signals. This metric shows how long the level estimate @@ -110,8 +110,8 @@ </histogram> <histogram name="WebRTC.Audio.Agc2.FixedDigitalGainCurveRegion.Knee" - units="seconds" expires_after="2019-09-01"> - <owner>aleloi@chromium.org</owner> + units="seconds" expires_after="2021-12-31"> + <owner>alessiob@chromium.org</owner> <summary> The Fixed-Digital part of the AGC protects from saturation by reducing the level of too loud signals. This metric shows how long the level estimate @@ -121,8 +121,8 @@ </histogram> <histogram name="WebRTC.Audio.Agc2.FixedDigitalGainCurveRegion.Limiter" - units="seconds" expires_after="2019-09-01"> - <owner>aleloi@chromium.org</owner> + units="seconds" expires_after="2021-12-31"> + <owner>alessiob@chromium.org</owner> <summary> The Fixed-Digital part of the AGC protects from saturation by reducing the level of too loud signals. This metric shows how long the level estimate @@ -133,8 +133,8 @@ </histogram> <histogram name="WebRTC.Audio.Agc2.FixedDigitalGainCurveRegion.Saturation" - units="seconds" expires_after="2019-09-01"> - <owner>aleloi@chromium.org</owner> + units="seconds" expires_after="2021-12-31"> + <owner>alessiob@chromium.org</owner> <summary> The Fixed-Digital part of the AGC protects from saturation by reducing the level of too loud signals. This metric shows how long the level estimate @@ -145,7 +145,7 @@ </histogram> <histogram name="WebRTC.Audio.AgcClippingAdjustmentAllowed" enum="Boolean" - expires_after="2020-12-27"> + expires_after="2021-12-31"> <owner>hlundin@chromium.org</owner> <summary> The automatic gain control (AGC) in WebRTC tries to adjust the microphone @@ -158,7 +158,7 @@ </histogram> <histogram name="WebRTC.Audio.AgcSetLevel" units="level" - expires_after="2021-03-07"> + expires_after="2021-12-31"> <owner>hlundin@chromium.org</owner> <summary> The automatic gain control (AGC) in WebRTC tries to adjust the microphone @@ -169,7 +169,7 @@ </histogram> <histogram name="WebRTC.Audio.ApmCaptureInputLevelAverageRms" - units="dBFS (negated)" expires_after="2021-02-07"> + units="dBFS (negated)" expires_after="2021-12-31"> <owner>hlundin@chromium.org</owner> <summary> This histogram reports the average RMS of the signal coming in to WebRTC's @@ -181,7 +181,7 @@ </histogram> <histogram name="WebRTC.Audio.ApmCaptureInputLevelPeakRms" - units="dBFS (negated)" expires_after="2021-02-07"> + units="dBFS (negated)" expires_after="2021-12-31"> <owner>hlundin@chromium.org</owner> <summary> This histogram reports the peak RMS of the signal coming in to WebRTC's @@ -193,7 +193,7 @@ </histogram> <histogram name="WebRTC.Audio.ApmCaptureOutputLevelAverageRms" - units="dBFS (negated)" expires_after="2021-04-11"> + units="dBFS (negated)" expires_after="2021-12-31"> <owner>peah@chromium.org</owner> <summary> This histogram reports the average RMS of the signal in the output of @@ -205,7 +205,7 @@ </histogram> <histogram name="WebRTC.Audio.ApmCaptureOutputLevelPeakRms" - units="dBFS (negated)" expires_after="2021-04-18"> + units="dBFS (negated)" expires_after="2021-12-31"> <owner>peah@chromium.org</owner> <summary> This histogram reports the peak RMS of the signal in the output of WebRTC's
diff --git a/tools/perf/benchmarks/v8_browsing.py b/tools/perf/benchmarks/v8_browsing.py index b16fbe7..282f398 100644 --- a/tools/perf/benchmarks/v8_browsing.py +++ b/tools/perf/benchmarks/v8_browsing.py
@@ -11,6 +11,19 @@ from telemetry.web_perf import timeline_based_measurement import page_sets +V8_BROWSING_BENCHMARK_UMA = [ + 'V8.WasmCompileModuleMicroSeconds.wasm', + 'V8.WasmCompileModuleAsyncMicroSeconds', + 'V8.WasmCompileModuleStreamingMicroSeconds', + 'V8.WasmFinishModuleStreamingMicroSeconds', + 'V8.WasmTierUpModuleMicroSeconds', + 'V8.WasmCompileFunctionMicroSeconds.wasm', + 'V8.WasmInstantiateModuleMicroSeconds.wasm', + 'V8.WasmModuleCodeSizeTopTierMiB', + 'V8.WasmCompileFunctionPeakMemoryBytes', + 'V8.WasmModuleCodeSizeMiB', +] + def AugmentOptionsForV8BrowsingMetrics(options, enable_runtime_call_stats=True): categories = [ @@ -44,14 +57,18 @@ options.config.chrome_trace_config.SetTraceBufferSizeInKb(400 * 1024) + options.config.chrome_trace_config.EnableUMAHistograms( + *V8_BROWSING_BENCHMARK_UMA) + metrics = [ - 'blinkGcMetric', - 'consoleErrorMetric', - 'expectedQueueingTimeMetric', - 'gcMetric', - 'memoryMetric', - 'reportedByPageMetric', - 'wasmMetric', + 'blinkGcMetric', + 'consoleErrorMetric', + 'expectedQueueingTimeMetric', + 'gcMetric', + 'memoryMetric', + 'reportedByPageMetric', + 'umaMetric', + 'wasmMetric', ] options.ExtendTimelineBasedMetric(metrics) if enable_runtime_call_stats:
diff --git a/ui/chromeos/translations/ui_chromeos_strings_iw.xtb b/ui/chromeos/translations/ui_chromeos_strings_iw.xtb index ccce7bc9..b27b3086 100644 --- a/ui/chromeos/translations/ui_chromeos_strings_iw.xtb +++ b/ui/chromeos/translations/ui_chromeos_strings_iw.xtb
@@ -143,6 +143,7 @@ <translation id="2515586267016047495">Alt</translation> <translation id="2529133382850673012">מקלדת אנגלית (ארה"ב)</translation> <translation id="2534155362429831547"><ph name="NUMBER_OF_ITEMS" /> פריטים נמחקו</translation> +<translation id="2541377937973966830">התכנים בתיקייה הזו הם לקריאה בלבד. לא ניתן לבצע פעולות מסוימות.</translation> <translation id="2542049655219295786">טבלה של Google</translation> <translation id="2547921442987553570">הוספה אל <ph name="EXTENSION_NAME" /></translation> <translation id="255937426064304553">ארה"ב - בינלאומית</translation> @@ -312,6 +313,7 @@ <translation id="4522570452068850558">פרטים</translation> <translation id="4527800702232535228">התיקייה הזו משותפת עם Parallels Desktop</translation> <translation id="4552678318981539154">קנה עוד שטח אחסון</translation> +<translation id="4559318885353833501">בוצעה מחיקה של <ph name="FILE_NAME" /></translation> <translation id="4559767610552730302">טשטוש</translation> <translation id="4572815280350369984">קובץ <ph name="FILE_TYPE" /></translation> <translation id="457386861538956877">עוד...</translation> @@ -513,6 +515,7 @@ <translation id="6356685157277930264">חלון משוב לגבי קבצים</translation> <translation id="6358884629796491903">דרקון</translation> <translation id="637062427944097960">הקובץ הזה נפתח בשולחן עבודה שונה. עבור אל <ph name="USER_NAME" /> (<ph name="MAIL_ADDRESS" />) כדי לראות אותו.</translation> +<translation id="6394388407447716302">לקריאה בלבד</translation> <translation id="6395575651121294044"><ph name="NUMBER_OF_FILES" /> פריטים</translation> <translation id="6398765197997659313">יציאה ממסך מלא</translation> <translation id="642282551015776456">ייתכן שלא ניתן להשתמש בשם זה כשם קובץ או תיקייה</translation>
diff --git a/ui/chromeos/translations/ui_chromeos_strings_tr.xtb b/ui/chromeos/translations/ui_chromeos_strings_tr.xtb index f4dffb5..3a1a4891 100644 --- a/ui/chromeos/translations/ui_chromeos_strings_tr.xtb +++ b/ui/chromeos/translations/ui_chromeos_strings_tr.xtb
@@ -143,6 +143,7 @@ <translation id="2515586267016047495">Alt</translation> <translation id="2529133382850673012">ABD klavye</translation> <translation id="2534155362429831547"><ph name="NUMBER_OF_ITEMS" /> öğe silindi</translation> +<translation id="2541377937973966830">Bu klasörün içindekiler salt okunurdur. Bazı işlemler desteklenmez.</translation> <translation id="2542049655219295786">Google tablosu</translation> <translation id="2547921442987553570"><ph name="EXTENSION_NAME" /> uzantısına ekle</translation> <translation id="255937426064304553">ABD uluslararası</translation> @@ -312,6 +313,7 @@ <translation id="4522570452068850558">Ayrıntılar</translation> <translation id="4527800702232535228">Bu klasör Parallels Desktop ile paylaşılıyor</translation> <translation id="4552678318981539154">Daha fazla depolama alanı satın alın</translation> +<translation id="4559318885353833501"><ph name="FILE_NAME" /> silindi</translation> <translation id="4559767610552730302">Bokeh</translation> <translation id="4572815280350369984"><ph name="FILE_TYPE" /> dosyası</translation> <translation id="457386861538956877">Diğer...</translation> @@ -512,6 +514,7 @@ <translation id="6356685157277930264">Dosya geri bildirim penceresi</translation> <translation id="6358884629796491903">Ejderha</translation> <translation id="637062427944097960">Bu dosya farklı bir masaüstünde açıldı. Görüntülemek için <ph name="USER_NAME" /> (<ph name="MAIL_ADDRESS" />) adlı kullanıcıya gidin.</translation> +<translation id="6394388407447716302">Salt okunur</translation> <translation id="6395575651121294044"><ph name="NUMBER_OF_FILES" /> öğe</translation> <translation id="6398765197997659313">Tam ekrandan çık</translation> <translation id="642282551015776456">Bu ad, dosya veya klasör adı olarak kullanılamaz</translation>
diff --git a/ui/chromeos/translations/ui_chromeos_strings_vi.xtb b/ui/chromeos/translations/ui_chromeos_strings_vi.xtb index 8c6500ce..9a162ec 100644 --- a/ui/chromeos/translations/ui_chromeos_strings_vi.xtb +++ b/ui/chromeos/translations/ui_chromeos_strings_vi.xtb
@@ -143,7 +143,7 @@ <translation id="2515586267016047495">Alt</translation> <translation id="2529133382850673012">Bàn phím Anh-Mỹ</translation> <translation id="2534155362429831547">Đã xóa <ph name="NUMBER_OF_ITEMS" /> mục</translation> -<translation id="2541377937973966830">Nội dung trong thư mục này đang ở chế độ chỉ đọc. Vì thế, một số hoạt động sẽ không thực hiện được.</translation> +<translation id="2541377937973966830">Nội dung trong thư mục này đang ở chế độ chỉ có thể đọc. Vì thế, một số hoạt động sẽ không được hỗ trợ.</translation> <translation id="2542049655219295786">Bảng Google</translation> <translation id="2547921442987553570">Thêm vào <ph name="EXTENSION_NAME" /></translation> <translation id="255937426064304553">Bàn phím quốc tế Hoa Kỳ</translation> @@ -514,7 +514,7 @@ <translation id="6356685157277930264">Cửa sổ phản hồi về tệp</translation> <translation id="6358884629796491903">Rồng</translation> <translation id="637062427944097960">Tệp này được mở trên máy tính khác. Chuyển sang <ph name="USER_NAME" /> (<ph name="MAIL_ADDRESS" />) để xem tệp này.</translation> -<translation id="6394388407447716302">Chỉ đọc</translation> +<translation id="6394388407447716302">Chỉ có thể đọc</translation> <translation id="6395575651121294044"><ph name="NUMBER_OF_FILES" /> mục</translation> <translation id="6398765197997659313">Thoát khỏi chế độ toàn màn hình</translation> <translation id="642282551015776456">Không thể sử dụng tên này làm tên tệp trong thư mục</translation>
diff --git a/ui/login/display_manager.js b/ui/login/display_manager.js index bf9c10e..547eee52 100644 --- a/ui/login/display_manager.js +++ b/ui/login/display_manager.js
@@ -50,9 +50,6 @@ /** @const */ var ACCELERATOR_KIOSK_ENABLE = 'kiosk_enable'; /** @const */ var ACCELERATOR_VERSION = 'version'; /** @const */ var ACCELERATOR_RESET = 'reset'; -/** @const */ var ACCELERATOR_DEVICE_REQUISITION = 'device_requisition'; -/** @const */ var ACCELERATOR_DEVICE_REQUISITION_REMORA = - 'device_requisition_remora'; /** @const */ var ACCELERATOR_APP_LAUNCH_BAILOUT = 'app_launch_bailout'; /** @const */ var ACCELERATOR_APP_LAUNCH_NETWORK_CONFIG = 'app_launch_network_config'; @@ -402,13 +399,6 @@ RESET_AVAILABLE_SCREEN_GROUP.indexOf(currentStepId) != -1) { chrome.send('toggleResetScreen'); } - } else if (name == ACCELERATOR_DEVICE_REQUISITION) { - if (this.isOobeUI()) - this.showDeviceRequisitionPrompt_(); - } else if (name == ACCELERATOR_DEVICE_REQUISITION_REMORA) { - if (this.isOobeUI() && !attributes.changeRequisitonProhibited) - this.showDeviceRequisitionRemoraPrompt_( - 'deviceRequisitionRemoraPromptText', 'remora'); } else if (name == ACCELERATOR_APP_LAUNCH_BAILOUT) { if (currentStepId == SCREEN_APP_LAUNCH_SPLASH) chrome.send('cancelAppLaunch'); @@ -767,34 +757,6 @@ }, /** - * Shows the device requisition prompt. - */ - showDeviceRequisitionPrompt_: function() { - if (!this.deviceRequisitionDialog_) { - this.deviceRequisitionDialog_ = - new cr.ui.dialogs.PromptDialog(document.body); - this.deviceRequisitionDialog_.setOkLabel( - loadTimeData.getString('deviceRequisitionPromptOk')); - this.deviceRequisitionDialog_.setCancelLabel( - loadTimeData.getString('deviceRequisitionPromptCancel')); - } - this.deviceRequisitionDialog_.show( - loadTimeData.getString('deviceRequisitionPromptText'), - this.deviceRequisition_, - this.onConfirmDeviceRequisitionPrompt_.bind(this)); - }, - - /** - * Confirmation handle for the device requisition prompt. - * @param {string} value The value entered by the user. - * @private - */ - onConfirmDeviceRequisitionPrompt_: function(value) { - this.deviceRequisition_ = value; - chrome.send('setDeviceRequisition', [value == '' ? 'none' : value]); - }, - - /** * Called when window size changed. Notifies current screen about * change. * @private @@ -807,38 +769,6 @@ } }, - /* - * Updates the device requisition string shown in the requisition - * prompt. - * @param {string} requisition The device requisition. - */ - updateDeviceRequisition: function(requisition) { - this.deviceRequisition_ = requisition; - }, - - /** - * Shows the special remora/shark device requisition prompt. - * @private - */ - showDeviceRequisitionRemoraPrompt_: function(promptText, requisition) { - if (!this.deviceRequisitionRemoraDialog_) { - this.deviceRequisitionRemoraDialog_ = - new cr.ui.dialogs.ConfirmDialog(document.body); - this.deviceRequisitionRemoraDialog_.setOkLabel( - loadTimeData.getString('deviceRequisitionRemoraPromptOk')); - this.deviceRequisitionRemoraDialog_.setCancelLabel( - loadTimeData.getString('deviceRequisitionRemoraPromptCancel')); - } - this.deviceRequisitionRemoraDialog_.show( - loadTimeData.getString(promptText), - function() { // onShow - chrome.send('setDeviceRequisition', [requisition]); - }, - function() { // onCancel - chrome.send('setDeviceRequisition', ['none']); - }); - }, - /** * Returns true if Oobe UI is shown. */
diff --git a/ui/login/display_manager_types.js b/ui/login/display_manager_types.js index 0d60aef..24dd83f 100644 --- a/ui/login/display_manager_types.js +++ b/ui/login/display_manager_types.js
@@ -12,7 +12,6 @@ * resetAllowed: (boolean|undefined), * startEnrollmentAllowed: (boolean|undefined), * toggleKioskAllowed: (boolean|undefined), - * changeRequisitonProhibited: (boolean|undefined), * }} */ var DisplayManagerScreenAttributes = {}; @@ -36,12 +35,6 @@ DisplayManagerScreenAttributes.toggleKioskAllowed; /** - * True if "enroll hangouts meet" accelerator is prohibited. - * @type {boolean|undefined} - */ -DisplayManagerScreenAttributes.changeRequisitonProhibited; - -/** * Possible types of UI. * @enum {string} */
diff --git a/ui/views/accessibility/ax_aura_obj_cache_unittest.cc b/ui/views/accessibility/ax_aura_obj_cache_unittest.cc index dcdd751..90f49f2 100644 --- a/ui/views/accessibility/ax_aura_obj_cache_unittest.cc +++ b/ui/views/accessibility/ax_aura_obj_cache_unittest.cc
@@ -116,7 +116,8 @@ child_widget->Show(); // Create a child view. - auto* button = new LabelButton(nullptr, base::ASCIIToUTF16("ChildButton")); + auto* button = new LabelButton(Button::PressedCallback(), + base::ASCIIToUTF16("ChildButton")); button->SetSize(gfx::Size(20, 20)); child_widget->GetContentsView()->AddChildView(button);
diff --git a/ui/views/accessibility/ax_system_caret_win_interactive_uitest.cc b/ui/views/accessibility/ax_system_caret_win_interactive_uitest.cc index 607295453..25d4d360 100644 --- a/ui/views/accessibility/ax_system_caret_win_interactive_uitest.cc +++ b/ui/views/accessibility/ax_system_caret_win_interactive_uitest.cc
@@ -342,7 +342,7 @@ { // Move focus to a button. - LabelButton button(nullptr, base::string16()); + LabelButton button{Button::PressedCallback(), base::string16()}; button.SetBounds(500, 0, 200, 20); widget_->GetRootView()->AddChildView(&button); test::WidgetActivationWaiter waiter(widget_, true);
diff --git a/ui/views/accessibility/ax_virtual_view_unittest.cc b/ui/views/accessibility/ax_virtual_view_unittest.cc index 23e1ba55..ae13025 100644 --- a/ui/views/accessibility/ax_virtual_view_unittest.cc +++ b/ui/views/accessibility/ax_virtual_view_unittest.cc
@@ -35,7 +35,7 @@ class TestButton : public Button { public: - TestButton() : Button(nullptr) {} + TestButton() : Button(Button::PressedCallback()) {} TestButton(const TestButton&) = delete; TestButton& operator=(const TestButton&) = delete; ~TestButton() override = default;
diff --git a/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc b/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc index f24870f..55449108 100644 --- a/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc +++ b/ui/views/accessibility/view_ax_platform_node_delegate_unittest.cc
@@ -34,7 +34,7 @@ class TestButton : public Button { public: - TestButton() : Button(nullptr) {} + TestButton() : Button(Button::PressedCallback()) {} TestButton(const TestButton&) = delete; TestButton& operator=(const TestButton&) = delete; ~TestButton() override = default;
diff --git a/ui/views/accessibility/views_ax_tree_manager_unittest.cc b/ui/views/accessibility/views_ax_tree_manager_unittest.cc index e5a396d6..d2f4d0b 100644 --- a/ui/views/accessibility/views_ax_tree_manager_unittest.cc +++ b/ui/views/accessibility/views_ax_tree_manager_unittest.cc
@@ -35,7 +35,7 @@ class TestButton : public Button { public: - TestButton() : Button(nullptr) {} + TestButton() : Button(Button::PressedCallback()) {} TestButton(const TestButton&) = delete; TestButton& operator=(const TestButton&) = delete; ~TestButton() override = default;
diff --git a/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc b/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc index 47cb389..27aae4a 100644 --- a/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc +++ b/ui/views/bubble/bubble_dialog_delegate_view_unittest.cc
@@ -532,8 +532,9 @@ // widget is shown or hidden respectively. TEST_F(BubbleDialogDelegateViewTest, AttachedWidgetShowsInkDropWhenVisible) { std::unique_ptr<Widget> anchor_widget = CreateTestWidget(); - LabelButton* button = anchor_widget->SetContentsView( - std::make_unique<LabelButton>(nullptr, base::string16())); + LabelButton* button = + anchor_widget->SetContentsView(std::make_unique<LabelButton>( + Button::PressedCallback(), base::string16())); TestInkDrop* ink_drop = new TestInkDrop(); test::InkDropHostViewTestApi(button).SetInkDrop(base::WrapUnique(ink_drop)); TestBubbleDialogDelegateView* bubble_delegate = @@ -560,8 +561,9 @@ // widget is shown. TEST_F(BubbleDialogDelegateViewTest, VisibleWidgetShowsInkDropOnAttaching) { std::unique_ptr<Widget> anchor_widget = CreateTestWidget(); - LabelButton* button = anchor_widget->SetContentsView( - std::make_unique<LabelButton>(nullptr, base::string16())); + LabelButton* button = + anchor_widget->SetContentsView(std::make_unique<LabelButton>( + Button::PressedCallback(), base::string16())); TestInkDrop* ink_drop = new TestInkDrop(); test::InkDropHostViewTestApi(button).SetInkDrop(base::WrapUnique(ink_drop)); TestBubbleDialogDelegateView* bubble_delegate =
diff --git a/ui/views/button_drag_utils.cc b/ui/views/button_drag_utils.cc index d462452..ca50afc 100644 --- a/ui/views/button_drag_utils.cc +++ b/ui/views/button_drag_utils.cc
@@ -48,7 +48,8 @@ ui::OSExchangeData* data) { // Create a button to render the drag image for us. views::LabelButton button( - nullptr, title.empty() ? base::UTF8ToUTF16(url.spec()) : title); + views::Button::PressedCallback(), + title.empty() ? base::UTF8ToUTF16(url.spec()) : title); button.SetTextSubpixelRenderingEnabled(false); const ui::NativeTheme* theme = widget.GetNativeTheme(); button.SetTextColor(
diff --git a/ui/views/controls/button/button_unittest.cc b/ui/views/controls/button/button_unittest.cc index c67b614..1de5a23 100644 --- a/ui/views/controls/button/button_unittest.cc +++ b/ui/views/controls/button/button_unittest.cc
@@ -322,7 +322,7 @@ TEST_F(ButtonTest, NotifyAction) { gfx::Point center(10, 10); - // By default the button should notify its listener on mouse release. + // By default the button should notify the callback on mouse release. button()->OnMousePressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); @@ -335,7 +335,7 @@ EXPECT_EQ(Button::STATE_HOVERED, button()->GetState()); EXPECT_TRUE(button()->pressed()); - // Set the notify action to its listener on mouse press. + // Set the notify action to happen on mouse press. button()->Reset(); button()->button_controller()->set_notify_action( ButtonController::NotifyAction::kOnPress); @@ -359,7 +359,7 @@ TEST_F(ButtonTest, NotifyActionNoClick) { gfx::Point center(10, 10); - // By default the button should notify its listener on mouse release. + // By default the button should notify the callback on mouse release. button()->OnMousePressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); @@ -370,7 +370,7 @@ ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON)); EXPECT_TRUE(button()->canceled()); - // Set the notify action to its listener on mouse press. + // Set the notify action to happen on mouse press. button()->Reset(); button()->button_controller()->set_notify_action( ButtonController::NotifyAction::kOnPress); @@ -435,7 +435,7 @@ TEST_F(ButtonTest, AsButton) { base::string16 text; - LabelButton label_button(nullptr, text); + LabelButton label_button(Button::PressedCallback(), text); EXPECT_TRUE(Button::AsButton(&label_button)); ImageButton image_button; @@ -447,7 +447,7 @@ RadioButton radio_button(text, 0); EXPECT_TRUE(Button::AsButton(&radio_button)); - MenuButton menu_button(nullptr, text); + MenuButton menu_button(Button::PressedCallback(), text); EXPECT_TRUE(Button::AsButton(&menu_button)); ToggleButton toggle_button; @@ -737,7 +737,7 @@ button()->OnMousePressed(ui::MouseEvent( ui::ET_MOUSE_PRESSED, center, center, ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); - // Default button controller notifies listener at mouse release. + // Default button controller notifies callback at mouse release. button()->OnMouseReleased(ui::MouseEvent( ui::ET_MOUSE_RELEASED, center, center, ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)); @@ -870,7 +870,7 @@ // Verifies that button activation highlight state changes trigger property // change callbacks. -TEST_F(ButtonTest, ChangingHighlightStateNotifiesListener) { +TEST_F(ButtonTest, ChangingHighlightStateNotifiesCallback) { CreateButtonWithObserver(); EXPECT_FALSE(button_observer()->highlighted_changed()); EXPECT_FALSE(button()->GetHighlighted());
diff --git a/ui/views/controls/button/image_button_factory.cc b/ui/views/controls/button/image_button_factory.cc index d6f38ff9..b086f26e 100644 --- a/ui/views/controls/button/image_button_factory.cc +++ b/ui/views/controls/button/image_button_factory.cc
@@ -25,9 +25,6 @@ ColorTrackingVectorImageButton(PressedCallback callback, const gfx::VectorIcon& icon) : ImageButton(std::move(callback)), icon_(icon) {} - ColorTrackingVectorImageButton(ButtonListener* listener, - const gfx::VectorIcon& icon) - : ColorTrackingVectorImageButton(PressedCallback(listener, this), icon) {} // ImageButton: void OnThemeChanged() override { @@ -52,15 +49,6 @@ return button; } -std::unique_ptr<ImageButton> CreateVectorImageButtonWithNativeTheme( - ButtonListener* listener, - const gfx::VectorIcon& icon) { - auto button = - std::make_unique<ColorTrackingVectorImageButton>(listener, icon); - ConfigureVectorImageButton(button.get()); - return button; -} - std::unique_ptr<ImageButton> CreateVectorImageButton( Button::PressedCallback callback) { auto button = std::make_unique<ImageButton>(std::move(callback)); @@ -81,13 +69,6 @@ return button; } -std::unique_ptr<ToggleImageButton> CreateVectorToggleImageButton( - ButtonListener* listener) { - auto button = std::make_unique<ToggleImageButton>(listener); - ConfigureVectorImageButton(button.get()); - return button; -} - void ConfigureVectorImageButton(ImageButton* button) { button->SetInkDropMode(Button::InkDropMode::ON); button->SetHasInkDropActionOnClick(true);
diff --git a/ui/views/controls/button/image_button_factory.h b/ui/views/controls/button/image_button_factory.h index 593ec05..d31cf949 100644 --- a/ui/views/controls/button/image_button_factory.h +++ b/ui/views/controls/button/image_button_factory.h
@@ -25,9 +25,6 @@ VIEWS_EXPORT std::unique_ptr<ImageButton> CreateVectorImageButtonWithNativeTheme(Button::PressedCallback callback, const gfx::VectorIcon& icon); -VIEWS_EXPORT std::unique_ptr<ImageButton> -CreateVectorImageButtonWithNativeTheme(ButtonListener* listener, - const gfx::VectorIcon& icon); // Creates an ImageButton with an ink drop and a centered image in preparation // for applying a vector icon with SetImageFromVectorIcon below. @@ -40,8 +37,6 @@ // preparation for applying a vector icon from SetImageFromVectorIcon below. VIEWS_EXPORT std::unique_ptr<ToggleImageButton> CreateVectorToggleImageButton( Button::PressedCallback callback); -VIEWS_EXPORT std::unique_ptr<ToggleImageButton> CreateVectorToggleImageButton( - ButtonListener* listener); // Configures an existing ImageButton with an ink drop and a centered image in // preparation for applying a vector icon with SetImageFromVectorIcon below.
diff --git a/ui/views/controls/button/image_button_factory_unittest.cc b/ui/views/controls/button/image_button_factory_unittest.cc index 2197b35..0aa307a5 100644 --- a/ui/views/controls/button/image_button_factory_unittest.cc +++ b/ui/views/controls/button/image_button_factory_unittest.cc
@@ -21,13 +21,13 @@ using ImageButtonFactoryTest = ViewsTestBase; TEST_F(ImageButtonFactoryTest, CreateVectorImageButton) { - auto button = CreateVectorImageButton(nullptr); + auto button = CreateVectorImageButton(Button::PressedCallback()); EXPECT_EQ(ImageButton::ALIGN_CENTER, button->h_alignment_); EXPECT_EQ(ImageButton::ALIGN_MIDDLE, button->v_alignment_); } TEST_F(ImageButtonFactoryTest, SetImageFromVectorIcon) { - auto button = CreateVectorImageButton(nullptr); + auto button = CreateVectorImageButton(Button::PressedCallback()); SetImageFromVectorIcon(button.get(), vector_icons::kCloseRoundedIcon, SK_ColorRED); EXPECT_FALSE(button->GetImage(Button::STATE_NORMAL).isNull()); @@ -78,7 +78,7 @@ TEST_F(ImageButtonFactoryWidgetTest, CreateVectorImageButtonWithNativeTheme) { AddImageButton(CreateVectorImageButtonWithNativeTheme( - nullptr, vector_icons::kCloseRoundedIcon)); + Button::PressedCallback(), vector_icons::kCloseRoundedIcon)); EXPECT_EQ(button()->GetNativeTheme()->GetSystemColor( ui::NativeTheme::kColorId_DefaultIconColor), button()->GetInkDropBaseColor());
diff --git a/ui/views/controls/button/label_button_unittest.cc b/ui/views/controls/button/label_button_unittest.cc index a4a586b..fc737c55 100644 --- a/ui/views/controls/button/label_button_unittest.cc +++ b/ui/views/controls/button/label_button_unittest.cc
@@ -72,7 +72,7 @@ public: explicit TestLabelButton(const base::string16& text = base::string16(), int button_context = style::CONTEXT_BUTTON) - : LabelButton(nullptr, text, button_context) {} + : LabelButton(Button::PressedCallback(), text, button_context) {} using LabelButton::image; using LabelButton::label; @@ -745,8 +745,8 @@ widget_->Init(std::move(params)); widget_->Show(); - button_ = widget_->SetContentsView( - std::make_unique<LabelButton>(nullptr, base::string16())); + button_ = widget_->SetContentsView(std::make_unique<LabelButton>( + Button::PressedCallback(), base::string16())); test_ink_drop_ = new test::TestInkDrop(); test::InkDropHostViewTestApi(button_).SetInkDrop(
diff --git a/ui/views/controls/button/menu_button.cc b/ui/views/controls/button/menu_button.cc index da771b0..7e760955 100644 --- a/ui/views/controls/button/menu_button.cc +++ b/ui/views/controls/button/menu_button.cc
@@ -17,7 +17,7 @@ MenuButton::MenuButton(PressedCallback callback, const base::string16& text, int button_context) - : LabelButton(nullptr, text, button_context) { + : LabelButton(PressedCallback(), text, button_context) { SetHorizontalAlignment(gfx::ALIGN_LEFT); std::unique_ptr<MenuButtonController> menu_button_controller = std::make_unique<MenuButtonController>(
diff --git a/ui/views/controls/button/menu_button_unittest.cc b/ui/views/controls/button/menu_button_unittest.cc index 2e3eb48..2e22a0d 100644 --- a/ui/views/controls/button/menu_button_unittest.cc +++ b/ui/views/controls/button/menu_button_unittest.cc
@@ -496,8 +496,8 @@ // No touch on desktop Mac. Tracked in http://crbug.com/445520. #if !defined(OS_APPLE) || defined(USE_AURA) -// Tests if the listener is notified correctly when a gesture tap happens on a -// MenuButton that has a ButtonListener. +// Tests if the callback is notified correctly when a gesture tap happens on a +// MenuButton that has a callback. TEST_F(MenuButtonTest, ActivateDropDownOnGestureTap) { ConfigureMenuButton(std::make_unique<TestMenuButton>()); @@ -508,7 +508,7 @@ generator()->GestureTapAt(gfx::Point(10, 10)); - // Check that MenuButton has notified the listener, while it was in pressed + // Check that MenuButton has notified the callback, while it was in pressed // state. EXPECT_TRUE(button()->clicked()); EXPECT_EQ(Button::STATE_HOVERED, button()->last_state()); @@ -529,7 +529,7 @@ } // Tests that a move event that exits the button returns it to the normal state, -// and that the button did not activate the listener. +// and that the button did not activate the callback. TEST_F(MenuButtonTest, TouchFeedbackDuringTapCancel) { ConfigureMenuButton(std::make_unique<TestMenuButton>()); generator()->PressTouch();
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc index 3de16177..936d008 100644 --- a/ui/views/controls/menu/menu_controller_unittest.cc +++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -768,8 +768,8 @@ menu_item()->AppendMenuItem(5, base::ASCIIToUTF16("Five")); const size_t children_count = single_child ? 1 : 3; for (size_t i = 0; i < children_count; ++i) { - LabelButton* button = - new LabelButton(nullptr, base::ASCIIToUTF16("Label")); + LabelButton* button = new LabelButton(Button::PressedCallback(), + base::ASCIIToUTF16("Label")); // This is an in-menu button. Hence it must be always focusable. button->SetFocusBehavior(View::FocusBehavior::ALWAYS); item_view->AddChildView(button);
diff --git a/ui/views/controls/menu/menu_runner_unittest.cc b/ui/views/controls/menu/menu_runner_unittest.cc index 9c8e634..225cf30 100644 --- a/ui/views/controls/menu/menu_runner_unittest.cc +++ b/ui/views/controls/menu/menu_runner_unittest.cc
@@ -641,8 +641,8 @@ TEST_F(MenuRunnerImplTest, FocusOnMenuCloseDeleteAfterRun) { // Create test button that has focus. - LabelButton* button = - new LabelButton(nullptr, base::string16(), style::CONTEXT_BUTTON); + LabelButton* button = new LabelButton( + Button::PressedCallback(), base::string16(), style::CONTEXT_BUTTON); button->SetID(1); button->SetSize(gfx::Size(20, 20)); owner()->GetRootView()->AddChildView(button);
diff --git a/ui/views/examples/dialog_example.cc b/ui/views/examples/dialog_example.cc index 10ffb74..d5940b0 100644 --- a/ui/views/examples/dialog_example.cc +++ b/ui/views/examples/dialog_example.cc
@@ -58,7 +58,7 @@ if (parent_->has_extra_button_->GetChecked()) { DialogDelegate::SetExtraView(std::make_unique<views::MdTextButton>( - nullptr, parent_->extra_button_label_->GetText())); + Button::PressedCallback(), parent_->extra_button_label_->GetText())); } }
diff --git a/ui/views/examples/scroll_view_example.cc b/ui/views/examples/scroll_view_example.cc index 35bc512..3e4b9c8 100644 --- a/ui/views/examples/scroll_view_example.cc +++ b/ui/views/examples/scroll_view_example.cc
@@ -48,7 +48,8 @@ container->AddChildView(std::move(view)); }; add_child(std::make_unique<LabelButton>( - nullptr, GetStringUTF16(IDS_SCROLL_VIEW_BUTTON_LABEL))); + Button::PressedCallback(), + GetStringUTF16(IDS_SCROLL_VIEW_BUTTON_LABEL))); add_child(std::make_unique<RadioButton>( GetStringUTF16(IDS_SCROLL_VIEW_RADIO_BUTTON_LABEL), 0)); layout_manager->SetDefaultFlex(1);
diff --git a/ui/views/examples/tabbed_pane_example.cc b/ui/views/examples/tabbed_pane_example.cc index 226b55b0..642fd16b 100644 --- a/ui/views/examples/tabbed_pane_example.cc +++ b/ui/views/examples/tabbed_pane_example.cc
@@ -86,7 +86,8 @@ } void TabbedPaneExample::AddButton(const base::string16& label) { - tabbed_pane_->AddTab(label, std::make_unique<LabelButton>(nullptr, label)); + tabbed_pane_->AddTab( + label, std::make_unique<LabelButton>(Button::PressedCallback(), label)); PrintCurrentStatus(); }
diff --git a/ui/views/focus/focus_traversal_unittest.cc b/ui/views/focus/focus_traversal_unittest.cc index b80dceb..9fc96e0 100644 --- a/ui/views/focus/focus_traversal_unittest.cc +++ b/ui/views/focus/focus_traversal_unittest.cc
@@ -372,8 +372,8 @@ y += label_height + gap_between_labels; - auto button = - std::make_unique<MdTextButton>(nullptr, ASCIIToUTF16("Click me")); + auto button = std::make_unique<MdTextButton>(Button::PressedCallback(), + ASCIIToUTF16("Click me")); button->SetBounds(label_x, y + 10, 80, 30); button->SetID(FRUIT_BUTTON_ID); left_container_->AddChildView(std::move(button)); @@ -470,18 +470,21 @@ y = 250; int width = 60; - button = std::make_unique<MdTextButton>(nullptr, ASCIIToUTF16("OK")); + button = std::make_unique<MdTextButton>(Button::PressedCallback(), + ASCIIToUTF16("OK")); button->SetID(OK_BUTTON_ID); button->SetIsDefault(true); button->SetBounds(150, y, width, 30); GetContentsView()->AddChildView(std::move(button)); - button = std::make_unique<MdTextButton>(nullptr, ASCIIToUTF16("Cancel")); + button = std::make_unique<MdTextButton>(Button::PressedCallback(), + ASCIIToUTF16("Cancel")); button->SetID(CANCEL_BUTTON_ID); button->SetBounds(220, y, width, 30); GetContentsView()->AddChildView(std::move(button)); - button = std::make_unique<MdTextButton>(nullptr, ASCIIToUTF16("Help")); + button = std::make_unique<MdTextButton>(Button::PressedCallback(), + ASCIIToUTF16("Help")); button->SetID(HELP_BUTTON_ID); button->SetBounds(290, y, width, 30); GetContentsView()->AddChildView(std::move(button)); @@ -531,7 +534,8 @@ text_field_ptr->SetBounds(10, 10, 100, 20); text_field_ptr->SetID(SEARCH_TEXTFIELD_ID); - button = std::make_unique<MdTextButton>(nullptr, ASCIIToUTF16("Search")); + button = std::make_unique<MdTextButton>(Button::PressedCallback(), + ASCIIToUTF16("Search")); button->SetBounds(112, 5, 60, 30); button->SetID(SEARCH_BUTTON_ID); border_contents->AddChildView(std::move(button)); @@ -555,11 +559,13 @@ view_contents->SetFocusBehavior(View::FocusBehavior::ALWAYS); view_contents->SetBackground(CreateSolidBackground(SK_ColorBLUE)); view_contents->SetID(THUMBNAIL_CONTAINER_ID); - button = std::make_unique<MdTextButton>(nullptr, ASCIIToUTF16("Star")); + button = std::make_unique<MdTextButton>(Button::PressedCallback(), + ASCIIToUTF16("Star")); button->SetBounds(5, 5, 50, 30); button->SetID(THUMBNAIL_STAR_ID); view_contents->AddChildView(std::move(button)); - button = std::make_unique<MdTextButton>(nullptr, ASCIIToUTF16("SuperStar")); + button = std::make_unique<MdTextButton>(Button::PressedCallback(), + ASCIIToUTF16("SuperStar")); button->SetBounds(60, 5, 100, 30); button->SetID(THUMBNAIL_SUPER_STAR_ID); view_contents->AddChildView(std::move(button));
diff --git a/ui/views/window/dialog_client_view_unittest.cc b/ui/views/window/dialog_client_view_unittest.cc index d8e9ef7..cd9cc849 100644 --- a/ui/views/window/dialog_client_view_unittest.cc +++ b/ui/views/window/dialog_client_view_unittest.cc
@@ -398,8 +398,8 @@ layout_provider()->SetDistanceMetric(DISTANCE_BUTTON_MAX_LINKABLE_WIDTH, 200); // The extra view should also match, if it's a matching button type. - View* extra_button = - SetExtraView(std::make_unique<LabelButton>(nullptr, base::string16())); + View* extra_button = SetExtraView(std::make_unique<LabelButton>( + Button::PressedCallback(), base::string16())); CheckContentsIsSetToPreferredSize(); EXPECT_EQ(cancel_button_width, extra_button->width()); } @@ -582,8 +582,8 @@ SetDialogButtons(ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL); SetDialogButtonLabel(ui::DIALOG_BUTTON_OK, "ok"); SetDialogButtonLabel(ui::DIALOG_BUTTON_CANCEL, "cancel"); - SetExtraView( - std::make_unique<LabelButton>(nullptr, base::UTF8ToUTF16("extra"))); + SetExtraView(std::make_unique<LabelButton>(Button::PressedCallback(), + base::UTF8ToUTF16("extra"))); widget()->Show();
diff --git a/weblayer/browser/java/org/chromium/weblayer_private/payments/WebLayerPaymentRequestFactory.java b/weblayer/browser/java/org/chromium/weblayer_private/payments/WebLayerPaymentRequestFactory.java index ff7c3010..bf9292c 100644 --- a/weblayer/browser/java/org/chromium/weblayer_private/payments/WebLayerPaymentRequestFactory.java +++ b/weblayer/browser/java/org/chromium/weblayer_private/payments/WebLayerPaymentRequestFactory.java
@@ -24,7 +24,7 @@ @Override public PaymentRequest createImpl() { - if (!PaymentFeatureList.isEnabled(PaymentFeatureList.WEB_LAYER_PAYMENTS)) { + if (!PaymentFeatureList.isEnabled(PaymentFeatureList.WEB_PAYMENTS)) { return new InvalidPaymentRequest(); }