diff --git a/DEPS b/DEPS index e0e224d..a2847dcb 100644 --- a/DEPS +++ b/DEPS
@@ -239,19 +239,19 @@ # 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': '00edeefab7f4d08e539d4e7b8c4913cfcb91b3b5', + 'skia_revision': '21b8ccb7393c700ee3dcfc86101c46f962eca852', # 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': 'bf3e892752c5832f3d5fdfc1a54d2cf63abd808b', + 'v8_revision': '9ae0b044c5778bb5cc97514abc23ad169b12bce9', # 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': 'b007e667a8f94b47788a5ba0b2e61c9ac2d1285f', + 'angle_revision': '87a8b79a29f261feefa141c00998a5a473546f53', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'a9e93a8690f5d1504f150ebe5d57fa7138621f37', + 'swiftshader_revision': 'a4232c15e287a38b93d2a55bd1d7894cb4effac3', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # and whatever else without interference from each other. @@ -314,7 +314,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': '31d4b5436c487752c8ced7d05bc3e45b4611f07b', + 'devtools_frontend_revision': 'c2756dca203815cd5c2d16270847432c97a670c8', # 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. @@ -354,7 +354,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': 'ef572ba7a186a283657852fce9d9b67782bb5dbb', + 'dawn_revision': 'ed33e05db17882e00437726d5a96281000d0debf', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -402,7 +402,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'libunwind_revision': '74c6eec6937391d0bfc75bb2f4a412087b0f0172', + 'libunwind_revision': 'c8c0ec928e46328fa284e7290c4ef052c7d285d4', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -735,7 +735,7 @@ 'packages': [ { 'package': 'chromium/rts/model/windows-amd64', - 'version': 'zfraX6i8jQtjk-OSdGxErf47H3Y0Db3vb7AqEuNsHbwC', + 'version': 'Wb684G7g-2oIT7edWKg4ZeNMIgrN-SDdi1-OhcMUX6MC', }, ], 'dep_type': 'cipd', @@ -796,7 +796,7 @@ 'packages': [ { 'package': 'chromium/third_party/androidx', - 'version': 'KOLlPoehy50pZsVEr88FIh8mpg_MDPsZelkCRMsVZwQC', + 'version': 'onI7kTN2StbSpqpAwCLMywNKlnTq9LblaQ1cK5tReloC', }, ], 'condition': 'checkout_android', @@ -1600,7 +1600,7 @@ 'src/third_party/usrsctp/usrsctplib': Var('chromium_git') + '/external/github.com/sctplab/usrsctp' + '@' + '62d7d0c928c9a040dce96aa2f16c00e7e67d59cb', - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@c03fdc9b1487a7ad84c917b108e2eac26a8da41f', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@bc087f672f1622c28037ac5f226ce7fa137d0119', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + '5e49f57a6e71a026a54eb42e366de09a4142d24e', @@ -1697,7 +1697,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@416e70fbaae9cb5756b601d178f21c05887d34fc', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@6be5655714a7d6665f93d25d222862b2787ea77b', 'condition': 'checkout_src_internal', }, @@ -1727,7 +1727,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'aBZpcE5gHkYFagIWmaLu2oBSMG0Gi5ikerNVntlp1xoC', + 'version': 'qQQSe5fgvGcN6aGrrqZo4XOjWxbQkBzFQ4VRm0zC2nQC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -1738,7 +1738,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'kSSwFZA71f5ALoVuued5YRJcZSBbTPBr5IiQt-CeBLcC', + 'version': 'r6-k2vrGWXcquUe49dygRZ0CjXM9BoA5rEmD19zRuHYC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/WATCHLISTS b/WATCHLISTS index db0516f..7758604 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -1843,9 +1843,9 @@ 'filepath': 'apitest|unittest|browsertest|uitest|chrome/test/', }, 'tether': { - 'filepath': 'chrome/browser/ash/tether/'\ + 'filepath': 'ash/components/tether/'\ + '|chrome/browser/ash/tether/'\ '|chrome/browser/ui/ash/network/tether*'\ - '|chromeos/components/tether/' }, 'text_to_speech': { 'filepath': 'tts'
diff --git a/android_webview/test/BUILD.gn b/android_webview/test/BUILD.gn index d9684b90..be71da9 100644 --- a/android_webview/test/BUILD.gn +++ b/android_webview/test/BUILD.gn
@@ -214,8 +214,6 @@ android_manifest = "../javatests/AndroidManifest.xml" min_sdk_version = default_min_sdk_version - use_vpython3 = false - deps = [ ":webview_instrumentation_test_mock_services_java", ":webview_instrumentation_test_utils_java",
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 8fc4d8b2..af01c58 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -2091,6 +2091,7 @@ "//components/media_message_center", "//components/onc", "//components/password_manager/core/browser:hash_password_manager", + "//components/policy/core/browser", "//components/pref_registry", "//components/prefs", "//components/quirks", @@ -2101,6 +2102,7 @@ "//components/soda:constants", "//components/strings", "//components/sync", + "//components/url_matcher", "//components/user_manager", "//components/vector_icons", "//components/viz/host", @@ -2414,6 +2416,7 @@ "rotator/screen_rotation_animation_unittest.cc", "rotator/screen_rotation_animator_unittest.cc", "screen_util_unittest.cc", + "session/fullscreen_controller_unittest.cc", "session/fullscreen_notification_bubble_unittest.cc", "session/session_controller_impl_unittest.cc", "shelf/assistant_overlay_unittest.cc",
diff --git a/ash/DEPS b/ash/DEPS index e621074a..85727f9 100644 --- a/ash/DEPS +++ b/ash/DEPS
@@ -13,6 +13,7 @@ "+components/language/core/browser/pref_names.h", "+components/live_caption", "+components/media_message_center", + "+components/policy/core/browser", "+components/pref_registry", "+components/prefs", "+components/quirks", @@ -21,6 +22,7 @@ "+components/strings", "+components/sync", "+components/ui_devtools", + "+components/url_matcher", "+components/vector_icons", "+components/viz/common", "+components/viz/host",
diff --git a/ash/components/BUILD.gn b/ash/components/BUILD.gn index 60201e2..943adc43 100644 --- a/ash/components/BUILD.gn +++ b/ash/components/BUILD.gn
@@ -27,6 +27,7 @@ "//ash/components/security_token_pin:unit_tests", "//ash/components/settings:unit_tests", "//ash/components/smbfs:unit_tests", + "//ash/components/tether:unit_tests", "//ash/components/timezone:unit_tests", "//ash/components/trial_group:unit_tests", ]
diff --git a/chromeos/components/tether/BUILD.gn b/ash/components/tether/BUILD.gn similarity index 97% rename from chromeos/components/tether/BUILD.gn rename to ash/components/tether/BUILD.gn index 45c54b5..29a3f2d 100644 --- a/chromeos/components/tether/BUILD.gn +++ b/ash/components/tether/BUILD.gn
@@ -2,7 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -assert(is_chromeos, "Non-ChromeOS builds cannot depend on //chromeos") +import("//build/config/chromeos/ui_mode.gni") + +assert(is_chromeos_ash, "Non-ChromeOS builds cannot depend on //ash") static_library("tether") { sources = [ @@ -115,10 +117,10 @@ ] deps = [ + "//ash/components/tether/proto", "//ash/constants", "//base", "//chromeos/components/multidevice/logging", - "//chromeos/components/tether/proto", "//chromeos/dbus/power", "//chromeos/login/login_state", "//chromeos/network", @@ -198,11 +200,11 @@ public_deps = [ ":tether" ] deps = [ + "//ash/components/tether/proto", "//base", "//base/test:test_support", "//chromeos/components/multidevice", "//chromeos/components/multidevice:test_support", - "//chromeos/components/tether/proto", "//chromeos/network:test_support", "//chromeos/services/device_sync/public/cpp:test_support", "//chromeos/services/secure_channel/public/cpp/client:test_support", @@ -260,10 +262,10 @@ deps = [ ":test_support", ":tether", + "//ash/components/tether/proto", "//base/test:test_support", "//chromeos/components/multidevice", "//chromeos/components/multidevice:test_support", - "//chromeos/components/tether/proto", "//chromeos/dbus/power", "//chromeos/login/login_state", "//chromeos/network:test_support",
diff --git a/chromeos/components/tether/COMMON_METADATA b/ash/components/tether/COMMON_METADATA similarity index 100% rename from chromeos/components/tether/COMMON_METADATA rename to ash/components/tether/COMMON_METADATA
diff --git a/chromeos/components/tether/DEPS b/ash/components/tether/DEPS similarity index 70% rename from chromeos/components/tether/DEPS rename to ash/components/tether/DEPS index ec367ad..e88de91d 100644 --- a/chromeos/components/tether/DEPS +++ b/ash/components/tether/DEPS
@@ -1,13 +1,13 @@ include_rules = [ + "+chromeos/login/login_state", # TODO(hansberry): Restrict //chromeos/services/secure_channel dependency # to //chromeos/services/secure_channel/public once SecureChannelClient # migration is complete. "+chromeos/services/secure_channel", - "+components/pref_registry", "+components/proximity_auth/logging", "+components/session_manager/core", "+components/sync_preferences", - "+device/bluetooth", - "+ui/gfx", - "+ui/message_center", + + # TODO(https://crbug.com/1164001) : Remove when the following moves to ash. + "+chromeos/services/device_sync", ]
diff --git a/ash/components/tether/DIR_METADATA b/ash/components/tether/DIR_METADATA new file mode 100644 index 0000000..4cad27d --- /dev/null +++ b/ash/components/tether/DIR_METADATA
@@ -0,0 +1 @@ +mixins: "//ash/components/tether/COMMON_METADATA"
diff --git a/chromeos/components/tether/OWNERS b/ash/components/tether/OWNERS similarity index 100% rename from chromeos/components/tether/OWNERS rename to ash/components/tether/OWNERS
diff --git a/chromeos/components/tether/active_host.cc b/ash/components/tether/active_host.cc similarity index 98% rename from chromeos/components/tether/active_host.cc rename to ash/components/tether/active_host.cc index 77a8c15..a88e430 100644 --- a/chromeos/components/tether/active_host.cc +++ b/ash/components/tether/active_host.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/active_host.h" +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/pref_names.h" +#include "ash/components/tether/tether_host_fetcher.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/values.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/pref_names.h" -#include "chromeos/components/tether/tether_host_fetcher.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h"
diff --git a/chromeos/components/tether/active_host.h b/ash/components/tether/active_host.h similarity index 97% rename from chromeos/components/tether/active_host.h rename to ash/components/tether/active_host.h index 3f425f51..407efd38 100644 --- a/chromeos/components/tether/active_host.h +++ b/ash/components/tether/active_host.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 CHROMEOS_COMPONENTS_TETHER_ACTIVE_HOST_H_ -#define CHROMEOS_COMPONENTS_TETHER_ACTIVE_HOST_H_ +#ifndef ASH_COMPONENTS_TETHER_ACTIVE_HOST_H_ +#define ASH_COMPONENTS_TETHER_ACTIVE_HOST_H_ #include <string> @@ -165,4 +165,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_ACTIVE_HOST_H_ +#endif // ASH_COMPONENTS_TETHER_ACTIVE_HOST_H_
diff --git a/chromeos/components/tether/active_host_network_state_updater.cc b/ash/components/tether/active_host_network_state_updater.cc similarity index 95% rename from chromeos/components/tether/active_host_network_state_updater.cc rename to ash/components/tether/active_host_network_state_updater.cc index fdbe5be..58394db 100644 --- a/chromeos/components/tether/active_host_network_state_updater.cc +++ b/ash/components/tether/active_host_network_state_updater.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/active_host_network_state_updater.h" +#include "ash/components/tether/active_host_network_state_updater.h" +#include "ash/components/tether/active_host.h" #include "base/memory/ptr_util.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/active_host.h" #include "chromeos/network/network_state_handler.h" namespace chromeos {
diff --git a/chromeos/components/tether/active_host_network_state_updater.h b/ash/components/tether/active_host_network_state_updater.h similarity index 79% rename from chromeos/components/tether/active_host_network_state_updater.h rename to ash/components/tether/active_host_network_state_updater.h index 6f3a5279..123ee99 100644 --- a/chromeos/components/tether/active_host_network_state_updater.h +++ b/ash/components/tether/active_host_network_state_updater.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_ACTIVE_HOST_NETWORK_STATE_UPDATER_H_ -#define CHROMEOS_COMPONENTS_TETHER_ACTIVE_HOST_NETWORK_STATE_UPDATER_H_ +#ifndef ASH_COMPONENTS_TETHER_ACTIVE_HOST_NETWORK_STATE_UPDATER_H_ +#define ASH_COMPONENTS_TETHER_ACTIVE_HOST_NETWORK_STATE_UPDATER_H_ +#include "ash/components/tether/active_host.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/tether/active_host.h" namespace chromeos { @@ -40,4 +40,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_ACTIVE_HOST_NETWORK_STATE_UPDATER_H_ +#endif // ASH_COMPONENTS_TETHER_ACTIVE_HOST_NETWORK_STATE_UPDATER_H_
diff --git a/chromeos/components/tether/active_host_network_state_updater_unittest.cc b/ash/components/tether/active_host_network_state_updater_unittest.cc similarity index 96% rename from chromeos/components/tether/active_host_network_state_updater_unittest.cc rename to ash/components/tether/active_host_network_state_updater_unittest.cc index c71a3d9..eccefca 100644 --- a/chromeos/components/tether/active_host_network_state_updater_unittest.cc +++ b/ash/components/tether/active_host_network_state_updater_unittest.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/active_host_network_state_updater.h" +#include "ash/components/tether/active_host_network_state_updater.h" #include <memory> +#include "ash/components/tether/fake_active_host.h" #include "base/logging.h" #include "base/memory/ptr_util.h" #include "base/test/task_environment.h" -#include "chromeos/components/tether/fake_active_host.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_state_test_helper.h"
diff --git a/chromeos/components/tether/active_host_unittest.cc b/ash/components/tether/active_host_unittest.cc similarity index 98% rename from chromeos/components/tether/active_host_unittest.cc rename to ash/components/tether/active_host_unittest.cc index 5f2d9d8..55d6ca5 100644 --- a/chromeos/components/tether/active_host_unittest.cc +++ b/ash/components/tether/active_host_unittest.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/active_host.h" +#include "ash/components/tether/active_host.h" #include <memory> +#include "ash/components/tether/fake_tether_host_fetcher.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/fake_tether_host_fetcher.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chromeos/components/tether/asynchronous_shutdown_object_container.h b/ash/components/tether/asynchronous_shutdown_object_container.h similarity index 85% rename from chromeos/components/tether/asynchronous_shutdown_object_container.h rename to ash/components/tether/asynchronous_shutdown_object_container.h index 3754d09..fff0e28 100644 --- a/chromeos/components/tether/asynchronous_shutdown_object_container.h +++ b/ash/components/tether/asynchronous_shutdown_object_container.h
@@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ -#define CHROMEOS_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#ifndef ASH_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#define ASH_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ + +#include "base/callback_forward.h" namespace chromeos { @@ -45,4 +47,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#endif // ASH_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_
diff --git a/chromeos/components/tether/asynchronous_shutdown_object_container_impl.cc b/ash/components/tether/asynchronous_shutdown_object_container_impl.cc similarity index 94% rename from chromeos/components/tether/asynchronous_shutdown_object_container_impl.cc rename to ash/components/tether/asynchronous_shutdown_object_container_impl.cc index 1a81a82..f27f4ef 100644 --- a/chromeos/components/tether/asynchronous_shutdown_object_container_impl.cc +++ b/ash/components/tether/asynchronous_shutdown_object_container_impl.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/asynchronous_shutdown_object_container_impl.h" +#include "ash/components/tether/asynchronous_shutdown_object_container_impl.h" +#include "ash/components/tether/disconnect_tethering_request_sender_impl.h" +#include "ash/components/tether/network_configuration_remover.h" +#include "ash/components/tether/wifi_hotspot_disconnector_impl.h" #include "base/memory/ptr_util.h" -#include "chromeos/components/tether/disconnect_tethering_request_sender_impl.h" -#include "chromeos/components/tether/network_configuration_remover.h" -#include "chromeos/components/tether/wifi_hotspot_disconnector_impl.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h"
diff --git a/chromeos/components/tether/asynchronous_shutdown_object_container_impl.h b/ash/components/tether/asynchronous_shutdown_object_container_impl.h similarity index 90% rename from chromeos/components/tether/asynchronous_shutdown_object_container_impl.h rename to ash/components/tether/asynchronous_shutdown_object_container_impl.h index 0eaa290..a4ee59b1 100644 --- a/chromeos/components/tether/asynchronous_shutdown_object_container_impl.h +++ b/ash/components/tether/asynchronous_shutdown_object_container_impl.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ #include <memory> +#include "ash/components/tether/asynchronous_shutdown_object_container.h" +#include "ash/components/tether/disconnect_tethering_request_sender.h" #include "base/callback.h" #include "base/memory/ref_counted.h" -#include "chromeos/components/tether/asynchronous_shutdown_object_container.h" -#include "chromeos/components/tether/disconnect_tethering_request_sender.h" class PrefService; @@ -120,4 +120,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_
diff --git a/chromeos/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc b/ash/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc similarity index 95% rename from chromeos/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc rename to ash/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc index c1763e9..d260a66 100644 --- a/chromeos/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc +++ b/ash/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/asynchronous_shutdown_object_container_impl.h" +#include "ash/components/tether/asynchronous_shutdown_object_container_impl.h" #include <memory> +#include "ash/components/tether/fake_disconnect_tethering_request_sender.h" +#include "ash/components/tether/fake_tether_host_fetcher.h" +#include "ash/components/tether/tether_component_impl.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/test/task_environment.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/fake_disconnect_tethering_request_sender.h" -#include "chromeos/components/tether/fake_tether_host_fetcher.h" -#include "chromeos/components/tether/tether_component_impl.h" #include "chromeos/services/device_sync/fake_remote_device_provider.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/device_sync/remote_device_provider_impl.h"
diff --git a/chromeos/components/tether/connect_tethering_operation.cc b/ash/components/tether/connect_tethering_operation.cc similarity index 97% rename from chromeos/components/tether/connect_tethering_operation.cc rename to ash/components/tether/connect_tethering_operation.cc index bdbcba0..fa849d5 100644 --- a/chromeos/components/tether/connect_tethering_operation.cc +++ b/ash/components/tether/connect_tethering_operation.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/connect_tethering_operation.h" +#include "ash/components/tether/connect_tethering_operation.h" +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/proto/tether.pb.h" +#include "ash/components/tether/tether_host_response_recorder.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/time/default_clock.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/proto/tether.pb.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" namespace chromeos {
diff --git a/chromeos/components/tether/connect_tethering_operation.h b/ash/components/tether/connect_tethering_operation.h similarity index 95% rename from chromeos/components/tether/connect_tethering_operation.h rename to ash/components/tether/connect_tethering_operation.h index 0e3f0bb3..9b48c9e 100644 --- a/chromeos/components/tether/connect_tethering_operation.h +++ b/ash/components/tether/connect_tethering_operation.h
@@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_CONNECT_TETHERING_OPERATION_H_ -#define CHROMEOS_COMPONENTS_TETHER_CONNECT_TETHERING_OPERATION_H_ +#ifndef ASH_COMPONENTS_TETHER_CONNECT_TETHERING_OPERATION_H_ +#define ASH_COMPONENTS_TETHER_CONNECT_TETHERING_OPERATION_H_ #include <stdint.h> #include <map> #include <vector> +#include "ash/components/tether/message_transfer_operation.h" #include "base/gtest_prod_util.h" #include "base/observer_list.h" #include "base/time/clock.h" #include "base/time/time.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/message_transfer_operation.h" namespace chromeos { @@ -168,4 +168,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_CONNECT_TETHERING_OPERATION_H_ +#endif // ASH_COMPONENTS_TETHER_CONNECT_TETHERING_OPERATION_H_
diff --git a/chromeos/components/tether/connect_tethering_operation_unittest.cc b/ash/components/tether/connect_tethering_operation_unittest.cc similarity index 96% rename from chromeos/components/tether/connect_tethering_operation_unittest.cc rename to ash/components/tether/connect_tethering_operation_unittest.cc index 8ac3118..19c941d0 100644 --- a/chromeos/components/tether/connect_tethering_operation_unittest.cc +++ b/ash/components/tether/connect_tethering_operation_unittest.cc
@@ -2,11 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/connect_tethering_operation.h" +#include "ash/components/tether/connect_tethering_operation.h" #include <memory> #include <vector> +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/mock_tether_host_response_recorder.h" +#include "ash/components/tether/proto/tether.pb.h" +#include "ash/components/tether/proto_test_util.h" +#include "ash/components/tether/test_timer_factory.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/simple_test_clock.h" @@ -14,11 +19,6 @@ #include "base/time/time.h" #include "base/timer/mock_timer.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/mock_tether_host_response_recorder.h" -#include "chromeos/components/tether/proto/tether.pb.h" -#include "chromeos/components/tether/proto_test_util.h" -#include "chromeos/components/tether/test_timer_factory.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h"
diff --git a/chromeos/components/tether/connection_preserver.cc b/ash/components/tether/connection_preserver.cc similarity index 85% rename from chromeos/components/tether/connection_preserver.cc rename to ash/components/tether/connection_preserver.cc index 88b4c6c2..556c1ee 100644 --- a/chromeos/components/tether/connection_preserver.cc +++ b/ash/components/tether/connection_preserver.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 "chromeos/components/tether/connection_preserver.h" +#include "ash/components/tether/connection_preserver.h" namespace chromeos {
diff --git a/chromeos/components/tether/connection_preserver.h b/ash/components/tether/connection_preserver.h similarity index 85% rename from chromeos/components/tether/connection_preserver.h rename to ash/components/tether/connection_preserver.h index 6e671ef..fd0d9abd 100644 --- a/chromeos/components/tether/connection_preserver.h +++ b/ash/components/tether/connection_preserver.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 CHROMEOS_COMPONENTS_TETHER_CONNECTION_PRESERVER_H_ -#define CHROMEOS_COMPONENTS_TETHER_CONNECTION_PRESERVER_H_ +#ifndef ASH_COMPONENTS_TETHER_CONNECTION_PRESERVER_H_ +#define ASH_COMPONENTS_TETHER_CONNECTION_PRESERVER_H_ #include <memory> @@ -34,4 +34,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_CONNECTION_PRESERVER_H_ +#endif // ASH_COMPONENTS_TETHER_CONNECTION_PRESERVER_H_
diff --git a/chromeos/components/tether/connection_preserver_impl.cc b/ash/components/tether/connection_preserver_impl.cc similarity index 98% rename from chromeos/components/tether/connection_preserver_impl.cc rename to ash/components/tether/connection_preserver_impl.cc index dc06ee4a..4c9fe99 100644 --- a/chromeos/components/tether/connection_preserver_impl.cc +++ b/ash/components/tether/connection_preserver_impl.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/connection_preserver_impl.h" +#include "ash/components/tether/connection_preserver_impl.h" +#include "ash/components/tether/tether_host_response_recorder.h" #include "base/bind.h" #include "base/timer/timer.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_type_pattern.h"
diff --git a/chromeos/components/tether/connection_preserver_impl.h b/ash/components/tether/connection_preserver_impl.h similarity index 92% rename from chromeos/components/tether/connection_preserver_impl.h rename to ash/components/tether/connection_preserver_impl.h index 5abe35a..914b575c 100644 --- a/chromeos/components/tether/connection_preserver_impl.h +++ b/ash/components/tether/connection_preserver_impl.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_CONNECTION_PRESERVER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_CONNECTION_PRESERVER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_CONNECTION_PRESERVER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_CONNECTION_PRESERVER_IMPL_H_ #include <memory> +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/connection_preserver.h" #include "base/timer/timer.h" #include "base/unguessable_token.h" -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/connection_preserver.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" #include "chromeos/services/secure_channel/public/cpp/client/connection_attempt.h" @@ -106,4 +106,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_CONNECTION_PRESERVER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_CONNECTION_PRESERVER_IMPL_H_
diff --git a/chromeos/components/tether/connection_preserver_impl_unittest.cc b/ash/components/tether/connection_preserver_impl_unittest.cc similarity index 97% rename from chromeos/components/tether/connection_preserver_impl_unittest.cc rename to ash/components/tether/connection_preserver_impl_unittest.cc index 4f029db..ea4cd1e 100644 --- a/chromeos/components/tether/connection_preserver_impl_unittest.cc +++ b/ash/components/tether/connection_preserver_impl_unittest.cc
@@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/connection_preserver_impl.h" +#include "ash/components/tether/connection_preserver_impl.h" #include <memory> +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/mock_tether_host_response_recorder.h" +#include "ash/components/tether/timer_factory.h" #include "base/base64.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/test/task_environment.h" #include "base/timer/mock_timer.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/mock_tether_host_response_recorder.h" -#include "chromeos/components/tether/timer_factory.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_state_test_helper.h"
diff --git a/chromeos/components/tether/crash_recovery_manager.h b/ash/components/tether/crash_recovery_manager.h similarity index 84% rename from chromeos/components/tether/crash_recovery_manager.h rename to ash/components/tether/crash_recovery_manager.h index aad135c..33e1e3e 100644 --- a/chromeos/components/tether/crash_recovery_manager.h +++ b/ash/components/tether/crash_recovery_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 CHROMEOS_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_H_ -#define CHROMEOS_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_H_ +#ifndef ASH_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_H_ +#define ASH_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_H_ #include "base/callback.h" @@ -36,4 +36,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_H_ +#endif // ASH_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_H_
diff --git a/chromeos/components/tether/crash_recovery_manager_impl.cc b/ash/components/tether/crash_recovery_manager_impl.cc similarity index 98% rename from chromeos/components/tether/crash_recovery_manager_impl.cc rename to ash/components/tether/crash_recovery_manager_impl.cc index 7257169..da154c6 100644 --- a/chromeos/components/tether/crash_recovery_manager_impl.cc +++ b/ash/components/tether/crash_recovery_manager_impl.cc
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/crash_recovery_manager_impl.h" +#include "ash/components/tether/crash_recovery_manager_impl.h" #include <memory> +#include "ash/components/tether/host_scan_cache.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/host_scan_cache.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h"
diff --git a/chromeos/components/tether/crash_recovery_manager_impl.h b/ash/components/tether/crash_recovery_manager_impl.h similarity index 88% rename from chromeos/components/tether/crash_recovery_manager_impl.h rename to ash/components/tether/crash_recovery_manager_impl.h index e1a9201..74adcc9 100644 --- a/chromeos/components/tether/crash_recovery_manager_impl.h +++ b/ash/components/tether/crash_recovery_manager_impl.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_IMPL_H_ #include <string> +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/crash_recovery_manager.h" #include "base/callback.h" -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/crash_recovery_manager.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos { @@ -80,4 +80,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_CRASH_RECOVERY_MANAGER_IMPL_H_
diff --git a/chromeos/components/tether/crash_recovery_manager_impl_unittest.cc b/ash/components/tether/crash_recovery_manager_impl_unittest.cc similarity index 94% rename from chromeos/components/tether/crash_recovery_manager_impl_unittest.cc rename to ash/components/tether/crash_recovery_manager_impl_unittest.cc index 5f250cab..a56c7cb 100644 --- a/chromeos/components/tether/crash_recovery_manager_impl_unittest.cc +++ b/ash/components/tether/crash_recovery_manager_impl_unittest.cc
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/crash_recovery_manager_impl.h" +#include "ash/components/tether/crash_recovery_manager_impl.h" #include <memory> #include <sstream> +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/host_scan_cache_entry.h" #include "base/bind.h" #include "base/test/task_environment.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/fake_host_scan_cache.h" -#include "chromeos/components/tether/host_scan_cache_entry.h" #include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_state_test_helper.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/device_id_tether_network_guid_map.cc b/ash/components/tether/device_id_tether_network_guid_map.cc similarity index 91% rename from chromeos/components/tether/device_id_tether_network_guid_map.cc rename to ash/components/tether/device_id_tether_network_guid_map.cc index 3d04b681..e6ae272 100644 --- a/chromeos/components/tether/device_id_tether_network_guid_map.cc +++ b/ash/components/tether/device_id_tether_network_guid_map.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 "chromeos/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/device_id_tether_network_guid_map.h" namespace chromeos {
diff --git a/chromeos/components/tether/device_id_tether_network_guid_map.h b/ash/components/tether/device_id_tether_network_guid_map.h similarity index 84% rename from chromeos/components/tether/device_id_tether_network_guid_map.h rename to ash/components/tether/device_id_tether_network_guid_map.h index dace078..c9091fa 100644 --- a/chromeos/components/tether/device_id_tether_network_guid_map.h +++ b/ash/components/tether/device_id_tether_network_guid_map.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 CHROMEOS_COMPONENTS_TETHER_DEVICE_ID_TETHER_NETWORK_GUID_MAP_H_ -#define CHROMEOS_COMPONENTS_TETHER_DEVICE_ID_TETHER_NETWORK_GUID_MAP_H_ +#ifndef ASH_COMPONENTS_TETHER_DEVICE_ID_TETHER_NETWORK_GUID_MAP_H_ +#define ASH_COMPONENTS_TETHER_DEVICE_ID_TETHER_NETWORK_GUID_MAP_H_ #include <string> @@ -39,4 +39,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_DEVICE_ID_TETHER_NETWORK_GUID_MAP_H_ +#endif // ASH_COMPONENTS_TETHER_DEVICE_ID_TETHER_NETWORK_GUID_MAP_H_
diff --git a/chromeos/components/tether/device_status_util.cc b/ash/components/tether/device_status_util.cc similarity index 96% rename from chromeos/components/tether/device_status_util.cc rename to ash/components/tether/device_status_util.cc index 6a6dfd87..662c05d 100644 --- a/chromeos/components/tether/device_status_util.cc +++ b/ash/components/tether/device_status_util.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 "chromeos/components/tether/device_status_util.h" +#include "ash/components/tether/device_status_util.h" #include "base/cxx17_backports.h"
diff --git a/chromeos/components/tether/device_status_util.h b/ash/components/tether/device_status_util.h similarity index 87% rename from chromeos/components/tether/device_status_util.h rename to ash/components/tether/device_status_util.h index 4b0c0a0..4f7edfd8 100644 --- a/chromeos/components/tether/device_status_util.h +++ b/ash/components/tether/device_status_util.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_DEVICE_STATUS_UTIL_H_ -#define CHROMEOS_COMPONENTS_TETHER_DEVICE_STATUS_UTIL_H_ +#ifndef ASH_COMPONENTS_TETHER_DEVICE_STATUS_UTIL_H_ +#define ASH_COMPONENTS_TETHER_DEVICE_STATUS_UTIL_H_ -#include "chromeos/components/tether/proto/tether.pb.h" +#include "ash/components/tether/proto/tether.pb.h" namespace chromeos { @@ -36,4 +36,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_DEVICE_STATUS_UTIL_H_ +#endif // ASH_COMPONENTS_TETHER_DEVICE_STATUS_UTIL_H_
diff --git a/chromeos/components/tether/device_status_util_unittest.cc b/ash/components/tether/device_status_util_unittest.cc similarity index 94% rename from chromeos/components/tether/device_status_util_unittest.cc rename to ash/components/tether/device_status_util_unittest.cc index ef89826..a5b4042 100644 --- a/chromeos/components/tether/device_status_util_unittest.cc +++ b/ash/components/tether/device_status_util_unittest.cc
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/device_status_util.h" +#include "ash/components/tether/device_status_util.h" #include <memory> +#include "ash/components/tether/fake_tether_host_fetcher.h" +#include "ash/components/tether/proto_test_util.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/fake_tether_host_fetcher.h" -#include "chromeos/components/tether/proto_test_util.h" #include "components/prefs/testing_pref_service.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/disconnect_tethering_operation.cc b/ash/components/tether/disconnect_tethering_operation.cc similarity index 94% rename from chromeos/components/tether/disconnect_tethering_operation.cc rename to ash/components/tether/disconnect_tethering_operation.cc index a6577272..553d48c2 100644 --- a/chromeos/components/tether/disconnect_tethering_operation.cc +++ b/ash/components/tether/disconnect_tethering_operation.cc
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/disconnect_tethering_operation.h" +#include "ash/components/tether/disconnect_tethering_operation.h" #include <memory> +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/proto/tether.pb.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/time/default_clock.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/proto/tether.pb.h" namespace chromeos {
diff --git a/chromeos/components/tether/disconnect_tethering_operation.h b/ash/components/tether/disconnect_tethering_operation.h similarity index 91% rename from chromeos/components/tether/disconnect_tethering_operation.h rename to ash/components/tether/disconnect_tethering_operation.h index 57f7556f..0f6d05c 100644 --- a/chromeos/components/tether/disconnect_tethering_operation.h +++ b/ash/components/tether/disconnect_tethering_operation.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_ -#define CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_ +#ifndef ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_ +#define ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_ +#include "ash/components/tether/message_transfer_operation.h" #include "base/gtest_prod_util.h" #include "base/observer_list.h" #include "base/time/clock.h" -#include "chromeos/components/tether/message_transfer_operation.h" namespace chromeos { @@ -100,4 +100,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_ +#endif // ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_
diff --git a/chromeos/components/tether/disconnect_tethering_operation_unittest.cc b/ash/components/tether/disconnect_tethering_operation_unittest.cc similarity index 96% rename from chromeos/components/tether/disconnect_tethering_operation_unittest.cc rename to ash/components/tether/disconnect_tethering_operation_unittest.cc index 9e3277bc..7319384 100644 --- a/chromeos/components/tether/disconnect_tethering_operation_unittest.cc +++ b/ash/components/tether/disconnect_tethering_operation_unittest.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 "chromeos/components/tether/disconnect_tethering_operation.h" +#include "ash/components/tether/disconnect_tethering_operation.h" #include <memory> #include <vector> +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/proto/tether.pb.h" +#include "ash/components/tether/test_timer_factory.h" #include "base/containers/flat_map.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" @@ -14,9 +17,6 @@ #include "base/time/time.h" #include "base/timer/mock_timer.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/proto/tether.pb.h" -#include "chromeos/components/tether/test_timer_factory.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h"
diff --git a/chromeos/components/tether/disconnect_tethering_request_sender.cc b/ash/components/tether/disconnect_tethering_request_sender.cc similarity index 91% rename from chromeos/components/tether/disconnect_tethering_request_sender.cc rename to ash/components/tether/disconnect_tethering_request_sender.cc index ba8342a..aceed98 100644 --- a/chromeos/components/tether/disconnect_tethering_request_sender.cc +++ b/ash/components/tether/disconnect_tethering_request_sender.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 "chromeos/components/tether/disconnect_tethering_request_sender.h" +#include "ash/components/tether/disconnect_tethering_request_sender.h" namespace chromeos {
diff --git a/chromeos/components/tether/disconnect_tethering_request_sender.h b/ash/components/tether/disconnect_tethering_request_sender.h similarity index 85% rename from chromeos/components/tether/disconnect_tethering_request_sender.h rename to ash/components/tether/disconnect_tethering_request_sender.h index 339e505..93a839a 100644 --- a/chromeos/components/tether/disconnect_tethering_request_sender.h +++ b/ash/components/tether/disconnect_tethering_request_sender.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 CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_H_ -#define CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_H_ +#ifndef ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_H_ +#define ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_H_ #include "base/observer_list.h" @@ -53,4 +53,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_H_ +#endif // ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_H_
diff --git a/chromeos/components/tether/disconnect_tethering_request_sender_impl.cc b/ash/components/tether/disconnect_tethering_request_sender_impl.cc similarity index 97% rename from chromeos/components/tether/disconnect_tethering_request_sender_impl.cc rename to ash/components/tether/disconnect_tethering_request_sender_impl.cc index 911af4f..b6fc9e3 100644 --- a/chromeos/components/tether/disconnect_tethering_request_sender_impl.cc +++ b/ash/components/tether/disconnect_tethering_request_sender_impl.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/disconnect_tethering_request_sender_impl.h" +#include "ash/components/tether/disconnect_tethering_request_sender_impl.h" #include <memory> +#include "ash/components/tether/tether_host_fetcher.h" #include "base/bind.h" #include "base/containers/contains.h" #include "base/memory/ptr_util.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/tether_host_fetcher.h" namespace chromeos {
diff --git a/chromeos/components/tether/disconnect_tethering_request_sender_impl.h b/ash/components/tether/disconnect_tethering_request_sender_impl.h similarity index 87% rename from chromeos/components/tether/disconnect_tethering_request_sender_impl.h rename to ash/components/tether/disconnect_tethering_request_sender_impl.h index 6b1d24ed..cc6742c 100644 --- a/chromeos/components/tether/disconnect_tethering_request_sender_impl.h +++ b/ash/components/tether/disconnect_tethering_request_sender_impl.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_IMPL_H_ #include <map> -#include "chromeos/components/tether/disconnect_tethering_operation.h" -#include "chromeos/components/tether/disconnect_tethering_request_sender.h" +#include "ash/components/tether/disconnect_tethering_operation.h" +#include "ash/components/tether/disconnect_tethering_request_sender.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos { @@ -90,4 +90,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_REQUEST_SENDER_IMPL_H_
diff --git a/chromeos/components/tether/disconnect_tethering_request_sender_impl_unittest.cc b/ash/components/tether/disconnect_tethering_request_sender_impl_unittest.cc similarity index 97% rename from chromeos/components/tether/disconnect_tethering_request_sender_impl_unittest.cc rename to ash/components/tether/disconnect_tethering_request_sender_impl_unittest.cc index efff6b5..edfcdfa 100644 --- a/chromeos/components/tether/disconnect_tethering_request_sender_impl_unittest.cc +++ b/ash/components/tether/disconnect_tethering_request_sender_impl_unittest.cc
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/disconnect_tethering_request_sender_impl.h" +#include "ash/components/tether/disconnect_tethering_request_sender_impl.h" #include <memory> +#include "ash/components/tether/disconnect_tethering_operation.h" +#include "ash/components/tether/disconnect_tethering_request_sender.h" +#include "ash/components/tether/fake_tether_host_fetcher.h" #include "base/memory/ptr_util.h" #include "base/test/task_environment.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/disconnect_tethering_operation.h" -#include "chromeos/components/tether/disconnect_tethering_request_sender.h" -#include "chromeos/components/tether/fake_tether_host_fetcher.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/fake_active_host.cc b/ash/components/tether/fake_active_host.cc similarity index 98% rename from chromeos/components/tether/fake_active_host.cc rename to ash/components/tether/fake_active_host.cc index 5930fa53..cdcd0fe9 100644 --- a/chromeos/components/tether/fake_active_host.cc +++ b/ash/components/tether/fake_active_host.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 "chromeos/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_active_host.h" #include <memory>
diff --git a/chromeos/components/tether/fake_active_host.h b/ash/components/tether/fake_active_host.h similarity index 88% rename from chromeos/components/tether/fake_active_host.h rename to ash/components/tether/fake_active_host.h index 3a307cf..6fb69ad 100644 --- a/chromeos/components/tether/fake_active_host.h +++ b/ash/components/tether/fake_active_host.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_ACTIVE_HOST_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_ACTIVE_HOST_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_ACTIVE_HOST_H_ +#define ASH_COMPONENTS_TETHER_FAKE_ACTIVE_HOST_H_ #include <string> +#include "ash/components/tether/active_host.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/tether/active_host.h" namespace chromeos { @@ -55,4 +55,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_ACTIVE_HOST_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_ACTIVE_HOST_H_
diff --git a/chromeos/components/tether/fake_asynchronous_shutdown_object_container.cc b/ash/components/tether/fake_asynchronous_shutdown_object_container.cc similarity index 93% rename from chromeos/components/tether/fake_asynchronous_shutdown_object_container.cc rename to ash/components/tether/fake_asynchronous_shutdown_object_container.cc index 748d01d..6048c6f 100644 --- a/chromeos/components/tether/fake_asynchronous_shutdown_object_container.cc +++ b/ash/components/tether/fake_asynchronous_shutdown_object_container.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 "chromeos/components/tether/fake_asynchronous_shutdown_object_container.h" +#include "ash/components/tether/fake_asynchronous_shutdown_object_container.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_asynchronous_shutdown_object_container.h b/ash/components/tether/fake_asynchronous_shutdown_object_container.h similarity index 88% rename from chromeos/components/tether/fake_asynchronous_shutdown_object_container.h rename to ash/components/tether/fake_asynchronous_shutdown_object_container.h index df330f3..5fa253c 100644 --- a/chromeos/components/tether/fake_asynchronous_shutdown_object_container.h +++ b/ash/components/tether/fake_asynchronous_shutdown_object_container.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#include "ash/components/tether/asynchronous_shutdown_object_container.h" #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" -#include "chromeos/components/tether/asynchronous_shutdown_object_container.h" namespace chromeos { @@ -75,4 +75,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_ASYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_
diff --git a/chromeos/components/tether/fake_connection_preserver.cc b/ash/components/tether/fake_connection_preserver.cc similarity index 89% rename from chromeos/components/tether/fake_connection_preserver.cc rename to ash/components/tether/fake_connection_preserver.cc index 3c7a966e..15bc8b2 100644 --- a/chromeos/components/tether/fake_connection_preserver.cc +++ b/ash/components/tether/fake_connection_preserver.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 "chromeos/components/tether/fake_connection_preserver.h" +#include "ash/components/tether/fake_connection_preserver.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_connection_preserver.h b/ash/components/tether/fake_connection_preserver.h similarity index 78% rename from chromeos/components/tether/fake_connection_preserver.h rename to ash/components/tether/fake_connection_preserver.h index 6fa8039..667f3bda 100644 --- a/chromeos/components/tether/fake_connection_preserver.h +++ b/ash/components/tether/fake_connection_preserver.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_CONNECTION_PRESERVER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_CONNECTION_PRESERVER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_CONNECTION_PRESERVER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_CONNECTION_PRESERVER_H_ #include <string> -#include "chromeos/components/tether/connection_preserver.h" +#include "ash/components/tether/connection_preserver.h" namespace chromeos { @@ -38,4 +38,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_CONNECTION_PRESERVER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_CONNECTION_PRESERVER_H_
diff --git a/chromeos/components/tether/fake_crash_recovery_manager.cc b/ash/components/tether/fake_crash_recovery_manager.cc similarity index 89% rename from chromeos/components/tether/fake_crash_recovery_manager.cc rename to ash/components/tether/fake_crash_recovery_manager.cc index 2fd46e2..414403a4 100644 --- a/chromeos/components/tether/fake_crash_recovery_manager.cc +++ b/ash/components/tether/fake_crash_recovery_manager.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 "chromeos/components/tether/fake_crash_recovery_manager.h" +#include "ash/components/tether/fake_crash_recovery_manager.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_crash_recovery_manager.h b/ash/components/tether/fake_crash_recovery_manager.h similarity index 77% rename from chromeos/components/tether/fake_crash_recovery_manager.h rename to ash/components/tether/fake_crash_recovery_manager.h index 7e3e27ab..e22c0f9 100644 --- a/chromeos/components/tether/fake_crash_recovery_manager.h +++ b/ash/components/tether/fake_crash_recovery_manager.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_CRASH_RECOVERY_MANAGER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_CRASH_RECOVERY_MANAGER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_CRASH_RECOVERY_MANAGER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_CRASH_RECOVERY_MANAGER_H_ +#include "ash/components/tether/crash_recovery_manager.h" #include "base/callback.h" -#include "chromeos/components/tether/crash_recovery_manager.h" namespace chromeos { @@ -38,4 +38,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_CRASH_RECOVERY_MANAGER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_CRASH_RECOVERY_MANAGER_H_
diff --git a/chromeos/components/tether/fake_disconnect_tethering_request_sender.cc b/ash/components/tether/fake_disconnect_tethering_request_sender.cc similarity index 91% rename from chromeos/components/tether/fake_disconnect_tethering_request_sender.cc rename to ash/components/tether/fake_disconnect_tethering_request_sender.cc index f6ca4dd7..4de05f9 100644 --- a/chromeos/components/tether/fake_disconnect_tethering_request_sender.cc +++ b/ash/components/tether/fake_disconnect_tethering_request_sender.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 "chromeos/components/tether/fake_disconnect_tethering_request_sender.h" +#include "ash/components/tether/fake_disconnect_tethering_request_sender.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_disconnect_tethering_request_sender.h b/ash/components/tether/fake_disconnect_tethering_request_sender.h similarity index 80% rename from chromeos/components/tether/fake_disconnect_tethering_request_sender.h rename to ash/components/tether/fake_disconnect_tethering_request_sender.h index 80ff3efe..4663526b 100644 --- a/chromeos/components/tether/fake_disconnect_tethering_request_sender.h +++ b/ash/components/tether/fake_disconnect_tethering_request_sender.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_DISCONNECT_TETHERING_REQUEST_SENDER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_DISCONNECT_TETHERING_REQUEST_SENDER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_DISCONNECT_TETHERING_REQUEST_SENDER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_DISCONNECT_TETHERING_REQUEST_SENDER_H_ #include <string> #include <vector> -#include "chromeos/components/tether/disconnect_tethering_request_sender.h" +#include "ash/components/tether/disconnect_tethering_request_sender.h" namespace chromeos { @@ -50,4 +50,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_DISCONNECT_TETHERING_REQUEST_SENDER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_DISCONNECT_TETHERING_REQUEST_SENDER_H_
diff --git a/chromeos/components/tether/fake_gms_core_notifications_state_tracker.cc b/ash/components/tether/fake_gms_core_notifications_state_tracker.cc similarity index 89% rename from chromeos/components/tether/fake_gms_core_notifications_state_tracker.cc rename to ash/components/tether/fake_gms_core_notifications_state_tracker.cc index b57619f..c01b05bc 100644 --- a/chromeos/components/tether/fake_gms_core_notifications_state_tracker.cc +++ b/ash/components/tether/fake_gms_core_notifications_state_tracker.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 "chromeos/components/tether/fake_gms_core_notifications_state_tracker.h" +#include "ash/components/tether/fake_gms_core_notifications_state_tracker.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_gms_core_notifications_state_tracker.h b/ash/components/tether/fake_gms_core_notifications_state_tracker.h similarity index 77% rename from chromeos/components/tether/fake_gms_core_notifications_state_tracker.h rename to ash/components/tether/fake_gms_core_notifications_state_tracker.h index 9f60c20..1bcb510 100644 --- a/chromeos/components/tether/fake_gms_core_notifications_state_tracker.h +++ b/ash/components/tether/fake_gms_core_notifications_state_tracker.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ #include <string> #include <vector> -#include "chromeos/components/tether/gms_core_notifications_state_tracker.h" +#include "ash/components/tether/gms_core_notifications_state_tracker.h" namespace chromeos { @@ -45,4 +45,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_
diff --git a/chromeos/components/tether/fake_host_scan_cache.cc b/ash/components/tether/fake_host_scan_cache.cc similarity index 96% rename from chromeos/components/tether/fake_host_scan_cache.cc rename to ash/components/tether/fake_host_scan_cache.cc index 33aa28e2..424d9b0 100644 --- a/chromeos/components/tether/fake_host_scan_cache.cc +++ b/ash/components/tether/fake_host_scan_cache.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 "chromeos/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/fake_host_scan_cache.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_host_scan_cache.h b/ash/components/tether/fake_host_scan_cache.h similarity index 85% rename from chromeos/components/tether/fake_host_scan_cache.h rename to ash/components/tether/fake_host_scan_cache.h index 95b41b5..1a66d976 100644 --- a/chromeos/components/tether/fake_host_scan_cache.h +++ b/ash/components/tether/fake_host_scan_cache.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_HOST_SCAN_CACHE_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_HOST_SCAN_CACHE_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_HOST_SCAN_CACHE_H_ +#define ASH_COMPONENTS_TETHER_FAKE_HOST_SCAN_CACHE_H_ #include <string> #include <unordered_map> #include <unordered_set> -#include "chromeos/components/tether/host_scan_cache.h" +#include "ash/components/tether/host_scan_cache.h" namespace chromeos { @@ -52,4 +52,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_HOST_SCAN_CACHE_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_HOST_SCAN_CACHE_H_
diff --git a/chromeos/components/tether/fake_host_scan_scheduler.cc b/ash/components/tether/fake_host_scan_scheduler.cc similarity index 87% rename from chromeos/components/tether/fake_host_scan_scheduler.cc rename to ash/components/tether/fake_host_scan_scheduler.cc index f65af25..a0af063 100644 --- a/chromeos/components/tether/fake_host_scan_scheduler.cc +++ b/ash/components/tether/fake_host_scan_scheduler.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 "chromeos/components/tether/fake_host_scan_scheduler.h" +#include "ash/components/tether/fake_host_scan_scheduler.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_host_scan_scheduler.h b/ash/components/tether/fake_host_scan_scheduler.h similarity index 74% rename from chromeos/components/tether/fake_host_scan_scheduler.h rename to ash/components/tether/fake_host_scan_scheduler.h index 8607a76..aa581eca 100644 --- a/chromeos/components/tether/fake_host_scan_scheduler.h +++ b/ash/components/tether/fake_host_scan_scheduler.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_HOST_SCAN_SCHEDULER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_HOST_SCAN_SCHEDULER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_HOST_SCAN_SCHEDULER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_HOST_SCAN_SCHEDULER_H_ -#include "chromeos/components/tether/host_scan_scheduler.h" +#include "ash/components/tether/host_scan_scheduler.h" namespace chromeos { @@ -34,4 +34,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_HOST_SCAN_SCHEDULER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_HOST_SCAN_SCHEDULER_H_
diff --git a/chromeos/components/tether/fake_host_scanner.cc b/ash/components/tether/fake_host_scanner.cc similarity index 92% rename from chromeos/components/tether/fake_host_scanner.cc rename to ash/components/tether/fake_host_scanner.cc index 8ce518c..c8977bb 100644 --- a/chromeos/components/tether/fake_host_scanner.cc +++ b/ash/components/tether/fake_host_scanner.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 "chromeos/components/tether/fake_host_scanner.h" +#include "ash/components/tether/fake_host_scanner.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_host_scanner.h b/ash/components/tether/fake_host_scanner.h similarity index 77% rename from chromeos/components/tether/fake_host_scanner.h rename to ash/components/tether/fake_host_scanner.h index ffc8fb7..b012efc0 100644 --- a/chromeos/components/tether/fake_host_scanner.h +++ b/ash/components/tether/fake_host_scanner.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_HOST_SCANNER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_HOST_SCANNER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_HOST_SCANNER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_HOST_SCANNER_H_ -#include "chromeos/components/tether/host_scanner.h" +#include "ash/components/tether/host_scanner.h" namespace chromeos { @@ -39,4 +39,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_HOST_SCANNER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_HOST_SCANNER_H_
diff --git a/chromeos/components/tether/fake_network_configuration_remover.cc b/ash/components/tether/fake_network_configuration_remover.cc similarity index 89% rename from chromeos/components/tether/fake_network_configuration_remover.cc rename to ash/components/tether/fake_network_configuration_remover.cc index 8c713fb..0a67404 100644 --- a/chromeos/components/tether/fake_network_configuration_remover.cc +++ b/ash/components/tether/fake_network_configuration_remover.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 "chromeos/components/tether/fake_network_configuration_remover.h" +#include "ash/components/tether/fake_network_configuration_remover.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_network_configuration_remover.h b/ash/components/tether/fake_network_configuration_remover.h similarity index 76% rename from chromeos/components/tether/fake_network_configuration_remover.h rename to ash/components/tether/fake_network_configuration_remover.h index 0ba05aa..bd3bbdb 100644 --- a/chromeos/components/tether/fake_network_configuration_remover.h +++ b/ash/components/tether/fake_network_configuration_remover.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_NETWORK_CONFIGURATION_REMOVER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_NETWORK_CONFIGURATION_REMOVER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_NETWORK_CONFIGURATION_REMOVER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_NETWORK_CONFIGURATION_REMOVER_H_ #include <string> -#include "chromeos/components/tether/network_configuration_remover.h" +#include "ash/components/tether/network_configuration_remover.h" namespace chromeos { @@ -41,4 +41,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_NETWORK_CONFIGURATION_REMOVER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_NETWORK_CONFIGURATION_REMOVER_H_
diff --git a/chromeos/components/tether/fake_notification_presenter.cc b/ash/components/tether/fake_notification_presenter.cc similarity index 97% rename from chromeos/components/tether/fake_notification_presenter.cc rename to ash/components/tether/fake_notification_presenter.cc index 1e84a29..6267b76 100644 --- a/chromeos/components/tether/fake_notification_presenter.cc +++ b/ash/components/tether/fake_notification_presenter.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 "chromeos/components/tether/fake_notification_presenter.h" +#include "ash/components/tether/fake_notification_presenter.h" #include "base/bind.h" #include "base/memory/ptr_util.h"
diff --git a/chromeos/components/tether/fake_notification_presenter.h b/ash/components/tether/fake_notification_presenter.h similarity index 88% rename from chromeos/components/tether/fake_notification_presenter.h rename to ash/components/tether/fake_notification_presenter.h index f4739c9..8f5efe3 100644 --- a/chromeos/components/tether/fake_notification_presenter.h +++ b/ash/components/tether/fake_notification_presenter.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_NOTIFICATION_PRESENTER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_NOTIFICATION_PRESENTER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_NOTIFICATION_PRESENTER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_NOTIFICATION_PRESENTER_H_ #include <memory> #include <string> -#include "chromeos/components/tether/notification_presenter.h" +#include "ash/components/tether/notification_presenter.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos { @@ -62,4 +62,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_NOTIFICATION_PRESENTER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_NOTIFICATION_PRESENTER_H_
diff --git a/chromeos/components/tether/fake_synchronous_shutdown_object_container.cc b/ash/components/tether/fake_synchronous_shutdown_object_container.cc similarity index 92% rename from chromeos/components/tether/fake_synchronous_shutdown_object_container.cc rename to ash/components/tether/fake_synchronous_shutdown_object_container.cc index ac1b6e4c..4a4757e 100644 --- a/chromeos/components/tether/fake_synchronous_shutdown_object_container.cc +++ b/ash/components/tether/fake_synchronous_shutdown_object_container.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 "chromeos/components/tether/fake_synchronous_shutdown_object_container.h" +#include "ash/components/tether/fake_synchronous_shutdown_object_container.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_synchronous_shutdown_object_container.h b/ash/components/tether/fake_synchronous_shutdown_object_container.h similarity index 85% rename from chromeos/components/tether/fake_synchronous_shutdown_object_container.h rename to ash/components/tether/fake_synchronous_shutdown_object_container.h index 6995a01..53cf969 100644 --- a/chromeos/components/tether/fake_synchronous_shutdown_object_container.h +++ b/ash/components/tether/fake_synchronous_shutdown_object_container.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#include "ash/components/tether/synchronous_shutdown_object_container.h" #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" -#include "chromeos/components/tether/synchronous_shutdown_object_container.h" namespace chromeos { @@ -62,4 +62,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_
diff --git a/chromeos/components/tether/fake_tether_component.cc b/ash/components/tether/fake_tether_component.cc similarity index 93% rename from chromeos/components/tether/fake_tether_component.cc rename to ash/components/tether/fake_tether_component.cc index a5cac88..10e83cd 100644 --- a/chromeos/components/tether/fake_tether_component.cc +++ b/ash/components/tether/fake_tether_component.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 "chromeos/components/tether/fake_tether_component.h" +#include "ash/components/tether/fake_tether_component.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_tether_component.h b/ash/components/tether/fake_tether_component.h similarity index 78% rename from chromeos/components/tether/fake_tether_component.h rename to ash/components/tether/fake_tether_component.h index 1e8b0c5e..c664f12 100644 --- a/chromeos/components/tether/fake_tether_component.h +++ b/ash/components/tether/fake_tether_component.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_COMPONENT_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_COMPONENT_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_TETHER_COMPONENT_H_ +#define ASH_COMPONENTS_TETHER_FAKE_TETHER_COMPONENT_H_ -#include "chromeos/components/tether/tether_component.h" -#include "chromeos/components/tether/tether_disconnector.h" +#include "ash/components/tether/tether_component.h" +#include "ash/components/tether/tether_disconnector.h" namespace chromeos { @@ -43,4 +43,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_COMPONENT_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_TETHER_COMPONENT_H_
diff --git a/chromeos/components/tether/fake_tether_connector.cc b/ash/components/tether/fake_tether_connector.cc similarity index 93% rename from chromeos/components/tether/fake_tether_connector.cc rename to ash/components/tether/fake_tether_connector.cc index 3825b838..2838be9a 100644 --- a/chromeos/components/tether/fake_tether_connector.cc +++ b/ash/components/tether/fake_tether_connector.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 "chromeos/components/tether/fake_tether_connector.h" +#include "ash/components/tether/fake_tether_connector.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_tether_connector.h b/ash/components/tether/fake_tether_connector.h similarity index 86% rename from chromeos/components/tether/fake_tether_connector.h rename to ash/components/tether/fake_tether_connector.h index af569d4..746f4cf 100644 --- a/chromeos/components/tether/fake_tether_connector.h +++ b/ash/components/tether/fake_tether_connector.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_CONNECTOR_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_CONNECTOR_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_TETHER_CONNECTOR_H_ +#define ASH_COMPONENTS_TETHER_FAKE_TETHER_CONNECTOR_H_ +#include "ash/components/tether/tether_connector.h" #include "base/callback_forward.h" -#include "chromeos/components/tether/tether_connector.h" #include "chromeos/network/network_connection_handler.h" namespace chromeos { @@ -57,4 +57,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_CONNECTOR_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_TETHER_CONNECTOR_H_
diff --git a/chromeos/components/tether/fake_tether_disconnector.cc b/ash/components/tether/fake_tether_disconnector.cc similarity index 93% rename from chromeos/components/tether/fake_tether_disconnector.cc rename to ash/components/tether/fake_tether_disconnector.cc index e1a4d82..fb4bc795 100644 --- a/chromeos/components/tether/fake_tether_disconnector.cc +++ b/ash/components/tether/fake_tether_disconnector.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 "chromeos/components/tether/fake_tether_disconnector.h" +#include "ash/components/tether/fake_tether_disconnector.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_tether_disconnector.h b/ash/components/tether/fake_tether_disconnector.h similarity index 83% rename from chromeos/components/tether/fake_tether_disconnector.h rename to ash/components/tether/fake_tether_disconnector.h index d3f0ea6..b4033d5 100644 --- a/chromeos/components/tether/fake_tether_disconnector.h +++ b/ash/components/tether/fake_tether_disconnector.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_DISCONNECTOR_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_DISCONNECTOR_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_TETHER_DISCONNECTOR_H_ +#define ASH_COMPONENTS_TETHER_FAKE_TETHER_DISCONNECTOR_H_ +#include "ash/components/tether/tether_disconnector.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include "base/callback_forward.h" -#include "chromeos/components/tether/tether_disconnector.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" #include "chromeos/network/network_connection_handler.h" namespace chromeos { @@ -57,4 +57,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_DISCONNECTOR_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_TETHER_DISCONNECTOR_H_
diff --git a/chromeos/components/tether/fake_tether_host_fetcher.cc b/ash/components/tether/fake_tether_host_fetcher.cc similarity index 94% rename from chromeos/components/tether/fake_tether_host_fetcher.cc rename to ash/components/tether/fake_tether_host_fetcher.cc index ff33c7c..86b62af1 100644 --- a/chromeos/components/tether/fake_tether_host_fetcher.cc +++ b/ash/components/tether/fake_tether_host_fetcher.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 "chromeos/components/tether/fake_tether_host_fetcher.h" +#include "ash/components/tether/fake_tether_host_fetcher.h" #include "base/memory/ptr_util.h"
diff --git a/chromeos/components/tether/fake_tether_host_fetcher.h b/ash/components/tether/fake_tether_host_fetcher.h similarity index 83% rename from chromeos/components/tether/fake_tether_host_fetcher.h rename to ash/components/tether/fake_tether_host_fetcher.h index 12a4a17..bb3745e 100644 --- a/chromeos/components/tether/fake_tether_host_fetcher.h +++ b/ash/components/tether/fake_tether_host_fetcher.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_HOST_FETCHER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_HOST_FETCHER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_TETHER_HOST_FETCHER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_TETHER_HOST_FETCHER_H_ #include <vector> +#include "ash/components/tether/tether_host_fetcher.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/tether_host_fetcher.h" namespace chromeos { @@ -47,4 +47,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_HOST_FETCHER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_TETHER_HOST_FETCHER_H_
diff --git a/chromeos/components/tether/fake_tether_session_completion_logger.cc b/ash/components/tether/fake_tether_session_completion_logger.cc similarity index 88% rename from chromeos/components/tether/fake_tether_session_completion_logger.cc rename to ash/components/tether/fake_tether_session_completion_logger.cc index 301940d..4c4f8af 100644 --- a/chromeos/components/tether/fake_tether_session_completion_logger.cc +++ b/ash/components/tether/fake_tether_session_completion_logger.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 "chromeos/components/tether/fake_tether_session_completion_logger.h" +#include "ash/components/tether/fake_tether_session_completion_logger.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_tether_session_completion_logger.h b/ash/components/tether/fake_tether_session_completion_logger.h similarity index 78% rename from chromeos/components/tether/fake_tether_session_completion_logger.h rename to ash/components/tether/fake_tether_session_completion_logger.h index 220fb22..cba4c1c 100644 --- a/chromeos/components/tether/fake_tether_session_completion_logger.h +++ b/ash/components/tether/fake_tether_session_completion_logger.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_SESSION_COMPLETION_LOGGER_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_SESSION_COMPLETION_LOGGER_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_TETHER_SESSION_COMPLETION_LOGGER_H_ +#define ASH_COMPONENTS_TETHER_FAKE_TETHER_SESSION_COMPLETION_LOGGER_H_ #include <memory> -#include "chromeos/components/tether/tether_session_completion_logger.h" +#include "ash/components/tether/tether_session_completion_logger.h" namespace chromeos { @@ -43,4 +43,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_TETHER_SESSION_COMPLETION_LOGGER_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_TETHER_SESSION_COMPLETION_LOGGER_H_
diff --git a/chromeos/components/tether/fake_wifi_hotspot_connector.cc b/ash/components/tether/fake_wifi_hotspot_connector.cc similarity index 94% rename from chromeos/components/tether/fake_wifi_hotspot_connector.cc rename to ash/components/tether/fake_wifi_hotspot_connector.cc index 45b73a9..f35b3738 100644 --- a/chromeos/components/tether/fake_wifi_hotspot_connector.cc +++ b/ash/components/tether/fake_wifi_hotspot_connector.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 "chromeos/components/tether/fake_wifi_hotspot_connector.h" +#include "ash/components/tether/fake_wifi_hotspot_connector.h" #include "base/memory/ptr_util.h" #include "chromeos/network/network_state_handler.h"
diff --git a/chromeos/components/tether/fake_wifi_hotspot_connector.h b/ash/components/tether/fake_wifi_hotspot_connector.h similarity index 84% rename from chromeos/components/tether/fake_wifi_hotspot_connector.h rename to ash/components/tether/fake_wifi_hotspot_connector.h index a0ed76f..a2b9b86 100644 --- a/chromeos/components/tether/fake_wifi_hotspot_connector.h +++ b/ash/components/tether/fake_wifi_hotspot_connector.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_ +#define ASH_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_ #include <string> -#include "chromeos/components/tether/wifi_hotspot_connector.h" +#include "ash/components/tether/wifi_hotspot_connector.h" namespace chromeos { @@ -52,4 +52,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_CONNECTOR_H_
diff --git a/chromeos/components/tether/fake_wifi_hotspot_disconnector.cc b/ash/components/tether/fake_wifi_hotspot_disconnector.cc similarity index 91% rename from chromeos/components/tether/fake_wifi_hotspot_disconnector.cc rename to ash/components/tether/fake_wifi_hotspot_disconnector.cc index ab9d39c..29673c0e 100644 --- a/chromeos/components/tether/fake_wifi_hotspot_disconnector.cc +++ b/ash/components/tether/fake_wifi_hotspot_disconnector.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 "chromeos/components/tether/fake_wifi_hotspot_disconnector.h" +#include "ash/components/tether/fake_wifi_hotspot_disconnector.h" namespace chromeos {
diff --git a/chromeos/components/tether/fake_wifi_hotspot_disconnector.h b/ash/components/tether/fake_wifi_hotspot_disconnector.h similarity index 82% rename from chromeos/components/tether/fake_wifi_hotspot_disconnector.h rename to ash/components/tether/fake_wifi_hotspot_disconnector.h index 38c761f..e1c1fd3f 100644 --- a/chromeos/components/tether/fake_wifi_hotspot_disconnector.h +++ b/ash/components/tether/fake_wifi_hotspot_disconnector.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_DISCONNECTOR_H_ -#define CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_DISCONNECTOR_H_ +#ifndef ASH_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_DISCONNECTOR_H_ +#define ASH_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_DISCONNECTOR_H_ +#include "ash/components/tether/wifi_hotspot_disconnector.h" #include "base/callback.h" -#include "chromeos/components/tether/wifi_hotspot_disconnector.h" namespace chromeos { @@ -46,4 +46,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_DISCONNECTOR_H_ +#endif // ASH_COMPONENTS_TETHER_FAKE_WIFI_HOTSPOT_DISCONNECTOR_H_
diff --git a/chromeos/components/tether/gms_core_notifications_state_tracker.cc b/ash/components/tether/gms_core_notifications_state_tracker.cc similarity index 91% rename from chromeos/components/tether/gms_core_notifications_state_tracker.cc rename to ash/components/tether/gms_core_notifications_state_tracker.cc index dbf2c0f..5606b6b 100644 --- a/chromeos/components/tether/gms_core_notifications_state_tracker.cc +++ b/ash/components/tether/gms_core_notifications_state_tracker.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 "chromeos/components/tether/gms_core_notifications_state_tracker.h" +#include "ash/components/tether/gms_core_notifications_state_tracker.h" namespace chromeos {
diff --git a/chromeos/components/tether/gms_core_notifications_state_tracker.h b/ash/components/tether/gms_core_notifications_state_tracker.h similarity index 86% rename from chromeos/components/tether/gms_core_notifications_state_tracker.h rename to ash/components/tether/gms_core_notifications_state_tracker.h index 595b6f09..2bc6745 100644 --- a/chromeos/components/tether/gms_core_notifications_state_tracker.h +++ b/ash/components/tether/gms_core_notifications_state_tracker.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 CHROMEOS_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ -#define CHROMEOS_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ +#ifndef ASH_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ +#define ASH_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ #include <string> #include <vector> @@ -53,4 +53,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_ +#endif // ASH_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_H_
diff --git a/chromeos/components/tether/gms_core_notifications_state_tracker_impl.cc b/ash/components/tether/gms_core_notifications_state_tracker_impl.cc similarity index 97% rename from chromeos/components/tether/gms_core_notifications_state_tracker_impl.cc rename to ash/components/tether/gms_core_notifications_state_tracker_impl.cc index 99e5a9b..f3f32be 100644 --- a/chromeos/components/tether/gms_core_notifications_state_tracker_impl.cc +++ b/ash/components/tether/gms_core_notifications_state_tracker_impl.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 "chromeos/components/tether/gms_core_notifications_state_tracker_impl.h" +#include "ash/components/tether/gms_core_notifications_state_tracker_impl.h" #include <sstream>
diff --git a/chromeos/components/tether/gms_core_notifications_state_tracker_impl.h b/ash/components/tether/gms_core_notifications_state_tracker_impl.h similarity index 79% rename from chromeos/components/tether/gms_core_notifications_state_tracker_impl.h rename to ash/components/tether/gms_core_notifications_state_tracker_impl.h index 1fae997..3bf25b94 100644 --- a/chromeos/components/tether/gms_core_notifications_state_tracker_impl.h +++ b/ash/components/tether/gms_core_notifications_state_tracker_impl.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_IMPL_H_ #include <map> #include <string> #include <vector> +#include "ash/components/tether/gms_core_notifications_state_tracker.h" +#include "ash/components/tether/host_scanner_operation.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/gms_core_notifications_state_tracker.h" -#include "chromeos/components/tether/host_scanner_operation.h" namespace chromeos { @@ -56,4 +56,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_GMS_CORE_NOTIFICATIONS_STATE_TRACKER_IMPL_H_
diff --git a/chromeos/components/tether/gms_core_notifications_state_tracker_impl_unittest.cc b/ash/components/tether/gms_core_notifications_state_tracker_impl_unittest.cc similarity index 98% rename from chromeos/components/tether/gms_core_notifications_state_tracker_impl_unittest.cc rename to ash/components/tether/gms_core_notifications_state_tracker_impl_unittest.cc index d1b96b0..6d94fe4 100644 --- a/chromeos/components/tether/gms_core_notifications_state_tracker_impl_unittest.cc +++ b/ash/components/tether/gms_core_notifications_state_tracker_impl_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 "chromeos/components/tether/gms_core_notifications_state_tracker_impl.h" +#include "ash/components/tether/gms_core_notifications_state_tracker_impl.h" #include <memory> #include <sstream>
diff --git a/chromeos/components/tether/host_connection_metrics_logger.cc b/ash/components/tether/host_connection_metrics_logger.cc similarity index 98% rename from chromeos/components/tether/host_connection_metrics_logger.cc rename to ash/components/tether/host_connection_metrics_logger.cc index e7fe1d98..f9994e39 100644 --- a/chromeos/components/tether/host_connection_metrics_logger.cc +++ b/ash/components/tether/host_connection_metrics_logger.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 "chromeos/components/tether/host_connection_metrics_logger.h" +#include "ash/components/tether/host_connection_metrics_logger.h" #include "base/metrics/histogram_macros.h" #include "base/time/default_clock.h"
diff --git a/chromeos/components/tether/host_connection_metrics_logger.h b/ash/components/tether/host_connection_metrics_logger.h similarity index 96% rename from chromeos/components/tether/host_connection_metrics_logger.h rename to ash/components/tether/host_connection_metrics_logger.h index 0d8b2a9..6506387c 100644 --- a/chromeos/components/tether/host_connection_metrics_logger.h +++ b/ash/components/tether/host_connection_metrics_logger.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_HOST_CONNECTION_METRICS_LOGGER_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_CONNECTION_METRICS_LOGGER_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_CONNECTION_METRICS_LOGGER_H_ +#define ASH_COMPONENTS_TETHER_HOST_CONNECTION_METRICS_LOGGER_H_ #include <map> #include <string> +#include "ash/components/tether/active_host.h" #include "base/gtest_prod_util.h" -#include "chromeos/components/tether/active_host.h" namespace base { class Clock; @@ -212,4 +212,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_CONNECTION_METRICS_LOGGER_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_CONNECTION_METRICS_LOGGER_H_
diff --git a/chromeos/components/tether/host_connection_metrics_logger_unittest.cc b/ash/components/tether/host_connection_metrics_logger_unittest.cc similarity index 98% rename from chromeos/components/tether/host_connection_metrics_logger_unittest.cc rename to ash/components/tether/host_connection_metrics_logger_unittest.cc index 4feb82c..7900606c 100644 --- a/chromeos/components/tether/host_connection_metrics_logger_unittest.cc +++ b/ash/components/tether/host_connection_metrics_logger_unittest.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/host_connection_metrics_logger.h" +#include "ash/components/tether/host_connection_metrics_logger.h" #include <memory> +#include "ash/components/tether/fake_active_host.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/simple_test_clock.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/fake_active_host.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/components/tether/host_scan_cache.cc b/ash/components/tether/host_scan_cache.cc similarity index 93% rename from chromeos/components/tether/host_scan_cache.cc rename to ash/components/tether/host_scan_cache.cc index b00b657..925633ed 100644 --- a/chromeos/components/tether/host_scan_cache.cc +++ b/ash/components/tether/host_scan_cache.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 "chromeos/components/tether/host_scan_cache.h" +#include "ash/components/tether/host_scan_cache.h" namespace chromeos {
diff --git a/chromeos/components/tether/host_scan_cache.h b/ash/components/tether/host_scan_cache.h similarity index 90% rename from chromeos/components/tether/host_scan_cache.h rename to ash/components/tether/host_scan_cache.h index c00c0fd..0af3073 100644 --- a/chromeos/components/tether/host_scan_cache.h +++ b/ash/components/tether/host_scan_cache.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_CACHE_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_CACHE_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCAN_CACHE_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCAN_CACHE_H_ #include <string> #include <unordered_set> +#include "ash/components/tether/host_scan_cache_entry.h" #include "base/observer_list.h" -#include "chromeos/components/tether/host_scan_cache_entry.h" namespace chromeos { @@ -68,4 +68,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_CACHE_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCAN_CACHE_H_
diff --git a/chromeos/components/tether/host_scan_cache_entry.cc b/ash/components/tether/host_scan_cache_entry.cc similarity index 97% rename from chromeos/components/tether/host_scan_cache_entry.cc rename to ash/components/tether/host_scan_cache_entry.cc index 6f9a4fd..6f1fab2 100644 --- a/chromeos/components/tether/host_scan_cache_entry.cc +++ b/ash/components/tether/host_scan_cache_entry.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 "chromeos/components/tether/host_scan_cache_entry.h" +#include "ash/components/tether/host_scan_cache_entry.h" #include "base/check_op.h" #include "base/memory/ptr_util.h"
diff --git a/chromeos/components/tether/host_scan_cache_entry.h b/ash/components/tether/host_scan_cache_entry.h similarity index 92% rename from chromeos/components/tether/host_scan_cache_entry.h rename to ash/components/tether/host_scan_cache_entry.h index c9c7025..479ce59 100644 --- a/chromeos/components/tether/host_scan_cache_entry.h +++ b/ash/components/tether/host_scan_cache_entry.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 CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_CACHE_ENTRY_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_CACHE_ENTRY_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCAN_CACHE_ENTRY_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCAN_CACHE_ENTRY_H_ #include <memory> #include <string> @@ -77,4 +77,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_CACHE_ENTRY_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCAN_CACHE_ENTRY_H_
diff --git a/chromeos/components/tether/host_scan_cache_unittest.cc b/ash/components/tether/host_scan_cache_unittest.cc similarity index 93% rename from chromeos/components/tether/host_scan_cache_unittest.cc rename to ash/components/tether/host_scan_cache_unittest.cc index dd40366..b595dca2 100644 --- a/chromeos/components/tether/host_scan_cache_unittest.cc +++ b/ash/components/tether/host_scan_cache_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/host_scan_cache.h" +#include "ash/components/tether/host_scan_cache.h" #include <memory> #include <unordered_map> -#include "chromeos/components/tether/fake_host_scan_cache.h" -#include "chromeos/components/tether/host_scan_test_util.h" +#include "ash/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/host_scan_test_util.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/components/tether/host_scan_device_prioritizer.h b/ash/components/tether/host_scan_device_prioritizer.h similarity index 86% rename from chromeos/components/tether/host_scan_device_prioritizer.h rename to ash/components/tether/host_scan_device_prioritizer.h index 9a48285e..bf76fb0 100644 --- a/chromeos/components/tether/host_scan_device_prioritizer.h +++ b/ash/components/tether/host_scan_device_prioritizer.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 CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_H_ #include "chromeos/components/multidevice/remote_device_ref.h" @@ -38,4 +38,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_H_
diff --git a/chromeos/components/tether/host_scan_device_prioritizer_impl.cc b/ash/components/tether/host_scan_device_prioritizer_impl.cc similarity index 93% rename from chromeos/components/tether/host_scan_device_prioritizer_impl.cc rename to ash/components/tether/host_scan_device_prioritizer_impl.cc index 921dbd7..8cce097 100644 --- a/chromeos/components/tether/host_scan_device_prioritizer_impl.cc +++ b/ash/components/tether/host_scan_device_prioritizer_impl.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/host_scan_device_prioritizer_impl.h" +#include "ash/components/tether/host_scan_device_prioritizer_impl.h" +#include "ash/components/tether/pref_names.h" +#include "ash/components/tether/tether_host_response_recorder.h" #include "base/memory/ptr_util.h" #include "base/values.h" -#include "chromeos/components/tether/pref_names.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" #include "components/prefs/pref_registry_simple.h"
diff --git a/chromeos/components/tether/host_scan_device_prioritizer_impl.h b/ash/components/tether/host_scan_device_prioritizer_impl.h similarity index 77% rename from chromeos/components/tether/host_scan_device_prioritizer_impl.h rename to ash/components/tether/host_scan_device_prioritizer_impl.h index fd492dc5..2aaf368 100644 --- a/chromeos/components/tether/host_scan_device_prioritizer_impl.h +++ b/ash/components/tether/host_scan_device_prioritizer_impl.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_ +#include "ash/components/tether/host_scan_device_prioritizer.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/host_scan_device_prioritizer.h" namespace chromeos { @@ -38,4 +38,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCAN_DEVICE_PRIORITIZER_IMPL_H_
diff --git a/chromeos/components/tether/host_scan_device_prioritizer_impl_unittest.cc b/ash/components/tether/host_scan_device_prioritizer_impl_unittest.cc similarity index 97% rename from chromeos/components/tether/host_scan_device_prioritizer_impl_unittest.cc rename to ash/components/tether/host_scan_device_prioritizer_impl_unittest.cc index ccaee70..7523bb0 100644 --- a/chromeos/components/tether/host_scan_device_prioritizer_impl_unittest.cc +++ b/ash/components/tether/host_scan_device_prioritizer_impl_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/host_scan_device_prioritizer_impl.h" +#include "ash/components/tether/host_scan_device_prioritizer_impl.h" #include <memory> +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/tether_host_response_recorder.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/host_scan_scheduler.h b/ash/components/tether/host_scan_scheduler.h similarity index 80% rename from chromeos/components/tether/host_scan_scheduler.h rename to ash/components/tether/host_scan_scheduler.h index fb55168a..1ed2978 100644 --- a/chromeos/components/tether/host_scan_scheduler.h +++ b/ash/components/tether/host_scan_scheduler.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 CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_H_ namespace chromeos { @@ -29,4 +29,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_H_
diff --git a/chromeos/components/tether/host_scan_scheduler_impl.cc b/ash/components/tether/host_scan_scheduler_impl.cc similarity index 98% rename from chromeos/components/tether/host_scan_scheduler_impl.cc rename to ash/components/tether/host_scan_scheduler_impl.cc index 4b622fe..184bda6 100644 --- a/chromeos/components/tether/host_scan_scheduler_impl.cc +++ b/ash/components/tether/host_scan_scheduler_impl.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 "chromeos/components/tether/host_scan_scheduler_impl.h" +#include "ash/components/tether/host_scan_scheduler_impl.h" #include <memory>
diff --git a/chromeos/components/tether/host_scan_scheduler_impl.h b/ash/components/tether/host_scan_scheduler_impl.h similarity index 90% rename from chromeos/components/tether/host_scan_scheduler_impl.h rename to ash/components/tether/host_scan_scheduler_impl.h index d7a533e..c302e2e 100644 --- a/chromeos/components/tether/host_scan_scheduler_impl.h +++ b/ash/components/tether/host_scan_scheduler_impl.h
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_IMPL_H_ #include <memory> +#include "ash/components/tether/host_scan_scheduler.h" +#include "ash/components/tether/host_scanner.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/time/clock.h" #include "base/time/time.h" #include "base/timer/timer.h" -#include "chromeos/components/tether/host_scan_scheduler.h" -#include "chromeos/components/tether/host_scanner.h" #include "chromeos/network/network_state_handler_observer.h" #include "components/session_manager/core/session_manager_observer.h" @@ -97,4 +97,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCAN_SCHEDULER_IMPL_H_
diff --git a/chromeos/components/tether/host_scan_scheduler_impl_unittest.cc b/ash/components/tether/host_scan_scheduler_impl_unittest.cc similarity index 98% rename from chromeos/components/tether/host_scan_scheduler_impl_unittest.cc rename to ash/components/tether/host_scan_scheduler_impl_unittest.cc index d9c9373..0a4e984 100644 --- a/chromeos/components/tether/host_scan_scheduler_impl_unittest.cc +++ b/ash/components/tether/host_scan_scheduler_impl_unittest.cc
@@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/host_scan_scheduler_impl.h" +#include "ash/components/tether/host_scan_scheduler_impl.h" #include <memory> +#include "ash/components/tether/fake_host_scanner.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" @@ -13,7 +14,6 @@ #include "base/test/task_environment.h" #include "base/test/test_simple_task_runner.h" #include "base/timer/mock_timer.h" -#include "chromeos/components/tether/fake_host_scanner.h" #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/login/login_state/login_state.h" #include "chromeos/network/network_state.h"
diff --git a/chromeos/components/tether/host_scan_test_util.cc b/ash/components/tether/host_scan_test_util.cc similarity index 97% rename from chromeos/components/tether/host_scan_test_util.cc rename to ash/components/tether/host_scan_test_util.cc index bc32fc9..f9720be6d 100644 --- a/chromeos/components/tether/host_scan_test_util.cc +++ b/ash/components/tether/host_scan_test_util.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 "chromeos/components/tether/host_scan_test_util.h" +#include "ash/components/tether/host_scan_test_util.h" namespace chromeos {
diff --git a/chromeos/components/tether/host_scan_test_util.h b/ash/components/tether/host_scan_test_util.h similarity index 87% rename from chromeos/components/tether/host_scan_test_util.h rename to ash/components/tether/host_scan_test_util.h index a221a20..af7c07b 100644 --- a/chromeos/components/tether/host_scan_test_util.h +++ b/ash/components/tether/host_scan_test_util.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_TEST_UTIL_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_TEST_UTIL_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCAN_TEST_UTIL_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCAN_TEST_UTIL_H_ #include <string> #include <unordered_map> -#include "chromeos/components/tether/host_scan_cache_entry.h" +#include "ash/components/tether/host_scan_cache_entry.h" namespace chromeos { @@ -57,4 +57,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCAN_TEST_UTIL_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCAN_TEST_UTIL_H_
diff --git a/chromeos/components/tether/host_scanner.cc b/ash/components/tether/host_scanner.cc similarity index 92% rename from chromeos/components/tether/host_scanner.cc rename to ash/components/tether/host_scanner.cc index 9178fe1..a34b516 100644 --- a/chromeos/components/tether/host_scanner.cc +++ b/ash/components/tether/host_scanner.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 "chromeos/components/tether/host_scanner.h" +#include "ash/components/tether/host_scanner.h" namespace chromeos {
diff --git a/chromeos/components/tether/host_scanner.h b/ash/components/tether/host_scanner.h similarity index 88% rename from chromeos/components/tether/host_scanner.h rename to ash/components/tether/host_scanner.h index 367aac3..972c171 100644 --- a/chromeos/components/tether/host_scanner.h +++ b/ash/components/tether/host_scanner.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 CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCANNER_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCANNER_H_ #include "base/observer_list.h" @@ -54,4 +54,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCANNER_H_
diff --git a/chromeos/components/tether/host_scanner_impl.cc b/ash/components/tether/host_scanner_impl.cc similarity index 95% rename from chromeos/components/tether/host_scanner_impl.cc rename to ash/components/tether/host_scanner_impl.cc index 19b9440b..7b8eea0 100644 --- a/chromeos/components/tether/host_scanner_impl.cc +++ b/ash/components/tether/host_scanner_impl.cc
@@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/host_scanner_impl.h" +#include "ash/components/tether/host_scanner_impl.h" #include <algorithm> +#include "ash/components/tether/connection_preserver.h" +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/device_status_util.h" +#include "ash/components/tether/gms_core_notifications_state_tracker_impl.h" +#include "ash/components/tether/host_scan_cache.h" +#include "ash/components/tether/tether_host_fetcher.h" +#include "ash/components/tether/top_level_host_scan_cache.h" #include "ash/constants/ash_switches.h" #include "base/bind.h" #include "base/metrics/histogram_macros.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/connection_preserver.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/device_status_util.h" -#include "chromeos/components/tether/gms_core_notifications_state_tracker_impl.h" -#include "chromeos/components/tether/host_scan_cache.h" -#include "chromeos/components/tether/tether_host_fetcher.h" -#include "chromeos/components/tether/top_level_host_scan_cache.h" #include "chromeos/network/network_state.h" #include "components/session_manager/core/session_manager.h"
diff --git a/chromeos/components/tether/host_scanner_impl.h b/ash/components/tether/host_scanner_impl.h similarity index 93% rename from chromeos/components/tether/host_scanner_impl.h rename to ash/components/tether/host_scanner_impl.h index 6723ec72..2d0e4604 100644 --- a/chromeos/components/tether/host_scanner_impl.h +++ b/ash/components/tether/host_scanner_impl.h
@@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCANNER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCANNER_IMPL_H_ #include <string> #include <unordered_set> #include <vector> +#include "ash/components/tether/host_scanner.h" +#include "ash/components/tether/host_scanner_operation.h" +#include "ash/components/tether/notification_presenter.h" #include "base/gtest_prod_util.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/time/clock.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/host_scanner.h" -#include "chromeos/components/tether/host_scanner_operation.h" -#include "chromeos/components/tether/notification_presenter.h" #include "chromeos/network/network_state_handler.h" #include "components/session_manager/core/session_manager_observer.h" @@ -148,4 +148,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCANNER_IMPL_H_
diff --git a/chromeos/components/tether/host_scanner_impl_unittest.cc b/ash/components/tether/host_scanner_impl_unittest.cc similarity index 97% rename from chromeos/components/tether/host_scanner_impl_unittest.cc rename to ash/components/tether/host_scanner_impl_unittest.cc index 2b789a6f..70e97a58 100644 --- a/chromeos/components/tether/host_scanner_impl_unittest.cc +++ b/ash/components/tether/host_scanner_impl_unittest.cc
@@ -2,12 +2,23 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/host_scanner_impl.h" +#include "ash/components/tether/host_scanner_impl.h" #include <algorithm> #include <memory> #include <vector> +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/fake_connection_preserver.h" +#include "ash/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/fake_notification_presenter.h" +#include "ash/components/tether/fake_tether_host_fetcher.h" +#include "ash/components/tether/gms_core_notifications_state_tracker_impl.h" +#include "ash/components/tether/host_scan_device_prioritizer.h" +#include "ash/components/tether/host_scanner.h" +#include "ash/components/tether/mock_tether_host_response_recorder.h" +#include "ash/components/tether/proto_test_util.h" +#include "ash/components/tether/top_level_host_scan_cache.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" @@ -15,17 +26,6 @@ #include "base/test/task_environment.h" #include "base/time/time.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/fake_connection_preserver.h" -#include "chromeos/components/tether/fake_host_scan_cache.h" -#include "chromeos/components/tether/fake_notification_presenter.h" -#include "chromeos/components/tether/fake_tether_host_fetcher.h" -#include "chromeos/components/tether/gms_core_notifications_state_tracker_impl.h" -#include "chromeos/components/tether/host_scan_device_prioritizer.h" -#include "chromeos/components/tether/host_scanner.h" -#include "chromeos/components/tether/mock_tether_host_response_recorder.h" -#include "chromeos/components/tether/proto_test_util.h" -#include "chromeos/components/tether/top_level_host_scan_cache.h" #include "chromeos/network/network_state_test_helper.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h"
diff --git a/chromeos/components/tether/host_scanner_operation.cc b/ash/components/tether/host_scanner_operation.cc similarity index 96% rename from chromeos/components/tether/host_scanner_operation.cc rename to ash/components/tether/host_scanner_operation.cc index 4dcd6a3..930c423f 100644 --- a/chromeos/components/tether/host_scanner_operation.cc +++ b/ash/components/tether/host_scanner_operation.cc
@@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/host_scanner_operation.h" +#include "ash/components/tether/host_scanner_operation.h" #include <memory> +#include "ash/components/tether/connection_preserver.h" +#include "ash/components/tether/host_scan_device_prioritizer.h" +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/proto/tether.pb.h" +#include "ash/components/tether/tether_host_response_recorder.h" #include "base/bind.h" #include "base/containers/contains.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/time/default_clock.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/connection_preserver.h" -#include "chromeos/components/tether/host_scan_device_prioritizer.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/proto/tether.pb.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" namespace chromeos {
diff --git a/chromeos/components/tether/host_scanner_operation.h b/ash/components/tether/host_scanner_operation.h similarity index 95% rename from chromeos/components/tether/host_scanner_operation.h rename to ash/components/tether/host_scanner_operation.h index 1ff95cbe..925ccaf3 100644 --- a/chromeos/components/tether/host_scanner_operation.h +++ b/ash/components/tether/host_scanner_operation.h
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_OPERATION_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_OPERATION_H_ +#ifndef ASH_COMPONENTS_TETHER_HOST_SCANNER_OPERATION_H_ +#define ASH_COMPONENTS_TETHER_HOST_SCANNER_OPERATION_H_ #include <map> #include <vector> +#include "ash/components/tether/message_transfer_operation.h" #include "base/gtest_prod_util.h" #include "base/observer_list.h" #include "base/time/clock.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/message_transfer_operation.h" namespace chromeos { @@ -157,4 +157,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOST_SCANNER_OPERATION_H_ +#endif // ASH_COMPONENTS_TETHER_HOST_SCANNER_OPERATION_H_
diff --git a/chromeos/components/tether/host_scanner_operation_unittest.cc b/ash/components/tether/host_scanner_operation_unittest.cc similarity index 96% rename from chromeos/components/tether/host_scanner_operation_unittest.cc rename to ash/components/tether/host_scanner_operation_unittest.cc index 7ca6a96e..935daf5d 100644 --- a/chromeos/components/tether/host_scanner_operation_unittest.cc +++ b/ash/components/tether/host_scanner_operation_unittest.cc
@@ -2,24 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/host_scanner_operation.h" +#include "ash/components/tether/host_scanner_operation.h" #include <algorithm> #include <memory> #include <vector> +#include "ash/components/tether/fake_connection_preserver.h" +#include "ash/components/tether/host_scan_device_prioritizer.h" +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/mock_tether_host_response_recorder.h" +#include "ash/components/tether/proto/tether.pb.h" +#include "ash/components/tether/proto_test_util.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/simple_test_clock.h" #include "base/test/task_environment.h" #include "base/test/test_simple_task_runner.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/fake_connection_preserver.h" -#include "chromeos/components/tether/host_scan_device_prioritizer.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/mock_tether_host_response_recorder.h" -#include "chromeos/components/tether/proto/tether.pb.h" -#include "chromeos/components/tether/proto_test_util.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h"
diff --git a/chromeos/components/tether/hotspot_usage_duration_tracker.cc b/ash/components/tether/hotspot_usage_duration_tracker.cc similarity index 97% rename from chromeos/components/tether/hotspot_usage_duration_tracker.cc rename to ash/components/tether/hotspot_usage_duration_tracker.cc index 4020de5..44ed8dbd 100644 --- a/chromeos/components/tether/hotspot_usage_duration_tracker.cc +++ b/ash/components/tether/hotspot_usage_duration_tracker.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 "chromeos/components/tether/hotspot_usage_duration_tracker.h" +#include "ash/components/tether/hotspot_usage_duration_tracker.h" #include "base/metrics/histogram_macros.h" #include "base/time/clock.h"
diff --git a/chromeos/components/tether/hotspot_usage_duration_tracker.h b/ash/components/tether/hotspot_usage_duration_tracker.h similarity index 81% rename from chromeos/components/tether/hotspot_usage_duration_tracker.h rename to ash/components/tether/hotspot_usage_duration_tracker.h index ef80102..0ee707d 100644 --- a/chromeos/components/tether/hotspot_usage_duration_tracker.h +++ b/ash/components/tether/hotspot_usage_duration_tracker.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_HOTSPOT_USAGE_DURATION_TRACKER_H_ -#define CHROMEOS_COMPONENTS_TETHER_HOTSPOT_USAGE_DURATION_TRACKER_H_ +#ifndef ASH_COMPONENTS_TETHER_HOTSPOT_USAGE_DURATION_TRACKER_H_ +#define ASH_COMPONENTS_TETHER_HOTSPOT_USAGE_DURATION_TRACKER_H_ +#include "ash/components/tether/active_host.h" #include "base/time/time.h" -#include "chromeos/components/tether/active_host.h" namespace base { class Clock; @@ -48,4 +48,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_HOTSPOT_USAGE_DURATION_TRACKER_H_ +#endif // ASH_COMPONENTS_TETHER_HOTSPOT_USAGE_DURATION_TRACKER_H_
diff --git a/chromeos/components/tether/hotspot_usage_duration_tracker_unittest.cc b/ash/components/tether/hotspot_usage_duration_tracker_unittest.cc similarity index 96% rename from chromeos/components/tether/hotspot_usage_duration_tracker_unittest.cc rename to ash/components/tether/hotspot_usage_duration_tracker_unittest.cc index fd34df0..d7155e1 100644 --- a/chromeos/components/tether/hotspot_usage_duration_tracker_unittest.cc +++ b/ash/components/tether/hotspot_usage_duration_tracker_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/hotspot_usage_duration_tracker.h" +#include "ash/components/tether/hotspot_usage_duration_tracker.h" #include <memory> +#include "ash/components/tether/fake_active_host.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/simple_test_clock.h" -#include "chromeos/components/tether/fake_active_host.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/keep_alive_operation.cc b/ash/components/tether/keep_alive_operation.cc similarity index 95% rename from chromeos/components/tether/keep_alive_operation.cc rename to ash/components/tether/keep_alive_operation.cc index 9380ac8e..989ad99 100644 --- a/chromeos/components/tether/keep_alive_operation.cc +++ b/ash/components/tether/keep_alive_operation.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/keep_alive_operation.h" +#include "ash/components/tether/keep_alive_operation.h" +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/proto/tether.pb.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/time/default_clock.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/proto/tether.pb.h" namespace chromeos {
diff --git a/chromeos/components/tether/keep_alive_operation.h b/ash/components/tether/keep_alive_operation.h similarity index 92% rename from chromeos/components/tether/keep_alive_operation.h rename to ash/components/tether/keep_alive_operation.h index af4358e..8d69de8 100644 --- a/chromeos/components/tether/keep_alive_operation.h +++ b/ash/components/tether/keep_alive_operation.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_KEEP_ALIVE_OPERATION_H_ -#define CHROMEOS_COMPONENTS_TETHER_KEEP_ALIVE_OPERATION_H_ +#ifndef ASH_COMPONENTS_TETHER_KEEP_ALIVE_OPERATION_H_ +#define ASH_COMPONENTS_TETHER_KEEP_ALIVE_OPERATION_H_ +#include "ash/components/tether/message_transfer_operation.h" #include "base/gtest_prod_util.h" #include "base/observer_list.h" #include "base/time/clock.h" -#include "chromeos/components/tether/message_transfer_operation.h" namespace chromeos { @@ -99,4 +99,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_KEEP_ALIVE_OPERATION_H_ +#endif // ASH_COMPONENTS_TETHER_KEEP_ALIVE_OPERATION_H_
diff --git a/chromeos/components/tether/keep_alive_operation_unittest.cc b/ash/components/tether/keep_alive_operation_unittest.cc similarity index 96% rename from chromeos/components/tether/keep_alive_operation_unittest.cc rename to ash/components/tether/keep_alive_operation_unittest.cc index b4e5b55a5..3ebacf1 100644 --- a/chromeos/components/tether/keep_alive_operation_unittest.cc +++ b/ash/components/tether/keep_alive_operation_unittest.cc
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/keep_alive_operation.h" +#include "ash/components/tether/keep_alive_operation.h" #include <memory> #include <vector> +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/proto_test_util.h" +#include "ash/components/tether/test_timer_factory.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/simple_test_clock.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/proto_test_util.h" -#include "chromeos/components/tether/test_timer_factory.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h"
diff --git a/chromeos/components/tether/keep_alive_scheduler.cc b/ash/components/tether/keep_alive_scheduler.cc similarity index 95% rename from chromeos/components/tether/keep_alive_scheduler.cc rename to ash/components/tether/keep_alive_scheduler.cc index afb78262..de392a5f 100644 --- a/chromeos/components/tether/keep_alive_scheduler.cc +++ b/ash/components/tether/keep_alive_scheduler.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/keep_alive_scheduler.h" +#include "ash/components/tether/keep_alive_scheduler.h" +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/host_scan_cache.h" #include "base/bind.h" #include "base/metrics/histogram_functions.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/host_scan_cache.h" #include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace chromeos {
diff --git a/chromeos/components/tether/keep_alive_scheduler.h b/ash/components/tether/keep_alive_scheduler.h similarity index 88% rename from chromeos/components/tether/keep_alive_scheduler.h rename to ash/components/tether/keep_alive_scheduler.h index 9fa675a..262a509 100644 --- a/chromeos/components/tether/keep_alive_scheduler.h +++ b/ash/components/tether/keep_alive_scheduler.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_KEEP_ALIVE_SCHEDULER_H_ -#define CHROMEOS_COMPONENTS_TETHER_KEEP_ALIVE_SCHEDULER_H_ +#ifndef ASH_COMPONENTS_TETHER_KEEP_ALIVE_SCHEDULER_H_ +#define ASH_COMPONENTS_TETHER_KEEP_ALIVE_SCHEDULER_H_ #include <memory> +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/device_status_util.h" +#include "ash/components/tether/keep_alive_operation.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/device_status_util.h" -#include "chromeos/components/tether/keep_alive_operation.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos { @@ -89,4 +89,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_KEEP_ALIVE_SCHEDULER_H_ +#endif // ASH_COMPONENTS_TETHER_KEEP_ALIVE_SCHEDULER_H_
diff --git a/chromeos/components/tether/keep_alive_scheduler_unittest.cc b/ash/components/tether/keep_alive_scheduler_unittest.cc similarity index 97% rename from chromeos/components/tether/keep_alive_scheduler_unittest.cc rename to ash/components/tether/keep_alive_scheduler_unittest.cc index 1c2b50d6..fb393f5 100644 --- a/chromeos/components/tether/keep_alive_scheduler_unittest.cc +++ b/ash/components/tether/keep_alive_scheduler_unittest.cc
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/keep_alive_scheduler.h" +#include "ash/components/tether/keep_alive_scheduler.h" #include <memory> #include <vector> +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/proto_test_util.h" #include "base/memory/ptr_util.h" #include "base/timer/mock_timer.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/fake_host_scan_cache.h" -#include "chromeos/components/tether/proto_test_util.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/message_transfer_operation.cc b/ash/components/tether/message_transfer_operation.cc similarity index 98% rename from chromeos/components/tether/message_transfer_operation.cc rename to ash/components/tether/message_transfer_operation.cc index 208c6b61..99c33a34 100644 --- a/chromeos/components/tether/message_transfer_operation.cc +++ b/ash/components/tether/message_transfer_operation.cc
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/message_transfer_operation.h" +#include "ash/components/tether/message_transfer_operation.h" #include <memory> #include <set> +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/timer_factory.h" #include "base/bind.h" #include "base/containers/contains.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/timer_factory.h" namespace chromeos {
diff --git a/chromeos/components/tether/message_transfer_operation.h b/ash/components/tether/message_transfer_operation.h similarity index 96% rename from chromeos/components/tether/message_transfer_operation.h rename to ash/components/tether/message_transfer_operation.h index f2f75c2..3dee39f 100644 --- a/chromeos/components/tether/message_transfer_operation.h +++ b/ash/components/tether/message_transfer_operation.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_MESSAGE_TRANSFER_OPERATION_H_ -#define CHROMEOS_COMPONENTS_TETHER_MESSAGE_TRANSFER_OPERATION_H_ +#ifndef ASH_COMPONENTS_TETHER_MESSAGE_TRANSFER_OPERATION_H_ +#define ASH_COMPONENTS_TETHER_MESSAGE_TRANSFER_OPERATION_H_ #include <map> #include <vector> +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/proto/tether.pb.h" #include "base/timer/timer.h" #include "base/unguessable_token.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/proto/tether.pb.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" #include "chromeos/services/secure_channel/public/cpp/client/connection_attempt.h" @@ -210,4 +210,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_MESSAGE_TRANSFER_OPERATION_H_ +#endif // ASH_COMPONENTS_TETHER_MESSAGE_TRANSFER_OPERATION_H_
diff --git a/chromeos/components/tether/message_transfer_operation_unittest.cc b/ash/components/tether/message_transfer_operation_unittest.cc similarity index 98% rename from chromeos/components/tether/message_transfer_operation_unittest.cc rename to ash/components/tether/message_transfer_operation_unittest.cc index c505ddb..2da49b1 100644 --- a/chromeos/components/tether/message_transfer_operation_unittest.cc +++ b/ash/components/tether/message_transfer_operation_unittest.cc
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/message_transfer_operation.h" +#include "ash/components/tether/message_transfer_operation.h" #include <memory> +#include "ash/components/tether/message_wrapper.h" +#include "ash/components/tether/proto_test_util.h" +#include "ash/components/tether/test_timer_factory.h" #include "base/memory/ptr_util.h" #include "base/timer/mock_timer.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/message_wrapper.h" -#include "chromeos/components/tether/proto_test_util.h" -#include "chromeos/components/tether/test_timer_factory.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h"
diff --git a/chromeos/components/tether/message_wrapper.cc b/ash/components/tether/message_wrapper.cc similarity index 98% rename from chromeos/components/tether/message_wrapper.cc rename to ash/components/tether/message_wrapper.cc index 7078db4..4a3af06e 100644 --- a/chromeos/components/tether/message_wrapper.cc +++ b/ash/components/tether/message_wrapper.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 "chromeos/components/tether/message_wrapper.h" +#include "ash/components/tether/message_wrapper.h" #include <memory>
diff --git a/chromeos/components/tether/message_wrapper.h b/ash/components/tether/message_wrapper.h similarity index 90% rename from chromeos/components/tether/message_wrapper.h rename to ash/components/tether/message_wrapper.h index d15c4418..207a8c8b 100644 --- a/chromeos/components/tether/message_wrapper.h +++ b/ash/components/tether/message_wrapper.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_MESSAGE_WRAPPER_H_ -#define CHROMEOS_COMPONENTS_TETHER_MESSAGE_WRAPPER_H_ +#ifndef ASH_COMPONENTS_TETHER_MESSAGE_WRAPPER_H_ +#define ASH_COMPONENTS_TETHER_MESSAGE_WRAPPER_H_ #include <google/protobuf/message_lite.h> #include <memory> -#include "chromeos/components/tether/proto/tether.pb.h" +#include "ash/components/tether/proto/tether.pb.h" namespace chromeos { @@ -62,4 +62,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_MESSAGE_WRAPPER_H_ +#endif // ASH_COMPONENTS_TETHER_MESSAGE_WRAPPER_H_
diff --git a/chromeos/components/tether/message_wrapper_unittest.cc b/ash/components/tether/message_wrapper_unittest.cc similarity index 97% rename from chromeos/components/tether/message_wrapper_unittest.cc rename to ash/components/tether/message_wrapper_unittest.cc index e560046..01468e3 100644 --- a/chromeos/components/tether/message_wrapper_unittest.cc +++ b/ash/components/tether/message_wrapper_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/message_wrapper.h" +#include "ash/components/tether/message_wrapper.h" #include <sstream> +#include "ash/components/tether/proto/tether.pb.h" +#include "ash/components/tether/proto_test_util.h" #include "base/base64url.h" -#include "chromeos/components/tether/proto/tether.pb.h" -#include "chromeos/components/tether/proto_test_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/mock_host_connection_metrics_logger.cc b/ash/components/tether/mock_host_connection_metrics_logger.cc similarity index 78% rename from chromeos/components/tether/mock_host_connection_metrics_logger.cc rename to ash/components/tether/mock_host_connection_metrics_logger.cc index ddfd0467..981fb9cf 100644 --- a/chromeos/components/tether/mock_host_connection_metrics_logger.cc +++ b/ash/components/tether/mock_host_connection_metrics_logger.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/mock_host_connection_metrics_logger.h" +#include "ash/components/tether/mock_host_connection_metrics_logger.h" -#include "chromeos/components/tether/active_host.h" +#include "ash/components/tether/active_host.h" namespace chromeos {
diff --git a/chromeos/components/tether/mock_host_connection_metrics_logger.h b/ash/components/tether/mock_host_connection_metrics_logger.h similarity index 75% rename from chromeos/components/tether/mock_host_connection_metrics_logger.h rename to ash/components/tether/mock_host_connection_metrics_logger.h index 6702a18..41d141e7 100644 --- a/chromeos/components/tether/mock_host_connection_metrics_logger.h +++ b/ash/components/tether/mock_host_connection_metrics_logger.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_MOCK_HOST_CONNECTION_METRICS_LOGGER_H_ -#define CHROMEOS_COMPONENTS_TETHER_MOCK_HOST_CONNECTION_METRICS_LOGGER_H_ +#ifndef ASH_COMPONENTS_TETHER_MOCK_HOST_CONNECTION_METRICS_LOGGER_H_ +#define ASH_COMPONENTS_TETHER_MOCK_HOST_CONNECTION_METRICS_LOGGER_H_ #include <string> -#include "chromeos/components/tether/host_connection_metrics_logger.h" +#include "ash/components/tether/host_connection_metrics_logger.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos { @@ -36,4 +36,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_MOCK_HOST_CONNECTION_METRICS_LOGGER_H_ +#endif // ASH_COMPONENTS_TETHER_MOCK_HOST_CONNECTION_METRICS_LOGGER_H_
diff --git a/chromeos/components/tether/mock_tether_host_response_recorder.cc b/ash/components/tether/mock_tether_host_response_recorder.cc similarity index 85% rename from chromeos/components/tether/mock_tether_host_response_recorder.cc rename to ash/components/tether/mock_tether_host_response_recorder.cc index b6a0312..e3986bc 100644 --- a/chromeos/components/tether/mock_tether_host_response_recorder.cc +++ b/ash/components/tether/mock_tether_host_response_recorder.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 "chromeos/components/tether/mock_tether_host_response_recorder.h" +#include "ash/components/tether/mock_tether_host_response_recorder.h" namespace chromeos {
diff --git a/chromeos/components/tether/mock_tether_host_response_recorder.h b/ash/components/tether/mock_tether_host_response_recorder.h similarity index 80% rename from chromeos/components/tether/mock_tether_host_response_recorder.h rename to ash/components/tether/mock_tether_host_response_recorder.h index ff0d9d10..75a307a 100644 --- a/chromeos/components/tether/mock_tether_host_response_recorder.h +++ b/ash/components/tether/mock_tether_host_response_recorder.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_MOCK_TETHER_HOST_RESPONSE_RECORDER_H_ -#define CHROMEOS_COMPONENTS_TETHER_MOCK_TETHER_HOST_RESPONSE_RECORDER_H_ +#ifndef ASH_COMPONENTS_TETHER_MOCK_TETHER_HOST_RESPONSE_RECORDER_H_ +#define ASH_COMPONENTS_TETHER_MOCK_TETHER_HOST_RESPONSE_RECORDER_H_ #include <vector> +#include "ash/components/tether/tether_host_response_recorder.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" #include "testing/gmock/include/gmock/gmock.h" namespace chromeos { @@ -39,4 +39,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_MOCK_TETHER_HOST_RESPONSE_RECORDER_H_ +#endif // ASH_COMPONENTS_TETHER_MOCK_TETHER_HOST_RESPONSE_RECORDER_H_
diff --git a/chromeos/components/tether/network_configuration_remover.cc b/ash/components/tether/network_configuration_remover.cc similarity index 95% rename from chromeos/components/tether/network_configuration_remover.cc rename to ash/components/tether/network_configuration_remover.cc index 16d6d2be..de302b9 100644 --- a/chromeos/components/tether/network_configuration_remover.cc +++ b/ash/components/tether/network_configuration_remover.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 "chromeos/components/tether/network_configuration_remover.h" +#include "ash/components/tether/network_configuration_remover.h" #include "base/bind.h" #include "base/values.h"
diff --git a/chromeos/components/tether/network_configuration_remover.h b/ash/components/tether/network_configuration_remover.h similarity index 84% rename from chromeos/components/tether/network_configuration_remover.h rename to ash/components/tether/network_configuration_remover.h index 3ffbc69..daa3c7e2 100644 --- a/chromeos/components/tether/network_configuration_remover.h +++ b/ash/components/tether/network_configuration_remover.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 CHROMEOS_COMPONENTS_TETHER_NETWORK_CONFIGURATION_REMOVER_H_ -#define CHROMEOS_COMPONENTS_TETHER_NETWORK_CONFIGURATION_REMOVER_H_ +#ifndef ASH_COMPONENTS_TETHER_NETWORK_CONFIGURATION_REMOVER_H_ +#define ASH_COMPONENTS_TETHER_NETWORK_CONFIGURATION_REMOVER_H_ #include <string> @@ -40,4 +40,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_NETWORK_CONFIGURATION_REMOVER_H_ +#endif // ASH_COMPONENTS_TETHER_NETWORK_CONFIGURATION_REMOVER_H_
diff --git a/chromeos/components/tether/network_configuration_remover_unittest.cc b/ash/components/tether/network_configuration_remover_unittest.cc similarity index 95% rename from chromeos/components/tether/network_configuration_remover_unittest.cc rename to ash/components/tether/network_configuration_remover_unittest.cc index 8012d29..bf5efe7 100644 --- a/chromeos/components/tether/network_configuration_remover_unittest.cc +++ b/ash/components/tether/network_configuration_remover_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 "chromeos/components/tether/network_configuration_remover.h" +#include "ash/components/tether/network_configuration_remover.h" #include <memory>
diff --git a/chromeos/components/tether/network_connection_handler_tether_delegate.cc b/ash/components/tether/network_connection_handler_tether_delegate.cc similarity index 95% rename from chromeos/components/tether/network_connection_handler_tether_delegate.cc rename to ash/components/tether/network_connection_handler_tether_delegate.cc index f17710bb..45c5e8c0 100644 --- a/chromeos/components/tether/network_connection_handler_tether_delegate.cc +++ b/ash/components/tether/network_connection_handler_tether_delegate.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/network_connection_handler_tether_delegate.h" +#include "ash/components/tether/network_connection_handler_tether_delegate.h" +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/tether_connector.h" +#include "ash/components/tether/tether_disconnector.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/containers/contains.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/tether_connector.h" -#include "chromeos/components/tether/tether_disconnector.h" namespace chromeos {
diff --git a/chromeos/components/tether/network_connection_handler_tether_delegate.h b/ash/components/tether/network_connection_handler_tether_delegate.h similarity index 90% rename from chromeos/components/tether/network_connection_handler_tether_delegate.h rename to ash/components/tether/network_connection_handler_tether_delegate.h index f0d7aaf..7dbe71b 100644 --- a/chromeos/components/tether/network_connection_handler_tether_delegate.h +++ b/ash/components/tether/network_connection_handler_tether_delegate.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 CHROMEOS_COMPONENTS_TETHER_NETWORK_CONNECTION_HANDLER_TETHER_DELEGATE_H_ -#define CHROMEOS_COMPONENTS_TETHER_NETWORK_CONNECTION_HANDLER_TETHER_DELEGATE_H_ +#ifndef ASH_COMPONENTS_TETHER_NETWORK_CONNECTION_HANDLER_TETHER_DELEGATE_H_ +#define ASH_COMPONENTS_TETHER_NETWORK_CONNECTION_HANDLER_TETHER_DELEGATE_H_ #include <unordered_map> @@ -78,4 +78,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_NETWORK_CONNECTION_HANDLER_TETHER_DELEGATE_H_ +#endif // ASH_COMPONENTS_TETHER_NETWORK_CONNECTION_HANDLER_TETHER_DELEGATE_H_
diff --git a/chromeos/components/tether/network_connection_handler_tether_delegate_unittest.cc b/ash/components/tether/network_connection_handler_tether_delegate_unittest.cc similarity index 95% rename from chromeos/components/tether/network_connection_handler_tether_delegate_unittest.cc rename to ash/components/tether/network_connection_handler_tether_delegate_unittest.cc index 066faa88..3cd7020 100644 --- a/chromeos/components/tether/network_connection_handler_tether_delegate_unittest.cc +++ b/ash/components/tether/network_connection_handler_tether_delegate_unittest.cc
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/network_connection_handler_tether_delegate.h" +#include "ash/components/tether/network_connection_handler_tether_delegate.h" #include <memory> +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_tether_connector.h" +#include "ash/components/tether/fake_tether_disconnector.h" +#include "ash/components/tether/tether_disconnector.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include "base/bind.h" #include "base/memory/ptr_util.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/fake_tether_connector.h" -#include "chromeos/components/tether/fake_tether_disconnector.h" -#include "chromeos/components/tether/tether_disconnector.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" #include "chromeos/network/network_connection_handler.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/network_host_scan_cache.cc b/ash/components/tether/network_host_scan_cache.cc similarity index 95% rename from chromeos/components/tether/network_host_scan_cache.cc rename to ash/components/tether/network_host_scan_cache.cc index 4f62d5a..9785c0da 100644 --- a/chromeos/components/tether/network_host_scan_cache.cc +++ b/ash/components/tether/network_host_scan_cache.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/network_host_scan_cache.h" +#include "ash/components/tether/network_host_scan_cache.h" +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/tether_host_response_recorder.h" #include "base/containers/contains.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h"
diff --git a/chromeos/components/tether/network_host_scan_cache.h b/ash/components/tether/network_host_scan_cache.h similarity index 85% rename from chromeos/components/tether/network_host_scan_cache.h rename to ash/components/tether/network_host_scan_cache.h index aa17523..e14709a 100644 --- a/chromeos/components/tether/network_host_scan_cache.h +++ b/ash/components/tether/network_host_scan_cache.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_NETWORK_HOST_SCAN_CACHE_H_ -#define CHROMEOS_COMPONENTS_TETHER_NETWORK_HOST_SCAN_CACHE_H_ +#ifndef ASH_COMPONENTS_TETHER_NETWORK_HOST_SCAN_CACHE_H_ +#define ASH_COMPONENTS_TETHER_NETWORK_HOST_SCAN_CACHE_H_ #include <memory> #include <string> #include <unordered_set> +#include "ash/components/tether/host_scan_cache.h" +#include "ash/components/tether/tether_host_response_recorder.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/tether/host_scan_cache.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" namespace chromeos { @@ -64,4 +64,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_NETWORK_HOST_SCAN_CACHE_H_ +#endif // ASH_COMPONENTS_TETHER_NETWORK_HOST_SCAN_CACHE_H_
diff --git a/chromeos/components/tether/network_host_scan_cache_unittest.cc b/ash/components/tether/network_host_scan_cache_unittest.cc similarity index 95% rename from chromeos/components/tether/network_host_scan_cache_unittest.cc rename to ash/components/tether/network_host_scan_cache_unittest.cc index 6ff081a..b23d5023 100644 --- a/chromeos/components/tether/network_host_scan_cache_unittest.cc +++ b/ash/components/tether/network_host_scan_cache_unittest.cc
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/network_host_scan_cache.h" +#include "ash/components/tether/network_host_scan_cache.h" #include <memory> #include <vector> +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/host_scan_test_util.h" +#include "ash/components/tether/mock_tether_host_response_recorder.h" #include "base/containers/contains.h" #include "base/test/task_environment.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/fake_host_scan_cache.h" -#include "chromeos/components/tether/host_scan_test_util.h" -#include "chromeos/components/tether/mock_tether_host_response_recorder.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_state_test_helper.h"
diff --git a/chromeos/components/tether/network_list_sorter.cc b/ash/components/tether/network_list_sorter.cc similarity index 97% rename from chromeos/components/tether/network_list_sorter.cc rename to ash/components/tether/network_list_sorter.cc index 695ddb5..61e6bc2d 100644 --- a/chromeos/components/tether/network_list_sorter.cc +++ b/ash/components/tether/network_list_sorter.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 "chromeos/components/tether/network_list_sorter.h" +#include "ash/components/tether/network_list_sorter.h" #include <algorithm>
diff --git a/chromeos/components/tether/network_list_sorter.h b/ash/components/tether/network_list_sorter.h similarity index 85% rename from chromeos/components/tether/network_list_sorter.h rename to ash/components/tether/network_list_sorter.h index 195301ae8..1d4066e7 100644 --- a/chromeos/components/tether/network_list_sorter.h +++ b/ash/components/tether/network_list_sorter.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 CHROMEOS_COMPONENTS_TETHER_NETWORK_LIST_SORTER_H_ -#define CHROMEOS_COMPONENTS_TETHER_NETWORK_LIST_SORTER_H_ +#ifndef ASH_COMPONENTS_TETHER_NETWORK_LIST_SORTER_H_ +#define ASH_COMPONENTS_TETHER_NETWORK_LIST_SORTER_H_ #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/network/network_state_handler.h" @@ -36,4 +36,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_NETWORK_LIST_SORTER_H_ +#endif // ASH_COMPONENTS_TETHER_NETWORK_LIST_SORTER_H_
diff --git a/chromeos/components/tether/network_list_sorter_unittest.cc b/ash/components/tether/network_list_sorter_unittest.cc similarity index 98% rename from chromeos/components/tether/network_list_sorter_unittest.cc rename to ash/components/tether/network_list_sorter_unittest.cc index 07b3a48..5f75ff9 100644 --- a/chromeos/components/tether/network_list_sorter_unittest.cc +++ b/ash/components/tether/network_list_sorter_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 "chromeos/components/tether/network_list_sorter.h" +#include "ash/components/tether/network_list_sorter.h" #include <memory>
diff --git a/chromeos/components/tether/notification_presenter.h b/ash/components/tether/notification_presenter.h similarity index 92% rename from chromeos/components/tether/notification_presenter.h rename to ash/components/tether/notification_presenter.h index 7d940bad..9973e34 100644 --- a/chromeos/components/tether/notification_presenter.h +++ b/ash/components/tether/notification_presenter.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 CHROMEOS_COMPONENTS_TETHER_NOTIFICATION_PRESENTER_H_ -#define CHROMEOS_COMPONENTS_TETHER_NOTIFICATION_PRESENTER_H_ +#ifndef ASH_COMPONENTS_TETHER_NOTIFICATION_PRESENTER_H_ +#define ASH_COMPONENTS_TETHER_NOTIFICATION_PRESENTER_H_ #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/network/network_state.h" @@ -67,4 +67,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_NOTIFICATION_PRESENTER_H_ +#endif // ASH_COMPONENTS_TETHER_NOTIFICATION_PRESENTER_H_
diff --git a/chromeos/components/tether/notification_remover.cc b/ash/components/tether/notification_remover.cc similarity index 95% rename from chromeos/components/tether/notification_remover.cc rename to ash/components/tether/notification_remover.cc index 92ace3a..6adc84bc 100644 --- a/chromeos/components/tether/notification_remover.cc +++ b/ash/components/tether/notification_remover.cc
@@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/notification_remover.h" +#include "ash/components/tether/notification_remover.h" -#include "chromeos/components/tether/notification_presenter.h" +#include "ash/components/tether/notification_presenter.h" #include "chromeos/network/network_state_handler.h" namespace chromeos {
diff --git a/chromeos/components/tether/notification_remover.h b/ash/components/tether/notification_remover.h similarity index 85% rename from chromeos/components/tether/notification_remover.h rename to ash/components/tether/notification_remover.h index bf7cecc5..0cbbc4d 100644 --- a/chromeos/components/tether/notification_remover.h +++ b/ash/components/tether/notification_remover.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_NOTIFICATION_REMOVER_H_ -#define CHROMEOS_COMPONENTS_TETHER_NOTIFICATION_REMOVER_H_ +#ifndef ASH_COMPONENTS_TETHER_NOTIFICATION_REMOVER_H_ +#define ASH_COMPONENTS_TETHER_NOTIFICATION_REMOVER_H_ -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/host_scan_cache.h" +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/host_scan_cache.h" #include "chromeos/network/network_state_handler_observer.h" namespace chromeos { @@ -57,4 +57,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_NOTIFICATION_REMOVER_H_ +#endif // ASH_COMPONENTS_TETHER_NOTIFICATION_REMOVER_H_
diff --git a/chromeos/components/tether/notification_remover_unittest.cc b/ash/components/tether/notification_remover_unittest.cc similarity index 93% rename from chromeos/components/tether/notification_remover_unittest.cc rename to ash/components/tether/notification_remover_unittest.cc index 1591c077..a39c466 100644 --- a/chromeos/components/tether/notification_remover_unittest.cc +++ b/ash/components/tether/notification_remover_unittest.cc
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/notification_remover.h" +#include "ash/components/tether/notification_remover.h" #include <memory> +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/fake_notification_presenter.h" +#include "ash/components/tether/host_scan_test_util.h" #include "base/test/task_environment.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/fake_host_scan_cache.h" -#include "chromeos/components/tether/fake_notification_presenter.h" -#include "chromeos/components/tether/host_scan_test_util.h" #include "chromeos/network/network_state_test_helper.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/cros_system_api/dbus/shill/dbus-constants.h"
diff --git a/chromeos/components/tether/persistent_host_scan_cache.h b/ash/components/tether/persistent_host_scan_cache.h similarity index 77% rename from chromeos/components/tether/persistent_host_scan_cache.h rename to ash/components/tether/persistent_host_scan_cache.h index 93814b8..5fcb761d 100644 --- a/chromeos/components/tether/persistent_host_scan_cache.h +++ b/ash/components/tether/persistent_host_scan_cache.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_H_ -#define CHROMEOS_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_H_ +#ifndef ASH_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_H_ +#define ASH_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_H_ -#include "chromeos/components/tether/host_scan_cache.h" +#include "ash/components/tether/host_scan_cache.h" namespace chromeos { @@ -32,4 +32,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_H_ +#endif // ASH_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_H_
diff --git a/chromeos/components/tether/persistent_host_scan_cache_impl.cc b/ash/components/tether/persistent_host_scan_cache_impl.cc similarity index 97% rename from chromeos/components/tether/persistent_host_scan_cache_impl.cc rename to ash/components/tether/persistent_host_scan_cache_impl.cc index 038f5ba..a2c5dfe 100644 --- a/chromeos/components/tether/persistent_host_scan_cache_impl.cc +++ b/ash/components/tether/persistent_host_scan_cache_impl.cc
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/persistent_host_scan_cache_impl.h" +#include "ash/components/tether/persistent_host_scan_cache_impl.h" #include <memory> #include <unordered_set> +#include "ash/components/tether/pref_names.h" #include "base/check.h" #include "base/notreached.h" -#include "chromeos/components/tether/pref_names.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h"
diff --git a/chromeos/components/tether/persistent_host_scan_cache_impl.h b/ash/components/tether/persistent_host_scan_cache_impl.h similarity index 85% rename from chromeos/components/tether/persistent_host_scan_cache_impl.h rename to ash/components/tether/persistent_host_scan_cache_impl.h index bbe0e7c6..007b9d4 100644 --- a/chromeos/components/tether/persistent_host_scan_cache_impl.h +++ b/ash/components/tether/persistent_host_scan_cache_impl.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_IMPL_H_ +#define ASH_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_IMPL_H_ #include <string> #include <unordered_map> #include <unordered_set> -#include "chromeos/components/tether/persistent_host_scan_cache.h" +#include "ash/components/tether/persistent_host_scan_cache.h" class PrefRegistrySimple; class PrefService; @@ -58,4 +58,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_PERSISTENT_HOST_SCAN_CACHE_IMPL_H_
diff --git a/chromeos/components/tether/persistent_host_scan_cache_impl_unittest.cc b/ash/components/tether/persistent_host_scan_cache_impl_unittest.cc similarity index 96% rename from chromeos/components/tether/persistent_host_scan_cache_impl_unittest.cc rename to ash/components/tether/persistent_host_scan_cache_impl_unittest.cc index 32c0e58..5c7f057 100644 --- a/chromeos/components/tether/persistent_host_scan_cache_impl_unittest.cc +++ b/ash/components/tether/persistent_host_scan_cache_impl_unittest.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/persistent_host_scan_cache_impl.h" +#include "ash/components/tether/persistent_host_scan_cache_impl.h" #include <memory> #include <unordered_map> -#include "chromeos/components/tether/fake_host_scan_cache.h" -#include "chromeos/components/tether/host_scan_test_util.h" +#include "ash/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/host_scan_test_util.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/pref_names.cc b/ash/components/tether/pref_names.cc similarity index 94% rename from chromeos/components/tether/pref_names.cc rename to ash/components/tether/pref_names.cc index 716a772..a47535f 100644 --- a/chromeos/components/tether/pref_names.cc +++ b/ash/components/tether/pref_names.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 "chromeos/components/tether/pref_names.h" +#include "ash/components/tether/pref_names.h" namespace chromeos {
diff --git a/chromeos/components/tether/pref_names.h b/ash/components/tether/pref_names.h similarity index 94% rename from chromeos/components/tether/pref_names.h rename to ash/components/tether/pref_names.h index 2af5d86..8fde66c 100644 --- a/chromeos/components/tether/pref_names.h +++ b/ash/components/tether/pref_names.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 CHROMEOS_COMPONENTS_TETHER_PREF_NAMES_H_ -#define CHROMEOS_COMPONENTS_TETHER_PREF_NAMES_H_ +#ifndef ASH_COMPONENTS_TETHER_PREF_NAMES_H_ +#define ASH_COMPONENTS_TETHER_PREF_NAMES_H_ namespace chromeos { @@ -61,4 +61,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_PREF_NAMES_H_ +#endif // ASH_COMPONENTS_TETHER_PREF_NAMES_H_
diff --git a/chromeos/components/tether/proto/BUILD.gn b/ash/components/tether/proto/BUILD.gn similarity index 69% rename from chromeos/components/tether/proto/BUILD.gn rename to ash/components/tether/proto/BUILD.gn index 1b7c394..fe3744c 100644 --- a/chromeos/components/tether/proto/BUILD.gn +++ b/ash/components/tether/proto/BUILD.gn
@@ -2,8 +2,11 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/chromeos/ui_mode.gni") import("//third_party/protobuf/proto_library.gni") +assert(is_chromeos_ash, "Non-ChromeOS builds cannot depend on //ash") + proto_library("proto") { sources = [ "tether.proto" ] }
diff --git a/chromeos/components/tether/proto/tether.proto b/ash/components/tether/proto/tether.proto similarity index 100% rename from chromeos/components/tether/proto/tether.proto rename to ash/components/tether/proto/tether.proto
diff --git a/chromeos/components/tether/proto_test_util.cc b/ash/components/tether/proto_test_util.cc similarity index 96% rename from chromeos/components/tether/proto_test_util.cc rename to ash/components/tether/proto_test_util.cc index 49cc9f65..ba27f9a 100644 --- a/chromeos/components/tether/proto_test_util.cc +++ b/ash/components/tether/proto_test_util.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 "chromeos/components/tether/proto_test_util.h" +#include "ash/components/tether/proto_test_util.h" namespace chromeos {
diff --git a/chromeos/components/tether/proto_test_util.h b/ash/components/tether/proto_test_util.h similarity index 82% rename from chromeos/components/tether/proto_test_util.h rename to ash/components/tether/proto_test_util.h index 297868f..06f3250 100644 --- a/chromeos/components/tether/proto_test_util.h +++ b/ash/components/tether/proto_test_util.h
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_PROTO_TEST_UTIL_H_ -#define CHROMEOS_COMPONENTS_TETHER_PROTO_TEST_UTIL_H_ +#ifndef ASH_COMPONENTS_TETHER_PROTO_TEST_UTIL_H_ +#define ASH_COMPONENTS_TETHER_PROTO_TEST_UTIL_H_ -#include "chromeos/components/tether/proto/tether.pb.h" +#include "ash/components/tether/proto/tether.pb.h" namespace chromeos { @@ -34,4 +34,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_PROTO_TEST_UTIL_H_ +#endif // ASH_COMPONENTS_TETHER_PROTO_TEST_UTIL_H_
diff --git a/chromeos/components/tether/synchronous_shutdown_object_container.h b/ash/components/tether/synchronous_shutdown_object_container.h similarity index 83% rename from chromeos/components/tether/synchronous_shutdown_object_container.h rename to ash/components/tether/synchronous_shutdown_object_container.h index dd51727..b6e5cd0 100644 --- a/chromeos/components/tether/synchronous_shutdown_object_container.h +++ b/ash/components/tether/synchronous_shutdown_object_container.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 CHROMEOS_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ -#define CHROMEOS_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#ifndef ASH_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#define ASH_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ namespace chromeos { @@ -39,4 +39,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_ +#endif // ASH_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_H_
diff --git a/chromeos/components/tether/synchronous_shutdown_object_container_impl.cc b/ash/components/tether/synchronous_shutdown_object_container_impl.cc similarity index 83% rename from chromeos/components/tether/synchronous_shutdown_object_container_impl.cc rename to ash/components/tether/synchronous_shutdown_object_container_impl.cc index b81ab8a..c941323 100644 --- a/chromeos/components/tether/synchronous_shutdown_object_container_impl.cc +++ b/ash/components/tether/synchronous_shutdown_object_container_impl.cc
@@ -2,36 +2,36 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/synchronous_shutdown_object_container_impl.h" +#include "ash/components/tether/synchronous_shutdown_object_container_impl.h" #include <memory> +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/active_host_network_state_updater.h" +#include "ash/components/tether/asynchronous_shutdown_object_container.h" +#include "ash/components/tether/connection_preserver_impl.h" +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/host_connection_metrics_logger.h" +#include "ash/components/tether/host_scan_device_prioritizer_impl.h" +#include "ash/components/tether/host_scan_scheduler_impl.h" +#include "ash/components/tether/host_scanner_impl.h" +#include "ash/components/tether/hotspot_usage_duration_tracker.h" +#include "ash/components/tether/keep_alive_scheduler.h" +#include "ash/components/tether/network_connection_handler_tether_delegate.h" +#include "ash/components/tether/network_host_scan_cache.h" +#include "ash/components/tether/network_list_sorter.h" +#include "ash/components/tether/notification_remover.h" +#include "ash/components/tether/persistent_host_scan_cache_impl.h" +#include "ash/components/tether/tether_connector_impl.h" +#include "ash/components/tether/tether_disconnector_impl.h" +#include "ash/components/tether/tether_host_response_recorder.h" +#include "ash/components/tether/tether_network_disconnection_handler.h" +#include "ash/components/tether/tether_session_completion_logger.h" +#include "ash/components/tether/timer_factory.h" +#include "ash/components/tether/top_level_host_scan_cache.h" +#include "ash/components/tether/wifi_hotspot_connector.h" #include "base/memory/ptr_util.h" #include "base/time/default_clock.h" -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/active_host_network_state_updater.h" -#include "chromeos/components/tether/asynchronous_shutdown_object_container.h" -#include "chromeos/components/tether/connection_preserver_impl.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/host_connection_metrics_logger.h" -#include "chromeos/components/tether/host_scan_device_prioritizer_impl.h" -#include "chromeos/components/tether/host_scan_scheduler_impl.h" -#include "chromeos/components/tether/host_scanner_impl.h" -#include "chromeos/components/tether/hotspot_usage_duration_tracker.h" -#include "chromeos/components/tether/keep_alive_scheduler.h" -#include "chromeos/components/tether/network_connection_handler_tether_delegate.h" -#include "chromeos/components/tether/network_host_scan_cache.h" -#include "chromeos/components/tether/network_list_sorter.h" -#include "chromeos/components/tether/notification_remover.h" -#include "chromeos/components/tether/persistent_host_scan_cache_impl.h" -#include "chromeos/components/tether/tether_connector_impl.h" -#include "chromeos/components/tether/tether_disconnector_impl.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" -#include "chromeos/components/tether/tether_network_disconnection_handler.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" -#include "chromeos/components/tether/timer_factory.h" -#include "chromeos/components/tether/top_level_host_scan_cache.h" -#include "chromeos/components/tether/wifi_hotspot_connector.h" namespace chromeos {
diff --git a/chromeos/components/tether/synchronous_shutdown_object_container_impl.h b/ash/components/tether/synchronous_shutdown_object_container_impl.h similarity index 94% rename from chromeos/components/tether/synchronous_shutdown_object_container_impl.h rename to ash/components/tether/synchronous_shutdown_object_container_impl.h index d0f88a7..2d50aea 100644 --- a/chromeos/components/tether/synchronous_shutdown_object_container_impl.h +++ b/ash/components/tether/synchronous_shutdown_object_container_impl.h
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ #include <memory> -#include "chromeos/components/tether/synchronous_shutdown_object_container.h" +#include "ash/components/tether/synchronous_shutdown_object_container.h" class PrefService; @@ -159,4 +159,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_SYNCHRONOUS_SHUTDOWN_OBJECT_CONTAINER_IMPL_H_
diff --git a/chromeos/components/tether/test_timer_factory.cc b/ash/components/tether/test_timer_factory.cc similarity index 91% rename from chromeos/components/tether/test_timer_factory.cc rename to ash/components/tether/test_timer_factory.cc index 2e47b6e..d40030b 100644 --- a/chromeos/components/tether/test_timer_factory.cc +++ b/ash/components/tether/test_timer_factory.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 "chromeos/components/tether/test_timer_factory.h" +#include "ash/components/tether/test_timer_factory.h" #include "base/check.h"
diff --git a/chromeos/components/tether/test_timer_factory.h b/ash/components/tether/test_timer_factory.h similarity index 83% rename from chromeos/components/tether/test_timer_factory.h rename to ash/components/tether/test_timer_factory.h index 61049ac..7ba731a 100644 --- a/chromeos/components/tether/test_timer_factory.h +++ b/ash/components/tether/test_timer_factory.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_TEST_TIMER_FACTORY_H_ -#define CHROMEOS_COMPONENTS_TETHER_TEST_TIMER_FACTORY_H_ +#ifndef ASH_COMPONENTS_TETHER_TEST_TIMER_FACTORY_H_ +#define ASH_COMPONENTS_TETHER_TEST_TIMER_FACTORY_H_ #include <memory> #include <string> +#include "ash/components/tether/timer_factory.h" #include "base/containers/flat_map.h" #include "base/timer/mock_timer.h" #include "base/timer/timer.h" -#include "chromeos/components/tether/timer_factory.h" namespace chromeos { namespace tether { @@ -45,4 +45,4 @@ } // namespace tether } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TEST_TIMER_FACTORY_H_ \ No newline at end of file +#endif // ASH_COMPONENTS_TETHER_TEST_TIMER_FACTORY_H_ \ No newline at end of file
diff --git a/chromeos/components/tether/tether_component.cc b/ash/components/tether/tether_component.cc similarity index 93% rename from chromeos/components/tether/tether_component.cc rename to ash/components/tether/tether_component.cc index e93ac6a..1f6b9d96 100644 --- a/chromeos/components/tether/tether_component.cc +++ b/ash/components/tether/tether_component.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 "chromeos/components/tether/tether_component.h" +#include "ash/components/tether/tether_component.h" namespace chromeos {
diff --git a/chromeos/components/tether/tether_component.h b/ash/components/tether/tether_component.h similarity index 91% rename from chromeos/components/tether/tether_component.h rename to ash/components/tether/tether_component.h index 6a6357f..12828fe 100644 --- a/chromeos/components/tether/tether_component.h +++ b/ash/components/tether/tether_component.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 CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_COMPONENT_H_ +#define ASH_COMPONENTS_TETHER_TETHER_COMPONENT_H_ #include "base/observer_list.h" @@ -66,4 +66,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_COMPONENT_H_
diff --git a/chromeos/components/tether/tether_component_impl.cc b/ash/components/tether/tether_component_impl.cc similarity index 92% rename from chromeos/components/tether/tether_component_impl.cc rename to ash/components/tether/tether_component_impl.cc index c71ff6cd..60f13c9 100644 --- a/chromeos/components/tether/tether_component_impl.cc +++ b/ash/components/tether/tether_component_impl.cc
@@ -2,24 +2,24 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/tether_component_impl.h" +#include "ash/components/tether/tether_component_impl.h" #include <memory> +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/asynchronous_shutdown_object_container_impl.h" +#include "ash/components/tether/crash_recovery_manager_impl.h" +#include "ash/components/tether/host_scan_scheduler.h" +#include "ash/components/tether/persistent_host_scan_cache_impl.h" +#include "ash/components/tether/synchronous_shutdown_object_container_impl.h" +#include "ash/components/tether/tether_disconnector.h" +#include "ash/components/tether/tether_host_response_recorder.h" +#include "ash/components/tether/tether_session_completion_logger.h" +#include "ash/components/tether/wifi_hotspot_disconnector_impl.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/memory/ptr_util.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/asynchronous_shutdown_object_container_impl.h" -#include "chromeos/components/tether/crash_recovery_manager_impl.h" -#include "chromeos/components/tether/host_scan_scheduler.h" -#include "chromeos/components/tether/persistent_host_scan_cache_impl.h" -#include "chromeos/components/tether/synchronous_shutdown_object_container_impl.h" -#include "chromeos/components/tether/tether_disconnector.h" -#include "chromeos/components/tether/tether_host_response_recorder.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" -#include "chromeos/components/tether/wifi_hotspot_disconnector_impl.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "components/pref_registry/pref_registry_syncable.h"
diff --git a/chromeos/components/tether/tether_component_impl.h b/ash/components/tether/tether_component_impl.h similarity index 94% rename from chromeos/components/tether/tether_component_impl.h rename to ash/components/tether/tether_component_impl.h index 2fc3ea4..867d1fe 100644 --- a/chromeos/components/tether/tether_component_impl.h +++ b/ash/components/tether/tether_component_impl.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_COMPONENT_IMPL_H_ +#define ASH_COMPONENTS_TETHER_TETHER_COMPONENT_IMPL_H_ #include <memory> +#include "ash/components/tether/tether_component.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/tether/tether_component.h" #include "components/prefs/pref_registry_simple.h" #include "device/bluetooth/bluetooth_adapter.h" @@ -138,4 +138,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_COMPONENT_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_COMPONENT_IMPL_H_
diff --git a/chromeos/components/tether/tether_component_impl_unittest.cc b/ash/components/tether/tether_component_impl_unittest.cc similarity index 93% rename from chromeos/components/tether/tether_component_impl_unittest.cc rename to ash/components/tether/tether_component_impl_unittest.cc index 6265d43..305297f 100644 --- a/chromeos/components/tether/tether_component_impl_unittest.cc +++ b/ash/components/tether/tether_component_impl_unittest.cc
@@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/tether_component_impl.h" +#include "ash/components/tether/tether_component_impl.h" #include <memory> +#include "ash/components/tether/asynchronous_shutdown_object_container_impl.h" +#include "ash/components/tether/crash_recovery_manager_impl.h" +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_asynchronous_shutdown_object_container.h" +#include "ash/components/tether/fake_crash_recovery_manager.h" +#include "ash/components/tether/fake_host_scan_scheduler.h" +#include "ash/components/tether/fake_synchronous_shutdown_object_container.h" +#include "ash/components/tether/fake_tether_disconnector.h" +#include "ash/components/tether/synchronous_shutdown_object_container_impl.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include "base/bind.h" #include "base/memory/ptr_util.h" -#include "chromeos/components/tether/asynchronous_shutdown_object_container_impl.h" -#include "chromeos/components/tether/crash_recovery_manager_impl.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/fake_asynchronous_shutdown_object_container.h" -#include "chromeos/components/tether/fake_crash_recovery_manager.h" -#include "chromeos/components/tether/fake_host_scan_scheduler.h" -#include "chromeos/components/tether/fake_synchronous_shutdown_object_container.h" -#include "chromeos/components/tether/fake_tether_disconnector.h" -#include "chromeos/components/tether/synchronous_shutdown_object_container_impl.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/components/tether/tether_connector.h b/ash/components/tether/tether_connector.h similarity index 88% rename from chromeos/components/tether/tether_connector.h rename to ash/components/tether/tether_connector.h index d7eeda1..d1efd13 100644 --- a/chromeos/components/tether/tether_connector.h +++ b/ash/components/tether/tether_connector.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 CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ +#define ASH_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ #include "base/callback_forward.h" #include "chromeos/network/network_connection_handler.h" @@ -42,4 +42,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_CONNECTOR_H_
diff --git a/chromeos/components/tether/tether_connector_impl.cc b/ash/components/tether/tether_connector_impl.cc similarity index 96% rename from chromeos/components/tether/tether_connector_impl.cc rename to ash/components/tether/tether_connector_impl.cc index e7f8c21..d86d3ff 100644 --- a/chromeos/components/tether/tether_connector_impl.cc +++ b/ash/components/tether/tether_connector_impl.cc
@@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/tether_connector_impl.h" +#include "ash/components/tether/tether_connector_impl.h" +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/disconnect_tethering_request_sender.h" +#include "ash/components/tether/host_connection_metrics_logger.h" +#include "ash/components/tether/host_scan_cache.h" +#include "ash/components/tether/notification_presenter.h" +#include "ash/components/tether/tether_host_fetcher.h" +#include "ash/components/tether/wifi_hotspot_connector.h" +#include "ash/components/tether/wifi_hotspot_disconnector.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/metrics/histogram_macros.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/disconnect_tethering_request_sender.h" -#include "chromeos/components/tether/host_connection_metrics_logger.h" -#include "chromeos/components/tether/host_scan_cache.h" -#include "chromeos/components/tether/notification_presenter.h" -#include "chromeos/components/tether/tether_host_fetcher.h" -#include "chromeos/components/tether/wifi_hotspot_connector.h" -#include "chromeos/components/tether/wifi_hotspot_disconnector.h" #include "chromeos/network/network_handler.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h"
diff --git a/chromeos/components/tether/tether_connector_impl.h b/ash/components/tether/tether_connector_impl.h similarity index 92% rename from chromeos/components/tether/tether_connector_impl.h rename to ash/components/tether/tether_connector_impl.h index 80771c0..d8cba93 100644 --- a/chromeos/components/tether/tether_connector_impl.h +++ b/ash/components/tether/tether_connector_impl.h
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_CONNECTOR_IMPL_H_ +#define ASH_COMPONENTS_TETHER_TETHER_CONNECTOR_IMPL_H_ +#include "ash/components/tether/connect_tethering_operation.h" +#include "ash/components/tether/host_connection_metrics_logger.h" +#include "ash/components/tether/tether_connector.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/tether/connect_tethering_operation.h" -#include "chromeos/components/tether/host_connection_metrics_logger.h" -#include "chromeos/components/tether/tether_connector.h" #include "chromeos/network/network_connection_handler.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -129,4 +129,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_CONNECTOR_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_CONNECTOR_IMPL_H_
diff --git a/chromeos/components/tether/tether_connector_impl_unittest.cc b/ash/components/tether/tether_connector_impl_unittest.cc similarity index 97% rename from chromeos/components/tether/tether_connector_impl_unittest.cc rename to ash/components/tether/tether_connector_impl_unittest.cc index d7d35da..8e545b9 100644 --- a/chromeos/components/tether/tether_connector_impl_unittest.cc +++ b/ash/components/tether/tether_connector_impl_unittest.cc
@@ -2,28 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/tether_connector_impl.h" +#include "ash/components/tether/tether_connector_impl.h" #include <memory> +#include "ash/components/tether/connect_tethering_operation.h" +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_disconnect_tethering_request_sender.h" +#include "ash/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/fake_notification_presenter.h" +#include "ash/components/tether/fake_tether_host_fetcher.h" +#include "ash/components/tether/fake_wifi_hotspot_connector.h" +#include "ash/components/tether/fake_wifi_hotspot_disconnector.h" +#include "ash/components/tether/mock_host_connection_metrics_logger.h" +#include "ash/components/tether/mock_tether_host_response_recorder.h" +#include "ash/components/tether/tether_connector.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/task_environment.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/connect_tethering_operation.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/fake_disconnect_tethering_request_sender.h" -#include "chromeos/components/tether/fake_host_scan_cache.h" -#include "chromeos/components/tether/fake_notification_presenter.h" -#include "chromeos/components/tether/fake_tether_host_fetcher.h" -#include "chromeos/components/tether/fake_wifi_hotspot_connector.h" -#include "chromeos/components/tether/fake_wifi_hotspot_disconnector.h" -#include "chromeos/components/tether/mock_host_connection_metrics_logger.h" -#include "chromeos/components/tether/mock_tether_host_response_recorder.h" -#include "chromeos/components/tether/tether_connector.h" #include "chromeos/network/network_connection_handler.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h"
diff --git a/chromeos/components/tether/tether_disconnector.h b/ash/components/tether/tether_disconnector.h similarity index 80% rename from chromeos/components/tether/tether_disconnector.h rename to ash/components/tether/tether_disconnector.h index d15a31c..34de2c88 100644 --- a/chromeos/components/tether/tether_disconnector.h +++ b/ash/components/tether/tether_disconnector.h
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ +#define ASH_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ #include <string> +#include "ash/components/tether/disconnect_tethering_operation.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include "base/callback_forward.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/tether/disconnect_tethering_operation.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" #include "chromeos/network/network_connection_handler.h" namespace chromeos { @@ -46,4 +46,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_DISCONNECTOR_H_
diff --git a/chromeos/components/tether/tether_disconnector_impl.cc b/ash/components/tether/tether_disconnector_impl.cc similarity index 91% rename from chromeos/components/tether/tether_disconnector_impl.cc rename to ash/components/tether/tether_disconnector_impl.cc index ef7efc6d..f8c1dc5d3 100644 --- a/chromeos/components/tether/tether_disconnector_impl.cc +++ b/ash/components/tether/tether_disconnector_impl.cc
@@ -2,17 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/tether_disconnector_impl.h" +#include "ash/components/tether/tether_disconnector_impl.h" +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/disconnect_tethering_request_sender.h" +#include "ash/components/tether/network_configuration_remover.h" +#include "ash/components/tether/tether_connector.h" +#include "ash/components/tether/wifi_hotspot_disconnector.h" #include "base/metrics/histogram_macros.h" #include "base/values.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/disconnect_tethering_request_sender.h" -#include "chromeos/components/tether/network_configuration_remover.h" -#include "chromeos/components/tether/tether_connector.h" -#include "chromeos/components/tether/wifi_hotspot_disconnector.h" #include "chromeos/network/network_connection_handler.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h"
diff --git a/chromeos/components/tether/tether_disconnector_impl.h b/ash/components/tether/tether_disconnector_impl.h similarity index 86% rename from chromeos/components/tether/tether_disconnector_impl.h rename to ash/components/tether/tether_disconnector_impl.h index 46c2c31..6dca7a0 100644 --- a/chromeos/components/tether/tether_disconnector_impl.h +++ b/ash/components/tether/tether_disconnector_impl.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_DISCONNECTOR_IMPL_H_ +#define ASH_COMPONENTS_TETHER_TETHER_DISCONNECTOR_IMPL_H_ #include <memory> #include <string> +#include "ash/components/tether/tether_disconnector.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include "base/callback_forward.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/tether/tether_disconnector.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" namespace chromeos { @@ -67,4 +67,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_DISCONNECTOR_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_DISCONNECTOR_IMPL_H_
diff --git a/chromeos/components/tether/tether_disconnector_impl_unittest.cc b/ash/components/tether/tether_disconnector_impl_unittest.cc similarity index 94% rename from chromeos/components/tether/tether_disconnector_impl_unittest.cc rename to ash/components/tether/tether_disconnector_impl_unittest.cc index cfa667d..92d62a8 100644 --- a/chromeos/components/tether/tether_disconnector_impl_unittest.cc +++ b/ash/components/tether/tether_disconnector_impl_unittest.cc
@@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/tether_disconnector_impl.h" +#include "ash/components/tether/tether_disconnector_impl.h" #include <memory> +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_disconnect_tethering_request_sender.h" +#include "ash/components/tether/fake_tether_connector.h" +#include "ash/components/tether/fake_tether_session_completion_logger.h" +#include "ash/components/tether/fake_wifi_hotspot_disconnector.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include "base/bind.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/fake_disconnect_tethering_request_sender.h" -#include "chromeos/components/tether/fake_tether_connector.h" -#include "chromeos/components/tether/fake_tether_session_completion_logger.h" -#include "chromeos/components/tether/fake_wifi_hotspot_disconnector.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/components/tether/tether_host_fetcher.cc b/ash/components/tether/tether_host_fetcher.cc similarity index 95% rename from chromeos/components/tether/tether_host_fetcher.cc rename to ash/components/tether/tether_host_fetcher.cc index 5b985f6..718a8f7 100644 --- a/chromeos/components/tether/tether_host_fetcher.cc +++ b/ash/components/tether/tether_host_fetcher.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 "chromeos/components/tether/tether_host_fetcher.h" +#include "ash/components/tether/tether_host_fetcher.h" #include <memory>
diff --git a/chromeos/components/tether/tether_host_fetcher.h b/ash/components/tether/tether_host_fetcher.h similarity index 92% rename from chromeos/components/tether/tether_host_fetcher.h rename to ash/components/tether/tether_host_fetcher.h index 9c2740d..bef12061f 100644 --- a/chromeos/components/tether/tether_host_fetcher.h +++ b/ash/components/tether/tether_host_fetcher.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 CHROMEOS_COMPONENTS_TETHER_TETHER_HOST_FETCHER_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_HOST_FETCHER_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_HOST_FETCHER_H_ +#define ASH_COMPONENTS_TETHER_TETHER_HOST_FETCHER_H_ #include <memory> @@ -71,4 +71,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_HOST_FETCHER_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_HOST_FETCHER_H_
diff --git a/chromeos/components/tether/tether_host_fetcher_impl.cc b/ash/components/tether/tether_host_fetcher_impl.cc similarity index 97% rename from chromeos/components/tether/tether_host_fetcher_impl.cc rename to ash/components/tether/tether_host_fetcher_impl.cc index dc161c6..8641fecb 100644 --- a/chromeos/components/tether/tether_host_fetcher_impl.cc +++ b/ash/components/tether/tether_host_fetcher_impl.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 "chromeos/components/tether/tether_host_fetcher_impl.h" +#include "ash/components/tether/tether_host_fetcher_impl.h" #include <memory>
diff --git a/chromeos/components/tether/tether_host_fetcher_impl.h b/ash/components/tether/tether_host_fetcher_impl.h similarity index 92% rename from chromeos/components/tether/tether_host_fetcher_impl.h rename to ash/components/tether/tether_host_fetcher_impl.h index b11c17e..b0dd3fc 100644 --- a/chromeos/components/tether/tether_host_fetcher_impl.h +++ b/ash/components/tether/tether_host_fetcher_impl.h
@@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_HOST_FETCHER_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_HOST_FETCHER_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_HOST_FETCHER_IMPL_H_ +#define ASH_COMPONENTS_TETHER_TETHER_HOST_FETCHER_IMPL_H_ #include <memory> +#include "ash/components/tether/tether_host_fetcher.h" #include "base/memory/weak_ptr.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/tether_host_fetcher.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" @@ -93,4 +93,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_HOST_FETCHER_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_HOST_FETCHER_IMPL_H_
diff --git a/chromeos/components/tether/tether_host_fetcher_impl_unittest.cc b/ash/components/tether/tether_host_fetcher_impl_unittest.cc similarity index 99% rename from chromeos/components/tether/tether_host_fetcher_impl_unittest.cc rename to ash/components/tether/tether_host_fetcher_impl_unittest.cc index ce25c95..af8f769 100644 --- a/chromeos/components/tether/tether_host_fetcher_impl_unittest.cc +++ b/ash/components/tether/tether_host_fetcher_impl_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 "chromeos/components/tether/tether_host_fetcher_impl.h" +#include "ash/components/tether/tether_host_fetcher_impl.h" #include <memory> #include <vector>
diff --git a/chromeos/components/tether/tether_host_response_recorder.cc b/ash/components/tether/tether_host_response_recorder.cc similarity index 96% rename from chromeos/components/tether/tether_host_response_recorder.cc rename to ash/components/tether/tether_host_response_recorder.cc index b067e67e..8efcf07 100644 --- a/chromeos/components/tether/tether_host_response_recorder.cc +++ b/ash/components/tether/tether_host_response_recorder.cc
@@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/tether_host_response_recorder.h" +#include "ash/components/tether/tether_host_response_recorder.h" #include <memory> +#include "ash/components/tether/pref_names.h" #include "base/values.h" -#include "chromeos/components/tether/pref_names.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h"
diff --git a/chromeos/components/tether/tether_host_response_recorder.h b/ash/components/tether/tether_host_response_recorder.h similarity index 94% rename from chromeos/components/tether/tether_host_response_recorder.h rename to ash/components/tether/tether_host_response_recorder.h index 564c02d..326637d 100644 --- a/chromeos/components/tether/tether_host_response_recorder.h +++ b/ash/components/tether/tether_host_response_recorder.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 CHROMEOS_COMPONENTS_TETHER_TETHER_HOST_RESPONSE_RECORDER_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_HOST_RESPONSE_RECORDER_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_HOST_RESPONSE_RECORDER_H_ +#define ASH_COMPONENTS_TETHER_TETHER_HOST_RESPONSE_RECORDER_H_ #include <string> #include <vector> @@ -94,4 +94,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_HOST_RESPONSE_RECORDER_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_HOST_RESPONSE_RECORDER_H_
diff --git a/chromeos/components/tether/tether_host_response_recorder_unittest.cc b/ash/components/tether/tether_host_response_recorder_unittest.cc similarity index 98% rename from chromeos/components/tether/tether_host_response_recorder_unittest.cc rename to ash/components/tether/tether_host_response_recorder_unittest.cc index 164f9d6..b118e1d2a 100644 --- a/chromeos/components/tether/tether_host_response_recorder_unittest.cc +++ b/ash/components/tether/tether_host_response_recorder_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 "chromeos/components/tether/tether_host_response_recorder.h" +#include "ash/components/tether/tether_host_response_recorder.h" #include <memory>
diff --git a/chromeos/components/tether/tether_network_disconnection_handler.cc b/ash/components/tether/tether_network_disconnection_handler.cc similarity index 90% rename from chromeos/components/tether/tether_network_disconnection_handler.cc rename to ash/components/tether/tether_network_disconnection_handler.cc index be364f7..85b7e82 100644 --- a/chromeos/components/tether/tether_network_disconnection_handler.cc +++ b/ash/components/tether/tether_network_disconnection_handler.cc
@@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/tether_network_disconnection_handler.h" +#include "ash/components/tether/tether_network_disconnection_handler.h" +#include "ash/components/tether/disconnect_tethering_request_sender.h" +#include "ash/components/tether/network_configuration_remover.h" +#include "ash/components/tether/tether_disconnector.h" +#include "ash/components/tether/tether_host_fetcher.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/disconnect_tethering_request_sender.h" -#include "chromeos/components/tether/network_configuration_remover.h" -#include "chromeos/components/tether/tether_disconnector.h" -#include "chromeos/components/tether/tether_host_fetcher.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" #include "chromeos/network/network_handler.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h"
diff --git a/chromeos/components/tether/tether_network_disconnection_handler.h b/ash/components/tether/tether_network_disconnection_handler.h similarity index 89% rename from chromeos/components/tether/tether_network_disconnection_handler.h rename to ash/components/tether/tether_network_disconnection_handler.h index 12a3888..76f137d4 100644 --- a/chromeos/components/tether/tether_network_disconnection_handler.h +++ b/ash/components/tether/tether_network_disconnection_handler.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_TETHER_NETWORK_DISCONNECTION_HANDLER_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_NETWORK_DISCONNECTION_HANDLER_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_NETWORK_DISCONNECTION_HANDLER_H_ +#define ASH_COMPONENTS_TETHER_TETHER_NETWORK_DISCONNECTION_HANDLER_H_ +#include "ash/components/tether/active_host.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/tether/active_host.h" #include "chromeos/network/network_state_handler_observer.h" namespace base { @@ -72,4 +72,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_NETWORK_DISCONNECTION_HANDLER_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_NETWORK_DISCONNECTION_HANDLER_H_
diff --git a/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc b/ash/components/tether/tether_network_disconnection_handler_unittest.cc similarity index 92% rename from chromeos/components/tether/tether_network_disconnection_handler_unittest.cc rename to ash/components/tether/tether_network_disconnection_handler_unittest.cc index 6163969..e1e6127 100644 --- a/chromeos/components/tether/tether_network_disconnection_handler_unittest.cc +++ b/ash/components/tether/tether_network_disconnection_handler_unittest.cc
@@ -2,20 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/tether_network_disconnection_handler.h" +#include "ash/components/tether/tether_network_disconnection_handler.h" #include <memory> +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_disconnect_tethering_request_sender.h" +#include "ash/components/tether/fake_network_configuration_remover.h" +#include "ash/components/tether/fake_tether_session_completion_logger.h" +#include "ash/components/tether/network_configuration_remover.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "base/test/test_simple_task_runner.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/fake_disconnect_tethering_request_sender.h" -#include "chromeos/components/tether/fake_network_configuration_remover.h" -#include "chromeos/components/tether/fake_tether_session_completion_logger.h" -#include "chromeos/components/tether/network_configuration_remover.h" -#include "chromeos/components/tether/tether_session_completion_logger.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_state_test_helper.h"
diff --git a/chromeos/components/tether/tether_session_completion_logger.cc b/ash/components/tether/tether_session_completion_logger.cc similarity index 90% rename from chromeos/components/tether/tether_session_completion_logger.cc rename to ash/components/tether/tether_session_completion_logger.cc index b460e01..644bb6fb 100644 --- a/chromeos/components/tether/tether_session_completion_logger.cc +++ b/ash/components/tether/tether_session_completion_logger.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 "chromeos/components/tether/tether_session_completion_logger.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include "base/metrics/histogram_macros.h"
diff --git a/chromeos/components/tether/tether_session_completion_logger.h b/ash/components/tether/tether_session_completion_logger.h similarity index 84% rename from chromeos/components/tether/tether_session_completion_logger.h rename to ash/components/tether/tether_session_completion_logger.h index a737991..12ac14a 100644 --- a/chromeos/components/tether/tether_session_completion_logger.h +++ b/ash/components/tether/tether_session_completion_logger.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 CHROMEOS_COMPONENTS_TETHER_TETHER_SESSION_COMPLETION_LOGGER_H_ -#define CHROMEOS_COMPONENTS_TETHER_TETHER_SESSION_COMPLETION_LOGGER_H_ +#ifndef ASH_COMPONENTS_TETHER_TETHER_SESSION_COMPLETION_LOGGER_H_ +#define ASH_COMPONENTS_TETHER_TETHER_SESSION_COMPLETION_LOGGER_H_ namespace chromeos { @@ -47,4 +47,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TETHER_SESSION_COMPLETION_LOGGER_H_ +#endif // ASH_COMPONENTS_TETHER_TETHER_SESSION_COMPLETION_LOGGER_H_
diff --git a/chromeos/components/tether/tether_session_completion_logger_unittest.cc b/ash/components/tether/tether_session_completion_logger_unittest.cc similarity index 97% rename from chromeos/components/tether/tether_session_completion_logger_unittest.cc rename to ash/components/tether/tether_session_completion_logger_unittest.cc index 09cc4caa..1594499 100644 --- a/chromeos/components/tether/tether_session_completion_logger_unittest.cc +++ b/ash/components/tether/tether_session_completion_logger_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 "chromeos/components/tether/tether_session_completion_logger.h" +#include "ash/components/tether/tether_session_completion_logger.h" #include <memory>
diff --git a/chromeos/components/tether/timer_factory.cc b/ash/components/tether/timer_factory.cc similarity index 88% rename from chromeos/components/tether/timer_factory.cc rename to ash/components/tether/timer_factory.cc index b4bc0ab..cde74820 100644 --- a/chromeos/components/tether/timer_factory.cc +++ b/ash/components/tether/timer_factory.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 "chromeos/components/tether/timer_factory.h" +#include "ash/components/tether/timer_factory.h" #include <memory>
diff --git a/chromeos/components/tether/timer_factory.h b/ash/components/tether/timer_factory.h similarity index 80% rename from chromeos/components/tether/timer_factory.h rename to ash/components/tether/timer_factory.h index 2292c31..443a79a6 100644 --- a/chromeos/components/tether/timer_factory.h +++ b/ash/components/tether/timer_factory.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 CHROMEOS_COMPONENTS_TETHER_TIMER_FACTORY_H_ -#define CHROMEOS_COMPONENTS_TETHER_TIMER_FACTORY_H_ +#ifndef ASH_COMPONENTS_TETHER_TIMER_FACTORY_H_ +#define ASH_COMPONENTS_TETHER_TIMER_FACTORY_H_ #include <memory> @@ -28,4 +28,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TIMER_FACTORY_H_ +#endif // ASH_COMPONENTS_TETHER_TIMER_FACTORY_H_
diff --git a/chromeos/components/tether/top_level_host_scan_cache.cc b/ash/components/tether/top_level_host_scan_cache.cc similarity index 96% rename from chromeos/components/tether/top_level_host_scan_cache.cc rename to ash/components/tether/top_level_host_scan_cache.cc index 82d4429..8e98f175 100644 --- a/chromeos/components/tether/top_level_host_scan_cache.cc +++ b/ash/components/tether/top_level_host_scan_cache.cc
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/top_level_host_scan_cache.h" +#include "ash/components/tether/top_level_host_scan_cache.h" #include <algorithm> +#include "ash/components/tether/active_host.h" +#include "ash/components/tether/persistent_host_scan_cache.h" +#include "ash/components/tether/timer_factory.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/active_host.h" -#include "chromeos/components/tether/persistent_host_scan_cache.h" -#include "chromeos/components/tether/timer_factory.h" namespace chromeos {
diff --git a/chromeos/components/tether/top_level_host_scan_cache.h b/ash/components/tether/top_level_host_scan_cache.h similarity index 92% rename from chromeos/components/tether/top_level_host_scan_cache.h rename to ash/components/tether/top_level_host_scan_cache.h index 8bc3825..d15eb50 100644 --- a/chromeos/components/tether/top_level_host_scan_cache.h +++ b/ash/components/tether/top_level_host_scan_cache.h
@@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_TOP_LEVEL_HOST_SCAN_CACHE_H_ -#define CHROMEOS_COMPONENTS_TETHER_TOP_LEVEL_HOST_SCAN_CACHE_H_ +#ifndef ASH_COMPONENTS_TETHER_TOP_LEVEL_HOST_SCAN_CACHE_H_ +#define ASH_COMPONENTS_TETHER_TOP_LEVEL_HOST_SCAN_CACHE_H_ #include <memory> #include <string> #include <unordered_map> #include <unordered_set> +#include "ash/components/tether/host_scan_cache.h" #include "base/gtest_prod_util.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "chromeos/components/tether/host_scan_cache.h" namespace chromeos { @@ -88,4 +88,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_TOP_LEVEL_HOST_SCAN_CACHE_H_ +#endif // ASH_COMPONENTS_TETHER_TOP_LEVEL_HOST_SCAN_CACHE_H_
diff --git a/chromeos/components/tether/top_level_host_scan_cache_unittest.cc b/ash/components/tether/top_level_host_scan_cache_unittest.cc similarity index 96% rename from chromeos/components/tether/top_level_host_scan_cache_unittest.cc rename to ash/components/tether/top_level_host_scan_cache_unittest.cc index 94af935..5e78c3c4 100644 --- a/chromeos/components/tether/top_level_host_scan_cache_unittest.cc +++ b/ash/components/tether/top_level_host_scan_cache_unittest.cc
@@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/top_level_host_scan_cache.h" +#include "ash/components/tether/top_level_host_scan_cache.h" #include <memory> #include <unordered_map> #include <vector> +#include "ash/components/tether/device_id_tether_network_guid_map.h" +#include "ash/components/tether/fake_active_host.h" +#include "ash/components/tether/fake_host_scan_cache.h" +#include "ash/components/tether/host_scan_test_util.h" +#include "ash/components/tether/persistent_host_scan_cache.h" +#include "ash/components/tether/timer_factory.h" #include "base/bind.h" #include "base/callback.h" #include "base/memory/ptr_util.h" #include "base/timer/mock_timer.h" -#include "chromeos/components/tether/device_id_tether_network_guid_map.h" -#include "chromeos/components/tether/fake_active_host.h" -#include "chromeos/components/tether/fake_host_scan_cache.h" -#include "chromeos/components/tether/host_scan_test_util.h" -#include "chromeos/components/tether/persistent_host_scan_cache.h" -#include "chromeos/components/tether/timer_factory.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/components/tether/wifi_hotspot_connector.cc b/ash/components/tether/wifi_hotspot_connector.cc similarity index 99% rename from chromeos/components/tether/wifi_hotspot_connector.cc rename to ash/components/tether/wifi_hotspot_connector.cc index c2551b2..1506cd0 100644 --- a/chromeos/components/tether/wifi_hotspot_connector.cc +++ b/ash/components/tether/wifi_hotspot_connector.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 "chromeos/components/tether/wifi_hotspot_connector.h" +#include "ash/components/tether/wifi_hotspot_connector.h" #include <memory>
diff --git a/chromeos/components/tether/wifi_hotspot_connector.h b/ash/components/tether/wifi_hotspot_connector.h similarity index 93% rename from chromeos/components/tether/wifi_hotspot_connector.h rename to ash/components/tether/wifi_hotspot_connector.h index 801ff23..7230f0f 100644 --- a/chromeos/components/tether/wifi_hotspot_connector.h +++ b/ash/components/tether/wifi_hotspot_connector.h
@@ -2,16 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_ -#define CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_ +#ifndef ASH_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_ +#define ASH_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_ +#include "ash/components/tether/active_host.h" #include "base/callback.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/time/clock.h" #include "base/timer/timer.h" #include "base/values.h" -#include "chromeos/components/tether/active_host.h" #include "chromeos/network/network_state_handler_observer.h" namespace base { @@ -99,4 +99,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_ +#endif // ASH_COMPONENTS_TETHER_WIFI_HOTSPOT_CONNECTOR_H_
diff --git a/chromeos/components/tether/wifi_hotspot_connector_unittest.cc b/ash/components/tether/wifi_hotspot_connector_unittest.cc similarity index 99% rename from chromeos/components/tether/wifi_hotspot_connector_unittest.cc rename to ash/components/tether/wifi_hotspot_connector_unittest.cc index 197dd26..338a9d8 100644 --- a/chromeos/components/tether/wifi_hotspot_connector_unittest.cc +++ b/ash/components/tether/wifi_hotspot_connector_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 "chromeos/components/tether/wifi_hotspot_connector.h" +#include "ash/components/tether/wifi_hotspot_connector.h" #include <memory> #include <sstream>
diff --git a/chromeos/components/tether/wifi_hotspot_disconnector.h b/ash/components/tether/wifi_hotspot_disconnector.h similarity index 85% rename from chromeos/components/tether/wifi_hotspot_disconnector.h rename to ash/components/tether/wifi_hotspot_disconnector.h index 0dcbf2b..e7fd127 100644 --- a/chromeos/components/tether/wifi_hotspot_disconnector.h +++ b/ash/components/tether/wifi_hotspot_disconnector.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 CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_H_ -#define CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_H_ +#ifndef ASH_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_H_ +#define ASH_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_H_ #include "base/callback.h" #include "chromeos/network/network_connection_handler.h" @@ -38,4 +38,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_H_ +#endif // ASH_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_H_
diff --git a/chromeos/components/tether/wifi_hotspot_disconnector_impl.cc b/ash/components/tether/wifi_hotspot_disconnector_impl.cc similarity index 96% rename from chromeos/components/tether/wifi_hotspot_disconnector_impl.cc rename to ash/components/tether/wifi_hotspot_disconnector_impl.cc index 135a3fc..4fd948f 100644 --- a/chromeos/components/tether/wifi_hotspot_disconnector_impl.cc +++ b/ash/components/tether/wifi_hotspot_disconnector_impl.cc
@@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/wifi_hotspot_disconnector_impl.h" +#include "ash/components/tether/wifi_hotspot_disconnector_impl.h" +#include "ash/components/tether/network_configuration_remover.h" +#include "ash/components/tether/pref_names.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/network_configuration_remover.h" -#include "chromeos/components/tether/pref_names.h" #include "chromeos/network/network_connection_handler.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h"
diff --git a/chromeos/components/tether/wifi_hotspot_disconnector_impl.h b/ash/components/tether/wifi_hotspot_disconnector_impl.h similarity index 89% rename from chromeos/components/tether/wifi_hotspot_disconnector_impl.h rename to ash/components/tether/wifi_hotspot_disconnector_impl.h index 284a2a68..620c7e1 100644 --- a/chromeos/components/tether/wifi_hotspot_disconnector_impl.h +++ b/ash/components/tether/wifi_hotspot_disconnector_impl.h
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_IMPL_H_ -#define CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_IMPL_H_ +#ifndef ASH_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_IMPL_H_ +#define ASH_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_IMPL_H_ +#include "ash/components/tether/wifi_hotspot_disconnector.h" #include "base/memory/weak_ptr.h" -#include "chromeos/components/tether/wifi_hotspot_disconnector.h" class PrefRegistrySimple; class PrefService; @@ -70,4 +70,4 @@ } // namespace chromeos -#endif // CHROMEOS_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_IMPL_H_ +#endif // ASH_COMPONENTS_TETHER_WIFI_HOTSPOT_DISCONNECTOR_IMPL_H_
diff --git a/chromeos/components/tether/wifi_hotspot_disconnector_impl_unittest.cc b/ash/components/tether/wifi_hotspot_disconnector_impl_unittest.cc similarity index 97% rename from chromeos/components/tether/wifi_hotspot_disconnector_impl_unittest.cc rename to ash/components/tether/wifi_hotspot_disconnector_impl_unittest.cc index 6f4c2ad..a3745f6 100644 --- a/chromeos/components/tether/wifi_hotspot_disconnector_impl_unittest.cc +++ b/ash/components/tether/wifi_hotspot_disconnector_impl_unittest.cc
@@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/components/tether/wifi_hotspot_disconnector_impl.h" +#include "ash/components/tether/wifi_hotspot_disconnector_impl.h" #include <memory> +#include "ash/components/tether/fake_network_configuration_remover.h" +#include "ash/components/tether/pref_names.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/test/task_environment.h" -#include "chromeos/components/tether/fake_network_configuration_remover.h" -#include "chromeos/components/tether/pref_names.h" #include "chromeos/network/network_connection_handler.h" #include "chromeos/network/network_state.h" #include "chromeos/network/network_state_handler.h"
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index 4f72b139..8ed43fd0 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -614,13 +614,6 @@ const base::Feature kFirmwareUpdaterApp = {"FirmwareUpdaterApp", base::FEATURE_DISABLED_BY_DEFAULT}; -// When enabled, there will be an alert bubble showing up when the device -// returns from low brightness (e.g., sleep, closed cover) without a lock screen -// and the active window is in fullscreen. -// TODO(https://crbug.com/1107185): Remove this after the feature is launched. -const base::Feature kFullscreenAlertBubble{"EnableFullscreenBubble", - base::FEATURE_DISABLED_BY_DEFAULT}; - // Enable ChromeOS FuseBox service. const base::Feature kFuseBox{"FuseBox", base::FEATURE_DISABLED_BY_DEFAULT}; @@ -1533,10 +1526,6 @@ return base::FeatureList::IsEnabled(kFirmwareUpdaterApp); } -bool IsFullscreenAlertBubbleEnabled() { - return base::FeatureList::IsEnabled(kFullscreenAlertBubble); -} - bool IsGaiaCloseViewMessageEnabled() { return base::FeatureList::IsEnabled(kGaiaCloseViewMessage); }
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index 362c896..198878c 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h
@@ -236,8 +236,6 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kFilesTrash; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kFiltersInRecents; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kFirmwareUpdaterApp; -COMPONENT_EXPORT(ASH_CONSTANTS) -extern const base::Feature kFullscreenAlertBubble; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kFuseBox; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kGaiaCloseViewMessage; @@ -551,7 +549,6 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsFastPairEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsFileManagerSwaEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsFirmwareUpdaterAppEnabled(); -COMPONENT_EXPORT(ASH_CONSTANTS) bool IsFullscreenAlertBubbleEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsGaiaCloseViewMessageEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsGaiaReauthEndpointEnabled(); COMPONENT_EXPORT(ASH_CONSTANTS) bool IsHideArcMediaNotificationsEnabled();
diff --git a/ash/debug.cc b/ash/debug.cc index fe6e5a7..02c4c4b7 100644 --- a/ash/debug.cc +++ b/ash/debug.cc
@@ -54,6 +54,7 @@ aura::Window* window, int indent, bool scrub_data, + std::vector<std::string>* out_window_titles, std::ostringstream* out) { std::string indent_str(indent, ' '); std::string name(window->GetName()); @@ -85,10 +86,12 @@ if (tree_id) *out << " ax_tree_id=" << *tree_id; - if (!scrub_data) { - std::u16string title(window->GetTitle()); - if (!title.empty()) + std::u16string title(window->GetTitle()); + if (!title.empty()) { + out_window_titles->push_back(base::UTF16ToUTF8(title)); + if (!scrub_data) { *out << " title=" << title; + } } int app_type = window->GetProperty(aura::client::kAppType); @@ -100,19 +103,22 @@ for (aura::Window* child : window->children()) { PrintWindowHierarchy(active_window, focused_window, child, indent + 3, - scrub_data, out); + scrub_data, out_window_titles, out); } } -void PrintWindowHierarchy(std::ostringstream* out, bool scrub_data) { +std::vector<std::string> PrintWindowHierarchy(std::ostringstream* out, + bool scrub_data) { aura::Window* active_window = window_util::GetActiveWindow(); aura::Window* focused_window = window_util::GetFocusedWindow(); aura::Window::Windows roots = Shell::Get()->GetAllRootWindows(); + std::vector<std::string> window_titles; for (size_t i = 0; i < roots.size(); ++i) { *out << "RootWindow " << i << ":\n"; PrintWindowHierarchy(active_window, focused_window, roots[i], 0, scrub_data, - out); + &window_titles, out); } + return window_titles; } void ToggleShowDebugBorders() {
diff --git a/ash/public/cpp/debug_utils.h b/ash/public/cpp/debug_utils.h index be99226..945394ad 100644 --- a/ash/public/cpp/debug_utils.h +++ b/ash/public/cpp/debug_utils.h
@@ -6,6 +6,8 @@ #define ASH_PUBLIC_CPP_DEBUG_UTILS_H_ #include <sstream> +#include <string> +#include <vector> #include "ash/ash_export.h" @@ -19,8 +21,12 @@ ASH_EXPORT void PrintViewHierarchy(std::ostringstream* out); // Prints all windows hierarchy to |out|. If |scrub_data| is true, we -// may skip some data fields that are not very important for debugging. -ASH_EXPORT void PrintWindowHierarchy(std::ostringstream* out, bool scrub_data); +// may skip some data fields that are not very important for debugging. Returns +// a list of window titles. Window titles will be removed from |out| if +// |scrub_data| is true. +ASH_EXPORT std::vector<std::string> PrintWindowHierarchy( + std::ostringstream* out, + bool scrub_data); } // namespace debug } // namespace ash
diff --git a/ash/public/cpp/session/session_controller.h b/ash/public/cpp/session/session_controller.h index fd5555d..962feff 100644 --- a/ash/public/cpp/session/session_controller.h +++ b/ash/public/cpp/session/session_controller.h
@@ -47,12 +47,6 @@ virtual void SetUserSessionOrder( const std::vector<uint32_t>& user_session_ids) = 0; - // Prepares ash for lock screen. Currently this ensures the current active - // window could not be used to mimic the lock screen. Lock screen is created - // after this call returns. - using PrepareForLockCallback = base::OnceClosure; - virtual void PrepareForLock(PrepareForLockCallback callback) = 0; - // Runs the pre-lock animation to start locking ash. When the call returns, // |locked| == true means that the ash post-lock animation is finished and ash // is fully locked. Otherwise |locked| is false, which means something is
diff --git a/ash/session/fullscreen_controller.cc b/ash/session/fullscreen_controller.cc index 45c9017a..50ff6a4 100644 --- a/ash/session/fullscreen_controller.cc +++ b/ash/session/fullscreen_controller.cc
@@ -12,12 +12,15 @@ #include "ash/session/session_controller_impl.h" #include "ash/shelf/shelf.h" #include "ash/shell.h" +#include "ash/shell_delegate.h" #include "ash/wm/window_state.h" #include "ash/wm/wm_event.h" #include "chromeos/dbus/power_manager/backlight.pb.h" #include "chromeos/dbus/power_manager/idle.pb.h" +#include "components/policy/core/browser/url_util.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" +#include "components/url_matcher/url_matcher.h" namespace ash { @@ -60,9 +63,6 @@ } void FullscreenController::MaybeShowNotification() { - if (!features::IsFullscreenAlertBubbleEnabled()) - return; - auto* session_controller = Shell::Get()->session_controller(); // Check if a user session is active to exclude OOBE process. @@ -71,12 +71,7 @@ return; } - auto* prefs = session_controller->GetPrimaryUserPrefService(); - - if (!prefs->GetBoolean(prefs::kFullscreenAlertEnabled)) - return; - - // Check if the activate window is fullscreen. + // Check if the active window is fullscreen. WindowState* active_window_state = WindowState::ForActiveWindow(); if (!active_window_state || !active_window_state->IsFullscreen()) return; @@ -89,6 +84,20 @@ if (shelf_visible && !active_window_state->GetHideShelfWhenFullscreen()) return; + // Get the URL of the active window from the shell delegate. + const GURL& url = + Shell::Get()->shell_delegate()->GetLastCommittedURLForWindowIfAny( + active_window_state->window()); + + // Check if the URL is exempt from the notification by user pref. + auto* prefs = session_controller->GetPrimaryUserPrefService(); + const base::ListValue* url_exempt_list = + prefs->GetList(prefs::kFullscreenNotificationUrlExemptList); + url_matcher::URLMatcher url_matcher; + policy::url_util::AddAllowFilters(&url_matcher, url_exempt_list); + if (!url_matcher.MatchURL(url).empty()) + return; + if (!bubble_) bubble_ = std::make_unique<FullscreenNotificationBubble>();
diff --git a/ash/session/fullscreen_controller_unittest.cc b/ash/session/fullscreen_controller_unittest.cc new file mode 100644 index 0000000..691de07 --- /dev/null +++ b/ash/session/fullscreen_controller_unittest.cc
@@ -0,0 +1,156 @@ +// Copyright 2021 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 "ash/session/fullscreen_controller.h" + +#include <memory> + +#include "ash/constants/ash_pref_names.h" +#include "ash/session/fullscreen_notification_bubble.h" +#include "ash/session/session_controller_impl.h" +#include "ash/shell.h" +#include "ash/test/ash_test_base.h" +#include "ash/test_shell_delegate.h" +#include "ash/wm/window_state.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "ui/aura/client/aura_constants.h" +#include "ui/aura/window.h" +#include "ui/views/widget/widget.h" + +namespace ash { +namespace { + +const GURL kActiveUrl = GURL("https://wwww.test.com"); +const GURL kEmptyUrl = GURL::EmptyGURL(); + +constexpr char kNonMatchingPattern[] = "google.com"; +constexpr char kMatchingPattern[] = "test.com"; +constexpr char kWildcardPattern[] = "*"; + +class FullscreenControllerTest : public AshTestBase { + public: + FullscreenControllerTest() {} + + FullscreenControllerTest(const FullscreenControllerTest&) = delete; + FullscreenControllerTest& operator=(const FullscreenControllerTest&) = delete; + + ~FullscreenControllerTest() override {} + + // AshTestBase: + void SetUp() override { + // Create a shell delegate and set the active URL. + auto test_shell_delegate = std::make_unique<TestShellDelegate>(); + test_shell_delegate_ = test_shell_delegate.get(); + test_shell_delegate->SetLastCommittedURLForWindow(kActiveUrl); + + AshTestBase::SetUp(std::move(test_shell_delegate)); + + CreateFullscreenWindow(); + + fullscreen_controller_ = + Shell::Get()->session_controller()->fullscreen_controller_for_test(); + + GetSessionControllerClient()->LockScreen(); + } + + void TearDown() override { + window_.reset(); + AshTestBase::TearDown(); + } + + void CreateFullscreenWindow() { + window_ = CreateTestWindow(); + window_->SetProperty(aura::client::kShowStateKey, + ui::SHOW_STATE_FULLSCREEN); + } + + void SetFullscreenNotificationExemptList(const std::string& pattern) { + base::Value list(base::Value::Type::LIST); + list.Append(base::Value(pattern)); + Shell::Get()->session_controller()->GetPrimaryUserPrefService()->Set( + prefs::kFullscreenNotificationUrlExemptList, list); + } + + bool IsNotificationVisible() const { + return fullscreen_controller_->bubble_for_test() && + fullscreen_controller_->bubble_for_test()->widget_for_test() && + fullscreen_controller_->bubble_for_test() + ->widget_for_test() + ->IsVisible(); + } + + protected: + std::unique_ptr<aura::Window> window_; + + FullscreenController* fullscreen_controller_ = nullptr; + + raw_ptr<TestShellDelegate> test_shell_delegate_ = nullptr; +}; + +// Test that the notification is not shown on session lock. +TEST_F(FullscreenControllerTest, NotShowingOnLock) { + EXPECT_FALSE(IsNotificationVisible()); +} + +// Test that the notification is shown on session unlock if the exempt list pref +// is unset. +TEST_F(FullscreenControllerTest, UnsetPref_ShowingOnUnlock) { + GetSessionControllerClient()->UnlockScreen(); + EXPECT_TRUE(IsNotificationVisible()); +} + +// Test that the notification is shown on session unlock if the URL of the +// active window does not match any patterns from the exempt list. +TEST_F(FullscreenControllerTest, NonMatchingPref_ShowingOnUnlock) { + SetFullscreenNotificationExemptList(kNonMatchingPattern); + + GetSessionControllerClient()->UnlockScreen(); + EXPECT_TRUE(IsNotificationVisible()); +} + +// Test that the notification is not shown on session unlock if the URL of the +// active window matches a pattern from the exempt list. +TEST_F(FullscreenControllerTest, MatchingPref_NotShowingOnUnlock) { + // Set up the URL exempt list with one matching and one non-matching pattern. + base::Value list(base::Value::Type::LIST); + list.Append(base::Value(kNonMatchingPattern)); + list.Append(base::Value(kMatchingPattern)); + Shell::Get()->session_controller()->GetPrimaryUserPrefService()->Set( + prefs::kFullscreenNotificationUrlExemptList, list); + + GetSessionControllerClient()->UnlockScreen(); + EXPECT_FALSE(IsNotificationVisible()); +} + +// Test that the notification is not shown on session unlock if the exempt list +// includes the wildcard character. +TEST_F(FullscreenControllerTest, WildcardPref_NotShowingOnUnlock) { + SetFullscreenNotificationExemptList(kWildcardPattern); + + GetSessionControllerClient()->UnlockScreen(); + EXPECT_FALSE(IsNotificationVisible()); +} + +// Test that the notification is shown on session unlock if the exempt list pref +// is unset. +TEST_F(FullscreenControllerTest, EmptyUrlUnsetPref_ShowingOnUnlock) { + test_shell_delegate_->SetLastCommittedURLForWindow(kEmptyUrl); + + GetSessionControllerClient()->UnlockScreen(); + EXPECT_TRUE(IsNotificationVisible()); +} + +// Test that the notification is not shown on session unlock if the exempt list +// includes the wildcard character. +TEST_F(FullscreenControllerTest, EmptyUrlWildcardPref_NotShowingOnUnlock) { + test_shell_delegate_->SetLastCommittedURLForWindow(kEmptyUrl); + + SetFullscreenNotificationExemptList(kWildcardPattern); + + GetSessionControllerClient()->UnlockScreen(); + EXPECT_FALSE(IsNotificationVisible()); +} + +} // namespace +} // namespace ash
diff --git a/ash/session/session_controller_impl.cc b/ash/session/session_controller_impl.cc index a6a6a2d..9b01fc0b 100644 --- a/ash/session/session_controller_impl.cc +++ b/ash/session/session_controller_impl.cc
@@ -368,11 +368,6 @@ } } -void SessionControllerImpl::PrepareForLock(PrepareForLockCallback callback) { - FullscreenController::MaybeExitFullscreen(); - std::move(callback).Run(); -} - void SessionControllerImpl::StartLock(StartLockCallback callback) { DCHECK(start_lock_callback_.is_null()); start_lock_callback_ = std::move(callback);
diff --git a/ash/session/session_controller_impl.h b/ash/session/session_controller_impl.h index 7b9e5e8..c4823ab2 100644 --- a/ash/session/session_controller_impl.h +++ b/ash/session/session_controller_impl.h
@@ -192,7 +192,6 @@ void UpdateUserSession(const UserSession& user_session) override; void SetUserSessionOrder( const std::vector<uint32_t>& user_session_order) override; - void PrepareForLock(PrepareForLockCallback callback) override; void StartLock(StartLockCallback callback) override; void NotifyChromeLockAnimationsComplete() override; void RunUnlockAnimation(RunUnlockAnimationCallback callback) override;
diff --git a/ash/session/session_controller_impl_unittest.cc b/ash/session/session_controller_impl_unittest.cc index d562520..fd74374 100644 --- a/ash/session/session_controller_impl_unittest.cc +++ b/ash/session/session_controller_impl_unittest.cc
@@ -9,7 +9,6 @@ #include <utility> #include <vector> -#include "ash/constants/ash_features.h" #include "ash/constants/ash_pref_names.h" #include "ash/login_status.h" #include "ash/public/cpp/ash_prefs.h" @@ -20,12 +19,10 @@ #include "ash/shell.h" #include "ash/system/tray/system_tray_notifier.h" #include "ash/test/ash_test_base.h" -#include "ash/wm/window_state.h" #include "ash/wm/window_util.h" #include "base/bind.h" #include "base/callback.h" #include "base/run_loop.h" -#include "base/test/scoped_feature_list.h" #include "base/threading/thread_task_runner_handle.h" #include "components/prefs/testing_pref_service.h" #include "components/user_manager/user_type.h" @@ -155,6 +152,56 @@ TestSessionObserver observer_; }; +class SessionControllerImplWithShellTest : public AshTestBase { + public: + SessionControllerImplWithShellTest() = default; + + SessionControllerImplWithShellTest( + const SessionControllerImplWithShellTest&) = delete; + SessionControllerImplWithShellTest& operator=( + const SessionControllerImplWithShellTest&) = delete; + + ~SessionControllerImplWithShellTest() override = default; + + // AshTestBase: + void SetUp() override { + AshTestBase::SetUp(); + controller()->AddObserver(&observer_); + + fullscreen_controller_ = controller()->fullscreen_controller_for_test(); + } + + void TearDown() override { + controller()->RemoveObserver(&observer_); + window_.reset(); + AshTestBase::TearDown(); + } + + void CreateFullscreenWindow() { + window_ = CreateTestWindow(); + window_->SetProperty(aura::client::kShowStateKey, + ui::SHOW_STATE_FULLSCREEN); + } + + bool IsNotificationVisible() const { + return fullscreen_controller_->bubble_for_test() && + fullscreen_controller_->bubble_for_test()->widget_for_test() && + fullscreen_controller_->bubble_for_test() + ->widget_for_test() + ->IsVisible(); + } + + SessionControllerImpl* controller() { + return Shell::Get()->session_controller(); + } + const TestSessionObserver* observer() const { return &observer_; } + + private: + TestSessionObserver observer_; + std::unique_ptr<aura::Window> window_; + FullscreenController* fullscreen_controller_ = nullptr; +}; + // Tests that the simple session info is reflected properly. TEST_F(SessionControllerImplTest, SimpleSessionInfo) { SessionInfo info; @@ -233,7 +280,7 @@ } // Tests that session state can be set and reflected properly. -TEST_F(SessionControllerImplTest, SessionState) { +TEST_F(SessionControllerImplWithShellTest, SessionState) { const struct { SessionState state; bool expected_is_screen_locked; @@ -251,7 +298,7 @@ FillDefaultSessionInfo(&info); for (const auto& test_case : kTestCases) { info.state = test_case.state; - SetSessionInfo(info); + controller()->SetSessionInfo(info); EXPECT_EQ(test_case.state, controller()->GetSessionState()) << "Test case state=" << static_cast<int>(test_case.state); @@ -382,24 +429,21 @@ // Tests that user session is unblocked with a running unlock animation so that // focus rules can find a correct activatable window after screen lock is // dismissed. -TEST_F(SessionControllerImplTest, +TEST_F(SessionControllerImplWithShellTest, UserSessionUnblockedWithRunningUnlockAnimation) { SessionInfo info; FillDefaultSessionInfo(&info); // LOCKED means blocked user session. info.state = SessionState::LOCKED; - SetSessionInfo(info); + controller()->SetSessionInfo(info); EXPECT_TRUE(controller()->IsUserSessionBlocked()); - // Mark a running unlock animation unblocks user session. - controller()->RunUnlockAnimation(base::OnceClosure()); - EXPECT_FALSE(controller()->IsUserSessionBlocked()); - const struct { SessionState state; - bool expected_is_user_session_blocked; + bool expect_blocked_after_unlock_animation; } kTestCases[] = { + {SessionState::LOCKED, false}, {SessionState::OOBE, true}, {SessionState::LOGIN_PRIMARY, true}, {SessionState::LOGGED_IN_NOT_ACTIVE, false}, @@ -408,12 +452,13 @@ }; for (const auto& test_case : kTestCases) { info.state = test_case.state; - SetSessionInfo(info); + controller()->SetSessionInfo(info); // Mark a running unlock animation. - controller()->RunUnlockAnimation(base::OnceClosure()); - - EXPECT_EQ(test_case.expected_is_user_session_blocked, + base::RunLoop run_loop; + controller()->RunUnlockAnimation(run_loop.QuitClosure()); + run_loop.Run(); + EXPECT_EQ(test_case.expect_blocked_after_unlock_animation, controller()->IsUserSessionBlocked()) << "Test case state=" << static_cast<int>(test_case.state); } @@ -805,96 +850,26 @@ EXPECT_TRUE(widget->IsActive()); } -class SessionControllerImplLockStateChangedTest : public AshTestBase { - public: - SessionControllerImplLockStateChangedTest() {} - - SessionControllerImplLockStateChangedTest( - const SessionControllerImplLockStateChangedTest&) = delete; - SessionControllerImplLockStateChangedTest& operator=( - const SessionControllerImplLockStateChangedTest&) = delete; - - ~SessionControllerImplLockStateChangedTest() override {} - - // AshTestBase: - void SetUp() override { - // Enable the FullscreenAlertBubble feature for testing. - feature_list_.InitAndEnableFeature(features::kFullscreenAlertBubble); - - AshTestBase::SetUp(); - - // Set the FullscreenAlertEnabled pref value to true for testing. - Shell::Get()->session_controller()->GetPrimaryUserPrefService()->SetBoolean( - prefs::kFullscreenAlertEnabled, true); - - fullscreen_controller_ = - Shell::Get()->session_controller()->fullscreen_controller_for_test(); - } - - void TearDown() override { - window_.reset(); - AshTestBase::TearDown(); - } - - void CreateFullscreenWindow() { - window_ = CreateTestWindow(); - window_->SetProperty(aura::client::kShowStateKey, - ui::SHOW_STATE_FULLSCREEN); - window_state_ = WindowState::Get(window_.get()); - } - - void ExpectFullscreenNotificationShowing(bool expect_notification) { - if (expect_notification) { - views::Widget* fullscreen_notification_widget = - fullscreen_controller_->bubble_for_test()->widget_for_test(); - EXPECT_TRUE(fullscreen_notification_widget->IsVisible()); - return; - } - EXPECT_TRUE(!fullscreen_controller_->bubble_for_test() || - !fullscreen_controller_->bubble_for_test()->widget_for_test() || - !fullscreen_controller_->bubble_for_test() - ->widget_for_test() - ->IsVisible()); - } - - protected: - std::unique_ptr<aura::Window> window_; - - WindowState* window_state_ = nullptr; - FullscreenController* fullscreen_controller_ = nullptr; - - base::test::ScopedFeatureList feature_list_; -}; - -TEST_F(SessionControllerImplLockStateChangedTest, ExitFullscreenBeforeLock) { - CreateFullscreenWindow(); - EXPECT_TRUE(window_state_->IsFullscreen()); - - base::RunLoop run_loop; - Shell::Get()->session_controller()->PrepareForLock(run_loop.QuitClosure()); - EXPECT_FALSE(window_state_->IsFullscreen()); -} - // Test that no full screen notification is shown on session lock or unlock when // there is no window in full screen mode. -TEST_F(SessionControllerImplLockStateChangedTest, WithoutFullscreenWindow) { +TEST_F(SessionControllerImplWithShellTest, WithoutFullscreenWindow) { GetSessionControllerClient()->LockScreen(); - ExpectFullscreenNotificationShowing(false); + EXPECT_FALSE(IsNotificationVisible()); GetSessionControllerClient()->UnlockScreen(); - ExpectFullscreenNotificationShowing(false); + EXPECT_FALSE(IsNotificationVisible()); } // Test that the full screen notification is shown on session unlock when there // is a window in full screen mode. -TEST_F(SessionControllerImplLockStateChangedTest, WithFullscreenWindow) { +TEST_F(SessionControllerImplWithShellTest, WithFullscreenWindow) { CreateFullscreenWindow(); GetSessionControllerClient()->LockScreen(); - ExpectFullscreenNotificationShowing(false); + EXPECT_FALSE(IsNotificationVisible()); GetSessionControllerClient()->UnlockScreen(); - ExpectFullscreenNotificationShowing(true); + EXPECT_TRUE(IsNotificationVisible()); } } // namespace
diff --git a/ash/shell_delegate.cc b/ash/shell_delegate.cc index 9d627cc..48cd1a31 100644 --- a/ash/shell_delegate.cc +++ b/ash/shell_delegate.cc
@@ -30,4 +30,9 @@ return -1; } +const GURL& ShellDelegate::GetLastCommittedURLForWindowIfAny( + aura::Window* window) { + return GURL::EmptyGURL(); +} + } // namespace ash
diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index df02db1..50300954 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h
@@ -17,6 +17,7 @@ #include "services/device/public/mojom/fingerprint.mojom-forward.h" #include "services/media_session/public/cpp/media_session_service.h" #include "ui/gfx/native_widget_types.h" +#include "url/gurl.h" namespace aura { class Window; @@ -129,6 +130,10 @@ // persistent desks bar. Note, this will be removed once the feature is fully // launched or removed. virtual void OpenFeedbackPageForPersistentDesksBar() = 0; + + // Returns the last committed URL from the web contents if the given |window| + // contains a browser frame, otherwise returns GURL::EmptyURL(). + virtual const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window); }; } // namespace ash
diff --git a/ash/test_shell_delegate.cc b/ash/test_shell_delegate.cc index 3a5a2ed..6f9b5c54 100644 --- a/ash/test_shell_delegate.cc +++ b/ash/test_shell_delegate.cc
@@ -13,6 +13,7 @@ #include "ash/system/tray/system_tray_notifier.h" #include "ash/wm/gestures/back_gesture/test_back_gesture_contextual_nudge_delegate.h" #include "ui/gfx/image/image.h" +#include "url/gurl.h" namespace ash { @@ -98,4 +99,13 @@ return base::FilePath(); } +const GURL& TestShellDelegate::GetLastCommittedURLForWindowIfAny( + aura::Window* window) { + return last_committed_url_; +} + +void TestShellDelegate::SetLastCommittedURLForWindow(const GURL& url) { + last_committed_url_ = url; +} + } // namespace ash
diff --git a/ash/test_shell_delegate.h b/ash/test_shell_delegate.h index cc2c940..81713df 100644 --- a/ash/test_shell_delegate.h +++ b/ash/test_shell_delegate.h
@@ -11,6 +11,7 @@ #include "base/callback.h" #include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" +#include "url/gurl.h" namespace ash { @@ -54,6 +55,7 @@ override; bool IsSessionRestoreInProgress() const override; void SetUpEnvironmentForLockedFullscreen(bool locked) override {} + const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window) override; void SetCanGoBack(bool can_go_back); void SetShouldWaitForTouchAck(bool should_wait_for_touch_ack); @@ -61,6 +63,7 @@ bool IsLoggingRedirectDisabled() const override; base::FilePath GetPrimaryUserDownloadsFolder() const override; void OpenFeedbackPageForPersistentDesksBar() override {} + void SetLastCommittedURLForWindow(const GURL& url); private: // True if the current top window can go back. @@ -79,6 +82,8 @@ bool session_restore_in_progress_ = false; MultiDeviceSetupBinder multidevice_setup_binder_; + + GURL last_committed_url_ = GURL::EmptyGURL(); }; } // namespace ash
diff --git a/ash/webui/camera_app_ui/resources/js/error.js b/ash/webui/camera_app_ui/resources/js/error.js index b67dbbe..37a88b3 100644 --- a/ash/webui/camera_app_ui/resources/js/error.js +++ b/ash/webui/camera_app_ui/resources/js/error.js
@@ -7,7 +7,6 @@ import {assertInstanceof} from './chrome_util.js'; import * as metrics from './metrics.js'; import { - ErrorInfo, // eslint-disable-line no-unused-vars ErrorLevel, ErrorType, } from './type.js';
diff --git a/ash/webui/camera_app_ui/resources/js/models/result_saver.js b/ash/webui/camera_app_ui/resources/js/models/result_saver.js index 0b0227b..53283de 100644 --- a/ash/webui/camera_app_ui/resources/js/models/result_saver.js +++ b/ash/webui/camera_app_ui/resources/js/models/result_saver.js
@@ -3,8 +3,6 @@ // found in the LICENSE file. import {assertNotReached} from '../chrome_util.js'; -// eslint-disable-next-line no-unused-vars -import {Resolution} from '../type.js'; // eslint-disable-next-line no-unused-vars import {VideoSaver} from './video_saver.js';
diff --git a/ash/webui/camera_app_ui/resources/js/views/camera/document_corner_overlay.js b/ash/webui/camera_app_ui/resources/js/views/camera/document_corner_overlay.js index f77c236..c83529c 100644 --- a/ash/webui/camera_app_ui/resources/js/views/camera/document_corner_overlay.js +++ b/ash/webui/camera_app_ui/resources/js/views/camera/document_corner_overlay.js
@@ -7,7 +7,6 @@ import { Point, PolarVector, - Vector, // eslint-disable-line no-unused-vars vectorFromPoints, } from '../../geometry.js'; import {I18nString} from '../../i18n_string.js';
diff --git a/ash/webui/camera_app_ui/resources/js/views/camera/mode/mode_base.js b/ash/webui/camera_app_ui/resources/js/views/camera/mode/mode_base.js index 98b1a5f..8b4903f 100644 --- a/ash/webui/camera_app_ui/resources/js/views/camera/mode/mode_base.js +++ b/ash/webui/camera_app_ui/resources/js/views/camera/mode/mode_base.js
@@ -6,8 +6,6 @@ // eslint-disable-next-line no-unused-vars import {StreamConstraints} from '../../../device/stream_constraints.js'; import * as error from '../../../error.js'; -// eslint-disable-next-line no-unused-vars -import {DeviceOperator} from '../../../mojo/device_operator.js'; import { CanceledError, ErrorLevel,
diff --git a/ash/webui/camera_app_ui/resources/js/views/settings.js b/ash/webui/camera_app_ui/resources/js/views/settings.js index 8aa92699..776f207 100644 --- a/ash/webui/camera_app_ui/resources/js/views/settings.js +++ b/ash/webui/camera_app_ui/resources/js/views/settings.js
@@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// eslint-disable-next-line no-unused-vars -import {Camera3DeviceInfo} from '../device/camera3_device_info.js'; import { PhotoConstraintsPreferrer, // eslint-disable-line no-unused-vars VideoConstraintsPreferrer, // eslint-disable-line no-unused-vars
diff --git a/ash/webui/camera_app_ui/resources/strings/camera_strings.grd b/ash/webui/camera_app_ui/resources/strings/camera_strings.grd index 6623ee6..8fe236c 100644 --- a/ash/webui/camera_app_ui/resources/strings/camera_strings.grd +++ b/ash/webui/camera_app_ui/resources/strings/camera_strings.grd
@@ -165,7 +165,7 @@ Print </message> <message desc="Label for the gallery button." name="IDS_GALLERY_BUTTON"> - Go to gallery + Go to Gallery </message> <message desc="Error message shown when saving/adding a image or video to the file system failed." name="IDS_ERROR_MSG_SAVE_FILE_FAILED"> Unable to save the file
diff --git a/ash/webui/camera_app_ui/resources/strings/camera_strings_grd/IDS_GALLERY_BUTTON.png.sha1 b/ash/webui/camera_app_ui/resources/strings/camera_strings_grd/IDS_GALLERY_BUTTON.png.sha1 new file mode 100644 index 0000000..51fe9ae --- /dev/null +++ b/ash/webui/camera_app_ui/resources/strings/camera_strings_grd/IDS_GALLERY_BUTTON.png.sha1
@@ -0,0 +1 @@ +3f158451cc894e23e62b68c11c95bd12567fbbf4 \ No newline at end of file
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 66813937..924990e 100644 --- a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc +++ b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc
@@ -393,6 +393,24 @@ base::ThreadSafePartitionRoot::FreeNoHooks(address); } +#if defined(OS_APPLE) +// Normal free() path on Apple OSes: +// 1. size = GetSizeEstimate(ptr); +// 2. if (size) FreeDefiniteSize(ptr, size) +// +// So we don't need to re-check that the pointer is owned in Free(), and we +// can use the size. +void PartitionFreeDefiniteSize(const AllocatorDispatch*, + void* address, + size_t size, + void* context) { + ScopedDisallowAllocations guard{}; + // TODO(lizeb): Optimize PartitionAlloc to use the size information. This is + // still useful though, as we avoid double-checking that the address is owned. + base::ThreadSafePartitionRoot::FreeNoHooks(address); +} +#endif // defined(OS_APPLE) + size_t PartitionGetSizeEstimate(const AllocatorDispatch*, void* address, void* context) { @@ -621,11 +639,18 @@ &base::internal::PartitionGetSizeEstimate, // get_size_estimate_function nullptr, // batch_malloc_function nullptr, // batch_free_function - nullptr, // free_definite_size_function - &base::internal::PartitionAlignedAlloc, // aligned_malloc_function - &base::internal::PartitionAlignedRealloc, // aligned_realloc_function - &base::internal::PartitionFree, // aligned_free_function - nullptr, // next +#if defined(OS_APPLE) + // On Apple OSes, free_definite_size() is always called from free(), since + // get_size_estimate() is used to determine whether an allocation belongs to + // the current zone. It makes sense to optimize for it. + &base::internal::PartitionFreeDefiniteSize, +#else + nullptr, // free_definite_size_function +#endif + &base::internal::PartitionAlignedAlloc, // aligned_malloc_function + &base::internal::PartitionAlignedRealloc, // aligned_realloc_function + &base::internal::PartitionFree, // aligned_free_function + nullptr, // next }; // Intercept diagnostics symbols as well, even though they are not part of the
diff --git a/base/allocator/allocator_shim_override_mac_default_zone.h b/base/allocator/allocator_shim_override_mac_default_zone.h index 7bbb0d0..a6a916e 100644 --- a/base/allocator/allocator_shim_override_mac_default_zone.h +++ b/base/allocator/allocator_shim_override_mac_default_zone.h
@@ -172,7 +172,7 @@ } void MallocZoneFreeDefiniteSize(malloc_zone_t* zone, void* ptr, size_t size) { - return ShimFree(ptr, nullptr); + return ShimFreeDefiniteSize(ptr, size, nullptr); } malloc_introspection_t g_mac_malloc_introspection{};
diff --git a/base/allocator/partition_allocator/partition_page.h b/base/allocator/partition_allocator/partition_page.h index 726a5e5..0ecdf72 100644 --- a/base/allocator/partition_allocator/partition_page.h +++ b/base/allocator/partition_allocator/partition_page.h
@@ -229,13 +229,7 @@ // - Raw size minus extras, for large buckets and direct-mapped allocations // (see also the comment in CanStoreRawSize() for more info). This is // equal to requested size. - size_t size_to_ajdust; - if (LIKELY(!CanStoreRawSize())) { - size_to_ajdust = bucket->slot_size; - } else { - size_to_ajdust = GetRawSize(); - } - return root->AdjustSizeForExtrasSubtract(size_to_ajdust); + return root->AdjustSizeForExtrasSubtract(GetUtilizedSlotSize()); } // Returns the total size of the slots that are currently provisioned.
diff --git a/build/android/pylib/local/device/local_device_instrumentation_test_run.py b/build/android/pylib/local/device/local_device_instrumentation_test_run.py index a1eaa4aa7..065ca72 100644 --- a/build/android/pylib/local/device/local_device_instrumentation_test_run.py +++ b/build/android/pylib/local/device/local_device_instrumentation_test_run.py
@@ -536,9 +536,19 @@ else: other_tests.append(test) + def dict2list(d): + if isinstance(d, dict): + return sorted([(k, dict2list(v)) for k, v in d.items()]) + if isinstance(d, list): + return [dict2list(v) for v in d] + if isinstance(d, tuple): + return tuple(dict2list(v) for v in d) + return d + all_tests = [] for _, btests in list(batched_tests.items()): - btests.sort() # Ensure a consistent ordering across external shards. + # Ensure a consistent ordering across external shards. + btests.sort(key=dict2list) all_tests.extend([ btests[i:i + _TEST_BATCH_MAX_GROUP_SIZE] for i in range(0, len(btests), _TEST_BATCH_MAX_GROUP_SIZE)
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni index ef59449f..d3833fd 100644 --- a/build/config/android/internal_rules.gni +++ b/build/config/android/internal_rules.gni
@@ -790,10 +790,6 @@ data += invoker.data } - if (defined(invoker.use_vpython3)) { - use_vpython3 = invoker.use_vpython3 - } - executable_args = [ "@WrappedPath(" + rebase_path(_runner_script, root_build_dir) + ")", _test_type,
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni index aae10aa8..91417e94 100644 --- a/build/config/android/rules.gni +++ b/build/config/android/rules.gni
@@ -3709,7 +3709,6 @@ "modules", "proguard_mapping_path", "public_deps", - "use_vpython3", "use_webview_provider", ]) test_name = invoker.target_name @@ -3855,9 +3854,7 @@ _apk_target_name = "${target_name}__test_apk" forward_variables_from(invoker, TESTONLY_AND_VISIBILITY) android_test_apk(_apk_target_name) { - forward_variables_from(invoker, - "*", - TESTONLY_AND_VISIBILITY + [ "use_vpython3" ]) + forward_variables_from(invoker, "*", TESTONLY_AND_VISIBILITY) } instrumentation_test_runner(target_name) { forward_variables_from(invoker, @@ -3872,7 +3869,6 @@ "modules", "never_incremental", "public_deps", - "use_vpython3", "use_webview_provider", ]) android_test_apk = ":${_apk_target_name}"
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 9c99855..92f805a8 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -7.20211207.2.1 +7.20211208.0.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 9c99855..92f805a8 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -7.20211207.2.1 +7.20211208.0.1
diff --git a/build/toolchain/win/BUILD.gn b/build/toolchain/win/BUILD.gn index d473997..a6bdc02 100644 --- a/build/toolchain/win/BUILD.gn +++ b/build/toolchain/win/BUILD.gn
@@ -142,20 +142,12 @@ sys_include_flags = "" } - # ninja does not have -t msvc other than windows, and lld doesn't depend on - # mt.exe in PATH on non-Windows, so it's not needed there anyways. - if (host_os != "win") { + if (host_os != "win" || (use_lld && defined(invoker.sys_lib_flags))) { linker_wrapper = "" sys_lib_flags = "${invoker.sys_lib_flags} " # Note trailing space. - } else if (defined(invoker.sys_lib_flags)) { - # Invoke ninja as wrapper instead of tool wrapper, because python - # invocation requires higher cpu usage compared to ninja invocation, and - # the python wrapper is only needed to work around link.exe problems. - # TODO(thakis): Remove wrapper once lld-link can merge manifests without - # relying on mt.exe being in %PATH% on Windows, https://crbug.com/872740 - linker_wrapper = "ninja -t msvc -e $env -- " # Note trailing space. - sys_lib_flags = "${invoker.sys_lib_flags} " # Note trailing space. } else { + # link.exe must be run under a wrapper to set up the environment + # (it needs %LIB% set to find libraries), and to work around its bugs. # Note trailing space: linker_wrapper = "$python_path $tool_wrapper_path link-wrapper $env False "
diff --git a/cc/metrics/dropped_frame_counter.cc b/cc/metrics/dropped_frame_counter.cc index e6cb1c6f..3ec53116 100644 --- a/cc/metrics/dropped_frame_counter.cc +++ b/cc/metrics/dropped_frame_counter.cc
@@ -12,6 +12,7 @@ #include "base/metrics/histogram.h" #include "base/metrics/histogram_macros.h" #include "base/trace_event/trace_event.h" +#include "build/chromeos_buildflags.h" #include "cc/metrics/frame_info.h" #include "cc/metrics/frame_sorter.h" #include "cc/metrics/total_frame_counter.h"
diff --git a/cc/metrics/dropped_frame_counter_unittest.cc b/cc/metrics/dropped_frame_counter_unittest.cc index 986daff..98c2fada 100644 --- a/cc/metrics/dropped_frame_counter_unittest.cc +++ b/cc/metrics/dropped_frame_counter_unittest.cc
@@ -11,6 +11,7 @@ #include "base/synchronization/waitable_event.h" #include "base/test/metrics/histogram_tester.h" #include "base/time/time.h" +#include "build/chromeos_buildflags.h" #include "cc/animation/animation_host.h" #include "cc/test/fake_content_layer_client.h" #include "cc/test/fake_picture_layer.h"
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 8f20031e..969eb84 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc
@@ -34,6 +34,7 @@ #include "base/system/sys_info.h" #include "base/trace_event/traced_value.h" #include "build/build_config.h" +#include "build/chromeos_buildflags.h" #include "cc/base/devtools_instrumentation.h" #include "cc/base/features.h" #include "cc/base/histograms.h"
diff --git a/cc/trees/single_thread_proxy.cc b/cc/trees/single_thread_proxy.cc index d697b93..4f0d50c 100644 --- a/cc/trees/single_thread_proxy.cc +++ b/cc/trees/single_thread_proxy.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/trace_event/trace_event.h" +#include "build/chromeos_buildflags.h" #include "cc/base/completion_event.h" #include "cc/base/devtools_instrumentation.h" #include "cc/benchmarks/benchmark_instrumentation.h"
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn index db03f09..fbdfe26 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn
@@ -356,6 +356,8 @@ "//chrome/browser/download/android:java_resources", "//chrome/browser/enterprise/util:java", "//chrome/browser/feature_engagement:java", + "//chrome/browser/feature_guide/notifications:factory_java", + "//chrome/browser/feature_guide/notifications:java", "//chrome/browser/feed/android:java", "//chrome/browser/feedback/android:java", "//chrome/browser/first_run/android:java", @@ -750,6 +752,7 @@ "//chrome/browser/content_creation/notes/internal/android:java", "//chrome/browser/content_creation/reactions/internal/android:java", "//chrome/browser/download/internal/android:java", + "//chrome/browser/feature_guide/notifications/internal:internal_java", "//chrome/browser/page_annotations/android:java", "//chrome/browser/password_check:internal_java", "//chrome/browser/password_edit_dialog/android:java", @@ -3028,8 +3031,6 @@ # TODO(wnwen): Re-enable when new lint failures are disabled for test targets. #enable_lint = true - use_vpython3 = false - apk_name = "ChromePublicTest" android_manifest = chrome_public_test_apk_manifest android_manifest_dep = ":chrome_public_test_apk_manifest"
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java index bd9569a9..90b11c48 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/FirstRunIntegrationTest.java
@@ -15,7 +15,6 @@ import android.content.Context; import android.content.Intent; import android.net.Uri; -import android.os.Build; import android.os.Bundle; import android.support.test.InstrumentationRegistry; import android.view.View; @@ -50,7 +49,6 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.Criteria; import org.chromium.base.test.util.CriteriaHelper; -import org.chromium.base.test.util.DisableIf; import org.chromium.base.test.util.DisabledTest; import org.chromium.base.test.util.JniMocker; import org.chromium.base.test.util.ScalableTimeout; @@ -595,8 +593,6 @@ @Test @MediumTest - @DisableIf. - Build(message = "https://crbug.com/1276506", sdk_is_greater_than = Build.VERSION_CODES.P) @CommandLineFlags.Remove({ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE}) @CommandLineFlags.Add({ChromeSwitches.FORCE_ENABLE_SIGNIN_FRE}) public void testSigninFirstRunPages_WithCctPolicy_AbsenceOfPromos() throws Exception { @@ -605,8 +601,6 @@ @Test @MediumTest - @DisableIf. - Build(message = "https://crbug.com/1276506", sdk_is_greater_than = Build.VERSION_CODES.P) @CommandLineFlags.Remove({ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE}) @CommandLineFlags.Add({ChromeSwitches.FORCE_ENABLE_SIGNIN_FRE}) public void testSigninFirstRunPages_WithCctPolicy_SearchPromo() throws Exception { @@ -615,8 +609,6 @@ @Test @MediumTest - @DisableIf. - Build(message = "https://crbug.com/1276506", sdk_is_greater_than = Build.VERSION_CODES.P) @CommandLineFlags.Remove({ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE}) @CommandLineFlags.Add({ChromeSwitches.FORCE_ENABLE_SIGNIN_FRE}) public void testSigninFirstRunPages_WithCctPolicy_SearchPromo_SigninPromo() throws Exception { @@ -628,8 +620,6 @@ @Test @MediumTest - @DisableIf. - Build(message = "https://crbug.com/1276506", sdk_is_greater_than = Build.VERSION_CODES.P) @CommandLineFlags.Remove({ChromeSwitches.FORCE_DISABLE_SIGNIN_FRE}) @CommandLineFlags.Add({ChromeSwitches.FORCE_ENABLE_SIGNIN_FRE}) public void testSigninFirstRunPages_WithCctPolicy_SigninPromo() throws Exception {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/TosAndUmaFirstRunFragmentWithEnterpriseSupportTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/TosAndUmaFirstRunFragmentWithEnterpriseSupportTest.java index 9a8b9c92..fe6e7142 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/TosAndUmaFirstRunFragmentWithEnterpriseSupportTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/firstrun/TosAndUmaFirstRunFragmentWithEnterpriseSupportTest.java
@@ -562,7 +562,7 @@ FREMobileIdentityConsistencyFieldTrial.setFirstRunTrialGroupForTesting( FREMobileIdentityConsistencyFieldTrial.OLD_FRE_WITH_UMA_DIALOG_GROUP); mAccountManagerTestRule.addAccount( - AccountManagerTestRule.createChildAccount("account@gmail.com").name); + AccountManagerTestRule.generateChildEmail("account@gmail.com")); launchFirstRunThroughCustomTab(); setAppRestrictionsMockInitialized(false); // Clear the focus on view to avoid unexpected highlight on background.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/init/StartupTabPreloaderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/init/StartupTabPreloaderTest.java index 32dc655..5ed808b 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/init/StartupTabPreloaderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/init/StartupTabPreloaderTest.java
@@ -17,7 +17,6 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.base.test.util.CriteriaHelper; import org.chromium.base.test.util.DisabledTest; -import org.chromium.base.test.util.FlakyTest; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.IntentHandler; import org.chromium.chrome.browser.flags.ChromeFeatureList; @@ -190,10 +189,16 @@ @Test @LargeTest - @FlakyTest(message = "https://crbug.com/1271158") @DisableFeatures(ChromeFeatureList.ELIDE_TAB_PRELOAD_AT_STARTUP) public void testStartupTabPreloaderStartupLoadingMetricsRecordedWhenTabTaken() throws Exception { + // Force the browser to regard itself as being in the foreground to work around the + // fact that the navigation here can happen before ChromeActivity records the + // browser as being in the foreground, in which case startup metrics are erroneously + // not recorded. TODO(crbug.com/1273097): Eliminate this call when we fix startup + // metrics to be recorded in this case. + TestThreadUtils.runOnUiThreadBlocking(() -> UmaUtils.recordForegroundStartTime()); + Intent intent = new Intent(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_LAUNCHER); mActivityRule.startMainActivityFromIntent( @@ -228,10 +233,16 @@ @Test @LargeTest - @FlakyTest(message = "https://crbug.com/1271158") @DisableFeatures(ChromeFeatureList.ELIDE_TAB_PRELOAD_AT_STARTUP) public void testStartupTabPreloaderStartupLoadingMetricsRecordedWhenTabDropped() throws Exception { + // Force the browser to regard itself as being in the foreground to work around the + // fact that the navigation here can happen before ChromeActivity records the + // browser as being in the foreground, in which case startup metrics are erroneously + // not recorded. TODO(crbug.com/1273097): Eliminate this call when we fix startup + // metrics to be recorded in this case. + TestThreadUtils.runOnUiThreadBlocking(() -> UmaUtils.recordForegroundStartTime()); + StartupTabPreloader.failNextTabMatchForTesting(); Intent intent = new Intent(Intent.ACTION_VIEW); @@ -314,11 +325,17 @@ @Test @LargeTest - @FlakyTest(message = "https://crbug.com/1271158") @EnableFeatures(ChromeFeatureList.ELIDE_TAB_PRELOAD_AT_STARTUP) public void testStartupTabPreloaderStartupLoadingMetricsRecordedWhenTabWouldBeTakenIfNotPreventedByFeature() throws Exception { + // Force the browser to regard itself as being in the foreground to work around the + // fact that the navigation here can happen before ChromeActivity records the + // browser as being in the foreground, in which case startup metrics are erroneously + // not recorded. TODO(crbug.com/1273097): Eliminate this call when we fix startup + // metrics to be recorded in this case. + TestThreadUtils.runOnUiThreadBlocking(() -> UmaUtils.recordForegroundStartTime()); + Intent intent = new Intent(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_LAUNCHER); mActivityRule.startMainActivityFromIntent( @@ -355,11 +372,17 @@ @Test @LargeTest - @FlakyTest(message = "https://crbug.com/1271158") @EnableFeatures(ChromeFeatureList.ELIDE_TAB_PRELOAD_AT_STARTUP) public void testStartupTabPreloaderStartupLoadingMetricsRecordedWhenTabWouldBeDroppedIfNotPreventedByFeature() throws Exception { + // Force the browser to regard itself as being in the foreground to work around the + // fact that the navigation here can happen before ChromeActivity records the + // browser as being in the foreground, in which case startup metrics are erroneously + // not recorded. TODO(crbug.com/1273097): Eliminate this call when we fix startup + // metrics to be recorded in this case. + TestThreadUtils.runOnUiThreadBlocking(() -> UmaUtils.recordForegroundStartTime()); + StartupTabPreloader.failNextTabMatchForTesting(); Intent intent = new Intent(Intent.ACTION_VIEW);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninCheckerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninCheckerTest.java index 8a13019..9ed1c5b2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninCheckerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninCheckerTest.java
@@ -7,7 +7,6 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; -import android.accounts.Account; import android.os.Build.VERSION_CODES; import androidx.test.filters.MediumTest; @@ -46,8 +45,8 @@ @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) @DisableIf.Build(sdk_is_less_than = VERSION_CODES.LOLLIPOP_MR1) public class SigninCheckerTest { - private static final Account CHILD_ACCOUNT = - AccountManagerTestRule.createChildAccount("test@gmail.com"); + private static final String CHILD_ACCOUNT_NAME = + AccountManagerTestRule.generateChildEmail("test@gmail.com"); @Rule public final MockitoRule mMockitoRule = MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS); @@ -157,7 +156,7 @@ UserActionTester actionTester = new UserActionTester(); final CoreAccountInfo expectedPrimaryAccount = - mAccountManagerTestRule.addAccountAndWaitForSeeding(CHILD_ACCOUNT.name); + mAccountManagerTestRule.addAccountAndWaitForSeeding(CHILD_ACCOUNT_NAME); CriteriaHelper.pollUiThread(() -> { return expectedPrimaryAccount.equals( @@ -177,7 +176,7 @@ when(mExternalAuthUtilsMock.isGooglePlayServicesMissing(any())).thenReturn(true); ExternalAuthUtils.setInstanceForTesting(mExternalAuthUtilsMock); - mAccountManagerTestRule.addAccountAndWaitForSeeding(CHILD_ACCOUNT.name); + mAccountManagerTestRule.addAccountAndWaitForSeeding(CHILD_ACCOUNT_NAME); // The check should be done twice, once at activity start-up, the other when account // is added. @@ -197,7 +196,7 @@ // test case therefore is not currently hittable on a real device; however it is included // here for completeness. mAccountManagerTestRule.addAccount("the.default.account@gmail.com"); - mAccountManagerTestRule.addAccount(CHILD_ACCOUNT.name); + mAccountManagerTestRule.addAccount(CHILD_ACCOUNT_NAME); mActivityTestRule.startMainActivityOnBlankPage(); UserActionTester actionTester = new UserActionTester(); @@ -214,7 +213,7 @@ @Test @MediumTest public void signinWhenChildAccountIsFirstAccount() { - final CoreAccountInfo childAccount = mAccountManagerTestRule.addAccount(CHILD_ACCOUNT.name); + final CoreAccountInfo childAccount = mAccountManagerTestRule.addAccount(CHILD_ACCOUNT_NAME); mAccountManagerTestRule.addAccount("the.second.account@gmail.com"); mActivityTestRule.startMainActivityOnBlankPage();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentRenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentRenderTest.java index 392d32f..07a0b07 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentRenderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentRenderTest.java
@@ -5,7 +5,6 @@ import static org.mockito.Mockito.when; -import android.accounts.Account; import android.content.res.Configuration; import android.support.test.runner.lifecycle.Stage; @@ -79,8 +78,8 @@ } private static final String TEST_EMAIL1 = "test.account1@gmail.com"; - private static final Account CHILD_ACCOUNT = - AccountManagerTestRule.createChildAccount("account@gmail.com"); + private static final String CHILD_ACCOUNT_NAME = + AccountManagerTestRule.generateChildEmail("account@gmail.com"); // Disable animations to reduce flakiness. @Rule @@ -273,7 +272,7 @@ @ParameterAnnotations.UseMethodParameter(NightModeAndOrientationParameterProvider.class) public void testFragmentWithChildAccount(boolean nightModeEnabled, int orientation) throws IOException { - mAccountManagerTestRule.addAccount(CHILD_ACCOUNT.name); + mAccountManagerTestRule.addAccount(CHILD_ACCOUNT_NAME); launchActivityWithFragment(orientation);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java index 6434698ad..eba9316 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/signin/SigninFirstRunFragmentTest.java
@@ -25,7 +25,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import android.accounts.Account; import android.accounts.AccountManager; import android.app.Activity; import android.content.Intent; @@ -95,8 +94,8 @@ private static final String FULL_NAME1 = "Test Account1"; private static final String GIVEN_NAME1 = "Account1"; private static final String TEST_EMAIL2 = "test.account2@gmail.com"; - private static final Account CHILD_ACCOUNT = - AccountManagerTestRule.createChildAccount("account@gmail.com"); + private static final String CHILD_ACCOUNT_NAME = + AccountManagerTestRule.generateChildEmail("account@gmail.com"); private static final String CHILD_FULL_NAME = "Test Child"; /** @@ -211,7 +210,7 @@ onView(withText(R.string.signin_fre_dismiss_button)).check(matches(isDisplayed())); mAccountManagerTestRule.addAccount( - CHILD_ACCOUNT.name, CHILD_FULL_NAME, /* givenName= */ null, /* avatar= */ null); + CHILD_ACCOUNT_NAME, CHILD_FULL_NAME, /* givenName= */ null, /* avatar= */ null); checkFragmentWithChildAccount(); } @@ -220,11 +219,11 @@ @MediumTest public void testFragmentWhenRemovingChildAccountDynamically() { mAccountManagerTestRule.addAccount( - CHILD_ACCOUNT.name, CHILD_FULL_NAME, /* givenName= */ null, /* avatar= */ null); + CHILD_ACCOUNT_NAME, CHILD_FULL_NAME, /* givenName= */ null, /* avatar= */ null); TestThreadUtils.runOnUiThreadBlocking(() -> { mFragment.onNativeInitialized(); }); launchActivityWithFragment(); - mAccountManagerTestRule.removeAccount(CHILD_ACCOUNT.name); + mAccountManagerTestRule.removeAccount(CHILD_ACCOUNT_NAME); CriteriaHelper.pollUiThread(() -> { return !mFragment.getView().findViewById(R.id.signin_fre_selected_account).isShown(); @@ -384,7 +383,7 @@ public void testFragmentWithChildAccount() { TestThreadUtils.runOnUiThreadBlocking(() -> { mFragment.onNativeInitialized(); }); mAccountManagerTestRule.addAccount( - CHILD_ACCOUNT.name, CHILD_FULL_NAME, /* givenName= */ null, /* avatar= */ null); + CHILD_ACCOUNT_NAME, CHILD_FULL_NAME, /* givenName= */ null, /* avatar= */ null); launchActivityWithFragment(); @@ -510,7 +509,7 @@ public void testContinueButtonWithChildAccount() { TestThreadUtils.runOnUiThreadBlocking(() -> { mFragment.onNativeInitialized(); }); mAccountManagerTestRule.addAccount( - CHILD_ACCOUNT.name, CHILD_FULL_NAME, /* givenName= */ null, /* avatar= */ null); + CHILD_ACCOUNT_NAME, CHILD_FULL_NAME, /* givenName= */ null, /* avatar= */ null); launchActivityWithFragment(); final String continueAsText = mChromeActivityTestRule.getActivity().getString( R.string.signin_promo_continue_as, CHILD_FULL_NAME); @@ -762,7 +761,7 @@ onView(withText(R.string.fre_welcome)).check(matches(isDisplayed())); Assert.assertFalse( mFragment.getView().findViewById(R.id.signin_fre_selected_account).isEnabled()); - onView(withText(CHILD_ACCOUNT.name)).check(matches(isDisplayed())); + onView(withText(CHILD_ACCOUNT_NAME)).check(matches(isDisplayed())); onView(withText(CHILD_FULL_NAME)).check(matches(isDisplayed())); onView(withId(R.id.signin_fre_selected_account_expand_icon)) .check(matches(not(isDisplayed())));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AccountManagementFragmentTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AccountManagementFragmentTest.java index 371b426..b053253 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AccountManagementFragmentTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AccountManagementFragmentTest.java
@@ -16,7 +16,6 @@ import static org.chromium.ui.test.util.ViewUtils.onViewWaiting; -import android.accounts.Account; import android.view.View; import androidx.test.filters.MediumTest; @@ -50,8 +49,8 @@ @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class AccountManagementFragmentTest { - private static final Account CHILD_ACCOUNT = - AccountManagerTestRule.createChildAccount("account@gmail.com"); + private static final String CHILD_ACCOUNT_NAME = + AccountManagerTestRule.generateChildEmail("account@gmail.com"); public final SettingsActivityTestRule<AccountManagementFragment> mSettingsActivityTestRule = new SettingsActivityTestRule<>(AccountManagementFragment.class); @@ -104,7 +103,7 @@ @MediumTest @Feature("RenderTest") public void testAccountManagementViewForChildAccount() throws Exception { - mAccountManagerTestRule.addAccountAndWaitForSeeding(CHILD_ACCOUNT.name); + mAccountManagerTestRule.addAccountAndWaitForSeeding(CHILD_ACCOUNT_NAME); final Profile profile = TestThreadUtils.runOnUiThreadBlockingNoException( Profile::getLastUsedRegularProfile); CriteriaHelper.pollUiThread(profile::isChild); @@ -112,7 +111,7 @@ CriteriaHelper.pollUiThread(() -> { return mSettingsActivityTestRule.getFragment() .getProfileDataCacheForTesting() - .hasProfileData(CHILD_ACCOUNT.name); + .hasProfileData(CHILD_ACCOUNT_NAME); }); View view = mSettingsActivityTestRule.getFragment().getView(); onViewWaiting(allOf(is(view), isDisplayed())); @@ -124,7 +123,7 @@ @Feature("RenderTest") @DisabledTest(message = "https://crbug.com/1272911") public void testAccountManagementViewForChildAccountWithSecondaryEduAccount() throws Exception { - mAccountManagerTestRule.addAccount(CHILD_ACCOUNT.name); + mAccountManagerTestRule.addAccount(CHILD_ACCOUNT_NAME); // The code under test doesn't care what account type this is, though in practice only // EDU accounts are supported on devices where the primary account is a child account. mAccountManagerTestRule.addAccount("account@school.com"); @@ -136,7 +135,7 @@ CriteriaHelper.pollUiThread(() -> { return mSettingsActivityTestRule.getFragment() .getProfileDataCacheForTesting() - .hasProfileData(CHILD_ACCOUNT.name); + .hasProfileData(CHILD_ACCOUNT_NAME); }); View view = mSettingsActivityTestRule.getFragment().getView(); onViewWaiting(allOf(is(view), isDisplayed()));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java index 62d3e90..56a49ab4 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/GoogleServicesSettingsTest.java
@@ -9,8 +9,6 @@ import static androidx.test.espresso.matcher.RootMatchers.isDialog; import static androidx.test.espresso.matcher.ViewMatchers.withText; -import android.accounts.Account; - import androidx.test.filters.LargeTest; import org.junit.After; @@ -51,8 +49,8 @@ @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) public class GoogleServicesSettingsTest { - private static final Account CHILD_ACCOUNT = - AccountManagerTestRule.createChildAccount("account@gmail.com"); + private static final String CHILD_ACCOUNT_NAME = + AccountManagerTestRule.generateChildEmail("account@gmail.com"); @Rule public final AccountManagerTestRule mAccountManagerTestRule = new AccountManagerTestRule(); @@ -90,7 +88,7 @@ @Test @LargeTest public void allowSigninOptionHiddenFromChildUser() { - mAccountManagerTestRule.addAccountAndWaitForSeeding(CHILD_ACCOUNT.name); + mAccountManagerTestRule.addAccountAndWaitForSeeding(CHILD_ACCOUNT_NAME); final Profile profile = TestThreadUtils.runOnUiThreadBlockingNoException( Profile::getLastUsedRegularProfile); CriteriaHelper.pollUiThread(profile::isChild);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenTest.java index 27d5990d..b0b698a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/webapps/AddToHomescreenTest.java
@@ -316,7 +316,7 @@ @DisabledTest(message = "https://crbug.com/1269022") public void testAddWebappShortcutWithEmptyPage() { Tab spawnedPopup = spawnPopupInBackground(""); - addShortcutToTab(spawnedPopup, "", false); + addShortcutToTab(spawnedPopup, "", true /* expectAdded */); Assert.assertEquals( 0, RecordHistogram.getHistogramTotalCountForTesting(INSTALL_PATH_HISTOGRAM_NAME));
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java index 4e73e8d..9e37468 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/firstrun/FirstRunFlowSequencerTest.java
@@ -11,7 +11,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import android.accounts.Account; import android.app.Activity; import android.os.Bundle; @@ -52,8 +51,8 @@ @Config(manifest = Config.NONE, shadows = {ShadowMultiDex.class}) public class FirstRunFlowSequencerTest { private static final String ADULT_ACCOUNT_NAME = "adult.account@gmail.com"; - private static final Account CHILD_ACCOUNT = - AccountManagerTestRule.createChildAccount(/*baseName=*/"account@gmail.com"); + private static final String CHILD_ACCOUNT_NAME = + AccountManagerTestRule.generateChildEmail(/*baseName=*/"account@gmail.com"); @Rule public TestRule mFeaturesProcessorRule = new Features.JUnitProcessor(); @@ -182,7 +181,7 @@ @Test @Feature({"FirstRun"}) public void testStandardFlowOneChildAccount() { - mAccountManagerTestRule.addAccount(CHILD_ACCOUNT.name); + mAccountManagerTestRule.addAccount(CHILD_ACCOUNT_NAME); when(mDataReductionProxySettingsMock.isDataReductionProxyFREPromoAllowed()) .thenReturn(false); mDelegate.isSyncAllowed = true;
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 0931aef..fcabde0 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -3730,6 +3730,9 @@ <message name="IDS_SETTINGS_SECURITY_KEYS_UPDATE_CREDENTIAL_DIALOG_TITLE" desc="The title of a dialog that lets users update sign-in data on their security key (an authentication hardware device)."> Edit sign-in data </message> + <message name="IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_TITLE" desc="The title of a prompt that asks users to confirm whether they want to delete the selected sign-in data on their security key (an authentication hardware device)."> + Delete sign-in data + </message> <message name="IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_CREDENTIAL" desc="A confirmation message shown to confirm the user wants to delete the selected sign-in data. Security keys are external devices used to authenticate people."> Are you sure you want to delete the selected sign-in data? </message>
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_CREDENTIAL.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_CREDENTIAL.png.sha1 index 75ce0f6d..1d77a1f 100644 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_CREDENTIAL.png.sha1 +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_CREDENTIAL.png.sha1
@@ -1 +1 @@ -61b567dd23e345d41a779c11e5ba43075c33ba0e \ No newline at end of file +cf90cca227252cc132cac8e403fc43db447ad72f \ No newline at end of file
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_TITLE.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_TITLE.png.sha1 new file mode 100644 index 0000000..1d77a1f --- /dev/null +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_TITLE.png.sha1
@@ -0,0 +1 @@ +cf90cca227252cc132cac8e403fc43db447ad72f \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 3f1c380..7298ceb03 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -505,6 +505,8 @@ "favicon/large_icon_service_factory.h", "feature_engagement/tracker_factory.cc", "feature_engagement/tracker_factory.h", + "feature_guide/notifications/feature_notification_guide_service_factory.cc", + "feature_guide/notifications/feature_notification_guide_service_factory.h", "federated_learning/floc_eligibility_observer.cc", "federated_learning/floc_eligibility_observer.h", "federated_learning/floc_event_logger.cc", @@ -1758,8 +1760,6 @@ "support_tool/support_tool_handler.h", "support_tool/support_tool_util.cc", "support_tool/support_tool_util.h", - "support_tool/ui_hierarchy_data_collector.cc", - "support_tool/ui_hierarchy_data_collector.h", "sync/bookmark_sync_service_factory.cc", "sync/bookmark_sync_service_factory.h", "sync/chrome_sync_client.cc", @@ -1966,8 +1966,8 @@ "//chrome/browser/browsing_data:constants", "//chrome/browser/commerce:feature_list", "//chrome/browser/devtools", - "//chrome/browser/feature_guide/notifications:factory", "//chrome/browser/feature_guide/notifications:public", + "//chrome/browser/feature_guide/notifications/internal", "//chrome/browser/image_decoder", "//chrome/browser/media:media_engagement_preload_proto", "//chrome/browser/media:mojo_bindings", @@ -2489,6 +2489,7 @@ "//chrome/browser/ui/webui/chromeos/vm:mojo_bindings", "//chrome/browser/ui/webui/settings/chromeos/os_apps_page/mojom", "//chrome/browser/ui/webui/settings/chromeos/search:mojo_bindings", + "//chrome/common/chromeos/extensions", "//chromeos/components/chromebox_for_meetings/buildflags", "//chromeos/components/local_search_service", "//chromeos/components/local_search_service/public/cpp:cpp", @@ -3135,6 +3136,7 @@ "enterprise/reporting/reporting_delegate_factory_android.h", "enterprise/util/android_enterprise_info.cc", "enterprise/util/android_enterprise_info.h", + "feature_guide/notifications/internal/android/feature_notification_guide_service_factory_android.cc", "feed/android/background_refresh_task.cc", "feed/android/background_refresh_task.h", "feed/android/feed_image_fetch_client.cc", @@ -3401,6 +3403,7 @@ "//chrome/browser/device_reauth/android:jni_headers", "//chrome/browser/download/internal/android", "//chrome/browser/endpoint_fetcher:jni_headers", + "//chrome/browser/feature_guide/notifications/internal:jni_headers", "//chrome/browser/feed/android:jni_headers", "//chrome/browser/feedback/android", "//chrome/browser/flags:flags_android", @@ -4014,6 +4017,8 @@ "metrics/desktop_session_duration/touch_mode_stats_tracker.h", "metrics/first_web_contents_profiler.cc", "metrics/first_web_contents_profiler.h", + "metrics/first_web_contents_profiler_base.cc", + "metrics/first_web_contents_profiler_base.h", "metrics/incognito_observer_desktop.cc", "metrics/power/power_metrics_reporter.cc", "metrics/power/power_metrics_reporter.h", @@ -5063,6 +5068,13 @@ ] } + if (is_chromeos_ash) { + sources += [ + "support_tool/ash/ui_hierarchy_data_collector.cc", + "support_tool/ash/ui_hierarchy_data_collector.h", + ] + } + if (is_chromeos_ash || enable_extensions || is_android) { sources += [ "metrics/cached_metrics_profile.cc",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 8e38387..5787068 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -4260,8 +4260,7 @@ {"enable-docked-magnifier-resizing", flag_descriptions::kDockedMagnifierResizingName, flag_descriptions::kDockedMagnifierResizingDescription, kOsCrOS, - FEATURE_VALUE_TYPE( - features::kMagnifierContinuousMouseFollowingModeSetting)}, + FEATURE_VALUE_TYPE(features::kDockedMagnifierResizing)}, {"enable-system-proxy-for-system-services", flag_descriptions::kSystemProxyForSystemServicesName, flag_descriptions::kSystemProxyForSystemServicesDescription, kOsCrOS,
diff --git a/chrome/browser/ash/crosapi/browser_data_migrator.cc b/chrome/browser/ash/crosapi/browser_data_migrator.cc index 72eddb0f..e107f93 100644 --- a/chrome/browser/ash/crosapi/browser_data_migrator.cc +++ b/chrome/browser/ash/crosapi/browser_data_migrator.cc
@@ -166,10 +166,15 @@ void OnRestartRequestResponse(bool result) { if (!result) { - LOG(ERROR) << "SessionManagerClient::RequestBrowserDataMigration failed."; + LOG(ERROR) << "SessionManagerClient::RequestBrowserDataMigration() failed."; return; } + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove this + // log message. + LOG(WARNING) + << "SessionManagerClient::RequestBrowserDataMigration() succeeded " + "and now attempting a restart."; chrome::AttemptRestart(); } @@ -232,11 +237,20 @@ void BrowserDataMigrator::MaybeRestartToMigrate( const AccountId& account_id, const std::string& user_id_hash) { + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove this + // log message. + LOG(WARNING) << "MaybeRestartToMigrate() is called."; // If `MigrationStep` is not `kCheckStep`, `MaybeRestartToMigrate()` has // already moved on to later steps. Namely either in the middle of migration // or migration has already run. if (GetMigrationStep(g_browser_process->local_state()) != MigrationStep::kCheckStep) { + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this + // log message. + LOG(WARNING) << "Migration step is " + << static_cast<int>( + GetMigrationStep(g_browser_process->local_state())); return; } @@ -247,6 +261,7 @@ if (force_migration_switch == kBrowserDataMigrationForceSkip) return; if (force_migration_switch == kBrowserDataMigrationForceMigration) { + LOG(WARNING) << "`kBrowserDataMigrationForceMigration` switch is present."; MaybeRestartToMigrateCallback(account_id, user_id_hash, true /* is_required */); return; @@ -264,6 +279,13 @@ return; // Check if lacros is enabled. If not immediately return. if (!crosapi::browser_util::IsLacrosEnabledForMigration(user)) { + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this log message. + LOG(WARNING) + << "Lacros is disabled. Call ClearMigrationAttemptCountForUser() so " + "that the migration can be attempted again after once lacros is " + "enabled again."; + // If lacros is not enabled other than reaching the maximum retry count of // profile migration, clear the retry count. This will allow users to reset // the retry count by disabling lacros and re-enabling lacros back. @@ -277,24 +299,39 @@ // `kLacrosProfileMigrationForAnyUser` defined in browser_util. // TODO(crbug.com/1266669): Remove this check once profile migration is // enabled for all users. - if (!crosapi::browser_util::IsProfileMigrationEnabled(account_id)) + if (!crosapi::browser_util::IsProfileMigrationEnabled(account_id)) { + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this log message. + LOG(WARNING) << "Profile migration is disabled."; return; + } // If the user is a new user, then there shouldn't be anything to migrate. // Also mark the user as migration completed. if (user_manager::UserManager::Get()->IsCurrentUserNew()) { crosapi::browser_util::SetProfileMigrationCompletedForUser( g_browser_process->local_state(), user_id_hash); + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this log message. + LOG(WARNING) << "Setting migration as completed since it is a new user."; return; } int attempts = GetMigrationAttemptCountForUser( g_browser_process->local_state(), user_id_hash); if (attempts >= kMaxMigrationAttemptCount) { + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this log message. + LOG(WARNING) << "Skipping profile migration since migration attemp count = " + << attempts << " has exceeded " << kMaxMigrationAttemptCount; return; } if (crosapi::browser_util::IsDataWipeRequired(user_id_hash)) { + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this log message. + LOG(WARNING) + << "Restarting to run profile migration since data wipe is required."; // If data wipe is required, no need for a further check to determine if // lacros data dir exists or not. MaybeRestartToMigrateCallback(account_id, user_id_hash, @@ -304,10 +341,17 @@ if (!crosapi::browser_util::IsProfileMigrationCompletedForUser( g_browser_process->local_state(), user_id_hash)) { + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this log message. + LOG(WARNING) << "Profile migration has not been completed yet."; MaybeRestartToMigrateCallback(account_id, user_id_hash, true /* is_required */); return; } else { + // TODO(crbug.com/1277848): Once `BrowserDataMigrator` stabilises, remove + // this log message. + LOG(WARNING) << "Calling IsMigrationRequiredOnWorker() to determine if " + "migration is required."; // Check if profile migration is required by checking if lacros data // directory exists even if profile migration is marked as completed. This // is needed because until the official release because lacros user data @@ -336,6 +380,7 @@ if (!is_required) return; + LOG(WARNING) << "Restarting to start profile migration."; SetMigrationStep(g_browser_process->local_state(), MigrationStep::kRestartCalled);
diff --git a/chrome/browser/ash/guest_os/guest_os_registry_service_icon_browsertest.cc b/chrome/browser/ash/guest_os/guest_os_registry_service_icon_browsertest.cc index ef61dc9..c8edafc 100644 --- a/chrome/browser/ash/guest_os/guest_os_registry_service_icon_browsertest.cc +++ b/chrome/browser/ash/guest_os/guest_os_registry_service_icon_browsertest.cc
@@ -6,12 +6,9 @@ #include <stddef.h> -#include "base/files/file_path_watcher.h" #include "base/files/file_util.h" #include "base/task/post_task.h" #include "base/task/thread_pool.h" -#include "base/test/bind.h" -#include "base/threading/thread_restrictions.h" #include "chrome/browser/ash/crostini/crostini_test_helper.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" @@ -52,31 +49,22 @@ return service_.get(); } - void LoadIconAndValidate(const std::string& app_id, - bool expect_loaded, - base::OnceClosure done_closure) { - service()->LoadIcon( - app_id, apps::IconKey(), apps::IconType::kCompressed, - /*size_hint_in_dip=*/1, /*allow_placeholder_icon=*/false, - /*fallback_resource_id=*/0, - base::BindOnce( - [](bool expect_loaded, base::OnceClosure done_closure, - apps::IconValuePtr icon) { - ASSERT_NE(nullptr, icon.get()); - if (expect_loaded) { - EXPECT_FALSE(icon->is_placeholder_icon); - EXPECT_EQ(apps::IconType::kCompressed, icon->icon_type); - EXPECT_GT(icon->compressed.size(), 0); - } else { - EXPECT_EQ(apps::IconType::kUnknown, icon->icon_type); - } - std::move(done_closure).Run(); - }, - expect_loaded, std::move(done_closure))); + void ExpectNoIconLoaded(base::OnceClosure done_closure, + apps::IconValuePtr icon) { + EXPECT_EQ(apps::IconType::kUnknown, icon->icon_type); + std::move(done_closure).Run(); + } + + void ExpectIconLoaded(base::OnceClosure done_closure, + apps::IconValuePtr icon) { + ASSERT_NE(nullptr, icon.get()); + EXPECT_FALSE(icon->is_placeholder_icon); + EXPECT_EQ(apps::IconType::kCompressed, icon->icon_type); + EXPECT_GT(icon->compressed.size(), 0); + std::move(done_closure).Run(); } void ExpectIconFiles(const std::string& app_id) { - base::ScopedAllowBlockingForTesting allow_blocking; base::FilePath icon_dir = browser()->profile()->GetPath().Append("crostini.icons").Append(app_id); @@ -114,15 +102,6 @@ return app_id; } - void RemoveApps() { - ApplicationList crostini_list; - crostini_list.set_vm_type( - GuestOsRegistryService::VmType::ApplicationList_VmType_TERMINA); - crostini_list.set_vm_name("termina"); - crostini_list.set_container_name("penguin"); - service()->UpdateApplicationList(crostini_list); - } - protected: chromeos::FakeCiceroneClient* fake_cicerone_client_; static constexpr char kSvgData[] = @@ -141,66 +120,59 @@ IN_PROC_BROWSER_TEST_F(GuestOsRegistryServiceIconTest, LoadIconOnce) { std::string app_id = AddApp(); + base::RunLoop run_loop; - LoadIconAndValidate(app_id, true, run_loop.QuitClosure()); + + service()->LoadIcon( + app_id, apps::IconKey(), apps::IconType::kCompressed, + /*size_hint_in_dip=*/1, /*allow_placeholder_icon=*/false, + /*fallback_resource_id=*/0, + base::BindOnce(&GuestOsRegistryServiceIconTest::ExpectIconLoaded, + base::Unretained(this), run_loop.QuitClosure())); run_loop.Run(); - ExpectIconFiles(app_id); + + base::RunLoop file_run_loop; + base::ThreadPool::PostTaskAndReply( + FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, + base::BindOnce(&GuestOsRegistryServiceIconTest::ExpectIconFiles, + base::Unretained(this), + + app_id), + file_run_loop.QuitClosure()); + file_run_loop.Run(); } IN_PROC_BROWSER_TEST_F(GuestOsRegistryServiceIconTest, LoadIconTwice) { std::string app_id = AddApp(); + base::RunLoop run_loop1, run_loop2; - LoadIconAndValidate(app_id, true, run_loop1.QuitClosure()); - LoadIconAndValidate(app_id, true, run_loop2.QuitClosure()); + + service()->LoadIcon( + app_id, apps::IconKey(), apps::IconType::kCompressed, + /*size_hint_in_dip=*/1, /*allow_placeholder_icon=*/false, + /*fallback_resource_id=*/0, + base::BindOnce(&GuestOsRegistryServiceIconTest::ExpectIconLoaded, + base::Unretained(this), run_loop1.QuitClosure())); + + service()->LoadIcon( + app_id, apps::IconKey(), apps::IconType::kCompressed, + /*size_hint_in_dip=*/1, /*allow_placeholder_icon=*/false, + /*fallback_resource_id=*/0, + base::BindOnce(&GuestOsRegistryServiceIconTest::ExpectIconLoaded, + base::Unretained(this), run_loop2.QuitClosure())); + run_loop1.Run(); run_loop2.Run(); - ExpectIconFiles(app_id); -} -IN_PROC_BROWSER_TEST_F(GuestOsRegistryServiceIconTest, AddRemoveAddAppIcon) { - base::ScopedAllowBlockingForTesting allow_blocking; - std::string app_id = crostini::CrostiniTestHelper::GenerateAppId( - kSvgAppName, "termina", "penguin"); - base::FilePath icon_dir = - browser()->profile()->GetPath().Append("crostini.icons").Append(app_id); + base::RunLoop file_run_loop; + base::ThreadPool::PostTaskAndReply( + FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT}, + base::BindOnce(&GuestOsRegistryServiceIconTest::ExpectIconFiles, + base::Unretained(this), - // Initially, there's no app icon. - EXPECT_FALSE(base::PathExists(icon_dir)); - base::RunLoop run_loop1; - LoadIconAndValidate(app_id, false, run_loop1.QuitClosure()); - run_loop1.Run(); - - // Add the app. There should be an icon. - AddApp(); - base::RunLoop run_loop2; - LoadIconAndValidate(app_id, true, run_loop2.QuitClosure()); - run_loop2.Run(); - EXPECT_TRUE(base::PathExists(icon_dir)); - - // RemoveApps, and the icon should go away. We need a FilePathWatcher to know - // when RemoveApps has finished deleting icons since it is done async. - base::RunLoop remove_apps_loop; - base::FilePathWatcher watcher; - ASSERT_TRUE(watcher.Watch( - icon_dir, base::FilePathWatcher::Type::kNonRecursive, - base::BindLambdaForTesting([&](const base::FilePath& path, bool error) { - if (!base::PathExists(icon_dir)) { - remove_apps_loop.Quit(); - } - }))); - RemoveApps(); - remove_apps_loop.Run(); - - base::RunLoop run_loop3; - LoadIconAndValidate(app_id, false, run_loop3.QuitClosure()); - run_loop3.Run(); - - // Add the app. Ensure 2nd fetch of icon from VM succeeds. - AddApp(); - base::RunLoop run_loop4; - LoadIconAndValidate(app_id, true, run_loop4.QuitClosure()); - run_loop4.Run(); - EXPECT_TRUE(base::PathExists(icon_dir)); + app_id), + file_run_loop.QuitClosure()); + file_run_loop.Run(); } } // namespace guest_os
diff --git a/chrome/browser/ash/login/lock/screen_locker.cc b/chrome/browser/ash/login/lock/screen_locker.cc index eeff1b4..de26604 100644 --- a/chrome/browser/ash/login/lock/screen_locker.cc +++ b/chrome/browser/ash/login/lock/screen_locker.cc
@@ -620,12 +620,10 @@ } if (!screen_locker_) { - SessionControllerClientImpl::Get()->PrepareForLock(base::BindOnce([]() { - ScreenLocker* locker = - new ScreenLocker(user_manager::UserManager::Get()->GetUnlockUsers()); - VLOG(1) << "Created ScreenLocker " << locker; - locker->Init(); - })); + ScreenLocker* locker = + new ScreenLocker(user_manager::UserManager::Get()->GetUnlockUsers()); + VLOG(1) << "Created ScreenLocker " << locker; + locker->Init(); } else { VLOG(1) << "ScreenLocker " << screen_locker_ << " already exists; " << " calling session manager's HandleLockScreenShown D-Bus method";
diff --git a/chrome/browser/ash/login/lock/screen_locker_browsertest.cc b/chrome/browser/ash/login/lock/screen_locker_browsertest.cc index feb76a5..99c9dd28 100644 --- a/chrome/browser/ash/login/lock/screen_locker_browsertest.cc +++ b/chrome/browser/ash/login/lock/screen_locker_browsertest.cc
@@ -7,6 +7,10 @@ #include <memory> #include "ash/constants/ash_pref_names.h" +#include "ash/session/fullscreen_controller.h" +#include "ash/session/fullscreen_notification_bubble.h" +#include "ash/session/session_controller_impl.h" +#include "ash/shell.h" #include "ash/wm/window_state.h" #include "base/bind.h" #include "base/run_loop.h" @@ -30,6 +34,7 @@ #include "content/public/test/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/compositor/scoped_animation_duration_scale_mode.h" +#include "ui/views/widget/widget.h" namespace ash { namespace { @@ -82,6 +87,16 @@ base::RunLoop().RunUntilIdle(); } + bool IsFullscreenNotificationShowing() { + ash::FullscreenController* ash_fullscreen_controller = + Shell::Get()->session_controller()->fullscreen_controller_for_test(); + return ash_fullscreen_controller->bubble_for_test() && + ash_fullscreen_controller->bubble_for_test()->widget_for_test() && + ash_fullscreen_controller->bubble_for_test() + ->widget_for_test() + ->IsVisible(); + } + private: void OnStartSession(const dbus::ObjectPath& path) {} @@ -109,71 +124,116 @@ 1, session_manager_client()->notify_lock_screen_dismissed_call_count()); } -// Test how locking the screen affects an active fullscreen window. -IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestFullscreenExit) { - // 1) If the active browser window is in fullscreen and the fullscreen window - // does not have all the pixels (e.g. the shelf is auto hidden instead of - // hidden), locking the screen should exit fullscreen. The shelf is - // auto hidden when in immersive fullscreen. +// Test that locking/unlocking the screen does not exit full screen if the +// active window is in full screen mode and the full screen window does not have +// all the pixels (e.g. immersive full screen where the shelf is auto hidden +// instead of hidden). +IN_PROC_BROWSER_TEST_F(ScreenLockerTest, BrowserFullscreenMode) { ScreenLockerTester tester; BrowserWindow* browser_window = browser()->window(); auto* window_state = WindowState::Get(browser_window->GetNativeWindow()); - { - FullscreenNotificationObserver fullscreen_waiter(browser()); - browser() - ->exclusive_access_manager() - ->fullscreen_controller() - ->ToggleBrowserFullscreenMode(); - fullscreen_waiter.Wait(); - EXPECT_TRUE(browser_window->IsFullscreen()); - EXPECT_FALSE(window_state->GetHideShelfWhenFullscreen()); - EXPECT_FALSE(tester.IsLocked()); - } - { - tester.Lock(); - EXPECT_FALSE(browser_window->IsFullscreen()); - EXPECT_TRUE(window_state->GetHideShelfWhenFullscreen()); - EXPECT_TRUE(tester.IsLocked()); - } + + ::FullscreenController* fullscreen_controller = + browser()->exclusive_access_manager()->fullscreen_controller(); + FullscreenNotificationObserver fullscreen_waiter(browser()); + + // Enter browser full screen mode. + fullscreen_controller->ToggleBrowserFullscreenMode(); + fullscreen_waiter.Wait(); + EXPECT_TRUE(browser_window->IsFullscreen()); + EXPECT_FALSE(window_state->GetHideShelfWhenFullscreen()); + EXPECT_FALSE(IsFullscreenNotificationShowing()); + + // Lock and unlock screen. + EXPECT_FALSE(tester.IsLocked()); + tester.Lock(); + EXPECT_TRUE(tester.IsLocked()); tester.SetUnlockPassword(user_manager::StubAccountId(), "pass"); tester.UnlockWithPassword(user_manager::StubAccountId(), "pass"); EXPECT_FALSE(tester.IsLocked()); - EXPECT_FALSE(browser_window->IsFullscreen()); // Browser window should be activated after screen locker is gone. Otherwise, // the rest of the test would fail. ASSERT_EQ(window_state, WindowState::ForActiveWindow()); - // 2) Similar to 1) if the active browser window is in fullscreen and the - // fullscreen window has all of the pixels, locking the screen should exit - // fullscreen. The fullscreen window has all of the pixels when in tab - // fullscreen. - { - FullscreenNotificationObserver fullscreen_waiter(browser()); - content::WebContents* web_contents = - browser()->tab_strip_model()->GetActiveWebContents(); - browser() - ->exclusive_access_manager() - ->fullscreen_controller() - ->EnterFullscreenModeForTab(web_contents->GetMainFrame()); - fullscreen_waiter.Wait(); - EXPECT_TRUE(browser_window->IsFullscreen()); - EXPECT_TRUE(window_state->GetHideShelfWhenFullscreen()); - EXPECT_FALSE(tester.IsLocked()); - } - { - tester.Lock(); - EXPECT_FALSE(browser_window->IsFullscreen()); - EXPECT_TRUE(tester.IsLocked()); - } + // The browser window is still in full screen and a full screen notification + // is shown. + EXPECT_TRUE(browser_window->IsFullscreen()); + EXPECT_FALSE(window_state->GetHideShelfWhenFullscreen()); + EXPECT_TRUE(IsFullscreenNotificationShowing()); + // Exiting full screen mode hides the notification. + fullscreen_controller->ToggleBrowserFullscreenMode(); + fullscreen_waiter.Wait(); + EXPECT_FALSE(browser_window->IsFullscreen()); + EXPECT_FALSE(IsFullscreenNotificationShowing()); + + // Re-entering full screen mode does not re-show the full screen notification. + fullscreen_controller->ToggleBrowserFullscreenMode(); + fullscreen_waiter.Wait(); + EXPECT_TRUE(browser_window->IsFullscreen()); + EXPECT_FALSE(IsFullscreenNotificationShowing()); + + EXPECT_EQ(1, session_manager_client()->notify_lock_screen_shown_call_count()); + EXPECT_EQ( + 1, session_manager_client()->notify_lock_screen_dismissed_call_count()); +} + +// Test that locking/unlocking the screen does not exit full screen if the +// active window is in full screen mode and the full screen window has all of +// the pixels (e.g. tab-initiated full screen mode). +IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TabInitiatedFullscreenMode) { + ScreenLockerTester tester; + BrowserWindow* browser_window = browser()->window(); + auto* window_state = WindowState::Get(browser_window->GetNativeWindow()); + content::WebContents* web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + + ::FullscreenController* fullscreen_controller = + browser()->exclusive_access_manager()->fullscreen_controller(); + FullscreenNotificationObserver fullscreen_waiter(browser()); + + // Enter tab-initiated full screen mode. + fullscreen_controller->EnterFullscreenModeForTab( + web_contents->GetMainFrame()); + fullscreen_waiter.Wait(); + EXPECT_TRUE(browser_window->IsFullscreen()); + EXPECT_TRUE(window_state->GetHideShelfWhenFullscreen()); + EXPECT_FALSE(IsFullscreenNotificationShowing()); + + // Lock and unlock screen. + EXPECT_FALSE(tester.IsLocked()); + tester.Lock(); + EXPECT_TRUE(tester.IsLocked()); tester.SetUnlockPassword(user_manager::StubAccountId(), "pass"); tester.UnlockWithPassword(user_manager::StubAccountId(), "pass"); EXPECT_FALSE(tester.IsLocked()); - EXPECT_EQ(2, session_manager_client()->notify_lock_screen_shown_call_count()); + // Browser window should be activated after screen locker is gone. Otherwise, + // the rest of the test would fail. + ASSERT_EQ(window_state, WindowState::ForActiveWindow()); + + // The browser window is still in full screen and a full screen notification + // is shown. + EXPECT_TRUE(browser_window->IsFullscreen()); + EXPECT_TRUE(window_state->GetHideShelfWhenFullscreen()); + EXPECT_TRUE(IsFullscreenNotificationShowing()); + + // Exiting full screen mode hides the notification. + fullscreen_controller->ExitFullscreenModeForTab(web_contents); + fullscreen_waiter.Wait(); + EXPECT_FALSE(browser_window->IsFullscreen()); + EXPECT_FALSE(IsFullscreenNotificationShowing()); + + // Re-entering full screen mode does not re-show the full screen notification. + fullscreen_controller->ToggleBrowserFullscreenMode(); + fullscreen_waiter.Wait(); + EXPECT_TRUE(browser_window->IsFullscreen()); + EXPECT_FALSE(IsFullscreenNotificationShowing()); + + EXPECT_EQ(1, session_manager_client()->notify_lock_screen_shown_call_count()); EXPECT_EQ( - 2, session_manager_client()->notify_lock_screen_dismissed_call_count()); + 1, session_manager_client()->notify_lock_screen_dismissed_call_count()); } IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestShowTwice) {
diff --git a/chrome/browser/ash/login/screens/hardware_data_collection_screen.cc b/chrome/browser/ash/login/screens/hardware_data_collection_screen.cc index 09eb9d2..bf900d1 100644 --- a/chrome/browser/ash/login/screens/hardware_data_collection_screen.cc +++ b/chrome/browser/ash/login/screens/hardware_data_collection_screen.cc
@@ -8,6 +8,7 @@ #include "ash/constants/ash_switches.h" #include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" +#include "chrome/browser/ash/settings/hardware_data_usage_controller.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" #include "chrome/browser/profiles/profile_manager.h" @@ -94,7 +95,8 @@ void HWDataCollectionScreen::OnUserAction(const std::string& action_id) { if (action_id == kUserActionAcceptButtonClicked) { - // TODO(dkuzmin): set a device setting here, once it will be available + HWDataUsageController::Get()->Set(ProfileManager::GetActiveUserProfile(), + base::Value(hw_data_usage_enabled_)); exit_callback_.Run(hw_data_usage_enabled_ ? Result::ACCEPTED_WITH_HW_DATA_USAGE : Result::ACCEPTED_WITHOUT_HW_DATA_USAGE);
diff --git a/chrome/browser/ash/login/screens/marketing_opt_in_screen.cc b/chrome/browser/ash/login/screens/marketing_opt_in_screen.cc index 0e945e7..58b7f44 100644 --- a/chrome/browser/ash/login/screens/marketing_opt_in_screen.cc +++ b/chrome/browser/ash/login/screens/marketing_opt_in_screen.cc
@@ -68,12 +68,6 @@ event); } -void RecordGeolocationResponseLength(int length) { - base::UmaHistogramExactLinear( - "OOBE.MarketingOptInScreen.GeolocationResolveLength", length, - kMaxGeolocationResponseLength); -} - } // namespace // static @@ -219,17 +213,16 @@ char region[kMaxGeolocationResponseLength]; UErrorCode error = U_ZERO_ERROR; auto timezone_id_unicode = icu::UnicodeString::fromUTF8(timezone_id); - const auto region_length = icu::TimeZone::getRegion( - timezone_id_unicode, region, kMaxGeolocationResponseLength, error); + icu::TimeZone::getRegion(timezone_id_unicode, region, + kMaxGeolocationResponseLength, error); // Track failures. if (U_FAILURE(error)) { RecordGeolocationResolve(GeolocationEvent::kCouldNotDetermineCountry); return; } - // Track whether we could successfully resolve and the length of the code. + // Track whether we could successfully resolve. RecordGeolocationResolve(GeolocationEvent::kCountrySuccessfullyDetermined); - RecordGeolocationResponseLength(region_length); // Set the country country_.clear();
diff --git a/chrome/browser/ash/login/screens/marketing_opt_in_screen_browsertest.cc b/chrome/browser/ash/login/screens/marketing_opt_in_screen_browsertest.cc index 883d435..beb9c325 100644 --- a/chrome/browser/ash/login/screens/marketing_opt_in_screen_browsertest.cc +++ b/chrome/browser/ash/login/screens/marketing_opt_in_screen_browsertest.cc
@@ -124,7 +124,7 @@ void OptIn(); void OptOut(); - void ExpectGeolocationMetric(bool resolved, int length); + void ExpectGeolocationMetric(bool resolved); void WaitForScreenExit(); // US as default location for non-parameterized tests. @@ -273,8 +273,7 @@ test::OobeJS().ExpectHasNoAttribute("checked", kChromebookEmailToggle); } -void MarketingOptInScreenTest::ExpectGeolocationMetric(bool resolved, - int length) { +void MarketingOptInScreenTest::ExpectGeolocationMetric(bool resolved) { histogram_tester_.ExpectUniqueSample( "OOBE.MarketingOptInScreen.GeolocationResolve", resolved @@ -282,10 +281,6 @@ kCountrySuccessfullyDetermined : MarketingOptInScreen::GeolocationEvent::kCouldNotDetermineCountry, 1); - if (resolved) { - histogram_tester_.ExpectUniqueSample( - "OOBE.MarketingOptInScreen.GeolocationResolveLength", length, 1); - } } void MarketingOptInScreenTest::WaitForScreenExit() { @@ -532,7 +527,7 @@ 1); // Expect successful geolocation resolve. - ExpectGeolocationMetric(true, std::string(param.country_code).size()); + ExpectGeolocationMetric(/*resolved=*/true); } // Test all the countries lists. @@ -572,10 +567,7 @@ ExpectNoOptInOption(); TapOnGetStartedAndWaitForScreenExit(); - if (param.is_unknown_country) - ExpectGeolocationMetric(false, 0); - else - ExpectGeolocationMetric(true, std::string(param.country_code).size()); + ExpectGeolocationMetric(/*resolved=*/!param.is_unknown_country); } // Tests that countries from the extended list
diff --git a/chrome/browser/ash/policy/dlp/dlp_confidential_contents.cc b/chrome/browser/ash/policy/dlp/dlp_confidential_contents.cc index c4a5508..8ed3f79 100644 --- a/chrome/browser/ash/policy/dlp/dlp_confidential_contents.cc +++ b/chrome/browser/ash/policy/dlp/dlp_confidential_contents.cc
@@ -83,6 +83,10 @@ return contents_; } +base::flat_set<DlpConfidentialContent>& DlpConfidentialContents::GetContents() { + return contents_; +} + void DlpConfidentialContents::Add(content::WebContents* web_contents) { contents_.insert(DlpConfidentialContent(web_contents)); } @@ -96,21 +100,6 @@ Add(web_contents); } -void DlpConfidentialContents::Remove(content::WebContents* web_contents) { - base::EraseIf(contents_, [&](const DlpConfidentialContent& content) { - return content.url.EqualsIgnoringRef(web_contents->GetLastCommittedURL()); - }); -} - -bool DlpConfidentialContents::Contains( - content::WebContents* web_contents) const { - return (std::find_if(contents_.begin(), contents_.end(), - [&](const DlpConfidentialContent& content) { - return content.url.EqualsIgnoringRef( - web_contents->GetLastCommittedURL()); - })) != contents_.end(); -} - bool DlpConfidentialContents::IsEmpty() const { return contents_.empty(); } @@ -119,13 +108,6 @@ contents_.insert(other.contents_.begin(), other.contents_.end()); } -void DlpConfidentialContents::DifferenceWith( - const DlpConfidentialContents& other) { - base::EraseIf(contents_, [&other](const DlpConfidentialContent& content) { - return other.contents_.contains(content); - }); -} - DlpConfidentialContentsCache::Entry::Entry( const DlpConfidentialContent& content, DlpRulesManager::Restriction restriction, @@ -184,17 +166,6 @@ return entries_.size(); } -DlpConfidentialContents -DlpConfidentialContentsCache::GetDlpConfidentialContentsForRestriction( - DlpRulesManager::Restriction restriction) { - DlpConfidentialContents contents; - for (auto& entry : entries_) { - if (entry->restriction == restriction) - contents.Add(entry->content); - } - return contents; -} - // static base::TimeDelta DlpConfidentialContentsCache::GetCacheTimeout() { return kDefaultCacheTimeout;
diff --git a/chrome/browser/ash/policy/dlp/dlp_confidential_contents.h b/chrome/browser/ash/policy/dlp/dlp_confidential_contents.h index d50357fc..d6f8f49 100644 --- a/chrome/browser/ash/policy/dlp/dlp_confidential_contents.h +++ b/chrome/browser/ash/policy/dlp/dlp_confidential_contents.h
@@ -62,6 +62,9 @@ ~DlpConfidentialContents(); // Returns a reference to the underlying content container. + base::flat_set<DlpConfidentialContent>& GetContents(); + + // Returns a const reference to the underlying content container. const base::flat_set<DlpConfidentialContent>& GetContents() const; // Converts |web_contents| to a DlpConfidentialContent and adds it to the @@ -74,14 +77,6 @@ // |web_contents| converted to a DlpConfidentialContent. void ClearAndAdd(content::WebContents* web_contents); - // Removes the content corresponding to |web_contents| if it exists and no-op - // otherwise. - void Remove(content::WebContents* web_contents); - - // Returns true if the underlying container contains DlpConfidentialContent - // that is created from |web_contents|. - bool Contains(content::WebContents* web_contents) const; - // Returns whether there is any content stored or not. bool IsEmpty() const; @@ -89,9 +84,6 @@ // duplicates. void UnionWith(const DlpConfidentialContents& other); - // Removes all content that also exists in |other|. - void DifferenceWith(const DlpConfidentialContents& other); - private: base::flat_set<DlpConfidentialContent> contents_; }; @@ -118,6 +110,8 @@ // Returns true if there is a cached entry corresponding to |web_contents| and // |restriction|. + // Useful to avoid converting |web_contents| to a DlpConfidentialContent + // unnecessarily. bool Contains(content::WebContents* web_contents, DlpRulesManager::Restriction restriction) const; @@ -129,11 +123,6 @@ // Returns the number of cached entries, useful for testing. int GetSizeForTesting() const; - // Returns DlpConfidentialContents for the given |restriction|. - // Used to pass the list of allowed contents when creating a warning dialog. - DlpConfidentialContents GetDlpConfidentialContentsForRestriction( - DlpRulesManager::Restriction restriction); - // Returns the duration for which the entries are kept in the cache. static base::TimeDelta GetCacheTimeout();
diff --git a/chrome/browser/ash/policy/dlp/dlp_confidential_contents_unittest.cc b/chrome/browser/ash/policy/dlp/dlp_confidential_contents_unittest.cc index 47a4f5f9..11ed3c8 100644 --- a/chrome/browser/ash/policy/dlp/dlp_confidential_contents_unittest.cc +++ b/chrome/browser/ash/policy/dlp/dlp_confidential_contents_unittest.cc
@@ -55,6 +55,19 @@ return DlpConfidentialContent(CreateWebContents(title, url).get()); } + // Helper to check whether |contents| has an element corresponding to + // |web_contents|. + bool Contains(const DlpConfidentialContents& contents, + content::WebContents* web_contents) { + auto iter = std::find_if(contents.GetContents().begin(), + contents.GetContents().end(), + [&](const DlpConfidentialContent& content) { + return content.url.EqualsIgnoringRef( + web_contents->GetLastCommittedURL()); + }); + return iter != contents.GetContents().end(); + } + private: content::BrowserTaskEnvironment task_environment_; content::RenderViewHostTestEnabler render_view_host_test_enabler_; @@ -72,7 +85,7 @@ contents.Add(web_contents.get()); contents.Add(web_contents.get()); EXPECT_EQ(contents.GetContents().size(), 1); - EXPECT_TRUE(contents.Contains(web_contents.get())); + EXPECT_TRUE(Contains(contents, web_contents.get())); } TEST_F(DlpConfidentialContentsTest, ClearAndAdd) { @@ -88,9 +101,9 @@ contents.ClearAndAdd(CreateWebContents(title3, url3).get()); EXPECT_EQ(contents.GetContents().size(), 1); - EXPECT_FALSE(contents.Contains(web_contents1.get())); - EXPECT_FALSE(contents.Contains(web_contents2.get())); - EXPECT_TRUE(contents.Contains(web_contents3.get())); + EXPECT_FALSE(Contains(contents, web_contents1.get())); + EXPECT_FALSE(Contains(contents, web_contents2.get())); + EXPECT_TRUE(Contains(contents, web_contents3.get())); } TEST_F(DlpConfidentialContentsTest, UnionShouldAddUniqueItems) { @@ -109,66 +122,13 @@ EXPECT_EQ(contents1.GetContents().size(), 2); EXPECT_EQ(contents2.GetContents().size(), 2); - EXPECT_FALSE(contents1.Contains(web_contents3.get())); + EXPECT_FALSE(Contains(contents1, web_contents3.get())); contents1.UnionWith(contents2); EXPECT_EQ(contents1.GetContents().size(), 3); EXPECT_EQ(contents2.GetContents().size(), 2); - EXPECT_TRUE(contents1.Contains(web_contents3.get())); -} - -TEST_F(DlpConfidentialContentsTest, DifferenceShouldRemoveMatchedItems) { - DlpConfidentialContents contents1; - DlpConfidentialContents contents2; - - auto web_contents1 = CreateWebContents(title1, url1); - - contents1.Add(web_contents1.get()); - contents1.Add(CreateWebContents(title2, url2).get()); - - contents2.Add(web_contents1.get()); - contents2.Add(CreateWebContents(title3, url3).get()); - - EXPECT_EQ(contents1.GetContents().size(), 2); - EXPECT_EQ(contents2.GetContents().size(), 2); - EXPECT_TRUE(contents1.Contains(web_contents1.get())); - - contents1.DifferenceWith(contents2); - - EXPECT_EQ(contents1.GetContents().size(), 1); - EXPECT_FALSE(contents1.Contains(web_contents1.get())); - EXPECT_EQ(contents2.GetContents().size(), 2); -} - -TEST_F(DlpConfidentialContentsTest, RemoveExistingContents) { - DlpConfidentialContents contents; - - auto web_contents1 = CreateWebContents(title1, url1); - - contents.Add(web_contents1.get()); - contents.Add(CreateWebContents(title2, url2).get()); - - EXPECT_EQ(contents.GetContents().size(), 2); - EXPECT_TRUE(contents.Contains(web_contents1.get())); - - contents.Remove(web_contents1.get()); - - EXPECT_EQ(contents.GetContents().size(), 1); - EXPECT_FALSE(contents.Contains(web_contents1.get())); -} - -TEST_F(DlpConfidentialContentsTest, RemoveNonexistingContents) { - DlpConfidentialContents contents; - - contents.Add(CreateWebContents(title1, url1).get()); - contents.Add(CreateWebContents(title2, url2).get()); - - EXPECT_EQ(contents.GetContents().size(), 2); - - contents.Remove(CreateWebContents(title3, url3).get()); - - EXPECT_EQ(contents.GetContents().size(), 2); + EXPECT_TRUE(Contains(contents1, web_contents3.get())); } TEST_F(DlpConfidentialContentsTest, CacheEvictsAfterTimeout) { @@ -186,10 +146,7 @@ } TEST_F(DlpConfidentialContentsTest, CacheEvictsWhenFull) { - scoped_refptr<base::TestMockTimeTaskRunner> task_runner = - base::MakeRefCounted<base::TestMockTimeTaskRunner>(); DlpConfidentialContentsCache cache; - cache.SetTaskRunnerForTesting(task_runner); cache.SetCacheSizeLimitForTesting(1); DlpConfidentialContent content1 = CreateConfidentialContent(title1, url1); @@ -203,10 +160,7 @@ } TEST_F(DlpConfidentialContentsTest, CacheRemovesDuplicates) { - scoped_refptr<base::TestMockTimeTaskRunner> task_runner = - base::MakeRefCounted<base::TestMockTimeTaskRunner>(); DlpConfidentialContentsCache cache; - cache.SetTaskRunnerForTesting(task_runner); DlpConfidentialContent content = CreateConfidentialContent(title1, url1);
diff --git a/chrome/browser/ash/policy/dlp/dlp_content_manager.cc b/chrome/browser/ash/policy/dlp/dlp_content_manager.cc index 2bde82e..f32f0c3 100644 --- a/chrome/browser/ash/policy/dlp/dlp_content_manager.cc +++ b/chrome/browser/ash/policy/dlp/dlp_content_manager.cc
@@ -187,8 +187,8 @@ if (IsWarn(restriction_info)) { // Check if the contents were already allowed and don't warn in that case. - if (GetUserAllowedContents(DlpRulesManager::Restriction::kPrinting) - .Contains(web_contents)) { + if (user_allowed_contents_cache_.Contains( + web_contents, DlpRulesManager::Restriction::kPrinting)) { ReportWarningProceededEvent(restriction_info.url, DlpRulesManager::Restriction::kPrinting, reporting_manager_); @@ -246,8 +246,8 @@ if (IsWarn(info.restriction_info)) { // Check which of the contents were already allowed and don't warn for // those. - info.confidential_contents.DifferenceWith( - GetUserAllowedContents(DlpRulesManager::Restriction::kScreenShare)); + RemoveAllowedContents(info.confidential_contents, + DlpRulesManager::Restriction::kScreenShare); if (info.confidential_contents.IsEmpty()) { // The user already allowed all the visible content. std::move(callback).Run(true); @@ -729,8 +729,8 @@ // can inform the user about it after the recording is finished. We drop // those that the user was already warned about and has allowed the screen // capture to proceed. - info.confidential_contents.DifferenceWith( - GetUserAllowedContents(DlpRulesManager::Restriction::kScreenshot)); + RemoveAllowedContents(info.confidential_contents, + DlpRulesManager::Restriction::kScreenshot); running_video_capture_info_->confidential_contents.UnionWith( info.confidential_contents); return; @@ -754,8 +754,8 @@ if (IsWarn(info.restriction_info)) { // Check which of the contents were already allowed and don't warn for // those. - info.confidential_contents.DifferenceWith( - GetUserAllowedContents(DlpRulesManager::Restriction::kScreenShare)); + RemoveAllowedContents(info.confidential_contents, + DlpRulesManager::Restriction::kScreenShare); if (info.confidential_contents.IsEmpty()) { // The user already allowed all the visible content. if (!screen_share.IsRunning()) { @@ -830,8 +830,8 @@ if (IsWarn(info.restriction_info)) { // Check which of the contents were already allowed and don't warn for // those. - info.confidential_contents.DifferenceWith( - GetUserAllowedContents(DlpRulesManager::Restriction::kScreenshot)); + RemoveAllowedContents(info.confidential_contents, + DlpRulesManager::Restriction::kScreenshot); if (info.confidential_contents.IsEmpty()) { // The user already allowed all the visible content. std::move(callback).Run(true); @@ -857,8 +857,10 @@ bool should_proceed) { if (should_proceed) { screen_share.Resume(); - GetUserAllowedContents(DlpRulesManager::Restriction::kScreenShare) - .UnionWith(confidential_contents); + for (const auto& content : confidential_contents.GetContents()) { + user_allowed_contents_cache_.Cache( + content, DlpRulesManager::Restriction::kScreenShare); + } } else { // TODO(crbug.com/1259605): stop instead of pause. screen_share.Pause(); @@ -872,7 +874,9 @@ OnDlpRestrictionCheckedCallback callback, bool should_proceed) { if (should_proceed) { - GetUserAllowedContents(restriction).UnionWith(confidential_contents); + for (const auto& content : confidential_contents.GetContents()) { + user_allowed_contents_cache_.Cache(content, restriction); + } } std::move(callback).Run(should_proceed); } @@ -897,9 +901,13 @@ } } -DlpConfidentialContents& DlpContentManager::GetUserAllowedContents( +void DlpContentManager::RemoveAllowedContents( + DlpConfidentialContents& contents, DlpRulesManager::Restriction restriction) { - return user_allowed_contents_[restriction]; + base::EraseIf( + contents.GetContents(), [=](const DlpConfidentialContent& content) { + return user_allowed_contents_cache_.Contains(content, restriction); + }); } // ScopedDlpContentManagerForTesting
diff --git a/chrome/browser/ash/policy/dlp/dlp_content_manager.h b/chrome/browser/ash/policy/dlp/dlp_content_manager.h index 30508609..3b29cdc 100644 --- a/chrome/browser/ash/policy/dlp/dlp_content_manager.h +++ b/chrome/browser/ash/policy/dlp/dlp_content_manager.h
@@ -332,9 +332,10 @@ void ReportWarningEvent(const RestrictionLevelAndUrl& restriction_info, DlpRulesManager::Restriction restriction); - // Returns the set of cached user allowed contents for given |restriction|. - DlpConfidentialContents& GetUserAllowedContents( - DlpRulesManager::Restriction restriction); + // Removes all elements of |contents| that the user has recently already + // acknowledged the warning for. + void RemoveAllowedContents(DlpConfidentialContents& contents, + DlpRulesManager::Restriction restriction); // Map from currently known confidential WebContents to the restrictions. base::flat_map<content::WebContents*, DlpContentRestrictionSet> @@ -355,9 +356,7 @@ // Keeps track of the contents for which the user allowed the action after // being shown a warning for each type of restriction. - // TODO(crbug.com/1264803): Change to DlpConfidentialContentsCache - base::flat_map<DlpRulesManager::Restriction, DlpConfidentialContents> - user_allowed_contents_; + DlpConfidentialContentsCache user_allowed_contents_cache_; DlpReportingManager* reporting_manager_;
diff --git a/chrome/browser/ash/policy/dlp/dlp_content_manager_test_helper.cc b/chrome/browser/ash/policy/dlp/dlp_content_manager_test_helper.cc index 65a663af..8dfa4b94 100644 --- a/chrome/browser/ash/policy/dlp/dlp_content_manager_test_helper.cc +++ b/chrome/browser/ash/policy/dlp/dlp_content_manager_test_helper.cc
@@ -55,11 +55,17 @@ manager_->ResetWarnNotifierForTesting(); } -const DlpConfidentialContents& -DlpContentManagerTestHelper::GetUserAllowedContentsForRestriction( +bool DlpContentManagerTestHelper::HasContentCachedForRestriction( + content::WebContents* web_contents, DlpRulesManager::Restriction restriction) const { DCHECK(manager_); - return manager_->user_allowed_contents_[restriction]; + return manager_->user_allowed_contents_cache_.Contains(web_contents, + restriction); +} + +bool DlpContentManagerTestHelper::HasAnyContentCached() const { + DCHECK(manager_); + return manager_->user_allowed_contents_cache_.GetSizeForTesting() != 0; } base::TimeDelta DlpContentManagerTestHelper::GetPrivacyScreenOffDelay() const {
diff --git a/chrome/browser/ash/policy/dlp/dlp_content_manager_test_helper.h b/chrome/browser/ash/policy/dlp/dlp_content_manager_test_helper.h index c20cf3c..47ecf77 100644 --- a/chrome/browser/ash/policy/dlp/dlp_content_manager_test_helper.h +++ b/chrome/browser/ash/policy/dlp/dlp_content_manager_test_helper.h
@@ -38,9 +38,12 @@ void ResetWarnNotifierForTesting(); - const DlpConfidentialContents& GetUserAllowedContentsForRestriction( + bool HasContentCachedForRestriction( + content::WebContents* web_contents, DlpRulesManager::Restriction restriction) const; + bool HasAnyContentCached() const; + base::TimeDelta GetPrivacyScreenOffDelay() const; DlpContentManager* GetContentManager() const;
diff --git a/chrome/browser/ash/policy/dlp/dlp_content_manager_unittest.cc b/chrome/browser/ash/policy/dlp/dlp_content_manager_unittest.cc index 4598ab3..c23503e 100644 --- a/chrome/browser/ash/policy/dlp/dlp_content_manager_unittest.cc +++ b/chrome/browser/ash/policy/dlp/dlp_content_manager_unittest.cc
@@ -565,18 +565,12 @@ std::unique_ptr<content::WebContents> web_contents = CreateWebContents(); EXPECT_EQ(GetManager()->GetConfidentialRestrictions(web_contents.get()), kEmptyRestrictionSet); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kPrinting) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); GetManager()->CheckPrintingRestriction( web_contents.get(), base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kPrinting) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); EXPECT_TRUE(events_.empty()); // Warn restriction is enforced: allow and remember that the user proceeded. @@ -587,10 +581,8 @@ web_contents.get(), base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kPrinting) - .Contains(web_contents.get())); + EXPECT_TRUE(helper_.HasContentCachedForRestriction( + web_contents.get(), DlpRulesManager::Restriction::kPrinting)); EXPECT_EQ(events_.size(), 2u); EXPECT_THAT(events_[0], IsDlpPolicyEvent(CreateDlpPolicyEvent( @@ -606,10 +598,8 @@ web_contents.get(), base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kPrinting) - .Contains(web_contents.get())); + EXPECT_TRUE(helper_.HasContentCachedForRestriction( + web_contents.get(), DlpRulesManager::Restriction::kPrinting)); EXPECT_EQ(events_.size(), 3u); EXPECT_THAT(events_[2], IsDlpPolicyEvent(CreateDlpPolicyWarningProceededEvent( @@ -644,18 +634,12 @@ std::unique_ptr<content::WebContents> web_contents = CreateWebContents(); EXPECT_EQ(GetManager()->GetConfidentialRestrictions(web_contents.get()), kEmptyRestrictionSet); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kPrinting) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); GetManager()->CheckPrintingRestriction( web_contents.get(), base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kPrinting) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); EXPECT_TRUE(events_.empty()); // Warn restriction is enforced: reject since the user canceled. @@ -666,10 +650,7 @@ web_contents.get(), base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(false /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kPrinting) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); EXPECT_EQ(events_.size(), 1u); EXPECT_THAT(events_[0], IsDlpPolicyEvent(CreateDlpPolicyEvent( @@ -681,10 +662,7 @@ web_contents.get(), base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(false /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kPrinting) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); EXPECT_EQ(events_.size(), 2u); EXPECT_THAT(events_[1], IsDlpPolicyEvent(CreateDlpPolicyEvent( @@ -764,17 +742,11 @@ std::unique_ptr<content::WebContents> web_contents = CreateWebContents(); EXPECT_EQ(GetManager()->GetConfidentialRestrictions(web_contents.get()), kEmptyRestrictionSet); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); GetManager()->CheckCaptureModeInitRestriction( base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); // Warn restriction is enforced: allow and remember that the user proceeded. helper_.ChangeConfidentiality(web_contents.get(), kScreenshotWarned); @@ -783,19 +755,15 @@ GetManager()->CheckCaptureModeInitRestriction( base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .Contains(web_contents.get())); + EXPECT_TRUE(helper_.HasContentCachedForRestriction( + web_contents.get(), DlpRulesManager::Restriction::kScreenshot)); // Check again: allow based on cached user's response - no dialog is shown. GetManager()->CheckCaptureModeInitRestriction( base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .Contains(web_contents.get())); + EXPECT_TRUE(helper_.HasContentCachedForRestriction( + web_contents.get(), DlpRulesManager::Restriction::kScreenshot)); // Web contents are destroyed: allow, no dialog is shown. helper_.DestroyWebContents(web_contents.get()); @@ -817,17 +785,11 @@ std::unique_ptr<content::WebContents> web_contents = CreateWebContents(); EXPECT_EQ(GetManager()->GetConfidentialRestrictions(web_contents.get()), kEmptyRestrictionSet); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); GetManager()->CheckCaptureModeInitRestriction( base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); // Warn restriction is enforced: reject since the user canceled. helper_.ChangeConfidentiality(web_contents.get(), kScreenshotWarned); @@ -836,19 +798,13 @@ GetManager()->CheckCaptureModeInitRestriction( base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(false /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); // Check again: since the user previously cancelled, dialog is shown again. GetManager()->CheckCaptureModeInitRestriction( base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(false /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); // Web contents are destroyed: allow, no dialog is shown. helper_.DestroyWebContents(web_contents.get()); @@ -929,18 +885,12 @@ std::unique_ptr<content::WebContents> web_contents = CreateWebContents(); EXPECT_EQ(GetManager()->GetConfidentialRestrictions(web_contents.get()), kEmptyRestrictionSet); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); GetManager()->CheckScreenshotRestriction( area, base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); // Warn restriction is enforced: allow and remember that the user proceeded. helper_.ChangeConfidentiality(web_contents.get(), kScreenshotWarned); @@ -950,20 +900,16 @@ area, base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .Contains(web_contents.get())); + EXPECT_TRUE(helper_.HasContentCachedForRestriction( + web_contents.get(), DlpRulesManager::Restriction::kScreenshot)); // Check again: allow based on cached user's response - no dialog is shown. GetManager()->CheckScreenshotRestriction( area, base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .Contains(web_contents.get())); + EXPECT_TRUE(helper_.HasContentCachedForRestriction( + web_contents.get(), DlpRulesManager::Restriction::kScreenshot)); // Web contents are destroyed: allow, no dialog is shown. helper_.DestroyWebContents(web_contents.get()); @@ -988,18 +934,12 @@ std::unique_ptr<content::WebContents> web_contents = CreateWebContents(); EXPECT_EQ(GetManager()->GetConfidentialRestrictions(web_contents.get()), kEmptyRestrictionSet); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); GetManager()->CheckScreenshotRestriction( area, base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(true /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); // Warn restriction is enforced: reject since the user canceled. helper_.ChangeConfidentiality(web_contents.get(), kScreenshotWarned); @@ -1009,20 +949,14 @@ area, base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(false /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); // Check again: since the user previously cancelled, dialog is shown again. GetManager()->CheckScreenshotRestriction( area, base::BindOnce(on_dlp_restriction_checked_callback, &is_action_allowed_)); VerifyAndResetActionAllowed(false /*expected*/); - EXPECT_TRUE(helper_ - .GetUserAllowedContentsForRestriction( - DlpRulesManager::Restriction::kScreenshot) - .IsEmpty()); + EXPECT_FALSE(helper_.HasAnyContentCached()); // Web contents are destroyed: allow, no dialog is shown. helper_.DestroyWebContents(web_contents.get());
diff --git a/chrome/browser/ash/settings/device_settings_provider.cc b/chrome/browser/ash/settings/device_settings_provider.cc index b7b5167..d17694e5 100644 --- a/chrome/browser/ash/settings/device_settings_provider.cc +++ b/chrome/browser/ash/settings/device_settings_provider.cc
@@ -29,6 +29,7 @@ #include "chrome/browser/ash/policy/off_hours/off_hours_proto_parser.h" #include "chrome/browser/ash/settings/cros_settings.h" #include "chrome/browser/ash/settings/device_settings_cache.h" +#include "chrome/browser/ash/settings/hardware_data_usage_controller.h" #include "chrome/browser/ash/settings/stats_reporting_controller.h" #include "chrome/browser/ash/tpm_firmware_update.h" #include "chromeos/dbus/dbus_thread_manager.h" @@ -1409,18 +1410,21 @@ // TODO(https://crbug.com/433840): Some of the above code can be // simplified or removed, once the DoSet function is removed - then there - // will be no pending writes. This is because the only value that needs to - // be written as a pending write is kStatsReportingPref, and this is now - // handled by the StatsReportingController - see below. Once DoSet is - // removed and there are no pending writes that are being maintained by - // DeviceSettingsProvider, this code for updating the signed settings for - // the new owner should probably be moved outside of - // DeviceSettingsProvider. + // will be no pending writes. This is because the only values that need to + // be written as a pending write is kStatsReportingPref and + // kEnableDeviceHWDataUsage, and those are now handled by the Controllers + // - see below. Once DoSet is removed and there are no pending writes that + // are being maintained by DeviceSettingsProvider, this code for updating + // the signed settings for the new owner should probably be moved outside + // of DeviceSettingsProvider. StatsReportingController::Get()->OnOwnershipTaken( device_settings_service_->GetOwnerSettingsService()); + HWDataUsageController::Get()->OnOwnershipTaken( + device_settings_service_->GetOwnerSettingsService()); } else if (chromeos::InstallAttributes::Get()->IsEnterpriseManaged()) { StatsReportingController::Get()->ClearPendingValue(); + HWDataUsageController::Get()->ClearPendingValue(); } }
diff --git a/chrome/browser/ash/settings/hardware_data_usage_controller.cc b/chrome/browser/ash/settings/hardware_data_usage_controller.cc new file mode 100644 index 0000000..74b09a3 --- /dev/null +++ b/chrome/browser/ash/settings/hardware_data_usage_controller.cc
@@ -0,0 +1,69 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/settings/hardware_data_usage_controller.h" + +#include "ash/components/settings/cros_settings_names.h" +#include "base/bind.h" +#include "chrome/browser/ash/settings/cros_settings.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/pref_service.h" + +namespace { + +constexpr char kPendingPref[] = "pending.cros.reven.enable_hw_data_usage"; + +} // namespace + +namespace ash { + +static HWDataUsageController* g_hw_data_usage_controller = nullptr; + +// static +void HWDataUsageController::Initialize(PrefService* local_state) { + CHECK(!g_hw_data_usage_controller); + g_hw_data_usage_controller = new HWDataUsageController(local_state); +} + +// static +bool HWDataUsageController::IsInitialized() { + return g_hw_data_usage_controller; +} + +// static +void HWDataUsageController::Shutdown() { + DCHECK(g_hw_data_usage_controller); + delete g_hw_data_usage_controller; + g_hw_data_usage_controller = nullptr; +} + +// static +HWDataUsageController* HWDataUsageController::Get() { + CHECK(g_hw_data_usage_controller); + return g_hw_data_usage_controller; +} + +// static +void HWDataUsageController::RegisterLocalStatePrefs( + PrefRegistrySimple* registry) { + registry->RegisterBooleanPref(kPendingPref, false, + PrefRegistry::NO_REGISTRATION_FLAGS); +} + +HWDataUsageController::HWDataUsageController(PrefService* local_state) + : OwnerPendingSettingController(kRevenEnableDeviceHWDataUsage, + kPendingPref, + local_state) { + setting_subscription_ = CrosSettings::Get()->AddSettingsObserver( + kRevenEnableDeviceHWDataUsage, + base::BindRepeating(&HWDataUsageController::NotifyObservers, + this->as_weak_ptr())); +} + +HWDataUsageController::~HWDataUsageController() { + owner_settings_service_observation_.Reset(); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); +} + +} // namespace ash
diff --git a/chrome/browser/ash/settings/hardware_data_usage_controller.h b/chrome/browser/ash/settings/hardware_data_usage_controller.h new file mode 100644 index 0000000..ea48de46 --- /dev/null +++ b/chrome/browser/ash/settings/hardware_data_usage_controller.h
@@ -0,0 +1,43 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_SETTINGS_HARDWARE_DATA_USAGE_CONTROLLER_H_ +#define CHROME_BROWSER_ASH_SETTINGS_HARDWARE_DATA_USAGE_CONTROLLER_H_ + +#include "chrome/browser/ash/settings/owner_pending_setting_controller.h" + +class PrefRegistrySimple; +class PrefService; + +namespace ash { + +// Class to control setting of cros.reven.enable_hw_data_usage device preference +// before ownership is taken. +class HWDataUsageController : public OwnerPendingSettingController { + public: + // Manage singleton instance. + static void Initialize(PrefService* local_state); + static bool IsInitialized(); + static void Shutdown(); + static HWDataUsageController* Get(); + + HWDataUsageController(const HWDataUsageController&) = delete; + HWDataUsageController& operator=(const HWDataUsageController&) = delete; + + static void RegisterLocalStatePrefs(PrefRegistrySimple* registry); + + private: + explicit HWDataUsageController(PrefService* local_state); + ~HWDataUsageController() override; +}; + +} // namespace ash + +// TODO(https://crbug.com/1164001): remove when Chrome OS code migration is +// done. +namespace chromeos { +using ::ash::HWDataUsageController; +} // namespace chromeos + +#endif // CHROME_BROWSER_ASH_SETTINGS_HARDWARE_DATA_USAGE_CONTROLLER_H_
diff --git a/chrome/browser/ash/settings/owner_pending_setting_controller.cc b/chrome/browser/ash/settings/owner_pending_setting_controller.cc new file mode 100644 index 0000000..36ed811 --- /dev/null +++ b/chrome/browser/ash/settings/owner_pending_setting_controller.cc
@@ -0,0 +1,215 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/settings/owner_pending_setting_controller.h" + +#include <string> + +#include "base/bind.h" +#include "base/logging.h" +#include "chrome/browser/ash/ownership/owner_settings_service_ash.h" +#include "chrome/browser/ash/ownership/owner_settings_service_ash_factory.h" +#include "chrome/browser/ash/settings/cros_settings.h" +#include "chrome/browser/ash/settings/device_settings_service.h" +#include "chrome/browser/profiles/profile.h" +#include "components/ownership/owner_settings_service.h" +#include "components/prefs/pref_registry_simple.h" +#include "components/prefs/pref_service.h" + +namespace ash { + +OwnerPendingSettingController::OwnerPendingSettingController( + const std::string& pref_name, + const std::string& pending_pref_name, + PrefService* local_state) + : local_state_(local_state), + pref_name_(pref_name), + pending_pref_name_(pending_pref_name) { + value_notified_to_observers_ = GetValue(); +} + +void OwnerPendingSettingController::Set(Profile* profile, + const base::Value& value) { + DCHECK(profile); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + if (GetOwnershipStatus() == DeviceSettingsService::OWNERSHIP_TAKEN) { + // The device has an owner. If the current profile is that owner, we will + // write the value on their behalf, otherwise no action is taken. + VLOG(1) << "Already has owner"; + SetWithServiceAsync(GetOwnerSettingsService(profile), value); + } else { + // The device has no owner, or we do not know yet whether the device has an + // owner. We write a pending value that will be persisted when ownership is + // taken (if that has not already happened). + // We store the new value in the local state, so that even if Chrome is + // restarted before ownership is taken, we will still persist it eventually. + // See OnOwnershipTaken. + VLOG(1) << "Pending owner; setting pending pref name: " + << pending_pref_name_; + local_state_->Set(pending_pref_name_, value); + NotifyObservers(); + } +} + +absl::optional<base::Value> OwnerPendingSettingController::GetValue() const { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + absl::optional<base::Value> value = GetPendingValue(); + if (ShouldReadFromPendingValue() && value.has_value()) { + // Return the pending value if it exists. + return value; + } + // Otherwise, always return the value from the signed store. + return GetSignedStoredValue(); +} + +base::CallbackListSubscription OwnerPendingSettingController::AddObserver( + const base::RepeatingClosure& callback) { + DCHECK(!callback.is_null()); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + return callback_list_.Add(callback); +} + +void OwnerPendingSettingController::OnOwnershipTaken( + ownership::OwnerSettingsService* service) { + DCHECK_EQ(GetOwnershipStatus(), DeviceSettingsService::OWNERSHIP_TAKEN); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + VLOG(1) << "OnOwnershipTaken"; + + absl::optional<base::Value> pending_value = GetPendingValue(); + if (pending_value.has_value()) { + // At the time ownership is taken, there is a value waiting to be written. + // Use the OwnerSettingsService of the new owner to write the setting. + SetWithServiceAsync(service, pending_value.value()); + } +} + +OwnerPendingSettingController::~OwnerPendingSettingController() { + owner_settings_service_observation_.Reset(); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); +} + +void OwnerPendingSettingController::OnSignedPolicyStored(bool success) { + if (!success) + return; + absl::optional<base::Value> pending_value = GetPendingValue(); + absl::optional<base::Value> signed_value = GetSignedStoredValue(); + if (pending_value.has_value() && signed_value.has_value() && + pending_value == signed_value) { + is_value_being_set_with_service_ = false; + owner_settings_service_observation_.Reset(); + ClearPendingValue(); + NotifyObservers(); + if (on_device_settings_stored_callback_) + std::move(on_device_settings_stored_callback_).Run(); + } +} + +void OwnerPendingSettingController::SetOnDeviceSettingsStoredCallBack( + base::OnceClosure callback) { + CHECK(!on_device_settings_stored_callback_); + on_device_settings_stored_callback_ = std::move(callback); +} + +void OwnerPendingSettingController::SetWithServiceAsync( + ownership::OwnerSettingsService* service, // Can be null for non-owners. + const base::Value& value) { + bool not_yet_ready = service && !service->IsReady(); + if (not_yet_ready) { + VLOG(1) << "Service not yet ready. Adding listener."; + // Service is not yet ready. Listen for changes in its readiness so we can + // write the value once it is ready. Uses weak pointers, so if everything + // is shutdown and deleted in the meantime, this callback isn't run. + service->IsOwnerAsync(base::BindOnce( + &OwnerPendingSettingController::SetWithServiceCallback, + this->as_weak_ptr(), service->as_weak_ptr(), value.Clone())); + } else { + // Service is either null, or ready - use it right now. + SetWithService(service, value); + } +} + +void OwnerPendingSettingController::SetWithServiceCallback( + const base::WeakPtr<ownership::OwnerSettingsService>& service, + const base::Value value, + bool is_owner) { + if (service) // Make sure service wasn't deleted in the meantime. + SetWithService(service.get(), value); +} + +void OwnerPendingSettingController::SetWithService( + ownership::OwnerSettingsService* service, // Can be null for non-owners. + const base::Value& value) { + if (service && service->IsOwner()) { + if (!owner_settings_service_observation_.IsObserving()) + owner_settings_service_observation_.Observe(service); + is_value_being_set_with_service_ = true; + service->Set(pref_name_, value); + local_state_->Set(pending_pref_name_, value); + } else { + // Do nothing since we are not the owner. + LOG(WARNING) << "Changing settings from non-owner, setting=" << pref_name_; + } +} + +void OwnerPendingSettingController::NotifyObservers() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + absl::optional<base::Value> current_value = GetValue(); + if (current_value != value_notified_to_observers_) { + VLOG(1) << "Notifying observers"; + value_notified_to_observers_ = std::move(current_value); + callback_list_.Notify(); + } else { + VLOG(1) << "Not notifying (already notified)"; + } +} + +DeviceSettingsService::OwnershipStatus +OwnerPendingSettingController::GetOwnershipStatus() const { + return DeviceSettingsService::Get()->GetOwnershipStatus(); +} + +ownership::OwnerSettingsService* +OwnerPendingSettingController::GetOwnerSettingsService(Profile* profile) { + return OwnerSettingsServiceAshFactory::GetForBrowserContext(profile); +} + +absl::optional<base::Value> OwnerPendingSettingController::GetPendingValue() + const { + if (local_state_->HasPrefPath(pending_pref_name_)) { + return local_state_->Get(pending_pref_name_)->Clone(); + } + return absl::nullopt; +} + +void OwnerPendingSettingController::ClearPendingValue() { + VLOG(1) << "ClearPendingValue"; + local_state_->ClearPref(pending_pref_name_); +} + +absl::optional<base::Value> +OwnerPendingSettingController::GetSignedStoredValue() const { + const base::Value* value = CrosSettings::Get()->GetPref(pref_name_); + if (value) { + return value->Clone(); + } + return absl::nullopt; +} + +bool OwnerPendingSettingController::ShouldReadFromPendingValue() const { + // Read from pending value before ownership is taken or ownership is + // unknown. There's a brief moment when ownership is unknown for every + // Chrome starts. In that case, we will read from pending value if it exists + // (which means ownership is not taken), and read from service when pending + // value pending is cleared (which means ownership is taken). + if (GetOwnershipStatus() == DeviceSettingsService::OWNERSHIP_NONE || + GetOwnershipStatus() == DeviceSettingsService::OWNERSHIP_UNKNOWN) { + return true; + } + // Read from pending value if ownership is taken but pending value has not + // been set successfully with service. + return is_value_being_set_with_service_; +} + +} // namespace ash
diff --git a/chrome/browser/ash/settings/owner_pending_setting_controller.h b/chrome/browser/ash/settings/owner_pending_setting_controller.h new file mode 100644 index 0000000..7e06c67 --- /dev/null +++ b/chrome/browser/ash/settings/owner_pending_setting_controller.h
@@ -0,0 +1,165 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_SETTINGS_OWNER_PENDING_SETTING_CONTROLLER_H_ +#define CHROME_BROWSER_ASH_SETTINGS_OWNER_PENDING_SETTING_CONTROLLER_H_ + +#include "base/callback_list.h" +#include "base/memory/weak_ptr.h" +#include "base/scoped_observation.h" +#include "base/sequence_checker.h" +#include "base/values.h" +#include "chrome/browser/ash/settings/cros_settings.h" +#include "chrome/browser/ash/settings/device_settings_service.h" +#include "components/ownership/owner_settings_service.h" + +class PrefService; +class Profile; + +namespace ownership { +class OwnerSettingsService; +} + +namespace ash { + +// An extra layer on top of CrosSettings / OwnerSettingsService that allows for +// writing a setting before ownership is taken. +// +// Ordinarily, the OwnerSettingsService interface is used for writing settings, +// and the CrosSettings interface is used for reading them - but as the OSS +// cannot be used until the device has an owner, this class can be used instead, +// since writing the new value with SetEnabled works even before ownership is +// taken. +// +// If OSS is ready then the new value is written straight away, and if not, then +// a pending write is queued that is completed as soon as the OSS is ready. +// This write will complete even if Chrome is restarted in the meantime. +// The caller need not care whether the write was immediate or pending, as long +// as they also use this class to read the value of kStatsReportingPref. +// IsEnabled will return the pending value until ownership is taken and the +// pending value is written - from then on it will return the signed, stored +// value from CrosSettings. +class OwnerPendingSettingController + : public ownership::OwnerSettingsService::Observer { + public: + OwnerPendingSettingController() = delete; + OwnerPendingSettingController(const OwnerPendingSettingController&) = delete; + OwnerPendingSettingController& operator=( + const OwnerPendingSettingController&) = delete; + + // Store the new value. This will happen straight away if |profile| is the + // owner, and it will cause a pending write to be buffered and written later + // if the device has no owner yet. It will write a warning and skip if the + // device already has an owner, and |profile| is not that owner. + void Set(Profile* profile, const base::Value& value); + + // Returns the latest value - regardless of whether this has been successfully + // signed and persisted, or if it is still stored as a pending write. Can + // return absl::nullopt if there is no pending write and no signed value. + absl::optional<base::Value> GetValue() const; + + // Add an observer |callback| for changes to the setting. + base::CallbackListSubscription AddObserver( + const base::RepeatingClosure& callback) WARN_UNUSED_RESULT; + + // Called once ownership is taken, |service| is the service of the user taking + // ownership. + void OnOwnershipTaken(ownership::OwnerSettingsService* service); + + // Sets the callback which is called once when the pending |value| is + // propagated to the device settings. Support only one callback at a time. + // CHECKs if the second callback is being set. + // It's different from the |AddObserver| API. Observers are called + // immediately after |Set| is called with the different |value| setting. + void SetOnDeviceSettingsStoredCallBack(base::OnceClosure callback); + + // ownership::OwnerSettingsService::Observer implementation: + void OnSignedPolicyStored(bool success) override; + + // Clears any value waiting to be written (from storage in local state). + void ClearPendingValue(); + + protected: + OwnerPendingSettingController(const std::string& pref_name, + const std::string& pending_pref_name, + PrefService* local_state); + ~OwnerPendingSettingController() override; + + // Delegates immediately to SetWithService if |service| is ready, otherwise + // runs SetWithService asynchronously once |service| is ready. + void SetWithServiceAsync(ownership::OwnerSettingsService* service, + const base::Value& value); + + // Callback used by SetWithServiceAsync. + void SetWithServiceCallback( + const base::WeakPtr<ownership::OwnerSettingsService>& service, + const base::Value value, + bool is_owner); + + // Uses |service| to write the latest value, as long as |service| belongs + // to the owner - otherwise just prints a warning. + void SetWithService(ownership::OwnerSettingsService* service, + const base::Value& value); + + // Notifies observers if the value has changed. + void NotifyObservers(); + + base::WeakPtr<OwnerPendingSettingController> as_weak_ptr() { + return weak_factory_.GetWeakPtr(); + } + + SEQUENCE_CHECKER(sequence_checker_); + + PrefService* local_state_; + absl::optional<base::Value> value_notified_to_observers_; + base::RepeatingClosureList callback_list_; + base::CallbackListSubscription setting_subscription_; + + base::ScopedObservation<ownership::OwnerSettingsService, + ownership::OwnerSettingsService::Observer> + owner_settings_service_observation_{this}; + + // Indicates if the setting value is in the process of being set with the + // service. There is a small period of time needed between start saving the + // value and before the value is stored correctly in the service. We should + // not use the setting value from the service if it is still in the process + // of being saved. + bool is_value_being_set_with_service_ = false; + + private: + friend class StatsReportingControllerTest; + + // Gets the current ownership status - owned, unowned, or unknown. + DeviceSettingsService::OwnershipStatus GetOwnershipStatus() const; + + // Get the owner-settings service for a particular profile. A variety of + // different results can be returned, depending on the profile. + // a) A ready-to-use service that we know belongs to the owner. + // b) A ready-to-use service that we know does NOT belong to the owner. + // c) A service that is NOT ready-to-use, which MIGHT belong to the owner. + // d) nullptr (for instance, if |profile| is a guest). + ownership::OwnerSettingsService* GetOwnerSettingsService(Profile* profile); + + // Return the value waiting to be written (stored in local_state), if one + // exists. + absl::optional<base::Value> GetPendingValue() const; + + // Return the value signed and stored in CrosSettings, if one exists. + absl::optional<base::Value> GetSignedStoredValue() const; + + // Returns whether pending value should be used when determining the value + // of `GetValue`. + bool ShouldReadFromPendingValue() const; + + base::OnceClosure on_device_settings_stored_callback_; + + const std::string pref_name_; + const std::string pending_pref_name_; + + base::WeakPtrFactory<OwnerPendingSettingController> weak_factory_{this}; +}; + +} // namespace ash + +#endif // CHROME_BROWSER_ASH_SETTINGS_OWNER_PENDING_SETTING_CONTROLLER_H_
diff --git a/chrome/browser/ash/settings/stats_reporting_controller.cc b/chrome/browser/ash/settings/stats_reporting_controller.cc index 11ea28d05..652327565 100644 --- a/chrome/browser/ash/settings/stats_reporting_controller.cc +++ b/chrome/browser/ash/settings/stats_reporting_controller.cc
@@ -4,19 +4,12 @@ #include "chrome/browser/ash/settings/stats_reporting_controller.h" -#include <string> - #include "ash/components/settings/cros_settings_names.h" #include "base/bind.h" #include "base/logging.h" -#include "chrome/browser/ash/ownership/owner_settings_service_ash.h" -#include "chrome/browser/ash/ownership/owner_settings_service_ash_factory.h" #include "chrome/browser/ash/settings/cros_settings.h" -#include "chrome/browser/ash/settings/device_settings_service.h" -#include "chrome/browser/profiles/profile.h" #include "components/metrics/structured/neutrino_logging.h" #include "components/metrics/structured/neutrino_logging_util.h" -#include "components/ownership/owner_settings_service.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" @@ -62,92 +55,31 @@ } void StatsReportingController::SetEnabled(Profile* profile, bool enabled) { - DCHECK(profile); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - VLOG(1) << "SetEnabled(" << std::boolalpha << enabled << ")"; - - if (GetOwnershipStatus() == DeviceSettingsService::OWNERSHIP_TAKEN) { - // The device has an owner. If the current profile is that owner, we will - // write the value on their behalf, otherwise no action is taken. - VLOG(1) << "Already has owner"; - SetWithServiceAsync(GetOwnerSettingsService(profile), enabled); - } else { - // The device has no owner, or we do not know yet whether the device has an - // owner. We write a pending value that will be persisted when ownership is - // taken (if that has not already happened). - // We store the new value in the local state, so that even if Chrome is - // restarted before ownership is taken, we will still persist it eventually. - // See OnOwnershipTaken. - VLOG(1) << "Pending owner; setting kPendingPref"; - local_state_->SetBoolean(kPendingPref, enabled); - NotifyObservers(); - } + Set(profile, base::Value(enabled)); } -bool StatsReportingController::IsEnabled() { +bool StatsReportingController::IsEnabled() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - bool value = false; metrics::structured::NeutrinoDevicesLogWithLocalState( local_state_, metrics::structured::NeutrinoDevicesLocation::kIsEnabled); - if (ShouldReadFromPendingValue() && GetPendingValue(&value)) { - // Return the pending value if it exists. - return value; - } - // Otherwise, always return the value from the signed store. - GetSignedStoredValue(&value); - return value; -} - -base::CallbackListSubscription StatsReportingController::AddObserver( - const base::RepeatingClosure& callback) { - DCHECK(!callback.is_null()); - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return callback_list_.Add(callback); -} - -void StatsReportingController::OnOwnershipTaken( - ownership::OwnerSettingsService* service) { - DCHECK_EQ(GetOwnershipStatus(), DeviceSettingsService::OWNERSHIP_TAKEN); - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - VLOG(1) << "OnOwnershipTaken"; - - bool pending_value; - if (GetPendingValue(&pending_value)) { - // At the time ownership is taken, there is a value waiting to be written. - // Use the OwnerSettingsService of the new owner to write the setting. - SetWithServiceAsync(service, pending_value); - } -} - -void StatsReportingController::OnSignedPolicyStored(bool success) { - if (!success) - return; - bool pending_value; - bool signed_value; - if (GetPendingValue(&pending_value) && GetSignedStoredValue(&signed_value) && - pending_value == signed_value) { - is_value_being_set_with_service_ = false; - owner_settings_service_observation_.Reset(); - ClearPendingValue(); - NotifyObservers(); - if (on_device_settings_stored_callback_) - std::move(on_device_settings_stored_callback_).Run(); - } -} - -void StatsReportingController::SetOnDeviceSettingsStoredCallBack( - base::OnceClosure callback) { - CHECK(!on_device_settings_stored_callback_); - on_device_settings_stored_callback_ = std::move(callback); + absl::optional<base::Value> value = GetValue(); + return value.has_value() && value->is_bool() && value->GetBool(); } StatsReportingController::StatsReportingController(PrefService* local_state) - : local_state_(local_state) { + : OwnerPendingSettingController(kStatsReportingPref, + kPendingPref, + local_state) { setting_subscription_ = CrosSettings::Get()->AddSettingsObserver( kStatsReportingPref, base::BindRepeating(&StatsReportingController::NotifyObservers, this->as_weak_ptr())); - value_notified_to_observers_ = IsEnabled(); + // AddObserver to log NeutrinoDevicesLogWithLocalState every time when + // observers are notified. + neutrino_logging_subscription_ = AddObserver(base::BindRepeating( + &metrics::structured::NeutrinoDevicesLogWithLocalState, local_state_, + metrics::structured::NeutrinoDevicesLocation::kNotifyObservers)); } StatsReportingController::~StatsReportingController() { @@ -155,107 +87,4 @@ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } -void StatsReportingController::SetWithServiceAsync( - ownership::OwnerSettingsService* service, // Can be null for non-owners. - bool enabled) { - VLOG(1) << "SetWithServiceAsync(" << std::boolalpha << enabled << ")"; - bool not_yet_ready = service && !service->IsReady(); - if (not_yet_ready) { - VLOG(1) << "Service not yet ready. Adding listener."; - // Service is not yet ready. Listen for changes in its readiness so we can - // write the value once it is ready. Uses weak pointers, so if everything - // is shutdown and deleted in the meantime, this callback isn't run. - service->IsOwnerAsync( - base::BindOnce(&StatsReportingController::SetWithServiceCallback, - this->as_weak_ptr(), service->as_weak_ptr(), enabled)); - } else { - // Service is either null, or ready - use it right now. - SetWithService(service, enabled); - } -} - -void StatsReportingController::SetWithServiceCallback( - const base::WeakPtr<ownership::OwnerSettingsService>& service, - bool enabled, - bool is_owner) { - VLOG(1) << "SetWithServiceCallback(" << std::boolalpha << enabled << ")"; - if (service) // Make sure service wasn't deleted in the meantime. - SetWithService(service.get(), enabled); -} - -void StatsReportingController::SetWithService( - ownership::OwnerSettingsService* service, // Can be null for non-owners. - bool enabled) { - VLOG(1) << "SetWithService(" << std::boolalpha << enabled << ")"; - if (service && service->IsOwner()) { - if (!owner_settings_service_observation_.IsObserving()) - owner_settings_service_observation_.Observe(service); - is_value_being_set_with_service_ = true; - service->SetBoolean(kStatsReportingPref, enabled); - local_state_->SetBoolean(kPendingPref, enabled); - } else { - // Do nothing since we are not the owner. - LOG(WARNING) << "Changing settings from non-owner, setting=" - << kStatsReportingPref; - } -} - -void StatsReportingController::NotifyObservers() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - bool current_value = IsEnabled(); - VLOG(1) << "Maybe notifying observers of " << std::boolalpha << current_value; - if (current_value != value_notified_to_observers_) { - VLOG(1) << "Notifying observers"; - value_notified_to_observers_ = current_value; - metrics::structured::NeutrinoDevicesLogWithLocalState( - local_state_, - metrics::structured::NeutrinoDevicesLocation::kNotifyObservers); - callback_list_.Notify(); - } else { - VLOG(1) << "Not notifying (already notified)"; - } -} - -DeviceSettingsService::OwnershipStatus -StatsReportingController::GetOwnershipStatus() const { - return DeviceSettingsService::Get()->GetOwnershipStatus(); -} - -ownership::OwnerSettingsService* -StatsReportingController::GetOwnerSettingsService(Profile* profile) { - return OwnerSettingsServiceAshFactory::GetForBrowserContext(profile); -} - -bool StatsReportingController::GetPendingValue(bool* result) { - if (local_state_->HasPrefPath(kPendingPref)) { - *result = local_state_->GetBoolean(kPendingPref); - return true; - } - return false; -} - -void StatsReportingController::ClearPendingValue() { - VLOG(1) << "ClearPendingValue"; - local_state_->ClearPref(kPendingPref); -} - -bool StatsReportingController::GetSignedStoredValue(bool* result) { - return CrosSettings::Get()->GetBoolean(kStatsReportingPref, result); -} - -bool StatsReportingController::ShouldReadFromPendingValue() const { - // Read from pending value before ownership is taken or ownership is - // unknown. There's a brief moment when ownership is unknown for every - // Chrome starts. In that case, we will read from pending value if it exists - // (which means ownership is not taken), and read from service when pending - // value pending is cleared (which means ownership is taken). - if (GetOwnershipStatus() == DeviceSettingsService::OWNERSHIP_NONE || - GetOwnershipStatus() == DeviceSettingsService::OWNERSHIP_UNKNOWN) { - return true; - } - // Read from pending value if ownership is taken but pending value has not - // been set successfully with service. - return is_value_being_set_with_service_; -} - } // namespace ash
diff --git a/chrome/browser/ash/settings/stats_reporting_controller.h b/chrome/browser/ash/settings/stats_reporting_controller.h index 9a29d47..e2f8f22 100644 --- a/chrome/browser/ash/settings/stats_reporting_controller.h +++ b/chrome/browser/ash/settings/stats_reporting_controller.h
@@ -5,44 +5,18 @@ #ifndef CHROME_BROWSER_ASH_SETTINGS_STATS_REPORTING_CONTROLLER_H_ #define CHROME_BROWSER_ASH_SETTINGS_STATS_REPORTING_CONTROLLER_H_ -#include "base/callback_list.h" +#include "chrome/browser/ash/settings/owner_pending_setting_controller.h" + #include "base/memory/weak_ptr.h" -#include "base/scoped_observation.h" -#include "base/sequence_checker.h" -#include "chrome/browser/ash/settings/cros_settings.h" -#include "chrome/browser/ash/settings/device_settings_service.h" -#include "components/ownership/owner_settings_service.h" class PrefRegistrySimple; class PrefService; -class Profile; - -namespace ownership { -class OwnerSettingsService; -} namespace ash { -// An extra layer on top of CrosSettings / OwnerSettingsService that allows for -// writing a setting before ownership is taken, for one setting only: -// kStatsReportingPref, which has the key: "cros.metrics.reportingEnabled". -// -// Ordinarily, the OwnerSettingsService interface is used for writing settings, -// and the CrosSettings interface is used for reading them - but as the OSS -// cannot be used until the device has an owner, this class can be used instead, -// since writing the new value with SetEnabled works even before ownership is -// taken. -// -// If OSS is ready then the new value is written straight away, and if not, then -// a pending write is queued that is completed as soon as the OSS is ready. -// This write will complete even if Chrome is restarted in the meantime. -// The caller need not care whether the write was immediate or pending, as long -// as they also use this class to read the value of kStatsReportingPref. -// IsEnabled will return the pending value until ownership is taken and the -// pending value is written - from then on it will return the signed, stored -// value from CrosSettings. -class StatsReportingController - : public ownership::OwnerSettingsService::Observer { +// Class to control setting of cros.metrics.reportingEnabled device preference +// before ownership is taken. +class StatsReportingController : public OwnerPendingSettingController { public: // Manage singleton instance. static void Initialize(PrefService* local_state); @@ -55,109 +29,18 @@ static void RegisterLocalStatePrefs(PrefRegistrySimple* registry); - // Store the new value of |enabled|. This will happen straight away if - // |profile| is the owner, and it will cause a pending write to be buffered - // and written later if the device has no owner yet. It will fail if the - // device already has an owner, and |profile| is not that owner. void SetEnabled(Profile* profile, bool enabled); - - // Returns the latest value of enabled - regardless of whether this has been - // successfully signed and persisted, or if it is still stored as a pending - // write. - bool IsEnabled(); - - // Add an observer |callback| for changes to the setting. - base::CallbackListSubscription AddObserver( - const base::RepeatingClosure& callback) WARN_UNUSED_RESULT; - - // Called once ownership is taken, |service| is the service of the user taking - // ownership. - void OnOwnershipTaken(ownership::OwnerSettingsService* service); - - // ownership::OwnerSettingsService::Observer implementation: - void OnSignedPolicyStored(bool success) override; - - // Sets the callback which is called once when the |enabled| value is - // propagated to the device settings. Support only one callback at a time. - // CHECKs if the second callback is being set. - // It's different from the |AddObserver| API. Observers are called - // immediately after |SetEnabled| is called with the different |enabled| - // setting. - void SetOnDeviceSettingsStoredCallBack(base::OnceClosure callback); - - // Clears any value waiting to be written (from storage in local state). - void ClearPendingValue(); + bool IsEnabled() const; private: - friend class StatsReportingControllerTest; - explicit StatsReportingController(PrefService* local_state); ~StatsReportingController() override; - // Delegates immediately to SetWithService if |service| is ready, otherwise - // runs SetWithService asynchronously once |service| is ready. - void SetWithServiceAsync(ownership::OwnerSettingsService* service, - bool enabled); - - // Callback used by SetWithServiceAsync. - void SetWithServiceCallback( - const base::WeakPtr<ownership::OwnerSettingsService>& service, - bool enabled, - bool is_owner); - - // Uses |service| to write the latest value, as long as |service| belongs - // to the owner - otherwise just prints a warning. - void SetWithService(ownership::OwnerSettingsService* service, bool enabled); - - // Notifies observers if the value has changed. - void NotifyObservers(); - - // Gets the current ownership status - owned, unowned, or unknown. - DeviceSettingsService::OwnershipStatus GetOwnershipStatus() const; - - // Get the owner-settings service for a particular profile. A variety of - // different results can be returned, depending on the profile. - // a) A ready-to-use service that we know belongs to the owner. - // b) A ready-to-use service that we know does NOT belong to the owner. - // c) A service that is NOT ready-to-use, which MIGHT belong to the owner. - // d) nullptr (for instance, if |profile| is a guest). - ownership::OwnerSettingsService* GetOwnerSettingsService(Profile* profile); - - // Sets |*value| to the value waiting to be written (stored in local_state), - // if one exists. Returns false if there is no such value. - bool GetPendingValue(bool* value); - - // Sets |*value| to the value signed and stored in CrosSettings, if one - // exists. Returns false if there is no such value. - bool GetSignedStoredValue(bool* value); - - // Returns whether pending value should be used when determining the value - // of `IsEnabled`. - bool ShouldReadFromPendingValue() const; - base::WeakPtr<StatsReportingController> as_weak_ptr() { return weak_factory_.GetWeakPtr(); } - SEQUENCE_CHECKER(sequence_checker_); - - PrefService* local_state_; - bool value_notified_to_observers_; - base::RepeatingClosureList callback_list_; - base::CallbackListSubscription setting_subscription_; - - // Indicates if the setting value is in the process of being set with the - // service. There is a small period of time needed between start saving the - // value and before the value is stored correctly in the service. We should - // not use the setting value from the service if it is still in the process - // of being saved. - bool is_value_being_set_with_service_ = false; - - base::ScopedObservation<ownership::OwnerSettingsService, - ownership::OwnerSettingsService::Observer> - owner_settings_service_observation_{this}; - - base::OnceClosure on_device_settings_stored_callback_; + base::CallbackListSubscription neutrino_logging_subscription_; base::WeakPtrFactory<StatsReportingController> weak_factory_{this}; };
diff --git a/chrome/browser/ash/settings/stats_reporting_controller_unittest.cc b/chrome/browser/ash/settings/stats_reporting_controller_unittest.cc index c9283c14..0e17a28 100644 --- a/chrome/browser/ash/settings/stats_reporting_controller_unittest.cc +++ b/chrome/browser/ash/settings/stats_reporting_controller_unittest.cc
@@ -67,20 +67,25 @@ } void ExpectThatPendingValueIs(bool expected) { - bool pending = false; - EXPECT_TRUE(StatsReportingController::Get()->GetPendingValue(&pending)); - EXPECT_EQ(expected, pending); + absl::optional<base::Value> pending = + StatsReportingController::Get()->GetPendingValue(); + EXPECT_TRUE(pending.has_value()); + EXPECT_TRUE(pending->is_bool()); + EXPECT_EQ(expected, pending->GetBool()); } void ExpectThatPendingValueIsNotSet() { - bool pending = false; - EXPECT_FALSE(StatsReportingController::Get()->GetPendingValue(&pending)); + absl::optional<base::Value> pending = + StatsReportingController::Get()->GetPendingValue(); + EXPECT_FALSE(pending.has_value()); } void ExpectThatSignedStoredValueIs(bool expected) { - bool stored = false; - EXPECT_TRUE(StatsReportingController::Get()->GetSignedStoredValue(&stored)); - EXPECT_EQ(expected, stored); + absl::optional<base::Value> stored = + StatsReportingController::Get()->GetSignedStoredValue(); + EXPECT_TRUE(stored.has_value()); + EXPECT_TRUE(stored->is_bool()); + EXPECT_EQ(expected, stored->GetBool()); } void OnNotifiedOfChange() {
diff --git a/chrome/browser/ash/tether/DIR_METADATA b/chrome/browser/ash/tether/DIR_METADATA index c34c17f..4cad27d 100644 --- a/chrome/browser/ash/tether/DIR_METADATA +++ b/chrome/browser/ash/tether/DIR_METADATA
@@ -1 +1 @@ -mixins: "//chromeos/components/tether/COMMON_METADATA" +mixins: "//ash/components/tether/COMMON_METADATA"
diff --git a/chrome/browser/ash/tether/OWNERS b/chrome/browser/ash/tether/OWNERS index 0f8ce8f..6473a0b4 100644 --- a/chrome/browser/ash/tether/OWNERS +++ b/chrome/browser/ash/tether/OWNERS
@@ -1 +1 @@ -file://chromeos/components/tether/OWNERS +file://ash/components/tether/OWNERS
diff --git a/chrome/browser/ash/tether/tether_service.cc b/chrome/browser/ash/tether/tether_service.cc index 66f012c4..1425fe0 100644 --- a/chrome/browser/ash/tether/tether_service.cc +++ b/chrome/browser/ash/tether/tether_service.cc
@@ -4,6 +4,10 @@ #include "chrome/browser/ash/tether/tether_service.h" +#include "ash/components/tether/gms_core_notifications_state_tracker_impl.h" +#include "ash/components/tether/tether_component.h" +#include "ash/components/tether/tether_component_impl.h" +#include "ash/components/tether/tether_host_fetcher_impl.h" #include "base/bind.h" #include "base/command_line.h" #include "base/metrics/histogram_macros.h" @@ -14,10 +18,6 @@ #include "chrome/browser/ui/ash/network/tether_notification_presenter.h" #include "chrome/common/pref_names.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/components/tether/gms_core_notifications_state_tracker_impl.h" -#include "chromeos/components/tether/tether_component.h" -#include "chromeos/components/tether/tether_component_impl.h" -#include "chromeos/components/tether/tether_host_fetcher_impl.h" #include "chromeos/network/device_state.h" #include "chromeos/network/network_connect.h" #include "chromeos/network/network_type_pattern.h"
diff --git a/chrome/browser/ash/tether/tether_service.h b/chrome/browser/ash/tether/tether_service.h index 4f58278d..8127831 100644 --- a/chrome/browser/ash/tether/tether_service.h +++ b/chrome/browser/ash/tether/tether_service.h
@@ -7,11 +7,11 @@ #include <memory> +#include "ash/components/tether/tether_component.h" +#include "ash/components/tether/tether_host_fetcher.h" #include "base/gtest_prod_util.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "chromeos/components/tether/tether_component.h" -#include "chromeos/components/tether/tether_host_fetcher.h" #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/network/network_state_handler.h" #include "chromeos/network/network_state_handler_observer.h"
diff --git a/chrome/browser/ash/tether/tether_service_unittest.cc b/chrome/browser/ash/tether/tether_service_unittest.cc index d455be91..2a14904 100644 --- a/chrome/browser/ash/tether/tether_service_unittest.cc +++ b/chrome/browser/ash/tether/tether_service_unittest.cc
@@ -6,6 +6,11 @@ #include <memory> +#include "ash/components/tether/fake_notification_presenter.h" +#include "ash/components/tether/fake_tether_component.h" +#include "ash/components/tether/fake_tether_host_fetcher.h" +#include "ash/components/tether/tether_component_impl.h" +#include "ash/components/tether/tether_host_fetcher_impl.h" #include "ash/constants/ash_features.h" #include "base/bind.h" #include "base/command_line.h" @@ -23,11 +28,6 @@ #include "chrome/test/base/testing_profile.h" #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/components/multidevice/software_feature.h" -#include "chromeos/components/tether/fake_notification_presenter.h" -#include "chromeos/components/tether/fake_tether_component.h" -#include "chromeos/components/tether/fake_tether_host_fetcher.h" -#include "chromeos/components/tether/tether_component_impl.h" -#include "chromeos/components/tether/tether_host_fetcher_impl.h" #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/dbus/power_manager/suspend.pb.h"
diff --git a/chrome/browser/background_fetch/background_fetch_browsertest.cc b/chrome/browser/background_fetch/background_fetch_browsertest.cc index c7d039679..1d02340a 100644 --- a/chrome/browser/background_fetch/background_fetch_browsertest.cc +++ b/chrome/browser/background_fetch/background_fetch_browsertest.cc
@@ -993,9 +993,10 @@ content::test::FencedFrameTestHelper fenced_frame_test_helper_; }; -// Tests that UKM records that the background fetch is denied in a fenced frame. +// Tests that background fetch UKM is not recorded in a fenced frame. The +// renderer should have checked and disallowed the request for fenced frames. IN_PROC_BROWSER_TEST_F(BackgroundFetchFencedFrameBrowserTest, - RecordBackgroundFetchUkmEvent) { + NoRecordBackgroundFetchUkmEvent) { // Load a fenced frame. GURL fenced_frame_url(https_server()->GetURL("/fenced_frames/title1.html")); content::RenderFrameHost* fenced_frame = @@ -1014,27 +1015,21 @@ RegisterServiceWorker(fenced_frame); constexpr char kExpectedError[] = - "TypeError - This origin does not have permission to start a fetch."; + "NotAllowedError - Failed to execute 'fetch' on " + "'BackgroundFetchManager': backgroundFetch is not allowed in a fenced " + "frame tree."; StartSingleFileDownload(fenced_frame, kExpectedError); std::vector<const ukm::mojom::UkmEntry*> entries = test_ukm_recorder_->GetEntriesByName( ukm::builders::BackgroundFetch::kEntryName); - ASSERT_EQ(1u, entries.size()); - const auto* entry = entries[0]; - test_ukm_recorder_->ExpectEntryMetric( - entry, ukm::builders::BackgroundFetch::kHasTitleName, 1); - test_ukm_recorder_->ExpectEntryMetric( - entry, ukm::builders::BackgroundFetch::kNumRequestsInFetchName, - ukm::GetExponentialBucketMin(kNumRequestsInFetch, - kUkmEventDataBucketSpacing)); - // In a fenced frame, it should be denied. - test_ukm_recorder_->ExpectEntryMetric( - entry, ukm::builders::BackgroundFetch::kDeniedDueToPermissionsName, 1); + ASSERT_EQ(0u, entries.size()); } -// Tests that UKM record works based on the outer most main frame. So, the -// fenced frame loaded not from the same origin is not be recorded. +// Tests that UKM record works based on the outer most main frame. This test is +// to check non-same origin case, but actually the background fetch UKM is not +// recorded in a fenced frame regardless of origin difference because the +// renderer should have checked and disallowed the request for fenced frames. IN_PROC_BROWSER_TEST_F(BackgroundFetchFencedFrameBrowserTest, NoRecordBackgroundFetchUkmEventNotInSameOrigin) { net::EmbeddedTestServer cross_origin_server( @@ -1061,7 +1056,9 @@ RegisterServiceWorker(fenced_frame); constexpr char kExpectedError[] = - "TypeError - This origin does not have permission to start a fetch."; + "NotAllowedError - Failed to execute 'fetch' on " + "'BackgroundFetchManager': backgroundFetch is not allowed in a fenced " + "frame tree."; StartSingleFileDownload(fenced_frame, kExpectedError); std::vector<const ukm::mojom::UkmEntry*> entries =
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 9a2def9..98556e45 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -215,6 +215,7 @@ #include "ash/components/settings/cros_settings_names.h" #include "ash/constants/ash_switches.h" #include "chrome/browser/ash/settings/cros_settings.h" +#include "chrome/browser/ash/settings/hardware_data_usage_controller.h" #include "chrome/browser/ash/settings/stats_reporting_controller.h" #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -904,6 +905,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) ash::CrosSettings::Initialize(local_state); + ash::HWDataUsageController::Initialize(local_state); ash::StatsReportingController::Initialize(local_state); arc::StabilityMetricsManager::Initialize(local_state); #endif // BUILDFLAG(IS_CHROMEOS_ASH) @@ -1886,6 +1888,7 @@ device_event_log::Shutdown(); #if BUILDFLAG(IS_CHROMEOS_ASH) + ash::HWDataUsageController::Shutdown(); arc::StabilityMetricsManager::Shutdown(); ash::StatsReportingController::Shutdown(); ash::CrosSettings::Shutdown();
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index ade2411..afe26b1 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -366,6 +366,7 @@ #include "chrome/browser/speech/tts_chromeos.h" #include "chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.h" #include "chrome/browser/ui/browser_dialogs.h" +#include "chrome/common/chromeos/extensions/chromeos_system_extension_info.h" #include "components/crash/core/app/breakpad_linux.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" @@ -2396,6 +2397,8 @@ autofill::switches::kShowAutofillSignatures, #if BUILDFLAG(IS_CHROMEOS_ASH) switches::kShortMergeSessionTimeoutForTest, // For tests only. + chromeos::switches:: + kTelemetryExtensionPwaOriginOverrideForTesting, // For tests only. #endif #if BUILDFLAG(ENABLE_EXTENSIONS) extensions::switches::kAllowHTTPBackgroundPage,
diff --git a/chrome/browser/chrome_navigation_browsertest.cc b/chrome/browser/chrome_navigation_browsertest.cc index d09a7fd8..1c7bdbc 100644 --- a/chrome/browser/chrome_navigation_browsertest.cc +++ b/chrome/browser/chrome_navigation_browsertest.cc
@@ -983,12 +983,14 @@ content::RenderFrameHost* opener = browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); - // 1. Create a new blank window that won't create a NavigationEntry. + // 1. Create a new blank window that stays on the initial NavigationEntry. content::WebContents* popup = nullptr; { content::WebContentsAddedObserver popup_observer; ASSERT_TRUE(content::ExecJs( - opener, content::JsReplace("window.open($1, 'my-popup')", GURL()))); + opener, + content::JsReplace("window.open($1, 'my-popup')", + embedded_test_server()->GetURL("/nocontent")))); popup = popup_observer.GetWebContents(); } content::RenderFrameHost* popup_main_rfh = popup->GetMainFrame(); @@ -1005,9 +1007,7 @@ const GURL kSameDocUrl("about:blank#foo"); content::TestNavigationManager navigation_manager(popup, kSameDocUrl); EXPECT_TRUE(content::ExecJs( - popup_main_rfh, - content::JsReplace("document.querySelector('iframe').src = $1", - kSameDocUrl))); + popup_main_rfh, "document.querySelector('iframe').src = '#foo';")); navigation_manager.WaitForNavigationFinished(); } @@ -1033,7 +1033,8 @@ content::WebContentsAddedObserver popup_observer; ASSERT_TRUE(content::ExecJs( opener, - content::JsReplace("var w = window.open($1, 'my-popup')", GURL()))); + content::JsReplace("var w = window.open($1, 'my-popup')", + embedded_test_server()->GetURL("/nocontent")))); popup = popup_observer.GetWebContents(); } // Popup should be on the initial navigation entry. @@ -1043,8 +1044,8 @@ { const GURL kSameDocUrl("about:blank#foo"); content::TestNavigationManager navigation_manager(popup, kSameDocUrl); - EXPECT_TRUE( - content::ExecJs(opener, "w.history.replaceState({}, '', '#foo');")); + EXPECT_TRUE(content::ExecJs( + opener, content::JsReplace("w.location.href = $1", kSameDocUrl))); navigation_manager.WaitForNavigationFinished(); } // Popup should no longer be on the initial navigation entry.
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index b56b008..560b0bc 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -104,6 +104,7 @@ "//ash/components/settings", "//ash/components/smbfs", "//ash/components/smbfs/mojom", + "//ash/components/tether", "//ash/components/timezone", "//ash/constants", "//ash/keyboard/ui", @@ -216,7 +217,6 @@ "//chromeos/components/sensors/mojom", "//chromeos/components/string_matching", "//chromeos/components/sync_wifi", - "//chromeos/components/tether", "//chromeos/crosapi/cpp", "//chromeos/crosapi/mojom", "//chromeos/cryptohome", @@ -2966,6 +2966,10 @@ "../ash/settings/device_settings_provider.h", "../ash/settings/device_settings_service.cc", "../ash/settings/device_settings_service.h", + "../ash/settings/hardware_data_usage_controller.cc", + "../ash/settings/hardware_data_usage_controller.h", + "../ash/settings/owner_pending_setting_controller.cc", + "../ash/settings/owner_pending_setting_controller.h", "../ash/settings/session_manager_operation.cc", "../ash/settings/session_manager_operation.h", "../ash/settings/shutdown_policy_forwarder.cc", @@ -4695,6 +4699,7 @@ "//ash/components/proximity_auth", "//ash/components/proximity_auth:test_support", "//ash/components/settings", + "//ash/components/tether:test_support", "//ash/constants", "//ash/public/cpp", "//ash/public/cpp:test_support", @@ -4717,7 +4722,6 @@ "//chromeos", "//chromeos/components/multidevice:test_support", "//chromeos/components/sensors:test_support", - "//chromeos/components/tether:test_support", "//chromeos/dbus:test_support", "//chromeos/dbus/anomaly_detector", "//chromeos/dbus/attestation",
diff --git a/chrome/browser/chromeos/extensions/login_screen/login_state/login_state_api_unittest.cc b/chrome/browser/chromeos/extensions/login_screen/login_state/login_state_api_unittest.cc index 0b5e621..2479068 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login_state/login_state_api_unittest.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login_state/login_state_api_unittest.cc
@@ -7,6 +7,7 @@ #include <memory> #include "base/memory/scoped_refptr.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/extensions/extension_api_unittest.h" #include "extensions/common/extension.h" #include "extensions/common/extension_builder.h"
diff --git a/chrome/browser/chromeos/extensions/login_screen/login_state/session_state_changed_event_dispatcher.cc b/chrome/browser/chromeos/extensions/login_screen/login_state/session_state_changed_event_dispatcher.cc index f3c42b42..9187ef4 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login_state/session_state_changed_event_dispatcher.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login_state/session_state_changed_event_dispatcher.cc
@@ -5,6 +5,7 @@ #include "chrome/browser/chromeos/extensions/login_screen/login_state/session_state_changed_event_dispatcher.h" #include "base/no_destructor.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/chromeos/extensions/login_screen/login_state/login_state_api.h" #include "chrome/common/extensions/api/login_state.h" #include "chromeos/crosapi/mojom/login_state.mojom.h"
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_extension_capabilities_browser_test.cc b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_extension_capabilities_browser_test.cc index 5507455..dc7fb2a 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_extension_capabilities_browser_test.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_extension_capabilities_browser_test.cc
@@ -3,10 +3,12 @@ // found in the LICENSE file. #include "base/callback_helpers.h" +#include "base/command_line.h" #include "base/files/file_path.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_browser_test.h" +#include "chrome/common/chromeos/extensions/chromeos_system_extension_info.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/render_frame_host.h" #include "content/public/test/browser_test.h" @@ -116,6 +118,58 @@ EXPECT_EQ("done", listener.message()); } +// Tests that the extension's PWA origin is overridden in tests using the +// command line switch |kTelemetryExtensionPwaOriginOverrideForTesting|. The +// test also makes sure the command line switch is copied across processes. +IN_PROC_BROWSER_TEST_P(TelemetryExtensionBrowserTest, + CanOverridePwaOriginForTesting) { + constexpr char kPwaOriginOverride[] = "*://pwa.website.com/*"; + + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( + chromeos::switches::kTelemetryExtensionPwaOriginOverrideForTesting, + kPwaOriginOverride); + + // Make sure the PWA origin is overridden. + const auto extension_info = + GetChromeOSExtensionInfoForId(extension_info_params().extension_id); + EXPECT_EQ(kPwaOriginOverride, extension_info.pwa_origin); + + // Open the PWA page url to bypass IsPwaUiOpen() check. + ASSERT_TRUE( + ui_test_utils::NavigateToURL(browser(), GURL("http://pwa.website.com"))); + + // Start listening on the extension. + ExtensionTestMessageListener listener(/*will_reply=*/false); + + // Must outlive the extension. + extensions::TestExtensionDir test_dir_receiver; + test_dir_receiver.WriteManifest( + GetManifestFile(extension_info_params().public_key, kPwaOriginOverride)); + test_dir_receiver.WriteFile(FILE_PATH_LITERAL("options.html"), ""); + test_dir_receiver.WriteFile("sw.js", R"( + chrome.test.runTests([ + // Choose a candidate API function that doesn't require any setup. + async function runBatteryHealthRoutine() { + const response = + await chrome.os.diagnostics.runBatteryHealthRoutine(); + chrome.test.assertEq({id: 0, status: "ready"}, response); + chrome.test.sendMessage('ready'); + } + ]); + )"); + + // Load and run the extenion (chromeos_system_extension). If the extension has + // been installed and run, then the command line switch must have been copied + // across processes. + const extensions::Extension* receiver = + LoadExtension(test_dir_receiver.UnpackedPath()); + ASSERT_TRUE(receiver); + + // Make sure the sw.js was being run. + ASSERT_TRUE(listener.WaitUntilSatisfied()); + EXPECT_EQ("ready", listener.message()); +} + INSTANTIATE_TEST_SUITE_P( All, TelemetryExtensionBrowserTest,
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_impl.cc b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_impl.cc index 0f111f4..ce2151b 100644 --- a/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_impl.cc +++ b/chrome/browser/chromeos/policy/dlp/dlp_rules_manager_impl.cc
@@ -15,6 +15,7 @@ #include "base/containers/fixed_flat_map.h" #include "base/feature_list.h" #include "base/values.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/policy/dlp/data_transfer_dlp_controller.h" #include "chrome/browser/chromeos/policy/dlp/dlp_histogram_helper.h"
diff --git a/chrome/browser/devtools/devtools_browsertest.cc b/chrome/browser/devtools/devtools_browsertest.cc index 0335fcf..fcf104d 100644 --- a/chrome/browser/devtools/devtools_browsertest.cc +++ b/chrome/browser/devtools/devtools_browsertest.cc
@@ -2884,6 +2884,19 @@ "unsynced value"); } +IN_PROC_BROWSER_TEST_F(DevToolsTest, NoJavascriptUrlOnDevtools) { + // As per crbug/1115460 one could use javascript: url as a homepage URL and then trigger homepage + // navigation (e.g. via keyboard shortcut) to execute in the context of the privileged devtools + // frontend. + OpenDevToolsWindow("about:blank", true); + + WebContents* wc = DevToolsWindowTesting::Get(window_)->main_web_contents(); + wc->GetController().LoadURL(GURL("javascript:window.xss=true"), + content::Referrer(), ui::PAGE_TRANSITION_TYPED, + std::string()); + EXPECT_EQ(false, content::EvalJs(wc, "!!window.xss")); +} + class DevToolsSyncTest : public SyncTest { public: DevToolsSyncTest() : SyncTest(SyncTest::SINGLE_CLIENT) {}
diff --git a/chrome/browser/download/notification/download_item_notification.cc b/chrome/browser/download/notification/download_item_notification.cc index bc3fbd2..a120112 100644 --- a/chrome/browser/download/notification/download_item_notification.cc +++ b/chrome/browser/download/notification/download_item_notification.cc
@@ -9,13 +9,6 @@ #include <memory> -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "ash/constants/ash_features.h" -#include "chrome/browser/ash/note_taking_helper.h" -#elif BUILDFLAG(IS_CHROMEOS_LACROS) -#include "chromeos/lacros/lacros_service.h" -#endif - #include "ash/public/cpp/notification_utils.h" #include "base/bind.h" #include "base/feature_list.h" @@ -26,6 +19,7 @@ #include "base/task/post_task.h" #include "base/task/thread_pool.h" #include "build/build_config.h" +#include "build/chromeos_buildflags.h" #include "chrome/app/vector_icons/vector_icons.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_commands.h" @@ -70,6 +64,13 @@ #include "ui/message_center/public/cpp/message_center_constants.h" #include "ui/message_center/public/cpp/notification.h" +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "ash/constants/ash_features.h" +#include "chrome/browser/ash/note_taking_helper.h" +#elif BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chromeos/lacros/lacros_service.h" +#endif + using base::UserMetricsAction; using offline_items_collection::FailState;
diff --git a/chrome/browser/download/notification/download_item_notification_unittest.cc b/chrome/browser/download/notification/download_item_notification_unittest.cc index 92671414..cfa1d38 100644 --- a/chrome/browser/download/notification/download_item_notification_unittest.cc +++ b/chrome/browser/download/notification/download_item_notification_unittest.cc
@@ -9,13 +9,6 @@ #include <memory> #include <utility> -#if BUILDFLAG(IS_CHROMEOS_ASH) -#include "ash/constants/ash_features.h" -#elif BUILDFLAG(IS_CHROMEOS_LACROS) -#include "chromeos/lacros/lacros_service.h" -#include "chromeos/lacros/lacros_test_helper.h" -#endif - #include "base/guid.h" #include "base/json/json_reader.h" #include "base/run_loop.h" @@ -23,6 +16,7 @@ #include "base/test/scoped_feature_list.h" #include "base/test/test_simple_task_runner.h" #include "base/threading/thread_task_runner_handle.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/download/chrome_download_manager_delegate.h" #include "chrome/browser/download/notification/download_notification_manager.h" #include "chrome/browser/download/offline_item_utils.h" @@ -45,6 +39,13 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "ash/constants/ash_features.h" +#elif BUILDFLAG(IS_CHROMEOS_LACROS) +#include "chromeos/lacros/lacros_service.h" +#include "chromeos/lacros/lacros_test_helper.h" +#endif + using testing::_; using testing::NiceMock; using testing::Return;
diff --git a/chrome/browser/download/notification/download_notification_browsertest.cc b/chrome/browser/download/notification/download_notification_browsertest.cc index 40b5a7c..cd73426 100644 --- a/chrome/browser/download/notification/download_notification_browsertest.cc +++ b/chrome/browser/download/notification/download_notification_browsertest.cc
@@ -18,6 +18,7 @@ #include "base/strings/utf_string_conversions.h" #include "base/synchronization/lock.h" #include "base/test/scoped_feature_list.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/download/chrome_download_manager_delegate.h" #include "chrome/browser/download/download_core_service.h"
diff --git a/chrome/browser/download/save_package_file_picker.cc b/chrome/browser/download/save_package_file_picker.cc index 7ec16a0d..1df01bf 100644 --- a/chrome/browser/download/save_package_file_picker.cc +++ b/chrome/browser/download/save_package_file_picker.cc
@@ -123,13 +123,13 @@ // TODO(crbug/928323): REMOVE DIRTY HACK // To prevent access to blocked websites, we are temporarily disabling the -// HTML-only download of error pages for supervised users only. +// HTML-only download of error pages for child users only. // Note that MHTML is still available, so the save functionality is preserved. bool SavePackageFilePicker::ShouldSaveAsOnlyHTML( content::WebContents* web_contents) const { Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); - return !profile->IsSupervised() || !IsErrorPage(web_contents); + return !profile->IsChild() || !IsErrorPage(web_contents); } bool SavePackageFilePicker::ShouldSaveAsMHTML() const {
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api.cc b/chrome/browser/extensions/api/developer_private/developer_private_api.cc index 2065dd3..eb2b0f7 100644 --- a/chrome/browser/extensions/api/developer_private/developer_private_api.cc +++ b/chrome/browser/extensions/api/developer_private/developer_private_api.cc
@@ -895,7 +895,7 @@ Profile* profile = Profile::FromBrowserContext(browser_context()); PrefService* prefs = profile->GetPrefs(); if (update.in_developer_mode) { - if (profile->IsSupervised()) + if (profile->IsChild()) return RespondNow(Error(kCannotUpdateSupervisedProfileSettingsError)); prefs->SetBoolean(prefs::kExtensionsUIDeveloperMode, *update.in_developer_mode); @@ -1108,7 +1108,7 @@ return RespondNow(Error(kCouldNotFindWebContentsError)); Profile* profile = Profile::FromBrowserContext(browser_context()); - if (profile->IsSupervised()) { + if (profile->IsChild()) { return RespondNow( Error("Supervised users cannot load unpacked extensions.")); } @@ -1694,8 +1694,8 @@ ExtensionFunction::ResponseAction DeveloperPrivateIsProfileManagedFunction::Run() { - return RespondNow(OneArgument(base::Value( - Profile::FromBrowserContext(browser_context())->IsSupervised()))); + return RespondNow(OneArgument( + base::Value(Profile::FromBrowserContext(browser_context())->IsChild()))); } DeveloperPrivateIsProfileManagedFunction::
diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc index fdf5198..8ffb21e 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc
@@ -660,6 +660,8 @@ settings_api::PrefType::PREF_TYPE_BOOLEAN; (*s_allowlist)[::ash::prefs::kLocalStateDevicePeripheralDataAccessEnabled] = settings_api::PrefType::PREF_TYPE_BOOLEAN; + (*s_allowlist)[ash::kRevenEnableDeviceHWDataUsage] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; // Bluetooth & Internet settings. (*s_allowlist)[ash::kAllowBluetooth] =
diff --git a/chrome/browser/extensions/preinstalled_apps_browsertest.cc b/chrome/browser/extensions/preinstalled_apps_browsertest.cc index 6bf506f8..fffdeae0 100644 --- a/chrome/browser/extensions/preinstalled_apps_browsertest.cc +++ b/chrome/browser/extensions/preinstalled_apps_browsertest.cc
@@ -14,6 +14,7 @@ #include "base/test/scoped_feature_list.h" #include "base/test/scoped_path_override.h" #include "build/branding_buildflags.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/pending_extension_manager.h" #include "chrome/browser/web_applications/extension_status_utils.h"
diff --git a/chrome/browser/extensions/updater/extension_updater.cc b/chrome/browser/extensions/updater/extension_updater.cc index 96e06d68..b55a8e2 100644 --- a/chrome/browser/extensions/updater/extension_updater.cc +++ b/chrome/browser/extensions/updater/extension_updater.cc
@@ -20,6 +20,7 @@ #include "base/rand_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/extensions/crx_installer.h" #include "chrome/browser/extensions/extension_management.h"
diff --git a/chrome/browser/favicon/content_favicon_driver_browsertest.cc b/chrome/browser/favicon/content_favicon_driver_browsertest.cc index 1837780d2..488e18d4 100644 --- a/chrome/browser/favicon/content_favicon_driver_browsertest.cc +++ b/chrome/browser/favicon/content_favicon_driver_browsertest.cc
@@ -446,7 +446,7 @@ ui_test_utils::BROWSER_TEST_WAIT_FOR_LOAD_STOP); EXPECT_TRUE(content::ExecJs(rfh, content::JsReplace(R"( - let w = window.open(); + let w = window.open('/page204.html'); w.document.write('abc'); w.document.close(); w.location.href = $1;)",
diff --git a/chrome/browser/feature_guide/notifications/BUILD.gn b/chrome/browser/feature_guide/notifications/BUILD.gn index 8c8c9b0..5c850d6 100644 --- a/chrome/browser/feature_guide/notifications/BUILD.gn +++ b/chrome/browser/feature_guide/notifications/BUILD.gn
@@ -12,26 +12,47 @@ sources = [ "feature_notification_guide_service.cc", "feature_notification_guide_service.h", + "feature_type.h", ] - deps = [] + deps = [ "//skia" ] public_deps = [ "//base", + "//chrome/browser/notifications/scheduler/public", "//components/keyed_service/core", ] } -source_set("factory") { - sources = [ - "feature_notification_guide_service_factory.cc", - "feature_notification_guide_service_factory.h", - ] +if (is_android) { + java_cpp_enum("jni_enums") { + visibility = [ "*" ] - deps = [ - ":public", - "internal:internal", - ] + sources = [ "feature_type.h" ] + } + + android_library("java") { + sources = [ "android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideService.java" ] + + deps = [ + "//base:base_java", + "//third_party/androidx:androidx_annotation_annotation_java", + ] + srcjar_deps = [ ":jni_enums" ] + } + + android_library_factory("factory_java") { + # These deps will be inherited by the resulting android_library target. + deps = [ + ":java", + "//base:base_java", + "//chrome/browser/profiles/android:java", + ] + + # This internal file will be replaced by a generated file so the resulting + # android_library target does not actually depend on this internal file. + sources = [ "internal/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideServiceFactory.java" ] + } } group("unit_tests") {
diff --git a/chrome/browser/feature_guide/notifications/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideService.java b/chrome/browser/feature_guide/notifications/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideService.java new file mode 100644 index 0000000..3cfc084b --- /dev/null +++ b/chrome/browser/feature_guide/notifications/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideService.java
@@ -0,0 +1,40 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.feature_guide.notifications; + +/** + * Central class representing feature notification guide. + */ +public interface FeatureNotificationGuideService { + /** + * A delegate containing helper methods needed by the service, such as providing notification + * texts, and handling notification interactions. + */ + public interface Delegate { + /** + * Called when the notification associated with {@code featureType} is clicked. + * @param featureType The {@link FeatureType} for the notification. + */ + void onNotificationClick(@FeatureType int featureType); + + /** + * Called to get the notification title text associated with {@code featureType}. + * @param featureType The {@link FeatureType} for the notification. + */ + String getNotificationTitle(@FeatureType int featureType); + + /** + * Called to get the notification body text associated with {@code featureType}. + * @param featureType The {@link FeatureType} for the notification. + */ + String getNotificationMessage(@FeatureType int featureType); + } + + /** + * Called by the embedder to set the delegate. + * @param delegate The {@link Delegate} to handle chrome layer logic. + */ + void setDelegate(Delegate delegate); +} \ No newline at end of file
diff --git a/chrome/browser/feature_guide/notifications/feature_notification_guide_service.cc b/chrome/browser/feature_guide/notifications/feature_notification_guide_service.cc index a91f5e04..0bbd187 100644 --- a/chrome/browser/feature_guide/notifications/feature_notification_guide_service.cc +++ b/chrome/browser/feature_guide/notifications/feature_notification_guide_service.cc
@@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2021 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.
diff --git a/chrome/browser/feature_guide/notifications/feature_notification_guide_service.h b/chrome/browser/feature_guide/notifications/feature_notification_guide_service.h index 79b7186..3c9d3f6 100644 --- a/chrome/browser/feature_guide/notifications/feature_notification_guide_service.h +++ b/chrome/browser/feature_guide/notifications/feature_notification_guide_service.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_FEATURE_GUIDE_NOTIFICATIONS_FEATURE_NOTIFICATION_GUIDE_SERVICE_H_ #include "base/feature_list.h" +#include "base/supports_user_data.h" #include "components/keyed_service/core/keyed_service.h" namespace feature_guide { @@ -18,7 +19,8 @@ // The central class responsible for managing feature notification guide in // chrome. -class FeatureNotificationGuideService : public KeyedService { +class FeatureNotificationGuideService : public KeyedService, + public base::SupportsUserData { public: FeatureNotificationGuideService(); ~FeatureNotificationGuideService() override;
diff --git a/chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.cc b/chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.cc index ecc8b799..d9b3953 100644 --- a/chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.cc +++ b/chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.cc
@@ -5,9 +5,15 @@ #include "chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.h" #include "base/memory/singleton.h" +#include "base/time/default_clock.h" +#include "chrome/browser/feature_engagement/tracker_factory.h" #include "chrome/browser/feature_guide/notifications/feature_notification_guide_service.h" #include "chrome/browser/feature_guide/notifications/internal/feature_notification_guide_service_impl.h" -#include "components/keyed_service/core/simple_dependency_manager.h" +#include "chrome/browser/notifications/scheduler/notification_schedule_service_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_key.h" +#include "components/keyed_service/content/browser_context_dependency_manager.h" +#include "content/public/browser/browser_context.h" namespace feature_guide { @@ -19,20 +25,33 @@ // static FeatureNotificationGuideService* -FeatureNotificationGuideServiceFactory::GetForKey(SimpleFactoryKey* key) { +FeatureNotificationGuideServiceFactory::GetForProfile(Profile* profile) { return static_cast<FeatureNotificationGuideService*>( - GetInstance()->GetServiceForKey(key, /*create=*/true)); + GetInstance()->GetServiceForBrowserContext(profile, true)); } FeatureNotificationGuideServiceFactory::FeatureNotificationGuideServiceFactory() - : SimpleKeyedServiceFactory("FeatureNotificationGuideService", - SimpleDependencyManager::GetInstance()) {} + : BrowserContextKeyedServiceFactory( + "FeatureNotificationGuideService", + BrowserContextDependencyManager::GetInstance()) { + DependsOn(NotificationScheduleServiceFactory::GetInstance()); +} -std::unique_ptr<KeyedService> -FeatureNotificationGuideServiceFactory::BuildServiceInstanceFor( - SimpleFactoryKey* key) const { - auto service = std::make_unique<FeatureNotificationGuideServiceImpl>(); - return std::move(service); +KeyedService* FeatureNotificationGuideServiceFactory::BuildServiceInstanceFor( + content::BrowserContext* context) const { + Profile* profile = Profile::FromBrowserContext(context); + auto* notification_scheduler = + NotificationScheduleServiceFactory::GetForKey(profile->GetProfileKey()); + feature_engagement::Tracker* tracker = + feature_engagement::TrackerFactory::GetForBrowserContext(profile); + DCHECK(notification_scheduler); + DCHECK(tracker); + // TODO(shaktisahu): Hookup dependencies. + return new FeatureNotificationGuideServiceImpl(); +} + +bool FeatureNotificationGuideServiceFactory::ServiceIsNULLWhileTesting() const { + return true; } } // namespace feature_guide
diff --git a/chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.h b/chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.h index e6c7f5a..2063091 100644 --- a/chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.h +++ b/chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.h
@@ -5,25 +5,28 @@ #ifndef CHROME_BROWSER_FEATURE_GUIDE_NOTIFICATIONS_FEATURE_NOTIFICATION_GUIDE_SERVICE_FACTORY_H_ #define CHROME_BROWSER_FEATURE_GUIDE_NOTIFICATIONS_FEATURE_NOTIFICATION_GUIDE_SERVICE_FACTORY_H_ -#include <memory> - -#include "components/keyed_service/core/simple_factory_key.h" -#include "components/keyed_service/core/simple_keyed_service_factory.h" +#include "components/keyed_service/content/browser_context_keyed_service_factory.h" namespace base { template <typename T> struct DefaultSingletonTraits; } // namespace base +namespace content { +class BrowserContext; +} // namespace content + +class Profile; + namespace feature_guide { class FeatureNotificationGuideService; // A factory to create one unique FeatureNotificationGuideService. class FeatureNotificationGuideServiceFactory - : public SimpleKeyedServiceFactory { + : public BrowserContextKeyedServiceFactory { public: static FeatureNotificationGuideServiceFactory* GetInstance(); - static FeatureNotificationGuideService* GetForKey(SimpleFactoryKey* key); + static FeatureNotificationGuideService* GetForProfile(Profile* profile); private: friend struct base::DefaultSingletonTraits< @@ -32,8 +35,9 @@ FeatureNotificationGuideServiceFactory(); ~FeatureNotificationGuideServiceFactory() override = default; - std::unique_ptr<KeyedService> BuildServiceInstanceFor( - SimpleFactoryKey* key) const override; + KeyedService* BuildServiceInstanceFor( + content::BrowserContext* context) const override; + bool ServiceIsNULLWhileTesting() const override; }; } // namespace feature_guide
diff --git a/chrome/browser/feature_guide/notifications/feature_type.h b/chrome/browser/feature_guide/notifications/feature_type.h new file mode 100644 index 0000000..707478d --- /dev/null +++ b/chrome/browser/feature_guide/notifications/feature_type.h
@@ -0,0 +1,28 @@ +// Copyright 2021 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_FEATURE_GUIDE_NOTIFICATIONS_FEATURE_TYPE_H_ +#define CHROME_BROWSER_FEATURE_GUIDE_NOTIFICATIONS_FEATURE_TYPE_H_ + +#include "base/logging.h" + +namespace feature_guide { + +// A Java counterpart will be generated for this enum. +// GENERATED_JAVA_ENUM_PACKAGE: ( +// org.chromium.chrome.browser.feature_guide.notifications) +enum class FeatureType { + kTest = -1, + kInvalid = 0, + kDefaultBrowser = 1, + kSignIn = 2, + kIncognitoTab = 3, + kNTPSuggestionCard = 4, + kVoiceSearch = 5, + kMaxValue = kVoiceSearch, +}; + +} // namespace feature_guide + +#endif // CHROME_BROWSER_FEATURE_GUIDE_NOTIFICATIONS_FEATURE_TYPE_H_
diff --git a/chrome/browser/feature_guide/notifications/internal/BUILD.gn b/chrome/browser/feature_guide/notifications/internal/BUILD.gn index f48e0ab..dd7dd58 100644 --- a/chrome/browser/feature_guide/notifications/internal/BUILD.gn +++ b/chrome/browser/feature_guide/notifications/internal/BUILD.gn
@@ -16,7 +16,51 @@ deps = [ "//base", "//chrome/browser/feature_guide/notifications:public", + "//components/feature_engagement/public", + "//skia", ] + + if (is_android) { + sources += [ + "android/feature_notification_guide_bridge.cc", + "android/feature_notification_guide_bridge.h", + ] + + deps += [ ":jni_headers" ] + } +} + +if (is_android) { + android_library("internal_java") { + visibility = [ + ":*", + "//chrome/android:chrome_all_java", + ] + sources = [ + "android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideBridge.java", + "android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideServiceFactory.java", + ] + + deps = [ + "//base:base_java", + "//chrome/browser/feature_guide/notifications:java", + "//chrome/browser/profiles/android:java", + "//third_party/androidx:androidx_annotation_annotation_java", + ] + annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] + } + + generate_jni("jni_headers") { + visibility = [ + ":*", + "//chrome/browser", + ] + + sources = [ + "android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideBridge.java", + "android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideServiceFactory.java", + ] + } } source_set("unit_tests") {
diff --git a/chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_bridge.cc b/chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_bridge.cc new file mode 100644 index 0000000..89139f8 --- /dev/null +++ b/chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_bridge.cc
@@ -0,0 +1,89 @@ +// Copyright 2021 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/feature_guide/notifications/internal/android/feature_notification_guide_bridge.h" + +#include <string> + +#include "base/android/jni_android.h" +#include "base/android/jni_string.h" +#include "chrome/browser/feature_guide/notifications/feature_notification_guide_service.h" +#include "chrome/browser/feature_guide/notifications/feature_type.h" +#include "chrome/browser/feature_guide/notifications/internal/jni_headers/FeatureNotificationGuideBridge_jni.h" + +namespace feature_guide { +namespace { +const char kFeatureNotificationGuideBridgeKey[] = + "feature_notification_guide_bridge"; +} // namespace + +// static +FeatureNotificationGuideBridge* +FeatureNotificationGuideBridge::GetFeatureNotificationGuideBridge( + FeatureNotificationGuideService* feature_notification_guide_service) { + if (!feature_notification_guide_service->GetUserData( + kFeatureNotificationGuideBridgeKey)) { + feature_notification_guide_service->SetUserData( + kFeatureNotificationGuideBridgeKey, + std::make_unique<FeatureNotificationGuideBridge>( + feature_notification_guide_service)); + } + + return static_cast<FeatureNotificationGuideBridge*>( + feature_notification_guide_service->GetUserData( + kFeatureNotificationGuideBridgeKey)); +} + +ScopedJavaLocalRef<jobject> FeatureNotificationGuideBridge::GetJavaObj() { + return ScopedJavaLocalRef<jobject>(java_obj_); +} + +FeatureNotificationGuideBridge::FeatureNotificationGuideBridge( + FeatureNotificationGuideService* feature_notification_guide_service) + : feature_notification_guide_service_(feature_notification_guide_service) { + DCHECK(feature_notification_guide_service); + JNIEnv* env = base::android::AttachCurrentThread(); + java_obj_.Reset(env, Java_FeatureNotificationGuideBridge_create( + env, reinterpret_cast<int64_t>(this)) + .obj()); +} + +FeatureNotificationGuideBridge::~FeatureNotificationGuideBridge() { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_FeatureNotificationGuideBridge_clearNativePtr(env, java_obj_); +} + +std::u16string FeatureNotificationGuideBridge::GetNotificationTitle( + FeatureType feature) { + JNIEnv* env = base::android::AttachCurrentThread(); + std::u16string title; + base::android::ConvertJavaStringToUTF16( + env, + Java_FeatureNotificationGuideBridge_getNotificationTitle( + env, java_obj_, static_cast<int>(feature)) + .obj(), + &title); + return title; +} + +std::u16string FeatureNotificationGuideBridge::GetNotificationMessage( + FeatureType feature) { + JNIEnv* env = base::android::AttachCurrentThread(); + std::u16string message; + base::android::ConvertJavaStringToUTF16( + env, + Java_FeatureNotificationGuideBridge_getNotificationMessage( + env, java_obj_, static_cast<int>(feature)) + .obj(), + &message); + return message; +} + +void FeatureNotificationGuideBridge::OnNotificationClick(FeatureType feature) { + JNIEnv* env = base::android::AttachCurrentThread(); + Java_FeatureNotificationGuideBridge_onNotificationClick( + env, java_obj_, static_cast<int>(feature)); +} + +} // namespace feature_guide
diff --git a/chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_bridge.h b/chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_bridge.h new file mode 100644 index 0000000..284035e --- /dev/null +++ b/chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_bridge.h
@@ -0,0 +1,49 @@ +// Copyright 2021 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_FEATURE_GUIDE_NOTIFICATIONS_INTERNAL_ANDROID_FEATURE_NOTIFICATION_GUIDE_BRIDGE_H_ +#define CHROME_BROWSER_FEATURE_GUIDE_NOTIFICATIONS_INTERNAL_ANDROID_FEATURE_NOTIFICATION_GUIDE_BRIDGE_H_ + +#include <string> + +#include "base/android/jni_android.h" +#include "base/memory/raw_ptr.h" +#include "base/supports_user_data.h" +#include "chrome/browser/feature_guide/notifications/feature_type.h" + +using base::android::ScopedJavaGlobalRef; +using base::android::ScopedJavaLocalRef; + +namespace feature_guide { +class FeatureNotificationGuideService; + +// Contains JNI methods needed by the feature notification guide. +class FeatureNotificationGuideBridge : public base::SupportsUserData::Data { + public: + // Returns a Java FeatureNotificationGuideBridge for |service|. + // There will be only one bridge per FeatureNotificationGuideBridge. + static FeatureNotificationGuideBridge* GetFeatureNotificationGuideBridge( + FeatureNotificationGuideService* feature_notification_guide_service); + + explicit FeatureNotificationGuideBridge( + FeatureNotificationGuideService* feature_notification_guide_service); + ~FeatureNotificationGuideBridge() override; + + ScopedJavaLocalRef<jobject> GetJavaObj(); + std::u16string GetNotificationTitle(FeatureType feature); + std::u16string GetNotificationMessage(FeatureType feature); + void OnNotificationClick(FeatureType feature); + + private: + // A reference to the Java counterpart of this class. See + // FeatureNotificationGuideBridge.java. + ScopedJavaGlobalRef<jobject> java_obj_; + + // Not owned. + raw_ptr<FeatureNotificationGuideService> feature_notification_guide_service_; +}; + +} // namespace feature_guide + +#endif // CHROME_BROWSER_FEATURE_GUIDE_NOTIFICATIONS_INTERNAL_ANDROID_FEATURE_NOTIFICATION_GUIDE_BRIDGE_H_
diff --git a/chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_service_factory_android.cc b/chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_service_factory_android.cc new file mode 100644 index 0000000..0d48db07 --- /dev/null +++ b/chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_service_factory_android.cc
@@ -0,0 +1,25 @@ +// Copyright 2021 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/android/scoped_java_ref.h" +#include "chrome/browser/feature_guide/notifications/feature_notification_guide_service.h" +#include "chrome/browser/feature_guide/notifications/feature_notification_guide_service_factory.h" +#include "chrome/browser/feature_guide/notifications/internal/android/feature_notification_guide_bridge.h" +#include "chrome/browser/feature_guide/notifications/internal/jni_headers/FeatureNotificationGuideServiceFactory_jni.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_android.h" + +static base::android::ScopedJavaLocalRef<jobject> +JNI_FeatureNotificationGuideServiceFactory_GetForProfile( + JNIEnv* env, + const base::android::JavaParamRef<jobject>& jprofile) { + Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile); + DCHECK(profile); + feature_guide::FeatureNotificationGuideService* service = + feature_guide::FeatureNotificationGuideServiceFactory::GetForProfile( + profile->GetOriginalProfile()); + return feature_guide::FeatureNotificationGuideBridge:: + GetFeatureNotificationGuideBridge(service) + ->GetJavaObj(); +}
diff --git a/chrome/browser/feature_guide/notifications/internal/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideBridge.java b/chrome/browser/feature_guide/notifications/internal/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideBridge.java new file mode 100644 index 0000000..acd4db1 --- /dev/null +++ b/chrome/browser/feature_guide/notifications/internal/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideBridge.java
@@ -0,0 +1,52 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.feature_guide.notifications; + +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.JNINamespace; + +/** + * Contains JNI methods needed by the feature notification guide. + */ +@JNINamespace("feature_guide") +public final class FeatureNotificationGuideBridge implements FeatureNotificationGuideService { + private long mNativeFeatureNotificationGuideBridge; + private Delegate mDelegate; + + @CalledByNative + private static FeatureNotificationGuideBridge create(long nativePtr) { + return new FeatureNotificationGuideBridge(nativePtr); + } + + @CalledByNative + private void clearNativePtr() { + mNativeFeatureNotificationGuideBridge = 0; + } + + private FeatureNotificationGuideBridge(long nativePtr) { + mNativeFeatureNotificationGuideBridge = nativePtr; + } + + @Override + public void setDelegate(Delegate delegate) { + assert mDelegate == null; + mDelegate = delegate; + } + + @CalledByNative + private String getNotificationTitle(int featureType) { + return mDelegate.getNotificationTitle(featureType); + } + + @CalledByNative + private String getNotificationMessage(int featureType) { + return mDelegate.getNotificationMessage(featureType); + } + + @CalledByNative + private void onNotificationClick(int featureType) { + mDelegate.onNotificationClick(featureType); + } +} \ No newline at end of file
diff --git a/chrome/browser/feature_guide/notifications/internal/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideServiceFactory.java b/chrome/browser/feature_guide/notifications/internal/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideServiceFactory.java new file mode 100644 index 0000000..39cddba --- /dev/null +++ b/chrome/browser/feature_guide/notifications/internal/android/java/src/org/chromium/chrome/browser/feature_guide/notifications/FeatureNotificationGuideServiceFactory.java
@@ -0,0 +1,30 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.feature_guide.notifications; + +import org.chromium.base.annotations.NativeMethods; +import org.chromium.chrome.browser.profiles.Profile; + +/** + * Basic factory that creates and returns an {@link FeatureNotificationGuideService} that is + * attached natively to the given {@link Profile}. + */ +public final class FeatureNotificationGuideServiceFactory { + private static FeatureNotificationGuideService sFeatureNotificationGuideServiceForTesting; + + private FeatureNotificationGuideServiceFactory() {} + + public static FeatureNotificationGuideService getForProfile(Profile profile) { + if (sFeatureNotificationGuideServiceForTesting != null) { + return sFeatureNotificationGuideServiceForTesting; + } + return FeatureNotificationGuideServiceFactoryJni.get().getForProfile(profile); + } + + @NativeMethods + interface Natives { + FeatureNotificationGuideService getForProfile(Profile profile); + } +} \ No newline at end of file
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 396b746..1914aa0a 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -4703,7 +4703,7 @@ const char kDockedMagnifierResizingName[] = "Enable ability to resize Docked Magnifier"; const char kDockedMagnifierResizingDescription[] = - "Enable feature which adds ability for user to grab and resize divider of" + "Enable feature which adds ability for user to grab and resize divider of " "Docked Magnifier."; const char kFilesArchivemountName[] = "Archivemount in Files App (1st Tier)";
diff --git a/chrome/browser/media/webrtc/display_media_access_handler.h b/chrome/browser/media/webrtc/display_media_access_handler.h index 32341c4..d274d53f6 100644 --- a/chrome/browser/media/webrtc/display_media_access_handler.h +++ b/chrome/browser/media/webrtc/display_media_access_handler.h
@@ -8,6 +8,7 @@ #include <memory> #include "base/containers/flat_map.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/media/capture_access_handler_base.h" #include "chrome/browser/media/media_access_handler.h" #include "chrome/browser/media/webrtc/capture_policy_utils.h"
diff --git a/chrome/browser/media/webrtc/native_desktop_media_list.cc b/chrome/browser/media/webrtc/native_desktop_media_list.cc index aa05a5dd..04dbc1f 100644 --- a/chrome/browser/media/webrtc/native_desktop_media_list.cc +++ b/chrome/browser/media/webrtc/native_desktop_media_list.cc
@@ -15,6 +15,7 @@ #include "base/threading/thread_restrictions.h" #include "base/threading/thread_task_runner_handle.h" #include "build/build_config.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/media/webrtc/desktop_media_list.h" #include "chrome/grit/generated_resources.h" #include "content/public/browser/browser_task_traits.h"
diff --git a/chrome/browser/metrics/first_web_contents_profiler.cc b/chrome/browser/metrics/first_web_contents_profiler.cc index e7066db..50bfe5af 100644 --- a/chrome/browser/metrics/first_web_contents_profiler.cc +++ b/chrome/browser/metrics/first_web_contents_profiler.cc
@@ -14,78 +14,40 @@ #include "base/memory/memory_pressure_monitor.h" #include "base/metrics/histogram_functions.h" #include "base/time/time.h" -#include "build/build_config.h" -#include "chrome/browser/ui/browser.h" +#include "chrome/browser/metrics/first_web_contents_profiler_base.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/browser_window.h" -#include "chrome/browser/ui/tabs/tab_strip_model.h" #include "components/startup_metric_utils/browser/startup_metric_utils.h" #include "content/public/browser/navigation_controller.h" #include "content/public/browser/navigation_entry.h" -#include "content/public/browser/navigation_handle.h" -#include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_observer.h" +namespace metrics { namespace { -// Reasons for which profiling is deemed complete. Logged in UMA (do not re- -// order or re-assign). -enum class FinishReason { - // All metrics were successfully gathered. - kDone = 0, - // Abandon if blocking UI was shown during startup. - kAbandonBlockingUI = 1, - // Abandon if the WebContents is hidden (lowers scheduling priority). - kAbandonContentHidden = 2, - // Abandon if the WebContents is destroyed. - kAbandonContentDestroyed = 3, - // Abandon if the WebContents navigates away from its initial page, as it: - // (1) is no longer a fair timing; and - // (2) can cause http://crbug.com/525209 where the first paint didn't fire - // for the initial content but fires after a lot of idle time when the - // user finally navigates to another page that does trigger it. - kAbandonNewNavigation = 4, - // Abandon if the WebContents fails to load (e.g. network error, etc.). - kAbandonNavigationError = 5, - // Abandon if no WebContents was visible at the beginning of startup - kAbandonNoInitiallyVisibleContent = 6, - kMaxValue = kAbandonNoInitiallyVisibleContent -}; - -void RecordFinishReason(FinishReason finish_reason) { +void RecordFirstWebContentsFinishReason( + StartupProfilingFinishReason finish_reason) { base::UmaHistogramEnumeration("Startup.FirstWebContents.FinishReason", finish_reason); } -// Note: Instances of this class self destroy when the first non-empty paint -// happens, or when an event prevents it from being recorded. -class FirstWebContentsProfiler : public content::WebContentsObserver { +class FirstWebContentsProfiler : public FirstWebContentsProfilerBase { public: explicit FirstWebContentsProfiler(content::WebContents* web_contents); FirstWebContentsProfiler(const FirstWebContentsProfiler&) = delete; FirstWebContentsProfiler& operator=(const FirstWebContentsProfiler&) = delete; + protected: + // FirstWebContentsProfilerBase: + void RecordFinishReason(StartupProfilingFinishReason finish_reason) override; + void RecordNavigationFinished(base::TimeTicks navigation_start) override; + void RecordFirstNonEmptyPaint() override; + bool WasStartupInterrupted() override; + private: ~FirstWebContentsProfiler() override = default; - // content::WebContentsObserver: - void DidStartNavigation( - content::NavigationHandle* navigation_handle) override; - void DidFinishNavigation( - content::NavigationHandle* navigation_handle) override; - void DidFirstVisuallyNonEmptyPaint() override; - void OnVisibilityChanged(content::Visibility visibility) override; - void WebContentsDestroyed() override; - - // Logs |finish_reason| to UMA and deletes this FirstWebContentsProfiler. - void FinishedCollectingMetrics(FinishReason finish_reason); - - // Whether a main frame navigation finished since this was created. - bool did_finish_first_navigation_ = false; - // Memory pressure listener that will be used to check if memory pressure has // an impact on startup. base::MemoryPressureListener memory_pressure_listener_; @@ -93,7 +55,7 @@ FirstWebContentsProfiler::FirstWebContentsProfiler( content::WebContents* web_contents) - : content::WebContentsObserver(web_contents), + : FirstWebContentsProfilerBase(web_contents), memory_pressure_listener_( FROM_HERE, base::BindRepeating(&startup_metric_utils:: @@ -105,119 +67,44 @@ DCHECK(web_contents->GetController().GetPendingEntry()); } -void FirstWebContentsProfiler::DidStartNavigation( - content::NavigationHandle* navigation_handle) { - // The profiler is concerned with the primary main frame navigation only. - if (!navigation_handle->IsInPrimaryMainFrame() || - navigation_handle->IsSameDocument()) { - return; - } - - // FirstWebContentsProfiler is created after DidStartNavigation() has been - // dispatched for the first top-level navigation. If another - // DidStartNavigation() is received, it means that a new navigation was - // initiated. - FinishedCollectingMetrics(FinishReason::kAbandonNewNavigation); +void FirstWebContentsProfiler::RecordFinishReason( + StartupProfilingFinishReason finish_reason) { + RecordFirstWebContentsFinishReason(finish_reason); } -void FirstWebContentsProfiler::DidFinishNavigation( - content::NavigationHandle* navigation_handle) { - if (startup_metric_utils::WasMainWindowStartupInterrupted()) { - FinishedCollectingMetrics(FinishReason::kAbandonBlockingUI); - return; - } - - // Ignore subframe navigations, pre-rendering, and same-document navigations. - if (!navigation_handle->IsInPrimaryMainFrame() || - navigation_handle->IsSameDocument()) { - return; - } - - if (!navigation_handle->HasCommitted() || - navigation_handle->IsErrorPage()) { - FinishedCollectingMetrics(FinishReason::kAbandonNavigationError); - return; - } - - // It is not possible to get a second top-level DidFinishNavigation() without - // first having a DidStartNavigation(), which would have deleted |this|. - DCHECK(!did_finish_first_navigation_); - - did_finish_first_navigation_ = true; - +void FirstWebContentsProfiler::RecordNavigationFinished( + base::TimeTicks navigation_start) { startup_metric_utils::RecordFirstWebContentsMainNavigationStart( - navigation_handle->NavigationStart()); + navigation_start); startup_metric_utils::RecordFirstWebContentsMainNavigationFinished( base::TimeTicks::Now()); } -void FirstWebContentsProfiler::DidFirstVisuallyNonEmptyPaint() { - DCHECK(did_finish_first_navigation_); - - if (startup_metric_utils::WasMainWindowStartupInterrupted()) { - FinishedCollectingMetrics(FinishReason::kAbandonBlockingUI); - return; - } - +void FirstWebContentsProfiler::RecordFirstNonEmptyPaint() { startup_metric_utils::RecordFirstWebContentsNonEmptyPaint( base::TimeTicks::Now(), web_contents()->GetMainFrame()->GetProcess()->GetLastInitTime()); - - FinishedCollectingMetrics(FinishReason::kDone); } -void FirstWebContentsProfiler::OnVisibilityChanged( - content::Visibility visibility) { - if (visibility != content::Visibility::VISIBLE) { - // Stop profiling if the content gets hidden as its load may be - // deprioritized and timing it becomes meaningless. - FinishedCollectingMetrics(FinishReason::kAbandonContentHidden); - } -} - -void FirstWebContentsProfiler::WebContentsDestroyed() { - FinishedCollectingMetrics(FinishReason::kAbandonContentDestroyed); -} - -void FirstWebContentsProfiler::FinishedCollectingMetrics( - FinishReason finish_reason) { - RecordFinishReason(finish_reason); - delete this; +bool FirstWebContentsProfiler::WasStartupInterrupted() { + return startup_metric_utils::WasMainWindowStartupInterrupted(); } } // namespace -namespace metrics { - void BeginFirstWebContentsProfiling() { - const BrowserList* browser_list = BrowserList::GetInstance(); - content::WebContents* visible_contents = nullptr; + const BrowserList* browser_list = BrowserList::GetInstance(); for (Browser* browser : *browser_list) { - if (!browser->window()->IsVisible()) - continue; - - // The active WebContents may be hidden when the window height is small. - content::WebContents* contents = - browser->tab_strip_model()->GetActiveWebContents(); - -#if defined(OS_MAC) - // TODO(https://crbug.com/1032348): It is incorrect to have a visible - // browser window with no active WebContents, but reports on Mac show that - // it happens. - if (!contents) - continue; -#endif // defined(OS_MAC) - - if (contents->GetVisibility() != content::Visibility::VISIBLE) - continue; - - visible_contents = contents; - break; + visible_contents = + FirstWebContentsProfilerBase::GetVisibleContents(browser); + if (visible_contents) + break; } if (!visible_contents) { - RecordFinishReason(FinishReason::kAbandonNoInitiallyVisibleContent); + RecordFirstWebContentsFinishReason( + StartupProfilingFinishReason::kAbandonNoInitiallyVisibleContent); return; }
diff --git a/chrome/browser/metrics/first_web_contents_profiler_base.cc b/chrome/browser/metrics/first_web_contents_profiler_base.cc new file mode 100644 index 0000000..3f2d06b --- /dev/null +++ b/chrome/browser/metrics/first_web_contents_profiler_base.cc
@@ -0,0 +1,123 @@ +// Copyright 2021 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/metrics/first_web_contents_profiler_base.h" + +#include "build/build_config.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "content/public/browser/navigation_entry.h" +#include "content/public/browser/navigation_handle.h" +#include "content/public/browser/web_contents_observer.h" + +namespace metrics { + +FirstWebContentsProfilerBase::FirstWebContentsProfilerBase( + content::WebContents* web_contents) + : content::WebContentsObserver(web_contents) {} + +FirstWebContentsProfilerBase::~FirstWebContentsProfilerBase() = default; + +// static +content::WebContents* FirstWebContentsProfilerBase::GetVisibleContents( + Browser* browser) { + if (!browser->window()->IsVisible()) + return nullptr; + + // The active WebContents may be hidden when the window height is small. + content::WebContents* contents = + browser->tab_strip_model()->GetActiveWebContents(); + +#if defined(OS_MAC) + // TODO(https://crbug.com/1032348): It is incorrect to have a visible + // browser window with no active WebContents, but reports on Mac show that + // it happens. + if (!contents) + return nullptr; +#endif // defined(OS_MAC) + + if (contents->GetVisibility() != content::Visibility::VISIBLE) + return nullptr; + + return contents; +} + +void FirstWebContentsProfilerBase::DidStartNavigation( + content::NavigationHandle* navigation_handle) { + // The profiler is concerned with the primary main frame navigation only. + if (!navigation_handle->IsInPrimaryMainFrame() || + navigation_handle->IsSameDocument()) { + return; + } + + // The profiler is created after DidStartNavigation() has been dispatched for + // the first top-level navigation. If another DidStartNavigation() is + // received, it means that a new navigation was initiated. + FinishedCollectingMetrics( + StartupProfilingFinishReason::kAbandonNewNavigation); +} + +void FirstWebContentsProfilerBase::DidFinishNavigation( + content::NavigationHandle* navigation_handle) { + if (WasStartupInterrupted()) { + FinishedCollectingMetrics(StartupProfilingFinishReason::kAbandonBlockingUI); + return; + } + + // Ignore subframe navigations, pre-rendering, and same-document navigations. + if (!navigation_handle->IsInPrimaryMainFrame() || + navigation_handle->IsSameDocument()) { + return; + } + + if (!navigation_handle->HasCommitted() || navigation_handle->IsErrorPage()) { + FinishedCollectingMetrics( + StartupProfilingFinishReason::kAbandonNavigationError); + return; + } + + // It is not possible to get a second top-level DidFinishNavigation() without + // first having a DidStartNavigation(), which would have deleted |this|. + DCHECK(!did_finish_first_navigation_); + + did_finish_first_navigation_ = true; + + RecordNavigationFinished(navigation_handle->NavigationStart()); +} + +void FirstWebContentsProfilerBase::DidFirstVisuallyNonEmptyPaint() { + DCHECK(did_finish_first_navigation_); + + if (WasStartupInterrupted()) { + FinishedCollectingMetrics(StartupProfilingFinishReason::kAbandonBlockingUI); + return; + } + + RecordFirstNonEmptyPaint(); + FinishedCollectingMetrics(StartupProfilingFinishReason::kDone); +} + +void FirstWebContentsProfilerBase::OnVisibilityChanged( + content::Visibility visibility) { + if (visibility != content::Visibility::VISIBLE) { + // Stop profiling if the content gets hidden as its load may be + // deprioritized and timing it becomes meaningless. + FinishedCollectingMetrics( + StartupProfilingFinishReason::kAbandonContentHidden); + } +} + +void FirstWebContentsProfilerBase::WebContentsDestroyed() { + FinishedCollectingMetrics( + StartupProfilingFinishReason::kAbandonContentDestroyed); +} + +void FirstWebContentsProfilerBase::FinishedCollectingMetrics( + StartupProfilingFinishReason finish_reason) { + RecordFinishReason(finish_reason); + delete this; +} + +} // namespace metrics
diff --git a/chrome/browser/metrics/first_web_contents_profiler_base.h b/chrome/browser/metrics/first_web_contents_profiler_base.h new file mode 100644 index 0000000..92fbd79 --- /dev/null +++ b/chrome/browser/metrics/first_web_contents_profiler_base.h
@@ -0,0 +1,94 @@ +// Copyright 2021 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_METRICS_FIRST_WEB_CONTENTS_PROFILER_BASE_H_ +#define CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_BASE_H_ + +#include "base/time/time.h" +#include "content/public/browser/web_contents_observer.h" + +namespace content { +class WebContents; +} + +class Browser; + +namespace metrics { + +// Reasons for which profiling is deemed complete. Logged in UMA (do not re- +// order or re-assign). +enum class StartupProfilingFinishReason { + // All metrics were successfully gathered. + kDone = 0, + // Abandon if blocking UI was shown during startup. + kAbandonBlockingUI = 1, + // Abandon if the WebContents is hidden (lowers scheduling priority). + kAbandonContentHidden = 2, + // Abandon if the WebContents is destroyed. + kAbandonContentDestroyed = 3, + // Abandon if the WebContents navigates away from its initial page, as it: + // (1) is no longer a fair timing; and + // (2) can cause http://crbug.com/525209 where the first paint didn't fire + // for the initial content but fires after a lot of idle time when the + // user finally navigates to another page that does trigger it. + kAbandonNewNavigation = 4, + // Abandon if the WebContents fails to load (e.g. network error, etc.). + kAbandonNavigationError = 5, + // Abandon if no WebContents was visible at the beginning of startup + kAbandonNoInitiallyVisibleContent = 6, + // Abandon if the WebContents was already painted. We set up the profiler too + // late and it missed the first non empty paint event. + kAbandonAlreadyPaintedContent = 7, + kMaxValue = kAbandonAlreadyPaintedContent +}; + +// Note: Instances of this class self destroy when the first non-empty paint +// happens, or when an event prevents it from being recorded. +class FirstWebContentsProfilerBase : public content::WebContentsObserver { + public: + FirstWebContentsProfilerBase(const FirstWebContentsProfilerBase&) = delete; + FirstWebContentsProfilerBase& operator=(const FirstWebContentsProfilerBase&) = + delete; + + // Returns a visible webcontents from `browser` that can be observed for + // startup profiling, or `nullptr` if no compatible one was obtained. + static content::WebContents* GetVisibleContents(Browser* browser); + + protected: + explicit FirstWebContentsProfilerBase(content::WebContents* web_contents); + + // Protected destructor as `FirstWebContentsProfilerBase` deletes itself. + ~FirstWebContentsProfilerBase() override; + + // Whether to abort recording metrics if the main window startup was + // interrupted. Recording metrics for startups with interruptions pollutes the + // collected data, however some flows (e.g. startup on ProfilePicker) + // specifically define their metrics to work around the interruptions. + virtual bool WasStartupInterrupted() = 0; + + virtual void RecordFinishReason( + StartupProfilingFinishReason finish_reason) = 0; + virtual void RecordNavigationFinished(base::TimeTicks navigation_start) = 0; + virtual void RecordFirstNonEmptyPaint() = 0; + + private: + // content::WebContentsObserver: + void DidStartNavigation( + content::NavigationHandle* navigation_handle) override; + void DidFinishNavigation( + content::NavigationHandle* navigation_handle) override; + void DidFirstVisuallyNonEmptyPaint() override; + void OnVisibilityChanged(content::Visibility visibility) override; + void WebContentsDestroyed() override; + + // Logs |finish_reason| to UMA and deletes this profiler. + void FinishedCollectingMetrics(StartupProfilingFinishReason finish_reason); + + // Whether a main frame navigation finished since this was created. + bool did_finish_first_navigation_ = false; +}; + +} // namespace metrics + +#endif // CHROME_BROWSER_METRICS_FIRST_WEB_CONTENTS_PROFILER_BASE_H_
diff --git a/chrome/browser/net/private_network_access_browsertest.cc b/chrome/browser/net/private_network_access_browsertest.cc index a084ffe3..70ea8fa2 100644 --- a/chrome/browser/net/private_network_access_browsertest.cc +++ b/chrome/browser/net/private_network_access_browsertest.cc
@@ -15,6 +15,8 @@ #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/install_verifier.h" #include "chrome/browser/extensions/test_extension_system.h" +#include "chrome/browser/net/profile_network_context_service.h" +#include "chrome/browser/net/profile_network_context_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/in_process_browser_test.h" @@ -27,6 +29,8 @@ #include "components/embedder_support/switches.h" #include "components/error_page/content/browser/net_error_auto_reloader.h" #include "components/metrics/content/subprocess_metrics_provider.h" +#include "components/proxy_config/proxy_config_dictionary.h" +#include "components/proxy_config/proxy_config_pref_names.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_features.h" #include "content/public/common/url_constants.h" @@ -125,6 +129,7 @@ WebFeature::kAddressSpacePublicNonSecureContextNavigatedToPrivate, WebFeature::kAddressSpaceUnknownSecureContextNavigatedToPrivate, WebFeature::kAddressSpaceUnknownNonSecureContextNavigatedToPrivate, + WebFeature::kPrivateNetworkAccessIgnoredPreflightError, }; } @@ -209,6 +214,7 @@ features::kBlockInsecurePrivateNetworkRequests, features::kBlockInsecurePrivateNetworkRequestsFromPrivate, features::kBlockInsecurePrivateNetworkRequestsDeprecationTrial, + features::kPrivateNetworkAccessSendPreflights, dom_distiller::kReaderMode, }, {}) {} @@ -297,6 +303,32 @@ })); } +// This test verifies that when a preflight request is sent ahead of a private +// network request, fails, and enforcement is not enabled, the correct +// WebFeature is use-counted to reflect the suppressed error. +IN_PROC_BROWSER_TEST_F(PrivateNetworkAccessWithFeatureEnabledBrowserTest, + RecordsAddressSpaceFeatureForFetchWithPreflight) { + std::unique_ptr<net::EmbeddedTestServer> server = NewServer(); + + EXPECT_TRUE(content::NavigateToURL(web_contents(), PublicSecureURL(*server))); + + WebFeatureHistogramTester feature_histogram_tester; + + // The server does not reply with valid CORS headers, so the preflight fails. + // The enforcement feature is not enabled however, so the error is suppressed. + // Instead, a warning is shown in DevTools and a WebFeature use-counted. + EXPECT_EQ(true, content::EvalJs(web_contents(), R"( + fetch("/defaultresponse").then(response => response.ok) + )")); + + feature_histogram_tester.ExpectCounts(AddFeatureCounts( + AllZeroFeatureCounts(AllAddressSpaceFeatures()), + { + {WebFeature::kAddressSpacePublicSecureContextEmbeddedLocal, 1}, + {WebFeature::kPrivateNetworkAccessIgnoredPreflightError, 1}, + })); +} + // This test verifies that when a non-secure context served from the public // address space loads a resource from the local network, the correct WebFeature // is use-counted. @@ -624,6 +656,28 @@ 1); } +// This test verifies that resources proxied through a proxy on localhost can +// be fetched from documents in the public IP address space. +// Regression test for https://crbug.com/1253239. +IN_PROC_BROWSER_TEST_F(PrivateNetworkAccessWithFeatureEnabledBrowserTest, + ProxiedResourcesAllowed) { + auto server = NewServer(); + + EXPECT_TRUE( + content::NavigateToURL(web_contents(), PublicNonSecureURL(*server))); + + browser()->profile()->GetPrefs()->Set( + proxy_config::prefs::kProxy, + ProxyConfigDictionary::CreateFixedServers( + server->host_port_pair().ToString(), "")); + ProfileNetworkContextServiceFactory::GetForContext(browser()->profile()) + ->FlushProxyConfigMonitorForTesting(); + + EXPECT_EQ(true, content::EvalJs(web_contents(), R"( + fetch("/defaultresponse").then(response => response.ok) + )")); +} + // ==================== // SPECIAL SCHEME TESTS // ====================
diff --git a/chrome/browser/offline_pages/background_loader_offliner.cc b/chrome/browser/offline_pages/background_loader_offliner.cc index 55ef46a1..17d3369 100644 --- a/chrome/browser/offline_pages/background_loader_offliner.cc +++ b/chrome/browser/offline_pages/background_loader_offliner.cc
@@ -489,7 +489,7 @@ void BackgroundLoaderOffliner::AttachObservers() { content::WebContents* contents = loader_->web_contents(); content::WebContentsObserver::Observe(contents); - OfflinerUserData::AddToWebContents(contents, this); + OfflinerUserData::CreateForWebContents(contents, this); } void BackgroundLoaderOffliner::AddLoadingSignal(const char* signal_name) {
diff --git a/chrome/browser/offline_pages/offliner_user_data.cc b/chrome/browser/offline_pages/offliner_user_data.cc index 1b61fd3..1232ff77e4 100644 --- a/chrome/browser/offline_pages/offliner_user_data.cc +++ b/chrome/browser/offline_pages/offliner_user_data.cc
@@ -8,12 +8,10 @@ namespace offline_pages { -void OfflinerUserData::AddToWebContents(content::WebContents* webcontents, - BackgroundLoaderOffliner* offliner) { - DCHECK(offliner); - webcontents->SetUserData(UserDataKey(), - std::make_unique<OfflinerUserData>(offliner)); -} +OfflinerUserData::OfflinerUserData(content::WebContents* web_contents, + BackgroundLoaderOffliner* offliner) + : content::WebContentsUserData<OfflinerUserData>(*web_contents), + offliner_(offliner) {} // static - gets the data pointer as a BackgroundLoaderOffliner BackgroundLoaderOffliner* OfflinerUserData::OfflinerFromWebContents(
diff --git a/chrome/browser/offline_pages/offliner_user_data.h b/chrome/browser/offline_pages/offliner_user_data.h index f464c3932..8aa7d953 100644 --- a/chrome/browser/offline_pages/offliner_user_data.h +++ b/chrome/browser/offline_pages/offliner_user_data.h
@@ -14,22 +14,20 @@ class OfflinerUserData : public content::WebContentsUserData<OfflinerUserData> { public: - static void AddToWebContents(content::WebContents* webcontents, - BackgroundLoaderOffliner* offliner); - static BackgroundLoaderOffliner* OfflinerFromWebContents( content::WebContents* webcontents); static ResourceLoadingObserver* ResourceLoadingObserverFromWebContents( content::WebContents* webcontents); - explicit OfflinerUserData(BackgroundLoaderOffliner* offliner) { - offliner_ = offliner; - } BackgroundLoaderOffliner* offliner() { return offliner_; } private: friend class content::WebContentsUserData<OfflinerUserData>; + + OfflinerUserData(content::WebContents* web_contents, + BackgroundLoaderOffliner* offliner); + // The offliner that the WebContents is attached to. The offliner owns the // Delegate which owns the WebContents that this data is attached to. // Therefore, its lifetime should exceed that of the WebContents, so this
diff --git a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc index 72295ec507..9f548f6d 100644 --- a/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc +++ b/chrome/browser/optimization_guide/optimization_guide_keyed_service.cc
@@ -13,6 +13,7 @@ #include "base/task/task_traits.h" #include "base/task/thread_pool.h" #include "build/build_config.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/optimization_guide/chrome_hints_manager.h"
diff --git a/chrome/browser/platform_util.cc b/chrome/browser/platform_util.cc index b3f5823..9b8fa23 100644 --- a/chrome/browser/platform_util.cc +++ b/chrome/browser/platform_util.cc
@@ -9,6 +9,7 @@ #include "base/files/file.h" #include "base/files/file_util.h" #include "base/task/thread_pool.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/platform_util_internal.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h"
diff --git a/chrome/browser/policy/system_features_disable_list_policy_handler.cc b/chrome/browser/policy/system_features_disable_list_policy_handler.cc index 831632a1..4a5b5fdc 100644 --- a/chrome/browser/policy/system_features_disable_list_policy_handler.cc +++ b/chrome/browser/policy/system_features_disable_list_policy_handler.cc
@@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/metrics/histogram_functions.h" #include "base/values.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/web_applications/web_app_id_constants.h" #include "components/policy/core/common/policy_pref_names.h" #include "components/policy/policy_constants.h"
diff --git a/chrome/browser/policy/system_features_disable_list_policy_handler_unittest.cc b/chrome/browser/policy/system_features_disable_list_policy_handler_unittest.cc index 07d6dc95..2ec1c73 100644 --- a/chrome/browser/policy/system_features_disable_list_policy_handler_unittest.cc +++ b/chrome/browser/policy/system_features_disable_list_policy_handler_unittest.cc
@@ -7,6 +7,7 @@ #include "base/test/metrics/histogram_tester.h" #include "base/values.h" +#include "build/chromeos_buildflags.h" #include "components/policy/core/common/policy_map.h" #include "components/policy/core/common/policy_pref_names.h" #include "components/policy/core/common/policy_types.h"
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index 8834b6ac..079d3be96 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -186,6 +186,7 @@ #include "chrome/browser/ash/net/system_proxy_manager.h" #include "chrome/browser/ash/platform_keys/key_permissions/key_permissions_manager_impl.h" #include "chrome/browser/ash/policy/networking/euicc_status_uploader.h" +#include "chrome/browser/ash/settings/hardware_data_usage_controller.h" #include "chrome/browser/ash/settings/stats_reporting_controller.h" #include "chrome/browser/chromeos/extensions/extensions_permissions_tracker.h" #include "chrome/browser/component_updater/metadata_table_chromeos.h" @@ -1006,6 +1007,7 @@ ash::device_activity::DeviceActivityController::RegisterPrefs(registry); chromeos::EnableDebuggingScreenHandler::RegisterPrefs(registry); chromeos::FastTransitionObserver::RegisterPrefs(registry); + ash::HWDataUsageController::RegisterLocalStatePrefs(registry); ash::KerberosCredentialsManager::RegisterLocalStatePrefs(registry); ash::KioskAppManager::RegisterPrefs(registry); ash::KioskCryptohomeRemover::RegisterPrefs(registry);
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.cc b/chrome/browser/profiles/off_the_record_profile_impl.cc index 801a023..059eb9b 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.cc +++ b/chrome/browser/profiles/off_the_record_profile_impl.cc
@@ -372,10 +372,6 @@ return GetOriginalProfile()->GetExtensionSpecialStoragePolicy(); } -bool OffTheRecordProfileImpl::IsSupervised() const { - return profile_->IsSupervised(); -} - bool OffTheRecordProfileImpl::IsChild() const { // TODO(treib): If we ever allow incognito for child accounts, evaluate // whether we want to just return false here.
diff --git a/chrome/browser/profiles/off_the_record_profile_impl.h b/chrome/browser/profiles/off_the_record_profile_impl.h index 77d150b..8985b2d8 100644 --- a/chrome/browser/profiles/off_the_record_profile_impl.h +++ b/chrome/browser/profiles/off_the_record_profile_impl.h
@@ -52,7 +52,6 @@ bool HasAnyOffTheRecordProfile() override; Profile* GetOriginalProfile() override; const Profile* GetOriginalProfile() const override; - bool IsSupervised() const override; bool IsChild() const override; bool AllowsBrowserWindows() const override; ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
diff --git a/chrome/browser/profiles/profile.h b/chrome/browser/profiles/profile.h index 1466666..641a244 100644 --- a/chrome/browser/profiles/profile.h +++ b/chrome/browser/profiles/profile.h
@@ -287,9 +287,6 @@ // profile is not OffTheRecord. virtual const Profile* GetOriginalProfile() const = 0; - // Returns whether the profile is supervised (either a legacy supervised - // user or a child account; see SupervisedUserService). - virtual bool IsSupervised() const = 0; // Returns whether the profile is associated with a child account. virtual bool IsChild() const = 0;
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index a33a449..98c0522 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc
@@ -1036,10 +1036,6 @@ return this; } -bool ProfileImpl::IsSupervised() const { - return !GetPrefs()->GetString(prefs::kSupervisedUserId).empty(); -} - bool ProfileImpl::IsChild() const { #if BUILDFLAG(ENABLE_SUPERVISED_USERS) return GetPrefs()->GetString(prefs::kSupervisedUserId) ==
diff --git a/chrome/browser/profiles/profile_impl.h b/chrome/browser/profiles/profile_impl.h index d6f7f4319..e406fc2b7 100644 --- a/chrome/browser/profiles/profile_impl.h +++ b/chrome/browser/profiles/profile_impl.h
@@ -121,7 +121,6 @@ bool HasAnyOffTheRecordProfile() override; Profile* GetOriginalProfile() override; const Profile* GetOriginalProfile() const override; - bool IsSupervised() const override; bool IsChild() const override; bool AllowsBrowserWindows() const override; ExtensionSpecialStoragePolicy* GetExtensionSpecialStoragePolicy() override;
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc index 8c3fabf..ba53f111 100644 --- a/chrome/browser/profiles/profile_metrics.cc +++ b/chrome/browser/profiles/profile_metrics.cc
@@ -471,7 +471,7 @@ #endif // defined(OS_ANDROID) void ProfileMetrics::LogProfileLaunch(Profile* profile) { - if (profile->IsSupervised()) { + if (profile->IsChild()) { base::RecordAction( base::UserMetricsAction("ManagedMode_NewManagedUserWindow")); }
diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn index 282d39f..744d9f81 100644 --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn
@@ -293,6 +293,7 @@ "privacy_page/disable_safebrowsing_dialog.ts", "privacy_page/privacy_review/privacy_review_clear_on_exit_fragment.ts", "privacy_page/privacy_review/privacy_review_completion_fragment.ts", + "privacy_page/privacy_review/privacy_review_completion_link_row.ts", "privacy_page/privacy_review/privacy_review_cookies_fragment.ts", "privacy_page/privacy_review/privacy_review_description_item.ts", "privacy_page/privacy_review/privacy_review_fragment_shared_css.ts", @@ -656,6 +657,7 @@ "privacy_page/privacy_review/privacy_review_browser_proxy.ts", "privacy_page/privacy_review/privacy_review_clear_on_exit_fragment.ts", "privacy_page/privacy_review/privacy_review_completion_fragment.ts", + "privacy_page/privacy_review/privacy_review_completion_link_row.ts", "privacy_page/privacy_review/privacy_review_cookies_fragment.ts", "privacy_page/privacy_review/privacy_review_description_item.ts", "privacy_page/privacy_review/privacy_review_fragment_shared_css.ts",
diff --git a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html index dc011fa..557d9af 100644 --- a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html +++ b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.html
@@ -48,6 +48,8 @@ [[getStorageDetailsMessage_(dialogMode_)]] </div> <select class="md-select" id="storePicker" + autofocus="[[shouldShowStorePicker_(isAccountStoreUser, + dialogMode_)]]" aria-description="$i18n{addPasswordStorePickerA11yDescription}" hidden="[[!shouldShowStorePicker_(isAccountStoreUser, dialogMode_)]]"> @@ -60,6 +62,8 @@ </select> <cr-input id="websiteInput" label="$i18n{editPasswordWebsiteLabel}" class$="[[getClassForWebsiteInput_(websiteInputErrorMessage_)]]" + autofocus="[[shouldAutofocusWebsiteInput_(isAccountStoreUser, + dialogMode_)]]" value="[[getWebsite_(dialogMode_, existingEntry.urls.link)]]" on-blur="onWebsiteInputBlur_" placeholder="example.com" on-input="validateWebsite_"
diff --git a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts index 7c914b0..ebc6c6b2 100644 --- a/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts +++ b/chrome/browser/resources/settings/autofill_page/password_edit_dialog.ts
@@ -54,6 +54,31 @@ ADD = 'add', } +/** + * Represents different user interactions related to adding credential from the + * settings. Should be kept in sync with + * |metrics_util::AddCredentialFromSettingsUserInteractions|. These values are + * persisted to logs. Entries should not be renumbered and numeric values should + * never be reused. + */ +export enum AddCredentialFromSettingsUserInteractions { + // Used when the add credential dialog is opened from the settings. + Add_Dialog_Opened = 0, + // Used when the add credential dialog is closed from the settings. + Add_Dialog_Closed = 1, + // Used when a new credential is added from the settings . + Credential_Added = 2, + // Used when a new credential is being added from the add credential dialog in + // settings and another credential exists with the same username/website + // combination. + Duplicated_Credential_Entered = 3, + // Used when an existing credential is viewed while adding a new credential + // from the settings. + Duplicate_Credential_Viewed = 4, + // Must be last. + COUNT = 5, +} + /* TODO(crbug.com/1255127): Revisit usage for 3 different modes. */ export class PasswordEditDialogElement extends PasswordEditDialogElementBase { static get is() { @@ -434,6 +459,11 @@ return this.dialogMode_ === PasswordDialogMode.ADD; } + private shouldAutofocusWebsiteInput_(): boolean { + return this.dialogMode_ === PasswordDialogMode.ADD && + !this.isAccountStoreUser; + } + /** * @return The text to be displayed as the dialog's footnote. */ @@ -489,6 +519,10 @@ } private onViewExistingPasswordClick_() { + chrome.metricsPrivate.recordEnumerationValue( + 'AddCredentialFromSettingsUserInteractions', + AddCredentialFromSettingsUserInteractions.Duplicate_Credential_Viewed, + AddCredentialFromSettingsUserInteractions.COUNT); const existingEntry = this.savedPasswords.find(entry => { return entry.urls.origin === this.websiteUrls_!.origin && entry.username === this.username_; @@ -535,9 +569,19 @@ return false; } // TODO(crbug.com/1264468): Consider moving duplication check to backend. - return this.usernamesByOrigin_.has(this.websiteUrls_.origin) && + const isDuplicate = this.usernamesByOrigin_.has(this.websiteUrls_.origin) && this.usernamesByOrigin_.get(this.websiteUrls_.origin)!.has( this.username_); + + if (isDuplicate && this.dialogMode_ === PasswordDialogMode.ADD) { + chrome.metricsPrivate.recordEnumerationValue( + 'AddCredentialFromSettingsUserInteractions', + AddCredentialFromSettingsUserInteractions + .Duplicated_Credential_Entered, + AddCredentialFromSettingsUserInteractions.COUNT); + } + + return isDuplicate; } /**
diff --git a/chrome/browser/resources/settings/autofill_page/passwords_section.ts b/chrome/browser/resources/settings/autofill_page/passwords_section.ts index 0970bab..51d58de 100644 --- a/chrome/browser/resources/settings/autofill_page/passwords_section.ts +++ b/chrome/browser/resources/settings/autofill_page/passwords_section.ts
@@ -56,6 +56,7 @@ import {MultiStoreExceptionEntry} from './multi_store_exception_entry.js'; import {MultiStorePasswordUiEntry} from './multi_store_password_ui_entry.js'; import {PasswordCheckMixin} from './password_check_mixin.js'; +import {AddCredentialFromSettingsUserInteractions} from './password_edit_dialog.js'; import {PasswordCheckReferrer, PasswordExceptionListChangedListener, PasswordManagerImpl, PasswordManagerProxy} from './password_manager_proxy.js'; import {PasswordsListHandlerElement} from './passwords_list_handler.js'; @@ -615,12 +616,20 @@ } private onAddPasswordTap_() { + chrome.metricsPrivate.recordEnumerationValue( + 'AddCredentialFromSettingsUserInteractions', + AddCredentialFromSettingsUserInteractions.Add_Dialog_Opened, + AddCredentialFromSettingsUserInteractions.COUNT); this.showAddPasswordDialog_ = true; this.activeDialogAnchorStack_.push( this.shadowRoot!.querySelector('#addPasswordButton')!); } private onAddPasswordDialogClosed_() { + chrome.metricsPrivate.recordEnumerationValue( + 'AddCredentialFromSettingsUserInteractions', + AddCredentialFromSettingsUserInteractions.Add_Dialog_Closed, + AddCredentialFromSettingsUserInteractions.COUNT); this.showAddPasswordDialog_ = false; focusWithoutInk(assert(this.activeDialogAnchorStack_.pop()!)); }
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/BUILD.gn b/chrome/browser/resources/settings/privacy_page/privacy_review/BUILD.gn index 3648e32..468a5d4a 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/BUILD.gn +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/BUILD.gn
@@ -8,6 +8,7 @@ js_files = [ "privacy_review_clear_on_exit_fragment.ts", "privacy_review_completion_fragment.ts", + "privacy_review_completion_link_row.ts", "privacy_review_cookies_fragment.ts", "privacy_review_description_item.ts", "privacy_review_fragment_shared_css.ts",
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.html index 03535d99..e32d07c 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.html
@@ -10,23 +10,11 @@ flex: 1; flex-direction: column; justify-content: space-between; - padding: 36px 120px var(--cr-section-padding) 120px; + padding: 36px 120px 16px 120px; row-gap: 8px; text-align: center; } - .info-row { - align-items: center; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - justify-content: space-between; - } - - .info-row-description { - flex: 1; - } - .footer { align-items: center; display: flex; @@ -46,35 +34,25 @@ $i18n{privacyReviewCompletionCardSubHeader} </div> </div> -<div id="privacySandboxRow" class="info-row"> - <picture> - <source - srcset="./images/privacy_review/privacy_sandbox_graphic_dark.svg" - media="(prefers-color-scheme: dark)"> - <img alt="" src="./images/privacy_review/privacy_sandbox_graphic.svg"> - </picture> - <cr-link-row class="info-row-description" external - label="$i18n{privacyReviewCompletionCardPrivacySandboxLabel}" - sub-label="$i18n{privacyReviewCompletionCardPrivacySandboxSubLabel}" - on-click="onPrivacySandboxClick_" - role-description="$i18n{subpageArrowRoleDescription}"></cr-link-row> - <a id="privacySandboxLink" href="privacySandbox" - target="_blank" tabindex="-1" aria-disabled="true" - role="none"></a> -</div> -<div id="waaRow" class="info-row" hidden="[[!shouldShowWaa_]]"> - <picture> - <source - srcset="./images/privacy_review/waa_graphic_dark.svg" - media="(prefers-color-scheme: dark)"> - <img alt="" src="./images/privacy_review/waa_graphic.svg"> - </picture> - <cr-link-row class="info-row-description" external +<privacy-review-completion-link-row id="privacySandboxRow" + label="$i18n{privacyReviewCompletionCardPrivacySandboxLabel}" + sub-label="$i18n{privacyReviewCompletionCardPrivacySandboxSubLabel}" + light-img-src="./images/privacy_review/privacy_sandbox_graphic.svg" + dark-img-src="./images/privacy_review/privacy_sandbox_graphic_dark.svg" + on-click="onPrivacySandboxClick_"> +</privacy-review-completion-link-row> +<a id="privacySandboxLink" href="privacySandbox" + target="_blank" tabindex="-1" aria-disabled="true" + role="none"></a> +<template is="dom-if" if="[[shouldShowWaa_]]"> + <privacy-review-completion-link-row id="waaRow" label="$i18n{privacyReviewCompletionCardWaaLabel}" sub-label="$i18n{privacyReviewCompletionCardWaaSubLabel}" - on-click="onWaaClick_" - role-description="$i18n{subpageArrowRoleDescription}"></cr-link-row> -</div> + light-img-src="./images/privacy_review/waa_graphic.svg" + dark-img-src="./images/privacy_review/waa_graphic_dark.svg" + on-click="onWaaClick_"> + </privacy-review-completion-link-row> +</template> <div class="footer"> <cr-button id="backButton" role="button" on-click="onBackButtonClick_"> $i18n{privacyReviewBackButton}
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.ts b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.ts index b5c17875..aec31457 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.ts +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_fragment.ts
@@ -9,6 +9,7 @@ */ import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_link_row/cr_link_row.js'; +import './privacy_review_completion_link_row.js'; import './privacy_review_fragment_shared_css.js'; import {WebUIListenerMixin} from 'chrome://resources/js/web_ui_listener_mixin.js';
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_link_row.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_link_row.html new file mode 100644 index 0000000..32d332a --- /dev/null +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_link_row.html
@@ -0,0 +1,30 @@ +<style include="cr-shared-style cr-actionable-row-style"> + #labelWrapper { + flex: 1; + padding-inline-start: 16px; + } + + #label { + font-size: 0.875rem; /* 14px */ + padding-bottom: 4px; + } + + cr-icon-button { + --cr-icon-button-icon-size: 24px; + } +</style> +<picture> + <source srcset="[[darkImgSrc]]" media="(prefers-color-scheme: dark)"> + <img alt="" src="[[lightImgSrc]]"> +</picture> +<div id="labelWrapper" class="cr-padded-text"> + <div id="label" aria-hidden="true">[[label]]</div> + <div id="subLabel" class="cr-secondary-text" aria-hidden="true"> + [[subLabel]] + </div> +</div> +<cr-icon-button iron-icon="cr:open-in-new" + aria-describedby="subLabel" + aria-labelledby="label" + aria-roledescription$="$i18n{subpageArrowRoleDescription}"> +</cr-icon-button> \ No newline at end of file
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_link_row.ts b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_link_row.ts new file mode 100644 index 0000000..28330d0d --- /dev/null +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_completion_link_row.ts
@@ -0,0 +1,45 @@ +// Copyright 2021 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. + +/** + * @fileoverview + * 'privacy-review-completion-link-row' is the custom link row element for the + * privacy review completion card. + */ +import 'chrome://resources/cr_elements/cr_actionable_row_style.m.js'; +import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; +import 'chrome://resources/cr_elements/shared_style_css.m.js'; +import 'chrome://resources/cr_elements/shared_vars_css.m.js'; + +import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +export class PrivacyReviewCompletionLinkRowElement extends PolymerElement { + static get is() { + return 'privacy-review-completion-link-row'; + } + + static get template() { + return html`{__html_template__}`; + } + + static get properties() { + return { + // Primary label of the link row. + label: String, + + // Secondary label of the link row. + subLabel: String, + + // The light mode source for the image of the link row. + lightImgSrc: String, + + // The dark mode source for the image of the link row. + darkImgSrc: String, + }; + } +} + +customElements.define( + PrivacyReviewCompletionLinkRowElement.is, + PrivacyReviewCompletionLinkRowElement); \ No newline at end of file
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_fragment_shared_css.html b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_fragment_shared_css.html index d1a16c7..251914c 100644 --- a/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_fragment_shared_css.html +++ b/chrome/browser/resources/settings/privacy_page/privacy_review/privacy_review_fragment_shared_css.html
@@ -21,7 +21,7 @@ @media (prefers-color-scheme: dark) { .description-header { - color: var(--google-blue-300); + color: var(--google-blue-refresh-300); } }
diff --git a/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.ts b/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.ts index c9a62d8..f622fabe 100644 --- a/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.ts +++ b/chrome/browser/resources/settings/privacy_page/security_keys_credential_management_dialog.ts
@@ -246,11 +246,11 @@ break; case CredentialManagementDialogPage.CONFIRM: this.cancelButtonVisible_ = true; - this.confirmButtonLabel_ = this.i18n('continue'); + this.confirmButtonLabel_ = this.i18n('delete'); this.confirmButtonVisible_ = true; this.closeButtonVisible_ = false; this.dialogTitle_ = - this.i18n('securityKeysCredentialManagementDialogTitle'); + this.i18n('securityKeysCredentialManagementConfirmDeleteTitle'); break; default: assertNotReached();
diff --git a/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.html b/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.html index 3be038f..7753f2d2 100644 --- a/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.html +++ b/chrome/browser/resources/signin/sync_confirmation/sync_confirmation_app.html
@@ -4,7 +4,7 @@ --banner-height: 244px; --banner-size: auto; --confirmation-description-margin-inline: auto; - --content-container-margin-bottom: calc(48px + var(--footer-margin)); + --content-container-margin-bottom: calc(32px + 2 * var(--footer-margin)); --content-container-margin-top: 104px; --footer-margin: 40px; --text-font-size: 1.16em; @@ -113,6 +113,14 @@ width: 512px; } + /* Makes the absolutely positioned footer relative to confirmationContainer + which may be larger than the window. */ + #confirmationContainer { + min-height: 100%; + position: absolute; + width: 100%; + } + #headerContainer { background-color: var(--theme-frame-color); height: var(--banner-height); @@ -285,49 +293,51 @@ </template> <template is="dom-if" if="[[isNewDesign_]]"> - <div id="headerContainer" style$="--theme-frame-color:[[highlightColor_]]"> - <div id="syncPromoBanner"></div> - <div id="avatarContainer"> - <img id="avatar" alt="" src="[[accountImageSrc_]]"> - <div class="work-badge" hidden="[[!showEnterpriseBadge_]]"> - <iron-icon class="icon" icon="cr:domain"></iron-icon> + <div id="confirmationContainer"> + <div id="headerContainer" style$="--theme-frame-color:[[highlightColor_]]"> + <div id="syncPromoBanner"></div> + <div id="avatarContainer"> + <img id="avatar" alt="" src="[[accountImageSrc_]]"> + <div class="work-badge" hidden="[[!showEnterpriseBadge_]]"> + <iron-icon class="icon" icon="cr:domain"></iron-icon> + </div> </div> </div> - </div> - <div id="contentContainer"> - <h2 consent-description id="syncConfirmationHeading"> - $i18n{syncConfirmationTitle} - </h2> - <div id="confirmationDescription" class="secondary"> - <span consent-description>$i18n{syncConfirmationSyncInfoTitle}</span>. - <span> - $i18n{syncConfirmationSettingsInfo} - </span> - <span consent-description>$i18n{syncConfirmationSyncInfoDesc}</span>. + <div id="contentContainer"> + <h2 consent-description id="syncConfirmationHeading"> + $i18n{syncConfirmationTitle} + </h2> + <div id="confirmationDescription" class="secondary"> + <span consent-description>$i18n{syncConfirmationSyncInfoTitle}</span>. + <span> + $i18n{syncConfirmationSettingsInfo} + </span> + <span consent-description>$i18n{syncConfirmationSyncInfoDesc}</span>. + </div> </div> - </div> - <div id="buttonsContainer" class="action-container"> - <cr-button class="action-button" id="confirmButton" - on-click="onConfirm_" consent-confirmation> - $i18n{syncConfirmationConfirmLabel} - </cr-button> - <if expr="is_macosx or is_linux"> - <cr-button id="settingsButton" on-click="onGoToSettings_" - consent-confirmation> - $i18n{syncConfirmationSettingsLabel} + <div id="buttonsContainer" class="action-container"> + <cr-button class="action-button" id="confirmButton" + on-click="onConfirm_" consent-confirmation> + $i18n{syncConfirmationConfirmLabel} </cr-button> - </if> - <if expr="not lacros"> - <cr-button id="notNowButton" on-click="onUndo_"> - $i18n{syncConfirmationUndoLabel} - </cr-button> - </if> - <if expr="not is_macosx and not is_linux"> - <cr-button id="settingsButton" on-click="onGoToSettings_" - consent-confirmation> - $i18n{syncConfirmationSettingsLabel} - </cr-button> - </if> + <if expr="is_macosx or is_linux"> + <cr-button id="settingsButton" on-click="onGoToSettings_" + consent-confirmation> + $i18n{syncConfirmationSettingsLabel} + </cr-button> + </if> + <if expr="not lacros"> + <cr-button id="notNowButton" on-click="onUndo_"> + $i18n{syncConfirmationUndoLabel} + </cr-button> + </if> + <if expr="not is_macosx and not is_linux"> + <cr-button id="settingsButton" on-click="onGoToSettings_" + consent-confirmation> + $i18n{syncConfirmationSettingsLabel} + </cr-button> + </if> + </div> </div> </template>
diff --git a/chrome/browser/resources/tab_search/BUILD.gn b/chrome/browser/resources/tab_search/BUILD.gn index 9b2474c0..22f3cc85 100644 --- a/chrome/browser/resources/tab_search/BUILD.gn +++ b/chrome/browser/resources/tab_search/BUILD.gn
@@ -52,31 +52,26 @@ ] input_files_base_dir = rebase_path(".", "//") + deps = [ ":build_fuse_grdp" ] + grdp_files = [ "$target_gen_dir/fuse_resources.grdp" ] + if (optimize_webui) { - deps = [ - ":build", - ":build_fuse_grdp", - ] + deps += [ ":build" ] manifest_files = [ "$target_gen_dir/$build_manifest" ] resource_path_rewrites = [ "tab_search.rollup.js|tab_search.js" ] - - # Need to manually include fuse.js in the grd since it is excluded from the - # rollup bundle. - grdp_files = [ "$target_gen_dir/fuse_resources.grdp" ] } else { - deps = [ ":build_ts" ] + deps += [ ":build_ts" ] manifest_files = [ "$target_gen_dir/tsconfig.manifest" ] } } -if (optimize_webui) { - generate_grd("build_fuse_grdp") { - grd_prefix = "tab_search" - out_grd = "$target_gen_dir/fuse_resources.grdp" - input_files = [ "fuse.js" ] - input_files_base_dir = rebase_path("$target_gen_dir/tsc", root_build_dir) - deps = [ ":build_ts" ] - } +generate_grd("build_fuse_grdp") { + grd_prefix = "tab_search" + out_grd = "$target_gen_dir/fuse_resources.grdp" + input_files = [ "fuse.js" ] + input_files_base_dir = + rebase_path("$target_gen_dir/$preprocess_folder", root_build_dir) + deps = [ ":copy_fuse_dts" ] } preprocess_if_expr("preprocess") { @@ -125,6 +120,13 @@ outputs = [ "$target_gen_dir/$preprocess_folder/{{source_file_part}}" ] } +# Work-around for https://github.com/microsoft/TypeScript/issues/47035, so +# that the manually provided fuse.d.ts file prevails. +copy("copy_fuse_dts_tsc") { + sources = [ "//third_party/fusejs/dist/fuse.d.ts" ] + outputs = [ "$target_gen_dir/tsc/{{source_file_part}}" ] +} + preprocess_if_expr("preprocess_mojo_tab_groups") { deps = [ "//components/tab_groups/public/mojom:mojo_bindings_webui_js" ] in_folder = "$root_gen_dir/mojom-webui/components/tab_groups/public/mojom/" @@ -170,11 +172,11 @@ ts_library("build_ts") { root_dir = "$target_gen_dir/$preprocess_folder" out_dir = "$target_gen_dir/tsc" + composite = true tsconfig_base = "tsconfig_base.json" in_files = [ "app.ts", "bimap.ts", - "fuse.js", "fuzzy_search.ts", "infinite_list.ts", "tab_data.ts", @@ -191,7 +193,10 @@ "tabs.mojom-webui.js", "title_item.ts", ] - definitions = [ "//tools/typescript/definitions/metrics_private.d.ts" ] + definitions = [ + "//tools/typescript/definitions/metrics_private.d.ts", + "$target_gen_dir/$preprocess_folder/fuse.d.ts", + ] deps = [ "//third_party/polymer/v3_0:library", @@ -201,6 +206,7 @@ extra_deps = [ ":copy_fuse", ":copy_fuse_dts", + ":copy_fuse_dts_tsc", ":preprocess", ":preprocess_mojo", ":preprocess_mojo_tab_groups",
diff --git a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc index 98859b6..4dc73478 100644 --- a/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_navigation_observer_browsertest.cc
@@ -1238,7 +1238,7 @@ blank_url, // original_request_url blank_url, // destination_url false, // is_user_initiated, - false, // has_committed + true, // has_committed false, // has_server_redirect nav_list->GetNavigationEvent(2)); EXPECT_EQ(nav_list->GetNavigationEvent(2)->source_tab_id, @@ -1331,7 +1331,7 @@ blank_url, // original_request_url blank_url, // destination_url false, // is_user_initiated, - false, // has_committed + true, // has_committed false, // has_server_redirect nav_list->GetNavigationEvent(2)); EXPECT_EQ(nav_list->GetNavigationEvent(2)->source_tab_id, @@ -1599,7 +1599,7 @@ blank_url, // original_request_url blank_url, // destination_url false, // is_user_initiated, - false, // has_committed + true, // has_committed false, // has_server_redirect nav_list->GetNavigationEvent(5)); VerifyNavigationEvent(blank_url, // source_url
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index ac182b7..4d42024 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -876,7 +876,10 @@ // Run javascript in the blank new tab to load the malware image. EXPECT_CALL(observer_, OnSafeBrowsingHit(IsUnsafeResourceFor(img_url))) .Times(1); - content::TestNavigationObserver observer(new_tab_contents); + // Wait for 2 navigations to finish: the synchronous about:blank commit + // triggered by the window.open() above, and the interstitial page navigation + // triggered by Safe Browsing code for the image load below. + content::TestNavigationObserver observer(new_tab_contents, 2); new_tab_rfh->ExecuteJavaScriptForTests( u"var img=new Image();" u"img.src=\"" + @@ -891,8 +894,9 @@ EXPECT_TRUE(got_hit_report()); EXPECT_EQ(img_url, hit_report().malicious_url); EXPECT_TRUE(hit_report().is_subresource); - // Page report URLs should be empty, since there is no URL for this page. - EXPECT_EQ(GURL(), hit_report().page_url); + // Page report URLs should be about:blank, as the last committed navigation is + // the synchronous about:blank commit. + EXPECT_EQ(GURL(url::kAboutBlankURL), hit_report().page_url); EXPECT_EQ(GURL(), hit_report().referrer_url); // Proceed through it.
diff --git a/chrome/browser/sessions/exit_type_service_factory.cc b/chrome/browser/sessions/exit_type_service_factory.cc index 9abdd2d..8613b78 100644 --- a/chrome/browser/sessions/exit_type_service_factory.cc +++ b/chrome/browser/sessions/exit_type_service_factory.cc
@@ -4,6 +4,7 @@ #include "chrome/browser/sessions/exit_type_service_factory.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sessions/exit_type_service.h" #include "chrome/common/buildflags.h"
diff --git a/chrome/browser/sessions/session_restore_browsertest.cc b/chrome/browser/sessions/session_restore_browsertest.cc index 28c3a27c..bfee55b7 100644 --- a/chrome/browser/sessions/session_restore_browsertest.cc +++ b/chrome/browser/sessions/session_restore_browsertest.cc
@@ -2472,6 +2472,10 @@ old_popup->GetMainFrame()->GetLastCommittedOrigin()); } + // Do a document.open() so that the initial empty document's history entry + // won't get replaced. + EXPECT_TRUE(ExecJs(old_popup, "document.open();")); + // Navigate the popup to another site. GURL other_url = embedded_test_server()->GetURL("bar.com", "/title1.html"); url::Origin other_origin = url::Origin::Create(other_url);
diff --git a/chrome/browser/sessions/tab_restore_browsertest.cc b/chrome/browser/sessions/tab_restore_browsertest.cc index d740f28..97b0a08a 100644 --- a/chrome/browser/sessions/tab_restore_browsertest.cc +++ b/chrome/browser/sessions/tab_restore_browsertest.cc
@@ -1760,6 +1760,10 @@ old_popup->GetMainFrame()->GetLastCommittedOrigin()); } + // Do a document.open() so that the initial empty document's history entry + // won't get replaced. + EXPECT_TRUE(ExecJs(old_popup, "document.open();")); + // Navigate the popup to another site. GURL other_url = embedded_test_server()->GetURL("bar.com", "/title1.html"); url::Origin other_origin = url::Origin::Create(other_url);
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java index 12f466f9..32897aa 100644 --- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java +++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProvider.java
@@ -25,6 +25,7 @@ import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.profiles.Profile; +import org.chromium.chrome.browser.share.ChromeShareExtras.DetailedContentType; import org.chromium.chrome.browser.share.SaveBitmapDelegate; import org.chromium.chrome.browser.share.link_to_text.LinkToTextCoordinator.LinkGeneration; import org.chromium.chrome.browser.share.long_screenshots.LongScreenshotsCoordinator; @@ -133,6 +134,7 @@ private static class FirstPartyOption { final Collection<Integer> mContentTypes; final Collection<Integer> mContentTypesToDisableFor; + final Collection<Integer> mDetailedContentTypesToDisableFor; final PropertyModel mPropertyModel; final boolean mDisableForMultiWindow; @@ -143,13 +145,17 @@ * @param model Property model for the first party option. * @param contentTypes Content types to trigger for. * @param contentTypesToDisableFor Content types to disable for. + * @param detailedContentTypesToDisableFor {@link DetailedContentType}s to disable for. * @param disableForMultiWindow If the feature should be disabled if in multi-window mode. */ FirstPartyOption(PropertyModel model, Collection<Integer> contentTypes, - Collection<Integer> contentTypesToDisableFor, boolean disableForMultiWindow) { + Collection<Integer> contentTypesToDisableFor, + Collection<Integer> detailedContentTypesToDisableFor, + boolean disableForMultiWindow) { mPropertyModel = model; mContentTypes = contentTypes; mContentTypesToDisableFor = contentTypesToDisableFor; + mDetailedContentTypesToDisableFor = detailedContentTypesToDisableFor; mDisableForMultiWindow = disableForMultiWindow; } } @@ -162,6 +168,7 @@ private Callback<View> mOnClickCallback; private boolean mDisableForMultiWindow; private Integer[] mContentTypesToDisableFor; + private Integer[] mDetailedContentTypesToDisableFor; private final Integer[] mContentTypesInBuilder; private boolean mShowNewBadge; private boolean mHideBottomSheetContentOnTap = true; @@ -169,6 +176,7 @@ FirstPartyOptionBuilder(Integer... contentTypes) { mContentTypesInBuilder = contentTypes; mContentTypesToDisableFor = new Integer[] {}; + mDetailedContentTypesToDisableFor = new Integer[] {}; } FirstPartyOptionBuilder setIcon(int icon, int iconLabel) { @@ -197,6 +205,12 @@ return this; } + FirstPartyOptionBuilder setDetailedContentTypesToDisableFor( + Integer... detailedContentTypesToDisableFor) { + mDetailedContentTypesToDisableFor = detailedContentTypesToDisableFor; + return this; + } + FirstPartyOptionBuilder setDisableForMultiWindow(boolean disableForMultiWindow) { mDisableForMultiWindow = disableForMultiWindow; return this; @@ -228,7 +242,8 @@ callTargetChosenCallback(); }, mShowNewBadge); return new FirstPartyOption(model, Arrays.asList(mContentTypesInBuilder), - Arrays.asList(mContentTypesToDisableFor), mDisableForMultiWindow); + Arrays.asList(mContentTypesToDisableFor), + Arrays.asList(mDetailedContentTypesToDisableFor), mDisableForMultiWindow); } } @@ -237,15 +252,19 @@ * contentTypes} being shared. * * @param contentTypes a {@link Set} of {@link ContentType}. + * @param detailedContentType the {@link DetailedContentType} being shared. * @param isMultiWindow if in multi-window mode. * @return a list of {@link PropertyModel}s. */ - List<PropertyModel> getPropertyModels(Set<Integer> contentTypes, boolean isMultiWindow) { + List<PropertyModel> getPropertyModels(Set<Integer> contentTypes, + @DetailedContentType int detailedContentType, boolean isMultiWindow) { List<PropertyModel> propertyModels = new ArrayList<>(); for (FirstPartyOption firstPartyOption : mOrderedFirstPartyOptions) { if (!Collections.disjoint(contentTypes, firstPartyOption.mContentTypes) && Collections.disjoint( contentTypes, firstPartyOption.mContentTypesToDisableFor) + && !firstPartyOption.mDetailedContentTypesToDisableFor.contains( + detailedContentType) && !(isMultiWindow && firstPartyOption.mDisableForMultiWindow)) { propertyModels.add(firstPartyOption.mPropertyModel); } @@ -471,6 +490,7 @@ return new FirstPartyOptionBuilder(ContentType.IMAGE, ContentType.IMAGE_AND_LINK) .setIcon(R.drawable.save_to_device, R.string.sharing_save_image) .setFeatureNameForMetrics("SharingHubAndroid.SaveImageSelected") + .setDetailedContentTypesToDisableFor(DetailedContentType.LIGHTWEIGHT_REACTION) .setOnClickCallback((view) -> { if (mShareParams.getFileUris().isEmpty()) return;
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetCoordinator.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetCoordinator.java index d2703fa7..af5076b81 100644 --- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetCoordinator.java +++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/share_sheet/ShareSheetCoordinator.java
@@ -338,7 +338,7 @@ mIsMultiWindow = ApiCompatibilityUtils.isInMultiWindowMode(activity); return mChromeProvidedSharingOptionsProvider.getPropertyModels( - contentTypes, mIsMultiWindow); + contentTypes, chromeShareExtras.getDetailedContentType(), mIsMultiWindow); } private boolean shouldShowLinkToText(ChromeShareExtras chromeShareExtras) { @@ -633,8 +633,8 @@ mIsMultiWindow = isMultiWindow; mBottomSheet.createFirstPartyRecyclerViews( - mChromeProvidedSharingOptionsProvider.getPropertyModels( - mContentTypes, mIsMultiWindow)); + mChromeProvidedSharingOptionsProvider.getPropertyModels(mContentTypes, + mChromeShareExtras.getDetailedContentType(), mIsMultiWindow)); mBottomSheetController.requestShowContent(mBottomSheet, /*animate=*/false); }
diff --git a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProviderTest.java b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProviderTest.java index 1a91a42..c5cb8509 100644 --- a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProviderTest.java +++ b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/share_sheet/ChromeProvidedSharingOptionsProviderTest.java
@@ -145,6 +145,7 @@ List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( ShareSheetPropertyModelBuilder.ALL_CONTENT_TYPES_FOR_TEST, + DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/false); assertCorrectModelsAreInTheRightOrder(propertyModels, @@ -170,6 +171,7 @@ List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( ShareSheetPropertyModelBuilder.ALL_CONTENT_TYPES_FOR_TEST, + DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/false); assertCorrectModelsAreInTheRightOrder(propertyModels, @@ -193,7 +195,8 @@ /*printingEnabled=*/false, LinkGeneration.MAX); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( - ImmutableSet.of(ContentType.TEXT), /*isMultiWindow=*/false); + ImmutableSet.of(ContentType.TEXT), DetailedContentType.NOT_SPECIFIED, + /*isMultiWindow=*/false); assertCorrectModelsAreInTheRightOrder(propertyModels, ImmutableList.of(mActivity.getResources().getString(R.string.sharing_screenshot), @@ -211,6 +214,7 @@ mChromeProvidedSharingOptionsProvider.getPropertyModels( ImmutableSet.of(ContentType.LINK_AND_TEXT, ContentType.LINK_PAGE_NOT_VISIBLE, ContentType.TEXT), + DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/true); assertCorrectModelsAreInTheRightOrder(propertyModels, @@ -230,6 +234,7 @@ List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( ImmutableSet.of(ContentType.LINK_PAGE_NOT_VISIBLE), + DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/true); assertCorrectModelsAreInTheRightOrder(propertyModels, @@ -248,7 +253,7 @@ List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( - ImmutableSet.of(ContentType.TEXT), + ImmutableSet.of(ContentType.TEXT), DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/true); assertCorrectModelsAreInTheRightOrder(propertyModels, @@ -266,6 +271,7 @@ List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( ShareSheetPropertyModelBuilder.ALL_CONTENT_TYPES_FOR_TEST, + DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/true); assertCorrectModelsAreInTheRightOrder(propertyModels, @@ -288,6 +294,7 @@ List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( ImmutableSet.of(ContentType.LINK_PAGE_NOT_VISIBLE), + DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/false); assertCorrectModelsAreInTheRightOrder(propertyModels, @@ -306,6 +313,7 @@ List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( ImmutableSet.of(ContentType.LINK_PAGE_NOT_VISIBLE, ContentType.IMAGE), + DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/false); // Long Screenshots is supported >= Android N (7.0). @@ -327,6 +335,48 @@ @Test @MediumTest + public void getPropertyModels_nonLightweightReaction_doesNotFilterByDetailedContentType() { + setUpChromeProvidedSharingOptionsProviderTest( + /*printingEnabled=*/true, LinkGeneration.MAX); + List<PropertyModel> propertyModels = + mChromeProvidedSharingOptionsProvider.getPropertyModels( + ImmutableSet.of(ContentType.IMAGE), DetailedContentType.IMAGE, + /*isMultiWindow=*/false); + + List<String> expectedModels = new ArrayList<String>(); + expectedModels.add(mActivity.getResources().getString(R.string.sharing_screenshot)); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { + expectedModels.add( + mActivity.getResources().getString(R.string.sharing_long_screenshot)); + } + expectedModels.addAll(ImmutableList.of( + mActivity.getResources().getString(R.string.sharing_copy_image), + mActivity.getResources().getString(R.string.send_tab_to_self_share_activity_title), + mActivity.getResources().getString(R.string.qr_code_share_icon_label), + mActivity.getResources().getString(R.string.sharing_save_image))); + + assertCorrectModelsAreInTheRightOrder(propertyModels, expectedModels); + } + + @Test + @MediumTest + public void getPropertyModels_lightweightReaction_filtersByDetailedContentType() { + setUpChromeProvidedSharingOptionsProviderTest( + /*printingEnabled=*/true, LinkGeneration.MAX); + List<PropertyModel> propertyModels = + mChromeProvidedSharingOptionsProvider.getPropertyModels( + ImmutableSet.of(ContentType.IMAGE_AND_LINK), + DetailedContentType.LIGHTWEIGHT_REACTION, + /*isMultiWindow=*/false); + + List<String> expectedModels = new ArrayList<>(); + expectedModels.add(mActivity.getResources().getString(R.string.sharing_copy_image)); + + assertCorrectModelsAreInTheRightOrder(propertyModels, expectedModels); + } + + @Test + @MediumTest @Features.EnableFeatures({ChromeFeatureList.PREEMPTIVE_LINK_TO_TEXT_GENERATION}) @Features.DisableFeatures({ChromeFeatureList.CHROME_SHARE_LONG_SCREENSHOT}) public void getShareDetailsMetrics_LinkGeneration() { @@ -337,7 +387,8 @@ /*printingEnabled=*/false, linkGenerationStatus); List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( - ImmutableSet.of(ContentType.HIGHLIGHTED_TEXT), /*isMultiWindow=*/false); + ImmutableSet.of(ContentType.HIGHLIGHTED_TEXT), + DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/false); assertCorrectLinkGenerationMetrics(propertyModels, linkGenerationStatus); } @@ -350,7 +401,8 @@ List<PropertyModel> propertyModels = mChromeProvidedSharingOptionsProvider.getPropertyModels( - ImmutableSet.of(ContentType.LINK_PAGE_VISIBLE), /*isMultiWindow=*/false); + ImmutableSet.of(ContentType.LINK_PAGE_VISIBLE), + DetailedContentType.NOT_SPECIFIED, /*isMultiWindow=*/false); View.OnClickListener onClickListener = propertyModels.get(0).get(ShareSheetItemViewProperties.CLICK_LISTENER);
diff --git a/chrome/browser/speech/tts_crosapi_util.cc b/chrome/browser/speech/tts_crosapi_util.cc index 1d6864db..d87ebcb 100644 --- a/chrome/browser/speech/tts_crosapi_util.cc +++ b/chrome/browser/speech/tts_crosapi_util.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/speech/tts_crosapi_util.h" +#include "build/chromeos_buildflags.h" + namespace tts_crosapi_util { content::TtsEventType FromMojo(crosapi::mojom::TtsEventType mojo_event) {
diff --git a/chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc b/chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc index 671d51b4..d06fe74 100644 --- a/chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc +++ b/chrome/browser/supervised_user/supervised_user_navigation_throttle_browsertest.cc
@@ -18,6 +18,7 @@ #include "base/test/scoped_feature_list.h" #include "base/values.h" #include "build/build_config.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/ash/login/test/logged_in_user_mixin.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_key.h"
diff --git a/chrome/browser/supervised_user/web_approvals_manager.cc b/chrome/browser/supervised_user/web_approvals_manager.cc index 7df2fff6..2be040fc 100644 --- a/chrome/browser/supervised_user/web_approvals_manager.cc +++ b/chrome/browser/supervised_user/web_approvals_manager.cc
@@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/callback.h" #include "base/logging.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/supervised_user/permission_request_creator.h" #include "components/policy/core/browser/url_util.h" #include "url/gurl.h"
diff --git a/chrome/browser/support_tool/ash/ui_hierarchy_data_collector.cc b/chrome/browser/support_tool/ash/ui_hierarchy_data_collector.cc new file mode 100644 index 0000000..797dea5 --- /dev/null +++ b/chrome/browser/support_tool/ash/ui_hierarchy_data_collector.cc
@@ -0,0 +1,110 @@ +// Copyright 2021 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/support_tool/ash/ui_hierarchy_data_collector.h" + +#include <string> +#include <utility> +#include <vector> + +#include "ash/public/cpp/debug_utils.h" +#include "base/bind.h" +#include "base/callback.h" +#include "base/check.h" +#include "base/files/file_path.h" +#include "base/files/file_util.h" +#include "base/location.h" +#include "base/task/post_task.h" +#include "base/task/thread_pool.h" +#include "chrome/browser/support_tool/data_collector.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +UiHierarchyDataCollector::UiHierarchyDataCollector() = default; +UiHierarchyDataCollector::~UiHierarchyDataCollector() = default; + +namespace { + +UIHierarchyData CollectUiHierarchyData() { + std::ostringstream out; + out << "UI Hierarchy: Windows\n"; + std::vector<std::string> window_titles = + ash::debug::PrintWindowHierarchy(&out, /*scrub_data=*/false); + + out << "UI Hierarchy: Views\n"; + ash::debug::PrintViewHierarchy(&out); + + out << "UI Hierarchy: Layers\n"; + ash::debug::PrintLayerHierarchy(&out); + + return UIHierarchyData(window_titles, /*data=*/out.str()); +} + +bool WriteOutputFile(std::string data, base::FilePath target_directory) { + return base::WriteFile( + target_directory.Append(FILE_PATH_LITERAL("ui_hierarchy")), data); +} + +} // namespace + +UIHierarchyData::UIHierarchyData(std::vector<std::string> window_titles, + std::string data) + : window_titles(std::move(window_titles)), data(std::move(data)) {} + +UIHierarchyData::~UIHierarchyData() = default; + +UIHierarchyData::UIHierarchyData(UIHierarchyData&& ui_hierarchy_data) = default; + +std::string UiHierarchyDataCollector::GetName() const { + return "UI Hierarchy"; +} + +std::string UiHierarchyDataCollector::GetDescription() const { + return "Collects UI hiearchy data."; +} + +const PIIMap& UiHierarchyDataCollector::GetDetectedPII() { + return pii_map_; +} + +void UiHierarchyDataCollector::CollectDataAndDetectPII( + DataCollectorDoneCallback on_data_collected_callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + UIHierarchyData ui_hierarchy_data = CollectUiHierarchyData(); + InsertIntoPIIMap(ui_hierarchy_data.window_titles); + data_ = std::move(ui_hierarchy_data.data); + // `data_` can't be empty. + DCHECK(!data_.empty()); + std::move(on_data_collected_callback).Run(/*error_code=*/absl::nullopt); +} + +void UiHierarchyDataCollector::ExportCollectedDataWithPII( + std::set<PIIType> pii_types_to_keep, + base::FilePath target_directory, + DataCollectorDoneCallback on_exported_callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::MayBlock()}, + base::BindOnce(&WriteOutputFile, data_, target_directory), + base::BindOnce(&UiHierarchyDataCollector::OnDataExportDone, + weak_ptr_factory_.GetWeakPtr(), + std::move(on_exported_callback))); +} + +void UiHierarchyDataCollector::OnDataExportDone( + DataCollectorDoneCallback on_exported_callback, + bool success) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (!success) { + std::move(on_exported_callback) + .Run(SupportToolError::kUIHierarchyDataCollectorError); + return; + } + std::move(on_exported_callback).Run(/*error_code=*/absl::nullopt); +} + +void UiHierarchyDataCollector::InsertIntoPIIMap( + const std::vector<std::string>& window_titles) { + for (auto const& title : window_titles) + pii_map_.emplace(PIIType::kUIHierarchyWindowTitles, title); +}
diff --git a/chrome/browser/support_tool/ash/ui_hierarchy_data_collector.h b/chrome/browser/support_tool/ash/ui_hierarchy_data_collector.h new file mode 100644 index 0000000..5199680 --- /dev/null +++ b/chrome/browser/support_tool/ash/ui_hierarchy_data_collector.h
@@ -0,0 +1,71 @@ +// Copyright 2021 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_SUPPORT_TOOL_ASH_UI_HIERARCHY_DATA_COLLECTOR_H_ +#define CHROME_BROWSER_SUPPORT_TOOL_ASH_UI_HIERARCHY_DATA_COLLECTOR_H_ + +#include <set> + +#include "base/callback_forward.h" +#include "base/files/file_path.h" +#include "base/sequence_checker.h" +#include "chrome/browser/support_tool/data_collector.h" + +struct UIHierarchyData { + UIHierarchyData(std::vector<std::string> window_titles, std::string data); + ~UIHierarchyData(); + + // We don't need this struct to be copyable. + UIHierarchyData(const UIHierarchyData& ui_hierarchy_data) = delete; + + UIHierarchyData(UIHierarchyData&& ui_hierarchy_data); + + // The list of window titles that the UI hierarchy data contains. Window + // titles are considered PII sensitive data. + std::vector<std::string> window_titles; + // UI hierarchy data. Contains window hierarchy, view hierarchy and layer + // hierarchy. + std::string data; +}; + +class UiHierarchyDataCollector : public DataCollector { + public: + UiHierarchyDataCollector(); + ~UiHierarchyDataCollector() override; + + // Overrides from DataCollector. + std::string GetName() const override; + + std::string GetDescription() const override; + + const PIIMap& GetDetectedPII() override; + + void CollectDataAndDetectPII( + DataCollectorDoneCallback on_data_collected_callback) override; + + void ExportCollectedDataWithPII( + std::set<PIIType> pii_types_to_keep, + base::FilePath target_directory, + DataCollectorDoneCallback on_exported_callback) override; + + private: + // Runs `on_exported_callback` when the data export is done. Returns an error + // to the callback if `success` is false. + void OnDataExportDone(DataCollectorDoneCallback on_exported_callback, + bool success); + + // Inserts the contents of `window_titles` into `pii_map_` of this, with key + // PIIType::kUIHierarchyWindowTitles. + void InsertIntoPIIMap(const std::vector<std::string>& window_titles); + + SEQUENCE_CHECKER(sequence_checker_); + // PII sensitive information that the collected `data_` contains. + PIIMap pii_map_; + // UI hierarchy data that the UiHierarchyDataCollector instance collected. + // Contains window hierarchy, view hierarchy and layer hierarchy. + std::string data_; + base::WeakPtrFactory<UiHierarchyDataCollector> weak_ptr_factory_{this}; +}; + +#endif // CHROME_BROWSER_SUPPORT_TOOL_ASH_UI_HIERARCHY_DATA_COLLECTOR_H_
diff --git a/chrome/browser/support_tool/support_tool_util.cc b/chrome/browser/support_tool/support_tool_util.cc index 1d013aca7..335aa22 100644 --- a/chrome/browser/support_tool/support_tool_util.cc +++ b/chrome/browser/support_tool/support_tool_util.cc
@@ -6,15 +6,20 @@ #include <memory> +#include "build/chromeos_buildflags.h" #include "chrome/browser/support_tool/support_tool_handler.h" -#include "chrome/browser/support_tool/ui_hierarchy_data_collector.h" +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/support_tool/ash/ui_hierarchy_data_collector.h" +#endif // BUILDFLAG(IS_CHROMEOS_ASH) std::unique_ptr<SupportToolHandler> GetSupportToolHandler(bool chrome_os, bool chrome_browser) { std::unique_ptr<SupportToolHandler> handler = std::make_unique<SupportToolHandler>(); if (chrome_os) { +#if BUILDFLAG(IS_CHROMEOS_ASH) handler->AddDataCollector(std::make_unique<UiHierarchyDataCollector>()); +#endif // BUILDFLAG(IS_CHROMEOS_ASH) } return handler; }
diff --git a/chrome/browser/support_tool/ui_hierarchy_data_collector.cc b/chrome/browser/support_tool/ui_hierarchy_data_collector.cc deleted file mode 100644 index 3d7d3a4..0000000 --- a/chrome/browser/support_tool/ui_hierarchy_data_collector.cc +++ /dev/null
@@ -1,97 +0,0 @@ -// Copyright 2021 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/support_tool/ui_hierarchy_data_collector.h" - -#include <string> -#include <utility> - -#include "base/bind.h" -#include "base/callback.h" -#include "base/files/file_path.h" -#include "base/location.h" -#include "base/task/post_task.h" -#include "base/task/thread_pool.h" -#include "chrome/browser/support_tool/data_collector.h" -#include "third_party/abseil-cpp/absl/types/optional.h" - -UiHierarchyDataCollector::UiHierarchyDataCollector() = default; -UiHierarchyDataCollector::~UiHierarchyDataCollector() = default; - -namespace { -absl::optional<PIIMap> CollectUiHierarchyData() { - // Just an empty function to create the skeleton for the DataCollector. - // Data will be collected and PIIMap will be filled here. - PIIMap map; - return map; -} - -bool WriteOutputFile(std::string data, base::FilePath target_directory) { - // Just an empty function. This will create output file in given - // `target_directory` and write the data to it. Return success for now. - return true; -} - -} // namespace - -std::string UiHierarchyDataCollector::GetName() const { - return "UI Hierarchy"; -} - -std::string UiHierarchyDataCollector::GetDescription() const { - return "Collects UI hiearchy data."; -} - -const PIIMap& UiHierarchyDataCollector::GetDetectedPII() { - return pii_map_; -} - -void UiHierarchyDataCollector::CollectDataAndDetectPII( - DataCollectorDoneCallback on_data_collected_callback) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - base::ThreadPool::PostTaskAndReplyWithResult( - FROM_HERE, base::BindOnce(&CollectUiHierarchyData), - base::BindOnce(&UiHierarchyDataCollector::OnDataCollectedAndPIIDetected, - weak_ptr_factory_.GetWeakPtr(), - std::move(on_data_collected_callback))); -} - -void UiHierarchyDataCollector::OnDataCollectedAndPIIDetected( - DataCollectorDoneCallback on_data_collected_callback, - absl::optional<PIIMap> pii_map) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (pii_map) { - pii_map_ = pii_map.value(); - std::move(on_data_collected_callback).Run(absl::nullopt); - } else { - std::move(on_data_collected_callback) - .Run(SupportToolError::kUIHierarchyDataCollectorError); - } -} - -void UiHierarchyDataCollector::ExportCollectedDataWithPII( - std::set<PIIType> pii_types_to_keep, - base::FilePath target_directory, - DataCollectorDoneCallback on_exported_callback) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - base::ThreadPool::PostTaskAndReplyWithResult( - FROM_HERE, {base::MayBlock()}, - base::BindOnce(&WriteOutputFile, "some place holder data", - target_directory), - base::BindOnce(&UiHierarchyDataCollector::OnDataExportDone, - weak_ptr_factory_.GetWeakPtr(), - std::move(on_exported_callback))); -} - -void UiHierarchyDataCollector::OnDataExportDone( - DataCollectorDoneCallback on_exported_callback, - bool success) { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (success) { - std::move(on_exported_callback).Run(absl::nullopt); - } else { - std::move(on_exported_callback) - .Run(SupportToolError::kUIHierarchyDataCollectorError); - } -}
diff --git a/chrome/browser/support_tool/ui_hierarchy_data_collector.h b/chrome/browser/support_tool/ui_hierarchy_data_collector.h deleted file mode 100644 index c5d802c..0000000 --- a/chrome/browser/support_tool/ui_hierarchy_data_collector.h +++ /dev/null
@@ -1,52 +0,0 @@ -// Copyright 2021 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_SUPPORT_TOOL_UI_HIERARCHY_DATA_COLLECTOR_H_ -#define CHROME_BROWSER_SUPPORT_TOOL_UI_HIERARCHY_DATA_COLLECTOR_H_ - -#include <set> - -#include "base/callback_forward.h" -#include "base/files/file_path.h" -#include "base/sequence_checker.h" -#include "chrome/browser/support_tool/data_collector.h" - -class UiHierarchyDataCollector : public DataCollector { - public: - UiHierarchyDataCollector(); - ~UiHierarchyDataCollector() override; - - // Overrides from DataCollector. - std::string GetName() const override; - - std::string GetDescription() const override; - - const PIIMap& GetDetectedPII() override; - - void CollectDataAndDetectPII( - DataCollectorDoneCallback on_data_collected_callback) override; - - void ExportCollectedDataWithPII( - std::set<PIIType> pii_types_to_keep, - base::FilePath target_directory, - DataCollectorDoneCallback on_exported_callback) override; - - private: - // Runs `on_data_collected_callback` when data collection is done. Returns an - // error message to the callback if the optional `pii_map` is nullopt. - void OnDataCollectedAndPIIDetected( - DataCollectorDoneCallback on_data_collected_callback, - absl::optional<PIIMap> pii_map); - - // Runs `on_exported_callback` when the data export is done. Returns an error - // to the callback if `success` is false. - void OnDataExportDone(DataCollectorDoneCallback on_exported_callback, - bool success); - - SEQUENCE_CHECKER(sequence_checker_); - PIIMap pii_map_; - base::WeakPtrFactory<UiHierarchyDataCollector> weak_ptr_factory_{this}; -}; - -#endif // CHROME_BROWSER_SUPPORT_TOOL_UI_HIERARCHY_DATA_COLLECTOR_H_
diff --git a/chrome/browser/translate/translate_manager_browsertest.cc b/chrome/browser/translate/translate_manager_browsertest.cc index 3cd3bb4..f3e47c1b 100644 --- a/chrome/browser/translate/translate_manager_browsertest.cc +++ b/chrome/browser/translate/translate_manager_browsertest.cc
@@ -808,9 +808,16 @@ 1); } +// TODO(https://crbug.com/1277893): Flaky on Mac builders. +#if defined(OS_MAC) +#define MAYBE_HrefTranslateSiteBlocked DISABLED_HrefTranslateSiteBlocked +#else +#define MAYBE_HrefTranslateSiteBlocked HrefTranslateSiteBlocked +#endif // Test that hrefTranslate doesn't translate if the website is in the user's // site blocklist. -IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, HrefTranslateSiteBlocked) { +IN_PROC_BROWSER_TEST_F(TranslateManagerBrowserTest, + MAYBE_HrefTranslateSiteBlocked) { base::HistogramTester histograms; GetChromeTranslateClient() ->GetTranslateManager()
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index ed12309..cc4b0021 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -2894,6 +2894,7 @@ "//ash/components/phonehub:debug", "//ash/components/proximity_auth", "//ash/components/settings", + "//ash/components/tether", "//ash/constants", "//ash/keyboard/ui", "//ash/public/cpp", @@ -2974,7 +2975,6 @@ "//chromeos/components/quick_answers/public/cpp:cpp", "//chromeos/components/quick_answers/public/cpp:prefs", "//chromeos/components/string_matching", - "//chromeos/components/tether", "//chromeos/constants", "//chromeos/crosapi/cpp", "//chromeos/cryptohome",
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 1e15458..5b32662b 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc
@@ -315,3 +315,10 @@ void ChromeShellDelegate::ResetDisableLoggingRedirectForTesting() { disable_logging_redirect_for_testing.reset(); } + +const GURL& ChromeShellDelegate::GetLastCommittedURLForWindowIfAny( + aura::Window* window) { + content::WebContents* contents = + GetActiveWebContentsForNativeBrowserWindow(window); + return contents ? contents->GetLastCommittedURL() : GURL::EmptyGURL(); +}
diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h index 02b7e5dca..07155ed 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/ash/chrome_shell_delegate.h
@@ -9,6 +9,7 @@ #include "ash/shell_delegate.h" #include "base/callback_forward.h" +#include "url/gurl.h" class ChromeShellDelegate : public ash::ShellDelegate { public: @@ -59,6 +60,7 @@ void OpenFeedbackPageForPersistentDesksBar() override; static void SetDisableLoggingRedirectForTesting(bool value); static void ResetDisableLoggingRedirectForTesting(); + const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window) override; }; #endif // CHROME_BROWSER_UI_ASH_CHROME_SHELL_DELEGATE_H_
diff --git a/chrome/browser/ui/ash/network/tether_notification_presenter.h b/chrome/browser/ui/ash/network/tether_notification_presenter.h index 6945a6f..b3eabe4 100644 --- a/chrome/browser/ui/ash/network/tether_notification_presenter.h +++ b/chrome/browser/ui/ash/network/tether_notification_presenter.h
@@ -8,10 +8,10 @@ #include <memory> #include <string> +#include "ash/components/tether/notification_presenter.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/components/tether/notification_presenter.h" #include "chromeos/network/network_state.h" #include "ui/message_center/public/cpp/notification.h"
diff --git a/chrome/browser/ui/ash/session_controller_client_impl.cc b/chrome/browser/ui/ash/session_controller_client_impl.cc index d42b3c61..2747ada 100644 --- a/chrome/browser/ui/ash/session_controller_client_impl.cc +++ b/chrome/browser/ui/ash/session_controller_client_impl.cc
@@ -203,10 +203,6 @@ return g_session_controller_client_instance; } -void SessionControllerClientImpl::PrepareForLock(base::OnceClosure callback) { - session_controller_->PrepareForLock(std::move(callback)); -} - void SessionControllerClientImpl::StartLock(StartLockCallback callback) { session_controller_->StartLock(std::move(callback)); }
diff --git a/chrome/browser/ui/ash/session_controller_client_impl.h b/chrome/browser/ui/ash/session_controller_client_impl.h index f80739a7..9b32a854 100644 --- a/chrome/browser/ui/ash/session_controller_client_impl.h +++ b/chrome/browser/ui/ash/session_controller_client_impl.h
@@ -58,9 +58,6 @@ static SessionControllerClientImpl* Get(); - // Calls SessionController to prepare locking ash. - void PrepareForLock(base::OnceClosure callback); - // Calls SessionController to start locking ash. |callback| will be invoked // to indicate whether the lock is successful. If |locked| is true, the post // lock animation is finished and ash is fully locked. Otherwise, the lock
diff --git a/chrome/browser/ui/ash/test_session_controller.cc b/chrome/browser/ui/ash/test_session_controller.cc index c833212..a3ac53d 100644 --- a/chrome/browser/ui/ash/test_session_controller.cc +++ b/chrome/browser/ui/ash/test_session_controller.cc
@@ -34,10 +34,6 @@ ++set_user_session_order_count_; } -void TestSessionController::PrepareForLock(PrepareForLockCallback callback) { - std::move(callback).Run(); -} - void TestSessionController::StartLock(StartLockCallback callback) { std::move(callback).Run(true); }
diff --git a/chrome/browser/ui/ash/test_session_controller.h b/chrome/browser/ui/ash/test_session_controller.h index beefd1c90..76a28e54 100644 --- a/chrome/browser/ui/ash/test_session_controller.h +++ b/chrome/browser/ui/ash/test_session_controller.h
@@ -56,7 +56,6 @@ void UpdateUserSession(const ash::UserSession& user_session) override; void SetUserSessionOrder( const std::vector<uint32_t>& user_session_order) override; - void PrepareForLock(PrepareForLockCallback callback) override; void StartLock(StartLockCallback callback) override; void NotifyChromeLockAnimationsComplete() override; void RunUnlockAnimation(RunUnlockAnimationCallback callback) override;
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc index c677f45..fe71852 100644 --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -14,13 +14,11 @@ #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/browser/accessibility/accessibility_state_utils.h" -#include "chrome/browser/feature_engagement/tracker_factory.h" #include "chrome/browser/ui/autofill/autofill_popup_view.h" #include "components/autofill/content/browser/content_autofill_driver.h" #include "components/autofill/core/browser/ui/autofill_popup_delegate.h" #include "components/autofill/core/browser/ui/popup_item_ids.h" #include "components/autofill/core/browser/ui/suggestion.h" -#include "components/feature_engagement/public/tracker.h" #include "components/password_manager/content/browser/content_password_manager_driver.h" #include "components/strings/grit/components_strings.h" #include "content/public/browser/native_web_keyboard_event.h" @@ -324,14 +322,6 @@ /*has_suggestions=*/false); mf_controller->Hide(); #endif - - if (web_contents_ && - suggestion.frontend_id == POPUP_ITEM_ID_VIRTUAL_CREDIT_CARD_ENTRY) { - feature_engagement::TrackerFactory::GetForBrowserContext( - web_contents_->GetBrowserContext()) - ->NotifyEvent("autofill_virtual_card_suggestion_accepted"); - } - delegate_->DidAcceptSuggestion(suggestion.value, suggestion.frontend_id, suggestion.backend_id, index); }
diff --git a/chrome/browser/ui/cocoa/screentime/tab_helper.mm b/chrome/browser/ui/cocoa/screentime/tab_helper.mm index ff78281..b3b8751 100644 --- a/chrome/browser/ui/cocoa/screentime/tab_helper.mm +++ b/chrome/browser/ui/cocoa/screentime/tab_helper.mm
@@ -34,7 +34,9 @@ } TabHelper::TabHelper(content::WebContents* contents) - : WebContentsObserver(contents), page_controller_(MakeWebpageController()) { + : WebContentsObserver(contents), + content::WebContentsUserData<TabHelper>(*contents), + page_controller_(MakeWebpageController()) { Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); // Absolutely ensure that we never record a navigation for an OTR profile. CHECK(!profile->IsOffTheRecord());
diff --git a/chrome/browser/ui/login/login_handler_browsertest.cc b/chrome/browser/ui/login/login_handler_browsertest.cc index 301c9b14..f3045a6 100644 --- a/chrome/browser/ui/login/login_handler_browsertest.cc +++ b/chrome/browser/ui/login/login_handler_browsertest.cc
@@ -1968,12 +1968,13 @@ content::WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); - ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("about:blank"))); + ASSERT_TRUE(ui_test_utils::NavigateToURL( + browser(), embedded_test_server()->GetURL("/title1.html"))); // Open a new window via JavaScript and navigate it to a page that delivers an // auth prompt. GURL test_page = embedded_test_server()->GetURL(kAuthBasicPage); - ASSERT_NE(false, content::EvalJs(contents, "w = window.open();")); + ASSERT_NE(false, content::EvalJs(contents, "w = window.open('/nocontent');")); content::WebContents* opened_contents = browser()->tab_strip_model()->GetWebContentsAt(1); NavigationController* opened_controller = &opened_contents->GetController();
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_base_view.cc b/chrome/browser/ui/views/autofill/autofill_popup_base_view.cc index 98a03f21..6f47b02 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_base_view.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_base_view.cc
@@ -106,7 +106,6 @@ // Ensure the bubble border is not painted on an opaque background. params.opacity = views::Widget::InitParams::WindowOpacity::kTranslucent; params.shadow_type = views::Widget::InitParams::ShadowType::kNone; - params.child = true; widget->Init(std::move(params)); widget->AddObserver(this);
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc b/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc index 6fb4b55..fd5b181b 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_base_view_browsertest.cc
@@ -95,13 +95,8 @@ raw_ptr<AutofillPopupBaseView> view_; }; -#if defined(OS_CHROMEOS) -// Fails on ChromeOS. http://crbug.com/1277271 -#define MAYBE_CorrectBoundsTest DISABLED_CorrectBoundsTest -#else -#define MAYBE_CorrectBoundsTest CorrectBoundsTest -#endif -IN_PROC_BROWSER_TEST_F(AutofillPopupBaseViewTest, MAYBE_CorrectBoundsTest) { +// Regression test for crbug.com/391316 +IN_PROC_BROWSER_TEST_F(AutofillPopupBaseViewTest, CorrectBoundsTest) { gfx::RectF bounds(100, 150, 5, 5); EXPECT_CALL(mock_delegate_, element_bounds()) .WillRepeatedly(ReturnRef(bounds));
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc index 4a11486..8b0ff46 100644 --- a/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc +++ b/chrome/browser/ui/views/autofill/autofill_popup_view_native_views.cc
@@ -19,21 +19,16 @@ #include "chrome/browser/platform_util.h" #include "chrome/browser/ui/autofill/autofill_popup_controller.h" #include "chrome/browser/ui/autofill/autofill_popup_controller_utils.h" -#include "chrome/browser/ui/browser_element_identifiers.h" -#include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/views/autofill/autofill_popup_view_utils.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" #include "chrome/browser/ui/views/chrome_typography_provider.h" -#include "chrome/browser/ui/views/frame/browser_view.h" -#include "chrome/browser/ui/views/user_education/feature_promo_controller_views.h" #include "components/autofill/core/browser/autofill_experiments.h" #include "components/autofill/core/browser/data_model/credit_card.h" #include "components/autofill/core/browser/ui/popup_item_ids.h" #include "components/autofill/core/browser/ui/popup_types.h" #include "components/autofill/core/browser/ui/suggestion.h" #include "components/autofill/core/common/autofill_features.h" -#include "components/feature_engagement/public/feature_constants.h" #include "components/omnibox/browser/vector_icons.h" #include "components/strings/grit/components_strings.h" #include "components/vector_icons/vector_icons.h" @@ -343,7 +338,6 @@ ~AutofillPopupItemView() override = default; // views::View: - void AddedToWidget() override; void GetAccessibleNodeData(ui::AXNodeData* node_data) override; void OnPaint(gfx::Canvas* canvas) override; void OnMouseEntered(const ui::MouseEvent& event) override; @@ -395,9 +389,6 @@ // GetSubtexts(); void UpdateLayoutSize(views::BoxLayout* layout_manager, int64_t num_subtexts); - // Manipulate the in-product-help promo anchored to this bubble. - void MaybeShowIphPromo(); - const int frontend_id_; // All the labels inside this view. @@ -581,11 +572,6 @@ /************** AutofillPopupItemView **************/ -void AutofillPopupItemView::AddedToWidget() { - AutofillPopupRowView::AddedToWidget(); - MaybeShowIphPromo(); -} - void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) { base::WeakPtr<AutofillPopupController> controller = popup_view()->controller(); @@ -910,46 +896,6 @@ /*use_min_size=*/true); } -void AutofillPopupItemView::MaybeShowIphPromo() { - content::WebContents* web_contents = - popup_view()->controller()->GetWebContents(); - // In unittests the web_contents is missing. - if (!web_contents) - return; - - Browser* browser = chrome::FindBrowserWithWebContents(web_contents); - DCHECK(browser); - BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); - DCHECK(browser_view); - FeaturePromoControllerViews* promo_controller = - browser_view->feature_promo_controller(); - if (!promo_controller) - return; - - std::string feature_name = popup_view() - ->controller() - ->GetSuggestionAt(GetLineNumber()) - .feature_for_iph; - if (feature_name.empty()) - return; - - absl::optional<FeaturePromoSpecification> promo_spec; - if (feature_name == "IPH_AutofillVirtualCardSuggestion") { - promo_spec = FeaturePromoSpecification::CreateForToastPromo( - feature_engagement::kIPHAutofillVirtualCardSuggestionFeature, - ui::ElementIdentifier(), - IDS_AUTOFILL_VIRTUAL_CARD_SUGGESTION_IPH_BUBBLE_LABEL, - IDS_AUTOFILL_VIRTUAL_CARD_SUGGESTION_IPH_BUBBLE_LABEL, - FeaturePromoSpecification::AcceleratorInfo()); - promo_spec->SetBubbleArrow( - FeaturePromoSpecification::BubbleArrow::kLeftCenter); - } - - if (promo_spec.has_value()) { - promo_controller->MaybeShowPromoFromSpecification(*promo_spec, this); - } -} - /************** AutofillPopupSuggestionView **************/ // static
diff --git a/chrome/browser/ui/views/autofill/payments/card_unmask_otp_input_dialog_views.cc b/chrome/browser/ui/views/autofill/payments/card_unmask_otp_input_dialog_views.cc index 2c7f07c3..b90cc45 100644 --- a/chrome/browser/ui/views/autofill/payments/card_unmask_otp_input_dialog_views.cc +++ b/chrome/browser/ui/views/autofill/payments/card_unmask_otp_input_dialog_views.cc
@@ -81,6 +81,7 @@ otp_input_textfield_invalid_label_->SetVisible(true); otp_input_textfield_invalid_label_->SetText(invalid_label_text); otp_input_textfield_invalid_label_padding_->SetVisible(false); + otp_input_textfield_->SetAssociatedLabel(otp_input_textfield_invalid_label_); } void CardUnmaskOtpInputDialogViews::Dismiss( @@ -191,6 +192,8 @@ gfx::HorizontalAlignment::ALIGN_LEFT); otp_input_textfield_invalid_label_->SetVisible(false); otp_input_textfield_invalid_label_->SetMultiLine(true); + // Disable the label so that its accessibility data will not be read. + otp_input_textfield_invalid_label_->SetEnabled(false); // Adds padding between the textfield and footer text while textfield label // is not visible, so that the initial dialog layout allows room for the error @@ -250,7 +253,9 @@ void CardUnmaskOtpInputDialogViews::HideInvalidState() { DCHECK(otp_input_textfield_->GetInvalid()); otp_input_textfield_->SetInvalid(false); + otp_input_textfield_invalid_label_->SetText(std::u16string()); otp_input_textfield_invalid_label_->SetVisible(false); + otp_input_textfield_->SetAssociatedLabel(otp_input_textfield_invalid_label_); otp_input_textfield_invalid_label_padding_->SetVisible(true); }
diff --git a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc index 9ce291fc..a1a0be7 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc
@@ -10,6 +10,7 @@ #include "base/scoped_observation.h" #include "base/strings/utf_string_conversions.h" #include "base/test/bind.h" +#include "base/test/metrics/histogram_tester.h" #include "base/test/mock_callback.h" #include "base/test/scoped_feature_list.h" #include "base/time/time.h" @@ -17,6 +18,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/feature_engagement/tracker_factory.h" #include "chrome/browser/interstitials/chrome_settings_page_helper.h" +#include "chrome/browser/metrics/first_web_contents_profiler_base.h" #include "chrome/browser/policy/cloud/user_policy_signin_service.h" #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" #include "chrome/browser/profiles/profile_attributes_entry.h" @@ -64,6 +66,7 @@ #include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/identity_test_utils.h" #include "components/signin/public/identity_manager/primary_account_mutator.h" +#include "components/startup_metric_utils/browser/startup_metric_utils.h" #include "components/sync/base/sync_prefs.h" #include "components/sync/driver/sync_driver_switches.h" #include "components/sync/driver/sync_service.h" @@ -984,6 +987,8 @@ } IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, OpenProfile) { + base::HistogramTester histogram_tester; + AvatarToolbarButton::SetIPHMinDelayAfterCreationForTesting(base::Seconds(0)); FeaturePromoControllerViews::BlockActiveWindowCheckForTesting(); ASSERT_EQ(1u, BrowserList::GetInstance()->size()); @@ -1002,6 +1007,43 @@ WaitForPickerClosed(); // IPH is shown. EXPECT_TRUE(ProfileSwitchPromoHasBeenShown(new_browser)); + + // FirstProfileTime.* histograms aren't recorded because the picker + // is opened from the menu. + EXPECT_THAT(histogram_tester.GetTotalCountsForPrefix( + "ProfilePicker.FirstProfileTime."), + testing::IsEmpty()); +} + +IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, + OpenProfileFromStartup) { + base::HistogramTester histogram_tester; + + // Create a second profile. + base::FilePath other_path = CreateNewProfileWithoutBrowser(); + + // Open the picker. + ProfilePicker::Show(ProfilePicker::EntryPoint::kOnStartup); + EXPECT_TRUE(ProfilePicker::IsOpen()); + WaitForLoadStop(GURL("chrome://profile-picker")); + + // Open the new profile. + OpenProfileFromPicker(other_path, /*open_settings=*/false); + + // Measurement of startup performance started. + + // Browser for the profile is displayed. + Browser* new_browser = BrowserAddedWaiter(2u).Wait(); + WaitForLoadStop(GURL("chrome://newtab/"), + new_browser->tab_strip_model()->GetActiveWebContents()); + EXPECT_EQ(new_browser->profile()->GetPath(), other_path); + WaitForPickerClosed(); + + histogram_tester.ExpectTotalCount( + "ProfilePicker.FirstProfileTime.FirstWebContentsNonEmptyPaint", 1); + histogram_tester.ExpectUniqueSample( + "ProfilePicker.FirstProfileTime.FirstWebContentsFinishReason", + metrics::StartupProfilingFinishReason::kDone, 1); } IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest,
diff --git a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc index 9f3ea5d2..110d2bf 100644 --- a/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc +++ b/chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_browsertest.cc
@@ -776,8 +776,16 @@ } #endif // !BUILDFLAG(IS_CHROMEOS_LACROS) +// TODO(https://crbug.com/1277860): Flaky on Mac builders. +#if defined(OS_MAC) +#define MAYBE_WindowControlsOverlayDraggableRegions \ + DISABLED_WindowControlsOverlayDraggableRegions +#else +#define MAYBE_WindowControlsOverlayDraggableRegions \ + WindowControlsOverlayDraggableRegions +#endif IN_PROC_BROWSER_TEST_F(WebAppFrameToolbarBrowserTest_WindowControlsOverlay, - WindowControlsOverlayDraggableRegions) { + MAYBE_WindowControlsOverlayDraggableRegions) { InstallAndLaunchWebApp(); ToggleWindowControlsOverlayAndWait();
diff --git a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc index 0b66105..11c00ea6 100644 --- a/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc +++ b/chrome/browser/ui/views/web_apps/web_app_integration_browsertest.cc
@@ -1575,9 +1575,17 @@ helper_.CheckWindowCreated(); } +// TODO(https://crbug.com/1277870): Flaky on Linux builders. +#if defined(OS_LINUX) +#define MAYBE_WebAppIntegration_InstOmniboxSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated \ + DISABLED_WebAppIntegration_InstOmniboxSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated +#else +#define MAYBE_WebAppIntegration_InstOmniboxSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated \ + WebAppIntegration_InstOmniboxSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated +#endif IN_PROC_BROWSER_TEST_F( WebAppIntegrationBrowserTest, - WebAppIntegration_InstOmniboxSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated) { + MAYBE_WebAppIntegration_InstOmniboxSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported. @@ -1634,9 +1642,17 @@ helper_.CheckWindowCreated(); } +// TODO(https://crbug.com/1277870): Flaky on Linux builders. +#if defined(OS_LINUX) +#define MAYBE_WebAppIntegration_InstMenuOptionSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated \ + DISABLED_WebAppIntegration_InstMenuOptionSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated +#else +#define MAYBE_WebAppIntegration_InstMenuOptionSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated \ + WebAppIntegration_InstMenuOptionSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated +#endif IN_PROC_BROWSER_TEST_F( WebAppIntegrationBrowserTest, - WebAppIntegration_InstMenuOptionSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated) { + MAYBE_WebAppIntegration_InstMenuOptionSiteA_WindowCreated_InListWinSiteA_InstPlcyTabShctSiteA_InListWinSiteA_LaunchFromIconSiteA_WindowCreated) { // Test contents are generated by script. Please do not modify! // See `chrome/test/webapps/README.md` for more info. // Sheriffs: Disabling this test is supported.
diff --git a/chrome/browser/ui/webui/browser_command/OWNERS b/chrome/browser/ui/webui/browser_command/OWNERS new file mode 100644 index 0000000..284e67f --- /dev/null +++ b/chrome/browser/ui/webui/browser_command/OWNERS
@@ -0,0 +1,3 @@ +mahmadi@chromium.org +msramek@chromium.org +rbpotter@chromium.org
diff --git a/chrome/browser/ui/webui/browser_command/browser_command_handler.cc b/chrome/browser/ui/webui/browser_command/browser_command_handler.cc index 9670540c..9452459 100644 --- a/chrome/browser/ui/webui/browser_command/browser_command_handler.cc +++ b/chrome/browser/ui/webui/browser_command/browser_command_handler.cc
@@ -13,6 +13,7 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/chrome_pages.h" +#include "chrome/common/chrome_features.h" #include "chrome/common/webui_url_constants.h" #include "components/safe_browsing/content/browser/web_ui/safe_browsing_ui.h" #include "components/safe_browsing/core/common/safe_browsing_policy_handler.h" @@ -70,6 +71,11 @@ case Command::kOpenFeedbackForm: can_execute = true; break; + case Command::kOpenPrivacyReview: + can_execute = base::FeatureList::IsEnabled(features::kPrivacyReview) && + !chrome::enterprise_util::IsBrowserManaged(profile_) && + !profile_->IsChild(); + break; default: NOTREACHED() << "Unspecified behavior for command " << command_id; break; @@ -120,6 +126,12 @@ case Command::kOpenFeedbackForm: OpenFeedbackForm(); break; + case Command::kOpenPrivacyReview: + NavigateToURL(GURL(chrome::GetSettingsUrl(chrome::kPrivacyReviewSubPage)), + disposition); + base::RecordAction( + base::UserMetricsAction("NewTabPage_Promos_PrivacyGuide")); + break; default: NOTREACHED() << "Unspecified behavior for command " << id; break;
diff --git a/chrome/browser/ui/webui/browser_command/browser_command_handler_unittest.cc b/chrome/browser/ui/webui/browser_command/browser_command_handler_unittest.cc index 7c79a72..f028f211 100644 --- a/chrome/browser/ui/webui/browser_command/browser_command_handler_unittest.cc +++ b/chrome/browser/ui/webui/browser_command/browser_command_handler_unittest.cc
@@ -12,6 +12,7 @@ #include "chrome/browser/command_updater_impl.h" #include "chrome/browser/ui/chrome_pages.h" #include "chrome/browser/ui/webui/browser_command/browser_command_handler.h" +#include "chrome/common/chrome_features.h" #include "chrome/common/webui_url_constants.h" #include "chrome/test/base/testing_profile.h" #include "components/content_settings/core/common/pref_names.h" @@ -36,6 +37,7 @@ Command::kOpenSafetyCheck, Command::kOpenSafeBrowsingEnhancedProtectionSettings, Command::kOpenFeedbackForm, + Command::kOpenPrivacyReview, }; class TestCommandHandler : public BrowserCommandHandler { @@ -114,6 +116,11 @@ info.ctrl_key, info.meta_key, info.shift_key); } +class TestingChildProfile : public TestingProfile { + public: + bool IsChild() const override { return true; } +}; + } // namespace class BrowserCommandHandlerTest : public testing::Test { @@ -313,3 +320,45 @@ EXPECT_CALL(*command_handler_, OpenFeedbackForm()); EXPECT_TRUE(ExecuteCommand(Command::kOpenFeedbackForm, std::move(info))); } + +TEST_F(BrowserCommandHandlerTest, CanExecuteCommand_OpenPrivacyReview) { + // Showing the Privacy Review promo is not allowed if the experimental + // flag is disabled. + base::test::ScopedFeatureList feature_list; + feature_list.InitAndDisableFeature(features::kPrivacyReview); + EXPECT_FALSE(CanExecuteCommand(Command::kOpenPrivacyReview)); + + // Once the flag is enabled, it is allowed. + feature_list.Reset(); + feature_list.InitAndEnableFeature(features::kPrivacyReview); + EXPECT_TRUE(CanExecuteCommand(Command::kOpenPrivacyReview)); + + // If the browser is managed, it is again not allowed. + { + TestingProfile::Builder builder; + builder.OverridePolicyConnectorIsManagedForTesting(true); + std::unique_ptr<TestingProfile> profile = builder.Build(); + command_handler_ = std::make_unique<MockCommandHandler>(profile.get()); + EXPECT_FALSE(CanExecuteCommand(Command::kOpenPrivacyReview)); + } + + // Neither is it if the profile belongs to a child. + { + TestingChildProfile profile; + command_handler_ = std::make_unique<MockCommandHandler>(&profile); + EXPECT_FALSE(CanExecuteCommand(Command::kOpenPrivacyReview)); + } +} + +TEST_F(BrowserCommandHandlerTest, OpenPrivacyReviewCommand) { + // The OpenPrivacyReview command opens a new settings window with the Privacy + // Review, and the correct disposition. + ClickInfoPtr info = ClickInfo::New(); + info->middle_button = true; + info->meta_key = true; + EXPECT_CALL( + *command_handler_, + NavigateToURL(GURL(chrome::GetSettingsUrl(chrome::kPrivacyReviewSubPage)), + DispositionFromClick(*info))); + EXPECT_TRUE(ExecuteCommand(Command::kOpenPrivacyReview, std::move(info))); +}
diff --git a/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.cc b/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.cc index 2ff0389c..a8c47dd 100644 --- a/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.cc +++ b/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.cc
@@ -14,20 +14,27 @@ Profile* profile) : receiver_(this, std::move(receiver)), page_(std::move(page)), - segmentation_platform_service_( - segmentation_platform::SegmentationPlatformServiceFactory:: - GetForProfile(profile)) { - segmentation_platform_service_->AddObserver(this); + service_proxy_(segmentation_platform::SegmentationPlatformServiceFactory:: + GetForProfile(profile) + ->GetServiceProxy()) { + if (service_proxy_) + service_proxy_->AddObserver(this); } SegmentationInternalsPageHandlerImpl::~SegmentationInternalsPageHandlerImpl() { - segmentation_platform_service_->RemoveObserver(this); + if (service_proxy_) + service_proxy_->RemoveObserver(this); } void SegmentationInternalsPageHandlerImpl::GetSegment( const std::string& key, GetSegmentCallback callback) { - segmentation_platform_service_->GetSelectedSegment( + if (!service_proxy_) { + OnGetSelectedSegmentDone(std::move(callback), + segmentation_platform::SegmentSelectionResult()); + return; + } + service_proxy_->GetSelectedSegment( key, base::BindOnce( &SegmentationInternalsPageHandlerImpl::OnGetSelectedSegmentDone, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); @@ -44,7 +51,9 @@ } void SegmentationInternalsPageHandlerImpl::GetServiceStatus() { - segmentation_platform_service_->GetServiceStatus(); + if (service_proxy_) { + service_proxy_->GetServiceStatus(); + } } void SegmentationInternalsPageHandlerImpl::OnServiceStatusChanged(
diff --git a/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.h b/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.h index d2bf2fe..598ac7d 100644 --- a/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.h +++ b/chrome/browser/ui/webui/segmentation_internals/segmentation_internals_page_handler_impl.h
@@ -10,7 +10,7 @@ #include "base/memory/weak_ptr.h" #include "chrome/browser/ui/webui/segmentation_internals/segmentation_internals.mojom.h" #include "components/segmentation_platform/public/segment_selection_result.h" -#include "components/segmentation_platform/public/segmentation_platform_service.h" +#include "components/segmentation_platform/public/service_proxy.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h" @@ -18,7 +18,7 @@ class SegmentationInternalsPageHandlerImpl : public segmentation_internals::mojom::PageHandler, - public segmentation_platform::SegmentationPlatformService::Observer { + public segmentation_platform::ServiceProxy::Observer { public: SegmentationInternalsPageHandlerImpl( mojo::PendingReceiver<segmentation_internals::mojom::PageHandler> @@ -47,8 +47,7 @@ mojo::Receiver<segmentation_internals::mojom::PageHandler> receiver_; mojo::Remote<segmentation_internals::mojom::Page> page_; - segmentation_platform::SegmentationPlatformService* - segmentation_platform_service_; + segmentation_platform::ServiceProxy* service_proxy_; base::WeakPtrFactory<SegmentationInternalsPageHandlerImpl> weak_ptr_factory_{ this};
diff --git a/chrome/browser/ui/webui/settings/chromeos/internet_handler.h b/chrome/browser/ui/webui/settings/chromeos/internet_handler.h index 42843b3..80862b2 100644 --- a/chrome/browser/ui/webui/settings/chromeos/internet_handler.h +++ b/chrome/browser/ui/webui/settings/chromeos/internet_handler.h
@@ -7,8 +7,8 @@ #include <memory> +#include "ash/components/tether/gms_core_notifications_state_tracker.h" #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" -#include "chromeos/components/tether/gms_core_notifications_state_tracker.h" #include "ui/gfx/native_widget_types.h" class Profile;
diff --git a/chrome/browser/ui/webui/settings/chromeos/internet_handler_unittest.cc b/chrome/browser/ui/webui/settings/chromeos/internet_handler_unittest.cc index be665c3..bfc60cb5 100644 --- a/chrome/browser/ui/webui/settings/chromeos/internet_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/chromeos/internet_handler_unittest.cc
@@ -6,8 +6,8 @@ #include <memory> +#include "ash/components/tether/fake_gms_core_notifications_state_tracker.h" #include "chrome/test/base/browser_with_test_window_test.h" -#include "chromeos/components/tether/fake_gms_core_notifications_state_tracker.h" #include "content/public/test/test_web_ui.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/ui/webui/settings/privacy_review_handler_unittest.cc b/chrome/browser/ui/webui/settings/privacy_review_handler_unittest.cc index bf3e199..b474632 100644 --- a/chrome/browser/ui/webui/settings/privacy_review_handler_unittest.cc +++ b/chrome/browser/ui/webui/settings/privacy_review_handler_unittest.cc
@@ -64,7 +64,8 @@ PrivacyReviewHandler* handler() { return handler_.get(); } TestingProfile* profile() { return &profile_; } - private: + protected: + base::test::ScopedFeatureList feature_list_; content::BrowserTaskEnvironment browser_task_environment_; content::RenderViewHostTestEnabler render_view_host_test_enabler_; TestingProfile profile_; @@ -74,15 +75,27 @@ std::unique_ptr<PrivacyReviewHandler> handler_; }; -TEST_F(PrivacyReviewHandlerTest, IsPrivacyReviewAvailable) { - // Privacy review is not available when the experimental flag is disabled. - base::test::ScopedFeatureList feature_list; - feature_list.InitAndDisableFeature(features::kPrivacyReview); - ValidateIsPrivacyReviewAvailable(false); +class PrivacyReviewHandlerDisabledTest : public PrivacyReviewHandlerTest { + public: + PrivacyReviewHandlerDisabledTest() { + feature_list_.InitAndDisableFeature(features::kPrivacyReview); + } +}; - // Once the flag is enabled, privacy review is available. - feature_list.Reset(); - feature_list.InitAndEnableFeature(features::kPrivacyReview); +class PrivacyReviewHandlerEnabledTest : public PrivacyReviewHandlerTest { + public: + PrivacyReviewHandlerEnabledTest() { + feature_list_.InitAndEnableFeature(features::kPrivacyReview); + } +}; + +TEST_F(PrivacyReviewHandlerDisabledTest, IsPrivacyReviewAvailable) { + // Privacy review is not available when the experimental flag is disabled. + ValidateIsPrivacyReviewAvailable(false); +} + +TEST_F(PrivacyReviewHandlerEnabledTest, IsPrivacyReviewAvailable) { + // Privacy review is available when the experimental flag is enabled. ValidateIsPrivacyReviewAvailable(true); // If the browser is managed, then privacy review is not available.
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 045f6c1879..65b73f91 100644 --- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc +++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
@@ -2769,6 +2769,8 @@ IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_REMOVED}, {"securityKeysCredentialManagementDesc", IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_DESC}, + {"securityKeysCredentialManagementConfirmDeleteTitle", + IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_CONFIRM_DELETE_TITLE}, {"securityKeysCredentialManagementDialogTitle", IDS_SETTINGS_SECURITY_KEYS_CREDENTIAL_MANAGEMENT_DIALOG_TITLE}, {"securityKeysUpdateCredentialDialogTitle",
diff --git a/chrome/browser/ui/webui/signin/profile_picker_handler.cc b/chrome/browser/ui/webui/signin/profile_picker_handler.cc index 3e21ece9..0917ab4 100644 --- a/chrome/browser/ui/webui/signin/profile_picker_handler.cc +++ b/chrome/browser/ui/webui/signin/profile_picker_handler.cc
@@ -13,8 +13,10 @@ #include "base/metrics/histogram_functions.h" #include "base/notreached.h" #include "base/strings/utf_string_conversions.h" +#include "base/trace_event/trace_event.h" #include "base/values.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/metrics/first_web_contents_profiler_base.h" #include "chrome/browser/new_tab_page/chrome_colors/chrome_colors_service.h" #include "chrome/browser/new_tab_page/chrome_colors/generated_colors_info.h" #include "chrome/browser/profiles/profile.h" @@ -242,6 +244,99 @@ } #endif // BUILDFLAG(IS_CHROMEOS_LACROS) +void RecordProfilingFinishReason( + metrics::StartupProfilingFinishReason finish_reason) { + base::UmaHistogramEnumeration( + "ProfilePicker.FirstProfileTime.FirstWebContentsFinishReason", + finish_reason); +} + +class FirstWebContentsProfilerForProfilePicker + : public metrics::FirstWebContentsProfilerBase { + public: + explicit FirstWebContentsProfilerForProfilePicker( + content::WebContents* web_contents, + base::TimeTicks pick_time); + + FirstWebContentsProfilerForProfilePicker( + const FirstWebContentsProfilerForProfilePicker&) = delete; + FirstWebContentsProfilerForProfilePicker& operator=( + const FirstWebContentsProfilerForProfilePicker&) = delete; + + protected: + // FirstWebContentsProfilerBase: + void RecordFinishReason( + metrics::StartupProfilingFinishReason finish_reason) override; + void RecordNavigationFinished(base::TimeTicks navigation_start) override; + void RecordFirstNonEmptyPaint() override; + bool WasStartupInterrupted() override; + + private: + ~FirstWebContentsProfilerForProfilePicker() override; + + const base::TimeTicks pick_time_; +}; + +FirstWebContentsProfilerForProfilePicker:: + FirstWebContentsProfilerForProfilePicker(content::WebContents* web_contents, + base::TimeTicks pick_time) + : FirstWebContentsProfilerBase(web_contents), pick_time_(pick_time) { + DCHECK(!pick_time_.is_null()); +} + +FirstWebContentsProfilerForProfilePicker:: + ~FirstWebContentsProfilerForProfilePicker() = default; + +void FirstWebContentsProfilerForProfilePicker::RecordFinishReason( + metrics::StartupProfilingFinishReason finish_reason) { + RecordProfilingFinishReason(finish_reason); +} + +void FirstWebContentsProfilerForProfilePicker::RecordNavigationFinished( + base::TimeTicks navigation_start) { + // Nothing to record here for Profile Picker startups. +} + +void FirstWebContentsProfilerForProfilePicker::RecordFirstNonEmptyPaint() { + const char histogram_name[] = + "ProfilePicker.FirstProfileTime.FirstWebContentsNonEmptyPaint"; + base::TimeTicks paint_time = base::TimeTicks::Now(); + base::UmaHistogramLongTimes100(histogram_name, paint_time - pick_time_); + TRACE_EVENT_NESTABLE_ASYNC_BEGIN_WITH_TIMESTAMP0("startup", histogram_name, + this, pick_time_); + TRACE_EVENT_NESTABLE_ASYNC_END_WITH_TIMESTAMP0("startup", histogram_name, + this, paint_time); +} + +bool FirstWebContentsProfilerForProfilePicker::WasStartupInterrupted() { + // We're assuming that no interruptions block opening an existing profile + // from the profile picker. We would detect this by observing really high + // latency on the tracked metric, and can start tracking interruptions if we + // find that such cases occur. + return false; +} + +void BeginFirstWebContentsProfiling(Browser* browser, + base::TimeTicks pick_time) { + content::WebContents* visible_contents = + metrics::FirstWebContentsProfilerBase::GetVisibleContents(browser); + if (!visible_contents) { + RecordProfilingFinishReason(metrics::StartupProfilingFinishReason:: + kAbandonNoInitiallyVisibleContent); + return; + } + + if (visible_contents->CompletedFirstVisuallyNonEmptyPaint()) { + RecordProfilingFinishReason( + metrics::StartupProfilingFinishReason::kAbandonAlreadyPaintedContent); + return; + } + + // FirstWebContentsProfilerForProfilePicker owns itself and is also bound to + // |visible_contents|'s lifetime by observing WebContentsDestroyed(). + new FirstWebContentsProfilerForProfilePicker(visible_contents, pick_time); +} + } // namespace ProfilePickerHandler::ProfilePickerHandler() = default; @@ -441,6 +536,12 @@ } #endif // BUILDFLAG(IS_CHROMEOS_LACROS) + if (!creation_time_on_startup_.is_null() && + // Avoid overriding the picked time if already recorded. This can happen + // for example if multiple profiles are picked: https://crbug.com/1277466. + profile_picked_time_on_startup_.is_null()) { + profile_picked_time_on_startup_ = base::TimeTicks::Now(); + } profiles::SwitchToProfile( *profile_path, /*always_create=*/false, base::BindRepeating(&ProfilePickerHandler::OnSwitchToProfileComplete, @@ -837,6 +938,13 @@ DCHECK(browser); DCHECK(browser->window()); + // Measure startup time to display first web contents if the profile picker + // was displayed on startup and if the initiating action is instrumented. For + // example we don't record pick time for profile creations. + if (!profile_picked_time_on_startup_.is_null()) { + BeginFirstWebContentsProfiling(browser, profile_picked_time_on_startup_); + } + // Only show the profile switch IPH when the user clicked the card, and there // are multiple profiles. std::vector<ProfileAttributesEntry*> entries =
diff --git a/chrome/browser/ui/webui/signin/profile_picker_handler.h b/chrome/browser/ui/webui/signin/profile_picker_handler.h index 026c3b3..ab92d9b 100644 --- a/chrome/browser/ui/webui/signin/profile_picker_handler.h +++ b/chrome/browser/ui/webui/signin/profile_picker_handler.h
@@ -182,6 +182,11 @@ // Creation time of the handler, to measure performance on startup. Only set // when the picker is shown on startup. base::TimeTicks creation_time_on_startup_; + + // Time when the user picked a profile to open, to measure browser startup + // performance. Only set when the picker is shown on startup. + base::TimeTicks profile_picked_time_on_startup_; + bool main_view_initialized_ = false; #if BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index b3298372..8e99a6ee 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1638943101-713eeaae06d946aac8db8b8688821b9462c03ba3.profdata +chrome-linux-main-1638964457-04459cc64f73d0079dd6eb3e07d73c7c110807a1.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 9ee88e1..43c682a8 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1638943101-534ddf6568f4a08b96c34a6393ab4c551da0ae95.profdata +chrome-mac-main-1638964457-bd8a9b2ab15f95714c0b36e7d608ffdc3d061088.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 3d2a54c..6535bf2c 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1638921351-c9309ab8978fef04a6ca58e962ea206bf9604996.profdata +chrome-win32-main-1638943101-b07a4b7633ea48f17e03818723e23748e9ea70a0.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 5e0090c6..9b5c4ff 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1638921351-e34a9aa5758f222e7b798e5be812a4fddbcd10c2.profdata +chrome-win64-main-1638964457-fc2eeb7c869576bb8931072d2327e83226cbb9a1.profdata
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc index 2d26c1b..8da43fea 100644 --- a/chrome/common/webui_url_constants.cc +++ b/chrome/common/webui_url_constants.cc
@@ -550,6 +550,7 @@ const char kPasswordManagerSubPage[] = "passwords"; const char kPaymentsSubPage[] = "payments"; const char kPrintingSettingsSubPage[] = "printing"; +const char kPrivacyReviewSubPage[] = "privacy/review"; const char kPrivacySubPage[] = "privacy"; const char kResetSubPage[] = "reset"; const char kResetProfileSettingsSubPage[] = "resetProfileSettings";
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h index 4cd418d2..08f2528b 100644 --- a/chrome/common/webui_url_constants.h +++ b/chrome/common/webui_url_constants.h
@@ -494,6 +494,7 @@ extern const char kPaymentsSubPage[]; extern const char kPeopleSubPage[]; extern const char kPrintingSettingsSubPage[]; +extern const char kPrivacyReviewSubPage[]; extern const char kPrivacySubPage[]; extern const char kResetSubPage[]; extern const char kResetProfileSettingsSubPage[];
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/AccountManagerTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/AccountManagerTestRule.java index 26896e3..189ce18 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/AccountManagerTestRule.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/signin/AccountManagerTestRule.java
@@ -233,13 +233,13 @@ } /** - * Creates a child account. + * Creates an email used to identify child accounts in tests. * A child-specific prefix will be appended to the base name so that the created account * will be considered as {@link ChildAccountStatus#REGULAR_CHILD} in * {@link FakeAccountManagerFacade}. */ - public static Account createChildAccount(String baseName) { - return FakeAccountManagerFacade.createChildAccount(baseName); + public static String generateChildEmail(String baseName) { + return FakeAccountManagerFacade.generateChildEmail(baseName); } /**
diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index 73df3ae..30cca13 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc
@@ -700,10 +700,6 @@ GetPrefs()->ClearPref(prefs::kSupervisedUserId); } -bool TestingProfile::IsSupervised() const { - return !supervised_user_id_.empty(); -} - bool TestingProfile::IsChild() const { #if BUILDFLAG(ENABLE_SUPERVISED_USERS) return supervised_user_id_ == supervised_users::kChildAccountSUID;
diff --git a/chrome/test/base/testing_profile.h b/chrome/test/base/testing_profile.h index 816b7063..2de3571 100644 --- a/chrome/test/base/testing_profile.h +++ b/chrome/test/base/testing_profile.h
@@ -336,7 +336,6 @@ bool HasAnyOffTheRecordProfile() override; Profile* GetOriginalProfile() override; const Profile* GetOriginalProfile() const override; - bool IsSupervised() const override; bool IsChild() const override; bool AllowsBrowserWindows() const override; #if BUILDFLAG(ENABLE_EXTENSIONS)
diff --git a/chrome/test/data/webui/BUILD.gn b/chrome/test/data/webui/BUILD.gn index 330927ce..fdf4739 100644 --- a/chrome/test/data/webui/BUILD.gn +++ b/chrome/test/data/webui/BUILD.gn
@@ -96,7 +96,6 @@ "settings/privacy_sandbox_browsertest.js", "settings/settings_idle_load_browsertest.js", "support_tool/support_tool_browsertest.js", - "tab_search/tab_search_browsertest.js", "text_defaults_browsertest.js", "webui_resource_async_browsertest.js", "whats_new/whats_new_browsertest.js", @@ -447,6 +446,7 @@ "downloads/downloads_browsertest.js", "engagement/site_engagement_browsertest.js", "read_later/read_later_browsertest.js", + "tab_search/tab_search_browsertest.js", "usb_internals_browsertest.js", ] if (is_chromeos_ash) { @@ -625,6 +625,7 @@ "downloads:build_grdp", "read_later:build_grdp", "settings:build_grdp", + "tab_search:build_grdp", ] grdp_files = [ @@ -633,6 +634,7 @@ "$target_gen_dir/downloads/resources.grdp", "$target_gen_dir/read_later/resources.grdp", "$target_gen_dir/settings/resources.grdp", + "$target_gen_dir/tab_search/resources.grdp", "$target_gen_dir/web_ui_test_mojo_resources.grdp", ]
diff --git a/chrome/test/data/webui/settings/password_edit_dialog_test.js b/chrome/test/data/webui/settings/password_edit_dialog_test.js index b6d7810..663885c 100644 --- a/chrome/test/data/webui/settings/password_edit_dialog_test.js +++ b/chrome/test/data/webui/settings/password_edit_dialog_test.js
@@ -356,6 +356,7 @@ test('hasCorrectInitialStateWhenAddPassword', function() { const addDialog = elementFactory.createPasswordEditDialog(); assertAddDialogParts(addDialog); + assertEquals(true, addDialog.$.websiteInput.autofocus); assertEquals('', addDialog.$.websiteInput.value); assertEquals('', addDialog.$.usernameInput.value); assertEquals('', addDialog.$.passwordInput.value); @@ -370,10 +371,14 @@ addDialog.accountEmail = 'username@gmail.com'; const picker = addDialog.$.storePicker; assertFalse(isElementVisible(picker)); + assertEquals(false, picker.autofocus); + assertEquals(true, addDialog.$.websiteInput.autofocus); addDialog.isAccountStoreUser = true; flush(); assertTrue(isElementVisible(picker)); + assertEquals(true, picker.autofocus); + assertEquals(false, addDialog.$.websiteInput.autofocus); assertEquals( addDialog.i18n('addPasswordStoreOptionAccount', addDialog.accountEmail), picker.options[0].textContent.trim());
diff --git a/chrome/test/data/webui/tab_search/BUILD.gn b/chrome/test/data/webui/tab_search/BUILD.gn new file mode 100644 index 0000000..2c338a8 --- /dev/null +++ b/chrome/test/data/webui/tab_search/BUILD.gn
@@ -0,0 +1,42 @@ +# Copyright 2021 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("//tools/typescript/ts_library.gni") +import("//ui/webui/resources/tools/generate_grd.gni") + +generate_grd("build_grdp") { + grd_prefix = "webui_tab_search" + out_grd = "$target_gen_dir/resources.grdp" + + deps = [ ":build_ts" ] + manifest_files = [ "$target_gen_dir/tsconfig.manifest" ] + resource_path_prefix = "tab_search" +} + +ts_library("build_ts") { + root_dir = "./" + out_dir = "$target_gen_dir/tsc" + tsconfig_base = "tsconfig_base.json" + path_mappings = [ + "chrome://tab-search.top-chrome/*|" + + rebase_path("$root_gen_dir/chrome/browser/resources/tab_search/tsc/*", + target_gen_dir), + "chrome://webui-test/*|" + + rebase_path("$root_gen_dir/chrome/test/data/webui/tsc/*", + target_gen_dir), + ] + in_files = [ + "bimap_test.js", + "fuzzy_search_test.js", + "infinite_list_test.js", + "tab_search_app_focus_test.js", + "tab_search_app_test.js", + "tab_search_item_test.js", + "tab_search_test_data.js", + "tab_search_test_helper.js", + "test_tab_search_api_proxy.js", + ] + deps = [ "//chrome/browser/resources/tab_search:build_ts" ] + extra_deps = [ "..:generate_definitions" ] +}
diff --git a/chrome/test/data/webui/tab_search/bimap_test.js b/chrome/test/data/webui/tab_search/bimap_test.js index edc62bc..4663a22 100644 --- a/chrome/test/data/webui/tab_search/bimap_test.js +++ b/chrome/test/data/webui/tab_search/bimap_test.js
@@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'chrome://webui-test/mojo_webui_test_support.js'; + import {BiMap} from 'chrome://tab-search.top-chrome/tab_search.js'; -import {assertEquals} from '../../chai_assert.js'; +import {assertEquals} from 'chrome://webui-test/chai_assert.js'; suite('BiMapTest', () => { test('Base', async () => {
diff --git a/chrome/test/data/webui/tab_search/fuzzy_search_test.js b/chrome/test/data/webui/tab_search/fuzzy_search_test.js index 9a9c739..63c68cb 100644 --- a/chrome/test/data/webui/tab_search/fuzzy_search_test.js +++ b/chrome/test/data/webui/tab_search/fuzzy_search_test.js
@@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'chrome://webui-test/mojo_webui_test_support.js'; + import {fuzzySearch, TabData} from 'chrome://tab-search.top-chrome/tab_search.js'; -import {assertDeepEquals, assertEquals} from '../../chai_assert.js'; +import {assertDeepEquals, assertEquals} from 'chrome://webui-test/chai_assert.js'; /** * Assert search results return in specific order.
diff --git a/chrome/test/data/webui/tab_search/infinite_list_test.js b/chrome/test/data/webui/tab_search/infinite_list_test.js index a760d13e..b94e711 100644 --- a/chrome/test/data/webui/tab_search/infinite_list_test.js +++ b/chrome/test/data/webui/tab_search/infinite_list_test.js
@@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'chrome://webui-test/mojo_webui_test_support.js'; + import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {InfiniteList, TabData, TabSearchItem, TitleItem} from 'chrome://tab-search.top-chrome/tab_search.js'; -import {assertEquals, assertGT, assertNotEquals, assertTrue} from '../../chai_assert.js'; -import {flushTasks, waitAfterNextRender} from '../../test_util.js'; +import {assertEquals, assertGT, assertNotEquals, assertTrue} from 'chrome://webui-test/chai_assert.js'; +import {flushTasks, waitAfterNextRender} from 'chrome://webui-test/test_util.js'; import {generateSampleTabsFromSiteNames, sampleSiteNames} from './tab_search_test_data.js'; import {assertTabItemAndNeighborsInViewBounds, disableAnimationBehavior} from './tab_search_test_helper.js';
diff --git a/chrome/test/data/webui/tab_search/tab_search_app_focus_test.js b/chrome/test/data/webui/tab_search/tab_search_app_focus_test.js index 1002ee71..4affae89 100644 --- a/chrome/test/data/webui/tab_search/tab_search_app_focus_test.js +++ b/chrome/test/data/webui/tab_search/tab_search_app_focus_test.js
@@ -6,8 +6,8 @@ import {keyDownOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; import {InfiniteList, ProfileData, TabSearchApiProxyImpl, TabSearchAppElement, TabSearchItem, TabSearchSearchField, TabsRemovedInfo} from 'chrome://tab-search.top-chrome/tab_search.js'; -import {assertEquals, assertGT, assertNotEquals} from '../../chai_assert.js'; -import {flushTasks, waitAfterNextRender} from '../../test_util.js'; +import {assertEquals, assertGT, assertNotEquals} from 'chrome://webui-test/chai_assert.js'; +import {flushTasks, waitAfterNextRender} from 'chrome://webui-test/test_util.js'; import {generateSampleDataFromSiteNames, sampleData, sampleSiteNames} from './tab_search_test_data.js'; import {assertTabItemAndNeighborsInViewBounds, disableAnimationBehavior, initLoadTimeDataWithDefaults} from './tab_search_test_helper.js';
diff --git a/chrome/test/data/webui/tab_search/tab_search_app_test.js b/chrome/test/data/webui/tab_search/tab_search_app_test.js index b6971c77..bf4142c 100644 --- a/chrome/test/data/webui/tab_search/tab_search_app_test.js +++ b/chrome/test/data/webui/tab_search/tab_search_app_test.js
@@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'chrome://webui-test/mojo_webui_test_support.js'; + import {keyDownOn} from 'chrome://resources/polymer/v3_0/iron-test-helpers/mock-interactions.js'; import {ProfileData, RecentlyClosedTab, Tab, TabGroup, TabGroupColor, TabSearchApiProxyImpl, TabSearchAppElement, TabSearchSearchField, TabsRemovedInfo, TabUpdateInfo} from 'chrome://tab-search.top-chrome/tab_search.js'; -import {assertEquals, assertFalse, assertNotEquals, assertTrue} from '../../chai_assert.js'; -import {flushTasks, waitAfterNextRender} from '../../test_util.js'; +import {assertEquals, assertFalse, assertNotEquals, assertTrue} from 'chrome://webui-test/chai_assert.js'; +import {flushTasks, waitAfterNextRender} from 'chrome://webui-test/test_util.js'; import {generateSampleDataFromSiteNames, generateSampleRecentlyClosedTabs, generateSampleTabsFromSiteNames, SAMPLE_RECENTLY_CLOSED_DATA, SAMPLE_WINDOW_DATA, SAMPLE_WINDOW_HEIGHT, sampleData, sampleToken} from './tab_search_test_data.js'; import {initLoadTimeDataWithDefaults, initProfileDataWithDefaults} from './tab_search_test_helper.js';
diff --git a/chrome/test/data/webui/tab_search/tab_search_browsertest.js b/chrome/test/data/webui/tab_search/tab_search_browsertest.js index fd475bf6..2c7bf1b0 100644 --- a/chrome/test/data/webui/tab_search/tab_search_browsertest.js +++ b/chrome/test/data/webui/tab_search/tab_search_browsertest.js
@@ -20,7 +20,7 @@ var TabSearchAppTest = class extends TabSearchBrowserTest { /** @override */ get browsePreload() { - return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/tab_search_app_test.js'; + return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/tab_search_app_test.js&host=webui-test'; } }; @@ -31,7 +31,7 @@ var BiMapTest = class extends TabSearchBrowserTest { /** @override */ get browsePreload() { - return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/bimap_test.js'; + return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/bimap_test.js&host=webui-test'; } }; @@ -42,7 +42,7 @@ var FuzzySearchTest = class extends TabSearchBrowserTest { /** @override */ get browsePreload() { - return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/fuzzy_search_test.js'; + return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/fuzzy_search_test.js&host=webui-test'; } }; @@ -53,7 +53,7 @@ var InfiniteListTest = class extends TabSearchBrowserTest { /** @override */ get browsePreload() { - return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/infinite_list_test.js'; + return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/infinite_list_test.js&host=webui-test'; } }; @@ -64,7 +64,7 @@ var TabSearchItemTest = class extends TabSearchBrowserTest { /** @override */ get browsePreload() { - return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/tab_search_item_test.js'; + return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/tab_search_item_test.js&host=webui-test'; } };
diff --git a/chrome/test/data/webui/tab_search/tab_search_interactive_ui_tests.js b/chrome/test/data/webui/tab_search/tab_search_interactive_ui_tests.js index 662ed381..96881d49 100644 --- a/chrome/test/data/webui/tab_search/tab_search_interactive_ui_tests.js +++ b/chrome/test/data/webui/tab_search/tab_search_interactive_ui_tests.js
@@ -13,7 +13,7 @@ var TabSearchInteractiveUITest = class extends PolymerInteractiveUITest { /** @override */ get browsePreload() { - return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/tab_search_app_focus_test.js'; + return 'chrome://tab-search.top-chrome/test_loader.html?module=tab_search/tab_search_app_focus_test.js&host=webui-test'; } };
diff --git a/chrome/test/data/webui/tab_search/tab_search_item_test.js b/chrome/test/data/webui/tab_search/tab_search_item_test.js index 131facb..ec4a7fd 100644 --- a/chrome/test/data/webui/tab_search/tab_search_item_test.js +++ b/chrome/test/data/webui/tab_search/tab_search_item_test.js
@@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import 'chrome://webui-test/mojo_webui_test_support.js'; + import {Tab, TabAlertState, TabData, TabGroup, TabGroupColor, TabItemType, TabSearchItem} from 'chrome://tab-search.top-chrome/tab_search.js'; -import {assertDeepEquals, assertEquals, assertNotEquals} from '../chai_assert.js'; -import {flushTasks} from '../test_util.js'; +import {assertDeepEquals, assertEquals, assertNotEquals} from 'chrome://webui-test/chai_assert.js'; +import {flushTasks} from 'chrome://webui-test/test_util.js'; import {sampleToken} from './tab_search_test_data.js';
diff --git a/chrome/test/data/webui/tab_search/tab_search_test_helper.js b/chrome/test/data/webui/tab_search/tab_search_test_helper.js index e333972..4051298 100644 --- a/chrome/test/data/webui/tab_search/tab_search_test_helper.js +++ b/chrome/test/data/webui/tab_search/tab_search_test_helper.js
@@ -3,7 +3,7 @@ // found in the LICENSE file. import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {assertGE, assertLE} from '../../chai_assert.js'; +import {assertGE, assertLE} from 'chrome://webui-test/chai_assert.js'; /** * Override the specified function and parameters for the given class to avoid
diff --git a/chrome/test/data/webui/tab_search/test_tab_search_api_proxy.js b/chrome/test/data/webui/tab_search/test_tab_search_api_proxy.js index e77f829..7db2225 100644 --- a/chrome/test/data/webui/tab_search/test_tab_search_api_proxy.js +++ b/chrome/test/data/webui/tab_search/test_tab_search_api_proxy.js
@@ -4,7 +4,7 @@ import {PageCallbackRouter, PageRemote, ProfileData} from 'chrome://tab-search.top-chrome/tab_search.js'; -import {TestBrowserProxy} from '../test_browser_proxy.js'; +import {TestBrowserProxy} from 'chrome://webui-test/test_browser_proxy.js'; /** @implements {TabSearchApiProxy} */ export class TestTabSearchApiProxy extends TestBrowserProxy {
diff --git a/chrome/test/data/webui/tab_search/tsconfig_base.json b/chrome/test/data/webui/tab_search/tsconfig_base.json new file mode 100644 index 0000000..eeddfb3 --- /dev/null +++ b/chrome/test/data/webui/tab_search/tsconfig_base.json
@@ -0,0 +1,9 @@ +{ + "extends": "../../../../../tools/typescript/tsconfig_base.json", + "compilerOptions": { + "allowJs": true, + "typeRoots": [ + "./../../../../../third_party/node/node_modules/@types" + ] + } +}
diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc index 86bef70..955f4eac 100644 --- a/chrome/test/ppapi/ppapi_browsertest.cc +++ b/chrome/test/ppapi/ppapi_browsertest.cc
@@ -1787,10 +1787,22 @@ LIST_TEST(WebSocket_UtilityBufferedAmount) \ ) -IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket1) { +// TODO(https://crbug.com/1277909): Flaky on Mac and Windows builders. +#if defined(OS_MAC) || defined(OS_WIN) +#define MAYBE_WebSocket1 DISABLED_WebSocket1 +#else +#define MAYBE_WebSocket1 WebSocket1 +#endif +IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_WebSocket1) { RUN_WEBSOCKET_SUBTESTS_1; } -IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, WebSocket2) { +// TODO(https://crbug.com/1277909): Flaky on Mac and Windows builders. +#if defined(OS_MAC) || defined(OS_WIN) +#define MAYBE_WebSocket2 DISABLED_WebSocket2 +#else +#define MAYBE_WebSocket2 WebSocket2 +#endif +IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, MAYBE_WebSocket2) { RUN_WEBSOCKET_SUBTESTS_2; } IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, MAYBE_PPAPI_NACL(WebSocket1)) {
diff --git a/chromeos/components/BUILD.gn b/chromeos/components/BUILD.gn index 3d647b5..490224d 100644 --- a/chromeos/components/BUILD.gn +++ b/chromeos/components/BUILD.gn
@@ -31,7 +31,6 @@ "//chromeos/components/sensors:unit_tests", "//chromeos/components/string_matching:unit_tests", "//chromeos/components/sync_wifi:unit_tests", - "//chromeos/components/tether:unit_tests", "//mojo/core/embedder", "//ui/base:base", ]
diff --git a/chromeos/components/tether/DIR_METADATA b/chromeos/components/tether/DIR_METADATA deleted file mode 100644 index c34c17f..0000000 --- a/chromeos/components/tether/DIR_METADATA +++ /dev/null
@@ -1 +0,0 @@ -mixins: "//chromeos/components/tether/COMMON_METADATA"
diff --git a/chromeos/services/libassistant/grpc/assistant_client_impl.cc b/chromeos/services/libassistant/grpc/assistant_client_impl.cc index 86924162..7bb1faf 100644 --- a/chromeos/services/libassistant/grpc/assistant_client_impl.cc +++ b/chromeos/services/libassistant/grpc/assistant_client_impl.cc
@@ -206,8 +206,24 @@ NOTIMPLEMENTED(); } +void AssistantClientImpl::StartVoiceInteraction() { + libassistant_client_.CallServiceMethod( + ::assistant::api::StartVoiceQueryRequest(), + GetLoggingCallback<::assistant::api::StartVoiceQueryResponse>( + /*request_name=*/__func__), + kInteractionDefaultStateConfig); +} + void AssistantClientImpl::StopAssistantInteraction(bool cancel_conversation) { - NOTIMPLEMENTED(); + ::assistant::api::StopQueryRequest request; + request.set_type(::assistant::api::StopQueryRequest::ACTIVE_INTERNAL); + request.set_cancel_conversation(cancel_conversation); + + libassistant_client_.CallServiceMethod( + request, + GetLoggingCallback<::assistant::api::StopQueryResponse>( + /*request_name=*/__func__), + kInteractionDefaultStateConfig); } void AssistantClientImpl::SetAuthenticationInfo(const AuthTokens& tokens) {
diff --git a/chromeos/services/libassistant/grpc/assistant_client_impl.h b/chromeos/services/libassistant/grpc/assistant_client_impl.h index e7ce288f..74891c59 100644 --- a/chromeos/services/libassistant/grpc/assistant_client_impl.h +++ b/chromeos/services/libassistant/grpc/assistant_client_impl.h
@@ -63,6 +63,7 @@ assistant_client::ActionModule* action_module) override; void SendScreenContextRequest( const std::vector<std::string>& context_protos) override; + void StartVoiceInteraction() override; void StopAssistantInteraction(bool cancel_conversation) override; // Settings-related setters:
diff --git a/chromeos/services/libassistant/grpc/grpc_libassistant_client.cc b/chromeos/services/libassistant/grpc/grpc_libassistant_client.cc index dbd5482..17c05955 100644 --- a/chromeos/services/libassistant/grpc/grpc_libassistant_client.cc +++ b/chromeos/services/libassistant/grpc/grpc_libassistant_client.cc
@@ -7,6 +7,7 @@ #include <memory> #include "base/check.h" +#include "chromeos/assistant/internal/internal_constants.h" #include "chromeos/assistant/internal/libassistant_util.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/alarm_timer_interface.pb.h" #include "chromeos/assistant/internal/proto/shared/proto/v2/audio_utils_interface.pb.h" @@ -67,8 +68,9 @@ template <> std::string GetLibassistGrpcMethodName<::assistant::api::SendQueryRequest>() { // QueryService handles queries sent from libassistant customers. - return chromeos::assistant::GetLibassistGrpcMethodName("QueryService", - "SendQuery"); + return chromeos::assistant::GetLibassistGrpcMethodName( + chromeos::assistant::kQueryServiceName, + chromeos::assistant::kSendQueryMethodName); } template <> @@ -77,7 +79,23 @@ // QueryService handles RegisterActionModule sent from // libassistant customers to register themselves to handle actions. return chromeos::assistant::GetLibassistGrpcMethodName( - "QueryService", "RegisterActionModule"); + chromeos::assistant::kQueryServiceName, + chromeos::assistant::kRegisterActionModuleMethodName); +} + +template <> +std::string +GetLibassistGrpcMethodName<::assistant::api::StartVoiceQueryRequest>() { + return chromeos::assistant::GetLibassistGrpcMethodName( + chromeos::assistant::kQueryServiceName, + chromeos::assistant::kStartVoiceQueryMethodName); +} + +template <> +std::string GetLibassistGrpcMethodName<::assistant::api::StopQueryRequest>() { + return chromeos::assistant::GetLibassistGrpcMethodName( + chromeos::assistant::kQueryServiceName, + chromeos::assistant::kStopQueryMethodName); } template <>
diff --git a/components/autofill/core/browser/autofill_suggestion_generator.cc b/components/autofill/core/browser/autofill_suggestion_generator.cc index a294e85..e9594ff 100644 --- a/components/autofill/core/browser/autofill_suggestion_generator.cc +++ b/components/autofill/core/browser/autofill_suggestion_generator.cc
@@ -246,12 +246,14 @@ if (virtual_card_option) { #if defined(OS_ANDROID) + // Set the IPH feature in order to show the IPH bubble when the virtual + // card is presented in the keyboard accessory. + suggestion.feature_for_iph = + feature_engagement::kIPHKeyboardAccessoryPaymentVirtualCardFeature.name; suggestion.custom_icon_url = credit_card.card_art_url(); #endif // OS_ANDROID suggestion.frontend_id = POPUP_ITEM_ID_VIRTUAL_CREDIT_CARD_ENTRY; - suggestion.feature_for_iph = - feature_engagement::kIPHAutofillVirtualCardSuggestionFeature.name; gfx::Image* image = personal_data_->GetCreditCardArtImageForUrl( card_art_url_for_virtual_card_option);
diff --git a/components/autofill/core/browser/payments/autofill_save_card_infobar_delegate_mobile.h b/components/autofill/core/browser/payments/autofill_save_card_infobar_delegate_mobile.h index d9af11f..d0697646 100644 --- a/components/autofill/core/browser/payments/autofill_save_card_infobar_delegate_mobile.h +++ b/components/autofill/core/browser/payments/autofill_save_card_infobar_delegate_mobile.h
@@ -32,7 +32,7 @@ // will be executed. // If |upload| is true, |displayed_target_account| should be the account to // which the card will be saved. If |upload| is false, it must be empty. - // TODO(crbug.com/1206190): Split into 2 static constructors (local/cloud), + // TODO(crbug.com/1277904): Split into 2 static constructors (local/cloud), // each with the minimum set of required parameters. Also consider merging // the 2 callbacks into one. AutofillSaveCardInfoBarDelegateMobile(
diff --git a/components/autofill/core/common/autofill_prefs.cc b/components/autofill/core/common/autofill_prefs.cc index 14881f2..2c25dae1 100644 --- a/components/autofill/core/common/autofill_prefs.cc +++ b/components/autofill/core/common/autofill_prefs.cc
@@ -325,7 +325,7 @@ void ClearSyncTransportOptIns(PrefService* prefs) { DictionaryPrefUpdate update(prefs, prefs::kAutofillSyncTransportOptIn); - update->Clear(); + update->DictClear(); } } // namespace prefs
diff --git a/components/autofill_assistant/browser/BUILD.gn b/components/autofill_assistant/browser/BUILD.gn index 87056a1..ea05f0f 100644 --- a/components/autofill_assistant/browser/BUILD.gn +++ b/components/autofill_assistant/browser/BUILD.gn
@@ -198,6 +198,9 @@ "service/access_token_fetcher.h", "service/api_key_fetcher.cc", "service/api_key_fetcher.h", + "service/cup.cc", + "service/cup.h", + "service/rpc_type.h", "service/server_url_fetcher.cc", "service/server_url_fetcher.h", "service/service.h", @@ -298,6 +301,7 @@ "//components/autofill_assistant/browser/devtools", "//components/autofill_assistant/browser/public:public", "//components/autofill_assistant/content/browser", + "//components/client_update_protocol", "//components/google/core/common:common", "//components/keyed_service/core", "//components/password_manager/content/browser:browser", @@ -430,6 +434,7 @@ "script_tracker_unittest.cc", "selector_unittest.cc", "service/api_key_fetcher_unittest.cc", + "service/cup_unittest.cc", "service/mock_access_token_fetcher.cc", "service/mock_access_token_fetcher.h", "service/mock_service_request_sender.cc",
diff --git a/components/autofill_assistant/browser/DEPS b/components/autofill_assistant/browser/DEPS index e1b3844..181aa07 100644 --- a/components/autofill_assistant/browser/DEPS +++ b/components/autofill_assistant/browser/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "+chrome/android/features/autofill_assistant/test_support_jni_headers", "+components/autofill", + "+components/client_update_protocol", "+components/google/core/common", "+components/keyed_service/core", "+components/password_manager/content/browser",
diff --git a/components/autofill_assistant/browser/fake_script_executor_delegate.cc b/components/autofill_assistant/browser/fake_script_executor_delegate.cc index b6f2276..efdb512d 100644 --- a/components/autofill_assistant/browser/fake_script_executor_delegate.cc +++ b/components/autofill_assistant/browser/fake_script_executor_delegate.cc
@@ -76,7 +76,9 @@ } void FakeScriptExecutorDelegate::SetTouchableElementArea( - const ElementAreaProto& element) {} + const ElementAreaProto& element_area) { + touchable_element_area_history_.emplace_back(element_area); +} void FakeScriptExecutorDelegate::SetStatusMessage(const std::string& message) { status_message_ = message;
diff --git a/components/autofill_assistant/browser/fake_script_executor_delegate.h b/components/autofill_assistant/browser/fake_script_executor_delegate.h index 2a01a707..75a19f4d 100644 --- a/components/autofill_assistant/browser/fake_script_executor_delegate.h +++ b/components/autofill_assistant/browser/fake_script_executor_delegate.h
@@ -137,6 +137,9 @@ std::vector<AutofillAssistantState> GetStateHistory() { return state_history_; } + std::vector<ElementAreaProto> GetTouchableElementAreaHistory() { + return touchable_element_area_history_; + } const std::vector<Details>& GetDetails() { return details_; } @@ -172,6 +175,7 @@ raw_ptr<WebController> web_controller_ = nullptr; std::unique_ptr<TriggerContext> trigger_context_; std::vector<AutofillAssistantState> state_history_; + std::vector<ElementAreaProto> touchable_element_area_history_; std::string status_message_; std::string tts_message_; std::string bubble_message_;
diff --git a/components/autofill_assistant/browser/features.cc b/components/autofill_assistant/browser/features.cc index 725880d..8e69cc7 100644 --- a/components/autofill_assistant/browser/features.cc +++ b/components/autofill_assistant/browser/features.cc
@@ -22,6 +22,18 @@ const base::Feature kAutofillAssistantChromeEntry{ "AutofillAssistantChromeEntry", base::FEATURE_ENABLED_BY_DEFAULT}; +// Controls whether RPC responses from the backend should be verified for +// |GetActions| calls. +const base::Feature kAutofillAssistantVerifyGetActionsResponses{ + "AutofillAssistantVerifyGetActionsResponses", + base::FEATURE_DISABLED_BY_DEFAULT}; + +// Controls whether RPC requests to the backend should be signed for +// |GetActions| calls. +const base::Feature kAutofillAssistantSignGetActionsRequests{ + "AutofillAssistantSignGetActionsRequests", + base::FEATURE_DISABLED_BY_DEFAULT}; + // Controls whether to enable dialog onboarding for Autofill Assistant const base::Feature kAutofillAssistantDialogOnboarding{ "AutofillAssistantDialogOnboarding", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/components/autofill_assistant/browser/features.h b/components/autofill_assistant/browser/features.h index 4b8179b7..26cec00 100644 --- a/components/autofill_assistant/browser/features.h +++ b/components/autofill_assistant/browser/features.h
@@ -26,7 +26,9 @@ extern const base::Feature kAutofillAssistantFeedbackChip; extern const base::Feature kAutofillAssistantLoadDFMForTriggerScripts; extern const base::Feature kAutofillAssistantProactiveHelp; +extern const base::Feature kAutofillAssistantSignGetActionsRequests; extern const base::Feature kAutofillAssistantUrlHeuristics; +extern const base::Feature kAutofillAssistantVerifyGetActionsResponses; } // namespace features } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/script_executor.cc b/components/autofill_assistant/browser/script_executor.cc index 9d74aee..345cc77 100644 --- a/components/autofill_assistant/browser/script_executor.cc +++ b/components/autofill_assistant/browser/script_executor.cc
@@ -1248,6 +1248,8 @@ /* listener= */ this, &no_interrupts_, delegate_); delegate_->EnterState(AutofillAssistantState::RUNNING); delegate_->SetUserActions(nullptr); + // Note that we don't clear the touchable area in the delegate here. + // TODO(b/209732258): check whether this is a bug. interrupt_executor_->Run( main_script_->user_data_, base::BindOnce(&ScriptExecutor::WaitForDomOperation::OnInterruptDone, @@ -1312,6 +1314,9 @@ delegate_->SetStatusMessage(saved_pre_interrupt_state_->status_message); delegate_->EnterState(saved_pre_interrupt_state_->controller_state); + if (main_script_->touchable_element_area_) { + delegate_->SetTouchableElementArea(*main_script_->touchable_element_area_); + } } void ScriptExecutor::WaitForDomOperation::RestorePreInterruptScroll() {
diff --git a/components/autofill_assistant/browser/script_executor_unittest.cc b/components/autofill_assistant/browser/script_executor_unittest.cc index c676fea5..2e3b4fe5 100644 --- a/components/autofill_assistant/browser/script_executor_unittest.cc +++ b/components/autofill_assistant/browser/script_executor_unittest.cc
@@ -45,6 +45,13 @@ using ::testing::UnorderedElementsAreArray; using ::testing::WithArgs; +ElementAreaProto MakeElementAreaProto(const std::string& id) { + Selector touchable_element({id}); + ElementAreaProto area; + *area.add_touchable()->add_elements() = touchable_element.proto; + return area; +} + const char* kScriptPath = "script_path"; class ScriptExecutorTest : public testing::Test, @@ -1196,12 +1203,33 @@ } TEST_F(ScriptExecutorTest, RunInterruptDuringPrompt) { - SetupInterrupt("interrupt", "interrupt_trigger"); + RegisterInterrupt("interrupt", "interrupt_trigger"); + + ActionsResponseProto interrupt_actions; + InitInterruptActions(&interrupt_actions, "interrupt"); + ElementAreaProto interrupt_area = + MakeElementAreaProto(/* id = */ "interrupt_area"); + *interrupt_actions.add_actions() + ->mutable_set_touchable_area() + ->mutable_element_area() = interrupt_area; + auto* interrupt_prompt = interrupt_actions.add_actions()->mutable_prompt(); + *interrupt_prompt->add_choices() + ->mutable_auto_select_when() + ->mutable_match() = ToSelectorProto("end_prompt"); + + EXPECT_CALL(mock_service_, OnGetActions("interrupt", _, _, _, _, _)) + .WillRepeatedly( + RunOnceCallback<5>(net::HTTP_OK, Serialize(interrupt_actions))); // Main script has a prompt with an "auto_select" element. This functions very // much like a WaitForDom, except for the UI changes triggered by the switches // between PROMPT and RUNNING states. ActionsResponseProto interruptible; + ElementAreaProto interruptible_area = + MakeElementAreaProto(/* id = */ "interruptible_area"); + *interruptible.add_actions() + ->mutable_set_touchable_area() + ->mutable_element_area() = interruptible_area; auto* prompt_action = interruptible.add_actions()->mutable_prompt(); prompt_action->set_allow_interrupt(true); *prompt_action->add_choices()->mutable_auto_select_when()->mutable_match() = @@ -1237,15 +1265,30 @@ // - show prompt (enter PROMPT state) // - notice interrupt_trigger element // - run interrupt (enter RUNNING state) + // - show the interrupt's prompt (enter PROMPT state) + // - the interrupt finishes (enter RUNNING state) // - show prompt again (enter PROMPT state) // - notice end_prompt element // - end prompt, continue main script (enter RUNNING state) // - run tell, which sets message to "done" - EXPECT_THAT(delegate_.GetStateHistory(), - ElementsAre(AutofillAssistantState::PROMPT, - AutofillAssistantState::RUNNING, - AutofillAssistantState::PROMPT, - AutofillAssistantState::RUNNING)); + EXPECT_THAT( + delegate_.GetStateHistory(), + ElementsAre( + AutofillAssistantState::PROMPT, AutofillAssistantState::RUNNING, + AutofillAssistantState::PROMPT, AutofillAssistantState::RUNNING, + AutofillAssistantState::PROMPT, AutofillAssistantState::RUNNING)); + // Expected scenario: + // - the main script's SetTouchableArea sets |interruptible_area| + // - the interrupt starts + // - the interrupt's SetTouchableArea sets |interrupt_area| + // - the area is cleaned up at the end of the interrupt's prompt + // - when the main script resumes, we restore |interruptible_area| + // - the area is cleaned up again at the end of the main script's prompt + EXPECT_THAT( + delegate_.GetTouchableElementAreaHistory(), + ElementsAre(interruptible_area, interrupt_area, + ElementAreaProto::default_instance(), interruptible_area, + ElementAreaProto::default_instance())); EXPECT_EQ("done", delegate_.GetStatusMessage()); }
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index 6c686d4..a429851 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -467,10 +467,10 @@ message CUPRequestData { // A serialized ScriptActionRequestProto. optional bytes request = 1; - // The ID of the public key that the client will use to verify the response - // signature. - optional bytes public_key_id = 2; - optional bytes nonce = 3; + // Combination of public key id and random nonce. + optional bytes query_cup2key = 2; + // SHA2 hash of the request. + optional bytes hash_hex = 3; } message ScriptActionRequestProto {
diff --git a/components/autofill_assistant/browser/service/cup.cc b/components/autofill_assistant/browser/service/cup.cc new file mode 100644 index 0000000..2684e02 --- /dev/null +++ b/components/autofill_assistant/browser/service/cup.cc
@@ -0,0 +1,112 @@ +// Copyright 2021 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 "cup.h" + +#include "base/base64.h" +#include "base/feature_list.h" +#include "base/strings/string_number_conversions.h" +#include "base/strings/string_split.h" +#include "components/autofill_assistant/browser/features.h" +#include "components/autofill_assistant/browser/service.pb.h" +#include "components/client_update_protocol/ecdsa.h" + +namespace { + +// This is an ECDSA prime256v1 named-curve key. +constexpr int kKeyVersion = 11; +constexpr char kKeyPubBytesBase64[] = + "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgH30WRJf4g6I2C1FKsBQF3qHANLw" + "thwYsNt2PWTDQBS0ufSRE83piOPoJQcePzTkMfbghjnZerDjLJhBsDkfFg=="; + +std::string GetKey(const char* key_bytes_base64) { + std::string result; + return base::Base64Decode(std::string(key_bytes_base64), &result) + ? result + : std::string(); +} + +bool ShouldSignGetActionsRequests() { + return base::FeatureList::IsEnabled( + autofill_assistant::features::kAutofillAssistantSignGetActionsRequests); +} + +bool ShouldVerifyGetActionsResponses() { + return ShouldSignGetActionsRequests() && + base::FeatureList::IsEnabled( + autofill_assistant::features:: + kAutofillAssistantVerifyGetActionsResponses); +} + +} // namespace + +namespace autofill_assistant { + +std::unique_ptr<client_update_protocol::Ecdsa> CUP::CreateQuerySigner() { + return client_update_protocol::Ecdsa::Create(kKeyVersion, + GetKey(kKeyPubBytesBase64)); +} + +bool CUP::ShouldSignRequests(RpcType rpc_type) { + return ShouldSignGetActionsRequests() && rpc_type == RpcType::GET_ACTIONS; +} + +bool CUP::ShouldVerifyResponses(RpcType rpc_type) { + return ShouldVerifyGetActionsResponses() && rpc_type == RpcType::GET_ACTIONS; +} + +CUP::CUP(std::unique_ptr<client_update_protocol::Ecdsa> query_signer) + : query_signer_{std::move(query_signer)} { + DCHECK(query_signer_); +} + +CUP::~CUP() = default; + +std::string CUP::PackAndSignRequest(const std::string& original_request) { + return PackGetActionsRequest(original_request); +} + +absl::optional<std::string> CUP::UnpackResponse( + const std::string& original_response) { + return UnpackGetActionsResponse(original_response); +} + +std::string CUP::PackGetActionsRequest(const std::string& original_request) { + autofill_assistant::ScriptActionRequestProto actions_request; + actions_request.mutable_cup_data()->set_request(original_request); + + client_update_protocol::Ecdsa::RequestParameters request_parameters = + query_signer_->SignRequest(original_request); + actions_request.mutable_cup_data()->set_query_cup2key( + request_parameters.query_cup2key); + actions_request.mutable_cup_data()->set_hash_hex(request_parameters.hash_hex); + + std::string serialized_request; + actions_request.SerializeToString(&serialized_request); + return serialized_request; +} + +absl::optional<std::string> CUP::UnpackGetActionsResponse( + const std::string& original_response) { + autofill_assistant::ActionsResponseProto actions_response; + if (!actions_response.ParseFromString(original_response)) { + LOG(ERROR) << "Failed to parse server response"; + return absl::nullopt; + } + + std::string serialized_response = actions_response.cup_data().response(); + if (!query_signer_->ValidateResponse( + serialized_response, actions_response.cup_data().ecdsa_signature())) { + LOG(ERROR) << "CUP RPC response verification failed"; + return absl::nullopt; + } + + return serialized_response; +} + +client_update_protocol::Ecdsa& CUP::GetQuerySigner() { + return *query_signer_.get(); +} + +} // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/service/cup.h b/components/autofill_assistant/browser/service/cup.h new file mode 100644 index 0000000..3b52180c --- /dev/null +++ b/components/autofill_assistant/browser/service/cup.h
@@ -0,0 +1,69 @@ +// Copyright 2021 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_AUTOFILL_ASSISTANT_BROWSER_SERVICE_CUP_H_ +#define COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SERVICE_CUP_H_ + +#include "components/autofill_assistant/browser/service/rpc_type.h" +#include "components/client_update_protocol/ecdsa.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace autofill_assistant { + +// Implementation of the Client Update Protocol (CUP) for the service calls in +// |autofill_assistant|. +// https://source.chromium.org/chromium/chromium/src/+/main:docs/updater/cup.md +// +// Due to server-side constraints, the CUP information cannot be exchanged over +// HTTP headers, and is sent as part of the request and response body instead. +// +// This class can only be used once per service call. +class CUP { + public: + static std::unique_ptr<client_update_protocol::Ecdsa> CreateQuerySigner(); + + // Whether |PackAndSignRequest| should be called before the request is + // submitted. Can be |false| because signing is disabled via feature flag, + // or given message type doesn't support CUP signing. + static bool ShouldSignRequests(RpcType rpc_type); + + // Whether |UnpackResponse| should be called on the response from the service + // call. Can be false because verification is disabled via feature flag or + // |ShouldSignRequest| returns |false|. + static bool ShouldVerifyResponses(RpcType rpc_type); + + CUP(std::unique_ptr<client_update_protocol::Ecdsa> query_signer); + CUP(const CUP&) = delete; + CUP& operator=(const CUP&) = delete; + ~CUP(); + + // Generates a new |request| where |original_request| is packed and signed in + // its |cup_data| field. + // + // Should only be called if |ShouldSignRequest| returns true. + std::string PackAndSignRequest(const std::string& original_request); + + // Generates a new |response| where |original_response| is unpacked from + // the |cup_data| field. + // + // Should only be called if |ShouldVerifyResponse| returns true. + absl::optional<std::string> UnpackResponse( + const std::string& original_response); + + // Gets the query signer object being used by this CUP instance. Needed for + // testing. + client_update_protocol::Ecdsa& GetQuerySigner(); + + private: + std::string PackGetActionsRequest(const std::string& original_request); + + absl::optional<std::string> UnpackGetActionsResponse( + const std::string& original_response); + + std::unique_ptr<client_update_protocol::Ecdsa> query_signer_; +}; + +} // namespace autofill_assistant + +#endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SERVICE_CUP_H_
diff --git a/components/autofill_assistant/browser/service/cup_unittest.cc b/components/autofill_assistant/browser/service/cup_unittest.cc new file mode 100644 index 0000000..cf874932f --- /dev/null +++ b/components/autofill_assistant/browser/service/cup_unittest.cc
@@ -0,0 +1,149 @@ +// 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 "cup.h" + +#include "base/test/scoped_feature_list.h" +#include "components/autofill_assistant/browser/features.h" +#include "components/autofill_assistant/browser/service.pb.h" +#include "testing/gmock/include/gmock/gmock.h" + +namespace { + +class CUPTest : public testing::Test { + public: + CUPTest() : cup_{autofill_assistant::CUP::CreateQuerySigner()} {} + ~CUPTest() override = default; + + protected: + autofill_assistant::CUP cup_; + base::test::ScopedFeatureList scoped_feature_list_; + + void InitCupFeatures(bool enableSigning, bool enableVerifying) { + std::vector<base::Feature> enabled_features; + std::vector<base::Feature> disabled_features; + + if (enableSigning) { + enabled_features.push_back(autofill_assistant::features:: + kAutofillAssistantSignGetActionsRequests); + } else { + disabled_features.push_back(autofill_assistant::features:: + kAutofillAssistantSignGetActionsRequests); + } + + if (enableVerifying) { + enabled_features.push_back( + autofill_assistant::features:: + kAutofillAssistantVerifyGetActionsResponses); + } else { + disabled_features.push_back( + autofill_assistant::features:: + kAutofillAssistantVerifyGetActionsResponses); + } + + scoped_feature_list_.Reset(); + scoped_feature_list_.InitWithFeatures(enabled_features, disabled_features); + } +}; + +TEST_F(CUPTest, ShouldSignGetActionsRequestWhenFeatureActivated) { + InitCupFeatures(true, false); + + EXPECT_TRUE(autofill_assistant::CUP::ShouldSignRequests( + autofill_assistant::RpcType::GET_ACTIONS)); +} + +TEST_F(CUPTest, ShouldNotSignGetActionsRequestWhenFeatureNotActivated) { + InitCupFeatures(false, false); + + EXPECT_FALSE(autofill_assistant::CUP::ShouldSignRequests( + autofill_assistant::RpcType::GET_ACTIONS)); +} + +TEST_F(CUPTest, ShouldNotSignNotGetActionsRequest) { + InitCupFeatures(true, false); + + EXPECT_FALSE(autofill_assistant::CUP::ShouldSignRequests( + autofill_assistant::RpcType::GET_TRIGGER_SCRIPTS)); +} + +TEST_F(CUPTest, ShouldVerifyGetActionsResponseWhenFeatureActivated) { + InitCupFeatures(true, true); + + EXPECT_TRUE(autofill_assistant::CUP::ShouldVerifyResponses( + autofill_assistant::RpcType::GET_ACTIONS)); +} + +TEST_F(CUPTest, ShouldNotVerifyGetActionsResponseWhenFeatureNotActivated) { + InitCupFeatures(true, false); + + EXPECT_FALSE(autofill_assistant::CUP::ShouldVerifyResponses( + autofill_assistant::RpcType::GET_ACTIONS)); +} + +TEST_F(CUPTest, ShouldNotVerifyGetActionsResponseWhenSigningNotActivated) { + InitCupFeatures(false, true); + + EXPECT_FALSE(autofill_assistant::CUP::ShouldVerifyResponses( + autofill_assistant::RpcType::GET_ACTIONS)); +} + +TEST_F(CUPTest, ShouldNotVerifyNotGetActionsResponse) { + InitCupFeatures(true, true); + + EXPECT_FALSE(autofill_assistant::CUP::ShouldVerifyResponses( + autofill_assistant::RpcType::GET_TRIGGER_SCRIPTS)); +} + +TEST_F(CUPTest, PacksAndSignsGetActionsRequest) { + InitCupFeatures(true, false); + + autofill_assistant::ScriptActionRequestProto user_request; + user_request.mutable_client_context()->set_experiment_ids("test"); + std::string user_request_str; + user_request.SerializeToString(&user_request_str); + + auto packed_request_str = cup_.PackAndSignRequest(user_request_str); + + autofill_assistant::ScriptActionRequestProto packed_request; + EXPECT_TRUE(packed_request.ParseFromString(packed_request_str)); + EXPECT_TRUE(packed_request.client_context().experiment_ids().empty()); + EXPECT_FALSE(packed_request.cup_data().request().empty()); + EXPECT_FALSE(packed_request.cup_data().query_cup2key().empty()); + EXPECT_FALSE(packed_request.cup_data().hash_hex().empty()); + + autofill_assistant::ScriptActionRequestProto actual_user_request; + EXPECT_TRUE( + actual_user_request.ParseFromString(packed_request.cup_data().request())); + EXPECT_EQ(actual_user_request.client_context().experiment_ids(), "test"); + EXPECT_FALSE(actual_user_request.has_cup_data()); +} + +TEST_F(CUPTest, UnpacksTrustedGetActionsResponse) { + // TODO(b/203031699): Write test for the successful case. +} + +TEST_F(CUPTest, FailsToUnpackNonTrustedGetActionsResponse) { + InitCupFeatures(true, true); + + autofill_assistant::ScriptActionRequestProto user_request; + user_request.mutable_client_context()->set_experiment_ids("123"); + std::string user_request_str; + user_request.SerializeToString(&user_request_str); + + cup_.PackAndSignRequest(user_request_str); + cup_.GetQuerySigner().OverrideNonceForTesting(8, 12345); + + autofill_assistant::ActionsResponseProto user_response; + user_response.set_global_payload("adsf"); + std::string user_response_str; + user_response.SerializeToString(&user_response_str); + autofill_assistant::ActionsResponseProto packed_response; + packed_response.mutable_cup_data()->set_response(user_response_str); + packed_response.mutable_cup_data()->set_ecdsa_signature("not a signature"); + + EXPECT_EQ(cup_.UnpackResponse(user_response_str), absl::nullopt); +} + +} // namespace
diff --git a/components/autofill_assistant/browser/service/rpc_type.h b/components/autofill_assistant/browser/service/rpc_type.h new file mode 100644 index 0000000..dca4bb77 --- /dev/null +++ b/components/autofill_assistant/browser/service/rpc_type.h
@@ -0,0 +1,19 @@ +// Copyright 2021 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_AUTOFILL_ASSISTANT_BROWSER_SERVICE_RPC_TYPE_H_ +#define COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SERVICE_RPC_TYPE_H_ + +namespace autofill_assistant { + +enum class RpcType { + UNKNOWN, + GET_ACTIONS, + GET_TRIGGER_SCRIPTS, + SUPPORTS_SCRIPT, +}; + +} + +#endif // COMPONENTS_AUTOFILL_ASSISTANT_BROWSER_SERVICE_RPC_TYPE_H_
diff --git a/components/autofill_payments_strings.grdp b/components/autofill_payments_strings.grdp index 62b947f..c0655c6b 100644 --- a/components/autofill_payments_strings.grdp +++ b/components/autofill_payments_strings.grdp
@@ -520,11 +520,6 @@ Copied </message> </if> - - <message name="IDS_AUTOFILL_VIRTUAL_CARD_SUGGESTION_IPH_BUBBLE_LABEL" desc="Text shown in the IPH bubble for the virtual card option in the suggestion dropdown bubble."> - Use your virtual card for added security - </message> - <message name="IDS_AUTOFILL_CARD_UNMASK_AUTHENTICATION_SELECTION_DIALOG_ISSUER_CONFIRMATION_TEXT" desc="The issuer confirmation text shown in the Autofill card unmask authentication selection dialog on Desktop. This is the header text of the dialog, and it is the text stating that the issuer wants additional authentication. This dialog lets the user choose the method of authentication when unmasking a server card, including a virtual card."> Your bank wants to confirm it's you. </message>
diff --git a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_VIRTUAL_CARD_SUGGESTION_IPH_BUBBLE_LABEL.png.sha1 b/components/autofill_payments_strings_grdp/IDS_AUTOFILL_VIRTUAL_CARD_SUGGESTION_IPH_BUBBLE_LABEL.png.sha1 deleted file mode 100644 index 0c6d2a8dd..0000000 --- a/components/autofill_payments_strings_grdp/IDS_AUTOFILL_VIRTUAL_CARD_SUGGESTION_IPH_BUBBLE_LABEL.png.sha1 +++ /dev/null
@@ -1 +0,0 @@ -c268ae70d46009771482cb9fe595fd5b0e187706 \ No newline at end of file
diff --git a/components/client_update_protocol/ecdsa.cc b/components/client_update_protocol/ecdsa.cc index 54ba7d1..fbb97af 100644 --- a/components/client_update_protocol/ecdsa.cc +++ b/components/client_update_protocol/ecdsa.cc
@@ -112,6 +112,15 @@ std::string* query_params) { DCHECK(query_params); + Ecdsa::RequestParameters request_parameters = SignRequest(request_body); + + *query_params = base::StringPrintf("cup2key=%s&cup2hreq=%s", + request_parameters.query_cup2key.c_str(), + request_parameters.hash_hex.c_str()); +} + +Ecdsa::RequestParameters Ecdsa::SignRequest( + const base::StringPiece& request_body) { // Generate a random nonce to use for freshness, build the cup2key query // string, and compute the SHA-256 hash of the request body. Set these // two pieces of data aside to use during ValidateResponse(). @@ -134,9 +143,10 @@ base::HexEncode(&request_hash_.front(), request_hash_.size()); request_hash_hex = base::ToLowerASCII(request_hash_hex); - *query_params = base::StringPrintf("cup2key=%s&cup2hreq=%s", - request_query_cup2key_.c_str(), - request_hash_hex.c_str()); + RequestParameters request_parameters; + request_parameters.query_cup2key = request_query_cup2key_; + request_parameters.hash_hex = request_hash_hex; + return request_parameters; } bool Ecdsa::ValidateResponse(const base::StringPiece& response_body,
diff --git a/components/client_update_protocol/ecdsa.h b/components/client_update_protocol/ecdsa.h index a49653df..e50d1d20 100644 --- a/components/client_update_protocol/ecdsa.h +++ b/components/client_update_protocol/ecdsa.h
@@ -35,6 +35,11 @@ ~Ecdsa(); + struct RequestParameters { + std::string query_cup2key; + std::string hash_hex; + }; + // Initializes this instance of CUP-ECDSA with a versioned public key. // |key_version| must be non-negative. |public_key| is expected to be a // DER-encoded ASN.1 SubjectPublicKeyInfo containing an ECDSA public key. @@ -53,6 +58,15 @@ void SignRequest(const base::StringPiece& request_body, std::string* query_params); + // Generates freshness/authentication data for an outgoing ping. + // |request_body| contains the body of the ping in UTF-8. Returns the + // parameters that must be sent to the server for ECDSA authentication. + // + // This method will store internal state in this instance used by calls to + // ValidateResponse(); if you need to have multiple pings in flight, + // initialize a separate CUP-ECDSA instance for each one. + RequestParameters SignRequest(const base::StringPiece& request_body); + // Validates a response given to a ping previously signed with // SignRequest(). |response_body| contains the body of the response in // UTF-8. |signature| contains the ECDSA signature and observed request
diff --git a/components/client_update_protocol/ecdsa_unittest.cc b/components/client_update_protocol/ecdsa_unittest.cc index b6949e8..fb87675d 100644 --- a/components/client_update_protocol/ecdsa_unittest.cc +++ b/components/client_update_protocol/ecdsa_unittest.cc
@@ -13,6 +13,7 @@ #include "base/base64url.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" #include "crypto/random.h" #include "crypto/secure_util.h" #include "testing/gtest/include/gtest/gtest.h" @@ -55,38 +56,53 @@ TEST_F(CupEcdsaTest, SignRequest) { static const char kRequest[] = "TestSequenceForCupEcdsaUnitTest"; static const char kRequestHash[] = + "cde1f7dc1311ed96813057ca321c2f5a17ea2c9c776ee0eb31965f7985a3074a"; + static const char kRequestHashWithName[] = "&cup2hreq=" "cde1f7dc1311ed96813057ca321c2f5a17ea2c9c776ee0eb31965f7985a3074a"; - static const char kKeyId[] = "cup2key=8:"; + static const char kKeyId[] = "8:"; + static const char kKeyIdWithName[] = "cup2key=8:"; std::string query; CUP().SignRequest(kRequest, &query); std::string query2; CUP().SignRequest(kRequest, &query2); + Ecdsa::RequestParameters request_parameters = CUP().SignRequest(kRequest); - EXPECT_TRUE(base::StartsWith(query, kKeyId)); - EXPECT_TRUE(base::StartsWith(query2, kKeyId)); - EXPECT_TRUE(base::EndsWith(query, kRequestHash)); - EXPECT_TRUE(base::EndsWith(query2, kRequestHash)); + EXPECT_TRUE(base::StartsWith(query, kKeyIdWithName)); + EXPECT_TRUE(base::StartsWith(query2, kKeyIdWithName)); + EXPECT_TRUE(base::StartsWith(request_parameters.query_cup2key, kKeyId)); + EXPECT_TRUE(base::EndsWith(query, kRequestHashWithName)); + EXPECT_TRUE(base::EndsWith(query2, kRequestHashWithName)); + EXPECT_EQ(request_parameters.hash_hex, kRequestHash); // The nonce should be a base64url-encoded, 32-byte (256-bit) string. base::StringPiece nonce_b64 = query; - nonce_b64.remove_prefix(strlen(kKeyId)); - nonce_b64.remove_suffix(strlen(kRequestHash)); + nonce_b64.remove_prefix(strlen(kKeyIdWithName)); + nonce_b64.remove_suffix(strlen(kRequestHashWithName)); std::string nonce; EXPECT_TRUE(base::Base64UrlDecode( nonce_b64, base::Base64UrlDecodePolicy::DISALLOW_PADDING, &nonce)); EXPECT_EQ(32u, nonce.size()); - nonce_b64 = query2; + nonce_b64 = request_parameters.query_cup2key; nonce_b64.remove_prefix(strlen(kKeyId)); - nonce_b64.remove_suffix(strlen(kRequestHash)); + EXPECT_TRUE(base::Base64UrlDecode( + nonce_b64, base::Base64UrlDecodePolicy::DISALLOW_PADDING, &nonce)); + EXPECT_EQ(32u, nonce.size()); + + nonce_b64 = query2; + nonce_b64.remove_prefix(strlen(kKeyIdWithName)); + nonce_b64.remove_suffix(strlen(kRequestHashWithName)); EXPECT_TRUE(base::Base64UrlDecode( nonce_b64, base::Base64UrlDecodePolicy::DISALLOW_PADDING, &nonce)); EXPECT_EQ(32u, nonce.size()); // With a 256-bit nonce, the probability of collision is negligible. EXPECT_NE(query, query2); + EXPECT_NE(query, base::StringPrintf("cup2key=%s&cup2hreq=%s", + request_parameters.query_cup2key.c_str(), + request_parameters.hash_hex.c_str())); } TEST_F(CupEcdsaTest, ValidateResponse_TestETagParsing) {
diff --git a/components/feature_engagement/public/android/java/src/org/chromium/components/feature_engagement/EventConstants.java b/components/feature_engagement/public/android/java/src/org/chromium/components/feature_engagement/EventConstants.java index cc751fb..6c8738a6 100644 --- a/components/feature_engagement/public/android/java/src/org/chromium/components/feature_engagement/EventConstants.java +++ b/components/feature_engagement/public/android/java/src/org/chromium/components/feature_engagement/EventConstants.java
@@ -166,7 +166,7 @@ /** The keyboard accessory was used to fill payment data into a form. */ public static final String KEYBOARD_ACCESSORY_PAYMENT_AUTOFILLED = - "autofill_virtual_card_suggestion_accepted"; + "keyboard_accessory_payment_suggestion_accepted"; /** The keyboard accessory was swiped to reveal more suggestions. */ public static final String KEYBOARD_ACCESSORY_BAR_SWIPED = "keyboard_accessory_bar_swiped";
diff --git a/components/feature_engagement/public/android/java/src/org/chromium/components/feature_engagement/FeatureConstants.java b/components/feature_engagement/public/android/java/src/org/chromium/components/feature_engagement/FeatureConstants.java index 28ac066..36b443a 100644 --- a/components/feature_engagement/public/android/java/src/org/chromium/components/feature_engagement/FeatureConstants.java +++ b/components/feature_engagement/public/android/java/src/org/chromium/components/feature_engagement/FeatureConstants.java
@@ -94,7 +94,8 @@ String KEYBOARD_ACCESSORY_PASSWORD_FILLING_FEATURE = "IPH_KeyboardAccessoryPasswordFilling"; String KEYBOARD_ACCESSORY_PAYMENT_FILLING_FEATURE = "IPH_KeyboardAccessoryPaymentFilling"; String KEYBOARD_ACCESSORY_PAYMENT_OFFER_FEATURE = "IPH_KeyboardAccessoryPaymentOffer"; - String KEYBOARD_ACCESSORY_PAYMENT_VIRTUAL_CARD_FEATURE = "IPH_AutofillVirtualCardSuggestion"; + String KEYBOARD_ACCESSORY_PAYMENT_VIRTUAL_CARD_FEATURE = + "IPH_KeyboardAccessoryPaymentVirtualCard"; String KEYBOARD_ACCESSORY_BAR_SWIPING_FEATURE = "IPH_KeyboardAccessoryBarSwiping"; String INSTANCE_SWITCHER = "IPH_InstanceSwitcher"; String PREVIEWS_OMNIBOX_UI_FEATURE = "IPH_PreviewsOmniboxUI";
diff --git a/components/feature_engagement/public/feature_configurations.cc b/components/feature_engagement/public/feature_configurations.cc index d89aebb..05f131b 100644 --- a/components/feature_engagement/public/feature_configurations.cc +++ b/components/feature_engagement/public/feature_configurations.cc
@@ -87,7 +87,6 @@ Comparator(EQUAL, 0), 7, 360)); return config; } - #endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || // defined(OS_CHROMEOS) @@ -572,39 +571,30 @@ return config; } -#endif // defined(OS_ANDROID) - -#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ - defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) - if (kIPHAutofillVirtualCardSuggestionFeature.name == feature->name) { - // A config that allows the virtual card credit card suggestion IPH to be - // shown when: - // * it has been shown less than three times in last 90 days; - // * the virtual card suggestion has been selected less than twice in last - // 90 days. - + if (kIPHKeyboardAccessoryPaymentVirtualCardFeature.name == feature->name) { + // A config that allows the virtual card IPH to be shown when a user + // interacts with the payment form and triggers the credit card suggestion + // list. absl::optional<FeatureConfig> config = FeatureConfig(); config->valid = true; config->availability = Comparator(ANY, 0); - config->session_rate = Comparator(EQUAL, 0); - config->trigger = EventConfig("autofill_virtual_card_iph_trigger", - Comparator(LESS_THAN, 3), 90, 360); - config->used = EventConfig("autofill_virtual_card_suggestion_accepted", + config->session_rate = Comparator(ANY, 0); + config->trigger = + EventConfig("keyboard_accessory_payment_virtual_card_iph_trigger", + Comparator(LESS_THAN, 3), 90, 360); + config->used = EventConfig("keyboard_accessory_payment_suggestion_accepted", Comparator(LESS_THAN, 2), 90, 360); -#if defined(OS_ANDROID) SessionRateImpact session_rate_impact; session_rate_impact.type = SessionRateImpact::Type::EXPLICIT; std::vector<std::string> affected_features; affected_features.push_back("IPH_KeyboardAccessoryBarSwiping"); session_rate_impact.affected_features = affected_features; config->session_rate_impact = session_rate_impact; -#endif // defined(OS_ANDROID) - return config; } -#endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || - // defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) + +#endif // defined(OS_ANDROID) if (kIPHDummyFeature.name == feature->name) { // Only used for tests. Various magic tricks are used below to ensure this
diff --git a/components/feature_engagement/public/feature_constants.cc b/components/feature_engagement/public/feature_constants.cc index 3e0ce36..3cb9a87 100644 --- a/components/feature_engagement/public/feature_constants.cc +++ b/components/feature_engagement/public/feature_constants.cc
@@ -146,6 +146,9 @@ "IPH_KeyboardAccessoryPaymentFilling", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kIPHKeyboardAccessoryPaymentOfferFeature{ "IPH_KeyboardAccessoryPaymentOffer", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kIPHKeyboardAccessoryPaymentVirtualCardFeature{ + "IPH_KeyboardAccessoryPaymentVirtualCard", + base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kIPHNewTabPageHomeButtonFeature{ "IPH_NewTabPageHomeButton", base::FEATURE_DISABLED_BY_DEFAULT}; const base::Feature kIPHMicToolbarFeature{"IPH_MicToolbar", @@ -233,8 +236,6 @@ #if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) -const base::Feature kIPHAutofillVirtualCardSuggestionFeature{ - "IPH_AutofillVirtualCardSuggestion", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kIPHUpdatedConnectionSecurityIndicatorsFeature{ "IPH_UpdatedConnectionSecurityIndicators", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/components/feature_engagement/public/feature_constants.h b/components/feature_engagement/public/feature_constants.h index c607c7c6..ee6d09c 100644 --- a/components/feature_engagement/public/feature_constants.h +++ b/components/feature_engagement/public/feature_constants.h
@@ -97,6 +97,7 @@ extern const base::Feature kIPHKeyboardAccessoryPasswordFillingFeature; extern const base::Feature kIPHKeyboardAccessoryPaymentFillingFeature; extern const base::Feature kIPHKeyboardAccessoryPaymentOfferFeature; +extern const base::Feature kIPHKeyboardAccessoryPaymentVirtualCardFeature; extern const base::Feature kIPHMicToolbarFeature; extern const base::Feature kIPHNewTabPageHomeButtonFeature; extern const base::Feature kIPHPageInfoFeature; @@ -149,10 +150,8 @@ #if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) -extern const base::Feature kIPHAutofillVirtualCardSuggestionFeature; extern const base::Feature kIPHUpdatedConnectionSecurityIndicatorsFeature; -#endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || - // defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) +#endif } // namespace feature_engagement
diff --git a/components/feature_engagement/public/feature_list.cc b/components/feature_engagement/public/feature_list.cc index 079741d..738cb6f 100644 --- a/components/feature_engagement/public/feature_list.cc +++ b/components/feature_engagement/public/feature_list.cc
@@ -56,6 +56,7 @@ &kIPHKeyboardAccessoryPasswordFillingFeature, &kIPHKeyboardAccessoryPaymentFillingFeature, &kIPHKeyboardAccessoryPaymentOfferFeature, + &kIPHKeyboardAccessoryPaymentVirtualCardFeature, &kIPHMicToolbarFeature, &kIPHNewTabPageHomeButtonFeature, &kIPHPageInfoFeature, @@ -122,13 +123,6 @@ &kIPHDesktopSharedHighlightingFeature, #endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || // defined(OS_CHROMEOS) || defined(OS_FUCHSIA) - -#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ - defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) - &kIPHAutofillVirtualCardSuggestionFeature, -#endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || - // defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) - }; } // namespace
diff --git a/components/feature_engagement/public/feature_list.h b/components/feature_engagement/public/feature_list.h index 8c2c674..df1ab2e 100644 --- a/components/feature_engagement/public/feature_list.h +++ b/components/feature_engagement/public/feature_list.h
@@ -114,6 +114,8 @@ "IPH_KeyboardAccessoryPaymentFilling"); DEFINE_VARIATION_PARAM(kIPHKeyboardAccessoryPaymentOfferFeature, "IPH_KeyboardAccessoryPaymentOffer"); +DEFINE_VARIATION_PARAM(kIPHKeyboardAccessoryPaymentVirtualCardFeature, + "IPH_KeyboardAccessoryPaymentVirtualCard"); DEFINE_VARIATION_PARAM(kIPHMicToolbarFeature, "IPH_MicToolbar"); DEFINE_VARIATION_PARAM(kIPHNewTabPageButtonFeature, "IPH_NewTabPageHomeButton"); DEFINE_VARIATION_PARAM(kIPHPageInfoFeature, "IPH_PageInfo"); @@ -218,13 +220,6 @@ #endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || // defined(OS_CHROMEOS) || defined(OS_FUCHSIA) -#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ - defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) -DEFINE_VARIATION_PARAM(kIPHAutofillVirtualCardSuggestionFeature, - "IPH_AutofillVirtualCardSuggestion"); -#endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || - // defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) - } // namespace // Defines the array of which features should be listed in the chrome://flags @@ -276,6 +271,7 @@ VARIATION_ENTRY(kIPHKeyboardAccessoryPasswordFillingFeature), VARIATION_ENTRY(kIPHKeyboardAccessoryPaymentFillingFeature), VARIATION_ENTRY(kIPHKeyboardAccessoryPaymentOfferFeature), + VARIATION_ENTRY(kIPHKeyboardAccessoryPaymentVirtualCardFeature), VARIATION_ENTRY(kIPHMicToolbarFeature), VARIATION_ENTRY(kIPHNewTabPageButtonFeature), VARIATION_ENTRY(kIPHPageInfoFeature), @@ -339,12 +335,6 @@ VARIATION_ENTRY(kIPHDesktopSharedHighlightingFeature), #endif // defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || // defined(OS_CHROMEOS) || defined(OS_FUCHSIA) - -#if defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || \ - defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) - VARIATION_ENTRY(kIPHAutofillVirtualCardSuggestionFeature), -#endif // defined(OS_WIN) || defined(OS_APPLE) || defined(OS_LINUX) || - // defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_FUCHSIA) }; #undef DEFINE_VARIATION_PARAM
diff --git a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.cc b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.cc index deda1b0..ebd1c20 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper.cc
@@ -15,6 +15,17 @@ namespace password_manager { +namespace { + +bool IsFacetValidForAffiliation(const FacetURI& facet) { + return facet.IsValidAndroidFacetURI() || + (facet.IsValidWebFacetURI() && + base::FeatureList::IsEnabled( + password_manager::features::kFillingAcrossAffiliatedWebsites)); +} + +} // namespace + // static constexpr base::TimeDelta AffiliatedMatchHelper::kInitializationDelayOnStartup; @@ -139,7 +150,16 @@ void AffiliatedMatchHelper::OnLoginsRetained( PasswordStoreInterface* /*store*/, - const std::vector<PasswordForm>& retained_passwords) {} + const std::vector<PasswordForm>& retained_passwords) { + std::vector<FacetURI> facets; + for (const auto& form : retained_passwords) { + FacetURI facet_uri = + FacetURI::FromPotentiallyInvalidSpec(form.signon_realm); + if (IsFacetValidForAffiliation(facet_uri)) + facets.push_back(std::move(facet_uri)); + } + affiliation_service_->KeepPrefetchForFacets(std::move(facets)); +} void AffiliatedMatchHelper::OnGetPasswordStoreResults( std::vector<std::unique_ptr<PasswordForm>> results) { @@ -147,12 +167,7 @@ for (const auto& form : results) { FacetURI facet_uri = FacetURI::FromPotentiallyInvalidSpec(form->signon_realm); - if (facet_uri.IsValidAndroidFacetURI()) - affiliation_service_->Prefetch(facet_uri, base::Time::Max()); - - if (facet_uri.IsValidWebFacetURI() && - base::FeatureList::IsEnabled( - password_manager::features::kFillingAcrossAffiliatedWebsites)) + if (IsFacetValidForAffiliation(facet_uri)) affiliation_service_->Prefetch(facet_uri, base::Time::Max()); facets.push_back(std::move(facet_uri));
diff --git a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc index 91410d09..f32dbb7d 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliated_match_helper_unittest.cc
@@ -92,6 +92,12 @@ void ExpectCallToTrimUnusedCache() { EXPECT_CALL(*this, TrimUnusedCache).RetiresOnSaturation(); } + + void ExpectKeepPrefetchForFacets( + const std::vector<FacetURI>& expected_facets) { + EXPECT_CALL(*this, KeepPrefetchForFacets(expected_facets)) + .RetiresOnSaturation(); + } }; const char kTestWebFacetURIAlpha1[] = "https://one.alpha.example.com"; @@ -575,6 +581,26 @@ kTestAndroidRealmAlpha3)); } +TEST_P(AffiliatedMatchHelperTest, OnLoginsRetained) { + std::vector<PasswordForm> forms = { + GetTestAndroidCredentials(kTestWebFacetURIAlpha1), + GetTestAndroidCredentials(kTestAndroidFacetURIBeta2)}; + std::vector<FacetURI> expected_facets; + + if (base::FeatureList::IsEnabled( + features::kFillingAcrossAffiliatedWebsites)) { + expected_facets = {FacetURI::FromCanonicalSpec(kTestWebFacetURIAlpha1), + FacetURI::FromCanonicalSpec(kTestAndroidFacetURIBeta2)}; + } else { + expected_facets = {FacetURI::FromCanonicalSpec(kTestAndroidFacetURIBeta2)}; + } + + mock_affiliation_service()->ExpectKeepPrefetchForFacets(expected_facets); + + (static_cast<PasswordStoreInterface::Observer*>(match_helper())) + ->OnLoginsRetained(nullptr, forms); +} + INSTANTIATE_TEST_SUITE_P(FillingAcrossAffiliatedWebsites, AffiliatedMatchHelperTest, ::testing::Bool());
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc b/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc index 43a5c0d..1e4f3f4 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_backend.cc
@@ -103,6 +103,41 @@ facet_managers_.erase(facet_uri); } +void AffiliationBackend::KeepPrefetchForFacets( + std::vector<FacetURI> facet_uris) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + // Firstly, check which facets are missing from the |facet_managers_| and + // schedule Prefetch() for them. + for (const auto& facet : facet_uris) { + if (facet_managers_.find(facet) == facet_managers_.end()) { + Prefetch(facet, base::Time::Max()); + } + } + + // Now remove facets which which aren't retained anymore. + auto retained_facets = base::MakeFlatSet<std::string>( + facet_uris, {}, &FacetURI::potentially_invalid_spec); + + std::vector<FacetURI> facets_to_remove; + for (const auto& facet_manager_pair : facet_managers_) { + if (retained_facets.contains( + facet_manager_pair.first.potentially_invalid_spec())) { + continue; + } + + facet_manager_pair.second->CancelPrefetch(base::Time::Max()); + + if (facet_manager_pair.second->CanBeDiscarded()) + facets_to_remove.push_back(facet_manager_pair.first); + } + + for (const auto& facet : facets_to_remove) { + facet_managers_.erase(facet); + TrimCacheForFacetURI(facet); + } +} + void AffiliationBackend::TrimCacheForFacetURI(const FacetURI& facet_uri) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -114,7 +149,7 @@ void AffiliationBackend::TrimUnusedCache(std::vector<FacetURI> facet_uris) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - cache_->RemoveMissingFacetURI(std::move(facet_uris)); + cache_->RemoveMissingFacetURI(facet_uris); } // static
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_backend.h b/components/password_manager/core/browser/android_affiliation/affiliation_backend.h index cf71d95..6edc7a3 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_backend.h +++ b/components/password_manager/core/browser/android_affiliation/affiliation_backend.h
@@ -90,6 +90,7 @@ void Prefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until); void CancelPrefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until); + void KeepPrefetchForFacets(std::vector<FacetURI> facet_uris); void TrimCacheForFacetURI(const FacetURI& facet_uri); void TrimUnusedCache(std::vector<FacetURI> facet_uris);
diff --git a/components/password_manager/core/browser/android_affiliation/affiliation_backend_unittest.cc b/components/password_manager/core/browser/android_affiliation/affiliation_backend_unittest.cc index 4eefc86..d823bb64 100644 --- a/components/password_manager/core/browser/android_affiliation/affiliation_backend_unittest.cc +++ b/components/password_manager/core/browser/android_affiliation/affiliation_backend_unittest.cc
@@ -895,4 +895,30 @@ ASSERT_FALSE(base::PathExists(db_path())); } +TEST_F(AffiliationBackendTest, KeepPrefetchForFacets) { + // Have {kTestFacetURIAlpha1, kTestFacetURIAlpha1, kTestFacetURIBeta1} as a + // list of actively fetching facets. + ASSERT_NO_FATAL_FAILURE(PrefetchAndExpectFetch( + FacetURI::FromCanonicalSpec(kTestFacetURIAlpha1), base::Time::Max())); + ASSERT_NO_FATAL_FAILURE(PrefetchAndExpectFetch( + FacetURI::FromCanonicalSpec(kTestFacetURIBeta1), base::Time::Max())); + Prefetch(FacetURI::FromCanonicalSpec(kTestFacetURIAlpha1), base::Time::Max()); + EXPECT_EQ(2u, backend_facet_manager_count()); + EXPECT_EQ(2u, GetNumOfEquivalenceClassInDatabase()); + + AdvanceTime(GetCacheSoftExpiryPeriod() - Epsilon()); + + backend()->KeepPrefetchForFacets( + {FacetURI::FromCanonicalSpec(kTestFacetURIAlpha1), + FacetURI::FromCanonicalSpec(kTestFacetURIGamma1)}); + ASSERT_NO_FATAL_FAILURE(ExpectNeedForFetchAndLetItBeSent()); + ASSERT_NO_FATAL_FAILURE( + ExpectAndCompleteFetch(FacetURI::FromCanonicalSpec(kTestFacetURIGamma1))); + EXPECT_EQ(2u, backend_facet_manager_count()); + EXPECT_EQ(2u, GetNumOfEquivalenceClassInDatabase()); + + consumer_task_runner()->RunUntilIdle(); + testing::Mock::VerifyAndClearExpectations(mock_consumer()); +} + } // namespace password_manager
diff --git a/components/password_manager/core/browser/leak_detection_dialog_utils.cc b/components/password_manager/core/browser/leak_detection_dialog_utils.cc index 8d4ae11..eb2f49e 100644 --- a/components/password_manager/core/browser/leak_detection_dialog_utils.cc +++ b/components/password_manager/core/browser/leak_detection_dialog_utils.cc
@@ -25,6 +25,10 @@ constexpr char kPasswordCheckupURL[] = "https://passwords.google.com/checkup/start?hideExplanation=true"; +constexpr base::FeatureParam<bool> kPasswordChangeUseBasicCloseLabel{ + &password_manager::features::kPasswordChange, "use_basic_close_label", + false}; + CredentialLeakType CreateLeakType(IsSaved is_saved, IsReused is_reused, IsSyncing is_syncing, @@ -79,7 +83,8 @@ } std::u16string GetCancelButtonLabel(CredentialLeakType leak_type) { - if (ShouldShowChangePasswordButton(leak_type)) { + if (ShouldShowChangePasswordButton(leak_type) && + !kPasswordChangeUseBasicCloseLabel.Get()) { return l10n_util::GetStringUTF16( IDS_CREDENTIAL_LEAK_DONT_CHANGE_AUTOMATICALLY); }
diff --git a/components/password_manager/core/browser/password_manager_metrics_util.cc b/components/password_manager/core/browser/password_manager_metrics_util.cc index 8032d231..5341760 100644 --- a/components/password_manager/core/browser/password_manager_metrics_util.cc +++ b/components/password_manager/core/browser/password_manager_metrics_util.cc
@@ -369,6 +369,14 @@ values); } +void LogUserInteractionsWhenAddingCredentialFromSettings( + AddCredentialFromSettingsUserInteractions + add_credential_from_settings_user_interaction) { + base::UmaHistogramEnumeration( + "PasswordManager.AddCredentialFromSettings.UserAction", + add_credential_from_settings_user_interaction); +} + } // namespace metrics_util } // namespace password_manager
diff --git a/components/password_manager/core/browser/password_manager_metrics_util.h b/components/password_manager/core/browser/password_manager_metrics_util.h index 4f340d5..45a8b730 100644 --- a/components/password_manager/core/browser/password_manager_metrics_util.h +++ b/components/password_manager/core/browser/password_manager_metrics_util.h
@@ -451,6 +451,28 @@ kMaxValue = kShowPassword, }; +// Represents different user interactions related to adding credential from the +// setting. These values are persisted to logs. Entries should not be renumbered +// and numeric values should never be reused. Always keep this enum in sync with +// the corresponding PasswordCheckInteraction in enums.xml and +// password_manager_proxy.js. +enum class AddCredentialFromSettingsUserInteractions { + // Used when the add credential dialog is opened from the settings. + kAddDialogOpened = 0, + // Used when the add credential dialog is closed from the settings. + kAddDialogClosed = 1, + // Used when a new credential is added from the settings . + kCredentialAdded = 2, + // Used when a new credential is being added from the add credential dialog in + // settings and another credential exists with the same username/website + // combination. + kDuplicatedCredentialEntered = 3, + // Used when an existing credential is viewed while adding a new credential + // from the settings. + kDuplicateCredentialViewed = 4, + kMaxValue = kDuplicateCredentialViewed +}; + // Metrics: PasswordManager.MoveToAccountStoreTrigger. // This must be kept in sync with the enum in password_move_to_account_dialog.js // (in chrome/browser/resources/settings/autofill_page). @@ -665,6 +687,11 @@ void LogPasswordEditResult(IsUsernameChanged password_changed, IsPasswordChanged username_changed); +// Log the user interaction events when creating a new credential from settings. +void LogUserInteractionsWhenAddingCredentialFromSettings( + AddCredentialFromSettingsUserInteractions + add_credential_from_settings_user_interaction); + } // namespace metrics_util } // namespace password_manager
diff --git a/components/password_manager/core/browser/site_affiliation/affiliation_service.h b/components/password_manager/core/browser/site_affiliation/affiliation_service.h index 94481585..4b0847f 100644 --- a/components/password_manager/core/browser/site_affiliation/affiliation_service.h +++ b/components/password_manager/core/browser/site_affiliation/affiliation_service.h
@@ -76,6 +76,13 @@ virtual void CancelPrefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until) = 0; + // Compares |facet_uris| with a actively prefetching list of facets. For any + // facet which is present in the |facet_uris| but missing from the list a new + // prefetch is scheduled. For any facet which is present in the list but + // missing in |facet_uris| the corresponding prefetch command is canceled. It + // also deletes cache which is no longer needed. + virtual void KeepPrefetchForFacets(std::vector<FacetURI> facet_uris) = 0; + // Wipes results of on-demand fetches and expired prefetches from the // cache, but retains information corresponding to facets that are being // kept fresh. As no required data is deleted, there will be no network
diff --git a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc index dfedf2a..6a9ef85 100644 --- a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc +++ b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.cc
@@ -256,6 +256,16 @@ base::Unretained(backend_), facet_uri, keep_fresh_until)); } +void AffiliationServiceImpl::KeepPrefetchForFacets( + std::vector<FacetURI> facet_uris) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(backend_); + backend_task_runner_->PostTask( + FROM_HERE, + base::BindOnce(&AffiliationBackend::KeepPrefetchForFacets, + base::Unretained(backend_), std::move(facet_uris))); +} + void AffiliationServiceImpl::TrimCacheForFacetURI(const FacetURI& facet_uri) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(backend_);
diff --git a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h index 259780c..f9164bfa 100644 --- a/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h +++ b/components/password_manager/core/browser/site_affiliation/affiliation_service_impl.h
@@ -100,6 +100,7 @@ void CancelPrefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until) override; void TrimCacheForFacetURI(const FacetURI& facet_uri) override; + void KeepPrefetchForFacets(std::vector<FacetURI> facet_uris) override; void TrimUnusedCache(std::vector<FacetURI> facet_uris) override; void InjectAffiliationAndBrandingInformation( std::vector<std::unique_ptr<PasswordForm>> forms,
diff --git a/components/password_manager/core/browser/site_affiliation/fake_affiliation_service.cc b/components/password_manager/core/browser/site_affiliation/fake_affiliation_service.cc index c4be3fb8..faa0822 100644 --- a/components/password_manager/core/browser/site_affiliation/fake_affiliation_service.cc +++ b/components/password_manager/core/browser/site_affiliation/fake_affiliation_service.cc
@@ -26,6 +26,8 @@ void FakeAffiliationService::CancelPrefetch( const FacetURI& facet_uri, const base::Time& keep_fresh_until) {} +void FakeAffiliationService::KeepPrefetchForFacets( + std::vector<FacetURI> facet_uris) {} void FakeAffiliationService::TrimCacheForFacetURI(const FacetURI& facet_uri) {} void FakeAffiliationService::TrimUnusedCache(std::vector<FacetURI> facet_uris) { }
diff --git a/components/password_manager/core/browser/site_affiliation/fake_affiliation_service.h b/components/password_manager/core/browser/site_affiliation/fake_affiliation_service.h index 478442c..9759d9419 100644 --- a/components/password_manager/core/browser/site_affiliation/fake_affiliation_service.h +++ b/components/password_manager/core/browser/site_affiliation/fake_affiliation_service.h
@@ -27,6 +27,7 @@ const base::Time& keep_fresh_until) override; void CancelPrefetch(const FacetURI& facet_uri, const base::Time& keep_fresh_until) override; + void KeepPrefetchForFacets(std::vector<FacetURI> facet_uris) override; void TrimCacheForFacetURI(const FacetURI& facet_uri) override; void TrimUnusedCache(std::vector<FacetURI> facet_uris) override;
diff --git a/components/password_manager/core/browser/site_affiliation/mock_affiliation_service.h b/components/password_manager/core/browser/site_affiliation/mock_affiliation_service.h index d4bc531..5f0a535 100644 --- a/components/password_manager/core/browser/site_affiliation/mock_affiliation_service.h +++ b/components/password_manager/core/browser/site_affiliation/mock_affiliation_service.h
@@ -43,6 +43,7 @@ CancelPrefetch, (const FacetURI&, const base::Time&), (override)); + MOCK_METHOD(void, KeepPrefetchForFacets, (std::vector<FacetURI>), (override)); MOCK_METHOD(void, TrimCacheForFacetURI, (const FacetURI&), (override)); MOCK_METHOD(void, TrimUnusedCache, (std::vector<FacetURI>), (override));
diff --git a/components/password_manager/core/browser/ui/saved_passwords_presenter.cc b/components/password_manager/core/browser/ui/saved_passwords_presenter.cc index b9677a5..7b1107e 100644 --- a/components/password_manager/core/browser/ui/saved_passwords_presenter.cc +++ b/components/password_manager/core/browser/ui/saved_passwords_presenter.cc
@@ -117,6 +117,9 @@ account_store_->Unblocklist(form_digest, /*completion=*/base::DoNothing()); GetStoreFor(form).AddLogin(form); + metrics_util::LogUserInteractionsWhenAddingCredentialFromSettings( + metrics_util::AddCredentialFromSettingsUserInteractions:: + kCredentialAdded); return true; }
diff --git a/components/policy/core/common/schema_unittest.cc b/components/policy/core/common/schema_unittest.cc index d3afe523..890250ed 100644 --- a/components/policy/core/common/schema_unittest.cc +++ b/components/policy/core/common/schema_unittest.cc
@@ -671,7 +671,7 @@ // Wrong type, expected list of strings. { - bundle.Clear(); + bundle.DictClear(); base::ListValue list; list.Append(1); bundle.SetKey("Array", std::move(list)); @@ -680,7 +680,7 @@ // Wrong type in a sub-object. { - bundle.Clear(); + bundle.DictClear(); base::DictionaryValue dict; dict.SetString("one", "one"); bundle.SetKey("Object", std::move(dict)); @@ -688,12 +688,12 @@ } // Unknown name. - bundle.Clear(); + bundle.DictClear(); bundle.SetBoolean("Unknown", true); TestSchemaValidation(schema, bundle, SCHEMA_STRICT, false); // All of these will be valid. - bundle.Clear(); + bundle.DictClear(); bundle.SetBoolean("Boolean", true); bundle.SetInteger("Integer", 123); bundle.SetDouble("Number", 3.14);
diff --git a/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc b/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc index 3b075ae0..bb94f7da 100644 --- a/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc +++ b/components/safe_search_api/safe_search/safe_search_url_checker_client_unittest.cc
@@ -30,10 +30,11 @@ "https://safesearch.googleapis.com/v1:classify"; std::string BuildResponse(bool is_porn) { - base::DictionaryValue dict; - auto classification_dict = std::make_unique<base::DictionaryValue>(); + base::Value dict(base::Value::Type::DICTIONARY); + auto classification_dict = + std::make_unique<base::Value>(base::Value::Type::DICTIONARY); if (is_porn) - classification_dict->SetBoolean("pornography", is_porn); + classification_dict->SetBoolKey("pornography", is_porn); auto classifications_list = std::make_unique<base::ListValue>(); classifications_list->Append(std::move(classification_dict)); dict.SetKey("classifications",
diff --git a/components/safe_search_api/stub_url_checker.cc b/components/safe_search_api/stub_url_checker.cc index 09991aa..9ce25d6 100644 --- a/components/safe_search_api/stub_url_checker.cc +++ b/components/safe_search_api/stub_url_checker.cc
@@ -24,10 +24,11 @@ "https://safesearch.googleapis.com/v1:classify"; std::string BuildResponse(bool is_porn) { - base::DictionaryValue dict; - auto classification_dict = std::make_unique<base::DictionaryValue>(); + base::Value dict(base::Value::Type::DICTIONARY); + auto classification_dict = + std::make_unique<base::Value>(base::Value::Type::DICTIONARY); if (is_porn) - classification_dict->SetBoolean("pornography", is_porn); + classification_dict->SetBoolKey("pornography", is_porn); auto classifications_list = std::make_unique<base::ListValue>(); classifications_list->Append(std::move(classification_dict)); dict.SetKey("classifications",
diff --git a/components/security_interstitials/content/stateful_ssl_host_state_delegate.cc b/components/security_interstitials/content/stateful_ssl_host_state_delegate.cc index 034b351..186363e 100644 --- a/components/security_interstitials/content/stateful_ssl_host_state_delegate.cc +++ b/components/security_interstitials/content/stateful_ssl_host_state_delegate.cc
@@ -527,7 +527,7 @@ recurrent_errors_.clear(); DictionaryPrefUpdate pref_update(pref_service_, prefs::kRecurrentSSLInterstitial); - pref_update->Clear(); + pref_update->DictClear(); } void StatefulSSLHostStateDelegate::SetClockForTesting(
diff --git a/components/segmentation_platform/internal/BUILD.gn b/components/segmentation_platform/internal/BUILD.gn index f067e29f..3e6ef0b 100644 --- a/components/segmentation_platform/internal/BUILD.gn +++ b/components/segmentation_platform/internal/BUILD.gn
@@ -58,6 +58,8 @@ "selection/segment_selector_impl.h", "selection/segmentation_result_prefs.cc", "selection/segmentation_result_prefs.h", + "service_proxy_impl.cc", + "service_proxy_impl.h", "signals/histogram_signal_handler.cc", "signals/histogram_signal_handler.h", "signals/signal_filter_processor.cc",
diff --git a/components/segmentation_platform/internal/dummy_segmentation_platform_service.cc b/components/segmentation_platform/internal/dummy_segmentation_platform_service.cc index 6b51a8d..3e7c2a5 100644 --- a/components/segmentation_platform/internal/dummy_segmentation_platform_service.cc +++ b/components/segmentation_platform/internal/dummy_segmentation_platform_service.cc
@@ -24,7 +24,4 @@ void DummySegmentationPlatformService::EnableMetrics( bool signal_collection_allowed) {} - -void DummySegmentationPlatformService::GetServiceStatus() {} - } // namespace segmentation_platform
diff --git a/components/segmentation_platform/internal/dummy_segmentation_platform_service.h b/components/segmentation_platform/internal/dummy_segmentation_platform_service.h index a3ff31b1..7102adc 100644 --- a/components/segmentation_platform/internal/dummy_segmentation_platform_service.h +++ b/components/segmentation_platform/internal/dummy_segmentation_platform_service.h
@@ -28,7 +28,6 @@ void GetSelectedSegment(const std::string& segmentation_key, SegmentSelectionCallback callback) override; void EnableMetrics(bool signal_collection_allowed) override; - void GetServiceStatus() override; }; } // namespace segmentation_platform
diff --git a/components/segmentation_platform/internal/segmentation_platform_service_impl.cc b/components/segmentation_platform/internal/segmentation_platform_service_impl.cc index 48e567c1..08eb642a 100644 --- a/components/segmentation_platform/internal/segmentation_platform_service_impl.cc +++ b/components/segmentation_platform/internal/segmentation_platform_service_impl.cc
@@ -103,6 +103,7 @@ std::move(signal_storage_config_db), clock); segmentation_result_prefs_ = std::make_unique<SegmentationResultPrefs>(pref_service); + proxy_ = std::make_unique<ServiceProxyImpl>(this); // Construct signal processors. user_action_signal_handler_ = @@ -161,18 +162,8 @@ signal_filter_processor_->EnableMetrics(signal_collection_allowed); } -void SegmentationPlatformServiceImpl::GetServiceStatus() { - OnServiceStatusChanged(); -} - -void SegmentationPlatformServiceImpl::AddObserver( - SegmentationPlatformService::Observer* observer) { - observers_.AddObserver(observer); -} - -void SegmentationPlatformServiceImpl::RemoveObserver( - SegmentationPlatformService::Observer* observer) { - observers_.RemoveObserver(observer); +ServiceProxy* SegmentationPlatformServiceImpl::GetServiceProxy() { + return proxy_.get(); } void SegmentationPlatformServiceImpl::OnSegmentInfoDatabaseInitialized( @@ -270,8 +261,7 @@ } } - for (Observer& obs : observers_) - obs.OnServiceStatusChanged(IsInitializationFinished(), status); + proxy_->OnServiceStatusChanged(IsInitializationFinished(), status); } // static
diff --git a/components/segmentation_platform/internal/segmentation_platform_service_impl.h b/components/segmentation_platform/internal/segmentation_platform_service_impl.h index 250543c..fca4bd55 100644 --- a/components/segmentation_platform/internal/segmentation_platform_service_impl.h +++ b/components/segmentation_platform/internal/segmentation_platform_service_impl.h
@@ -14,10 +14,10 @@ #include "base/memory/raw_ptr.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" -#include "base/observer_list.h" #include "components/leveldb_proto/public/proto_database.h" #include "components/optimization_guide/proto/models.pb.h" #include "components/segmentation_platform/internal/platform_options.h" +#include "components/segmentation_platform/internal/service_proxy_impl.h" #include "components/segmentation_platform/public/segmentation_platform_service.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -113,9 +113,7 @@ void GetSelectedSegment(const std::string& segmentation_key, SegmentSelectionCallback callback) override; void EnableMetrics(bool signal_collection_allowed) override; - void GetServiceStatus() override; - void AddObserver(SegmentationPlatformService::Observer* observer) override; - void RemoveObserver(SegmentationPlatformService::Observer* observer) override; + ServiceProxy* GetServiceProxy() override; private: FRIEND_TEST_ALL_PREFIXES(SegmentationPlatformServiceImplTest, @@ -180,7 +178,7 @@ absl::optional<bool> signal_database_initialized_; absl::optional<bool> signal_storage_config_initialized_; - base::ObserverList<SegmentationPlatformService::Observer> observers_; + std::unique_ptr<ServiceProxyImpl> proxy_; base::WeakPtrFactory<SegmentationPlatformServiceImpl> weak_ptr_factory_{this}; };
diff --git a/components/segmentation_platform/internal/service_proxy_impl.cc b/components/segmentation_platform/internal/service_proxy_impl.cc new file mode 100644 index 0000000..3ebc83b --- /dev/null +++ b/components/segmentation_platform/internal/service_proxy_impl.cc
@@ -0,0 +1,42 @@ +// Copyright 2021 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/segmentation_platform/internal/service_proxy_impl.h" + +namespace segmentation_platform { + +ServiceProxyImpl::ServiceProxyImpl(SegmentationPlatformService* service) + : is_service_initialized_(false), + service_status_flag_(0), + service_(service) {} + +ServiceProxyImpl::~ServiceProxyImpl() = default; + +void ServiceProxyImpl::AddObserver(ServiceProxy::Observer* observer) { + observers_.AddObserver(observer); +} + +void ServiceProxyImpl::RemoveObserver(ServiceProxy::Observer* observer) { + observers_.RemoveObserver(observer); +} + +void ServiceProxyImpl::OnServiceStatusChanged(bool is_initialized, + int status_flag) { + is_service_initialized_ = is_initialized; + service_status_flag_ = status_flag; + for (Observer& obs : observers_) + obs.OnServiceStatusChanged(is_initialized, status_flag); +} + +void ServiceProxyImpl::GetServiceStatus() { + OnServiceStatusChanged(is_service_initialized_, service_status_flag_); +} + +void ServiceProxyImpl::GetSelectedSegment( + const std::string& segmentation_key, + SegmentationPlatformService::SegmentSelectionCallback callback) { + service_->GetSelectedSegment(segmentation_key, std::move(callback)); +} + +} // namespace segmentation_platform
diff --git a/components/segmentation_platform/internal/service_proxy_impl.h b/components/segmentation_platform/internal/service_proxy_impl.h new file mode 100644 index 0000000..bb1410cd --- /dev/null +++ b/components/segmentation_platform/internal/service_proxy_impl.h
@@ -0,0 +1,44 @@ +// Copyright 2021 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_SEGMENTATION_PLATFORM_INTERNAL_SERVICE_PROXY_IMPL_H_ +#define COMPONENTS_SEGMENTATION_PLATFORM_INTERNAL_SERVICE_PROXY_IMPL_H_ + +#include "base/observer_list.h" +#include "components/segmentation_platform/public/service_proxy.h" + +namespace segmentation_platform { + +// A helper class to expose internals of the segmentationss service to a logging +// component and/or debug UI. +class ServiceProxyImpl : public ServiceProxy { + public: + explicit ServiceProxyImpl(SegmentationPlatformService* service); + ~ServiceProxyImpl() override; + + void AddObserver(ServiceProxy::Observer* observer) override; + void RemoveObserver(ServiceProxy::Observer* observer) override; + + ServiceProxyImpl(const ServiceProxyImpl& other) = delete; + ServiceProxyImpl& operator=(const ServiceProxyImpl& other) = delete; + + // Returns the current status of the segmentation service. + void GetServiceStatus() override; + void GetSelectedSegment( + const std::string& segmentation_key, + SegmentationPlatformService::SegmentSelectionCallback callback) override; + + // Called when segmentation service status changed. + void OnServiceStatusChanged(bool is_initialized, int status_flag); + + private: + bool is_service_initialized_; + int service_status_flag_; + SegmentationPlatformService* service_; + base::ObserverList<ServiceProxy::Observer> observers_; +}; + +} // namespace segmentation_platform + +#endif // COMPONENTS_SEGMENTATION_PLATFORM_INTERNAL_SERVICE_PROXY_IMPL_H_
diff --git a/components/segmentation_platform/public/BUILD.gn b/components/segmentation_platform/public/BUILD.gn index d5150d8..3862db29 100644 --- a/components/segmentation_platform/public/BUILD.gn +++ b/components/segmentation_platform/public/BUILD.gn
@@ -17,6 +17,7 @@ "segment_selection_result.h", "segmentation_platform_service.cc", "segmentation_platform_service.h", + "service_proxy.h", ] deps = [
diff --git a/components/segmentation_platform/public/segmentation_platform_service.cc b/components/segmentation_platform/public/segmentation_platform_service.cc index 5b6f727..3131013 100644 --- a/components/segmentation_platform/public/segmentation_platform_service.cc +++ b/components/segmentation_platform/public/segmentation_platform_service.cc
@@ -4,4 +4,10 @@ #include "components/segmentation_platform/public/segmentation_platform_service.h" -namespace segmentation_platform {} // namespace segmentation_platform +namespace segmentation_platform { + +ServiceProxy* SegmentationPlatformService::GetServiceProxy() { + return nullptr; +} + +} // namespace segmentation_platform
diff --git a/components/segmentation_platform/public/segmentation_platform_service.h b/components/segmentation_platform/public/segmentation_platform_service.h index 31cb980..cb74dbc4 100644 --- a/components/segmentation_platform/public/segmentation_platform_service.h +++ b/components/segmentation_platform/public/segmentation_platform_service.h
@@ -20,6 +20,7 @@ class PrefRegistrySimple; namespace segmentation_platform { +class ServiceProxy; struct SegmentSelectionResult; // The core class of segmentation platform that integrates all the required @@ -27,12 +28,6 @@ class SegmentationPlatformService : public KeyedService, public base::SupportsUserData { public: - // Interface that observes the service for debugging purpose. - class Observer : public base::CheckedObserver { - public: - virtual void OnServiceStatusChanged(bool is_initialized, int status_flag) {} - }; - #if defined(OS_ANDROID) // Returns a Java object of the type SegmentationPlatformService for the given // SegmentationPlatformService. @@ -63,12 +58,8 @@ // on startup. virtual void EnableMetrics(bool signal_collection_allowed) = 0; - // Called to check if the status of the service. - virtual void GetServiceStatus() = 0; - - // Called to add and remove observers - virtual void AddObserver(Observer* observer) {} - virtual void RemoveObserver(Observer* observer) {} + // Called to get the proxy that is used for debugging purpose. + virtual ServiceProxy* GetServiceProxy(); }; } // namespace segmentation_platform
diff --git a/components/segmentation_platform/public/service_proxy.h b/components/segmentation_platform/public/service_proxy.h new file mode 100644 index 0000000..7b39d19 --- /dev/null +++ b/components/segmentation_platform/public/service_proxy.h
@@ -0,0 +1,45 @@ +// Copyright 2021 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_SEGMENTATION_PLATFORM_PUBLIC_SERVICE_PROXY_H_ +#define COMPONENTS_SEGMENTATION_PLATFORM_PUBLIC_SERVICE_PROXY_H_ + +#include "base/observer_list_types.h" +#include "components/segmentation_platform/public/segmentation_platform_service.h" + +namespace segmentation_platform { + +// A helper class to expose internals of the segmentationss service to a logging +// component and/or debug UI. +class ServiceProxy { + public: + class Observer : public base::CheckedObserver { + public: + // Called whenever the service status changes. + virtual void OnServiceStatusChanged(bool is_initialized, int status_flag) {} + }; + + virtual ~ServiceProxy() = default; + + virtual void AddObserver(Observer* observer) = 0; + virtual void RemoveObserver(Observer* observer) = 0; + + ServiceProxy(const ServiceProxy& other) = delete; + ServiceProxy& operator=(const ServiceProxy& other) = delete; + + // Returns the current status of the segmentation service. + virtual void GetServiceStatus() = 0; + + // Called to get the selected segment. If none, returns empty result. + virtual void GetSelectedSegment( + const std::string& segmentation_key, + SegmentationPlatformService::SegmentSelectionCallback callback) = 0; + + protected: + ServiceProxy() = default; +}; + +} // namespace segmentation_platform + +#endif // COMPONENTS_SEGMENTATION_PLATFORM_PUBLIC_SERVICE_PROXY_H_ \ No newline at end of file
diff --git a/components/signin/public/android/java/src/org/chromium/components/signin/test/util/FakeAccountManagerFacade.java b/components/signin/public/android/java/src/org/chromium/components/signin/test/util/FakeAccountManagerFacade.java index e7b1564..87d94547 100644 --- a/components/signin/public/android/java/src/org/chromium/components/signin/test/util/FakeAccountManagerFacade.java +++ b/components/signin/public/android/java/src/org/chromium/components/signin/test/util/FakeAccountManagerFacade.java
@@ -19,7 +19,6 @@ import org.chromium.base.ThreadUtils; import org.chromium.components.signin.AccessTokenData; import org.chromium.components.signin.AccountManagerFacade; -import org.chromium.components.signin.AccountUtils; import org.chromium.components.signin.AccountsChangeObserver; import org.chromium.components.signin.ChildAccountStatus; @@ -163,13 +162,13 @@ } /** - * Creates a child account. + * Creates an email used to identify child accounts in tests. * A child-specific prefix will be appended to the base name so that the created account * will be considered as {@link ChildAccountStatus#REGULAR_CHILD} in * {@link FakeAccountManagerFacade}. */ - public static Account createChildAccount(String baseName) { - return AccountUtils.createAccountFromName(CHILD_ACCOUNT_NAME_PREFIX + baseName); + public static String generateChildEmail(String baseEmail) { + return CHILD_ACCOUNT_NAME_PREFIX + baseEmail; } @GuardedBy("mLock")
diff --git a/components/signin/public/android/junit/src/org/chromium/components/signin/AccountUtilsTest.java b/components/signin/public/android/junit/src/org/chromium/components/signin/AccountUtilsTest.java index 1d5982a1..2d1474e 100644 --- a/components/signin/public/android/junit/src/org/chromium/components/signin/AccountUtilsTest.java +++ b/components/signin/public/android/junit/src/org/chromium/components/signin/AccountUtilsTest.java
@@ -25,10 +25,10 @@ /** Unit tests for {@link AccountUtils} */ @RunWith(BaseRobolectricTestRunner.class) public class AccountUtilsTest { - private static final Account CHILD_ACCOUNT1 = - FakeAccountManagerFacade.createChildAccount("account1@gmail.com"); - private static final Account CHILD_ACCOUNT2 = - FakeAccountManagerFacade.createChildAccount("account2@gmail.com"); + private static final Account CHILD_ACCOUNT1 = AccountUtils.createAccountFromName( + FakeAccountManagerFacade.generateChildEmail("account1@gmail.com")); + private static final Account CHILD_ACCOUNT2 = AccountUtils.createAccountFromName( + FakeAccountManagerFacade.generateChildEmail("account2@gmail.com")); private static final Account ADULT_ACCOUNT1 = AccountUtils.createAccountFromName("adult.account1@gmail.com"); private static final Account ADULT_ACCOUNT2 =
diff --git a/components/sync/driver/sync_service_impl.cc b/components/sync/driver/sync_service_impl.cc index 96d397d..e858b61 100644 --- a/components/sync/driver/sync_service_impl.cc +++ b/components/sync/driver/sync_service_impl.cc
@@ -515,8 +515,6 @@ void SyncServiceImpl::ResetEngine(ShutdownReason shutdown_reason, ResetEngineReason reset_reason) { - base::UmaHistogramEnumeration("Sync.ResetEngineReason", reset_reason); - if (!engine_) { // If the engine hasn't started or is already shut down when a DISABLE_SYNC // happens, the Directory needs to be cleaned up here. @@ -526,6 +524,7 @@ return; } + base::UmaHistogramEnumeration("Sync.ResetEngineReason", reset_reason); switch (shutdown_reason) { case ShutdownReason::STOP_SYNC_AND_KEEP_DATA: case ShutdownReason::DISABLE_SYNC_AND_CLEAR_DATA:
diff --git a/components/user_manager/known_user.cc b/components/user_manager/known_user.cc index a5d8d3c..fe75d87 100644 --- a/components/user_manager/known_user.cc +++ b/components/user_manager/known_user.cc
@@ -259,7 +259,7 @@ static_cast<base::DictionaryValue*>(&element_value); if (UserMatches(account_id, *element)) { if (clear) - element->Clear(); + element->DictClear(); element->MergeDictionary(&values); UpdateIdentity(account_id, *element); return;
diff --git a/components/viz/service/display/surface_aggregator.cc b/components/viz/service/display/surface_aggregator.cc index 8443a09..5ae5ff22 100644 --- a/components/viz/service/display/surface_aggregator.cc +++ b/components/viz/service/display/surface_aggregator.cc
@@ -235,6 +235,26 @@ aggregation.in_pixel_moving_filter_pass; } +// Computes an enclosing rect in target render pass coordinate space that bounds +// where |quad| may contribute pixels. This rect is computed by transforming the +// quads |visible_rect|, which is known to be contained by the quads |rect|, and +// transforming it into target render pass coordinate space. The rect is then +// clipped by SharedQuadState |clip_rect| if one exists. +// +// Since a quad can only damage pixels it can draw to, the drawable rect is also +// the maximum damage rect a quad can contribute (ignoring pixel-moving +// filters). +gfx::Rect ComputeDrawableRectForQuad(const DrawQuad* quad) { + const SharedQuadState* sqs = quad->shared_quad_state; + + gfx::Rect drawable_rect = cc::MathUtil::MapEnclosingClippedRect( + sqs->quad_to_target_transform, quad->visible_rect); + if (sqs->clip_rect) + drawable_rect.Intersect(*sqs->clip_rect); + + return drawable_rect; +} + } // namespace constexpr base::TimeDelta SurfaceAggregator::kHistogramMinTime; @@ -557,38 +577,35 @@ const SurfaceDrawQuad* surface_quad, float parent_device_scale_factor, const gfx::Transform& target_transform, - const absl::optional<gfx::Rect>& clip_rect, + const absl::optional<gfx::Rect>& added_clip_rect, AggregatedRenderPass* dest_pass, bool ignore_undamaged, gfx::Rect* damage_rect_in_quad_space, bool* damage_rect_in_quad_space_valid, const MaskFilterInfoExt& mask_filter_info) { + DCHECK(target_transform.Preserves2dAxisAlignment()); + SurfaceId primary_surface_id = surface_quad->surface_range.end(); const ResolvedFrameData* resolved_frame = GetResolvedFrame(surface_quad->surface_range); + // |added_clip_rect| should be bounded by the output_rect of the render pass + // that contains |surface_quad|. + absl::optional<gfx::Rect> surface_clip_rect = CalculateClipRect( + added_clip_rect, source_pass.output_rect, target_transform); + // If a new surface is going to be emitted, add the surface_quad rect to // |surface_damage_rect_list_| for overlays. The whole quad is considered // damaged. if (needs_surface_damage_rect_list_ && (!resolved_frame || (resolved_frame->surface_id() != primary_surface_id))) { - const SharedQuadState* surface_quad_sqs = surface_quad->shared_quad_state; - - // TODO(crbug.com/1261917, crbug.com/1257765 and crbug.com/1263146): - // Integer overflows caused by huge rect sizes in surface_quad->visible_rect - // occur in some crash dumps. Use sqs->visible_quad_layer_rect instead - // because it seems more accurate in those crash dumps. Revisit this comment - // after the huge rect size bug is fixed. - gfx::Rect default_damage_rect = cc::MathUtil::MapEnclosingClippedRect( - surface_quad_sqs->quad_to_target_transform, - surface_quad_sqs->visible_quad_layer_rect); - if (surface_quad_sqs->clip_rect) { - default_damage_rect.Intersect(surface_quad_sqs->clip_rect.value()); - } - - AddSurfaceDamageToDamageList(default_damage_rect, target_transform, - clip_rect, dest_pass, + // If using a fallback surface the surface content may be stretched or have + // gutter. If the surface is missing the content will be filled with a solid + // color. In both cases we no longer have frame-to-frame damage so treat the + // entire SurfaceDrawQuad visible_rect as damaged. + AddSurfaceDamageToDamageList(ComputeDrawableRectForQuad(surface_quad), + target_transform, surface_clip_rect, dest_pass, /*resolved_frame=*/nullptr); } @@ -596,8 +613,9 @@ // SolidColorDrawQuad with the provided default background color. This // can happen after a Viz process crash. if (!resolved_frame) { - EmitDefaultBackgroundColorQuad(surface_quad, target_transform, clip_rect, - dest_pass, mask_filter_info); + EmitDefaultBackgroundColorQuad(surface_quad, target_transform, + surface_clip_rect, dest_pass, + mask_filter_info); return; } @@ -612,17 +630,18 @@ parent_device_scale_factor / fallback_frame.device_scale_factor(); fallback_rect = gfx::ScaleToEnclosingRect(fallback_rect, scale_ratio, scale_ratio); - fallback_rect = gfx::IntersectRects(fallback_rect, surface_quad->rect); + fallback_rect = + gfx::IntersectRects(fallback_rect, surface_quad->visible_rect); - EmitGutterQuadsIfNecessary(surface_quad->rect, fallback_rect, + EmitGutterQuadsIfNecessary(surface_quad->visible_rect, fallback_rect, surface_quad->shared_quad_state, - target_transform, clip_rect, + target_transform, surface_clip_rect, fallback_frame.metadata.root_background_color, dest_pass, mask_filter_info); } - EmitSurfaceContent(*resolved_frame, parent_device_scale_factor, source_pass, - surface_quad, target_transform, clip_rect, dest_pass, + EmitSurfaceContent(*resolved_frame, parent_device_scale_factor, surface_quad, + target_transform, surface_clip_rect, dest_pass, ignore_undamaged, damage_rect_in_quad_space, damage_rect_in_quad_space_valid, mask_filter_info); } @@ -630,10 +649,9 @@ void SurfaceAggregator::EmitSurfaceContent( const ResolvedFrameData& resolved_frame, float parent_device_scale_factor, - const CompositorRenderPass& source_pass, const SurfaceDrawQuad* surface_quad, const gfx::Transform& target_transform, - const absl::optional<gfx::Rect>& clip_rect, + const absl::optional<gfx::Rect>& added_clip_rect, AggregatedRenderPass* dest_pass, bool ignore_undamaged, gfx::Rect* damage_rect_in_quad_space, @@ -727,24 +745,22 @@ copy_requests.empty() && combined_transform.Preserves2dAxisAlignment() && mask_filter_info.CanMergeMaskFilterInfo(*render_pass_list.back()); - absl::optional<gfx::Rect> quads_clip; - // Intersect the transformed surface visible rect and the clip rect to - // create a smaller cliprect for the quad. - gfx::Rect surface_quad_clip_rect = cc::MathUtil::MapEnclosingClippedRect( - surface_quad_sqs->quad_to_target_transform, surface_quad_visible_rect); - if (surface_quad_sqs->clip_rect) { - surface_quad_clip_rect.Intersect(*surface_quad_sqs->clip_rect); + absl::optional<gfx::Rect> surface_quad_clip; + if (merge_pass || needs_surface_damage_rect_list_) { + // Compute a clip rect in |dest_pass| coordinate space to ensure merged + // surface cannot draw outside where a non-merged surface would draw. An + // enclosing rect in |surface_quad| target render pass coordinate space is + // computed, then transformed into |dest_pass| coordinate space and finally + // that is intersected with existing |added_clip_rect|. + surface_quad_clip = CalculateClipRect( + added_clip_rect, ComputeDrawableRectForQuad(surface_quad), + target_transform); } - surface_quad_clip_rect.Intersect(source_pass.output_rect); - - quads_clip = - CalculateClipRect(clip_rect, surface_quad_clip_rect, target_transform); - if (needs_surface_damage_rect_list_) { AddSurfaceDamageToDamageList(/*default_damage_rect=*/gfx::Rect(), - combined_transform, quads_clip, dest_pass, - &resolved_frame); + combined_transform, surface_quad_clip, + dest_pass, &resolved_frame); } if (frame.metadata.delegated_ink_metadata) { @@ -823,8 +839,8 @@ if (merge_pass) { CopyQuadsToPass(resolved_frame, resolved_root_pass, dest_pass, - frame.device_scale_factor(), combined_transform, quads_clip, - surface, mask_filter_info); + frame.device_scale_factor(), combined_transform, + surface_quad_clip, surface, mask_filter_info); } else { auto* shared_quad_state = CopyAndScaleSharedQuadState( surface_quad_sqs, scaled_quad_to_target_transform, target_transform, @@ -834,7 +850,7 @@ gfx::ScaleToEnclosingRect(surface_quad_sqs->visible_quad_layer_rect, inverse_extra_content_scale_x, inverse_extra_content_scale_y), - quads_clip, mask_filter_info, dest_pass); + added_clip_rect, mask_filter_info, dest_pass); // At this point, we need to calculate three values in order to construct // the CompositorRenderPassDrawQuad:
diff --git a/components/viz/service/display/surface_aggregator.h b/components/viz/service/display/surface_aggregator.h index 9908441..5a2475ec9 100644 --- a/components/viz/service/display/surface_aggregator.h +++ b/components/viz/service/display/surface_aggregator.h
@@ -128,25 +128,27 @@ ResolvedFrameData* GetResolvedFrame(Surface* surface, bool inside_aggregation); - // |source_pass| is the render pass that contains |surface_quad|. + // - |source_pass| is the render pass that contains |surface_quad|. + // - |target_transform| is the transform from the coordinate space of + // |source_pass| to |dest_pass|. + // - |added_clip_rect| is an added clip rect in the |dest_pass| coordinate + // space. void HandleSurfaceQuad(const CompositorRenderPass& source_pass, const SurfaceDrawQuad* surface_quad, float parent_device_scale_factor, const gfx::Transform& target_transform, - const absl::optional<gfx::Rect>& clip_rect, + const absl::optional<gfx::Rect>& added_clip_rect, AggregatedRenderPass* dest_pass, bool ignore_undamaged, gfx::Rect* damage_rect_in_quad_space, bool* damage_rect_in_quad_space_valid, const MaskFilterInfoExt& mask_filter_info_pair); - // |source_pass| is the render pass that contains |surface_quad|. void EmitSurfaceContent(const ResolvedFrameData& resolved_frame, float parent_device_scale_factor, - const CompositorRenderPass& source_pass, const SurfaceDrawQuad* surface_quad, const gfx::Transform& target_transform, - const absl::optional<gfx::Rect>& clip_rect, + const absl::optional<gfx::Rect>& added_clip_rect, AggregatedRenderPass* dest_pass, bool ignore_undamaged, gfx::Rect* damage_rect_in_quad_space,
diff --git a/components/viz/service/display/surface_aggregator_unittest.cc b/components/viz/service/display/surface_aggregator_unittest.cc index d5278b7..cc336bb 100644 --- a/components/viz/service/display/surface_aggregator_unittest.cc +++ b/components/viz/service/display/surface_aggregator_unittest.cc
@@ -773,6 +773,91 @@ ElementsAre(AllOf(IsAggregatedRenderPassQuad(), HasTransform(rotate)))); } +// Validate that implicit clipping when quads are drawn to an intermediate +// render pass texture the same size as the render pass output_rect is +// maintained even if the root render pass for a surface is merged into the +// embedding render pass and there is no intermediate texture. +TEST_F(SurfaceAggregatorValidSurfaceTest, ClipMergedPasses) { + // The grandchild surface is larger than the child surface, making it possible + // for a SolidColorDrawQuad from the granchild surface to draw beyond the + // child surface intermediate render pass texture when surfaces are merged + // together and intermediate textures are skipped. + constexpr gfx::Rect grandchild_child_rect(150, 150); + constexpr gfx::Rect child_rect(100, 100); + constexpr gfx::Size root_size(200, 200); + + auto grandchild_support = std::make_unique<CompositorFrameSinkSupport>( + nullptr, &this->manager_, kArbitraryFrameSinkId1, false); + TestSurfaceIdAllocator grandchild_surface_id( + grandchild_support->frame_sink_id()); + TestSurfaceIdAllocator child_surface_id(child_sink_->frame_sink_id()); + + { + auto frame = CompositorFrameBuilder() + .AddRenderPass(RenderPassBuilder(grandchild_child_rect) + .AddSolidColorQuad( + gfx::Rect(grandchild_child_rect), + SK_ColorBLUE)) + .Build(); + grandchild_support->SubmitCompositorFrame( + grandchild_surface_id.local_surface_id(), std::move(frame)); + } + + { + // There is a 150x150 SurfaceDrawQuad translated 50,50 inside of a 100x100 + // CompositorFrame. As a result, only a 50x50 portion of the SurfaceDrawQuad + // can be drawn and the rest extends outside the output_rect and should be + // clipped. + auto frame = CompositorFrameBuilder() + .AddRenderPass(RenderPassBuilder(child_rect) + .AddSurfaceQuad( + grandchild_child_rect, + SurfaceRange(grandchild_surface_id)) + .SetQuadToTargetTranslation(50, 50)) + .Build(); + child_sink_->SubmitCompositorFrame(child_surface_id.local_surface_id(), + std::move(frame)); + } + + { + // The SurfaceDrawQuad here is using 150x150 as the rect/visible_rect which + // is intentionally bigger than the 100x100 output_rect of the child + // surface. + auto frame = + CompositorFrameBuilder() + .AddRenderPass( + RenderPassBuilder(root_size) + .AddSurfaceQuad(grandchild_child_rect, + SurfaceRange(child_surface_id)) + .SetQuadToTargetTranslation(50, 50) + .AddSolidColorQuad(gfx::Rect(root_size), SK_ColorWHITE)) + .Build(); + root_sink_->SubmitCompositorFrame(root_surface_id_.local_surface_id(), + std::move(frame)); + } + + auto aggregated_frame = AggregateFrame(root_surface_id_); + EXPECT_EQ(1u, aggregated_frame.render_pass_list.size()); + + auto& render_pass = aggregated_frame.render_pass_list[0]; + EXPECT_THAT(render_pass->quad_list, + ElementsAre(IsSolidColorQuad(SK_ColorBLUE), + IsSolidColorQuad(SK_ColorWHITE))); + + // Make sure there is a 150x150 solid color quad in the final frame. + auto* clipped_quad = render_pass->quad_list.ElementAt(0); + EXPECT_EQ(clipped_quad->rect, grandchild_child_rect); + EXPECT_EQ(clipped_quad->visible_rect, grandchild_child_rect); + EXPECT_TRUE(clipped_quad->shared_quad_state->clip_rect); + + // Only a 50x50 chunk of the 150x150 solid color quad should be visible. This + // is due to the child surface root render pass output_rect being added to the + // surface clip rect. Even if the visible_rect is wrong this ensures the + // merged and unmerged cases produce the same output. + EXPECT_THAT(clipped_quad->shared_quad_state->clip_rect, + testing::Optional(gfx::Rect(100, 100, 50, 50))); +} + TEST_F(SurfaceAggregatorValidSurfaceTest, MultiPassSimpleFrame) { std::vector<Quad> quads[2] = { {Quad::SolidColorQuad(SK_ColorWHITE, gfx::Rect(5, 5)),
diff --git a/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc b/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc index 2207ce9..e9ba1061 100644 --- a/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc +++ b/components/viz/service/display_embedder/skia_output_device_buffer_queue.cc
@@ -41,6 +41,10 @@ g_last_reshape_failure = now; } +// See |needs_background_image| for details. +constexpr size_t kNumberOfBackgroundImages = 2u; +constexpr gfx::Size kBackgroundImageSize(4, 4); + } // namespace namespace viz { @@ -241,11 +245,8 @@ void SkiaOutputDeviceBufferQueue::SchedulePrimaryPlane( const absl::optional<OverlayProcessorInterface::OutputSurfaceOverlayPlane>& plane) { - if (background_image_ && !background_image_is_scheduled_) { - background_image_->BeginPresent(); - presenter_->ScheduleBackground(background_image_.get()); - background_image_is_scheduled_ = true; - } + // See |needs_background_image|. + MaybeScheduleBackgroundImage(); if (plane) { // If the current_image_ is nullptr, it means there is no change on the @@ -637,11 +638,8 @@ overlay_transform_ = transform; - if (needs_background_image_ && !background_image_) { - background_image_ = - presenter_->AllocateSingleImage(color_space, gfx::Size(4, 4)); - background_image_is_scheduled_ = false; - } + // See |needs_background_image|. + MaybeAllocateBackgroundImages(); if (color_space_ == color_space && image_size_ == size) return true; @@ -676,6 +674,40 @@ return !images_.empty(); } +void SkiaOutputDeviceBufferQueue::MaybeAllocateBackgroundImages() { + if (!needs_background_image_ || !background_images_.empty()) + return; + + background_images_ = presenter_->AllocateImages( + color_space_, kBackgroundImageSize, kNumberOfBackgroundImages); + DCHECK(!background_images_.empty()); + + // Clear the background images to avoid undesired artifacts. + for (auto& image : background_images_) { + image->BeginWriteSkia(); + image->sk_surface()->getCanvas()->clear(SkColors::kTransparent); + image->EndWriteSkia(/*force_flush*/ true); + } +} + +void SkiaOutputDeviceBufferQueue::MaybeScheduleBackgroundImage() { + if (!needs_background_image_) + return; + + if (current_background_image_) + current_background_image_->EndPresent({}); + current_background_image_ = GetNextBackgroundImage(); + current_background_image_->BeginPresent(); + presenter_->ScheduleBackground(current_background_image_); +} + +OutputPresenter::Image* SkiaOutputDeviceBufferQueue::GetNextBackgroundImage() { + DCHECK_EQ(background_images_.size(), kNumberOfBackgroundImages); + return current_background_image_ == background_images_.front().get() + ? background_images_.back().get() + : background_images_.front().get(); +} + SkSurface* SkiaOutputDeviceBufferQueue::BeginPaint( bool allocate_frame_buffer, std::vector<GrBackendSemaphore>* end_semaphores) {
diff --git a/components/viz/service/display_embedder/skia_output_device_buffer_queue.h b/components/viz/service/display_embedder/skia_output_device_buffer_queue.h index ed1b1b9..eeab0d87 100644 --- a/components/viz/service/display_embedder/skia_output_device_buffer_queue.h +++ b/components/viz/service/display_embedder/skia_output_device_buffer_queue.h
@@ -89,6 +89,10 @@ gfx::Size GetSwapBuffersSize(); bool RecreateImages(); + void MaybeAllocateBackgroundImages(); + void MaybeScheduleBackgroundImage(); + OutputPresenter::Image* GetNextBackgroundImage(); + std::unique_ptr<OutputPresenter> presenter_; scoped_refptr<gpu::SharedContextState> context_state_; @@ -145,17 +149,22 @@ #endif // Set to true if no image is to be used for the primary plane of this frame. bool current_frame_has_no_primary_plane_ = false; - // Whether the platform needs an occluded background image. Wayland needs it - // for opaque accelerated widgets and event wiring. + // Whether or not the platform needs occluded background images. Wayland needs + // it for opaque accelerated widgets and event wiring. Please see details on + // the number of background images below. bool needs_background_image_ = false; + // 4x4 small images that will be scaled to cover an opaque region. + // It's required to have two background images to be scheduled so that + // Desktop Wayland compositors are able to apply state changes to root + // surfaces. Otherwise, they unref the attached buffer after processing it + // and never update the state changes of the root surface, which leads to + // a broken resize opetion. + std::vector<std::unique_ptr<OutputPresenter::Image>> background_images_; + OutputPresenter::Image* current_background_image_ = nullptr; // Whether the platform supports non-backed solid color overlays. The Wayland // backend is able to delegate these overlays without buffer backings // depending on the availability of a certain protocol. bool supports_non_backed_solid_color_images_ = false; - // A 4x4 small image that will be scaled to cover an opaque region. - std::unique_ptr<OutputPresenter::Image> background_image_; - // Set to true if background has been scheduled in a frame. - bool background_image_is_scheduled_ = false; // Whether |SchedulePrimaryPlane| needs to wait for a paint before scheduling // This works around an edge case for unpromoting fullscreen quads. bool primary_plane_waiting_on_paint_ = false;
diff --git a/components/webcrypto/algorithms/hmac_unittest.cc b/components/webcrypto/algorithms/hmac_unittest.cc index bcf8643..83c33984 100644 --- a/components/webcrypto/algorithms/hmac_unittest.cc +++ b/components/webcrypto/algorithms/hmac_unittest.cc
@@ -333,7 +333,7 @@ // Consistency rules when JWK value exists: Fail if inconsistency is found. // Pass: All input values are consistent with the JWK values. - dict.Clear(); + dict.DictClear(); dict.SetString("kty", "oct"); dict.SetString("alg", "HS256"); dict.SetString("use", "sig"); @@ -367,7 +367,7 @@ // Fail: Input algorithm (AES-CBC) is inconsistent with JWK value // (HMAC SHA256). - dict.Clear(); + dict.DictClear(); dict.SetString("kty", "oct"); dict.SetString("alg", "HS256"); dict.SetString("k", "l3nZEgZCeX8XRwJdWyK3rGB8qwjhdY8vOkbIvh4lxTuMao9Y_--hdg");
diff --git a/components/webcrypto/algorithms/rsa_ssa_unittest.cc b/components/webcrypto/algorithms/rsa_ssa_unittest.cc index f0c4a3d..5ebf78a6f 100644 --- a/components/webcrypto/algorithms/rsa_ssa_unittest.cc +++ b/components/webcrypto/algorithms/rsa_ssa_unittest.cc
@@ -24,7 +24,7 @@ // Helper for ImportJwkRsaFailures. Restores the JWK JSON // dictionary to a good state void RestoreJwkRsaDictionary(base::DictionaryValue* dict) { - dict->Clear(); + dict->DictClear(); dict->SetString("kty", "RSA"); dict->SetString("alg", "RS256"); dict->SetString("use", "sig");
diff --git a/content/browser/back_forward_cache_browsertest.cc b/content/browser/back_forward_cache_browsertest.cc index 9a211fd..72d9f9b0 100644 --- a/content/browser/back_forward_cache_browsertest.cc +++ b/content/browser/back_forward_cache_browsertest.cc
@@ -735,6 +735,71 @@ bool observed_ = false; }; +PageLifecycleStateManagerTestDelegate::PageLifecycleStateManagerTestDelegate( + PageLifecycleStateManager* manager) + : manager_(manager) { + manager->SetDelegateForTesting(this); +} + +PageLifecycleStateManagerTestDelegate:: + ~PageLifecycleStateManagerTestDelegate() { + if (manager_) + manager_->SetDelegateForTesting(nullptr); +} + +void PageLifecycleStateManagerTestDelegate::WaitForInBackForwardCacheAck() { + DCHECK(manager_); + if (manager_->last_acknowledged_state().is_in_back_forward_cache) { + return; + } + base::RunLoop loop; + store_in_back_forward_cache_ack_received_ = loop.QuitClosure(); + loop.Run(); +} + +void PageLifecycleStateManagerTestDelegate::OnStoreInBackForwardCacheSent( + base::OnceClosure cb) { + store_in_back_forward_cache_sent_ = std::move(cb); +} + +void PageLifecycleStateManagerTestDelegate::OnDisableJsEvictionSent( + base::OnceClosure cb) { + disable_eviction_sent_ = std::move(cb); +} + +void PageLifecycleStateManagerTestDelegate::OnRestoreFromBackForwardCacheSent( + base::OnceClosure cb) { + restore_from_back_forward_cache_sent_ = std::move(cb); +} + +void PageLifecycleStateManagerTestDelegate::OnLastAcknowledgedStateChanged( + const blink::mojom::PageLifecycleState& old_state, + const blink::mojom::PageLifecycleState& new_state) { + if (store_in_back_forward_cache_ack_received_ && + new_state.is_in_back_forward_cache) + std::move(store_in_back_forward_cache_ack_received_).Run(); +} + +void PageLifecycleStateManagerTestDelegate::OnUpdateSentToRenderer( + const blink::mojom::PageLifecycleState& new_state) { + if (store_in_back_forward_cache_sent_ && new_state.is_in_back_forward_cache) { + std::move(store_in_back_forward_cache_sent_).Run(); + } + + if (disable_eviction_sent_ && new_state.eviction_enabled == false) { + std::move(disable_eviction_sent_).Run(); + } + + if (restore_from_back_forward_cache_sent_ && + !new_state.is_in_back_forward_cache) { + std::move(restore_from_back_forward_cache_sent_).Run(); + } +} + +void PageLifecycleStateManagerTestDelegate::OnDeleted() { + manager_ = nullptr; +} + // Check the visible URL in the omnibox is properly updated when restoring a // document from the BackForwardCache. IN_PROC_BROWSER_TEST_F(BackForwardCacheBrowserTest, VisibleURL) {
diff --git a/content/browser/back_forward_cache_browsertest.h b/content/browser/back_forward_cache_browsertest.h index ad9c6d3..fa1c8d0 100644 --- a/content/browser/back_forward_cache_browsertest.h +++ b/content/browser/back_forward_cache_browsertest.h
@@ -260,6 +260,39 @@ const size_t kBackForwardCacheSize = 5; }; +// An implementation of PageLifecycleStateManager::TestDelegate for testing. +class PageLifecycleStateManagerTestDelegate + : public PageLifecycleStateManager::TestDelegate { + public: + explicit PageLifecycleStateManagerTestDelegate( + PageLifecycleStateManager* manager); + + ~PageLifecycleStateManagerTestDelegate() override; + + // Waits for the renderer finishing to set the state of being in back/forward + // cache. + void WaitForInBackForwardCacheAck(); + + void OnStoreInBackForwardCacheSent(base::OnceClosure cb); + void OnDisableJsEvictionSent(base::OnceClosure cb); + void OnRestoreFromBackForwardCacheSent(base::OnceClosure cb); + + private: + // PageLifecycleStateManager::TestDelegate: + void OnLastAcknowledgedStateChanged( + const blink::mojom::PageLifecycleState& old_state, + const blink::mojom::PageLifecycleState& new_state) override; + void OnUpdateSentToRenderer( + const blink::mojom::PageLifecycleState& new_state) override; + void OnDeleted() override; + + raw_ptr<PageLifecycleStateManager> manager_; + base::OnceClosure store_in_back_forward_cache_sent_; + base::OnceClosure store_in_back_forward_cache_ack_received_; + base::OnceClosure restore_from_back_forward_cache_sent_; + base::OnceClosure disable_eviction_sent_; +}; + } // namespace content #endif // CONTENT_BROWSER_BACK_FORWARD_CACHE_BROWSERTEST_H_
diff --git a/content/browser/back_forward_cache_features_browsertest.cc b/content/browser/back_forward_cache_features_browsertest.cc index 6cf32493e..16d6641 100644 --- a/content/browser/back_forward_cache_features_browsertest.cc +++ b/content/browser/back_forward_cache_features_browsertest.cc
@@ -453,10 +453,9 @@ // Tests the case when the page starts fetching in a dedicated worker, goes to // BFcache, and then the response amount reaches the threshold. The cached page // should evicted in this case. -// TODO(crbug.com/1275106): Test flaky. IN_PROC_BROWSER_TEST_F( BackForwardCacheWithDedicatedWorkerBrowserTest, - DISABLED_FetchStillLoading_ResponseStartedWhileFrozen_ExceedsPerRequestBytesLimit) { + FetchStillLoading_ResponseStartedWhileFrozen_ExceedsPerRequestBytesLimit) { CreateHttpsServer(); net::test_server::ControllableHttpResponse image_response(https_server(), @@ -485,8 +484,12 @@ image_response.WaitForRequest(); // Navigate away. + PageLifecycleStateManagerTestDelegate delegate( + rfh_a->render_view_host()->GetPageLifecycleStateManager()); EXPECT_TRUE( NavigateToURL(shell(), https_server()->GetURL("b.test", "/title2.html"))); + delegate.WaitForInBackForwardCacheAck(); + // The worker was still loading when we navigated away, but it's still // eligible for back-forward cache. EXPECT_TRUE(rfh_a->IsInBackForwardCache()); @@ -511,10 +514,9 @@ // Tests the case when the page starts fetching in a nested dedicated worker, // goes to BFcache, and then the response amount reaches the threshold. The // cached page should evicted in this case. -// TODO(crbug.com/1275106): Test flaky. IN_PROC_BROWSER_TEST_F( BackForwardCacheWithDedicatedWorkerBrowserTest, - DISABLED_FetchStillLoading_ResponseStartedWhileFrozen_ExceedsPerRequestBytesLimit_Nested) { + FetchStillLoading_ResponseStartedWhileFrozen_ExceedsPerRequestBytesLimit_Nested) { CreateHttpsServer(); net::test_server::ControllableHttpResponse image_response(https_server(), @@ -549,8 +551,11 @@ image_response.WaitForRequest(); // Navigate away. + PageLifecycleStateManagerTestDelegate delegate( + rfh_a->render_view_host()->GetPageLifecycleStateManager()); EXPECT_TRUE( NavigateToURL(shell(), https_server()->GetURL("b.test", "/title2.html"))); + delegate.WaitForInBackForwardCacheAck(); // The worker was still loading when we navigated away, but it's still // eligible for back-forward cache. EXPECT_TRUE(rfh_a->IsInBackForwardCache());
diff --git a/content/browser/back_forward_cache_internal_browsertest.cc b/content/browser/back_forward_cache_internal_browsertest.cc index d7364f3..aad18a0 100644 --- a/content/browser/back_forward_cache_internal_browsertest.cc +++ b/content/browser/back_forward_cache_internal_browsertest.cc
@@ -2455,77 +2455,6 @@ rfh_d->GetLifecycleState()); } -class PageLifecycleStateManagerTestDelegate - : public PageLifecycleStateManager::TestDelegate { - public: - explicit PageLifecycleStateManagerTestDelegate( - PageLifecycleStateManager* manager) - : manager_(manager) { - manager->SetDelegateForTesting(this); - } - - ~PageLifecycleStateManagerTestDelegate() override { - if (manager_) - manager_->SetDelegateForTesting(nullptr); - } - - void WaitForInBackForwardCacheAck() { - DCHECK(manager_); - if (manager_->last_acknowledged_state().is_in_back_forward_cache) { - return; - } - base::RunLoop loop; - store_in_back_forward_cache_ack_received_ = loop.QuitClosure(); - loop.Run(); - } - - void OnStoreInBackForwardCacheSent(base::OnceClosure cb) { - store_in_back_forward_cache_sent_ = std::move(cb); - } - - void OnDisableJsEvictionSent(base::OnceClosure cb) { - disable_eviction_sent_ = std::move(cb); - } - - void OnRestoreFromBackForwardCacheSent(base::OnceClosure cb) { - restore_from_back_forward_cache_sent_ = std::move(cb); - } - - private: - void OnLastAcknowledgedStateChanged( - const blink::mojom::PageLifecycleState& old_state, - const blink::mojom::PageLifecycleState& new_state) override { - if (store_in_back_forward_cache_ack_received_ && - new_state.is_in_back_forward_cache) - std::move(store_in_back_forward_cache_ack_received_).Run(); - } - - void OnUpdateSentToRenderer( - const blink::mojom::PageLifecycleState& new_state) override { - if (store_in_back_forward_cache_sent_ && - new_state.is_in_back_forward_cache) { - std::move(store_in_back_forward_cache_sent_).Run(); - } - - if (disable_eviction_sent_ && new_state.eviction_enabled == false) { - std::move(disable_eviction_sent_).Run(); - } - - if (restore_from_back_forward_cache_sent_ && - !new_state.is_in_back_forward_cache) { - std::move(restore_from_back_forward_cache_sent_).Run(); - } - } - - void OnDeleted() override { manager_ = nullptr; } - - raw_ptr<PageLifecycleStateManager> manager_; - base::OnceClosure store_in_back_forward_cache_sent_; - base::OnceClosure store_in_back_forward_cache_ack_received_; - base::OnceClosure restore_from_back_forward_cache_sent_; - base::OnceClosure disable_eviction_sent_; -}; - namespace { class EchoFakeWithFilter final : public mojom::Echo {
diff --git a/content/browser/background_fetch/background_fetch_service_impl.cc b/content/browser/background_fetch/background_fetch_service_impl.cc index 252b5d5..33037ed 100644 --- a/content/browser/background_fetch/background_fetch_service_impl.cc +++ b/content/browser/background_fetch/background_fetch_service_impl.cc
@@ -67,6 +67,19 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(render_frame_host); + if (render_frame_host->IsNestedWithinFencedFrame()) { + // The renderer should have checked and disallowed the request for fenced + // frames and throw exception in blink::BackgroundFetchManager. Ignore the + // request and mark it as bad if it didn't happen for some reason. + // TODO(crbug.com/1271051) Follow-up on this line depending on the + // conclusion at + // https://groups.google.com/a/chromium.org/g/navigation-dev/c/BZLlGsL2-64 + bad_message::ReceivedBadMessage( + render_frame_host->GetProcess(), + bad_message::BFSI_CREATE_FOR_FRAME_FENCED_FRAME); + return; + } + auto* rfhi = static_cast<RenderFrameHostImpl*>(render_frame_host); RenderProcessHost* render_process_host = rfhi->GetProcess(); DCHECK(render_process_host);
diff --git a/content/browser/bad_message.h b/content/browser/bad_message.h index 35e5348..a885bf0 100644 --- a/content/browser/bad_message.h +++ b/content/browser/bad_message.h
@@ -281,6 +281,7 @@ RFH_CREATE_CHILD_FRAME_SANDBOX_FLAGS = 254, RFPH_FOCUSED_FENCED_FRAME = 255, WCI_REQUEST_LOCK_MOUSE_FENCED_FRAME = 256, + BFSI_CREATE_FOR_FRAME_FENCED_FRAME = 257, // Please add new elements here. The naming convention is abbreviated class // name (e.g. RenderFrameHost becomes RFH) plus a unique description of the
diff --git a/content/browser/devtools/network_service_devtools_observer.cc b/content/browser/devtools/network_service_devtools_observer.cc index 69d94af..f0ec0d2 100644 --- a/content/browser/devtools/network_service_devtools_observer.cc +++ b/content/browser/devtools/network_service_devtools_observer.cc
@@ -9,8 +9,10 @@ #include "content/browser/devtools/protocol/audits_handler.h" #include "content/browser/devtools/protocol/network_handler.h" #include "content/browser/devtools/render_frame_devtools_agent_host.h" +#include "content/public/common/content_client.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/network/public/mojom/http_raw_headers.mojom.h" +#include "third_party/blink/public/mojom/web_feature/web_feature.mojom.h" namespace content { @@ -195,6 +197,18 @@ if (!ftn) return; + RenderFrameHostImpl* rfhi = ftn->current_frame_host(); + if (!rfhi) + return; + + // TODO(https://crbug.com/1268378): Remove this once enforcement is always + // enabled and warnings are no more. + if (is_warning) { + GetContentClient()->browser()->LogWebFeatureForCurrentPage( + rfhi, + blink::mojom::WebFeature::kPrivateNetworkAccessIgnoredPreflightError); + } + std::unique_ptr<protocol::Audits::AffectedRequest> affected_request = protocol::Audits::AffectedRequest::Create() .SetRequestId(devtools_request_id ? *devtools_request_id : "") @@ -227,8 +241,7 @@ .SetDetails(std::move(details)) .SetIssueId(cors_error_status.issue_id.ToString()) .Build(); - devtools_instrumentation::ReportBrowserInitiatedIssue( - ftn->current_frame_host(), issue.get()); + devtools_instrumentation::ReportBrowserInitiatedIssue(rfhi, issue.get()); } void NetworkServiceDevToolsObserver::OnSubresourceWebBundleMetadata(
diff --git a/content/browser/isolated_origin_browsertest.cc b/content/browser/isolated_origin_browsertest.cc index 778dca09d..2d859c232 100644 --- a/content/browser/isolated_origin_browsertest.cc +++ b/content/browser/isolated_origin_browsertest.cc
@@ -2021,8 +2021,8 @@ // Have tab1 call window.open() to create blank tab2. FrameTreeNode* tab1_root = web_contents()->GetPrimaryFrameTree().root(); ShellAddedObserver new_shell_observer; - ASSERT_TRUE( - ExecJs(tab1_root->current_frame_host(), "window.w = window.open()")); + ASSERT_TRUE(ExecJs(tab1_root->current_frame_host(), + "window.w = window.open('/nocontent')")); Shell* tab2_shell = new_shell_observer.GetShell(); // Create iframe in tab2.
diff --git a/content/browser/loader/cross_site_document_blocking_browsertest.cc b/content/browser/loader/cross_site_document_blocking_browsertest.cc index cf6d3aca..a43b58a 100644 --- a/content/browser/loader/cross_site_document_blocking_browsertest.cc +++ b/content/browser/loader/cross_site_document_blocking_browsertest.cc
@@ -782,6 +782,10 @@ InspectHistograms(histograms, kShouldBeAllowedWithoutSniffing, resource); } + // Do a document.open() so that the initial empty document's history entry + // won't get replaced. + EXPECT_TRUE(ExecJs(popup, "document.open();")); + // Navigate the popup and then go back to the 'about:blank' URL. TestNavigationObserver nav_observer(popup); ASSERT_TRUE(ExecJs(shell(), "popup.location.href = '/title3.html'"));
diff --git a/content/browser/navigation_browsertest.cc b/content/browser/navigation_browsertest.cc index f50afa9..5c64df3 100644 --- a/content/browser/navigation_browsertest.cc +++ b/content/browser/navigation_browsertest.cc
@@ -5250,7 +5250,10 @@ // Verify that we are at the initial empty document. EXPECT_EQ(1, popup->GetController().GetEntryCount()); - EXPECT_TRUE(popup->GetController().GetLastCommittedEntry()->IsInitialEntry()); + // Note that we're not on the initial NavigationEntry because of the + // synchronous about:blank commit. + EXPECT_FALSE( + popup->GetController().GetLastCommittedEntry()->IsInitialEntry()); EXPECT_TRUE( popup->GetPrimaryFrameTree().root()->is_on_initial_empty_document());
diff --git a/content/browser/renderer_host/browsing_context_state.h b/content/browser/renderer_host/browsing_context_state.h index 65086e4..b268449 100644 --- a/content/browser/renderer_host/browsing_context_state.h +++ b/content/browser/renderer_host/browsing_context_state.h
@@ -52,19 +52,36 @@ // TODO(crbug.com/1270671): Currently it's under implementation and there are // two different modes, controlled by a flag: kLegacyOneToOneWithFrameTreeNode, -// where BrowsingContextState is 1:1 with FrameTreeNode, and +// where BrowsingContextState is 1:1 with FrameTreeNode and exists for the +// duration of the FrameTreeNode lifetime, and // kSwapForCrossBrowsingInstanceNavigations intended state with the behaviour -// described above. kLegacyOneToOneWithFrameTreeNode is currently enabled -// and will be removed once the functionality gated behind -// kSwapForCrossBrowsingInstanceNavigations is implemented. +// described above, tied to the lifetime of the RenderFrameHostImpl. +// kLegacyOneToOneWithFrameTreeNode is currently enabled and will be removed +// once the functionality gated behind kSwapForCrossBrowsingInstanceNavigations +// is implemented. class BrowsingContextState : public base::RefCounted<BrowsingContextState> { public: + using RenderFrameProxyHostMap = + std::unordered_map<SiteInstanceGroupId, + std::unique_ptr<RenderFrameProxyHost>, + SiteInstanceGroupId::Hasher>; + explicit BrowsingContextState(); + // Returns a const reference to the map of proxy hosts. The keys are + // SiteInstanceGroup IDs, the values are RenderFrameProxyHosts. + const RenderFrameProxyHostMap& proxy_hosts() const { return proxy_hosts_; } + + RenderFrameProxyHostMap& proxy_hosts() { return proxy_hosts_; } + protected: friend class base::RefCounted<BrowsingContextState>; virtual ~BrowsingContextState(); + + private: + // Proxy hosts, indexed by SiteInstanceGroup ID. + RenderFrameProxyHostMap proxy_hosts_; }; } // namespace content
diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc index 2e297659..49d6a69 100644 --- a/content/browser/renderer_host/media/video_capture_manager.cc +++ b/content/browser/renderer_host/media/video_capture_manager.cc
@@ -972,7 +972,6 @@ RecordDeviceSessionLockDuration(); if (base::FeatureList::IsEnabled(features::kStopVideoCaptureOnScreenLock)) { - idle_close_timer_.Stop(); ResumeDevices(); } } @@ -983,6 +982,10 @@ "Media.VideoCaptureManager.DeviceSessionLockDuration", base::TimeTicks::Now() - lock_time_); lock_time_ = base::TimeTicks(); + + if (base::FeatureList::IsEnabled(features::kStopVideoCaptureOnScreenLock)) { + idle_close_timer_.Stop(); + } } void VideoCaptureManager::EmitLogMessage(const std::string& message,
diff --git a/content/browser/renderer_host/navigation_controller_impl.cc b/content/browser/renderer_host/navigation_controller_impl.cc index a312771..f4d63d32 100644 --- a/content/browser/renderer_host/navigation_controller_impl.cc +++ b/content/browser/renderer_host/navigation_controller_impl.cc
@@ -1323,14 +1323,6 @@ return false; } break; - case NAVIGATION_TYPE_NAV_IGNORE: - // If a pending navigation was in progress, this canceled it. We should - // discard it and make sure it is removed from the URL bar. After that, - // there is nothing we can do with this navigation, so we just return to - // the caller that nothing has happened. - if (pending_entry_) - DiscardNonCommittedEntries(); - return false; case NAVIGATION_TYPE_UNKNOWN: NOTREACHED(); break; @@ -1446,15 +1438,6 @@ TraceReturnReason<tracing_category::kNavigation> trace_return( "ClassifyNavigation"); DCHECK(GetLastCommittedEntry()); - if (navigation_request->is_synchronous_renderer_commit() && - !navigation_request->IsSameDocument() && !rfh->GetParent() && - params.should_replace_current_entry) { - // Ignore the synchronous about:blank commit for window.open() to preserve - // previous behavior. - trace_return.set_return_reason( - "synchronous about:blank for window.open(), ignore"); - return NAVIGATION_TYPE_NAV_IGNORE; - } if (params.did_create_new_entry) { // A new entry for either the main frame or a subframe.
diff --git a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc index 41ca3360..e94bb2b2 100644 --- a/content/browser/renderer_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/renderer_host/navigation_controller_impl_browsertest.cc
@@ -1866,16 +1866,12 @@ // Navigate to a page to force the renderer process to start. EXPECT_TRUE(NavigateToURL(shell(), GURL(url::kAboutBlankURL))); - // Pop open a new window with only the initial entry. + // Pop open a new blank window. Shell* new_shell = OpenBlankWindow(contents()); FrameTreeNode* new_root = static_cast<WebContentsImpl*>(new_shell->web_contents()) ->GetPrimaryFrameTree() .root(); - EXPECT_TRUE(new_shell->web_contents() - ->GetController() - .GetLastCommittedEntry() - ->IsInitialEntry()); // Make a new iframe in it. { @@ -4241,9 +4237,9 @@ WebContentsImpl* new_contents = static_cast<WebContentsImpl*>(new_shell->web_contents()); NavigationControllerImpl& controller = new_contents->GetController(); - // Since the new window did a synchronous about:blank commit but it got - // dropped, it is still on the initial NavigationEntry. - EXPECT_TRUE(controller.GetLastCommittedEntry()->IsInitialEntry()); + // Since the new window did a synchronous about:blank commit, it is no + // longer the initial NavigationEntry. + EXPECT_FALSE(controller.GetLastCommittedEntry()->IsInitialEntry()); // Navigating the window to |url_2| will be classified as NEW_ENTRY and will // replace the previous entry. @@ -4263,17 +4259,28 @@ NavigationControllerImpl& controller = new_contents->GetController(); EXPECT_EQ(1, controller.GetEntryCount()); NavigationEntry* last_entry = controller.GetLastCommittedEntry(); - EXPECT_TRUE(last_entry->IsInitialEntry()); + // Since the new window did a synchronous about:blank commit, it is no + // longer the initial NavigationEntry. + EXPECT_FALSE(last_entry->IsInitialEntry()); // The window should be on the initial empty document. FrameTreeNode* new_root = new_contents->GetPrimaryFrameTree().root(); EXPECT_TRUE(new_root->is_on_initial_empty_document()); // Navigating the window to about:blank will be classified as NEW_ENTRY - // and will replace the initial entry. - NavigateWindowAndCheck(new_contents, GURL("about:blank")); + // and will replace the initial entry if renderer initiated, but will be + // turned into a reload if it's browser initiated since it's a same-URL + // navigation. + NavigateWindowAndCheck(new_contents, GURL("about:blank"), + true /* wait_for_previous_navigations */, + false /* expect_same_document */, + renderer_initiated() + ? NAVIGATION_TYPE_MAIN_FRAME_NEW_ENTRY + : NAVIGATION_TYPE_MAIN_FRAME_EXISTING_ENTRY, + renderer_initiated() /* expect_replace */); EXPECT_EQ(1, controller.GetEntryCount()); - EXPECT_NE(last_entry, controller.GetLastCommittedEntry()); + EXPECT_EQ(renderer_initiated(), + last_entry != controller.GetLastCommittedEntry()); last_entry = controller.GetLastCommittedEntry(); // The window is no longer on the initial empty document. @@ -4306,7 +4313,9 @@ NavigationControllerImpl& controller = new_contents->GetController(); EXPECT_EQ(1, controller.GetEntryCount()); NavigationEntry* last_entry = controller.GetLastCommittedEntry(); - EXPECT_TRUE(last_entry->IsInitialEntry()); + // Since the new window did a synchronous about:blank commit, it is no + // longer the initial NavigationEntry. + EXPECT_FALSE(last_entry->IsInitialEntry()); // The window should be on the initial empty document. FrameTreeNode* new_root = new_contents->GetPrimaryFrameTree().root(); @@ -4314,20 +4323,13 @@ // Navigating the window to about:blank#foo will be classified as a same- // document replacement, and will be classified as EXISTING_ENTRY and modify - // the last NavigationEntry for browser-initiated navigations, but it will - // be classified as NEW_ENTRY for renderer-initiated navigations, because - // of how main frame initial empty documents are handled in the renderer. - // TODO(https://crbug.com/1215096): Fix the renderer-initiated navigation - // case. + // the last NavigationEntry for browser-initiated navigations. NavigateWindowAndCheck(new_contents, GURL("about:blank#foo"), true /* wait_for_previous_navigations */, true /* expect_same_document */, - renderer_initiated() - ? NAVIGATION_TYPE_MAIN_FRAME_NEW_ENTRY - : NAVIGATION_TYPE_MAIN_FRAME_EXISTING_ENTRY); + NAVIGATION_TYPE_MAIN_FRAME_EXISTING_ENTRY); EXPECT_EQ(1, controller.GetEntryCount()); - EXPECT_EQ(renderer_initiated(), - last_entry != controller.GetLastCommittedEntry()); + EXPECT_EQ(last_entry, controller.GetLastCommittedEntry()); // The window should still be on the initial empty document. EXPECT_TRUE(new_root->is_on_initial_empty_document()); @@ -4358,10 +4360,10 @@ NavigateWindowAndCheck(new_contents, GURL("about:blank#foo"), true /* wait_for_previous_navigations */, true /* expect_same_document */, - NAVIGATION_TYPE_MAIN_FRAME_NEW_ENTRY, - false /* expect_replace */); - EXPECT_EQ(2, controller.GetEntryCount()); - EXPECT_NE(last_entry, controller.GetLastCommittedEntry()); + NAVIGATION_TYPE_MAIN_FRAME_EXISTING_ENTRY, + true /* expect_replace */); + EXPECT_EQ(1, controller.GetEntryCount()); + EXPECT_EQ(last_entry, controller.GetLastCommittedEntry()); // Check that we did a same-document navigation (the DSN stays the same). EXPECT_EQ(last_entry->GetMainFrameDocumentSequenceNumber(), controller.GetLastCommittedEntry() @@ -4372,12 +4374,12 @@ EXPECT_TRUE(new_root->is_on_initial_empty_document()); // Navigating the window to |url_2| will be classified as NEW_ENTRY and will - // add a new entry. + // replace the previous entry. NavigateWindowAndCheck( new_contents, url_2, true /* wait_for_previous_navigations */, false /* expect_same_document */, NAVIGATION_TYPE_MAIN_FRAME_NEW_ENTRY, - false /* expect_replace */); - EXPECT_EQ(3, controller.GetEntryCount()); + true /* expect_replace */); + EXPECT_EQ(1, controller.GetEntryCount()); EXPECT_NE(last_entry, controller.GetLastCommittedEntry()); // The window is no longer on theinitial empty document. @@ -4452,9 +4454,12 @@ EXPECT_FALSE(new_root->is_on_initial_empty_document()); // Navigating the window to |url_2| will be classified as NEW_ENTRY and will - // replace the previous entry. - NavigateWindowAndCheck(new_contents, url_2); - EXPECT_EQ(1, controller.GetEntryCount()); + // add a new entry. + NavigateWindowAndCheck( + new_contents, url_2, true /* wait_for_previous_navigations */, + false /* expect_same_document */, NAVIGATION_TYPE_MAIN_FRAME_NEW_ENTRY, + false /* expect_replace */); + EXPECT_EQ(2, controller.GetEntryCount()); EXPECT_TRUE(controller.GetLastCommittedEntry()); } @@ -4632,9 +4637,10 @@ } { - // Pop open a new window with window.open(), which will stay at the initial - // NavigationEntry. - Shell* new_shell = OpenBlankWindow(contents()); + // Pop open a new window which won't commit a navigation, so it will stay at + // the initial NavigationEntry. + GURL no_commit_url(embedded_test_server()->GetURL("/page204.html")); + Shell* new_shell = OpenWindow(contents(), no_commit_url); WebContentsImpl* new_contents = static_cast<WebContentsImpl*>(new_shell->web_contents()); // Stop the navigation so that it won't affect future navigations. @@ -4718,17 +4724,17 @@ NavigationControllerImpl& controller = new_contents->GetController(); FrameTreeNode* root = new_contents->GetPrimaryFrameTree().root(); EXPECT_EQ(1, controller.GetEntryCount()); - EXPECT_TRUE(controller.GetLastCommittedEntry()->IsInitialEntry()); + NavigationEntry* last_entry = controller.GetLastCommittedEntry(); { // Reload the tab. FrameNavigateParamsCapturer capturer(root); controller.Reload(ReloadType::NORMAL, false /* check_for_repost */); capturer.Wait(); - // Check that the renderer is still alive and the NavigationEntry is no - // longer the initial NavigationEntry. + // Check that the renderer is still alive and reused the previous entry. EXPECT_EQ(1, controller.GetEntryCount()); - EXPECT_FALSE(controller.GetLastCommittedEntry()->IsInitialEntry()); + EXPECT_EQ(last_entry, controller.GetLastCommittedEntry()); + last_entry = controller.GetLastCommittedEntry(); } { @@ -4737,10 +4743,10 @@ controller.Reload(ReloadType::BYPASSING_CACHE, false /* check_for_repost */); capturer.Wait(); - // Check that the renderer is still alive and the NavigationEntry is no - // longer the initial NavigationEntry. + // Check that the renderer is still alive and reused the previous entry. EXPECT_EQ(1, controller.GetEntryCount()); - EXPECT_FALSE(controller.GetLastCommittedEntry()->IsInitialEntry()); + EXPECT_EQ(last_entry, controller.GetLastCommittedEntry()); + last_entry = controller.GetLastCommittedEntry(); } // Navigate the tab to a page that has an about:blank iframe, which will load @@ -4749,6 +4755,8 @@ "/navigation_controller/page_with_iframe.html")); EXPECT_TRUE(NavigateToURL(new_shell, url_with_synchronous_blank_iframe)); EXPECT_EQ(2, controller.GetEntryCount()); + EXPECT_NE(last_entry, controller.GetLastCommittedEntry()); + last_entry = controller.GetLastCommittedEntry(); { // Reload the tab. This also reloads the iframe and re-triggers the @@ -4765,6 +4773,8 @@ EXPECT_TRUE(ExecJs(new_shell, "true")); EXPECT_TRUE(ExecJs(root->child_at(0), "true")); EXPECT_EQ(2, controller.GetEntryCount()); + EXPECT_EQ(last_entry, controller.GetLastCommittedEntry()); + last_entry = controller.GetLastCommittedEntry(); } { // Reload the tab, bypassing the cache. This also reloads the iframe and @@ -4782,6 +4792,7 @@ EXPECT_TRUE(ExecJs(new_shell, "true")); EXPECT_TRUE(ExecJs(root->child_at(0), "true")); EXPECT_EQ(2, controller.GetEntryCount()); + EXPECT_EQ(last_entry, controller.GetLastCommittedEntry()); } }
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 5d347b9..26819b5 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -7079,21 +7079,7 @@ return false; } - if (!frame_tree_node_->is_on_initial_empty_document()) { - // Return if we're not on the initial empty document. - return false; - } - - if (IsInMainFrame()) { - // We don't currently do initial empty document replacement on main frames, - // but we always replace the initial NavigationEntry on the next navigation - // on the main frame. - return frame_tree_node_->navigator() - .controller() - .GetLastCommittedEntry() - ->IsInitialEntry(); - } - return true; + return frame_tree_node_->is_on_initial_empty_document(); } bool NavigationRequest::ShouldReplaceCurrentEntryForFailedNavigation() const {
diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc index 784a93c..79e5b753 100644 --- a/content/browser/renderer_host/navigator.cc +++ b/content/browser/renderer_host/navigator.cc
@@ -583,7 +583,7 @@ // Send notification about committed provisional loads. This notification is // different from the NAV_ENTRY_COMMITTED notification which doesn't include // the actual URL navigated to and isn't sent for AUTO_SUBFRAME navigations. - if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { + if (delegate_) { DCHECK_EQ(!render_frame_host->GetParent(), did_navigate ? details.is_main_frame : false); navigation_request->DidCommitNavigation(
diff --git a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc index 57d2bf5a..372bd7d 100644 --- a/content/browser/renderer_host/render_frame_host_impl_browsertest.cc +++ b/content/browser/renderer_host/render_frame_host_impl_browsertest.cc
@@ -3024,7 +3024,6 @@ // Create a new about:blank popup and document.write into it. WebContentsAddedObserver popup_observer; - TestNavigationObserver load_observer(web_contents()); const char kScript[] = R"( // Empty |url| argument means that the popup will commit an initial // about:blank. @@ -3041,25 +3040,23 @@ // Wait for the new popup to be created (this will be before the popup finish // the synchronous about:blank commit in the browser). WebContents* popup = popup_observer.GetWebContents(); + content::TestNavigationObserver load_observer(popup); EXPECT_EQ(main_origin, popup->GetMainFrame()->GetLastCommittedOrigin()); EXPECT_EQ( blink::StorageKey(main_origin), static_cast<RenderFrameHostImpl*>(popup->GetMainFrame())->storage_key()); - // A round-trip to the renderer process is an indirect way to wait for - // DidCommitProvisionalLoad IPC for the synchronous about:blank commit. - // WaitForLoadStop cannot be used, because this commit won't raise - // NOTIFICATION_LOAD_STOP. - EXPECT_EQ(123, EvalJs(popup, "123")); + load_observer.WaitForNavigationFinished(); EXPECT_EQ(main_origin, popup->GetMainFrame()->GetLastCommittedOrigin()); EXPECT_EQ( blink::StorageKey(main_origin), static_cast<RenderFrameHostImpl*>(popup->GetMainFrame())->storage_key()); - // The synchronous about:blank commit should be ignored, and won't replace the - // initial NavigationEntry. + // The synchronous about:blank commit should replace the initial + // NavigationEntry. EXPECT_EQ(1, popup->GetController().GetEntryCount()); - EXPECT_TRUE(popup->GetController().GetLastCommittedEntry()->IsInitialEntry()); + EXPECT_FALSE( + popup->GetController().GetLastCommittedEntry()->IsInitialEntry()); } IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest,
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc index 0f9acdd8..a1b908ed 100644 --- a/content/browser/renderer_host/render_frame_host_manager.cc +++ b/content/browser/renderer_host/render_frame_host_manager.cc
@@ -336,8 +336,7 @@ SetRenderFrameHost(CreateRenderFrameHost( CreateFrameCase::kInitChild, site_instance, frame_routing_id, std::move(frame_remote), frame_token, - /*renderer_initiated_creation=*/false, - base::MakeRefCounted<BrowsingContextState>())); + /*renderer_initiated_creation=*/false, browsing_context_state_)); } RenderWidgetHostViewBase* RenderFrameHostManager::GetRenderWidgetHostView() @@ -540,7 +539,7 @@ frame_tree_node_->SetOpener(opener); - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { if (pair.second->GetSiteInstance() == source_site_instance) continue; pair.second->UpdateOpener(); @@ -575,7 +574,7 @@ // the parent process since it already knows the latest state. SiteInstance* parent_site_instance = frame_tree_node_->parent()->GetSiteInstance(); - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { if (pair.second->GetSiteInstance() != parent_site_instance) { pair.second->GetAssociatedRemoteFrame()->DidUpdateFramePolicy( frame_policy); @@ -584,7 +583,7 @@ } void RenderFrameHostManager::OnDidSetFramePolicyHeaders() { - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { pair.second->GetAssociatedRemoteFrame()->DidSetFramePolicyHeaders( frame_tree_node_->active_sandbox_flags(), frame_tree_node_->current_replication_state() @@ -601,12 +600,22 @@ void RenderFrameHostManager::PrepareForCollectingPage( RenderFrameHostImpl* main_render_frame_host, std::set<RenderViewHostImpl*>* render_view_hosts, - RenderFrameProxyHostMap* proxy_hosts) { + BrowsingContextState::RenderFrameProxyHostMap* proxy_hosts) { // Prepare the main frame. (*render_view_hosts).insert(main_render_frame_host->render_view_host()); // Prepare the proxies. SiteInstance* instance = main_render_frame_host->GetSiteInstance(); - for (auto& it : proxy_hosts_) { + + // When BrowsingContextState is decoupled from the FrameTreeNode and + // RenderFrameHostManager (legacy mode is disabled), proxies and replication + // state will be transferred with the RenderFrameHost instead and therefore + // will not need to be collected. + if (features::GetBrowsingContextMode() == + features::BrowsingContextStateImplementationType:: + kSwapForCrossBrowsingInstanceNavigations) { + return; + } + for (auto& it : browsing_context_state_->proxy_hosts()) { // This avoids including the proxy created when starting a // new cross-process, cross-BrowsingInstance navigation, as well as any // restored proxies which are also in a different BrowsingInstance. @@ -627,7 +636,7 @@ DCHECK(main_render_frame_host->is_main_frame()); std::set<RenderViewHostImpl*> render_view_hosts; - RenderFrameProxyHostMap proxy_hosts; + BrowsingContextState::RenderFrameProxyHostMap proxy_hosts; PrepareForCollectingPage(main_render_frame_host.get(), &render_view_hosts, &proxy_hosts); @@ -832,11 +841,11 @@ } void RenderFrameHostManager::ResetProxyHosts() { - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { static_cast<SiteInstanceImpl*>(pair.second->GetSiteInstance()) ->RemoveObserver(this); } - proxy_hosts_.clear(); + browsing_context_state_->proxy_hosts().clear(); } void RenderFrameHostManager::ClearRFHsPendingShutdown() { @@ -1321,18 +1330,18 @@ } void RenderFrameHostManager::OnDidStartLoading() { - for (const auto& pair : proxy_hosts_) + for (const auto& pair : browsing_context_state_->proxy_hosts()) pair.second->GetAssociatedRemoteFrame()->DidStartLoading(); } void RenderFrameHostManager::OnDidStopLoading() { - for (const auto& pair : proxy_hosts_) + for (const auto& pair : browsing_context_state_->proxy_hosts()) pair.second->GetAssociatedRemoteFrame()->DidStopLoading(); } void RenderFrameHostManager::OnDidUpdateName(const std::string& name, const std::string& unique_name) { - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { pair.second->GetAssociatedRemoteFrame()->SetReplicatedName(name, unique_name); } @@ -1340,7 +1349,7 @@ void RenderFrameHostManager::OnEnforceInsecureRequestPolicy( blink::mojom::InsecureRequestPolicy policy) { - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { pair.second->GetAssociatedRemoteFrame()->EnforceInsecureRequestPolicy( policy); } @@ -1348,7 +1357,7 @@ void RenderFrameHostManager::OnEnforceInsecureNavigationsSet( const std::vector<uint32_t>& insecure_navigations_set) { - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { pair.second->GetAssociatedRemoteFrame()->EnforceInsecureNavigationsSet( insecure_navigations_set); } @@ -1394,7 +1403,7 @@ // // TODO(alexmos): It would be sufficient to only send this update to proxies // in the current FrameTree. - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { if (pair.second->site_instance_group() != parent_instance->group()) { auto properties_for_remote_frame = properties.Clone(); RenderFrameProxyHost* proxy = pair.second.get(); @@ -1407,14 +1416,14 @@ void RenderFrameHostManager::OnDidUpdateOrigin( const url::Origin& origin, bool is_potentially_trustworthy_unique_origin) { - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { pair.second->GetAssociatedRemoteFrame()->SetReplicatedOrigin( origin, is_potentially_trustworthy_unique_origin); } } void RenderFrameHostManager::OnDidSetIsAdSubframe(bool is_ad_subframe) { - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { pair.second->GetAssociatedRemoteFrame()->SetReplicatedIsAdSubframe( is_ad_subframe); } @@ -1454,7 +1463,7 @@ void RenderFrameHostManager::UpdateUserActivationState( blink::mojom::UserActivationUpdateType update_type, blink::mojom::UserActivationNotificationType notification_type) { - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { RenderFrameProxyHost* proxy = pair.second.get(); proxy->GetAssociatedRemoteFrame()->UpdateUserActivationState( update_type, notification_type); @@ -1483,7 +1492,7 @@ void RenderFrameHostManager::OnSetHadStickyUserActivationBeforeNavigation( bool value) { - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { pair.second->GetAssociatedRemoteFrame() ->SetHadStickyUserActivationBeforeNavigation(value); } @@ -1504,11 +1513,13 @@ scoped_refptr<RenderViewHostImpl> rvh) { auto site_instance_group_id = static_cast<SiteInstanceImpl*>(site_instance)->group()->GetId(); - CHECK(proxy_hosts_.find(site_instance_group_id) == proxy_hosts_.end()) + CHECK(browsing_context_state_->proxy_hosts().find(site_instance_group_id) == + browsing_context_state_->proxy_hosts().end()) << "A proxy already existed for this SiteInstanceGroup."; RenderFrameProxyHost* proxy_host = new RenderFrameProxyHost(site_instance, std::move(rvh), frame_tree_node_); - proxy_hosts_[site_instance_group_id] = base::WrapUnique(proxy_host); + browsing_context_state_->proxy_hosts()[site_instance_group_id] = + base::WrapUnique(proxy_host); static_cast<SiteInstanceImpl*>(site_instance)->AddObserver(this); TRACE_EVENT_INSTANT("navigation", @@ -1520,7 +1531,7 @@ void RenderFrameHostManager::DeleteRenderFrameProxyHost( SiteInstance* site_instance) { static_cast<SiteInstanceImpl*>(site_instance)->RemoveObserver(this); - proxy_hosts_.erase( + browsing_context_state_->proxy_hosts().erase( static_cast<SiteInstanceImpl*>(site_instance)->group()->GetId()); } @@ -2908,7 +2919,7 @@ ChromeTrackEvent::kFrameTreeNodeInfo, *child); RenderFrameProxyHost* outer_delegate_proxy = IsMainFrameForInnerDelegate() ? GetProxyToOuterDelegate() : nullptr; - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { TRACE_EVENT_INSTANT( "navigation", "RenderFrameHostManager::CreateProxiesForChildFrame_ProxyHost", @@ -3343,19 +3354,27 @@ // If a document is being restored from the BackForwardCache or is being // activated from Prerendering, restore all cached state now. if (pending_stored_page) { - RenderFrameProxyHostMap proxy_hosts_to_restore = - std::move(pending_stored_page->proxy_hosts); - for (auto& proxy : proxy_hosts_to_restore) { - // We only cache pages when swapping BrowsingInstance, so we should never - // be reusing SiteInstanceGroups. - CHECK(!base::Contains(proxy_hosts_, - proxy.second->site_instance_group()->GetId())); - static_cast<SiteInstanceImpl*>(proxy.second->GetSiteInstance()) - ->AddObserver(this); - TRACE_EVENT_INSTANT( - "navigation", "RenderFrameHostManager::CommitPending_RestoreProxy", - ChromeTrackEvent::kRenderFrameProxyHost, *proxy.second); - proxy_hosts_.insert(std::move(proxy)); + // This is only implemented for the legacy mode of BrowsingContextState + // because in the new implementation, proxies will be swapped/restored + // whenever the RenderFrameHost (and internal BrowsingContextState) is + // restored. + if (features::GetBrowsingContextMode() == + features::BrowsingContextStateImplementationType:: + kLegacyOneToOneWithFrameTreeNode) { + BrowsingContextState::RenderFrameProxyHostMap proxy_hosts_to_restore = + std::move(pending_stored_page->proxy_hosts); + for (auto& proxy : proxy_hosts_to_restore) { + // We only cache pages when swapping BrowsingInstance, so we should + // never be reusing SiteInstanceGroups. + CHECK(!base::Contains(browsing_context_state_->proxy_hosts(), + proxy.second->site_instance_group()->GetId())); + static_cast<SiteInstanceImpl*>(proxy.second->GetSiteInstance()) + ->AddObserver(this); + TRACE_EVENT_INSTANT( + "navigation", "RenderFrameHostManager::CommitPending_RestoreProxy", + ChromeTrackEvent::kRenderFrameProxyHost, *proxy.second); + browsing_context_state_->proxy_hosts().insert(std::move(proxy)); + } } std::set<RenderViewHostImpl*> render_view_hosts_to_restore = @@ -3518,7 +3537,7 @@ } std::vector<RenderFrameProxyHost*> removed_proxies; - for (auto& it : proxy_hosts_) { + for (auto& it : browsing_context_state_->proxy_hosts()) { const auto& proxy = it.second; if (!render_frame_host_->GetSiteInstance()->IsRelatedSiteInstance( proxy->GetSiteInstance())) { @@ -3534,7 +3553,8 @@ // CrossProcessFrameConnector created already. Use it to link the new RFH's // view to the proxy that belongs to the parent frame's SiteInstance. If this // navigation causes an out-of-process frame to return to the same process as - // its parent, the proxy would have been removed from proxy_hosts_ above. + // its parent, the proxy would have been removed from + // browsing_context_state_->proxy_hosts() above. // Note: We do this after unloading the old RFH because that may create // the proxy we're looking for. RenderFrameProxyHost* proxy_to_parent_or_outer_delegate = @@ -3637,14 +3657,15 @@ RenderFrameProxyHost* RenderFrameHostManager::GetRenderFrameProxyHost( SiteInstanceGroup* site_instance_group) const { - auto it = proxy_hosts_.find(site_instance_group->GetId()); - if (it != proxy_hosts_.end()) + auto it = + browsing_context_state_->proxy_hosts().find(site_instance_group->GetId()); + if (it != browsing_context_state_->proxy_hosts().end()) return it->second.get(); return nullptr; } size_t RenderFrameHostManager::GetProxyCount() { - return proxy_hosts_.size(); + return browsing_context_state_->proxy_hosts().size(); } void RenderFrameHostManager::CollectOpenerFrameTrees( @@ -3768,7 +3789,7 @@ // want to also call it for the outer WebContent's frame as well. RenderFrameProxyHost* outer_delegate_proxy = IsMainFrameForInnerDelegate() ? GetProxyToOuterDelegate() : nullptr; - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { if (outer_delegate_proxy == pair.second.get()) continue; if (pair.second->GetSiteInstance() == instance_to_skip) @@ -3796,7 +3817,7 @@ // frame as well. RenderFrameProxyHost* outer_delegate_proxy = IsMainFrameForInnerDelegate() ? GetProxyToOuterDelegate() : nullptr; - for (const auto& pair : proxy_hosts_) { + for (const auto& pair : browsing_context_state_->proxy_hosts()) { if (outer_delegate_proxy == pair.second.get()) continue; if (pair.second->GetSiteInstance() == instance_to_skip)
diff --git a/content/browser/renderer_host/render_frame_host_manager.h b/content/browser/renderer_host/render_frame_host_manager.h index 17a64d21..6755509 100644 --- a/content/browser/renderer_host/render_frame_host_manager.h +++ b/content/browser/renderer_host/render_frame_host_manager.h
@@ -112,11 +112,6 @@ class CONTENT_EXPORT RenderFrameHostManager : public SiteInstanceImpl::Observer { public: - using RenderFrameProxyHostMap = - std::unordered_map<SiteInstanceGroupId, - std::unique_ptr<RenderFrameProxyHost>, - SiteInstanceGroupId::Hasher>; - // Functions implemented by our owner that we need. // // TODO(brettw) Clean this up! These are all the functions in WebContentsImpl @@ -495,8 +490,9 @@ // Returns a const reference to the map of proxy hosts. The keys are // SiteInstanceGroup IDs, the values are RenderFrameProxyHosts. - const RenderFrameProxyHostMap& GetAllProxyHostsForTesting() const { - return proxy_hosts_; + const BrowsingContextState::RenderFrameProxyHostMap& + GetAllProxyHostsForTesting() const { + return browsing_context_state_->proxy_hosts(); } // SiteInstanceImpl::Observer @@ -931,7 +927,7 @@ void PrepareForCollectingPage( RenderFrameHostImpl* main_render_frame_host, std::set<RenderViewHostImpl*>* render_view_hosts, - RenderFrameProxyHostMap* proxy_hosts); + BrowsingContextState::RenderFrameProxyHostMap* proxy_hosts); // Collects all of the page-related state currently owned by // RenderFrameHostManager (including relevant RenderViewHosts and @@ -952,9 +948,6 @@ // Eventually, RenderViewHost will be replaced with a page context. std::unique_ptr<RenderFrameHostImpl> render_frame_host_; - // Proxy hosts, indexed by SiteInstanceGroup ID. - RenderFrameProxyHostMap proxy_hosts_; - // Temporarily store BrowsingContextState here while it is 1:1 with // FrameTreeNode and RenderFrameHostManager so we can do an in-place migration // before starting to create a new BrowsingContextState for
diff --git a/content/browser/renderer_host/render_frame_host_manager_browsertest.cc b/content/browser/renderer_host/render_frame_host_manager_browsertest.cc index a6cb951..b88499f 100644 --- a/content/browser/renderer_host/render_frame_host_manager_browsertest.cc +++ b/content/browser/renderer_host/render_frame_host_manager_browsertest.cc
@@ -2181,9 +2181,10 @@ // navigation. WebContents* contents = new_shell->web_contents(); EXPECT_FALSE(contents->GetController().IsInitialNavigation()); - // The visible entry should be the initial entry, resulting in about:blank in - // the address bar. - EXPECT_TRUE(contents->GetController().GetVisibleEntry()->IsInitialEntry()); + // The visible entry should be the entry for the synchronously committed + // about:blank, resulting in about:blank in the address bar. + EXPECT_EQ(GURL(url::kAboutBlankURL), + contents->GetController().GetVisibleEntry()->GetURL()); } // Crashes under ThreadSanitizer, http://crbug.com/356758. @@ -3345,6 +3346,10 @@ EXPECT_EQ(shell()->web_contents()->GetSiteInstance(), new_shell->web_contents()->GetSiteInstance()); + // Do a document.open() so that the initial empty document's history entry + // won't get replaced. + EXPECT_TRUE(ExecJs(new_shell, "document.open();")); + // Navigate the popup to a different site. EXPECT_TRUE(NavigateToURL( new_shell, embedded_test_server()->GetURL("b.com", "/title2.html")));
diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc index dc1708a..13b6c1f2 100644 --- a/content/browser/service_worker/service_worker_internals_ui.cc +++ b/content/browser/service_worker/service_worker_internals_ui.cc
@@ -41,7 +41,6 @@ #include "third_party/blink/public/common/storage_key/storage_key.h" #include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h" -using base::DictionaryValue; using base::ListValue; using base::Value; using base::WeakPtr; @@ -458,8 +457,8 @@ CHECK(args->GetList().size() != 0); std::string callback_id = args->GetList()[0].GetString(); AllowJavascript(); - DictionaryValue options; - options.SetBoolean("debug_on_start", + base::Value options(base::Value::Type::DICTIONARY); + options.SetBoolKey("debug_on_start", ServiceWorkerDevToolsManager::GetInstance() ->debug_service_worker_on_start()); ResolveJavascriptCallback(base::Value(callback_id), options);
diff --git a/content/public/browser/navigation_type.h b/content/public/browser/navigation_type.h index f262323..20410a15 100644 --- a/content/public/browser/navigation_type.h +++ b/content/public/browser/navigation_type.h
@@ -73,11 +73,6 @@ // These two cases are actually pretty different, they just happen to // require almost the same code to handle. NAVIGATION_TYPE_AUTO_SUBFRAME, - - // Nothing happened. This happens when we get information about a page we - // don't know anything about. It can also happen when an iframe in a popup - // navigated to about:blank is navigated. Nothing needs to be done. - NAVIGATION_TYPE_NAV_IGNORE, }; } // namespace content
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc index 928b981..74d165a 100644 --- a/content/renderer/render_thread_impl.cc +++ b/content/renderer/render_thread_impl.cc
@@ -968,6 +968,8 @@ WebString devtools_scheme(WebString::FromASCII(kChromeDevToolsScheme)); WebSecurityPolicy::RegisterURLSchemeAsDisplayIsolated(devtools_scheme); WebSecurityPolicy::RegisterURLSchemeAsSupportingFetchAPI(devtools_scheme); + WebSecurityPolicy::RegisterURLSchemeAsNotAllowingJavascriptURLs( + devtools_scheme); // view-source: WebString view_source_scheme(WebString::FromASCII(kViewSourceScheme));
diff --git a/content/shell/android/BUILD.gn b/content/shell/android/BUILD.gn index 80e91a61..431cb408 100644 --- a/content/shell/android/BUILD.gn +++ b/content/shell/android/BUILD.gn
@@ -223,7 +223,6 @@ apk_name = "ContentShellTest" android_manifest = content_shell_test_manifest android_manifest_dep = ":content_shell_test_manifest" - use_vpython3 = false shared_libraries = [ ":libcontent_native_test" ] deps = [ "//base:base_java_test_support",
diff --git a/extensions/browser/content_script_tracker.cc b/extensions/browser/content_script_tracker.cc index da9bf679..61b7759 100644 --- a/extensions/browser/content_script_tracker.cc +++ b/extensions/browser/content_script_tracker.cc
@@ -168,7 +168,15 @@ return std::make_unique<RenderFrameHostAdapter>(parent_or_opener); } - GURL GetUrl() const override { return frame_->GetLastCommittedURL(); } + GURL GetUrl() const override { + if (frame_->GetLastCommittedURL().is_empty()) { + // It's possible for URL to be empty when `frame_` is on the initial empty + // document. TODO(https://crbug.com/1197308): Consider making `frame_`'s + // document's URL about:blank instead of empty in that case. + return GURL(url::kAboutBlankURL); + } + return frame_->GetLastCommittedURL(); + } url::Origin GetOrigin() const override { return frame_->GetLastCommittedOrigin();
diff --git a/extensions/renderer/script_context.cc b/extensions/renderer/script_context.cc index 7ead4e8..71259966 100644 --- a/extensions/renderer/script_context.cc +++ b/extensions/renderer/script_context.cc
@@ -69,7 +69,15 @@ return std::make_unique<WebLocalFrameAdapter>(local_parent_or_opener); } - GURL GetUrl() const override { return frame_->GetDocument().Url(); } + GURL GetUrl() const override { + if (frame_->GetDocument().Url().IsEmpty()) { + // It's possible for URL to be empty when `frame_` is on the initial empty + // document. TODO(https://crbug.com/1197308): Consider making `frame_`'s + // document's URL about:blank instead of empty in that case. + return GURL(url::kAboutBlankURL); + } + return frame_->GetDocument().Url(); + } url::Origin GetOrigin() const override { return frame_->GetSecurityOrigin(); }
diff --git a/ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.mm b/ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.mm index f2d140a..977abe90 100644 --- a/ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller.mm
@@ -23,6 +23,7 @@ #import "ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_constants.h" #import "ios/chrome/browser/ui/settings/password/password_details/password_details_table_view_controller_delegate.h" #import "ios/chrome/browser/ui/settings/password/passwords_table_view_constants.h" +#import "ios/chrome/browser/ui/table_view/cells/table_view_attributed_header_footer_item.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_link_header_footer_item.h" #import "ios/chrome/browser/ui/table_view/cells/table_view_text_edit_item.h" @@ -175,6 +176,11 @@ self.navigationItem.rightBarButtonItem.accessibilityIdentifier = kPasswordsAddPasswordSaveButtonId; + password_manager::metrics_util:: + LogUserInteractionsWhenAddingCredentialFromSettings( + password_manager::metrics_util:: + AddCredentialFromSettingsUserInteractions::kAddDialogOpened); + [self loadModel]; } else { UILabel* titleLabel = [[UILabel alloc] init]; @@ -188,7 +194,12 @@ } - (void)viewDidDisappear:(BOOL)animated { - if (self.credentialType != CredentialTypeNew) { + if (self.credentialType == CredentialTypeNew) { + password_manager::metrics_util:: + LogUserInteractionsWhenAddingCredentialFromSettings( + password_manager::metrics_util:: + AddCredentialFromSettingsUserInteractions::kAddDialogClosed); + } else { [self.handler passwordDetailsTableViewControllerDidDisappear]; } [super viewDidDisappear:animated]; @@ -484,13 +495,29 @@ return item; } -- (TableViewLinkHeaderFooterItem*)TLDMessageFooterItem { - TableViewLinkHeaderFooterItem* item = - [[TableViewLinkHeaderFooterItem alloc] initWithType:ItemTypeFooter]; +- (TableViewAttributedHeaderFooterItem*)TLDMessageFooterItem { + TableViewAttributedHeaderFooterItem* item = + [[TableViewAttributedHeaderFooterItem alloc] initWithType:ItemTypeFooter]; + NSString* URLWithTLD = + [self.websiteTextItem.textFieldValue stringByAppendingString:@".com"]; item.text = l10n_util::GetNSStringF( IDS_IOS_SETTINGS_PASSWORDS_MISSING_TLD_DESCRIPTION, - base::SysNSStringToUTF16([self.websiteTextItem.textFieldValue - stringByAppendingString:@".com"])); + base::SysNSStringToUTF16(URLWithTLD)); + + NSRange boldedRange = [item.text rangeOfString:URLWithTLD]; + DCHECK(boldedRange.location != NSNotFound); + UIFontDescriptor* baseDescriptor = [UIFontDescriptor + preferredFontDescriptorWithTextStyle:UIFontTextStyleFootnote]; + UIFontDescriptor* styleDescriptor = [baseDescriptor + fontDescriptorWithSymbolicTraits:UIFontDescriptorTraitBold]; + UIFont* fontText = [UIFont fontWithDescriptor:styleDescriptor + size:kUseDefaultFontSize]; + NSDictionary* boldTextAttribute = [NSDictionary + dictionaryWithObjectsAndKeys:fontText, NSFontAttributeName, + [UIColor colorNamed:kTextSecondaryColor], + NSForegroundColorAttributeName, nil]; + item.customTextAttributesOnRange = + @{[NSValue valueWithRange:boldedRange] : boldTextAttribute}; return item; } @@ -568,6 +595,11 @@ } break; case ItemTypeDuplicateCredentialButton: + password_manager::metrics_util:: + LogUserInteractionsWhenAddingCredentialFromSettings( + password_manager::metrics_util:: + AddCredentialFromSettingsUserInteractions:: + kDuplicateCredentialViewed); [self reauthAndShowExistingCredential]; break; } @@ -726,6 +758,11 @@ [self toggleNavigationBarRightButtonItem]; TableViewModel* model = self.tableViewModel; if (duplicateFound) { + password_manager::metrics_util:: + LogUserInteractionsWhenAddingCredentialFromSettings( + password_manager::metrics_util:: + AddCredentialFromSettingsUserInteractions:: + kDuplicatedCredentialEntered); [self performBatchTableViewUpdates:^{ NSUInteger passwordSectionIndex = [self.tableViewModel
diff --git a/ios/chrome/browser/ui/table_view/cells/BUILD.gn b/ios/chrome/browser/ui/table_view/cells/BUILD.gn index 0afe5f9..106927b 100644 --- a/ios/chrome/browser/ui/table_view/cells/BUILD.gn +++ b/ios/chrome/browser/ui/table_view/cells/BUILD.gn
@@ -6,6 +6,8 @@ sources = [ "table_view_activity_indicator_header_footer_item.h", "table_view_activity_indicator_header_footer_item.mm", + "table_view_attributed_header_footer_item.h", + "table_view_attributed_header_footer_item.mm", "table_view_cell.h", "table_view_cell.mm", "table_view_detail_icon_item.h",
diff --git a/ios/chrome/browser/ui/table_view/cells/table_view_attributed_header_footer_item.h b/ios/chrome/browser/ui/table_view/cells/table_view_attributed_header_footer_item.h new file mode 100644 index 0000000..c4c08c61 --- /dev/null +++ b/ios/chrome/browser/ui/table_view/cells/table_view_attributed_header_footer_item.h
@@ -0,0 +1,40 @@ +// Copyright 2021 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_UI_TABLE_VIEW_CELLS_TABLE_VIEW_ATTRIBUTED_HEADER_FOOTER_ITEM_H_ +#define IOS_CHROME_BROWSER_UI_TABLE_VIEW_CELLS_TABLE_VIEW_ATTRIBUTED_HEADER_FOOTER_ITEM_H_ + +#import <UIKit/UIKit.h> + +#import "ios/chrome/browser/ui/table_view/cells/table_view_header_footer_item.h" + +@class TableViewAttributedHeaderFooterView; + +// TableViewAttributedHeaderFooterItem is the model class corresponding to +// TableViewAttributedHeaderFooterView. +@interface TableViewAttributedHeaderFooterItem : TableViewHeaderFooterItem + +// The main text string. +@property(nonatomic, copy) NSString* text; + +// The text string attributes to be applied on a specific range of text. +@property(nonatomic, assign) + NSDictionary<NSValue*, NSDictionary*>* customTextAttributesOnRange; + +@end + +// UITableViewHeaderFooterView subclass containing a single UITextView. The text +// view is laid to fill the full width of the cell and it is wrapped as needed +// to fit in the cell. +@interface TableViewAttributedHeaderFooterView : UITableViewHeaderFooterView + +// Sets the |text| displayed by this cell. Adds custom attributes to text if +// provided. +- (void)setText:(NSString*)text + withCustomTextAttributes: + (NSDictionary<NSValue*, NSDictionary*>*)customTextAttributesOnRange; + +@end + +#endif // IOS_CHROME_BROWSER_UI_TABLE_VIEW_CELLS_TABLE_VIEW_ATTRIBUTED_HEADER_FOOTER_ITEM_H_
diff --git a/ios/chrome/browser/ui/table_view/cells/table_view_attributed_header_footer_item.mm b/ios/chrome/browser/ui/table_view/cells/table_view_attributed_header_footer_item.mm new file mode 100644 index 0000000..425788c --- /dev/null +++ b/ios/chrome/browser/ui/table_view/cells/table_view_attributed_header_footer_item.mm
@@ -0,0 +1,117 @@ +// Copyright 2021 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/table_view/cells/table_view_attributed_header_footer_item.h" + +#import "ios/chrome/browser/ui/table_view/cells/table_view_cells_constants.h" +#import "ios/chrome/common/ui/colors/semantic_color_names.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +namespace { + +// Padding used on the top and bottom edges of the cell. +const CGFloat kVerticalPadding = 8; + +} // namespace + +@implementation TableViewAttributedHeaderFooterItem + +- (instancetype)initWithType:(NSInteger)type { + self = [super initWithType:type]; + if (self) { + self.cellClass = [TableViewAttributedHeaderFooterView class]; + } + return self; +} + +#pragma mark CollectionViewItem + +- (void)configureHeaderFooterView: + (TableViewAttributedHeaderFooterView*)headerFooter + withStyler:(ChromeTableViewStyler*)styler { + [super configureHeaderFooterView:headerFooter withStyler:styler]; + + [headerFooter setText:self.text + withCustomTextAttributes:self.customTextAttributesOnRange]; +} + +@end + +@interface TableViewAttributedHeaderFooterView () + +// UILabel corresponding to |text| from the item. +@property(nonatomic, readonly, strong) UILabel* textLabel; + +@end + +@implementation TableViewAttributedHeaderFooterView + +@synthesize textLabel = _textLabel; + +- (instancetype)initWithReuseIdentifier:(NSString*)reuseIdentifier { + self = [super initWithReuseIdentifier:reuseIdentifier]; + if (self) { + _textLabel = [[UILabel alloc] init]; + _textLabel.backgroundColor = UIColor.clearColor; + _textLabel.font = + [UIFont preferredFontForTextStyle:kTableViewSublabelFontStyle]; + + _textLabel.adjustsFontForContentSizeCategory = YES; + _textLabel.translatesAutoresizingMaskIntoConstraints = NO; + + [self.contentView addSubview:_textLabel]; + + [NSLayoutConstraint activateConstraints:@[ + [_textLabel.topAnchor constraintEqualToAnchor:self.contentView.topAnchor + constant:kVerticalPadding], + [_textLabel.bottomAnchor + constraintEqualToAnchor:self.contentView.bottomAnchor + constant:-kVerticalPadding], + [_textLabel.trailingAnchor + constraintEqualToAnchor:self.contentView.trailingAnchor + constant:-HorizontalPadding()], + [_textLabel.leadingAnchor + constraintEqualToAnchor:self.contentView.leadingAnchor + constant:HorizontalPadding()], + ]]; + } + return self; +} + +- (void)prepareForReuse { + [super prepareForReuse]; + self.textLabel.text = nil; + self.textLabel.attributedText = nil; +} + +#pragma mark - Properties + +- (void)setText:(NSString*)text + withCustomTextAttributes: + (NSDictionary<NSValue*, NSDictionary*>*)customTextAttributesOnRange { + NSDictionary* textAttributes = @{ + NSFontAttributeName : + [UIFont preferredFontForTextStyle:kTableViewSublabelFontStyle], + NSForegroundColorAttributeName : [UIColor colorNamed:kTextSecondaryColor] + }; + + NSMutableAttributedString* attributedText = + [[NSMutableAttributedString alloc] initWithString:text + attributes:textAttributes]; + + if ([customTextAttributesOnRange count] > 0) { + [customTextAttributesOnRange + enumerateKeysAndObjectsUsingBlock:^(NSValue* range, NSDictionary* attrs, + BOOL* stop) { + [attributedText setAttributes:attrs range:range.rangeValue]; + }]; + } + + self.textLabel.attributedText = attributedText; +} + +@end
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 index e8975ad..6b3b1a7 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -a928b3352c3c2d868644cd1c30da91391726abca \ No newline at end of file +2e271bfcd36d394b46dd4945ce4ce6797bb5d6d5 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 index 3109a4c0..c884808 100644 --- a/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -51b9b86c9c03d353ceb693ae69dee0b8e4011fdf \ No newline at end of file +15e603f0f12d3e8ee27be9545f15c93fabb0d3fa \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 index ea0dfa6..a3b52bf 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -c413587e8d7f78b1f55a07494053c52c411d2a9e \ No newline at end of file +07da3f703ea6fac573f51609154c2c76b3b868d8 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 index 7fc0d70..6cb65e60 100644 --- a/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/chrome_sso_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -0dbb601047e225ce401f375eed4b554f20d54ea4 \ No newline at end of file +e3b4f574bdefebcd430ef2425fdfa336deae0d4f \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 index 002b2e3..a61ed312 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -49d1b7caadcb4276e3711c35bde90b40b1ba005c \ No newline at end of file +c3db6cb58331733f8e097085cc84c4b5593c108a \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 index 6eed437c..1c8f9f31 100644 --- a/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_dogfood_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -6665cafa418309af5f6d23fa0351fa455bdb239c \ No newline at end of file +58d2b63debfe332cd146b071deb3ae6db9e93402 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 index 337002b..c84ac58 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -53560dfa4ef268a030b7b8180df0b0d0b1dd553d \ No newline at end of file +b1ec816da9c46a9182a7fec6cadc224aa85c63dd \ No newline at end of file
diff --git a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 index f578cb32..2736ebd 100644 --- a/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/remoting_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -5f79ab2d377447d49eeca88fb536d0a419eedafd \ No newline at end of file +e2a67e59c66641b3f1979968e349801ab1cbaec0 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 index 3eeba06..86dbdd70 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.ios.zip.sha1
@@ -1 +1 @@ -9aa7bdf6ce7fe643646e62addcf6defd2d92353a \ No newline at end of file +035a80c9b5617fa73f0837d340bf2a4f4e14be11 \ No newline at end of file
diff --git a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 index e31382ef..f34354a 100644 --- a/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1 +++ b/ios/google_internal/frameworks/web_view_shell_internal_dynamic_framework.iossimulator.zip.sha1
@@ -1 +1 @@ -1a1951dc381badf35c21a7b667795a2c6f731b69 \ No newline at end of file +bfd521fce25411e441ad9ca82c313e583abaed8b \ No newline at end of file
diff --git a/media/gpu/test/video_player/video_decoder_client.cc b/media/gpu/test/video_player/video_decoder_client.cc index 89e3c64..cfc6f5c5 100644 --- a/media/gpu/test/video_player/video_decoder_client.cc +++ b/media/gpu/test/video_player/video_decoder_client.cc
@@ -308,9 +308,14 @@ return; } bitstream_buffer->set_timestamp(base::TimeTicks::Now().since_origin()); - bool has_config_info = media::test::EncodedDataHelper::HasConfigInfo( - bitstream_buffer->data(), bitstream_buffer->data_size(), - video_->Profile()); + + bool has_config_info = false; + if (video_->Codec() == media::VideoCodec::kH264 || + video_->Codec() == media::VideoCodec::kHEVC) { + has_config_info = media::test::EncodedDataHelper::HasConfigInfo( + bitstream_buffer->data(), bitstream_buffer->data_size(), + video_->Profile()); + } VideoDecoder::DecodeCB decode_cb = base::BindOnce( CallbackThunk<decltype(&VideoDecoderClient::DecodeDoneTask),
diff --git a/media/gpu/test/video_test_helpers.cc b/media/gpu/test/video_test_helpers.cc index 2cd7e6da..9d578ec 100644 --- a/media/gpu/test/video_test_helpers.cc +++ b/media/gpu/test/video_test_helpers.cc
@@ -355,35 +355,10 @@ return IsH264SPSNALU(data, size); } else if (profile >= HEVCPROFILE_MIN && profile <= HEVCPROFILE_MAX) { return IsHevcSPSNALU(data, size); - } else if (profile >= VP8PROFILE_MIN && profile <= VP8PROFILE_MAX) { - Vp8Parser parser; - Vp8FrameHeader frame_header; - if (!parser.ParseFrame(data, size, &frame_header)) { - // Let the VDA figure out there's something wrong with the stream. - return false; - } - // Stream configuration is present in a keyframe in vp8. - return frame_header.IsKeyframe(); - } else if (profile >= VP9PROFILE_MIN && profile <= VP9PROFILE_MAX) { - Vp9Parser parser(false); - parser.SetStream(data, size, nullptr); - Vp9FrameHeader frame_header; - std::unique_ptr<DecryptConfig> null_config; - gfx::Size allocated_size; - Vp9Parser::Result result = - parser.ParseNextFrame(&frame_header, &allocated_size, &null_config); - if (result != Vp9Parser::kOk) { - // Let the VDA figure out there's something wrong with the stream. - return false; - } - // Stream configuration is present in a keyframe in vp9. - return frame_header.IsKeyframe(); - } else if (profile >= AV1PROFILE_MIN && profile <= AV1PROFILE_MAX) { - // TODO(hiroh): Implement this. - return false; } - // Shouldn't happen at this point. - LOG(FATAL) << "Invalid profile: " << GetProfileName(profile); + + LOG(FATAL) << "HasConfigInfo() should be called only for H264/HEVC stream: " + << GetProfileName(profile); return false; }
diff --git a/mojo/public/java/system/BUILD.gn b/mojo/public/java/system/BUILD.gn index 8eafeae2..daec5ec 100644 --- a/mojo/public/java/system/BUILD.gn +++ b/mojo/public/java/system/BUILD.gn
@@ -159,7 +159,6 @@ instrumentation_test_apk("mojo_test_apk") { apk_name = "MojoTest" android_manifest = "javatests/AndroidManifest.xml" - use_vpython3 = false deps = [ ":mojo_javatests", ":system_impl_java",
diff --git a/services/audio/audio_processor.cc b/services/audio/audio_processor.cc index b4e496e..dbe75ed1 100644 --- a/services/audio/audio_processor.cc +++ b/services/audio/audio_processor.cc
@@ -5,13 +5,37 @@ #include "services/audio/audio_processor.h" #include "base/logging.h" +#include "base/metrics/histogram_functions.h" +#include "base/strings/strcat.h" #include "base/time/time.h" #include "base/trace_event/trace_event.h" +#include "media/audio/audio_device_description.h" #include "media/base/audio_bus.h" #include "services/audio/device_output_listener.h" namespace audio { +class AudioProcessor::UmaLogger { + public: + UmaLogger(const std::string& device_id) + : is_default_(media::AudioDeviceDescription::IsDefaultDevice(device_id)), + start_(base::TimeTicks::Now()) {} + + UmaLogger(const UmaLogger&) = delete; + UmaLogger& operator=(const UmaLogger&) = delete; + + ~UmaLogger() { + base::UmaHistogramLongTimes( + base::StrCat({"Media.Audio.OutputDeviceListener.Duration.", + ((is_default_) ? "Default" : "NonDefault")}), + base::TimeTicks::Now() - start_); + } + + private: + const bool is_default_; + base::TimeTicks start_; +}; + AudioProcessor::AudioProcessor(DeviceOutputListener* device_output_listener) : device_output_listener_(device_output_listener) { DCHECK_CALLED_ON_VALID_SEQUENCE(owning_sequence_); @@ -27,17 +51,23 @@ void AudioProcessor::SetOutputDeviceForAec( const std::string& output_device_id) { DCHECK_CALLED_ON_VALID_SEQUENCE(owning_sequence_); + if (output_device_id_ == output_device_id || + (media::AudioDeviceDescription::IsDefaultDevice(output_device_id_) && + media::AudioDeviceDescription::IsDefaultDevice(output_device_id))) { + return; + } + output_device_id_ = output_device_id; if (active_) - device_output_listener_->StartListening(this, output_device_id_); + StartListening(); } void AudioProcessor::Start() { DCHECK_CALLED_ON_VALID_SEQUENCE(owning_sequence_); DCHECK(!active_); active_ = true; - device_output_listener_->StartListening(this, output_device_id_); + StartListening(); } void AudioProcessor::Stop() { @@ -45,6 +75,7 @@ DCHECK(active_); device_output_listener_->StopListening(this); active_ = false; + uma_logger_.reset(); } void AudioProcessor::OnPlayoutData(const media::AudioBus& audio_bus, @@ -54,4 +85,11 @@ static_cast<void*>(this), "delay", delay.InMillisecondsF()); } +void AudioProcessor::StartListening() { + DCHECK_CALLED_ON_VALID_SEQUENCE(owning_sequence_); + DCHECK(active_); + uma_logger_ = std::make_unique<UmaLogger>(output_device_id_); + device_output_listener_->StartListening(this, output_device_id_); +} + } // namespace audio
diff --git a/services/audio/audio_processor.h b/services/audio/audio_processor.h index 546795f..2823948e 100644 --- a/services/audio/audio_processor.h +++ b/services/audio/audio_processor.h
@@ -30,15 +30,19 @@ void Stop(); private: + class UmaLogger; // Listener void OnPlayoutData(const media::AudioBus& audio_bus, int sample_rate, base::TimeDelta delay) final; + void StartListening(); + SEQUENCE_CHECKER(owning_sequence_); bool active_ = false; std::string output_device_id_; raw_ptr<DeviceOutputListener> const device_output_listener_; + std::unique_ptr<UmaLogger> uma_logger_; }; } // namespace audio
diff --git a/services/network/cors/cors_url_loader.cc b/services/network/cors/cors_url_loader.cc index 75306f3..d68c333 100644 --- a/services/network/cors/cors_url_loader.cc +++ b/services/network/cors/cors_url_loader.cc
@@ -757,7 +757,21 @@ // Even if we ignore the error, record the warning in metrics and DevTools. base::UmaHistogramEnumeration(kPreflightWarningHistogramName, histogram_error); - if (status && devtools_observer_) { + if (devtools_observer_) { + if (!status) { + // Set the resource IP address space to the target IP address space for + // better error messages in DevTools. If the resource address space had + // not matched, the request would likely have failed with + // `CorsError::kInvalidPrivateNetwork`. If the error happened before we + // ever obtained a connection to the remote endpoint, then this value + // is incorrect - we cannot tell what value it would have been. Given + // that this is used for debugging only, the slight incorrectness is + // worth the increased debuggability. + status = CorsErrorStatus(mojom::CorsError::kInvalidResponse, + request_.target_ip_address_space, + request_.target_ip_address_space); + } + ReportCorsErrorToDevTools(*status, /*is_warning=*/true); }
diff --git a/services/network/cors/cors_url_loader_unittest.cc b/services/network/cors/cors_url_loader_unittest.cc index 6f5ffe7..ef08f19 100644 --- a/services/network/cors/cors_url_loader_unittest.cc +++ b/services/network/cors/cors_url_loader_unittest.cc
@@ -3518,6 +3518,7 @@ factory_params.is_trusted = true; ResetFactory(initiator_origin, kRendererProcessId, factory_params); + MockDevToolsObserver devtools_observer; ResourceRequest request; request.method = "GET"; request.mode = mojom::RequestMode::kCors; @@ -3525,8 +3526,14 @@ request.request_initiator = initiator_origin; request.trusted_params = RequestTrustedParamsBuilder() - .WithPrivateNetworkRequestPolicy( - mojom::PrivateNetworkRequestPolicy::kPreflightWarn) + .WithClientSecurityState( + ClientSecurityStateBuilder() + .WithPrivateNetworkRequestPolicy( + mojom::PrivateNetworkRequestPolicy::kPreflightWarn) + .WithIsSecureContext(true) + .WithIPAddressSpace(mojom::IPAddressSpace::kPublic) + .Build()) + .WithDevToolsObserver(devtools_observer.Bind()) .Build(); base::HistogramTester histogram_tester; @@ -3551,6 +3558,22 @@ IsEmpty()); EXPECT_THAT(histogram_tester.GetAllSamples(kPreflightWarningHistogramName), ElementsAre(MakeBucket(mojom::CorsError::kInvalidResponse, 1))); + + devtools_observer.WaitUntilCorsError(); + + const MockDevToolsObserver::OnCorsErrorParams& error_params = + *devtools_observer.cors_error_params(); + EXPECT_EQ(error_params.status, + CorsErrorStatus(mojom::CorsError::kInvalidResponse, + mojom::IPAddressSpace::kPrivate, + mojom::IPAddressSpace::kPrivate)); + EXPECT_TRUE(error_params.is_warning); + ASSERT_TRUE(error_params.client_security_state); + EXPECT_TRUE(error_params.client_security_state->is_web_secure_context); + EXPECT_EQ(error_params.client_security_state->private_network_request_policy, + mojom::PrivateNetworkRequestPolicy::kPreflightWarn); + EXPECT_EQ(error_params.client_security_state->ip_address_space, + mojom::IPAddressSpace::kPublic); } // This test verifies that when:
diff --git a/services/network/public/cpp/ip_address_space_util.cc b/services/network/public/cpp/ip_address_space_util.cc index a7cfbcc1..c504326c 100644 --- a/services/network/public/cpp/ip_address_space_util.cc +++ b/services/network/public/cpp/ip_address_space_util.cc
@@ -14,6 +14,7 @@ #include "base/strings/string_split.h" #include "net/base/ip_address.h" #include "net/base/ip_endpoint.h" +#include "net/base/transport_info.h" #include "services/network/public/cpp/content_security_policy/content_security_policy.h" #include "services/network/public/cpp/network_switches.h" #include "services/network/public/mojom/parsed_headers.mojom.h" @@ -250,8 +251,6 @@ return *kMap; } -} // namespace - IPAddressSpace IPEndPointToIPAddressSpace(const IPEndPoint& endpoint) { if (!endpoint.address().IsValid()) { return IPAddressSpace::kUnknown; @@ -267,6 +266,17 @@ .value_or(IPAddressSpace::kPublic); } +} // namespace + +IPAddressSpace TransportInfoToIPAddressSpace(const net::TransportInfo& info) { + switch (info.type) { + case net::TransportType::kDirect: + return IPEndPointToIPAddressSpace(info.endpoint); + case net::TransportType::kProxied: + return mojom::IPAddressSpace::kUnknown; + } +} + namespace { // For comparison purposes, we treat kUnknown the same as kPublic.
diff --git a/services/network/public/cpp/ip_address_space_util.h b/services/network/public/cpp/ip_address_space_util.h index d0a9236..f16eb95 100644 --- a/services/network/public/cpp/ip_address_space_util.h +++ b/services/network/public/cpp/ip_address_space_util.h
@@ -16,25 +16,33 @@ namespace net { class IPEndPoint; +struct TransportInfo; } // namespace net namespace network { -// Returns the IPAddressSpace to which `endpoint` belongs. +// Returns the `IPAddressSpace` to which the endpoint of `transport` belongs. // -// Returns `kUnknown` for invalid IP addresses. Otherwise, takes into account -// the `--ip-address-space-overrides` command-line switch. +// When the transport is a proxied connection, returns `kUnknown`. See +// https://github.com/WICG/private-network-access/issues/62 for more details on +// the reasoning there. // -// `endpoint`'s port is only used for matching to command-line overrides. It is -// ignored otherwise. In particular, if no overrides are specified on the +// When the transport is a direct connection, returns the IP address space of +// `info.endpoint`. This returns `kUnknown` for invalid IP addresses. Otherwise, +// takes into account the `--ip-address-space-overrides` command-line switch. If +// no override applies, then follows this algorithm: +// https://wicg.github.io/private-network-access/#determine-the-ip-address-space +// +// `info.endpoint`'s port is only used for matching to command-line overrides. +// It is ignored otherwise. In particular, if no overrides are specified on the // command-line, then this function ignores the port entirely. // // WARNING: This can only be used as-is for subresource requests loaded over the // network. Special URL schemes and resource headers must also be taken into // account at higher layers. mojom::IPAddressSpace COMPONENT_EXPORT(NETWORK_CPP) - IPEndPointToIPAddressSpace(const net::IPEndPoint& endpoint); + TransportInfoToIPAddressSpace(const net::TransportInfo& info); // Returns whether `lhs` is less public than `rhs`. //
diff --git a/services/network/public/cpp/ip_address_space_util_unittest.cc b/services/network/public/cpp/ip_address_space_util_unittest.cc index e4fedd25..11b349d 100644 --- a/services/network/public/cpp/ip_address_space_util_unittest.cc +++ b/services/network/public/cpp/ip_address_space_util_unittest.cc
@@ -7,6 +7,7 @@ #include "base/command_line.h" #include "net/base/ip_address.h" #include "net/base/ip_endpoint.h" +#include "net/base/transport_info.h" #include "services/network/public/cpp/network_switches.h" #include "services/network/public/mojom/url_response_head.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -22,6 +23,8 @@ using net::IPAddress; using net::IPAddressBytes; using net::IPEndPoint; +using net::TransportInfo; +using net::TransportType; IPAddress PublicIPv4Address() { return IPAddress(64, 233, 160, 0); @@ -31,6 +34,24 @@ return IPAddress(192, 168, 1, 1); } +TransportInfo DirectTransport(const IPEndPoint& endpoint) { + TransportInfo result; + result.type = TransportType::kDirect; + result.endpoint = endpoint; + return result; +} + +TransportInfo ProxiedTransport(const IPEndPoint& endpoint) { + TransportInfo result; + result.type = TransportType::kProxied; + result.endpoint = endpoint; + return result; +} + +IPAddressSpace IPEndPointToIPAddressSpace(const IPEndPoint& endpoint) { + return TransportInfoToIPAddressSpace(DirectTransport(endpoint)); +} + // Helper for tests that do not care about command-line overrides. IPAddressSpace IPAddressToIPAddressSpace(const IPAddress& address) { return IPEndPointToIPAddressSpace(IPEndPoint(address, 80)); @@ -355,6 +376,22 @@ IPAddressSpace::kPrivate); } +TEST(IPAddressSpaceTest, TransportInfoToIPAddressSpaceProxiedIsUnknown) { + EXPECT_EQ(TransportInfoToIPAddressSpace( + ProxiedTransport(IPEndPoint(IPAddress(1, 2, 3, 4), 80))), + IPAddressSpace::kUnknown); +} + +TEST(IPAddressSpaceTest, TransportInfoToIPAddressSpaceProxiedIgnoresOverrides) { + auto& command_line = *base::CommandLine::ForCurrentProcess(); + command_line.AppendSwitchASCII(switches::kIpAddressSpaceOverrides, + "127.0.0.1:80=public"); + + EXPECT_EQ(TransportInfoToIPAddressSpace( + ProxiedTransport(IPEndPoint(IPAddress(127, 0, 0, 1), 80))), + IPAddressSpace::kUnknown); +} + // Verifies that IPv4-mapped IPv6 addresses are not overridden as though they // were the mapped IPv4 address instead. TEST(IPAddressSpaceTest, IPEndPointToAddressSpaceOverrideIPv4MappedIPv6) {
diff --git a/services/network/public/mojom/cors.mojom b/services/network/public/mojom/cors.mojom index deec40e..8601f4d 100644 --- a/services/network/public/mojom/cors.mojom +++ b/services/network/public/mojom/cors.mojom
@@ -20,6 +20,10 @@ enum CorsError { // Access control kDisallowedByMode, + + // This value is only used in warnings reported to DevTools. It indicates that + // the preflight request failed due to a non-CORS net error (for example, + // `net::ERR_EMPTY_RESPONSE`). kInvalidResponse, // Not allowed wildcard origin was found in Access-Control-Allow-Origin
diff --git a/services/network/url_loader.cc b/services/network/url_loader.cc index 804ecca..e53ff47 100644 --- a/services/network/url_loader.cc +++ b/services/network/url_loader.cc
@@ -1095,14 +1095,16 @@ } PrivateNetworkAccessCheckResult URLLoader::PrivateNetworkAccessCheck( - mojom::IPAddressSpace resource_address_space) const { + const net::TransportInfo& transport_info) { + resource_ip_address_space_ = TransportInfoToIPAddressSpace(transport_info); + const mojom::ClientSecurityState* security_state = GetClientSecurityState(); // Fully-qualify function name to disambiguate it, otherwise it resolves to // `URLLoader::PrivateNetworkAccessCheck()` and fails to compile. PrivateNetworkAccessCheckResult result = network::PrivateNetworkAccessCheck( security_state, target_ip_address_space_, options_, - resource_address_space); + resource_ip_address_space_); bool is_warning = false; switch (result) { @@ -1124,7 +1126,7 @@ if (auto* devtools_observer = GetDevToolsObserver()) { devtools_observer->OnPrivateNetworkRequest( devtools_request_id(), url_request_->url(), is_warning, - resource_address_space, security_state->Clone()); + resource_ip_address_space_, security_state->Clone()); } return result; @@ -1140,18 +1142,15 @@ // Now that the request endpoint's address has been resolved, check if // this request should be blocked per Private Network Access. - mojom::IPAddressSpace resource_address_space = - IPEndPointToIPAddressSpace(info.endpoint); - absl::optional<mojom::CorsError> cors_error = PrivateNetworkAccessCheckResultToCorsError( - PrivateNetworkAccessCheck(resource_address_space)); + PrivateNetworkAccessCheck(info)); if (cors_error.has_value()) { // Remember the CORS error so we can annotate the URLLoaderCompletionStatus // with it later, then fail the request with the same net error code as // other CORS errors. cors_error_status_ = CorsErrorStatus(*cors_error, target_ip_address_space_, - resource_address_space); + resource_ip_address_space_); return net::ERR_FAILED; } @@ -2132,8 +2131,7 @@ emitted_devtools_raw_response_ = true; devtools_observer->OnRawResponse( devtools_request_id().value(), url_request_->maybe_stored_cookies(), - std::move(header_array), raw_response_headers, - IPEndPointToIPAddressSpace(response_info.remote_endpoint), + std::move(header_array), raw_response_headers, resource_ip_address_space_, response_headers->response_code()); return true;
diff --git a/services/network/url_loader.h b/services/network/url_loader.h index 36a02b9..fcc47a2 100644 --- a/services/network/url_loader.h +++ b/services/network/url_loader.h
@@ -425,12 +425,9 @@ // Applies Private Network Access checks to the current request. // - // `resource_address_space` specifies the IP address space of the remote - // endpoint. - // // Helper for `OnConnected()`. PrivateNetworkAccessCheckResult PrivateNetworkAccessCheck( - mojom::IPAddressSpace resource_address_space) const; + const net::TransportInfo& info); mojom::DevToolsObserver* GetDevToolsObserver() const; mojom::CookieAccessObserver* GetCookieAccessObserver() const; @@ -570,6 +567,12 @@ mojom::IPAddressSpace target_ip_address_space_ = mojom::IPAddressSpace::kUnknown; + // The resource's address space, as computed using the |net::TransportInfo| + // argument to the |OnConnected()| callback. This info is only available then, + // so the computation result is stored for later use in this member. + mojom::IPAddressSpace resource_ip_address_space_ = + mojom::IPAddressSpace::kUnknown; + mojo::Remote<mojom::TrustedHeaderClient> header_client_; std::unique_ptr<FileOpenerForUpload> file_opener_for_upload_;
diff --git a/services/network/url_loader_unittest.cc b/services/network/url_loader_unittest.cc index af0e149..9876350 100644 --- a/services/network/url_loader_unittest.cc +++ b/services/network/url_loader_unittest.cc
@@ -1670,6 +1670,9 @@ // The address space of the endpoint serving the request. mojom::IPAddressSpace endpoint_address_space; + // The type of transport to set in `TransportInfo`. + net::TransportType transport_type; + // The expected request result. int expected_result; }; @@ -1679,6 +1682,8 @@ const URLLoaderFakeTransportInfoTestParams& params) { return out << "{ client_address_space: " << params.client_address_space << ", endpoint_address_space: " << params.endpoint_address_space + << ", transport_type: " + << net::TransportTypeToString(params.transport_type) << ", expected_result: " << net::ErrorToString(params.expected_result) << " }"; } @@ -1707,9 +1712,10 @@ } // Returns a transport info with an endpoint in the given IP address space. - static net::TransportInfo FakeTransportInfo(mojom::IPAddressSpace space) { - return net::TransportInfo(net::TransportType::kDirect, FakeEndpoint(space), - ""); + static net::TransportInfo FakeTransportInfo( + const URLLoaderFakeTransportInfoTestParams& params) { + return net::TransportInfo(params.transport_type, + FakeEndpoint(params.endpoint_address_space), ""); } }; @@ -1728,7 +1734,7 @@ net::URLRequestFilter::GetInstance()->AddUrlInterceptor( url, std::make_unique<FakeTransportInfoInterceptor>( - FakeTransportInfo(params.endpoint_address_space))); + FakeTransportInfo(params))); // Despite its name, IsError(OK) asserts that the matched value is OK. EXPECT_THAT(Load(url), IsError(params.expected_result)); @@ -1746,84 +1752,125 @@ { mojom::IPAddressSpace::kUnknown, mojom::IPAddressSpace::kUnknown, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kUnknown, mojom::IPAddressSpace::kPublic, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kUnknown, mojom::IPAddressSpace::kPrivate, + net::TransportType::kDirect, net::ERR_FAILED, }, { mojom::IPAddressSpace::kUnknown, mojom::IPAddressSpace::kLocal, + net::TransportType::kDirect, net::ERR_FAILED, }, // Client: kPublic { mojom::IPAddressSpace::kPublic, mojom::IPAddressSpace::kUnknown, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kPublic, mojom::IPAddressSpace::kPublic, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kPublic, mojom::IPAddressSpace::kPrivate, + net::TransportType::kDirect, net::ERR_FAILED, }, { mojom::IPAddressSpace::kPublic, mojom::IPAddressSpace::kLocal, + net::TransportType::kDirect, net::ERR_FAILED, }, // Client: kPrivate { mojom::IPAddressSpace::kPrivate, mojom::IPAddressSpace::kUnknown, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kPrivate, mojom::IPAddressSpace::kPublic, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kPrivate, mojom::IPAddressSpace::kPrivate, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kPrivate, mojom::IPAddressSpace::kLocal, + net::TransportType::kDirect, net::ERR_FAILED, }, // Client: kLocal { mojom::IPAddressSpace::kLocal, mojom::IPAddressSpace::kUnknown, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kLocal, mojom::IPAddressSpace::kPublic, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kLocal, mojom::IPAddressSpace::kPrivate, + net::TransportType::kDirect, net::OK, }, { mojom::IPAddressSpace::kLocal, mojom::IPAddressSpace::kLocal, + net::TransportType::kDirect, + net::OK, + }, + // TransportType: kProxied + { + mojom::IPAddressSpace::kUnknown, + mojom::IPAddressSpace::kLocal, + net::TransportType::kProxied, + net::OK, + }, + { + mojom::IPAddressSpace::kPublic, + mojom::IPAddressSpace::kLocal, + net::TransportType::kProxied, + net::OK, + }, + { + mojom::IPAddressSpace::kPublic, + mojom::IPAddressSpace::kPrivate, + net::TransportType::kProxied, + net::OK, + }, + { + mojom::IPAddressSpace::kPrivate, + mojom::IPAddressSpace::kLocal, + net::TransportType::kProxied, net::OK, }, };
diff --git a/services/network/websocket.cc b/services/network/websocket.cc index e8f5346ca..4c5d1dc 100644 --- a/services/network/websocket.cc +++ b/services/network/websocket.cc
@@ -12,6 +12,8 @@ #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/check.h" +#include "base/check_op.h" #include "base/feature_list.h" #include "base/ignore_result.h" #include "base/location.h" @@ -274,11 +276,7 @@ if (payload.size() > 0) { impl_->pending_data_frames_.push(payload); } - if (impl_->incoming_frame_interceptor_ && - impl_->incoming_frame_interceptor_->IsFrameStarted()) { - return; - } - impl_->SendPendingDataFrames(); + impl_->SendPendingDataFrames(InterruptionReason::kNone); } void WebSocket::WebSocketEventHandler::OnSendDataFrameDone() { @@ -516,10 +514,8 @@ // Safe if ReadAndSendFromDataPipe() deletes |this| because this method is // only called from mojo. - if (!blocked_on_websocket_channel_ && - (!outgoing_frame_interceptor_ || - !outgoing_frame_interceptor_->IsFrameStarted())) { - ReadAndSendFromDataPipe(); + if (!blocked_on_websocket_channel_) { + ReadAndSendFromDataPipe(InterruptionReason::kNone); } } @@ -653,47 +649,51 @@ OnConnectionError(FROM_HERE); return; } - wait_for_writable_ = false; - SendPendingDataFrames(); - if (pending_data_frames_.empty()) { - ignore_result(channel_->ReadFrames()); - } + SendPendingDataFrames(InterruptionReason::kMojoPipe); } -void WebSocket::SendPendingDataFrames() { +void WebSocket::SendPendingDataFrames(InterruptionReason resume_reason) { DVLOG(3) << "WebSocket::SendPendingDataFrames @" << reinterpret_cast<void*>(this) << ", pending_data_frames_.size=" << pending_data_frames_.size() - << ", wait_for_writable_?" << wait_for_writable_; + << ", incoming_frames_interrupted_=" + << static_cast<int>(incoming_frames_interrupted_); - if (wait_for_writable_) { + if (incoming_frames_interrupted_ != resume_reason) return; + + bool resuming_after_interruption = false; + if (incoming_frames_interrupted_ != InterruptionReason::kNone) { + incoming_frames_interrupted_ = InterruptionReason::kNone; + resuming_after_interruption = true; } while (!pending_data_frames_.empty()) { base::span<const char>& data_frame = pending_data_frames_.front(); if (incoming_frame_interceptor_ && - !incoming_frame_interceptor_->IsFrameStarted()) { - // `Intercept` always intercepts sending data per frame. Once intercepted, - // the intercepteror needs to be notified when the whole frame is sent by - // calling `FinishFrame`. + resume_reason == InterruptionReason::kNone) { + // `Intercept` always intercepts sending data per frame. auto intercept_result = incoming_frame_interceptor_->Intercept( data_frame.size(), base::BindOnce(&WebSocket::SendPendingDataFrames, - base::Unretained(this))); - if (intercept_result == WebSocketInterceptor::kShouldWait) + base::Unretained(this), + InterruptionReason::kInterceptor)); + if (intercept_result == WebSocketInterceptor::kShouldWait) { + DCHECK_EQ(incoming_frames_interrupted_, InterruptionReason::kNone); + incoming_frames_interrupted_ = InterruptionReason::kInterceptor; return; + } } SendDataFrame(&data_frame); if (data_frame.size() > 0) { // Mojo doesn't have any write buffer so far. writable_watcher_.ArmOrNotify(); - wait_for_writable_ = true; + DCHECK_EQ(incoming_frames_interrupted_, InterruptionReason::kNone); + incoming_frames_interrupted_ = InterruptionReason::kMojoPipe; return; } pending_data_frames_.pop(); - if (incoming_frame_interceptor_ && - incoming_frame_interceptor_->IsFrameStarted()) { - incoming_frame_interceptor_->FinishFrame(); - } + } + if (resuming_after_interruption) { + ignore_result(channel_->ReadFrames()); } } @@ -737,43 +737,39 @@ OnConnectionError(FROM_HERE); return; } - wait_for_readable_ = false; - // Safe if ReadAndSendFromDataPipe() deletes |this| because this method is // only called from mojo. - if (!outgoing_frame_interceptor_ || - !outgoing_frame_interceptor_->IsFrameStarted()) { - ReadAndSendFromDataPipe(); - } + ReadAndSendFromDataPipe(InterruptionReason::kMojoPipe); } -void WebSocket::ReadAndSendFromDataPipe() { - if (wait_for_readable_) { +void WebSocket::ReadAndSendFromDataPipe(InterruptionReason resume_reason) { + if (outgoing_frames_interrupted_ != resume_reason) return; - } + + if (outgoing_frames_interrupted_ != InterruptionReason::kNone) + outgoing_frames_interrupted_ = InterruptionReason::kNone; + while (!pending_send_data_frames_.empty()) { DataFrame& data_frame = pending_send_data_frames_.front(); DVLOG(2) << " ConsumePendingDataFrame frame=(" << data_frame.type << ", (data_length = " << data_frame.data_length << "))"; if (outgoing_frame_interceptor_ && - !outgoing_frame_interceptor_->IsFrameStarted()) { - // `Intercept` always intercepts reading data per frame. Once intercepted, - // the intercepteror needs to be notified when the whole frame is read by - // calling `FinishFrame`. + resume_reason == InterruptionReason::kNone) { + // `Intercept` always intercepts reading data per frame. auto intercept_result = outgoing_frame_interceptor_->Intercept( data_frame.data_length, base::BindOnce(&WebSocket::ReadAndSendFromDataPipe, - base::Unretained(this))); - if (intercept_result == WebSocketInterceptor::kShouldWait) + base::Unretained(this), + InterruptionReason::kInterceptor)); + if (intercept_result == WebSocketInterceptor::kShouldWait) { + DCHECK_EQ(outgoing_frames_interrupted_, InterruptionReason::kNone); + outgoing_frames_interrupted_ = InterruptionReason::kInterceptor; return; + } } if (!ReadAndSendFrameFromDataPipe(&data_frame)) { return; } - if (outgoing_frame_interceptor_ && - outgoing_frame_interceptor_->IsFrameStarted()) { - outgoing_frame_interceptor_->FinishFrame(); - } pending_send_data_frames_.pop(); } if (pending_start_closing_handshake_) { @@ -802,7 +798,8 @@ const MojoResult begin_result = readable_->BeginReadData( &buffer, &readable_size, MOJO_READ_DATA_FLAG_NONE); if (begin_result == MOJO_RESULT_SHOULD_WAIT) { - wait_for_readable_ = true; + DCHECK_EQ(outgoing_frames_interrupted_, InterruptionReason::kNone); + outgoing_frames_interrupted_ = InterruptionReason::kMojoPipe; if (!blocked_on_websocket_channel_) { readable_watcher_.ArmOrNotify(); }
diff --git a/services/network/websocket.h b/services/network/websocket.h index c38df7a..d6a7a68 100644 --- a/services/network/websocket.h +++ b/services/network/websocket.h
@@ -170,15 +170,25 @@ void Reset(); + enum class InterruptionReason { + // Not interrupted or not resuming after interruptions (but processing a + // brand new frame) + kNone, + // Interrupted by empty Mojo pipe or resuming afterwards + kMojoPipe, + // Interrupted by the interceptor or resuming afterwards + kInterceptor, + }; + // Datapipe functions to receive. void OnWritable(MojoResult result, const mojo::HandleSignalsState& state); - void SendPendingDataFrames(); + void SendPendingDataFrames(InterruptionReason resume_reason); void SendDataFrame(base::span<const char>* data_span); // Datapipe functions to send. void OnReadable(MojoResult result, const mojo::HandleSignalsState& state); - void ReadAndSendFromDataPipe(); + void ReadAndSendFromDataPipe(InterruptionReason resume_reason); // This helper method only called from ReadAndSendFromDataPipe. // Note that it may indirectly delete |this|. // Returns true if the frame has been sent completely. @@ -218,17 +228,18 @@ bool handshake_succeeded_ = false; const HasRawHeadersAccess has_raw_headers_access_; + InterruptionReason incoming_frames_interrupted_ = InterruptionReason::kNone; + InterruptionReason outgoing_frames_interrupted_ = InterruptionReason::kNone; + // Datapipe fields to receive. mojo::ScopedDataPipeProducerHandle writable_; mojo::SimpleWatcher writable_watcher_; base::queue<base::span<const char>> pending_data_frames_; - bool wait_for_writable_ = false; // Datapipe fields to send. mojo::ScopedDataPipeConsumerHandle readable_; mojo::SimpleWatcher readable_watcher_; base::queue<DataFrame> pending_send_data_frames_; - bool wait_for_readable_ = false; bool blocked_on_websocket_channel_ = false; // True if we should preserve the old behaviour where <=64KB messages were
diff --git a/services/network/websocket_interceptor.cc b/services/network/websocket_interceptor.cc index 3eb2ee4d..a1ca0f0940 100644 --- a/services/network/websocket_interceptor.cc +++ b/services/network/websocket_interceptor.cc
@@ -36,7 +36,6 @@ size_t size, base::OnceClosure retry_callback) { DCHECK(!pending_callback_); - DCHECK(!frame_started_); auto* throttling_interceptor = ThrottlingController::GetInterceptor(net_log_source_id_); @@ -50,18 +49,11 @@ /*is_upload=*/direction_ == kOutgoing, throttle_callback_); if (start_throttle_result == net::ERR_IO_PENDING) { pending_callback_ = std::move(retry_callback); - frame_started_ = true; return kShouldWait; } return kContinue; } -void WebSocketInterceptor::FinishFrame() { - DCHECK(frame_started_); - DCHECK(pending_callback_.is_null()); - frame_started_ = false; -} - void WebSocketInterceptor::ThrottleCallback(int result, int64_t bytes) { if (pending_callback_) std::move(pending_callback_).Run();
diff --git a/services/network/websocket_interceptor.h b/services/network/websocket_interceptor.h index b3fd4c2..9e468bd 100644 --- a/services/network/websocket_interceptor.h +++ b/services/network/websocket_interceptor.h
@@ -46,12 +46,7 @@ // * kShouldWait: frame processing should be paused until `retry_callback` // is invoked. // Calling Intercept again before the callback runs is not allowed. - // Calling Intercept again before calling FinishFrame is also not allowed. InterceptResult Intercept(size_t size, base::OnceClosure retry_callback); - // This is meant to be called when processing of a single frame is done and it - // resets the interceptor state. - void FinishFrame(); - bool IsFrameStarted() { return frame_started_; } private: void ThrottleCallback(int result, int64_t bytes); @@ -62,7 +57,6 @@ const std::unique_ptr<ScopedThrottlingToken> throttling_token_; base::OnceClosure pending_callback_; - bool frame_started_ = false; }; } // namespace network
diff --git a/services/network/websocket_interceptor_unittest.cc b/services/network/websocket_interceptor_unittest.cc index c9030a7..ea38faa9 100644 --- a/services/network/websocket_interceptor_unittest.cc +++ b/services/network/websocket_interceptor_unittest.cc
@@ -85,7 +85,6 @@ EXPECT_CALL(mock_callback_, Callback()).Times(1); task_environment_.FastForwardUntilNoTasksRemain(); - interceptor_->FinishFrame(); EXPECT_EQ(WebSocketInterceptor::kShouldWait, interceptor_->Intercept(42, MakeCallback())); } @@ -98,10 +97,7 @@ EXPECT_EQ(WebSocketInterceptor::kShouldWait, interceptor_->Intercept(42, MakeCallback())); - // EXPECT_CALL(mock_callback_, Callback()).Times(1); - EXPECT_CALL(mock_callback_, Callback()).Times(1).WillOnce([&] { - interceptor_->FinishFrame(); - }); + EXPECT_CALL(mock_callback_, Callback()).Times(1); ThrottlingController::SetConditions(*kThrottlingProfileId, nullptr); interceptor_->Intercept(42, MakeCallback()); } @@ -114,9 +110,7 @@ EXPECT_EQ(WebSocketInterceptor::kShouldWait, interceptor_->Intercept(42, MakeCallback())); - EXPECT_CALL(mock_callback_, Callback()).Times(1).WillOnce([&] { - interceptor_->FinishFrame(); - }); + EXPECT_CALL(mock_callback_, Callback()).Times(1); ThrottlingController::SetConditions( *kThrottlingProfileId, std::make_unique<NetworkConditions>(/*offline=*/false, /*latency=*/0,
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 365ba7b7..bda80d4 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -5306,6 +5306,26 @@ ] } ], + "NoWakeUpsForCanceledTasks": [ + { + "platforms": [ + "android", + "chromeos", + "ios", + "linux", + "mac", + "windows" + ], + "experiments": [ + { + "name": "Enabled", + "enable_features": [ + "NoWakeUpsForCanceledTasks" + ] + } + ] + } + ], "NtpRealboxAnswersInSuggest": [ { "platforms": [ @@ -6493,28 +6513,6 @@ ] } ], - "RTCDisallowPlanBOutsideDeprecationTrial": [ - { - "platforms": [ - "android", - "android_webview", - "chromeos", - "chromeos_lacros", - "ios", - "linux", - "mac", - "windows" - ], - "experiments": [ - { - "name": "Enabled", - "enable_features": [ - "RTCDisallowPlanBOutsideDeprecationTrial" - ] - } - ] - } - ], "RadioThrottleOnWeakSignalAndroid": [ { "platforms": [
diff --git a/third_party/abseil-cpp/README.chromium b/third_party/abseil-cpp/README.chromium index 0b06673..60774f6 100644 --- a/third_party/abseil-cpp/README.chromium +++ b/third_party/abseil-cpp/README.chromium
@@ -4,7 +4,7 @@ License: Apache 2.0 License File: LICENSE Version: 0 -Revision: 3e1983c5c07eb8a43ad030e770cbae023a470a04 +Revision: 9336be04a242237cd41a525bedfcf3be1bb55377 Security Critical: yes Description:
diff --git a/third_party/abseil-cpp/absl/base/config.h b/third_party/abseil-cpp/absl/base/config.h index ae7a5a1..c29b206 100644 --- a/third_party/abseil-cpp/absl/base/config.h +++ b/third_party/abseil-cpp/absl/base/config.h
@@ -788,4 +788,12 @@ #define ABSL_HAVE_CLASS_TEMPLATE_ARGUMENT_DEDUCTION 1 #endif +// `ABSL_INTERNAL_HAS_RTTI` determines whether abseil is being compiled with +// RTTI support. +#ifdef ABSL_INTERNAL_HAS_RTTI +#error ABSL_INTERNAL_HAS_RTTI cannot be directly set +#elif !defined(__GNUC__) || defined(__GXX_RTTI) +#define ABSL_INTERNAL_HAS_RTTI 1 +#endif // !defined(__GNUC__) || defined(__GXX_RTTI) + #endif // ABSL_BASE_CONFIG_H_
diff --git a/third_party/abseil-cpp/absl/container/BUILD.bazel b/third_party/abseil-cpp/absl/container/BUILD.bazel index ea2c98b..728c4be1 100644 --- a/third_party/abseil-cpp/absl/container/BUILD.bazel +++ b/third_party/abseil-cpp/absl/container/BUILD.bazel
@@ -241,6 +241,7 @@ ":hash_function_defaults", ":raw_hash_map", "//absl/algorithm:container", + "//absl/base:core_headers", "//absl/memory", ], ) @@ -310,6 +311,7 @@ ":node_slot_policy", ":raw_hash_map", "//absl/algorithm:container", + "//absl/base:core_headers", "//absl/memory", ], ) @@ -342,6 +344,7 @@ ":node_slot_policy", ":raw_hash_set", "//absl/algorithm:container", + "//absl/base:core_headers", "//absl/memory", ], )
diff --git a/third_party/abseil-cpp/absl/container/BUILD.gn b/third_party/abseil-cpp/absl/container/BUILD.gn index a509720..845b6ec8 100644 --- a/third_party/abseil-cpp/absl/container/BUILD.gn +++ b/third_party/abseil-cpp/absl/container/BUILD.gn
@@ -66,6 +66,7 @@ ":hash_function_defaults", ":raw_hash_map", "//third_party/abseil-cpp/absl/algorithm:container", + "//third_party/abseil-cpp/absl/base:core_headers", "//third_party/abseil-cpp/absl/memory", ] } @@ -90,6 +91,7 @@ ":node_slot_policy", ":raw_hash_map", "//third_party/abseil-cpp/absl/algorithm:container", + "//third_party/abseil-cpp/absl/base:core_headers", "//third_party/abseil-cpp/absl/memory", ] } @@ -102,6 +104,7 @@ ":node_slot_policy", ":raw_hash_set", "//third_party/abseil-cpp/absl/algorithm:container", + "//third_party/abseil-cpp/absl/base:core_headers", "//third_party/abseil-cpp/absl/memory", ] }
diff --git a/third_party/abseil-cpp/absl/container/CMakeLists.txt b/third_party/abseil-cpp/absl/container/CMakeLists.txt index bb718cf8..b819deeb 100644 --- a/third_party/abseil-cpp/absl/container/CMakeLists.txt +++ b/third_party/abseil-cpp/absl/container/CMakeLists.txt
@@ -274,6 +274,7 @@ ${ABSL_DEFAULT_COPTS} DEPS absl::container_memory + absl::core_headers absl::hash_function_defaults absl::raw_hash_map absl::algorithm_container @@ -347,6 +348,7 @@ ${ABSL_DEFAULT_COPTS} DEPS absl::container_memory + absl::core_headers absl::hash_function_defaults absl::node_slot_policy absl::raw_hash_map @@ -381,6 +383,7 @@ COPTS ${ABSL_DEFAULT_COPTS} DEPS + absl::core_headers absl::hash_function_defaults absl::node_slot_policy absl::raw_hash_set
diff --git a/third_party/abseil-cpp/absl/container/btree_benchmark.cc b/third_party/abseil-cpp/absl/container/btree_benchmark.cc index 65b6790b..0ca497c 100644 --- a/third_party/abseil-cpp/absl/container/btree_benchmark.cc +++ b/third_party/abseil-cpp/absl/container/btree_benchmark.cc
@@ -153,9 +153,9 @@ BM_LookupImpl<T>(state, true); } -// Benchmark deletion of values from a container. +// Benchmark erasing values from a container. template <typename T> -void BM_Delete(benchmark::State& state) { +void BM_Erase(benchmark::State& state) { using V = typename remove_pair_const<typename T::value_type>::type; typename KeyOfValue<typename T::key_type, V>::type key_of_value; std::vector<V> values = GenerateValues<V>(kBenchmarkValues); @@ -180,9 +180,9 @@ } } -// Benchmark deletion of multiple values from a container. +// Benchmark erasing multiple values from a container. template <typename T> -void BM_DeleteRange(benchmark::State& state) { +void BM_EraseRange(benchmark::State& state) { using V = typename remove_pair_const<typename T::value_type>::type; typename KeyOfValue<typename T::key_type, V>::type key_of_value; std::vector<V> values = GenerateValues<V>(kBenchmarkValues); @@ -222,6 +222,40 @@ } } +// Predicate that erases every other element. We can't use a lambda because +// C++11 doesn't support generic lambdas. +// TODO(b/207389011): consider adding benchmarks that remove different fractions +// of keys (e.g. 10%, 90%). +struct EraseIfPred { + uint64_t i = 0; + template <typename T> + bool operator()(const T&) { + return ++i % 2; + } +}; + +// Benchmark erasing multiple values from a container with a predicate. +template <typename T> +void BM_EraseIf(benchmark::State& state) { + using V = typename remove_pair_const<typename T::value_type>::type; + std::vector<V> values = GenerateValues<V>(kBenchmarkValues); + + // Removes half of the keys per batch. + const int batch_size = (kBenchmarkValues + 1) / 2; + EraseIfPred pred; + while (state.KeepRunningBatch(batch_size)) { + state.PauseTiming(); + { + T container(values.begin(), values.end()); + state.ResumeTiming(); + erase_if(container, pred); + benchmark::DoNotOptimize(container); + state.PauseTiming(); + } + state.ResumeTiming(); + } +} + // Benchmark steady-state insert (into first half of range) and remove (from // second half of range), treating the container approximately like a queue with // log-time access for all elements. This benchmark does not test the case where @@ -477,14 +511,14 @@ void BM_##type##_##func(benchmark::State& state) { BM_##func<type>(state); } \ BENCHMARK(BM_##type##_##func) -#define MY_BENCHMARK3(type) \ +#define MY_BENCHMARK3_STL(type) \ MY_BENCHMARK4(type, Insert); \ MY_BENCHMARK4(type, InsertSorted); \ MY_BENCHMARK4(type, InsertSmall); \ MY_BENCHMARK4(type, Lookup); \ MY_BENCHMARK4(type, FullLookup); \ - MY_BENCHMARK4(type, Delete); \ - MY_BENCHMARK4(type, DeleteRange); \ + MY_BENCHMARK4(type, Erase); \ + MY_BENCHMARK4(type, EraseRange); \ MY_BENCHMARK4(type, QueueAddRem); \ MY_BENCHMARK4(type, MixedAddRem); \ MY_BENCHMARK4(type, Fifo); \ @@ -492,9 +526,13 @@ MY_BENCHMARK4(type, InsertRangeRandom); \ MY_BENCHMARK4(type, InsertRangeSorted) +#define MY_BENCHMARK3(type) \ + MY_BENCHMARK4(type, EraseIf); \ + MY_BENCHMARK3_STL(type) + #define MY_BENCHMARK2_SUPPORTS_MULTI_ONLY(type) \ - MY_BENCHMARK3(stl_##type); \ - MY_BENCHMARK3(stl_unordered_##type); \ + MY_BENCHMARK3_STL(stl_##type); \ + MY_BENCHMARK3_STL(stl_unordered_##type); \ MY_BENCHMARK3(btree_256_##type) #define MY_BENCHMARK2(type) \ @@ -684,12 +722,12 @@ btree_set<BigTypePtr<SIZE>>; \ using btree_256_map_size##SIZE##copies##SIZE##ptr = \ btree_map<int, BigTypePtr<SIZE>>; \ - MY_BENCHMARK3(stl_set_size##SIZE##copies##SIZE##ptr); \ - MY_BENCHMARK3(stl_unordered_set_size##SIZE##copies##SIZE##ptr); \ + MY_BENCHMARK3_STL(stl_set_size##SIZE##copies##SIZE##ptr); \ + MY_BENCHMARK3_STL(stl_unordered_set_size##SIZE##copies##SIZE##ptr); \ MY_BENCHMARK3(flat_hash_set_size##SIZE##copies##SIZE##ptr); \ MY_BENCHMARK3(btree_256_set_size##SIZE##copies##SIZE##ptr); \ - MY_BENCHMARK3(stl_map_size##SIZE##copies##SIZE##ptr); \ - MY_BENCHMARK3(stl_unordered_map_size##SIZE##copies##SIZE##ptr); \ + MY_BENCHMARK3_STL(stl_map_size##SIZE##copies##SIZE##ptr); \ + MY_BENCHMARK3_STL(stl_unordered_map_size##SIZE##copies##SIZE##ptr); \ MY_BENCHMARK3(flat_hash_map_size##SIZE##copies##SIZE##ptr); \ MY_BENCHMARK3(btree_256_map_size##SIZE##copies##SIZE##ptr)
diff --git a/third_party/abseil-cpp/absl/container/btree_map.h b/third_party/abseil-cpp/absl/container/btree_map.h index 4eafe06..ad484ce0 100644 --- a/third_party/abseil-cpp/absl/container/btree_map.h +++ b/third_party/abseil-cpp/absl/container/btree_map.h
@@ -478,15 +478,11 @@ // absl::erase_if(absl::btree_map<>, Pred) // // Erases all elements that satisfy the predicate pred from the container. +// Returns the number of erased elements. template <typename K, typename V, typename C, typename A, typename Pred> -void erase_if(btree_map<K, V, C, A> &map, Pred pred) { - for (auto it = map.begin(); it != map.end();) { - if (pred(*it)) { - it = map.erase(it); - } else { - ++it; - } - } +typename btree_map<K, V, C, A>::size_type erase_if( + btree_map<K, V, C, A> &map, Pred pred) { + return container_internal::btree_access::erase_if(map, std::move(pred)); } // absl::btree_multimap @@ -809,15 +805,11 @@ // absl::erase_if(absl::btree_multimap<>, Pred) // // Erases all elements that satisfy the predicate pred from the container. +// Returns the number of erased elements. template <typename K, typename V, typename C, typename A, typename Pred> -void erase_if(btree_multimap<K, V, C, A> &map, Pred pred) { - for (auto it = map.begin(); it != map.end();) { - if (pred(*it)) { - it = map.erase(it); - } else { - ++it; - } - } +typename btree_multimap<K, V, C, A>::size_type erase_if( + btree_multimap<K, V, C, A> &map, Pred pred) { + return container_internal::btree_access::erase_if(map, std::move(pred)); } namespace container_internal {
diff --git a/third_party/abseil-cpp/absl/container/btree_set.h b/third_party/abseil-cpp/absl/container/btree_set.h index 8c96e0e..7882683 100644 --- a/third_party/abseil-cpp/absl/container/btree_set.h +++ b/third_party/abseil-cpp/absl/container/btree_set.h
@@ -398,15 +398,11 @@ // absl::erase_if(absl::btree_set<>, Pred) // // Erases all elements that satisfy the predicate pred from the container. +// Returns the number of erased elements. template <typename K, typename C, typename A, typename Pred> -void erase_if(btree_set<K, C, A> &set, Pred pred) { - for (auto it = set.begin(); it != set.end();) { - if (pred(*it)) { - it = set.erase(it); - } else { - ++it; - } - } +typename btree_set<K, C, A>::size_type erase_if(btree_set<K, C, A> &set, + Pred pred) { + return container_internal::btree_access::erase_if(set, std::move(pred)); } // absl::btree_multiset<> @@ -724,15 +720,11 @@ // absl::erase_if(absl::btree_multiset<>, Pred) // // Erases all elements that satisfy the predicate pred from the container. +// Returns the number of erased elements. template <typename K, typename C, typename A, typename Pred> -void erase_if(btree_multiset<K, C, A> &set, Pred pred) { - for (auto it = set.begin(); it != set.end();) { - if (pred(*it)) { - it = set.erase(it); - } else { - ++it; - } - } +typename btree_multiset<K, C, A>::size_type erase_if( + btree_multiset<K, C, A> & set, Pred pred) { + return container_internal::btree_access::erase_if(set, std::move(pred)); } namespace container_internal {
diff --git a/third_party/abseil-cpp/absl/container/btree_test.cc b/third_party/abseil-cpp/absl/container/btree_test.cc index d27cf271..13cb8186 100644 --- a/third_party/abseil-cpp/absl/container/btree_test.cc +++ b/third_party/abseil-cpp/absl/container/btree_test.cc
@@ -2452,23 +2452,28 @@ // Test that erase_if works with all the container types and supports lambdas. { absl::btree_set<int> s = {1, 3, 5, 6, 100}; - erase_if(s, [](int k) { return k > 3; }); + EXPECT_EQ(erase_if(s, [](int k) { return k > 3; }), 3); EXPECT_THAT(s, ElementsAre(1, 3)); } { absl::btree_multiset<int> s = {1, 3, 3, 5, 6, 6, 100}; - erase_if(s, [](int k) { return k <= 3; }); + EXPECT_EQ(erase_if(s, [](int k) { return k <= 3; }), 3); EXPECT_THAT(s, ElementsAre(5, 6, 6, 100)); } { absl::btree_map<int, int> m = {{1, 1}, {3, 3}, {6, 6}, {100, 100}}; - erase_if(m, [](std::pair<const int, int> kv) { return kv.first > 3; }); + EXPECT_EQ( + erase_if(m, [](std::pair<const int, int> kv) { return kv.first > 3; }), + 2); EXPECT_THAT(m, ElementsAre(Pair(1, 1), Pair(3, 3))); } { absl::btree_multimap<int, int> m = {{1, 1}, {3, 3}, {3, 6}, {6, 6}, {6, 7}, {100, 6}}; - erase_if(m, [](std::pair<const int, int> kv) { return kv.second == 6; }); + EXPECT_EQ( + erase_if(m, + [](std::pair<const int, int> kv) { return kv.second == 6; }), + 3); EXPECT_THAT(m, ElementsAre(Pair(1, 1), Pair(3, 3), Pair(6, 7))); } // Test that erasing all elements from a large set works and test support for @@ -2476,15 +2481,29 @@ { absl::btree_set<int> s; for (int i = 0; i < 1000; ++i) s.insert(2 * i); - erase_if(s, IsEven); + EXPECT_EQ(erase_if(s, IsEven), 1000); EXPECT_THAT(s, IsEmpty()); } // Test that erase_if supports other format of function pointers. { absl::btree_set<int> s = {1, 3, 5, 6, 100}; - erase_if(s, &IsEven); + EXPECT_EQ(erase_if(s, &IsEven), 2); EXPECT_THAT(s, ElementsAre(1, 3, 5)); } + // Test that erase_if invokes the predicate once per element. + { + absl::btree_set<int> s; + for (int i = 0; i < 1000; ++i) s.insert(i); + int pred_calls = 0; + EXPECT_EQ(erase_if(s, + [&pred_calls](int k) { + ++pred_calls; + return k % 2; + }), + 500); + EXPECT_THAT(s, SizeIs(500)); + EXPECT_EQ(pred_calls, 1000); + } } TEST(Btree, InsertOrAssign) {
diff --git a/third_party/abseil-cpp/absl/container/flat_hash_map.h b/third_party/abseil-cpp/absl/container/flat_hash_map.h index 74def0d..83c7102 100644 --- a/third_party/abseil-cpp/absl/container/flat_hash_map.h +++ b/third_party/abseil-cpp/absl/container/flat_hash_map.h
@@ -36,6 +36,7 @@ #include <utility> #include "absl/algorithm/container.h" +#include "absl/base/macros.h" #include "absl/container/internal/container_memory.h" #include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export #include "absl/container/internal/raw_hash_map.h" // IWYU pragma: export @@ -541,10 +542,12 @@ // erase_if(flat_hash_map<>, Pred) // // Erases all elements that satisfy the predicate `pred` from the container `c`. +// Returns the number of erased elements. template <typename K, typename V, typename H, typename E, typename A, typename Predicate> -void erase_if(flat_hash_map<K, V, H, E, A>& c, Predicate pred) { - container_internal::EraseIf(pred, &c); +typename flat_hash_map<K, V, H, E, A>::size_type erase_if( + flat_hash_map<K, V, H, E, A>& c, Predicate pred) { + return container_internal::EraseIf(pred, &c); } namespace container_internal {
diff --git a/third_party/abseil-cpp/absl/container/flat_hash_map_test.cc b/third_party/abseil-cpp/absl/container/flat_hash_map_test.cc index 8dda1d3..263951f 100644 --- a/third_party/abseil-cpp/absl/container/flat_hash_map_test.cc +++ b/third_party/abseil-cpp/absl/container/flat_hash_map_test.cc
@@ -236,33 +236,36 @@ // Erase all elements. { flat_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, [](std::pair<const int, int>) { return true; }); + EXPECT_EQ(erase_if(s, [](std::pair<const int, int>) { return true; }), 5); EXPECT_THAT(s, IsEmpty()); } // Erase no elements. { flat_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, [](std::pair<const int, int>) { return false; }); + EXPECT_EQ(erase_if(s, [](std::pair<const int, int>) { return false; }), 0); EXPECT_THAT(s, UnorderedElementsAre(Pair(1, 1), Pair(2, 2), Pair(3, 3), Pair(4, 4), Pair(5, 5))); } // Erase specific elements. { flat_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, - [](std::pair<const int, int> kvp) { return kvp.first % 2 == 1; }); + EXPECT_EQ(erase_if(s, + [](std::pair<const int, int> kvp) { + return kvp.first % 2 == 1; + }), + 3); EXPECT_THAT(s, UnorderedElementsAre(Pair(2, 2), Pair(4, 4))); } // Predicate is function reference. { flat_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, FirstIsEven); + EXPECT_EQ(erase_if(s, FirstIsEven), 2); EXPECT_THAT(s, UnorderedElementsAre(Pair(1, 1), Pair(3, 3), Pair(5, 5))); } // Predicate is function pointer. { flat_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, &FirstIsEven); + EXPECT_EQ(erase_if(s, &FirstIsEven), 2); EXPECT_THAT(s, UnorderedElementsAre(Pair(1, 1), Pair(3, 3), Pair(5, 5))); } }
diff --git a/third_party/abseil-cpp/absl/container/flat_hash_set.h b/third_party/abseil-cpp/absl/container/flat_hash_set.h index 6b89da6..f1c650c 100644 --- a/third_party/abseil-cpp/absl/container/flat_hash_set.h +++ b/third_party/abseil-cpp/absl/container/flat_hash_set.h
@@ -443,9 +443,11 @@ // erase_if(flat_hash_set<>, Pred) // // Erases all elements that satisfy the predicate `pred` from the container `c`. +// Returns the number of erased elements. template <typename T, typename H, typename E, typename A, typename Predicate> -void erase_if(flat_hash_set<T, H, E, A>& c, Predicate pred) { - container_internal::EraseIf(pred, &c); +typename flat_hash_set<T, H, E, A>::size_type erase_if( + flat_hash_set<T, H, E, A>& c, Predicate pred) { + return container_internal::EraseIf(pred, &c); } namespace container_internal {
diff --git a/third_party/abseil-cpp/absl/container/flat_hash_set_test.cc b/third_party/abseil-cpp/absl/container/flat_hash_set_test.cc index 8f6f9944..b6a72a2 100644 --- a/third_party/abseil-cpp/absl/container/flat_hash_set_test.cc +++ b/third_party/abseil-cpp/absl/container/flat_hash_set_test.cc
@@ -143,31 +143,31 @@ // Erase all elements. { flat_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, [](int) { return true; }); + EXPECT_EQ(erase_if(s, [](int) { return true; }), 5); EXPECT_THAT(s, IsEmpty()); } // Erase no elements. { flat_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, [](int) { return false; }); + EXPECT_EQ(erase_if(s, [](int) { return false; }), 0); EXPECT_THAT(s, UnorderedElementsAre(1, 2, 3, 4, 5)); } // Erase specific elements. { flat_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, [](int k) { return k % 2 == 1; }); + EXPECT_EQ(erase_if(s, [](int k) { return k % 2 == 1; }), 3); EXPECT_THAT(s, UnorderedElementsAre(2, 4)); } // Predicate is function reference. { flat_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, IsEven); + EXPECT_EQ(erase_if(s, IsEven), 2); EXPECT_THAT(s, UnorderedElementsAre(1, 3, 5)); } // Predicate is function pointer. { flat_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, &IsEven); + EXPECT_EQ(erase_if(s, &IsEven), 2); EXPECT_THAT(s, UnorderedElementsAre(1, 3, 5)); } }
diff --git a/third_party/abseil-cpp/absl/container/internal/btree.h b/third_party/abseil-cpp/absl/container/internal/btree.h index bf65a03d..29603379 100644 --- a/third_party/abseil-cpp/absl/container/internal/btree.h +++ b/third_party/abseil-cpp/absl/container/internal/btree.h
@@ -830,6 +830,7 @@ template <typename N, typename R, typename P> friend struct btree_iterator; friend class BtreeNodePeer; + friend struct btree_access; }; template <typename Node, typename Reference, typename Pointer> @@ -964,6 +965,7 @@ friend class btree_multiset_container; template <typename TreeType, typename CheckerType> friend class base_checker; + friend struct btree_access; const key_type &key() const { return node->key(position); } slot_type *slot() { return node->slot(position); } @@ -1336,6 +1338,8 @@ allocator_type get_allocator() const { return allocator(); } private: + friend struct btree_access; + // Internal accessor routines. node_type *root() { return root_.template get<2>(); } const node_type *root() const { return root_.template get<2>(); } @@ -2530,6 +2534,48 @@ return count; } +struct btree_access { + template <typename BtreeContainer, typename Pred> + static auto erase_if(BtreeContainer &container, Pred pred) + -> typename BtreeContainer::size_type { + const auto initial_size = container.size(); + auto &tree = container.tree_; + auto *alloc = tree.mutable_allocator(); + for (auto it = container.begin(); it != container.end();) { + if (!pred(*it)) { + ++it; + continue; + } + auto *node = it.node; + if (!node->leaf()) { + // Handle internal nodes normally. + it = container.erase(it); + continue; + } + // If this is a leaf node, then we do all the erases from this node + // at once before doing rebalancing. + + // The current position to transfer slots to. + int to_pos = it.position; + node->value_destroy(it.position, alloc); + while (++it.position < node->finish()) { + if (pred(*it)) { + node->value_destroy(it.position, alloc); + } else { + node->transfer(node->slot(to_pos++), node->slot(it.position), + alloc); + } + } + const int num_deleted = node->finish() - to_pos; + tree.size_ -= num_deleted; + node->set_finish(to_pos); + it.position = to_pos; + it = tree.rebalance_after_delete(it); + } + return initial_size - container.size(); + } +}; + } // namespace container_internal ABSL_NAMESPACE_END } // namespace absl
diff --git a/third_party/abseil-cpp/absl/container/internal/btree_container.h b/third_party/abseil-cpp/absl/container/internal/btree_container.h index a99668c..d28b244 100644 --- a/third_party/abseil-cpp/absl/container/internal/btree_container.h +++ b/third_party/abseil-cpp/absl/container/internal/btree_container.h
@@ -228,6 +228,7 @@ } protected: + friend struct btree_access; Tree tree_; };
diff --git a/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc b/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc index 1a3ca7cc..1d24db5f 100644 --- a/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +++ b/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc
@@ -61,13 +61,10 @@ return *sampler; } -// TODO(bradleybear): The comments at this constructors declaration say that the -// fields are not initialized, but this definition does initialize the fields. -// Something needs to be cleaned up. -HashtablezInfo::HashtablezInfo() { PrepareForSampling(); } +HashtablezInfo::HashtablezInfo() = default; HashtablezInfo::~HashtablezInfo() = default; -void HashtablezInfo::PrepareForSampling() { +void HashtablezInfo::PrepareForSampling(size_t inline_element_size_value) { capacity.store(0, std::memory_order_relaxed); size.store(0, std::memory_order_relaxed); num_erases.store(0, std::memory_order_relaxed); @@ -85,6 +82,7 @@ // instead. depth = absl::GetStackTrace(stack, HashtablezInfo::kMaxStackDepth, /* skip_count= */ 0); + inline_element_size = inline_element_size_value; } static bool ShouldForceSampling() { @@ -110,8 +108,8 @@ HashtablezInfo* SampleSlow(int64_t* next_sample, size_t inline_element_size) { if (ABSL_PREDICT_FALSE(ShouldForceSampling())) { *next_sample = 1; - HashtablezInfo* result = GlobalHashtablezSampler().Register(); - result->inline_element_size = inline_element_size; + HashtablezInfo* result = + GlobalHashtablezSampler().Register(inline_element_size); return result; } @@ -137,9 +135,7 @@ return SampleSlow(next_sample, inline_element_size); } - HashtablezInfo* result = GlobalHashtablezSampler().Register(); - result->inline_element_size = inline_element_size; - return result; + return GlobalHashtablezSampler().Register(inline_element_size); #endif }
diff --git a/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h b/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h index ee4d293e9..6738786c 100644 --- a/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h +++ b/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.h
@@ -67,7 +67,8 @@ // Puts the object into a clean state, fills in the logically `const` members, // blocking for any readers that are currently sampling the object. - void PrepareForSampling() ABSL_EXCLUSIVE_LOCKS_REQUIRED(init_mu); + void PrepareForSampling(size_t inline_element_size_value) + ABSL_EXCLUSIVE_LOCKS_REQUIRED(init_mu); // These fields are mutated by the various Record* APIs and need to be // thread-safe. @@ -84,14 +85,14 @@ // All of the fields below are set by `PrepareForSampling`, they must not be // mutated in `Record*` functions. They are logically `const` in that sense. - // These are guarded by init_mu, but that is not externalized to clients, who - // can only read them during `HashtablezSampler::Iterate` which will hold the - // lock. + // These are guarded by init_mu, but that is not externalized to clients, + // which can read them only during `SampleRecorder::Iterate` which will hold + // the lock. static constexpr int kMaxStackDepth = 64; absl::Time create_time; int32_t depth; void* stack[kMaxStackDepth]; - size_t inline_element_size; + size_t inline_element_size; // How big is the slot? }; inline void RecordRehashSlow(HashtablezInfo* info, size_t total_probe_length) {
diff --git a/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_test.cc b/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_test.cc index 449619a..ac6ed9b 100644 --- a/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_test.cc +++ b/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler_test.cc
@@ -70,7 +70,8 @@ } HashtablezInfo* Register(HashtablezSampler* s, size_t size) { - auto* info = s->Register(); + const size_t test_element_size = 17; + auto* info = s->Register(test_element_size); assert(info != nullptr); info->size.store(size); return info; @@ -81,9 +82,8 @@ const size_t test_element_size = 17; HashtablezInfo info; absl::MutexLock l(&info.init_mu); - info.PrepareForSampling(); + info.PrepareForSampling(test_element_size); - info.inline_element_size = test_element_size; EXPECT_EQ(info.capacity.load(), 0); EXPECT_EQ(info.size.load(), 0); EXPECT_EQ(info.num_erases.load(), 0); @@ -108,7 +108,7 @@ info.max_reserve.store(1, std::memory_order_relaxed); info.create_time = test_start - absl::Hours(20); - info.PrepareForSampling(); + info.PrepareForSampling(test_element_size); EXPECT_EQ(info.capacity.load(), 0); EXPECT_EQ(info.size.load(), 0); EXPECT_EQ(info.num_erases.load(), 0); @@ -126,7 +126,8 @@ TEST(HashtablezInfoTest, RecordStorageChanged) { HashtablezInfo info; absl::MutexLock l(&info.init_mu); - info.PrepareForSampling(); + const size_t test_element_size = 19; + info.PrepareForSampling(test_element_size); RecordStorageChangedSlow(&info, 17, 47); EXPECT_EQ(info.size.load(), 17); EXPECT_EQ(info.capacity.load(), 47); @@ -138,7 +139,8 @@ TEST(HashtablezInfoTest, RecordInsert) { HashtablezInfo info; absl::MutexLock l(&info.init_mu); - info.PrepareForSampling(); + const size_t test_element_size = 23; + info.PrepareForSampling(test_element_size); EXPECT_EQ(info.max_probe_length.load(), 0); RecordInsertSlow(&info, 0x0000FF00, 6 * kProbeLength); EXPECT_EQ(info.max_probe_length.load(), 6); @@ -161,8 +163,7 @@ const size_t test_element_size = 29; HashtablezInfo info; absl::MutexLock l(&info.init_mu); - info.PrepareForSampling(); - info.inline_element_size = test_element_size; + info.PrepareForSampling(test_element_size); EXPECT_EQ(info.num_erases.load(), 0); EXPECT_EQ(info.size.load(), 0); RecordInsertSlow(&info, 0x0000FF00, 6 * kProbeLength); @@ -177,8 +178,7 @@ const size_t test_element_size = 31; HashtablezInfo info; absl::MutexLock l(&info.init_mu); - info.PrepareForSampling(); - info.inline_element_size = test_element_size; + info.PrepareForSampling(test_element_size); RecordInsertSlow(&info, 0x1, 0); RecordInsertSlow(&info, 0x2, kProbeLength); RecordInsertSlow(&info, 0x4, kProbeLength); @@ -203,7 +203,8 @@ TEST(HashtablezInfoTest, RecordReservation) { HashtablezInfo info; absl::MutexLock l(&info.init_mu); - info.PrepareForSampling(); + const size_t test_element_size = 33; + info.PrepareForSampling(test_element_size); RecordReservationSlow(&info, 3); EXPECT_EQ(info.max_reserve.load(), 3); @@ -266,7 +267,8 @@ TEST(HashtablezSamplerTest, Handle) { auto& sampler = GlobalHashtablezSampler(); - HashtablezInfoHandle h(sampler.Register()); + const size_t test_element_size = 39; + HashtablezInfoHandle h(sampler.Register(test_element_size)); auto* info = HashtablezInfoHandlePeer::GetInfo(&h); info->hashes_bitwise_and.store(0x12345678, std::memory_order_relaxed); @@ -338,18 +340,19 @@ ThreadPool pool(10); for (int i = 0; i < 10; ++i) { - pool.Schedule([&sampler, &stop]() { + const size_t elt_size = 10 + i % 2; + pool.Schedule([&sampler, &stop, elt_size]() { std::random_device rd; std::mt19937 gen(rd()); std::vector<HashtablezInfo*> infoz; while (!stop.HasBeenNotified()) { if (infoz.empty()) { - infoz.push_back(sampler.Register()); + infoz.push_back(sampler.Register(elt_size)); } switch (std::uniform_int_distribution<>(0, 2)(gen)) { case 0: { - infoz.push_back(sampler.Register()); + infoz.push_back(sampler.Register(elt_size)); break; } case 1: {
diff --git a/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h b/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h index 12682b3..d4b72ab1 100644 --- a/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h +++ b/third_party/abseil-cpp/absl/container/internal/raw_hash_set.h
@@ -1958,7 +1958,9 @@ // Erases all elements that satisfy the predicate `pred` from the container `c`. template <typename P, typename H, typename E, typename A, typename Predicate> -void EraseIf(Predicate& pred, raw_hash_set<P, H, E, A>* c) { +typename raw_hash_set<P, H, E, A>::size_type EraseIf( + Predicate& pred, raw_hash_set<P, H, E, A>* c) { + const auto initial_size = c->size(); for (auto it = c->begin(), last = c->end(); it != last;) { if (pred(*it)) { c->erase(it++); @@ -1966,6 +1968,7 @@ ++it; } } + return initial_size - c->size(); } namespace hashtable_debug_internal {
diff --git a/third_party/abseil-cpp/absl/container/node_hash_map.h b/third_party/abseil-cpp/absl/container/node_hash_map.h index 302dafa..ca1ed40 100644 --- a/third_party/abseil-cpp/absl/container/node_hash_map.h +++ b/third_party/abseil-cpp/absl/container/node_hash_map.h
@@ -41,6 +41,7 @@ #include <utility> #include "absl/algorithm/container.h" +#include "absl/base/macros.h" #include "absl/container/internal/container_memory.h" #include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export #include "absl/container/internal/node_slot_policy.h" @@ -525,10 +526,12 @@ // erase_if(node_hash_map<>, Pred) // // Erases all elements that satisfy the predicate `pred` from the container `c`. +// Returns the number of erased elements. template <typename K, typename V, typename H, typename E, typename A, typename Predicate> -void erase_if(node_hash_map<K, V, H, E, A>& c, Predicate pred) { - container_internal::EraseIf(pred, &c); +typename node_hash_map<K, V, H, E, A>::size_type erase_if( + node_hash_map<K, V, H, E, A>& c, Predicate pred) { + return container_internal::EraseIf(pred, &c); } namespace container_internal {
diff --git a/third_party/abseil-cpp/absl/container/node_hash_map_test.cc b/third_party/abseil-cpp/absl/container/node_hash_map_test.cc index 8f59a1e4..e941a836 100644 --- a/third_party/abseil-cpp/absl/container/node_hash_map_test.cc +++ b/third_party/abseil-cpp/absl/container/node_hash_map_test.cc
@@ -223,33 +223,36 @@ // Erase all elements. { node_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, [](std::pair<const int, int>) { return true; }); + EXPECT_EQ(erase_if(s, [](std::pair<const int, int>) { return true; }), 5); EXPECT_THAT(s, IsEmpty()); } // Erase no elements. { node_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, [](std::pair<const int, int>) { return false; }); + EXPECT_EQ(erase_if(s, [](std::pair<const int, int>) { return false; }), 0); EXPECT_THAT(s, UnorderedElementsAre(Pair(1, 1), Pair(2, 2), Pair(3, 3), Pair(4, 4), Pair(5, 5))); } // Erase specific elements. { node_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, - [](std::pair<const int, int> kvp) { return kvp.first % 2 == 1; }); + EXPECT_EQ(erase_if(s, + [](std::pair<const int, int> kvp) { + return kvp.first % 2 == 1; + }), + 3); EXPECT_THAT(s, UnorderedElementsAre(Pair(2, 2), Pair(4, 4))); } // Predicate is function reference. { node_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, FirstIsEven); + EXPECT_EQ(erase_if(s, FirstIsEven), 2); EXPECT_THAT(s, UnorderedElementsAre(Pair(1, 1), Pair(3, 3), Pair(5, 5))); } // Predicate is function pointer. { node_hash_map<int, int> s = {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}}; - erase_if(s, &FirstIsEven); + EXPECT_EQ(erase_if(s, &FirstIsEven), 2); EXPECT_THAT(s, UnorderedElementsAre(Pair(1, 1), Pair(3, 3), Pair(5, 5))); } }
diff --git a/third_party/abseil-cpp/absl/container/node_hash_set.h b/third_party/abseil-cpp/absl/container/node_hash_set.h index 4247288..9421e11 100644 --- a/third_party/abseil-cpp/absl/container/node_hash_set.h +++ b/third_party/abseil-cpp/absl/container/node_hash_set.h
@@ -38,6 +38,7 @@ #include <type_traits> #include "absl/algorithm/container.h" +#include "absl/base/macros.h" #include "absl/container/internal/hash_function_defaults.h" // IWYU pragma: export #include "absl/container/internal/node_slot_policy.h" #include "absl/container/internal/raw_hash_set.h" // IWYU pragma: export @@ -433,9 +434,11 @@ // erase_if(node_hash_set<>, Pred) // // Erases all elements that satisfy the predicate `pred` from the container `c`. +// Returns the number of erased elements. template <typename T, typename H, typename E, typename A, typename Predicate> -void erase_if(node_hash_set<T, H, E, A>& c, Predicate pred) { - container_internal::EraseIf(pred, &c); +typename node_hash_set<T, H, E, A>::size_type erase_if( + node_hash_set<T, H, E, A>& c, Predicate pred) { + return container_internal::EraseIf(pred, &c); } namespace container_internal {
diff --git a/third_party/abseil-cpp/absl/container/node_hash_set_test.cc b/third_party/abseil-cpp/absl/container/node_hash_set_test.cc index 7ddad20..98a8dbdd 100644 --- a/third_party/abseil-cpp/absl/container/node_hash_set_test.cc +++ b/third_party/abseil-cpp/absl/container/node_hash_set_test.cc
@@ -108,31 +108,31 @@ // Erase all elements. { node_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, [](int) { return true; }); + EXPECT_EQ(erase_if(s, [](int) { return true; }), 5); EXPECT_THAT(s, IsEmpty()); } // Erase no elements. { node_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, [](int) { return false; }); + EXPECT_EQ(erase_if(s, [](int) { return false; }), 0); EXPECT_THAT(s, UnorderedElementsAre(1, 2, 3, 4, 5)); } // Erase specific elements. { node_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, [](int k) { return k % 2 == 1; }); + EXPECT_EQ(erase_if(s, [](int k) { return k % 2 == 1; }), 3); EXPECT_THAT(s, UnorderedElementsAre(2, 4)); } // Predicate is function reference. { node_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, IsEven); + EXPECT_EQ(erase_if(s, IsEven), 2); EXPECT_THAT(s, UnorderedElementsAre(1, 3, 5)); } // Predicate is function pointer. { node_hash_set<int> s = {1, 2, 3, 4, 5}; - erase_if(s, &IsEven); + EXPECT_EQ(erase_if(s, &IsEven), 2); EXPECT_THAT(s, UnorderedElementsAre(1, 3, 5)); } }
diff --git a/third_party/abseil-cpp/absl/flags/config.h b/third_party/abseil-cpp/absl/flags/config.h index 5ab1f311..14c4235 100644 --- a/third_party/abseil-cpp/absl/flags/config.h +++ b/third_party/abseil-cpp/absl/flags/config.h
@@ -45,14 +45,6 @@ #define ABSL_FLAGS_STRIP_HELP ABSL_FLAGS_STRIP_NAMES #endif -// ABSL_FLAGS_INTERNAL_HAS_RTTI macro is used for selecting if we can use RTTI -// for flag type identification. -#ifdef ABSL_FLAGS_INTERNAL_HAS_RTTI -#error ABSL_FLAGS_INTERNAL_HAS_RTTI cannot be directly set -#elif !defined(__GNUC__) || defined(__GXX_RTTI) -#define ABSL_FLAGS_INTERNAL_HAS_RTTI 1 -#endif // !defined(__GNUC__) || defined(__GXX_RTTI) - // These macros represent the "source of truth" for the list of supported // built-in types. #define ABSL_FLAGS_INTERNAL_BUILTIN_TYPES(A) \
diff --git a/third_party/abseil-cpp/absl/flags/internal/flag.cc b/third_party/abseil-cpp/absl/flags/internal/flag.cc index 1515022..7102559 100644 --- a/third_party/abseil-cpp/absl/flags/internal/flag.cc +++ b/third_party/abseil-cpp/absl/flags/internal/flag.cc
@@ -205,7 +205,7 @@ if (lhs_runtime_type_id == rhs_runtime_type_id) return; -#if defined(ABSL_FLAGS_INTERNAL_HAS_RTTI) +#ifdef ABSL_INTERNAL_HAS_RTTI if (*lhs_runtime_type_id == *rhs_runtime_type_id) return; #endif
diff --git a/third_party/abseil-cpp/absl/flags/internal/flag.h b/third_party/abseil-cpp/absl/flags/internal/flag.h index 124a2f1..2d0a7e9c 100644 --- a/third_party/abseil-cpp/absl/flags/internal/flag.h +++ b/third_party/abseil-cpp/absl/flags/internal/flag.h
@@ -163,7 +163,7 @@ // Returns an address of RTTI's typeid(T). template <typename T> inline const std::type_info* GenRuntimeTypeId() { -#if defined(ABSL_FLAGS_INTERNAL_HAS_RTTI) +#ifdef ABSL_INTERNAL_HAS_RTTI return &typeid(T); #else return nullptr;
diff --git a/third_party/abseil-cpp/absl/functional/function_ref.h b/third_party/abseil-cpp/absl/functional/function_ref.h index 824e3ce..f977960 100644 --- a/third_party/abseil-cpp/absl/functional/function_ref.h +++ b/third_party/abseil-cpp/absl/functional/function_ref.h
@@ -69,7 +69,8 @@ // An `absl::FunctionRef` is a lightweight wrapper to any invokable object with // a compatible signature. Generally, an `absl::FunctionRef` should only be used // as an argument type and should be preferred as an argument over a const -// reference to a `std::function`. +// reference to a `std::function`. `absl::FunctionRef` itself does not allocate, +// although the wrapped invokable may. // // Example: //
diff --git a/third_party/abseil-cpp/absl/functional/function_ref_test.cc b/third_party/abseil-cpp/absl/functional/function_ref_test.cc index 3aa59745..412027c 100644 --- a/third_party/abseil-cpp/absl/functional/function_ref_test.cc +++ b/third_party/abseil-cpp/absl/functional/function_ref_test.cc
@@ -14,6 +14,7 @@ #include "absl/functional/function_ref.h" +#include <functional> #include <memory> #include "gmock/gmock.h"
diff --git a/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h b/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h index 6c14621..fc269bd 100644 --- a/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +++ b/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h
@@ -59,7 +59,8 @@ ~SampleRecorder(); // Registers for sampling. Returns an opaque registration info. - T* Register(); + template <typename... Targs> + T* Register(Targs&&... args); // Unregisters the sample. void Unregister(T* sample); @@ -81,7 +82,8 @@ private: void PushNew(T* sample); void PushDead(T* sample); - T* PopDead(); + template <typename... Targs> + T* PopDead(Targs... args); std::atomic<size_t> dropped_samples_; std::atomic<size_t> size_estimate_; @@ -163,7 +165,8 @@ } template <typename T> -T* SampleRecorder<T>::PopDead() { +template <typename... Targs> +T* SampleRecorder<T>::PopDead(Targs... args) { absl::MutexLock graveyard_lock(&graveyard_.init_mu); // The list is circular, so eventually it collapses down to @@ -175,12 +178,13 @@ absl::MutexLock sample_lock(&sample->init_mu); graveyard_.dead = sample->dead; sample->dead = nullptr; - sample->PrepareForSampling(); + sample->PrepareForSampling(std::forward<Targs>(args)...); return sample; } template <typename T> -T* SampleRecorder<T>::Register() { +template <typename... Targs> +T* SampleRecorder<T>::Register(Targs&&... args) { int64_t size = size_estimate_.fetch_add(1, std::memory_order_relaxed); if (size > max_samples_.load(std::memory_order_relaxed)) { size_estimate_.fetch_sub(1, std::memory_order_relaxed); @@ -188,10 +192,14 @@ return nullptr; } - T* sample = PopDead(); + T* sample = PopDead(args...); if (sample == nullptr) { // Resurrection failed. Hire a new warlock. sample = new T(); + { + absl::MutexLock sample_lock(&sample->init_mu); + sample->PrepareForSampling(std::forward<Targs>(args)...); + } PushNew(sample); }
diff --git a/third_party/abseil-cpp/absl/strings/cord.cc b/third_party/abseil-cpp/absl/strings/cord.cc index 0015bb9..5905bac 100644 --- a/third_party/abseil-cpp/absl/strings/cord.cc +++ b/third_party/abseil-cpp/absl/strings/cord.cc
@@ -468,46 +468,6 @@ return true; } -template <bool has_length> -void Cord::InlineRep::GetAppendRegion(char** region, size_t* size, - size_t length) { - auto constexpr method = CordzUpdateTracker::kGetAppendRegion; - - CordRep* root = tree(); - size_t sz = root ? root->length : inline_size(); - if (root == nullptr) { - size_t available = kMaxInline - sz; - if (available >= (has_length ? length : 1)) { - *region = data_.as_chars() + sz; - *size = has_length ? length : available; - set_inline_size(has_length ? sz + length : kMaxInline); - return; - } - } - - size_t extra = has_length ? length : (std::max)(sz, kMinFlatLength); - CordzUpdateScope scope(root ? data_.cordz_info() : nullptr, method); - CordRep* rep = root ? cord_internal::RemoveCrcNode(root) - : MakeFlatWithExtraCapacity(extra); - if (PrepareAppendRegion(rep, region, size, length)) { - CommitTree(root, rep, scope, method); - return; - } - - // Allocate new node. - CordRepFlat* new_node = CordRepFlat::New(extra); - new_node->length = std::min(new_node->Capacity(), length); - *region = new_node->Data(); - *size = new_node->length; - - if (btree_enabled()) { - rep = CordRepBtree::Append(ForceBtree(rep), new_node); - } else { - rep = Concat(rep, new_node); - } - CommitTree(root, rep, scope, method); -} - // Computes the memory side of the provided edge which must be a valid data edge // for a btrtee, i.e., a FLAT, EXTERNAL or SUBSTRING of a FLAT or EXTERNAL node. static bool RepMemoryUsageDataEdge(const CordRep* rep,
diff --git a/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker.h b/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker.h index 7a41c18..c5170662 100644 --- a/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker.h +++ b/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker.h
@@ -39,8 +39,8 @@ // Tracked update methods. enum MethodIdentifier { kUnknown, - kAppendBuffer, kAppendCord, + kAppendCordBuffer, kAppendExternalMemory, kAppendString, kAssignCord, @@ -50,13 +50,14 @@ kConstructorString, kCordReader, kFlatten, + kGetAppendBuffer, kGetAppendRegion, kMakeCordFromExternal, kMoveAppendCord, kMoveAssignCord, kMovePrependCord, - kPrependBuffer, kPrependCord, + kPrependCordBuffer, kPrependString, kRemovePrefix, kRemoveSuffix,
diff --git a/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker_test.cc b/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker_test.cc index 8eda529..9b1f7986 100644 --- a/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker_test.cc +++ b/third_party/abseil-cpp/absl/strings/internal/cordz_update_tracker_test.cc
@@ -37,8 +37,8 @@ // Returns an array of all methods defined in `MethodIdentifier` Methods AllMethods() { return Methods{Method::kUnknown, - Method::kAppendBuffer, Method::kAppendCord, + Method::kAppendCordBuffer, Method::kAppendExternalMemory, Method::kAppendString, Method::kAssignCord, @@ -48,13 +48,14 @@ Method::kConstructorString, Method::kCordReader, Method::kFlatten, + Method::kGetAppendBuffer, Method::kGetAppendRegion, Method::kMakeCordFromExternal, Method::kMoveAppendCord, Method::kMoveAssignCord, Method::kMovePrependCord, - Method::kPrependBuffer, Method::kPrependCord, + Method::kPrependCordBuffer, Method::kPrependString, Method::kRemovePrefix, Method::kRemoveSuffix,
diff --git a/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h b/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h index 8aadde5..a5b084e6 100644 --- a/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h +++ b/third_party/abseil-cpp/absl/time/internal/cctz/include/cctz/civil_time_detail.h
@@ -84,14 +84,13 @@ return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0); } CONSTEXPR_F int year_index(year_t y, month_t m) noexcept { - return (static_cast<int>((y + (m > 2)) % 400) + 400) % 400; + const int yi = static_cast<int>((y + (m > 2)) % 400); + return yi < 0 ? yi + 400 : yi; } -CONSTEXPR_F int days_per_century(year_t y, month_t m) noexcept { - const int yi = year_index(y, m); +CONSTEXPR_F int days_per_century(int yi) noexcept { return 36524 + (yi == 0 || yi > 300); } -CONSTEXPR_F int days_per_4years(year_t y, month_t m) noexcept { - const int yi = year_index(y, m); +CONSTEXPR_F int days_per_4years(int yi) noexcept { return 1460 + (yi == 0 || yi > 300 || (yi - 1) % 100 < 96); } CONSTEXPR_F int days_per_year(year_t y, month_t m) noexcept { @@ -133,17 +132,22 @@ } } if (d > 365) { + int yi = year_index(ey, m); // Index into Gregorian 400 year cycle. for (;;) { - int n = days_per_century(ey, m); + int n = days_per_century(yi); if (d <= n) break; d -= n; ey += 100; + yi += 100; + if (yi >= 400) yi -= 400; } for (;;) { - int n = days_per_4years(ey, m); + int n = days_per_4years(yi); if (d <= n) break; d -= n; ey += 4; + yi += 4; + if (yi >= 400) yi -= 400; } for (;;) { int n = days_per_year(ey, m);
diff --git a/third_party/abseil-cpp/absl/types/any.h b/third_party/abseil-cpp/absl/types/any.h index fc5a074..204da26 100644 --- a/third_party/abseil-cpp/absl/types/any.h +++ b/third_party/abseil-cpp/absl/types/any.h
@@ -81,18 +81,9 @@ #include <utility> #include "absl/base/internal/fast_type_id.h" -#include "absl/base/macros.h" #include "absl/meta/type_traits.h" #include "absl/types/bad_any_cast.h" -// NOTE: This macro is an implementation detail that is undefined at the bottom -// of the file. It is not intended for expansion directly from user code. -#ifdef ABSL_ANY_DETAIL_HAS_RTTI -#error ABSL_ANY_DETAIL_HAS_RTTI cannot be directly set -#elif !defined(__GNUC__) || defined(__GXX_RTTI) -#define ABSL_ANY_DETAIL_HAS_RTTI 1 -#endif // !defined(__GNUC__) || defined(__GXX_RTTI) - namespace absl { ABSL_NAMESPACE_BEGIN @@ -348,7 +339,7 @@ // returns `false`. bool has_value() const noexcept { return obj_ != nullptr; } -#if ABSL_ANY_DETAIL_HAS_RTTI +#ifdef ABSL_INTERNAL_HAS_RTTI // Returns: typeid(T) if *this has a contained object of type T, otherwise // typeid(void). const std::type_info& type() const noexcept { @@ -358,7 +349,7 @@ return typeid(void); } -#endif // ABSL_ANY_DETAIL_HAS_RTTI +#endif // ABSL_INTERNAL_HAS_RTTI private: // Tagged type-erased abstraction for holding a cloneable object. @@ -367,9 +358,9 @@ virtual ~ObjInterface() = default; virtual std::unique_ptr<ObjInterface> Clone() const = 0; virtual const void* ObjTypeId() const noexcept = 0; -#if ABSL_ANY_DETAIL_HAS_RTTI +#ifdef ABSL_INTERNAL_HAS_RTTI virtual const std::type_info& Type() const noexcept = 0; -#endif // ABSL_ANY_DETAIL_HAS_RTTI +#endif // ABSL_INTERNAL_HAS_RTTI }; // Hold a value of some queryable type, with an ability to Clone it. @@ -386,9 +377,9 @@ const void* ObjTypeId() const noexcept final { return IdForType<T>(); } -#if ABSL_ANY_DETAIL_HAS_RTTI +#ifdef ABSL_INTERNAL_HAS_RTTI const std::type_info& Type() const noexcept final { return typeid(T); } -#endif // ABSL_ANY_DETAIL_HAS_RTTI +#endif // ABSL_INTERNAL_HAS_RTTI T value; }; @@ -521,8 +512,6 @@ ABSL_NAMESPACE_END } // namespace absl -#undef ABSL_ANY_DETAIL_HAS_RTTI - #endif // ABSL_USES_STD_ANY #endif // ABSL_TYPES_ANY_H_
diff --git a/third_party/abseil-cpp/symbols_arm64_dbg.def b/third_party/abseil-cpp/symbols_arm64_dbg.def index e2d9b36..b7dade3 100644 --- a/third_party/abseil-cpp/symbols_arm64_dbg.def +++ b/third_party/abseil-cpp/symbols_arm64_dbg.def
@@ -425,7 +425,9 @@ ??$Pointer@$01D@?$LayoutImpl@V?$tuple@_KPEAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@_K$0A@$00@absl@@U?$integer_sequence@_K$0A@$00$01@5@@internal_layout@container_internal@absl@@QEBAPEAIPEAD@Z ??$Pointer@$0A@$$CBD@?$LayoutImpl@V?$tuple@_KPEAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@_K$S@absl@@U?$integer_sequence@_K$0A@@5@@internal_layout@container_internal@absl@@QEBAPEB_KPEBD@Z ??$Pointer@$0A@D@?$LayoutImpl@V?$tuple@_KPEAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@_K$S@absl@@U?$integer_sequence@_K$0A@@5@@internal_layout@container_internal@absl@@QEBAPEA_KPEAD@Z + ??$PopDead@_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_K@Z ??$Prepend@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@$0A@@Cord@absl@@QEAAX$$QEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z + ??$Register@AEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEA_K@Z ??$STLStringResizeUninitialized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@X@strings_internal@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@_K@Z ??$STLStringResizeUninitializedAmortized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@strings_internal@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@_K@Z ??$Seconds@H$0A@@absl@@YA?AVDuration@0@H@Z @@ -2322,10 +2324,9 @@ ?PiecewiseChunkSize@hash_internal@absl@@YA_KXZ ?PointerToRep@Status@absl@@CA_KPEAUStatusRep@status_internal@2@@Z ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PopDead@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@3@XZ ?Post@PerThreadSem@synchronization_internal@absl@@CAXPEAUThreadIdentity@base_internal@3@@Z ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAXXZ + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@Cord@absl@@QEAAXVstring_view@2@@Z @@ -2376,7 +2377,6 @@ ?Ref@CordRep@cord_internal@absl@@SAPEAU123@PEAU123@@Z ?Ref@Status@absl@@CAX_K@Z ?RefCordRep@CordzInfo@cord_internal@absl@@QEBAPEAUCordRep@23@XZ - ?Register@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@3@XZ ?Register@CycleClockSource@base_internal@absl@@CAXP6A_JXZ@Z ?RegisterAbortHook@raw_logging_internal@absl@@YAXP6AXPEBDH000@Z@Z ?RegisterCondVarTracer@absl@@YAXP6AXPEBDPEBX@Z@Z @@ -3159,8 +3159,8 @@ ?day@?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@detail@cctz@time_internal@absl@@QEBAHXZ ?day@?$civil_time@Usecond_tag@time_internal@absl@@@detail@cctz@time_internal@absl@@QEBAHXZ ?day_difference@impl@detail@cctz@time_internal@absl@@YA_J_JCC0CC@Z - ?days_per_4years@impl@detail@cctz@time_internal@absl@@YAH_JC@Z - ?days_per_century@impl@detail@cctz@time_internal@absl@@YAH_JC@Z + ?days_per_4years@impl@detail@cctz@time_internal@absl@@YAHH@Z + ?days_per_century@impl@detail@cctz@time_internal@absl@@YAHH@Z ?days_per_month@impl@detail@cctz@time_internal@absl@@YAH_JC@Z ?days_per_year@impl@detail@cctz@time_internal@absl@@YAH_JC@Z ?deallocate@?$allocator@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@QEAAXPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@_K@Z
diff --git a/third_party/abseil-cpp/symbols_arm64_rel.def b/third_party/abseil-cpp/symbols_arm64_rel.def index 8eab345..69e1448 100644 --- a/third_party/abseil-cpp/symbols_arm64_rel.def +++ b/third_party/abseil-cpp/symbols_arm64_rel.def
@@ -78,7 +78,9 @@ ??$ParseFloat@$09@strings_internal@absl@@YA?AUParsedFloat@01@PEBD0W4chars_format@1@@Z ??$ParseFloat@$0BA@@strings_internal@absl@@YA?AUParsedFloat@01@PEBD0W4chars_format@1@@Z ??$ParseFormatString@UParsedFormatConsumer@ParsedFormatBase@str_format_internal@absl@@@str_format_internal@absl@@YA_NVstring_view@1@UParsedFormatConsumer@ParsedFormatBase@01@@Z + ??$PopDead@_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_K@Z ??$Prepend@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@$0A@@Cord@absl@@QEAAX$$QEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z + ??$Register@AEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEA_K@Z ??$STLStringResizeUninitializedAmortized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@strings_internal@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@_K@Z ??$SetEdge@$00@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z @@ -603,9 +605,8 @@ ?ParseTime@absl@@YA_NVstring_view@1@0VTimeZone@1@PEAVTime@1@PEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z ?PermissionDeniedError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PopDead@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@3@XZ ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAXXZ + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@CordRepBtree@cord_internal@absl@@SAPEAV123@PEAV123@Vstring_view@3@_K@Z @@ -643,7 +644,6 @@ ?Rebuild@CordRepBtree@cord_internal@absl@@SAPEAV123@PEAV123@@Z ?ReclaimThreadIdentity@synchronization_internal@absl@@YAXPEAX@Z ?RecordInsertSlow@container_internal@absl@@YAXPEAUHashtablezInfo@12@_K1@Z - ?Register@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@3@XZ ?Register@CycleClockSource@base_internal@absl@@CAXP6A_JXZ@Z ?RegisterAbortHook@raw_logging_internal@absl@@YAXP6AXPEBDH000@Z@Z ?RegisterCondVarTracer@absl@@YAXP6AXPEBDPEBX@Z@Z
diff --git a/third_party/abseil-cpp/symbols_x64_dbg.def b/third_party/abseil-cpp/symbols_x64_dbg.def index 818fc56..5c65dda 100644 --- a/third_party/abseil-cpp/symbols_x64_dbg.def +++ b/third_party/abseil-cpp/symbols_x64_dbg.def
@@ -425,7 +425,9 @@ ??$Pointer@$01D@?$LayoutImpl@V?$tuple@_KPEAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@_K$0A@$00@absl@@U?$integer_sequence@_K$0A@$00$01@5@@internal_layout@container_internal@absl@@QEBAPEAIPEAD@Z ??$Pointer@$0A@$$CBD@?$LayoutImpl@V?$tuple@_KPEAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@_K$S@absl@@U?$integer_sequence@_K$0A@@5@@internal_layout@container_internal@absl@@QEBAPEB_KPEBD@Z ??$Pointer@$0A@D@?$LayoutImpl@V?$tuple@_KPEAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@_K$S@absl@@U?$integer_sequence@_K$0A@@5@@internal_layout@container_internal@absl@@QEBAPEA_KPEAD@Z + ??$PopDead@_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_K@Z ??$Prepend@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@$0A@@Cord@absl@@QEAAX$$QEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z + ??$Register@AEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEA_K@Z ??$STLStringResizeUninitialized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@X@strings_internal@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@_K@Z ??$STLStringResizeUninitializedAmortized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@strings_internal@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@_K@Z ??$Seconds@H$0A@@absl@@YA?AVDuration@0@H@Z @@ -2324,10 +2326,9 @@ ?PiecewiseChunkSize@hash_internal@absl@@YA_KXZ ?PointerToRep@Status@absl@@CA_KPEAUStatusRep@status_internal@2@@Z ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PopDead@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@3@XZ ?Post@PerThreadSem@synchronization_internal@absl@@CAXPEAUThreadIdentity@base_internal@3@@Z ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAXXZ + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@Cord@absl@@QEAAXVstring_view@2@@Z @@ -2378,7 +2379,6 @@ ?Ref@CordRep@cord_internal@absl@@SAPEAU123@PEAU123@@Z ?Ref@Status@absl@@CAX_K@Z ?RefCordRep@CordzInfo@cord_internal@absl@@QEBAPEAUCordRep@23@XZ - ?Register@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@3@XZ ?Register@CycleClockSource@base_internal@absl@@CAXP6A_JXZ@Z ?RegisterAbortHook@raw_logging_internal@absl@@YAXP6AXPEBDH000@Z@Z ?RegisterCondVarTracer@absl@@YAXP6AXPEBDPEBX@Z@Z @@ -3159,8 +3159,8 @@ ?day@?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@detail@cctz@time_internal@absl@@QEBAHXZ ?day@?$civil_time@Usecond_tag@time_internal@absl@@@detail@cctz@time_internal@absl@@QEBAHXZ ?day_difference@impl@detail@cctz@time_internal@absl@@YA_J_JCC0CC@Z - ?days_per_4years@impl@detail@cctz@time_internal@absl@@YAH_JC@Z - ?days_per_century@impl@detail@cctz@time_internal@absl@@YAH_JC@Z + ?days_per_4years@impl@detail@cctz@time_internal@absl@@YAHH@Z + ?days_per_century@impl@detail@cctz@time_internal@absl@@YAHH@Z ?days_per_month@impl@detail@cctz@time_internal@absl@@YAH_JC@Z ?days_per_year@impl@detail@cctz@time_internal@absl@@YAH_JC@Z ?deallocate@?$allocator@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@QEAAXPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@_K@Z
diff --git a/third_party/abseil-cpp/symbols_x64_rel.def b/third_party/abseil-cpp/symbols_x64_rel.def index 40a29e3..1eec14a 100644 --- a/third_party/abseil-cpp/symbols_x64_rel.def +++ b/third_party/abseil-cpp/symbols_x64_rel.def
@@ -78,7 +78,9 @@ ??$ParseFloat@$09@strings_internal@absl@@YA?AUParsedFloat@01@PEBD0W4chars_format@1@@Z ??$ParseFloat@$0BA@@strings_internal@absl@@YA?AUParsedFloat@01@PEBD0W4chars_format@1@@Z ??$ParseFormatString@UParsedFormatConsumer@ParsedFormatBase@str_format_internal@absl@@@str_format_internal@absl@@YA_NVstring_view@1@UParsedFormatConsumer@ParsedFormatBase@01@@Z + ??$PopDead@_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_K@Z ??$Prepend@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@$0A@@Cord@absl@@QEAAX$$QEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z + ??$Register@AEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEA_K@Z ??$STLStringResizeUninitializedAmortized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@strings_internal@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@_K@Z ??$SetEdge@$00@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z @@ -604,9 +606,8 @@ ?ParseTime@absl@@YA_NVstring_view@1@0VTimeZone@1@PEAVTime@1@PEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z ?PermissionDeniedError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PopDead@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@3@XZ ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAXXZ + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@CordRepBtree@cord_internal@absl@@SAPEAV123@PEAV123@Vstring_view@3@_K@Z @@ -644,7 +645,6 @@ ?Rebuild@CordRepBtree@cord_internal@absl@@SAPEAV123@PEAV123@@Z ?ReclaimThreadIdentity@synchronization_internal@absl@@YAXPEAX@Z ?RecordInsertSlow@container_internal@absl@@YAXPEAUHashtablezInfo@12@_K1@Z - ?Register@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@3@XZ ?Register@CycleClockSource@base_internal@absl@@CAXP6A_JXZ@Z ?RegisterAbortHook@raw_logging_internal@absl@@YAXP6AXPEBDH000@Z@Z ?RegisterCondVarTracer@absl@@YAXP6AXPEBDPEBX@Z@Z
diff --git a/third_party/abseil-cpp/symbols_x64_rel_asan.def b/third_party/abseil-cpp/symbols_x64_rel_asan.def index 7b9d315..b529a79b 100644 --- a/third_party/abseil-cpp/symbols_x64_rel_asan.def +++ b/third_party/abseil-cpp/symbols_x64_rel_asan.def
@@ -77,7 +77,9 @@ ??$ParseFloat@$09@strings_internal@absl@@YA?AUParsedFloat@01@PEBD0W4chars_format@1@@Z ??$ParseFloat@$0BA@@strings_internal@absl@@YA?AUParsedFloat@01@PEBD0W4chars_format@1@@Z ??$ParseFormatString@UParsedFormatConsumer@ParsedFormatBase@str_format_internal@absl@@@str_format_internal@absl@@YA_NVstring_view@1@UParsedFormatConsumer@ParsedFormatBase@01@@Z + ??$PopDead@_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_K@Z ??$Prepend@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@$0A@@Cord@absl@@QEAAX$$QEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z + ??$Register@AEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEA_K@Z ??$STLStringResizeUninitializedAmortized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@strings_internal@absl@@YAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@_K@Z ??$SetEdge@$00@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z @@ -614,9 +616,8 @@ ?ParseTime@absl@@YA_NVstring_view@1@0VTimeZone@1@PEAVTime@1@PEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z ?PermissionDeniedError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PopDead@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@3@XZ ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAXXZ + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@CordRepBtree@cord_internal@absl@@SAPEAV123@PEAV123@Vstring_view@3@_K@Z @@ -654,7 +655,6 @@ ?Rebuild@CordRepBtree@cord_internal@absl@@SAPEAV123@PEAV123@@Z ?ReclaimThreadIdentity@synchronization_internal@absl@@YAXPEAX@Z ?RecordInsertSlow@container_internal@absl@@YAXPEAUHashtablezInfo@12@_K1@Z - ?Register@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@3@XZ ?Register@CycleClockSource@base_internal@absl@@CAXP6A_JXZ@Z ?RegisterAbortHook@raw_logging_internal@absl@@YAXP6AXPEBDH000@Z@Z ?RegisterCondVarTracer@absl@@YAXP6AXPEBDPEBX@Z@Z
diff --git a/third_party/abseil-cpp/symbols_x86_dbg.def b/third_party/abseil-cpp/symbols_x86_dbg.def index 8ef3437..4b47ddfd 100644 --- a/third_party/abseil-cpp/symbols_x86_dbg.def +++ b/third_party/abseil-cpp/symbols_x86_dbg.def
@@ -423,7 +423,9 @@ ??$Pointer@$01D@?$LayoutImpl@V?$tuple@IPAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@I$0A@$00@absl@@U?$integer_sequence@I$0A@$00$01@5@@internal_layout@container_internal@absl@@QBEPAIPAD@Z ??$Pointer@$0A@$$CBD@?$LayoutImpl@V?$tuple@IPAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@I$S@absl@@U?$integer_sequence@I$0A@@5@@internal_layout@container_internal@absl@@QBEPBIPBD@Z ??$Pointer@$0A@D@?$LayoutImpl@V?$tuple@IPAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@I$S@absl@@U?$integer_sequence@I$0A@@5@@internal_layout@container_internal@absl@@QBEPAIPAD@Z + ??$PopDead@I@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AAEPAUHashtablezInfo@container_internal@2@I@Z ??$Prepend@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@$0A@@Cord@absl@@QAEX$$QAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z + ??$Register@AAI@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QAEPAUHashtablezInfo@container_internal@2@AAI@Z ??$STLStringResizeUninitialized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@X@strings_internal@absl@@YAXPAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@I@Z ??$STLStringResizeUninitializedAmortized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@strings_internal@absl@@YAXPAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@I@Z ??$Seconds@H$0A@@absl@@YA?AVDuration@0@H@Z @@ -2318,10 +2320,9 @@ ?PiecewiseChunkSize@hash_internal@absl@@YAIXZ ?PointerToRep@Status@absl@@CAIPAUStatusRep@status_internal@2@@Z ?Poke@Waiter@synchronization_internal@absl@@QAEXXZ - ?PopDead@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AAEPAUHashtablezInfo@container_internal@3@XZ ?Post@PerThreadSem@synchronization_internal@absl@@CAXPAUThreadIdentity@base_internal@3@@Z ?Post@Waiter@synchronization_internal@absl@@QAEXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QAEXXZ + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QAEXI@Z ?PrepareToModify@Status@absl@@AAEXXZ ?Prepend@Cord@absl@@QAEXABV12@@Z ?Prepend@Cord@absl@@QAEXVstring_view@2@@Z @@ -2372,7 +2373,6 @@ ?Ref@CordRep@cord_internal@absl@@SAPAU123@PAU123@@Z ?Ref@Status@absl@@CAXI@Z ?RefCordRep@CordzInfo@cord_internal@absl@@QBEPAUCordRep@23@XZ - ?Register@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QAEPAUHashtablezInfo@container_internal@3@XZ ?Register@CycleClockSource@base_internal@absl@@CAXP6A_JXZ@Z ?RegisterAbortHook@raw_logging_internal@absl@@YAXP6AXPBDH000@Z@Z ?RegisterCondVarTracer@absl@@YAXP6AXPBDPBX@Z@Z @@ -3153,8 +3153,8 @@ ?day@?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@detail@cctz@time_internal@absl@@QBEHXZ ?day@?$civil_time@Usecond_tag@time_internal@absl@@@detail@cctz@time_internal@absl@@QBEHXZ ?day_difference@impl@detail@cctz@time_internal@absl@@YA_J_JCC0CC@Z - ?days_per_4years@impl@detail@cctz@time_internal@absl@@YAH_JC@Z - ?days_per_century@impl@detail@cctz@time_internal@absl@@YAH_JC@Z + ?days_per_4years@impl@detail@cctz@time_internal@absl@@YAHH@Z + ?days_per_century@impl@detail@cctz@time_internal@absl@@YAHH@Z ?days_per_month@impl@detail@cctz@time_internal@absl@@YAH_JC@Z ?days_per_year@impl@detail@cctz@time_internal@absl@@YAH_JC@Z ?deallocate@?$allocator@PAPBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@QAEXPAPAPBVImpl@time_zone@cctz@time_internal@absl@@I@Z
diff --git a/third_party/abseil-cpp/symbols_x86_rel.def b/third_party/abseil-cpp/symbols_x86_rel.def index b2ed127..8918644 100644 --- a/third_party/abseil-cpp/symbols_x86_rel.def +++ b/third_party/abseil-cpp/symbols_x86_rel.def
@@ -78,7 +78,9 @@ ??$ParseFloat@$09@strings_internal@absl@@YA?AUParsedFloat@01@PBD0W4chars_format@1@@Z ??$ParseFloat@$0BA@@strings_internal@absl@@YA?AUParsedFloat@01@PBD0W4chars_format@1@@Z ??$ParseFormatString@UParsedFormatConsumer@ParsedFormatBase@str_format_internal@absl@@@str_format_internal@absl@@YA_NVstring_view@1@UParsedFormatConsumer@ParsedFormatBase@01@@Z + ??$PopDead@I@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AAEPAUHashtablezInfo@container_internal@2@I@Z ??$Prepend@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@$0A@@Cord@absl@@QAEX$$QAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z + ??$Register@AAI@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QAEPAUHashtablezInfo@container_internal@2@AAI@Z ??$STLStringResizeUninitializedAmortized@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@strings_internal@absl@@YAXPAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@I@Z ??$SetEdge@$00@CordRepBtree@cord_internal@absl@@QAE?AUOpResult@012@_NPAUCordRep@12@I@Z ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QAE?AUOpResult@012@_NPAUCordRep@12@I@Z @@ -605,9 +607,8 @@ ?ParseTime@absl@@YA_NVstring_view@1@0VTimeZone@1@PAVTime@1@PAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z ?PermissionDeniedError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?Poke@Waiter@synchronization_internal@absl@@QAEXXZ - ?PopDead@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AAEPAUHashtablezInfo@container_internal@3@XZ ?Post@Waiter@synchronization_internal@absl@@QAEXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QAEXXZ + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QAEXI@Z ?PrepareToModify@Status@absl@@AAEXXZ ?Prepend@Cord@absl@@QAEXABV12@@Z ?Prepend@CordRepBtree@cord_internal@absl@@SAPAV123@PAV123@Vstring_view@3@I@Z @@ -645,7 +646,6 @@ ?Rebuild@CordRepBtree@cord_internal@absl@@SAPAV123@PAV123@@Z ?ReclaimThreadIdentity@synchronization_internal@absl@@YAXPAX@Z ?RecordInsertSlow@container_internal@absl@@YAXPAUHashtablezInfo@12@II@Z - ?Register@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QAEPAUHashtablezInfo@container_internal@3@XZ ?Register@CycleClockSource@base_internal@absl@@CAXP6A_JXZ@Z ?RegisterAbortHook@raw_logging_internal@absl@@YAXP6AXPBDH000@Z@Z ?RegisterCondVarTracer@absl@@YAXP6AXPBDPBX@Z@Z
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc index 1de818cd..220e0c53 100644 --- a/third_party/blink/common/features.cc +++ b/third_party/blink/common/features.cc
@@ -276,7 +276,7 @@ // with {sdpSemantics:"plan-b"} and the Deprecation Trial is not enabled. const base::Feature kRTCDisallowPlanBOutsideDeprecationTrial{ "RTCDisallowPlanBOutsideDeprecationTrial", - base::FEATURE_DISABLED_BY_DEFAULT}; + base::FEATURE_ENABLED_BY_DEFAULT}; // Determines if the SDP attrbute extmap-allow-mixed should be offered by // default or not. The default value can be overridden by passing
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 46894e84..391f6b2a 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -3398,6 +3398,8 @@ kCrossOriginOpenerPolicySameOriginAllowPopupsReportOnly = 4089, kCrossOriginOpenerPolicySameOriginReportOnly = 4090, kImageLoadAtDismissalEvent = 4091, + kPrivateNetworkAccessIgnoredPreflightError = 4092, + // 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/renderer/bindings/generated_in_modules.gni b/third_party/blink/renderer/bindings/generated_in_modules.gni index 01fde62f..3cecbe2 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules.gni
@@ -1731,12 +1731,8 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_bind_group_layout.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_usage.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_usage.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_canvas_context.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_canvas_context.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_write.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_write.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_command_buffer.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_command_buffer.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_command_encoder.cc", @@ -1755,8 +1751,6 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_device_lost_info.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_external_texture.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_external_texture.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_map_mode.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_map_mode.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_out_of_memory_error.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_out_of_memory_error.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_pipeline_layout.cc", @@ -1777,16 +1771,12 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_sampler.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_module.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_stage.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_stage.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_supported_features.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_supported_features.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_supported_limits.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_supported_limits.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture.h", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_usage.cc", - "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_usage.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_view.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_view.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_uncaptured_error_event.cc", @@ -2497,7 +2487,18 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_xr_webgl_layer.h", ] -generated_namespace_sources_in_modules = [] +generated_namespace_sources_in_modules = [ + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_usage.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_usage.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_write.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_write.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_map_mode.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_map_mode.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_stage.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_stage.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_usage.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_usage.h", +] generated_observable_array_sources_in_modules = []
diff --git a/third_party/blink/renderer/core/dom/events/event.h b/third_party/blink/renderer/core/dom/events/event.h index 102e5e8..4a6562c 100644 --- a/third_party/blink/renderer/core/dom/events/event.h +++ b/third_party/blink/renderer/core/dom/events/event.h
@@ -28,7 +28,7 @@ #include "base/time/time.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/dom/events/event_dispatch_result.h" -#include "third_party/blink/renderer/core/probe/async_task_id.h" +#include "third_party/blink/renderer/core/probe/async_task_context.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -308,7 +308,7 @@ virtual DispatchEventResult DispatchEvent(EventDispatcher&); - probe::AsyncTaskId* async_task_id() { return &async_task_id_; } + probe::AsyncTaskContext* async_task_context() { return &async_task_context_; } void Trace(Visitor*) const override; @@ -353,7 +353,7 @@ PassiveMode handling_passive_; uint8_t event_phase_; - probe::AsyncTaskId async_task_id_; + probe::AsyncTaskContext async_task_context_; Member<EventTarget> current_target_; Member<EventTarget> target_;
diff --git a/third_party/blink/renderer/core/dom/events/event_listener.h b/third_party/blink/renderer/core/dom/events/event_listener.h index b2dfc21f..9add232 100644 --- a/third_party/blink/renderer/core/dom/events/event_listener.h +++ b/third_party/blink/renderer/core/dom/events/event_listener.h
@@ -22,7 +22,7 @@ #define THIRD_PARTY_BLINK_RENDERER_CORE_DOM_EVENTS_EVENT_LISTENER_H_ #include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/core/probe/async_task_id.h" +#include "third_party/blink/renderer/core/probe/async_task_context.h" #include "third_party/blink/renderer/platform/bindings/name_client.h" #include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" @@ -85,11 +85,11 @@ virtual bool IsJSBasedEventListener() const { return false; } virtual bool IsNativeEventListener() const { return false; } - probe::AsyncTaskId* async_task_id() { return &async_task_id_; } + probe::AsyncTaskContext* async_task_context() { return &async_task_context_; } private: EventListener() = default; - probe::AsyncTaskId async_task_id_; + probe::AsyncTaskContext async_task_context_; // Only these two classes are direct subclasses of EventListener. Other // subclasses must inherit from either of them.
diff --git a/third_party/blink/renderer/core/dom/events/event_queue.cc b/third_party/blink/renderer/core/dom/events/event_queue.cc index f3cced5..cf2e1006 100644 --- a/third_party/blink/renderer/core/dom/events/event_queue.cc +++ b/third_party/blink/renderer/core/dom/events/event_queue.cc
@@ -56,8 +56,7 @@ DCHECK(event.target()); DCHECK(GetExecutionContext()); - probe::AsyncTaskScheduled(GetExecutionContext(), event.type(), - event.async_task_id()); + event.async_task_context()->Schedule(GetExecutionContext(), event.type()); bool was_added = queued_events_.insert(&event).is_new_entry; DCHECK(was_added); // It should not have already been in the list. @@ -96,7 +95,8 @@ DCHECK(GetExecutionContext()); - probe::AsyncTask async_task(GetExecutionContext(), event->async_task_id()); + probe::AsyncTask async_task(GetExecutionContext(), + event->async_task_context()); EventTarget* target = event->target(); if (LocalDOMWindow* window = target->ToLocalDOMWindow()) window->DispatchEvent(*event, nullptr); @@ -115,7 +115,7 @@ void EventQueue::DoCancelAllEvents(ExecutionContext* context) { for (const auto& queued_event : queued_events_) - probe::AsyncTaskCanceled(context, queued_event->async_task_id()); + queued_event->async_task_context()->Cancel(); queued_events_.clear(); }
diff --git a/third_party/blink/renderer/core/dom/events/event_target.cc b/third_party/blink/renderer/core/dom/events/event_target.cc index fcd1f5d..ab104b0 100644 --- a/third_party/blink/renderer/core/dom/events/event_target.cc +++ b/third_party/blink/renderer/core/dom/events/event_target.cc
@@ -504,8 +504,8 @@ AddedEventListener(event_type, registered_listener); if (IsA<JSBasedEventListener>(listener) && IsInstrumentedForAsyncStack(event_type)) { - probe::AsyncTaskScheduled(GetExecutionContext(), event_type, - listener->async_task_id()); + listener->async_task_context()->Schedule(GetExecutionContext(), + event_type); } } return added; @@ -660,8 +660,8 @@ if (registered_listener) { if (IsA<JSBasedEventListener>(listener) && IsInstrumentedForAsyncStack(event_type)) { - probe::AsyncTaskScheduled(GetExecutionContext(), event_type, - listener->async_task_id()); + listener->async_task_context()->Schedule(GetExecutionContext(), + event_type); } registered_listener->SetCallback(listener); return true; @@ -888,7 +888,8 @@ event.SetHandlingPassive(EventPassiveMode(registered_listener)); probe::UserCallback probe(context, nullptr, event.type(), false, this); - probe::AsyncTask async_task(context, listener->async_task_id(), "event", + probe::AsyncTask async_task(context, listener->async_task_context(), + "event", IsInstrumentedForAsyncStack(event.type())); // To match Mozilla, the AT_TARGET phase fires both capturing and bubbling @@ -961,7 +962,7 @@ ExecutionContext* context = GetExecutionContext(); if (!context) return; - probe::AsyncTaskScheduled(context, event.type(), event.async_task_id()); + event.async_task_context()->Schedule(context, event.type()); context->GetTaskRunner(task_type)->PostTask( FROM_HERE, WTF::Bind(&EventTarget::DispatchEnqueuedEvent, WrapPersistent(this), @@ -971,10 +972,10 @@ void EventTarget::DispatchEnqueuedEvent(Event* event, ExecutionContext* context) { if (!GetExecutionContext()) { - probe::AsyncTaskCanceled(context, event->async_task_id()); + event->async_task_context()->Cancel(); return; } - probe::AsyncTask async_task(context, event->async_task_id()); + probe::AsyncTask async_task(context, event->async_task_context()); DispatchEvent(*event); }
diff --git a/third_party/blink/renderer/core/dom/scripted_animation_controller.cc b/third_party/blink/renderer/core/dom/scripted_animation_controller.cc index 45a2bea..47911a89 100644 --- a/third_party/blink/renderer/core/dom/scripted_animation_controller.cc +++ b/third_party/blink/renderer/core/dom/scripted_animation_controller.cc
@@ -142,7 +142,7 @@ // FIXME: We should not fire events for nodes that are no longer in the // tree. probe::AsyncTask async_task(event_target->GetExecutionContext(), - event->async_task_id()); + event->async_task_context()); if (LocalDOMWindow* window = event_target->ToLocalDOMWindow()) window->DispatchEvent(*event, nullptr); else @@ -273,8 +273,8 @@ } void ScriptedAnimationController::EnqueueEvent(Event* event) { - probe::AsyncTaskScheduled(event->target()->GetExecutionContext(), - event->type(), event->async_task_id()); + event->async_task_context()->Schedule(event->target()->GetExecutionContext(), + event->type()); event_queue_.push_back(event); ScheduleAnimationIfNeeded(); }
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 908d17b94..1c487b3 100644 --- a/third_party/blink/renderer/core/frame/local_dom_window.cc +++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
@@ -1084,7 +1084,7 @@ WrapPersistent(event), std::move(posted_message->target_origin), std::move(location), source->GetAgent()->cluster_id())); - probe::AsyncTaskScheduled(this, "postMessage", event->async_task_id()); + event->async_task_context()->Schedule(this, "postMessage"); } void LocalDOMWindow::DispatchPostMessage( @@ -1094,8 +1094,8 @@ const base::UnguessableToken& source_agent_cluster_id) { // Do not report postMessage tasks to the ad tracker. This allows non-ad // script to perform operations in response to events created by ad frames. - probe::AsyncTask async_task(this, event->async_task_id(), nullptr /* step */, - true /* enabled */, + probe::AsyncTask async_task(this, event->async_task_context(), + nullptr /* step */, true /* enabled */, probe::AsyncTask::AdTrackingType::kIgnore); if (!IsCurrentlyDisplayedInFrame()) return;
diff --git a/third_party/blink/renderer/core/loader/frame_loader.cc b/third_party/blink/renderer/core/loader/frame_loader.cc index 764d5cf..543d430 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.cc +++ b/third_party/blink/renderer/core/loader/frame_loader.cc
@@ -475,35 +475,6 @@ TakeObjectSnapshot(); } -WebFrameLoadType FrameLoader::HandleInitialEmptyDocumentReplacementIfNeeded( - const KURL& url, - WebFrameLoadType frame_load_type) { - // Converts navigations from the initial empty document to do replacement if - // needed. Note that we don't convert reloads or history navigations (so only - // kStandard navigations can get converted to do replacement). - if (frame_load_type != WebFrameLoadType::kStandard) - return frame_load_type; - - if (frame_->Tree().Parent() && IsOnInitialEmptyDocument()) { - // Subframe navigations from the initial empty document should always do - // replacement. - return WebFrameLoadType::kReplaceCurrentItem; - } - - if (!frame_->Tree().Parent() && !Client()->BackForwardLength()) { - // For main frames, currently only empty-URL navigations will be converted - // to do replacement. Note that this will cause the navigation to be - // ignored in the browser side, so no NavigationEntry will be added. - // TODO(https://crbug.com/1215096): Make the main frame case follow the - // behavior of subframes (always replace when navigating from the initial - // empty document). - if (Opener() && url.IsEmpty()) - return WebFrameLoadType::kReplaceCurrentItem; - } - - return frame_load_type; -} - bool FrameLoader::AllowRequestForThisFrame(const FrameLoadRequest& request) { // If no origin Document* was specified, skip remaining security checks and // assume the caller has fully initialized the FrameLoadRequest. @@ -661,8 +632,13 @@ mojom::blink::WebFeature::kFileSystemUrlNavigation); } - frame_load_type = HandleInitialEmptyDocumentReplacementIfNeeded( - resource_request.Url(), frame_load_type); + // Convert navigations from the initial empty document to do replacement if + // needed. Note that we don't convert reloads or history navigations (so only + // kStandard navigations can get converted to do replacement). + if (frame_load_type == WebFrameLoadType::kStandard && + IsOnInitialEmptyDocument()) { + frame_load_type = WebFrameLoadType::kReplaceCurrentItem; + } bool same_document_navigation = request.GetNavigationPolicy() == kNavigationPolicyCurrentTab &&
diff --git a/third_party/blink/renderer/core/loader/frame_loader.h b/third_party/blink/renderer/core/loader/frame_loader.h index 9a093bd2..786e5233 100644 --- a/third_party/blink/renderer/core/loader/frame_loader.h +++ b/third_party/blink/renderer/core/loader/frame_loader.h
@@ -259,9 +259,6 @@ private: bool AllowRequestForThisFrame(const FrameLoadRequest&); - WebFrameLoadType HandleInitialEmptyDocumentReplacementIfNeeded( - const KURL& url, - WebFrameLoadType); bool ShouldPerformFragmentNavigation(bool is_form_submission, const String& http_method,
diff --git a/third_party/blink/renderer/core/probe/async_task_context.h b/third_party/blink/renderer/core/probe/async_task_context.h index 7abcb92..e9eaed2 100644 --- a/third_party/blink/renderer/core/probe/async_task_context.h +++ b/third_party/blink/renderer/core/probe/async_task_context.h
@@ -44,7 +44,7 @@ friend class AsyncTask; AsyncTaskId async_task_id_; - v8::Isolate* isolate_; + v8::Isolate* isolate_ = nullptr; }; } // namespace probe
diff --git a/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.cc b/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.cc index e833bf58..f4f354e3 100644 --- a/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.cc +++ b/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.cc
@@ -20,6 +20,7 @@ #include "third_party/blink/renderer/core/fetch/request.h" #include "third_party/blink/renderer/core/frame/csp/content_security_policy.h" #include "third_party/blink/renderer/core/frame/deprecation.h" +#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/modules/background_fetch/background_fetch_bridge.h" #include "third_party/blink/renderer/modules/background_fetch/background_fetch_icon_loader.h" #include "third_party/blink/renderer/modules/background_fetch/background_fetch_registration.h" @@ -167,6 +168,14 @@ return ScriptPromise(); } + LocalDOMWindow* const window = LocalDOMWindow::From(script_state); + if (window && window->GetFrame()->IsInFencedFrameTree()) { + exception_state.ThrowDOMException( + DOMExceptionCode::kNotAllowedError, + "backgroundFetch is not allowed in a fenced frame tree."); + return ScriptPromise(); + } + bool has_requests_with_body; Vector<mojom::blink::FetchAPIRequestPtr> fetch_api_requests = CreateFetchAPIRequestVector(script_state, requests, exception_state, @@ -359,6 +368,14 @@ if (!registration_->active()) return ScriptPromise::CastUndefined(script_state); + LocalDOMWindow* const window = LocalDOMWindow::From(script_state); + if (window && window->GetFrame()->IsInFencedFrameTree()) { + exception_state.ThrowDOMException( + DOMExceptionCode::kNotAllowedError, + "backgroundFetch is not allowed in a fenced frame tree."); + return ScriptPromise(); + } + ScriptState::Scope scope(script_state); if (id.IsEmpty()) { @@ -496,7 +513,16 @@ NOTREACHED(); } -ScriptPromise BackgroundFetchManager::getIds(ScriptState* script_state) { +ScriptPromise BackgroundFetchManager::getIds(ScriptState* script_state, + ExceptionState& exception_state) { + LocalDOMWindow* const window = LocalDOMWindow::From(script_state); + if (window && window->GetFrame()->IsInFencedFrameTree()) { + exception_state.ThrowDOMException( + DOMExceptionCode::kNotAllowedError, + "backgroundFetch is not allowed in a fenced frame tree."); + return ScriptPromise(); + } + // Creating a Background Fetch registration requires an activated worker, so // if |registration_| has not been activated we can skip the Mojo roundtrip. if (!registration_->active()) {
diff --git a/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.h b/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.h index 330468c4..075de0f3 100644 --- a/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.h +++ b/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.h
@@ -49,7 +49,8 @@ ScriptPromise get(ScriptState* script_state, const String& id, ExceptionState& exception_state); - ScriptPromise getIds(ScriptState* script_state); + ScriptPromise getIds(ScriptState* script_state, + ExceptionState& exception_state); void Trace(Visitor* visitor) const override;
diff --git a/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.idl b/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.idl index 18e2ce7d..43c66a1 100644 --- a/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.idl +++ b/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.idl
@@ -10,5 +10,9 @@ ] interface BackgroundFetchManager { [CallWith=ScriptState, RaisesException, MeasureAs=BackgroundFetchManagerFetch] Promise<BackgroundFetchRegistration> fetch(DOMString id, (RequestInfo or sequence<RequestInfo>) requests, optional BackgroundFetchOptions options = {}); [CallWith=ScriptState, RaisesException, MeasureAs=BackgroundFetchManagerGet] Promise<BackgroundFetchRegistration?> get(DOMString id); - [CallWith=ScriptState, MeasureAs=BackgroundFetchManagerGetIds] Promise<FrozenArray<DOMString>> getIds(); + [ + CallWith = ScriptState, RaisesException, MeasureAs = + BackgroundFetchManagerGetIds + ] Promise<FrozenArray<DOMString>> + getIds(); };
diff --git a/third_party/blink/renderer/modules/webdatabase/sql_transaction.cc b/third_party/blink/renderer/modules/webdatabase/sql_transaction.cc index e19c458a..e8fba27 100644 --- a/third_party/blink/renderer/modules/webdatabase/sql_transaction.cc +++ b/third_party/blink/renderer/modules/webdatabase/sql_transaction.cc
@@ -103,8 +103,7 @@ read_only_(read_only) { DCHECK(IsMainThread()); DCHECK(database_); - probe::AsyncTaskScheduled(db->GetExecutionContext(), "SQLTransaction", - &async_task_id_); + async_task_context_.Schedule(db->GetExecutionContext(), "SQLTransaction"); } SQLTransaction::~SQLTransaction() = default; @@ -185,8 +184,8 @@ SQLTransactionState SQLTransaction::DeliverTransactionCallback() { bool should_deliver_error_callback = false; - probe::AsyncTask async_task(database_->GetExecutionContext(), &async_task_id_, - "transaction"); + probe::AsyncTask async_task(database_->GetExecutionContext(), + &async_task_context_, "transaction"); // Spec 4.3.2 4: Invoke the transaction callback with the new SQLTransaction // object. @@ -210,7 +209,7 @@ SQLTransactionState SQLTransaction::DeliverTransactionErrorCallback() { probe::AsyncTask async_task(database_->GetExecutionContext(), - &async_task_id_); + &async_task_context_); // Spec 4.3.2.10: If exists, invoke error callback with the last // error to have occurred in this transaction. @@ -275,7 +274,7 @@ SQLTransactionState SQLTransaction::DeliverSuccessCallback() { DCHECK(IsMainThread()); probe::AsyncTask async_task(database_->GetExecutionContext(), - &async_task_id_); + &async_task_context_); // Spec 4.3.2.8: Deliver success callback. if (OnSuccessCallback* success_callback = success_callback_.Release())
diff --git a/third_party/blink/renderer/modules/webdatabase/sql_transaction.h b/third_party/blink/renderer/modules/webdatabase/sql_transaction.h index 9027aad..b10ff84 100644 --- a/third_party/blink/renderer/modules/webdatabase/sql_transaction.h +++ b/third_party/blink/renderer/modules/webdatabase/sql_transaction.h
@@ -36,7 +36,7 @@ #include "third_party/blink/renderer/bindings/modules/v8/v8_binding_for_modules.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_sql_transaction_callback.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_sql_transaction_error_callback.h" -#include "third_party/blink/renderer/core/probe/async_task_id.h" +#include "third_party/blink/renderer/core/probe/async_task_context.h" #include "third_party/blink/renderer/modules/webdatabase/sql_statement.h" #include "third_party/blink/renderer/modules/webdatabase/sql_transaction_state_machine.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" @@ -202,7 +202,7 @@ bool execute_sql_allowed_; std::unique_ptr<SQLErrorData> transaction_error_; - probe::AsyncTaskId async_task_id_; + probe::AsyncTaskContext async_task_context_; bool read_only_; };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.h b/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.h index 45cde5eb..5b47b8b 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_BUFFER_USAGE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_BUFFER_USAGE_H_ +#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_buffer_usage.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" namespace blink { @@ -14,16 +15,17 @@ public: // gpu_buffer_usage.idl - static constexpr uint32_t kMapRead = 1; - static constexpr uint32_t kMapWrite = 2; - static constexpr uint32_t kCopySrc = 4; - static constexpr uint32_t kCopyDst = 8; - static constexpr uint32_t kIndex = 16; - static constexpr uint32_t kVertex = 32; - static constexpr uint32_t kUniform = 64; - static constexpr uint32_t kStorage = 128; - static constexpr uint32_t kIndirect = 256; - static constexpr uint32_t kQueryResolve = 512; + static constexpr uint32_t kMapRead = V8GPUBufferUsage::Constant::kMapRead; + static constexpr uint32_t kMapWrite = V8GPUBufferUsage::Constant::kMapWrite; + static constexpr uint32_t kCopySrc = V8GPUBufferUsage::Constant::kCopySrc; + static constexpr uint32_t kCopyDst = V8GPUBufferUsage::Constant::kCopyDst; + static constexpr uint32_t kIndex = V8GPUBufferUsage::Constant::kIndex; + static constexpr uint32_t kVertex = V8GPUBufferUsage::Constant::kVertex; + static constexpr uint32_t kUniform = V8GPUBufferUsage::Constant::kUniform; + static constexpr uint32_t kStorage = V8GPUBufferUsage::Constant::kStorage; + static constexpr uint32_t kIndirect = V8GPUBufferUsage::Constant::kIndirect; + static constexpr uint32_t kQueryResolve = + V8GPUBufferUsage::Constant::kQueryResolve; GPUBufferUsage(const GPUBufferUsage&) = delete; GPUBufferUsage& operator=(const GPUBufferUsage&) = delete;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.idl b/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.idl index 1cf1be0..9989000 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_buffer_usage.idl
@@ -7,7 +7,7 @@ typedef [EnforceRange] unsigned long GPUBufferUsageFlags; [ Exposed(Window WebGPU, Worker WebGPU) -] interface GPUBufferUsage { +] namespace GPUBufferUsage { const unsigned long MAP_READ = 1; const unsigned long MAP_WRITE = 2; const unsigned long COPY_SRC = 4;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_color_write.h b/third_party/blink/renderer/modules/webgpu/gpu_color_write.h index 66a7176..ba9306e9f 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_color_write.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_color_write.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_COLOR_WRITE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_COLOR_WRITE_H_ +#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_color_write.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" namespace blink { @@ -14,11 +15,11 @@ public: // gpu_color_write.idl - static constexpr uint32_t kRed = 1; - static constexpr uint32_t kGreen = 2; - static constexpr uint32_t kBlue = 4; - static constexpr uint32_t kAlpha = 8; - static constexpr uint32_t kAll = 15; + static constexpr uint32_t kRed = V8GPUColorWrite::Constant::kRed; + static constexpr uint32_t kGreen = V8GPUColorWrite::Constant::kGreen; + static constexpr uint32_t kBlue = V8GPUColorWrite::Constant::kBlue; + static constexpr uint32_t kAlpha = V8GPUColorWrite::Constant::kAlpha; + static constexpr uint32_t kAll = V8GPUColorWrite::Constant::kAll; GPUColorWrite(const GPUColorWrite&) = delete; GPUColorWrite& operator=(const GPUColorWrite&) = delete;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_color_write.idl b/third_party/blink/renderer/modules/webgpu/gpu_color_write.idl index 80254c5..1c11e989 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_color_write.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_color_write.idl
@@ -7,7 +7,7 @@ typedef [EnforceRange] unsigned long GPUColorWriteFlags; [ Exposed(Window WebGPU, Worker WebGPU) -] interface GPUColorWrite { +] namespace GPUColorWrite { const unsigned long RED = 1; const unsigned long GREEN = 2; const unsigned long BLUE = 4;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_map_mode.h b/third_party/blink/renderer/modules/webgpu/gpu_map_mode.h index b72e8208..cc6ffb1 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_map_mode.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_map_mode.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_MAP_MODE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_MAP_MODE_H_ +#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_map_mode.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" namespace blink { @@ -14,8 +15,8 @@ public: // gpu_map_mode.idl - static constexpr uint32_t kRead = 1; - static constexpr uint32_t kWrite = 2; + static constexpr uint32_t kRead = V8GPUMapMode::Constant::kRead; + static constexpr uint32_t kWrite = V8GPUMapMode::Constant::kWrite; GPUMapMode(const GPUMapMode&) = delete; GPUMapMode& operator=(const GPUMapMode&) = delete;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_map_mode.idl b/third_party/blink/renderer/modules/webgpu/gpu_map_mode.idl index 69fbb9c..8bae3f86 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_map_mode.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_map_mode.idl
@@ -7,7 +7,7 @@ typedef [EnforceRange] unsigned long GPUMapModeFlags; [ Exposed(Window WebGPU, Worker WebGPU) -] interface GPUMapMode { +] namespace GPUMapMode { const unsigned long READ = 0x0001; const unsigned long WRITE = 0x0002; };
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.h b/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.h index 0c4e01e..4e7b47b 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_SHADER_STAGE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_SHADER_STAGE_H_ +#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_shader_stage.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" namespace blink { @@ -14,9 +15,9 @@ public: // gpu_shader_stage.idl - static constexpr uint32_t kVertex = 1; - static constexpr uint32_t kFragment = 2; - static constexpr uint32_t kCompute = 4; + static constexpr uint32_t kVertex = V8GPUShaderStage::Constant::kVertex; + static constexpr uint32_t kFragment = V8GPUShaderStage::Constant::kFragment; + static constexpr uint32_t kCompute = V8GPUShaderStage::Constant::kCompute; GPUShaderStage(const GPUShaderStage&) = delete; GPUShaderStage& operator=(const GPUShaderStage&) = delete;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl b/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl index b250a67..9259b577 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_shader_stage.idl
@@ -7,7 +7,7 @@ typedef [EnforceRange] unsigned long GPUShaderStageFlags; [ Exposed(Window WebGPU, Worker WebGPU) -] interface GPUShaderStage { +] namespace GPUShaderStage { const unsigned long VERTEX = 1; const unsigned long FRAGMENT = 2; const unsigned long COMPUTE = 4;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.h b/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.h index 0d533d80..8e48dda 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.h +++ b/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_TEXTURE_USAGE_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBGPU_GPU_TEXTURE_USAGE_H_ +#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_texture_usage.h" #include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" @@ -15,11 +16,14 @@ public: // gpu_texture_usage.idl - static constexpr uint32_t kCopySrc = 1; - static constexpr uint32_t kCopyDst = 2; - static constexpr uint32_t kTextureBinding = 4; - static constexpr uint32_t kStorageBinding = 8; - static constexpr uint32_t kRenderAttachment = 16; + static constexpr uint32_t kCopySrc = V8GPUTextureUsage::Constant::kCopySrc; + static constexpr uint32_t kCopyDst = V8GPUTextureUsage::Constant::kCopyDst; + static constexpr uint32_t kTextureBinding = + V8GPUTextureUsage::Constant::kTextureBinding; + static constexpr uint32_t kStorageBinding = + V8GPUTextureUsage::Constant::kStorageBinding; + static constexpr uint32_t kRenderAttachment = + V8GPUTextureUsage::Constant::kRenderAttachment; GPUTextureUsage(const GPUTextureUsage&) = delete; GPUTextureUsage& operator=(const GPUTextureUsage&) = delete;
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.idl b/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.idl index 9c2376ea..97759db5 100644 --- a/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.idl +++ b/third_party/blink/renderer/modules/webgpu/gpu_texture_usage.idl
@@ -7,7 +7,7 @@ typedef [EnforceRange] unsigned long GPUTextureUsageFlags; [ Exposed(Window WebGPU, Worker WebGPU) -] interface GPUTextureUsage { +] namespace GPUTextureUsage { const unsigned long COPY_SRC = 1; const unsigned long COPY_DST = 2; const unsigned long TEXTURE_BINDING = 4;
diff --git a/third_party/blink/renderer/modules/webtransport/web_transport.cc b/third_party/blink/renderer/modules/webtransport/web_transport.cc index 8813c46..c5dade0 100644 --- a/third_party/blink/renderer/modules/webtransport/web_transport.cc +++ b/third_party/blink/renderer/modules/webtransport/web_transport.cc
@@ -750,13 +750,6 @@ return ScriptPromise(); } - MojoCreateDataPipeOptions options; - options.struct_size = sizeof(MojoCreateDataPipeOptions); - options.flags = MOJO_CREATE_DATA_PIPE_FLAG_NONE; - options.element_num_bytes = 1; - // TODO(ricea): Find an appropriate value for capacity_num_bytes. - options.capacity_num_bytes = 0; - mojo::ScopedDataPipeProducerHandle outgoing_producer; mojo::ScopedDataPipeConsumerHandle outgoing_consumer; if (!CreateStreamDataPipe(&outgoing_producer, &outgoing_consumer,
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-container-size.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-container-size.html index 909e75b..846281b 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-container-size.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-container-size.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#animated-containers"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> @keyframes anim { from { width: 200px; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-container-type-dynamic.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-container-type-dynamic.html index d885cd70..c096654 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-container-type-dynamic.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-container-type-dynamic.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#animated-containers"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> @keyframes anim { from { width: 200px; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-nested-animation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-nested-animation.html index 79c1330..68b258bb 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-nested-animation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-nested-animation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#animated-containers"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> @keyframes outer { from { width: 100px; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-nested-transition.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-nested-transition.html index 85f5358..110a3bd 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-nested-transition.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/animation-nested-transition.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#animated-containers"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> @keyframes outer { from { width: 100px; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/aspect-ratio-feature-evaluation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/aspect-ratio-feature-evaluation.html index 4a0916dd..f2919e5 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/aspect-ratio-feature-evaluation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/aspect-ratio-feature-evaluation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#aspect-ratio"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> .container { width: 100px;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/at-container-parsing.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/at-container-parsing.html index f6c27ec..f49a382 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/at-container-parsing.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/at-container-parsing.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-rule"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div style="container:size; width:100px; height:100px"> <main id=main></main> </div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/auto-scrollbars.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/auto-scrollbars.html index 2dea807..19dbd35 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/auto-scrollbars.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/auto-scrollbars.html
@@ -4,7 +4,7 @@ <link rel="help" href="https://drafts.csswg.org/css-overflow-3/#scrollbar-layout"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #scroller { height: 100px;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/backdrop-invalidation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/backdrop-invalidation.html index 47d41fdb8..acb5b2b 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/backdrop-invalidation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/backdrop-invalidation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> :root { color: black;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/conditional-container-status.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/conditional-container-status.html index c082a08a..cdeaf418 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/conditional-container-status.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/conditional-container-status.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-type"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> .parent { width: 300px; } .child { width: 100px; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-computed.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-computed.html index 97c5cf5..1bd063a 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-computed.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-computed.html
@@ -6,7 +6,7 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/css/support/computed-testcommon.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div id="target"></div> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-for-shadow-dom.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-for-shadow-dom.tentative.html index 54e31ef3..aee25f86 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-for-shadow-dom.tentative.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-for-shadow-dom.tentative.html
@@ -5,7 +5,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#query-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #inclusive-ancestor-across-root, #inclusive-ancestor-skip-slotting,
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-inheritance.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-inheritance.html index 7bdbcdc9..efc09983 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-inheritance.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-inheritance.html
@@ -6,7 +6,7 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/css/support/inheritance-testcommon.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div id="container"> <div id="target"></div> </div>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-computed.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-computed.html index 01ebb8b6..79361d7 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-computed.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-computed.html
@@ -5,7 +5,7 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/css/support/computed-testcommon.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div id="target"></div> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-invalidation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-invalidation.html index 4dfd24c..796884e1 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-invalidation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-invalidation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-name"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> div { color: black;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-parsing.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-parsing.html index 810a0c5..4fc6a175 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-parsing.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-name-parsing.html
@@ -5,7 +5,7 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/css/support/parsing-testcommon.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div id="target"></div> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-parsing.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-parsing.html index d9c1b2d..e18b282 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-parsing.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-parsing.html
@@ -6,7 +6,7 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/css/support/parsing-testcommon.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div id="target"></div> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-selection.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-selection.html index b08df66c..a797fe47 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-selection.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-selection.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-rule"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> main { background-color: lightgray; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-size-invalidation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-size-invalidation.html index b7a5d65..7008d4a7 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-size-invalidation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-size-invalidation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #container { container-type: size;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-computed.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-computed.html index 7b3e718..cd5f1cbb 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-computed.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-computed.html
@@ -5,7 +5,7 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/css/support/computed-testcommon.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div id="target"></div> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-containment.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-containment.html index 42a42eac..66500a6 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-containment.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-containment.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-type"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <script> setup(() => assert_implements_container_queries()); </script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-invalidation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-invalidation.html index 209c77f..178c50f 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-invalidation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-invalidation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-type"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> div { color: black;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-layout-invalidation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-layout-invalidation.html index 60b8d10..3103de81 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-layout-invalidation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-layout-invalidation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #div { width: fit-content;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-parsing.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-parsing.html index 6395389..2ed93c20 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-parsing.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-type-parsing.html
@@ -5,7 +5,7 @@ <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> <script src="/css/support/parsing-testcommon.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div id="target"></div> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-animation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-animation.html index 28413092..75178bb 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-animation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-animation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-lengths"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #container { container-type: size;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-basic.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-basic.html index abe3eaf..09f6624 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-basic.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-basic.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-lengths"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> .inline { container-type: inline-size; } .size { container-type: size; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-computational-independence.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-computational-independence.html index 42c9e6e..5f22a29 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-computational-independence.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-computational-independence.html
@@ -4,7 +4,7 @@ <link rel="help" href="https://drafts.css-houdini.org/css-properties-values-api-1/#computationally-independent"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-invalidation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-invalidation.html index 2ddc2756..257573a 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-invalidation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-invalidation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-lengths"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #inline { container-type: inline-size; } #size, #outer { container-type: size; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-selection.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-selection.html index ef05ba8..8613813 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-selection.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-selection.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-lengths"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> * { writing-mode: initial; } .inline { container-type: inline-size; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-typed-om.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-typed-om.html index 6f3d758..9baf12d 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-typed-om.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/container-units-typed-om.html
@@ -4,7 +4,7 @@ <link rel="help" href="https://drafts.css-houdini.org/css-typed-om-1/#stylepropertymap"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div id=element></div> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/counters-flex-circular.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/counters-flex-circular.html index 31741e5c..3bee287 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/counters-flex-circular.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/counters-flex-circular.html
@@ -4,7 +4,7 @@ <link rel="stylesheet" href="/fonts/ahem.css"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #flex { width: 200px;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/display-contents.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/display-contents.html index 4be3e79..55df5df 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/display-contents.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/display-contents.html
@@ -4,7 +4,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-2/#containment-size"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <script> setup(() => assert_implements_container_queries()); </script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/display-none.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/display-none.html index 8341b364..cdd614c 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/display-none.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/display-none.html
@@ -4,7 +4,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-2/#containment-size"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <script> setup(() => assert_implements_container_queries()); </script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/font-relative-units-dynamic.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/font-relative-units-dynamic.html index f50614c4..0c7786f 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/font-relative-units-dynamic.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/font-relative-units-dynamic.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> :root { font-size: 10px; } :root.larger { font-size: 50px; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/font-relative-units.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/font-relative-units.html index 670629d..cad44d5 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/font-relative-units.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/font-relative-units.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> :root { font-size: 10px; } #em_container {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/get-animations.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/get-animations.html index 4c7489c..ea95bb98 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/get-animations.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/get-animations.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#animated-containers"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #container { container-type: inline-size;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/iframe-invalidation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/iframe-invalidation.html index 09adf705..8fc81a7 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/iframe-invalidation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/iframe-invalidation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> iframe { width: 200px;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/ineligible-containment.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/ineligible-containment.html index c041acd..5077508 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/ineligible-containment.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/ineligible-containment.html
@@ -4,7 +4,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-2/#containment-size"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #outer, #inner1, #inner2 { width: 200px;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-and-min-width.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-and-min-width.html index 8d72729..7d4ca6a 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-and-min-width.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-and-min-width.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #container { container-type: inline-size;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-containment-vertical-rl.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-containment-vertical-rl.html index cfc0206..ec19467c 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-containment-vertical-rl.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-containment-vertical-rl.html
@@ -21,7 +21,7 @@ </div> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-containment.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-containment.html index d600fa0..2a45053 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-containment.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/inline-size-containment.html
@@ -20,7 +20,7 @@ </div> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <script> setup(() => assert_implements_container_queries());
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/orthogonal-wm-container-query.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/orthogonal-wm-container-query.html index 3147a429..30e58f8 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/orthogonal-wm-container-query.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/orthogonal-wm-container-query.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <link rel="stylesheet" href="/fonts/ahem.css"> <style> #container {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/pseudo-elements-001.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/pseudo-elements-001.html index 35a6759c..c5fd15f 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/pseudo-elements-001.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/pseudo-elements-001.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#query-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> :root { color: black;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/pseudo-elements-003.tentative.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/pseudo-elements-003.tentative.html index 68fd06fa..7d03dc0 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/pseudo-elements-003.tentative.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/pseudo-elements-003.tentative.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://github.com/w3c/csswg-drafts/issues/6711"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> .container { container-type: inline-size; } #target { display: list-item; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/query-evaluation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/query-evaluation.html index e8952b2..50ae75d 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/query-evaluation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/query-evaluation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-rule"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #container { width: 1px;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/reattach-container-with-dirty-child.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/reattach-container-with-dirty-child.html index ab4cc22..0cdf571 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/reattach-container-with-dirty-child.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/reattach-container-with-dirty-child.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #container { container-type: inline-size;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/size-container-no-principal-box.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/size-container-no-principal-box.html index c26dfdd1..cc409b4 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/size-container-no-principal-box.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/size-container-no-principal-box.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #outer { container-type: inline-size;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/size-feature-evaluation.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/size-feature-evaluation.html index 763ac196f..e558d831 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/size-feature-evaluation.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/size-feature-evaluation.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <div id=container> <div id=target>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/style-change-in-container.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/style-change-in-container.html index d2c6ff3..82a830c 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/style-change-in-container.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/style-change-in-container.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #container { container-type: size; } @container size(min-width: 1px) {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/support/testcommon.js b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/support/cq-testcommon.js similarity index 100% rename from third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/support/testcommon.js rename to third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/support/cq-testcommon.js
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-dialog-container.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-dialog-container.html index f3799fe..a61c35a3 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-dialog-container.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-dialog-container.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #parent { width: 100px; } #dialog {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-dialog.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-dialog.html index 54ba22e..0983d49a 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-dialog.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-dialog.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #container { container-type: inline-size;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-nested-dialog.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-nested-dialog.html index 34904706..5649ad4 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-nested-dialog.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/top-layer-nested-dialog.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#container-queries"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> dialog { color: red; } #container { width: 100px; }
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/transition-scrollbars.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/transition-scrollbars.html index 816ae068..33734eb 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/transition-scrollbars.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/transition-scrollbars.html
@@ -4,7 +4,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#animated-containers"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #scrollable { overflow: auto;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/transition-style-change-event.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/transition-style-change-event.html index b5ae21f..f10e58c 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/transition-style-change-event.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/transition-style-change-event.html
@@ -5,7 +5,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#animated-containers"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> .container { container-type: size } #outer {
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/unsupported-axis.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/unsupported-axis.html index 757b62d..9ab91f8 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/unsupported-axis.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/unsupported-axis.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <script> setup(() => assert_implements_container_queries()); </script>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/viewport-units-dynamic.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/viewport-units-dynamic.html index 72b1c4be..092c4e4b 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/viewport-units-dynamic.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/viewport-units-dynamic.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> iframe { width: 100px;
diff --git a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/viewport-units.html b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/viewport-units.html index 6cf1d204..68546258 100644 --- a/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/viewport-units.html +++ b/third_party/blink/web_tests/external/wpt/css/css-contain/container-queries/viewport-units.html
@@ -3,7 +3,7 @@ <link rel="help" href="https://drafts.csswg.org/css-contain-3/#size-container"> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> -<script src="support/testcommon.js"></script> +<script src="support/cq-testcommon.js"></script> <style> #vw { container-type: inline-size; width: 10vw; } #vh { container-type: inline-size; width: 10vh; }
diff --git a/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/coop-sandbox-redirects-cuts-opener.https.html b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/coop-sandbox-redirects-cuts-opener.https.html new file mode 100644 index 0000000..01f60b42 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/html/cross-origin-opener-policy/coop-sandbox-redirects-cuts-opener.https.html
@@ -0,0 +1,68 @@ +<!doctype html> +<title> + Sandboxed Cross-Origin-Opener-Policy popup should cut the opener if necessary + including during redirects. +</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/common/dispatcher/dispatcher.js"></script> +<script src="/common/get-host-info.sub.js"></script> +<script src="/common/utils.js"></script> +<script src="resources/common.js"></script> +<body> +<script> +const executor_path = "/common/dispatcher/executor.html?pipe="; +const coop_same_origin_header = + '|header(Cross-Origin-Opener-Policy,same-origin)'; +const coop_unsafe_none_header = + '|header(Cross-Origin-Opener-Policy,unsafe-none)'; + +function getExecutorPath(uuid, origin) { + return origin.origin + executor_path + `&uuid=${uuid}`; +} + +[ + "allow-popups allow-scripts allow-same-origin", + "allow-popups allow-scripts", +].forEach(sandboxValue => { + async_test(t => { + // Set up dispatcher communications. + const iframe_token = token(); + const popup_token = token(); + const main_frame_token_for_popup = token(); + const main_frame_token_for_iframe = token(); + + // Create a sandboxed iframe. + const iframe = document.createElement("iframe"); + iframe.sandbox = sandboxValue; + iframe.src = getExecutorPath(iframe_token, SAME_ORIGIN); + document.body.append(iframe); + t.add_cleanup(() => iframe.remove()); + + // Open a COOP popup from the sandboxed iframe. + // Instead of navigating directly we go through a redirect. + const popup_url = getExecutorPath(popup_token, SAME_ORIGIN); + const redirect_url = SAME_ORIGIN.origin + "/common/redirect.py?pipe=" + + coop_same_origin_header + "&location=" + + encodeURIComponent(popup_url); + send(iframe_token, `window.popup = window.open('${redirect_url}')`); + + // This should fail. We ping the popup, if we get an answer it loaded. + send(popup_token, ` + send('${main_frame_token_for_popup}', 'Popup loaded'); + `); + receive(main_frame_token_for_popup) + .then(t.unreached_func("A COOP popup was created from a sandboxed frame")); + + // We delay probing the popup.closed property to give it time to settle. + t.step_timeout(() => { + send(iframe_token, + `send('${main_frame_token_for_iframe}', window.popup.closed);`); + }, 1500); + receive(main_frame_token_for_iframe) + .then(t.step_func_done(data => assert_equals(data, "true"))); + + }, `<iframe sandbox="${sandboxValue}"> ${document.title}`); +}); +</script> +</body>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/network/websocket/slow-network.js b/third_party/blink/web_tests/http/tests/inspector-protocol/network/websocket/slow-network.js index 1871a0d..9f15356 100644 --- a/third_party/blink/web_tests/http/tests/inspector-protocol/network/websocket/slow-network.js +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/network/websocket/slow-network.js
@@ -14,12 +14,16 @@ return new Promise((resolve) => { const ws = new WebSocket('ws://localhost:8880/echo'); let startTime; + let numMessages = 0; ws.onopen = () => { startTime = performance.now(); - ws.send('x'.repeat(2000)); - ws.send('x'.repeat(2000)); + ws.send('x'.repeat(1000)); + ws.send('x'.repeat(1000)); }; - ws.onmessage = () => { resolve(performance.now() - startTime); } + ws.onmessage = () => { + ++numMessages; + if (numMessages == 2) resolve(performance.now() - startTime); + } ws.onerror = () => log += 'onerror '; ws.onclose = () => log += 'onclose '; });
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/background-fetch.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/background-fetch.https.html new file mode 100644 index 0000000..d8a15993 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/background-fetch.https.html
@@ -0,0 +1,72 @@ +<!DOCTYPE html> +<title>Test fenced frame does not allow call background fetch</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="resources/utils.js"></script> +<script src="/common/get-host-info.sub.js"></script> + +<body> + + <script> + const background_fetch_register_key = KEYS['background-fetch']; + const fenced_frame_url = 'resources/background-fetch-inner.https.html'; + + function base_path() { + return location.pathname.replace(/\/[^\/]*$/, '/'); + } + + async function test(url, expected, message) { + attachFencedFrame(url) + + // Get the result for the top-level fenced frame. + const fenced_frame_result = await nextValueFromServer(background_fetch_register_key); + assert_equals(fenced_frame_result, expected, message); + } + + promise_test(async () => { + const url = `${fenced_frame_url}?fetch`; + await test( + url, + '[backgroundFetch.fetch] Failed inside fencedframe as expected', + 'backgroundFetch.fetch is disallowed inside a same-origin fenced frame'); + + const CROSS_ORIGIN_DESTINATION = + get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() + url; + await test( + CROSS_ORIGIN_DESTINATION, + '[backgroundFetch.fetch] Failed inside fencedframe as expected', + 'backgroundFetch.fetch is disallowed inside a cross-origin fenced frame'); + }, 'backgroundFetch.fetch'); + + promise_test(async () => { + const url = `${fenced_frame_url}?get`; + await test( + url, + '[backgroundFetch.get] Failed inside fencedframe as expected', + 'backgroundFetch.get is disallowed inside a same-origin fenced frame'); + + const CROSS_ORIGIN_DESTINATION = + get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() + url; + await test( + CROSS_ORIGIN_DESTINATION, + '[backgroundFetch.get] Failed inside fencedframe as expected', + 'backgroundFetch.get is disallowed inside a cross-origin fenced frame'); + }, 'backgroundFetch.get'); + + promise_test(async () => { + const url = `${fenced_frame_url}?getIds`; + await test( + url, + '[backgroundFetch.getIds] Failed inside fencedframe as expected', + 'backgroundFetch.getIds is disallowed inside a same-origin fenced frame'); + + const CROSS_ORIGIN_DESTINATION = + get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() + url; + await test( + CROSS_ORIGIN_DESTINATION, + '[backgroundFetch.getIds] Failed inside fencedframe as expected', + 'backgroundFetch.getIds is disallowed inside a cross-origin fenced frame'); + }, 'backgroundFetch.getIds'); + </script> + +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/background-fetch-inner.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/background-fetch-inner.https.html new file mode 100644 index 0000000..1f8d2f8 --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/background-fetch-inner.https.html
@@ -0,0 +1,47 @@ +<!DOCTYPE html> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="utils.js"></script> +<title>Fenced frame content to report the result of background fetch</title> + +<body> + <script> + (async function () { + const background_fetch_register_key = KEYS['background-fetch']; + const file = 'background-fetch-inner.https.html.headers'; + + navigator.serviceWorker.register("empty-worker.js", { scope: location.href }); + const registration = await navigator.serviceWorker.ready; + + const param = location.search.slice(1); + + let promise; + switch (param) { + case 'fetch': + promise = registration.backgroundFetch.fetch('test-fetch', file); + break; + case 'get': + promise = registration.backgroundFetch.get('test-fetch'); + break; + case 'getIds': + promise = registration.backgroundFetch.getIds(); + break + default: + promise = Promise.resolve(); + } + + promise + .then(() => { + writeValueToServer(background_fetch_register_key, + `[backgroundFetch.${param}] Unexpectedly started`); + }) + .catch(() => { + writeValueToServer(background_fetch_register_key, + `[backgroundFetch.${param}] Failed inside fencedframe as expected`); + }) + .finally(() => { + registration.unregister(); + }); + })(); + </script> +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/background-fetch-inner.https.html.headers b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/background-fetch-inner.https.html.headers new file mode 100644 index 0000000..6247f6d --- /dev/null +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/background-fetch-inner.https.html.headers
@@ -0,0 +1 @@ +Supports-Loading-Mode: fenced-frame \ No newline at end of file
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/utils.js b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/utils.js index e983af1..bdb79dd6 100644 --- a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/utils.js +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/utils.js
@@ -84,6 +84,8 @@ "usb.requestDevice" : "00000000-0000-0000-0000-00000000002A", "navigator.share" : "00000000-0000-0000-0000-00000000002B", + + "background-fetch" : "00000000-0000-0000-0000-00000000002C", // Add keys above this list, incrementing the key UUID in hexadecimal }
diff --git a/tools/accessibility/inspect/ax_event_server.cc b/tools/accessibility/inspect/ax_event_server.cc index a5cb9ff5..d2c5533 100644 --- a/tools/accessibility/inspect/ax_event_server.cc +++ b/tools/accessibility/inspect/ax_event_server.cc
@@ -5,6 +5,8 @@ #include "tools/accessibility/inspect/ax_event_server.h" #include "base/bind.h" +#include "base/logging.h" +#include "base/time/time.h" #include "content/public/browser/ax_inspect_factory.h" namespace tools { @@ -21,7 +23,7 @@ AXEventServer::~AXEventServer() = default; void AXEventServer::OnEvent(const std::string& event) const { - printf("%s\n", event.c_str()); + LOG(INFO) << "[" << base::Time::NowFromSystemTime() << "] " << event; } } // namespace tools
diff --git a/tools/clang/scripts/build.py b/tools/clang/scripts/build.py index af357b49..4cf12c6 100755 --- a/tools/clang/scripts/build.py +++ b/tools/clang/scripts/build.py
@@ -278,6 +278,100 @@ return zlib_dir +def BuildLibXml2(): + """Download and build libxml2""" + # libxml2-2.9.11 is the first version with cmake build files. However, + # https://gitlab.gnome.org/GNOME/libxml2/-/merge_requests/109 wasn't merged + # when 2.9.11 was released, so xmlwin32version.h.in is missing from the + # release tar gz. So we uploaded a slightly tweaked libxml2 like so: + # $ curl -O ftp://xmlsoft.org/libxml2/libxml2-2.9.11.tar.gz + # $ tar xzf libxml2-2.9.11.tar.gz + # $ WIN=include/libxml/xmlwin32version.h.in + # $ curl -o libxml2-2.9.11/$WIN \ + # https://gitlab.gnome.org/GNOME/libxml2/-/raw/v2.9.11/$WIN + # $ rm libxml2-2.9.11.tar.gz + # $ tar cf libxml2-2.9.11.tar libxml2-2.9.11 + # $ gzip -9 libxml2-2.9.11.tar + # $ gsutil cp -n -a public-read libxml2-2.9.11.tar.gz \ + # gs://chromium-browser-clang/tools + + # TODO(thakis): Use this locally built statically linked libxml2 on all + # platforms. fewer dynamic deps, and guaranteed(ish) to have same behavior + # across platforms. + + libxml2_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'libxml2-2.9.11') + if os.path.exists(libxml2_dir): + RmTree(libxml2_dir) + zip_name = 'libxml2-2.9.11.tar.gz' + DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR) + os.chdir(libxml2_dir) + os.mkdir('build') + os.chdir('build') + + libxml2_install_dir = os.path.join(libxml2_dir, 'build', 'install') + + # Disable everything except WITH_TREE and WITH_OUTPUT, both needed by LLVM's + # WindowsManifestMerger. + RunCommand( + [ + 'cmake', + '-GNinja', + '-DCMAKE_BUILD_TYPE=Release', + '-DCMAKE_INSTALL_PREFIX=install', + '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded', # /MT to match LLVM. + '-DBUILD_SHARED_LIBS=OFF', + '-DLIBXML2_WITH_C14N=OFF', + '-DLIBXML2_WITH_CATALOG=OFF', + '-DLIBXML2_WITH_DEBUG=OFF', + '-DLIBXML2_WITH_DOCB=OFF', + '-DLIBXML2_WITH_FTP=OFF', + '-DLIBXML2_WITH_HTML=OFF', + '-DLIBXML2_WITH_HTTP=OFF', + '-DLIBXML2_WITH_ICONV=OFF', + '-DLIBXML2_WITH_ICU=OFF', + '-DLIBXML2_WITH_ISO8859X=OFF', + '-DLIBXML2_WITH_LEGACY=OFF', + '-DLIBXML2_WITH_LZMA=OFF', + '-DLIBXML2_WITH_MEM_DEBUG=OFF', + '-DLIBXML2_WITH_MODULES=OFF', + '-DLIBXML2_WITH_OUTPUT=ON', + '-DLIBXML2_WITH_PATTERN=OFF', + '-DLIBXML2_WITH_PROGRAMS=OFF', + '-DLIBXML2_WITH_PUSH=OFF', + '-DLIBXML2_WITH_PYTHON=OFF', + '-DLIBXML2_WITH_READER=OFF', + '-DLIBXML2_WITH_REGEXPS=OFF', + '-DLIBXML2_WITH_RUN_DEBUG=OFF', + '-DLIBXML2_WITH_SAX1=OFF', + '-DLIBXML2_WITH_SCHEMAS=OFF', + '-DLIBXML2_WITH_SCHEMATRON=OFF', + '-DLIBXML2_WITH_TESTS=OFF', + '-DLIBXML2_WITH_THREADS=OFF', + '-DLIBXML2_WITH_THREAD_ALLOC=OFF', + '-DLIBXML2_WITH_TREE=ON', + '-DLIBXML2_WITH_VALID=OFF', + '-DLIBXML2_WITH_WRITER=OFF', + '-DLIBXML2_WITH_XINCLUDE=OFF', + '-DLIBXML2_WITH_XPATH=OFF', + '-DLIBXML2_WITH_XPTR=OFF', + '-DLIBXML2_WITH_ZLIB=OFF', + '..', + ], + msvc_arch='x64') + RunCommand(['ninja', 'install'], msvc_arch='x64') + + libxml2_include_dir = os.path.join(libxml2_install_dir, 'include', 'libxml2') + libxml2_lib = os.path.join(libxml2_install_dir, 'lib', 'libxml2s.lib') + extra_cmake_flags = [ + '-DLLVM_ENABLE_LIBXML2=FORCE_ON', + '-DLIBXML2_INCLUDE_DIR=' + libxml2_include_dir.replace('\\', '/'), + '-DLIBXML2_LIBRARIES=' + libxml2_lib.replace('\\', '/'), + ] + extra_cflags = ['-DLIBXML_STATIC'] + + return extra_cmake_flags, extra_cflags + + def DownloadRPMalloc(): """Download rpmalloc.""" rpmalloc_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'rpmalloc') @@ -616,6 +710,12 @@ cxxflags.append('-I' + zlib_dir) ldflags.append('-LIBPATH:' + zlib_dir) + # Statically link libxml2 to make lld-link not require mt.exe + libxml_cmake_args, libxml_cflags = BuildLibXml2() + base_cmake_args += libxml_cmake_args + cflags += libxml_cflags + cxxflags += libxml_cflags + # Use rpmalloc. For faster ThinLTO linking. rpmalloc_dir = DownloadRPMalloc() base_cmake_args.append('-DLLVM_INTEGRATED_CRT_ALLOC=' + rpmalloc_dir) @@ -965,6 +1065,10 @@ '-DCOMPILER_RT_BUILD_PROFILE=ON', '-DCOMPILER_RT_BUILD_SANITIZERS=OFF', '-DCOMPILER_RT_BUILD_XRAY=OFF', + + # The libxml2 we built above is 64-bit. Since it's only needed by + # lld-link and not compiler-rt, just turn it off down here. + '-DLLVM_ENABLE_LIBXML2=OFF', ] RunCommand(['cmake'] + compiler_rt_args + [os.path.join(LLVM_DIR, 'llvm')],
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 7bae916..e5cc1d0 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -35,7 +35,7 @@ # Reverting problematic clang rolls is safe, though. # This is the output of `git describe` and is usable as a commit-ish. CLANG_REVISION = 'llvmorg-14-init-11564-g37fbf238' -CLANG_SUB_REVISION = 1 +CLANG_SUB_REVISION = 2 PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION) RELEASE_VERSION = '14.0.0'
diff --git a/tools/mb/mb.py b/tools/mb/mb.py index 2e1c0545..67391c7 100755 --- a/tools/mb/mb.py +++ b/tools/mb/mb.py
@@ -2075,6 +2075,8 @@ stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, stdin=subprocess.PIPE) out, err = p.communicate(input=stdin) + out = out.decode('utf-8') + err = err.decode('utf-8') else: p = subprocess.Popen(cmd, shell=False, cwd=self.chromium_src_dir, env=env)
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 5ea41f31..ff08c55f 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -19616,6 +19616,14 @@ </description> </action> +<action name="NewTabPage_Promos_PrivacyGuide"> + <owner>msramek@chromium.org</owner> + <owner>rainhard@chromium.org</owner> + <description> + Recorded when the user clicks a Privacy Guide promotion on the New Tab Page. + </description> +</action> + <action name="NewTabPage_Promos_SafetyCheck"> <owner>msramek@chromium.org</owner> <description>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index b227f26d..1141861 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -1348,6 +1348,14 @@ <int value="7" label="Failed to enable (need powerwash)"/> </enum> +<enum name="AddCredentialFromSettingsUserInteractions"> + <int value="0" label="Add Credential Dialog is opened"/> + <int value="1" label="Add Credential Dialog is closed"/> + <int value="2" label="Credential got added"/> + <int value="3" label="Duplicate Credential is entered"/> + <int value="4" label="Duplicate Credential is viewed"/> +</enum> + <enum name="AddIceCandidateResult"> <int value="0" label="Success"/> <int value="1" label="Closed"/> @@ -8273,6 +8281,7 @@ <int value="254" label="RFH_CREATE_CHILD_FRAME_SANDBOX_FLAGS"/> <int value="255" label="RFPH_FOCUSED_FENCED_FRAME"/> <int value="256" label="WCI_REQUEST_LOCK_MOUSE_FENCED_FRAME"/> + <int value="257" label="BFSI_CREATE_FOR_FRAME_FENCED_FRAME"/> </enum> <enum name="BadMessageReasonExtensions"> @@ -35773,6 +35782,7 @@ label="CrossOriginOpenerPolicySameOriginAllowPopupsReportOnly"/> <int value="4090" label="CrossOriginOpenerPolicySameOriginReportOnly"/> <int value="4091" label="ImageLoadAtDismissalEvent"/> + <int value="4092" label="PrivateNetworkAccessIgnoredPreflightError"/> </enum> <enum name="FeaturePolicyAllowlistType"> @@ -71400,6 +71410,7 @@ <int value="1" label="Open Safety Check"/> <int value="2" label="Open SafeBrowsing Enhanced Protection"/> <int value="3" label="Open Chrome feedback form"/> + <int value="4" label="Open Privacy Guide"/> </enum> <enum name="ProtectorError"> @@ -81989,7 +82000,11 @@ resource"/> <int value="6" label="Abandoned because no content was visible at the beginning of - startup"/> + startup. Hint: often caused by showing the profile picker + instead of immediately opening a browser window on startup"/> + <int value="7" + label="Abandoned because the content was already painted before + profiling started"/> </enum> <enum name="StartupTabPreloaderLoadDecisionCause">
diff --git a/tools/metrics/histograms/metadata/feature_engagement/histograms.xml b/tools/metrics/histograms/metadata/feature_engagement/histograms.xml index 8115fe9..cb109d2 100644 --- a/tools/metrics/histograms/metadata/feature_engagement/histograms.xml +++ b/tools/metrics/histograms/metadata/feature_engagement/histograms.xml
@@ -48,10 +48,6 @@ <variant name="IPH_AutoDarkUserEducationMessageOptIn" summary="message educating users about enabling auto dark web contents feature globally"/> - <variant name="IPH_AutofillVirtualCardSuggestion" - summary="message shown along with the virtual card suggestion option in - the Autofill dropdown to educate users virtual cards come with - better security"/> <variant name="IPH_BadgedReadingList" summary="badged reading list"/> <variant name="IPH_Bookmark" summary="bookmark"/> <variant name="IPH_BottomToolbarTip" summary="bottom toolbar"/> @@ -165,6 +161,8 @@ summary="payments autofill suggestions"/> <variant name="IPH_KeyboardAccessoryPaymentOffer" summary="payments autofill suggestions that have an offer"/> + <variant name="IPH_KeyboardAccessoryPaymentVirtualCard" + summary="payment autofill suggestions that are virtual cards"/> <variant name="IPH_LiveCaption" summary="Live Caption"/> <variant name="IPH_LongPressToolbarTip" summary="LongPress toolbar"/> <variant name="IPH_MicToolbar" summary="the mic button in the toolbar"/>
diff --git a/tools/metrics/histograms/metadata/media/histograms.xml b/tools/metrics/histograms/metadata/media/histograms.xml index 8073b4f..eba5913 100644 --- a/tools/metrics/histograms/metadata/media/histograms.xml +++ b/tools/metrics/histograms/metadata/media/histograms.xml
@@ -668,6 +668,21 @@ </summary> </histogram> +<histogram name="Media.Audio.OutputDeviceListener.Duration.{Device}" units="ms" + expires_after="2022-10-04"> + <owner>olka@chromium.org</owner> + <owner>tguilbert@chromium.org</owner> + <summary> + Duration of the interval when a listener listens to a specific output + device. Recorded when a listener chooses to listen to another output device, + or stops listening altogether. + </summary> + <token key="Device"> + <variant name=".Default" summary="Default device"/> + <variant name=".NonDefault" summary="Non-default device"/> + </token> +</histogram> + <histogram name="Media.Audio.OutputDeviceMixer.MaxListenerCount{Device}" units="listeners" expires_after="2022-10-04"> <owner>olka@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/oobe/histograms.xml b/tools/metrics/histograms/metadata/oobe/histograms.xml index 6ad6fdf..f29c4af 100644 --- a/tools/metrics/histograms/metadata/oobe/histograms.xml +++ b/tools/metrics/histograms/metadata/oobe/histograms.xml
@@ -169,7 +169,7 @@ </histogram> <histogram name="OOBE.MarketingOptInScreen.BackendConnector" - enum="MarketingOptInBackendConnectorEvent" expires_after="2021-10-04"> + enum="MarketingOptInBackendConnectorEvent" expires_after="2022-11-30"> <owner>rrsilva@google.com</owner> <owner>cros-oac@google.com</owner> <summary> @@ -191,7 +191,7 @@ </histogram> <histogram name="OOBE.MarketingOptInScreen.GeolocationResolve" - enum="MarketingOptInGeolocationEvent" expires_after="2021-08-01"> + enum="MarketingOptInGeolocationEvent" expires_after="2022-11-30"> <owner>rrsilva@google.com</owner> <owner>cros-oac@google.com</owner> <summary> @@ -201,6 +201,9 @@ <histogram name="OOBE.MarketingOptInScreen.GeolocationResolveLength" units="chars" expires_after="2021-08-09"> + <obsolete> + Removed in the M98. + </obsolete> <owner>rrsilva@google.com</owner> <owner>cros-oac@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/others/histograms.xml b/tools/metrics/histograms/metadata/others/histograms.xml index df691114..67eccec 100644 --- a/tools/metrics/histograms/metadata/others/histograms.xml +++ b/tools/metrics/histograms/metadata/others/histograms.xml
@@ -8163,7 +8163,7 @@ </histogram> <histogram name="ImportantFile.SerializationDuration{File}" units="ms" - expires_after="2021-12-12"> + expires_after="2022-12-12"> <owner>battre@chromium.org</owner> <owner>gab@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/metadata/password/histograms.xml b/tools/metrics/histograms/metadata/password/histograms.xml index 52c9cbdaf5..4a49e6a 100644 --- a/tools/metrics/histograms/metadata/password/histograms.xml +++ b/tools/metrics/histograms/metadata/password/histograms.xml
@@ -626,6 +626,16 @@ </token> </histogram> +<histogram name="PasswordManager.AddCredentialFromSettings.UserAction" + enum="AddCredentialFromSettingsUserInteractions" expires_after="M104"> + <owner>vidhanj@google.com</owner> + <owner>lizapopova@google.com</owner> + <summary> + Records the user actions performed when a new credential is added from + Settings. Only applicable to Desktop and iOS platforms. + </summary> +</histogram> + <histogram name="PasswordManager.AffiliationBackend.FetchSize" units="facets" expires_after="2022-04-10"> <owner>vsemeniuk@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/profile/histograms.xml b/tools/metrics/histograms/metadata/profile/histograms.xml index 87c893fd..a2e82be2 100644 --- a/tools/metrics/histograms/metadata/profile/histograms.xml +++ b/tools/metrics/histograms/metadata/profile/histograms.xml
@@ -837,6 +837,37 @@ </summary> </histogram> +<histogram name="ProfilePicker.FirstProfileTime.FirstWebContentsFinishReason" + enum="StartupProfilingFinishReason" expires_after="2022-04-03"> + <owner>dgn@chromium.org</owner> + <owner>chrome-signin-team@google.com</owner> + <summary> + [Desktop] The reason for which profile picker startup profiling was deemed + complete. Logged once per session when the user opens a profile from the + profile picker shown on startup. + + Used to understand user behavior shifts when + ProfilePicker.FirstProfileTime.FirstWebContentsNonEmptyPaint regresses + </summary> +</histogram> + +<histogram name="ProfilePicker.FirstProfileTime.FirstWebContentsNonEmptyPaint" + units="ms" expires_after="2022-04-03"> + <owner>dgn@chromium.org</owner> + <owner>chrome-signin-team@google.com</owner> + <summary> + Measure the elapsed time from when the user selects a profile on the startup + profile picker to the first non empty paint of the first web contents. This + is recorded when the user selects an existing profile from that profile + picker shown on startup. + + Together with ProfilePicker.StartupTime.FirstPaint.FromApplicationStart, + this metric is intended to capture the startup latency for a common case + where Startup.FirstWebContents.NonEmptyPaint3 is not recorded due to the + profile picker interrupting browser startup. + </summary> +</histogram> + <histogram name="ProfilePicker.NewProfileCreateShortcut" enum="BooleanCreated" expires_after="M90"> <owner>msalama@chromium.org</owner>
diff --git a/ui/accessibility/platform/ax_platform_node_cocoa.mm b/ui/accessibility/platform/ax_platform_node_cocoa.mm index e390e9d..96320a6 100644 --- a/ui/accessibility/platform/ax_platform_node_cocoa.mm +++ b/ui/accessibility/platform/ax_platform_node_cocoa.mm
@@ -1244,37 +1244,37 @@ // Parameterized text-specific attributes. - (id)AXLineForIndex:(id)parameter { - DCHECK([parameter isKindOfClass:[NSNumber class]]); // TODO: multiline is not supported on views. return @0; } - (id)AXRangeForLine:(id)parameter { - DCHECK([parameter isKindOfClass:[NSNumber class]]); - DCHECK_EQ(0, [parameter intValue]); + if (![parameter isKindOfClass:[NSNumber class]] || [parameter intValue] != 0) + return nil; + return [NSValue valueWithRange:{0, [[self getAXValueAsString] length]}]; } - (id)AXStringForRange:(id)parameter { - DCHECK([parameter isKindOfClass:[NSValue class]]); + if (![parameter isKindOfClass:[NSValue class]] || + (0 != strcmp([parameter objCType], @encode(NSRange)))) + return nil; + return [[self getAXValueAsString] substringWithRange:[parameter rangeValue]]; } - (id)AXRangeForPosition:(id)parameter { - DCHECK([parameter isKindOfClass:[NSValue class]]); // TODO(tapted): Hit-test [parameter pointValue] and return an NSRange. NOTIMPLEMENTED(); return nil; } - (id)AXRangeForIndex:(id)parameter { - DCHECK([parameter isKindOfClass:[NSNumber class]]); NOTIMPLEMENTED(); return nil; } - (id)AXBoundsForRange:(id)parameter { - DCHECK([parameter isKindOfClass:[NSValue class]]); // TODO(tapted): Provide an accessor on AXPlatformNodeDelegate to obtain this // from ui::TextInputClient::GetCompositionCharacterBounds(). NOTIMPLEMENTED(); @@ -1282,20 +1282,23 @@ } - (id)AXRTFForRange:(id)parameter { - DCHECK([parameter isKindOfClass:[NSValue class]]); NOTIMPLEMENTED(); return nil; } - (id)AXStyleRangeForIndex:(id)parameter { - DCHECK([parameter isKindOfClass:[NSNumber class]]); + if (![parameter isKindOfClass:[NSNumber class]]) + return nil; + // TODO(https://crbug.com/958811): Implement this for real. return [NSValue valueWithRange:NSMakeRange(0, [self accessibilityNumberOfCharacters])]; } - (id)AXAttributedStringForRange:(id)parameter { - DCHECK([parameter isKindOfClass:[NSValue class]]); + if (![parameter isKindOfClass:[NSValue class]]) + return nil; + // TODO(https://crbug.com/958811): Implement this for real. base::scoped_nsobject<NSAttributedString> attributedString( [[NSAttributedString alloc]
diff --git a/ui/aura/client/drag_drop_delegate.cc b/ui/aura/client/drag_drop_delegate.cc index f7b0d4e8..cded1bf 100644 --- a/ui/aura/client/drag_drop_delegate.cc +++ b/ui/aura/client/drag_drop_delegate.cc
@@ -5,6 +5,7 @@ #include "ui/aura/client/drag_drop_delegate.h" #include "ui/base/class_property.h" +#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h" DEFINE_EXPORTED_UI_CLASS_PROPERTY_TYPE(AURA_EXPORT, aura::client::DragDropDelegate*) @@ -24,6 +25,12 @@ DEFINE_UI_CLASS_PROPERTY_KEY(DragDropDelegate*, kDragDropDelegateKey, nullptr) +ui::mojom::DragOperation DragDropDelegate::OnPerformDrop( + const ui::DropTargetEvent& event, + std::unique_ptr<ui::OSExchangeData> data) { + return ui::mojom::DragOperation::kNone; +} + void SetDragDropDelegate(Window* window, DragDropDelegate* delegate) { window->SetProperty(kDragDropDelegateKey, delegate); }
diff --git a/ui/aura/client/drag_drop_delegate.h b/ui/aura/client/drag_drop_delegate.h index 5f1eca3..47b49fd 100644 --- a/ui/aura/client/drag_drop_delegate.h +++ b/ui/aura/client/drag_drop_delegate.h
@@ -69,7 +69,7 @@ // instead. virtual ui::mojom::DragOperation OnPerformDrop( const ui::DropTargetEvent& event, - std::unique_ptr<ui::OSExchangeData> data) = 0; + std::unique_ptr<ui::OSExchangeData> data); // Invoked during a drag and drop session when the user release the mouse, but // the drop is held because of the DataTransferPolicyController.
diff --git a/ui/webui/resources/BUILD.gn b/ui/webui/resources/BUILD.gn index ec4255e..e7b1bc6 100644 --- a/ui/webui/resources/BUILD.gn +++ b/ui/webui/resources/BUILD.gn
@@ -204,6 +204,7 @@ tsconfig_base = "tsconfig_base.json" in_files = [ + "cr_elements/cr_a11y_announcer/cr_a11y_announcer.ts", "cr_components/iph_bubble/iph_bubble.ts", "cr_elements/cr_container_shadow_mixin.ts", "cr_elements/cr_nav_menu_item_style.ts", @@ -292,7 +293,6 @@ out_dir = preprocessed_folder js_files = [ "cr_elements/action_link_css.m.js", - "cr_elements/cr_a11y_announcer/cr_a11y_announcer.js", "cr_elements/cr_actionable_row_style.m.js", "cr_elements/cr_fingerprint/cr_fingerprint_icon.m.js", "cr_elements/cr_grid/cr_grid.js",
diff --git a/ui/webui/resources/cr_elements/BUILD.gn b/ui/webui/resources/cr_elements/BUILD.gn index b06a480..49670fcd 100644 --- a/ui/webui/resources/cr_elements/BUILD.gn +++ b/ui/webui/resources/cr_elements/BUILD.gn
@@ -135,7 +135,7 @@ out_manifest = "$target_gen_dir/$preprocess_gen_manifest" in_files = [ "action_link_css.m.js", - "cr_a11y_announcer/cr_a11y_announcer.js", + "cr_a11y_announcer/cr_a11y_announcer.ts", "cr_actionable_row_style.m.js", "cr_action_menu/cr_action_menu.js", "cr_button/cr_button.m.js", @@ -228,7 +228,6 @@ # Targets for auto-generated Polymer 3 JS Modules ":cr_elements_module_resources", - "cr_a11y_announcer:closure_compile", "cr_action_menu:closure_compile_module", "cr_button:closure_compile_module", "cr_checkbox:closure_compile_module",
diff --git a/ui/webui/resources/cr_elements/cr_a11y_announcer/BUILD.gn b/ui/webui/resources/cr_elements/cr_a11y_announcer/BUILD.gn index 855a763f..f433dde0 100644 --- a/ui/webui/resources/cr_elements/cr_a11y_announcer/BUILD.gn +++ b/ui/webui/resources/cr_elements/cr_a11y_announcer/BUILD.gn
@@ -2,21 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//third_party/closure_compiler/compile_js.gni") import("//tools/polymer/html_to_js.gni") html_to_js("web_components") { - js_files = [ "cr_a11y_announcer.js" ] -} - -js_type_check("closure_compile") { - is_polymer3 = true - deps = [ ":cr_a11y_announcer" ] -} - -js_library("cr_a11y_announcer") { - deps = [ - "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", - "//ui/webui/resources/js:assert.m", - ] + js_files = [ "cr_a11y_announcer.ts" ] }
diff --git a/ui/webui/resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js b/ui/webui/resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.ts similarity index 81% rename from ui/webui/resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js rename to ui/webui/resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.ts index 22116d2d..e018f7c4 100644 --- a/ui/webui/resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.js +++ b/ui/webui/resources/cr_elements/cr_a11y_announcer/cr_a11y_announcer.ts
@@ -14,9 +14,8 @@ /** * 150ms seems to be around the minimum time required for screen readers to * read out consecutively queued messages. - * @type {number} */ -export const TIMEOUT_MS = 150; +export const TIMEOUT_MS: number = 150; /** * A map of an HTML element to its corresponding CrA11yAnnouncerElement. There @@ -24,9 +23,8 @@ * which the DocumentElement's CrA11yAnnouncerElement becomes hidden or * deactivated (eg. when a modal dialog causes the CrA11yAnnouncerElement to * become inaccessible). - * @type {!Map<!HTMLElement, !CrA11yAnnouncerElement>} */ -const instances = new Map(); +const instances: Map<HTMLElement, CrA11yAnnouncerElement> = new Map(); export class CrA11yAnnouncerElement extends PolymerElement { static get is() { @@ -37,15 +35,8 @@ return html`{__html_template__}`; } - constructor() { - super(); - - /** @private {?number} */ - this.currentTimeout_ = null; - - /** @private {!Array<string>} */ - this.messages_ = []; - } + private currentTimeout_: number|null = null; + private messages_: string[] = []; disconnectedCallback() { super.disconnectedCallback(); @@ -62,8 +53,7 @@ } } - /** @param {string} message */ - announce(message) { + announce(message: string) { if (this.currentTimeout_ !== null) { clearTimeout(this.currentTimeout_); this.currentTimeout_ = null; @@ -72,7 +62,7 @@ this.messages_.push(message); this.currentTimeout_ = setTimeout(() => { - const messagesDiv = this.shadowRoot.querySelector('#messages'); + const messagesDiv = this.shadowRoot!.querySelector('#messages')!; messagesDiv.innerHTML = ''; // <if expr="is_macosx"> @@ -94,13 +84,10 @@ }, TIMEOUT_MS); } - /** - * @param {!HTMLElement=} container - * @return {!CrA11yAnnouncerElement} - */ - static getInstance(container = document.body) { + static getInstance(container: HTMLElement = document.body): + CrA11yAnnouncerElement { if (instances.has(container)) { - return instances.get(container); + return instances.get(container)!; } assert(container.isConnected); const instance = new CrA11yAnnouncerElement();
diff --git a/ui/webui/resources/js/browser_command/browser_command.mojom b/ui/webui/resources/js/browser_command/browser_command.mojom index 90bf4dda..4da7021 100644 --- a/ui/webui/resources/js/browser_command/browser_command.mojom +++ b/ui/webui/resources/js/browser_command/browser_command.mojom
@@ -19,6 +19,7 @@ kOpenSafetyCheck = 1, kOpenSafeBrowsingEnhancedProtectionSettings = 2, kOpenFeedbackForm = 3, + kOpenPrivacyReview = 4, }; // Click information needed to determine user's desired window disposition using
diff --git a/weblayer/browser/android/javatests/skew/expectations.txt b/weblayer/browser/android/javatests/skew/expectations.txt index f235719b..ba796a08f 100644 --- a/weblayer/browser/android/javatests/skew/expectations.txt +++ b/weblayer/browser/android/javatests/skew/expectations.txt
@@ -90,3 +90,8 @@ crbug.com/1191751 [ all ] org.chromium.weblayer.test.NavigationTest#testIsFormSubmission [ Skip ] crbug.com/1191751 [ all ] org.chromium.weblayer.test.TabCallbackTest#testOnRenderProcessGone [ Skip ] crbug.com/1191751 [ all ] org.chromium.weblayer.test.ScrollOffsetCallbackTest#testBasic [ Skip ] + +# In 98 we changed the implementation to have navigations succeed rather than +# fail in this case. Unfortunately there is no way to skip tests based on +# the impl being >= a given version. +crbug.com/1233480 [ all ] org.chromium.weblayer.test.NavigationTest#testInitialRendererInitiatedNavigationToAboutBlankFails [ Skip ]
diff --git a/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/NavigationTest.java b/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/NavigationTest.java index 75ab2ffa..c627c36 100644 --- a/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/NavigationTest.java +++ b/weblayer/browser/android/javatests/src/org/chromium/weblayer/test/NavigationTest.java
@@ -698,15 +698,14 @@ } /** - * This test verifies that initial renderer-initiated navigations to about:blank in WebLayer get - * marked as failing due to the fact that such navigations are not committed within //content. - * It additionally verifies that calling Navigation#getPage() on such a failed navigation raises - * an exception rather than crashing the browser (regression test for crbug.com/1233480). + * This is a regression test for crbug.com/1233480, adapted for a change in + * //content to have such navigations commit rather than fail. It also + * should not crash nor throw an exception. */ - @MinWebLayerVersion(96) + @MinWebLayerVersion(98) @Test @SmallTest - public void testInitialRendererInitiatedNavigationToAboutBlankFails() throws Exception { + public void testInitialRendererInitiatedNavigationToAboutBlankSucceeds() throws Exception { InstrumentationActivity activity = mActivityTestRule.launchShellWithUrl(URL1); // Setup a callback for when the navigation in a new tab fails. @@ -717,13 +716,10 @@ NavigationController navigationController = tab.getNavigationController(); navigationController.registerNavigationCallback(new NavigationCallback() { @Override - public void onNavigationFailed(Navigation navigation) { - assertEquals(NavigationState.FAILED, navigation.getState()); - - // Calling Navigation#getPage() should throw an exception here because the - // navigation has not committed. - assertThrows(IllegalStateException.class, () -> { navigation.getPage(); }); - + public void onNavigationCompleted(Navigation navigation) { + assertEquals(NavigationState.COMPLETE, navigation.getState()); + // There should be a valid page for this navigation. + assertNotNull(navigation.getPage()); navigationController.unregisterNavigationCallback(this); callbackHelper.notifyCalled(); }