diff --git a/DEPS b/DEPS index 9db82fb..9b9b53a 100644 --- a/DEPS +++ b/DEPS
@@ -245,15 +245,15 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '0cfc76a0dd82d43b4ba0241d76250187ee75118c', + 'skia_revision': '2c2e4313adca2fb9ed85df0218c738cf52bf57d7', # 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': 'e44c84d7815a1124e3a0e4f82172b9acb2bef738', + 'v8_revision': '0a12473af5dfeabb6626bd558d5dc866f16cdb6a', # 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': '2ad5f350c55575d73585e47ee2f50e90035cc4ec', + 'angle_revision': '322d118fca1fde1439dfac9a234a791ac610c54b', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. @@ -276,7 +276,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling googletest # and whatever else without interference from each other. - 'googletest_revision': 'f45d5865ed0b2b8912244627cdf508a24cc6ccb4', + 'googletest_revision': '0b7798b2fba340969a0cf83698e5c0a2e25b7dbc', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling lighttpd # and whatever else without interference from each other. @@ -320,7 +320,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': 'd8e38badf3d8c1edf91a8a2f606e7816f7d06d0f', + 'devtools_frontend_revision': 'd2b8719629b8aecb383f5644542b3bdf7d31a7cc', # 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. @@ -360,7 +360,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': '153d1cfecee566aa2e2729a1bcbf14c3db369aff', + 'dawn_revision': '913e158429f49b6291e07775a63bb340b2f09c60', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -663,7 +663,7 @@ Var('chromium_git') + '/external/github.com/toji/webvr.info.git' + '@' + 'c58ae99b9ff9e2aa4c524633519570bf33536248', 'src/docs/website': { - 'url': Var('chromium_git') + '/website.git' + '@' + '6d85be91ee86cf0727cacc8a772f4089d15bb9f9', + 'url': Var('chromium_git') + '/website.git' + '@' + 'd3e8789ea703ef617c51a36afe8c5dd1348b1a74', }, 'src/ios/third_party/earl_grey2/src': { @@ -1473,7 +1473,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'a0de991bf39c5744ab4eef00eae823c378eb99a9', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '383df8c3092e183e0335ba3f1c502cc660c523dc', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1551,7 +1551,7 @@ 'packages': [ { 'package': 'fuchsia/third_party/android/aemu/release/linux-amd64', - 'version': 'e5Q0UxHa8O_iRh03VkvfCD6y--2jZGzwluCDMQXLG4AC' + 'version': 'Ea-MmVNtNTqZyinCufB9t1a9bhgxSk4eLHIfYMTuWnkC' }, ], 'condition': 'host_os == "linux" and checkout_fuchsia', @@ -1655,7 +1655,7 @@ 'src/third_party/usrsctp/usrsctplib': Var('chromium_git') + '/external/github.com/sctplab/usrsctp' + '@' + '62d7d0c928c9a040dce96aa2f16c00e7e67d59cb', - 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@0ce8f86158f9b2bbcb96b66c324e26c5e7110af1', + 'src/third_party/vulkan-deps': '{chromium_git}/vulkan-deps@a19b5047ffcafc95fcba3f39e53f229acca6debc', 'src/third_party/vulkan_memory_allocator': Var('chromium_git') + '/external/github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git' + '@' + 'ebe84bec02c041d28f902da0214bf442743fc907', @@ -1764,7 +1764,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@03056849eb5d6a1ced7b6f1f42e93cb70da6ced6', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@9a6b4cc0b53de057dc9857c0d4bbda024e925d86', 'condition': 'checkout_src_internal', }, @@ -1816,7 +1816,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/projector_app/app', - 'version': 'lN2RmDzg5XcS3fEvwu0EFjT-tHv5PEhaiJOvhpcRSn0C', + 'version': 't4dGdnA-BcnbOT333rLjDQOQKMqkxXFOOu-N4d4r6b4C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/ash/components/phonehub/DEPS b/ash/components/phonehub/DEPS index ababe15e..4385117 100644 --- a/ash/components/phonehub/DEPS +++ b/ash/components/phonehub/DEPS
@@ -1,7 +1,6 @@ include_rules = [ "+chromeos/services/device_sync/public/cpp", "+chromeos/services/network_config/in_process_instance.h", - "+chromeos/services/secure_channel/public", "+components/keyed_service/core/keyed_service.h", "+components/session_manager/core", ]
diff --git a/ash/components/phonehub/camera_roll_download_manager.h b/ash/components/phonehub/camera_roll_download_manager.h index 33cfec7..d7abaf12 100644 --- a/ash/components/phonehub/camera_roll_download_manager.h +++ b/ash/components/phonehub/camera_roll_download_manager.h
@@ -6,8 +6,8 @@ #define ASH_COMPONENTS_PHONEHUB_CAMERA_ROLL_DOWNLOAD_MANAGER_H_ #include "ash/components/phonehub/proto/phonehub_api.pb.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace ash {
diff --git a/ash/components/phonehub/camera_roll_manager_impl.cc b/ash/components/phonehub/camera_roll_manager_impl.cc index cd7024a5..d8c5200 100644 --- a/ash/components/phonehub/camera_roll_manager_impl.cc +++ b/ash/components/phonehub/camera_roll_manager_impl.cc
@@ -15,13 +15,13 @@ #include "ash/components/phonehub/pref_names.h" #include "ash/components/phonehub/proto/phonehub_api.pb.h" #include "ash/components/phonehub/util/histogram_util.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/memory/weak_ptr.h" #include "base/metrics/histogram_functions.h" #include "base/observer_list.h" #include "base/time/time.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/ash/components/phonehub/camera_roll_manager_impl.h b/ash/components/phonehub/camera_roll_manager_impl.h index 8dee04f2..5383e3d 100644 --- a/ash/components/phonehub/camera_roll_manager_impl.h +++ b/ash/components/phonehub/camera_roll_manager_impl.h
@@ -12,14 +12,14 @@ #include "ash/components/phonehub/camera_roll_thumbnail_decoder.h" #include "ash/components/phonehub/message_receiver.h" #include "ash/components/phonehub/proto/phonehub_api.pb.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/observer_list_types.h" #include "base/time/time.h" #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" #include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" class PrefRegistrySimple;
diff --git a/ash/components/phonehub/camera_roll_manager_impl_unittest.cc b/ash/components/phonehub/camera_roll_manager_impl_unittest.cc index 3e6b7b2..4bc5460 100644 --- a/ash/components/phonehub/camera_roll_manager_impl_unittest.cc +++ b/ash/components/phonehub/camera_roll_manager_impl_unittest.cc
@@ -12,6 +12,8 @@ #include "ash/components/phonehub/fake_message_sender.h" #include "ash/components/phonehub/pref_names.h" #include "ash/components/phonehub/proto/phonehub_api.pb.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" @@ -19,8 +21,6 @@ #include "base/time/time.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" #include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/prefs/testing_pref_service.h"
diff --git a/ash/components/phonehub/connection_scheduler_impl.cc b/ash/components/phonehub/connection_scheduler_impl.cc index 3083e7a0..3eb85659 100644 --- a/ash/components/phonehub/connection_scheduler_impl.cc +++ b/ash/components/phonehub/connection_scheduler_impl.cc
@@ -5,10 +5,10 @@ #include "ash/components/phonehub/connection_scheduler_impl.h" #include "ash/components/phonehub/feature_status.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" #include "base/bind.h" #include "base/threading/sequenced_task_runner_handle.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" namespace ash { namespace phonehub {
diff --git a/ash/components/phonehub/connection_scheduler_impl.h b/ash/components/phonehub/connection_scheduler_impl.h index 30bd1b1..d6df299 100644 --- a/ash/components/phonehub/connection_scheduler_impl.h +++ b/ash/components/phonehub/connection_scheduler_impl.h
@@ -8,10 +8,10 @@ #include "ash/components/phonehub/connection_scheduler.h" #include "ash/components/phonehub/feature_status.h" #include "ash/components/phonehub/feature_status_provider.h" +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" -// TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" #include "net/base/backoff_entry.h" namespace ash {
diff --git a/ash/components/phonehub/connection_scheduler_impl_unittest.cc b/ash/components/phonehub/connection_scheduler_impl_unittest.cc index 60335cf..320e8e2f 100644 --- a/ash/components/phonehub/connection_scheduler_impl_unittest.cc +++ b/ash/components/phonehub/connection_scheduler_impl_unittest.cc
@@ -8,9 +8,9 @@ #include "ash/components/phonehub/fake_feature_status_provider.h" #include "ash/components/phonehub/feature_status.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "base/test/task_environment.h" #include "base/time/time.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "testing/gtest/include/gtest/gtest.h" namespace ash {
diff --git a/ash/components/phonehub/cros_state_sender.h b/ash/components/phonehub/cros_state_sender.h index d97af91b..313e4868 100644 --- a/ash/components/phonehub/cros_state_sender.h +++ b/ash/components/phonehub/cros_state_sender.h
@@ -5,9 +5,9 @@ #ifndef ASH_COMPONENTS_PHONEHUB_CROS_STATE_SENDER_H_ #define ASH_COMPONENTS_PHONEHUB_CROS_STATE_SENDER_H_ +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" #include "base/timer/timer.h" #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" namespace ash { namespace phonehub {
diff --git a/ash/components/phonehub/cros_state_sender_unittest.cc b/ash/components/phonehub/cros_state_sender_unittest.cc index f9146b2..1b854746 100644 --- a/ash/components/phonehub/cros_state_sender_unittest.cc +++ b/ash/components/phonehub/cros_state_sender_unittest.cc
@@ -9,9 +9,9 @@ #include "ash/components/phonehub/fake_message_sender.h" #include "ash/components/phonehub/mutable_phone_model.h" #include "ash/components/phonehub/phone_model_test_util.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "base/timer/mock_timer.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "testing/gtest/include/gtest/gtest.h" namespace ash {
diff --git a/ash/components/phonehub/fake_camera_roll_download_manager.cc b/ash/components/phonehub/fake_camera_roll_download_manager.cc index 91e130d..97f5b3b 100644 --- a/ash/components/phonehub/fake_camera_roll_download_manager.cc +++ b/ash/components/phonehub/fake_camera_roll_download_manager.cc
@@ -9,8 +9,8 @@ #include "ash/components/phonehub/camera_roll_download_manager.h" #include "ash/components/phonehub/proto/phonehub_api.pb.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/containers/flat_map.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace ash {
diff --git a/ash/components/phonehub/fake_camera_roll_download_manager.h b/ash/components/phonehub/fake_camera_roll_download_manager.h index 157d747..abb062c 100644 --- a/ash/components/phonehub/fake_camera_roll_download_manager.h +++ b/ash/components/phonehub/fake_camera_roll_download_manager.h
@@ -9,8 +9,8 @@ #include "ash/components/phonehub/camera_roll_download_manager.h" #include "ash/components/phonehub/proto/phonehub_api.pb.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/containers/flat_map.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace ash { namespace phonehub {
diff --git a/ash/components/phonehub/feature_status_provider_impl.h b/ash/components/phonehub/feature_status_provider_impl.h index 1963b49c..3a9c086d 100644 --- a/ash/components/phonehub/feature_status_provider_impl.h +++ b/ash/components/phonehub/feature_status_provider_impl.h
@@ -6,12 +6,12 @@ #define ASH_COMPONENTS_PHONEHUB_FEATURE_STATUS_PROVIDER_IMPL_H_ #include "ash/components/phonehub/feature_status_provider.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" #include "components/session_manager/core/session_manager.h" #include "components/session_manager/core/session_manager_observer.h" #include "device/bluetooth/bluetooth_adapter.h"
diff --git a/ash/components/phonehub/feature_status_provider_impl_unittest.cc b/ash/components/phonehub/feature_status_provider_impl_unittest.cc index f41c927..3ceb2e3 100644 --- a/ash/components/phonehub/feature_status_provider_impl_unittest.cc +++ b/ash/components/phonehub/feature_status_provider_impl_unittest.cc
@@ -7,13 +7,13 @@ #include <memory> #include <vector> +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "base/test/task_environment.h" #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/dbus/power/fake_power_manager_client.h" #include "chromeos/dbus/power/power_manager_client.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "components/session_manager/core/session_manager.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h"
diff --git a/ash/components/phonehub/invalid_connection_disconnector.h b/ash/components/phonehub/invalid_connection_disconnector.h index 44e8099..fcd2753 100644 --- a/ash/components/phonehub/invalid_connection_disconnector.h +++ b/ash/components/phonehub/invalid_connection_disconnector.h
@@ -5,7 +5,7 @@ #ifndef ASH_COMPONENTS_PHONEHUB_INVALID_CONNECTION_DISCONNECTOR_H_ #define ASH_COMPONENTS_PHONEHUB_INVALID_CONNECTION_DISCONNECTOR_H_ -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" namespace base { class OneShotTimer;
diff --git a/ash/components/phonehub/invalid_connection_disconnector_unittest.cc b/ash/components/phonehub/invalid_connection_disconnector_unittest.cc index 9ef87ce..981ee1b3 100644 --- a/ash/components/phonehub/invalid_connection_disconnector_unittest.cc +++ b/ash/components/phonehub/invalid_connection_disconnector_unittest.cc
@@ -6,9 +6,9 @@ #include "ash/components/phonehub/mutable_phone_model.h" #include "ash/components/phonehub/phone_model_test_util.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "base/memory/ptr_util.h" #include "base/timer/mock_timer.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "testing/gtest/include/gtest/gtest.h" namespace ash {
diff --git a/ash/components/phonehub/message_receiver_impl.h b/ash/components/phonehub/message_receiver_impl.h index cbf0bb95..9e54d526 100644 --- a/ash/components/phonehub/message_receiver_impl.h +++ b/ash/components/phonehub/message_receiver_impl.h
@@ -7,7 +7,7 @@ #include "ash/components/phonehub/message_receiver.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" namespace ash { namespace phonehub {
diff --git a/ash/components/phonehub/message_receiver_unittest.cc b/ash/components/phonehub/message_receiver_unittest.cc index 9991f94..e70e91f 100644 --- a/ash/components/phonehub/message_receiver_unittest.cc +++ b/ash/components/phonehub/message_receiver_unittest.cc
@@ -9,9 +9,9 @@ #include "ash/components/phonehub/proto/phonehub_api.pb.h" #include "ash/constants/ash_features.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "base/strings/strcat.h" #include "base/test/scoped_feature_list.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "testing/gtest/include/gtest/gtest.h" namespace ash {
diff --git a/ash/components/phonehub/message_sender_impl.cc b/ash/components/phonehub/message_sender_impl.cc index 8b32c96..f70944e 100644 --- a/ash/components/phonehub/message_sender_impl.cc +++ b/ash/components/phonehub/message_sender_impl.cc
@@ -7,10 +7,10 @@ #include <netinet/in.h> #include "ash/components/phonehub/util/histogram_util.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" #include "base/metrics/histogram_macros.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" namespace ash { namespace phonehub {
diff --git a/ash/components/phonehub/message_sender_impl.h b/ash/components/phonehub/message_sender_impl.h index 8a16735..248d985 100644 --- a/ash/components/phonehub/message_sender_impl.h +++ b/ash/components/phonehub/message_sender_impl.h
@@ -12,7 +12,7 @@ #include "ash/components/phonehub/proto/phonehub_api.pb.h" // TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" namespace ash { namespace phonehub {
diff --git a/ash/components/phonehub/message_sender_unittest.cc b/ash/components/phonehub/message_sender_unittest.cc index c12a9e6..57ad0c8 100644 --- a/ash/components/phonehub/message_sender_unittest.cc +++ b/ash/components/phonehub/message_sender_unittest.cc
@@ -10,9 +10,9 @@ #include <string> #include "ash/components/phonehub/proto/phonehub_api.pb.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "testing/gtest/include/gtest/gtest.h" namespace ash {
diff --git a/ash/components/phonehub/phone_hub_manager_impl.cc b/ash/components/phonehub/phone_hub_manager_impl.cc index 813c0e9..b0cbc73 100644 --- a/ash/components/phonehub/phone_hub_manager_impl.cc +++ b/ash/components/phonehub/phone_hub_manager_impl.cc
@@ -31,8 +31,8 @@ #include "ash/components/phonehub/tether_controller_impl.h" #include "ash/components/phonehub/user_action_recorder_impl.h" #include "ash/constants/ash_features.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager_impl.h" #include "chromeos/dbus/power/power_manager_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.h" #include "components/session_manager/core/session_manager.h" namespace ash {
diff --git a/ash/components/phonehub/phone_hub_manager_impl.h b/ash/components/phonehub/phone_hub_manager_impl.h index 9662f39..d8314d4 100644 --- a/ash/components/phonehub/phone_hub_manager_impl.h +++ b/ash/components/phonehub/phone_hub_manager_impl.h
@@ -8,15 +8,15 @@ #include <memory> #include "ash/components/phonehub/phone_hub_manager.h" +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/callback.h" // TODO(https://crbug.com/1164001): move to forward declaration. #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" // TODO(https://crbug.com/1164001): move to forward declaration. #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" -// TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "components/keyed_service/core/keyed_service.h" class PrefService;
diff --git a/ash/components/proximity_auth/fake_remote_device_life_cycle.h b/ash/components/proximity_auth/fake_remote_device_life_cycle.h index 92356dc..1288902 100644 --- a/ash/components/proximity_auth/fake_remote_device_life_cycle.h +++ b/ash/components/proximity_auth/fake_remote_device_life_cycle.h
@@ -6,10 +6,11 @@ #define ASH_COMPONENTS_PROXIMITY_AUTH_FAKE_REMOTE_DEVICE_LIFE_CYCLE_H_ #include "ash/components/proximity_auth/remote_device_life_cycle.h" +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" #include "base/observer_list.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/services/secure_channel/fake_connection.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" namespace proximity_auth {
diff --git a/ash/components/proximity_auth/messenger_impl.h b/ash/components/proximity_auth/messenger_impl.h index 6a90bc86..c6a2a7e6 100644 --- a/ash/components/proximity_auth/messenger_impl.h +++ b/ash/components/proximity_auth/messenger_impl.h
@@ -8,10 +8,10 @@ #include <memory> #include "ash/components/proximity_auth/messenger.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" #include "base/containers/circular_deque.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" namespace base { class DictionaryValue;
diff --git a/ash/components/proximity_auth/messenger_impl_unittest.cc b/ash/components/proximity_auth/messenger_impl_unittest.cc index a643ae5..eb34e5d6 100644 --- a/ash/components/proximity_auth/messenger_impl_unittest.cc +++ b/ash/components/proximity_auth/messenger_impl_unittest.cc
@@ -8,11 +8,11 @@ #include "ash/components/proximity_auth/messenger_observer.h" #include "ash/components/proximity_auth/remote_status_update.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "base/callback.h" #include "base/test/scoped_feature_list.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/remote_device_test_util.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/ash/components/proximity_auth/proximity_auth_system.cc b/ash/components/proximity_auth/proximity_auth_system.cc index 6e978d30..1844f2a 100644 --- a/ash/components/proximity_auth/proximity_auth_system.cc +++ b/ash/components/proximity_auth/proximity_auth_system.cc
@@ -7,8 +7,8 @@ #include "ash/components/proximity_auth/proximity_auth_client.h" #include "ash/components/proximity_auth/remote_device_life_cycle_impl.h" #include "ash/components/proximity_auth/unlock_manager_impl.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace proximity_auth {
diff --git a/ash/components/proximity_auth/proximity_auth_system_unittest.cc b/ash/components/proximity_auth/proximity_auth_system_unittest.cc index c108d25b..f0b1ef037 100644 --- a/ash/components/proximity_auth/proximity_auth_system_unittest.cc +++ b/ash/components/proximity_auth/proximity_auth_system_unittest.cc
@@ -11,6 +11,7 @@ #include "ash/components/proximity_auth/mock_proximity_auth_client.h" #include "ash/components/proximity_auth/proximity_auth_profile_pref_manager.h" #include "ash/components/proximity_auth/unlock_manager.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/command_line.h" #include "base/test/scoped_feature_list.h" #include "base/test/test_simple_task_runner.h" @@ -20,7 +21,6 @@ #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/components/multidevice/software_feature_state.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/ash/components/proximity_auth/proximity_monitor_impl.cc b/ash/components/proximity_auth/proximity_monitor_impl.cc index a1d434c..2b7a48a 100644 --- a/ash/components/proximity_auth/proximity_monitor_impl.cc +++ b/ash/components/proximity_auth/proximity_monitor_impl.cc
@@ -10,11 +10,11 @@ #include <utility> #include "ash/components/proximity_auth/metrics.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" #include "base/bind.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_adapter_factory.h"
diff --git a/ash/components/proximity_auth/proximity_monitor_impl.h b/ash/components/proximity_auth/proximity_monitor_impl.h index 95938f0..679bf20 100644 --- a/ash/components/proximity_auth/proximity_monitor_impl.h +++ b/ash/components/proximity_auth/proximity_monitor_impl.h
@@ -8,9 +8,9 @@ #include <memory> #include "ash/components/proximity_auth/proximity_monitor.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/memory/weak_ptr.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "device/bluetooth/bluetooth_device.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/ash/components/proximity_auth/proximity_monitor_impl_unittest.cc b/ash/components/proximity_auth/proximity_monitor_impl_unittest.cc index 3e7d1e4..71a2f07 100644 --- a/ash/components/proximity_auth/proximity_monitor_impl_unittest.cc +++ b/ash/components/proximity_auth/proximity_monitor_impl_unittest.cc
@@ -8,6 +8,7 @@ #include <utility> #include "ash/components/proximity_auth/proximity_monitor_observer.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "base/memory/ptr_util.h" #include "base/memory/ref_counted.h" #include "base/test/gmock_move_support.h" @@ -23,7 +24,6 @@ #include "chromeos/components/multidevice/software_feature_state.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" #include "chromeos/services/secure_channel/fake_connection.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/ash/components/proximity_auth/remote_device_life_cycle_impl.cc b/ash/components/proximity_auth/remote_device_life_cycle_impl.cc index 452ea5ea..35676d6 100644 --- a/ash/components/proximity_auth/remote_device_life_cycle_impl.cc +++ b/ash/components/proximity_auth/remote_device_life_cycle_impl.cc
@@ -7,11 +7,11 @@ #include <memory> #include "ash/components/proximity_auth/messenger_impl.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/bind.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace proximity_auth {
diff --git a/ash/components/proximity_auth/remote_device_life_cycle_impl.h b/ash/components/proximity_auth/remote_device_life_cycle_impl.h index 30a6cc56..8e7bb9b 100644 --- a/ash/components/proximity_auth/remote_device_life_cycle_impl.h +++ b/ash/components/proximity_auth/remote_device_life_cycle_impl.h
@@ -9,13 +9,13 @@ #include "ash/components/proximity_auth/messenger_observer.h" #include "ash/components/proximity_auth/remote_device_life_cycle.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" #include "base/timer/timer.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" namespace chromeos { namespace secure_channel {
diff --git a/ash/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc b/ash/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc index 89aaa7e..247850f 100644 --- a/ash/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc +++ b/ash/components/proximity_auth/remote_device_life_cycle_impl_unittest.cc
@@ -10,15 +10,15 @@ #include <utility> #include "ash/components/proximity_auth/messenger.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/callback.h" #include "base/test/scoped_feature_list.h" #include "base/test/test_simple_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/remote_device_test_util.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" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/ash/components/proximity_auth/unlock_manager_impl.cc b/ash/components/proximity_auth/unlock_manager_impl.cc index 24ef20c..425a190 100644 --- a/ash/components/proximity_auth/unlock_manager_impl.cc +++ b/ash/components/proximity_auth/unlock_manager_impl.cc
@@ -10,6 +10,7 @@ #include "ash/components/proximity_auth/metrics.h" #include "ash/components/proximity_auth/proximity_auth_client.h" #include "ash/components/proximity_auth/proximity_monitor_impl.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" #include "base/bind.h" #include "base/logging.h" #include "base/metrics/histogram_functions.h" @@ -19,7 +20,6 @@ #include "base/timer/timer.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" #include "device/bluetooth/bluetooth_adapter_factory.h" namespace proximity_auth {
diff --git a/ash/components/proximity_auth/unlock_manager_impl.h b/ash/components/proximity_auth/unlock_manager_impl.h index 65140e8..87b50d7 100644 --- a/ash/components/proximity_auth/unlock_manager_impl.h +++ b/ash/components/proximity_auth/unlock_manager_impl.h
@@ -14,12 +14,12 @@ #include "ash/components/proximity_auth/smart_lock_metrics_recorder.h" #include "ash/components/proximity_auth/unlock_manager.h" #include "ash/public/cpp/smartlock_state.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "build/build_config.h" #include "chromeos/dbus/power/power_manager_client.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "device/bluetooth/bluetooth_adapter.h" namespace base {
diff --git a/ash/components/proximity_auth/unlock_manager_impl_unittest.cc b/ash/components/proximity_auth/unlock_manager_impl_unittest.cc index 19e6008..f67fc80 100644 --- a/ash/components/proximity_auth/unlock_manager_impl_unittest.cc +++ b/ash/components/proximity_auth/unlock_manager_impl_unittest.cc
@@ -14,6 +14,7 @@ #include "ash/components/proximity_auth/proximity_monitor.h" #include "ash/components/proximity_auth/remote_device_life_cycle.h" #include "ash/components/proximity_auth/remote_status_update.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "base/memory/ref_counted.h" #include "base/test/gmock_callback_support.h" #include "base/test/scoped_feature_list.h" @@ -26,7 +27,6 @@ #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" -#include "chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h" #include "device/bluetooth/bluetooth_adapter_factory.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/ash/components/tether/DEPS b/ash/components/tether/DEPS index e88de91d..1bac222 100644 --- a/ash/components/tether/DEPS +++ b/ash/components/tether/DEPS
@@ -1,9 +1,5 @@ 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/proximity_auth/logging", "+components/session_manager/core", "+components/sync_preferences",
diff --git a/ash/components/tether/asynchronous_shutdown_object_container_impl.cc b/ash/components/tether/asynchronous_shutdown_object_container_impl.cc index 1b2a734f..9b5c048 100644 --- a/ash/components/tether/asynchronous_shutdown_object_container_impl.cc +++ b/ash/components/tether/asynchronous_shutdown_object_container_impl.cc
@@ -7,9 +7,9 @@ #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 "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/memory/ptr_util.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace ash {
diff --git a/ash/components/tether/asynchronous_shutdown_object_container_impl.h b/ash/components/tether/asynchronous_shutdown_object_container_impl.h index 42ac401..bd413f5 100644 --- a/ash/components/tether/asynchronous_shutdown_object_container_impl.h +++ b/ash/components/tether/asynchronous_shutdown_object_container_impl.h
@@ -9,6 +9,8 @@ #include "ash/components/tether/asynchronous_shutdown_object_container.h" #include "ash/components/tether/disconnect_tethering_request_sender.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/callback.h" #include "base/memory/ref_counted.h" // TODO(https://crbug.com/1164001): move to forward declaration @@ -19,8 +21,6 @@ #include "chromeos/network/network_state_handler.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" class PrefService;
diff --git a/ash/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc b/ash/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc index a57d8be..ce3bce06b 100644 --- a/ash/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc +++ b/ash/components/tether/asynchronous_shutdown_object_container_impl_unittest.cc
@@ -9,6 +9,7 @@ #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 "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/test/task_environment.h" @@ -16,7 +17,6 @@ #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" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/ash/components/tether/connect_tethering_operation.h b/ash/components/tether/connect_tethering_operation.h index 25b6a087..3ea4fc3 100644 --- a/ash/components/tether/connect_tethering_operation.h +++ b/ash/components/tether/connect_tethering_operation.h
@@ -11,6 +11,8 @@ #include <vector> #include "ash/components/tether/message_transfer_operation.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/gtest_prod_util.h" #include "base/observer_list.h" #include "base/time/clock.h" @@ -18,8 +20,6 @@ #include "chromeos/components/multidevice/remote_device_ref.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace ash {
diff --git a/ash/components/tether/connect_tethering_operation_unittest.cc b/ash/components/tether/connect_tethering_operation_unittest.cc index 60f8322..8d6ef9b 100644 --- a/ash/components/tether/connect_tethering_operation_unittest.cc +++ b/ash/components/tether/connect_tethering_operation_unittest.cc
@@ -12,6 +12,9 @@ #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 "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/simple_test_clock.h" @@ -20,9 +23,6 @@ #include "base/timer/mock_timer.h" #include "chromeos/components/multidevice/remote_device_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" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/ash/components/tether/connection_preserver_impl.h b/ash/components/tether/connection_preserver_impl.h index 5340772b..b772099 100644 --- a/ash/components/tether/connection_preserver_impl.h +++ b/ash/components/tether/connection_preserver_impl.h
@@ -9,16 +9,16 @@ #include "ash/components/tether/active_host.h" #include "ash/components/tether/connection_preserver.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/timer/timer.h" #include "base/unguessable_token.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/network/network_state_handler.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" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" namespace ash {
diff --git a/ash/components/tether/connection_preserver_impl_unittest.cc b/ash/components/tether/connection_preserver_impl_unittest.cc index ed94b49..f731c7e 100644 --- a/ash/components/tether/connection_preserver_impl_unittest.cc +++ b/ash/components/tether/connection_preserver_impl_unittest.cc
@@ -9,6 +9,10 @@ #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 "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/base64.h" #include "base/bind.h" #include "base/memory/ptr_util.h" @@ -19,10 +23,6 @@ #include "chromeos/network/network_state_handler.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_client_channel.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/cros_system_api/dbus/service_constants.h"
diff --git a/ash/components/tether/disconnect_tethering_operation.h b/ash/components/tether/disconnect_tethering_operation.h index 1324b96..0c6cc67d 100644 --- a/ash/components/tether/disconnect_tethering_operation.h +++ b/ash/components/tether/disconnect_tethering_operation.h
@@ -6,13 +6,13 @@ #define ASH_COMPONENTS_TETHER_DISCONNECT_TETHERING_OPERATION_H_ #include "ash/components/tether/message_transfer_operation.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/gtest_prod_util.h" #include "base/observer_list.h" #include "base/time/clock.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace ash {
diff --git a/ash/components/tether/disconnect_tethering_operation_unittest.cc b/ash/components/tether/disconnect_tethering_operation_unittest.cc index 392288c..dbe9134 100644 --- a/ash/components/tether/disconnect_tethering_operation_unittest.cc +++ b/ash/components/tether/disconnect_tethering_operation_unittest.cc
@@ -10,6 +10,9 @@ #include "ash/components/tether/message_wrapper.h" #include "ash/components/tether/proto/tether.pb.h" #include "ash/components/tether/test_timer_factory.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/containers/flat_map.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" @@ -18,9 +21,6 @@ #include "base/timer/mock_timer.h" #include "chromeos/components/multidevice/remote_device_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" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/ash/components/tether/disconnect_tethering_request_sender_impl.h b/ash/components/tether/disconnect_tethering_request_sender_impl.h index 5cbdddc..e104584 100644 --- a/ash/components/tether/disconnect_tethering_request_sender_impl.h +++ b/ash/components/tether/disconnect_tethering_request_sender_impl.h
@@ -10,9 +10,9 @@ #include "ash/components/tether/disconnect_tethering_operation.h" #include "ash/components/tether/disconnect_tethering_request_sender.h" // TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/device_sync/public/cpp/device_sync_client.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" // TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace ash {
diff --git a/ash/components/tether/disconnect_tethering_request_sender_impl_unittest.cc b/ash/components/tether/disconnect_tethering_request_sender_impl_unittest.cc index 06f44ac..3b2bdbe0 100644 --- a/ash/components/tether/disconnect_tethering_request_sender_impl_unittest.cc +++ b/ash/components/tether/disconnect_tethering_request_sender_impl_unittest.cc
@@ -9,12 +9,12 @@ #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 "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.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/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" namespace ash {
diff --git a/ash/components/tether/host_scanner_impl.h b/ash/components/tether/host_scanner_impl.h index e1109e3f..affbf03a 100644 --- a/ash/components/tether/host_scanner_impl.h +++ b/ash/components/tether/host_scanner_impl.h
@@ -12,6 +12,8 @@ #include "ash/components/tether/host_scanner.h" #include "ash/components/tether/host_scanner_operation.h" #include "ash/components/tether/notification_presenter.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/gtest_prod_util.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" @@ -20,8 +22,6 @@ #include "chromeos/network/network_state_handler.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "components/session_manager/core/session_manager_observer.h" namespace session_manager {
diff --git a/ash/components/tether/host_scanner_impl_unittest.cc b/ash/components/tether/host_scanner_impl_unittest.cc index acbb530..b12dd5c 100644 --- a/ash/components/tether/host_scanner_impl_unittest.cc +++ b/ash/components/tether/host_scanner_impl_unittest.cc
@@ -19,6 +19,7 @@ #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 "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/test/metrics/histogram_tester.h" @@ -28,7 +29,6 @@ #include "chromeos/components/multidevice/remote_device_test_util.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" #include "components/session_manager/core/session_manager.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/cros_system_api/dbus/shill/dbus-constants.h"
diff --git a/ash/components/tether/host_scanner_operation.h b/ash/components/tether/host_scanner_operation.h index 3b39890..27f3af6 100644 --- a/ash/components/tether/host_scanner_operation.h +++ b/ash/components/tether/host_scanner_operation.h
@@ -9,14 +9,14 @@ #include <vector> #include "ash/components/tether/message_transfer_operation.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.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" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace ash {
diff --git a/ash/components/tether/host_scanner_operation_unittest.cc b/ash/components/tether/host_scanner_operation_unittest.cc index 968911a..2d7b4406 100644 --- a/ash/components/tether/host_scanner_operation_unittest.cc +++ b/ash/components/tether/host_scanner_operation_unittest.cc
@@ -14,6 +14,9 @@ #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/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/simple_test_clock.h" @@ -21,9 +24,6 @@ #include "base/test/test_simple_task_runner.h" #include "chromeos/components/multidevice/remote_device_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" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "testing/gtest/include/gtest/gtest.h" using testing::_;
diff --git a/ash/components/tether/keep_alive_operation.h b/ash/components/tether/keep_alive_operation.h index fe4beb7..ac43a73 100644 --- a/ash/components/tether/keep_alive_operation.h +++ b/ash/components/tether/keep_alive_operation.h
@@ -6,13 +6,13 @@ #define ASH_COMPONENTS_TETHER_KEEP_ALIVE_OPERATION_H_ #include "ash/components/tether/message_transfer_operation.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/gtest_prod_util.h" #include "base/observer_list.h" #include "base/time/clock.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace ash {
diff --git a/ash/components/tether/keep_alive_operation_unittest.cc b/ash/components/tether/keep_alive_operation_unittest.cc index c50b09a..3fcc27ae 100644 --- a/ash/components/tether/keep_alive_operation_unittest.cc +++ b/ash/components/tether/keep_alive_operation_unittest.cc
@@ -10,14 +10,14 @@ #include "ash/components/tether/message_wrapper.h" #include "ash/components/tether/proto_test_util.h" #include "ash/components/tether/test_timer_factory.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.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/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" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/ash/components/tether/keep_alive_scheduler.cc b/ash/components/tether/keep_alive_scheduler.cc index 82be7cda..60bb7d7 100644 --- a/ash/components/tether/keep_alive_scheduler.cc +++ b/ash/components/tether/keep_alive_scheduler.cc
@@ -6,9 +6,9 @@ #include "ash/components/tether/device_id_tether_network_guid_map.h" #include "ash/components/tether/host_scan_cache.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/bind.h" #include "base/metrics/histogram_functions.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace ash {
diff --git a/ash/components/tether/keep_alive_scheduler.h b/ash/components/tether/keep_alive_scheduler.h index 3b5d44e6..fcdd3914 100644 --- a/ash/components/tether/keep_alive_scheduler.h +++ b/ash/components/tether/keep_alive_scheduler.h
@@ -10,12 +10,12 @@ #include "ash/components/tether/active_host.h" #include "ash/components/tether/device_status_util.h" #include "ash/components/tether/keep_alive_operation.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace ash {
diff --git a/ash/components/tether/keep_alive_scheduler_unittest.cc b/ash/components/tether/keep_alive_scheduler_unittest.cc index e8ba56e8..6cd2a795 100644 --- a/ash/components/tether/keep_alive_scheduler_unittest.cc +++ b/ash/components/tether/keep_alive_scheduler_unittest.cc
@@ -11,11 +11,11 @@ #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 "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/memory/ptr_util.h" #include "base/timer/mock_timer.h" #include "chromeos/components/multidevice/remote_device_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" namespace ash {
diff --git a/ash/components/tether/message_transfer_operation.h b/ash/components/tether/message_transfer_operation.h index 39e80e7..6ec729c3a 100644 --- a/ash/components/tether/message_transfer_operation.h +++ b/ash/components/tether/message_transfer_operation.h
@@ -10,14 +10,15 @@ #include "ash/components/tether/message_wrapper.h" #include "ash/components/tether/proto/tether.pb.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt.h" +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/timer/timer.h" #include "base/unguessable_token.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" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace ash {
diff --git a/ash/components/tether/message_transfer_operation_unittest.cc b/ash/components/tether/message_transfer_operation_unittest.cc index 4cc5672..6de07bc 100644 --- a/ash/components/tether/message_transfer_operation_unittest.cc +++ b/ash/components/tether/message_transfer_operation_unittest.cc
@@ -9,13 +9,13 @@ #include "ash/components/tether/message_wrapper.h" #include "ash/components/tether/proto_test_util.h" #include "ash/components/tether/test_timer_factory.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/memory/ptr_util.h" #include "base/timer/mock_timer.h" #include "chromeos/components/multidevice/remote_device_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" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/ash/components/tether/synchronous_shutdown_object_container_impl.h b/ash/components/tether/synchronous_shutdown_object_container_impl.h index 438cc8f..0a293f2 100644 --- a/ash/components/tether/synchronous_shutdown_object_container_impl.h +++ b/ash/components/tether/synchronous_shutdown_object_container_impl.h
@@ -9,6 +9,8 @@ #include "ash/components/tether/synchronous_shutdown_object_container.h" // TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" +// TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/network/network_connect.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/network/network_state_handler.h" @@ -16,8 +18,6 @@ #include "chromeos/network/network_connection_handler.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" class PrefService;
diff --git a/ash/components/tether/tether_component_impl.cc b/ash/components/tether/tether_component_impl.cc index b429414f..2fefd716 100644 --- a/ash/components/tether/tether_component_impl.cc +++ b/ash/components/tether/tether_component_impl.cc
@@ -16,12 +16,12 @@ #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 "ash/services/secure_channel/public/cpp/client/secure_channel_client.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/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" namespace ash {
diff --git a/ash/components/tether/tether_component_impl.h b/ash/components/tether/tether_component_impl.h index 3fd30d5..4836819c 100644 --- a/ash/components/tether/tether_component_impl.h +++ b/ash/components/tether/tether_component_impl.h
@@ -8,6 +8,8 @@ #include <memory> #include "ash/components/tether/tether_component.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" // TODO(https://crbug.com/1164001): move to forward declaration @@ -20,8 +22,6 @@ #include "chromeos/network/network_state_handler.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "components/prefs/pref_registry_simple.h" #include "device/bluetooth/bluetooth_adapter.h"
diff --git a/ash/components/tether/tether_connector_impl.h b/ash/components/tether/tether_connector_impl.h index 4d3f653..945fbecd 100644 --- a/ash/components/tether/tether_connector_impl.h +++ b/ash/components/tether/tether_connector_impl.h
@@ -8,14 +8,14 @@ #include "ash/components/tether/connect_tethering_operation.h" #include "ash/components/tether/host_connection_metrics_logger.h" #include "ash/components/tether/tether_connector.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/memory/weak_ptr.h" #include "chromeos/network/network_connection_handler.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/network/network_state_handler.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace ash {
diff --git a/ash/components/tether/tether_connector_impl_unittest.cc b/ash/components/tether/tether_connector_impl_unittest.cc index 48b1c306..c78d5cf 100644 --- a/ash/components/tether/tether_connector_impl_unittest.cc +++ b/ash/components/tether/tether_connector_impl_unittest.cc
@@ -18,6 +18,7 @@ #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 "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/test/metrics/histogram_tester.h" @@ -29,7 +30,6 @@ #include "chromeos/network/network_state_handler.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" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/cros_system_api/dbus/shill/dbus-constants.h"
diff --git a/ash/constants/ash_features.cc b/ash/constants/ash_features.cc index 419bb6f..8e7a692 100644 --- a/ash/constants/ash_features.cc +++ b/ash/constants/ash_features.cc
@@ -611,11 +611,6 @@ const base::Feature kFilesArchivemount2{"FilesArchivemount2", base::FEATURE_DISABLED_BY_DEFAULT}; -// Enable the updated banner framework. -// https://crbug.com/1228128 -const base::Feature kFilesBannerFramework{"FilesBannerFramework", - base::FEATURE_ENABLED_BY_DEFAULT}; - // Enable the simple archive extraction. // https://crbug.com/953256 const base::Feature kFilesExtractArchive{"FilesExtractArchive",
diff --git a/ash/constants/ash_features.h b/ash/constants/ash_features.h index d79c798..5e2c8f9 100644 --- a/ash/constants/ash_features.h +++ b/ash/constants/ash_features.h
@@ -236,8 +236,6 @@ extern const base::Feature kFastPairSoftwareScanning; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kFilesArchivemount; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kFilesArchivemount2; -COMPONENT_EXPORT(ASH_CONSTANTS) -extern const base::Feature kFilesBannerFramework; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kFilesExtractArchive; COMPONENT_EXPORT(ASH_CONSTANTS) extern const base::Feature kFilesSWA; COMPONENT_EXPORT(ASH_CONSTANTS)
diff --git a/ash/services/secure_channel/DEPS b/ash/services/secure_channel/DEPS new file mode 100644 index 0000000..84469a7 --- /dev/null +++ b/ash/services/secure_channel/DEPS
@@ -0,0 +1,5 @@ +include_rules = [ + "+ash/constants", + "+chromeos/services/device_sync", + "+chromeos/services/secure_channel", +]
diff --git a/ash/services/secure_channel/DIR_METADATA b/ash/services/secure_channel/DIR_METADATA new file mode 100644 index 0000000..ea7ecb0 --- /dev/null +++ b/ash/services/secure_channel/DIR_METADATA
@@ -0,0 +1,3 @@ +monorail { + component: "OS>Systems>Multidevice" +}
diff --git a/ash/services/secure_channel/OWNERS b/ash/services/secure_channel/OWNERS new file mode 100644 index 0000000..7027ab73 --- /dev/null +++ b/ash/services/secure_channel/OWNERS
@@ -0,0 +1 @@ +file://chromeos/components/multidevice/OWNERS
diff --git a/chromeos/services/secure_channel/public/cpp/client/client_channel.cc b/ash/services/secure_channel/public/cpp/client/client_channel.cc similarity index 92% rename from chromeos/services/secure_channel/public/cpp/client/client_channel.cc rename to ash/services/secure_channel/public/cpp/client/client_channel.cc index f1dfecb..f572c5e 100644 --- a/chromeos/services/secure_channel/public/cpp/client/client_channel.cc +++ b/ash/services/secure_channel/public/cpp/client/client_channel.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/guid.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/client_channel.h b/ash/services/secure_channel/public/cpp/client/client_channel.h similarity index 90% rename from chromeos/services/secure_channel/public/cpp/client/client_channel.h rename to ash/services/secure_channel/public/cpp/client/client_channel.h index 235057ff..b41c97a 100644 --- a/chromeos/services/secure_channel/public/cpp/client/client_channel.h +++ b/ash/services/secure_channel/public/cpp/client/client_channel.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_H_ #include <string> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback_forward.h" #include "base/observer_list.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos { @@ -105,4 +105,4 @@ } // namespace secure_channel } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl.cc b/ash/services/secure_channel/public/cpp/client/client_channel_impl.cc similarity index 97% rename from chromeos/services/secure_channel/public/cpp/client/client_channel_impl.cc rename to ash/services/secure_channel/public/cpp/client/client_channel_impl.cc index f347ec7..ee7c99c 100644 --- a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl.cc +++ b/ash/services/secure_channel/public/cpp/client/client_channel_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/services/secure_channel/public/cpp/client/client_channel_impl.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel_impl.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/memory/ptr_util.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl.h b/ash/services/secure_channel/public/cpp/client/client_channel_impl.h similarity index 89% rename from chromeos/services/secure_channel/public/cpp/client/client_channel_impl.h rename to ash/services/secure_channel/public/cpp/client/client_channel_impl.h index c6f2873b..a92eb092 100644 --- a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl.h +++ b/ash/services/secure_channel/public/cpp/client/client_channel_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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_IMPL_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_IMPL_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_IMPL_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_IMPL_H_ +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/memory/weak_ptr.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" @@ -115,4 +115,4 @@ } // namespace chromeos -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_IMPL_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CLIENT_CHANNEL_IMPL_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc b/ash/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc similarity index 95% rename from chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc rename to ash/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc index 0336b67d..ea36066 100644 --- a/chromeos/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc +++ b/ash/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc
@@ -2,10 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/public/cpp/client/client_channel_impl.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel_impl.h" #include <vector> +#include "ash/services/secure_channel/public/cpp/client/client_channel_impl.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt_impl.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" @@ -23,13 +30,6 @@ #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/services/secure_channel/fake_channel.h" #include "chromeos/services/secure_channel/fake_secure_channel.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel_impl.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_client_channel_observer.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/secure_channel_impl.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chromeos/services/secure_channel/public/cpp/client/connection_attempt.cc b/ash/services/secure_channel/public/cpp/client/connection_attempt.cc similarity index 87% rename from chromeos/services/secure_channel/public/cpp/client/connection_attempt.cc rename to ash/services/secure_channel/public/cpp/client/connection_attempt.cc index fa0ac2dc..3fcac3a 100644 --- a/chromeos/services/secure_channel/public/cpp/client/connection_attempt.cc +++ b/ash/services/secure_channel/public/cpp/client/connection_attempt.cc
@@ -2,7 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt.h" + +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/connection_attempt.h b/ash/services/secure_channel/public/cpp/client/connection_attempt.h similarity index 82% rename from chromeos/services/secure_channel/public/cpp/client/connection_attempt.h rename to ash/services/secure_channel/public/cpp/client/connection_attempt.h index 38d3e14..963a788d 100644 --- a/chromeos/services/secure_channel/public/cpp/client/connection_attempt.h +++ b/ash/services/secure_channel/public/cpp/client/connection_attempt.h
@@ -2,17 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_H_ +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" namespace chromeos { namespace secure_channel { +class ClientChannel; + // A handle for clients to own while waiting for a connection to establish (or // fail); it is returned by SecureChannelClient's InitiateConnectionToDevice() // or ListenForConnectionFromDevice() method. Clients should implement the @@ -60,4 +61,4 @@ } // namespace secure_channel } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.cc b/ash/services/secure_channel/public/cpp/client/connection_attempt_impl.cc similarity index 89% rename from chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.cc rename to ash/services/secure_channel/public/cpp/client/connection_attempt_impl.cc index d55ba6b..26c2ac5f 100644 --- a/chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.cc +++ b/ash/services/secure_channel/public/cpp/client/connection_attempt_impl.cc
@@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt_impl.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel_impl.h" #include "base/bind.h" #include "base/memory/ptr_util.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel_impl.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.h b/ash/services/secure_channel/public/cpp/client/connection_attempt_impl.h similarity index 83% rename from chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.h rename to ash/services/secure_channel/public/cpp/client/connection_attempt_impl.h index fadd849..ed42131 100644 --- a/chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.h +++ b/ash/services/secure_channel/public/cpp/client/connection_attempt_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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_IMPL_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_IMPL_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_IMPL_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_IMPL_H_ +#include "ash/services/secure_channel/public/cpp/client/connection_attempt.h" #include "base/memory/weak_ptr.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" @@ -59,4 +59,4 @@ } // namespace chromeos -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_IMPL_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_ATTEMPT_IMPL_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/connection_manager.cc b/ash/services/secure_channel/public/cpp/client/connection_manager.cc similarity index 93% rename from chromeos/services/secure_channel/public/cpp/client/connection_manager.cc rename to ash/services/secure_channel/public/cpp/client/connection_manager.cc index 3ebb048..15492e6 100644 --- a/chromeos/services/secure_channel/public/cpp/client/connection_manager.cc +++ b/ash/services/secure_channel/public/cpp/client/connection_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/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" namespace chromeos { namespace secure_channel {
diff --git a/chromeos/services/secure_channel/public/cpp/client/connection_manager.h b/ash/services/secure_channel/public/cpp/client/connection_manager.h similarity index 90% rename from chromeos/services/secure_channel/public/cpp/client/connection_manager.h rename to ash/services/secure_channel/public/cpp/client/connection_manager.h index 8181a1a..d7d28a4 100644 --- a/chromeos/services/secure_channel/public/cpp/client/connection_manager.h +++ b/ash/services/secure_channel/public/cpp/client/connection_manager.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_H_ #include <ostream> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/observer_list.h" #include "base/observer_list_types.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos { namespace secure_channel { @@ -98,4 +98,4 @@ } // namespace secure_channel } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.cc b/ash/services/secure_channel/public/cpp/client/connection_manager_impl.cc similarity index 96% rename from chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.cc rename to ash/services/secure_channel/public/cpp/client/connection_manager_impl.cc index 6da48c2..16f6797 100644 --- a/chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.cc +++ b/ash/services/secure_channel/public/cpp/client/connection_manager_impl.cc
@@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager_impl.h" #include "ash/constants/ash_features.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/callback_helpers.h" #include "base/metrics/histogram_functions.h" @@ -12,8 +14,6 @@ #include "base/time/time.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos { namespace secure_channel {
diff --git a/chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.h b/ash/services/secure_channel/public/cpp/client/connection_manager_impl.h similarity index 87% rename from chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.h rename to ash/services/secure_channel/public/cpp/client/connection_manager_impl.h index 6784dc9..d8fc3d19 100644 --- a/chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.h +++ b/ash/services/secure_channel/public/cpp/client/connection_manager_impl.h
@@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_IMPL_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_IMPL_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_IMPL_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_IMPL_H_ #include <memory> +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/time/default_clock.h" #include "base/timer/timer.h" // TODO(https://crbug.com/1164001): move to forward declaration. #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" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos { @@ -131,4 +131,4 @@ } // namespace secure_channel } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_IMPL_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_CONNECTION_MANAGER_IMPL_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/connection_manager_impl_unittest.cc b/ash/services/secure_channel/public/cpp/client/connection_manager_impl_unittest.cc similarity index 96% rename from chromeos/services/secure_channel/public/cpp/client/connection_manager_impl_unittest.cc rename to ash/services/secure_channel/public/cpp/client/connection_manager_impl_unittest.cc index 0cb6922..8b5632c 100644 --- a/chromeos/services/secure_channel/public/cpp/client/connection_manager_impl_unittest.cc +++ b/ash/services/secure_channel/public/cpp/client/connection_manager_impl_unittest.cc
@@ -2,11 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager_impl.h" #include <memory> #include "ash/constants/ash_features.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/memory/ptr_util.h" #include "base/test/bind.h" @@ -17,10 +21,6 @@ #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_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" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_client_channel.cc b/ash/services/secure_channel/public/cpp/client/fake_client_channel.cc similarity index 90% rename from chromeos/services/secure_channel/public/cpp/client/fake_client_channel.cc rename to ash/services/secure_channel/public/cpp/client/fake_client_channel.cc index a161de0..9dcc07de 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_client_channel.cc +++ b/ash/services/secure_channel/public/cpp/client/fake_client_channel.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/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/memory/ptr_util.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h b/ash/services/secure_channel/public/cpp/client/fake_client_channel.h similarity index 82% rename from chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h rename to ash/services/secure_channel/public/cpp/client/fake_client_channel.h index 0fdd5eb..1cba929 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_client_channel.h +++ b/ash/services/secure_channel/public/cpp/client/fake_client_channel.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_H_ #include <queue> #include <vector> +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos { @@ -80,4 +80,4 @@ } // namespace secure_channel } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_client_channel_observer.cc b/ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.cc similarity index 86% rename from chromeos/services/secure_channel/public/cpp/client/fake_client_channel_observer.cc rename to ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.cc index ce9a9d0e..c5ec82b 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_client_channel_observer.cc +++ b/ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.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/services/secure_channel/public/cpp/client/fake_client_channel_observer.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_client_channel_observer.h b/ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.h similarity index 74% rename from chromeos/services/secure_channel/public/cpp/client/fake_client_channel_observer.h rename to ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.h index 95e66de6..e7f7b735 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_client_channel_observer.h +++ b/ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_OBSERVER_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_OBSERVER_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_OBSERVER_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_OBSERVER_H_ -#include "chromeos/services/secure_channel/public/cpp/client/client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel.h" namespace chromeos { @@ -42,4 +42,4 @@ } // namespace chromeos -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_OBSERVER_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CLIENT_CHANNEL_OBSERVER_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.cc b/ash/services/secure_channel/public/cpp/client/fake_connection_attempt.cc similarity index 91% rename from chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.cc rename to ash/services/secure_channel/public/cpp/client/fake_connection_attempt.cc index ededaec..8c7eb129 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.cc +++ b/ash/services/secure_channel/public/cpp/client/fake_connection_attempt.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/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h b/ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h similarity index 83% rename from chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h rename to ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h index b010d8d4..f6f183c 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_connection_attempt.h +++ b/ash/services/secure_channel/public/cpp/client/fake_connection_attempt.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_ATTEMPT_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_ATTEMPT_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_ATTEMPT_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_ATTEMPT_H_ +#include "ash/services/secure_channel/public/cpp/client/connection_attempt_impl.h" #include "base/memory/weak_ptr.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" @@ -24,8 +24,8 @@ ~FakeConnectionAttempt() override; - using ConnectionAttempt::NotifyConnectionAttemptFailure; using ConnectionAttempt::NotifyConnection; + using ConnectionAttempt::NotifyConnectionAttemptFailure; // ConnectionAttemptImpl: void OnConnectionAttemptFailure( @@ -58,4 +58,4 @@ } // namespace secure_channel } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_ATTEMPT_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_ATTEMPT_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.cc b/ash/services/secure_channel/public/cpp/client/fake_connection_manager.cc similarity index 91% rename from chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.cc rename to ash/services/secure_channel/public/cpp/client/fake_connection_manager.cc index b2238d9..28219c5 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.cc +++ b/ash/services/secure_channel/public/cpp/client/fake_connection_manager.cc
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos { namespace secure_channel {
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h b/ash/services/secure_channel/public/cpp/client/fake_connection_manager.h similarity index 82% rename from chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h rename to ash/services/secure_channel/public/cpp/client/fake_connection_manager.h index 42acba5..6f4987aa 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h +++ b/ash/services/secure_channel/public/cpp/client/fake_connection_manager.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_MANAGER_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_MANAGER_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_MANAGER_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_MANAGER_H_ #include <vector> +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos { namespace secure_channel { @@ -72,4 +72,4 @@ } // namespace secure_channel } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_MANAGER_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_CONNECTION_MANAGER_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_nearby_connector.cc b/ash/services/secure_channel/public/cpp/client/fake_nearby_connector.cc similarity index 96% rename from chromeos/services/secure_channel/public/cpp/client/fake_nearby_connector.cc rename to ash/services/secure_channel/public/cpp/client/fake_nearby_connector.cc index 5038f43..626b9ad 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_nearby_connector.cc +++ b/ash/services/secure_channel/public/cpp/client/fake_nearby_connector.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/services/secure_channel/public/cpp/client/fake_nearby_connector.h" +#include "ash/services/secure_channel/public/cpp/client/fake_nearby_connector.h" +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_nearby_connector.h b/ash/services/secure_channel/public/cpp/client/fake_nearby_connector.h similarity index 90% rename from chromeos/services/secure_channel/public/cpp/client/fake_nearby_connector.h rename to ash/services/secure_channel/public/cpp/client/fake_nearby_connector.h index d0aa21d..a1fd176 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_nearby_connector.h +++ b/ash/services/secure_channel/public/cpp/client/fake_nearby_connector.h
@@ -2,19 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_NEARBY_CONNECTOR_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_NEARBY_CONNECTOR_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_NEARBY_CONNECTOR_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_NEARBY_CONNECTOR_H_ #include <memory> #include <string> #include <vector> +#include "ash/services/secure_channel/public/cpp/client/nearby_connector.h" +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/containers/queue.h" -#include "chromeos/services/secure_channel/public/cpp/client/nearby_connector.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" @@ -139,4 +139,4 @@ } // namespace secure_channel } // namespace chromeos -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_NEARBY_CONNECTOR_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_NEARBY_CONNECTOR_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.cc b/ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.cc similarity index 96% rename from chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.cc rename to ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.cc index 9964f85..3f5f3b4 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.cc +++ b/ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.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/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "chromeos/components/multidevice/remote_device_ref.h"
diff --git a/chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h b/ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h similarity index 93% rename from chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h rename to ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h index 4253788..c3011f8 100644 --- a/chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h +++ b/ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_SECURE_CHANNEL_CLIENT_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_SECURE_CHANNEL_CLIENT_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_SECURE_CHANNEL_CLIENT_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_SECURE_CHANNEL_CLIENT_H_ #include <memory> #include <string> #include <vector> +#include "ash/services/secure_channel/public/cpp/client/connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/callback.h" #include "base/containers/contains.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace chromeos { @@ -168,4 +168,4 @@ } } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_SECURE_CHANNEL_CLIENT_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_FAKE_SECURE_CHANNEL_CLIENT_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/nearby_connector.cc b/ash/services/secure_channel/public/cpp/client/nearby_connector.cc similarity index 88% rename from chromeos/services/secure_channel/public/cpp/client/nearby_connector.cc rename to ash/services/secure_channel/public/cpp/client/nearby_connector.cc index d574f6e..447fb529 100644 --- a/chromeos/services/secure_channel/public/cpp/client/nearby_connector.cc +++ b/ash/services/secure_channel/public/cpp/client/nearby_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/services/secure_channel/public/cpp/client/nearby_connector.h" +#include "ash/services/secure_channel/public/cpp/client/nearby_connector.h" namespace chromeos { namespace secure_channel {
diff --git a/chromeos/services/secure_channel/public/cpp/client/nearby_connector.h b/ash/services/secure_channel/public/cpp/client/nearby_connector.h similarity index 72% rename from chromeos/services/secure_channel/public/cpp/client/nearby_connector.h rename to ash/services/secure_channel/public/cpp/client/nearby_connector.h index ff24879..1a7157c 100644 --- a/chromeos/services/secure_channel/public/cpp/client/nearby_connector.h +++ b/ash/services/secure_channel/public/cpp/client/nearby_connector.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_NEARBY_CONNECTOR_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_NEARBY_CONNECTOR_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_NEARBY_CONNECTOR_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_NEARBY_CONNECTOR_H_ -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "mojo/public/cpp/bindings/receiver_set.h" namespace chromeos { @@ -33,4 +33,4 @@ } } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_NEARBY_CONNECTOR_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_NEARBY_CONNECTOR_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/presence_monitor_client.h b/ash/services/secure_channel/public/cpp/client/presence_monitor_client.h similarity index 78% rename from chromeos/services/secure_channel/public/cpp/client/presence_monitor_client.h rename to ash/services/secure_channel/public/cpp/client/presence_monitor_client.h index 85af752..77ec682f 100644 --- a/chromeos/services/secure_channel/public/cpp/client/presence_monitor_client.h +++ b/ash/services/secure_channel/public/cpp/client/presence_monitor_client.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_H_ +#include "ash/services/secure_channel/public/cpp/shared/presence_monitor.h" #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/services/secure_channel/public/cpp/shared/presence_monitor.h" namespace chromeos { namespace secure_channel { @@ -43,4 +43,4 @@ } } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/presence_monitor_client_impl.cc b/ash/services/secure_channel/public/cpp/client/presence_monitor_client_impl.cc similarity index 95% rename from chromeos/services/secure_channel/public/cpp/client/presence_monitor_client_impl.cc rename to ash/services/secure_channel/public/cpp/client/presence_monitor_client_impl.cc index 2751a558..5a7b7fac 100644 --- a/chromeos/services/secure_channel/public/cpp/client/presence_monitor_client_impl.cc +++ b/ash/services/secure_channel/public/cpp/client/presence_monitor_client_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/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h" +#include "ash/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h" #include "base/bind.h" #include "base/memory/ptr_util.h"
diff --git a/chromeos/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h b/ash/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h similarity index 79% rename from chromeos/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h rename to ash/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h index 8939119..3d83394 100644 --- a/chromeos/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h +++ b/ash/services/secure_channel/public/cpp/client/presence_monitor_client_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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_IMPL_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_IMPL_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_IMPL_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_IMPL_H_ #include <memory> -#include "chromeos/services/secure_channel/public/cpp/client/presence_monitor_client.h" -#include "chromeos/services/secure_channel/public/cpp/shared/presence_monitor.h" +#include "ash/services/secure_channel/public/cpp/client/presence_monitor_client.h" +#include "ash/services/secure_channel/public/cpp/shared/presence_monitor.h" namespace chromeos { @@ -66,4 +66,4 @@ } } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_IMPL_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_PRESENCE_MONITOR_CLIENT_IMPL_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h b/ash/services/secure_channel/public/cpp/client/secure_channel_client.h similarity index 88% rename from chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h rename to ash/services/secure_channel/public/cpp/client/secure_channel_client.h index 4d081d4..5a7c76e 100644 --- a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h +++ b/ash/services/secure_channel/public/cpp/client/secure_channel_client.h
@@ -2,14 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_H_ #include <string> #include "chromeos/components/multidevice/remote_device_ref.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos { @@ -17,6 +15,8 @@ class ConnectionAttempt; class NearbyConnector; +enum class ConnectionMedium; +enum class ConnectionPriority; // Provides clients access to the SecureChannel API. // @@ -87,4 +87,4 @@ } } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.cc b/ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.cc similarity index 94% rename from chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.cc rename to ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.cc index 890c416..dad00b75 100644 --- a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.cc +++ b/ash/services/secure_channel/public/cpp/client/secure_channel_client_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/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt_impl.h" +#include "ash/services/secure_channel/public/cpp/client/nearby_connector.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/task/task_runner.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.h" -#include "chromeos/services/secure_channel/public/cpp/client/nearby_connector.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.h b/ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.h similarity index 88% rename from chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.h rename to ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.h index a6c161da..f0b42e4 100644 --- a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.h +++ b/ash/services/secure_channel/public/cpp/client/secure_channel_client_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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_IMPL_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_IMPL_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_IMPL_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_IMPL_H_ +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/memory/weak_ptr.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h" @@ -104,4 +104,4 @@ } } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_IMPL_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_CLIENT_SECURE_CHANNEL_CLIENT_IMPL_H_
diff --git a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc b/ash/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc similarity index 95% rename from chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc rename to ash/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc index fc0d6c9..345141d 100644 --- a/chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc +++ b/ash/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc
@@ -2,8 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" +#include "ash/services/secure_channel/public/cpp/client/client_channel_impl.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt.h" +#include "ash/services/secure_channel/public/cpp/client/connection_attempt_impl.h" +#include "ash/services/secure_channel/public/cpp/client/fake_client_channel.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/memory/ptr_util.h" #include "base/memory/scoped_refptr.h" #include "base/run_loop.h" @@ -14,12 +20,6 @@ #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/services/secure_channel/fake_channel.h" #include "chromeos/services/secure_channel/fake_secure_channel.h" -#include "chromeos/services/secure_channel/public/cpp/client/client_channel_impl.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_attempt_impl.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" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "chromeos/services/secure_channel/secure_channel_initializer.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chromeos/services/secure_channel/public/cpp/shared/connection_medium.cc b/ash/services/secure_channel/public/cpp/shared/connection_medium.cc similarity index 87% rename from chromeos/services/secure_channel/public/cpp/shared/connection_medium.cc rename to ash/services/secure_channel/public/cpp/shared/connection_medium.cc index 3bb9e14..2b3e432 100644 --- a/chromeos/services/secure_channel/public/cpp/shared/connection_medium.cc +++ b/ash/services/secure_channel/public/cpp/shared/connection_medium.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/services/secure_channel/public/cpp/shared/connection_medium.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_medium.h" #include "base/check.h"
diff --git a/chromeos/services/secure_channel/public/cpp/shared/connection_medium.h b/ash/services/secure_channel/public/cpp/shared/connection_medium.h similarity index 74% rename from chromeos/services/secure_channel/public/cpp/shared/connection_medium.h rename to ash/services/secure_channel/public/cpp/shared/connection_medium.h index c274d10..f47b060 100644 --- a/chromeos/services/secure_channel/public/cpp/shared/connection_medium.h +++ b/ash/services/secure_channel/public/cpp/shared/connection_medium.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_MEDIUM_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_MEDIUM_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_MEDIUM_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_MEDIUM_H_ #include <ostream> @@ -27,4 +27,4 @@ } // namespace chromeos -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_MEDIUM_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_MEDIUM_H_
diff --git a/chromeos/services/secure_channel/public/cpp/shared/connection_priority.cc b/ash/services/secure_channel/public/cpp/shared/connection_priority.cc similarity index 89% rename from chromeos/services/secure_channel/public/cpp/shared/connection_priority.cc rename to ash/services/secure_channel/public/cpp/shared/connection_priority.cc index 5c5346f..66fd2d41 100644 --- a/chromeos/services/secure_channel/public/cpp/shared/connection_priority.cc +++ b/ash/services/secure_channel/public/cpp/shared/connection_priority.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/services/secure_channel/public/cpp/shared/connection_priority.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/public/cpp/shared/connection_priority.h b/ash/services/secure_channel/public/cpp/shared/connection_priority.h similarity index 87% rename from chromeos/services/secure_channel/public/cpp/shared/connection_priority.h rename to ash/services/secure_channel/public/cpp/shared/connection_priority.h index f445ad4e..9e6aef17 100644 --- a/chromeos/services/secure_channel/public/cpp/shared/connection_priority.h +++ b/ash/services/secure_channel/public/cpp/shared/connection_priority.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_PRIORITY_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_PRIORITY_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_PRIORITY_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_PRIORITY_H_ #include <ostream> @@ -48,4 +48,4 @@ } // namespace secure_channel } // namespace ash -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_PRIORITY_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_CONNECTION_PRIORITY_H_
diff --git a/chromeos/services/secure_channel/public/cpp/shared/presence_monitor.h b/ash/services/secure_channel/public/cpp/shared/presence_monitor.h similarity index 82% rename from chromeos/services/secure_channel/public/cpp/shared/presence_monitor.h rename to ash/services/secure_channel/public/cpp/shared/presence_monitor.h index 63c80ab25..babe97c 100644 --- a/chromeos/services/secure_channel/public/cpp/shared/presence_monitor.h +++ b/ash/services/secure_channel/public/cpp/shared/presence_monitor.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_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_PRESENCE_MONITOR_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_PRESENCE_MONITOR_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_PRESENCE_MONITOR_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_PRESENCE_MONITOR_H_ #include "base/callback.h" @@ -40,4 +40,5 @@ } // namespace secure_channel } // namespace chromeos -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_PRESENCE_MONITOR_H_ + +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_CPP_SHARED_PRESENCE_MONITOR_H_
diff --git a/chromeos/services/secure_channel/public/mojom/OWNERS b/ash/services/secure_channel/public/mojom/OWNERS similarity index 100% rename from chromeos/services/secure_channel/public/mojom/OWNERS rename to ash/services/secure_channel/public/mojom/OWNERS
diff --git a/chromeos/services/secure_channel/public/mojom/nearby_connector.mojom b/ash/services/secure_channel/public/mojom/nearby_connector.mojom similarity index 96% rename from chromeos/services/secure_channel/public/mojom/nearby_connector.mojom rename to ash/services/secure_channel/public/mojom/nearby_connector.mojom index 92dc98f5..81521714 100644 --- a/chromeos/services/secure_channel/public/mojom/nearby_connector.mojom +++ b/ash/services/secure_channel/public/mojom/nearby_connector.mojom
@@ -4,7 +4,7 @@ module chromeos.secure_channel.mojom; -import "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom"; +import "ash/services/secure_channel/public/mojom/secure_channel_types.mojom"; // Service ID to use. Nearby Connections requires a service ID to be associated // with each connection request.
diff --git a/chromeos/services/secure_channel/public/mojom/secure_channel.mojom b/ash/services/secure_channel/public/mojom/secure_channel.mojom similarity index 98% rename from chromeos/services/secure_channel/public/mojom/secure_channel.mojom rename to ash/services/secure_channel/public/mojom/secure_channel.mojom index f31c5e4..68e2965 100644 --- a/chromeos/services/secure_channel/public/mojom/secure_channel.mojom +++ b/ash/services/secure_channel/public/mojom/secure_channel.mojom
@@ -4,9 +4,9 @@ module chromeos.secure_channel.mojom; +import "ash/services/secure_channel/public/mojom/nearby_connector.mojom"; +import "ash/services/secure_channel/public/mojom/secure_channel_types.mojom"; import "chromeos/components/multidevice/mojom/multidevice_types.mojom"; -import "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom"; -import "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom"; enum ConnectionAttemptFailureReason { // The local device could not authenticate with the remote device. This likely
diff --git a/chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits.cc b/ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.cc similarity index 97% rename from chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits.cc rename to ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.cc index 5896d00..6570aee 100644 --- a/chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits.cc +++ b/ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.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/services/secure_channel/public/mojom/secure_channel_mojom_traits.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.h" #include "base/notreached.h"
diff --git a/chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits.h b/ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.h similarity index 68% rename from chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits.h rename to ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.h index 5afc89f..fa3c147 100644 --- a/chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits.h +++ b/ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.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_SERVICES_SECURE_CHANNEL_PUBLIC_MOJOM_SECURE_CHANNEL_MOJOM_TRAITS_H_ -#define CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_MOJOM_SECURE_CHANNEL_MOJOM_TRAITS_H_ +#ifndef ASH_SERVICES_SECURE_CHANNEL_PUBLIC_MOJOM_SECURE_CHANNEL_MOJOM_TRAITS_H_ +#define ASH_SERVICES_SECURE_CHANNEL_PUBLIC_MOJOM_SECURE_CHANNEL_MOJOM_TRAITS_H_ -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom-shared.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_medium.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom-shared.h" #include "mojo/public/cpp/bindings/enum_traits.h" namespace mojo { @@ -35,4 +35,4 @@ } // namespace mojo -#endif // CHROMEOS_SERVICES_SECURE_CHANNEL_PUBLIC_MOJOM_SECURE_CHANNEL_MOJOM_TRAITS_H_ +#endif // ASH_SERVICES_SECURE_CHANNEL_PUBLIC_MOJOM_SECURE_CHANNEL_MOJOM_TRAITS_H_
diff --git a/chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits_unittest.cc b/ash/services/secure_channel/public/mojom/secure_channel_mojom_traits_unittest.cc similarity index 83% rename from chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits_unittest.cc rename to ash/services/secure_channel/public/mojom/secure_channel_mojom_traits_unittest.cc index f53cb46..d4e05f79 100644 --- a/chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits_unittest.cc +++ b/ash/services/secure_channel/public/mojom/secure_channel_mojom_traits_unittest.cc
@@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chromeos/services/secure_channel/public/mojom/secure_channel_mojom_traits.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "mojo/public/cpp/test_support/test_utils.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom b/ash/services/secure_channel/public/mojom/secure_channel_types.mojom similarity index 100% rename from chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom rename to ash/services/secure_channel/public/mojom/secure_channel_types.mojom
diff --git a/ash/system/bluetooth/bluetooth_device_status_ui_handler.cc b/ash/system/bluetooth/bluetooth_device_status_ui_handler.cc index f6075d2..23348b1 100644 --- a/ash/system/bluetooth/bluetooth_device_status_ui_handler.cc +++ b/ash/system/bluetooth/bluetooth_device_status_ui_handler.cc
@@ -10,7 +10,9 @@ #include "ash/public/cpp/system/toast_data.h" #include "ash/public/cpp/system/toast_manager.h" #include "ash/strings/grit/ash_strings.h" +#include "base/bind.h" #include "base/check.h" +#include "base/threading/thread_task_runner_handle.h" #include "chromeos/services/bluetooth_config/public/cpp/cros_bluetooth_config_util.h" #include "device/bluetooth/chromeos/bluetooth_utils.h" #include "ui/base/l10n/l10n_util.h" @@ -27,11 +29,13 @@ BluetoothDeviceStatusUiHandler::BluetoothDeviceStatusUiHandler() { DCHECK(ash::features::IsBluetoothRevampEnabled()); - GetBluetoothConfigService( - remote_cros_bluetooth_config_.BindNewPipeAndPassReceiver()); - remote_cros_bluetooth_config_->ObserveDeviceStatusChanges( - cros_bluetooth_device_status_observer_receiver_ - .BindNewPipeAndPassRemote()); + + // Asynchronously bind to CrosBluetoothConfig so that we don't want to attempt + // to bind to it before it has initialized. + base::ThreadTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(&BluetoothDeviceStatusUiHandler::BindToCrosBluetoothConfig, + weak_ptr_factory_.GetWeakPtr())); } BluetoothDeviceStatusUiHandler::~BluetoothDeviceStatusUiHandler() = default; @@ -90,4 +94,12 @@ base::ToLowerASCII(paired_device_properties->device_properties->id); } +void BluetoothDeviceStatusUiHandler::BindToCrosBluetoothConfig() { + GetBluetoothConfigService( + remote_cros_bluetooth_config_.BindNewPipeAndPassReceiver()); + remote_cros_bluetooth_config_->ObserveDeviceStatusChanges( + cros_bluetooth_device_status_observer_receiver_ + .BindNewPipeAndPassRemote()); +} + } // namespace ash
diff --git a/ash/system/bluetooth/bluetooth_device_status_ui_handler.h b/ash/system/bluetooth/bluetooth_device_status_ui_handler.h index 1079d19..c65045e7 100644 --- a/ash/system/bluetooth/bluetooth_device_status_ui_handler.h +++ b/ash/system/bluetooth/bluetooth_device_status_ui_handler.h
@@ -46,11 +46,15 @@ const chromeos::bluetooth_config::mojom::PairedBluetoothDeviceProperties* paired_device_properties); + void BindToCrosBluetoothConfig(); + mojo::Remote<chromeos::bluetooth_config::mojom::CrosBluetoothConfig> remote_cros_bluetooth_config_; mojo::Receiver< chromeos::bluetooth_config::mojom::BluetoothDeviceStatusObserver> cros_bluetooth_device_status_observer_receiver_{this}; + + base::WeakPtrFactory<BluetoothDeviceStatusUiHandler> weak_ptr_factory_{this}; }; } // namespace ash
diff --git a/ash/system/session/logout_button_tray.cc b/ash/system/session/logout_button_tray.cc index 3e5a77d..586c34b 100644 --- a/ash/system/session/logout_button_tray.cc +++ b/ash/system/session/logout_button_tray.cc
@@ -42,6 +42,8 @@ std::u16string(), CONTEXT_LAUNCHER_BUTTON)); button_->SetProminent(true); set_use_bounce_in_animation(false); + + SetFocusBehavior(FocusBehavior::NEVER); } LogoutButtonTray::~LogoutButtonTray() {
diff --git a/ash/webui/camera_app_ui/resources/js/device/mode/video.ts b/ash/webui/camera_app_ui/resources/js/device/mode/video.ts index 087f9c0..c8391a2f 100644 --- a/ash/webui/camera_app_ui/resources/js/device/mode/video.ts +++ b/ash/webui/camera_app_ui/resources/js/device/mode/video.ts
@@ -4,6 +4,7 @@ import { assert, + assertExists, assertInstanceof, } from '../../assert.js'; import * as dom from '../../dom.js'; @@ -26,6 +27,7 @@ ErrorLevel, ErrorType, Facing, + getVideoTrackSettings, NoChunkError, PreviewVideo, Resolution, @@ -273,6 +275,7 @@ try { const timestamp = Date.now(); let blob: Blob; + assert(this.crosImageCapture !== null); if (await this.isBlobVideoSnapshotEnabled()) { const photoSettings: PhotoSettings = { imageWidth: this.snapshotResolution.width, @@ -313,10 +316,12 @@ const waitable = new WaitableEvent(); this.togglePausedInternal = waitable.wait(); + assert(this.mediaRecorder !== null); assert(this.mediaRecorder.state !== 'inactive'); const toBePaused = this.mediaRecorder.state !== 'paused'; const toggledEvent = toBePaused ? 'pause' : 'resume'; const onToggled = () => { + assert(this.mediaRecorder !== null); this.mediaRecorder.removeEventListener(toggledEvent, onToggled); state.set(state.State.RECORDING_PAUSED, toBePaused); this.togglePausedInternal = null; @@ -350,7 +355,8 @@ const preference = encoderPreference.get(loadTimeData.getBoard()) || {profile: h264.Profile.HIGH, multiplier: 2}; const {profile, multiplier} = preference; - const {width, height, frameRate} = this.getVideoTrack().getSettings(); + const {width, height, frameRate} = + getVideoTrackSettings(this.getVideoTrack()); const resolution = new Resolution(width, height); const bitrate = resolution.area * multiplier; const level = h264.getMinimalLevel(profile, bitrate, frameRate, resolution); @@ -472,12 +478,16 @@ } if (isVideoTooShort()) { + assert(videoSaver !== null); toast.show(I18nString.ERROR_MSG_VIDEO_TOO_SHORT); await videoSaver.cancel(); - return () => this.snapshotting; + return async () => { + await this.snapshotting; + }; } return async () => { + assert(videoSaver !== null); await this.handler.onVideoCaptureDone({ resolution: this.captureResolution, duration: this.recordTime.inMilliseconds(), @@ -527,7 +537,7 @@ await new Promise<void>((resolve) => { let encodedFrames = 0; let start = 0.0; - const updateCanvas = (now) => { + const updateCanvas = (now: number) => { if (start === 0.0) { start = now; } @@ -559,7 +569,7 @@ await new Promise((resolve, reject) => { let noChunk = true; - const ondataavailable = (event) => { + const ondataavailable = (event: BlobEvent) => { if (event.data && event.data.size > 0) { noChunk = false; saver.write(event.data); @@ -567,6 +577,8 @@ }; const onstop = async () => { + assert(this.mediaRecorder !== null); + state.set(state.State.RECORDING, false); state.set(state.State.RECORDING_PAUSED, false); state.set(state.State.RECORDING_UI_PAUSED, false); @@ -582,10 +594,15 @@ resolve(saver); } }; + const onstart = () => { + assert(this.mediaRecorder !== null); + state.set(state.State.RECORDING, true); this.mediaRecorder.removeEventListener('start', onstart); }; + + assert(this.mediaRecorder !== null); this.mediaRecorder.addEventListener('dataavailable', ondataavailable); this.mediaRecorder.addEventListener('stop', onstop); this.mediaRecorder.addEventListener('start', onstart); @@ -624,7 +641,7 @@ produce(): ModeBase { let captureConstraints = null; if (state.get(state.State.ENABLE_MULTISTREAM_RECORDING)) { - const {width, height} = this.captureResolution; + const {width, height} = assertExists(this.captureResolution); captureConstraints = { deviceId: this.constraints.deviceId, audio: this.constraints.audio,
diff --git a/ash/webui/camera_app_ui/resources/js/device/preview.ts b/ash/webui/camera_app_ui/resources/js/device/preview.ts index 9e39ad0..572c04a 100644 --- a/ash/webui/camera_app_ui/resources/js/device/preview.ts +++ b/ash/webui/camera_app_ui/resources/js/device/preview.ts
@@ -18,6 +18,8 @@ AndroidControlAwbMode, AndroidControlAwbState, AndroidStatisticsFaceDetectMode, + CameraMetadata, + CameraMetadataEntry, CameraMetadataTag, StreamType, } from '../mojo/type.js'; @@ -31,6 +33,7 @@ ErrorLevel, ErrorType, Facing, + getVideoTrackSettings, PreviewVideo, Resolution, } from '../type.js'; @@ -73,12 +76,12 @@ private watchdog: number|null = null; /** - * Promise for the current applying focus. + * Unique marker for the current applying focus. */ - private focus: Promise<void>|null = null; + private focusMarker: symbol|null = null; private facing = Facing.NOT_SET; - private deviceId: string|null; + private deviceId: string|null = null; private vidPid: string|null = null; private isSupportPTZInternal = false; @@ -132,7 +135,7 @@ return this.facing; } - getDeviceId(): string { + getDeviceId(): string|null { return this.deviceId; } @@ -196,7 +199,7 @@ return; } - const {deviceId} = this.getVideoTrack().getSettings(); + const {deviceId} = getVideoTrackSettings(this.getVideoTrack()); if (this.deviceDefaultPTZ.has(deviceId)) { return; } @@ -239,8 +242,9 @@ if (this.streamInternal === null || !this.isSupportPTZInternal) { return; } - const {deviceId} = this.getVideoTrack().getSettings(); + const {deviceId} = getVideoTrackSettings(this.getVideoTrack()); const defaultPTZ = this.deviceDefaultPTZ.get(deviceId); + assert(defaultPTZ !== undefined); await this.getVideoTrack().applyConstraints({advanced: [defaultPTZ]}); } @@ -274,6 +278,7 @@ video.srcObject = stream; }); await video.play(); + assert(this.video.parentElement !== null); this.video.parentElement.replaceChild(tpl, this.video); this.video.srcObject = null; this.video = video; @@ -310,23 +315,26 @@ // Use a watchdog since the stream.onended event is unreliable in the // recent version of Chrome. As of 55, the event is still broken. this.watchdog = setInterval(() => { + assert(this.streamInternal !== null); // Check if video stream is ended (audio stream may still be live). if (this.streamInternal.getVideoTracks().length === 0 || this.streamInternal.getVideoTracks()[0].readyState === 'ended') { - clearInterval(this.watchdog); - this.watchdog = null; + if (this.watchdog !== null) { + clearInterval(this.watchdog); + this.watchdog = null; + } this.streamInternal = null; this.onNewStreamNeeded(); } }, 100); await this.updateFacing(); - this.deviceId = this.getVideoTrack().getSettings().deviceId; + this.deviceId = getVideoTrackSettings(this.getVideoTrack()).deviceId; this.updateShowMetadata(); await this.updatePTZ(); const deviceOperator = await DeviceOperator.getInstance(); if (deviceOperator !== null) { - const {deviceId} = this.getVideoTrack().getSettings(); + const {deviceId} = getVideoTrackSettings(this.getVideoTrack()); const isSuccess = await deviceOperator.setCameraFrameRotationEnabledAtSource( deviceId, false); @@ -362,12 +370,13 @@ this.disableShowMetadata(); if (this.streamInternal !== null) { const track = this.getVideoTrack(); - const {deviceId} = track.getSettings(); + const {deviceId} = getVideoTrackSettings(track); track.stop(); const deviceOperator = await DeviceOperator.getInstance(); if (deviceOperator !== null) { deviceOperator.dropConnection(deviceId); } + assert(this.onPreviewExpired !== null); this.onPreviewExpired.signal(); this.onPreviewExpired = null; this.streamInternal = null; @@ -410,18 +419,19 @@ element.style.display = 'none'; }); - const displayCategory = (selector, enabled) => { + const displayCategory = (selector: string, enabled: boolean) => { dom.get(selector, HTMLElement).classList.toggle('mode-on', enabled); }; - const showValue = (selector, val) => { + const showValue = (selector: string, val: string) => { const element = dom.get(selector, HTMLElement); element.style.display = ''; element.textContent = val; }; - const buildInverseMap = - (obj: Record<string, number>, prefix: string): Map<number, string> => { + const buildInverseLookupFunction = + (obj: Record<string, number>, + prefix: string): (key: number) => string => { const map = new Map<number, string>(); for (const [key, val] of Object.entries(obj)) { if (!key.startsWith(prefix)) { @@ -435,20 +445,24 @@ } map.set(val, key.slice(prefix.length)); } - return map; + return (key: number) => { + const val = map.get(key); + assert(val !== undefined); + return val; + }; }; - const afStateName = - buildInverseMap(AndroidControlAfState, 'ANDROID_CONTROL_AF_STATE_'); - const aeStateName = - buildInverseMap(AndroidControlAeState, 'ANDROID_CONTROL_AE_STATE_'); - const awbStateName = - buildInverseMap(AndroidControlAwbState, 'ANDROID_CONTROL_AWB_STATE_'); - const aeAntibandingModeName = buildInverseMap( + const afStateNameLookup = buildInverseLookupFunction( + AndroidControlAfState, 'ANDROID_CONTROL_AF_STATE_'); + const aeStateNameLookup = buildInverseLookupFunction( + AndroidControlAeState, 'ANDROID_CONTROL_AE_STATE_'); + const awbStateNameLookup = buildInverseLookupFunction( + AndroidControlAwbState, 'ANDROID_CONTROL_AWB_STATE_'); + const aeAntibandingModeNameLookup = buildInverseLookupFunction( AndroidControlAeAntibandingMode, 'ANDROID_CONTROL_AE_ANTIBANDING_MODE_'); - let sensorSensitivity = null; + let sensorSensitivity: number|null = null; let sensorSensitivityBoost = 100; const getSensitivity = () => { if (sensorSensitivity === null) { @@ -468,7 +482,7 @@ showValue('#preview-focus-distance', `${focusDistance} cm`); }, [tag.ANDROID_CONTROL_AF_STATE]: ([value]) => { - showValue('#preview-af-state', afStateName.get(value)); + showValue('#preview-af-state', afStateNameLookup(value)); }, [tag.ANDROID_SENSOR_SENSITIVITY]: ([value]) => { sensorSensitivity = value; @@ -490,10 +504,10 @@ }, [tag.ANDROID_CONTROL_AE_ANTIBANDING_MODE]: ([value]) => { showValue( - '#preview-ae-antibanding-mode', aeAntibandingModeName.get(value)); + '#preview-ae-antibanding-mode', aeAntibandingModeNameLookup(value)); }, [tag.ANDROID_CONTROL_AE_STATE]: ([value]) => { - showValue('#preview-ae-state', aeStateName.get(value)); + showValue('#preview-ae-state', aeStateNameLookup(value)); }, [tag.ANDROID_COLOR_CORRECTION_GAINS]: ([valueRed, , , valueBlue]) => { const wbGainRed = valueRed.toFixed(2); @@ -502,7 +516,7 @@ showValue('#preview-wb-gain-blue', `${wbGainBlue}x`); }, [tag.ANDROID_CONTROL_AWB_STATE]: ([value]) => { - showValue('#preview-awb-state', awbStateName.get(value)); + showValue('#preview-awb-state', awbStateNameLookup(value)); }, [tag.ANDROID_CONTROL_AF_MODE]: ([value]) => { displayCategory( @@ -532,7 +546,7 @@ // Here we use the metadata events to calculate a reasonable approximation. const updateFps = (() => { const FPS_MEASURE_FRAMES = 100; - const timestamps = []; + const timestamps: number[] = []; return () => { const now = performance.now(); timestamps.push(now); @@ -551,29 +565,32 @@ return; } - const deviceId = videoTrack.getSettings().deviceId; + const {deviceId} = getVideoTrackSettings(videoTrack); const activeArraySize = await deviceOperator.getActiveArraySize(deviceId); const cameraFrameRotation = await deviceOperator.getCameraFrameRotation(deviceId); this.faceOverlay = new FaceOverlay(activeArraySize, (360 - cameraFrameRotation) % 360); - const updateFace = (mode, rects) => { - if (mode === - AndroidStatisticsFaceDetectMode - .ANDROID_STATISTICS_FACE_DETECT_MODE_OFF) { - dom.get('#preview-num-faces', HTMLDivElement).style.display = 'none'; - this.faceOverlay.clear(); - return; - } - assert(rects.length % 4 === 0); - const numFaces = rects.length / 4; - const label = numFaces >= 2 ? 'Faces' : 'Face'; - showValue('#preview-num-faces', `${numFaces} ${label}`); - this.faceOverlay.show(rects); - }; + const updateFace = + (mode: AndroidStatisticsFaceDetectMode, rects: number[]) => { + assert(this.faceOverlay !== null); + if (mode === + AndroidStatisticsFaceDetectMode + .ANDROID_STATISTICS_FACE_DETECT_MODE_OFF) { + dom.get('#preview-num-faces', HTMLDivElement).style.display = + 'none'; + this.faceOverlay.clear(); + return; + } + assert(rects.length % 4 === 0); + const numFaces = rects.length / 4; + const label = numFaces >= 2 ? 'Faces' : 'Face'; + showValue('#preview-num-faces', `${numFaces} ${label}`); + this.faceOverlay.show(rects); + }; - const callback = (metadata) => { + const callback = (metadata: CameraMetadata) => { showValue('#preview-resolution', resolution); showValue('#preview-device-name', deviceName); const fps = updateFps(); @@ -583,9 +600,9 @@ let faceMode = AndroidStatisticsFaceDetectMode .ANDROID_STATISTICS_FACE_DETECT_MODE_OFF; - let faceRects = []; + let faceRects: number[] = []; - const tryParseFaceEntry = (entry) => { + const tryParseFaceEntry = (entry: CameraMetadataEntry) => { switch (entry.tag) { case tag.ANDROID_STATISTICS_FACE_DETECT_MODE: { const data = parseMetadata(entry); @@ -601,6 +618,7 @@ return false; }; + assert(metadata.entries !== undefined); for (const entry of metadata.entries) { if (entry.count === 0) { continue; @@ -683,7 +701,9 @@ */ private onFocusClicked(event: MouseEvent) { this.cancelFocus(); - const focus = (async () => { + const marker = Symbol(); + this.focusMarker = marker; + (async () => { try { // Normalize to square space coordinates by W3C spec. const x = event.offsetX / this.video.offsetWidth; @@ -694,7 +714,7 @@ // error and return. return; } - if (focus !== this.focus) { + if (marker !== this.focusMarker) { return; // Focus was cancelled. } const aim = dom.get('#preview-focus-aim', HTMLObjectElement); @@ -702,16 +722,16 @@ clone.style.left = `${event.offsetX + this.video.offsetLeft}px`; clone.style.top = `${event.offsetY + this.video.offsetTop}px`; clone.hidden = false; + assert(aim.parentElement !== null); aim.parentElement.replaceChild(clone, aim); })(); - this.focus = focus; } /** * Cancels the current applying focus. */ private cancelFocus() { - this.focus = null; + this.focusMarker = null; const aim = dom.get('#preview-focus-aim', HTMLObjectElement); aim.hidden = true; }
diff --git a/ash/webui/camera_app_ui/resources/js/type.ts b/ash/webui/camera_app_ui/resources/js/type.ts index ab4e28c..53d521e 100644 --- a/ash/webui/camera_app_ui/resources/js/type.ts +++ b/ash/webui/camera_app_ui/resources/js/type.ts
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +import {assertExists, assertInstanceof} from './assert.js'; + /** * Photo or video resolution. */ @@ -190,6 +192,27 @@ perfInfo?: PerfInformation; } +export interface VideoTrackSettings { + deviceId: string; + width: number; + height: number; + frameRate: number; +} + +export function getVideoTrackSettings(videoTrack: MediaStreamTrack): + VideoTrackSettings { + // TODO(pihsun): The type from TypeScript lib.dom.d.ts is wrong on Chrome and + // the .deviceId should never be undefined. Try to override that when we have + // newer TypeScript compiler (>= 4.5) that supports overriding lib.dom.d.ts. + const {deviceId, width, height, frameRate} = videoTrack.getSettings(); + return { + deviceId: assertExists(deviceId), + width: assertExists(width), + height: assertExists(height), + frameRate: assertExists(frameRate), + }; +} + /** * A proxy to get preview video or stream with notification of when the video * stream is expired. @@ -206,15 +229,15 @@ } getStream(): MediaStream { - return this.video.srcObject as MediaStream; + return assertInstanceof(this.video.srcObject, MediaStream); } getVideoTrack(): MediaStreamTrack { return this.getStream().getVideoTracks()[0]; } - getVideoSettings(): MediaTrackSettings { - return this.getVideoTrack().getSettings(); + getVideoSettings(): VideoTrackSettings { + return getVideoTrackSettings(this.getVideoTrack()); } isExpired(): boolean {
diff --git a/ash/webui/camera_app_ui/resources/js/views/camera/options.ts b/ash/webui/camera_app_ui/resources/js/views/camera/options.ts index a25fbad..c282e2d 100644 --- a/ash/webui/camera_app_ui/resources/js/views/camera/options.ts +++ b/ash/webui/camera_app_ui/resources/js/views/camera/options.ts
@@ -100,7 +100,7 @@ }); } - private updateVideoConstFpsOption(prefFps: number) { + private updateVideoConstFpsOption(prefFps: number|null) { this.toggleFps.checked = prefFps === 60; SUPPORTED_CONSTANT_FPS.forEach( (fps) => state.set(state.assertState(`fps-${fps}`), fps === prefFps)); @@ -160,7 +160,8 @@ let enabled = facing !== Facing.ENVIRONMENT; // Override mirroring only if mirroring was toggled manually. - if (this.videoDeviceId in this.mirroringToggles) { + if (this.videoDeviceId !== null && + this.videoDeviceId in this.mirroringToggles) { enabled = this.mirroringToggles[this.videoDeviceId]; } @@ -171,8 +172,10 @@ * Saves the toggled mirror state for the current video device. */ private saveMirroring() { - this.mirroringToggles[this.videoDeviceId] = this.toggleMirror.checked; - localStorage.set('mirroringToggles', this.mirroringToggles); + if (this.videoDeviceId !== null) { + this.mirroringToggles[this.videoDeviceId] = this.toggleMirror.checked; + localStorage.set('mirroringToggles', this.mirroringToggles); + } } /**
diff --git a/ash/webui/eche_app_ui/DEPS b/ash/webui/eche_app_ui/DEPS index 02e2c72..e81a168e 100644 --- a/ash/webui/eche_app_ui/DEPS +++ b/ash/webui/eche_app_ui/DEPS
@@ -3,7 +3,6 @@ "+ash/grit/ash_eche_bundle_resources.h", "+ash/grit/ash_eche_bundle_resources_map.h", "+chromeos/services/device_sync/public/cpp", - "+chromeos/services/secure_channel/public/cpp", "+components/keyed_service/core/keyed_service.h", "+crypto/random.h", "+third_party/boringssl/src/include",
diff --git a/ash/webui/eche_app_ui/eche_app_manager.cc b/ash/webui/eche_app_ui/eche_app_manager.cc index d7b8513..397a5bbc 100644 --- a/ash/webui/eche_app_ui/eche_app_manager.cc +++ b/ash/webui/eche_app_ui/eche_app_manager.cc
@@ -6,6 +6,7 @@ #include "ash/components/phonehub/phone_hub_manager.h" #include "ash/public/cpp/network_config_service.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager_impl.h" #include "ash/webui/eche_app_ui/apps_access_manager_impl.h" #include "ash/webui/eche_app_ui/eche_connector_impl.h" #include "ash/webui/eche_app_ui/eche_message_receiver_impl.h" @@ -17,7 +18,6 @@ #include "ash/webui/eche_app_ui/system_info.h" #include "ash/webui/eche_app_ui/system_info_provider.h" #include "base/system/sys_info.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager_impl.h" namespace ash { namespace {
diff --git a/ash/webui/eche_app_ui/eche_app_manager.h b/ash/webui/eche_app_ui/eche_app_manager.h index 088d7170..40ffd1b 100644 --- a/ash/webui/eche_app_ui/eche_app_manager.h +++ b/ash/webui/eche_app_ui/eche_app_manager.h
@@ -9,6 +9,11 @@ #include <memory> #include "ash/components/phonehub/phone_hub_manager.h" +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h" +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "ash/webui/eche_app_ui/eche_feature_status_provider.h" #include "ash/webui/eche_app_ui/eche_notification_click_handler.h" #include "ash/webui/eche_app_ui/eche_recent_app_click_handler.h" @@ -19,11 +24,6 @@ // TODO(https://crbug.com/1164001): move to forward declaration. #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" #include "chromeos/services/network_config/public/mojom/cros_network_config.mojom.h" -// TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" -#include "chromeos/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h" -// TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "components/keyed_service/core/keyed_service.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/ash/webui/eche_app_ui/eche_connector_impl.cc b/ash/webui/eche_app_ui/eche_connector_impl.cc index 9834726..ddaed2a 100644 --- a/ash/webui/eche_app_ui/eche_connector_impl.cc +++ b/ash/webui/eche_app_ui/eche_connector_impl.cc
@@ -5,12 +5,12 @@ #include "ash/webui/eche_app_ui/eche_connector_impl.h" #include "ash/components/phonehub/phone_hub_manager.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" #include "ash/webui/eche_app_ui/proto/exo_messages.pb.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/components/multidevice/software_feature.h" #include "chromeos/components/multidevice/software_feature_state.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" namespace ash { namespace eche_app {
diff --git a/ash/webui/eche_app_ui/eche_connector_impl.h b/ash/webui/eche_app_ui/eche_connector_impl.h index ef56f34..938c0ec 100644 --- a/ash/webui/eche_app_ui/eche_connector_impl.h +++ b/ash/webui/eche_app_ui/eche_connector_impl.h
@@ -7,11 +7,11 @@ #include "ash/webui/eche_app_ui/eche_connector.h" +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" #include "ash/webui/eche_app_ui/eche_feature_status_provider.h" #include "ash/webui/eche_app_ui/feature_status_provider.h" #include "base/containers/queue.h" -// TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" namespace ash { namespace eche_app {
diff --git a/ash/webui/eche_app_ui/eche_feature_status_provider.h b/ash/webui/eche_app_ui/eche_feature_status_provider.h index 3967a4d..1ec993c3 100644 --- a/ash/webui/eche_app_ui/eche_feature_status_provider.h +++ b/ash/webui/eche_app_ui/eche_feature_status_provider.h
@@ -8,12 +8,12 @@ #include "ash/components/phonehub/feature_status_provider.h" // TODO(https://crbug.com/1164001): move to forward declaration. #include "ash/components/phonehub/phone_hub_manager.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" #include "ash/webui/eche_app_ui/feature_status_provider.h" #include "base/memory/weak_ptr.h" // TODO(https://crbug.com/1164001): move to forward declaration. #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" namespace ash { namespace eche_app {
diff --git a/ash/webui/eche_app_ui/eche_feature_status_provider_unittest.cc b/ash/webui/eche_app_ui/eche_feature_status_provider_unittest.cc index 85f2558..b38735a 100644 --- a/ash/webui/eche_app_ui/eche_feature_status_provider_unittest.cc +++ b/ash/webui/eche_app_ui/eche_feature_status_provider_unittest.cc
@@ -9,11 +9,11 @@ #include "ash/components/phonehub/fake_phone_hub_manager.h" #include "ash/components/phonehub/phone_hub_manager.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "base/test/task_environment.h" #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/ash/webui/eche_app_ui/eche_message_receiver_impl.h b/ash/webui/eche_app_ui/eche_message_receiver_impl.h index 4762db6..818c041 100644 --- a/ash/webui/eche_app_ui/eche_message_receiver_impl.h +++ b/ash/webui/eche_app_ui/eche_message_receiver_impl.h
@@ -7,7 +7,7 @@ #include "ash/webui/eche_app_ui/eche_message_receiver.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" namespace ash { namespace eche_app {
diff --git a/ash/webui/eche_app_ui/eche_message_receiver_impl_unittest.cc b/ash/webui/eche_app_ui/eche_message_receiver_impl_unittest.cc index b7cc40a..2f79bd9 100644 --- a/ash/webui/eche_app_ui/eche_message_receiver_impl_unittest.cc +++ b/ash/webui/eche_app_ui/eche_message_receiver_impl_unittest.cc
@@ -4,8 +4,8 @@ #include "ash/webui/eche_app_ui/eche_message_receiver_impl.h" +#include "ash/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "ash/webui/eche_app_ui/proto/exo_messages.pb.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_connection_manager.h" #include "testing/gtest/include/gtest/gtest.h" namespace ash {
diff --git a/ash/webui/eche_app_ui/eche_presence_manager.cc b/ash/webui/eche_app_ui/eche_presence_manager.cc index 48b666c..f305aa47 100644 --- a/ash/webui/eche_app_ui/eche_presence_manager.cc +++ b/ash/webui/eche_app_ui/eche_presence_manager.cc
@@ -4,12 +4,12 @@ #include "ash/webui/eche_app_ui/eche_presence_manager.h" +#include "ash/services/secure_channel/public/cpp/client/presence_monitor_client.h" #include "ash/webui/eche_app_ui/eche_connector.h" #include "ash/webui/eche_app_ui/proto/exo_messages.pb.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/presence_monitor_client.h" namespace ash { namespace eche_app {
diff --git a/ash/webui/eche_app_ui/eche_presence_manager.h b/ash/webui/eche_app_ui/eche_presence_manager.h index e23ad9c..8ec0ce8 100644 --- a/ash/webui/eche_app_ui/eche_presence_manager.h +++ b/ash/webui/eche_app_ui/eche_presence_manager.h
@@ -7,6 +7,8 @@ #include <memory> +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/client/presence_monitor_client.h" #include "ash/webui/eche_app_ui/eche_feature_status_provider.h" #include "ash/webui/eche_app_ui/eche_message_receiver.h" #include "ash/webui/eche_app_ui/feature_status_provider.h" @@ -16,8 +18,6 @@ #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" // TODO(https://crbug.com/1164001): move to forward declaration. #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" -// TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/presence_monitor_client.h" namespace ash { namespace eche_app {
diff --git a/ash/webui/eche_app_ui/eche_signaler.h b/ash/webui/eche_app_ui/eche_signaler.h index 386ff76..7d77484 100644 --- a/ash/webui/eche_app_ui/eche_signaler.h +++ b/ash/webui/eche_app_ui/eche_signaler.h
@@ -5,9 +5,9 @@ #ifndef ASH_WEBUI_ECHE_APP_UI_ECHE_SIGNALER_H_ #define ASH_WEBUI_ECHE_APP_UI_ECHE_SIGNALER_H_ +#include "ash/services/secure_channel/public/cpp/client/connection_manager.h" #include "ash/webui/eche_app_ui/eche_connector.h" #include "ash/webui/eche_app_ui/mojom/eche_app.mojom.h" -#include "chromeos/services/secure_channel/public/cpp/client/connection_manager.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver_set.h"
diff --git a/base/BUILD.gn b/base/BUILD.gn index 247befa..c411550 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -3756,9 +3756,16 @@ "//third_party/fuchsia-sdk/sdk/pkg/sys_cpp", ] - use_cfv2 = true - additional_manifest_fragments = - [ "//build/config/fuchsia/test/logger.shard.test-cml" ] + # TODO(crbug.com/1256502): Switch back to CFv2 and delete the .test-cmx once + # the bug is fixed. + use_cfv2 = false + if (use_cfv2) { + additional_manifest_fragments = + [ "//build/config/fuchsia/test/logger.shard.test-cml" ] + } else { + additional_manifest_fragments = + [ "//build/config/fuchsia/test/test_logger_capabilities.test-cmx" ] + } } if (!is_fuchsia && !is_ios) {
diff --git a/base/allocator/partition_allocator/starscan/pcscan_internal.cc b/base/allocator/partition_allocator/starscan/pcscan_internal.cc index ac1f74a..19e645b 100644 --- a/base/allocator/partition_allocator/starscan/pcscan_internal.cc +++ b/base/allocator/partition_allocator/starscan/pcscan_internal.cc
@@ -120,11 +120,11 @@ }; #if PA_STARSCAN_USE_CARD_TABLE -// Bytemap that represent regions (cards) that contain quarantined objects. +// Bytemap that represent regions (cards) that contain quarantined slots. // A single PCScan cycle consists of the following steps: // 1) clearing (memset quarantine + marking cards that contain quarantine); // 2) scanning; -// 3) sweeping (freeing + unmarking cards that contain freed objects). +// 3) sweeping (freeing + unmarking cards that contain freed slots). // Marking cards on step 1) ensures that the card table stays in the consistent // state while scanning. Unmarking on the step 3) ensures that unmarking // actually happens (and we don't hit too many false positives). @@ -152,7 +152,7 @@ } // Returns whether the card to which |address| points to contains quarantined - // objects. May return false positives for but should never return false + // slots. May return false positives for but should never return false // negatives, as otherwise this breaks security. ALWAYS_INLINE bool IsQuarantined(uintptr_t address) const { address = memory::UnmaskPtr(address); @@ -331,7 +331,7 @@ #endif } -// SuperPageSnapshot is used to record all slot spans that contain live objects. +// SuperPageSnapshot is used to record all slot spans that contain live slots. // The class avoids dynamic allocations and is designed to be instantiated on // stack. To avoid stack overflow, internal data structures are kept packed. class SuperPageSnapshot final { @@ -569,9 +569,9 @@ PA_SCAN_INLINE AllocationStateMap* TryFindScannerBitmapForPointer( uintptr_t maybe_ptr) const; - // Lookup and marking functions. Return size of the object if marked or zero + // Lookup and marking functions. Return size of the slot if marked, or zero // otherwise. - PA_SCAN_INLINE size_t TryMarkObjectInNormalBuckets(uintptr_t maybe_ptr) const; + PA_SCAN_INLINE size_t TryMarkSlotInNormalBuckets(uintptr_t maybe_ptr) const; // Scans stack, only called from safepoints. void ScanStack(); @@ -587,17 +587,16 @@ uintptr_t* end, size_t slot_size); - // Scans all registered partitions and marks reachable quarantined objects. + // Scans all registered partitions and marks reachable quarantined slots. void ScanPartitions(); - // Clear quarantined objects and prepare card table for fast lookup - void ClearQuarantinedObjectsAndPrepareCardTable(); + // Clear quarantined slots and prepare card table for fast lookup + void ClearQuarantinedSlotsAndPrepareCardTable(); // Unprotect all slot spans from all partitions. void UnprotectPartitions(); - // Sweeps (frees) unreachable quarantined entries. Returns the size of swept - // objects. + // Sweeps (frees) unreachable quarantined entries. void SweepQuarantine(); // Finishes the scanner (updates limits, UMA, etc). @@ -614,7 +613,7 @@ std::atomic<size_t> number_of_scanning_threads_{0u}; // We can unprotect only once to reduce context-switches. std::once_flag unprotect_once_flag_; - bool immediatelly_free_objects_{false}; + bool immediatelly_free_slots_{false}; PCScan& pcscan_; }; @@ -651,17 +650,17 @@ } // Looks up and marks a potential dangling pointer. Returns the size of the slot -// (which is then accounted as quarantined) or zero if no object is found. +// (which is then accounted as quarantined), or zero if no slot is found. // For normal bucket super pages, PCScan uses two quarantine bitmaps, the -// mutator and the scanner one. The former is used by mutators when objects are +// mutator and the scanner one. The former is used by mutators when slots are // freed, while the latter is used concurrently by the PCScan thread. The // bitmaps are swapped as soon as PCScan is triggered. Once a dangling pointer -// (which points to an object in the scanner bitmap) is found, -// TryMarkObjectInNormalBuckets() marks it again in the bitmap and clears +// (which points to a slot in the scanner bitmap) is found, +// TryMarkSlotInNormalBuckets() marks it again in the bitmap and clears // from the scanner bitmap. This way, when scanning is done, all uncleared -// entries in the scanner bitmap correspond to unreachable objects. +// entries in the scanner bitmap correspond to unreachable slots. PA_SCAN_INLINE size_t -PCScanTask::TryMarkObjectInNormalBuckets(uintptr_t maybe_ptr) const { +PCScanTask::TryMarkSlotInNormalBuckets(uintptr_t maybe_ptr) const { // Check if |maybe_ptr| points somewhere to the heap. auto* state_map = TryFindScannerBitmapForPointer(maybe_ptr); if (!state_map) @@ -688,19 +687,19 @@ #endif // Check if pointer was in the quarantine bitmap. - const GetSlotStartResult object_start_result = + const GetSlotStartResult slot_start_result = GetSlotStartInSuperPage(maybe_ptr); - if (!object_start_result.is_found()) + if (!slot_start_result.is_found()) return 0; - const uintptr_t slot_start = object_start_result.slot_start; + const uintptr_t slot_start = slot_start_result.slot_start; if (LIKELY(!state_map->IsQuarantined(slot_start))) return 0; PA_SCAN_DCHECK((maybe_ptr & kSuperPageBaseMask) == (slot_start & kSuperPageBaseMask)); - if (UNLIKELY(immediatelly_free_objects_)) + if (UNLIKELY(immediatelly_free_slots_)) return 0; // Now we are certain that |maybe_ptr| is a dangling pointer. Mark it again in @@ -708,12 +707,12 @@ // PCScan has exclusive access to the scanner bitmap, we can avoid atomic rmw // operation for it. if (LIKELY(state_map->MarkQuarantinedAsReachable(slot_start, pcscan_epoch_))) - return object_start_result.slot_size; + return slot_start_result.slot_size; return 0; } -void PCScanTask::ClearQuarantinedObjectsAndPrepareCardTable() { +void PCScanTask::ClearQuarantinedSlotsAndPrepareCardTable() { const PCScan::ClearType clear_type = pcscan_.clear_type_; #if !PA_STARSCAN_USE_CARD_TABLE @@ -725,17 +724,19 @@ view.VisitConcurrently([clear_type](uintptr_t super_page) { auto* bitmap = StateBitmapFromAddr(super_page); auto* root = Root::FromFirstSuperPage(super_page); - bitmap->IterateQuarantined([root, clear_type](uintptr_t address) { - auto* object = memory::RemaskPtr(reinterpret_cast<void*>(address)); - auto* slot_span = SlotSpan::FromSlotInnerPtr(object); + bitmap->IterateQuarantined([root, clear_type](uintptr_t slot_start) { + auto* slot_span = SlotSpan::FromSlotStart(slot_start); // Use zero as a zapping value to speed up the fast bailout check in // ScanPartitions. const size_t size = slot_span->GetUsableSize(root); - if (clear_type == PCScan::ClearType::kLazy) + if (clear_type == PCScan::ClearType::kLazy) { + void* object = + memory::RemaskPtr(root->AdjustPointerForExtrasAdd(slot_start)); memset(object, 0, size); + } #if PA_STARSCAN_USE_CARD_TABLE - // Set card(s) for this quarantined object. - QuarantineCardTable::GetFrom(address).Quarantine(address, size); + // Set card(s) for this quarantined slot. + QuarantineCardTable::GetFrom(slot_start).Quarantine(slot_start, size); #endif }); }); @@ -783,7 +784,7 @@ PA_SCAN_INLINE void CheckPointer(uintptr_t maybe_ptr) { quarantine_size_ += - task_.TryMarkObjectInNormalBuckets(memory::UnmaskPtr(maybe_ptr)); + task_.TryMarkSlotInNormalBuckets(memory::UnmaskPtr(maybe_ptr)); } const PCScanTask& task_; @@ -808,7 +809,7 @@ quarantine_size_ += loop.quarantine_size(); } - // Returns size of quarantined objects that are reachable from the current + // Returns size of quarantined slots that are reachable from the current // stack. size_t quarantine_size() const { return quarantine_size_; } @@ -821,7 +822,7 @@ : pcscan_epoch_(pcscan.epoch() - 1), snapshot_(StarScanSnapshot::Create(PCScanInternal::Instance())), stats_(PCScanInternal::Instance().process_name(), quarantine_last_size), - immediatelly_free_objects_( + immediatelly_free_slots_( PCScanInternal::Instance().IsImmediateFreeingEnabled()), pcscan_(pcscan) {} @@ -857,7 +858,7 @@ uintptr_t* end, size_t slot_size) { // For scanning large areas, it's worthwhile checking whether the range that - // is scanned contains allocated objects. It also helps to skip discarded + // is scanned contains allocated slots. It also helps to skip discarded // freed slots. // Protect slot span before scanning it. pcscan.ProtectPages(reinterpret_cast<uintptr_t>(begin), @@ -868,8 +869,8 @@ for (uintptr_t* current_slot = begin; current_slot < end; current_slot += slot_size_in_words) { - // It is okay to skip objects as their payload has been zapped at this - // point which means that the pointers no longer retain other objects. + // It is okay to skip slots as the object they hold has been zapped at this + // point, which means that the pointers no longer retain other slots. if (!bitmap->IsAllocated(reinterpret_cast<uintptr_t>(current_slot))) { continue; } @@ -881,7 +882,7 @@ void PCScanTask::ScanPartitions() { // Threshold for which bucket size it is worthwhile in checking whether the - // object is allocated and needs to be scanned. PartitionPurgeSlotSpan() + // slot is allocated and needs to be scanned. PartitionPurgeSlotSpan() // purges only slots >= page-size, this helps us to avoid faulting in // discarded pages. We actually lower it further to 1024, to take advantage of // skipping unallocated slots, but don't want to go any lower, as this comes @@ -926,31 +927,29 @@ size_t discarded_bytes = 0; }; -void UnmarkInCardTable(uintptr_t object, +void UnmarkInCardTable(uintptr_t slot_start, SlotSpanMetadata<ThreadSafe>* slot_span) { #if PA_STARSCAN_USE_CARD_TABLE - object = memory::UnmaskPtr(object); - // Reset card(s) for this quarantined object. Please note that the - // cards may still contain quarantined objects (which were - // promoted in this scan cycle), but - // ClearQuarantinedObjectsAndFilterSuperPages() will set them - // again in the next PCScan cycle. - QuarantineCardTable::GetFrom(object).Unquarantine( - object, slot_span->GetUtilizedSlotSize()); + // Reset card(s) for this quarantined slot. Please note that the cards may + // still contain quarantined slots (which were promoted in this scan cycle), + // but ClearQuarantinedSlotsAndPrepareCardTable() will set them again in the + // next PCScan cycle. + QuarantineCardTable::GetFrom(slot_start) + .Unquarantine(slot_start, slot_span->GetUtilizedSlotSize()); #endif } [[maybe_unused]] size_t FreeAndUnmarkInCardTable( PartitionRoot<ThreadSafe>* root, SlotSpanMetadata<ThreadSafe>* slot_span, - uintptr_t object) { + uintptr_t slot_start) { + void* object = root->AdjustPointerForExtrasAdd(slot_start); + // TODO(bartekn): Move the cast and MTE masking to a more suitable place. object = memory::RemaskPtr(object); - const size_t slot_size = slot_span->bucket->slot_size; - uintptr_t slot_start = - root->AdjustPointerForExtrasSubtract(reinterpret_cast<void*>(object)); - root->FreeNoHooksImmediate(object, slot_span, slot_start); - UnmarkInCardTable(object, slot_span); - return slot_size; + root->FreeNoHooksImmediate(reinterpret_cast<uintptr_t>(object), slot_span, + slot_start); + UnmarkInCardTable(slot_start, slot_span); + return slot_span->bucket->slot_size; } [[maybe_unused]] void SweepSuperPage(ThreadSafePartitionRoot* root, @@ -959,10 +958,10 @@ SweepStat& stat) { auto* bitmap = StateBitmapFromAddr(super_page); ThreadSafePartitionRoot::FromFirstSuperPage(super_page); - bitmap->IterateUnmarkedQuarantined(epoch, [root, &stat](uintptr_t object) { - auto* slot_span = SlotSpanMetadata<ThreadSafe>::FromSlotInnerPtr( - reinterpret_cast<void*>(object)); - stat.swept_bytes += FreeAndUnmarkInCardTable(root, slot_span, object); + bitmap->IterateUnmarkedQuarantined(epoch, [root, + &stat](uintptr_t slot_start) { + auto* slot_span = SlotSpanMetadata<ThreadSafe>::FromSlotStart(slot_start); + stat.swept_bytes += FreeAndUnmarkInCardTable(root, slot_span, slot_start); }); } @@ -972,24 +971,22 @@ size_t epoch, SweepStat& stat) { auto* bitmap = StateBitmapFromAddr(super_page); - bitmap->IterateQuarantined(epoch, [root, &stat](uintptr_t object, + bitmap->IterateQuarantined(epoch, [root, &stat](uintptr_t slot_start, bool is_marked) { - auto* slot_span = SlotSpanMetadata<ThreadSafe>::FromSlotInnerPtr( - reinterpret_cast<void*>(object)); + auto* slot_span = SlotSpanMetadata<ThreadSafe>::FromSlotStart(slot_start); if (LIKELY(!is_marked)) { - stat.swept_bytes += FreeAndUnmarkInCardTable(root, slot_span, object); + stat.swept_bytes += FreeAndUnmarkInCardTable(root, slot_span, slot_start); return; } // Otherwise, try to discard pages for marked quarantine. Since no data is - // stored in quarantined objects (e.g. the |next| pointer), this can be + // stored in quarantined slots (e.g. the |next| pointer), this can be // freely done. const size_t slot_size = slot_span->bucket->slot_size; if (slot_size >= SystemPageSize()) { - // Since no data is stored in quarantined objects (e.g. the |next| - // pointer), we can freely discard physical memory. const uintptr_t discard_end = - bits::AlignDown(object + slot_size, SystemPageSize()); - const uintptr_t discard_begin = bits::AlignUp(object, SystemPageSize()); + bits::AlignDown(slot_start + slot_size, SystemPageSize()); + const uintptr_t discard_begin = + bits::AlignUp(slot_start, SystemPageSize()); const intptr_t discard_size = discard_end - discard_begin; if (discard_size > 0) { DiscardSystemPages(discard_begin, discard_size); @@ -1012,9 +1009,9 @@ internal::PartitionFreelistEntry* freelist_head = nullptr; size_t freelist_entries = 0; - const auto bitmap_iterator = [&](uintptr_t address) { - SlotSpan* current_slot_span = SlotSpan::FromSlotStart(address); - auto* entry = PartitionFreelistEntry::EmplaceAndInitNull(address); + const auto bitmap_iterator = [&](uintptr_t slot_start) { + SlotSpan* current_slot_span = SlotSpan::FromSlotStart(slot_start); + auto* entry = PartitionFreelistEntry::EmplaceAndInitNull(slot_start); if (current_slot_span != previous_slot_span) { // We started scanning a new slot span. Flush the accumulated freelist to @@ -1035,7 +1032,7 @@ freelist_tail = entry; ++freelist_entries; - UnmarkInCardTable(address, current_slot_span); + UnmarkInCardTable(slot_start, current_slot_span); stat.swept_bytes += current_slot_span->bucket->slot_size; }; @@ -1116,10 +1113,10 @@ if (!pcscan_.IsJoinable()) return; { - // Clear all quarantined objects and prepare card table. + // Clear all quarantined slots and prepare card table. StatsCollector::MutatorScope clear_scope( stats_, StatsCollector::MutatorId::kClear); - ClearQuarantinedObjectsAndPrepareCardTable(); + ClearQuarantinedSlotsAndPrepareCardTable(); } { // Scan the thread's stack to find dangling references. @@ -1148,10 +1145,10 @@ { SyncScope<Context::kScanner> sync_scope(*this); { - // Clear all quarantined objects and prepare the card table. + // Clear all quarantined slots and prepare the card table. StatsCollector::ScannerScope clear_scope( stats_, StatsCollector::ScannerId::kClear); - ClearQuarantinedObjectsAndPrepareCardTable(); + ClearQuarantinedSlotsAndPrepareCardTable(); } { // Scan heap for dangling references. @@ -1165,7 +1162,7 @@ } } { - // Sweep unreachable quarantined objects. + // Sweep unreachable quarantined slots. StatsCollector::ScannerScope sweep_scope( stats_, StatsCollector::ScannerId::kSweep); SweepQuarantine();
diff --git a/base/fuchsia/test_component_context_for_process_unittest.cc b/base/fuchsia/test_component_context_for_process_unittest.cc index 7d83eb61..1de931a 100644 --- a/base/fuchsia/test_component_context_for_process_unittest.cc +++ b/base/fuchsia/test_component_context_for_process_unittest.cc
@@ -110,8 +110,9 @@ // Use the Loader to verify that it was the system service that was connected. // Load the component containing this test since we know it exists. // TODO(https://fxbug.dev/51490): Use a programmatic mechanism to obtain this. + // TODO(crbug.com/1256502): Switch back to `.cm` once the bug is fixed. const char kComponentUrl[] = - "fuchsia-pkg://fuchsia.com/base_unittests#meta/base_unittests.cm"; + "fuchsia-pkg://fuchsia.com/base_unittests#meta/base_unittests.cmx"; loader->LoadUrl(kComponentUrl, [quit_loop = wait_loop.QuitClosure(), expected_path = kComponentUrl]( ::fuchsia::sys::PackagePtr package) {
diff --git a/build/config/fuchsia/test/test_logger_capabilities.test-cmx b/build/config/fuchsia/test/test_logger_capabilities.test-cmx new file mode 100644 index 0000000..68b2a67 --- /dev/null +++ b/build/config/fuchsia/test/test_logger_capabilities.test-cmx
@@ -0,0 +1,7 @@ +{ + "sandbox": { + "services": [ + "fuchsia.logger.Log" + ] + } +} \ No newline at end of file
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 1c3897b..6e6d7c0 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -7.20220126.2.3 +7.20220127.0.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 1c3897b..4499ee8a 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -7.20220126.2.3 +7.20220126.3.1
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni index dcaa6ad..02248db 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni
@@ -208,6 +208,7 @@ "java/src/org/chromium/chrome/browser/browserservices/SessionDataHolder.java", "java/src/org/chromium/chrome/browser/browserservices/SessionHandler.java", "java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClient.java", + "java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientWrappers.java", "java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivitySettingsLauncher.java", "java/src/org/chromium/chrome/browser/browserservices/digitalgoods/AcknowledgeConverter.java", "java/src/org/chromium/chrome/browser/browserservices/digitalgoods/DigitalGoodsAdapter.java", @@ -1070,7 +1071,6 @@ "java/src/org/chromium/chrome/browser/survey/SurveyHttpClientBridge.java", "java/src/org/chromium/chrome/browser/sync/AndroidSyncSettings.java", "java/src/org/chromium/chrome/browser/sync/SyncContentResolverDelegate.java", - "java/src/org/chromium/chrome/browser/sync/SyncController.java", "java/src/org/chromium/chrome/browser/sync/SyncErrorNotifier.java", "java/src/org/chromium/chrome/browser/sync/TrustedVaultClient.java", "java/src/org/chromium/chrome/browser/sync/settings/AccountManagementFragment.java",
diff --git a/chrome/android/chrome_junit_test_java_sources.gni b/chrome/android/chrome_junit_test_java_sources.gni index 1f3e8ed3..5a3768a 100644 --- a/chrome/android/chrome_junit_test_java_sources.gni +++ b/chrome/android/chrome_junit_test_java_sources.gni
@@ -196,7 +196,6 @@ "junit/src/org/chromium/chrome/browser/survey/ChromeSurveyControllerFlowTest.java", "junit/src/org/chromium/chrome/browser/survey/ChromeSurveyControllerTest.java", "junit/src/org/chromium/chrome/browser/survey/SurveyHttpClientBridgeUnitTest.java", - "junit/src/org/chromium/chrome/browser/sync/AndroidSyncSettingsTest.java", "junit/src/org/chromium/chrome/browser/tab/HistoricalTabSaverUnitTest.java", "junit/src/org/chromium/chrome/browser/tab/RequestDesktopUtilsUnitTest.java", "junit/src/org/chromium/chrome/browser/tab/TabAttributesTest.java",
diff --git a/chrome/android/features/autofill_assistant/BUILD.gn b/chrome/android/features/autofill_assistant/BUILD.gn index 200dd4a..d173293 100644 --- a/chrome/android/features/autofill_assistant/BUILD.gn +++ b/chrome/android/features/autofill_assistant/BUILD.gn
@@ -172,6 +172,7 @@ "java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantTermsSection.java", "java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantVerticalExpander.java", "java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantVerticalExpanderAccordion.java", + "java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AutofillUtilChrome.java", "java/src/org/chromium/chrome/browser/autofill_assistant/user_data/additional_sections/AssistantAdditionalSection.java", "java/src/org/chromium/chrome/browser/autofill_assistant/user_data/additional_sections/AssistantAdditionalSectionContainer.java", "java/src/org/chromium/chrome/browser/autofill_assistant/user_data/additional_sections/AssistantAdditionalSectionFactory.java", @@ -226,6 +227,7 @@ generate_jni("jni_headers_public") { sources = [ + "public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAutofillProfile.java", "public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependencies.java", "public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantFeatures.java", "public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java",
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java index ec703bba..2a738b4 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantActionHandlerImpl.java
@@ -29,15 +29,15 @@ */ class AutofillAssistantActionHandlerImpl implements AutofillAssistantActionHandler { private final OnboardingCoordinatorFactory mOnboardingCoordinatorFactory; - private final AssistantDependenciesFactory mDependenciesFactory; + private final AssistantStaticDependencies mStaticDependencies; private final Supplier<WebContents> mWebContentsSupplier; AutofillAssistantActionHandlerImpl(OnboardingCoordinatorFactory onboardingCoordinatorFactory, Supplier<WebContents> webContentsSupplier, - AssistantDependenciesFactory dependenciesFactory) { + AssistantStaticDependencies staticDependencies) { mOnboardingCoordinatorFactory = onboardingCoordinatorFactory; mWebContentsSupplier = webContentsSupplier; - mDependenciesFactory = dependenciesFactory; + mStaticDependencies = staticDependencies; } @Override @@ -142,7 +142,7 @@ } return AutofillAssistantClient.createForWebContents( - webContents, mDependenciesFactory.createDependencies(activity)); + webContents, mStaticDependencies.createDependencies(activity)); } /**
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntryImpl.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntryImpl.java index b75b1b70..dea2b864e 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntryImpl.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntryImpl.java
@@ -21,11 +21,6 @@ @UsedByReflection("AutofillAssistantModuleEntryProvider.java") public class AutofillAssistantModuleEntryImpl implements AutofillAssistantModuleEntry { @Override - public AssistantDependenciesFactory createDependenciesFactory() { - return new AssistantDependenciesFactoryChrome(); - } - - @Override public AssistantOnboardingHelper createOnboardingHelper( WebContents webContents, AssistantDependencies dependencies) { return new AssistantOnboardingHelperImpl(webContents, dependencies); @@ -36,15 +31,13 @@ BottomSheetController bottomSheetController, BrowserControlsStateProvider browserControls, View rootView, Supplier<WebContents> webContentsSupplier, - AssistantDependenciesFactory dependenciesFactory) { - AssistantStaticDependencies staticDependencies = - dependenciesFactory.createStaticDependencies(); + AssistantStaticDependencies staticDependencies) { return new AutofillAssistantActionHandlerImpl( new OnboardingCoordinatorFactory(context, bottomSheetController, () -> new AssistantBrowserControlsChrome(browserControls), rootView, staticDependencies.getAccessibilityUtil(), staticDependencies.createInfoPageUtil()), - webContentsSupplier, dependenciesFactory); + webContentsSupplier, staticDependencies); } }
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java index eb4b0fe..c77e0df 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataModel.java
@@ -13,6 +13,7 @@ import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.JNINamespace; import org.chromium.chrome.browser.autofill.PersonalDataManager; +import org.chromium.chrome.browser.autofill_assistant.AssistantAutofillProfile; import org.chromium.chrome.browser.autofill_assistant.AssistantInfoPopup; import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantAdditionalSectionFactory; import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantPopupListSection; @@ -22,10 +23,7 @@ import org.chromium.chrome.browser.autofill_assistant.user_data.additional_sections.AssistantTextInputType; import org.chromium.chrome.browser.payments.AutofillAddress; import org.chromium.chrome.browser.payments.AutofillAddress.CompletenessCheckType; -import org.chromium.chrome.browser.payments.AutofillContact; import org.chromium.chrome.browser.payments.AutofillPaymentInstrument; -import org.chromium.chrome.browser.payments.ContactEditor; -import org.chromium.components.autofill.EditableOption; import org.chromium.components.payments.MethodStrings; import org.chromium.content_public.browser.WebContents; import org.chromium.ui.modelutil.PropertyModel; @@ -42,19 +40,19 @@ public class AssistantCollectUserDataModel extends PropertyModel { // TODO(crbug.com/806868): Add |setSelectedLogin|. - /** Options specifying how to summarize an {@code AutofillContact}. */ + /** Options specifying how to summarize an {@code AssistantAutofillProfile}. */ public static class ContactDescriptionOptions { public @AssistantContactField int[] mFields; public int mMaxNumberLines; } /** - * Model wrapper for an {@code EditableOption} to contain errors. + * Model wrapper for a data item to contain errors. * - * @param <T> The type of |EditableOption| that a concrete instance of this class is created - * for, such as |AutofillContact|, |AutofillPaymentMethod|, etc. + * @param <T> The type that an instance of this class is created for, such as + * |AssistantAutofillProfile|, |AutofillPaymentMethod|, etc. */ - public static class OptionModel<T extends EditableOption> { + public static class OptionModel<T> { public T mOption; public List<String> mErrors; @@ -66,18 +64,23 @@ public OptionModel(T option) { this(option, new ArrayList<>()); } + + boolean isComplete() { + return mErrors.isEmpty(); + } } - /** Model wrapper for an {@code AutofillContact}. */ - public static class ContactModel extends OptionModel<AutofillContact> { + /** Model wrapper for an {@code AssistantAutofillProfile}. */ + public static class ContactModel extends OptionModel<AssistantAutofillProfile> { private final boolean mCanEdit; - public ContactModel(AutofillContact contact, List<String> errors, boolean canEdit) { + public ContactModel( + AssistantAutofillProfile contact, List<String> errors, boolean canEdit) { super(contact, errors); mCanEdit = canEdit; } - public ContactModel(AutofillContact contact) { + public ContactModel(AssistantAutofillProfile contact) { super(contact); mCanEdit = true; } @@ -115,6 +118,11 @@ public LoginChoiceModel(AssistantLoginChoice loginChoice) { super(loginChoice); } + + @Override + public boolean isComplete() { + return mOption.isComplete(); + } } public static final WritableObjectPropertyKey<AssistantCollectUserDataDelegate> DELEGATE = @@ -350,7 +358,7 @@ @CalledByNative private void setSelectedContactDetails( - @Nullable AutofillContact contact, String[] errors, boolean canEdit) { + @Nullable AssistantAutofillProfile contact, String[] errors, boolean canEdit) { set(SELECTED_CONTACT_DETAILS, contact == null ? null : new ContactModel(contact, Arrays.asList(errors), canEdit)); } @@ -475,35 +483,16 @@ } @CalledByNative - private static List<ContactModel> createAutofillContactList() { + private static List<ContactModel> createContactList() { return new ArrayList<>(); } @CalledByNative - private static void addAutofillContact(List<ContactModel> contacts, AutofillContact contact, + private static void addContact(List<ContactModel> contacts, AssistantAutofillProfile contact, String[] errors, boolean canEdit) { contacts.add(new ContactModel(contact, Arrays.asList(errors), canEdit)); } - @VisibleForTesting - @CalledByNative - @Nullable - public static AutofillContact createAutofillContact(Context context, - @Nullable PersonalDataManager.AutofillProfile profile, boolean requestName, - boolean requestPhone, boolean requestEmail) { - if (profile == null || !(requestName || requestPhone || requestEmail)) { - return null; - } - ContactEditor editor = - new ContactEditor(requestName, requestPhone, requestEmail, /* saveToDisk= */ false); - String name = profile.getFullName(); - String phone = profile.getPhoneNumber(); - String email = profile.getEmailAddress(); - return new AutofillContact(context, profile, name, phone, email, - editor.checkContactCompletionStatus(name, phone, email), requestName, requestPhone, - requestEmail); - } - @CalledByNative private void setAvailableContacts(List<ContactModel> contacts) { set(AVAILABLE_CONTACTS, contacts);
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataNativeDelegate.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataNativeDelegate.java index fcba42a..6d969ef1 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataNativeDelegate.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataNativeDelegate.java
@@ -10,6 +10,7 @@ import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.browser.autofill.PersonalDataManager; +import org.chromium.chrome.browser.autofill_assistant.AssistantAutofillProfile; import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantValue; /** Delegate for the Collect user data UI which forwards events to a native counterpart. */ @@ -35,7 +36,7 @@ AssistantCollectUserDataNativeDelegateJni.get().onContactInfoChanged( mNativeAssistantCollectUserDataDelegate, AssistantCollectUserDataNativeDelegate.this, - contactModel == null ? null : contactModel.mOption.getProfile(), eventType); + contactModel == null ? null : contactModel.mOption, eventType); } } @@ -126,7 +127,7 @@ interface Natives { void onContactInfoChanged(long nativeAssistantCollectUserDataDelegate, AssistantCollectUserDataNativeDelegate caller, - @Nullable PersonalDataManager.AutofillProfile contactProfile, int eventType); + @Nullable AssistantAutofillProfile contactProfile, int eventType); void onShippingAddressChanged(long nativeAssistantCollectUserDataDelegate, AssistantCollectUserDataNativeDelegate caller, @Nullable PersonalDataManager.AutofillProfile address, int eventType);
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataSection.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataSection.java index 8a9f2d8..89f2adc 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataSection.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantCollectUserDataSection.java
@@ -27,8 +27,8 @@ /** * This is the generic superclass for all autofill-assistant payment request sections. * - * @param <T> The type of |EditableOption| that a concrete instance of this class is created for, - * such as |AutofillContact|, |AutofillPaymentMethod|, etc. + * @param <T> The type of entry that a concrete instance of this class is created for, + * such as |AssistantAutofillProfile|, |AutofillPaymentMethod|, etc. */ public abstract class AssistantCollectUserDataSection<T extends OptionModel> { interface Delegate<T> { @@ -308,7 +308,7 @@ return; } selectItem(item, /*notify=*/true, AssistantUserDataEventType.SELECTION_CHANGED); - if (item.mOption.mOption.isComplete()) { + if (item.mOption.isComplete()) { // Workaround for Android bug: a layout transition may cause the newly // checked radiobutton to not render properly. mSectionExpander.post(() -> mSectionExpander.setExpanded(false));
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantContactDetailsSection.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantContactDetailsSection.java index 13d83dc3..51f04d38 100644 --- a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantContactDetailsSection.java +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AssistantContactDetailsSection.java
@@ -13,7 +13,9 @@ import androidx.annotation.DrawableRes; import androidx.annotation.Nullable; +import org.chromium.base.Callback; import org.chromium.chrome.autofill_assistant.R; +import org.chromium.chrome.browser.autofill_assistant.AssistantAutofillProfile; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantCollectUserDataModel.ContactModel; import org.chromium.chrome.browser.payments.AutofillContact; import org.chromium.chrome.browser.payments.ContactEditor; @@ -52,14 +54,28 @@ @Override protected void createOrEditItem(@Nullable ContactModel oldItem) { - if (mEditor != null) { - mEditor.edit(oldItem == null ? null : oldItem.mOption, contact -> { - assert (contact != null && contact.isComplete()); - mIgnoreProfileChangeNotifications = true; - addOrUpdateItem(new ContactModel(contact), /* select= */ true, /* notify= */ true); - mIgnoreProfileChangeNotifications = false; - }, cancel -> {}); + if (mEditor == null) { + return; } + + AutofillContact oldContact = oldItem == null + ? null + : AutofillUtilChrome.assistantAutofillProfileToAutofillContact( + oldItem.mOption, mContext, mEditor); + + Callback<AutofillContact> doneCallback = contact -> { + assert (contact != null && contact.isComplete() && contact.getProfile() != null); + mIgnoreProfileChangeNotifications = true; + addOrUpdateItem( + new ContactModel(AutofillUtilChrome.autofillProfileToAssistantAutofillProfile( + contact.getProfile())), + /* select= */ true, /* notify= */ true); + mIgnoreProfileChangeNotifications = false; + }; + + Callback<AutofillContact> cancelCallback = contact -> {}; + + mEditor.edit(oldContact, doneCallback, cancelCallback); } @Override @@ -118,18 +134,7 @@ if (modelA == null || modelB == null) { return modelA == modelB; } - AutofillContact optionA = modelA.mOption; - AutofillContact optionB = modelB.mOption; - if (TextUtils.equals(optionA.getIdentifier(), optionB.getIdentifier())) { - return true; - } - if (optionA.getProfile() == null || optionB.getProfile() == null) { - return optionA.getProfile() == optionB.getProfile(); - } - if (TextUtils.equals(optionA.getProfile().getGUID(), optionB.getProfile().getGUID())) { - return true; - } - return optionA.isEqualOrSupersetOf(optionB) && optionB.isEqualOrSupersetOf(optionA); + return TextUtils.equals(modelA.mOption.getGUID(), modelB.mOption.getGUID()); } /** @@ -171,13 +176,13 @@ addAutocompleteInformationToEditor(model.mOption); } - private void addAutocompleteInformationToEditor(AutofillContact contact) { + private void addAutocompleteInformationToEditor(AssistantAutofillProfile contact) { if (mEditor == null || contact == null) { return; } - mEditor.addEmailAddressIfValid(contact.getPayerEmail()); - mEditor.addPayerNameIfValid(contact.getPayerName()); - mEditor.addPhoneNumberIfValid(contact.getPayerPhone()); + mEditor.addEmailAddressIfValid(contact.getEmailAddress()); + mEditor.addPayerNameIfValid(contact.getFullName()); + mEditor.addPhoneNumberIfValid(contact.getPhoneNumber()); } /** @@ -185,7 +190,7 @@ */ private String createContactDescription( AssistantCollectUserDataModel.ContactDescriptionOptions options, - AutofillContact contact) { + AssistantAutofillProfile contact) { List<String> descriptionLines = new ArrayList<>(); for (int i = 0; i < options.mFields.length && descriptionLines.size() < options.mMaxNumberLines; @@ -193,13 +198,13 @@ String line = ""; switch (options.mFields[i]) { case AssistantContactField.NAME_FULL: - line = contact.getPayerName(); + line = contact.getFullName(); break; case AssistantContactField.EMAIL_ADDRESS: - line = contact.getPayerEmail(); + line = contact.getEmailAddress(); break; case AssistantContactField.PHONE_HOME_WHOLE_NUMBER: - line = contact.getPayerPhone(); + line = contact.getPhoneNumber(); break; default: assert false : "profile field not handled";
diff --git a/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AutofillUtilChrome.java b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AutofillUtilChrome.java new file mode 100644 index 0000000..32fe4951 --- /dev/null +++ b/chrome/android/features/autofill_assistant/java/src/org/chromium/chrome/browser/autofill_assistant/user_data/AutofillUtilChrome.java
@@ -0,0 +1,69 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.autofill_assistant.user_data; + +import android.content.Context; + +import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; +import org.chromium.chrome.browser.autofill_assistant.AssistantAutofillProfile; +import org.chromium.chrome.browser.payments.AutofillContact; +import org.chromium.chrome.browser.payments.ContactEditor; + +/** + * Utility class for Chrome to handle Autofill / Assistant conversions. + */ +public class AutofillUtilChrome { + /** + * Transform an {@link AssistantAutofillProfile} to an {@link AutofillProfile}. + * + * @param profile The {@link AssistantAutofillProfile} to transform. + * @return The equivalent {@link AutofillProfile}. + */ + public static AutofillProfile assistantAutofillProfileToAutofillProfile( + AssistantAutofillProfile profile) { + return new AutofillProfile(profile.getGUID(), profile.getOrigin(), profile.getIsLocal(), + profile.getHonorificPrefix(), profile.getFullName(), profile.getCompanyName(), + profile.getStreetAddress(), profile.getRegion(), profile.getLocality(), + profile.getDependentLocality(), profile.getPostalCode(), profile.getSortingCode(), + profile.getCountryCode(), profile.getPhoneNumber(), profile.getEmailAddress(), + profile.getLanguageCode()); + } + + /** + * Transform an {@link AutofillProfile} to an {@link AssistantAutofillProfile}. + * + * @param profile The {@link AutofillProfile} to transform. + * @return The equivalent {@link AssistantAutofillProfile}. + */ + public static AssistantAutofillProfile autofillProfileToAssistantAutofillProfile( + AutofillProfile profile) { + return new AssistantAutofillProfile(profile.getGUID(), profile.getOrigin(), + profile.getIsLocal(), profile.getHonorificPrefix(), profile.getFullName(), + profile.getCompanyName(), profile.getStreetAddress(), profile.getRegion(), + profile.getLocality(), profile.getDependentLocality(), profile.getPostalCode(), + profile.getSortingCode(), profile.getCountryCode(), profile.getPhoneNumber(), + profile.getEmailAddress(), profile.getLanguageCode()); + } + + /** + * Transform an {@link AssistantAutofillProfile} into an {@link AutofillContact}. + * + * @param profile The {@link AssistantAutofillProfile} to transform. + * @param context The context the app is currently run as. + * @param editor The contact editor that holds details about the treatment of the contact. + * @return The equivalent {@link AutofillContact}. + */ + public static AutofillContact assistantAutofillProfileToAutofillContact( + AssistantAutofillProfile profile, Context context, ContactEditor editor) { + String name = profile.getFullName(); + String phone = profile.getPhoneNumber(); + String email = profile.getEmailAddress(); + + return new AutofillContact(context, assistantAutofillProfileToAutofillProfile(profile), + name, phone, email, editor.checkContactCompletionStatus(name, phone, email), + editor.getRequestPayerName(), editor.getRequestPayerPhone(), + editor.getRequestPayerEmail()); + } +}
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingHelperTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingHelperTest.java index b4ae0902..69ea288 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingHelperTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AssistantOnboardingHelperTest.java
@@ -68,7 +68,7 @@ AutofillAssistantModuleEntryProvider.INSTANCE.getModuleEntryIfInstalled(); assert mModuleEntry != null; AssistantDependencies dependencies = - mModuleEntry.createDependenciesFactory().createDependencies( + new AssistantStaticDependenciesChrome().createDependencies( mTestRule.getActivity()); mOnboardingHelper = mModuleEntry.createOnboardingHelper(mTestRule.getWebContents(), dependencies);
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java index 72452d7..f6cf159 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataTestHelper.java
@@ -29,7 +29,6 @@ import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpander; import org.chromium.chrome.browser.autofill_assistant.user_data.AssistantVerticalExpanderAccordion; import org.chromium.chrome.browser.payments.AutofillAddress; -import org.chromium.chrome.browser.payments.AutofillContact; import org.chromium.chrome.browser.payments.AutofillPaymentInstrument; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -97,7 +96,7 @@ * should be able to get the currently selected items by asking the model. */ static class MockDelegate implements AssistantCollectUserDataDelegate { - AutofillContact mContact; + AssistantAutofillProfile mContact; AutofillAddress mAddress; AutofillPaymentInstrument mPaymentMethod; AssistantLoginChoice mLoginChoice;
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java index e83dccb..8769cbcd 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantCollectUserDataUiTest.java
@@ -68,7 +68,6 @@ import org.chromium.chrome.browser.customtabs.CustomTabsTestUtils; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.payments.AutofillAddress; -import org.chromium.chrome.browser.payments.AutofillContact; import org.chromium.chrome.browser.payments.AutofillPaymentInstrument; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -386,10 +385,7 @@ // Add profile to the list and send the updated model. TestThreadUtils.runOnUiThreadBlocking(() -> { - AutofillContact contact = AssistantCollectUserDataModel.createAutofillContact( - mTestRule.getActivity(), - mHelper.createDummyProfile("John Doe", "john@gmail.com"), - /* requestName= */ true, /* requestPhone= */ true, /* requestEmail= */ false); + AssistantAutofillProfile contact = createDummyContact("John Doe", "john@gmail.com"); model.set(AssistantCollectUserDataModel.AVAILABLE_CONTACTS, Collections.singletonList(new ContactModel(contact))); model.set(AssistantCollectUserDataModel.SELECTED_CONTACT_DETAILS, @@ -594,9 +590,7 @@ mDefaultContactFullOptions); model.set(AssistantCollectUserDataModel.REQUEST_PAYMENT, true); model.set(AssistantCollectUserDataModel.REQUEST_SHIPPING_ADDRESS, true); - AutofillContact contact = AssistantCollectUserDataModel.createAutofillContact( - mTestRule.getActivity(), profile, /* requestName= */ true, - /* requestPhone= */ true, /* requestEmail= */ true); + AssistantAutofillProfile contact = createDummyContact(profile); model.set(AssistantCollectUserDataModel.AVAILABLE_CONTACTS, Collections.singletonList(new ContactModel(contact))); model.set(AssistantCollectUserDataModel.SELECTED_CONTACT_DETAILS, @@ -683,9 +677,7 @@ assertThat(delegate.mLoginChoice, is(nullValue())); TestThreadUtils.runOnUiThreadBlocking(() -> { - AutofillContact contact = AssistantCollectUserDataModel.createAutofillContact( - mTestRule.getActivity(), profile, /* requestName= */ true, - /* requestPhone= */ true, /* requestEmail= */ true); + AssistantAutofillProfile contact = createDummyContact(profile); model.set(AssistantCollectUserDataModel.AVAILABLE_CONTACTS, Collections.singletonList(new ContactModel(contact))); AutofillAddress address = AssistantCollectUserDataModel.createAutofillAddress( @@ -714,22 +706,10 @@ @Test @MediumTest public void testContactDetailsCustomSummary() throws Exception { - AutofillContact contactFull = - AssistantCollectUserDataModel.createAutofillContact(mTestRule.getActivity(), - new PersonalDataManager.AutofillProfile("GUID", "https://www.example.com", - /* honorificPrefix= */ "", "Maggie Simpson", "Acme Inc.", - "123 Main", "California", "Los Angeles", "", "90210", "", "UZ", - "555 123-4567", "maggie@simpson.com", ""), - /* requestName= */ true, - /* requestPhone= */ true, /* requestEmail= */ true); - - AutofillContact contactWithoutEmail = AssistantCollectUserDataModel.createAutofillContact( - mTestRule.getActivity(), - new PersonalDataManager.AutofillProfile("GUID", "https://www.example.com", - /* honorificPrefix= */ "", "John Simpson", "Acme Inc.", "123 Main", - "California", "Los Angeles", "", "90210", "", "UZ", "555 123-4567", "", ""), - /* requestName= */ true, - /* requestPhone= */ true, /* requestEmail= */ true); + AssistantAutofillProfile contactFull = + createDummyContact("Maggie Simpson", "maggie@simpson.com", "555 123-4567"); + AssistantAutofillProfile contactWithoutEmail = + createDummyContact("John Simpson", /* email= */ "", "555 123-4567"); AssistantCollectUserDataModel model = createCollectUserDataModel(); AssistantCollectUserDataCoordinator coordinator = createCollectUserDataCoordinator(model); @@ -1174,4 +1154,23 @@ onView(allOf(withId(R.id.sublabel), isDescendantOfA(is(fullView)))) .check(matches(withText(expectedSublabel))); } + + private AssistantAutofillProfile createDummyContact(String name, String email) { + return createDummyContact(name, email, /* phone= */ ""); + } + + private AssistantAutofillProfile createDummyContact( + PersonalDataManager.AutofillProfile profile) { + return createDummyContact( + profile.getFullName(), profile.getEmailAddress(), profile.getPhoneNumber()); + } + + private AssistantAutofillProfile createDummyContact(String name, String email, String phone) { + return new AssistantAutofillProfile(/* guid= */ "", /* origin= */ "", /* isLocal= */ true, + /* honorificPrefix= */ "", name, + /* companyName= */ "", /* streetAddress= */ "", /* region= */ "", + /* locality= */ "", + /* dependentLocality= */ "", /* postalCode= */ "", /* sortingCode= */ "", + /* countryCode= */ "", phone, email, /* languageCode= */ "en-US"); + } }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDetailsUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDetailsUiTest.java index e6348a6..e1e1f64 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDetailsUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDetailsUiTest.java
@@ -116,11 +116,8 @@ Bitmap testImage = BitmapFactory.decodeResource( mTestRule.getActivity().getResources(), R.drawable.btn_close); - AssistantStaticDependencies staticDependencies = - new AssistantDependenciesFactoryChrome().createStaticDependencies(); - return new AssistantDetailsCoordinator(InstrumentationRegistry.getTargetContext(), - staticDependencies.createInfoPageUtil(), model, + new AssistantStaticDependenciesChrome().createInfoPageUtil(), model, new AutofillAssistantUiTestUtil.MockImageFetcher(testImage, null)); });
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java index ac9188b..c0a0e971 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantOverlayUiTest.java
@@ -110,10 +110,7 @@ activity.getBrowserControlsManager()), activity.getCompositorViewHolderForTesting(), mTestRule.getActivity().getRootUiCoordinatorForTesting().getScrimCoordinator(), - model, - new AssistantDependenciesFactoryChrome() - .createStaticDependencies() - .getAccessibilityUtil()); + model, new AssistantStaticDependenciesChrome().getAccessibilityUtil()); }); }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java index 85dd28a..2c3da17f 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPersonalDataManagerTest.java
@@ -730,8 +730,10 @@ org.chromium.chrome.autofill_assistant.R.drawable.visa_card, profileId, /* serverId= */ ""); mHelper.setCreditCard(card); - waitUntilViewMatchesCondition(allOf(withText("Card is expired"), - isDescendantOfA(withId(R.id.payment_method_summary))), + waitUntilViewMatchesCondition( + allOf(withText(mTestRule.getActivity().getString( + R.string.autofill_assistant_payment_information_missing)), + isDescendantOfA(withId(R.id.payment_method_summary))), isDisplayed()); onView(withContentDescription("Continue")).check(matches(not(isEnabled())));
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java index 3dff0a6a3..31fbacc1 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantUiTest.java
@@ -104,8 +104,7 @@ } private AssistantCoordinator createAndShowAssistantCoordinator() { - AssistantStaticDependencies staticDependencies = - new AssistantDependenciesFactoryChrome().createStaticDependencies(); + AssistantStaticDependencies staticDependencies = new AssistantStaticDependenciesChrome(); return TestThreadUtils.runOnUiThreadBlockingNoException(() -> { AssistantCoordinator coordinator = new AssistantCoordinator(getActivity(), initializeBottomSheet(),
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/BottomSheetOnboardingCoordinatorTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/BottomSheetOnboardingCoordinatorTest.java index 6ed90b8..f9002c7 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/BottomSheetOnboardingCoordinatorTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/BottomSheetOnboardingCoordinatorTest.java
@@ -109,8 +109,7 @@ .getRootUiCoordinatorForTesting() .getScrimCoordinator(); - AssistantStaticDependencies staticDependencies = - new AssistantDependenciesFactoryChrome().createStaticDependencies(); + AssistantStaticDependencies staticDependencies = new AssistantStaticDependenciesChrome(); mOnboardingCoordinatorFactory = new OnboardingCoordinatorFactory(mActivity, mBottomSheetController, ()
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/DirectActionsIntegrationTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/DirectActionsIntegrationTest.java index 9817784..474cdf5 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/DirectActionsIntegrationTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/DirectActionsIntegrationTest.java
@@ -98,7 +98,7 @@ AutofillAssistantModuleEntryProvider.INSTANCE.getModuleEntryIfInstalled(); assert mModuleEntry != null; AssistantDependencies dependencies = - mModuleEntry.createDependenciesFactory().createDependencies( + new AssistantStaticDependenciesChrome().createDependencies( mTestRule.getActivity()); mDirectActionHandler = AutofillAssistantFacade.createDirectActionHandler( mTestRule.getActivity(), dependencies.getBottomSheetController(),
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/TestingAutofillAssistantModuleEntryProvider.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/TestingAutofillAssistantModuleEntryProvider.java index 6b15309..97b9326e 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/TestingAutofillAssistantModuleEntryProvider.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/TestingAutofillAssistantModuleEntryProvider.java
@@ -37,14 +37,13 @@ BottomSheetController bottomSheetController, BrowserControlsStateProvider browserControls, View rootView, Supplier<WebContents> webContentsSupplier, - AssistantDependenciesFactory dependenciesFactory) { + AssistantStaticDependencies staticDependencies) { super(new OnboardingCoordinatorFactory(context, bottomSheetController, () -> new AssistantBrowserControlsChrome(browserControls), - rootView, - dependenciesFactory.createStaticDependencies().getAccessibilityUtil(), - dependenciesFactory.createStaticDependencies().createInfoPageUtil()), - webContentsSupplier, dependenciesFactory); + rootView, staticDependencies.getAccessibilityUtil(), + staticDependencies.createInfoPageUtil()), + webContentsSupplier, staticDependencies); } @Override @@ -63,11 +62,6 @@ /** Mock module entry. */ static class MockAutofillAssistantModuleEntry implements AutofillAssistantModuleEntry { @Override - public AssistantDependenciesFactory createDependenciesFactory() { - return new AssistantDependenciesFactoryChrome(); - } - - @Override public AssistantOnboardingHelper createOnboardingHelper( WebContents webContents, AssistantDependencies dependencies) { return null; @@ -78,9 +72,9 @@ BottomSheetController bottomSheetController, BrowserControlsStateProvider browserControls, View rootView, Supplier<WebContents> webContentsSupplier, - AssistantDependenciesFactory dependenciesFactory) { + AssistantStaticDependencies staticDependencies) { return new MockAutofillAssistantActionHandler(context, bottomSheetController, - browserControls, rootView, webContentsSupplier, dependenciesFactory); + browserControls, rootView, webContentsSupplier, staticDependencies); } }
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAutofillProfile.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAutofillProfile.java new file mode 100644 index 0000000..cd6c7a2 --- /dev/null +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAutofillProfile.java
@@ -0,0 +1,134 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.autofill_assistant; + +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.JNINamespace; + +/** + * A profile, similar to the one used by the PersonalDataManager. + */ +@JNINamespace("autofill_assistant") +public class AssistantAutofillProfile { + private final String mGUID; + private final String mOrigin; + private final boolean mIsLocal; + private final String mHonorificPrefix; + private final String mFullName; + private final String mCompanyName; + private final String mStreetAddress; + private final String mRegion; + private final String mLocality; + private final String mDependentLocality; + private final String mPostalCode; + private final String mSortingCode; + private final String mCountryCode; + private final String mPhoneNumber; + private final String mEmailAddress; + private final String mLanguageCode; + + @CalledByNative + public AssistantAutofillProfile(String guid, String origin, boolean isLocal, + String honorificPrefix, String fullName, String companyName, String streetAddress, + String region, String locality, String dependentLocality, String postalCode, + String sortingCode, String countryCode, String phoneNumber, String emailAddress, + String languageCode) { + mGUID = guid; + mOrigin = origin; + mIsLocal = isLocal; + mHonorificPrefix = honorificPrefix; + mFullName = fullName; + mCompanyName = companyName; + mStreetAddress = streetAddress; + mRegion = region; + mLocality = locality; + mDependentLocality = dependentLocality; + mPostalCode = postalCode; + mSortingCode = sortingCode; + mCountryCode = countryCode; + mPhoneNumber = phoneNumber; + mEmailAddress = emailAddress; + mLanguageCode = languageCode; + } + + @CalledByNative + public String getGUID() { + return mGUID; + } + + @CalledByNative + public String getOrigin() { + return mOrigin; + } + + public boolean getIsLocal() { + return mIsLocal; + } + + @CalledByNative + public String getHonorificPrefix() { + return mHonorificPrefix; + } + + @CalledByNative + public String getFullName() { + return mFullName; + } + + @CalledByNative + public String getCompanyName() { + return mCompanyName; + } + + @CalledByNative + public String getStreetAddress() { + return mStreetAddress; + } + + @CalledByNative + public String getRegion() { + return mRegion; + } + + @CalledByNative + public String getLocality() { + return mLocality; + } + + @CalledByNative + public String getDependentLocality() { + return mDependentLocality; + } + + @CalledByNative + public String getPostalCode() { + return mPostalCode; + } + + @CalledByNative + public String getSortingCode() { + return mSortingCode; + } + + @CalledByNative + public String getCountryCode() { + return mCountryCode; + } + + @CalledByNative + public String getPhoneNumber() { + return mPhoneNumber; + } + + @CalledByNative + public String getEmailAddress() { + return mEmailAddress; + } + + @CalledByNative + public String getLanguageCode() { + return mLanguageCode; + } +}
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependenciesFactory.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependenciesFactory.java deleted file mode 100644 index 03d0614c..0000000 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependenciesFactory.java +++ /dev/null
@@ -1,23 +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. - -package org.chromium.chrome.browser.autofill_assistant; - -import android.app.Activity; - -/** - * Factory for creating dependencies. Implementations might differ depending on where Autofill - * Assistant is running (e.g. WebLayer, Chrome). - */ -public interface AssistantDependenciesFactory { - /** - * Create the Activity specific dependencies. - * */ - AssistantDependencies createDependencies(Activity activity); - - /** - * Create the static dependencies that are independent of Activity. - * */ - AssistantStaticDependencies createStaticDependencies(); -}
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependenciesFactoryChrome.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependenciesFactoryChrome.java deleted file mode 100644 index a739311..0000000 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependenciesFactoryChrome.java +++ /dev/null
@@ -1,22 +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. - -package org.chromium.chrome.browser.autofill_assistant; - -import android.app.Activity; - -/** - * Factory for creating dependencies when running in Chrome. - */ -public class AssistantDependenciesFactoryChrome implements AssistantDependenciesFactory { - @Override - public AssistantDependencies createDependencies(Activity activity) { - return new AssistantDependenciesChrome(activity); - } - - @Override - public AssistantStaticDependencies createStaticDependencies() { - return new AssistantStaticDependenciesChrome(); - } -}
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java index 61cf2af..2e7bb6d 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependencies.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.autofill_assistant; +import android.app.Activity; import android.content.Context; import androidx.annotation.DimenRes; @@ -23,6 +24,11 @@ @CalledByNative long getNativePointer(); + /** + * Create the Activity specific dependencies. + * */ + AssistantDependencies createDependencies(Activity activity); + AccessibilityUtil getAccessibilityUtil(); /**
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java index 0ae090f..74d35e7 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantStaticDependenciesChrome.java
@@ -4,6 +4,7 @@ package org.chromium.chrome.browser.autofill_assistant; +import android.app.Activity; import android.content.Context; import androidx.annotation.DimenRes; @@ -38,6 +39,11 @@ } @Override + public AssistantDependencies createDependencies(Activity activity) { + return new AssistantDependenciesChrome(activity); + } + + @Override public AccessibilityUtil getAccessibilityUtil() { return ChromeAccessibilityUtil.get(); }
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java index 81d006f2..8c6e4ad 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantDirectActionHandler.java
@@ -271,6 +271,6 @@ if (entry == null) return null; return entry.createActionHandler(mContext, mBottomSheetController, mBrowserControls, - mRootView, mWebContentsSupplier, entry.createDependenciesFactory()); + mRootView, mWebContentsSupplier, new AssistantStaticDependenciesChrome()); } }
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntry.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntry.java index 4ecd60c..6aa3938 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntry.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantModuleEntry.java
@@ -20,12 +20,6 @@ impl = "org.chromium.chrome.browser.autofill_assistant.AutofillAssistantModuleEntryImpl") public interface AutofillAssistantModuleEntry { /** - * Creates a concrete {@code AssistantDependenciesFactory} object. Its contents are opaque to - * the outside of the module. - */ - AssistantDependenciesFactory createDependenciesFactory(); - - /** * Creates a concrete {@code AssistantOnboardingHelper} object. Its contents are opaque to * the outside of the module. */ @@ -41,11 +35,11 @@ * @param browserControls provider of browser controls state * @param rootView root view of the activity * @param webContentsSupplier supplier of the current WebContents - * @param dependenciesFactory creates platform-specific dependencies + * @param staticDependencies used to create platform-specific dependencies */ AutofillAssistantActionHandler createActionHandler(Context context, BottomSheetController bottomSheetController, BrowserControlsStateProvider browserControls, View rootView, Supplier<WebContents> webContentsSupplier, - AssistantDependenciesFactory dependenciesFactory); + AssistantStaticDependencies staticDependencies); }
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTabHelper.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTabHelper.java index e746a0520..d9afb91 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTabHelper.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantTabHelper.java
@@ -20,7 +20,8 @@ public static void createForTab(Tab tab) { Starter starter = new Starter(() -> TabUtils.getActivity(tab), - tab.getWebContents(), AssistantDependencyUtilsChrome::isGsa, + tab.getWebContents(), new AssistantStaticDependenciesChrome(), + AssistantDependencyUtilsChrome::isGsa, AssistantDependencyUtilsChrome::isMakeSearchesAndBrowsingBetterSettingEnabled, new AssistantModuleInstallUiProviderChrome(tab)); AssistantDependencyUtilsChrome.attachTabObserver(tab, starter);
diff --git a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java index 242a2a5..3786cd956 100644 --- a/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java +++ b/chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/Starter.java
@@ -30,6 +30,7 @@ /** A supplier for the activity of the tab that this starter tracks. */ private final Supplier<Activity> mActivitySupplier; + private final AssistantStaticDependencies mStaticDependencies; private final AssistantIsGsaFunction mIsGsaFunction; private final AssistantIsMsbbEnabledFunction mIsMsbbEnabledFunction; private final AssistantModuleInstallUi.Provider mModuleInstallUiProvider; @@ -68,10 +69,11 @@ * track of changes. */ public Starter(Supplier<Activity> activitySupplier, @Nullable WebContents webContents, - AssistantIsGsaFunction isGsaFunction, + AssistantStaticDependencies staticDependencies, AssistantIsGsaFunction isGsaFunction, AssistantIsMsbbEnabledFunction isMsbbEnabledFunction, AssistantModuleInstallUi.Provider moduleInstallUiProvider) { mActivitySupplier = activitySupplier; + mStaticDependencies = staticDependencies; mIsGsaFunction = isGsaFunction; mIsMsbbEnabledFunction = isMsbbEnabledFunction; mModuleInstallUiProvider = moduleInstallUiProvider; @@ -304,8 +306,7 @@ private Object[] getOrCreateDependenciesAndOnboardingHelper() { if (mDependencies == null) { AutofillAssistantModuleEntry module = getModuleOrThrow(); - mDependencies = - module.createDependenciesFactory().createDependencies(mActivitySupplier.get()); + mDependencies = mStaticDependencies.createDependencies(mActivitySupplier.get()); mOnboardingHelper = module.createOnboardingHelper(mWebContents, mDependencies); }
diff --git a/chrome/android/features/autofill_assistant/public/java_sources.gni b/chrome/android/features/autofill_assistant/public/java_sources.gni index 8fc1bac..8f0fecc 100644 --- a/chrome/android/features/autofill_assistant/public/java_sources.gni +++ b/chrome/android/features/autofill_assistant/public/java_sources.gni
@@ -5,13 +5,12 @@ public_autofill_assistant_java_sources = [ "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAccessTokenUtil.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAccessTokenUtilChrome.java", + "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantAutofillProfile.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBrowserControls.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBrowserControlsChrome.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantBrowserControlsFactory.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependencies.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependenciesChrome.java", - "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependenciesFactory.java", - "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependenciesFactoryChrome.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantDependencyUtilsChrome.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantFeatures.java", "//chrome/android/features/autofill_assistant/public/java/src/org/chromium/chrome/browser/autofill_assistant/AssistantFeedbackUtil.java",
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClient.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClient.java index 9ec1ce7..a543377 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClient.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClient.java
@@ -26,17 +26,13 @@ import androidx.browser.trusted.Token; import androidx.browser.trusted.TrustedWebActivityCallback; import androidx.browser.trusted.TrustedWebActivityService; -import androidx.browser.trusted.TrustedWebActivityServiceConnection; import androidx.browser.trusted.TrustedWebActivityServiceConnectionPool; -import com.google.common.util.concurrent.ListenableFuture; - import org.chromium.base.ContextUtils; -import org.chromium.base.Log; -import org.chromium.base.task.AsyncTask; -import org.chromium.base.task.PostTask; import org.chromium.chrome.R; import org.chromium.chrome.browser.ChromeApplicationImpl; +import org.chromium.chrome.browser.browserservices.TrustedWebActivityClientWrappers.Connection; +import org.chromium.chrome.browser.browserservices.TrustedWebActivityClientWrappers.ConnectionPool; import org.chromium.chrome.browser.browserservices.constants.LocationUpdateError; import org.chromium.chrome.browser.browserservices.metrics.TrustedWebActivityUmaRecorder; import org.chromium.chrome.browser.browserservices.metrics.TrustedWebActivityUmaRecorder.DelegatedNotificationSmallIconFallback; @@ -47,12 +43,9 @@ import org.chromium.components.content_settings.ContentSettingsType; import org.chromium.components.embedder_support.util.Origin; import org.chromium.components.embedder_support.util.UrlConstants; -import org.chromium.content_public.browser.UiThreadTaskTraits; import java.util.List; import java.util.Set; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Executor; import javax.inject.Inject; import javax.inject.Singleton; @@ -63,8 +56,6 @@ @Singleton public class TrustedWebActivityClient { private static final String TAG = "TWAClient"; - private static final Executor UI_THREAD_EXECUTOR = - (Runnable r) -> PostTask.postTask(UiThreadTaskTraits.USER_VISIBLE, r); private static final String CHECK_LOCATION_PERMISSION_COMMAND_NAME = "checkAndroidLocationPermission"; @@ -75,7 +66,7 @@ private static final String STOP_LOCATION_COMMAND_NAME = "stopLocation"; private static final String LOCATION_ARG_ENABLE_HIGH_ACCURACY = "enableHighAccuracy"; - private final TrustedWebActivityServiceConnectionPool mConnection; + private final ConnectionPool mConnectionPool; private final TrustedWebActivityPermissionManager mDelegatesManager; private final TrustedWebActivityUmaRecorder mRecorder; @@ -101,8 +92,7 @@ * Interface for callbacks to {@link #connectAndExecute}. */ public interface ExecutionCallback { - void onConnected(Origin origin, TrustedWebActivityServiceConnection service) - throws RemoteException; + void onConnected(Origin origin, Connection service) throws RemoteException; default void onNoTwaFound() {} } @@ -110,10 +100,19 @@ * Creates a TrustedWebActivityService. */ @Inject - public TrustedWebActivityClient(TrustedWebActivityServiceConnectionPool connection, + public TrustedWebActivityClient(TrustedWebActivityServiceConnectionPool connectionPool, TrustedWebActivityPermissionManager delegatesManager, TrustedWebActivityUmaRecorder recorder) { - mConnection = connection; + this(TrustedWebActivityClientWrappers.wrap(connectionPool), delegatesManager, recorder); + } + + /** + * Creates a TrustedWebActivityService for tests. + */ + public TrustedWebActivityClient(ConnectionPool connectionPool, + TrustedWebActivityPermissionManager delegatesManager, + TrustedWebActivityUmaRecorder recorder) { + mConnectionPool = connectionPool; mDelegatesManager = delegatesManager; mRecorder = recorder; } @@ -129,7 +128,7 @@ if (origin == null) return false; Set<Token> possiblePackages = mDelegatesManager.getAllDelegateApps(origin); if (possiblePackages == null) return false; - return mConnection.serviceExistsForScope(scope, possiblePackages); + return mConnectionPool.serviceExistsForScope(scope, possiblePackages); } /** @@ -143,11 +142,11 @@ Resources res = ContextUtils.getApplicationContext().getResources(); String channelDisplayName = res.getString(R.string.notification_category_group_general); - connectAndExecute(origin.uri(), - new ExecutionCallback() { + connectAndExecute( + origin.uri(), new ExecutionCallback() { @Override - public void onConnected(Origin originCopy, - TrustedWebActivityServiceConnection service) throws RemoteException { + public void onConnected(Origin originCopy, Connection service) + throws RemoteException { callback.onPermissionCheck(service.getComponentName(), service.areNotificationsEnabled(channelDisplayName)); } @@ -169,8 +168,7 @@ public void checkLocationPermission(Origin origin, PermissionCheckCallback callback) { connectAndExecute(origin.uri(), new ExecutionCallback() { @Override - public void onConnected(Origin origin, TrustedWebActivityServiceConnection service) - throws RemoteException { + public void onConnected(Origin origin, Connection service) throws RemoteException { TrustedWebActivityCallback resultCallback = new TrustedWebActivityCallback() { @Override public void onExtraCallback(String callbackName, @Nullable Bundle bundle) { @@ -203,8 +201,7 @@ Origin origin, boolean highAccuracy, TrustedWebActivityCallback locationCallback) { connectAndExecute(origin.uri(), new ExecutionCallback() { @Override - public void onConnected(Origin origin, TrustedWebActivityServiceConnection service) - throws RemoteException { + public void onConnected(Origin origin, Connection service) throws RemoteException { Bundle args = new Bundle(); args.putBoolean(LOCATION_ARG_ENABLE_HIGH_ACCURACY, highAccuracy); Bundle executionResult = service.sendExtraCommand( @@ -227,8 +224,7 @@ public void stopLocationUpdates(Origin origin) { connectAndExecute(origin.uri(), new ExecutionCallback() { @Override - public void onConnected(Origin origin, TrustedWebActivityServiceConnection service) - throws RemoteException { + public void onConnected(Origin origin, Connection service) throws RemoteException { service.sendExtraCommand(STOP_LOCATION_COMMAND_NAME, Bundle.EMPTY, null); } }); @@ -274,8 +270,8 @@ }); } - private void fallbackToIconFromServiceIfNecessary(NotificationBuilderBase builder, - TrustedWebActivityServiceConnection service) throws RemoteException { + private void fallbackToIconFromServiceIfNecessary( + NotificationBuilderBase builder, Connection service) throws RemoteException { if (builder.hasSmallIconForContent() && builder.hasStatusBarIconBitmap()) { recordFallback(NO_FALLBACK); return; @@ -327,24 +323,7 @@ return; } - ListenableFuture<TrustedWebActivityServiceConnection> connection = - mConnection.connect(scope, possiblePackages, AsyncTask.THREAD_POOL_EXECUTOR); - connection.addListener(() -> { - try { - callback.onConnected(origin, connection.get()); - } catch (RemoteException | InterruptedException e) { - // These failures could be transient - a RemoteException indicating that the TWA - // got killed as it was answering and an InterruptedException to do with threading - // on our side. In this case, there's not anything necessarily wrong with the TWA. - Log.w(TAG, "Failed to execute TWA command.", e); - } catch (ExecutionException | SecurityException e) { - // An ExecutionException means that we could not find a TWA to connect to and a - // SecurityException means that the TWA doesn't trust this app. In either cases we - // consider that there is no TWA for the scope. - Log.w(TAG, "Failed to connect to TWA to execute command", e); - callback.onNoTwaFound(); - } - }, UI_THREAD_EXECUTOR); + mConnectionPool.connectAndExecute(scope, origin, possiblePackages, callback); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientWrappers.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientWrappers.java new file mode 100644 index 0000000..a253cb5 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientWrappers.java
@@ -0,0 +1,144 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.browserservices; + +import android.app.Notification; +import android.content.ComponentName; +import android.graphics.Bitmap; +import android.net.Uri; +import android.os.Bundle; +import android.os.RemoteException; + +import androidx.browser.trusted.Token; +import androidx.browser.trusted.TrustedWebActivityCallback; +import androidx.browser.trusted.TrustedWebActivityServiceConnection; +import androidx.browser.trusted.TrustedWebActivityServiceConnectionPool; + +import com.google.common.util.concurrent.ListenableFuture; + +import org.chromium.base.Log; +import org.chromium.base.task.AsyncTask; +import org.chromium.base.task.PostTask; +import org.chromium.chrome.browser.browserservices.TrustedWebActivityClient.ExecutionCallback; +import org.chromium.components.embedder_support.util.Origin; +import org.chromium.content_public.browser.UiThreadTaskTraits; + +import java.util.Set; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; + +/** + * Provides wrappers for AndroidX classes that can be mocked in tests. + */ +public class TrustedWebActivityClientWrappers { + private static final String TAG = "TWAClient"; + private static final Executor UI_THREAD_EXECUTOR = + (Runnable r) -> PostTask.postTask(UiThreadTaskTraits.USER_VISIBLE, r); + + /** Wrapper around {@link TrustedWebActivityServiceConnection}. */ + public interface Connection { + /** See implementation on {@link TrustedWebActivityServiceConnection}. */ + ComponentName getComponentName(); + /** See implementation on {@link TrustedWebActivityServiceConnection}. */ + boolean areNotificationsEnabled(String channelName) throws RemoteException; + /** See implementation on {@link TrustedWebActivityServiceConnection}. */ + boolean notify(String platformTag, int platformId, Notification notification, + String channel) throws RemoteException; + /** See implementation on {@link TrustedWebActivityServiceConnection}. */ + void cancel(String platformTag, int platformId) throws RemoteException; + /** See implementation on {@link TrustedWebActivityServiceConnection}. */ + int getSmallIconId() throws RemoteException; + /** See implementation on {@link TrustedWebActivityServiceConnection}. */ + Bitmap getSmallIconBitmap() throws RemoteException; + /** See implementation on {@link TrustedWebActivityServiceConnection}. */ + Bundle sendExtraCommand(String commandName, Bundle args, + TrustedWebActivityCallback callback) throws RemoteException; + } + + /** Wrapper around {@link TrustedWebActivityServiceConnectionPool}. */ + public interface ConnectionPool { + /** See implementation on {@link TrustedWebActivityServiceConnectionPool}. */ + boolean serviceExistsForScope(Uri scope, Set<Token> possiblePackages); + + /** See implementation on {@link TrustedWebActivityServiceConnectionPool}. */ + void connectAndExecute( + Uri scope, Origin origin, Set<Token> possiblePackages, ExecutionCallback callback); + } + + public static ConnectionPool wrap(TrustedWebActivityServiceConnectionPool pool) { + return new ConnectionPool() { + @Override + public boolean serviceExistsForScope(Uri scope, Set<Token> possiblePackages) { + return pool.serviceExistsForScope(scope, possiblePackages); + } + + @Override + public void connectAndExecute(Uri scope, Origin origin, Set<Token> possiblePackages, + ExecutionCallback callback) { + ListenableFuture<TrustedWebActivityServiceConnection> connection = + pool.connect(scope, possiblePackages, AsyncTask.THREAD_POOL_EXECUTOR); + + connection.addListener(() -> { + try { + callback.onConnected(origin, wrap(connection.get())); + } catch (RemoteException | InterruptedException e) { + // These failures could be transient - a RemoteException indicating that the + // TWA got killed as it was answering and an InterruptedException to do with + // threading on our side. In this case, there's not anything necessarily + // wrong with the TWA. + Log.w(TAG, "Failed to execute TWA command.", e); + } catch (ExecutionException | SecurityException e) { + // An ExecutionException means that we could not find a TWA to connect to + // and a SecurityException means that the TWA doesn't trust this app. In + // either cases we consider that there is no TWA for the scope. + Log.w(TAG, "Failed to connect to TWA to execute command", e); + callback.onNoTwaFound(); + } + }, UI_THREAD_EXECUTOR); + } + }; + } + + public static Connection wrap(TrustedWebActivityServiceConnection connection) { + return new Connection() { + @Override + public ComponentName getComponentName() { + return connection.getComponentName(); + } + + @Override + public boolean areNotificationsEnabled(String channelName) throws RemoteException { + return connection.areNotificationsEnabled(channelName); + } + + @Override + public boolean notify(String platformTag, int platformId, Notification notification, + String channel) throws RemoteException { + return connection.notify(platformTag, platformId, notification, channel); + } + + @Override + public void cancel(String platformTag, int platformId) throws RemoteException { + connection.cancel(platformTag, platformId); + } + + @Override + public int getSmallIconId() throws RemoteException { + return connection.getSmallIconId(); + } + + @Override + public Bitmap getSmallIconBitmap() throws RemoteException { + return connection.getSmallIconBitmap(); + } + + @Override + public Bundle sendExtraCommand(String commandName, Bundle args, + TrustedWebActivityCallback callback) throws RemoteException { + return connection.sendExtraCommand(commandName, args, callback); + } + }; + } +}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/digitalgoods/DigitalGoodsAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/digitalgoods/DigitalGoodsAdapter.java index 9b30bfa8..42265fd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/browserservices/digitalgoods/DigitalGoodsAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/browserservices/digitalgoods/DigitalGoodsAdapter.java
@@ -8,10 +8,10 @@ import android.os.Bundle; import androidx.browser.trusted.TrustedWebActivityCallback; -import androidx.browser.trusted.TrustedWebActivityServiceConnection; import org.chromium.base.Log; import org.chromium.chrome.browser.browserservices.TrustedWebActivityClient; +import org.chromium.chrome.browser.browserservices.TrustedWebActivityClientWrappers; import org.chromium.components.embedder_support.util.Origin; import org.chromium.payments.mojom.DigitalGoods.Acknowledge_Response; import org.chromium.payments.mojom.DigitalGoods.GetDetails_Response; @@ -69,7 +69,8 @@ Runnable onClientAppUnavailable) { mClient.connectAndExecute(scope, new TrustedWebActivityClient.ExecutionCallback() { @Override - public void onConnected(Origin origin, TrustedWebActivityServiceConnection service) { + public void onConnected( + Origin origin, TrustedWebActivityClientWrappers.Connection service) { // Wrap this call so that crashes in the TWA client don't cause crashes in Chrome. Bundle result = null; try {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchInternalStateController.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchInternalStateController.java index a54bc4bb..c7b544c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchInternalStateController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchInternalStateController.java
@@ -431,7 +431,9 @@ transitionTo(InternalState.START_SHOWING_TAP_UI); break; case InternalState.START_SHOWING_TAP_UI: - transitionTo(InternalState.SHOW_RESOLVING_UI); + transitionTo(mPolicy.isLiteralSearchTapEnabled() + ? InternalState.SHOWING_LITERAL_SEARCH + : InternalState.SHOW_RESOLVING_UI); break; case InternalState.SHOW_RESOLVING_UI: transitionTo(mPolicy.shouldPreviousGestureResolve()
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java index 4542872..a55942b3 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManager.java
@@ -1824,7 +1824,8 @@ // Also clear any tap-based selection unless the Tap IPH is showing. In the // latter case we preserve the selection so the help bubble has something to // point to. - if (mSelectionController.getSelectionType() == SelectionType.TAP + if (!mPolicy.isLiteralSearchTapEnabled() + && mSelectionController.getSelectionType() == SelectionType.TAP && !mInProductHelp.isShowingForTappedButShouldLongpress()) { mSelectionController.clearSelection(); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java index 5641466..0d8283f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchPolicy.java
@@ -152,7 +152,8 @@ * This only checks the gesture, not privacy status -- {@see #shouldPreviousGestureResolve}. */ boolean isResolvingGesture() { - return mSelectionController.getSelectionType() == SelectionType.TAP + return (mSelectionController.getSelectionType() == SelectionType.TAP + && !isLiteralSearchTapEnabled()) || mSelectionController.getSelectionType() == SelectionType.RESOLVING_LONG_PRESS; } @@ -308,6 +309,14 @@ } /** + * @return whether the experiment that causes a tap gesture to trigger a literal search for the + * selection (rather than sending context to resolve a search term) is enabled. + */ + boolean isLiteralSearchTapEnabled() { + return ChromeFeatureList.isEnabled(ChromeFeatureList.CONTEXTUAL_SEARCH_LITERAL_SEARCH_TAP); + } + + /** * Determines whether an error from a search term resolution request should * be shown to the user, or not. */
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninCheckerProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninCheckerProvider.java index 791b3a1..d2a17d2f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninCheckerProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninCheckerProvider.java
@@ -8,7 +8,6 @@ import org.chromium.chrome.browser.profiles.Profile; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; -import org.chromium.chrome.browser.sync.SyncController; import org.chromium.chrome.browser.sync.SyncErrorNotifier; /** @@ -23,10 +22,9 @@ @MainThread public static SigninChecker get() { if (sInstance == null) { - // SyncController and SyncErrorNotifier must be explicitly initialized. + // SyncErrorNotifier must be explicitly initialized. // TODO(crbug.com/1156620): Move the initializations elsewhere. SyncErrorNotifier.get(); - SyncController.get(); Profile profile = Profile.getLastUsedRegularProfile(); sInstance = new SigninChecker(IdentityServicesProvider.get().getSigninManager(profile), IdentityServicesProvider.get().getAccountTrackerService(profile));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/AndroidSyncSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/AndroidSyncSettings.java index ca9e171..dc9c882 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/AndroidSyncSettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/AndroidSyncSettings.java
@@ -6,64 +6,18 @@ import android.accounts.Account; import android.annotation.SuppressLint; -import android.content.ContentResolver; -import android.content.SyncStatusObserver; import androidx.annotation.MainThread; -import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; -import org.chromium.base.ContextUtils; import org.chromium.base.ThreadUtils; -import org.chromium.base.task.PostTask; -import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; -import org.chromium.components.signin.AccountManagerFacadeProvider; -import org.chromium.components.signin.base.CoreAccountInfo; -import org.chromium.components.signin.identitymanager.ConsentLevel; -import org.chromium.components.signin.identitymanager.IdentityManager; -import org.chromium.content_public.browser.UiThreadTaskTraits; -/** - * WARNING: Chrome will be decoupled from Android auto-sync (crbug.com/1105795). - * Some documentation in this class may be outdated or may not be coherent when - * DecoupleSyncFromAndroidMasterSync is enabled. - * - * A helper class to handle the current status of sync for Chrome in Android settings. - * - * {@link #updateAccount(Account)} should be invoked whenever sync account is changed. - */ +/** TODO(crbug.com/1107904): Delete and migrate callers to use SyncService. */ @MainThread public class AndroidSyncSettings { @SuppressLint("StaticFieldLeak") private static AndroidSyncSettings sInstance; - // Cached value of the static |getContractAuthority()|. - private final String mContractAuthority; - - private final SyncContentResolverDelegate mSyncContentResolverDelegate; - - private Account mAccount; - - private boolean mIsSyncable; - - private boolean mChromeSyncEnabled; - - private boolean mMasterSyncEnabled; - - private boolean mShouldDecoupleSyncFromMasterSync; - - // Is set at most once. - @Nullable - private Delegate mDelegate; - - /** - * Propagates changes from Android sync settings to the native code. - */ - public interface Delegate { - void androidSyncSettingsChanged(); - } - /** Singleton instance getter. Will initialize the singleton if it hasn't been initialized before. */ @@ -71,7 +25,7 @@ public static AndroidSyncSettings get() { ThreadUtils.assertOnUiThread(); if (sInstance == null) { - sInstance = new AndroidSyncSettings(getSyncAccount()); + sInstance = new AndroidSyncSettings(); } return sInstance; } @@ -86,46 +40,6 @@ sInstance = instance; } - // TODO(crbug.com/1125622): Exposing these testing constructors that don't register the - // singleton instance can be dangerous when there's code that explicitly calls |get()| - // (in that case, a new object would be returned, not the one constructed by the test). - // Consider exposing them as static methods that also register a singleton instance. - /** - * WARNING: Consider using |overrideForTests()| to inject a mock instead. - * @param account The sync account if sync is enabled, null otherwise. - */ - @VisibleForTesting - @Deprecated - public AndroidSyncSettings(@Nullable Account account) { - ThreadUtils.assertOnUiThread(); - mContractAuthority = getContractAuthority(); - mSyncContentResolverDelegate = SyncContentResolverDelegate.get(); - - mAccount = account; - updateCachedSettings(); - updateSyncability(); - - SyncService syncService = SyncService.get(); - if (syncService != null) { - // Read initial persisted value. - mShouldDecoupleSyncFromMasterSync = syncService.getDecoupledFromAndroidMasterSync(); - } - - SyncStatusObserver androidOsListener = new SyncStatusObserver() { - @Override - public void onStatusChanged(int which) { - if (which != ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS) return; - // This is called by Android on a background thread, but AndroidSyncSettings - // methods should be called from the UI thread, so post a task. - PostTask.postTask(UiThreadTaskTraits.DEFAULT, () -> { - if (updateCachedSettings()) maybeNotifyDelegate(); - }); - } - }; - mSyncContentResolverDelegate.addStatusChangeListener( - ContentResolver.SYNC_OBSERVER_TYPE_SETTINGS, androidOsListener); - } - /** * DEPRECATED - DO NOT USE! You probably want SyncService.isSyncRequested() instead. * @@ -135,16 +49,7 @@ @Deprecated public boolean isChromeSyncEnabled() { ThreadUtils.assertOnUiThread(); - return mChromeSyncEnabled; - } - - /** - * Checks whether the master sync flag for Android allows syncing Chrome - * data. - */ - public boolean doesMasterSyncSettingAllowChromeSync() { - ThreadUtils.assertOnUiThread(); - return mMasterSyncEnabled || mShouldDecoupleSyncFromMasterSync; + return SyncService.get() != null && SyncService.get().isSyncRequested(); } /** @@ -152,131 +57,12 @@ */ public void enableChromeSync() { ThreadUtils.assertOnUiThread(); - setChromeSyncEnabled(true); - } - - /** - * Disables Chrome sync for |mAccount| if it's non-null. - */ - public void disableChromeSync() { - ThreadUtils.assertOnUiThread(); - setChromeSyncEnabled(false); + assert SyncService.get() != null; + SyncService.get().setSyncRequested(true); } /** * Must be called with the new account on sign-in and with null on sign-out. */ - public void updateAccount(Account account) { - ThreadUtils.assertOnUiThread(); - mAccount = account; - updateSyncability(); - if (updateCachedSettings()) maybeNotifyDelegate(); - } - - /** - * Returns the contract authority used by Chrome when talking to auto-sync. - * Exposed only to tests, so they can fake user interaction with the - * auto-sync UI. - */ - @VisibleForTesting - public static String getContractAuthority() { - return ContextUtils.getApplicationContext().getPackageName(); - } - - /** - * Must be called at most once to set a (non-null) delegate. - */ - public void setDelegate(Delegate delegate) { - ThreadUtils.assertOnUiThread(); - assert delegate != null; - assert mDelegate == null; - mDelegate = delegate; - } - - private void setChromeSyncEnabled(boolean value) { - updateSyncability(); - if (value == mChromeSyncEnabled || mAccount == null) return; - mChromeSyncEnabled = value; - - mSyncContentResolverDelegate.setSyncAutomatically(mAccount, mContractAuthority, value); - maybeNotifyDelegate(); - } - - /** - * Updates whether Chrome is registered with the Android Auto-Sync Manager. - * - * This is what causes the "Chrome" option to appear in Settings -> Accounts -> Sync . - */ - private void updateSyncability() { - // Following crbug.com/1107371, this method is only ensuring that no account is "syncable". - // The logic could probably by simplified, e.g. doing setIsSyncable() for every account - // once. However, since this class will be deleted after the migration period anyway - // (crbug.com/1107904), let's avoid subtle behavior changes and just keep the code as is. - - if (!mIsSyncable) return; - - mIsSyncable = false; - if (mAccount != null) { - mSyncContentResolverDelegate.setIsSyncable(mAccount, mContractAuthority, 0); - } - - // Disable the syncability of Chrome for all other accounts. - AccountManagerFacadeProvider.getInstance().getAccounts().then(accounts -> { - for (Account account : accounts) { - if (account.equals(mAccount)) continue; - if (mSyncContentResolverDelegate.getIsSyncable(account, mContractAuthority) <= 0) { - continue; - } - mSyncContentResolverDelegate.setIsSyncable(account, mContractAuthority, 0); - } - }); - } - - /** - * Update the three cached settings from the content resolver and the - * master sync decoupling setting. - * - * @return Whether either chromeSyncEnabled or masterSyncEnabled changed. - */ - private boolean updateCachedSettings() { - boolean oldChromeSyncEnabled = mChromeSyncEnabled; - boolean oldMasterSyncEnabled = mMasterSyncEnabled; - - if (mAccount != null) { - mIsSyncable = - mSyncContentResolverDelegate.getIsSyncable(mAccount, mContractAuthority) > 0; - mChromeSyncEnabled = - mSyncContentResolverDelegate.getSyncAutomatically(mAccount, mContractAuthority); - } else { - mIsSyncable = false; - mChromeSyncEnabled = false; - } - mMasterSyncEnabled = mSyncContentResolverDelegate.getMasterSyncAutomatically(); - - if (mAccount != null && SyncService.get() != null && mMasterSyncEnabled - && !mShouldDecoupleSyncFromMasterSync) { - // Re-enabling master sync at least once should cause Sync to no longer care whether - // the former is enabled or not. This fact should be persisted via SyncService - // so it's known on the next startup. - mShouldDecoupleSyncFromMasterSync = true; - SyncService.get().setDecoupledFromAndroidMasterSync(); - } - - return oldChromeSyncEnabled != mChromeSyncEnabled - || oldMasterSyncEnabled != mMasterSyncEnabled; - } - - private void maybeNotifyDelegate() { - if (mDelegate != null) mDelegate.androidSyncSettingsChanged(); - } - - /** - * Returns the sync account in the last used regular profile. - */ - private static @Nullable Account getSyncAccount() { - IdentityManager identityManager = IdentityServicesProvider.get().getIdentityManager( - Profile.getLastUsedRegularProfile()); - return CoreAccountInfo.getAndroidAccountFrom( - identityManager.getPrimaryAccountInfo(ConsentLevel.SYNC)); - } + public void updateAccount(Account account) {} }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java deleted file mode 100644 index 6055011..0000000 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/SyncController.java +++ /dev/null
@@ -1,148 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.chrome.browser.sync; - -import android.annotation.SuppressLint; - -import androidx.annotation.Nullable; - -import org.chromium.base.ThreadUtils; -import org.chromium.base.metrics.RecordHistogram; -import org.chromium.chrome.browser.profiles.Profile; -import org.chromium.components.sync.StopSource; - -/** - * SyncController handles the coordination of sync state between the invalidation controller, - * the Android sync settings, and the native sync code. - * - * It also handles initialization of some pieces of sync state on startup. - * - * Sync state can be changed from four places: - * - * - The Chrome UI, which will call SyncController directly. - * - Native sync, which can disable it via a dashboard stop and clear. - * - Android's Chrome sync setting. - * - Android's master sync setting. - * - * SyncController implements listeners for the last three cases. When master sync is disabled, we - * are careful to not change the Android Chrome sync setting so we know whether to turn sync back - * on when it is re-enabled. - */ -public class SyncController - implements SyncService.SyncStateChangedListener, AndroidSyncSettings.Delegate { - private static final String TAG = "SyncController"; - - @SuppressLint("StaticFieldLeak") - private static SyncController sInstance; - private static boolean sInitialized; - - private final SyncService mSyncService; - - private SyncController() { - AndroidSyncSettings.get().setDelegate(this); - mSyncService = SyncService.get(); - mSyncService.addSyncStateChangedListener(this); - - updateSyncStateFromAndroid(); - } - - /** - * Retrieve the singleton instance of this class. - * - * @return the singleton instance. - */ - @Nullable - public static SyncController get() { - ThreadUtils.assertOnUiThread(); - if (!sInitialized) { - if (SyncService.get() != null) { - sInstance = new SyncController(); - } - sInitialized = true; - } - return sInstance; - } - - /** - * Updates sync to reflect the state of the Android sync settings. - */ - private void updateSyncStateFromAndroid() { - // Note: |isChromeSyncEnabled| maps to SyncRequested, and - // |isMasterSyncEnabled| maps to *both* SyncRequested and - // SyncAllowedByPlatform. - // TODO(crbug.com/921025): Don't mix these two concepts. - - mSyncService.setSyncAllowedByPlatform( - AndroidSyncSettings.get().doesMasterSyncSettingAllowChromeSync()); - - if (isSyncEnabledInAndroidSyncSettings() == mSyncService.isSyncRequested()) return; - if (isSyncEnabledInAndroidSyncSettings()) { - mSyncService.setSyncRequested(true); - return; - } - - if (Profile.getLastUsedRegularProfile().isChild()) { - // For child accounts, Sync needs to stay enabled, so we reenable it in settings. - // TODO(bauerb): Remove the dependency on child account code and instead go through - // prefs (here and in the Sync customization UI). - AndroidSyncSettings.get().enableChromeSync(); - } else { - // On sign-out, Sync.StopSource is already recorded in the native code, so only - // record it here if there's still a primary (syncing) account. - // TODO(crbug.com/1105795): Revisit how these metrics are recorded. - if (mSyncService.hasSyncConsent()) { - int source = !AndroidSyncSettings.get().doesMasterSyncSettingAllowChromeSync() - ? StopSource.ANDROID_MASTER_SYNC - : StopSource.ANDROID_CHROME_SYNC; - RecordHistogram.recordEnumeratedHistogram( - "Sync.StopSource", source, StopSource.STOP_SOURCE_LIMIT); - } - - mSyncService.setSyncRequested(false); - } - } - - /** - * From {@link SyncService.SyncStateChangedListener}. - * - * Changes the invalidation controller and Android sync setting state to match - * the new native sync state. - */ - @Override - public void syncStateChanged() { - ThreadUtils.assertOnUiThread(); - if (mSyncService.isSyncRequested()) { - if (!isSyncEnabledInAndroidSyncSettings()) { - AndroidSyncSettings.get().enableChromeSync(); - } - } else { - if (isSyncEnabledInAndroidSyncSettings()) { - // Both Android's master and Chrome sync setting are enabled, so we want to disable - // the Chrome sync setting to match isSyncRequested. We have to be careful not to - // disable it when isSyncRequested becomes false due to master sync being disabled - // so that sync will turn back on if master sync is re-enabled. - // TODO(crbug.com/921025): Master sync shouldn't influence isSyncRequested. - AndroidSyncSettings.get().disableChromeSync(); - } - } - } - - /** - * From {@link AndroidSyncSettings.Delegate}. - */ - @Override - public void androidSyncSettingsChanged() { - updateSyncStateFromAndroid(); - } - - /** - * Checks both the master sync for the device, and Chrome sync setting for the given account. - * If no user is currently signed in it returns false. - */ - private boolean isSyncEnabledInAndroidSyncSettings() { - return AndroidSyncSettings.get().doesMasterSyncSettingAllowChromeSync() - && AndroidSyncSettings.get().isChromeSyncEnabled(); - } -}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java index b4da7b11..00fb368b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabImpl.java
@@ -227,7 +227,8 @@ mIsTabSaveEnabledSupplier.set(false); mId = TabIdManager.getInstance().generateValidId(id); mIncognito = incognito; - if (serializedCriticalPersistedTabData != null && useCriticalPersistedTabData()) { + if (!CriticalPersistedTabData.isEmptySerialization(serializedCriticalPersistedTabData) + && useCriticalPersistedTabData()) { CriticalPersistedTabData.build(this, serializedCriticalPersistedTabData, true); mUsedCriticalPersistedTabData = true; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java index db1ce81..a3302ea2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java
@@ -647,8 +647,9 @@ throws InterruptedException, ExecutionException { // If CriticalPersistedTabData flag is on and CriticalPersistedTabData was retrieved, no // need to attempt to retrieve TabState. - if (isCriticalPersistedTabDataEnabled() && serializedCriticalPersistedTabData != null - && serializedCriticalPersistedTabData.limit() != 0) { + if (isCriticalPersistedTabDataEnabled() + && !CriticalPersistedTabData.isEmptySerialization( + serializedCriticalPersistedTabData)) { return null; } // If the Tab being restored is the Active Tab and the corresponding TabState prefetch @@ -675,7 +676,9 @@ boolean isIncognito = isIncognitoTabBeingRestored( tabToRestore, tabState, serializedCriticalPersistedTabData); - if (tabState == null && serializedCriticalPersistedTabData == null) { + if (tabState == null + && CriticalPersistedTabData.isEmptySerialization( + serializedCriticalPersistedTabData)) { if (tabToRestore.isIncognito == null) { Log.w(TAG, "Failed to restore tab: not enough info about its type was available."); return; @@ -719,7 +722,9 @@ } int tabId = tabToRestore.id; - if (tabState != null || serializedCriticalPersistedTabData != null) { + if (tabState != null + || !CriticalPersistedTabData.isEmptySerialization( + serializedCriticalPersistedTabData)) { mTabCreatorManager.getTabCreator(isIncognito) .createFrozenTab(tabState, serializedCriticalPersistedTabData, tabToRestore.id, isIncognito, restoredIndex); @@ -1491,7 +1496,7 @@ "Tabs.SavedTabLoadTime.CriticalPersistedTabData.%s", res == null ? "Null" : "Exists"), SystemClock.elapsedRealtime() - startTime); - if (res == null) { + if (CriticalPersistedTabData.isEmptySerialization(res)) { loadTabState(); } else { completeLoad(mTabToRestore, null, res); @@ -1696,7 +1701,8 @@ Log.i(TAG, "#isIncognitoTabBeingRestored from tabDetails: " + tabDetails.isIncognito); // The TabState couldn't be restored, but we have some information about the tab. return tabDetails.isIncognito; - } else if (serializedCriticalPersistedTabData != null) { + } else if (!CriticalPersistedTabData.isEmptySerialization( + serializedCriticalPersistedTabData)) { return FilePersistedTabDataStorage.isIncognito(tabDetails.id); } else { Log.i(TAG, "#isIncognitoTabBeingRestored defaulting to false"); @@ -1756,7 +1762,7 @@ } ByteBuffer res = CriticalPersistedTabData.restore(activeTabId, isIncognito); - if (res == null || res.limit() == 0) { + if (CriticalPersistedTabData.isEmptySerialization(res)) { prefetchActiveTabTask(activeTabId, taskRunner); return null; }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java index 13e47395..c06fb21 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/browsing_data/BrowsingDataRemoverIntegrationTest.java
@@ -15,6 +15,7 @@ import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.browserservices.intents.BrowserServicesIntentDataProvider; +import org.chromium.chrome.browser.browserservices.verification.VerificationResultStore; import org.chromium.chrome.browser.browsing_data.BrowsingDataBridge.OnClearBrowsingDataListener; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.webapps.TestFetchStorageCallback; @@ -28,6 +29,8 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import java.util.Set; +import java.util.concurrent.TimeoutException; /** * Integration tests for the native BrowsingDataRemover. @@ -109,4 +112,28 @@ // All webapps should have been unregistered. Assert.assertTrue(WebappRegistry.getRegisteredWebappIdsForTesting().isEmpty()); } + + @Test + @MediumTest + public void testClearingTrustedWebActivityVerifications() throws TimeoutException { + CallbackHelper callbackHelper = new CallbackHelper(); + + String relationship = "relationship1"; + Set<String> savedLinks = new HashSet<>(); + savedLinks.add(relationship); + + VerificationResultStore mStore = VerificationResultStore.getInstanceForTesting(); + + mStore.setRelationships(savedLinks); + + Assert.assertTrue(mStore.getRelationships().contains(relationship)); + + TestThreadUtils.runOnUiThreadBlocking(() -> { + BrowsingDataBridge.getInstance().clearBrowsingData(callbackHelper::notifyCalled, + new int[] {BrowsingDataType.HISTORY}, TimePeriod.ALL_TIME); + }); + + callbackHelper.waitForCallback(0); + Assert.assertTrue(mStore.getRelationships().isEmpty()); + } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchInstrumentationBase.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchInstrumentationBase.java index 8c09843..7ccbde21 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchInstrumentationBase.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchInstrumentationBase.java
@@ -118,18 +118,21 @@ */ private static final ImmutableMap<String, Boolean> ENABLE_NONE = ImmutableMap.of(ChromeFeatureList.CONTEXTUAL_SEARCH_LONGPRESS_RESOLVE, false, + ChromeFeatureList.CONTEXTUAL_SEARCH_LITERAL_SEARCH_TAP, false, ChromeFeatureList.CONTEXTUAL_SEARCH_TRANSLATIONS, false); /** - * This represents the Longpress configuration, currently launching. + * This represents the Longpress with LiteralTap configurations, a good launch candidate. */ private static final ImmutableMap<String, Boolean> ENABLE_LONGPRESS = ImmutableMap.of(ChromeFeatureList.CONTEXTUAL_SEARCH_LONGPRESS_RESOLVE, true, + ChromeFeatureList.CONTEXTUAL_SEARCH_LITERAL_SEARCH_TAP, true, ChromeFeatureList.CONTEXTUAL_SEARCH_TRANSLATIONS, false); /** - * This represents the Translations addition to the Longpress configuration. + * This represents the Translations addition to the Longpress with LiteralTap configuration. */ private static final ImmutableMap<String, Boolean> ENABLE_TRANSLATIONS = ImmutableMap.of(ChromeFeatureList.CONTEXTUAL_SEARCH_LONGPRESS_RESOLVE, false, + ChromeFeatureList.CONTEXTUAL_SEARCH_LITERAL_SEARCH_TAP, true, ChromeFeatureList.CONTEXTUAL_SEARCH_TRANSLATIONS, true); /** @@ -298,10 +301,13 @@ private class ContextualSearchInstrumentationTestHost implements ContextualSearchTestHost { @Override public void triggerNonResolve(String nodeId) throws TimeoutException { - if (!mPolicy.canResolveLongpress() || mPolicy.isUserUndecided()) { + if (mPolicy.isLiteralSearchTapEnabled()) { + clickWordNode(nodeId); + } else if (!mPolicy.canResolveLongpress()) { longPressNode(nodeId); } else { - Assert.fail("Cannot trigger a non-resolving gesture!"); + Assert.fail( + "Cannot trigger a non-resolving gesture with literal tap or non-resolve!"); } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java index fa585291..8e1ab91 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java
@@ -208,13 +208,15 @@ /** This represents the current fully-launched configuration. */ private static final ImmutableMap<String, Boolean> ENABLE_NONE = ImmutableMap.of(ChromeFeatureList.CONTEXTUAL_SEARCH_LONGPRESS_RESOLVE, false, + ChromeFeatureList.CONTEXTUAL_SEARCH_LITERAL_SEARCH_TAP, false, ChromeFeatureList.CONTEXTUAL_SEARCH_TRANSLATIONS, false); /** - * This represents the Translations addition to the Longpress configuration. + * This represents the Translations addition to the Longpress with LiteralTap configuration. * This is likely the best launch candidate. */ private static final ImmutableMap<String, Boolean> ENABLE_TRANSLATIONS = ImmutableMap.of(ChromeFeatureList.CONTEXTUAL_SEARCH_LONGPRESS_RESOLVE, false, + ChromeFeatureList.CONTEXTUAL_SEARCH_LITERAL_SEARCH_TAP, true, ChromeFeatureList.CONTEXTUAL_SEARCH_TRANSLATIONS, true); /** Feature maps that we use for individual tests. */ @@ -346,10 +348,14 @@ private class ContextualSearchManagerTestHost implements ContextualSearchTestHost { @Override public void triggerNonResolve(String nodeId) throws TimeoutException { - if (!mPolicy.canResolveLongpress() || mPolicy.isUserUndecided()) { + // TODO(donnd): remove support for the LiteralSearchTap Feature. + if (mPolicy.isLiteralSearchTapEnabled()) { + clickWordNode(nodeId); + } else if (!mPolicy.canResolveLongpress()) { longPressNode(nodeId); } else { - Assert.fail("Cannot trigger a non-resolving gesture!"); + Assert.fail( + "Cannot trigger a non-resolving gesture with literal tap or non-resolve!"); } } @@ -1539,8 +1545,7 @@ @Feature({"ContextualSearch"}) @ParameterAnnotations.UseMethodParameter(FeatureParamProvider.class) public void testNonResolveTrigger(@EnabledFeature int enabledFeature) throws Exception { - // Mark the user undecided so we won't resolve the search. - mPolicy.overrideDecidedStateForTesting(false); + if (isConfigurationForResolvingGesturesOnly()) return; triggerNonResolve("states"); Assert.assertNull(mFakeServer.getSearchTermRequested()); @@ -1591,8 +1596,6 @@ @Restriction(UiRestriction.RESTRICTION_TYPE_PHONE) @ParameterAnnotations.UseMethodParameter(FeatureParamProvider.class) public void testNonResolveSwipeExpand(@EnabledFeature int enabledFeature) throws Exception { - // Mark the user undecided so we won't resolve the search. - mPolicy.overrideDecidedStateForTesting(false); simulateNonResolveSearch("search"); assertNoWebContents(); assertLoadedNoUrl(); @@ -2741,8 +2744,6 @@ @ParameterAnnotations.UseMethodParameter(FeatureParamProvider.class) public void testNonResolveContentVisibility(@EnabledFeature int enabledFeature) throws Exception { - // Mark the user undecided so we won't resolve the search. - mPolicy.overrideDecidedStateForTesting(false); // Simulate a non-resolve search and make sure no Content is created. simulateNonResolveSearch("search"); assertNoWebContents(); @@ -2808,8 +2809,6 @@ @DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.P, message = "crbug.com/1032760") public void testNonResolveMultipleSwipeOnlyLoadsContentOnce(@EnabledFeature int enabledFeature) throws Exception { - // Mark the user undecided so we won't resolve the search. - mPolicy.overrideDecidedStateForTesting(false); // Simulate a non-resolve search and make sure no Content is created. simulateNonResolveSearch("search"); assertNoWebContents(); @@ -3084,8 +3083,6 @@ @Feature({"ContextualSearch"}) @ParameterAnnotations.UseMethodParameter(FeatureParamProvider.class) public void testNonResolveTranslates(@EnabledFeature int enabledFeature) throws Exception { - // Mark the user undecided so we won't resolve the search. - mPolicy.overrideDecidedStateForTesting(false); // A non-resolving gesture on any word should trigger a forced translation. simulateNonResolveSearch("search"); // Make sure we did try to trigger translate.
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTest.java index b08f478..2ccc5c0 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchTest.java
@@ -57,7 +57,8 @@ // can be tested too. Or just remove this whole suite if it's not useful for // these experimental triggering changes. @Features.DisableFeatures({ChromeFeatureList.CONTEXTUAL_SEARCH_LONGPRESS_RESOLVE, - ChromeFeatureList.CONTEXTUAL_SEARCH_TRANSLATIONS}) + ChromeFeatureList.CONTEXTUAL_SEARCH_TRANSLATIONS, + ChromeFeatureList.CONTEXTUAL_SEARCH_LITERAL_SEARCH_TAP}) @Batch(Batch.PER_CLASS) public class ContextualSearchTest { @ClassRule
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java index 1b62746a..5b0d102a 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/omnibox/UrlBarTest.java
@@ -28,6 +28,7 @@ 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.FlakyTest; import org.chromium.base.test.util.Restriction; import org.chromium.base.test.util.UrlUtils; import org.chromium.chrome.R; @@ -138,6 +139,7 @@ @Test @SmallTest + @FlakyTest(message = "crbug.com/1291515") public void testRefocusing() { for (int i = 0; i < 5; i++) { mOmnibox.requestFocus();
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AndroidSyncSettingsTestUtils.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AndroidSyncSettingsTestUtils.java index 7f2f9e2..505bab2 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AndroidSyncSettingsTestUtils.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/AndroidSyncSettingsTestUtils.java
@@ -25,14 +25,4 @@ TestThreadUtils.runOnUiThreadBlocking( () -> SyncContentResolverDelegate.overrideForTests(delegate)); } - - public static boolean getIsChromeSyncEnabledOnUiThread() { - return TestThreadUtils.runOnUiThreadBlockingNoException( - () -> AndroidSyncSettings.get().isChromeSyncEnabled()); - } - - public static boolean getDoesMasterSyncAllowSyncOnUiThread() { - return TestThreadUtils.runOnUiThreadBlockingNoException( - () -> AndroidSyncSettings.get().doesMasterSyncSettingAllowChromeSync()); - } }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTestRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTestRule.java index 8381355..7b1c0b5 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTestRule.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/sync/SyncTestRule.java
@@ -388,9 +388,6 @@ startMainActivityForSyncTest(); - // Ensure SyncController is created. - TestThreadUtils.runOnUiThreadBlocking(() -> SyncController.get()); - statement.evaluate(); } }, desc);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/state/ShoppingPersistedTabDataTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/state/ShoppingPersistedTabDataTest.java index e24f2be..8855a1c 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tab/state/ShoppingPersistedTabDataTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tab/state/ShoppingPersistedTabDataTest.java
@@ -1137,7 +1137,7 @@ } @Override - protected void deserializeAndLog(@Nullable ByteBuffer bytes) { + public void deserializeAndLog(@Nullable ByteBuffer bytes) { ThreadUtils.assertOnBackgroundThread(); super.deserializeAndLog(bytes); }
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java index 9af8b83..22919615 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabPersistentStoreTest.java
@@ -58,6 +58,7 @@ import org.chromium.chrome.browser.tab.TabState; import org.chromium.chrome.browser.tab.state.CriticalPersistedTabData; import org.chromium.chrome.browser.tab.state.LoadCallbackHelper; +import org.chromium.chrome.browser.tab.state.PersistedTabDataConfiguration; import org.chromium.chrome.browser.tabmodel.NextTabPolicy.NextTabPolicySupplier; import org.chromium.chrome.browser.tabmodel.TabPersistentStore.TabModelSelectorMetadata; import org.chromium.chrome.browser.tabmodel.TabPersistentStore.TabPersistentStoreObserver; @@ -683,6 +684,51 @@ @Test @SmallTest @Feature({"TabPersistentStore"}) + public void testFallbackTabStateEmptyByteBufferCriticalPersistedTabData() throws Exception { + CachedFeatureFlags.setForTesting(ChromeFeatureList.CRITICAL_PERSISTED_TAB_DATA, true); + TestThreadUtils.runOnUiThreadBlocking(() -> { + // Always return Empty Byte buffer (ByteBuffer with limit = 0 from storage) + PersistedTabDataConfiguration.setUseEmptyByteBufferTestConfig(true); + }); + TabModelMetaDataInfo info = TestTabModelDirectory.TAB_MODEL_METADATA_V5_WITH_INCOGNITO; + int numExpectedTabs = info.contents.length; + + // Write out Tab Model and TabState files + mMockDirectory.writeTabModelFiles(info, false); + for (int i = 0; i < info.contents.length; i++) { + mMockDirectory.writeTabStateFile(info.contents[i]); + } + + // Initialize the classes. + MockTabModelSelector mockSelector = + TestThreadUtils.runOnUiThreadBlocking(() -> new MockTabModelSelector(0, 0, null)); + MockTabCreatorManager mockManager = new MockTabCreatorManager(mockSelector); + MockTabPersistentStoreObserver mockObserver = new MockTabPersistentStoreObserver(); + TabPersistencePolicy persistencePolicy = createTabPersistencePolicy(0, false, true); + final TabPersistentStore store = + buildTabPersistentStore(persistencePolicy, mockSelector, mockManager); + TestThreadUtils.runOnUiThreadBlocking(() -> { + store.addObserver(mockObserver); + + // Load the TabModel metadata. + store.loadState(false /* ignoreIncognitoFiles */); + }); + mockObserver.initializedCallback.waitForCallback(0, 1); + Assert.assertEquals(numExpectedTabs, mockObserver.mTabCountAtStartup); + mockObserver.detailsReadCallback.waitForCallback(0, numExpectedTabs); + Assert.assertEquals(numExpectedTabs, mockObserver.details.size()); + + // Restore the TabStates, and confirm that the correct number of tabs is created. + TestThreadUtils.runOnUiThreadBlocking(() -> { store.restoreTabs(true); }); + mockObserver.stateLoadedCallback.waitForCallback(0, 1); + Assert.assertEquals(info.numRegularTabs, mockSelector.getModel(false).getCount()); + // No incognito TabState files were written. + Assert.assertEquals(0, mockSelector.getModel(true).getCount()); + } + + @Test + @SmallTest + @Feature({"TabPersistentStore"}) public void testSerializeDuringRestore() throws Exception { TabStateInfo regularTab = new TabStateInfo(false, 2, 2, "https://google.com", "Google", null);
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java index 7eb8ebd..9a49bab 100644 --- a/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java +++ b/chrome/android/junit/src/org/chromium/chrome/browser/browserservices/TrustedWebActivityClientTest.java
@@ -7,6 +7,7 @@ import static org.junit.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -18,16 +19,11 @@ import android.os.RemoteException; import androidx.browser.trusted.Token; -import androidx.browser.trusted.TrustedWebActivityServiceConnection; -import androidx.browser.trusted.TrustedWebActivityServiceConnectionPool; - -import com.google.common.util.concurrent.SettableFuture; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; @@ -38,7 +34,10 @@ import org.chromium.chrome.browser.notifications.NotificationBuilderBase; import org.chromium.chrome.browser.notifications.NotificationUmaTracker; import org.chromium.components.browser_ui.notifications.NotificationWrapper; +import org.chromium.components.embedder_support.util.Origin; +import java.io.ByteArrayOutputStream; +import java.io.DataOutputStream; import java.util.ArrayList; import java.util.HashSet; import java.util.Set; @@ -53,12 +52,10 @@ private static final int SERVICE_SMALL_ICON_ID = 1; private static final String CLIENT_PACKAGE_NAME = "com.example.app"; - private SettableFuture<TrustedWebActivityServiceConnection> mServiceFuture = - SettableFuture.create(); - @Mock - private TrustedWebActivityServiceConnectionPool mConnectionPool; - @Mock private TrustedWebActivityServiceConnection mService; + private TrustedWebActivityClientWrappers.ConnectionPool mConnectionPool; + @Mock + private TrustedWebActivityClientWrappers.Connection mService; @Mock private NotificationBuilderBase mNotificationBuilder; @Mock private TrustedWebActivityUmaRecorder mRecorder; @Mock private NotificationUmaTracker mNotificationUmaTracker; @@ -71,11 +68,19 @@ private TrustedWebActivityClient mClient; @Before - public void setUp() throws ExecutionException, InterruptedException, RemoteException { + public void setUp() throws RemoteException { MockitoAnnotations.initMocks(this); - mServiceFuture.set(mService); - when(mConnectionPool.connect(any(), any(), any())).thenReturn(mServiceFuture); + doAnswer(invocation -> { + Origin origin = invocation.getArgument(1); + TrustedWebActivityClient.ExecutionCallback callback = invocation.getArgument(3); + + callback.onConnected(origin, mService); + + return null; + }) + .when(mConnectionPool) + .connectAndExecute(any(), any(), any(), any()); when(mService.getSmallIconId()).thenReturn(SERVICE_SMALL_ICON_ID); when(mService.getSmallIconBitmap()).thenReturn(mServiceSmallIconBitmap); @@ -84,7 +89,7 @@ when(mNotificationBuilder.build(any())).thenReturn(mNotificationWrapper); Set<Token> delegateApps = new HashSet<>(); - delegateApps.add(Mockito.mock(Token.class)); + delegateApps.add(createDummyToken()); when(mDelegatesManager.getAllDelegateApps(any())).thenReturn(delegateApps); mClient = new TrustedWebActivityClient(mConnectionPool, mDelegatesManager, mRecorder); @@ -157,4 +162,30 @@ assertNull(TrustedWebActivityClient.createLaunchIntentForTwa(RuntimeEnvironment.application, "mailto:miranda@example.com", new ArrayList<ResolveInfo>())); } + + private static Token createDummyToken() { + // This code requires understanding how Token's parse (see TokenContents.java inside + // androidx.browser) and is pretty ugly. The alternative is to set up the Robolectric + // PackageManager to provide the right data, which probably is a more robust approach. + // However, ideally androidx.browser will add a way to create a mock Token for testing and + // we can use that instead. + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + DataOutputStream writer = new DataOutputStream(baos); + + String packageName = "token.package.name"; + int numFingerprints = 1; + byte[] fingerprint = "1234".getBytes(); + + try { + writer.writeUTF(packageName); + writer.writeInt(numFingerprints); + writer.writeInt(fingerprint.length); + writer.write(fingerprint); + writer.flush(); + } catch (Exception e) { + throw new RuntimeException(e); + } + + return Token.deserialize(baos.toByteArray()); + } }
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/sync/AndroidSyncSettingsTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/sync/AndroidSyncSettingsTest.java deleted file mode 100644 index 393d6d4..0000000 --- a/chrome/android/junit/src/org/chromium/chrome/browser/sync/AndroidSyncSettingsTest.java +++ /dev/null
@@ -1,378 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -package org.chromium.chrome.browser.sync; - -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import static org.chromium.chrome.browser.sync.AndroidSyncSettingsTestUtils.getDoesMasterSyncAllowSyncOnUiThread; -import static org.chromium.chrome.browser.sync.AndroidSyncSettingsTestUtils.getIsChromeSyncEnabledOnUiThread; - -import android.accounts.Account; -import android.os.Bundle; - -import androidx.test.filters.SmallTest; - -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; -import org.robolectric.annotation.Config; - -import org.chromium.base.test.BaseRobolectricTestRunner; -import org.chromium.base.test.util.Feature; -import org.chromium.components.signin.AccountManagerFacadeProvider; -import org.chromium.components.signin.AccountUtils; -import org.chromium.components.signin.test.util.FakeAccountManagerFacade; -import org.chromium.content_public.browser.test.util.TestThreadUtils; - -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Tests for AndroidSyncSettings. - */ -@RunWith(BaseRobolectricTestRunner.class) -@Config(manifest = Config.NONE) -public class AndroidSyncSettingsTest { - // Thread-safe class to fake user interaction with auto-sync settings which also counts calls - // to certain methods. - // When a setter is called, this results into a task being immediately posted to the thread - // where AndroidSyncSettings lives (UI) to update its internal state. Consequently, if the - // setter is called on the test thread, and an assertion for the expected state is then posted - // to the UI thread, the assertion task is guaranteed to be executed after the update task. So - // this is safe. Getters on the other hand can be called wherever, with many of them being - // batched with other code running inside runOnUiThreadBlocking() to make the code succinct. - private static class CountingMockSyncContentResolverDelegate - extends MockSyncContentResolverDelegate { - private final AtomicInteger mGetMasterSyncAutomaticallyCalls = new AtomicInteger(); - private final AtomicInteger mGetSyncAutomaticallyCalls = new AtomicInteger(); - private final AtomicInteger mGetIsSyncableCalls = new AtomicInteger(); - private final AtomicInteger mSetIsSyncableCalls = new AtomicInteger(); - private final AtomicInteger mSetSyncAutomaticallyCalls = new AtomicInteger(); - private final AtomicInteger mRemovePeriodicSyncCalls = new AtomicInteger(); - - @Override - public boolean getMasterSyncAutomatically() { - mGetMasterSyncAutomaticallyCalls.getAndIncrement(); - return super.getMasterSyncAutomatically(); - } - - @Override - public boolean getSyncAutomatically(Account account, String authority) { - mGetSyncAutomaticallyCalls.getAndIncrement(); - return super.getSyncAutomatically(account, authority); - } - - @Override - public int getIsSyncable(Account account, String authority) { - mGetIsSyncableCalls.getAndIncrement(); - return super.getIsSyncable(account, authority); - } - - @Override - public void setIsSyncable(Account account, String authority, int syncable) { - mSetIsSyncableCalls.getAndIncrement(); - super.setIsSyncable(account, authority, syncable); - } - - @Override - public void setSyncAutomatically(Account account, String authority, boolean sync) { - mSetSyncAutomaticallyCalls.getAndIncrement(); - super.setSyncAutomatically(account, authority, sync); - } - - @Override - public void removePeriodicSync(Account account, String authority, Bundle extras) { - mRemovePeriodicSyncCalls.getAndIncrement(); - super.removePeriodicSync(account, authority, extras); - } - } - - // Should live on the UI thread as a normal AndroidSyncSettings.Delegate. - private static class MockSyncSettingsDelegate implements AndroidSyncSettings.Delegate { - private boolean mReceivedNotification; - - public void clearNotification() { - mReceivedNotification = false; - } - - public boolean receivedNotification() { - return mReceivedNotification; - } - - @Override - public void androidSyncSettingsChanged() { - mReceivedNotification = true; - } - } - - @Rule - public final MockitoRule mMockitoRule = MockitoJUnit.rule(); - - private AndroidSyncSettings mAndroidSyncSettings; - private CountingMockSyncContentResolverDelegate mSyncContentResolverDelegate; - @Mock - private SyncService mSyncService; - private Account mAccount; - private Account mAlternateAccount; - private String mAuthority = AndroidSyncSettings.getContractAuthority(); - - @Before - public void setUp() { - mSyncContentResolverDelegate = new CountingMockSyncContentResolverDelegate(); - TestThreadUtils.runOnUiThreadBlocking(() -> { - SyncContentResolverDelegate.overrideForTests(mSyncContentResolverDelegate); - SyncService.overrideForTests(mSyncService); - }); - - FakeAccountManagerFacade fakeAccountManagerFacade = new FakeAccountManagerFacade(); - AccountManagerFacadeProvider.setInstanceForTests(fakeAccountManagerFacade); - mAccount = AccountUtils.createAccountFromName("account@example.com"); - fakeAccountManagerFacade.addAccount(mAccount); - mAlternateAccount = AccountUtils.createAccountFromName("alternate@example.com"); - fakeAccountManagerFacade.addAccount(mAlternateAccount); - } - - private void createAndroidSyncSettings() { - TestThreadUtils.runOnUiThreadBlocking(() -> { - // TODO(crbug.com/1105795): Consider setting the fake account in the identity manager - // so there's no need to inject it here. - mAndroidSyncSettings = new AndroidSyncSettings(mAccount); - AndroidSyncSettings.overrideForTests(mAndroidSyncSettings); - }); - - // Less than or equal to 0 means not "syncable". - Assert.assertTrue(mSyncContentResolverDelegate.getIsSyncable(mAccount, mAuthority) <= 0); - } - - @After - public void tearDown() { - AccountManagerFacadeProvider.resetInstanceForTests(); - } - - @Test - @SmallTest - @Feature({"Sync"}) - public void testToggleMasterSyncFromSettingsWithDecouplingEnabled() { - createAndroidSyncSettings(); - - mSyncContentResolverDelegate.setMasterSyncAutomatically(true); - Assert.assertTrue(getDoesMasterSyncAllowSyncOnUiThread()); - - mSyncContentResolverDelegate.setMasterSyncAutomatically(false); - Assert.assertTrue(getDoesMasterSyncAllowSyncOnUiThread()); - } - - @Test - @SmallTest - @Feature({"Sync"}) - public void testToggleChromeSyncFromSettingsWithDecouplingEnabled() { - createAndroidSyncSettings(); - - mSyncContentResolverDelegate.setMasterSyncAutomatically(true); - - // Enable sync for Chrome app. - mSyncContentResolverDelegate.setSyncAutomatically(mAccount, mAuthority, true); - Assert.assertTrue(getDoesMasterSyncAllowSyncOnUiThread()); - Assert.assertTrue(getIsChromeSyncEnabledOnUiThread()); - - // Disable sync for Chrome app. - mSyncContentResolverDelegate.setSyncAutomatically(mAccount, mAuthority, false); - Assert.assertTrue(getDoesMasterSyncAllowSyncOnUiThread()); - Assert.assertFalse(getIsChromeSyncEnabledOnUiThread()); - - // Re-enable sync for Chrome app. - mSyncContentResolverDelegate.setSyncAutomatically(mAccount, mAuthority, true); - Assert.assertTrue(getDoesMasterSyncAllowSyncOnUiThread()); - Assert.assertTrue(getIsChromeSyncEnabledOnUiThread()); - - // Disable master sync (all apps). - mSyncContentResolverDelegate.setMasterSyncAutomatically(false); - Assert.assertTrue(getDoesMasterSyncAllowSyncOnUiThread()); - Assert.assertTrue(getIsChromeSyncEnabledOnUiThread()); - } - - @Test - @SmallTest - @Feature({"Sync"}) - public void testToggleAccountSyncFromApplicationWithDecouplingEnabled() { - mSyncContentResolverDelegate.setMasterSyncAutomatically(true); - - createAndroidSyncSettings(); - - TestThreadUtils.runOnUiThreadBlocking(() -> mAndroidSyncSettings.enableChromeSync()); - Assert.assertTrue(getIsChromeSyncEnabledOnUiThread()); - - TestThreadUtils.runOnUiThreadBlocking(() -> mAndroidSyncSettings.disableChromeSync()); - Assert.assertFalse(getIsChromeSyncEnabledOnUiThread()); - } - - @Test - @SmallTest - @Feature({"Sync"}) - public void testToggleSyncabilityForMultipleAccountsWithDecouplingEnabled() { - mSyncContentResolverDelegate.setMasterSyncAutomatically(true); - - createAndroidSyncSettings(); - - TestThreadUtils.runOnUiThreadBlocking(() -> { - mAndroidSyncSettings.enableChromeSync(); - Assert.assertTrue(mAndroidSyncSettings.isChromeSyncEnabled()); - - mAndroidSyncSettings.updateAccount(mAlternateAccount); - mAndroidSyncSettings.enableChromeSync(); - Assert.assertTrue(mAndroidSyncSettings.isChromeSyncEnabled()); - - mAndroidSyncSettings.disableChromeSync(); - Assert.assertFalse(mAndroidSyncSettings.isChromeSyncEnabled()); - mAndroidSyncSettings.updateAccount(mAccount); - Assert.assertTrue(mAndroidSyncSettings.isChromeSyncEnabled()); - - // Ensure we don't erroneously re-use cached data. - mAndroidSyncSettings.updateAccount(null); - Assert.assertFalse(mAndroidSyncSettings.isChromeSyncEnabled()); - }); - } - - @Test - @SmallTest - @Feature({"Sync"}) - public void testSyncSettingsCachingWithDecouplingEnabled() { - mSyncContentResolverDelegate.setMasterSyncAutomatically(true); - - createAndroidSyncSettings(); - - TestThreadUtils.runOnUiThreadBlocking(() -> { - mAndroidSyncSettings.enableChromeSync(); - Assert.assertTrue(mAndroidSyncSettings.isChromeSyncEnabled()); - - int masterSyncAutomaticallyCalls = - mSyncContentResolverDelegate.mGetMasterSyncAutomaticallyCalls.get(); - int isSyncableCalls = mSyncContentResolverDelegate.mGetIsSyncableCalls.get(); - int getSyncAutomaticallyCalls = - mSyncContentResolverDelegate.mGetSyncAutomaticallyCalls.get(); - - // Do a bunch of reads. - mAndroidSyncSettings.doesMasterSyncSettingAllowChromeSync(); - mAndroidSyncSettings.isChromeSyncEnabled(); - - // Ensure values were read from cache. - Assert.assertEquals(masterSyncAutomaticallyCalls, - mSyncContentResolverDelegate.mGetMasterSyncAutomaticallyCalls.get()); - Assert.assertEquals( - isSyncableCalls, mSyncContentResolverDelegate.mGetIsSyncableCalls.get()); - Assert.assertEquals(getSyncAutomaticallyCalls, - mSyncContentResolverDelegate.mGetSyncAutomaticallyCalls.get()); - - // Do a bunch of reads for alternate account. - mAndroidSyncSettings.updateAccount(mAlternateAccount); - mAndroidSyncSettings.doesMasterSyncSettingAllowChromeSync(); - mAndroidSyncSettings.isChromeSyncEnabled(); - - // Ensure settings were only fetched once. - Assert.assertEquals(masterSyncAutomaticallyCalls + 1, - mSyncContentResolverDelegate.mGetMasterSyncAutomaticallyCalls.get()); - Assert.assertEquals( - isSyncableCalls + 1, mSyncContentResolverDelegate.mGetIsSyncableCalls.get()); - Assert.assertEquals(getSyncAutomaticallyCalls + 1, - mSyncContentResolverDelegate.mGetSyncAutomaticallyCalls.get()); - }); - } - - @Test - @SmallTest - @Feature({"Sync"}) - public void testAndroidSyncSettingsNotifiesDelegateWithDecouplingEnabled() { - createAndroidSyncSettings(); - - TestThreadUtils.runOnUiThreadBlocking(() -> { - MockSyncSettingsDelegate syncSettingsDelegate = new MockSyncSettingsDelegate(); - mAndroidSyncSettings.setDelegate(syncSettingsDelegate); - - syncSettingsDelegate.clearNotification(); - mAndroidSyncSettings.enableChromeSync(); - Assert.assertTrue("enableChromeSync should notify delegate", - syncSettingsDelegate.receivedNotification()); - - syncSettingsDelegate.clearNotification(); - mAndroidSyncSettings.updateAccount(mAlternateAccount); - Assert.assertTrue("switching to account with different settings should notify", - syncSettingsDelegate.receivedNotification()); - - syncSettingsDelegate.clearNotification(); - mAndroidSyncSettings.updateAccount(mAccount); - Assert.assertTrue("switching to account with different settings should notify", - syncSettingsDelegate.receivedNotification()); - - syncSettingsDelegate.clearNotification(); - mAndroidSyncSettings.enableChromeSync(); - // enableChromeSync() was a no-op because sync was already enabled for this account. So - // there shouldn't be a notification. - Assert.assertFalse("enableChromeSync shouldn't notify delegate", - syncSettingsDelegate.receivedNotification()); - - syncSettingsDelegate.clearNotification(); - mAndroidSyncSettings.disableChromeSync(); - Assert.assertTrue("disableChromeSync should notify delegate", - syncSettingsDelegate.receivedNotification()); - - syncSettingsDelegate.clearNotification(); - mAndroidSyncSettings.disableChromeSync(); - // disableChromeSync() was a no-op because sync was already disabled. So there shouldn't - // be a notification. - Assert.assertFalse("disableChromeSync shouldn't notify delegate", - syncSettingsDelegate.receivedNotification()); - }); - } - - @Test - @SmallTest - @Feature({"Sync"}) - public void testMasterSyncAllowsSyncIfReEnabledOnce() { - // Master sync is disabled on startup and the user hasn't gone through the decoupling flow - // in the past. - mSyncContentResolverDelegate.setMasterSyncAutomatically(false); - TestThreadUtils.runOnUiThreadBlocking(() -> { - when(mSyncService.getDecoupledFromAndroidMasterSync()).thenReturn(false); - }); - - // Sync must remain disallowed as long as master sync is not re-enabled. - createAndroidSyncSettings(); - Assert.assertFalse(getDoesMasterSyncAllowSyncOnUiThread()); - - // Re-enable master sync at least once. Sync is now allowed and decoupled from master - // sync. - TestThreadUtils.runOnUiThreadBlocking( - () -> doNothing().when(mSyncService).setDecoupledFromAndroidMasterSync()); - mSyncContentResolverDelegate.setMasterSyncAutomatically(true); - Assert.assertTrue(getDoesMasterSyncAllowSyncOnUiThread()); - TestThreadUtils.runOnUiThreadBlocking( - () -> verify(mSyncService).setDecoupledFromAndroidMasterSync()); - mSyncContentResolverDelegate.setMasterSyncAutomatically(false); - Assert.assertTrue(getDoesMasterSyncAllowSyncOnUiThread()); - } - - @Test - @SmallTest - @Feature({"Sync"}) - public void testSyncStateRespectsPersistedDecouplingStateIfFeatureEnabled() { - // Master sync is disabled on startup, but the user has gone through the decoupling flow in - // the past and has the DecoupleSyncFromAndroidMasterSync feature enabled. - mSyncContentResolverDelegate.setMasterSyncAutomatically(false); - TestThreadUtils.runOnUiThreadBlocking( - () -> { when(mSyncService.getDecoupledFromAndroidMasterSync()).thenReturn(true); }); - - // Chrome becomes aware of the previous decoupling, so Sync can be enabled despite master - // sync being disabled. - createAndroidSyncSettings(); - Assert.assertTrue(getDoesMasterSyncAllowSyncOnUiThread()); - } -}
diff --git a/chrome/android/profiles/newest.txt b/chrome/android/profiles/newest.txt index 4e63ef7..3c806ae 100644 --- a/chrome/android/profiles/newest.txt +++ b/chrome/android/profiles/newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-99.0.4844.7_rc-r1-merged.afdo.bz2 +chromeos-chrome-amd64-99.0.4844.9_rc-r1-merged.afdo.bz2
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index 613dcd52..3a16bb8 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -5515,6 +5515,9 @@ <message name="IDS_ACCOUNT_MANAGER_DIALOG_TITLE" desc="Title for the Chrome OS 'Add account' dialog."> Sign in to add a Google account </message> + <message name="IDS_ACCOUNT_MANAGER_DIALOG_NEXT_BUTTON" desc="Label for the 'Continue' button which takes user to the next screen in Chrome OS 'Add account' dialog."> + Continue + </message> <message name="IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_TITLE" desc="Title for the Welcome screen in Chrome OS 'Add account' dialog."> Add another Google Account for <ph name="USER_NAME">$1<ex>John</ex></ph> </message> @@ -5524,10 +5527,10 @@ <message name="IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_WITHOUT_INCOGNITO" desc="Text body for the Welcome screen in Chrome OS 'Add account' dialog without Incognito link."> You can manage signed-in Google Accounts from <ph name="LINK_BEGIN"><a id="osSettingsLink" href="$1<ex>https://google.com/</ex>"></ph>Settings<ph name="LINK_END"></a></ph>. Permissions you have granted to websites and apps may apply to all accounts. If you don't want sites or apps to access your account info, you can sign into your <ph name="DEVICE_TYPE">$2<ex>Chromebook</ex></ph> as a guest. </message> - <!-- TODO(https://crbug.com/1260909): Make the strings translatable when they are finalized. --> - <message name="IDS_ACCOUNT_MANAGER_DIALOG_ARC_TOGGLE_LABEL" desc="Toggle text for the Welcome screen in Chrome OS 'Add account' dialog. If user toggles it on, the account that will be added will be available in Android Apps. The default value for the toggle may be 'on' or 'off' depending on where the dialog is being opened from." translateable="false"> + <message name="IDS_ACCOUNT_MANAGER_DIALOG_ARC_TOGGLE_LABEL" desc="Toggle text for the Welcome screen in Chrome OS 'Add account' dialog. If user toggles it on, the account that will be added will be available in Android Apps. The default value for the toggle may be 'on' or 'off' depending on where the dialog is being opened from."> Use this account with Android apps. You can control permissions for Android apps in <ph name="LINK_BEGIN"><a id="appsSettingsLink" href="$1<ex>https://google.com/</ex>"></ph>Apps Settings<ph name="LINK_END"></a></ph>. </message> + <!-- TODO(https://crbug.com/1260909): Make the strings translatable when they are finalized. --> <message name="IDS_ACCOUNT_MANAGER_DIALOG_ARC_ACCOUNT_PICKER_TITLE" desc="" translateable="false"> Accounts available to use with Android apps </message>
diff --git a/chrome/app/chromeos_strings_grdp/IDS_ACCOUNT_MANAGER_DIALOG_ARC_TOGGLE_LABEL.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_ACCOUNT_MANAGER_DIALOG_ARC_TOGGLE_LABEL.png.sha1 new file mode 100644 index 0000000..d3cab53 --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_ACCOUNT_MANAGER_DIALOG_ARC_TOGGLE_LABEL.png.sha1
@@ -0,0 +1 @@ +9273241d6a3578cd27213dd902c954995fce9862 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_ACCOUNT_MANAGER_DIALOG_NEXT_BUTTON.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_ACCOUNT_MANAGER_DIALOG_NEXT_BUTTON.png.sha1 new file mode 100644 index 0000000..d3cab53 --- /dev/null +++ b/chrome/app/chromeos_strings_grdp/IDS_ACCOUNT_MANAGER_DIALOG_NEXT_BUTTON.png.sha1
@@ -0,0 +1 @@ +9273241d6a3578cd27213dd902c954995fce9862 \ No newline at end of file
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index 7a0eb60e..34f2c01 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd
@@ -482,6 +482,12 @@ Chromium is unable to recover your settings. </message> + <!-- Add account dialog --> + <if expr="chromeos"> + <message name="IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_V2" desc="Text body for the Welcome screen in Chrome OS 'Add account' dialog."> + Permissions you've already given to websites and apps may apply to this account. If you don't want websites or apps to access your account info, use Guest mode in Chromium browser. You can also manage your Google Accounts in <ph name="LINK_2_BEGIN"><a id="osSettingsLink" href="$1<ex>https://google.com/</ex>"></ph>Settings<ph name="LINK_2_END"></a></ph>. + </message> + </if> <!-- Crash Recovery Dialog --> <message name="IDS_CRASH_RECOVERY_TITLE" desc="Title of dialog shown when the browser crashes."> Chromium
diff --git a/chrome/app/chromium_strings_grd/IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_V2.png.sha1 b/chrome/app/chromium_strings_grd/IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_V2.png.sha1 new file mode 100644 index 0000000..b9db98d6 --- /dev/null +++ b/chrome/app/chromium_strings_grd/IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_V2.png.sha1
@@ -0,0 +1 @@ +9d240499b32993be8a59ce76b3156496f2a25e54 \ No newline at end of file
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index b0dd14b..ea9345b 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd
@@ -488,6 +488,12 @@ Google Chrome is unable to recover your settings. </message> + <!-- Add account dialog --> + <if expr="chromeos"> + <message name="IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_V2" desc="Text body for the Welcome screen in Chrome OS 'Add account' dialog."> + Permissions you've already given to websites and apps may apply to this account. If you don't want websites or apps to access your account info, use Guest mode in Chrome browser. You can also manage your Google Accounts in <ph name="LINK_2_BEGIN"><a id="osSettingsLink" href="$1<ex>https://google.com/</ex>"></ph>Settings<ph name="LINK_2_END"></a></ph>. + </message> + </if> <!-- Crash Recovery Dialog --> <message name="IDS_CRASH_RECOVERY_TITLE" desc="Title of dialog shown when the browser crashes."> Google Chrome
diff --git a/chrome/app/google_chrome_strings_grd/IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_V2.png.sha1 b/chrome/app/google_chrome_strings_grd/IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_V2.png.sha1 new file mode 100644 index 0000000..d3cab53 --- /dev/null +++ b/chrome/app/google_chrome_strings_grd/IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_V2.png.sha1
@@ -0,0 +1 @@ +9273241d6a3578cd27213dd902c954995fce9862 \ No newline at end of file
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index c817e92..a38a1d4 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc
@@ -2817,6 +2817,11 @@ flag_descriptions::kContextualSearchForceCaptionName, flag_descriptions::kContextualSearchForceCaptionDescription, kOsAndroid, FEATURE_VALUE_TYPE(chrome::android::kContextualSearchForceCaption)}, + {"contextual-search-literal-search-tap", + flag_descriptions::kContextualSearchLiteralSearchTapName, + flag_descriptions::kContextualSearchLiteralSearchTapDescription, + kOsAndroid, + FEATURE_VALUE_TYPE(chrome::android::kContextualSearchLiteralSearchTap)}, {"contextual-search-longpress-resolve", flag_descriptions::kContextualSearchLongpressResolveName, flag_descriptions::kContextualSearchLongpressResolveDescription, @@ -4411,9 +4416,6 @@ {"files-archivemount2", flag_descriptions::kFilesArchivemount2Name, flag_descriptions::kFilesArchivemount2Description, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kFilesArchivemount2)}, - {"files-banner-framework", flag_descriptions::kFilesBannerFrameworkName, - flag_descriptions::kFilesBannerFrameworkDescription, kOsCrOS, - FEATURE_VALUE_TYPE(chromeos::features::kFilesBannerFramework)}, {"files-extract-archive", flag_descriptions::kFilesExtractArchiveName, flag_descriptions::kFilesExtractArchiveDescription, kOsCrOS, FEATURE_VALUE_TYPE(chromeos::features::kFilesExtractArchive)}, @@ -8045,7 +8047,7 @@ #else // Note: This will only be called by the UI when Lacros is available. DCHECK(crosapi::BrowserManager::Get()); - crosapi::BrowserManager::Get()->OpenUrl(GURL(chrome::kChromeUIFlagsURL)); + crosapi::BrowserManager::Get()->SwitchToTab(GURL(chrome::kChromeUIFlagsURL)); #endif } #endif
diff --git a/chrome/browser/android/autofill_assistant/assistant_collect_user_data_delegate.cc b/chrome/browser/android/autofill_assistant/assistant_collect_user_data_delegate.cc index 0eb484b..d4bc1093 100644 --- a/chrome/browser/android/autofill_assistant/assistant_collect_user_data_delegate.cc +++ b/chrome/browser/android/autofill_assistant/assistant_collect_user_data_delegate.cc
@@ -8,6 +8,7 @@ #include <utility> #include "base/android/jni_string.h" +#include "base/android/locale_utils.h" #include "base/strings/utf_string_conversions.h" #include "chrome/android/features/autofill_assistant/jni_headers/AssistantCollectUserDataNativeDelegate_jni.h" #include "chrome/browser/android/autofill_assistant/ui_controller_android.h" @@ -44,8 +45,9 @@ } auto contact_profile = std::make_unique<autofill::AutofillProfile>(); - autofill::PersonalDataManagerAndroid::PopulateNativeProfileFromJava( - jcontact_profile, env, contact_profile.get()); + ui_controller_android_utils::PopulateAutofillProfileFromJava( + jcontact_profile, env, contact_profile.get(), + base::android::GetDefaultLocaleString()); ui_controller_->OnContactInfoChanged( std::move(contact_profile), static_cast<UserDataEventType>(event_type));
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android.cc b/chrome/browser/android/autofill_assistant/ui_controller_android.cc index acaf5b0..7c80107 100644 --- a/chrome/browser/android/autofill_assistant/ui_controller_android.cc +++ b/chrome/browser/android/autofill_assistant/ui_controller_android.cc
@@ -11,6 +11,7 @@ #include "base/android/jni_android.h" #include "base/android/jni_array.h" #include "base/android/jni_string.h" +#include "base/android/locale_utils.h" #include "base/bind.h" #include "base/command_line.h" #include "base/metrics/field_trial_params.h" @@ -1325,13 +1326,9 @@ auto jselected_contact = selected_contact_profile == nullptr ? nullptr - : Java_AssistantCollectUserDataModel_createAutofillContact( - env, jcontext, - autofill::PersonalDataManagerAndroid:: - CreateJavaProfileFromNative(env, *selected_contact_profile), - collect_user_data_options->request_payer_name, - collect_user_data_options->request_payer_phone, - collect_user_data_options->request_payer_email); + : ui_controller_android_utils::CreateAssistantAutofillProfile( + env, *selected_contact_profile, + base::android::GetDefaultLocaleString()); const auto& selected_contact_errors = user_data::GetContactValidationErrors( selected_contact_profile, *collect_user_data_options); @@ -1354,26 +1351,20 @@ field_change == UserData::FieldChange::AVAILABLE_PROFILES) { // Contacts. auto jcontactlist = - Java_AssistantCollectUserDataModel_createAutofillContactList(env); + Java_AssistantCollectUserDataModel_createContactList(env); auto contact_indices = user_data::SortContactsByCompleteness( *collect_user_data_options, user_data.available_contacts_); for (int index : contact_indices) { - auto jcontact = Java_AssistantCollectUserDataModel_createAutofillContact( - env, jcontext, - autofill::PersonalDataManagerAndroid::CreateJavaProfileFromNative( - env, *user_data.available_contacts_[index]->profile), - collect_user_data_options->request_payer_name, - collect_user_data_options->request_payer_phone, - collect_user_data_options->request_payer_email); - if (jcontact) { - const auto& errors = user_data::GetContactValidationErrors( - user_data.available_contacts_[index]->profile.get(), - *collect_user_data_options); - Java_AssistantCollectUserDataModel_addAutofillContact( - env, jcontactlist, jcontact, - base::android::ToJavaArrayOfStrings(env, errors), - collect_user_data_options->can_edit_contacts); - } + const auto& errors = user_data::GetContactValidationErrors( + user_data.available_contacts_[index]->profile.get(), + *collect_user_data_options); + Java_AssistantCollectUserDataModel_addContact( + env, jcontactlist, + ui_controller_android_utils::CreateAssistantAutofillProfile( + env, *user_data.available_contacts_[index]->profile, + base::android::GetDefaultLocaleString()), + base::android::ToJavaArrayOfStrings(env, errors), + collect_user_data_options->can_edit_contacts); } Java_AssistantCollectUserDataModel_setAvailableContacts(env, jmodel, jcontactlist);
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android_utils.cc b/chrome/browser/android/autofill_assistant/ui_controller_android_utils.cc index e723699..060038c3 100644 --- a/chrome/browser/android/autofill_assistant/ui_controller_android_utils.cc +++ b/chrome/browser/android/autofill_assistant/ui_controller_android_utils.cc
@@ -20,6 +20,7 @@ #include "chrome/android/features/autofill_assistant/jni_headers/AssistantInfoPopup_jni.h" #include "chrome/android/features/autofill_assistant/jni_headers/AssistantValue_jni.h" #include "chrome/android/features/autofill_assistant/jni_headers/AutofillAssistantDependencyInjector_jni.h" +#include "chrome/android/features/autofill_assistant/jni_headers_public/AssistantAutofillProfile_jni.h" #include "chrome/browser/android/autofill_assistant/client_android.h" #include "chrome/browser/android/tab_android.h" #include "components/autofill_assistant/browser/generic_ui_java_generated_enums.h" @@ -33,6 +34,11 @@ namespace ui_controller_android_utils { namespace { +using ::base::android::ConvertJavaStringToUTF16; +using ::base::android::ConvertJavaStringToUTF8; +using ::base::android::ConvertUTF16ToJavaString; +using ::base::android::ConvertUTF8ToJavaString; + DrawableIcon MapDrawableIcon(DrawableProto::Icon icon) { switch (icon) { case DrawableProto::DRAWABLE_ICON_UNDEFINED: @@ -70,6 +76,23 @@ } } +void MaybeSetInfo(autofill::AutofillProfile* profile, + autofill::ServerFieldType type, + const base::android::JavaRef<jstring>& value, + const std::string& locale) { + if (value) { + profile->SetInfo(type, ConvertJavaStringToUTF16(value), locale); + } +} + +void MaybeSetRawInfo(autofill::AutofillProfile* profile, + autofill::ServerFieldType type, + const base::android::JavaRef<jstring>& value) { + if (value) { + profile->SetRawInfo(type, ConvertJavaStringToUTF16(value)); + } +} + } // namespace base::android::ScopedJavaLocalRef<jobject> GetJavaColor( @@ -579,5 +602,88 @@ return test_tts_controller; } +base::android::ScopedJavaLocalRef<jobject> CreateAssistantAutofillProfile( + JNIEnv* env, + const autofill::AutofillProfile& profile, + const std::string& locale) { + return Java_AssistantAutofillProfile_Constructor( + env, ConvertUTF8ToJavaString(env, profile.guid()), + ConvertUTF8ToJavaString(env, profile.origin()), + profile.record_type() == autofill::AutofillProfile::LOCAL_PROFILE, + ConvertUTF16ToJavaString( + env, profile.GetInfo(autofill::NAME_HONORIFIC_PREFIX, locale)), + ConvertUTF16ToJavaString(env, + profile.GetInfo(autofill::NAME_FULL, locale)), + ConvertUTF16ToJavaString(env, profile.GetRawInfo(autofill::COMPANY_NAME)), + ConvertUTF16ToJavaString( + env, profile.GetRawInfo(autofill::ADDRESS_HOME_STREET_ADDRESS)), + ConvertUTF16ToJavaString( + env, profile.GetRawInfo(autofill::ADDRESS_HOME_STATE)), + ConvertUTF16ToJavaString(env, + profile.GetRawInfo(autofill::ADDRESS_HOME_CITY)), + ConvertUTF16ToJavaString( + env, profile.GetRawInfo(autofill::ADDRESS_HOME_DEPENDENT_LOCALITY)), + ConvertUTF16ToJavaString(env, + profile.GetRawInfo(autofill::ADDRESS_HOME_ZIP)), + ConvertUTF16ToJavaString( + env, profile.GetRawInfo(autofill::ADDRESS_HOME_SORTING_CODE)), + ConvertUTF16ToJavaString( + env, profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), + ConvertUTF16ToJavaString( + env, profile.GetRawInfo(autofill::PHONE_HOME_WHOLE_NUMBER)), + ConvertUTF16ToJavaString(env, + profile.GetRawInfo(autofill::EMAIL_ADDRESS)), + ConvertUTF8ToJavaString(env, profile.language_code())); +} + +void PopulateAutofillProfileFromJava( + const base::android::JavaParamRef<jobject>& jprofile, + JNIEnv* env, + autofill::AutofillProfile* profile, + const std::string& locale) { + // Only set the guid if it is an existing profile (Java guid not empty). + // Otherwise, keep the generated one. + std::string guid = ConvertJavaStringToUTF8( + Java_AssistantAutofillProfile_getGUID(env, jprofile)); + if (!guid.empty()) { + profile->set_guid(guid); + } + + profile->set_origin(ConvertJavaStringToUTF8( + Java_AssistantAutofillProfile_getOrigin(env, jprofile))); + MaybeSetInfo(profile, autofill::NAME_FULL, + Java_AssistantAutofillProfile_getFullName(env, jprofile), + locale); + MaybeSetRawInfo( + profile, autofill::NAME_HONORIFIC_PREFIX, + Java_AssistantAutofillProfile_getHonorificPrefix(env, jprofile)); + MaybeSetRawInfo(profile, autofill::COMPANY_NAME, + Java_AssistantAutofillProfile_getCompanyName(env, jprofile)); + MaybeSetRawInfo( + profile, autofill::ADDRESS_HOME_STREET_ADDRESS, + Java_AssistantAutofillProfile_getStreetAddress(env, jprofile)); + MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_STATE, + Java_AssistantAutofillProfile_getRegion(env, jprofile)); + MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_CITY, + Java_AssistantAutofillProfile_getLocality(env, jprofile)); + MaybeSetRawInfo( + profile, autofill::ADDRESS_HOME_DEPENDENT_LOCALITY, + Java_AssistantAutofillProfile_getDependentLocality(env, jprofile)); + MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_ZIP, + Java_AssistantAutofillProfile_getPostalCode(env, jprofile)); + MaybeSetRawInfo(profile, autofill::ADDRESS_HOME_SORTING_CODE, + Java_AssistantAutofillProfile_getSortingCode(env, jprofile)); + MaybeSetInfo(profile, autofill::ADDRESS_HOME_COUNTRY, + Java_AssistantAutofillProfile_getCountryCode(env, jprofile), + locale); + MaybeSetRawInfo(profile, autofill::PHONE_HOME_WHOLE_NUMBER, + Java_AssistantAutofillProfile_getPhoneNumber(env, jprofile)); + MaybeSetRawInfo(profile, autofill::EMAIL_ADDRESS, + Java_AssistantAutofillProfile_getEmailAddress(env, jprofile)); + profile->set_language_code(ConvertJavaStringToUTF8( + Java_AssistantAutofillProfile_getLanguageCode(env, jprofile))); + profile->FinalizeAfterImport(); +} + } // namespace ui_controller_android_utils } // namespace autofill_assistant
diff --git a/chrome/browser/android/autofill_assistant/ui_controller_android_utils.h b/chrome/browser/android/autofill_assistant/ui_controller_android_utils.h index 9b00c1a..2fe884a6 100644 --- a/chrome/browser/android/autofill_assistant/ui_controller_android_utils.h +++ b/chrome/browser/android/autofill_assistant/ui_controller_android_utils.h
@@ -10,6 +10,7 @@ #include "base/android/jni_android.h" #include "base/containers/flat_map.h" +#include "components/autofill/core/browser/data_model/autofill_profile.h" #include "components/autofill_assistant/browser/autofill_assistant_tts_controller.h" #include "components/autofill_assistant/browser/bottom_sheet_state.h" #include "components/autofill_assistant/browser/service.pb.h" @@ -156,6 +157,21 @@ std::unique_ptr<AutofillAssistantTtsController> GetTtsControllerToInject( JNIEnv* env); +// Creates an AssistantAutofillProfile in Java. This is comparable to +// PersonalDataManagerAndroid::CreateJavaProfileFromNative. +base::android::ScopedJavaLocalRef<jobject> CreateAssistantAutofillProfile( + JNIEnv* env, + const autofill::AutofillProfile& profile, + const std::string& locale); + +// Populate the AutofillProfile from the Java AssistantAutofillProfile. This is +// comparable to PersonalDataManagerAndroid::PopulateNativeProfileFromJava. +void PopulateAutofillProfileFromJava( + const base::android::JavaParamRef<jobject>& jprofile, + JNIEnv* env, + autofill::AutofillProfile* profile, + const std::string& locale); + } // namespace ui_controller_android_utils } // namespace autofill_assistant
diff --git a/chrome/browser/android/browserservices/verification/BUILD.gn b/chrome/browser/android/browserservices/verification/BUILD.gn index e6abf08..b32817f3 100644 --- a/chrome/browser/android/browserservices/verification/BUILD.gn +++ b/chrome/browser/android/browserservices/verification/BUILD.gn
@@ -46,7 +46,6 @@ ":java", "//base:base_java", "//base:base_java_test_support", - "//chrome/android:chrome_java", "//chrome/browser/flags:java", "//chrome/test/android:chrome_java_test_support", "//components/embedder_support/android:util_java",
diff --git a/chrome/browser/android/browserservices/verification/DEPS b/chrome/browser/android/browserservices/verification/DEPS index 7d9f8bff..eb217169 100644 --- a/chrome/browser/android/browserservices/verification/DEPS +++ b/chrome/browser/android/browserservices/verification/DEPS
@@ -13,7 +13,6 @@ specific_include_rules = { '.*Test\.java': [ "+base/test/android", - "+chrome/android/java/src/org/chromium/chrome/browser/browsing_data", "+chrome/test/android", "+content/public/test/android/javatests/src/org/chromium/content_public/browser/test", ]
diff --git a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierTest.java b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierTest.java index 7f648bb..9a590bb 100644 --- a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierTest.java +++ b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/OriginVerifierTest.java
@@ -18,12 +18,8 @@ import org.chromium.base.ContextUtils; import org.chromium.base.task.PostTask; import org.chromium.base.test.util.Batch; -import org.chromium.base.test.util.CallbackHelper; import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.browser.browserservices.verification.OriginVerifier.OriginVerificationListener; -import org.chromium.chrome.browser.browsing_data.BrowsingDataBridge; -import org.chromium.chrome.browser.browsing_data.BrowsingDataType; -import org.chromium.chrome.browser.browsing_data.TimePeriod; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; @@ -34,12 +30,9 @@ import org.chromium.content_public.browser.test.util.TestThreadUtils; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; -import java.util.Set; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; /** Tests for OriginVerifier. */ @RunWith(ChromeJUnit4ClassRunner.class) @@ -149,30 +142,6 @@ @Test @SmallTest - public void testWipedWithBrowsingData() throws TimeoutException { - CallbackHelper callbackHelper = new CallbackHelper(); - - String relationship = "relationship1"; - Set<String> savedLinks = new HashSet<>(); - savedLinks.add(relationship); - - VerificationResultStore mStore = VerificationResultStore.getInstance(); - - mStore.setRelationships(savedLinks); - - Assert.assertTrue(mStore.getRelationships().contains(relationship)); - - TestThreadUtils.runOnUiThreadBlocking(() -> { - BrowsingDataBridge.getInstance().clearBrowsingData(callbackHelper::notifyCalled, - new int[] {BrowsingDataType.HISTORY}, TimePeriod.ALL_TIME); - }); - - callbackHelper.waitForCallback(0); - Assert.assertTrue(mStore.getRelationships().isEmpty()); - } - - @Test - @SmallTest public void testVerificationBypass() throws InterruptedException { OriginVerifier verifier = mFactory.create( PACKAGE_NAME, CustomTabsService.RELATION_HANDLE_ALL_URLS, null, mExternalAuthUtils);
diff --git a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/VerificationResultStore.java b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/VerificationResultStore.java index 06d1d97..75e99cc 100644 --- a/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/VerificationResultStore.java +++ b/chrome/browser/android/browserservices/verification/java/src/org/chromium/chrome/browser/browserservices/verification/VerificationResultStore.java
@@ -80,7 +80,12 @@ } @VisibleForTesting - Set<String> getRelationships() { + public static VerificationResultStore getInstanceForTesting() { + return getInstance(); + } + + @VisibleForTesting + public Set<String> getRelationships() { // In case we're called on the UI thread and Preferences haven't been read before. try (StrictModeContext ignored = StrictModeContext.allowDiskReads()) { // From the official docs, modifying the result of a SharedPreferences.getStringSet can @@ -91,7 +96,7 @@ } @VisibleForTesting - void setRelationships(Set<String> relationships) { + public void setRelationships(Set<String> relationships) { SharedPreferencesManager.getInstance().writeStringSet( ChromePreferenceKeys.VERIFIED_DIGITAL_ASSET_LINKS, relationships); }
diff --git a/chrome/browser/apps/app_service/publishers/standalone_browser_apps.cc b/chrome/browser/apps/app_service/publishers/standalone_browser_apps.cc index 7cbb683..d705bbb 100644 --- a/chrome/browser/apps/app_service/publishers/standalone_browser_apps.cc +++ b/chrome/browser/apps/app_service/publishers/standalone_browser_apps.cc
@@ -198,7 +198,7 @@ // `browser_manager` may be null in tests. if (!browser_manager) return; - browser_manager->OpenUrl(GURL(chrome::kChromeUIContentSettingsURL)); + browser_manager->SwitchToTab(GURL(chrome::kChromeUIContentSettingsURL)); } void StandaloneBrowserApps::StopApp(const std::string& app_id) {
diff --git a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc index 8a222a3..38b30b58 100644 --- a/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc +++ b/chrome/browser/ash/arc/instance_throttle/arc_app_launch_throttle_observer_unittest.cc
@@ -19,10 +19,15 @@ ArcAppListPrefs::AppInfo CreateAppInfoForPackage( const std::string package_name) { - return ArcAppListPrefs::AppInfo(package_name, package_name, "", "", "", - base::Time(), base::Time(), true, true, - arc::mojom::ArcResizeLockState::UNDEFINED, - true, true, true, true, true, true); + return ArcAppListPrefs::AppInfo( + package_name, package_name, "" /* activity */, "" /* intent_uri */, + "" /* icon_resource_id */, base::Time() /* last_launch_time */, + base::Time() /* install_time */, true /* sticky */, + true /* notifications_enabled */, + arc::mojom::ArcResizeLockState::UNDEFINED, + true /* resize_lock_needs_confirmation */, + ArcAppListPrefs::WindowLayout(), true /* ready */, true /* suspended */, + true /* show_in_launcher */, true /* shortcut */, true /* launchable */); } class ArcAppLaunchThrottleObserverTest : public testing::Test {
diff --git a/chrome/browser/ash/arc/window_predictor/window_predictor.cc b/chrome/browser/ash/arc/window_predictor/window_predictor.cc index 6a4ca6dd..7489cfba 100644 --- a/chrome/browser/ash/arc/window_predictor/window_predictor.cc +++ b/chrome/browser/ash/arc/window_predictor/window_predictor.cc
@@ -28,7 +28,7 @@ } arc::mojom::WindowInfoPtr WindowPredictor::PredictAppWindowInfo( - const std::string& arc_app_id, + const ArcAppListPrefs::AppInfo& app_info, arc::mojom::WindowInfoPtr window_info) { // TODO(sstan): Generate window bounds based on display info and the // info saved in ArcAppListPrefs.
diff --git a/chrome/browser/ash/arc/window_predictor/window_predictor.h b/chrome/browser/ash/arc/window_predictor/window_predictor.h index 42f3c1a3..a9724bfd 100644 --- a/chrome/browser/ash/arc/window_predictor/window_predictor.h +++ b/chrome/browser/ash/arc/window_predictor/window_predictor.h
@@ -10,6 +10,7 @@ #include "ash/components/arc/mojom/app.mojom.h" #include "base/no_destructor.h" #include "chrome/browser/ash/arc/window_predictor/arc_predictor_app_launch_handler.h" +#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" class Profile; @@ -30,7 +31,7 @@ // Get predict app window info by app id and existed window info. arc::mojom::WindowInfoPtr PredictAppWindowInfo( - const std::string& arc_app_id, + const ArcAppListPrefs::AppInfo& app_info, arc::mojom::WindowInfoPtr window_info); ArcPredictorAppLaunchHandler* app_launch_handler() {
diff --git a/chrome/browser/ash/arc/window_predictor/window_predictor_utils.cc b/chrome/browser/ash/arc/window_predictor/window_predictor_utils.cc index b705d22..a07ee9d 100644 --- a/chrome/browser/ash/arc/window_predictor/window_predictor_utils.cc +++ b/chrome/browser/ash/arc/window_predictor/window_predictor_utils.cc
@@ -12,6 +12,7 @@ bool LaunchArcAppWithGhostWindow(Profile* profile, const std::string& arc_app_id, + const ArcAppListPrefs::AppInfo& app_info, int event_flags, arc::UserInteractionType user_interaction_type, arc::mojom::WindowInfoPtr window_info) { @@ -29,7 +30,7 @@ arc::mojom::WindowInfoPtr predict_window_info = WindowPredictor::GetInstance()->PredictAppWindowInfo( - arc_app_id, std::move(window_info)); + app_info, std::move(window_info)); auto* app_launch_handler = WindowPredictor::GetInstance()->app_launch_handler(); DCHECK(app_launch_handler);
diff --git a/chrome/browser/ash/arc/window_predictor/window_predictor_utils.h b/chrome/browser/ash/arc/window_predictor/window_predictor_utils.h index 485023da..cc2aa9b 100644 --- a/chrome/browser/ash/arc/window_predictor/window_predictor_utils.h +++ b/chrome/browser/ash/arc/window_predictor/window_predictor_utils.h
@@ -7,6 +7,7 @@ #include "ash/components/arc/metrics/arc_metrics_constants.h" #include "ash/components/arc/mojom/app.mojom.h" +#include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" class Profile; @@ -15,7 +16,8 @@ // Create ARC app ghost window and add the corresponding to the launching list, // it will be launched after ARC ready. bool LaunchArcAppWithGhostWindow(Profile* profile, - const std::string& arc_app_id, + const std::string& app_id, + const ArcAppListPrefs::AppInfo& app_info, int event_flags, arc::UserInteractionType user_interaction_type, arc::mojom::WindowInfoPtr window_info);
diff --git a/chrome/browser/ash/crosapi/browser_manager.cc b/chrome/browser/ash/crosapi/browser_manager.cc index 533fcb0..f979cd0 100644 --- a/chrome/browser/ash/crosapi/browser_manager.cc +++ b/chrome/browser/ash/crosapi/browser_manager.cc
@@ -492,21 +492,14 @@ } void BrowserManager::OpenUrl(const GURL& url) { - auto result = MaybeStart(browser_util::InitialBrowserAction( - mojom::InitialBrowserAction::kOpenWindowWithUrls, {url})); - if (result != MaybeStartResult::kRunning) - return; + OpenUrlImpl( + url, + crosapi::mojom::OpenUrlParams::WindowOpenDisposition::kNewForegroundTab); +} - if (!browser_service_.has_value()) { - LOG(ERROR) << "BrowserService was disconnected"; - return; - } - if (browser_service_->interface_version < - mojom::BrowserService::kOpenUrlMinVersion) { - LOG(ERROR) << "BrowserService does not support OpenUrl"; - return; - } - browser_service_->service->OpenUrl(url, base::DoNothing()); +void BrowserManager::SwitchToTab(const GURL& url) { + OpenUrlImpl( + url, crosapi::mojom::OpenUrlParams::WindowOpenDisposition::kSwitchToTab); } void BrowserManager::RestoreTab() { @@ -1272,4 +1265,28 @@ lacros_mode_and_source); } +void BrowserManager::OpenUrlImpl( + const GURL& url, + crosapi::mojom::OpenUrlParams::WindowOpenDisposition disposition) { + auto result = MaybeStart(browser_util::InitialBrowserAction( + mojom::InitialBrowserAction::kOpenWindowWithUrls, {url})); + if (result != MaybeStartResult::kRunning) + return; + + if (!browser_service_.has_value()) { + LOG(ERROR) << "BrowserService was disconnected"; + return; + } + if (browser_service_->interface_version < + mojom::BrowserService::kOpenUrlMinVersion) { + LOG(ERROR) << "BrowserService does not support OpenUrl"; + return; + } + + using OpenUrlParams = crosapi::mojom::OpenUrlParams; + auto params = OpenUrlParams::New(); + params->disposition = disposition; + browser_service_->service->OpenUrl(url, std::move(params), base::DoNothing()); +} + } // namespace crosapi
diff --git a/chrome/browser/ash/crosapi/browser_manager.h b/chrome/browser/ash/crosapi/browser_manager.h index 0a138ed..752d9e5 100644 --- a/chrome/browser/ash/crosapi/browser_manager.h +++ b/chrome/browser/ash/crosapi/browser_manager.h
@@ -142,6 +142,11 @@ // See crosapi::mojom::BrowserService::OpenUrl for more details. void OpenUrl(const GURL& url); + // If there's already a tab opening the URL in lacros-chrome, in some window + // of the primary profile, activate the tab. Otherwise, opens a tab for + // the given URL. + void SwitchToTab(const GURL& url); + // Similar to NewWindow(), but restores a tab recently closed. // See crosapi::mojom::BrowserService::RestoreTab for more details void RestoreTab(); @@ -400,6 +405,11 @@ // (i.e., if there's no browser window opened, it may be shut down). void UpdateKeepAliveInBrowserIfNecessary(bool enabled); + // Shared implementation of OpenUrl and SwitchToTab. + void OpenUrlImpl( + const GURL& url, + crosapi::mojom::OpenUrlParams::WindowOpenDisposition disposition); + State state_ = State::NOT_INITIALIZED; std::unique_ptr<crosapi::BrowserLoader> browser_loader_;
diff --git a/chrome/browser/ash/crosapi/test_mojo_connection_manager_unittest.cc b/chrome/browser/ash/crosapi/test_mojo_connection_manager_unittest.cc index 4ed25111..3c0711d 100644 --- a/chrome/browser/ash/crosapi/test_mojo_connection_manager_unittest.cc +++ b/chrome/browser/ash/crosapi/test_mojo_connection_manager_unittest.cc
@@ -77,7 +77,9 @@ void NewFullscreenWindow(const GURL& url, NewFullscreenWindowCallback callback) override {} void NewTab(NewTabCallback callback) override {} - void OpenUrl(const GURL& url, OpenUrlCallback callback) override {} + void OpenUrl(const GURL& url, + crosapi::mojom::OpenUrlParamsPtr params, + OpenUrlCallback callback) override {} void RestoreTab(RestoreTabCallback callback) override {} void HandleTabScrubbing(float x_offset) override {} void GetFeedbackData(GetFeedbackDataCallback callback) override {}
diff --git a/chrome/browser/ash/eche_app/eche_app_manager_factory.cc b/chrome/browser/ash/eche_app/eche_app_manager_factory.cc index 2603e06..260bd54b 100644 --- a/chrome/browser/ash/eche_app/eche_app_manager_factory.cc +++ b/chrome/browser/ash/eche_app/eche_app_manager_factory.cc
@@ -8,6 +8,8 @@ #include "ash/components/phonehub/phone_hub_manager.h" #include "ash/constants/ash_features.h" +#include "ash/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h" +#include "ash/services/secure_channel/public/cpp/shared/presence_monitor.h" #include "ash/webui/eche_app_ui/apps_access_manager_impl.h" #include "ash/webui/eche_app_ui/eche_app_manager.h" #include "ash/webui/eche_app_ui/eche_uid_provider.h" @@ -31,8 +33,6 @@ #include "chrome/browser/ui/web_applications/system_web_app_ui_utils.h" #include "chrome/browser/web_applications/system_web_apps/system_web_app_delegate.h" #include "chromeos/services/secure_channel/presence_monitor_impl.h" -#include "chromeos/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h" -#include "chromeos/services/secure_channel/public/cpp/shared/presence_monitor.h" #include "chromeos/strings/grit/chromeos_strings.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/pref_registry/pref_registry_syncable.h"
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest.cc b/chrome/browser/ash/file_manager/file_manager_browsertest.cc index b5ab6ad..491ed48 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest.cc
@@ -126,16 +126,6 @@ return *this; } - TestCase& EnableBannersFramework() { - options.enable_banners_framework = true; - return *this; - } - - TestCase& DisableBannersFramework() { - options.enable_banners_framework = false; - return *this; - } - std::string GetFullName() const { std::string full_name = name; @@ -169,9 +159,6 @@ if (options.enable_trash) full_name += "_Trash"; - if (options.enable_banners_framework) - full_name += "_BannersFramework"; - return full_name; } @@ -952,16 +939,9 @@ TestCase("driveLinkToDirectory"), TestCase("driveLinkOpenFileThroughLinkedDirectory").MediaSwa(), TestCase("driveLinkOpenFileThroughTransitiveLink").MediaSwa(), - TestCase("driveWelcomeBanner").EnableBannersFramework(), - TestCase("driveWelcomeBanner").DisableBannersFramework(), - TestCase("driveOfflineInfoBanner") - .EnableDriveDssPin() - .EnableBannersFramework(), - TestCase("driveOfflineInfoBanner") - .EnableDriveDssPin() - .DisableBannersFramework(), - TestCase("driveOfflineInfoBannerWithoutFlag").EnableBannersFramework(), - TestCase("driveOfflineInfoBannerWithoutFlag").DisableBannersFramework(), + TestCase("driveWelcomeBanner"), + TestCase("driveOfflineInfoBanner").EnableDriveDssPin(), + TestCase("driveOfflineInfoBannerWithoutFlag"), TestCase("driveEnableDocsOfflineDialog"), TestCase("driveEnableDocsOfflineDialogWithoutWindow"), TestCase("driveEnableDocsOfflineDialogMultipleWindows"), @@ -971,45 +951,15 @@ HoldingSpace, /* holding_space.js */ FilesAppBrowserTest, ::testing::Values( - TestCase("holdingSpaceWelcomeBanner").EnableBannersFramework(), - TestCase("holdingSpaceWelcomeBanner").DisableBannersFramework(), - TestCase("holdingSpaceWelcomeBanner") - .EnableBannersFramework() - .FilesSwa(), - TestCase("holdingSpaceWelcomeBanner") - .DisableBannersFramework() - .FilesSwa(), - TestCase("holdingSpaceWelcomeBannerWontShowAfterBeingDismissed") - .DisableBannersFramework(), - TestCase("holdingSpaceWelcomeBannerWontShowForModalDialogs") - .WithBrowser() - .DisableBannersFramework(), + TestCase("holdingSpaceWelcomeBanner"), + TestCase("holdingSpaceWelcomeBanner").FilesSwa(), + TestCase("holdingSpaceWelcomeBannerWillShowForModalDialogs") + .WithBrowser(), TestCase("holdingSpaceWelcomeBannerWillShowForModalDialogs") .WithBrowser() - .EnableBannersFramework(), - TestCase("holdingSpaceWelcomeBannerWillShowForModalDialogs") - .WithBrowser() - .EnableBannersFramework() .FilesSwa(), - TestCase("holdingSpaceWelcomeBannerWontShowForModalDialogs") - .WithBrowser() - .DisableBannersFramework() - .FilesSwa(), - TestCase("holdingSpaceWelcomeBannerWontShowOnDrive") - .DisableBannersFramework(), - TestCase("holdingSpaceWelcomeBannerWontShowOnDrive") - .DisableBannersFramework() - .FilesSwa(), - TestCase("holdingSpaceWelcomeBannerOnTabletModeChanged") - .EnableBannersFramework(), - TestCase("holdingSpaceWelcomeBannerOnTabletModeChanged") - .DisableBannersFramework(), - TestCase("holdingSpaceWelcomeBannerOnTabletModeChanged") - .EnableBannersFramework() - .FilesSwa(), - TestCase("holdingSpaceWelcomeBannerOnTabletModeChanged") - .DisableBannersFramework() - .FilesSwa())); + TestCase("holdingSpaceWelcomeBannerOnTabletModeChanged"), + TestCase("holdingSpaceWelcomeBannerOnTabletModeChanged").FilesSwa())); WRAPPED_INSTANTIATE_TEST_SUITE_P( Transfer, /* transfer.js */ @@ -1175,29 +1125,12 @@ FilesAppBrowserTest, ::testing::Values( TestCase("tabindexSearchBoxFocus"), - TestCase("tabindexFocus").DisableBannersFramework(), - TestCase("tabindexFocus").EnableBannersFramework(), - TestCase("tabindexFocusDownloads").DisableBannersFramework(), - TestCase("tabindexFocusDownloads").EnableBannersFramework(), - TestCase("tabindexFocusDownloads") - .DisableBannersFramework() - .InGuestMode(), - TestCase("tabindexFocusDirectorySelected").DisableBannersFramework(), - TestCase("tabindexFocusDirectorySelected").EnableBannersFramework(), - TestCase("tabindexOpenDialogDownloads") - .WithBrowser() - .DisableBannersFramework(), - TestCase("tabindexOpenDialogDownloads") - .WithBrowser() - .EnableBannersFramework(), - TestCase("tabindexOpenDialogDownloads") - .WithBrowser() - .DisableBannersFramework() - .InGuestMode(), - TestCase("tabindexOpenDialogDownloads") - .WithBrowser() - .EnableBannersFramework() - .InGuestMode() + TestCase("tabindexFocus"), + TestCase("tabindexFocusDownloads"), + TestCase("tabindexFocusDownloads").InGuestMode(), + TestCase("tabindexFocusDirectorySelected"), + TestCase("tabindexOpenDialogDownloads").WithBrowser(), + TestCase("tabindexOpenDialogDownloads").WithBrowser().InGuestMode() // TODO(crbug.com/1236842): Remove flakiness and enable this test. // , // TestCase("tabindexSaveFileDialogDrive").WithBrowser(), @@ -1346,8 +1279,7 @@ FilesAppBrowserTest, ::testing::Values(TestCase("showGridViewDownloads").InGuestMode(), TestCase("showGridViewDownloads"), - TestCase("showGridViewDrive").EnableBannersFramework(), - TestCase("showGridViewDrive").DisableBannersFramework(), + TestCase("showGridViewDrive"), TestCase("showGridViewButtonSwitches"), TestCase("showGridViewButtonSwitches").FilesSwa(), TestCase("showGridViewKeyboardSelectionA11y"), @@ -1433,14 +1365,12 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( Crostini, /* crostini.js */ FilesAppBrowserTest, - ::testing::Values( - TestCase("mountCrostini"), - TestCase("enableDisableCrostini"), - TestCase("sharePathWithCrostini").EnableBannersFramework(), - TestCase("sharePathWithCrostini").DisableBannersFramework(), - TestCase("pluginVmDirectoryNotSharedErrorDialog"), - TestCase("pluginVmFileOnExternalDriveErrorDialog"), - TestCase("pluginVmFileDropFailErrorDialog"))); + ::testing::Values(TestCase("mountCrostini"), + TestCase("enableDisableCrostini"), + TestCase("sharePathWithCrostini"), + TestCase("pluginVmDirectoryNotSharedErrorDialog"), + TestCase("pluginVmFileOnExternalDriveErrorDialog"), + TestCase("pluginVmFileDropFailErrorDialog"))); WRAPPED_INSTANTIATE_TEST_SUITE_P( MyFiles, /* my_files.js */ @@ -1569,12 +1499,6 @@ AndroidPhotos, /* android_photos.js */ FilesAppBrowserTest, ::testing::Values( - // TODO(crbug.com/1228128): Remove disabled test when framework is live. - TestCase("androidPhotosBanner") - .EnablePhotosDocumentsProvider() - .EnableBannersFramework(), - TestCase("androidPhotosBanner") - .EnablePhotosDocumentsProvider() - .DisableBannersFramework())); + TestCase("androidPhotosBanner").EnablePhotosDocumentsProvider())); } // namespace file_manager
diff --git a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc index c550908..5eae4564 100644 --- a/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc +++ b/chrome/browser/ash/file_manager/file_manager_browsertest_base.cc
@@ -1777,12 +1777,6 @@ disabled_features.push_back(chromeos::features::kFilesTrash); } - if (options.enable_banners_framework) { - enabled_features.push_back(chromeos::features::kFilesBannerFramework); - } else { - disabled_features.push_back(chromeos::features::kFilesBannerFramework); - } - if (command_line->HasSwitch(switches::kDevtoolsCodeCoverage) && options.guest_mode != IN_INCOGNITO) { devtools_code_coverage_dir_ =
diff --git a/chrome/browser/ash/file_manager/file_manager_jstest.cc b/chrome/browser/ash/file_manager/file_manager_jstest.cc index 5cfa436..04c9860 100644 --- a/chrome/browser/ash/file_manager/file_manager_jstest.cc +++ b/chrome/browser/ash/file_manager/file_manager_jstest.cc
@@ -122,10 +122,6 @@ RunTestURL("foreground/elements/files_xf_elements_unittest.m_gen.html"); } -IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesMessage) { - RunTestURL("foreground/elements/files_message_unittest.m_gen.html"); -} - IN_PROC_BROWSER_TEST_F(FileManagerJsTest, FilesPasswordDialog) { RunTestURL("foreground/elements/files_password_dialog_unittest.m_gen.html"); }
diff --git a/chrome/browser/ash/file_manager/file_manager_string_util.cc b/chrome/browser/ash/file_manager/file_manager_string_util.cc index 6ce5e46..9097798 100644 --- a/chrome/browser/ash/file_manager/file_manager_string_util.cc +++ b/chrome/browser/ash/file_manager/file_manager_string_util.cc
@@ -991,10 +991,6 @@ base::FeatureList::IsEnabled( chromeos::features::kFilesSinglePartitionFormat)); dict->SetBoolKey( - "FILES_BANNER_FRAMEWORK", - base::FeatureList::IsEnabled(chromeos::features::kFilesBannerFramework)); - - dict->SetBoolKey( "EXTRACT_ARCHIVE", base::FeatureList::IsEnabled(chromeos::features::kFilesExtractArchive));
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h index ec328052f..298b46db 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service.h
@@ -21,7 +21,7 @@ #include "chrome/browser/ash/login/easy_unlock/smartlock_state_handler.h" #include "chromeos/components/multidevice/remote_device_ref.h" // TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "components/keyed_service/core/keyed_service.h" class AccountId;
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.h index 90b0cb2..b79f83b 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular.h
@@ -18,7 +18,7 @@ #include "chromeos/services/device_sync/public/cpp/device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client.h" // TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "components/prefs/pref_change_registrar.h" namespace base {
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc index bc6ae43c..6642930 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_regular_unittest.cc
@@ -14,6 +14,7 @@ #include "ash/components/proximity_auth/fake_lock_handler.h" #include "ash/components/proximity_auth/screenlock_bridge.h" #include "ash/constants/ash_features.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/run_loop.h" @@ -39,7 +40,6 @@ #include "chromeos/services/device_sync/proto/cryptauth_api.pb.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "components/account_id/account_id.h" #include "components/signin/public/identity_manager/account_info.h" #include "components/sync_preferences/testing_pref_service_syncable.h"
diff --git a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin.h b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin.h index 2c47d78..4bf89e2 100644 --- a/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin.h +++ b/chrome/browser/ash/login/easy_unlock/easy_unlock_service_signin.h
@@ -10,6 +10,8 @@ #include <string> #include "ash/components/proximity_auth/screenlock_bridge.h" +// TODO(https://crbug.com/1164001): move to forward declaration +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "base/values.h" @@ -17,8 +19,6 @@ #include "chrome/browser/ash/login/easy_unlock/easy_unlock_types.h" // TODO(https://crbug.com/1164001): move to forward declaration #include "chromeos/components/multidevice/remote_device_cache.h" -// TODO(https://crbug.com/1164001): move to forward declaration -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" namespace proximity_auth { class ProximityAuthLocalStatePrefManager;
diff --git a/chrome/browser/ash/phonehub/camera_roll_download_manager_impl.cc b/chrome/browser/ash/phonehub/camera_roll_download_manager_impl.cc index ed7545f..955cd424 100644 --- a/chrome/browser/ash/phonehub/camera_roll_download_manager_impl.cc +++ b/chrome/browser/ash/phonehub/camera_roll_download_manager_impl.cc
@@ -9,6 +9,7 @@ #include "ash/components/phonehub/camera_roll_download_manager.h" #include "ash/components/phonehub/proto/phonehub_api.pb.h" #include "ash/public/cpp/holding_space/holding_space_progress.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/check.h" #include "base/containers/flat_map.h" @@ -29,7 +30,6 @@ #include "base/time/time.h" #include "chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace ash {
diff --git a/chrome/browser/ash/phonehub/camera_roll_download_manager_impl.h b/chrome/browser/ash/phonehub/camera_roll_download_manager_impl.h index 519a871..20d1dcc 100644 --- a/chrome/browser/ash/phonehub/camera_roll_download_manager_impl.h +++ b/chrome/browser/ash/phonehub/camera_roll_download_manager_impl.h
@@ -9,6 +9,7 @@ #include "ash/components/phonehub/camera_roll_download_manager.h" #include "ash/components/phonehub/proto/phonehub_api.pb.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/containers/flat_map.h" #include "base/files/file_path.h" #include "base/files/safe_base_name.h" @@ -17,7 +18,6 @@ #include "base/task/sequenced_task_runner.h" #include "base/time/time.h" #include "chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace ash { namespace phonehub {
diff --git a/chrome/browser/ash/phonehub/camera_roll_download_manager_impl_unittest.cc b/chrome/browser/ash/phonehub/camera_roll_download_manager_impl_unittest.cc index b32f78c..405b38f 100644 --- a/chrome/browser/ash/phonehub/camera_roll_download_manager_impl_unittest.cc +++ b/chrome/browser/ash/phonehub/camera_roll_download_manager_impl_unittest.cc
@@ -12,6 +12,7 @@ #include "ash/public/cpp/holding_space/holding_space_item.h" #include "ash/public/cpp/holding_space/holding_space_model.h" #include "ash/public/cpp/holding_space/holding_space_progress.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/files/file.h" #include "base/files/file_path.h" #include "base/files/file_path_watcher.h" @@ -30,7 +31,6 @@ #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "components/account_id/account_id.h" #include "components/user_manager/scoped_user_manager.h" #include "content/public/test/browser_task_environment.h"
diff --git a/chrome/browser/ash/secure_channel/nearby_connection_broker.h b/chrome/browser/ash/secure_channel/nearby_connection_broker.h index b360e70..92606d7 100644 --- a/chrome/browser/ash/secure_channel/nearby_connection_broker.h +++ b/chrome/browser/ash/secure_channel/nearby_connection_broker.h
@@ -8,8 +8,8 @@ #include <string> #include <vector> +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "base/callback.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h"
diff --git a/chrome/browser/ash/secure_channel/nearby_connection_broker_impl.cc b/chrome/browser/ash/secure_channel/nearby_connection_broker_impl.cc index 0d997128..04a450c 100644 --- a/chrome/browser/ash/secure_channel/nearby_connection_broker_impl.cc +++ b/chrome/browser/ash/secure_channel/nearby_connection_broker_impl.cc
@@ -8,6 +8,7 @@ #include <utility> #include "ash/constants/ash_features.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/containers/flat_map.h" #include "base/files/file.h" @@ -23,7 +24,6 @@ #include "chrome/browser/ash/secure_channel/nearby_endpoint_finder.h" #include "chrome/browser/ash/secure_channel/util/histogram_util.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/remote.h" namespace ash {
diff --git a/chrome/browser/ash/secure_channel/nearby_connection_broker_impl.h b/chrome/browser/ash/secure_channel/nearby_connection_broker_impl.h index effc4d5..6b4ca57 100644 --- a/chrome/browser/ash/secure_channel/nearby_connection_broker_impl.h +++ b/chrome/browser/ash/secure_channel/nearby_connection_broker_impl.h
@@ -9,6 +9,7 @@ #include <ostream> #include "ash/services/nearby/public/mojom/nearby_connections.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/containers/flat_map.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_refptr.h" @@ -18,7 +19,6 @@ #include "base/timer/timer.h" #include "chrome/browser/ash/secure_channel/nearby_connection_broker.h" #include "chrome/browser/ash/secure_channel/util/histogram_util.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/shared_remote.h" namespace ash {
diff --git a/chrome/browser/ash/secure_channel/nearby_connection_broker_impl_unittest.cc b/chrome/browser/ash/secure_channel/nearby_connection_broker_impl_unittest.cc index f9d9f91..518e75e4 100644 --- a/chrome/browser/ash/secure_channel/nearby_connection_broker_impl_unittest.cc +++ b/chrome/browser/ash/secure_channel/nearby_connection_broker_impl_unittest.cc
@@ -9,6 +9,8 @@ #include "ash/constants/ash_features.h" #include "ash/services/nearby/public/cpp/mock_nearby_connections.h" +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/containers/span.h" #include "base/files/file_util.h" #include "base/run_loop.h" @@ -19,8 +21,6 @@ #include "base/timer/mock_timer.h" #include "chrome/browser/ash/secure_channel/fake_nearby_endpoint_finder.h" #include "chrome/browser/ash/secure_channel/util/histogram_util.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/shared_remote.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/ash/secure_channel/nearby_connector_factory.cc b/chrome/browser/ash/secure_channel/nearby_connector_factory.cc index b38a92e..f2d8dfc 100644 --- a/chrome/browser/ash/secure_channel/nearby_connector_factory.cc +++ b/chrome/browser/ash/secure_channel/nearby_connector_factory.cc
@@ -4,11 +4,11 @@ #include "chrome/browser/ash/secure_channel/nearby_connector_factory.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "chrome/browser/ash/nearby/nearby_process_manager_factory.h" #include "chrome/browser/ash/secure_channel/nearby_connector_impl.h" #include "chrome/browser/ash/secure_channel/secure_channel_client_provider.h" #include "chrome/browser/profiles/profile.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" namespace ash {
diff --git a/chrome/browser/ash/secure_channel/nearby_connector_factory.h b/chrome/browser/ash/secure_channel/nearby_connector_factory.h index 1c66dd0..0d52f1d 100644 --- a/chrome/browser/ash/secure_channel/nearby_connector_factory.h +++ b/chrome/browser/ash/secure_channel/nearby_connector_factory.h
@@ -5,9 +5,9 @@ #ifndef CHROME_BROWSER_ASH_SECURE_CHANNEL_NEARBY_CONNECTOR_FACTORY_H_ #define CHROME_BROWSER_ASH_SECURE_CHANNEL_NEARBY_CONNECTOR_FACTORY_H_ -#include "base/memory/singleton.h" // TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/nearby_connector.h" +#include "ash/services/secure_channel/public/cpp/client/nearby_connector.h" +#include "base/memory/singleton.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" class Profile;
diff --git a/chrome/browser/ash/secure_channel/nearby_connector_impl.cc b/chrome/browser/ash/secure_channel/nearby_connector_impl.cc index 40cbabb..2339af4 100644 --- a/chrome/browser/ash/secure_channel/nearby_connector_impl.cc +++ b/chrome/browser/ash/secure_channel/nearby_connector_impl.cc
@@ -5,12 +5,12 @@ #include "chrome/browser/ash/secure_channel/nearby_connector_impl.h" #include "ash/services/nearby/public/cpp/nearby_process_manager.h" +#include "ash/services/secure_channel/public/cpp/client/nearby_connector.h" #include "base/bind.h" #include "chrome/browser/ash/secure_channel/nearby_connection_broker_impl.h" #include "chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl.h" #include "chrome/browser/ash/secure_channel/util/histogram_util.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/cpp/client/nearby_connector.h" #include "components/keyed_service/core/keyed_service.h" namespace ash {
diff --git a/chrome/browser/ash/secure_channel/nearby_connector_impl.h b/chrome/browser/ash/secure_channel/nearby_connector_impl.h index ce54ad3..e36890a 100644 --- a/chrome/browser/ash/secure_channel/nearby_connector_impl.h +++ b/chrome/browser/ash/secure_channel/nearby_connector_impl.h
@@ -9,11 +9,11 @@ #include <vector> #include "ash/services/nearby/public/cpp/nearby_process_manager.h" +#include "ash/services/secure_channel/public/cpp/client/nearby_connector.h" #include "base/containers/flat_map.h" #include "base/containers/queue.h" #include "base/memory/weak_ptr.h" #include "base/unguessable_token.h" -#include "chromeos/services/secure_channel/public/cpp/client/nearby_connector.h" #include "components/keyed_service/core/keyed_service.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chrome/browser/ash/secure_channel/nearby_connector_impl_unittest.cc b/chrome/browser/ash/secure_channel/nearby_connector_impl_unittest.cc index 20cb22c..a0639121 100644 --- a/chrome/browser/ash/secure_channel/nearby_connector_impl_unittest.cc +++ b/chrome/browser/ash/secure_channel/nearby_connector_impl_unittest.cc
@@ -8,6 +8,7 @@ #include <vector> #include "ash/services/nearby/public/cpp/fake_nearby_process_manager.h" +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "base/containers/flat_map.h" #include "base/run_loop.h" #include "base/test/bind.h" @@ -16,7 +17,6 @@ #include "chrome/browser/ash/secure_channel/fake_nearby_endpoint_finder.h" #include "chrome/browser/ash/secure_channel/nearby_connection_broker_impl.h" #include "chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "mojo/public/cpp/bindings/remote.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl.cc b/chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl.cc index 51e5329..5288e9d 100644 --- a/chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl.cc +++ b/chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl.cc
@@ -4,12 +4,12 @@ #include "chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl.h" +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "base/base64.h" #include "base/memory/ptr_util.h" #include "base/rand_util.h" #include "chrome/browser/ash/secure_channel/util/histogram_util.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" namespace ash { namespace secure_channel {
diff --git a/chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl_unittest.cc b/chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl_unittest.cc index aa716837..5cd2e7c 100644 --- a/chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl_unittest.cc +++ b/chrome/browser/ash/secure_channel/nearby_endpoint_finder_impl_unittest.cc
@@ -8,9 +8,9 @@ #include <vector> #include "ash/services/nearby/public/cpp/mock_nearby_connections.h" +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "base/run_loop.h" #include "base/test/task_environment.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/shared_remote.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc b/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc index ae4a282..c62bc451 100644 --- a/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc +++ b/chrome/browser/ash/secure_channel/secure_channel_client_provider.cc
@@ -4,8 +4,8 @@ #include "chrome/browser/ash/secure_channel/secure_channel_client_provider.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" #include "base/no_destructor.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" #include "chromeos/services/secure_channel/secure_channel_base.h" #include "chromeos/services/secure_channel/secure_channel_initializer.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chrome/browser/ash/secure_channel/secure_channel_client_provider.h b/chrome/browser/ash/secure_channel/secure_channel_client_provider.h index 8b865d1c..b62b3f6 100644 --- a/chrome/browser/ash/secure_channel/secure_channel_client_provider.h +++ b/chrome/browser/ash/secure_channel/secure_channel_client_provider.h
@@ -7,9 +7,9 @@ #include <memory> -#include "base/no_destructor.h" // TODO(https://crbug.com/1164001): move to forward declaration. -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" +#include "base/no_destructor.h" namespace ash { namespace secure_channel {
diff --git a/chrome/browser/ash/tether/tether_service.cc b/chrome/browser/ash/tether/tether_service.cc index 91ab429..cfd38a1 100644 --- a/chrome/browser/ash/tether/tether_service.cc +++ b/chrome/browser/ash/tether/tether_service.cc
@@ -8,6 +8,7 @@ #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 "ash/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "base/bind.h" #include "base/command_line.h" #include "base/metrics/histogram_macros.h" @@ -22,7 +23,6 @@ #include "chromeos/network/network_connect.h" #include "chromeos/network/network_type_pattern.h" #include "chromeos/services/multidevice_setup/public/cpp/prefs.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client.h" #include "components/pref_registry/pref_registry_syncable.h" #include "components/prefs/pref_service.h" #include "device/bluetooth/bluetooth_adapter_factory.h"
diff --git a/chrome/browser/ash/tether/tether_service_unittest.cc b/chrome/browser/ash/tether/tether_service_unittest.cc index d6f704a1..c609386 100644 --- a/chrome/browser/ash/tether/tether_service_unittest.cc +++ b/chrome/browser/ash/tether/tether_service_unittest.cc
@@ -12,6 +12,8 @@ #include "ash/components/tether/tether_component_impl.h" #include "ash/components/tether/tether_host_fetcher_impl.h" #include "ash/constants/ash_features.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" +#include "ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" #include "base/bind.h" #include "base/command_line.h" #include "base/memory/ptr_util.h" @@ -50,8 +52,6 @@ #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" #include "chromeos/services/multidevice_setup/public/cpp/multidevice_setup_client_impl.h" #include "chromeos/services/multidevice_setup/public/cpp/prefs.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/secure_channel_client_impl.h" #include "components/prefs/testing_pref_service.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "components/user_manager/scoped_user_manager.h"
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index f298644c..dc758b8 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc
@@ -1251,6 +1251,18 @@ ChromeRLZTrackerDelegate::IsGoogleInStartpages(profile)); } #endif // BUILDFLAG(ENABLE_RLZ) && !BUILDFLAG(IS_CHROMEOS_ASH) + + language::LanguageUsageMetrics::RecordAcceptLanguages( + profile->GetPrefs()->GetString(language::prefs::kAcceptLanguages)); + language::LanguageUsageMetrics::RecordApplicationLanguage( + browser_process_->GetApplicationLocale()); + translate::TranslateMetricsLoggerImpl::LogApplicationStartMetrics( + ChromeTranslateClient::CreateTranslatePrefs(profile->GetPrefs())); +// On ChromeOS results in a crash. https://crbug.com/1151558 +#if !BUILDFLAG(IS_CHROMEOS_ASH) + language::LanguageUsageMetrics::RecordPageLanguages( + *UrlLanguageHistogramFactory::GetForBrowserContext(profile)); +#endif // BUILDFLAG(IS_CHROMEOS_ASH) } void ChromeBrowserMainParts::PreBrowserStart() { @@ -1679,18 +1691,6 @@ HandleTestParameters(parsed_command_line()); - language::LanguageUsageMetrics::RecordAcceptLanguages( - profile->GetPrefs()->GetString(language::prefs::kAcceptLanguages)); - language::LanguageUsageMetrics::RecordApplicationLanguage( - browser_process_->GetApplicationLocale()); - translate::TranslateMetricsLoggerImpl::LogApplicationStartMetrics( - ChromeTranslateClient::CreateTranslatePrefs(profile->GetPrefs())); -// On ChromeOS results in a crash. https://crbug.com/1151558 -#if !BUILDFLAG(IS_CHROMEOS_ASH) - language::LanguageUsageMetrics::RecordPageLanguages( - *UrlLanguageHistogramFactory::GetForBrowserContext(profile)); -#endif // BUILDFLAG(IS_CHROMEOS_ASH) - // On mobile, the need for a clean shutdown arises only when the application // comes to the foreground (i.e. when MetricsService::OnAppEnterForeground() is // called). See crbug.com/179143 for more details.
diff --git a/chrome/browser/chromeos/policy/dlp/clipboard_bubble.cc b/chrome/browser/chromeos/policy/dlp/clipboard_bubble.cc index 9743fe1..ead6b7fd 100644 --- a/chrome/browser/chromeos/policy/dlp/clipboard_bubble.cc +++ b/chrome/browser/chromeos/policy/dlp/clipboard_bubble.cc
@@ -120,8 +120,15 @@ ash::NewWindowDelegate::GetInstance()->OpenUrl( GURL(kDlpLearnMoreUrl), /*from_user_interaction=*/true); #elif BUILDFLAG(IS_CHROMEOS_LACROS) + // TODO(hidehiko): Instantiating BrowserServiceLacros here is an unexpected + // use case. Get rid of this by replacing with Navigate() API invocation + // directly. auto browser_service = std::make_unique<BrowserServiceLacros>(); - browser_service->OpenUrl(GURL(kDlpLearnMoreUrl), base::DoNothing()); + using OpenUrlParams = crosapi::mojom::OpenUrlParams; + auto params = OpenUrlParams::New(); + params->disposition = OpenUrlParams::WindowOpenDisposition::kNewForegroundTab; + browser_service->OpenUrl(GURL(kDlpLearnMoreUrl), std::move(params), + base::DoNothing()); #endif // BUILDFLAG(IS_CHROMEOS_ASH) }
diff --git a/chrome/browser/chromeos/policy/dlp/dlp_notification_helper.cc b/chrome/browser/chromeos/policy/dlp/dlp_notification_helper.cc index d6d0db7..7d6ced9 100644 --- a/chrome/browser/chromeos/policy/dlp/dlp_notification_helper.cc +++ b/chrome/browser/chromeos/policy/dlp/dlp_notification_helper.cc
@@ -46,8 +46,15 @@ ash::NewWindowDelegate::GetInstance()->OpenUrl( GURL(kDlpLearnMoreUrl), /*from_user_interaction=*/true); #elif BUILDFLAG(IS_CHROMEOS_LACROS) + // TODO(hidehiko): Instantiating BrowserServiceLacros here is an unexpected + // use case. Get rid of this by replacing with Navigate() API invocation + // directly. auto browser_service = std::make_unique<BrowserServiceLacros>(); - browser_service->OpenUrl(GURL(kDlpLearnMoreUrl), base::DoNothing()); + using OpenUrlParams = crosapi::mojom::OpenUrlParams; + auto params = OpenUrlParams::New(); + params->disposition = OpenUrlParams::WindowOpenDisposition::kNewForegroundTab; + browser_service->OpenUrl(GURL(kDlpLearnMoreUrl), std::move(params), + base::DoNothing()); #endif // BUILDFLAG(IS_CHROMEOS_ASH) NotificationDisplayService::GetForProfile(
diff --git a/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc b/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc index abe5311..290102e 100644 --- a/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc +++ b/chrome/browser/extensions/api/passwords_private/password_check_delegate.cc
@@ -274,6 +274,7 @@ api_credential.compromised_info->elapsed_time_since_compromise = FormatElapsedTime(credential.create_time); api_credential.compromised_info->compromise_type = credential_and_type.type; + api_credential.compromised_info->is_muted = credential.is_muted.value(); compromised_credentials.push_back(std::move(api_credential)); } @@ -331,6 +332,17 @@ return insecure_credentials_manager_.RemoveCredential(*insecure_credential); } +bool PasswordCheckDelegate::MuteInsecureCredential( + const api::passwords_private::InsecureCredential& credential) { + // Try to obtain the original CredentialWithPassword. Return false if fails. + const CredentialWithPassword* insecure_credential = + FindMatchingInsecureCredential(credential); + if (!insecure_credential) + return false; + + return insecure_credentials_manager_.MuteCredential(*insecure_credential); +} + void PasswordCheckDelegate::StartPasswordCheck( StartPasswordCheckCallback callback) { // If the delegate isn't initialized yet, enqueue the callback and return
diff --git a/chrome/browser/extensions/api/passwords_private/password_check_delegate.h b/chrome/browser/extensions/api/passwords_private/password_check_delegate.h index 9ee409a6..979427e 100644 --- a/chrome/browser/extensions/api/passwords_private/password_check_delegate.h +++ b/chrome/browser/extensions/api/passwords_private/password_check_delegate.h
@@ -75,6 +75,11 @@ bool RemoveInsecureCredential( const api::passwords_private::InsecureCredential& credential); + // Attempts to mute |credential| from the password store. Returns whether + // the mute succeeded. + bool MuteInsecureCredential( + const api::passwords_private::InsecureCredential& credential); + // Requests to start a check for insecure passwords. Invokes |callback| once a // check is running or the request was stopped via StopPasswordCheck(). void StartPasswordCheck(
diff --git a/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc b/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc index fad920a..e8681e5 100644 --- a/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc +++ b/chrome/browser/extensions/api/passwords_private/password_check_delegate_unittest.cc
@@ -751,6 +751,59 @@ EXPECT_FALSE(delegate().RemoveInsecureCredential(credential)); } +// Test that muting a insecure password succeeds. +TEST_F(PasswordCheckDelegateTest, MuteInsecureCredentialSuccess) { + PasswordForm form = MakeSavedPassword(kExampleCom, kUsername1); + AddIssueToForm(&form, InsecureType::kLeaked); + store().AddLogin(form); + RunUntilIdle(); + + InsecureCredential credential = + std::move(delegate().GetCompromisedCredentials().at(0)); + EXPECT_TRUE(delegate().MuteInsecureCredential(credential)); + RunUntilIdle(); + EXPECT_TRUE(store() + .stored_passwords() + .at(kExampleCom) + .back() + .password_issues.at(InsecureType::kLeaked) + .is_muted.value()); + + // Expect another mute of the same credential to fail. + EXPECT_FALSE(delegate().MuteInsecureCredential(credential)); +} + +// Test that muting a insecure password fails if the underlying insecure +// credential no longer exists. +TEST_F(PasswordCheckDelegateTest, MuteInsecureCredentialStaleData) { + PasswordForm form = MakeSavedPassword(kExampleCom, kUsername1); + AddIssueToForm(&form, InsecureType::kLeaked); + store().AddLogin(form); + RunUntilIdle(); + + InsecureCredential credential = + std::move(delegate().GetCompromisedCredentials().at(0)); + store().RemoveLogin(form); + RunUntilIdle(); + + EXPECT_FALSE(delegate().MuteInsecureCredential(credential)); +} + +// Test that muting a insecure password fails if the ids don't match. +TEST_F(PasswordCheckDelegateTest, MuteInsecureCredentialIdMismatch) { + PasswordForm form = MakeSavedPassword(kExampleCom, kUsername1); + AddIssueToForm(&form, InsecureType::kLeaked); + store().AddLogin(form); + RunUntilIdle(); + + InsecureCredential credential = + std::move(delegate().GetCompromisedCredentials().at(0)); + EXPECT_EQ(0, credential.id); + credential.id = 1; + + EXPECT_FALSE(delegate().MuteInsecureCredential(credential)); +} + // Tests that we don't create an entry in the database if there is no matching // saved password. TEST_F(PasswordCheckDelegateTest, OnLeakFoundDoesNotCreateCredential) {
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc index 45a9307..23ff3d3 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc
@@ -353,6 +353,25 @@ return RespondNow(NoArguments()); } +// PasswordsPrivateMuteInsecureCredentialFunction: +PasswordsPrivateMuteInsecureCredentialFunction:: + ~PasswordsPrivateMuteInsecureCredentialFunction() = default; + +ResponseAction PasswordsPrivateMuteInsecureCredentialFunction::Run() { + auto parameters = + api::passwords_private::MuteInsecureCredential::Params::Create(args()); + EXTENSION_FUNCTION_VALIDATE(parameters); + + if (!GetDelegate(browser_context()) + ->MuteInsecureCredential(parameters->credential)) { + return RespondNow( + Error("Could not mute the insecure credential. Probably no matching " + "password could be found.")); + } + + return RespondNow(NoArguments()); +} + // PasswordsPrivateStartPasswordCheckFunction: PasswordsPrivateStartPasswordCheckFunction:: ~PasswordsPrivateStartPasswordCheckFunction() = default;
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.h b/chrome/browser/extensions/api/passwords_private/passwords_private_api.h index 8165b85a9..3d9222ee 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.h +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.h
@@ -314,6 +314,19 @@ ResponseAction Run() override; }; +class PasswordsPrivateMuteInsecureCredentialFunction + : public ExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("passwordsPrivate.muteInsecureCredential", + PASSWORDSPRIVATE_MUTEINSECURECREDENTIAL) + + protected: + ~PasswordsPrivateMuteInsecureCredentialFunction() override; + + // ExtensionFunction overrides. + ResponseAction Run() override; +}; + class PasswordsPrivateStartPasswordCheckFunction : public ExtensionFunction { public: DECLARE_EXTENSION_FUNCTION("passwordsPrivate.startPasswordCheck",
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc index c6935da..4428da6b 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_apitest.cc
@@ -312,6 +312,17 @@ << message_; } +IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, + MuteInsecureCredentialSucceeds) { + AddCompromisedCredential(0); + EXPECT_TRUE(RunPasswordsSubtest("muteInsecureCredentialSucceeds")) + << message_; +} + +IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, MuteInsecureCredentialFails) { + EXPECT_TRUE(RunPasswordsSubtest("muteInsecureCredentialFails")) << message_; +} + IN_PROC_BROWSER_TEST_F(PasswordsPrivateApiTest, StartPasswordCheck) { set_start_password_check_state( password_manager::BulkLeakCheckService::State::kRunning);
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h index 9a88fd4..b1e828e 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate.h
@@ -182,6 +182,11 @@ virtual bool RemoveInsecureCredential( const api::passwords_private::InsecureCredential& credential) = 0; + // Attempts to mute |credential| from the password store. Returns whether + // the mute succeeded. + virtual bool MuteInsecureCredential( + const api::passwords_private::InsecureCredential& credential) = 0; + // Requests to start a check for insecure passwords. Invokes |callback| // once a check is running or the request was stopped via StopPasswordCheck(). virtual void StartPasswordCheck(StartPasswordCheckCallback callback) = 0;
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc index 7ef0165..1dfb521b 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
@@ -544,6 +544,11 @@ return password_check_delegate_.RemoveInsecureCredential(credential); } +bool PasswordsPrivateDelegateImpl::MuteInsecureCredential( + const api::passwords_private::InsecureCredential& credential) { + return password_check_delegate_.MuteInsecureCredential(credential); +} + void PasswordsPrivateDelegateImpl::StartPasswordCheck( StartPasswordCheckCallback callback) { password_check_delegate_.StartPasswordCheck(std::move(callback));
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h index cdc2310..1be2f8bd 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.h
@@ -99,6 +99,8 @@ base::StringPiece new_password) override; bool RemoveInsecureCredential( const api::passwords_private::InsecureCredential& credential) override; + bool MuteInsecureCredential( + const api::passwords_private::InsecureCredential& credential) override; void StartPasswordCheck(StartPasswordCheckCallback callback) override; void StopPasswordCheck() override; api::passwords_private::PasswordCheckStatus GetPasswordCheckStatus() override;
diff --git a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc index 8a16da49..e9d5191e 100644 --- a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc +++ b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.cc
@@ -278,6 +278,16 @@ }) != 0; } +// Fake implementation of MuteInsecureCredential. This succeeds if the +// delegate knows of a insecure credential with the same id. +bool TestPasswordsPrivateDelegate::MuteInsecureCredential( + const api::passwords_private::InsecureCredential& credential) { + return std::any_of(insecure_credentials_.begin(), insecure_credentials_.end(), + [&credential](const auto& insecure_credential) { + return insecure_credential.id == credential.id; + }); +} + void TestPasswordsPrivateDelegate::StartPasswordCheck( StartPasswordCheckCallback callback) { start_password_check_triggered_ = true;
diff --git a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h index 867110c..0007ba61 100644 --- a/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h +++ b/chrome/browser/extensions/api/passwords_private/test_passwords_private_delegate.h
@@ -80,6 +80,10 @@ // delegate knows of a insecure credential with the same id. bool RemoveInsecureCredential( const api::passwords_private::InsecureCredential& credential) override; + // Fake implementation of MuteInsecureCredential. This succeeds if the + // delegate knows of a insecure credential with the same id. + bool MuteInsecureCredential( + const api::passwords_private::InsecureCredential& credential) override; void StartPasswordCheck(StartPasswordCheckCallback callback) override; void StopPasswordCheck() override; api::passwords_private::PasswordCheckStatus GetPasswordCheckStatus() override;
diff --git a/chrome/browser/extensions/api/quick_unlock_private/quick_unlock_private_api_unittest.cc b/chrome/browser/extensions/api/quick_unlock_private/quick_unlock_private_api_unittest.cc index 569a75f4..bc5e193 100644 --- a/chrome/browser/extensions/api/quick_unlock_private/quick_unlock_private_api_unittest.cc +++ b/chrome/browser/extensions/api/quick_unlock_private/quick_unlock_private_api_unittest.cc
@@ -12,6 +12,7 @@ #include "ash/components/login/auth/fake_extended_authenticator.h" #include "ash/constants/ash_features.h" #include "ash/constants/ash_pref_names.h" +#include "ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/containers/contains.h" @@ -44,7 +45,6 @@ #include "chromeos/dbus/userdataauth/fake_userdataauth_client.h" #include "chromeos/services/device_sync/public/cpp/fake_device_sync_client.h" #include "chromeos/services/multidevice_setup/public/cpp/fake_multidevice_setup_client.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_secure_channel_client.h" #include "components/prefs/pref_service.h" #include "components/prefs/testing_pref_service.h" #include "components/sync_preferences/testing_pref_service_syncable.h"
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 5e5d64f..5726097 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -884,6 +884,11 @@ "expiry_milestone": 99 }, { + "name": "contextual-search-literal-search-tap", + "owners": [ "//chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/OWNERS", "contextual-search-eng@google.com" ], + "expiry_milestone": 95 + }, + { "name": "contextual-search-longpress-resolve", "owners": [ "//chrome/android/java/src/org/chromium/chrome/browser/contextualsearch/OWNERS", "contextual-search-eng@google.com" ], "expiry_milestone": 99 @@ -3200,11 +3205,6 @@ "expiry_milestone": 112 }, { - "name": "files-banner-framework", - "owners": [ "benreich", "lucmult" ], - "expiry_milestone": 100 - }, - { "name": "files-extract-archive", "owners": [ "adanilo", "simmonsjosh@google.com" ], "expiry_milestone": 112
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc index 008987c..4af113a 100644 --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc
@@ -2976,6 +2976,14 @@ const char kContextualSearchForceCaptionDescription[] = "Forces a caption to always be shown in the Touch to Search Bar."; +const char kContextualSearchLiteralSearchTapName[] = + "Contextual Search literal search with tap"; +const char kContextualSearchLiteralSearchTapDescription[] = + "Enables Contextual Search to be activated with a single tap and produce " + "a literal search. This is intended to be used in conjunction with the " + "long-press resolve feature to allow both gestures to trigger a form of " + "Touch to Search."; + const char kContextualSearchLongpressResolveName[] = "Contextual Search long-press Resolves"; const char kContextualSearchLongpressResolveDescription[] = @@ -4677,11 +4685,6 @@ "Enable mounting additional archive formats in File Manager. This has no " "effect unless #files-archivemount is also enabled."; -const char kFilesBannerFrameworkName[] = - "Updated Banner framework in Files app"; -const char kFilesBannerFrameworkDescription[] = - "Enable the updated banner framework in Files app"; - const char kFilesExtractArchiveName[] = "Extract archive in Files app"; const char kFilesExtractArchiveDescription[] = "Enable the simplified archive extraction feature in Files app";
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h index e92b9d5..cbe49fb 100644 --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h
@@ -1696,6 +1696,9 @@ extern const char kContextualSearchForceCaptionName[]; extern const char kContextualSearchForceCaptionDescription[]; +extern const char kContextualSearchLiteralSearchTapName[]; +extern const char kContextualSearchLiteralSearchTapDescription[]; + extern const char kContextualSearchLongpressResolveName[]; extern const char kContextualSearchLongpressResolveDescription[]; @@ -2681,9 +2684,6 @@ extern const char kFilesArchivemount2Name[]; extern const char kFilesArchivemount2Description[]; -extern const char kFilesBannerFrameworkName[]; -extern const char kFilesBannerFrameworkDescription[]; - extern const char kFilesExtractArchiveName[]; extern const char kFilesExtractArchiveDescription[];
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc index f61ed30..1df9faf9 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc
@@ -206,6 +206,7 @@ &kContextualSearchDebug, &kContextualSearchDelayedIntelligence, &kContextualSearchForceCaption, + &kContextualSearchLiteralSearchTap, &kContextualSearchLongpressResolve, &kContextualSearchMlTapSuppression, &KContextualSearchNewSettings, @@ -553,6 +554,9 @@ const base::Feature kContextualSearchForceCaption{ "ContextualSearchForceCaption", base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kContextualSearchLiteralSearchTap{ + "ContextualSearchLiteralSearchTap", base::FEATURE_DISABLED_BY_DEFAULT}; + const base::Feature kContextualSearchLongpressResolve{ "ContextualSearchLongpressResolve", base::FEATURE_ENABLED_BY_DEFAULT};
diff --git a/chrome/browser/flags/android/chrome_feature_list.h b/chrome/browser/flags/android/chrome_feature_list.h index ca71cc7..66afd848 100644 --- a/chrome/browser/flags/android/chrome_feature_list.h +++ b/chrome/browser/flags/android/chrome_feature_list.h
@@ -68,6 +68,7 @@ extern const base::Feature kContextualSearchDebug; extern const base::Feature kContextualSearchDelayedIntelligence; extern const base::Feature kContextualSearchForceCaption; +extern const base::Feature kContextualSearchLiteralSearchTap; extern const base::Feature kContextualSearchLongpressResolve; extern const base::Feature kContextualSearchMlTapSuppression; extern const base::Feature KContextualSearchNewSettings;
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java index a392f75..5074b147 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
@@ -284,6 +284,8 @@ public static final String CONTEXTUAL_SEARCH_DELAYED_INTELLIGENCE = "ContextualSearchDelayedIntelligence"; public static final String CONTEXTUAL_SEARCH_FORCE_CAPTION = "ContextualSearchForceCaption"; + public static final String CONTEXTUAL_SEARCH_LITERAL_SEARCH_TAP = + "ContextualSearchLiteralSearchTap"; public static final String CONTEXTUAL_SEARCH_ML_TAP_SUPPRESSION = "ContextualSearchMlTapSuppression"; public static final String CONTEXTUAL_SEARCH_NEW_SETTINGS = "ContextualSearchNewSettings";
diff --git a/chrome/browser/lacros/browser_service_lacros.cc b/chrome/browser/lacros/browser_service_lacros.cc index 38b5f958f..6f12f47 100644 --- a/chrome/browser/lacros/browser_service_lacros.cc +++ b/chrome/browser/lacros/browser_service_lacros.cc
@@ -70,6 +70,7 @@ struct BrowserServiceLacros::PendingOpenUrl { Profile* profile; GURL url; + crosapi::mojom::OpenUrlParamsPtr params; OpenUrlCallback callback; }; @@ -180,11 +181,13 @@ weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } -void BrowserServiceLacros::OpenUrl(const GURL& url, OpenUrlCallback callback) { +void BrowserServiceLacros::OpenUrl(const GURL& url, + crosapi::mojom::OpenUrlParamsPtr params, + OpenUrlCallback callback) { // TODO(crbug.com/1102815): Find what profile should be used. - ProfileManager::LoadLastUsedProfileAllowedByPolicy( - base::BindOnce(&BrowserServiceLacros::OpenUrlWithProfile, - weak_ptr_factory_.GetWeakPtr(), url, std::move(callback))); + ProfileManager::LoadLastUsedProfileAllowedByPolicy(base::BindOnce( + &BrowserServiceLacros::OpenUrlWithProfile, weak_ptr_factory_.GetWeakPtr(), + url, std::move(params), std::move(callback))); } void BrowserServiceLacros::RestoreTab(RestoreTabCallback callback) { @@ -303,26 +306,48 @@ // Then, run for each. for (auto& pending : pendings) - OpenUrlImpl(pending.profile, pending.url, std::move(pending.callback)); + OpenUrlImpl(pending.profile, pending.url, std::move(pending.params), + std::move(pending.callback)); } void BrowserServiceLacros::OpenUrlImpl(Profile* profile, const GURL& url, + crosapi::mojom::OpenUrlParamsPtr params, OpenUrlCallback callback) { NavigateParams navigate_params( profile, url, ui::PageTransitionFromInt(ui::PAGE_TRANSITION_LINK | ui::PAGE_TRANSITION_FROM_API)); - if (url.SchemeIs(content::kChromeUIScheme) && - (url.host() == chrome::kChromeUIFlagsHost || - url.host() == chrome::kChromeUIVersionHost || - url.host() == chrome::kChromeUIAboutHost || - url.host() == chrome::kChromeUIComponentsHost)) { - // Try to re-activate an existing tab for a few specified URLs. - navigate_params.disposition = WindowOpenDisposition::SWITCH_TO_TAB; - } else { - navigate_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; + + using OpenUrlParams = crosapi::mojom::OpenUrlParams; + + // Set up the window disposition. + auto mojo_disposition = + params ? params->disposition + : OpenUrlParams::WindowOpenDisposition::kLegacyAutoDetection; + switch (mojo_disposition) { + // This is to support M99 or earlier ash-chrome behavior. + // We can drop this when we deprecate to support it. + case OpenUrlParams::WindowOpenDisposition::kLegacyAutoDetection: + if (url.SchemeIs(content::kChromeUIScheme) && + (url.host() == chrome::kChromeUIFlagsHost || + url.host() == chrome::kChromeUIVersionHost || + url.host() == chrome::kChromeUIAboutHost || + url.host() == chrome::kChromeUIComponentsHost)) { + // Try to re-activate an existing tab for a few specified URLs. + navigate_params.disposition = WindowOpenDisposition::SWITCH_TO_TAB; + } else { + navigate_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; + } + break; + case OpenUrlParams::WindowOpenDisposition::kNewForegroundTab: + navigate_params.disposition = WindowOpenDisposition::NEW_FOREGROUND_TAB; + break; + case OpenUrlParams::WindowOpenDisposition::kSwitchToTab: + navigate_params.disposition = WindowOpenDisposition::SWITCH_TO_TAB; + break; } + // Ensure the browser window is showing when the URL is opened. This avoids // the user being unaware a new tab with `url` has been opened (if the window // was minimized for example). @@ -435,15 +460,17 @@ std::move(callback).Run(); } -void BrowserServiceLacros::OpenUrlWithProfile(const GURL& url, - OpenUrlCallback callback, - Profile* profile) { +void BrowserServiceLacros::OpenUrlWithProfile( + const GURL& url, + crosapi::mojom::OpenUrlParamsPtr params, + OpenUrlCallback callback, + Profile* profile) { DCHECK(profile) << "No profile is found."; // If there is on-going session restoring task, wait for its completion. if (SessionRestore::IsRestoring(profile)) { pending_open_urls_.push_back( - PendingOpenUrl{profile, url, std::move(callback)}); + PendingOpenUrl{profile, url, std::move(params), std::move(callback)}); return; } @@ -454,14 +481,14 @@ if (!chrome::FindBrowserWithProfile(profile) && session_service && session_service->ShouldRestore(nullptr)) { pending_open_urls_.push_back( - PendingOpenUrl{profile, url, std::move(callback)}); + PendingOpenUrl{profile, url, std::move(params), std::move(callback)}); session_service->RestoreIfNecessary(StartupTabs(), /* restore apps */ false); return; } // Otherwise, directly try to open the URL. - OpenUrlImpl(profile, url, std::move(callback)); + OpenUrlImpl(profile, url, std::move(params), std::move(callback)); } void BrowserServiceLacros::RestoreTabWithProfile(RestoreTabCallback callback,
diff --git a/chrome/browser/lacros/browser_service_lacros.h b/chrome/browser/lacros/browser_service_lacros.h index 316a749..5984124 100644 --- a/chrome/browser/lacros/browser_service_lacros.h +++ b/chrome/browser/lacros/browser_service_lacros.h
@@ -42,7 +42,9 @@ const std::u16string& group_id, NewWindowForDetachingTabCallback callback) override; void NewTab(NewTabCallback callback) override; - void OpenUrl(const GURL& url, OpenUrlCallback callback) override; + void OpenUrl(const GURL& url, + crosapi::mojom::OpenUrlParamsPtr params, + OpenUrlCallback callback) override; void RestoreTab(RestoreTabCallback callback) override; void HandleTabScrubbing(float x_offset) override; void GetFeedbackData(GetFeedbackDataCallback callback) override; @@ -61,7 +63,10 @@ void OnGetCompressedHistograms(GetHistogramsCallback callback, const std::string& compressed_histogram); - void OpenUrlImpl(Profile* profile, const GURL& url, OpenUrlCallback callback); + void OpenUrlImpl(Profile* profile, + const GURL& url, + crosapi::mojom::OpenUrlParamsPtr params, + OpenUrlCallback callback); // These *WithProfile() methods are called asynchronously by the corresponding // profile-less function, after loading the profile. @@ -79,6 +84,7 @@ Profile* profile); void NewTabWithProfile(NewTabCallback callback, Profile* profile); void OpenUrlWithProfile(const GURL& url, + crosapi::mojom::OpenUrlParamsPtr params, OpenUrlCallback callback, Profile* profile); void RestoreTabWithProfile(RestoreTabCallback callback, Profile* profile);
diff --git a/chrome/browser/password_manager/password_store_utils.cc b/chrome/browser/password_manager/password_store_utils.cc index adfa8da..fe2546f 100644 --- a/chrome/browser/password_manager/password_store_utils.cc +++ b/chrome/browser/password_manager/password_store_utils.cc
@@ -10,7 +10,6 @@ #include "chrome/browser/password_manager/password_reuse_manager_factory.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/safe_browsing/advanced_protection_status_manager.h" #include "chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h" #include "chrome/browser/signin/identity_manager_factory.h" @@ -81,7 +80,6 @@ profile_store, account_store, sync_service, identity_manager, pref_service, password_reuse_manager, IsUnderAdvancedProtection(profile_), - ProfileManager::GetPrimaryUserProfile() == profile_, base::BindOnce( &StoreMetricReporterHelper::RemoveInstanceFromProfileUserData, weak_ptr_factory_.GetWeakPtr()));
diff --git a/chrome/browser/printing/print_backend_service_manager.cc b/chrome/browser/printing/print_backend_service_manager.cc index b6b8f2eb..db5a2ae 100644 --- a/chrome/browser/printing/print_backend_service_manager.cc +++ b/chrome/browser/printing/print_backend_service_manager.cc
@@ -41,6 +41,9 @@ constexpr char kPrintBackendRequiresElevatedPrivilegeHistogramName[] = "Printing.PrintBackend.DriversRequiringElevatedPrivilegeEncountered"; +// For fetching remote IDs when there is no printer name. +constexpr char kEmptyPrinterName[] = ""; + // Amount of idle time to wait before resetting the connection to the service. constexpr base::TimeDelta kNoClientsRegisteredResetOnIdleTimeout = base::Seconds(10); @@ -55,6 +58,20 @@ PrintBackendServiceManager::~PrintBackendServiceManager() = default; +void PrintBackendServiceManager::SetCrashKeys(const std::string& printer_name) { + if (sandboxed_service_remote_for_test_) + return; + + // TODO(crbug.com/1227561) Remove local call for driver info, don't want + // any residual accesses left into the printer drivers from the browser + // process. + base::ScopedAllowBlocking allow_blocking; + scoped_refptr<PrintBackend> print_backend = + PrintBackend::CreateInstance(g_browser_process->GetApplicationLocale()); + crash_keys_ = std::make_unique<crash_keys::ScopedPrinterInfo>( + print_backend->GetPrinterDriverInfo(printer_name)); +} + uint32_t PrintBackendServiceManager::RegisterClient() { uint32_t client_id = ++last_client_id_; @@ -74,7 +91,6 @@ // We don't know if a particular printer might be needed, so for now just // start for the blank `printer_name` which would cover queries like getting // the default printer and enumerating the list of printers. - constexpr char kEmptyPrinterName[] = ""; std::string remote_id = GetRemoteIdForPrinterName(kEmptyPrinterName); auto iter = sandboxed_remotes_.find(remote_id); if (iter == sandboxed_remotes_.end()) { @@ -142,9 +158,8 @@ // Get a callback ID to represent this command. auto saved_callback_id = base::UnguessableToken::Create(); - const std::string kEmptyPrinterName; - bool is_sandboxed; std::string remote_id = GetRemoteIdForPrinterName(kEmptyPrinterName); + bool is_sandboxed; auto& service = GetService(kEmptyPrinterName, &is_sandboxed); SaveCallback(GetRemoteSavedEnumeratePrintersCallbacks(is_sandboxed), @@ -173,16 +188,7 @@ SaveCallback(GetRemoteSavedFetchCapabilitiesCallbacks(is_sandboxed), remote_id, saved_callback_id, std::move(callback)); - if (!sandboxed_service_remote_for_test_) { - // TODO(crbug.com/1227561) Remove local call for driver info, don't want - // any residual accesses left into the printer drivers from the browser - // process. - base::ScopedAllowBlocking allow_blocking; - scoped_refptr<PrintBackend> print_backend = - PrintBackend::CreateInstance(g_browser_process->GetApplicationLocale()); - crash_keys_ = std::make_unique<crash_keys::ScopedPrinterInfo>( - print_backend->GetPrinterDriverInfo(printer_name)); - } + SetCrashKeys(printer_name); DVLOG(1) << "Sending FetchCapabilities on remote `" << remote_id << "`, saved callback ID of " << saved_callback_id; @@ -201,10 +207,9 @@ // Get a callback ID to represent this command. auto saved_callback_id = base::UnguessableToken::Create(); - std::string remote_id = - GetRemoteIdForPrinterName(/*printer_name=*/std::string()); + std::string remote_id = GetRemoteIdForPrinterName(kEmptyPrinterName); bool is_sandboxed; - auto& service = GetService(/*printer_name=*/std::string(), &is_sandboxed); + auto& service = GetService(kEmptyPrinterName, &is_sandboxed); SaveCallback(GetRemoteSavedGetDefaultPrinterNameCallbacks(is_sandboxed), remote_id, saved_callback_id, std::move(callback)); @@ -234,16 +239,7 @@ GetRemoteSavedGetPrinterSemanticCapsAndDefaultsCallbacks(is_sandboxed), remote_id, saved_callback_id, std::move(callback)); - if (!sandboxed_service_remote_for_test_) { - // TODO(crbug.com/1227561) Remove local call for driver info, don't want - // any residual accesses left into the printer drivers from the browser - // process. - base::ScopedAllowBlocking allow_blocking; - scoped_refptr<PrintBackend> print_backend = - PrintBackend::CreateInstance(g_browser_process->GetApplicationLocale()); - crash_keys_ = std::make_unique<crash_keys::ScopedPrinterInfo>( - print_backend->GetPrinterDriverInfo(printer_name)); - } + SetCrashKeys(printer_name); DVLOG(1) << "Sending GetPrinterSemanticCapsAndDefaults on remote `" << remote_id << "`, saved callback ID of " << saved_callback_id; @@ -271,16 +267,7 @@ SaveCallback(GetRemoteSavedUpdatePrintSettingsCallbacks(is_sandboxed), remote_id, saved_callback_id, std::move(callback)); - if (!sandboxed_service_remote_for_test_) { - // TODO(crbug.com/1227561) Remove local call for driver info, don't want - // any residual accesses left into the printer drivers from the browser - // process. - base::ScopedAllowBlocking allow_blocking; - scoped_refptr<PrintBackend> print_backend = - PrintBackend::CreateInstance(g_browser_process->GetApplicationLocale()); - crash_keys_ = std::make_unique<crash_keys::ScopedPrinterInfo>( - print_backend->GetPrinterDriverInfo(printer_name)); - } + SetCrashKeys(printer_name); DVLOG(1) << "Sending UpdatePrintSettings on remote `" << remote_id << "`, saved callback ID of " << saved_callback_id; @@ -311,16 +298,7 @@ SaveCallback(GetRemoteSavedStartPrintingCallbacks(is_sandboxed), remote_id, saved_callback_id, std::move(callback)); - if (!sandboxed_service_remote_for_test_) { - // TODO(crbug.com/1227561) Remove local call for driver info, don't want - // any residual accesses left into the printer drivers from the browser - // process. - base::ScopedAllowBlocking allow_blocking; - scoped_refptr<PrintBackend> print_backend = - PrintBackend::CreateInstance(g_browser_process->GetApplicationLocale()); - crash_keys_ = std::make_unique<crash_keys::ScopedPrinterInfo>( - print_backend->GetPrinterDriverInfo(printer_name)); - } + SetCrashKeys(printer_name); DVLOG(1) << "Sending StartPrinting on remote `" << remote_id << "`, saved callback ID of " << saved_callback_id; @@ -353,16 +331,7 @@ SaveCallback(GetRemoteSavedRenderPrintedPageCallbacks(is_sandboxed), remote_id, saved_callback_id, std::move(callback)); - if (!sandboxed_service_remote_for_test_) { - // TODO(crbug.com/1227561) Remove local call for driver info, don't want - // any residual accesses left into the printer drivers from the browser - // process. - base::ScopedAllowBlocking allow_blocking; - scoped_refptr<PrintBackend> print_backend = - PrintBackend::CreateInstance(g_browser_process->GetApplicationLocale()); - crash_keys_ = std::make_unique<crash_keys::ScopedPrinterInfo>( - print_backend->GetPrinterDriverInfo(printer_name)); - } + SetCrashKeys(printer_name); // Page numbers are 0-based for the printing context. const uint32_t page_index = page.page_number() - 1; @@ -433,14 +402,13 @@ std::string PrintBackendServiceManager::GetRemoteIdForPrinterName( const std::string& printer_name) const { if (sandboxed_service_remote_for_test_) { - return std::string(); // Test environment is always just one instance for - // all printers. + // Test environment is always just one instance for all printers. + return std::string(); } #if BUILDFLAG(IS_WIN) - // Windows drivers are not thread safe. Use a - // process per driver to prevent bad interactions - // when interfacing to multiple drivers in parallel. + // Windows drivers are not thread safe. Use a process per driver to prevent + // bad interactions when interfacing to multiple drivers in parallel. // https://crbug.com/957242 return printer_name; #else
diff --git a/chrome/browser/printing/print_backend_service_manager.h b/chrome/browser/printing/print_backend_service_manager.h index cc891a80..99e9bbb2 100644 --- a/chrome/browser/printing/print_backend_service_manager.h +++ b/chrome/browser/printing/print_backend_service_manager.h
@@ -149,9 +149,15 @@ RemoteSavedCallbacks<mojom::ResultCode>; #endif + using RemotesMap = + base::flat_map<std::string, + mojo::Remote<printing::mojom::PrintBackendService>>; + PrintBackendServiceManager(); ~PrintBackendServiceManager(); + void SetCrashKeys(const std::string& printer_name); + // Determine the remote ID that is used for the specified `printer_name`. std::string GetRemoteIdForPrinterName(const std::string& printer_name) const; @@ -257,10 +263,6 @@ const std::string& remote_id, T result); - using RemotesMap = - base::flat_map<std::string, - mojo::Remote<printing::mojom::PrintBackendService>>; - // Keep separate mapping of remotes for sandboxed vs. unsandboxed services. RemotesMap sandboxed_remotes_; RemotesMap unsandboxed_remotes_;
diff --git a/chrome/browser/resources/BUILD.gn b/chrome/browser/resources/BUILD.gn index ddd1655e..fc2045d 100644 --- a/chrome/browser/resources/BUILD.gn +++ b/chrome/browser/resources/BUILD.gn
@@ -39,6 +39,7 @@ "new_tab_page:resources", "new_tab_page_instant:resources", "new_tab_page_third_party:resources", + "privacy_sandbox:resources", "read_later:resources", "settings:resources", "signin:resources",
diff --git a/chrome/browser/resources/chromeos/emoji_picker/BUILD.gn b/chrome/browser/resources/chromeos/emoji_picker/BUILD.gn index 20361a0..1d3b892 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/BUILD.gn +++ b/chrome/browser/resources/chromeos/emoji_picker/BUILD.gn
@@ -159,8 +159,7 @@ action_foreach("emoticon_data") { script = "tools/emoticon_data.py" - metadata_json = - [ "//third_party/emoji-metadata/src/emoji_14_0_ordering.json" ] + metadata_json = [ "./emoticon_test_ordering.json" ] keyword_xmls = [ # later keywords will override earlier keywords for a particular emoji. "//third_party/cldr/src/common/annotations/en.xml", @@ -168,7 +167,7 @@ "//third_party/cldr/src/common/annotationsDerived/en.xml", "//third_party/cldr/src/common/annotationsDerived/en_001.xml", ] - merged_json = "$target_gen_dir/emoticon_{{source_name_part}}.json" + merged_json = "$target_gen_dir/{{source_name_part}}.json" sources = metadata_json inputs = keyword_xmls
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_ordering.grdp b/chrome/browser/resources/chromeos/emoji_picker/emoji_ordering.grdp index bf1efbd..d20d228 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_ordering.grdp +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_ordering.grdp
@@ -4,4 +4,5 @@ <include name="IDR_EMOJI_PICKER_EMOJI_14_0_ORDERING_JSON_REMAINING" compress="gzip" file="${root_gen_dir}/chrome/browser/resources/chromeos/emoji_picker/emoji_14_0_ordering_remaining.json" resource_path="emoji_14_0_ordering_remaining.json" use_base_dir="false" type="chrome_html" /> <include name="IDR_EMOJI_PICKER_EMOJI_TEST_ORDERING_JSON_START" compress="gzip" file="${root_gen_dir}/chrome/browser/resources/chromeos/emoji_picker/emoji_test_ordering_start.json" resource_path="emoji_test_ordering_start.json" use_base_dir="false" type="chrome_html" /> <include name="IDR_EMOJI_PICKER_EMOJI_TEST_ORDERING_JSON_REMAINING" compress="gzip" file="${root_gen_dir}/chrome/browser/resources/chromeos/emoji_picker/emoji_test_ordering_remaining.json" resource_path="emoji_test_ordering_remaining.json" use_base_dir="false" type="chrome_html" /> + <include name="IDR_EMOJI_PICKER_EMOTICON_MOCK_ORDERING_JSON" compress="gzip" file="${root_gen_dir}/chrome/browser/resources/chromeos/emoji_picker/emoticon_test_ordering.json" resource_path="emoticon_test_ordering.json" use_base_dir="false" type="chrome_html" /> </grit-part>
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.html b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.html index bfa92f38..189f441 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.html +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.html
@@ -219,6 +219,10 @@ margin-inline: 4px; padding-inline: 0; } + + :host([v2-enabled]) .category-gap { + height: 16px; + } </style> <div class="sr-only" aria-live="polite"> @@ -345,12 +349,21 @@ </template> </div> <template is="dom-repeat" items="[[emojiData]]"> - <div data-group$="[[index]]"> + <div data-group$="[[getDataGroupIndex('emoji', index)]]"> <emoji-group data="[[item]]" preferred="[[preferenceMapping]]" v2-enabled$="[[v2Enabled]]"> </emoji-group> </div> </template> + <div class="category-gap"></div> + <template is="dom-if" if="[[v2Enabled]]"> + <template is="dom-repeat" items="[[emoticonData]]"> + <div data-group$="[[getDataGroupIndex('emoticon', index)]]"> + <emoji-group data="[[item]]" class="group"> + </emoji-group> + </div> + </template> + </template> </div> </div>
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js index e5679a5..54d1493 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js +++ b/chrome/browser/resources/chromeos/emoji_picker/emoji_picker.js
@@ -17,11 +17,12 @@ import {Feature} from './emoji_picker.mojom-webui.js'; import {EmojiPickerApiProxy, EmojiPickerApiProxyImpl} from './emoji_picker_api_proxy.js'; import {CATEGORY_BUTTON_CLICK, createCustomEvent, EMOJI_BUTTON_CLICK, EMOJI_CLEAR_RECENTS_CLICK, EMOJI_DATA_LOADED, EMOJI_REMAINING_DATA_LOADED, EMOJI_VARIANTS_SHOWN, EmojiVariantsShownEvent, GROUP_BUTTON_CLICK, V2_CONTENT_LOADED} from './events.js'; -import {EMPTY_EMOTICON_DATA, V2_SUBCATEGORY_TABS} from './metadata_extension.js'; +import {V2_SUBCATEGORY_TABS} from './metadata_extension.js'; import {RecentEmojiStore} from './store.js'; import {Emoji, EmojiGroup, EmojiGroupData, EmojiVariants, StoredEmoji, SubcategoryData} from './types.js'; const EMOJI_ORDERING_JSON_TEMPLATE = '/emoji_14_0_ordering'; +const EMOTICON_ORDERING_JSON = '/emoticon_test_ordering.json'; // the name attributes below are used to label the group buttons. // the ordering group names are used for the group headings in the emoji picker. @@ -133,9 +134,11 @@ emojiGroupTabs: {type: Array}, /** @private {?EmojiGroupData} */ emojiData: { - type: Object, + type: Array, observer: 'onEmojiDataChanged', }, + /** @type {?EmojiGroupData} */ + emoticonData: {type: Array, value: []}, /** @private {Object<string,string>} */ preferenceMapping: {type: Object}, /** @private {!EmojiGroup} */ @@ -260,10 +263,13 @@ CATEGORY_BUTTON_CLICK, ev => this.set('category', ev.detail.categoryName)); this.addEventListener(EMOJI_REMAINING_DATA_LOADED, () => { - // TODO(b/211520561): remove below line after the emoticon loading - // logic is finished. - this.emojiData = this.emojiData.concat(EMPTY_EMOTICON_DATA); - this.dispatchEvent(createCustomEvent(V2_CONTENT_LOADED)); + this.fetchEmoticonData().then((data) => { + // TODO(b/214319678): modify the line below to allow consumption of + // the full emoticon data. + this.emoticonData = + data.map((group) => ({group: group.group, emoji: []})); + this.dispatchEvent(createCustomEvent(V2_CONTENT_LOADED)); + }); }); } }); @@ -307,6 +313,17 @@ }); } + fetchEmoticonData() { + return new Promise((resolve, reject) => { + const xhr = new XMLHttpRequest(); + xhr.onloadend = () => { + resolve(JSON.parse(xhr.responseText)); + }; + xhr.open('GET', EMOTICON_ORDERING_JSON); + xhr.send(); + }); + } + onSearchChanged(newValue) { this.$['list-container'].style.display = newValue ? 'none' : ''; } @@ -763,6 +780,19 @@ isNotFirstPage(pageNumber) { return pageNumber !== 1; } + + /** + * Calculate the data group index for emoji-group and emoticon-group that + * matches with the group id from subcategory metadata. + * @param {string} category + * @param {number} offsetIndex + * @returns + */ + getDataGroupIndex(category, offsetIndex) { + const firstTabByCategory = V2_SUBCATEGORY_TABS.find( + tab => tab.category === category && tab.groupId !== 'history'); + return parseInt(firstTabByCategory.groupId, 10) + offsetIndex; + } } customElements.define(EmojiPicker.is, EmojiPicker);
diff --git a/chrome/browser/resources/chromeos/emoji_picker/emoticon_test_ordering.json b/chrome/browser/resources/chromeos/emoji_picker/emoticon_test_ordering.json new file mode 100644 index 0000000..c360220 --- /dev/null +++ b/chrome/browser/resources/chromeos/emoji_picker/emoticon_test_ordering.json
@@ -0,0 +1 @@ +[{"group": "Group 1", "emoji": [{"emoticons":["@-,-'-,-"],"shortcodes":[":rose:"],"base":[127801]},{"emoticons":["=^.^="],"shortcodes":[":cat-face:"],"base":[128049]},{"emoticons":["▼・ᴥ・▼"],"shortcodes":[":dog-face:"],"base":[128054]},{"emoticons":["ʕ·ᴥ·ʔ"],"shortcodes":[":bear-face:"],"base":[128059]},{"emoticons":["~>゜)~~~~"],"shortcodes":[":snake:"],"base":[128013]},{"emoticons":["(:3ꇤ⁐ꃳ ="],"shortcodes":[":otter:"],"base":[129446]},{"emoticons":["⎛⎝(•ⱅ•)⎠⎞"],"shortcodes":[":bat:"],"base":[129415]},{"emoticons":["<><"],"shortcodes":[":fish:"],"base":[128031]},{"emoticons":["くコ:彡"],"shortcodes":[":squid:"],"base":[129425]},{"emoticons":["εїз"],"shortcodes":[":butterfly:"],"base":[129419]}]},{"group": "Group 2", "emoji": [{"emoticons":[":-D"],"base":[128515],"shortcodes":[":smile-with-big-eyes:"]},{"emoticons":["^_^"],"base":[128516],"shortcodes":[":grin:"]},{"emoticons":["*^_^*"],"base":[128513],"shortcodes":[":grinning:"]}]},{"group": "Group 3", "emoji": [{"emoticons":["^_^;"],"base":[128517],"shortcodes":[":grin-sweat:"]},{"emoticons":[">w<"],"base":[128514],"shortcodes":[":joy:"]}]},{"group": "Group 4", "emoji": [{"emoticons":["<3"],"base":[10084,65039],"shortcodes":[":red-heart:"]},{"emoticons":["<3<3"],"base":[128149],"shortcodes":[":two-hearts:"]},{"emoticons":["<3!"],"base":[10083,65039],"shortcodes":[":heart-exclamation-point:"]},{"emoticons":["</3"],"base":[128148],"shortcodes":[":broken-heart:"]}]},{"group": "Group 5", "emoji": [{"emoticons":["♪┏(・o・)┛♪"],"shortcodes":[":dancer-woman:"],"base":[128131]},{"emoticons":["┗ ( ・o・) ┓♪"],"shortcodes":[":dancer-man:"],"base":[128378]},{"emoticons":["(-}{-)"],"shortcodes":[":kiss-people:"],"base":[128143]}]},{"group": "Group 6", "emoji": [{"emoticons":[":P"],"base":[128539],"shortcodes":[":stuck-out-tongue:"]},{"emoticons":[":-P"],"base":[128541],"shortcodes":[":squinting-tongue:"]},{"emoticons":["♥_♥"],"base":[128525],"shortcodes":[":heart-eyes:"]},{"emoticons":[";P"],"base":[128540],"shortcodes":[":winky-tongue:"]},{"emoticons":["o_O"],"base":[129322],"shortcodes":[":zany-face:"]},{"emoticons":["O:)"],"base":[128519],"shortcodes":[":halo:",":innocent:"]},{"emoticons":[":-)"],"base":[9786,65039],"shortcodes":[":warm-smile:"]},{"emoticons":["(・д・ゝ)"],"base":[129761],"shortcodes":[":salute:"]},{"emoticons":["\\(^o^)/"],"base":[129303],"shortcodes":[":hug-face:"]},{"emoticons":["|д・)"],"base":[129763],"shortcodes":[":peeking:"]},{"emoticons":["@0@"],"base":[128561],"shortcodes":[":screaming:"]},{"emoticons":["(-_-)ゞ"],"base":[129320],"shortcodes":[":raised-eyebrow:"]},{"emoticons":["(0へ0)"],"base":[128531],"shortcodes":[":sweat:",":downcast:"]},{"emoticons":["(*´台`*)"],"base":[129319],"shortcodes":[":sneeze:"]},{"emoticons":["⊂(´・◡・⊂ )∘˚˳°"],"base":[128123],"shortcodes":[":ghost:"]}]},{"group": "Group 7", "emoji": [{"emoticons":["└[∵┌]└[ ∵ ]┘[┐∵]┘"],"base":[129302],"shortcodes":[":robot:"]}]},{"group": "Group 8", "emoji": [{"emoticons":["༼ ^-^ ༽"],"base":[128169],"shortcodes":[":poop:"]},{"emoticons":["(<>..<>)"],"base":[128125],"shortcodes":[":alien:"]}]},{"group": "Group 9", "emoji": []},{"group": "Group 10", "emoji": []},{"group": "Group 11", "emoji": []},{"group": "Group 12", "emoji": []},{"group": "Group 13", "emoji": []},{"group": "Group 14", "emoji": []}] \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/emoji_picker/metadata_extension.js b/chrome/browser/resources/chromeos/emoji_picker/metadata_extension.js index 2ba8df6..a736f67 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/metadata_extension.js +++ b/chrome/browser/resources/chromeos/emoji_picker/metadata_extension.js
@@ -20,6 +20,7 @@ }, ]; +// TODO(b/216190190): Change groupId to number type. export const V2_SUBCATEGORY_TABS = [ { name: 'Recently Used', @@ -214,8 +215,3 @@ pagination: 4 }, ]; - -// TODO(b/211520561): remove this after the emoticon loading logic is finished. -export const EMPTY_EMOTICON_DATA = - V2_SUBCATEGORY_TABS.filter((tab) => tab.category === 'emoticon') - .map(tab => ({group: tab.name, emoji: []})); \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/emoji_picker/tools/emoticon_data.py b/chrome/browser/resources/chromeos/emoji_picker/tools/emoticon_data.py index a9b35f19..438d4ea 100644 --- a/chrome/browser/resources/chromeos/emoji_picker/tools/emoticon_data.py +++ b/chrome/browser/resources/chromeos/emoji_picker/tools/emoticon_data.py
@@ -90,7 +90,7 @@ return [{ "group": group["group"], - "items": + "emoji": list( chain.from_iterable( self.pull_emoticons_from_emoji(emoji)
diff --git a/chrome/browser/resources/chromeos/login/test_api/test_api.js b/chrome/browser/resources/chromeos/login/test_api/test_api.js index 9188e6e..a2708c4 100644 --- a/chrome/browser/resources/chromeos/login/test_api/test_api.js +++ b/chrome/browser/resources/chromeos/login/test_api/test_api.js
@@ -136,6 +136,10 @@ return keyboardTickIcon.isVisible(); } + getNextButtonName() { + return loadTimeData.getString('hidDetectionContinue'); + } + canClickNext() { return this.nextButton.isEnabled(); }
diff --git a/chrome/browser/resources/extensions/extensions.ts b/chrome/browser/resources/extensions/extensions.ts index a866cd67..525ba2c 100644 --- a/chrome/browser/resources/extensions/extensions.ts +++ b/chrome/browser/resources/extensions/extensions.ts
@@ -21,9 +21,12 @@ // </if> export {Dialog, navigation, NavigationHelper, Page} from './navigation_helper.js'; export {OptionsDialogMaxHeight, OptionsDialogMinWidth} from './options_dialog.js'; +export {ExtensionsOptionsDialogElement} from './options_dialog.js'; export {ExtensionsPackDialogElement, PackDialogDelegate} from './pack_dialog.js'; export {ExtensionsPackDialogAlertElement} from './pack_dialog_alert.js'; +export {ExtensionsRuntimeHostPermissionsElement} from './runtime_host_permissions.js'; export {getPatternFromSite} from './runtime_hosts_dialog.js'; +export {ExtensionsRuntimeHostsDialogElement} from './runtime_hosts_dialog.js'; export {Service, ServiceInterface} from './service.js'; export {ExtensionsShortcutInputElement} from './shortcut_input.js'; export {isValidKeyCode, Key, keystrokeToString} from './shortcut_util.js';
diff --git a/chrome/browser/resources/extensions/options_dialog.ts b/chrome/browser/resources/extensions/options_dialog.ts index 97506fc..f4e27c5 100644 --- a/chrome/browser/resources/extensions/options_dialog.ts +++ b/chrome/browser/resources/extensions/options_dialog.ts
@@ -35,14 +35,14 @@ // The maximum height in pixels for the options dialog. export const OptionsDialogMaxHeight = 640; -interface ExtensionsOptionsDialogElement { +export interface ExtensionsOptionsDialogElement { $: { body: HTMLElement, dialog: CrDialogElement, }; } -class ExtensionsOptionsDialogElement extends PolymerElement { +export class ExtensionsOptionsDialogElement extends PolymerElement { static get is() { return 'extensions-options-dialog'; }
diff --git a/chrome/browser/resources/extensions/runtime_host_permissions.html b/chrome/browser/resources/extensions/runtime_host_permissions.html index d0de954..acb1a7525 100644 --- a/chrome/browser/resources/extensions/runtime_host_permissions.html +++ b/chrome/browser/resources/extensions/runtime_host_permissions.html
@@ -19,7 +19,7 @@ margin-inline-start: 6px; } - #host-access { + #hostAccess { margin-inline-start: 12px; width: 100%; } @@ -74,7 +74,7 @@ </div> <div> - <select id="host-access" class="md-select" on-change="onHostAccessChange_" + <select id="hostAccess" class="md-select" on-change="onHostAccessChange_" value="[[permissions.hostAccess]]" aria-labelledby="section-heading-text"> <template is="dom-if" if="[[!enableEnhancedSiteControls]]">
diff --git a/chrome/browser/resources/extensions/runtime_host_permissions.ts b/chrome/browser/resources/extensions/runtime_host_permissions.ts index c6572a6..44e01f25 100644 --- a/chrome/browser/resources/extensions/runtime_host_permissions.ts +++ b/chrome/browser/resources/extensions/runtime_host_permissions.ts
@@ -32,14 +32,14 @@ }; } -interface ExtensionsRuntimeHostPermissionsElement { +export interface ExtensionsRuntimeHostPermissionsElement { $: { hostActionMenu: CrActionMenuElement, - 'host-access': HTMLSelectElement, + hostAccess: HTMLSelectElement, }; } -class ExtensionsRuntimeHostPermissionsElement extends PolymerElement { +export class ExtensionsRuntimeHostPermissionsElement extends PolymerElement { static get is() { return 'extensions-runtime-host-permissions'; } @@ -143,7 +143,7 @@ private revertingHostAccess_: boolean; private onHostAccessChange_() { - const selectMenu = this.$['host-access']; + const selectMenu = this.$.hostAccess; const access = selectMenu.value as chrome.developerPrivate.HostAccess; // Log a user action when the host access selection is changed by the user, @@ -240,14 +240,14 @@ } private onHostDialogCancel_() { - // The user canceled the dialog. Set host-access back to the old value, + // The user canceled the dialog. Set hostAccess back to the old value, // if the dialog was shown when just transitioning to a new state. chrome.metricsPrivate.recordUserAction( 'Extensions.Settings.Hosts.AddHostDialogCanceled'); if (this.oldHostAccess_) { assert(this.permissions.hostAccess === this.oldHostAccess_); this.revertingHostAccess_ = true; - this.$['host-access'].value = this.oldHostAccess_; + this.$.hostAccess.value = this.oldHostAccess_; this.revertingHostAccess_ = false; this.oldHostAccess_ = null; } @@ -301,6 +301,13 @@ } } +declare global { + interface HTMLElementTagNameMap { + 'extensions-runtime-host-permissions': + ExtensionsRuntimeHostPermissionsElement; + } +} + customElements.define( ExtensionsRuntimeHostPermissionsElement.is, ExtensionsRuntimeHostPermissionsElement);
diff --git a/chrome/browser/resources/extensions/runtime_hosts_dialog.ts b/chrome/browser/resources/extensions/runtime_hosts_dialog.ts index 2dc5f6ad..f5d2f0d 100644 --- a/chrome/browser/resources/extensions/runtime_hosts_dialog.ts +++ b/chrome/browser/resources/extensions/runtime_hosts_dialog.ts
@@ -8,6 +8,7 @@ import 'chrome://resources/cr_elements/shared_style_css.m.js'; import './strings.m.js'; +import {CrButtonElement} from 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import {CrDialogElement} from 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; import {assert} from 'chrome://resources/js/assert.m.js'; import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; @@ -48,13 +49,14 @@ return scheme + host + port + path; } -interface ExtensionsRuntimeHostsDialogElement { +export interface ExtensionsRuntimeHostsDialogElement { $: { dialog: CrDialogElement, + submit: CrButtonElement, }; } -class ExtensionsRuntimeHostsDialogElement extends PolymerElement { +export class ExtensionsRuntimeHostsDialogElement extends PolymerElement { static get is() { return 'extensions-runtime-hosts-dialog'; } @@ -223,6 +225,12 @@ } } +declare global { + interface HTMLElementTagNameMap { + 'extensions-runtime-hosts-dialog': ExtensionsRuntimeHostsDialogElement; + } +} + customElements.define( ExtensionsRuntimeHostsDialogElement.is, ExtensionsRuntimeHostsDialogElement);
diff --git a/chrome/browser/resources/inline_login/BUILD.gn b/chrome/browser/resources/inline_login/BUILD.gn index 48199c1a..3191e53 100644 --- a/chrome/browser/resources/inline_login/BUILD.gn +++ b/chrome/browser/resources/inline_login/BUILD.gn
@@ -42,6 +42,7 @@ deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", "//ui/webui/resources/cr_elements/cr_toggle:cr_toggle.m", + "//ui/webui/resources/js:i18n_behavior.m", "//ui/webui/resources/js:load_time_data.m", ] }
diff --git a/chrome/browser/resources/inline_login/inline_login_app.html b/chrome/browser/resources/inline_login/inline_login_app.html index 63dd313..2279af0 100644 --- a/chrome/browser/resources/inline_login/inline_login_app.html +++ b/chrome/browser/resources/inline_login/inline_login_app.html
@@ -112,7 +112,7 @@ aria-label="$i18n{ok}" on-tap="onOkButtonClick_" hidden$="[[!shouldShowOkButton_(currentView_)]]"> - $i18n{ok} + [[getNextButtonLabel_(isArcAccountRestrictionsEnabled_)]] </cr-button> </div> </if>
diff --git a/chrome/browser/resources/inline_login/inline_login_app.js b/chrome/browser/resources/inline_login/inline_login_app.js index 08c3dd72f..aa2287d4 100644 --- a/chrome/browser/resources/inline_login/inline_login_app.js +++ b/chrome/browser/resources/inline_login/inline_login_app.js
@@ -13,6 +13,7 @@ import {isRTL} from 'chrome://resources/js/util.m.js'; import {WebUIListenerBehavior} from 'chrome://resources/js/web_ui_listener_behavior.m.js'; import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {I18nBehavior} from 'chrome://resources/js/i18n_behavior.m.js'; // <if expr="chromeos"> import './arc_account_picker_app.js'; @@ -43,7 +44,7 @@ _template: html`{__html_template__}`, - behaviors: [WebUIListenerBehavior], + behaviors: [WebUIListenerBehavior, I18nBehavior], properties: { /** Mirroring the enum so that it can be used from HTML bindings. */ @@ -319,6 +320,16 @@ }, /** + * @return {string} + * @private + */ + getNextButtonLabel_() { + return this.isArcAccountRestrictionsEnabled_ ? + this.i18n('nextButtonLabel') : + this.i18n('ok'); + }, + + /** * @return {boolean} * @private */
diff --git a/chrome/browser/resources/privacy_sandbox/BUILD.gn b/chrome/browser/resources/privacy_sandbox/BUILD.gn new file mode 100644 index 0000000..ff71355 --- /dev/null +++ b/chrome/browser/resources/privacy_sandbox/BUILD.gn
@@ -0,0 +1,74 @@ +# Copyright 2022 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//chrome/common/features.gni") +import("//tools/grit/grit_rule.gni") +import("//tools/grit/preprocess_if_expr.gni") +import("//tools/polymer/html_to_js.gni") +import("//tools/typescript/ts_library.gni") +import("//ui/webui/resources/tools/generate_grd.gni") +import("privacy_sandbox.gni") + +assert(!is_android, "!is_android check failed") + +preprocess_folder = "preprocessed" + +grit("resources") { + defines = chrome_grit_defines + + # These arguments are needed since the grd is generated at build time. + enable_input_discovery_for_gn_analyze = false + source = "$target_gen_dir/resources.grd" + deps = [ ":build_grd" ] + + outputs = [ + "grit/privacy_sandbox_resources.h", + "grit/privacy_sandbox_resources_map.cc", + "grit/privacy_sandbox_resources_map.h", + "privacy_sandbox_resources.pak", + ] + output_dir = "$root_gen_dir/chrome" +} + +generate_grd("build_grd") { + grd_prefix = "privacy_sandbox" + out_grd = "$target_gen_dir/resources.grd" + input_files = [ "privacy_sandbox_dialog.html" ] + input_files_base_dir = rebase_path(".", "//") + deps = [ ":build_ts" ] + manifest_files = [ "$target_gen_dir/tsconfig.manifest" ] +} + +preprocess_if_expr("preprocess") { + in_folder = "." + out_folder = "$target_gen_dir/$preprocess_folder" + in_files = non_web_component_files +} + +preprocess_if_expr("preprocess_generated") { + deps = [ ":web_components" ] + in_folder = target_gen_dir + out_folder = "$target_gen_dir/$preprocess_folder" + in_files = web_component_files +} + +html_to_js("web_components") { + js_files = web_component_files +} + +ts_library("build_ts") { + root_dir = "$target_gen_dir/$preprocess_folder" + out_dir = "$target_gen_dir/tsc" + tsconfig_base = "tsconfig_base.json" + in_files = non_web_component_files + web_component_files + definitions = [ "//tools/typescript/definitions/chrome_send.d.ts" ] + deps = [ + "//third_party/polymer/v3_0:library", + "//ui/webui/resources:library", + ] + extra_deps = [ + ":preprocess", + ":preprocess_generated", + ] +}
diff --git a/chrome/browser/resources/privacy_sandbox/DIR_METADATA b/chrome/browser/resources/privacy_sandbox/DIR_METADATA new file mode 100644 index 0000000..7d283fa --- /dev/null +++ b/chrome/browser/resources/privacy_sandbox/DIR_METADATA
@@ -0,0 +1,5 @@ +monorail: { + component: "UI>Settings>Privacy" +} + +team_email: "chrome-friendly-settings@google.com"
diff --git a/chrome/browser/resources/privacy_sandbox/OWNERS b/chrome/browser/resources/privacy_sandbox/OWNERS new file mode 100644 index 0000000..0bab1928 --- /dev/null +++ b/chrome/browser/resources/privacy_sandbox/OWNERS
@@ -0,0 +1,3 @@ +# Chrome Privacy Team +rainhard@chromium.org +sauski@google.com
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox.gni b/chrome/browser/resources/privacy_sandbox/privacy_sandbox.gni new file mode 100644 index 0000000..3e8844f --- /dev/null +++ b/chrome/browser/resources/privacy_sandbox/privacy_sandbox.gni
@@ -0,0 +1,7 @@ +# Copyright 2022 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +non_web_component_files = [ "privacy_sandbox_dialog_browser_proxy.ts" ] + +web_component_files = [ "privacy_sandbox_dialog_app.ts" ]
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog.html b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog.html new file mode 100644 index 0000000..7524d90 --- /dev/null +++ b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog.html
@@ -0,0 +1,30 @@ +<!DOCTYPE html> +<html dir="$i18n{textdirection}" lang="$i18n{language}"> +<head> + <meta charset="utf-8"> + <meta name="color-scheme" content="light dark"> + <meta name="viewport" content="width=device-width initial-scale=1.0, + user-scalable=no"> + <title>Lorum Ipsum</title> + <link rel="stylesheet" href="chrome://resources/css/md_colors.css"> + <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css"> + <style> + html { + background: var(--md-background-color); + height: 100%; + } + + html, + body { + height: 500px; + margin: 0; + padding: 0; + width: 500px; + } + </style> + <script type="module" src="privacy_sandbox_dialog_app.js"></script> +</head> +<body> + <privacy-sandbox-dialog-app></privacy-sandbox-dialog-app> +</body> +</html>
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_app.html b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_app.html new file mode 100644 index 0000000..07a2e6b --- /dev/null +++ b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_app.html
@@ -0,0 +1,4 @@ +<div> + Lorum Ipsum + <cr-button on-click="onClose_"> close </cr-button> +</div>
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_app.ts b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_app.ts new file mode 100644 index 0000000..b7e52619 --- /dev/null +++ b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_app.ts
@@ -0,0 +1,29 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; + +import {html, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; + +import {PrivacySandboxDialogBrowserProxy} from './privacy_sandbox_dialog_browser_proxy.js'; + +const PrivacySandboxDialogAppElementBase = PolymerElement; + +export class PrivacySandboxDialogAppElement extends + PrivacySandboxDialogAppElementBase { + static get is() { + return 'privacy-sandbox-dialog-app'; + } + + static get template() { + return html`{__html_template__}`; + } + + private onClose_() { + PrivacySandboxDialogBrowserProxy.getInstance().closeDialog(); + } +} + +customElements.define( + PrivacySandboxDialogAppElement.is, PrivacySandboxDialogAppElement);
diff --git a/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_browser_proxy.ts b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_browser_proxy.ts new file mode 100644 index 0000000..1aa43b8 --- /dev/null +++ b/chrome/browser/resources/privacy_sandbox/privacy_sandbox_dialog_browser_proxy.ts
@@ -0,0 +1,19 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export class PrivacySandboxDialogBrowserProxy { + closeDialog() { + chrome.send('closeDialog'); + } + + static getInstance(): PrivacySandboxDialogBrowserProxy { + return instance || (instance = new PrivacySandboxDialogBrowserProxy()); + } + + static setInstance(obj: PrivacySandboxDialogBrowserProxy) { + instance = obj; + } +} + +let instance: PrivacySandboxDialogBrowserProxy|null = null;
diff --git a/chrome/browser/resources/privacy_sandbox/tsconfig_base.json b/chrome/browser/resources/privacy_sandbox/tsconfig_base.json new file mode 100644 index 0000000..afa07315 --- /dev/null +++ b/chrome/browser/resources/privacy_sandbox/tsconfig_base.json
@@ -0,0 +1,8 @@ +{ + "extends": "../../../../tools/typescript/tsconfig_base.json", + "compilerOptions": { + "noUncheckedIndexedAccess": false, + "noUnusedLocals": false, + "strictPropertyInitialization": false + } +}
diff --git a/chrome/browser/tab/BUILD.gn b/chrome/browser/tab/BUILD.gn index 51e5466..94e5e15 100644 --- a/chrome/browser/tab/BUILD.gn +++ b/chrome/browser/tab/BUILD.gn
@@ -34,6 +34,7 @@ "java/src/org/chromium/chrome/browser/tab/WebContentsStateBridge.java", "java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabData.java", "java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabDataObserver.java", + "java/src/org/chromium/chrome/browser/tab/state/EmptyByteBufferPersistedTabDataStorage.java", "java/src/org/chromium/chrome/browser/tab/state/EncryptedFilePersistedTabDataStorage.java", "java/src/org/chromium/chrome/browser/tab/state/FilePersistedTabDataStorage.java", "java/src/org/chromium/chrome/browser/tab/state/LevelDBPersistedDataStorage.java",
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabData.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabData.java index d304799..dc86627 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabData.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/CriticalPersistedTabData.java
@@ -82,7 +82,7 @@ private @TabUserAgent int mUserAgent; @VisibleForTesting - protected CriticalPersistedTabData(Tab tab) { + public CriticalPersistedTabData(Tab tab) { super(tab, PersistedTabDataConfiguration.get(CriticalPersistedTabData.class, tab.isIncognito()) .getStorage(), @@ -712,4 +712,11 @@ public void setShouldSaveForTesting(boolean shouldSaveForTesting) { mShouldSaveForTesting = shouldSaveForTesting; } + + /** + * @return true if the serialized {@link CriticalPersistedTabData} is empty. + */ + public static boolean isEmptySerialization(ByteBuffer byteBuffer) { + return byteBuffer == null || byteBuffer.limit() == 0; + } }
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/EmptyByteBufferPersistedTabDataStorage.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/EmptyByteBufferPersistedTabDataStorage.java new file mode 100644 index 0000000..eefa678 --- /dev/null +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/EmptyByteBufferPersistedTabDataStorage.java
@@ -0,0 +1,54 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.tab.state; + +import org.chromium.base.Callback; +import org.chromium.base.supplier.Supplier; +import org.chromium.base.task.PostTask; +import org.chromium.content_public.browser.UiThreadTaskTraits; + +import java.nio.ByteBuffer; +import java.util.List; + +/** + * Mock implementation of {@link PersistedTabDataStorage} for tests. Specifically + * this implementation mocks a non-null Bytebuffer with limit 0 simulating what + * we saw in crbug.com/1287632. + */ +public class EmptyByteBufferPersistedTabDataStorage implements PersistedTabDataStorage { + // Unused + @Override + public void save(int tabId, String tabDataId, Supplier<ByteBuffer> dataSupplier) { + assert false : "save is currently unused in EmptyByteBufferPersistedTabDataStorage"; + } + + @Override + public void restore(int tabId, String tabDataId, Callback<ByteBuffer> callback) { + PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, + () -> { callback.onResult(ByteBuffer.allocateDirect(0)); }); + } + + // Unused + @Override + public ByteBuffer restore(int tabId, String tabDataId) { + return ByteBuffer.allocateDirect(0); + } + + // Unused + @Override + public void delete(int tabId, String tabDataId) { + assert false : "delete is currently unused in EmptyByteBufferPersistedTabDataStorage"; + } + + @Override + public String getUmaTag() { + return "MPTDS"; + } + + @Override + public void performMaintenance(List<Integer> tabIds, String dataId) { + assert false : "perforMaintenance is not available in MockPersistedTabDataStorage"; + } +}
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/PersistedTabData.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/PersistedTabData.java index 16943e3..17be18a 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/PersistedTabData.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/PersistedTabData.java
@@ -294,7 +294,8 @@ */ abstract boolean deserialize(@Nullable ByteBuffer bytes); - protected void deserializeAndLog(@Nullable ByteBuffer bytes) { + @VisibleForTesting(otherwise = VisibleForTesting.PROTECTED) + public void deserializeAndLog(@Nullable ByteBuffer bytes) { boolean success; try (TraceEvent e = TraceEvent.scoped("PersistedTabData.Deserialize")) { success = deserialize(bytes);
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/PersistedTabDataConfiguration.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/PersistedTabDataConfiguration.java index db519ce..51fd432 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/PersistedTabDataConfiguration.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/state/PersistedTabDataConfiguration.java
@@ -22,6 +22,7 @@ ENCRYPTED_MOCK_PERSISTED_TAB_DATA("EMPTD"), SHOPPING_PERSISTED_TAB_DATA("SPTD"), STORE_PERSISTED_TAB_DATA("STPTD"), + EMPTY_BYTE_BUFFER_TEST_CONFIG("EBBTC"), // TODO(crbug.com/1113828) investigate separating test from prod test implementations TEST_CONFIG("TC"); @@ -36,6 +37,16 @@ private static FilePersistedTabDataStorage sFilePersistedTabDataStorage; private static EncryptedFilePersistedTabDataStorage sEncrpytedFilePersistedTabDataStorage; private static MockPersistedTabDataStorage sMockPersistedTabDataStorage; + private static EmptyByteBufferPersistedTabDataStorage sEmptyByteBufferPersistedTabDataStorage; + private static boolean sUseEmptyByteBufferTestConfig; + + private static EmptyByteBufferPersistedTabDataStorage + getEmptyByteBufferPersistedTabDataStorage() { + if (sEmptyByteBufferPersistedTabDataStorage == null) { + sEmptyByteBufferPersistedTabDataStorage = new EmptyByteBufferPersistedTabDataStorage(); + } + return sEmptyByteBufferPersistedTabDataStorage; + } private static FilePersistedTabDataStorage getFilePersistedTabDataStorage() { if (sFilePersistedTabDataStorage == null) { @@ -90,6 +101,10 @@ TEST_CONFIG.mStorageFactory = () -> { return getMockPersistedTabDataStorage(); }; + + EMPTY_BYTE_BUFFER_TEST_CONFIG.mStorageFactory = () -> { + return getEmptyByteBufferPersistedTabDataStorage(); + }; } private final String mId; @@ -123,6 +138,9 @@ */ public static PersistedTabDataConfiguration get( Class<? extends PersistedTabData> clazz, boolean isEncrypted) { + if (sUseEmptyByteBufferTestConfig) { + return EMPTY_BYTE_BUFFER_TEST_CONFIG; + } if (sUseTestConfig) { return TEST_CONFIG; } @@ -132,12 +150,19 @@ return sLookup.get(clazz); } + // TODO(crbug.com/1290977) merge test config options into an enum so there can be just one + // setter). @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) public static void setUseTestConfig(boolean useTestConfig) { sUseTestConfig = useTestConfig; } @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + public static void setUseEmptyByteBufferTestConfig(boolean useEmptyByteBufferTestConfig) { + sUseEmptyByteBufferTestConfig = useEmptyByteBufferTestConfig; + } + + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) static PersistedTabDataConfiguration getTestConfig() { return TEST_CONFIG; }
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index e3dd9b3f..adaaca0 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -1210,6 +1210,9 @@ "pdf/chrome_pdf_web_contents_helper_client.cc", "pdf/chrome_pdf_web_contents_helper_client.h", "permission_bubble/permission_prompt.h", + "privacy_sandbox/privacy_sandbox_dialog.h", + "privacy_sandbox/privacy_sandbox_dialog_helper.cc", + "privacy_sandbox/privacy_sandbox_dialog_helper.h", "sad_tab.cc", "sad_tab.h", "sad_tab_helper.cc", @@ -1551,6 +1554,10 @@ "webui/plural_string_handler.h", "webui/policy_indicator_localized_strings_provider.cc", "webui/policy_indicator_localized_strings_provider.h", + "webui/privacy_sandbox/privacy_sandbox_dialog_handler.cc", + "webui/privacy_sandbox/privacy_sandbox_dialog_handler.h", + "webui/privacy_sandbox/privacy_sandbox_dialog_ui.cc", + "webui/privacy_sandbox/privacy_sandbox_dialog_ui.h", "webui/profile_info_watcher.cc", "webui/profile_info_watcher.h", "webui/read_later/read_later_page_handler.cc", @@ -3218,6 +3225,8 @@ "views/external_protocol_dialog.h", "views/hats/hats_next_web_dialog.cc", "views/hats/hats_next_web_dialog.h", + "views/privacy_sandbox/privacy_sandbox_dialog_view.cc", + "views/privacy_sandbox/privacy_sandbox_dialog_view.h", "views/profiles/incognito_menu_view.cc", "views/profiles/incognito_menu_view.h", "views/profiles/profile_menu_view_base.cc",
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc index 695aa07..2630f68bd 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.cc
@@ -86,6 +86,10 @@ constexpr char kVPNProvider[] = "vpnprovider"; constexpr char kPermissionStateGranted[] = "granted"; constexpr char kPermissionStateManaged[] = "managed"; +constexpr char kWindowLayout[] = "window_layout"; +constexpr char kWindowSizeType[] = "window_layout_type"; +constexpr char kWindowResizability[] = "window_resizability"; +constexpr char kWindowBounds[] = "window_bounds"; // Defines maximum number of showing splash screen per user. const int kMaxNumSplashScreen = 2; @@ -235,6 +239,62 @@ return true; } +// Converts |rect| to base::Value, e.g. { 0, 100, 200, 300 }. +base::Value RectToValueDict(const gfx::Rect& rect) { + base::Value dict(base::Value::Type::DICTIONARY); + dict.SetIntKey("x", rect.x()); + dict.SetIntKey("y", rect.y()); + dict.SetIntKey("width", rect.width()); + dict.SetIntKey("height", rect.height()); + return dict; +} + +// Gets gfx::Rect from base::Value, e.g. { 0, 100, 200, 300 } returns +// gfx::Rect(0, 100, 200, 300). If the Value does not contains valid rect, +// returns absl::nullopt. +absl::optional<gfx::Rect> RectFromDictValue(const base::Value* rect_dict) { + if (!rect_dict) + return absl::nullopt; + auto x = rect_dict->FindIntKey("x"); + auto y = rect_dict->FindIntKey("y"); + auto width = rect_dict->FindIntKey("width"); + auto height = rect_dict->FindIntKey("height"); + if (!x.has_value() || !y.has_value() || !width.has_value() || + !height.has_value()) { + return absl::nullopt; + } + return gfx::Rect(x.value(), y.value(), width.value(), height.value()); +} + +base::Value WindowLayoutToDict( + const ArcAppListPrefs::WindowLayout& window_layout) { + base::Value dict(base::Value::Type::DICTIONARY); + dict.SetIntKey(kWindowSizeType, static_cast<int32_t>(window_layout.type)); + dict.SetBoolKey(kWindowResizability, window_layout.resizable); + if (window_layout.bounds.has_value()) + dict.SetKey(kWindowBounds, RectToValueDict(window_layout.bounds.value())); + return dict; +} + +ArcAppListPrefs::WindowLayout WindowLayoutFromDict(const base::Value* dict) { + if (!dict) + return ArcAppListPrefs::WindowLayout(); + return ArcAppListPrefs::WindowLayout( + static_cast<arc::mojom::WindowSizeType>( + dict->FindIntKey(kWindowSizeType).value_or(0)), + dict->FindBoolKey(kWindowResizability).value_or(true), + RectFromDictValue(dict->FindKey(kWindowBounds))); +} + +ArcAppListPrefs::WindowLayout WindowLayoutFromApp( + const arc::mojom::AppInfo& app) { + if (app.initial_layout.is_null()) + return ArcAppListPrefs::WindowLayout(); + return ArcAppListPrefs::WindowLayout(app.initial_layout->type, + app.initial_layout->resizable, + app.initial_layout->bounds); +} + // Returns true if one of state of |info1| does not match the same state in // |info2|. bool AreAppStatesChanged(const ArcAppListPrefs::AppInfo& info1, @@ -812,13 +872,16 @@ if (deferred) notifications_enabled = deferred; + WindowLayout window_layout = + WindowLayoutFromDict(apps->FindDictKey(kWindowLayout)); + return std::make_unique<AppInfo>( name, package_name, activity, intent_uri, icon_resource_id, last_launch_time, GetInstallTime(app_id), app->FindBoolKey(kSticky).value_or(false), notifications_enabled, resize_lock_state, app->FindBoolKey(kResizeLockNeedsConfirmation).value_or(true), - ready_apps_.count(app_id) > 0 /* ready */, + window_layout, ready_apps_.count(app_id) > 0 /* ready */, app->FindBoolKey(kSuspended).value_or(false), launchable && arc::ShouldShowInLauncher(app_id), shortcut, launchable); } @@ -1133,7 +1196,7 @@ std::string() /* icon_resource_id */, false /* sticky */, false /* notifications_enabled */, false /* app_ready */, false /* suspended */, false /* shortcut */, - true /* launchable */); + true /* launchable */, ArcAppListPrefs::WindowLayout()); } } @@ -1224,21 +1287,23 @@ std::string() /* icon_resource_id */, false /* sticky */, false /* notifications_enabled */, true /* app_ready */, false /* suspended */, false /* shortcut */, - false /* launchable */); + false /* launchable */, ArcAppListPrefs::WindowLayout()); } } -void ArcAppListPrefs::AddAppAndShortcut(const std::string& name, - const std::string& package_name, - const std::string& activity, - const std::string& intent_uri, - const std::string& icon_resource_id, - const bool sticky, - const bool notifications_enabled, - const bool app_ready, - const bool suspended, - const bool shortcut, - const bool launchable) { +void ArcAppListPrefs::AddAppAndShortcut( + const std::string& name, + const std::string& package_name, + const std::string& activity, + const std::string& intent_uri, + const std::string& icon_resource_id, + const bool sticky, + const bool notifications_enabled, + const bool app_ready, + const bool suspended, + const bool shortcut, + const bool launchable, + const WindowLayout& initial_window_layout) { const std::string app_id = shortcut ? GetAppId(package_name, intent_uri) : GetAppId(package_name, activity); @@ -1298,6 +1363,8 @@ app_dict->SetBoolKey(kShortcut, shortcut); app_dict->SetBoolKey(kLaunchable, launchable); + app_dict->SetKey(kWindowLayout, WindowLayoutToDict(initial_window_layout)); + // Note the install time is the first time the Chrome OS sees the app, not the // actual install time in Android side. if (GetInstallTime(app_id).is_null()) { @@ -1314,8 +1381,9 @@ AppInfo app_info( updated_name, package_name, activity, intent_uri, icon_resource_id, last_launch_time, GetInstallTime(app_id), sticky, notifications_enabled, - resize_lock_state, resize_lock_needs_confirmation, app_ready, suspended, - launchable && arc::ShouldShowInLauncher(app_id), shortcut, launchable); + resize_lock_state, resize_lock_needs_confirmation, initial_window_layout, + app_ready, suspended, launchable && arc::ShouldShowInLauncher(app_id), + shortcut, launchable); if (was_tracked) { if (AreAppStatesChanged(*app_old_info, app_info)) { @@ -1526,11 +1594,12 @@ ready_apps_.clear(); for (const auto& app : apps) { - AddAppAndShortcut( - app->name, app->package_name, app->activity, - std::string() /* intent_uri */, std::string() /* icon_resource_id */, - app->sticky, app->notifications_enabled, true /* app_ready */, - app->suspended, false /* shortcut */, true /* launchable */); + AddAppAndShortcut(app->name, app->package_name, app->activity, + std::string() /* intent_uri */, + std::string() /* icon_resource_id */, app->sticky, + app->notifications_enabled, true /* app_ready */, + app->suspended, false /* shortcut */, + true /* launchable */, WindowLayoutFromApp(*app)); } // Detect removed ARC apps after current refresh. @@ -1594,11 +1663,12 @@ return; } - AddAppAndShortcut( - app_info.name, app_info.package_name, app_info.activity, - std::string() /* intent_uri */, std::string() /* icon_resource_id */, - app_info.sticky, app_info.notifications_enabled, true /* app_ready */, - app_info.suspended, false /* shortcut */, true /* launchable */); + AddAppAndShortcut(app_info.name, app_info.package_name, app_info.activity, + std::string() /* intent_uri */, + std::string() /* icon_resource_id */, app_info.sticky, + app_info.notifications_enabled, true /* app_ready */, + app_info.suspended, false /* shortcut */, + true /* launchable */, WindowLayoutFromApp(app_info)); } void ArcAppListPrefs::OnAppAddedDeprecated(arc::mojom::AppInfoPtr app) { @@ -1683,11 +1753,12 @@ return; } - AddAppAndShortcut( - shortcut->name, shortcut->package_name, std::string() /* activity */, - shortcut->intent_uri, shortcut->icon_resource_id, false /* sticky */, - false /* notifications_enabled */, true /* app_ready */, - false /* suspended */, true /* shortcut */, true /* launchable */); + AddAppAndShortcut(shortcut->name, shortcut->package_name, + std::string() /* activity */, shortcut->intent_uri, + shortcut->icon_resource_id, false /* sticky */, + false /* notifications_enabled */, true /* app_ready */, + false /* suspended */, true /* shortcut */, + true /* launchable */, ArcAppListPrefs::WindowLayout()); } void ArcAppListPrefs::OnUninstallShortcut(const std::string& package_name, @@ -2113,6 +2184,7 @@ bool notifications_enabled, arc::mojom::ArcResizeLockState resize_lock_state, bool resize_lock_needs_confirmation, + const WindowLayout& initial_window_layout, bool ready, bool suspended, bool show_in_launcher, @@ -2129,6 +2201,7 @@ notifications_enabled(notifications_enabled), resize_lock_state(resize_lock_state), resize_lock_needs_confirmation(resize_lock_needs_confirmation), + initial_window_layout(initial_window_layout), ready(ready), suspended(suspended), show_in_launcher(show_in_launcher), @@ -2156,6 +2229,7 @@ resize_lock_state == other.resize_lock_state && resize_lock_needs_confirmation == other.resize_lock_needs_confirmation && + initial_window_layout == other.initial_window_layout && ready == other.ready && suspended == other.suspended && show_in_launcher == other.show_in_launcher && shortcut == other.shortcut && launchable == other.launchable; @@ -2184,6 +2258,24 @@ // Complex class/struct needs an explicit out-of-line destructor ArcAppListPrefs::PackageInfo::~PackageInfo() = default; +ArcAppListPrefs::WindowLayout::WindowLayout() + : WindowLayout(arc::mojom::WindowSizeType::kUnknown, true, absl::nullopt) {} + +ArcAppListPrefs::WindowLayout::WindowLayout(arc::mojom::WindowSizeType type, + bool resizable, + absl::optional<gfx::Rect> bounds) + : type(type), resizable(resizable), bounds(std::move(bounds)) {} + +ArcAppListPrefs::WindowLayout::WindowLayout( + const ArcAppListPrefs::WindowLayout& other) = default; + +ArcAppListPrefs::WindowLayout::~WindowLayout() = default; + +bool ArcAppListPrefs::WindowLayout::operator==( + const WindowLayout& other) const { + return type == other.type && resizable == other.resizable && + bounds == other.bounds; +} ArcAppListPrefs::Observer::~Observer() { CHECK(!IsInObserverList()); }
diff --git a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h index cc09fa6a..77253e0 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h +++ b/chrome/browser/ui/app_list/arc/arc_app_list_prefs.h
@@ -71,6 +71,22 @@ public arc::ArcPolicyBridge::Observer, public arc::ArcResizeLockPrefDelegate { public: + struct WindowLayout { + // TODO(sstan): Refactor WindowLayout and AppInfo for adding move + // constructor. + WindowLayout(); + WindowLayout(arc::mojom::WindowSizeType type, + bool resizable, + absl::optional<gfx::Rect> bounds); + WindowLayout(const WindowLayout& other); + ~WindowLayout(); + + arc::mojom::WindowSizeType type; + bool resizable; + absl::optional<gfx::Rect> bounds; + + bool operator==(const WindowLayout& other) const; + }; struct AppInfo { AppInfo(const std::string& name, const std::string& package_name, @@ -83,6 +99,7 @@ bool notifications_enabled, arc::mojom::ArcResizeLockState resize_lock_state, bool resize_lock_needs_confirmation, + const WindowLayout& initial_window_layout, bool ready, bool suspended, bool show_in_launcher, @@ -107,6 +124,8 @@ // Whether the confirmation dialog is needed when user requests resize if // the app is in the resize-locked mode. bool resize_lock_needs_confirmation; + // The app window initial window layout. + WindowLayout initial_window_layout; // Whether app is ready. Disabled and removed apps are not ready. bool ready; // Whether app was suspended by policy. It may have or may not have ready @@ -500,7 +519,8 @@ const bool app_ready, const bool suspended, const bool shortcut, - const bool launchable); + const bool launchable, + const WindowLayout& initial_window_layout); // Adds or updates local pref for given package. void AddOrUpdatePackagePrefs(const arc::mojom::ArcPackageInfo& package); // Removes given package from local pref.
diff --git a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc index 11aa657..5bdbf79 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_unittest.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_unittest.cc
@@ -416,9 +416,9 @@ std::string() /* icon_resource_id */, base::Time() /* last_launch_time */, base::Time() /* install_time */, app.sticky, app.notifications_enabled, arc::mojom::ArcResizeLockState::UNDEFINED, - true /* resize_lock_needs_confirmation */, true /* ready */, - false /* suspended */, launchable /* show_in_launcher*/, - false /* shortcut */, launchable); + true /* resize_lock_needs_confirmation */, + ArcAppListPrefs::WindowLayout(), true /* ready */, false /* suspended */, + launchable /* show_in_launcher*/, false /* shortcut */, launchable); } MATCHER_P(ArcPackageInfoIs, package, "") {
diff --git a/chrome/browser/ui/app_list/arc/arc_app_utils.cc b/chrome/browser/ui/app_list/arc/arc_app_utils.cc index 5f558b3f..7aa61996 100644 --- a/chrome/browser/ui/app_list/arc/arc_app_utils.cc +++ b/chrome/browser/ui/app_list/arc/arc_app_utils.cc
@@ -37,6 +37,7 @@ #include "chrome/browser/ash/arc/boot_phase_monitor/arc_boot_phase_monitor_bridge.h" #include "chrome/browser/ash/arc/notification/arc_management_transition_notification.h" #include "chrome/browser/ash/arc/session/arc_session_manager.h" +#include "chrome/browser/ash/arc/window_predictor/window_predictor_utils.h" #include "chrome/browser/ash/login/login_pref_names.h" #include "chrome/browser/ash/policy/handlers/powerwash_requirements_checker.h" #include "chrome/browser/browser_process.h" @@ -53,6 +54,7 @@ #include "chrome/browser/ui/ash/shelf/shelf_spinner_controller.h" #include "chrome/common/pref_names.h" #include "components/app_restore/app_restore_utils.h" +#include "components/app_restore/features.h" #include "components/arc/intent_helper/arc_intent_helper_bridge.h" #include "components/language/core/browser/pref_names.h" #include "components/prefs/pref_service.h" @@ -369,6 +371,15 @@ arc::ArcBootPhaseMonitorBridge::RecordFirstAppLaunchDelayUMA(context); } + if (full_restore::features::IsArcWindowPredictorEnabled()) { + if (LaunchArcAppWithGhostWindow(profile, app_id, *app_info, event_flags, + user_action, std::move(window_info))) { + prefs->SetLastLaunchTime(app_id); + return true; + } + VLOG(2) << "Failed to launch ghost window, fallback to use shelf spinner"; + } + ChromeShelfController* chrome_controller = ChromeShelfController::instance(); // chrome_controller may be null in tests.
diff --git a/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider_unittest.cc b/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider_unittest.cc index dfd92e6..eb6e227 100644 --- a/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider_unittest.cc +++ b/chrome/browser/ui/app_list/search/arc/arc_app_shortcuts_search_provider_unittest.cc
@@ -76,7 +76,7 @@ std::string() /* intent_uri */, std::string() /* icon_resource_id */, false /* sticky */, true /* notifications_enabled */, true /* app_ready */, false /* suspended */, false /* shortcut */, - launchable); + launchable, ArcAppListPrefs::WindowLayout()); const std::string app_id = ArcAppListPrefs::GetAppId(app_info.package_name, app_info.activity); EXPECT_TRUE(prefs->GetApp(app_id));
diff --git a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc index 2cd7fcce..678d5d4 100644 --- a/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc +++ b/chrome/browser/ui/ash/shelf/chrome_shelf_controller_unittest.cc
@@ -1009,7 +1009,7 @@ std::string() /* intent_uri */, std::string() /* icon_resource_id */, false /* sticky */, true /* notifications_enabled */, true /* app_ready */, false /* suspended */, false /* shortcut */, - true /* launchable */); + true /* launchable */, ArcAppListPrefs::WindowLayout()); const std::string app_id = ArcAppListPrefs::GetAppId(app_info.package_name, app_info.activity); EXPECT_TRUE(prefs->GetApp(app_id));
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc index 0049dec..3d7db1d 100644 --- a/chrome/browser/ui/chrome_pages.cc +++ b/chrome/browser/ui/chrome_pages.cc
@@ -443,6 +443,11 @@ browser, extension_urls::GetWebstoreLaunchURL()); } +void ShowPrivacySandboxSettings(Browser* browser) { + base::RecordAction(UserMetricsAction("Options_ShowPrivacySandbox")); + ShowSettingsSubPage(browser, kPrivacySandboxSubPage); +} + #if BUILDFLAG(IS_CHROMEOS_ASH) void ShowEnterpriseManagementPageInTabbedBrowser(Browser* browser) { // Management shows in a tab because it has a "back" arrow that takes the
diff --git a/chrome/browser/ui/chrome_pages.h b/chrome/browser/ui/chrome_pages.h index cd35e02c..0f7b8af 100644 --- a/chrome/browser/ui/chrome_pages.h +++ b/chrome/browser/ui/chrome_pages.h
@@ -158,6 +158,7 @@ void ShowAboutChrome(Browser* browser); void ShowSearchEngineSettings(Browser* browser); void ShowWebStore(Browser* browser); +void ShowPrivacySandboxSettings(Browser* browser); #if BUILDFLAG(IS_CHROMEOS_ASH) // Shows the enterprise management info page in a browser tab.
diff --git a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc index d7a41ae..7e525b6f8 100644 --- a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc +++ b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.cc
@@ -11,6 +11,8 @@ #include "chrome/browser/page_info/about_this_site_service_factory.h" #include "chrome/browser/permissions/permission_manager_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/chrome_pages.h" #include "chrome/common/pref_names.h" #include "components/content_settings/core/common/content_settings_types.h" #include "components/page_info/core/about_this_site_service.h" @@ -165,6 +167,11 @@ return count > 1; } +void ChromePageInfoUiDelegate::ShowPrivacySandboxSettings() { + Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); + chrome::ShowPrivacySandboxSettings(browser); +} + std::u16string ChromePageInfoUiDelegate::GetPermissionDetail( ContentSettingsType type) { switch (type) {
diff --git a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h index 2274a7f94..666f809 100644 --- a/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h +++ b/chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h
@@ -54,6 +54,9 @@ // extra details to the user concerning the granted permission. std::u16string GetPermissionDetail(ContentSettingsType type); + // Opens "Privacy Sandbox" settings page. + void ShowPrivacySandboxSettings(); + // PageInfoUiDelegate implementation bool IsBlockAutoPlayEnabled() override; bool IsMultipleTabsOpen() override;
diff --git a/chrome/browser/ui/privacy_sandbox/DIR_METADATA b/chrome/browser/ui/privacy_sandbox/DIR_METADATA new file mode 100644 index 0000000..669e5c9 --- /dev/null +++ b/chrome/browser/ui/privacy_sandbox/DIR_METADATA
@@ -0,0 +1,5 @@ +monorail { + component: "UI>Settings>Privacy" +} + +team_email: "chrome-friendly-settings@google.com"
diff --git a/chrome/browser/ui/privacy_sandbox/OWNERS b/chrome/browser/ui/privacy_sandbox/OWNERS new file mode 100644 index 0000000..282c715 --- /dev/null +++ b/chrome/browser/ui/privacy_sandbox/OWNERS
@@ -0,0 +1 @@ +file://chrome/browser/privacy_sandbox/OWNERS
diff --git a/chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog.h b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog.h new file mode 100644 index 0000000..ceade3b0 --- /dev/null +++ b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog.h
@@ -0,0 +1,18 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_H_ +#define CHROME_BROWSER_UI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_H_ + +#include "chrome/browser/privacy_sandbox/privacy_sandbox_service.h" + +class Browser; + +// Creates and shows a dialog for |browser| displaying the Privacy Sandbox +// notice or consent to the user. Specific implementations are responsible for +// altering the content as appropriate based on |dialog_type|. +void ShowPrivacySandboxDialog(Browser* browser, + PrivacySandboxService::DialogType dialog_type); + +#endif // CHROME_BROWSER_UI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_H_
diff --git a/chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog_helper.cc b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog_helper.cc new file mode 100644 index 0000000..d2f7deb --- /dev/null +++ b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog_helper.cc
@@ -0,0 +1,70 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog_helper.h" + +#include "chrome/browser/privacy_sandbox/privacy_sandbox_service.h" +#include "chrome/browser/privacy_sandbox/privacy_sandbox_service_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog.h" +#include "content/public/browser/navigation_handle.h" +#include "content/public/browser/web_contents.h" +#include "content/public/common/url_constants.h" + +namespace { + +// Gets the type of dialog that should be displayed for |profile|, this includes +// the possibility of no dialog being required. +PrivacySandboxService::DialogType GetRequiredDialogType(Profile* profile) { + if (!profile || !profile->IsRegularProfile()) + return PrivacySandboxService::DialogType::kNone; + + auto* privacy_sandbox_serivce = + PrivacySandboxServiceFactory::GetForProfile(profile); + if (!privacy_sandbox_serivce) + return PrivacySandboxService::DialogType::kNone; + + return privacy_sandbox_serivce->GetRequiredDialogType(); +} + +} // namespace + +PrivacySandboxDialogHelper::~PrivacySandboxDialogHelper() = default; + +PrivacySandboxDialogHelper::PrivacySandboxDialogHelper( + content::WebContents* web_contents) + : WebContentsObserver(web_contents), + content::WebContentsUserData<PrivacySandboxDialogHelper>(*web_contents) {} + +void PrivacySandboxDialogHelper::DidFinishNavigation( + content::NavigationHandle* navigation_handle) { + // Ignore everything except chrome:// urls. + if (!navigation_handle || !navigation_handle->IsInMainFrame() || + !navigation_handle->GetWebContents()->GetLastCommittedURL().SchemeIs( + content::kChromeUIScheme)) { + return; + } + + // TODO(crbug.com/1286276): This logic is too simple, there are more + // circumstances on which we may not wish to show the dialog, such as sync + // consent currently in progress. + if (!ProfileRequiresDialog(profile())) + return; + + if (auto* browser = chrome::FindBrowserWithProfile(profile())) + ShowPrivacySandboxDialog(browser, GetRequiredDialogType(profile())); +} + +// static +bool PrivacySandboxDialogHelper::ProfileRequiresDialog(Profile* profile) { + return GetRequiredDialogType(profile) != + PrivacySandboxService::DialogType::kNone; +} + +Profile* PrivacySandboxDialogHelper::profile() { + return Profile::FromBrowserContext(web_contents()->GetBrowserContext()); +} + +WEB_CONTENTS_USER_DATA_KEY_IMPL(PrivacySandboxDialogHelper);
diff --git a/chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog_helper.h b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog_helper.h new file mode 100644 index 0000000..4bb1f6c8 --- /dev/null +++ b/chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog_helper.h
@@ -0,0 +1,49 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_HELPER_H_ +#define CHROME_BROWSER_UI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_HELPER_H_ + +#include "content/public/browser/web_contents_observer.h" +#include "content/public/browser/web_contents_user_data.h" + +namespace content { +class WebContents; +} + +class Profile; + +// Helper class which watches |web_contents| to determine whether there is an +// appropriate opportunity to show the PrivacySandboxDialog. Consults with the +// PrivacySandboxService to determine what type of dialog, if any, to show. +// When an appropriate time is determined, calls Show() directly to the +// PrivacySandboxDialog. +class PrivacySandboxDialogHelper + : public content::WebContentsObserver, + public content::WebContentsUserData<PrivacySandboxDialogHelper> { + public: + PrivacySandboxDialogHelper(const PrivacySandboxDialogHelper&) = delete; + PrivacySandboxDialogHelper& operator=(const PrivacySandboxDialogHelper&) = + delete; + ~PrivacySandboxDialogHelper() override; + + // Returns whether |profile| needs to be shown a Privacy Sandbox dialog. If + // this returns false, there is no need to create this helper. + static bool ProfileRequiresDialog(Profile* profile); + + private: + friend class content::WebContentsUserData<PrivacySandboxDialogHelper>; + + explicit PrivacySandboxDialogHelper(content::WebContents* web_contents); + + // contents::WebContentsObserver: + void DidFinishNavigation( + content::NavigationHandle* navigation_handle) override; + + Profile* profile(); + + WEB_CONTENTS_USER_DATA_KEY_DECL(); +}; + +#endif // CHROME_BROWSER_UI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_HELPER_H_
diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc index 5cbc5cec..5c942f5 100644 --- a/chrome/browser/ui/tab_helpers.cc +++ b/chrome/browser/ui/tab_helpers.cc
@@ -86,6 +86,7 @@ #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" #include "chrome/browser/ui/pdf/chrome_pdf_web_contents_helper_client.h" #include "chrome/browser/ui/prefs/prefs_tab_helper.h" +#include "chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog_helper.h" #include "chrome/browser/ui/recently_audible_helper.h" #include "chrome/browser/ui/search_engines/search_engine_tab_helper.h" #include "chrome/browser/ui/tab_contents/core_tab_helper.h" @@ -453,6 +454,8 @@ LastTabStandingTrackerTabHelper::CreateForWebContents(web_contents); } ManagePasswordsUIController::CreateForWebContents(web_contents); + if (PrivacySandboxDialogHelper::ProfileRequiresDialog(profile)) + PrivacySandboxDialogHelper::CreateForWebContents(web_contents); SadTabHelper::CreateForWebContents(web_contents); SearchTabHelper::CreateForWebContents(web_contents); SyncEncryptionKeysTabHelper::CreateForWebContents(web_contents);
diff --git a/chrome/browser/ui/views/page_info/page_info_ad_personalization_content_view.cc b/chrome/browser/ui/views/page_info/page_info_ad_personalization_content_view.cc index 516a522..4af448f6 100644 --- a/chrome/browser/ui/views/page_info/page_info_ad_personalization_content_view.cc +++ b/chrome/browser/ui/views/page_info/page_info_ad_personalization_content_view.cc
@@ -6,6 +6,7 @@ #include <vector> +#include "chrome/browser/ui/page_info/chrome_page_info_ui_delegate.h" #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/views/chrome_layout_provider.h" #include "chrome/browser/ui/views/chrome_typography.h" @@ -19,8 +20,9 @@ #include "ui/views/layout/flex_layout.h" PageInfoAdPersonalizationContentView::PageInfoAdPersonalizationContentView( - PageInfo* presenter) - : presenter_(presenter) { + PageInfo* presenter, + ChromePageInfoUiDelegate* ui_delegate) + : presenter_(presenter), ui_delegate_(ui_delegate) { SetLayoutManager(std::make_unique<views::FlexLayout>()) ->SetOrientation(views::LayoutOrientation::kVertical); info_container_ = AddChildView(std::make_unique<views::View>()); @@ -32,7 +34,8 @@ AddChildView(std::make_unique<PageInfoHoverButton>( base::BindRepeating( [](PageInfoAdPersonalizationContentView* view) { - // TODO(olesiamarukhno): Open settings. + // TODO(olesiamarukhno): Record metrics. + view->ui_delegate_->ShowPrivacySandboxSettings(); }, this), PageInfoViewFactory::GetSiteSettingsIcon(),
diff --git a/chrome/browser/ui/views/page_info/page_info_ad_personalization_content_view.h b/chrome/browser/ui/views/page_info/page_info_ad_personalization_content_view.h index 083bf0e..bf3cf762 100644 --- a/chrome/browser/ui/views/page_info/page_info_ad_personalization_content_view.h +++ b/chrome/browser/ui/views/page_info/page_info_ad_personalization_content_view.h
@@ -10,6 +10,7 @@ #include "components/page_info/page_info_ui.h" #include "ui/views/view.h" +class ChromePageInfoUiDelegate; class PageInfo; // The view that is used as a content view of the "Ad personalization" subpage @@ -17,16 +18,19 @@ class PageInfoAdPersonalizationContentView : public views::View, public PageInfoUI { public: - explicit PageInfoAdPersonalizationContentView(PageInfo* presenter); + explicit PageInfoAdPersonalizationContentView( + PageInfo* presenter, + ChromePageInfoUiDelegate* ui_delegate); ~PageInfoAdPersonalizationContentView() override; // PageInfoUI implementations. void SetAdPersonalizationInfo(const AdPersonalizationInfo& info) override; private: - raw_ptr<PageInfo> presenter_; + const raw_ptr<PageInfo> presenter_; + const raw_ptr<ChromePageInfoUiDelegate> ui_delegate_; - views::View* info_container_ = nullptr; + raw_ptr<views::View> info_container_ = nullptr; }; #endif // CHROME_BROWSER_UI_VIEWS_PAGE_INFO_PAGE_INFO_AD_PERSONALIZATION_CONTENT_VIEW_H_
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc index c8008118..75a3f4b8 100644 --- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc +++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
@@ -148,7 +148,8 @@ PageInfoViewFactory::CreateAdPersonalizationPageView() { return std::make_unique<PageInfoSubpageView>( CreateSubpageHeader(u"Lorem ipsum dolor"), - std::make_unique<PageInfoAdPersonalizationContentView>(presenter_)); + std::make_unique<PageInfoAdPersonalizationContentView>(presenter_, + ui_delegate_)); } std::unique_ptr<views::View> PageInfoViewFactory::CreateSubpageHeader(
diff --git a/chrome/browser/ui/views/privacy_sandbox/DIR_METADATA b/chrome/browser/ui/views/privacy_sandbox/DIR_METADATA new file mode 100644 index 0000000..7d283fa --- /dev/null +++ b/chrome/browser/ui/views/privacy_sandbox/DIR_METADATA
@@ -0,0 +1,5 @@ +monorail: { + component: "UI>Settings>Privacy" +} + +team_email: "chrome-friendly-settings@google.com"
diff --git a/chrome/browser/ui/views/privacy_sandbox/OWNERS b/chrome/browser/ui/views/privacy_sandbox/OWNERS new file mode 100644 index 0000000..282c715 --- /dev/null +++ b/chrome/browser/ui/views/privacy_sandbox/OWNERS
@@ -0,0 +1 @@ +file://chrome/browser/privacy_sandbox/OWNERS
diff --git a/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_dialog_view.cc b/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_dialog_view.cc new file mode 100644 index 0000000..540ec7c --- /dev/null +++ b/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_dialog_view.cc
@@ -0,0 +1,73 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_dialog_view.h" + +#include "chrome/browser/privacy_sandbox/privacy_sandbox_service.h" +#include "chrome/browser/ui/privacy_sandbox/privacy_sandbox_dialog.h" +#include "chrome/browser/ui/views/frame/app_menu_button.h" +#include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/views/frame/toolbar_button_provider.h" +#include "chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.h" +#include "chrome/common/webui_url_constants.h" +#include "components/constrained_window/constrained_window_views.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_ui.h" +#include "ui/base/metadata/metadata_impl_macros.h" +#include "ui/views/layout/fill_layout.h" + +namespace { + +// TODO(crbug.com/1286276) - Figure out the appropriate sizes. +constexpr int kDialogWidth = 500; +constexpr int kDialogHeight = 500; + +} // namespace + +// static +void ShowPrivacySandboxDialog(Browser* browser, + PrivacySandboxService::DialogType dialog_type) { + auto dialog = + std::make_unique<PrivacySandboxDialogView>(browser, dialog_type); + constrained_window::CreateBrowserModalDialogViews( + std::move(dialog), browser->window()->GetNativeWindow()) + ->Show(); +} + +PrivacySandboxDialogView::PrivacySandboxDialogView( + Browser* browser, + PrivacySandboxService::DialogType dialog_type) { + // Create the web view in the native bubble. + auto* web_view = + AddChildView(std::make_unique<views::WebView>(browser->profile())); + web_view->LoadInitialURL(GURL(chrome::kChromeUIPrivacySandboxDialogURL)); + + auto width = + views::LayoutProvider::Get()->GetSnappedDialogWidth(kDialogWidth); + web_view->SetPreferredSize({width, kDialogHeight}); + + // TODO(crbug.com/1286276): Provide dialog type to WebUI so it can present + // the correct content. + PrivacySandboxDialogUI* web_ui = web_view->GetWebContents() + ->GetWebUI() + ->GetController() + ->GetAs<PrivacySandboxDialogUI>(); + SetInitiallyFocusedView(web_view); + DCHECK(web_ui); + // Unretained is fine because this outlives the inner web UI. + web_ui->Initialize( + base::BindOnce(&PrivacySandboxDialogView::Close, base::Unretained(this))); + + SetButtons(ui::DIALOG_BUTTON_NONE); + SetModalType(ui::MODAL_TYPE_WINDOW); + SetShowCloseButton(false); + SetUseDefaultFillLayout(true); +} + +void PrivacySandboxDialogView::Close() { + GetWidget()->Close(); +} + +BEGIN_METADATA(PrivacySandboxDialogView, views::DialogDelegateView) +END_METADATA
diff --git a/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_dialog_view.h b/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_dialog_view.h new file mode 100644 index 0000000..045a607 --- /dev/null +++ b/chrome/browser/ui/views/privacy_sandbox/privacy_sandbox_dialog_view.h
@@ -0,0 +1,25 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_VIEWS_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_VIEW_H_ +#define CHROME_BROWSER_UI_VIEWS_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_VIEW_H_ + +#include "chrome/browser/privacy_sandbox/privacy_sandbox_service.h" +#include "ui/base/metadata/metadata_header_macros.h" +#include "ui/views/window/dialog_delegate.h" + +class Browser; + +// Implements the PrivacySandboxDialog as a View. The view contains a WebView +// into which is loaded a WebUI page which renders the actual dialog content. +class PrivacySandboxDialogView : public views::DialogDelegateView { + public: + METADATA_HEADER(PrivacySandboxDialogView); + PrivacySandboxDialogView(Browser* browser, + PrivacySandboxService::DialogType dialog_type); + + void Close(); +}; + +#endif // CHROME_BROWSER_UI_VIEWS_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_VIEW_H_
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc index 671b7eef..109bcc0 100644 --- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc +++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -350,7 +350,9 @@ void BrowserTabStripController::ToggleTabAudioMute(int model_index) { content::WebContents* const contents = model_->GetWebContentsAt(model_index); - chrome::SetTabAudioMuted(contents, !contents->IsAudioMuted(), + bool mute_tab = !contents->IsAudioMuted(); + UMA_HISTOGRAM_BOOLEAN("Media.Audio.TabAudioMuted", mute_tab); + chrome::SetTabAudioMuted(contents, mute_tab, TabMutedReason::AUDIO_INDICATOR, std::string()); }
diff --git a/chrome/browser/ui/webui/about_ui.cc b/chrome/browser/ui/webui/about_ui.cc index 64389427..c287144 100644 --- a/chrome/browser/ui/webui/about_ui.cc +++ b/chrome/browser/ui/webui/about_ui.cc
@@ -816,7 +816,7 @@ #else // Note: This will only be called by the UI when Lacros is available. DCHECK(crosapi::BrowserManager::Get()); - crosapi::BrowserManager::Get()->OpenUrl(GURL(chrome::kChromeUIAboutURL)); + crosapi::BrowserManager::Get()->SwitchToTab(GURL(chrome::kChromeUIAboutURL)); #endif return true; }
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc index 35540080..6d07380 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -140,6 +140,7 @@ #include "chrome/browser/ui/webui/new_tab_page_third_party/new_tab_page_third_party_ui.h" #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" #include "chrome/browser/ui/webui/page_not_available_for_guest/page_not_available_for_guest_ui.h" +#include "chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.h" #include "chrome/browser/ui/webui/read_later/read_later_ui.h" #include "chrome/browser/ui/webui/settings/settings_ui.h" #include "chrome/browser/ui/webui/settings/settings_utils.h" @@ -1200,6 +1201,11 @@ return &NewWebUI<chromeos::cfm::NetworkSettingsDialogUi>; #endif // BUILDFLAG(PLATFORM_CFM) +#if !BUILDFLAG(IS_ANDROID) + if (url.host_piece() == chrome::kChromeUIPrivacySandboxDialogHost) + return &NewWebUI<PrivacySandboxDialogUI>; +#endif // !BUILDFLAG(IS_ANDROID) + return nullptr; }
diff --git a/chrome/browser/ui/webui/components/components_handler.cc b/chrome/browser/ui/webui/components/components_handler.cc index 5feac0e..bf219a1 100644 --- a/chrome/browser/ui/webui/components/components_handler.cc +++ b/chrome/browser/ui/webui/components/components_handler.cc
@@ -180,7 +180,8 @@ #else // Note: This will only be called by the UI when Lacros is available. DCHECK(crosapi::BrowserManager::Get()); - crosapi::BrowserManager::Get()->OpenUrl(GURL(chrome::kChromeUIComponentsUrl)); + crosapi::BrowserManager::Get()->SwitchToTab( + GURL(chrome::kChromeUIComponentsUrl)); #endif } #endif // BUILDFLAG(IS_CHROMEOS)
diff --git a/chrome/browser/ui/webui/privacy_sandbox/DIR_METADATA b/chrome/browser/ui/webui/privacy_sandbox/DIR_METADATA new file mode 100644 index 0000000..7d283fa --- /dev/null +++ b/chrome/browser/ui/webui/privacy_sandbox/DIR_METADATA
@@ -0,0 +1,5 @@ +monorail: { + component: "UI>Settings>Privacy" +} + +team_email: "chrome-friendly-settings@google.com"
diff --git a/chrome/browser/ui/webui/privacy_sandbox/OWNERS b/chrome/browser/ui/webui/privacy_sandbox/OWNERS new file mode 100644 index 0000000..0bab1928 --- /dev/null +++ b/chrome/browser/ui/webui/privacy_sandbox/OWNERS
@@ -0,0 +1,3 @@ +# Chrome Privacy Team +rainhard@chromium.org +sauski@google.com
diff --git a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.cc b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.cc new file mode 100644 index 0000000..f7ef00a --- /dev/null +++ b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.cc
@@ -0,0 +1,26 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.h" + +PrivacySandboxDialogHandler::PrivacySandboxDialogHandler( + base::OnceClosure close_callback) + : close_callback_(std::move(close_callback)) {} + +PrivacySandboxDialogHandler::~PrivacySandboxDialogHandler() { + DisallowJavascript(); +} + +void PrivacySandboxDialogHandler::RegisterMessages() { + web_ui()->RegisterDeprecatedMessageCallback( + "closeDialog", + base::BindRepeating(&PrivacySandboxDialogHandler::HandleCloseDialog, + base::Unretained(this))); +} + +void PrivacySandboxDialogHandler::HandleCloseDialog( + const base::ListValue* args) { + if (close_callback_) + std::move(close_callback_).Run(); +}
diff --git a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.h b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.h new file mode 100644 index 0000000..9d7e60a4 --- /dev/null +++ b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.h
@@ -0,0 +1,26 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_WEBUI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_HANDLER_H_ +#define CHROME_BROWSER_UI_WEBUI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_HANDLER_H_ + +#include "chrome/browser/profiles/profile.h" +#include "content/public/browser/web_ui.h" +#include "content/public/browser/web_ui_message_handler.h" + +class PrivacySandboxDialogHandler : public content::WebUIMessageHandler { + public: + explicit PrivacySandboxDialogHandler(base::OnceClosure close_callback); + ~PrivacySandboxDialogHandler() override; + + // content::WebUIMessageHandler: + void RegisterMessages() override; + + protected: + void HandleCloseDialog(const base::ListValue* args); + + base::OnceClosure close_callback_; +}; + +#endif // CHROME_BROWSER_UI_WEBUI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_HANDLER_H_
diff --git a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.cc b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.cc new file mode 100644 index 0000000..0755ea3 --- /dev/null +++ b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.cc
@@ -0,0 +1,38 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.h" + +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_handler.h" +#include "chrome/browser/ui/webui/webui_util.h" +#include "chrome/common/webui_url_constants.h" +#include "chrome/grit/privacy_sandbox_resources.h" +#include "chrome/grit/privacy_sandbox_resources_map.h" +#include "content/public/browser/web_ui.h" +#include "content/public/browser/web_ui_data_source.h" +#include "ui/base/webui/web_ui_util.h" + +PrivacySandboxDialogUI::PrivacySandboxDialogUI(content::WebUI* web_ui) + : content::WebUIController(web_ui) { + auto* source = content::WebUIDataSource::Create( + chrome::kChromeUIPrivacySandboxDialogHost); + + webui::SetupWebUIDataSource( + source, + base::make_span(kPrivacySandboxResources, kPrivacySandboxResourcesSize), + IDR_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_HTML); + + content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source); +} + +PrivacySandboxDialogUI::~PrivacySandboxDialogUI() = default; + +void PrivacySandboxDialogUI::Initialize(base::OnceClosure close_callback) { + auto handler = + std::make_unique<PrivacySandboxDialogHandler>(std::move(close_callback)); + web_ui()->AddMessageHandler(std::move(handler)); +} + +WEB_UI_CONTROLLER_TYPE_IMPL(PrivacySandboxDialogUI)
diff --git a/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.h b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.h new file mode 100644 index 0000000..d3c3874 --- /dev/null +++ b/chrome/browser/ui/webui/privacy_sandbox/privacy_sandbox_dialog_ui.h
@@ -0,0 +1,23 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_UI_WEBUI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_UI_H_ +#define CHROME_BROWSER_UI_WEBUI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_UI_H_ + +#include "content/public/browser/web_ui_controller.h" + +// WebUI which is shown to the user as part of the PrivacySandboxDialog. +class PrivacySandboxDialogUI : public content::WebUIController { + public: + explicit PrivacySandboxDialogUI(content::WebUI* web_ui); + ~PrivacySandboxDialogUI() override; + + // content::WebUIController + void Initialize(base::OnceClosure close_callback); + + private: + WEB_UI_CONTROLLER_TYPE_DECL(); +}; + +#endif // CHROME_BROWSER_UI_WEBUI_PRIVACY_SANDBOX_PRIVACY_SANDBOX_DIALOG_UI_H_
diff --git a/chrome/browser/ui/webui/signin/inline_login_ui.cc b/chrome/browser/ui/webui/signin/inline_login_ui.cc index 323cfab..a56bfff 100644 --- a/chrome/browser/ui/webui/signin/inline_login_ui.cc +++ b/chrome/browser/ui/webui/signin/inline_login_ui.cc
@@ -159,6 +159,7 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) {"title", IDS_ACCOUNT_MANAGER_DIALOG_TITLE}, {"ok", IDS_APP_OK}, + {"nextButtonLabel", IDS_ACCOUNT_MANAGER_DIALOG_NEXT_BUTTON}, {"accountManagerDialogWelcomeTitle", IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_TITLE}, {"accountManagerDialogWelcomeCheckbox", @@ -183,13 +184,14 @@ source->AddBoolean( "isArcAccountRestrictionsEnabled", ash::AccountAppsAvailability::IsArcAccountRestrictionsEnabled()); + // The "Apps Settings" link points to Apps > Manage your apps. source->AddString( "accountManagerDialogArcToggleLabel", l10n_util::GetStringFUTF16( IDS_ACCOUNT_MANAGER_DIALOG_ARC_TOGGLE_LABEL, base::UTF8ToUTF16( chrome::GetOSSettingsUrl( - chromeos::settings::mojom::kGooglePlayStoreSubpagePath) + chromeos::settings::mojom::kAppManagementSubpagePath) .spec()))); source->AddString( "accountManagerDialogArcAccountPickerBody", @@ -202,22 +204,33 @@ source->AddBoolean("shouldSkipWelcomePage", profile->GetPrefs()->GetBoolean( chromeos::prefs::kShouldSkipInlineLoginWelcomePage)); - bool is_incognito_enabled = - (IncognitoModePrefs::GetAvailability(profile->GetPrefs()) != - IncognitoModePrefs::Availability::kDisabled); - int message_id = - is_incognito_enabled - ? IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY - : IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_WITHOUT_INCOGNITO; - source->AddString( - "accountManagerDialogWelcomeBody", - l10n_util::GetStringFUTF16( - message_id, - base::UTF8ToUTF16( - chrome::GetOSSettingsUrl( - chromeos::settings::mojom::kMyAccountsSubpagePath) - .spec()), - ui::GetChromeOSDeviceName())); + if (ash::AccountAppsAvailability::IsArcAccountRestrictionsEnabled()) { + source->AddString( + "accountManagerDialogWelcomeBody", + l10n_util::GetStringFUTF16( + IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_V2, + base::UTF8ToUTF16( + chrome::GetOSSettingsUrl( + chromeos::settings::mojom::kMyAccountsSubpagePath) + .spec()))); + } else { + bool is_incognito_enabled = + (IncognitoModePrefs::GetAvailability(profile->GetPrefs()) != + IncognitoModePrefs::Availability::kDisabled); + int message_id = + is_incognito_enabled + ? IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY + : IDS_ACCOUNT_MANAGER_DIALOG_WELCOME_BODY_WITHOUT_INCOGNITO; + source->AddString( + "accountManagerDialogWelcomeBody", + l10n_util::GetStringFUTF16( + message_id, + base::UTF8ToUTF16( + chrome::GetOSSettingsUrl( + chromeos::settings::mojom::kMyAccountsSubpagePath) + .spec()), + ui::GetChromeOSDeviceName())); + } user_manager::User* user = ash::ProfileHelper::Get()->GetUserByProfile(profile);
diff --git a/chrome/browser/ui/webui/version/version_handler_chromeos.cc b/chrome/browser/ui/webui/version/version_handler_chromeos.cc index bd851e1..938edeb 100644 --- a/chrome/browser/ui/webui/version/version_handler_chromeos.cc +++ b/chrome/browser/ui/webui/version/version_handler_chromeos.cc
@@ -77,7 +77,8 @@ #else // Note: This will only be called by the UI when Lacros is available. DCHECK(crosapi::BrowserManager::Get()); - crosapi::BrowserManager::Get()->OpenUrl(GURL(chrome::kChromeUIVersionURL)); + crosapi::BrowserManager::Get()->SwitchToTab( + GURL(chrome::kChromeUIVersionURL)); #endif }
diff --git a/chrome/build/mac-arm.pgo.txt b/chrome/build/mac-arm.pgo.txt index 9735789..e8ce158 100644 --- a/chrome/build/mac-arm.pgo.txt +++ b/chrome/build/mac-arm.pgo.txt
@@ -1 +1 @@ -chrome-mac-arm-main-1643241442-559d26622d9b0d93f5e5d45bcc61e9a6ac75bd43.profdata +chrome-mac-arm-main-1643284754-95e64ca29eb53e4d882fc2eecd37abeaef1d7e33.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 4b087325..2d940af 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1643241442-206b6f77eafd6fd81e9207ff4f7d588b75ccac02.profdata +chrome-mac-main-1643263044-90c8dc6624fef5f0789e1e61a1dd9657945fea1a.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 6193d27..850b282 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1643252331-8af7cc0df0c5e0184bafc0c734e8bbc45108a009.profdata +chrome-win32-main-1643273519-7180bb615f46ba8b29f7955fc6feeba449e8d5b5.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 56e1cbc..e8feec3 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1643219901-644e8aa6a12c8ec61087ffe109cd8e439c295dc6.profdata +chrome-win64-main-1643263044-602b6f7a4f5a58f3b1dd41d244d89d4368f58926.profdata
diff --git a/chrome/chrome_paks.gni b/chrome/chrome_paks.gni index 18c8564b..8efd7742 100644 --- a/chrome/chrome_paks.gni +++ b/chrome/chrome_paks.gni
@@ -151,6 +151,7 @@ "$root_gen_dir/chrome/new_tab_page_instant_resources.pak", "$root_gen_dir/chrome/new_tab_page_resources.pak", "$root_gen_dir/chrome/new_tab_page_third_party_resources.pak", + "$root_gen_dir/chrome/privacy_sandbox_resources.pak", "$root_gen_dir/chrome/read_later_resources.pak", "$root_gen_dir/chrome/settings_resources.pak", "$root_gen_dir/chrome/signin_resources.pak", @@ -179,6 +180,7 @@ "//chrome/browser/resources/new_tab_page:resources", "//chrome/browser/resources/new_tab_page_instant:resources", "//chrome/browser/resources/new_tab_page_third_party:resources", + "//chrome/browser/resources/privacy_sandbox:resources", "//chrome/browser/resources/read_later:resources", "//chrome/browser/resources/settings:resources", "//chrome/browser/resources/signin:resources",
diff --git a/chrome/common/extensions/api/passwords_private.idl b/chrome/common/extensions/api/passwords_private.idl index bbed9d5..4ed095f 100644 --- a/chrome/common/extensions/api/passwords_private.idl +++ b/chrome/common/extensions/api/passwords_private.idl
@@ -130,6 +130,9 @@ // The type of the credentials that was compromised. CompromiseType compromiseType; + + // Indicates whether this credential is muted. + boolean isMuted; }; // Information about an insecure credential and relevant information required @@ -358,6 +361,11 @@ InsecureCredential credential, optional VoidCallback callback); + // Requests to mute |credential| from the password store. + // Invokes |callback| on completion. + [supportsPromises] static void muteInsecureCredential( + InsecureCredential credential, optional VoidCallback callback); + // Starts a check for insecure passwords. Invokes |callback| on completion. [supportsPromises] static void startPasswordCheck( optional VoidCallback callback);
diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc index 385ab18..926ea21 100644 --- a/chrome/common/webui_url_constants.cc +++ b/chrome/common/webui_url_constants.cc
@@ -152,6 +152,9 @@ const char kChromeUIPredictorsHost[] = "predictors"; const char kChromeUIPrefsInternalsHost[] = "prefs-internals"; const char kChromeUIPrintURL[] = "chrome://print/"; +const char kChromeUIPrivacySandboxDialogHost[] = "privacy-sandbox-dialog"; +const char kChromeUIPrivacySandboxDialogURL[] = + "chrome://privacy-sandbox-dialog"; const char kChromeUIQuitHost[] = "quit"; const char kChromeUIQuitURL[] = "chrome://quit/"; // TODO(crbug.com/1202165): Remove when new quota-internals page is done. @@ -541,6 +544,7 @@ const char kCreateProfileSubPage[] = "createProfile"; const char kManageProfileSubPage[] = "manageProfile"; const char kPeopleSubPage[] = "people"; +const char kPrivacySandboxSubPage[] = "privacySandbox"; #if !BUILDFLAG(IS_ANDROID) const char kPrivacySandboxSubPagePath[] = "/privacySandbox";
diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h index cc9fe23..7e6a109 100644 --- a/chrome/common/webui_url_constants.h +++ b/chrome/common/webui_url_constants.h
@@ -152,6 +152,8 @@ extern const char kChromeUIPredictorsHost[]; extern const char kChromeUIPrefsInternalsHost[]; extern const char kChromeUIPrintURL[]; +extern const char kChromeUIPrivacySandboxDialogHost[]; +extern const char kChromeUIPrivacySandboxDialogURL[]; extern const char kChromeUIQuitHost[]; extern const char kChromeUIQuitURL[]; // TODO(crbug.com/1202165): Remove when new quota-internals page is done. @@ -485,6 +487,7 @@ extern const char kSignOutSubPage[]; extern const char kSyncSetupSubPage[]; extern const char kTriggeredResetProfileSettingsSubPage[]; +extern const char kPrivacySandboxSubPage[]; #if !BUILDFLAG(IS_ANDROID) extern const char kPrivacySandboxSubPagePath[];
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/tabmodel/MockTabCreator.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/tabmodel/MockTabCreator.java index 5d2edad4..5da9fa0 100644 --- a/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/tabmodel/MockTabCreator.java +++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/util/browser/tabmodel/MockTabCreator.java
@@ -15,6 +15,7 @@ import org.chromium.chrome.browser.tab.TabLaunchType; import org.chromium.chrome.browser.tab.TabState; import org.chromium.chrome.browser.tab.TabTestUtils; +import org.chromium.chrome.browser.tab.state.CriticalPersistedTabData; import org.chromium.chrome.browser.tabmodel.TabCreator; import org.chromium.chrome.browser.tabmodel.TabModel; import org.chromium.chrome.browser.tabmodel.TabModelSelector; @@ -60,11 +61,17 @@ } @Override - public Tab createFrozenTab(TabState state, ByteBuffer criticalPersistedTabData, int id, - boolean isIncognito, int index) { - Tab tab = new MockTab(id, state.isIncognito(), TabLaunchType.FROM_RESTORE); + public Tab createFrozenTab(TabState state, ByteBuffer serializedCriticalPersistedTabData, + int id, boolean isIncognito, int index) { + Tab tab = new MockTab(id, isIncognito, TabLaunchType.FROM_RESTORE); tab.getUserDataHost().setUserData(MockTabAttributes.class, new MockTabAttributes(true)); - TabTestUtils.restoreFieldsFromState(tab, state); + if (state != null) TabTestUtils.restoreFieldsFromState(tab, state); + if (!CriticalPersistedTabData.isEmptySerialization(serializedCriticalPersistedTabData)) { + CriticalPersistedTabData criticalPersistedTabData = new CriticalPersistedTabData(tab); + criticalPersistedTabData.deserializeAndLog(serializedCriticalPersistedTabData); + tab.getUserDataHost().setUserData( + CriticalPersistedTabData.class, criticalPersistedTabData); + } mSelector.getModel(mIsIncognito) .addTab(tab, index, TabLaunchType.FROM_RESTORE, TabCreationState.FROZEN_ON_RESTORE); storeTabInfo(state, id);
diff --git a/chrome/test/data/extensions/api_test/passwords_private/test.js b/chrome/test/data/extensions/api_test/passwords_private/test.js index d91f58a..2af897a6 100644 --- a/chrome/test/data/extensions/api_test/passwords_private/test.js +++ b/chrome/test/data/extensions/api_test/passwords_private/test.js
@@ -425,6 +425,7 @@ compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', + isMuted: false, }, }; @@ -448,6 +449,7 @@ compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', + isMuted: false, }, }; @@ -474,6 +476,7 @@ compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', + isMuted: false, }, }, '', () => { @@ -497,6 +500,7 @@ compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', + isMuted: false, }, }, 'new_pass', () => { @@ -520,6 +524,7 @@ compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', + isMuted: false, }, }, 'new_pass', () => { @@ -541,6 +546,7 @@ compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', + isMuted: false, }, }, () => { @@ -565,6 +571,7 @@ compromiseTime: COMPROMISE_TIME, elapsedTimeSinceCompromise: '3 days ago', compromiseType: 'LEAKED', + isMuted: false, }, }, () => { @@ -574,6 +581,54 @@ }); }, + function muteInsecureCredentialSucceeds() { + chrome.passwordsPrivate.muteInsecureCredential( + { + id: 0, + formattedOrigin: 'example.com', + detailedOrigin: 'https://example.com', + isAndroidCredential: false, + signonRealm: 'https://example.com', + username: 'alice', + compromisedInfo: { + compromiseTime: COMPROMISE_TIME, + elapsedTimeSinceCompromise: '3 days ago', + compromiseType: 'LEAKED', + isMuted: false, + }, + }, + () => { + chrome.test.assertNoLastError(); + // Ensure that the callback is invoked. + chrome.test.succeed(); + }); + }, + + function muteInsecureCredentialFails() { + chrome.passwordsPrivate.muteInsecureCredential( + { + id: 0, + formattedOrigin: 'example.com', + detailedOrigin: 'https://example.com', + isAndroidCredential: false, + signonRealm: 'https://example.com', + username: 'alice', + compromisedInfo: { + compromiseTime: COMPROMISE_TIME, + elapsedTimeSinceCompromise: '3 days ago', + compromiseType: 'LEAKED', + isMuted: false, + }, + }, + () => { + chrome.test.assertLastError( + 'Could not mute the insecure credential. Probably no ' + + 'matching password could be found.'); + // Ensure that the callback is invoked. + chrome.test.succeed(); + }); + }, + function startPasswordCheck() { chrome.passwordsPrivate.startPasswordCheck(() => { chrome.test.assertNoLastError();
diff --git a/chrome/test/data/policy/policy_test_cases.json b/chrome/test/data/policy/policy_test_cases.json index 991abb4..eba8747b6 100644 --- a/chrome/test/data/policy/policy_test_cases.json +++ b/chrome/test/data/policy/policy_test_cases.json
@@ -127,7 +127,28 @@ }, "prefs": { "browser.default_browser_setting_enabled": { - "location": "local_state" + "location": "local_state", + "value": true + } + } + }, + { + "policies": { + "DefaultBrowserSettingEnabled": false + }, + "prefs": { + "browser.default_browser_setting_enabled": { + "location": "local_state", + "value": false + } + } + }, + { + "policies": {}, + "prefs": { + "browser.default_browser_setting_enabled": { + "location": "local_state", + "default_value": false } } } @@ -1180,11 +1201,34 @@ ], "policy_pref_mapping_tests": [ { + "policies": {}, + "prefs": { + "native_notifications.allowed": { + "location": "user_profile", + "default_value": true + } + } + }, + { "policies": { "AllowNativeNotifications": true }, "prefs": { - "native_notifications.allowed": {} + "native_notifications.allowed": { + "location": "user_profile", + "value": true + } + } + }, + { + "policies": { + "AllowNativeNotifications": false + }, + "prefs": { + "native_notifications.allowed": { + "location": "user_profile", + "value": false + } } } ] @@ -1195,11 +1239,34 @@ ], "policy_pref_mapping_tests": [ { + "policies": {}, + "prefs": { + "system_notifications.allowed": { + "location": "user_profile", + "default_value": true + } + } + }, + { "policies": { "AllowSystemNotifications": true }, "prefs": { - "system_notifications.allowed": {} + "system_notifications.allowed": { + "location": "user_profile", + "value": true + } + } + }, + { + "policies": { + "AllowSystemNotifications": false + }, + "prefs": { + "system_notifications.allowed": { + "location": "user_profile", + "value": false + } } } ] @@ -1976,11 +2043,34 @@ "can_be_recommended": true, "policy_pref_mapping_tests": [ { + "policies": {}, + "prefs": { + "plugins.always_open_pdf_externally": { + "location": "user_profile", + "default_value": false + } + } + }, + { "policies": { "AlwaysOpenPdfExternally": true }, "prefs": { - "plugins.always_open_pdf_externally": {} + "plugins.always_open_pdf_externally": { + "location": "user_profile", + "value": true + } + } + }, + { + "policies": { + "AlwaysOpenPdfExternally": false + }, + "prefs": { + "plugins.always_open_pdf_externally": { + "location": "user_profile", + "value": false + } } } ] @@ -5988,9 +6078,28 @@ }, "prefs": { "select_file_dialogs.allowed": { - "location": "local_state" + "location": "local_state", + "value": false }, - "download.prompt_for_download": {} + "download.prompt_for_download": { + "check_for_recommended": false, + "value": false + } + } + }, + { + "policies": { + "AllowFileSelectionDialogs": true + }, + "prefs": { + "select_file_dialogs.allowed": { + "location": "local_state", + "value": true + }, + "download.prompt_for_download": { + "check_for_recommended": false, + "default_value": false + } } } ]
diff --git a/chrome/test/data/webui/extensions/BUILD.gn b/chrome/test/data/webui/extensions/BUILD.gn index 787f1b5..5c89110 100644 --- a/chrome/test/data/webui/extensions/BUILD.gn +++ b/chrome/test/data/webui/extensions/BUILD.gn
@@ -37,10 +37,10 @@ "manager_unit_test.js", "manager_unit_test_with_activity_log_flag.js", "navigation_helper_test.js", - "options_dialog_test.js", + "options_dialog_test.ts", "pack_dialog_test.ts", - "runtime_host_permissions_test.js", - "runtime_hosts_dialog_test.js", + "runtime_host_permissions_test.ts", + "runtime_hosts_dialog_test.ts", "shortcut_input_test.ts", "sidebar_test.ts", "test_service.ts", @@ -94,8 +94,9 @@ deps = [ "//chrome/browser/resources/extensions:build_ts" ] definitions = [ - "//tools/typescript/definitions/developer_private.d.ts", "//tools/typescript/definitions/activity_log_private.d.ts", + "//tools/typescript/definitions/developer_private.d.ts", + "//tools/typescript/definitions/metrics_private.d.ts", ] extra_deps = [ ":copy",
diff --git a/chrome/test/data/webui/extensions/options_dialog_test.js b/chrome/test/data/webui/extensions/options_dialog_test.ts similarity index 66% rename from chrome/test/data/webui/extensions/options_dialog_test.js rename to chrome/test/data/webui/extensions/options_dialog_test.ts index 870a6b4..ae8ee11 100644 --- a/chrome/test/data/webui/extensions/options_dialog_test.js +++ b/chrome/test/data/webui/extensions/options_dialog_test.ts
@@ -3,24 +3,25 @@ // found in the LICENSE file. /** @fileoverview Suite of tests for extension-options-dialog. */ -import {OptionsDialogMaxHeight, OptionsDialogMinWidth, Service} from 'chrome://extensions/extensions.js'; +import 'chrome://extensions/extensions.js'; +import {ExtensionsOptionsDialogElement, OptionsDialogMaxHeight, OptionsDialogMinWidth, Service} from 'chrome://extensions/extensions.js'; import {assert} from 'chrome://resources/js/assert.m.js'; +import {assertEquals, assertFalse, assertGE, assertLE, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {eventToPromise} from 'chrome://webui-test/test_util.js'; -window.extension_options_dialog_tests = {}; -extension_options_dialog_tests.suiteName = 'ExtensionOptionsDialogTests'; -/** @enum {string} */ -extension_options_dialog_tests.TestNames = { - Layout: 'Layout', +const extension_options_dialog_tests = { + suiteName: 'ExtensionOptionsDialogTests', + TestNames: { + Layout: 'Layout', + }, }; -suite(extension_options_dialog_tests.suiteName, function() { - /** @type {ExtensionsOptionsDialogElement} */ - let optionsDialog; +Object.assign(window, {extension_options_dialog_tests}); - /** @type {chrome.developerPrivate.ExtensionInfo} */ - let data; +suite(extension_options_dialog_tests.suiteName, function() { + let optionsDialog: ExtensionsOptionsDialogElement; + let data: chrome.developerPrivate.ExtensionInfo; setup(function() { document.body.innerHTML = ''; @@ -30,11 +31,11 @@ const service = Service.getInstance(); return service.getExtensionsInfo().then(function(info) { assertEquals(1, info.length); - data = info[0]; + data = info[0]!; }); }); - function isDialogVisible() { + function isDialogVisible(): boolean { const dialogElement = optionsDialog.$.dialog.getNative(); const rect = dialogElement.getBoundingClientRect(); return rect.width * rect.height > 0; @@ -58,12 +59,10 @@ assertLE(rect.height, OptionsDialogMaxHeight); // This is the header height with default font size. assertGE(rect.height, 68); - - assertEquals( - data.name, - assert(optionsDialog.shadowRoot.querySelector( - '#icon-and-name-wrapper span')) - .textContent.trim()); + const nameElement = optionsDialog.shadowRoot!.querySelector( + '#icon-and-name-wrapper span'); + assertTrue(!!nameElement); + assertEquals(data.name, nameElement.textContent!.trim()); }); }); });
diff --git a/chrome/test/data/webui/extensions/runtime_host_permissions_test.js b/chrome/test/data/webui/extensions/runtime_host_permissions_test.js deleted file mode 100644 index 43721e5..0000000 --- a/chrome/test/data/webui/extensions/runtime_host_permissions_test.js +++ /dev/null
@@ -1,389 +0,0 @@ -// Copyright 2018 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 'chrome://extensions/extensions.js'; - -import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; -import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - -import {eventToPromise, isChildVisible} from 'chrome://webui-test/test_util.js'; - -import {TestService} from './test_service.js'; -import {MetricsPrivateMock} from './test_util.js'; - -suite('RuntimeHostPermissions', function() { - /** @type {RuntimeHostPermissionsElement} */ let element; - /** @type {TestService} */ let delegate; - /** @type {Function} */ let getUserActionCount; - - const HostAccess = chrome.developerPrivate.HostAccess; - const ITEM_ID = 'a'.repeat(32); - - setup(function() { - document.body.innerHTML = ''; - element = document.createElement('extensions-runtime-host-permissions'); - delegate = new TestService(); - element.delegate = delegate; - element.itemId = ITEM_ID; - element.enableEnhancedSiteControls = false; - - document.body.appendChild(element); - - chrome.metricsPrivate = new MetricsPrivateMock(); - // For convenience, we define a shorter name to call getUserActionCount - // with. - getUserActionCount = (...args) => - chrome.metricsPrivate.getUserActionCount(...args); - }); - - teardown(function() { - element.remove(); - }); - - test('permissions display', function() { - const permissions = { - hostAccess: HostAccess.ON_CLICK, - hasAllHosts: true, - hosts: [{granted: false, host: 'https://*/*'}], - }; - - element.set('permissions', permissions); - flush(); - - const testIsVisible = isChildVisible.bind(null, element); - expectTrue(testIsVisible('#host-access')); - - const selectHostAccess = element.shadowRoot.querySelector('#host-access'); - expectEquals(HostAccess.ON_CLICK, selectHostAccess.value); - // For on-click mode, there should be no runtime hosts listed. - expectFalse(testIsVisible('#hosts')); - - // Changing the data's access should change the UI appropriately. - element.set('permissions.hostAccess', HostAccess.ON_ALL_SITES); - flush(); - expectEquals(HostAccess.ON_ALL_SITES, selectHostAccess.value); - expectFalse(testIsVisible('#hosts')); - - // Setting the mode to on specific sites should display the runtime hosts - // list. - element.set('permissions.hostAccess', HostAccess.ON_SPECIFIC_SITES); - element.set('permissions.hosts', [ - {host: 'https://example.com', granted: true}, - {host: 'https://chromium.org', granted: true} - ]); - flush(); - expectEquals(HostAccess.ON_SPECIFIC_SITES, selectHostAccess.value); - expectTrue(testIsVisible('#hosts')); - // Expect three entries in the list: the two hosts + the add-host button. - expectEquals( - 3, - element.shadowRoot.querySelector('#hosts') - .getElementsByTagName('li') - .length); - expectTrue(testIsVisible('#add-host')); - }); - - test('permissions display new site access menu', function() { - loadTimeData.overrideValues({extensionsMenuAccessControlEnabled: true}); - const permissions = { - hostAccess: HostAccess.ON_CLICK, - hasAllHosts: true, - hosts: [{granted: false, host: 'https://*/*'}], - }; - - element.set('permissions', permissions); - flush(); - - const testIsVisible = isChildVisible.bind(null, element); - expectTrue(testIsVisible('#host-access')); - - const selectHostAccess = element.shadowRoot.querySelector('#host-access'); - expectEquals(HostAccess.ON_CLICK, selectHostAccess.value); - // For on-click mode, there should be no runtime hosts listed. - expectFalse(testIsVisible('#hosts')); - - // Changing the data's access should change the UI appropriately. - element.set('permissions.hostAccess', HostAccess.ON_ALL_SITES); - flush(); - expectEquals(HostAccess.ON_ALL_SITES, selectHostAccess.value); - expectFalse(testIsVisible('#hosts')); - - element.set('permissions.hostAccess', HostAccess.ON_SPECIFIC_SITES); - flush(); - expectEquals(HostAccess.ON_SPECIFIC_SITES, selectHostAccess.value); - // TODO(crbug.com/1253673): Test the new "customize for each site" menu. - }); - - test('permissions selection', async () => { - const permissions = { - hostAccess: HostAccess.ON_CLICK, - hasAllHosts: true, - hosts: [{granted: false, host: 'https://*.com/*'}], - }; - - element.set('permissions', permissions); - flush(); - - const selectHostAccess = element.shadowRoot.querySelector('#host-access'); - assertTrue(!!selectHostAccess); - - // Changes the value of the selectHostAccess menu and fires the change - // event, then verifies that the delegate was called with the correct - // value. - function expectDelegateCallOnAccessChange(newValue) { - selectHostAccess.value = newValue; - selectHostAccess.dispatchEvent(new CustomEvent('change')); - return delegate.whenCalled('setItemHostAccess').then((args) => { - expectEquals(ITEM_ID, args[0] /* id */); - expectEquals(newValue, args[1] /* access */); - delegate.resetResolver('setItemHostAccess'); - }); - } - - // Check that selecting different values correctly notifies the delegate. - await expectDelegateCallOnAccessChange(HostAccess.ON_ALL_SITES); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.OnAllSitesSelected'), 1); - await expectDelegateCallOnAccessChange(HostAccess.ON_CLICK); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.OnClickSelected'), 1); - // Finally select back to all sites and ensure the user action for it has - // incremented. - await expectDelegateCallOnAccessChange(HostAccess.ON_ALL_SITES); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.OnAllSitesSelected'), 2); - }); - - test('on select sites cancel', async () => { - const permissions = { - hostAccess: HostAccess.ON_CLICK, - hasAllHosts: true, - hosts: [{granted: false, host: 'https://*/*'}], - }; - - element.permissions = permissions; - flush(); - - const selectHostAccess = element.shadowRoot.querySelector('#host-access'); - assertTrue(!!selectHostAccess); - - selectHostAccess.value = HostAccess.ON_SPECIFIC_SITES; - selectHostAccess.dispatchEvent(new CustomEvent('change')); - - flush(); - const dialog = - element.shadowRoot.querySelector('extensions-runtime-hosts-dialog'); - assertTrue(!!dialog); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.OnClickSelected'), 0); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.OnSpecificSitesSelected'), - 1); - - expectTrue(dialog.updateHostAccess); - - // Canceling the dialog should reset the selectHostAccess value to ON_CLICK, - // since no host was added. - assertTrue(dialog.isOpen()); - let whenClosed = eventToPromise('close', dialog); - dialog.shadowRoot.querySelector('.cancel-button').click(); - await whenClosed; - - flush(); - expectEquals(HostAccess.ON_CLICK, selectHostAccess.value); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.AddHostDialogCanceled'), - 1); - // Reverting to a previous option when canceling the dialog doesn't count - // as a user action, so the on-click action count should still be 0. - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.OnClickSelected'), 0); - // Changing to a different option after this should still log a user action - // as expected. - selectHostAccess.value = HostAccess.ON_ALL_SITES; - selectHostAccess.dispatchEvent(new CustomEvent('change')); - flush(); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.OnAllSitesSelected'), 1); - }); - - test('on select sites accept', function() { - const permissions = { - hostAccess: HostAccess.ON_CLICK, - hasAllHosts: true, - hosts: [{granted: false, host: 'https://*/*'}], - }; - - element.set('permissions', permissions); - flush(); - - const selectHostAccess = element.shadowRoot.querySelector('#host-access'); - assertTrue(!!selectHostAccess); - - selectHostAccess.value = HostAccess.ON_SPECIFIC_SITES; - selectHostAccess.dispatchEvent(new CustomEvent('change')); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.OnSpecificSitesSelected'), - 1); - - flush(); - const dialog = - element.shadowRoot.querySelector('extensions-runtime-hosts-dialog'); - assertTrue(!!dialog); - - expectTrue(dialog.updateHostAccess); - - // Make the add button clickable by entering valid input. - const input = dialog.shadowRoot.querySelector('cr-input'); - input.value = 'https://example.com'; - input.fire('input'); - - // Closing the dialog (as opposed to canceling) should keep the - // selectHostAccess value at ON_SPECIFIC_SITES. - assertTrue(dialog.isOpen()); - let whenClosed = eventToPromise('close', dialog); - dialog.shadowRoot.querySelector('.action-button').click(); - return whenClosed.then(() => { - flush(); - expectEquals(HostAccess.ON_SPECIFIC_SITES, selectHostAccess.value); - expectEquals( - getUserActionCount( - 'Extensions.Settings.Hosts.AddHostDialogSubmitted'), - 1); - - // Simulate the new host being added. - const updatedPermissions = { - hostAccess: HostAccess.ON_SPECIFIC_SITES, - hasAllHosts: true, - hosts: [ - {host: 'https://example.com/*', granted: true}, - {host: 'https://*/*', granted: false}, - ], - }; - element.permissions = updatedPermissions; - flush(); - - // Open the dialog by clicking to edit the host permission. - const editHost = element.shadowRoot.querySelector('.edit-host'); - editHost.click(); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.ActionMenuOpened'), 1); - const actionMenu = element.shadowRoot.querySelector('cr-action-menu'); - const actionMenuEdit = actionMenu.querySelector('#action-menu-edit'); - assertTrue(!!actionMenuEdit); - actionMenuEdit.click(); - flush(); - expectEquals( - getUserActionCount( - 'Extensions.Settings.Hosts.ActionMenuEditActivated'), - 1); - - // Verify that the dialog does not want to update the old host access. - // Regression test for https://crbug.com/903082. - const dialog = - element.shadowRoot.querySelector('extensions-runtime-hosts-dialog'); - assertTrue(!!dialog); - expectTrue(dialog.$.dialog.open); - expectFalse(dialog.updateHostAccess); - expectEquals('https://example.com/*', dialog.currentSite); - }); - }); - - test('clicking add host triggers dialog', function() { - const permissions = { - hostAccess: HostAccess.ON_SPECIFIC_SITES, - hasAllHosts: true, - hosts: [ - {host: 'https://www.example.com/*', granted: true}, - {host: 'https://*.google.com', granted: false}, - {host: '*://*.com/*', granted: false}, - ], - }; - - element.set('permissions', permissions); - flush(); - - const addHostButton = element.shadowRoot.querySelector('#add-host'); - assertTrue(!!addHostButton); - expectTrue(isChildVisible(element, '#add-host')); - - addHostButton.click(); - flush(); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.AddHostActivated'), 1); - const dialog = - element.shadowRoot.querySelector('extensions-runtime-hosts-dialog'); - assertTrue(!!dialog); - expectTrue(dialog.$.dialog.open); - expectEquals(null, dialog.currentSite); - expectFalse(dialog.updateHostAccess); - }); - - test('removing runtime host permissions', function() { - const permissions = { - hostAccess: HostAccess.ON_SPECIFIC_SITES, - hasAllHosts: true, - hosts: [ - {host: 'https://example.com', granted: true}, - {host: 'https://chromium.org', granted: true}, - {host: '*://*.com/*', granted: false}, - ], - }; - element.set('permissions', permissions); - flush(); - - const editHost = element.shadowRoot.querySelector('.edit-host'); - assertTrue(!!editHost); - editHost.click(); - expectEquals( - getUserActionCount('Extensions.Settings.Hosts.ActionMenuOpened'), 1); - const actionMenu = element.shadowRoot.querySelector('cr-action-menu'); - assertTrue(!!actionMenu); - expectTrue(actionMenu.open); - - const remove = actionMenu.querySelector('#action-menu-remove'); - assertTrue(!!remove); - - remove.click(); - expectEquals( - getUserActionCount( - 'Extensions.Settings.Hosts.ActionMenuRemoveActivated'), - 1); - return delegate.whenCalled('removeRuntimeHostPermission').then((args) => { - expectEquals(ITEM_ID, args[0] /* id */); - expectEquals('https://chromium.org', args[1] /* site */); - expectFalse(actionMenu.open); - }); - }); - - test('clicking edit host triggers dialog', function() { - const permissions = { - hostAccess: HostAccess.ON_SPECIFIC_SITES, - hasAllHosts: true, - hosts: [ - {host: 'https://example.com', granted: true}, - {host: 'https://chromium.org', granted: true}, - {host: '*://*.com/*', granted: false}, - ], - }; - element.set('permissions', permissions); - flush(); - - const editHost = element.shadowRoot.querySelector('.edit-host'); - editHost.click(); - const actionMenu = element.shadowRoot.querySelector('cr-action-menu'); - - const actionMenuEdit = actionMenu.querySelector('#action-menu-edit'); - assertTrue(!!actionMenuEdit); - - actionMenuEdit.click(); - flush(); - const dialog = - element.shadowRoot.querySelector('extensions-runtime-hosts-dialog'); - assertTrue(!!dialog); - expectTrue(dialog.$.dialog.open); - expectFalse(dialog.updateHostAccess); - expectEquals('https://chromium.org', dialog.currentSite); - }); -});
diff --git a/chrome/test/data/webui/extensions/runtime_host_permissions_test.ts b/chrome/test/data/webui/extensions/runtime_host_permissions_test.ts new file mode 100644 index 0000000..e13c33ef --- /dev/null +++ b/chrome/test/data/webui/extensions/runtime_host_permissions_test.ts
@@ -0,0 +1,420 @@ +// Copyright 2018 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 'chrome://extensions/extensions.js'; + +import {ExtensionsRuntimeHostPermissionsElement} from 'chrome://extensions/extensions.js'; +import {loadTimeData} from 'chrome://resources/js/load_time_data.m.js'; +import {flush} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; +import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; +import {eventToPromise, isChildVisible} from 'chrome://webui-test/test_util.js'; + +import {TestService} from './test_service.js'; +import {MetricsPrivateMock} from './test_util.js'; + +suite('RuntimeHostPermissions', function() { + let element: ExtensionsRuntimeHostPermissionsElement; + let delegate: TestService; + let metricsPrivateMock: MetricsPrivateMock; + + const HostAccess = chrome.developerPrivate.HostAccess; + const ITEM_ID = 'a'.repeat(32); + + setup(function() { + document.body.innerHTML = ''; + element = document.createElement('extensions-runtime-host-permissions'); + delegate = new TestService(); + element.delegate = delegate; + element.itemId = ITEM_ID; + element.enableEnhancedSiteControls = false; + + document.body.appendChild(element); + + metricsPrivateMock = new MetricsPrivateMock(); + chrome.metricsPrivate = + metricsPrivateMock as unknown as typeof chrome.metricsPrivate; + }); + + teardown(function() { + element.remove(); + }); + + test('permissions display', function() { + const permissions = { + hostAccess: HostAccess.ON_CLICK, + hasAllHosts: true, + hosts: [{granted: false, host: 'https://*/*'}], + }; + + element.set('permissions', permissions); + flush(); + + const testIsVisible = isChildVisible.bind(null, element); + assertTrue(testIsVisible('#hostAccess')); + + const selectHostAccess = element.$.hostAccess; + assertEquals(HostAccess.ON_CLICK, selectHostAccess.value); + // For on-click mode, there should be no runtime hosts listed. + assertFalse(testIsVisible('#hosts')); + + // Changing the data's access should change the UI appropriately. + element.set('permissions.hostAccess', HostAccess.ON_ALL_SITES); + flush(); + assertEquals(HostAccess.ON_ALL_SITES, selectHostAccess.value); + assertFalse(testIsVisible('#hosts')); + + // Setting the mode to on specific sites should display the runtime hosts + // list. + element.set('permissions.hostAccess', HostAccess.ON_SPECIFIC_SITES); + element.set('permissions.hosts', [ + {host: 'https://example.com', granted: true}, + {host: 'https://chromium.org', granted: true} + ]); + flush(); + assertEquals(HostAccess.ON_SPECIFIC_SITES, selectHostAccess.value); + assertTrue(testIsVisible('#hosts')); + // Expect three entries in the list: the two hosts + the add-host button. + assertEquals( + 3, + element.shadowRoot!.querySelector('#hosts')!.getElementsByTagName('li') + .length); + assertTrue(testIsVisible('#add-host')); + }); + + test('permissions display new site access menu', function() { + loadTimeData.overrideValues({extensionsMenuAccessControlEnabled: true}); + const permissions = { + hostAccess: HostAccess.ON_CLICK, + hasAllHosts: true, + hosts: [{granted: false, host: 'https://*/*'}], + }; + + element.set('permissions', permissions); + flush(); + + const testIsVisible = isChildVisible.bind(null, element); + assertTrue(testIsVisible('#hostAccess')); + + const selectHostAccess = element.$.hostAccess; + assertEquals(HostAccess.ON_CLICK, selectHostAccess.value); + // For on-click mode, there should be no runtime hosts listed. + assertFalse(testIsVisible('#hosts')); + + // Changing the data's access should change the UI appropriately. + element.set('permissions.hostAccess', HostAccess.ON_ALL_SITES); + flush(); + assertEquals(HostAccess.ON_ALL_SITES, selectHostAccess.value); + assertFalse(testIsVisible('#hosts')); + + element.set('permissions.hostAccess', HostAccess.ON_SPECIFIC_SITES); + flush(); + assertEquals(HostAccess.ON_SPECIFIC_SITES, selectHostAccess.value); + // TODO(crbug.com/1253673): Test the new "customize for each site" menu. + }); + + test('permissions selection', async () => { + const permissions = { + hostAccess: HostAccess.ON_CLICK, + hasAllHosts: true, + hosts: [{granted: false, host: 'https://*.com/*'}], + }; + + element.set('permissions', permissions); + flush(); + + const selectHostAccess = element.$.hostAccess; + assertTrue(!!selectHostAccess); + + // Changes the value of the selectHostAccess menu and fires the change + // event, then verifies that the delegate was called with the correct + // value. + function assertDelegateCallOnAccessChange( + newValue: chrome.developerPrivate.HostAccess): Promise<void> { + selectHostAccess.value = newValue; + selectHostAccess.dispatchEvent(new CustomEvent('change')); + return delegate.whenCalled('setItemHostAccess').then((args) => { + assertEquals(ITEM_ID, args[0] /* id */); + assertEquals(newValue, args[1] /* access */); + delegate.resetResolver('setItemHostAccess'); + }); + } + + // Check that selecting different values correctly notifies the delegate. + await assertDelegateCallOnAccessChange(HostAccess.ON_ALL_SITES); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.OnAllSitesSelected'), + 1); + await assertDelegateCallOnAccessChange(HostAccess.ON_CLICK); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.OnClickSelected'), + 1); + // Finally select back to all sites and ensure the user action for it has + // incremented. + await assertDelegateCallOnAccessChange(HostAccess.ON_ALL_SITES); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.OnAllSitesSelected'), + 2); + }); + + test('on select sites cancel', async () => { + const permissions = { + hostAccess: HostAccess.ON_CLICK, + hasAllHosts: true, + hosts: [{granted: false, host: 'https://*/*'}], + }; + + element.permissions = permissions; + flush(); + + const selectHostAccess = element.$.hostAccess; + assertTrue(!!selectHostAccess); + + selectHostAccess.value = HostAccess.ON_SPECIFIC_SITES; + selectHostAccess.dispatchEvent(new CustomEvent('change')); + + flush(); + const dialog = + element.shadowRoot!.querySelector('extensions-runtime-hosts-dialog'); + assertTrue(!!dialog); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.OnClickSelected'), + 0); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.OnSpecificSitesSelected'), + 1); + + assertTrue(dialog.updateHostAccess); + + // Canceling the dialog should reset the selectHostAccess value to ON_CLICK, + // since no host was added. + assertTrue(dialog.isOpen()); + let whenClosed = eventToPromise('close', dialog); + dialog.shadowRoot!.querySelector<HTMLElement>('.cancel-button')!.click(); + await whenClosed; + + flush(); + assertEquals(HostAccess.ON_CLICK, selectHostAccess.value); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.AddHostDialogCanceled'), + 1); + // Reverting to a previous option when canceling the dialog doesn't count + // as a user action, so the on-click action count should still be 0. + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.OnClickSelected'), + 0); + // Changing to a different option after this should still log a user action + // as asserted. + selectHostAccess.value = HostAccess.ON_ALL_SITES; + selectHostAccess.dispatchEvent(new CustomEvent('change')); + flush(); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.OnAllSitesSelected'), + 1); + }); + + test('on select sites accept', function() { + const permissions = { + hostAccess: HostAccess.ON_CLICK, + hasAllHosts: true, + hosts: [{granted: false, host: 'https://*/*'}], + }; + + element.set('permissions', permissions); + flush(); + + const selectHostAccess = element.$.hostAccess; + assertTrue(!!selectHostAccess); + + selectHostAccess.value = HostAccess.ON_SPECIFIC_SITES; + selectHostAccess.dispatchEvent(new CustomEvent('change')); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.OnSpecificSitesSelected'), + 1); + + flush(); + const dialog = + element.shadowRoot!.querySelector('extensions-runtime-hosts-dialog'); + assertTrue(!!dialog); + + assertTrue(dialog.updateHostAccess); + + // Make the add button clickable by entering valid input. + const input = dialog.shadowRoot!.querySelector('cr-input'); + assertTrue(!!input); + input.value = 'https://example.com'; + input.fire('input'); + + // Closing the dialog (as opposed to canceling) should keep the + // selectHostAccess value at ON_SPECIFIC_SITES. + assertTrue(dialog.isOpen()); + let whenClosed = eventToPromise('close', dialog); + dialog.$.submit.click(); + return whenClosed.then(() => { + flush(); + assertEquals(HostAccess.ON_SPECIFIC_SITES, selectHostAccess.value); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.AddHostDialogSubmitted'), + 1); + + // Simulate the new host being added. + const updatedPermissions = { + hostAccess: HostAccess.ON_SPECIFIC_SITES, + hasAllHosts: true, + hosts: [ + {host: 'https://example.com/*', granted: true}, + {host: 'https://*/*', granted: false}, + ], + }; + element.permissions = updatedPermissions; + flush(); + + // Open the dialog by clicking to edit the host permission. + const editHost = + element.shadowRoot!.querySelector<HTMLElement>('.edit-host'); + assertTrue(!!editHost); + editHost.click(); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.ActionMenuOpened'), + 1); + const actionMenu = element.shadowRoot!.querySelector('cr-action-menu'); + assertTrue(!!actionMenu); + const actionMenuEdit = + actionMenu.querySelector<HTMLElement>('#action-menu-edit'); + assertTrue(!!actionMenuEdit); + actionMenuEdit.click(); + flush(); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.ActionMenuEditActivated'), + 1); + + // Verify that the dialog does not want to update the old host access. + // Regression test for https://crbug.com/903082. + const dialog = + element.shadowRoot!.querySelector('extensions-runtime-hosts-dialog'); + assertTrue(!!dialog); + assertTrue(dialog.$.dialog.open); + assertFalse(dialog.updateHostAccess); + assertEquals('https://example.com/*', dialog.currentSite); + }); + }); + + test('clicking add host triggers dialog', function() { + const permissions = { + hostAccess: HostAccess.ON_SPECIFIC_SITES, + hasAllHosts: true, + hosts: [ + {host: 'https://www.example.com/*', granted: true}, + {host: 'https://*.google.com', granted: false}, + {host: '*://*.com/*', granted: false}, + ], + }; + + element.set('permissions', permissions); + flush(); + + const addHostButton = + element.shadowRoot!.querySelector<HTMLElement>('#add-host'); + assertTrue(!!addHostButton); + assertTrue(isChildVisible(element, '#add-host')); + + addHostButton.click(); + flush(); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.AddHostActivated'), + 1); + const dialog = + element.shadowRoot!.querySelector('extensions-runtime-hosts-dialog'); + assertTrue(!!dialog); + assertTrue(dialog.$.dialog.open); + assertEquals(null, dialog.currentSite); + assertFalse(dialog.updateHostAccess); + }); + + test('removing runtime host permissions', function() { + const permissions = { + hostAccess: HostAccess.ON_SPECIFIC_SITES, + hasAllHosts: true, + hosts: [ + {host: 'https://example.com', granted: true}, + {host: 'https://chromium.org', granted: true}, + {host: '*://*.com/*', granted: false}, + ], + }; + element.set('permissions', permissions); + flush(); + + const editHost = + element.shadowRoot!.querySelector<HTMLElement>('.edit-host'); + assertTrue(!!editHost); + editHost.click(); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.ActionMenuOpened'), + 1); + const actionMenu = element.shadowRoot!.querySelector('cr-action-menu'); + assertTrue(!!actionMenu); + assertTrue(actionMenu.open); + + const remove = actionMenu.querySelector<HTMLElement>('#action-menu-remove'); + assertTrue(!!remove); + + remove.click(); + assertEquals( + metricsPrivateMock.getUserActionCount( + 'Extensions.Settings.Hosts.ActionMenuRemoveActivated'), + 1); + return delegate.whenCalled('removeRuntimeHostPermission').then((args) => { + assertEquals(ITEM_ID, args[0] /* id */); + assertEquals('https://chromium.org', args[1] /* site */); + assertFalse(actionMenu.open); + }); + }); + + test('clicking edit host triggers dialog', function() { + const permissions = { + hostAccess: HostAccess.ON_SPECIFIC_SITES, + hasAllHosts: true, + hosts: [ + {host: 'https://example.com', granted: true}, + {host: 'https://chromium.org', granted: true}, + {host: '*://*.com/*', granted: false}, + ], + }; + element.set('permissions', permissions); + flush(); + + const editHost = + element.shadowRoot!.querySelector<HTMLElement>('.edit-host'); + assertTrue(!!editHost); + editHost.click(); + const actionMenu = element.shadowRoot!.querySelector('cr-action-menu'); + assertTrue(!!actionMenu); + + const actionMenuEdit = + actionMenu.querySelector<HTMLElement>('#action-menu-edit'); + assertTrue(!!actionMenuEdit); + + actionMenuEdit.click(); + flush(); + const dialog = + element.shadowRoot!.querySelector('extensions-runtime-hosts-dialog'); + assertTrue(!!dialog); + assertTrue(dialog.$.dialog.open); + assertFalse(dialog.updateHostAccess); + assertEquals('https://chromium.org', dialog.currentSite); + }); +});
diff --git a/chrome/test/data/webui/extensions/runtime_hosts_dialog_test.js b/chrome/test/data/webui/extensions/runtime_hosts_dialog_test.ts similarity index 73% rename from chrome/test/data/webui/extensions/runtime_hosts_dialog_test.js rename to chrome/test/data/webui/extensions/runtime_hosts_dialog_test.ts index 124c6b65..887cc64 100644 --- a/chrome/test/data/webui/extensions/runtime_hosts_dialog_test.js +++ b/chrome/test/data/webui/extensions/runtime_hosts_dialog_test.ts
@@ -2,16 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {getPatternFromSite} from 'chrome://extensions/extensions.js'; +import 'chrome://extensions/extensions.js'; +import {ExtensionsRuntimeHostsDialogElement, getPatternFromSite} from 'chrome://extensions/extensions.js'; +import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js'; import {eventToPromise} from 'chrome://webui-test/test_util.js'; import {TestService} from './test_service.js'; import {MetricsPrivateMock} from './test_util.js'; suite('RuntimeHostsDialog', function() { - /** @type {RuntimeHostsDialogElement} */ let dialog; - /** @type {TestService} */ let delegate; + let dialog: ExtensionsRuntimeHostsDialogElement; + let delegate: TestService; + let metricsPrivateMock: MetricsPrivateMock; + const ITEM_ID = 'a'.repeat(32); setup(function() { @@ -24,7 +28,9 @@ document.body.appendChild(dialog); - chrome.metricsPrivate = new MetricsPrivateMock(); + metricsPrivateMock = new MetricsPrivateMock(); + chrome.metricsPrivate = + metricsPrivateMock as unknown as typeof chrome.metricsPrivate; }); teardown(function() { @@ -32,7 +38,8 @@ }); test('valid input', function() { - const input = dialog.shadowRoot.querySelector('cr-input'); + const input = dialog.shadowRoot!.querySelector('cr-input'); + assertTrue(!!input); const site = 'http://www.example.com'; input.value = site; input.fire('input'); @@ -52,7 +59,8 @@ test('invalid input', function() { // Initially the action button should be disabled, but the error warning // should not be shown for an empty input. - const input = dialog.shadowRoot.querySelector('cr-input'); + const input = dialog.shadowRoot!.querySelector('cr-input'); + assertTrue(!!input); assertFalse(input.invalid); const submit = dialog.$.submit; assertTrue(submit.disabled); @@ -74,7 +82,8 @@ test('delegate indicates invalid input', function() { delegate.acceptRuntimeHostPermission = false; - const input = dialog.shadowRoot.querySelector('cr-input'); + const input = dialog.shadowRoot!.querySelector('cr-input'); + assertTrue(!!input); const site = 'http://....a'; input.value = site; input.fire('input'); @@ -94,7 +103,8 @@ const newPattern = 'http://chromium.org/*'; dialog.currentSite = oldPattern; - const input = dialog.shadowRoot.querySelector('cr-input'); + const input = dialog.shadowRoot!.querySelector('cr-input'); + assertTrue(!!input); input.value = newPattern; input.fire('input'); const submit = dialog.$.submit; @@ -102,45 +112,46 @@ submit.click(); return delegate.whenCalled('removeRuntimeHostPermission') .then((args) => { - expectEquals(ITEM_ID, args[0] /* id */); - expectEquals(oldPattern, args[1] /* pattern */); + assertEquals(ITEM_ID, args[0] /* id */); + assertEquals(oldPattern, args[1] /* pattern */); return delegate.whenCalled('addRuntimeHostPermission'); }) .then((args) => { - expectEquals(ITEM_ID, args[0] /* id */); - expectEquals(newPattern, args[1] /* pattern */); + assertEquals(ITEM_ID, args[0] /* id */); + assertEquals(newPattern, args[1] /* pattern */); return eventToPromise('close', dialog); }) .then(() => { - expectFalse(dialog.isOpen()); - expectEquals( - chrome.metricsPrivate.getUserActionCount( + assertFalse(dialog.isOpen()); + assertEquals( + metricsPrivateMock.getUserActionCount( 'Extensions.Settings.Hosts.AddHostDialogSubmitted'), 1); }); }); test('get pattern from url', function() { - expectEquals( + assertEquals( 'https://example.com/*', getPatternFromSite('https://example.com/*')); - expectEquals( + assertEquals( 'https://example.com/*', getPatternFromSite('https://example.com/')); - expectEquals( + assertEquals( 'https://example.com/*', getPatternFromSite('https://example.com')); - expectEquals( + assertEquals( 'https://*.example.com/*', getPatternFromSite('https://*.example.com/*')); - expectEquals('*://example.com/*', getPatternFromSite('example.com')); - expectEquals( + assertEquals('*://example.com/*', getPatternFromSite('example.com')); + assertEquals( 'https://example.com:80/*', getPatternFromSite('https://example.com:80/*')); - expectEquals( + assertEquals( 'http://localhost:3030/*', getPatternFromSite('http://localhost:3030')); }); test('update site access', function() { dialog.updateHostAccess = true; - const input = dialog.shadowRoot.querySelector('cr-input'); + const input = dialog.shadowRoot!.querySelector('cr-input'); + assertTrue(!!input); const site = 'http://www.example.com'; input.value = site; input.fire('input');
diff --git a/chrome/test/data/webui/inline_login/inline_login_browsertest.js b/chrome/test/data/webui/inline_login/inline_login_browsertest.js index bdd3880..54ed655e 100644 --- a/chrome/test/data/webui/inline_login/inline_login_browsertest.js +++ b/chrome/test/data/webui/inline_login/inline_login_browsertest.js
@@ -178,6 +178,12 @@ this.runMochaTest(inline_login_welcome_page_test.TestNames.ToggleHidden); }); + TEST_F( + 'InlineLoginWelcomePageBrowserTestWithArcAccountRestrictionsEnabled', + 'LinkClick', function() { + this.runMochaTest(inline_login_welcome_page_test.TestNames.LinkClick); + }); + // eslint-disable-next-line no-var var InlineLoginArcAccountPickerBrowserTest = class extends InlineLoginBrowserTest {
diff --git a/chrome/test/data/webui/inline_login/inline_login_welcome_page_test.js b/chrome/test/data/webui/inline_login/inline_login_welcome_page_test.js index e1411a02..fb73f6b1 100644 --- a/chrome/test/data/webui/inline_login/inline_login_welcome_page_test.js +++ b/chrome/test/data/webui/inline_login/inline_login_welcome_page_test.js
@@ -29,6 +29,7 @@ GoBack: 'GoBack', IsAvailableInArc: 'IsAvailableInArc', ToggleHidden: 'ToggleHidden', + LinkClick: 'LinkClick', }; suite(inline_login_welcome_page_test.suiteName, () => { @@ -180,4 +181,18 @@ assertTrue(!!toggle); assertTrue(toggle.hidden, 'ARC toggle should be hidden'); }); + + test(assert(inline_login_welcome_page_test.TestNames.LinkClick), async () => { + const dialogArgs = { + isAvailableInArc: true, + showArcAvailabilityPicker: false + }; + testSetup(dialogArgs); + + inlineLoginComponent.$$('welcome-page-app').$$('#osSettingsLink').click(); + await testBrowserProxy.whenCalled('dialogClose'); + + inlineLoginComponent.$$('welcome-page-app').$$('#appsSettingsLink').click(); + return testBrowserProxy.whenCalled('dialogClose'); + }); });
diff --git a/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.ts b/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.ts index 663f7f4..a93a350 100644 --- a/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.ts +++ b/chrome/test/data/webui/settings/passwords_and_autofill_fake_data.ts
@@ -287,6 +287,7 @@ compromiseTime: Date.now() - (elapsedMinSinceCompromise * 60000), elapsedTimeSinceCompromise: `${elapsedMinSinceCompromise} minutes ago`, compromiseType: type, + isMuted: false, }; return credential; }
diff --git a/chromecast/browser/cast_web_contents_impl.cc b/chromecast/browser/cast_web_contents_impl.cc index ff52bde..d9a7e59 100644 --- a/chromecast/browser/cast_web_contents_impl.cc +++ b/chromecast/browser/cast_web_contents_impl.cc
@@ -132,6 +132,13 @@ CastWebContentsImpl::CastWebContentsImpl(content::WebContents* web_contents, mojom::CastWebViewParamsPtr params) + : CastWebContentsImpl(web_contents, + std::move(params), + nullptr /* parent */) {} + +CastWebContentsImpl::CastWebContentsImpl(content::WebContents* web_contents, + mojom::CastWebViewParamsPtr params, + CastWebContents* parent) : web_contents_(web_contents), params_(std::move(params)), page_state_(PageState::IDLE), @@ -142,6 +149,7 @@ ? std::make_unique<CastMediaBlocker>(web_contents_) : nullptr), main_process_host_(nullptr), + parent_cast_web_contents_(parent), tab_id_(params_->is_root_window ? 0 : next_tab_id++), id_(next_id++), main_frame_loaded_(false), @@ -163,7 +171,17 @@ CastWebContents::GetAll().push_back(this); content::WebContentsObserver::Observe(web_contents_); - url_rewrite_rules_manager_.AddWebContents(web_contents_); + + // The URL rewrite rules manager must be initialized only for the root + // CastWebContents that is created with this public ctor. All the inner + // CastWebContents created in |InnerWebContentsCreated()| callback will use + // the private ctor with |parent| specified which allows sharing the same + // manager, so that the whole Cast session applies the same rules. + if (!parent_cast_web_contents_) { + url_rewrite_rules_manager_.emplace(); + } + url_rewrite_rules_manager()->AddWebContents(web_contents_); + if (params_->enabled_for_dev) { LOG(INFO) << "Enabling dev console for CastWebContentsImpl"; remote_debugging_server_->EnableWebContentsForDebugging(web_contents_); @@ -223,7 +241,10 @@ url_rewrite::UrlRequestRewriteRulesManager* CastWebContentsImpl::url_rewrite_rules_manager() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - return &url_rewrite_rules_manager_; + if (parent_cast_web_contents_) { + return parent_cast_web_contents_->url_rewrite_rules_manager(); + } + return &*url_rewrite_rules_manager_; } void CastWebContentsImpl::AddRendererFeatures(base::Value features) { @@ -238,7 +259,7 @@ void CastWebContentsImpl::SetUrlRewriteRules( url_rewrite::mojom::UrlRequestRewriteRulesPtr rules) { - if (!url_rewrite_rules_manager_.OnRulesUpdated(std::move(rules))) { + if (!url_rewrite_rules_manager()->OnRulesUpdated(std::move(rules))) { LOG(ERROR) << "URL rewrite rules update failed."; } } @@ -914,8 +935,8 @@ mojom::CastWebViewParamsPtr params = mojom::CastWebViewParams::New(); params->enabled_for_dev = params_->enabled_for_dev; params->background_color = params_->background_color; - auto result = inner_contents_.insert(std::make_unique<CastWebContentsImpl>( - inner_web_contents, std::move(params))); + auto result = inner_contents_.insert(std::unique_ptr<CastWebContentsImpl>( + new CastWebContentsImpl(inner_web_contents, std::move(params), this))); // Notifies remote observers. for (auto& observer : observers_) {
diff --git a/chromecast/browser/cast_web_contents_impl.h b/chromecast/browser/cast_web_contents_impl.h index 507eaa5..8d3dcd94 100644 --- a/chromecast/browser/cast_web_contents_impl.h +++ b/chromecast/browser/cast_web_contents_impl.h
@@ -160,6 +160,11 @@ mojo::AssociatedReceiverSet<mojom::IdentificationSettingsManager> receivers; }; + // Constructor used to create inner CastWebContents. This allows inner + // contents to share the same URL rewrite rules as the root. + CastWebContentsImpl(content::WebContents* web_contents, + mojom::CastWebViewParamsPtr params, + CastWebContents* parent); void OnPageLoading(); void OnPageLoaded(); void UpdatePageState(); @@ -177,7 +182,8 @@ content::WebContents* web_contents_; mojom::CastWebViewParamsPtr params_; - url_rewrite::UrlRequestRewriteRulesManager url_rewrite_rules_manager_; + absl::optional<url_rewrite::UrlRequestRewriteRulesManager> + url_rewrite_rules_manager_; PageState page_state_; PageState last_state_; shell::RemoteDebuggingServer* const remote_debugging_server_; @@ -187,6 +193,7 @@ // Retained so that this observer can be removed before being destroyed: content::RenderProcessHost* main_process_host_; + CastWebContents* const parent_cast_web_contents_ = nullptr; base::flat_set<std::unique_ptr<CastWebContents>> inner_contents_; base::Value renderer_features_{base::Value::Type::DICTIONARY};
diff --git a/chromecast/cast_core/DEPS b/chromecast/cast_core/DEPS index 1812552..463c8ed 100644 --- a/chromecast/cast_core/DEPS +++ b/chromecast/cast_core/DEPS
@@ -1,6 +1,7 @@ include_rules = [ "-chromecast/cast_core", - "+chromecast/cast_core/common", + "+chromecast/cast_core/grpc", + "+chromecast/cast_core/runtime", "+chromecast/app", "+chromecast/base", "+content/public/app",
diff --git a/chromecast/cast_core/grpc/BUILD.gn b/chromecast/cast_core/grpc/BUILD.gn index f06ba2b..a235ce2 100644 --- a/chromecast/cast_core/grpc/BUILD.gn +++ b/chromecast/cast_core/grpc/BUILD.gn
@@ -7,32 +7,32 @@ cast_source_set("grpc") { sources = [ - "grpc_call.h", - "grpc_client_reactor.h", - "grpc_server_streaming_call.h", - "grpc_stub.h", - "grpc_unary_call.h", "cancellable_reactor.h", + "grpc_call.h", + "grpc_call_options.cc", + "grpc_call_options.h", + "grpc_client_reactor.h", "grpc_handler.cc", "grpc_handler.h", "grpc_server.cc", "grpc_server.h", "grpc_server_reactor.h", + "grpc_server_streaming_call.h", "grpc_server_streaming_handler.h", + "grpc_status_or.cc", + "grpc_status_or.h", + "grpc_stub.h", + "grpc_unary_call.h", "grpc_unary_handler.h", "server_reactor_tracker.cc", "server_reactor_tracker.h", "trackable_reactor.h", - "grpc_call_options.cc", - "grpc_call_options.h", - "grpc_status_or.cc", - "grpc_status_or.h", ] public_deps = [ "//base", - "//third_party/grpc:grpc++", "//third_party/abseil-cpp:absl", + "//third_party/grpc:grpc++", ] }
diff --git a/chromecast/cast_core/runtime/browser/BUILD.gn b/chromecast/cast_core/runtime/browser/BUILD.gn index 0b4ee6b..eccdfe2c 100644 --- a/chromecast/cast_core/runtime/browser/BUILD.gn +++ b/chromecast/cast_core/runtime/browser/BUILD.gn
@@ -10,8 +10,6 @@ "runtime_application_service_grpc_impl.h", "runtime_message_port_application_service_grpc_impl.cc", "runtime_message_port_application_service_grpc_impl.h", - "runtime_service_grpc_impl.cc", - "runtime_service_grpc_impl.h", ] public_deps = [ @@ -51,8 +49,6 @@ "cast_runtime_metrics_recorder.h", "cast_runtime_metrics_recorder_service.cc", "cast_runtime_metrics_recorder_service.h", - "metrics_recorder_grpc.cc", - "metrics_recorder_grpc.h", ] public_deps = [ @@ -212,10 +208,9 @@ "//chromecast/common:feature_constants", "//components/cast_streaming/public/mojom", "//components/url_rewrite/browser", - "//third_party/cast_core/public/src/proto/common:application_config_proto", - "//third_party/cast_core/public/src/proto/core:cast_core_service_proto", - "//third_party/cast_core/public/src/proto/metrics:metrics_recorder_proto", - "//third_party/cast_core/public/src/proto/v2:core_application_service_proto", + "//third_party/cast_core/public/src/proto/core:cast_core_service_proto_castcore", + "//third_party/cast_core/public/src/proto/metrics:metrics_recorder_proto_castcore", + "//third_party/cast_core/public/src/proto/runtime:runtime_service_proto_castcore", "//third_party/grpc:grpc++", ]
diff --git a/chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder_service.cc b/chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder_service.cc index 0d98aa52..f2be265b 100644 --- a/chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder_service.cc +++ b/chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder_service.cc
@@ -8,7 +8,6 @@ #include "chromecast/cast_core/runtime/browser/cast_runtime_action_recorder.h" #include "chromecast/cast_core/runtime/browser/cast_runtime_histogram_flattener.h" #include "chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder.h" -#include "chromecast/cast_core/runtime/browser/metrics_recorder_grpc.h" #include "third_party/cast_core/public/src/proto/metrics/metrics_recorder.pb.h" namespace chromecast { @@ -21,39 +20,34 @@ CastRuntimeMetricsRecorderService::CastRuntimeMetricsRecorderService( CastRuntimeMetricsRecorder* metrics_recorder, CastRuntimeActionRecorder* action_recorder, - MetricsRecorderGrpc* metrics_recorder_grpc, + RecordMetricsCallback record_metrics_callback, base::TimeDelta report_interval) : metrics_recorder_(metrics_recorder), action_recorder_(action_recorder), - metrics_recorder_grpc_(metrics_recorder_grpc) { + record_metrics_callback_(record_metrics_callback) { report_timer_.Start( FROM_HERE, report_interval, base::BindRepeating(&CastRuntimeMetricsRecorderService::Report, - base::Unretained(this))); - metrics_recorder_grpc_->SetClient(this); + weak_factory_.GetWeakPtr())); } CastRuntimeMetricsRecorderService::~CastRuntimeMetricsRecorderService() { - metrics_recorder_grpc_->SetClient(nullptr); -} - -void CastRuntimeMetricsRecorderService::OnRecordComplete() { - DCHECK(ack_pending_); - ack_pending_ = false; - DrainBuffer(); + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); } void CastRuntimeMetricsRecorderService::OnCloseSoon( base::OnceClosure complete_callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (flush_complete_callback_) { return; } - report_timer_.AbandonAndStop(); + report_timer_.Stop(); flush_complete_callback_ = std::move(complete_callback); Report(); } void CastRuntimeMetricsRecorderService::Report() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); std::vector<cast::metrics::Event> events = metrics_recorder_->TakeEvents(); for (auto& histogram : GetHistogramDeltas()) { cast::metrics::Event event; @@ -72,7 +66,15 @@ DrainBuffer(); } +void CastRuntimeMetricsRecorderService::OnRecordComplete() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(ack_pending_); + ack_pending_ = false; + DrainBuffer(); +} + void CastRuntimeMetricsRecorderService::DrainBuffer() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (ack_pending_) { return; } @@ -90,9 +92,13 @@ *request.mutable_event() = {send_buffer_.begin() + start_index, send_buffer_.end()}; send_buffer_.resize(start_index); + DVLOG(2) << "Sending metrics"; ack_pending_ = true; - metrics_recorder_grpc_->Record(request); + record_metrics_callback_.Run( + std::move(request), + base::BindOnce(&CastRuntimeMetricsRecorderService::OnRecordComplete, + weak_factory_.GetWeakPtr())); } } // namespace chromecast
diff --git a/chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder_service.h b/chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder_service.h index fc5626b..0a5c40d 100644 --- a/chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder_service.h +++ b/chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder_service.h
@@ -5,9 +5,10 @@ #ifndef CHROMECAST_CAST_CORE_RUNTIME_BROWSER_CAST_RUNTIME_METRICS_RECORDER_SERVICE_H_ #define CHROMECAST_CAST_CORE_RUNTIME_BROWSER_CAST_RUNTIME_METRICS_RECORDER_SERVICE_H_ +#include "base/callback.h" #include "base/time/time.h" #include "base/timer/timer.h" -#include "chromecast/cast_core/runtime/browser/metrics_recorder_grpc.h" +#include "third_party/cast_core/public/src/proto/metrics/metrics_recorder.pb.h" namespace chromecast { @@ -18,32 +19,39 @@ // Core via MetricsRecorderGrpc. It begins running the timer task on // construction. After OnCloseSoon(), it only attempts one more round of // metrics and then stops. -class CastRuntimeMetricsRecorderService final - : public MetricsRecorderGrpc::Client { +class CastRuntimeMetricsRecorderService { public: + using RecordCompleteCallback = base::OnceClosure; + using RecordMetricsCallback = + base::RepeatingCallback<void(cast::metrics::RecordRequest, + RecordCompleteCallback)>; + // All these pointers must outlive |this|. CastRuntimeMetricsRecorderService( CastRuntimeMetricsRecorder* metrics_recorder, CastRuntimeActionRecorder* action_recorder, - MetricsRecorderGrpc* metrics_recorder_grpc, + RecordMetricsCallback record_metrics_callback, base::TimeDelta report_interval); - ~CastRuntimeMetricsRecorderService() override; + ~CastRuntimeMetricsRecorderService(); - void OnRecordComplete() override; - void OnCloseSoon(base::OnceClosure complete_callback) override; + void OnCloseSoon(base::OnceClosure complete_callback); private: void Report(); void DrainBuffer(); + void OnRecordComplete(); CastRuntimeMetricsRecorder* const metrics_recorder_; CastRuntimeActionRecorder* const action_recorder_; - MetricsRecorderGrpc* const metrics_recorder_grpc_; + RecordMetricsCallback record_metrics_callback_; base::RepeatingTimer report_timer_; bool ack_pending_{false}; base::OnceClosure flush_complete_callback_; std::vector<cast::metrics::Event> send_buffer_; + + SEQUENCE_CHECKER(sequence_checker_); + base::WeakPtrFactory<CastRuntimeMetricsRecorderService> weak_factory_{this}; }; } // namespace chromecast
diff --git a/chromecast/cast_core/runtime/browser/metrics_recorder_grpc.cc b/chromecast/cast_core/runtime/browser/metrics_recorder_grpc.cc deleted file mode 100644 index 2b63d56..0000000 --- a/chromecast/cast_core/runtime/browser/metrics_recorder_grpc.cc +++ /dev/null
@@ -1,20 +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 "chromecast/cast_core/runtime/browser/metrics_recorder_grpc.h" - -#include "base/check.h" - -namespace chromecast { - -MetricsRecorderGrpc::MetricsRecorderGrpc() = default; - -MetricsRecorderGrpc::~MetricsRecorderGrpc() = default; - -void MetricsRecorderGrpc::SetClient(Client* client) { - DCHECK((!!metrics_recorder_client_) ^ (!!client)); - metrics_recorder_client_ = client; -} - -} // namespace chromecast
diff --git a/chromecast/cast_core/runtime/browser/metrics_recorder_grpc.h b/chromecast/cast_core/runtime/browser/metrics_recorder_grpc.h deleted file mode 100644 index eafc34f..0000000 --- a/chromecast/cast_core/runtime/browser/metrics_recorder_grpc.h +++ /dev/null
@@ -1,45 +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 CHROMECAST_CAST_CORE_RUNTIME_BROWSER_METRICS_RECORDER_GRPC_H_ -#define CHROMECAST_CAST_CORE_RUNTIME_BROWSER_METRICS_RECORDER_GRPC_H_ - -#include "base/callback.h" -#include "third_party/cast_core/public/src/proto/metrics/metrics_recorder.pb.h" - -namespace chromecast { - -// This is an interface that allows asynchronous access to the Cast Core -// MetricsRecorderService API. -class MetricsRecorderGrpc { - public: - class Client { - public: - virtual ~Client() = default; - - // Called after a prior Record() call is acknowledged by Cast Core and - // another Record() call can begin. - virtual void OnRecordComplete() = 0; - - // Called when metrics reporting should wind down. |complete_callback| - // should be called when no more calls to Record() will happen. - virtual void OnCloseSoon(base::OnceClosure complete_callback) = 0; - }; - - MetricsRecorderGrpc(); - virtual ~MetricsRecorderGrpc() = 0; - - // Sends |request| to Cast Core. Client::OnRecordComplete will be called when - // this is acknowledged by Cast Core. - virtual void Record(const cast::metrics::RecordRequest& request) = 0; - - void SetClient(Client* client); - - protected: - Client* metrics_recorder_client_{nullptr}; -}; - -} // namespace chromecast - -#endif // CHROMECAST_CAST_CORE_RUNTIME_BROWSER_METRICS_RECORDER_GRPC_H_
diff --git a/chromecast/cast_core/runtime/browser/runtime_application_dispatcher.cc b/chromecast/cast_core/runtime/browser/runtime_application_dispatcher.cc index ac0b90a..a4f5470 100644 --- a/chromecast/cast_core/runtime/browser/runtime_application_dispatcher.cc +++ b/chromecast/cast_core/runtime/browser/runtime_application_dispatcher.cc
@@ -5,6 +5,7 @@ #include "chromecast/cast_core/runtime/browser/runtime_application_dispatcher.h" #include "base/notreached.h" +#include "base/task/bind_post_task.h" #include "base/threading/sequenced_task_runner_handle.h" #include "base/time/time.h" #include "chromecast/browser/cast_content_window.h" @@ -25,112 +26,113 @@ } // namespace -RuntimeApplicationDispatcher::AsyncMetricsRecord::AsyncMetricsRecord( - const cast::metrics::RecordRequest& request, - cast::metrics::MetricsRecorderService::Stub* metrics_recorder_stub, - grpc::CompletionQueue* cq, - base::WeakPtr<RuntimeApplicationDispatcher> runtime_service) - : runtime_service_(runtime_service) { - response_reader_ = - metrics_recorder_stub->PrepareAsyncRecord(&context_, request, cq); - response_reader_->StartCall(); - response_reader_->Finish(&response_, &status_, static_cast<GRPC*>(this)); -} - -RuntimeApplicationDispatcher::AsyncMetricsRecord::~AsyncMetricsRecord() = - default; - -void RuntimeApplicationDispatcher::AsyncMetricsRecord::StepGRPC( - grpc::Status status) { - if (runtime_service_) { - runtime_service_->OnRecordComplete(); - } - delete this; -} - RuntimeApplicationDispatcher::RuntimeApplicationDispatcher( CastWebService* web_service, CastRuntimeMetricsRecorder::EventBuilderFactory* event_builder_factory, cast_streaming::NetworkContextGetter network_context_getter, media::VideoPlaneController* video_plane_controller, RuntimeApplicationWatcher* application_watcher) - : GrpcServer(base::SequencedTaskRunnerHandle::Get()), - web_service_(web_service), + : web_service_(web_service), network_context_getter_(std::move(network_context_getter)), metrics_recorder_(event_builder_factory), video_plane_controller_(video_plane_controller), - application_watcher_(application_watcher) { + application_watcher_(application_watcher), + task_runner_(base::SequencedTaskRunnerHandle::Get()) { DCHECK(web_service_); DCHECK(video_plane_controller_); + + heartbeat_timer_.SetTaskRunner(task_runner_); } RuntimeApplicationDispatcher::~RuntimeApplicationDispatcher() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); Stop(); } bool RuntimeApplicationDispatcher::Start( const std::string& runtime_id, - const std::string& runtime_service_path) { - runtime_id_ = runtime_id; - runtime_service_path_ = runtime_service_path; + const std::string& runtime_service_endpoint) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(!grpc_server_); - grpc::ServerBuilder builder; - builder.AddListeningPort(runtime_service_path_, - grpc::InsecureServerCredentials()); - builder.RegisterService(&grpc_runtime_service_); - SetCompletionQueue(builder.AddCompletionQueue()); - SetServer(builder.BuildAndStart()); - if (!grpc_server_) { - LOG(ERROR) << "Failed to start server on path: " << runtime_service_path_; - return false; - } + grpc_server_.emplace(); + grpc_server_ + ->SetHandler<cast::runtime::RuntimeServiceHandler::LoadApplication>( + base::BindPostTask( + task_runner_, + base::BindRepeating( + &RuntimeApplicationDispatcher::HandleLoadApplication, + weak_factory_.GetWeakPtr()))); + grpc_server_ + ->SetHandler<cast::runtime::RuntimeServiceHandler::LaunchApplication>( + base::BindPostTask( + task_runner_, + base::BindRepeating( + &RuntimeApplicationDispatcher::HandleLaunchApplication, + weak_factory_.GetWeakPtr()))); + grpc_server_ + ->SetHandler<cast::runtime::RuntimeServiceHandler::StopApplication>( + base::BindPostTask( + task_runner_, + base::BindRepeating( + &RuntimeApplicationDispatcher::HandleStopApplication, + weak_factory_.GetWeakPtr()))); + grpc_server_->SetHandler<cast::runtime::RuntimeServiceHandler::Heartbeat>( + base::BindPostTask( + task_runner_, + base::BindRepeating(&RuntimeApplicationDispatcher::HandleHeartbeat, + weak_factory_.GetWeakPtr()))); + grpc_server_ + ->SetHandler<cast::runtime::RuntimeServiceHandler::StartMetricsRecorder>( + base::BindPostTask( + task_runner_, + base::BindRepeating( + &RuntimeApplicationDispatcher::HandleStartMetricsRecorder, + weak_factory_.GetWeakPtr()))); + grpc_server_ + ->SetHandler<cast::runtime::RuntimeServiceHandler::StopMetricsRecorder>( + base::BindPostTask( + task_runner_, + base::BindRepeating( + &RuntimeApplicationDispatcher::HandleStopMetricsRecorder, + weak_factory_.GetWeakPtr()))); + grpc_server_->Start(runtime_service_endpoint); - StartRuntimeServiceMethods(&grpc_runtime_service_, weak_factory_.GetWeakPtr(), - grpc_cq_, &is_shutdown_); - GrpcServer::Start(); - + LOG(INFO) << "Runtime service started: runtime_id=" << runtime_id + << ", endpoint=" << runtime_service_endpoint; return true; } void RuntimeApplicationDispatcher::Stop() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); ResetApp(); - if (heartbeat_) { - heartbeat_->Finish(grpc::Status::CANCELLED); - heartbeat_ = nullptr; + if (heartbeat_reactor_) { + heartbeat_timer_.Stop(); + heartbeat_reactor_->Write(grpc::Status::OK); + heartbeat_reactor_ = nullptr; } - if (metrics_recorder_client_) { - metrics_recorder_client_->OnCloseSoon(base::DoNothing()); + + if (grpc_server_) { + grpc_server_->Stop(); + grpc_server_.reset(); } - GrpcServer::Stop(); + + if (metrics_recorder_service_) { + metrics_recorder_service_->OnCloseSoon(base::DoNothing()); + metrics_recorder_service_.reset(); + } + + LOG(INFO) << "Runtime service stopped"; } -void RuntimeApplicationDispatcher::Record( - const cast::metrics::RecordRequest& request) { - if (!metrics_recorder_stub_) { - return; - } - if (!grpc_cq_) { - return; - } - new AsyncMetricsRecord(request, metrics_recorder_stub_.get(), grpc_cq_, - weak_factory_.GetWeakPtr()); -} - -void RuntimeApplicationDispatcher::LoadApplication( - const cast::runtime::LoadApplicationRequest& request, - cast::runtime::LoadApplicationResponse* response, - GrpcMethod* callback) { +void RuntimeApplicationDispatcher::HandleLoadApplication( + cast::runtime::LoadApplicationRequest request, + cast::runtime::RuntimeServiceHandler::LoadApplication::Reactor* reactor) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!request.has_application_config()) { - std::stringstream err_stream; - err_stream - << "Invalid LoadApplication call (session id: " - << request.cast_session_id() << ", grpc endpoint: " - << (request.has_runtime_application_service_info() - ? request.runtime_application_service_info().grpc_endpoint() - : "NONE") - << ")"; - callback->StepGRPC(grpc::Status(grpc::INTERNAL, err_stream.str())); + reactor->Write( + grpc::Status(grpc::INVALID_ARGUMENT, "Application config is missing")); return; } @@ -150,29 +152,22 @@ } if (!app_->Load(request)) { - std::stringstream err_stream; - err_stream - << "failed to load RuntimeApplication (session id: " - << request.cast_session_id() - << ", app id: " << app_->app_config().app_id() << ", grpc endpoint: " - << (request.has_runtime_application_service_info() - ? request.runtime_application_service_info().grpc_endpoint() - : "NONE") - << ")"; ResetApp(); - callback->StepGRPC(grpc::Status(grpc::INTERNAL, err_stream.str())); + reactor->Write( + grpc::Status(grpc::StatusCode::INTERNAL, "Failed to load application")); return; } - cast::runtime::MessagePortInfo info; - *response->mutable_message_port_info() = info; - DCHECK(response->has_message_port_info()); - callback->StepGRPC(grpc::Status::OK); + + LOG(INFO) << "Application loaded: " << *app_; + cast::runtime::LoadApplicationResponse response; + response.mutable_message_port_info(); + reactor->Write(std::move(response)); } -void RuntimeApplicationDispatcher::LaunchApplication( - const cast::runtime::LaunchApplicationRequest& request, - cast::runtime::LaunchApplicationResponse* response, - GrpcMethod* callback) { +void RuntimeApplicationDispatcher::HandleLaunchApplication( + cast::runtime::LaunchApplicationRequest request, + cast::runtime::RuntimeServiceHandler::LaunchApplication::Reactor* reactor) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!app_->Launch(request)) { std::stringstream err_stream; err_stream << "failed to launch RuntimeApplication (session id: " @@ -184,96 +179,155 @@ : "NONE") << ")"; ResetApp(); - callback->StepGRPC(grpc::Status(grpc::INTERNAL, err_stream.str())); + reactor->Write(grpc::Status(grpc::INTERNAL, err_stream.str())); return; } - callback->StepGRPC(grpc::Status::OK); + + reactor->Write(cast::runtime::LaunchApplicationResponse()); } -void RuntimeApplicationDispatcher::StopApplication( - const cast::runtime::StopApplicationRequest& request, - cast::runtime::StopApplicationResponse* response, - GrpcMethod* callback) { - response->set_app_id(app_->app_config().app_id()); - response->set_cast_session_id(app_->cast_session_id()); +void RuntimeApplicationDispatcher::HandleStopApplication( + cast::runtime::StopApplicationRequest request, + cast::runtime::RuntimeServiceHandler::StopApplication::Reactor* reactor) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (!app_) { + reactor->Write(grpc::Status(grpc::StatusCode::FAILED_PRECONDITION, + "No application is running")); + return; + } + + // Reset the app only after the response is constructed. + cast::runtime::StopApplicationResponse response; + response.set_app_id(app_->app_config().app_id()); + response.set_cast_session_id(app_->cast_session_id()); + ResetApp(); - callback->StepGRPC(grpc::Status::OK); + reactor->Write(std::move(response)); } -void RuntimeApplicationDispatcher::Heartbeat( - const cast::runtime::HeartbeatRequest& request, - HeartbeatMethod* heartbeat) { - if (heartbeat_) { - heartbeat->Finish(grpc::Status::CANCELLED); - return; - } +void RuntimeApplicationDispatcher::HandleHeartbeat( + cast::runtime::HeartbeatRequest request, + cast::runtime::RuntimeServiceHandler::Heartbeat::Reactor* reactor) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(!heartbeat_reactor_); + if (!request.has_heartbeat_period() || request.heartbeat_period().seconds() <= 0) { - heartbeat->Finish(grpc::Status::CANCELLED); + reactor->Write(grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, + "Incorrect heartbeat period")); return; } - heartbeat_period_ = request.heartbeat_period().seconds(); - heartbeat_ = heartbeat; + + heartbeat_period_ = base::Seconds(request.heartbeat_period().seconds()); + heartbeat_reactor_ = reactor; + heartbeat_reactor_->SetWritesAvailableCallback(base::BindPostTask( + task_runner_, + base::BindRepeating(&RuntimeApplicationDispatcher::OnHeartbeatSent, + weak_factory_.GetWeakPtr()))); DVLOG(2) << "Starting heartbeat ticking with period: " << heartbeat_period_ << " seconds"; + SendHeartbeat(); } -void RuntimeApplicationDispatcher::StartMetricsRecorder( - const cast::runtime::StartMetricsRecorderRequest& request, - cast::runtime::StartMetricsRecorderResponse* response, - GrpcMethod* callback) { - auto metrics_channel = grpc::CreateChannel( - request.metrics_recorder_service_info().grpc_endpoint(), - grpc::InsecureChannelCredentials()); - if (!metrics_channel) { - DLOG(WARNING) << "Failed to open a channel to MetricsRecorderService."; - callback->StepGRPC( - grpc::Status(grpc::StatusCode::INTERNAL, - "Failed to open channel to MetricsRecorderService")); +void RuntimeApplicationDispatcher::HandleStartMetricsRecorder( + cast::runtime::StartMetricsRecorderRequest request, + cast::runtime::RuntimeServiceHandler::StartMetricsRecorder::Reactor* + reactor) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (request.metrics_recorder_service_info().grpc_endpoint().empty()) { + reactor->Write(grpc::Status(grpc::StatusCode::INVALID_ARGUMENT, + "MetricsRecord service endpoint is missing")); return; } - metrics_recorder_stub_ = cast::metrics::MetricsRecorderService::NewStub( - std::move(metrics_channel)); - metrics_recorder_service_ = - std::make_unique<CastRuntimeMetricsRecorderService>( - &metrics_recorder_, &action_recorder_, this, - kDefaultMetricsReportInterval); - DVLOG(2) << "MetricsRecorderService started"; - callback->StepGRPC(grpc::Status::OK); + metrics_recorder_stub_.emplace( + request.metrics_recorder_service_info().grpc_endpoint()); + metrics_recorder_service_.emplace( + &metrics_recorder_, &action_recorder_, + base::BindRepeating(&RuntimeApplicationDispatcher::RecordMetrics, + weak_factory_.GetWeakPtr()), + kDefaultMetricsReportInterval); + DVLOG(2) << "MetricsRecorderService connected: endpoint=" + << request.metrics_recorder_service_info().grpc_endpoint(); + reactor->Write(cast::runtime::StartMetricsRecorderResponse()); } -void RuntimeApplicationDispatcher::StopMetricsRecorder( - const cast::runtime::StopMetricsRecorderRequest& request, - cast::runtime::StopMetricsRecorderResponse* response, - GrpcMethod* callback) { - metrics_recorder_client_->OnCloseSoon(base::BindOnce( +void RuntimeApplicationDispatcher::HandleStopMetricsRecorder( + cast::runtime::StopMetricsRecorderRequest request, + cast::runtime::RuntimeServiceHandler::StopMetricsRecorder::Reactor* + reactor) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + metrics_recorder_service_->OnCloseSoon(base::BindOnce( &RuntimeApplicationDispatcher::OnMetricsRecorderServiceStopped, - base::Unretained(this), base::Unretained(callback))); + weak_factory_.GetWeakPtr(), std::move(reactor))); } void RuntimeApplicationDispatcher::SendHeartbeat() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(heartbeat_reactor_); DVLOG(2) << "Sending heartbeat"; - if (heartbeat_) { - heartbeat_->Tick(); - task_runner_->PostDelayedTask( - FROM_HERE, - base::BindOnce(&RuntimeApplicationDispatcher::SendHeartbeat, - weak_factory_.GetWeakPtr()), - base::Seconds(heartbeat_period_)); - } + heartbeat_reactor_->Write(cast::runtime::HeartbeatResponse()); } -void RuntimeApplicationDispatcher::OnRecordComplete() { - metrics_recorder_client_->OnRecordComplete(); +void RuntimeApplicationDispatcher::OnHeartbeatSent( + cast::utils::GrpcStatusOr< + cast::runtime::RuntimeServiceHandler::Heartbeat::Reactor*> reactor_or) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (!reactor_or.ok()) { + heartbeat_reactor_ = nullptr; + LOG(ERROR) << "Failed to send heartbeats: " << reactor_or.ToString(); + return; + } + + heartbeat_reactor_ = std::move(reactor_or).value(); + heartbeat_timer_.Start( + FROM_HERE, heartbeat_period_, + base::BindPostTask( + task_runner_, + base::BindOnce(&RuntimeApplicationDispatcher::SendHeartbeat, + weak_factory_.GetWeakPtr()))); +} + +void RuntimeApplicationDispatcher::RecordMetrics( + cast::metrics::RecordRequest request, + CastRuntimeMetricsRecorderService::RecordCompleteCallback + record_complete_callback) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (!metrics_recorder_stub_) { + std::move(record_complete_callback).Run(); + return; + } + + auto call = + metrics_recorder_stub_ + ->CreateCall<cast::metrics::MetricsRecorderServiceStub::Record>( + std::move(request)); + std::move(call).InvokeAsync(base::BindPostTask( + task_runner_, + base::BindOnce(&RuntimeApplicationDispatcher::OnMetricsRecordComplete, + weak_factory_.GetWeakPtr(), + std::move(record_complete_callback)))); +} + +void RuntimeApplicationDispatcher::OnMetricsRecordComplete( + CastRuntimeMetricsRecorderService::RecordCompleteCallback + record_complete_callback, + cast::utils::GrpcStatusOr<cast::metrics::RecordResponse> response_or) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + if (!response_or.ok()) { + LOG(ERROR) << "Failed to record metrics: " << response_or.ToString(); + } + + std::move(record_complete_callback).Run(); } void RuntimeApplicationDispatcher::OnMetricsRecorderServiceStopped( - GrpcMethod* callback) { + cast::runtime::RuntimeServiceHandler::StopMetricsRecorder::Reactor* + reactor) { DVLOG(2) << "MetricsRecorderService stopped"; metrics_recorder_service_.reset(); - callback->StepGRPC(grpc::Status::OK); + reactor->Write(cast::runtime::StopMetricsRecorderResponse()); } void RuntimeApplicationDispatcher::ResetApp() {
diff --git a/chromecast/cast_core/runtime/browser/runtime_application_dispatcher.h b/chromecast/cast_core/runtime/browser/runtime_application_dispatcher.h index 2069588..ad0690c 100644 --- a/chromecast/cast_core/runtime/browser/runtime_application_dispatcher.h +++ b/chromecast/cast_core/runtime/browser/runtime_application_dispatcher.h
@@ -8,16 +8,17 @@ #include <memory> #include "base/memory/weak_ptr.h" +#include "base/timer/timer.h" +#include "chromecast/cast_core/grpc/grpc_server.h" #include "chromecast/cast_core/runtime/browser/cast_runtime_action_recorder.h" #include "chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder.h" #include "chromecast/cast_core/runtime/browser/cast_runtime_metrics_recorder_service.h" #include "chromecast/cast_core/runtime/browser/grpc/grpc_method.h" #include "chromecast/cast_core/runtime/browser/grpc/grpc_server.h" -#include "chromecast/cast_core/runtime/browser/metrics_recorder_grpc.h" -#include "chromecast/cast_core/runtime/browser/runtime_service_grpc_impl.h" #include "components/cast_streaming/browser/public/network_context_getter.h" -#include "third_party/cast_core/public/src/proto/metrics/metrics_recorder.grpc.pb.h" -#include "third_party/grpc/src/include/grpcpp/server.h" +#include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/cast_core/public/src/proto/metrics/metrics_recorder.castcore.pb.h" +#include "third_party/cast_core/public/src/proto/runtime/runtime_service.castcore.pb.h" namespace chromecast { @@ -29,9 +30,7 @@ class RuntimeApplication; class RuntimeApplicationWatcher; -class RuntimeApplicationDispatcher final : public GrpcServer, - public RuntimeServiceDelegate, - public MetricsRecorderGrpc { +class RuntimeApplicationDispatcher { public: RuntimeApplicationDispatcher( CastWebService* web_service, @@ -39,97 +38,87 @@ cast_streaming::NetworkContextGetter network_context_getter, media::VideoPlaneController* video_plane_controller, RuntimeApplicationWatcher* application_watcher); - ~RuntimeApplicationDispatcher() override; + ~RuntimeApplicationDispatcher(); // Starts and stops the runtime service, including the gRPC completion queue. bool Start(const std::string& runtime_id, - const std::string& runtime_service_path); + const std::string& runtime_service_endpoint); void Stop(); - // RuntimeServiceDelegate implementation: - void LoadApplication(const cast::runtime::LoadApplicationRequest& request, - cast::runtime::LoadApplicationResponse* response, - GrpcMethod* callback) override; - void LaunchApplication(const cast::runtime::LaunchApplicationRequest& request, - cast::runtime::LaunchApplicationResponse* response, - GrpcMethod* callback) override; - void StopApplication(const cast::runtime::StopApplicationRequest& request, - cast::runtime::StopApplicationResponse* response, - GrpcMethod* callback) override; - void Heartbeat(const cast::runtime::HeartbeatRequest& request, - HeartbeatMethod* heartbeat) override; - void StartMetricsRecorder( - const cast::runtime::StartMetricsRecorderRequest& request, - cast::runtime::StartMetricsRecorderResponse* response, - GrpcMethod* callback) override; - void StopMetricsRecorder( - const cast::runtime::StopMetricsRecorderRequest& request, - cast::runtime::StopMetricsRecorderResponse* response, - GrpcMethod* callback) override; - const std::string& GetCastMediaServiceGrpcEndpoint() const; CastWebService* GetCastWebService() const; RuntimeApplication* GetRuntimeApplication(); private: - // This class handles asynchronously calling MetricsRecorderService->Record - // and notifying RuntimeApplicationDispatcher when it completes. There should - // only be one of these at a time. - class AsyncMetricsRecord final : public GrpcCall { - public: - AsyncMetricsRecord( - const cast::metrics::RecordRequest& request, - cast::metrics::MetricsRecorderService::Stub* metrics_recorder_stub, - grpc::CompletionQueue* cq, - base::WeakPtr<RuntimeApplicationDispatcher> runtime_service); - ~AsyncMetricsRecord() override; + // RuntimeService gRPC handlers: + void HandleLoadApplication( + cast::runtime::LoadApplicationRequest request, + cast::runtime::RuntimeServiceHandler::LoadApplication::Reactor* reactor); + void HandleLaunchApplication( + cast::runtime::LaunchApplicationRequest request, + cast::runtime::RuntimeServiceHandler::LaunchApplication::Reactor* + reactor); + void HandleStopApplication( + cast::runtime::StopApplicationRequest request, + cast::runtime::RuntimeServiceHandler::StopApplication::Reactor* reactor); + void HandleHeartbeat( + cast::runtime::HeartbeatRequest request, + cast::runtime::RuntimeServiceHandler::Heartbeat::Reactor* reactor); + void HandleStartMetricsRecorder( + cast::runtime::StartMetricsRecorderRequest request, + cast::runtime::RuntimeServiceHandler::StartMetricsRecorder::Reactor* + reactor); + void HandleStopMetricsRecorder( + cast::runtime::StopMetricsRecorderRequest request, + cast::runtime::RuntimeServiceHandler::StopMetricsRecorder::Reactor* + reactor); - // GrpcCall implementation: - void StepGRPC(grpc::Status status) override; - - private: - base::WeakPtr<RuntimeApplicationDispatcher> runtime_service_; - - cast::metrics::RecordResponse response_; - std::unique_ptr< - grpc::ClientAsyncResponseReader<cast::metrics::RecordResponse>> - response_reader_; - }; - + // Helper methods. void SendHeartbeat(); - void OnRecordComplete(); - void OnMetricsRecorderServiceStopped(GrpcMethod* callback); + void OnHeartbeatSent( + cast::utils::GrpcStatusOr< + cast::runtime::RuntimeServiceHandler::Heartbeat::Reactor*> + reactor_or); + void RecordMetrics(cast::metrics::RecordRequest request, + CastRuntimeMetricsRecorderService::RecordCompleteCallback + record_complete_callback); + void OnMetricsRecordComplete( + CastRuntimeMetricsRecorderService::RecordCompleteCallback + record_complete_callback, + cast::utils::GrpcStatusOr<cast::metrics::RecordResponse> response_or); + void OnMetricsRecorderServiceStopped( + cast::runtime::RuntimeServiceHandler::StopMetricsRecorder::Reactor* + reactor); void ResetApp(); - // MetricsRecorderGrpc implementation: - void Record(const cast::metrics::RecordRequest& request) override; - CastWebService* const web_service_; - cast_streaming::NetworkContextGetter network_context_getter_; - std::unique_ptr<RuntimeApplication> app_; - // These variables support the runtime heartbeat stream. |heartbeat_| will - // live until Finish() is called, but it is a GrpcMethod so it is unowned. - HeartbeatMethod* heartbeat_{nullptr}; - int64_t heartbeat_period_{0}; + // Heartbeat period as set by Cast Core. + base::TimeDelta heartbeat_period_; + // Heartbeat timeout timer. + base::OneShotTimer heartbeat_timer_; + // Server streaming reactor used to send the heartbeats to Cast Core. + cast::runtime::RuntimeServiceHandler::Heartbeat::Reactor* heartbeat_reactor_ = + nullptr; // Allows histogram and action recording, which can be reported by // CastRuntimeMetricsRecorderService if Cast Core starts it. CastRuntimeMetricsRecorder metrics_recorder_; CastRuntimeActionRecorder action_recorder_; - std::string runtime_id_; - std::string runtime_service_path_; - std::unique_ptr<cast::metrics::MetricsRecorderService::Stub> + absl::optional<cast::utils::GrpcServer> grpc_server_; + absl::optional<cast::metrics::MetricsRecorderServiceStub> metrics_recorder_stub_; - cast::runtime::RuntimeService::AsyncService grpc_runtime_service_; - std::unique_ptr<CastRuntimeMetricsRecorderService> metrics_recorder_service_; + absl::optional<CastRuntimeMetricsRecorderService> metrics_recorder_service_; media::VideoPlaneController* video_plane_controller_; RuntimeApplicationWatcher* application_watcher_; + scoped_refptr<base::SequencedTaskRunner> task_runner_; + + SEQUENCE_CHECKER(sequence_checker_); base::WeakPtrFactory<RuntimeApplicationDispatcher> weak_factory_{this}; };
diff --git a/chromecast/cast_core/runtime/browser/runtime_service_grpc_impl.cc b/chromecast/cast_core/runtime/browser/runtime_service_grpc_impl.cc deleted file mode 100644 index 0320c0b..0000000 --- a/chromecast/cast_core/runtime/browser/runtime_service_grpc_impl.cc +++ /dev/null
@@ -1,246 +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 "chromecast/cast_core/runtime/browser/runtime_service_grpc_impl.h" - -#include "base/logging.h" -#include "chromecast/cast_core/runtime/browser/grpc/simple_async_grpc.h" - -namespace chromecast { -namespace { - -class LoadApplication final - : public SimpleAsyncGrpc<LoadApplication, - cast::runtime::LoadApplicationRequest, - cast::runtime::LoadApplicationResponse> { - public: - LoadApplication(cast::runtime::RuntimeService::AsyncService* service, - base::WeakPtr<RuntimeServiceDelegate> delegate, - grpc::ServerCompletionQueue* cq, - bool* is_shutdown) - : SimpleAsyncGrpc(cq), - is_shutdown_(is_shutdown), - delegate_(delegate), - service_(service) { - DCHECK(!*is_shutdown_); - service_->RequestLoadApplication(&ctx_, &request_, &responder_, cq_, cq_, - static_cast<GRPC*>(this)); - } - - cast::runtime::RuntimeService::AsyncService* service() { return service_; } - base::WeakPtr<RuntimeServiceDelegate> delegate() { return delegate_; } - bool* is_shutdown() { return is_shutdown_; } - - void DoMethod() { delegate_->LoadApplication(request_, &response_, this); } - - private: - bool* is_shutdown_; - base::WeakPtr<RuntimeServiceDelegate> delegate_; - cast::runtime::RuntimeService::AsyncService* service_; -}; - -class LaunchApplication final - : public SimpleAsyncGrpc<LaunchApplication, - cast::runtime::LaunchApplicationRequest, - cast::runtime::LaunchApplicationResponse> { - public: - LaunchApplication(cast::runtime::RuntimeService::AsyncService* service, - base::WeakPtr<RuntimeServiceDelegate> delegate, - grpc::ServerCompletionQueue* cq, - bool* is_shutdown) - : SimpleAsyncGrpc(cq), - is_shutdown_(is_shutdown), - delegate_(delegate), - service_(service) { - DCHECK(!*is_shutdown_); - service_->RequestLaunchApplication(&ctx_, &request_, &responder_, cq_, cq_, - static_cast<GRPC*>(this)); - } - - cast::runtime::RuntimeService::AsyncService* service() { return service_; } - base::WeakPtr<RuntimeServiceDelegate> delegate() { return delegate_; } - bool* is_shutdown() { return is_shutdown_; } - - void DoMethod() { delegate_->LaunchApplication(request_, &response_, this); } - - private: - bool* is_shutdown_; - base::WeakPtr<RuntimeServiceDelegate> delegate_; - cast::runtime::RuntimeService::AsyncService* service_; -}; - -class StopApplication final - : public SimpleAsyncGrpc<StopApplication, - cast::runtime::StopApplicationRequest, - cast::runtime::StopApplicationResponse> { - public: - StopApplication(cast::runtime::RuntimeService::AsyncService* service, - base::WeakPtr<RuntimeServiceDelegate> delegate, - grpc::ServerCompletionQueue* cq, - bool* is_shutdown) - : SimpleAsyncGrpc(cq), - is_shutdown_(is_shutdown), - delegate_(delegate), - service_(service) { - DCHECK(!*is_shutdown_); - service_->RequestStopApplication(&ctx_, &request_, &responder_, cq_, cq_, - static_cast<GRPC*>(this)); - } - - cast::runtime::RuntimeService::AsyncService* service() { return service_; } - base::WeakPtr<RuntimeServiceDelegate> delegate() { return delegate_; } - bool* is_shutdown() { return is_shutdown_; } - - void DoMethod() { delegate_->StopApplication(request_, &response_, this); } - - private: - bool* is_shutdown_; - base::WeakPtr<RuntimeServiceDelegate> delegate_; - cast::runtime::RuntimeService::AsyncService* service_; -}; - -class StartMetricsRecorder final - : public SimpleAsyncGrpc<StartMetricsRecorder, - cast::runtime::StartMetricsRecorderRequest, - cast::runtime::StartMetricsRecorderResponse> { - public: - StartMetricsRecorder(cast::runtime::RuntimeService::AsyncService* service, - base::WeakPtr<RuntimeServiceDelegate> delegate, - grpc::ServerCompletionQueue* cq, - bool* is_shutdown) - : SimpleAsyncGrpc(cq), - is_shutdown_(is_shutdown), - delegate_(delegate), - service_(service) { - DCHECK(!*is_shutdown_); - service_->RequestStartMetricsRecorder(&ctx_, &request_, &responder_, cq_, - cq_, static_cast<GRPC*>(this)); - } - - cast::runtime::RuntimeService::AsyncService* service() { return service_; } - base::WeakPtr<RuntimeServiceDelegate> delegate() { return delegate_; } - bool* is_shutdown() { return is_shutdown_; } - - void DoMethod() { - delegate_->StartMetricsRecorder(request_, &response_, this); - } - - private: - bool* is_shutdown_; - base::WeakPtr<RuntimeServiceDelegate> delegate_; - cast::runtime::RuntimeService::AsyncService* service_; -}; - -class StopMetricsRecorder final - : public SimpleAsyncGrpc<StopMetricsRecorder, - cast::runtime::StopMetricsRecorderRequest, - cast::runtime::StopMetricsRecorderResponse> { - public: - StopMetricsRecorder(cast::runtime::RuntimeService::AsyncService* service, - base::WeakPtr<RuntimeServiceDelegate> delegate, - grpc::ServerCompletionQueue* cq, - bool* is_shutdown) - : SimpleAsyncGrpc(cq), - is_shutdown_(is_shutdown), - delegate_(delegate), - service_(service) { - DCHECK(!*is_shutdown_); - service_->RequestStopMetricsRecorder(&ctx_, &request_, &responder_, cq_, - cq_, static_cast<GRPC*>(this)); - } - - cast::runtime::RuntimeService::AsyncService* service() { return service_; } - base::WeakPtr<RuntimeServiceDelegate> delegate() { return delegate_; } - bool* is_shutdown() { return is_shutdown_; } - - void DoMethod() { - delegate_->StopMetricsRecorder(request_, &response_, this); - } - - private: - bool* is_shutdown_; - base::WeakPtr<RuntimeServiceDelegate> delegate_; - cast::runtime::RuntimeService::AsyncService* service_; -}; - -} // namespace - -RuntimeServiceDelegate::~RuntimeServiceDelegate() = default; - -HeartbeatMethod::HeartbeatMethod( - cast::runtime::RuntimeService::AsyncService* service, - base::WeakPtr<RuntimeServiceDelegate> delegate, - grpc::ServerCompletionQueue* cq, - bool* is_shutdown) - : GrpcMethod(cq), - is_shutdown_(is_shutdown), - service_(service), - delegate_(delegate), - responder_(&ctx_) { - DCHECK(!*is_shutdown_); - service_->RequestHeartbeat(&ctx_, &request_, &responder_, cq_, cq_, - static_cast<GRPC*>(this)); -} - -HeartbeatMethod::~HeartbeatMethod() = default; - -void HeartbeatMethod::Tick() { - DCHECK(delegate_); - DCHECK(!*is_shutdown_); - if (state_ == kWriteReady) { - cast::runtime::HeartbeatResponse response; - responder_.Write(response, this); - state_ = kWritePending; - } -} - -void HeartbeatMethod::Finish(grpc::Status status) { - DCHECK(delegate_); - DCHECK(!*is_shutdown_); - responder_.Finish(status, static_cast<GRPC*>(this)); - state_ = kFinish; - Done(); -} - -GrpcMethod* HeartbeatMethod::Clone() { - if (!delegate_ || *is_shutdown_) { - return nullptr; - } - return new HeartbeatMethod(service_, delegate_, cq_, is_shutdown_); -} - -void HeartbeatMethod::StepInternal(grpc::Status status) { - switch (state_) { - case kStart: - DCHECK(status.ok()); - state_ = kWriteReady; - if (delegate_) { - delegate_->Heartbeat(request_, this); - } else { - delete this; - } - break; - case kWritePending: - state_ = kWriteReady; - break; - default: - NOTREACHED(); - break; - } -} - -void StartRuntimeServiceMethods( - cast::runtime::RuntimeService::AsyncService* service, - base::WeakPtr<RuntimeServiceDelegate> delegate, - ::grpc::ServerCompletionQueue* cq, - bool* is_shutdown) { - new LoadApplication(service, delegate, cq, is_shutdown); - new LaunchApplication(service, delegate, cq, is_shutdown); - new StopApplication(service, delegate, cq, is_shutdown); - new HeartbeatMethod(service, delegate, cq, is_shutdown); - new StartMetricsRecorder(service, delegate, cq, is_shutdown); - new StopMetricsRecorder(service, delegate, cq, is_shutdown); -} - -} // namespace chromecast
diff --git a/chromecast/cast_core/runtime/browser/runtime_service_grpc_impl.h b/chromecast/cast_core/runtime/browser/runtime_service_grpc_impl.h deleted file mode 100644 index 8fff6df..0000000 --- a/chromecast/cast_core/runtime/browser/runtime_service_grpc_impl.h +++ /dev/null
@@ -1,86 +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 CHROMECAST_CAST_CORE_RUNTIME_BROWSER_RUNTIME_SERVICE_GRPC_IMPL_H_ -#define CHROMECAST_CAST_CORE_RUNTIME_BROWSER_RUNTIME_SERVICE_GRPC_IMPL_H_ - -#include "base/memory/weak_ptr.h" -#include "chromecast/cast_core/runtime/browser/grpc/grpc_method.h" -#include "third_party/cast_core/public/src/proto/runtime/runtime_service.grpc.pb.h" -#include "third_party/grpc/src/include/grpcpp/completion_queue.h" -#include "third_party/grpc/src/include/grpcpp/server_context.h" - -namespace chromecast { - -class GrpcMethod; -class HeartbeatMethod; - -class RuntimeServiceDelegate { - public: - virtual ~RuntimeServiceDelegate() = 0; - - virtual void LoadApplication( - const cast::runtime::LoadApplicationRequest& request, - cast::runtime::LoadApplicationResponse* response, - GrpcMethod* callback) = 0; - virtual void LaunchApplication( - const cast::runtime::LaunchApplicationRequest& request, - cast::runtime::LaunchApplicationResponse* response, - GrpcMethod* callback) = 0; - virtual void StopApplication( - const cast::runtime::StopApplicationRequest& request, - cast::runtime::StopApplicationResponse* response, - GrpcMethod* callback) = 0; - virtual void Heartbeat(const cast::runtime::HeartbeatRequest& request, - HeartbeatMethod* heartbeat) = 0; - virtual void StartMetricsRecorder( - const cast::runtime::StartMetricsRecorderRequest& request, - cast::runtime::StartMetricsRecorderResponse* response, - GrpcMethod* callback) = 0; - virtual void StopMetricsRecorder( - const cast::runtime::StopMetricsRecorderRequest& request, - cast::runtime::StopMetricsRecorderResponse* response, - GrpcMethod* callback) = 0; -}; - -class HeartbeatMethod final : public GrpcMethod { - public: - enum State { - kStart, - kWriteReady, - kWritePending, - kFinish, - }; - - HeartbeatMethod(cast::runtime::RuntimeService::AsyncService* service, - base::WeakPtr<RuntimeServiceDelegate> delegate, - grpc::ServerCompletionQueue* cq, - bool* is_shutdown); - ~HeartbeatMethod() override; - - void Tick(); - void Finish(grpc::Status status); - - // GrpcMethod implementation: - GrpcMethod* Clone() override; - void StepInternal(grpc::Status status) override; - - private: - State state_{kStart}; - bool* is_shutdown_; - cast::runtime::RuntimeService::AsyncService* service_; - base::WeakPtr<RuntimeServiceDelegate> delegate_; - cast::runtime::HeartbeatRequest request_; - grpc::ServerAsyncWriter<cast::runtime::HeartbeatResponse> responder_; -}; - -void StartRuntimeServiceMethods( - cast::runtime::RuntimeService::AsyncService* service, - base::WeakPtr<RuntimeServiceDelegate> delegate, - ::grpc::ServerCompletionQueue* cq, - bool* is_shutdown); - -} // namespace chromecast - -#endif // CHROMECAST_CAST_CORE_RUNTIME_BROWSER_RUNTIME_SERVICE_GRPC_IMPL_H_
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index e68d3b9..559ad52d 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -14477.0.0 \ No newline at end of file +14480.0.0 \ No newline at end of file
diff --git a/chromeos/crosapi/mojom/crosapi.mojom b/chromeos/crosapi/mojom/crosapi.mojom index 82120d3..4a3740f3 100644 --- a/chromeos/crosapi/mojom/crosapi.mojom +++ b/chromeos/crosapi/mojom/crosapi.mojom
@@ -860,6 +860,29 @@ bool is_device_enterprised_managed@35; }; +// Parameters to specify OpenUrl behavior. +[Stable] +struct OpenUrlParams { + // Decides the disposition of the opening page. + [Stable, Extensible] + enum WindowOpenDisposition { + // DEPRECATED. OpenUrl used to check the URL to decide the disposition + // of the page. This is kept just for the compatibility. New callers + // should not use this value. + [Default] kLegacyAutoDetection = 0, + + // Opens a new tab and navigate to the given URL. + kNewForegroundTab = 1, + + // If there's an existing tab showing the given URL, activate it. + // If not, if the tab is NTP and does not have history, navigate it + // to the given URL. Otherwise, opens a new tab and navigate it to + // the given URL. + kSwitchToTab = 2, + }; + WindowOpenDisposition disposition@0; +}; + // BrowserService defines the APIs that live in a browser (such as // lacros-chrome) and are accessed from ash-chrome. // IMPORTANT NOTE: If you are exposing a new capability from Lacros to Ash, @@ -867,7 +890,7 @@ // has accidentally become a kitchen sink for different features. This was not // intentional. // -// Next MinVersion: 62. +// Next MinVersion: 63. // Next ID: 14 // [Stable, Uuid="4e04dc16-b34c-40fd-9e3f-3c55c2c6cf91", @@ -921,7 +944,8 @@ // such as web-page opening request from ash features, or Crostini/ARC apps. // Added in M96. [MinVersion=12] - OpenUrl@10(url.mojom.Url url) => (); + OpenUrl@10(url.mojom.Url url, + [MinVersion=62] OpenUrlParams? params) => (); // Restores a tab (or a window) recently closed in the browser with, // currently, the last used profile. Please see also RestoreTab command
diff --git a/chromeos/profiles/atom.afdo.newest.txt b/chromeos/profiles/atom.afdo.newest.txt index 9045ee0..79836542 100644 --- a/chromeos/profiles/atom.afdo.newest.txt +++ b/chromeos/profiles/atom.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-atom-99-4827.0-1643020945-benchmark-99.0.4844.7-r1-redacted.afdo.xz +chromeos-chrome-amd64-atom-99-4827.0-1643020945-benchmark-99.0.4844.9-r1-redacted.afdo.xz
diff --git a/chromeos/profiles/bigcore.afdo.newest.txt b/chromeos/profiles/bigcore.afdo.newest.txt index 0f7eed8..8eb0d36 100644 --- a/chromeos/profiles/bigcore.afdo.newest.txt +++ b/chromeos/profiles/bigcore.afdo.newest.txt
@@ -1 +1 @@ -chromeos-chrome-amd64-bigcore-99-4827.0-1643023166-benchmark-99.0.4844.7-r1-redacted.afdo.xz +chromeos-chrome-amd64-bigcore-99-4827.0-1643023166-benchmark-99.0.4844.9-r1-redacted.afdo.xz
diff --git a/chromeos/services/secure_channel/DEPS b/chromeos/services/secure_channel/DEPS index 4d737496..c01c68e4 100644 --- a/chromeos/services/secure_channel/DEPS +++ b/chromeos/services/secure_channel/DEPS
@@ -1,4 +1,6 @@ include_rules = [ + # TODO(https://crbug.com/1164001): allow these headers while being migrated. + "+ash/services/secure_channel", "+chromeos/components/multidevice/logging/logging.h", "+device/bluetooth", "+mojo/public",
diff --git a/chromeos/services/secure_channel/active_connection_manager_impl.h b/chromeos/services/secure_channel/active_connection_manager_impl.h index 46d3c761..830b8279 100644 --- a/chromeos/services/secure_channel/active_connection_manager_impl.h +++ b/chromeos/services/secure_channel/active_connection_manager_impl.h
@@ -7,11 +7,11 @@ #include <string> +#include "ash/services/secure_channel/public/cpp/shared/connection_medium.h" #include "base/containers/flat_map.h" #include "chromeos/services/secure_channel/active_connection_manager.h" #include "chromeos/services/secure_channel/connection_details.h" #include "chromeos/services/secure_channel/multiplexed_channel.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/authenticated_channel.cc b/chromeos/services/secure_channel/authenticated_channel.cc index ae91eef..85c1653 100644 --- a/chromeos/services/secure_channel/authenticated_channel.cc +++ b/chromeos/services/secure_channel/authenticated_channel.cc
@@ -4,10 +4,10 @@ #include "chromeos/services/secure_channel/authenticated_channel.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/guid.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/authenticated_channel.h b/chromeos/services/secure_channel/authenticated_channel.h index da97ca58..6ee6b64 100644 --- a/chromeos/services/secure_channel/authenticated_channel.h +++ b/chromeos/services/secure_channel/authenticated_channel.h
@@ -7,11 +7,11 @@ #include <string> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback_forward.h" #include "base/observer_list.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/authenticated_channel_impl.cc b/chromeos/services/secure_channel/authenticated_channel_impl.cc index 2e0769fb..5e9fc72 100644 --- a/chromeos/services/secure_channel/authenticated_channel_impl.cc +++ b/chromeos/services/secure_channel/authenticated_channel_impl.cc
@@ -4,6 +4,7 @@ #include "chromeos/services/secure_channel/authenticated_channel_impl.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/callback.h" #include "base/containers/contains.h" @@ -11,7 +12,6 @@ #include "base/memory/ptr_util.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/authenticated_channel_impl.h b/chromeos/services/secure_channel/authenticated_channel_impl.h index 048f6fc..7e8d590 100644 --- a/chromeos/services/secure_channel/authenticated_channel_impl.h +++ b/chromeos/services/secure_channel/authenticated_channel_impl.h
@@ -8,10 +8,10 @@ #include <string> #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "chromeos/services/secure_channel/authenticated_channel.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/secure_channel.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/authenticated_channel_impl_unittest.cc b/chromeos/services/secure_channel/authenticated_channel_impl_unittest.cc index 1c722dd..c37606c 100644 --- a/chromeos/services/secure_channel/authenticated_channel_impl_unittest.cc +++ b/chromeos/services/secure_channel/authenticated_channel_impl_unittest.cc
@@ -11,6 +11,8 @@ #include <utility> #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/containers/contains.h" #include "base/test/bind.h" @@ -20,8 +22,6 @@ #include "chromeos/services/secure_channel/fake_connection.h" #include "chromeos/services/secure_channel/fake_secure_channel_connection.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/ble_advertiser.h b/chromeos/services/secure_channel/ble_advertiser.h index abf23c15..8aa876d 100644 --- a/chromeos/services/secure_channel/ble_advertiser.h +++ b/chromeos/services/secure_channel/ble_advertiser.h
@@ -5,8 +5,9 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_BLE_ADVERTISER_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_BLE_ADVERTISER_H_ +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/ble_advertiser_impl.h b/chromeos/services/secure_channel/ble_advertiser_impl.h index 800640b9..50a99b7 100644 --- a/chromeos/services/secure_channel/ble_advertiser_impl.h +++ b/chromeos/services/secure_channel/ble_advertiser_impl.h
@@ -9,6 +9,7 @@ #include <memory> #include <utility> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/containers/flat_set.h" #include "base/memory/weak_ptr.h" #include "base/task/sequenced_task_runner.h" @@ -16,7 +17,6 @@ #include "chromeos/services/secure_channel/ble_advertiser.h" #include "chromeos/services/secure_channel/ble_constants.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace base {
diff --git a/chromeos/services/secure_channel/ble_connection_manager.h b/chromeos/services/secure_channel/ble_connection_manager.h index 0e42eb6..7f33afb 100644 --- a/chromeos/services/secure_channel/ble_connection_manager.h +++ b/chromeos/services/secure_channel/ble_connection_manager.h
@@ -7,6 +7,7 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" @@ -15,7 +16,6 @@ #include "chromeos/services/secure_channel/connection_attempt_details.h" #include "chromeos/services/secure_channel/connection_role.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/ble_connection_manager_impl.cc b/chromeos/services/secure_channel/ble_connection_manager_impl.cc index 0f753f23..df2ca6b 100644 --- a/chromeos/services/secure_channel/ble_connection_manager_impl.cc +++ b/chromeos/services/secure_channel/ble_connection_manager_impl.cc
@@ -6,6 +6,7 @@ #include <utility> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/containers/contains.h" #include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" @@ -18,7 +19,6 @@ #include "chromeos/services/secure_channel/ble_scanner_impl.h" #include "chromeos/services/secure_channel/ble_weave_client_connection.h" #include "chromeos/services/secure_channel/connection_metrics_logger.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "chromeos/services/secure_channel/secure_channel_disconnector.h" #include "device/bluetooth/public/cpp/bluetooth_uuid.h"
diff --git a/chromeos/services/secure_channel/ble_connection_manager_impl.h b/chromeos/services/secure_channel/ble_connection_manager_impl.h index 95a3509f..35c0628 100644 --- a/chromeos/services/secure_channel/ble_connection_manager_impl.h +++ b/chromeos/services/secure_channel/ble_connection_manager_impl.h
@@ -8,6 +8,7 @@ #include <memory> #include <utility> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/containers/flat_map.h" #include "base/memory/ref_counted.h" #include "base/time/default_clock.h" @@ -16,7 +17,6 @@ #include "chromeos/services/secure_channel/ble_scanner.h" #include "chromeos/services/secure_channel/connection_role.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/services/secure_channel/secure_channel.h" namespace device {
diff --git a/chromeos/services/secure_channel/ble_initiator_operation.h b/chromeos/services/secure_channel/ble_initiator_operation.h index dd540e5..593c2d5 100644 --- a/chromeos/services/secure_channel/ble_initiator_operation.h +++ b/chromeos/services/secure_channel/ble_initiator_operation.h
@@ -7,12 +7,13 @@ #include <memory> +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/services/secure_channel/ble_initiator_failure_type.h" #include "chromeos/services/secure_channel/connect_to_device_operation.h" #include "chromeos/services/secure_channel/connect_to_device_operation_base.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/ble_initiator_operation_unittest.cc b/chromeos/services/secure_channel/ble_initiator_operation_unittest.cc index 2fb0f20d..7525064 100644 --- a/chromeos/services/secure_channel/ble_initiator_operation_unittest.cc +++ b/chromeos/services/secure_channel/ble_initiator_operation_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/bind.h" #include "base/test/task_environment.h" #include "base/test/test_simple_task_runner.h" @@ -13,7 +14,6 @@ #include "chromeos/services/secure_channel/device_id_pair.h" #include "chromeos/services/secure_channel/fake_authenticated_channel.h" #include "chromeos/services/secure_channel/fake_ble_connection_manager.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/ble_listener_operation.h b/chromeos/services/secure_channel/ble_listener_operation.h index 86a82c7..79f7043 100644 --- a/chromeos/services/secure_channel/ble_listener_operation.h +++ b/chromeos/services/secure_channel/ble_listener_operation.h
@@ -7,12 +7,13 @@ #include <memory> +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/services/secure_channel/ble_listener_failure_type.h" #include "chromeos/services/secure_channel/connect_to_device_operation.h" #include "chromeos/services/secure_channel/connect_to_device_operation_base.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/ble_listener_operation_unittest.cc b/chromeos/services/secure_channel/ble_listener_operation_unittest.cc index 28e47d850..be974384 100644 --- a/chromeos/services/secure_channel/ble_listener_operation_unittest.cc +++ b/chromeos/services/secure_channel/ble_listener_operation_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/bind.h" #include "base/test/task_environment.h" #include "base/test/test_simple_task_runner.h" @@ -13,7 +14,6 @@ #include "chromeos/services/secure_channel/device_id_pair.h" #include "chromeos/services/secure_channel/fake_authenticated_channel.h" #include "chromeos/services/secure_channel/fake_ble_connection_manager.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/ble_scanner.h b/chromeos/services/secure_channel/ble_scanner.h index ffa5ced..1e672f1d 100644 --- a/chromeos/services/secure_channel/ble_scanner.h +++ b/chromeos/services/secure_channel/ble_scanner.h
@@ -7,6 +7,7 @@ #include <ostream> +#include "ash/services/secure_channel/public/cpp/shared/connection_medium.h" #include "base/containers/flat_set.h" #include "base/observer_list.h" #include "base/observer_list_types.h" @@ -14,7 +15,6 @@ #include "chromeos/services/secure_channel/connection_attempt_details.h" #include "chromeos/services/secure_channel/connection_role.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" namespace device { class BluetoothDevice;
diff --git a/chromeos/services/secure_channel/ble_weave_client_connection.cc b/chromeos/services/secure_channel/ble_weave_client_connection.cc index be983463..cbe54ea 100644 --- a/chromeos/services/secure_channel/ble_weave_client_connection.cc +++ b/chromeos/services/secure_channel/ble_weave_client_connection.cc
@@ -8,6 +8,7 @@ #include <sstream> #include <utility> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" @@ -19,7 +20,6 @@ #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/services/secure_channel/background_eid_generator.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/wire_message.h" #include "device/bluetooth/bluetooth_gatt_connection.h"
diff --git a/chromeos/services/secure_channel/ble_weave_client_connection.h b/chromeos/services/secure_channel/ble_weave_client_connection.h index 1a833c8..a57f8e0 100644 --- a/chromeos/services/secure_channel/ble_weave_client_connection.h +++ b/chromeos/services/secure_channel/ble_weave_client_connection.h
@@ -11,6 +11,7 @@ #include <memory> #include <string> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/queue.h" #include "base/gtest_prod_util.h" @@ -23,7 +24,6 @@ #include "chromeos/services/secure_channel/ble_weave_packet_receiver.h" #include "chromeos/services/secure_channel/connection.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/remote_attribute.h" #include "device/bluetooth/bluetooth_adapter.h" #include "device/bluetooth/bluetooth_device.h"
diff --git a/chromeos/services/secure_channel/channel_impl.cc b/chromeos/services/secure_channel/channel_impl.cc index aaebde18..6cb78cd 100644 --- a/chromeos/services/secure_channel/channel_impl.cc +++ b/chromeos/services/secure_channel/channel_impl.cc
@@ -4,10 +4,10 @@ #include "chromeos/services/secure_channel/channel_impl.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/callback.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote_set.h"
diff --git a/chromeos/services/secure_channel/channel_impl.h b/chromeos/services/secure_channel/channel_impl.h index 71ab981d1..caf325a 100644 --- a/chromeos/services/secure_channel/channel_impl.h +++ b/chromeos/services/secure_channel/channel_impl.h
@@ -7,11 +7,11 @@ #include <string> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback_forward.h" #include "base/memory/weak_ptr.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote_set.h"
diff --git a/chromeos/services/secure_channel/client_connection_parameters.h b/chromeos/services/secure_channel/client_connection_parameters.h index 75b7f2d..d92b263 100644 --- a/chromeos/services/secure_channel/client_connection_parameters.h +++ b/chromeos/services/secure_channel/client_connection_parameters.h
@@ -8,9 +8,9 @@ #include <ostream> #include <string> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/observer_list.h" #include "base/unguessable_token.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chromeos/services/secure_channel/client_connection_parameters_impl.h b/chromeos/services/secure_channel/client_connection_parameters_impl.h index af38b00..02da564 100644 --- a/chromeos/services/secure_channel/client_connection_parameters_impl.h +++ b/chromeos/services/secure_channel/client_connection_parameters_impl.h
@@ -5,8 +5,8 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_CLIENT_CONNECTION_PARAMETERS_IMPL_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_CLIENT_CONNECTION_PARAMETERS_IMPL_H_ +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "chromeos/services/secure_channel/client_connection_parameters.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/chromeos/services/secure_channel/connect_to_device_operation.h b/chromeos/services/secure_channel/connect_to_device_operation.h index 50f4efd..93e435d3 100644 --- a/chromeos/services/secure_channel/connect_to_device_operation.h +++ b/chromeos/services/secure_channel/connect_to_device_operation.h
@@ -5,10 +5,10 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_CONNECT_TO_DEVICE_OPERATION_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_CONNECT_TO_DEVICE_OPERATION_H_ +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/callback.h" #include "base/logging.h" #include "chromeos/components/multidevice/logging/logging.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/connect_to_device_operation_base.h b/chromeos/services/secure_channel/connect_to_device_operation_base.h index 6128404f..f1fed3b 100644 --- a/chromeos/services/secure_channel/connect_to_device_operation_base.h +++ b/chromeos/services/secure_channel/connect_to_device_operation_base.h
@@ -5,12 +5,12 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_CONNECT_TO_DEVICE_OPERATION_BASE_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_CONNECT_TO_DEVICE_OPERATION_BASE_H_ +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/bind.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/services/secure_channel/connect_to_device_operation.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/connection.cc b/chromeos/services/secure_channel/connection.cc index bff1095..0c7e0c25 100644 --- a/chromeos/services/secure_channel/connection.cc +++ b/chromeos/services/secure_channel/connection.cc
@@ -7,12 +7,12 @@ #include <sstream> #include <utility> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/logging.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/services/secure_channel/connection_observer.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/wire_message.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/connection.h b/chromeos/services/secure_channel/connection.h index 7293f43..9edb50d 100644 --- a/chromeos/services/secure_channel/connection.h +++ b/chromeos/services/secure_channel/connection.h
@@ -8,12 +8,12 @@ #include <memory> #include <ostream> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback_forward.h" #include "base/memory/ref_counted.h" #include "base/observer_list.h" #include "chromeos/components/multidevice/remote_device_ref.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/connection_attempt_base.h b/chromeos/services/secure_channel/connection_attempt_base.h index 6accdec..56161ae 100644 --- a/chromeos/services/secure_channel/connection_attempt_base.h +++ b/chromeos/services/secure_channel/connection_attempt_base.h
@@ -5,6 +5,7 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_CONNECTION_ATTEMPT_BASE_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_CONNECTION_ATTEMPT_BASE_H_ +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/bind.h" #include "base/containers/contains.h" #include "base/containers/flat_map.h" @@ -18,7 +19,6 @@ #include "chromeos/services/secure_channel/connection_attempt_details.h" #include "chromeos/services/secure_channel/connection_details.h" #include "chromeos/services/secure_channel/pending_connection_request.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/connection_attempt_base_unittest.cc b/chromeos/services/secure_channel/connection_attempt_base_unittest.cc index 807246d2..27bc6c1 100644 --- a/chromeos/services/secure_channel/connection_attempt_base_unittest.cc +++ b/chromeos/services/secure_channel/connection_attempt_base_unittest.cc
@@ -7,6 +7,8 @@ #include <algorithm> #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_medium.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/bind.h" #include "base/test/task_environment.h" #include "base/test/test_simple_task_runner.h" @@ -22,8 +24,6 @@ #include "chromeos/services/secure_channel/fake_connection_delegate.h" #include "chromeos/services/secure_channel/fake_pending_connection_request.h" #include "chromeos/services/secure_channel/pending_connection_request_delegate.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/connection_attempt_details.h b/chromeos/services/secure_channel/connection_attempt_details.h index 5860723d1..07513b8 100644 --- a/chromeos/services/secure_channel/connection_attempt_details.h +++ b/chromeos/services/secure_channel/connection_attempt_details.h
@@ -8,10 +8,10 @@ #include <ostream> #include <string> +#include "ash/services/secure_channel/public/cpp/shared/connection_medium.h" #include "chromeos/services/secure_channel/connection_details.h" #include "chromeos/services/secure_channel/connection_role.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/connection_details.h b/chromeos/services/secure_channel/connection_details.h index 95db18e..830f0c7b 100644 --- a/chromeos/services/secure_channel/connection_details.h +++ b/chromeos/services/secure_channel/connection_details.h
@@ -8,7 +8,7 @@ #include <ostream> #include <string> -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_medium.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/connection_unittest.cc b/chromeos/services/secure_channel/connection_unittest.cc index 18ae813..df8524e 100644 --- a/chromeos/services/secure_channel/connection_unittest.cc +++ b/chromeos/services/secure_channel/connection_unittest.cc
@@ -4,6 +4,7 @@ #include "chromeos/services/secure_channel/connection.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/callback.h" #include "base/memory/ptr_util.h" @@ -12,7 +13,6 @@ #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/services/secure_channel/connection_observer.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/wire_message.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/device_to_device_authenticator_unittest.cc b/chromeos/services/secure_channel/device_to_device_authenticator_unittest.cc index 9117f97..3caec9f 100644 --- a/chromeos/services/secure_channel/device_to_device_authenticator_unittest.cc +++ b/chromeos/services/secure_channel/device_to_device_authenticator_unittest.cc
@@ -8,6 +8,7 @@ #include <utility> #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/base64url.h" #include "base/bind.h" #include "base/callback.h" @@ -20,7 +21,6 @@ #include "chromeos/services/secure_channel/connection.h" #include "chromeos/services/secure_channel/device_to_device_responder_operations.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/secure_context.h" #include "chromeos/services/secure_channel/session_keys.h" #include "chromeos/services/secure_channel/wire_message.h"
diff --git a/chromeos/services/secure_channel/fake_authenticated_channel.cc b/chromeos/services/secure_channel/fake_authenticated_channel.cc index ed079eed..9622f50 100644 --- a/chromeos/services/secure_channel/fake_authenticated_channel.cc +++ b/chromeos/services/secure_channel/fake_authenticated_channel.cc
@@ -4,9 +4,9 @@ #include "chromeos/services/secure_channel/fake_authenticated_channel.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/register_payload_file_request.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/fake_authenticated_channel.h b/chromeos/services/secure_channel/fake_authenticated_channel.h index 169ce09..d653c2c 100644 --- a/chromeos/services/secure_channel/fake_authenticated_channel.h +++ b/chromeos/services/secure_channel/fake_authenticated_channel.h
@@ -9,11 +9,11 @@ #include <tuple> #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "chromeos/services/secure_channel/authenticated_channel.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/register_payload_file_request.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/fake_ble_advertiser.h b/chromeos/services/secure_channel/fake_ble_advertiser.h index b142b8a7..e8a8185a 100644 --- a/chromeos/services/secure_channel/fake_ble_advertiser.h +++ b/chromeos/services/secure_channel/fake_ble_advertiser.h
@@ -11,9 +11,9 @@ #include <utility> #include <vector> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/services/secure_channel/ble_advertiser.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/services/secure_channel/shared_resource_scheduler.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chromeos/services/secure_channel/fake_ble_connection_manager.h b/chromeos/services/secure_channel/fake_ble_connection_manager.h index d76d123..47b87163 100644 --- a/chromeos/services/secure_channel/fake_ble_connection_manager.h +++ b/chromeos/services/secure_channel/fake_ble_connection_manager.h
@@ -5,10 +5,10 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_BLE_CONNECTION_MANAGER_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_BLE_CONNECTION_MANAGER_H_ +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/services/secure_channel/ble_connection_manager.h" #include "chromeos/services/secure_channel/connection_role.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/fake_channel.cc b/chromeos/services/secure_channel/fake_channel.cc index f332b05d..27efeaf 100644 --- a/chromeos/services/secure_channel/fake_channel.cc +++ b/chromeos/services/secure_channel/fake_channel.cc
@@ -4,10 +4,10 @@ #include "chromeos/services/secure_channel/fake_channel.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/fake_channel.h b/chromeos/services/secure_channel/fake_channel.h index 7c46cff4..c7b073d 100644 --- a/chromeos/services/secure_channel/fake_channel.h +++ b/chromeos/services/secure_channel/fake_channel.h
@@ -9,10 +9,10 @@ #include <utility> #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/chromeos/services/secure_channel/fake_client_connection_parameters.h b/chromeos/services/secure_channel/fake_client_connection_parameters.h index 7a74eced..86c91eae 100644 --- a/chromeos/services/secure_channel/fake_client_connection_parameters.h +++ b/chromeos/services/secure_channel/fake_client_connection_parameters.h
@@ -5,10 +5,10 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_CLIENT_CONNECTION_PARAMETERS_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_CLIENT_CONNECTION_PARAMETERS_H_ +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "chromeos/services/secure_channel/client_connection_parameters.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h"
diff --git a/chromeos/services/secure_channel/fake_connect_to_device_operation.h b/chromeos/services/secure_channel/fake_connect_to_device_operation.h index d41d82e..92c54cd 100644 --- a/chromeos/services/secure_channel/fake_connect_to_device_operation.h +++ b/chromeos/services/secure_channel/fake_connect_to_device_operation.h
@@ -5,9 +5,9 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_CONNECT_TO_DEVICE_OPERATION_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_CONNECT_TO_DEVICE_OPERATION_H_ +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/callback.h" #include "chromeos/services/secure_channel/connect_to_device_operation.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/fake_connection.cc b/chromeos/services/secure_channel/fake_connection.cc index c68f6eb..e0dd7ee 100644 --- a/chromeos/services/secure_channel/fake_connection.cc +++ b/chromeos/services/secure_channel/fake_connection.cc
@@ -8,10 +8,10 @@ #include <utility> #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/cxx20_erase.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/register_payload_file_request.h" #include "chromeos/services/secure_channel/wire_message.h"
diff --git a/chromeos/services/secure_channel/fake_connection.h b/chromeos/services/secure_channel/fake_connection.h index d9304e1..9657a4a 100644 --- a/chromeos/services/secure_channel/fake_connection.h +++ b/chromeos/services/secure_channel/fake_connection.h
@@ -7,10 +7,10 @@ #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "chromeos/services/secure_channel/connection.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/register_payload_file_request.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chromeos/services/secure_channel/fake_connection_delegate.h b/chromeos/services/secure_channel/fake_connection_delegate.h index 945b29d..22fdf5ef 100644 --- a/chromeos/services/secure_channel/fake_connection_delegate.h +++ b/chromeos/services/secure_channel/fake_connection_delegate.h
@@ -5,7 +5,7 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_CONNECTION_DELEGATE_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_FAKE_CONNECTION_DELEGATE_H_ -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver_set.h"
diff --git a/chromeos/services/secure_channel/fake_file_payload_listener.cc b/chromeos/services/secure_channel/fake_file_payload_listener.cc index e36ac1d5..d6bbab5 100644 --- a/chromeos/services/secure_channel/fake_file_payload_listener.cc +++ b/chromeos/services/secure_channel/fake_file_payload_listener.cc
@@ -6,8 +6,8 @@ #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h"
diff --git a/chromeos/services/secure_channel/fake_file_payload_listener.h b/chromeos/services/secure_channel/fake_file_payload_listener.h index 9a7587e..ba62d2f 100644 --- a/chromeos/services/secure_channel/fake_file_payload_listener.h +++ b/chromeos/services/secure_channel/fake_file_payload_listener.h
@@ -7,7 +7,7 @@ #include <vector> -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h"
diff --git a/chromeos/services/secure_channel/fake_message_receiver.h b/chromeos/services/secure_channel/fake_message_receiver.h index 30b7fd7..ca3357dd 100644 --- a/chromeos/services/secure_channel/fake_message_receiver.h +++ b/chromeos/services/secure_channel/fake_message_receiver.h
@@ -8,7 +8,7 @@ #include <string> #include <vector> -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/fake_pending_connection_manager.h b/chromeos/services/secure_channel/fake_pending_connection_manager.h index 68778bb..059342f 100644 --- a/chromeos/services/secure_channel/fake_pending_connection_manager.h +++ b/chromeos/services/secure_channel/fake_pending_connection_manager.h
@@ -8,12 +8,12 @@ #include <tuple> #include <vector> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/services/secure_channel/client_connection_parameters.h" #include "chromeos/services/secure_channel/connection_attempt_details.h" #include "chromeos/services/secure_channel/connection_details.h" #include "chromeos/services/secure_channel/device_id_pair.h" #include "chromeos/services/secure_channel/pending_connection_manager.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/fake_secure_channel.h b/chromeos/services/secure_channel/fake_secure_channel.h index 3fa60e9f..6ad757b 100644 --- a/chromeos/services/secure_channel/fake_secure_channel.h +++ b/chromeos/services/secure_channel/fake_secure_channel.h
@@ -10,8 +10,8 @@ #include <tuple> #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "chromeos/components/multidevice/remote_device_cache.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "chromeos/services/secure_channel/secure_channel_base.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/chromeos/services/secure_channel/fake_secure_channel_connection.cc b/chromeos/services/secure_channel/fake_secure_channel_connection.cc index febfadc..d42e623f 100644 --- a/chromeos/services/secure_channel/fake_secure_channel_connection.cc +++ b/chromeos/services/secure_channel/fake_secure_channel_connection.cc
@@ -7,10 +7,10 @@ #include <utility> #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/check.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/register_payload_file_request.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/fake_secure_channel_connection.h b/chromeos/services/secure_channel/fake_secure_channel_connection.h index 8fa1164..b4ceaace 100644 --- a/chromeos/services/secure_channel/fake_secure_channel_connection.h +++ b/chromeos/services/secure_channel/fake_secure_channel_connection.h
@@ -7,10 +7,10 @@ #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "chromeos/services/secure_channel/connection.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/register_payload_file_request.h" #include "chromeos/services/secure_channel/secure_channel.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chromeos/services/secure_channel/fake_single_client_proxy.cc b/chromeos/services/secure_channel/fake_single_client_proxy.cc index 4b9bb50..b09296e 100644 --- a/chromeos/services/secure_channel/fake_single_client_proxy.cc +++ b/chromeos/services/secure_channel/fake_single_client_proxy.cc
@@ -4,10 +4,10 @@ #include "chromeos/services/secure_channel/fake_single_client_proxy.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/register_payload_file_request.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/fake_single_client_proxy.h b/chromeos/services/secure_channel/fake_single_client_proxy.h index c0160fb..c28a659 100644 --- a/chromeos/services/secure_channel/fake_single_client_proxy.h +++ b/chromeos/services/secure_channel/fake_single_client_proxy.h
@@ -8,11 +8,11 @@ #include <string> #include <utility> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/unguessable_token.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/register_payload_file_request.h" #include "chromeos/services/secure_channel/single_client_proxy.h"
diff --git a/chromeos/services/secure_channel/file_transfer_update_callback.h b/chromeos/services/secure_channel/file_transfer_update_callback.h index c9d5ecf..b66b0d2 100644 --- a/chromeos/services/secure_channel/file_transfer_update_callback.h +++ b/chromeos/services/secure_channel/file_transfer_update_callback.h
@@ -5,8 +5,8 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_FILE_TRANSFER_UPDATE_CALLBACK_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_FILE_TRANSFER_UPDATE_CALLBACK_H_ +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/multiplexed_channel_impl.cc b/chromeos/services/secure_channel/multiplexed_channel_impl.cc index 258dd23..2644222 100644 --- a/chromeos/services/secure_channel/multiplexed_channel_impl.cc +++ b/chromeos/services/secure_channel/multiplexed_channel_impl.cc
@@ -4,13 +4,13 @@ #include "chromeos/services/secure_channel/multiplexed_channel_impl.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/contains.h" #include "base/logging.h" #include "base/memory/ptr_util.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/single_client_proxy_impl.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/multiplexed_channel_impl.h b/chromeos/services/secure_channel/multiplexed_channel_impl.h index 67f2e1a..eb9b30c 100644 --- a/chromeos/services/secure_channel/multiplexed_channel_impl.h +++ b/chromeos/services/secure_channel/multiplexed_channel_impl.h
@@ -10,13 +10,13 @@ #include <utility> #include <vector> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "chromeos/services/secure_channel/authenticated_channel.h" #include "chromeos/services/secure_channel/connection_details.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" #include "chromeos/services/secure_channel/multiplexed_channel.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/single_client_proxy.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/multiplexed_channel_impl_unittest.cc b/chromeos/services/secure_channel/multiplexed_channel_impl_unittest.cc index 3f4c15c..ba4b2e65 100644 --- a/chromeos/services/secure_channel/multiplexed_channel_impl_unittest.cc +++ b/chromeos/services/secure_channel/multiplexed_channel_impl_unittest.cc
@@ -10,6 +10,8 @@ #include <utility> #include <vector> +#include "ash/services/secure_channel/public/cpp/shared/connection_medium.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/containers/contains.h" #include "base/test/bind.h" @@ -21,8 +23,6 @@ #include "chromeos/services/secure_channel/fake_multiplexed_channel.h" #include "chromeos/services/secure_channel/fake_single_client_proxy.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/single_client_proxy_impl.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/nearby_connection.cc b/chromeos/services/secure_channel/nearby_connection.cc index 93cddd8..c10ebf8 100644 --- a/chromeos/services/secure_channel/nearby_connection.cc +++ b/chromeos/services/secure_channel/nearby_connection.cc
@@ -4,6 +4,8 @@ #include "chromeos/services/secure_channel/nearby_connection.h" +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/callback.h" #include "base/check.h" @@ -13,8 +15,6 @@ #include "base/strings/string_split.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/wire_message.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver_set.h"
diff --git a/chromeos/services/secure_channel/nearby_connection.h b/chromeos/services/secure_channel/nearby_connection.h index b6e5c01..119fadc 100644 --- a/chromeos/services/secure_channel/nearby_connection.h +++ b/chromeos/services/secure_channel/nearby_connection.h
@@ -5,14 +5,14 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_NEARBY_CONNECTION_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_NEARBY_CONNECTION_H_ +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/containers/queue.h" #include "base/memory/weak_ptr.h" #include "chromeos/services/secure_channel/connection.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/chromeos/services/secure_channel/nearby_connection_manager.h b/chromeos/services/secure_channel/nearby_connection_manager.h index fa1c58b..226f908 100644 --- a/chromeos/services/secure_channel/nearby_connection_manager.h +++ b/chromeos/services/secure_channel/nearby_connection_manager.h
@@ -7,12 +7,12 @@ #include <memory> +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "base/callback.h" #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "chromeos/services/secure_channel/device_id_pair.h" #include "chromeos/services/secure_channel/nearby_initiator_failure_type.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/chromeos/services/secure_channel/nearby_connection_manager_impl_unittest.cc b/chromeos/services/secure_channel/nearby_connection_manager_impl_unittest.cc index 4715919..28330386 100644 --- a/chromeos/services/secure_channel/nearby_connection_manager_impl_unittest.cc +++ b/chromeos/services/secure_channel/nearby_connection_manager_impl_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/client/fake_nearby_connector.h" #include "base/test/task_environment.h" #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/services/secure_channel/authenticated_channel_impl.h" @@ -15,7 +16,6 @@ #include "chromeos/services/secure_channel/fake_secure_channel_connection.h" #include "chromeos/services/secure_channel/fake_secure_channel_disconnector.h" #include "chromeos/services/secure_channel/nearby_connection.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_nearby_connector.h" #include "chromeos/services/secure_channel/secure_channel.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/nearby_connection_unittest.cc b/chromeos/services/secure_channel/nearby_connection_unittest.cc index 8be3ff6..68b84ff 100644 --- a/chromeos/services/secure_channel/nearby_connection_unittest.cc +++ b/chromeos/services/secure_channel/nearby_connection_unittest.cc
@@ -4,6 +4,8 @@ #include "chromeos/services/secure_channel/nearby_connection.h" +#include "ash/services/secure_channel/public/cpp/client/fake_nearby_connector.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/files/file.h" #include "base/files/file_path.h" @@ -13,8 +15,6 @@ #include "chromeos/components/multidevice/remote_device_test_util.h" #include "chromeos/services/secure_channel/connection_observer.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_nearby_connector.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/wire_message.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/nearby_initiator_operation.h b/chromeos/services/secure_channel/nearby_initiator_operation.h index 8070750..bdcd8a1 100644 --- a/chromeos/services/secure_channel/nearby_initiator_operation.h +++ b/chromeos/services/secure_channel/nearby_initiator_operation.h
@@ -7,12 +7,12 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/services/secure_channel/connect_to_device_operation.h" #include "chromeos/services/secure_channel/connect_to_device_operation_base.h" #include "chromeos/services/secure_channel/nearby_initiator_failure_type.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/nearby_initiator_operation_unittest.cc b/chromeos/services/secure_channel/nearby_initiator_operation_unittest.cc index 7a3ed164..cc63bc3 100644 --- a/chromeos/services/secure_channel/nearby_initiator_operation_unittest.cc +++ b/chromeos/services/secure_channel/nearby_initiator_operation_unittest.cc
@@ -6,6 +6,7 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/bind.h" #include "base/test/task_environment.h" #include "base/test/test_simple_task_runner.h" @@ -13,7 +14,6 @@ #include "chromeos/services/secure_channel/fake_authenticated_channel.h" #include "chromeos/services/secure_channel/fake_nearby_connection_manager.h" #include "chromeos/services/secure_channel/nearby_initiator_failure_type.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/pending_ble_connection_request_base_unittest.cc b/chromeos/services/secure_channel/pending_ble_connection_request_base_unittest.cc index 7e757b4..9ceaf8a4 100644 --- a/chromeos/services/secure_channel/pending_ble_connection_request_base_unittest.cc +++ b/chromeos/services/secure_channel/pending_ble_connection_request_base_unittest.cc
@@ -6,12 +6,12 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "chromeos/services/secure_channel/fake_client_connection_parameters.h" #include "chromeos/services/secure_channel/fake_connection_delegate.h" #include "chromeos/services/secure_channel/fake_pending_connection_request_delegate.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/pending_ble_initiator_connection_request.h b/chromeos/services/secure_channel/pending_ble_initiator_connection_request.h index 77c8223..c07ae00 100644 --- a/chromeos/services/secure_channel/pending_ble_initiator_connection_request.h +++ b/chromeos/services/secure_channel/pending_ble_initiator_connection_request.h
@@ -7,10 +7,11 @@ #include <memory> +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/services/secure_channel/ble_initiator_failure_type.h" #include "chromeos/services/secure_channel/client_connection_parameters.h" #include "chromeos/services/secure_channel/pending_ble_connection_request_base.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/pending_ble_initiator_connection_request_unittest.cc b/chromeos/services/secure_channel/pending_ble_initiator_connection_request_unittest.cc index e61dffab..56447e34 100644 --- a/chromeos/services/secure_channel/pending_ble_initiator_connection_request_unittest.cc +++ b/chromeos/services/secure_channel/pending_ble_initiator_connection_request_unittest.cc
@@ -7,12 +7,12 @@ #include <memory> #include <utility> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "base/unguessable_token.h" #include "chromeos/services/secure_channel/fake_client_connection_parameters.h" #include "chromeos/services/secure_channel/fake_pending_connection_request_delegate.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/pending_ble_listener_connection_request.h b/chromeos/services/secure_channel/pending_ble_listener_connection_request.h index 1108c437..395f675 100644 --- a/chromeos/services/secure_channel/pending_ble_listener_connection_request.h +++ b/chromeos/services/secure_channel/pending_ble_listener_connection_request.h
@@ -7,10 +7,11 @@ #include <memory> +// TODO(https://crbug.com/1164001): move to forward declaration. +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/services/secure_channel/ble_listener_failure_type.h" #include "chromeos/services/secure_channel/client_connection_parameters.h" #include "chromeos/services/secure_channel/pending_ble_connection_request_base.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/pending_ble_listener_connection_request_unittest.cc b/chromeos/services/secure_channel/pending_ble_listener_connection_request_unittest.cc index 469fd1ea..0cf23a8 100644 --- a/chromeos/services/secure_channel/pending_ble_listener_connection_request_unittest.cc +++ b/chromeos/services/secure_channel/pending_ble_listener_connection_request_unittest.cc
@@ -7,12 +7,12 @@ #include <memory> #include <utility> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "base/unguessable_token.h" #include "chromeos/services/secure_channel/fake_client_connection_parameters.h" #include "chromeos/services/secure_channel/fake_pending_connection_request_delegate.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/pending_connection_manager.h b/chromeos/services/secure_channel/pending_connection_manager.h index e1796fc..7ab1dc03 100644 --- a/chromeos/services/secure_channel/pending_connection_manager.h +++ b/chromeos/services/secure_channel/pending_connection_manager.h
@@ -13,14 +13,13 @@ #include "chromeos/services/secure_channel/connection_details.h" #include "chromeos/services/secure_channel/connection_role.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos { namespace secure_channel { class AuthenticatedChannel; +enum class ConnectionPriority; // Attempts to create connections to remote devices. If a connection request // fails or is canceled, the client will be notified. If a connection is
diff --git a/chromeos/services/secure_channel/pending_connection_manager_impl.h b/chromeos/services/secure_channel/pending_connection_manager_impl.h index bd28bde..53c5732 100644 --- a/chromeos/services/secure_channel/pending_connection_manager_impl.h +++ b/chromeos/services/secure_channel/pending_connection_manager_impl.h
@@ -8,6 +8,8 @@ #include <memory> #include <vector> +#include "ash/services/secure_channel/public/cpp/shared/connection_medium.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" #include "chromeos/services/secure_channel/ble_initiator_failure_type.h" @@ -19,8 +21,6 @@ #include "chromeos/services/secure_channel/device_id_pair.h" #include "chromeos/services/secure_channel/nearby_initiator_failure_type.h" #include "chromeos/services/secure_channel/pending_connection_manager.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_medium.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "device/bluetooth/bluetooth_adapter.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/pending_connection_request.h b/chromeos/services/secure_channel/pending_connection_request.h index de21bb13..855a4b7 100644 --- a/chromeos/services/secure_channel/pending_connection_request.h +++ b/chromeos/services/secure_channel/pending_connection_request.h
@@ -8,9 +8,9 @@ #include <string> #include <utility> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/services/secure_channel/client_connection_parameters.h" #include "chromeos/services/secure_channel/pending_connection_request_delegate.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/pending_connection_request_base.h b/chromeos/services/secure_channel/pending_connection_request_base.h index 280d1c25..04cdc71 100644 --- a/chromeos/services/secure_channel/pending_connection_request_base.h +++ b/chromeos/services/secure_channel/pending_connection_request_base.h
@@ -7,13 +7,13 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/logging.h" #include "base/memory/weak_ptr.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/services/secure_channel/client_connection_parameters.h" #include "chromeos/services/secure_channel/pending_connection_request.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc b/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc index c2385528..6b75057 100644 --- a/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc +++ b/chromeos/services/secure_channel/pending_connection_request_base_unittest.cc
@@ -6,12 +6,12 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "chromeos/services/secure_channel/fake_client_connection_parameters.h" #include "chromeos/services/secure_channel/fake_connection_delegate.h" #include "chromeos/services/secure_channel/fake_pending_connection_request_delegate.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "testing/gtest/include/gtest/gtest.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/pending_nearby_initiator_connection_request_unittest.cc b/chromeos/services/secure_channel/pending_nearby_initiator_connection_request_unittest.cc index 7589aabe..5cf7da13 100644 --- a/chromeos/services/secure_channel/pending_nearby_initiator_connection_request_unittest.cc +++ b/chromeos/services/secure_channel/pending_nearby_initiator_connection_request_unittest.cc
@@ -7,12 +7,12 @@ #include <memory> #include <utility> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/run_loop.h" #include "base/test/task_environment.h" #include "base/unguessable_token.h" #include "chromeos/services/secure_channel/fake_client_connection_parameters.h" #include "chromeos/services/secure_channel/fake_pending_connection_request_delegate.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "device/bluetooth/test/mock_bluetooth_adapter.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/presence_monitor_delegate.cc b/chromeos/services/secure_channel/presence_monitor_delegate.cc index fe802ea..a3d7930 100644 --- a/chromeos/services/secure_channel/presence_monitor_delegate.cc +++ b/chromeos/services/secure_channel/presence_monitor_delegate.cc
@@ -4,13 +4,13 @@ #include "chromeos/services/secure_channel/presence_monitor_delegate.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/remote_device_cache.h" #include "chromeos/services/secure_channel/ble_scanner_impl.h" #include "chromeos/services/secure_channel/ble_synchronizer.h" #include "chromeos/services/secure_channel/bluetooth_helper_impl.h" #include "chromeos/services/secure_channel/connection_role.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "device/bluetooth/bluetooth_adapter.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/presence_monitor_delegate.h b/chromeos/services/secure_channel/presence_monitor_delegate.h index 5389ee4..35f3173 100644 --- a/chromeos/services/secure_channel/presence_monitor_delegate.h +++ b/chromeos/services/secure_channel/presence_monitor_delegate.h
@@ -5,8 +5,8 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_PRESENCE_MONITOR_DELEGATE_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_PRESENCE_MONITOR_DELEGATE_H_ +#include "ash/services/secure_channel/public/cpp/shared/presence_monitor.h" #include "chromeos/services/secure_channel/ble_scanner.h" -#include "chromeos/services/secure_channel/public/cpp/shared/presence_monitor.h" namespace device { class BluetoothAdapter;
diff --git a/chromeos/services/secure_channel/presence_monitor_impl.h b/chromeos/services/secure_channel/presence_monitor_impl.h index 0821245..2e25ca83 100644 --- a/chromeos/services/secure_channel/presence_monitor_impl.h +++ b/chromeos/services/secure_channel/presence_monitor_impl.h
@@ -5,8 +5,8 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_PRESENCE_MONITOR_IMPL_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_PRESENCE_MONITOR_IMPL_H_ +#include "ash/services/secure_channel/public/cpp/shared/presence_monitor.h" #include "chromeos/services/secure_channel/presence_monitor_delegate.h" -#include "chromeos/services/secure_channel/public/cpp/shared/presence_monitor.h" namespace device {
diff --git a/chromeos/services/secure_channel/public/cpp/client/BUILD.gn b/chromeos/services/secure_channel/public/cpp/client/BUILD.gn index ec1c7c8..12d50c2 100644 --- a/chromeos/services/secure_channel/public/cpp/client/BUILD.gn +++ b/chromeos/services/secure_channel/public/cpp/client/BUILD.gn
@@ -4,26 +4,26 @@ source_set("client") { sources = [ - "client_channel.cc", - "client_channel.h", - "client_channel_impl.cc", - "client_channel_impl.h", - "connection_attempt.cc", - "connection_attempt.h", - "connection_attempt_impl.cc", - "connection_attempt_impl.h", - "connection_manager.cc", - "connection_manager.h", - "connection_manager_impl.cc", - "connection_manager_impl.h", - "nearby_connector.cc", - "nearby_connector.h", - "presence_monitor_client.h", - "presence_monitor_client_impl.cc", - "presence_monitor_client_impl.h", - "secure_channel_client.h", - "secure_channel_client_impl.cc", - "secure_channel_client_impl.h", + "//ash/services/secure_channel/public/cpp/client/client_channel.cc", + "//ash/services/secure_channel/public/cpp/client/client_channel.h", + "//ash/services/secure_channel/public/cpp/client/client_channel_impl.cc", + "//ash/services/secure_channel/public/cpp/client/client_channel_impl.h", + "//ash/services/secure_channel/public/cpp/client/connection_attempt.cc", + "//ash/services/secure_channel/public/cpp/client/connection_attempt.h", + "//ash/services/secure_channel/public/cpp/client/connection_attempt_impl.cc", + "//ash/services/secure_channel/public/cpp/client/connection_attempt_impl.h", + "//ash/services/secure_channel/public/cpp/client/connection_manager.cc", + "//ash/services/secure_channel/public/cpp/client/connection_manager.h", + "//ash/services/secure_channel/public/cpp/client/connection_manager_impl.cc", + "//ash/services/secure_channel/public/cpp/client/connection_manager_impl.h", + "//ash/services/secure_channel/public/cpp/client/nearby_connector.cc", + "//ash/services/secure_channel/public/cpp/client/nearby_connector.h", + "//ash/services/secure_channel/public/cpp/client/presence_monitor_client.h", + "//ash/services/secure_channel/public/cpp/client/presence_monitor_client_impl.cc", + "//ash/services/secure_channel/public/cpp/client/presence_monitor_client_impl.h", + "//ash/services/secure_channel/public/cpp/client/secure_channel_client.h", + "//ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.cc", + "//ash/services/secure_channel/public/cpp/client/secure_channel_client_impl.h", ] deps = [ @@ -42,18 +42,18 @@ testonly = true sources = [ - "fake_client_channel.cc", - "fake_client_channel.h", - "fake_client_channel_observer.cc", - "fake_client_channel_observer.h", - "fake_connection_attempt.cc", - "fake_connection_attempt.h", - "fake_connection_manager.cc", - "fake_connection_manager.h", - "fake_nearby_connector.cc", - "fake_nearby_connector.h", - "fake_secure_channel_client.cc", - "fake_secure_channel_client.h", + "//ash/services/secure_channel/public/cpp/client/fake_client_channel.cc", + "//ash/services/secure_channel/public/cpp/client/fake_client_channel.h", + "//ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.cc", + "//ash/services/secure_channel/public/cpp/client/fake_client_channel_observer.h", + "//ash/services/secure_channel/public/cpp/client/fake_connection_attempt.cc", + "//ash/services/secure_channel/public/cpp/client/fake_connection_attempt.h", + "//ash/services/secure_channel/public/cpp/client/fake_connection_manager.cc", + "//ash/services/secure_channel/public/cpp/client/fake_connection_manager.h", + "//ash/services/secure_channel/public/cpp/client/fake_nearby_connector.cc", + "//ash/services/secure_channel/public/cpp/client/fake_nearby_connector.h", + "//ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.cc", + "//ash/services/secure_channel/public/cpp/client/fake_secure_channel_client.h", ] deps = [ @@ -68,9 +68,9 @@ testonly = true sources = [ - "client_channel_impl_unittest.cc", - "connection_manager_impl_unittest.cc", - "secure_channel_client_impl_unittest.cc", + "//ash/services/secure_channel/public/cpp/client/client_channel_impl_unittest.cc", + "//ash/services/secure_channel/public/cpp/client/connection_manager_impl_unittest.cc", + "//ash/services/secure_channel/public/cpp/client/secure_channel_client_impl_unittest.cc", ] deps = [
diff --git a/chromeos/services/secure_channel/public/cpp/shared/BUILD.gn b/chromeos/services/secure_channel/public/cpp/shared/BUILD.gn index d8b26ee..5b64eb65 100644 --- a/chromeos/services/secure_channel/public/cpp/shared/BUILD.gn +++ b/chromeos/services/secure_channel/public/cpp/shared/BUILD.gn
@@ -4,11 +4,11 @@ source_set("shared") { sources = [ - "connection_medium.cc", - "connection_medium.h", - "connection_priority.cc", - "connection_priority.h", - "presence_monitor.h", + "//ash/services/secure_channel/public/cpp/shared/connection_medium.cc", + "//ash/services/secure_channel/public/cpp/shared/connection_medium.h", + "//ash/services/secure_channel/public/cpp/shared/connection_priority.cc", + "//ash/services/secure_channel/public/cpp/shared/connection_priority.h", + "//ash/services/secure_channel/public/cpp/shared/presence_monitor.h", ] deps = [ "//base" ]
diff --git a/chromeos/services/secure_channel/public/mojom/BUILD.gn b/chromeos/services/secure_channel/public/mojom/BUILD.gn index d8d6d1e..42f9e6e 100644 --- a/chromeos/services/secure_channel/public/mojom/BUILD.gn +++ b/chromeos/services/secure_channel/public/mojom/BUILD.gn
@@ -6,9 +6,9 @@ mojom("mojom") { sources = [ - "nearby_connector.mojom", - "secure_channel.mojom", - "secure_channel_types.mojom", + "//ash/services/secure_channel/public/mojom/nearby_connector.mojom", + "//ash/services/secure_channel/public/mojom/secure_channel.mojom", + "//ash/services/secure_channel/public/mojom/secure_channel_types.mojom", ] public_deps = [ @@ -29,8 +29,8 @@ }, ] - traits_headers = [ "secure_channel_mojom_traits.h" ] - traits_sources = [ "secure_channel_mojom_traits.cc" ] + traits_headers = [ "//ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.h" ] + traits_sources = [ "//ash/services/secure_channel/public/mojom/secure_channel_mojom_traits.cc" ] traits_public_deps = [ "//chromeos/services/secure_channel/public/cpp/shared" ] }, @@ -40,7 +40,7 @@ source_set("unit_tests") { testonly = true - sources = [ "secure_channel_mojom_traits_unittest.cc" ] + sources = [ "//ash/services/secure_channel/public/mojom/secure_channel_mojom_traits_unittest.cc" ] deps = [ ":mojom",
diff --git a/chromeos/services/secure_channel/register_payload_file_request.cc b/chromeos/services/secure_channel/register_payload_file_request.cc index 3eac29a..d8a116a0 100644 --- a/chromeos/services/secure_channel/register_payload_file_request.cc +++ b/chromeos/services/secure_channel/register_payload_file_request.cc
@@ -4,8 +4,8 @@ #include "chromeos/services/secure_channel/register_payload_file_request.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/register_payload_file_request.h b/chromeos/services/secure_channel/register_payload_file_request.h index f2c400a..cd5f60f 100644 --- a/chromeos/services/secure_channel/register_payload_file_request.h +++ b/chromeos/services/secure_channel/register_payload_file_request.h
@@ -5,8 +5,8 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_REGISTER_PAYLOAD_FILE_REQUEST_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_REGISTER_PAYLOAD_FILE_REQUEST_H_ +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/secure_channel.cc b/chromeos/services/secure_channel/secure_channel.cc index de12a76..c9cbd9c 100644 --- a/chromeos/services/secure_channel/secure_channel.cc +++ b/chromeos/services/secure_channel/secure_channel.cc
@@ -6,13 +6,13 @@ #include <memory> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/callback.h" #include "base/memory/ptr_util.h" #include "chromeos/components/multidevice/logging/logging.h" #include "chromeos/components/multidevice/secure_message_delegate_impl.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/wire_message.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/secure_channel.h b/chromeos/services/secure_channel/secure_channel.h index 3af9965b..5e83a9e 100644 --- a/chromeos/services/secure_channel/secure_channel.h +++ b/chromeos/services/secure_channel/secure_channel.h
@@ -5,6 +5,7 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_SECURE_CHANNEL_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_SECURE_CHANNEL_H_ +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/containers/queue.h" #include "base/memory/weak_ptr.h" @@ -14,7 +15,6 @@ #include "chromeos/services/secure_channel/connection_observer.h" #include "chromeos/services/secure_channel/device_to_device_authenticator.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/secure_context.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/secure_channel_base.h b/chromeos/services/secure_channel/secure_channel_base.h index e921eb1..f5da3aae 100644 --- a/chromeos/services/secure_channel/secure_channel_base.h +++ b/chromeos/services/secure_channel/secure_channel_base.h
@@ -5,7 +5,7 @@ #ifndef CHROMEOS_SERVICES_SECURE_CHANNEL_SECURE_CHANNEL_BASE_H_ #define CHROMEOS_SERVICES_SECURE_CHANNEL_SECURE_CHANNEL_BASE_H_ -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/receiver_set.h"
diff --git a/chromeos/services/secure_channel/secure_channel_impl.h b/chromeos/services/secure_channel/secure_channel_impl.h index b539e8a..2772295 100644 --- a/chromeos/services/secure_channel/secure_channel_impl.h +++ b/chromeos/services/secure_channel/secure_channel_impl.h
@@ -10,13 +10,13 @@ #include <tuple> #include <vector> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/containers/flat_map.h" #include "chromeos/components/multidevice/remote_device_cache.h" #include "chromeos/services/secure_channel/active_connection_manager.h" #include "chromeos/services/secure_channel/connection_attempt_details.h" #include "chromeos/services/secure_channel/pending_connection_manager.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" namespace device {
diff --git a/chromeos/services/secure_channel/secure_channel_initializer.h b/chromeos/services/secure_channel/secure_channel_initializer.h index 0e8e01b..fd7427d0 100644 --- a/chromeos/services/secure_channel/secure_channel_initializer.h +++ b/chromeos/services/secure_channel/secure_channel_initializer.h
@@ -9,11 +9,11 @@ #include <queue> #include <string> +#include "ash/services/secure_channel/public/mojom/nearby_connector.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/threading/thread_task_runner_handle.h" -#include "chromeos/services/secure_channel/public/mojom/nearby_connector.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "chromeos/services/secure_channel/secure_channel_base.h" #include "mojo/public/cpp/bindings/pending_remote.h"
diff --git a/chromeos/services/secure_channel/secure_channel_service_unittest.cc b/chromeos/services/secure_channel/secure_channel_service_unittest.cc index e0cc94e..da0e46c 100644 --- a/chromeos/services/secure_channel/secure_channel_service_unittest.cc +++ b/chromeos/services/secure_channel/secure_channel_service_unittest.cc
@@ -4,6 +4,9 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/client/fake_nearby_connector.h" +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "base/bind.h" #include "base/callback.h" #include "base/containers/flat_map.h" @@ -33,9 +36,6 @@ #include "chromeos/services/secure_channel/fake_timer_factory.h" #include "chromeos/services/secure_channel/nearby_connection_manager_impl.h" #include "chromeos/services/secure_channel/pending_connection_manager_impl.h" -#include "chromeos/services/secure_channel/public/cpp/client/fake_nearby_connector.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" #include "chromeos/services/secure_channel/secure_channel_disconnector_impl.h" #include "chromeos/services/secure_channel/secure_channel_initializer.h" #include "chromeos/services/secure_channel/timer_factory_impl.h"
diff --git a/chromeos/services/secure_channel/secure_channel_unittest.cc b/chromeos/services/secure_channel/secure_channel_unittest.cc index 308ed50a..e72593b 100644 --- a/chromeos/services/secure_channel/secure_channel_unittest.cc +++ b/chromeos/services/secure_channel/secure_channel_unittest.cc
@@ -7,6 +7,7 @@ #include <memory> #include <string> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" @@ -19,7 +20,6 @@ #include "chromeos/services/secure_channel/fake_connection.h" #include "chromeos/services/secure_channel/fake_secure_context.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/wire_message.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/chromeos/services/secure_channel/shared_resource_scheduler.h b/chromeos/services/secure_channel/shared_resource_scheduler.h index 6c617dcd..9cf7c777 100644 --- a/chromeos/services/secure_channel/shared_resource_scheduler.h +++ b/chromeos/services/secure_channel/shared_resource_scheduler.h
@@ -7,9 +7,9 @@ #include <list> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/containers/flat_map.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/shared_resource_scheduler_unittest.cc b/chromeos/services/secure_channel/shared_resource_scheduler_unittest.cc index 4709a95a..25e1658 100644 --- a/chromeos/services/secure_channel/shared_resource_scheduler_unittest.cc +++ b/chromeos/services/secure_channel/shared_resource_scheduler_unittest.cc
@@ -6,9 +6,9 @@ #include <memory> +#include "ash/services/secure_channel/public/cpp/shared/connection_priority.h" #include "base/test/gtest_util.h" #include "chromeos/services/secure_channel/device_id_pair.h" -#include "chromeos/services/secure_channel/public/cpp/shared/connection_priority.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/abseil-cpp/absl/types/optional.h"
diff --git a/chromeos/services/secure_channel/single_client_proxy.cc b/chromeos/services/secure_channel/single_client_proxy.cc index 37b8864..65bcfe88 100644 --- a/chromeos/services/secure_channel/single_client_proxy.cc +++ b/chromeos/services/secure_channel/single_client_proxy.cc
@@ -4,9 +4,9 @@ #include "chromeos/services/secure_channel/single_client_proxy.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/single_client_proxy.h b/chromeos/services/secure_channel/single_client_proxy.h index 3c8ede43..1f68170 100644 --- a/chromeos/services/secure_channel/single_client_proxy.h +++ b/chromeos/services/secure_channel/single_client_proxy.h
@@ -7,11 +7,11 @@ #include <string> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/unguessable_token.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/single_client_proxy_impl.cc b/chromeos/services/secure_channel/single_client_proxy_impl.cc index f48449f..ffbd7d30 100644 --- a/chromeos/services/secure_channel/single_client_proxy_impl.cc +++ b/chromeos/services/secure_channel/single_client_proxy_impl.cc
@@ -4,10 +4,10 @@ #include "chromeos/services/secure_channel/single_client_proxy_impl.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "base/memory/ptr_util.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" namespace chromeos {
diff --git a/chromeos/services/secure_channel/single_client_proxy_impl.h b/chromeos/services/secure_channel/single_client_proxy_impl.h index 4f7ca16b..e0be70e 100644 --- a/chromeos/services/secure_channel/single_client_proxy_impl.h +++ b/chromeos/services/secure_channel/single_client_proxy_impl.h
@@ -7,12 +7,12 @@ #include <string> +#include "ash/services/secure_channel/public/mojom/secure_channel.mojom.h" +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/callback.h" #include "chromeos/services/secure_channel/channel_impl.h" #include "chromeos/services/secure_channel/client_connection_parameters.h" #include "chromeos/services/secure_channel/file_transfer_update_callback.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel.mojom.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "chromeos/services/secure_channel/single_client_proxy.h" #include "mojo/public/cpp/bindings/remote.h"
diff --git a/chromeos/services/secure_channel/single_client_proxy_impl_unittest.cc b/chromeos/services/secure_channel/single_client_proxy_impl_unittest.cc index 399fd641..93d9984b 100644 --- a/chromeos/services/secure_channel/single_client_proxy_impl_unittest.cc +++ b/chromeos/services/secure_channel/single_client_proxy_impl_unittest.cc
@@ -8,6 +8,7 @@ #include <string> #include <unordered_set> +#include "ash/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "base/bind.h" #include "base/containers/contains.h" #include "base/files/file.h" @@ -21,7 +22,6 @@ #include "chromeos/services/secure_channel/fake_file_payload_listener.h" #include "chromeos/services/secure_channel/fake_message_receiver.h" #include "chromeos/services/secure_channel/fake_single_client_proxy.h" -#include "chromeos/services/secure_channel/public/mojom/secure_channel_types.mojom.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/remote.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/components/autofill/core/common/autofill_features.cc b/components/autofill/core/common/autofill_features.cc index 202115cc..2ee441b 100644 --- a/components/autofill/core/common/autofill_features.cc +++ b/components/autofill/core/common/autofill_features.cc
@@ -164,13 +164,6 @@ "AutofillEnableLabelPrecedenceForTurkishAddresses", base::FEATURE_DISABLED_BY_DEFAULT}; -// When enabled and user is signed in, a footer indicating user's e-mail address -// and profile picture will appear at the bottom of corresponding password -// InfoBars. -const base::Feature kAutofillEnablePasswordInfoBarAccountIndicationFooter{ - "AutofillEnablePasswordInfoBarAccountIndicationFooter", - base::FEATURE_ENABLED_BY_DEFAULT}; - // Enables the parsing of a sequence of fields that follows the pattern of Name, // Surname. // TODO(crbug.com/1277480): Remove once launched.
diff --git a/components/autofill/core/common/autofill_features.h b/components/autofill/core/common/autofill_features.h index 75b0fac..ca6d6e5 100644 --- a/components/autofill/core/common/autofill_features.h +++ b/components/autofill/core/common/autofill_features.h
@@ -63,9 +63,6 @@ COMPONENT_EXPORT(AUTOFILL) extern const base::Feature kAutofillEnableImportWhenMultiplePhoneNumbers; COMPONENT_EXPORT(AUTOFILL) -extern const base::Feature - kAutofillEnablePasswordInfoBarAccountIndicationFooter; -COMPONENT_EXPORT(AUTOFILL) extern const base::Feature kAutofillEnableSupportForApartmentNumbers; COMPONENT_EXPORT(AUTOFILL) extern const base::Feature kAutofillEnableLabelPrecedenceForTurkishAddresses;
diff --git a/components/autofill_assistant/browser/ui_controller.cc b/components/autofill_assistant/browser/ui_controller.cc index cd5a84b..9e3d42e 100644 --- a/components/autofill_assistant/browser/ui_controller.cc +++ b/components/autofill_assistant/browser/ui_controller.cc
@@ -851,10 +851,10 @@ CREDIT_CARD_EVENT, event_type); DCHECK(!collect_user_data_options_->billing_address_name.empty()); GetUserModel()->SetSelectedCreditCard(std::move(card), GetUserData()); - execution_delegate_->NotifyUserDataChange(UserData::FieldChange::CARD); SetProfile(collect_user_data_options_->billing_address_name, UserData::FieldChange::BILLING_ADDRESS, std::move(billing_profile)); + execution_delegate_->NotifyUserDataChange(UserData::FieldChange::CARD); } void UiController::SetProfile(
diff --git a/components/autofill_assistant/browser/ui_controller_unittest.cc b/components/autofill_assistant/browser/ui_controller_unittest.cc index 5f31e489..d424dcae 100644 --- a/components/autofill_assistant/browser/ui_controller_unittest.cc +++ b/components/autofill_assistant/browser/ui_controller_unittest.cc
@@ -387,11 +387,12 @@ } TEST_F(UiControllerTest, UserDataFormCreditCard) { - auto options = std::make_unique<FakeCollectUserDataOptions>(); + testing::InSequence seq; + auto options = std::make_unique<FakeCollectUserDataOptions>(); options->request_payment_method = true; options->billing_address_name = "billing_address"; - testing::InSequence seq; + EXPECT_CALL(mock_execution_delegate_, NotifyUserDataChange(UserData::FieldChange::ALL)); ui_controller_->SetCollectUserDataOptions(options.get()); @@ -399,23 +400,6 @@ Property(&UserAction::enabled, Eq(false))))); ui_controller_->OnUserDataChanged(user_data_, UserData::FieldChange::ALL); - // Credit card without billing address is invalid. - auto credit_card = std::make_unique<autofill::CreditCard>( - base::GenerateGUID(), "https://www.example.com"); - autofill::test::SetCreditCardInfo(credit_card.get(), "Marion Mitchell", - "4111 1111 1111 1111", "01", "2020", - /* billing_address_id = */ ""); - EXPECT_CALL(mock_execution_delegate_, - NotifyUserDataChange(UserData::FieldChange::CARD)); - EXPECT_CALL(mock_execution_delegate_, - NotifyUserDataChange(UserData::FieldChange::BILLING_ADDRESS)); - ui_controller_->SetCreditCard( - std::make_unique<autofill::CreditCard>(*credit_card), - /* billing_profile =*/nullptr, UNKNOWN); - EXPECT_CALL(mock_observer_, OnUserActionsChanged(UnorderedElementsAre( - Property(&UserAction::enabled, Eq(false))))); - ui_controller_->OnUserDataChanged(user_data_, UserData::FieldChange::CARD); - // Credit card with valid billing address is ok. auto billing_address = std::make_unique<autofill::AutofillProfile>( base::GenerateGUID(), "https://www.example.com"); @@ -423,11 +407,15 @@ "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "16505678910"); - credit_card->set_billing_address_id(billing_address->guid()); - EXPECT_CALL(mock_execution_delegate_, - NotifyUserDataChange(UserData::FieldChange::CARD)); + auto credit_card = std::make_unique<autofill::CreditCard>( + base::GenerateGUID(), "https://www.example.com"); + autofill::test::SetCreditCardInfo(credit_card.get(), "Marion Mitchell", + "4111 1111 1111 1111", "01", "2020", + billing_address->guid()); EXPECT_CALL(mock_execution_delegate_, NotifyUserDataChange(UserData::FieldChange::BILLING_ADDRESS)); + EXPECT_CALL(mock_execution_delegate_, + NotifyUserDataChange(UserData::FieldChange::CARD)); ui_controller_->SetCreditCard( std::make_unique<autofill::CreditCard>(*credit_card), std::make_unique<autofill::AutofillProfile>(*billing_address), UNKNOWN); @@ -440,6 +428,22 @@ EXPECT_THAT( user_data_.selected_address("billing_address")->Compare(*billing_address), Eq(0)); + + // Credit card without billing address is invalid. + credit_card->set_billing_address_id(""); + EXPECT_CALL(mock_execution_delegate_, + NotifyUserDataChange(UserData::FieldChange::BILLING_ADDRESS)); + EXPECT_CALL(mock_execution_delegate_, + NotifyUserDataChange(UserData::FieldChange::CARD)); + ui_controller_->SetCreditCard( + std::make_unique<autofill::CreditCard>(*credit_card), + /* billing_profile= */ nullptr, UNKNOWN); + EXPECT_CALL(mock_observer_, OnUserActionsChanged(UnorderedElementsAre( + Property(&UserAction::enabled, Eq(false))))); + ui_controller_->OnUserDataChanged(user_data_, UserData::FieldChange::CARD); + + EXPECT_THAT(user_data_.selected_card()->Compare(*credit_card), Eq(0)); + EXPECT_THAT(user_data_.selected_address("billing_address"), Eq(nullptr)); } TEST_F(UiControllerTest, UserDataChangesByOutOfLoopWrite) {
diff --git a/components/bookmarks/browser/bookmark_codec.cc b/components/bookmarks/browser/bookmark_codec.cc index e64f0a4..7bc70e3 100644 --- a/components/bookmarks/browser/bookmark_codec.cc +++ b/components/bookmarks/browser/bookmark_codec.cc
@@ -196,29 +196,15 @@ const base::Value* bb_value = roots->FindDictKey(kBookmarkBarFolderNameKey); const base::Value* other_folder_value = roots->FindDictKey(kOtherBookmarkFolderNameKey); + const base::Value* mobile_folder_value = + roots->FindDictKey(kMobileBookmarkFolderNameKey); - if (!bb_value || !other_folder_value) + if (!bb_value || !other_folder_value || !mobile_folder_value) return false; DecodeNode(*bb_value, nullptr, bb_node); DecodeNode(*other_folder_value, nullptr, other_folder_node); - - // Fail silently if we can't deserialize mobile bookmarks. We can't require - // them to exist in order to be backwards-compatible with older versions of - // chrome. - const base::Value* mobile_folder_value = - roots->FindDictKey(kMobileBookmarkFolderNameKey); - if (mobile_folder_value) { - DecodeNode(*mobile_folder_value, nullptr, mobile_folder_node); - } else { - // If we didn't find the mobile folder, we're almost guaranteed to have a - // duplicate id when we add the mobile folder. Consequently, if we don't - // intend to reassign ids in the future (ids_valid_ is still true), then at - // least reassign the mobile bookmarks to avoid it colliding with anything - // else. - if (ids_valid_) - ReassignIDsHelper(mobile_folder_node); - } + DecodeNode(*mobile_folder_value, nullptr, mobile_folder_node); if (!DecodeMetaInfo(*roots, &model_meta_info_map_)) return false;
diff --git a/components/bookmarks/browser/bookmark_codec_unittest.cc b/components/bookmarks/browser/bookmark_codec_unittest.cc index aa22c84..2922816 100644 --- a/components/bookmarks/browser/bookmark_codec_unittest.cc +++ b/components/bookmarks/browser/bookmark_codec_unittest.cc
@@ -378,7 +378,7 @@ AssertModelsEqual(decoded_model.get(), decoded_model2.get())); } -TEST_F(BookmarkCodecTest, CanDecodeModelWithoutMobileBookmarks) { +TEST_F(BookmarkCodecTest, CannotDecodeModelWithoutMobileBookmarks) { base::FilePath test_file = GetTestDataDir().AppendASCII("bookmarks/model_without_sync.json"); ASSERT_TRUE(base::PathExists(test_file)); @@ -390,35 +390,8 @@ std::unique_ptr<BookmarkModel> decoded_model( TestBookmarkClient::CreateModel()); BookmarkCodec decoder; - ASSERT_TRUE(Decode(&decoder, *root.get(), decoded_model.get(), - /*sync_metadata_str=*/nullptr)); - ExpectIDsUnique(decoded_model.get()); - - const BookmarkNode* bbn = decoded_model->bookmark_bar_node(); - ASSERT_EQ(1u, bbn->children().size()); - - const BookmarkNode* child = bbn->children().front().get(); - EXPECT_EQ(BookmarkNode::FOLDER, child->type()); - EXPECT_EQ(u"Folder A", child->GetTitle()); - ASSERT_EQ(1u, child->children().size()); - - child = child->children().front().get(); - EXPECT_EQ(BookmarkNode::URL, child->type()); - EXPECT_EQ(u"Bookmark Manager", child->GetTitle()); - - const BookmarkNode* other = decoded_model->other_node(); - ASSERT_EQ(1u, other->children().size()); - - child = other->children().front().get(); - EXPECT_EQ(BookmarkNode::FOLDER, child->type()); - EXPECT_EQ(u"Folder B", child->GetTitle()); - ASSERT_EQ(1u, child->children().size()); - - child = child->children().front().get(); - EXPECT_EQ(BookmarkNode::URL, child->type()); - EXPECT_EQ(u"Get started with Google Chrome", child->GetTitle()); - - ASSERT_TRUE(decoded_model->mobile_node() != nullptr); + EXPECT_FALSE(Decode(&decoder, *root.get(), decoded_model.get(), + /*sync_metadata_str=*/nullptr)); } TEST_F(BookmarkCodecTest, EncodeAndDecodeMetaInfo) {
diff --git a/components/content_settings/browser/page_specific_content_settings.cc b/components/content_settings/browser/page_specific_content_settings.cc index 86db2bc..d5a67819 100644 --- a/components/content_settings/browser/page_specific_content_settings.cc +++ b/components/content_settings/browser/page_specific_content_settings.cc
@@ -424,7 +424,10 @@ content::RenderFrameHost* rfh, const url::Origin api_origin, bool blocked_by_policy) { - // TODO(crbug.com/1286276): Not implemented yet. + DCHECK_CURRENTLY_ON(BrowserThread::UI); + PageSpecificContentSettings* settings = GetForFrame(rfh); + if (settings) + settings->OnInterestGroupJoined(api_origin, blocked_by_policy); } // static @@ -668,6 +671,19 @@ } } +void PageSpecificContentSettings::OnInterestGroupJoined( + const url::Origin api_origin, + bool blocked_by_policy) { + if (blocked_by_policy) { + blocked_interest_group_api_.push_back(api_origin); + OnContentBlocked(ContentSettingsType::COOKIES); + } else { + allowed_interest_group_api_.push_back(api_origin); + OnContentAllowed(ContentSettingsType::COOKIES); + } + NotifySiteDataObservers(); +} + void PageSpecificContentSettings::OnWebDatabaseAccessed( const GURL& url, bool blocked_by_policy) { @@ -912,6 +928,10 @@ content_settings_changed_via_page_info_.end(); } +bool PageSpecificContentSettings::HasJoinedUserToInterestGroup() const { + return !allowed_interest_group_api_.empty(); +} + bool PageSpecificContentSettings::IsPagePrerendering() const { // We consider the Page to be prerendering iff // |updates_queued_during_prerender_| is non null. Note, the page already may
diff --git a/components/content_settings/browser/page_specific_content_settings.h b/components/content_settings/browser/page_specific_content_settings.h index a79ab2b..4db7daa 100644 --- a/components/content_settings/browser/page_specific_content_settings.h +++ b/components/content_settings/browser/page_specific_content_settings.h
@@ -370,6 +370,8 @@ const std::string& name, const blink::StorageKey& storage_key, bool blocked_by_policy); + void OnInterestGroupJoined(const url::Origin api_origin, + bool blocked_by_policy); void OnWebDatabaseAccessed(const GURL& url, bool blocked_by_policy); #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) void OnProtectedMediaIdentifierPermissionSet(const GURL& requesting_frame, @@ -400,6 +402,10 @@ // since the last navigation. bool HasContentSettingChangedViaPageInfo(ContentSettingsType type) const; + // Returns true if the user was joined to an interest group and if the page + // is the joining origin. + bool HasJoinedUserToInterestGroup() const; + private: friend class content::DocumentUserData<PageSpecificContentSettings>; @@ -574,6 +580,11 @@ std::string media_stream_requested_audio_device_; std::string media_stream_requested_video_device_; + // Contains URLs which attempted to join interest groups. Note: The UI will + // only currently show the top frame as having attempted to join. + std::vector<url::Origin> allowed_interest_group_api_; + std::vector<url::Origin> blocked_interest_group_api_; + // The Geolocation, camera, and/or microphone permission was granted to this // origin from a permission prompt that was triggered by the currently active // document.
diff --git a/components/page_info/page_info.cc b/components/page_info/page_info.cc index a5c8505a..8e2b0a6 100644 --- a/components/page_info/page_info.cc +++ b/components/page_info/page_info.cc
@@ -1071,9 +1071,8 @@ if (!settings) return; - // TODO(olesiamarukhno): Use actual info. info.has_joined_user_to_interest_group = - site_url_ == GURL("https://example.com"); + settings->HasJoinedUserToInterestGroup(); ui_->SetAdPersonalizationInfo(info); }
diff --git a/components/password_manager/core/browser/store_metrics_reporter.cc b/components/password_manager/core/browser/store_metrics_reporter.cc index 08d56fe..7522d8c 100644 --- a/components/password_manager/core/browser/store_metrics_reporter.cc +++ b/components/password_manager/core/browser/store_metrics_reporter.cc
@@ -6,6 +6,7 @@ #include <memory> #include "base/metrics/histogram_functions.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "base/task/sequenced_task_runner.h" @@ -29,16 +30,12 @@ // Common prefix for all histograms. constexpr char kPasswordManager[] = "PasswordManager"; -// Need to stay in sync with the UserProfileLevel variant in histograms.xml. -constexpr char kPrimaryUserProfile[] = ".PrimaryUserProfile"; -constexpr char kNonPrimaryUserProfile[] = ".NonPrimaryUserProfile"; - -// Need to stay in sync with the PasswordType variant in histograms.xml. +// Need to stay in sync with the PasswordGenerated suffix in histograms.xml. constexpr char kAutoGeneratedSuffix[] = ".AutoGenerated"; constexpr char kUserCreatedSuffix[] = ".UserCreated"; constexpr char kOverallSuffix[] = ".Overall"; -// Need to stay in sync with the CustomPassphraseStatus variant in +// Need to stay in sync with the PasswordCustomPassphrase suffix in // histograms.xml. constexpr char kWithCustomPassphraseSuffix[] = ".WithCustomPassphrase"; constexpr char kWithoutCustomPassphraseSuffix[] = ".WithoutCustomPassphrase"; @@ -50,32 +47,22 @@ } // Returns a suffix (infix, really) to be used in histogram names to -// differentiate the profile store from the account store. Need to stay in sync -// with the Store variant in histograms.xml. +// differentiate the profile store from the account store. base::StringPiece GetMetricsSuffixForStore(bool is_account_store) { - return is_account_store ? ".AccountStore" : ".ProfileStore"; + // Note: For historic reasons, the profile store does not use a suffix, only + // the account store does. + return is_account_store ? ".AccountStore" : ""; } -// These values are persisted to logs. Entries should not be renumbered and -// numeric values should never be reused. -enum class SyncingAccountState { - kSyncingAndSyncPasswordNotSaved = 0, - kSyncingAndSyncPasswordSaved = 1, - kNotSyncingAndSyncPasswordNotSaved = 2, - kNotSyncingAndSyncPasswordSaved = 3, - kMaxValue = kNotSyncingAndSyncPasswordSaved, -}; - void LogAccountStatHiRes(const std::string& name, int sample) { base::UmaHistogramCustomCounts(name, sample, 0, 1000, 100); } -void LogNumberOfAccountsForScheme(base::StringPiece suffix_for_profile, - base::StringPiece suffix_for_store, +void LogNumberOfAccountsForScheme(base::StringPiece suffix_for_store, const std::string& scheme, int sample) { base::UmaHistogramCustomCounts( - base::StrCat({kPasswordManager, suffix_for_profile, suffix_for_store, + base::StrCat({kPasswordManager, suffix_for_store, ".TotalAccountsHiRes.WithScheme.", scheme}), sample, 1, 1000, 100); } @@ -85,7 +72,6 @@ } void ReportNumberOfAccountsMetrics( - base::StringPiece user_profile_infix, bool is_account_store, bool custom_passphrase_sync_enabled, const std::vector<std::unique_ptr<PasswordForm>>& forms) { @@ -119,23 +105,20 @@ if (password_type == PasswordForm::Type::kGenerated) { total_generated_accounts += accounts_per_site; LogAccountStatHiRes( - base::StrCat({kPasswordManager, user_profile_infix, store_suffix, - kAccountsPerSiteSuffix, kAutoGeneratedSuffix, - custom_passphrase_suffix}), + base::StrCat({kPasswordManager, store_suffix, kAccountsPerSiteSuffix, + kAutoGeneratedSuffix, custom_passphrase_suffix}), accounts_per_site); } else { total_user_created_accounts += accounts_per_site; LogAccountStatHiRes( - base::StrCat({kPasswordManager, user_profile_infix, store_suffix, - kAccountsPerSiteSuffix, kUserCreatedSuffix, - custom_passphrase_suffix}), + base::StrCat({kPasswordManager, store_suffix, kAccountsPerSiteSuffix, + kUserCreatedSuffix, custom_passphrase_suffix}), accounts_per_site); } LogAccountStatHiRes( - base::StrCat({kPasswordManager, user_profile_infix, store_suffix, - kAccountsPerSiteSuffix, kOverallSuffix, - custom_passphrase_suffix}), + base::StrCat({kPasswordManager, store_suffix, kAccountsPerSiteSuffix, + kOverallSuffix, custom_passphrase_suffix}), accounts_per_site); } @@ -143,30 +126,27 @@ ".TotalAccountsHiRes.ByType"; LogAccountStatHiRes( - base::StrCat({kPasswordManager, user_profile_infix, store_suffix, - kTotalAccountsByTypeSuffix, kUserCreatedSuffix, - custom_passphrase_suffix}), + base::StrCat({kPasswordManager, store_suffix, kTotalAccountsByTypeSuffix, + kUserCreatedSuffix, custom_passphrase_suffix}), total_user_created_accounts); LogAccountStatHiRes( - base::StrCat({kPasswordManager, user_profile_infix, store_suffix, - kTotalAccountsByTypeSuffix, kAutoGeneratedSuffix, - custom_passphrase_suffix}), + base::StrCat({kPasswordManager, store_suffix, kTotalAccountsByTypeSuffix, + kAutoGeneratedSuffix, custom_passphrase_suffix}), total_generated_accounts); - LogAccountStatHiRes(base::StrCat({kPasswordManager, user_profile_infix, - store_suffix, kTotalAccountsByTypeSuffix, - kOverallSuffix, custom_passphrase_suffix}), - total_user_created_accounts + total_generated_accounts); + LogAccountStatHiRes( + base::StrCat({kPasswordManager, store_suffix, kTotalAccountsByTypeSuffix, + kOverallSuffix, custom_passphrase_suffix}), + total_user_created_accounts + total_generated_accounts); LogAccountStatHiRes( - base::StrCat({kPasswordManager, user_profile_infix, store_suffix, - ".BlacklistedSitesHiRes", custom_passphrase_suffix}), + base::StrCat({kPasswordManager, store_suffix, ".BlacklistedSitesHiRes", + custom_passphrase_suffix}), blocklisted_sites); } void ReportLoginsWithSchemesMetrics( - base::StringPiece user_profile_infix, bool is_account_store, const std::vector<std::unique_ptr<PasswordForm>>& forms) { int android_logins = 0; @@ -195,20 +175,14 @@ base::StringPiece suffix_for_store = GetMetricsSuffixForStore(is_account_store); - LogNumberOfAccountsForScheme(user_profile_infix, suffix_for_store, "Android", - android_logins); - LogNumberOfAccountsForScheme(user_profile_infix, suffix_for_store, "Ftp", - ftp_logins); - LogNumberOfAccountsForScheme(user_profile_infix, suffix_for_store, "Http", - http_logins); - LogNumberOfAccountsForScheme(user_profile_infix, suffix_for_store, "Https", - https_logins); - LogNumberOfAccountsForScheme(user_profile_infix, suffix_for_store, "Other", - other_logins); + LogNumberOfAccountsForScheme(suffix_for_store, "Android", android_logins); + LogNumberOfAccountsForScheme(suffix_for_store, "Ftp", ftp_logins); + LogNumberOfAccountsForScheme(suffix_for_store, "Http", http_logins); + LogNumberOfAccountsForScheme(suffix_for_store, "Https", https_logins); + LogNumberOfAccountsForScheme(suffix_for_store, "Other", other_logins); } void ReportTimesPasswordUsedMetrics( - base::StringPiece user_profile_infix, bool is_account_store, bool custom_passphrase_sync_enabled, const std::vector<std::unique_ptr<PasswordForm>>& forms) { @@ -225,26 +199,25 @@ if (type == PasswordForm::Type::kGenerated) { LogTimesUsedStat( - base::StrCat({kPasswordManager, user_profile_infix, store_suffix, + base::StrCat({kPasswordManager, store_suffix, kTimesPasswordUsedSuffix, kAutoGeneratedSuffix, custom_passphrase_suffix}), times_used); } else { LogTimesUsedStat( - base::StrCat({kPasswordManager, user_profile_infix, store_suffix, + base::StrCat({kPasswordManager, store_suffix, kTimesPasswordUsedSuffix, kUserCreatedSuffix, custom_passphrase_suffix}), times_used); } - LogTimesUsedStat(base::StrCat({kPasswordManager, user_profile_infix, - store_suffix, kTimesPasswordUsedSuffix, - kOverallSuffix, custom_passphrase_suffix}), - times_used); + LogTimesUsedStat( + base::StrCat({kPasswordManager, store_suffix, kTimesPasswordUsedSuffix, + kOverallSuffix, custom_passphrase_suffix}), + times_used); } } void ReportSyncingAccountStateMetrics( - const std::string& user_profile_infix, const std::string& sync_username, const std::vector<std::unique_ptr<PasswordForm>>& forms) { std::string signon_realm = @@ -255,22 +228,13 @@ gaia::AreEmailsSame(sync_username, base::UTF16ToUTF8(form->username_value)); }); - SyncingAccountState sync_account_state = - sync_username.empty() - ? (syncing_account_saved - ? SyncingAccountState::kNotSyncingAndSyncPasswordSaved - : SyncingAccountState::kNotSyncingAndSyncPasswordNotSaved) - : (syncing_account_saved - ? SyncingAccountState::kSyncingAndSyncPasswordSaved - : SyncingAccountState::kSyncingAndSyncPasswordNotSaved); - base::UmaHistogramEnumeration( - base::StrCat( - {kPasswordManager, user_profile_infix, ".SyncingAccountState"}), - sync_account_state); + + UMA_HISTOGRAM_ENUMERATION("PasswordManager.SyncingAccountState", + 2 * sync_username.empty() + syncing_account_saved, + 4); } void ReportDuplicateCredentialsMetrics( - const std::string& user_profile_infix, const std::vector<std::unique_ptr<PasswordForm>>& forms) { // First group the passwords by [signon_realm, username] (which should be a // unique identifier). @@ -302,31 +266,24 @@ credentials_with_mismatched_duplicates++; } + base::UmaHistogramCustomCounts("PasswordManager.CredentialsWithDuplicates", + credentials_with_duplicates, 0, 32, 6); base::UmaHistogramCustomCounts( - base::StrCat( - {kPasswordManager, user_profile_infix, ".CredentialsWithDuplicates"}), - credentials_with_duplicates, 0, 32, 6); - base::UmaHistogramCustomCounts( - base::StrCat({kPasswordManager, user_profile_infix, - ".CredentialsWithMismatchedDuplicates"}), + "PasswordManager.CredentialsWithMismatchedDuplicates", credentials_with_mismatched_duplicates, 0, 32, 6); } void ReportPasswordIssuesMetrics( - const std::string& user_profile_infix, BulkCheckDone bulk_check_done, const std::vector<std::unique_ptr<PasswordForm>>& forms) { int count_leaked = base::ranges::count_if(forms, [](const auto& form) { return !form->password_issues.contains(InsecureType::kLeaked); }); base::UmaHistogramCounts100( - base::StrCat({kPasswordManager, user_profile_infix, - ".CompromisedCredentials.CountLeaked"}), - count_leaked); + "PasswordManager.CompromisedCredentials.CountLeaked", count_leaked); if (bulk_check_done) { base::UmaHistogramCounts100( - base::StrCat({kPasswordManager, user_profile_infix, - ".CompromisedCredentials.CountLeakedAfterBulkCheck"}), + "PasswordManager.CompromisedCredentials.CountLeakedAfterBulkCheck", count_leaked); } @@ -334,13 +291,10 @@ return !form->password_issues.contains(InsecureType::kPhished); }); base::UmaHistogramCounts100( - base::StrCat({kPasswordManager, user_profile_infix, - ".CompromisedCredentials.CountPhished"}), - count_phished); + "PasswordManager.CompromisedCredentials.CountPhished", count_phished); } void ReportMultiStoreMetrics( - const std::string& user_profile_infix, std::unique_ptr<std::map<std::pair<std::string, std::u16string>, std::u16string>> profile_store_results, std::unique_ptr<std::map<std::pair<std::string, std::u16string>, @@ -400,21 +354,13 @@ if (is_opted_in) { base::UmaHistogramCounts100( - base::StrCat({kPasswordManager, user_profile_infix, - ".AccountStoreVsProfileStore2.Additional"}), - additional); + "PasswordManager.AccountStoreVsProfileStore2.Additional", additional); base::UmaHistogramCounts100( - base::StrCat({kPasswordManager, user_profile_infix, - ".AccountStoreVsProfileStore2.Missing"}), - missing); + "PasswordManager.AccountStoreVsProfileStore2.Missing", missing); base::UmaHistogramCounts100( - base::StrCat({kPasswordManager, user_profile_infix, - ".AccountStoreVsProfileStore2.Identical"}), - identical); + "PasswordManager.AccountStoreVsProfileStore2.Identical", identical); base::UmaHistogramCounts100( - base::StrCat({kPasswordManager, user_profile_infix, - ".AccountStoreVsProfileStore2.Conflicting"}), - conflicting); + "PasswordManager.AccountStoreVsProfileStore2.Conflicting", conflicting); } } @@ -428,13 +374,10 @@ PrefService* prefs, password_manager::PasswordReuseManager* password_reuse_manager, bool is_under_advanced_protection, - bool for_primary_user_profile, base::OnceClosure done_callback) : profile_store_(profile_store), account_store_(account_store), is_under_advanced_protection_(is_under_advanced_protection), - user_profile_infix_(for_primary_user_profile ? kPrimaryUserProfile - : kNonPrimaryUserProfile), done_callback_(std::move(done_callback)) { DCHECK(prefs); @@ -452,7 +395,7 @@ is_opted_in_ = features_util::IsOptedInForAccountStorage(prefs, sync_service); base::UmaHistogramBoolean( - base::StrCat({kPasswordManager, user_profile_infix_, ".Enabled2"}), + "PasswordManager.Enabled2", prefs->GetBoolean(password_manager::prefs::kCredentialsEnableService)); // May be null in tests. @@ -511,8 +454,7 @@ // If both stores exist, kick off the MultiStoreMetricsReporter. if (profile_store_results_ && account_store_results_) { - ReportMultiStoreMetrics(user_profile_infix_, - std::move(profile_store_results_), + ReportMultiStoreMetrics(std::move(profile_store_results_), std::move(account_store_results_), is_opted_in_); } std::move(done_callback_).Run(); @@ -521,11 +463,10 @@ void StoreMetricsReporter::ReportStoreMetrics( bool is_account_store, std::vector<std::unique_ptr<PasswordForm>> results) { - ReportNumberOfAccountsMetrics(user_profile_infix_, is_account_store, + ReportNumberOfAccountsMetrics(is_account_store, custom_passphrase_sync_enabled_, results); - ReportLoginsWithSchemesMetrics(user_profile_infix_, is_account_store, - results); - ReportTimesPasswordUsedMetrics(user_profile_infix_, is_account_store, + ReportLoginsWithSchemesMetrics(is_account_store, results); + ReportTimesPasswordUsedMetrics(is_account_store, custom_passphrase_sync_enabled_, results); // The remaining metrics are not recorded for the account store: @@ -537,10 +478,9 @@ if (is_account_store) return; - ReportSyncingAccountStateMetrics(user_profile_infix_, sync_username_, - results); - ReportDuplicateCredentialsMetrics(user_profile_infix_, results); - ReportPasswordIssuesMetrics(user_profile_infix_, bulk_check_done_, results); + ReportSyncingAccountStateMetrics(sync_username_, results); + ReportDuplicateCredentialsMetrics(results); + ReportPasswordIssuesMetrics(bulk_check_done_, results); } StoreMetricsReporter::~StoreMetricsReporter() = default;
diff --git a/components/password_manager/core/browser/store_metrics_reporter.h b/components/password_manager/core/browser/store_metrics_reporter.h index 505b30f..8b6d8a1 100644 --- a/components/password_manager/core/browser/store_metrics_reporter.h +++ b/components/password_manager/core/browser/store_metrics_reporter.h
@@ -36,11 +36,8 @@ // |sync_service| password syncing state. Uses |sync_service| and // |identity_manager| to obtain the sync username to report about its presence // among saved credentials. Uses the |prefs| to obtain information whether the - // password manager and the leak detection feature is - // enabled.|for_primary_user_profile| indicates whether metrics are reported - // for the user which created the current session. Metrics for primary user - // profile are reported in different histograms from other profiles. - // |done_call| is run after all metrics reporting is done from the store. + // password manager and the leak detection feature is enabled. |done_call| is + // run after all metrics reporting is done from the store. StoreMetricsReporter(PasswordStoreInterface* profile_store, PasswordStoreInterface* account_store, const syncer::SyncService* sync_service, @@ -48,7 +45,6 @@ PrefService* prefs, PasswordReuseManager* password_reuse_manager, bool is_under_advanced_protection, - bool for_primary_user_profile, base::OnceClosure done_call); StoreMetricsReporter(const StoreMetricsReporter&) = delete; StoreMetricsReporter& operator=(const StoreMetricsReporter&) = delete; @@ -74,10 +70,6 @@ bool is_under_advanced_protection_; - // Used to report metrics for primary user profile and non-primary user - // profile in different histogram. - const std::string user_profile_infix_; - std::string sync_username_; bool custom_passphrase_sync_enabled_;
diff --git a/components/password_manager/core/browser/store_metrics_reporter_unittest.cc b/components/password_manager/core/browser/store_metrics_reporter_unittest.cc index 1fa3e48..452baa5 100644 --- a/components/password_manager/core/browser/store_metrics_reporter_unittest.cc +++ b/components/password_manager/core/browser/store_metrics_reporter_unittest.cc
@@ -168,12 +168,11 @@ StoreMetricsReporter reporter( /*profile_store=*/nullptr, /*account_store=*/nullptr, sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, - /*is_under_advanced_protection=*/false, /*for_primary_user_profile=*/true, + /*is_under_advanced_protection=*/false, /*done_callback*/ base::DoNothing()); - histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.Enabled2", password_manager_enabled, - 1); + histogram_tester.ExpectUniqueSample("PasswordManager.Enabled2", + password_manager_enabled, 1); } TEST_F(StoreMetricsReporterTest, ReportAccountsPerSiteHiResMetricsTest) { @@ -195,39 +194,31 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the // stores, i.e. to background task runners. RunUntilIdle(); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.ProfileStore.AccountsPerSiteHiRes." - "AutoGenerated." + "PasswordManager.AccountsPerSiteHiRes.AutoGenerated." "WithoutCustomPassphrase", 1, 2); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.AccountsPerSiteHiRes." - "UserCreated." + "PasswordManager.AccountsPerSiteHiRes.UserCreated." "WithoutCustomPassphrase", 1, 3); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.AccountsPerSiteHiRes." - "UserCreated." + "PasswordManager.AccountsPerSiteHiRes.UserCreated." "WithoutCustomPassphrase", 2, 2); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.AccountsPerSiteHiRes." - "Overall." - "WithoutCustomPassphrase", - 1, 5); + "PasswordManager.AccountsPerSiteHiRes.Overall.WithoutCustomPassphrase", 1, + 5); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.AccountsPerSiteHiRes." - "Overall." - "WithoutCustomPassphrase", - 2, 2); + "PasswordManager.AccountsPerSiteHiRes.Overall.WithoutCustomPassphrase", 2, + 2); account_store->ShutdownOnUIThread(); profile_store->ShutdownOnUIThread(); @@ -255,7 +246,6 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the @@ -263,46 +253,30 @@ RunUntilIdle(); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.ProfileStore.TotalAccountsHiRes." - "ByType." - "AutoGenerated." + "PasswordManager.TotalAccountsHiRes.ByType.AutoGenerated." "WithoutCustomPassphrase", 2, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.ProfileStore.TotalAccountsHiRes." - "ByType." - "UserCreated." + "PasswordManager.TotalAccountsHiRes.ByType.UserCreated." "WithoutCustomPassphrase", 7, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.ProfileStore.TotalAccountsHiRes." - "ByType.Overall." + "PasswordManager.TotalAccountsHiRes.ByType.Overall." "WithoutCustomPassphrase", 9, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.ProfileStore.TotalAccountsHiRes." - "WithScheme." - "Android", - 2, 1); + "PasswordManager.TotalAccountsHiRes.WithScheme.Android", 2, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.ProfileStore.TotalAccountsHiRes." - "WithScheme.Ftp", - 1, 1); + "PasswordManager.TotalAccountsHiRes.WithScheme.Ftp", 1, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.ProfileStore.TotalAccountsHiRes." - "WithScheme.Http", - 5, 1); + "PasswordManager.TotalAccountsHiRes.WithScheme.Http", 5, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.ProfileStore.TotalAccountsHiRes." - "WithScheme.Https", - 1, 1); + "PasswordManager.TotalAccountsHiRes.WithScheme.Https", 1, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.ProfileStore.TotalAccountsHiRes." - "WithScheme.Other", - 0, 1); + "PasswordManager.TotalAccountsHiRes.WithScheme.Other", 0, 1); account_store->ShutdownOnUIThread(); profile_store->ShutdownOnUIThread(); @@ -330,7 +304,6 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the @@ -338,53 +311,35 @@ RunUntilIdle(); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.TimesPasswordUsed." - "AutoGenerated." - "WithoutCustomPassphrase", + "PasswordManager.TimesPasswordUsed.AutoGenerated.WithoutCustomPassphrase", 2, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.TimesPasswordUsed." - "AutoGenerated." - "WithoutCustomPassphrase", + "PasswordManager.TimesPasswordUsed.AutoGenerated.WithoutCustomPassphrase", 4, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.TimesPasswordUsed." - "UserCreated." - "WithoutCustomPassphrase", + "PasswordManager.TimesPasswordUsed.UserCreated.WithoutCustomPassphrase", 0, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.TimesPasswordUsed." - "UserCreated." - "WithoutCustomPassphrase", + "PasswordManager.TimesPasswordUsed.UserCreated.WithoutCustomPassphrase", 1, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.TimesPasswordUsed." - "UserCreated." - "WithoutCustomPassphrase", + "PasswordManager.TimesPasswordUsed.UserCreated.WithoutCustomPassphrase", 3, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.TimesPasswordUsed." - "Overall." - "WithoutCustomPassphrase", - 0, 1); + "PasswordManager.TimesPasswordUsed.Overall.WithoutCustomPassphrase", 0, + 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.TimesPasswordUsed." - "Overall." - "WithoutCustomPassphrase", - 1, 1); + "PasswordManager.TimesPasswordUsed.Overall.WithoutCustomPassphrase", 1, + 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.TimesPasswordUsed." - "Overall." - "WithoutCustomPassphrase", - 2, 1); + "PasswordManager.TimesPasswordUsed.Overall.WithoutCustomPassphrase", 2, + 1); // The bucket for 3 and 4 is the same. Thus we expect two samples here. histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.ProfileStore.TimesPasswordUsed." - "Overall." - "WithoutCustomPassphrase", - 3, 2); + "PasswordManager.TimesPasswordUsed.Overall.WithoutCustomPassphrase", 3, + 2); account_store->ShutdownOnUIThread(); profile_store->ShutdownOnUIThread(); @@ -422,7 +377,6 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the @@ -430,30 +384,25 @@ RunUntilIdle(); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStore.AccountsPerSiteHiRes." - "AutoGenerated." + "PasswordManager.AccountStore.AccountsPerSiteHiRes.AutoGenerated." "WithoutCustomPassphrase", 1, 2); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.AccountsPerSiteHiRes." - "UserCreated." + "PasswordManager.AccountStore.AccountsPerSiteHiRes.UserCreated." "WithoutCustomPassphrase", 1, 3); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.AccountsPerSiteHiRes." - "UserCreated." + "PasswordManager.AccountStore.AccountsPerSiteHiRes.UserCreated." "WithoutCustomPassphrase", 2, 2); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.AccountsPerSiteHiRes." - "Overall." + "PasswordManager.AccountStore.AccountsPerSiteHiRes.Overall." "WithoutCustomPassphrase", 1, 5); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.AccountsPerSiteHiRes." - "Overall." + "PasswordManager.AccountStore.AccountsPerSiteHiRes.Overall." "WithoutCustomPassphrase", 2, 2); @@ -489,7 +438,6 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the @@ -497,43 +445,31 @@ RunUntilIdle(); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStore.TotalAccountsHiRes." - "ByType.AutoGenerated." + "PasswordManager.AccountStore.TotalAccountsHiRes.ByType.AutoGenerated." "WithoutCustomPassphrase", 2, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStore.TotalAccountsHiRes." - "ByType.UserCreated." + "PasswordManager.AccountStore.TotalAccountsHiRes.ByType.UserCreated." "WithoutCustomPassphrase", 7, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStore.TotalAccountsHiRes." - "ByType.Overall." + "PasswordManager.AccountStore.TotalAccountsHiRes.ByType.Overall." "WithoutCustomPassphrase", 9, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStore.TotalAccountsHiRes." - "WithScheme.Android", - 2, 1); + "PasswordManager.AccountStore.TotalAccountsHiRes.WithScheme.Android", 2, + 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStore.TotalAccountsHiRes." - "WithScheme.Ftp", - 1, 1); + "PasswordManager.AccountStore.TotalAccountsHiRes.WithScheme.Ftp", 1, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStore.TotalAccountsHiRes." - "WithScheme.Http", - 5, 1); + "PasswordManager.AccountStore.TotalAccountsHiRes.WithScheme.Http", 5, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStore.TotalAccountsHiRes." - "WithScheme.Https", - 1, 1); + "PasswordManager.AccountStore.TotalAccountsHiRes.WithScheme.Https", 1, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStore.TotalAccountsHiRes." - "WithScheme.Other", - 0, 1); + "PasswordManager.AccountStore.TotalAccountsHiRes.WithScheme.Other", 0, 1); account_store->ShutdownOnUIThread(); profile_store->ShutdownOnUIThread(); @@ -567,7 +503,6 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the @@ -575,51 +510,42 @@ RunUntilIdle(); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.TimesPasswordUsed." - "AutoGenerated." + "PasswordManager.AccountStore.TimesPasswordUsed.AutoGenerated." "WithoutCustomPassphrase", 2, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.TimesPasswordUsed." - "AutoGenerated." + "PasswordManager.AccountStore.TimesPasswordUsed.AutoGenerated." "WithoutCustomPassphrase", 4, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.TimesPasswordUsed." - "UserCreated." + "PasswordManager.AccountStore.TimesPasswordUsed.UserCreated." "WithoutCustomPassphrase", 0, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.TimesPasswordUsed." - "UserCreated." + "PasswordManager.AccountStore.TimesPasswordUsed.UserCreated." "WithoutCustomPassphrase", 1, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.TimesPasswordUsed." - "UserCreated." + "PasswordManager.AccountStore.TimesPasswordUsed.UserCreated." "WithoutCustomPassphrase", 3, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.TimesPasswordUsed." - "Overall." + "PasswordManager.AccountStore.TimesPasswordUsed.Overall." "WithoutCustomPassphrase", 0, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.TimesPasswordUsed." - "Overall." + "PasswordManager.AccountStore.TimesPasswordUsed.Overall." "WithoutCustomPassphrase", 1, 1); histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.TimesPasswordUsed." - "Overall." + "PasswordManager.AccountStore.TimesPasswordUsed.Overall." "WithoutCustomPassphrase", 2, 1); // The bucket for 3 and 4 is the same. Thus we expect two samples here. histogram_tester.ExpectBucketCount( - "PasswordManager.PrimaryUserProfile.AccountStore.TimesPasswordUsed." - "Overall." + "PasswordManager.AccountStore.TimesPasswordUsed.Overall." "WithoutCustomPassphrase", 3, 2); @@ -669,21 +595,18 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the // stores, i.e. to background task runners. RunUntilIdle(); - EXPECT_THAT( - histogram_tester.GetAllSamples( - "PasswordManager.PrimaryUserProfile.CredentialsWithDuplicates"), - testing::ElementsAre(base::Bucket(0, 1))); - EXPECT_THAT( - histogram_tester.GetAllSamples("PasswordManager.PrimaryUserProfile." - "CredentialsWithMismatchedDuplicates"), - testing::ElementsAre(base::Bucket(0, 1))); + EXPECT_THAT(histogram_tester.GetAllSamples( + "PasswordManager.CredentialsWithDuplicates"), + testing::ElementsAre(base::Bucket(0, 1))); + EXPECT_THAT(histogram_tester.GetAllSamples( + "PasswordManager.CredentialsWithMismatchedDuplicates"), + testing::ElementsAre(base::Bucket(0, 1))); profile_store->ShutdownOnUIThread(); // Make sure the PasswordStore destruction parts on the background sequence @@ -723,7 +646,6 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the @@ -731,14 +653,12 @@ RunUntilIdle(); // There should be 2 groups of "exact" duplicates. - EXPECT_THAT( - histogram_tester.GetAllSamples( - "PasswordManager.PrimaryUserProfile.CredentialsWithDuplicates"), - testing::ElementsAre(base::Bucket(2, 1))); - EXPECT_THAT( - histogram_tester.GetAllSamples("PasswordManager.PrimaryUserProfile." - "CredentialsWithMismatchedDuplicates"), - testing::ElementsAre(base::Bucket(0, 1))); + EXPECT_THAT(histogram_tester.GetAllSamples( + "PasswordManager.CredentialsWithDuplicates"), + testing::ElementsAre(base::Bucket(2, 1))); + EXPECT_THAT(histogram_tester.GetAllSamples( + "PasswordManager.CredentialsWithMismatchedDuplicates"), + testing::ElementsAre(base::Bucket(0, 1))); profile_store->ShutdownOnUIThread(); // Make sure the PasswordStore destruction parts on the background sequence @@ -776,21 +696,18 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the // stores, i.e. to background task runners. RunUntilIdle(); - EXPECT_THAT( - histogram_tester.GetAllSamples( - "PasswordManager.PrimaryUserProfile.CredentialsWithDuplicates"), - testing::ElementsAre(base::Bucket(0, 1))); - EXPECT_THAT( - histogram_tester.GetAllSamples("PasswordManager.PrimaryUserProfile." - "CredentialsWithMismatchedDuplicates"), - testing::ElementsAre(base::Bucket(1, 1))); + EXPECT_THAT(histogram_tester.GetAllSamples( + "PasswordManager.CredentialsWithDuplicates"), + testing::ElementsAre(base::Bucket(0, 1))); + EXPECT_THAT(histogram_tester.GetAllSamples( + "PasswordManager.CredentialsWithMismatchedDuplicates"), + testing::ElementsAre(base::Bucket(1, 1))); profile_store->ShutdownOnUIThread(); // Make sure the PasswordStore destruction parts on the background sequence @@ -880,7 +797,6 @@ sync_service(), identity_manager(), &prefs_, /*password_reuse_manager=*/nullptr, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the @@ -889,38 +805,22 @@ if (opted_in) { histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStoreVsProfileStore2." - "Additional", - 2, 1); + "PasswordManager.AccountStoreVsProfileStore2.Additional", 2, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStoreVsProfileStore2." - "Missing", - 4, 1); + "PasswordManager.AccountStoreVsProfileStore2.Missing", 4, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStoreVsProfileStore2." - "Identical", - 2, 1); + "PasswordManager.AccountStoreVsProfileStore2.Identical", 2, 1); histogram_tester.ExpectUniqueSample( - "PasswordManager.PrimaryUserProfile.AccountStoreVsProfileStore2." - "Conflicting", - 1, 1); + "PasswordManager.AccountStoreVsProfileStore2.Conflicting", 1, 1); } else { histogram_tester.ExpectTotalCount( - "PasswordManager.PrimaryUserProfile.AccountStoreVsProfileStore2." - "Additional", - 0); + "PasswordManager.AccountStoreVsProfileStore2.Additional", 0); histogram_tester.ExpectTotalCount( - "PasswordManager.PrimaryUserProfile.AccountStoreVsProfileStore2." - "Missing", - 0); + "PasswordManager.AccountStoreVsProfileStore2.Missing", 0); histogram_tester.ExpectTotalCount( - "PasswordManager.PrimaryUserProfile.AccountStoreVsProfileStore2." - "Identical", - 0); + "PasswordManager.AccountStoreVsProfileStore2.Identical", 0); histogram_tester.ExpectTotalCount( - "PasswordManager.PrimaryUserProfile.AccountStoreVsProfileStore2." - "Conflicting", - 0); + "PasswordManager.AccountStoreVsProfileStore2.Conflicting", 0); } } @@ -951,7 +851,6 @@ /*account_store=*/nullptr, sync_service(), identity_manager(), &prefs_, &reuse_manager, /*is_under_advanced_protection=*/true, - /*for_primary_user_profile=*/true, /*done_callback*/ base::DoNothing()); // Wait for the metrics to get reported, which involves queries to the stores,
diff --git a/components/sync/android/BUILD.gn b/components/sync/android/BUILD.gn index 5b75efa..47e91cf 100644 --- a/components/sync/android/BUILD.gn +++ b/components/sync/android/BUILD.gn
@@ -23,7 +23,6 @@ sources = [ "//components/sync/base/model_type.h", "//components/sync/base/passphrase_enums.h", - "//components/sync/base/stop_source.h", "//components/sync/driver/sync_service_utils.h", ] }
diff --git a/components/sync/base/stop_source.h b/components/sync/base/stop_source.h index 2ec6daf..01a8c3d4 100644 --- a/components/sync/base/stop_source.h +++ b/components/sync/base/stop_source.h
@@ -9,16 +9,13 @@ // Enumerate the main sources that can turn off sync. This enum is used to // back a UMA histogram and should be treated as append-only. -// -// A Java counterpart will be generated for this enum. -// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.sync enum StopSource { // Deprecated: PROFILE_DESTRUCTION = 0, SIGN_OUT = 1, // The user signed out of Chrome. BIRTHDAY_ERROR = 2, // A dashboard stop-and-clear on the server. CHROME_SYNC_SETTINGS = 3, // The on/off switch in settings for mobile Chrome. - ANDROID_CHROME_SYNC = 4, // Android's sync setting for Chrome. - ANDROID_MASTER_SYNC = 5, // Android's master sync setting. + // Deprecated: ANDROID_CHROME_SYNC = 4, + // Deprecated: ANDROID_MASTER_SYNC = 5, STOP_SOURCE_LIMIT = 6, };
diff --git a/components/test/data/autofill_assistant/html/form_target_website.html b/components/test/data/autofill_assistant/html/form_target_website.html index 7faf064..f59419d 100644 --- a/components/test/data/autofill_assistant/html/form_target_website.html +++ b/components/test/data/autofill_assistant/html/form_target_website.html
@@ -67,6 +67,13 @@ <option value="2021">2021</option> <option value="2022">2022</option> <option value="2023">2023</option> + <option value="2024">2024</option> + <option value="2025">2025</option> + <option value="2026">2026</option> + <option value="2027">2027</option> + <option value="2028">2028</option> + <option value="2029">2029</option> + <option value="2030">2030</option> <option value="2050">2050</option> </select> Fallback: <input type="text" id="fallback_entry" name="fallback_entry"/><br/>
diff --git a/components/translate/core/browser/translate_infobar_delegate_unittest.cc b/components/translate/core/browser/translate_infobar_delegate_unittest.cc index fe5f33e..f22347c 100644 --- a/components/translate/core/browser/translate_infobar_delegate_unittest.cc +++ b/components/translate/core/browser/translate_infobar_delegate_unittest.cc
@@ -86,6 +86,7 @@ protected: void SetUp() override { + ::testing::Test::SetUp(); pref_service_ = std::make_unique<sync_preferences::TestingPrefServiceSyncable>(); language::LanguagePrefs::RegisterProfilePrefs(pref_service_->registry()); @@ -107,6 +108,11 @@ infobar_manager_ = std::make_unique<TestInfoBarManager>(); } + void TearDown() override { + infobar_manager_->ShutDown(); + ::testing::Test::TearDown(); + } + std::unique_ptr<TranslateInfoBarDelegate> ConstructInfoBarDelegate() { return std::unique_ptr<TranslateInfoBarDelegate>( new TranslateInfoBarDelegate(
diff --git a/content/browser/direct_sockets/direct_sockets_udp_browsertest.cc b/content/browser/direct_sockets/direct_sockets_udp_browsertest.cc index 1ab2ad5..1411c59 100644 --- a/content/browser/direct_sockets/direct_sockets_udp_browsertest.cc +++ b/content/browser/direct_sockets/direct_sockets_udp_browsertest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/notreached.h" +#include "base/strings/stringprintf.h" #include "base/test/bind.h" #include "base/test/scoped_feature_list.h" #include "content/browser/direct_sockets/direct_sockets_service_impl.h" @@ -21,6 +23,8 @@ #include "net/base/ip_endpoint.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "services/network/public/mojom/network_context.mojom.h" +#include "services/network/public/mojom/udp_socket.mojom.h" +#include "services/network/test/udp_socket_test_util.h" #include "testing/gmock/include/gmock/gmock-matchers.h" #include "url/gurl.h" @@ -72,12 +76,36 @@ origin_list); } + uint16_t CreateUDPSocket( + mojo::PendingRemote<network::mojom::UDPSocketListener> + listener_receiver_remote) { + GetNetworkContext()->CreateUDPSocket( + server_socket_.BindNewPipeAndPassReceiver(), + std::move(listener_receiver_remote)); + + server_socket_.set_disconnect_handler( + base::BindLambdaForTesting([]() { NOTREACHED(); })); + + net::IPEndPoint server_addr(net::IPAddress::IPv4Localhost(), 0); + network::test::UDPSocketTestHelper helper(&server_socket_); + + int result = helper.BindSync(server_addr, nullptr, &server_addr); + DCHECK_EQ(net::OK, result); + + return server_addr.port(); + } + + void ReceiveMore(uint32_t num_additional_datagrams) { + server_socket_->ReceiveMore(num_additional_datagrams); + } + private: BrowserContext* browser_context() { return shell()->web_contents()->GetBrowserContext(); } base::test::ScopedFeatureList feature_list_; + mojo::Remote<network::mojom::UDPSocket> server_socket_; }; IN_PROC_BROWSER_TEST_F(DirectSocketsUdpBrowserTest, CloseUdp) { @@ -92,4 +120,69 @@ EXPECT_EQ("closeUdp succeeded", EvalJs(shell(), script)); } +// TODO(crbug/1290807): fails on the Win10 Tests x64 builder. +#if !BUILDFLAG(IS_WIN) +IN_PROC_BROWSER_TEST_F(DirectSocketsUdpBrowserTest, SendUdp) { + // We send datagrams with one byte, two bytes, three bytes, ... + const uint32_t kRequiredDatagrams = 35; + const uint32_t kRequiredBytes = + kRequiredDatagrams * (kRequiredDatagrams + 1) / 2; + EXPECT_TRUE(NavigateToURL(shell(), GetTestPageURL())); + + DirectSocketsServiceImpl::SetPermissionCallbackForTesting( + base::BindRepeating(&UnconditionallyPermitConnection)); + + // Any attempt to make this a class member results into + // "This caller requires a single-threaded context". + network::test::UDPSocketListenerImpl listener; + mojo::Receiver<network::mojom::UDPSocketListener> listener_receiver{ + &listener}; + + const uint16_t port = + CreateUDPSocket(listener_receiver.BindNewPipeAndPassRemote()); + + ReceiveMore(kRequiredDatagrams); + + const std::string script = base::StringPrintf( + "sendUdp({remoteAddress: '127.0.0.1', remotePort: %d}, %u)", port, + kRequiredBytes); + + EXPECT_EQ("send succeeded", EvalJs(shell(), script)); + + listener.WaitForReceivedResults(kRequiredDatagrams); + EXPECT_EQ(listener.results().size(), kRequiredDatagrams); + + uint32_t bytes_received = 0, expected_data_size = 0; + for (const network::test::UDPSocketListenerImpl::ReceivedResult& result : + listener.results()) { + expected_data_size++; + EXPECT_EQ(result.net_error, net::OK); + EXPECT_TRUE(result.src_addr.has_value()); + EXPECT_TRUE(result.data.has_value()); + EXPECT_EQ(result.data->size(), expected_data_size); + for (uint8_t current : *result.data) { + EXPECT_EQ(current, static_cast<uint8_t>('a')); + ++bytes_received; + } + } + EXPECT_EQ(bytes_received, kRequiredBytes); +} +#endif + +IN_PROC_BROWSER_TEST_F(DirectSocketsUdpBrowserTest, SendUdpAfterClose) { + const uint32_t kRequiredBytes = 1; + EXPECT_TRUE(NavigateToURL(shell(), GetTestPageURL())); + + DirectSocketsServiceImpl::SetPermissionCallbackForTesting( + base::BindRepeating(&UnconditionallyPermitConnection)); + + const std::string script = base::StringPrintf( + "sendUdpAfterClose({remoteAddress: '127.0.0.1', remotePort: 993}, %u)", + kRequiredBytes); + EXPECT_EQ( + "send failed: InvalidStateError: Failed to execute 'write' on " + "'UnderlyingSinkBase': Socket is disconnected.", + EvalJs(shell(), script)); +} + } // namespace content
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 02bd332..badcf2559 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -6739,7 +6739,17 @@ absl::optional<network::mojom::BlockedByResponseReason> NavigationRequest::EnforceCOEP() { // https://html.spec.whatwg.org/C/#check-a-navigation-response's-adherence-to-its-embedder-policy - auto* parent_frame = GetParentFrame(); + // Spec should be updated: + // https://github.com/shivanigithub/fenced-frame/issues/11 + + // Fenced frames should be treated as an embedded frame, thus COEP must apply. + // Note: we only check the outer document for fenced frames, because it's + // unclear if other embedded cases like Portals should behave the same. + // TODO(https://crbug.com/1278207): add other embedded cases if needed. + RenderFrameHostImpl* const parent_frame = + GetNavigatingFrameType() == FrameType::kFencedFrameRoot + ? GetParentFrameOrOuterDocument() + : GetParentFrame(); if (!parent_frame) { return absl::nullopt; }
diff --git a/content/browser/webrtc/webrtc_depth_capture_browsertest.cc b/content/browser/webrtc/webrtc_depth_capture_browsertest.cc deleted file mode 100644 index 35f056fb..0000000 --- a/content/browser/webrtc/webrtc_depth_capture_browsertest.cc +++ /dev/null
@@ -1,102 +0,0 @@ -// Copyright 2016 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 <stddef.h> - -#include "base/command_line.h" -#include "base/strings/stringprintf.h" -#include "base/strings/utf_string_conversions.h" -#include "content/browser/webrtc/webrtc_content_browsertest_base.h" -#include "content/public/common/content_switches.h" -#include "content/public/test/browser_test.h" -#include "content/public/test/content_browser_test_utils.h" -#include "media/base/media_switches.h" -#include "net/test/embedded_test_server/embedded_test_server.h" - -namespace { - -static const char kGetDepthStreamAndCallCreateImageBitmap[] = - "getDepthStreamAndCallCreateImageBitmap"; -static const char kGetStreamsByVideoKind[] = "getStreamsByVideoKind"; -static const char kGetStreamsByVideoKindNoDepth[] = - "getStreamsByVideoKindNoDepth"; - -} // namespace - -namespace content { - -template <int device_count, bool enable_video_kind> -class WebRtcDepthCaptureBrowserTest : public WebRtcContentBrowserTestBase { - public: - WebRtcDepthCaptureBrowserTest() { - // Automatically grant device permission. - AppendUseFakeUIForMediaStreamFlag(); - } - ~WebRtcDepthCaptureBrowserTest() override {} - - void SetUp() override { - base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - ASSERT_FALSE( - command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream)); - command_line->AppendSwitchASCII( - switches::kUseFakeDeviceForMediaStream, - base::StringPrintf("device-count=%d", device_count)); - if (enable_video_kind) { - command_line->AppendSwitchASCII(switches::kEnableBlinkFeatures, - "MediaCaptureDepthVideoKind"); - } - WebRtcContentBrowserTestBase::SetUp(); - } -}; - -// Command lines must be configured in SetUpCommandLine, before the test is -// multi-threaded, so any variations must be embedded in the test fixture. - -// Test using two video capture devices - a color and a 16-bit depth device. -using WebRtcTwoDeviceDepthCaptureBrowserTest = - WebRtcDepthCaptureBrowserTest<2, false>; -using WebRtcTwoDeviceDepthCaptureVideoKindBrowserTest = - WebRtcDepthCaptureBrowserTest<2, true>; - -// Test using only a color device. -using WebRtcOneDeviceDepthCaptureVideoKindBrowserTest = - WebRtcDepthCaptureBrowserTest<1, true>; - -IN_PROC_BROWSER_TEST_F(WebRtcTwoDeviceDepthCaptureBrowserTest, - GetDepthStreamAndCallCreateImageBitmap) { - ASSERT_TRUE(embedded_test_server()->Start()); - - GURL url( - embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); - EXPECT_TRUE(NavigateToURL(shell(), url)); - - ExecuteJavascriptAndWaitForOk(base::StringPrintf( - "%s({video: true});", kGetDepthStreamAndCallCreateImageBitmap)); -} - -IN_PROC_BROWSER_TEST_F(WebRtcTwoDeviceDepthCaptureVideoKindBrowserTest, - GetStreamsByVideoKind) { - ASSERT_TRUE(embedded_test_server()->Start()); - - GURL url( - embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); - EXPECT_TRUE(NavigateToURL(shell(), url)); - - ExecuteJavascriptAndWaitForOk( - base::StringPrintf("%s({video: true});", kGetStreamsByVideoKind)); -} - -IN_PROC_BROWSER_TEST_F(WebRtcOneDeviceDepthCaptureVideoKindBrowserTest, - GetStreamsByVideoKindNoDepth) { - ASSERT_TRUE(embedded_test_server()->Start()); - - GURL url( - embedded_test_server()->GetURL("/media/getusermedia-depth-capture.html")); - EXPECT_TRUE(NavigateToURL(shell(), url)); - - ExecuteJavascriptAndWaitForOk( - base::StringPrintf("%s({video: true});", kGetStreamsByVideoKindNoDepth)); -} - -} // namespace content
diff --git a/content/public/android/java/src/org/chromium/content/browser/BrowserStartupControllerImpl.java b/content/public/android/java/src/org/chromium/content/browser/BrowserStartupControllerImpl.java index 615c785..e020bca 100644 --- a/content/public/android/java/src/org/chromium/content/browser/BrowserStartupControllerImpl.java +++ b/content/public/android/java/src/org/chromium/content/browser/BrowserStartupControllerImpl.java
@@ -221,7 +221,7 @@ : BrowserStartType.FULL_BROWSER; if (contentStart() > 0) { // Failed. The callbacks may not have run, so run them. - enqueueCallbackExecution(STARTUP_FAILURE); + enqueueCallbackExecutionOnStartupFailure(); } } }); @@ -230,7 +230,7 @@ // If we missed the minimalBrowserStarted() call, launch the full browser now if needed. // Otherwise, minimalBrowserStarted() will handle the full browser launch. mCurrentBrowserStartType = BrowserStartType.FULL_BROWSER; - if (contentStart() > 0) enqueueCallbackExecution(STARTUP_FAILURE); + if (contentStart() > 0) enqueueCallbackExecutionOnStartupFailure(); } } @@ -253,7 +253,7 @@ mCurrentBrowserStartType = BrowserStartType.FULL_BROWSER; if (contentStart() > 0) { // Failed. The callbacks may not have run, so run them. - enqueueCallbackExecution(STARTUP_FAILURE); + enqueueCallbackExecutionOnStartupFailure(); startedSuccessfully = false; } } @@ -365,7 +365,7 @@ // If startFullBrowser() fails, execute the callbacks right away. Otherwise, // callbacks will be deferred until browser startup completes. mCurrentBrowserStartType = BrowserStartType.FULL_BROWSER; - if (contentStart() > 0) enqueueCallbackExecution(STARTUP_FAILURE); + if (contentStart() > 0) enqueueCallbackExecutionOnStartupFailure(); return; } @@ -405,15 +405,11 @@ mMinimalBrowserStartedCallbacks.clear(); } - // Queue the callbacks to run. Since running the callbacks clears the list it is safe to call - // this more than once. - private void enqueueCallbackExecution(final int startupFailure) { - PostTask.postTask(UiThreadTaskTraits.BOOTSTRAP, new Runnable() { - @Override - public void run() { - executeEnqueuedCallbacks(startupFailure); - } - }); + // Post a task to tell the callbacks that startup failed. Since the execution clears the + // callback lists, it is safe to call this more than once. + private void enqueueCallbackExecutionOnStartupFailure() { + PostTask.postTask( + UiThreadTaskTraits.BOOTSTRAP, () -> executeEnqueuedCallbacks(STARTUP_FAILURE)); } private void postStartupCompleted(final StartupCallback callback) {
diff --git a/content/test/BUILD.gn b/content/test/BUILD.gn index 7adfc61..7ba19df 100644 --- a/content/test/BUILD.gn +++ b/content/test/BUILD.gn
@@ -748,11 +748,6 @@ # added in the future. "//tools/perf/page_sets/maps_perf_test/", - # For depth_capture - "//content/test/data/media/depth_stream_test_utilities.js", - "//content/test/data/media/getusermedia-depth-capture.html", - "//content/test/data/media/webrtc_test_utilities.js", - # For GpuProcess.video "//content/test/data/media/bear.ogv", @@ -1336,7 +1331,6 @@ "../browser/webrtc/webrtc_content_browsertest_base.h", "../browser/webrtc/webrtc_data_browsertest.cc", "../browser/webrtc/webrtc_datachannel_browsertest.cc", - "../browser/webrtc/webrtc_depth_capture_browsertest.cc", "../browser/webrtc/webrtc_getusermedia_browsertest.cc", "../browser/webrtc/webrtc_image_capture_browsertest.cc", "../browser/webrtc/webrtc_internals_browsertest.cc",
diff --git a/content/test/data/direct_sockets/udp.html b/content/test/data/direct_sockets/udp.html index de16231..0ca0c372 100644 --- a/content/test/data/direct_sockets/udp.html +++ b/content/test/data/direct_sockets/udp.html
@@ -5,6 +5,30 @@ <script> 'use strict'; + async function sendLoop(writer, requiredBytes) { + let bytesWritten = 0; + let chunkLength = 0; + const encoder = new TextEncoder(); + + while (bytesWritten < requiredBytes) { + chunkLength = Math.min(chunkLength + 1, + requiredBytes - bytesWritten); + bytesWritten += chunkLength; + const view = encoder.encode('a'.repeat(chunkLength)); + await writer.write({ data: view.buffer }); + } + return 'send succeeded'; + } + + async function sendUdp(options, requiredBytes) { + try { + let udpSocket = await navigator.openUDPSocket(options); + return await sendLoop(udpSocket.writable.getWriter(), requiredBytes); + } catch(error) { + return ('sendUdp failed: ' + error); + } + } + async function closeUdp(options) { try { let udpSocket = await navigator.openUDPSocket(options); @@ -15,6 +39,16 @@ } } + async function sendUdpAfterClose(options, requiredBytes) { + try { + let udpSocket = await navigator.openUDPSocket(options); + await udpSocket.close(); + return await sendLoop(udpSocket.writable.getWriter(), requiredBytes); + } catch(error) { + return ('send failed: ' + error); + } + } + </script> </head> <body>
diff --git a/content/test/data/media/depth_stream_test_utilities.js b/content/test/data/media/depth_stream_test_utilities.js deleted file mode 100644 index 89298c9..0000000 --- a/content/test/data/media/depth_stream_test_utilities.js +++ /dev/null
@@ -1,76 +0,0 @@ -// Copyright 2016 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. - -function getConstraintsForDevice(deviceLabel) { - return new Promise(function(resolve, reject) { - navigator.mediaDevices.enumerateDevices() - .then(function(devices) { - for (var i = 0; i < devices.length; ++i) { - if (deviceLabel == devices[i].label) { - return resolve({video:{deviceId: {exact: devices[i].deviceId}, - width: {exact:96}, - height: {exact:96}} - }); - } - } - return reject("Expected to have a device with label:" + deviceLabel); - }) - }); -} - -function getFake16bitStream() { - return new Promise(function(resolve, reject) { - getConstraintsForDevice("fake_device_1") - .then(function(constraints) { - if (!constraints) - return reject("No fake device found"); - return navigator.mediaDevices.getUserMedia(constraints); - }).then(function(stream) { - return resolve(stream); - }); - }); -} - -function getStreamOfVideoKind(constraint_kind) { - var constraints = { - video:{ - videoKind: constraint_kind - } - } - return navigator.mediaDevices.getUserMedia(constraints); -} - -// Data is RGBA array data and could be used with different formats: -// e.g. Uint8Array, Uint8ClampedArray, Float32Array... -// Value at point (row, column) is calculated as -// (top_left_value + (row + column) * step) % wrap_around. wrap_around is 255 -// (for Uint8) or 1.0 for float. See FakeVideoCaptureDevice for details. -function verifyPixels( - data, width, height, flip_y, step, wrap_around, tolerance, test_name) { - var rowsColumnsToCheck = [[1, 1], - [0, width - 1], - [height - 1, 0], - [height - 1, width - 1], - [height - 3, width - 3]]; - - // Calculate all reference points based on top left and compare. - for (var j = 0; j < rowsColumnsToCheck.length; ++j) { - var row = rowsColumnsToCheck[j][0]; - var column = rowsColumnsToCheck[j][1]; - var i = (width * row + column) * 4; - var calculated = (data[0] + wrap_around + - step * ((flip_y ? -row : row) + column)) % wrap_around; - var diff = Math.abs(calculated - data[i]); - // We reconstruct the values based on top left value. When the reconstructed - // value is near |wrap_around|, read value, data[i], could be wrapped - // around, and vice versa - "diff > wrap_around - tolerance", in that case. - if (diff >= tolerance && diff <= wrap_around - tolerance) { - return Promise.reject(test_name + ": reference value " + data[i] + - " differs from calculated: " + calculated + " at index (row, column) " - + i + " (" + row + ", " + column + "). TopLeft value:" + data[0] + - ", step:" + step + ", flip_y:" + flip_y); - } - } - return true; -}
diff --git a/content/test/data/media/getusermedia-depth-capture.html b/content/test/data/media/getusermedia-depth-capture.html deleted file mode 100644 index f6c0a53b..0000000 --- a/content/test/data/media/getusermedia-depth-capture.html +++ /dev/null
@@ -1,444 +0,0 @@ -<html> -<head> - <script type="text/javascript" src="webrtc_test_utilities.js"></script> - <script type="text/javascript" src="depth_stream_test_utilities.js"></script> - <script type="text/javascript"> - - function cubemapFaces(gl) { - return [gl.TEXTURE_CUBE_MAP_POSITIVE_X, - gl.TEXTURE_CUBE_MAP_NEGATIVE_X, - gl.TEXTURE_CUBE_MAP_POSITIVE_Y, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Y, - gl.TEXTURE_CUBE_MAP_POSITIVE_Z, - gl.TEXTURE_CUBE_MAP_NEGATIVE_Z]; - } - - $ = function(id) { - return document.getElementById(id); - }; - - // testVideoToImageBitmap and the tests below are web tests that we - // run here because they require --use-fake-device-for-media-capture. - function getDepthStreamAndCallCreateImageBitmap() { - console.log('Calling getDepthStreamAndCallCreateImageBitmap'); - getFake16bitStream().then((stream) => { - detectVideoInLocalView1(stream).then(() => { - testVideoToImageBitmap('local-view-1', function() { - stream.getVideoTracks()[0].stop(); - detectVideoStopped('local-view-1') - .then(reportTestSuccess); - }, failedCallback); - }); - }, failedCallback); - } - - function getBothStreamsAndCheckForFeaturesPresence() { - console.log('Calling getBothStreamsAndCheckForFeaturesPresence'); - getConstraintsForDevice("fake_device_0") - .then(function(constraints) { - if (!constraints) - return failTest("No fake video device found."); - return navigator.mediaDevices.getUserMedia(constraints); - }).then(function(video_stream) { - getFake16bitStream().then(function(depth_stream) { - if (video_stream.getVideoTracks().length != 1) { - return failTest("Expected one video track, got " + - video_stream.getVideoTracks().length); - } - if (depth_stream.getVideoTracks().length != 1) { - return failTest("Expected one depth track, got " + - depth_stream.getVideoTracks().length); - } - var video_track = video_stream.getVideoTracks()[0]; - var depth_track = depth_stream.getVideoTracks()[0]; - - // We have specified the fields in getUserMedia constraints. Expect that - // both tracks have them in constraints and settings. - var expected_fields = ["deviceId", "height", "width"]; - for (var field in expected_fields) { - var expected_field = expected_fields[field]; - if (video_track.getSettings()[expected_field] === undefined) { - return failTest(expected_field + - " missing from video track getSettings()."); - } - if (video_track.getConstraints()[expected_field] === undefined) { - return failTest(expected_field + - " missing from video track getConstraints()."); - } - if (depth_track.getSettings()[expected_field] === undefined) { - return failTest(expected_field + - " missing from depth track getSettings()."); - } - if (depth_track.getConstraints()[expected_field] === undefined) { - return failTest(expected_field + - " missing from depth track getConstraints()."); - } - } - - reportTestSuccess(); - }, - failedCallback); - }, - failedCallback); - } - - function testGetStreamByVideoKindConstraint(constraint, kind) { - return new Promise(function(resolve, reject) { - getStreamOfVideoKind(constraint).then(function(stream) { - if (stream.getVideoTracks().length != 1) { - return reject("Expected one " + kind + " track, got " + - stream.getVideoTracks().length + - " when using constraint " + JSON.stringify(constraint)); - } - var track = stream.getVideoTracks()[0]; - if (track.getSettings().videoKind != kind) { - return reject("Expected " + kind + " track, got " + - track.getSettings().videoKind + - " when using constraint " + JSON.stringify(constraint)); - } - return resolve(); - }, - failedCallback); - }); - } - - function getStreamsByVideoKind() { - console.log('Calling getStreamsByVideoKind'); - var cases = [{constraint: {exact: "depth"}, kind: "depth"}, - {constraint: {exact: "color"}, kind: "color"}]; - var tests = []; - for (var i in cases) { - var test_case = cases[i]; - tests.push(testGetStreamByVideoKindConstraint(test_case.constraint, - test_case.kind)); - } - Promise.all(tests).then(reportTestSuccess, reason => { - failedCallback({name: reason}); - }); - } - - function getStreamsByVideoKindNoDepth() { - console.log('Calling getStreamsByVideoKindNoDepth'); - testGetStreamByVideoKindConstraint({exact: "color"}, "color") - .then(function() { - // Getting a depth stream should fail. - getStreamOfVideoKind({exact: "depth"}).then(function(stream) { - return failedCallback({name: "Expected to fail, got depth instead."}); - }, function() { - // Getting a random stream should fail. - getStreamOfVideoKind({exact: "fisheye"}).then(function(stream) { - return failedCallback( - {name: "Expected to fail, got fisheye instead."}); - }, reportTestSuccess); - }); - }, reason => { - failedCallback({name: reason}); - }); - } - - function depthStreamToRGBAUint8Texture() { - console.log('Calling depthStreamToRGBAUint8Texture'); - getFake16bitStream().then((stream) => { - detectVideoInLocalView1(stream).then(() => { - testVideoToRGBA8Texture('local-view-1', function() { - stream.getVideoTracks()[0].stop(); - detectVideoStopped('local-view-1') - .then(reportTestSuccess); - }, failedCallback); - }); - }, failedCallback); - } - - function depthStreamToRGBAFloatTexture() { - console.log('Calling depthStreamToRGBAFloatTexture'); - getFake16bitStream().then((stream) => { - detectVideoInLocalView1(stream).then(() => { - testVideoToRGBA32FTexture('local-view-1', function() { - stream.getVideoTracks()[0].stop(); - detectVideoStopped('local-view-1') - .then(reportTestSuccess); - }, failedCallback); - }); - }, failedCallback); - } - - function depthStreamToR32FloatTexture() { - console.log('Calling depthStreamToR32FloatTexture'); - getFake16bitStream().then((stream) => { - detectVideoInLocalView1(stream).then(() => { - testVideoToR32FTexture('local-view-1', function() { - stream.getVideoTracks()[0].stop(); - detectVideoStopped('local-view-1') - .then(reportTestSuccess); - }, failedCallback); - }); - }, failedCallback); - } - - function failedCallback(error) { - failTest('GetUserMedia call failed with error name ' + error.name); - } - - function attachMediaStream(stream, videoElement) { - $(videoElement).srcObject = stream; - } - - function detectVideoInLocalView1(stream) { - attachMediaStream(stream, 'local-view-1'); - return detectVideoPlaying('local-view-1'); - } - - function testVideoToImageBitmap(videoElementName, success, error) { - var bitmaps = {}; - var video = $(videoElementName); - var canvas = document.createElement('canvas'); - canvas.width = 96; - canvas.height = 96; - document.body.appendChild(canvas); - var p1 = createImageBitmap(video).then(function(imageBitmap) { - return runImageBitmapTest(imageBitmap, canvas, false); }); - var p2 = createImageBitmap(video, - {imageOrientation: "none", premultiplyAlpha: "premultiply"}).then( - function(imageBitmap) { - return runImageBitmapTest(imageBitmap, canvas, false); }); - var p3 = createImageBitmap(video, - {imageOrientation: "none", premultiplyAlpha: "default"}).then( - function(imageBitmap) { - return runImageBitmapTest(imageBitmap, canvas, false); }); - var p4 = createImageBitmap(video, - {imageOrientation: "none", premultiplyAlpha: "none"}).then( - function(imageBitmap) { - return runImageBitmapTest(imageBitmap, canvas, false); }); - var p5 = createImageBitmap(video, - {imageOrientation: "flipY", premultiplyAlpha: "premultiply"}).then( - function(imageBitmap) { - return runImageBitmapTest(imageBitmap, canvas, true); }); - var p6 = createImageBitmap(video, - {imageOrientation: "flipY", premultiplyAlpha: "default"}).then( - function(imageBitmap) { - return runImageBitmapTest(imageBitmap, canvas, true); }); - var p7 = createImageBitmap(video, - {imageOrientation: "flipY", premultiplyAlpha: "none"}).then( - function(imageBitmap) { - return runImageBitmapTest(imageBitmap, canvas, true); }); - return Promise.all([p1, p2, p3, p4, p5, p6, p7]).then(success(), reason => { - return error({name: reason}); - }); - } - - function runImageBitmapTest(bitmap, canvas, flip_y) { - var context = canvas.getContext('2d'); - context.drawImage(bitmap, 0, 0); - var imageData = context.getImageData(0, 0, canvas.width, canvas.height); - // Fake capture device 96x96 depth image is gradient. See also - // Draw16BitGradient in fake_video_capture_device.cc. - var color_step = 255.0 / (canvas.width + canvas.height); - return verifyPixels(imageData.data, canvas.width, canvas.height, flip_y, - color_step, 255, 2, "ImageBitmap"); - } - - function testVideoToRGBA32FTexture(videoElementName, success, error) { - var video = $(videoElementName); - var canvas = document.createElement('canvas'); - canvas.width = 96; - canvas.height = 96; - var gl = canvas.getContext('webgl'); - if (!gl) - return error({name:"WebGL is not available."}); - if (!gl.getExtension("OES_texture_float")) - return error({name:"OES_texture_float extension is not available."}); - return testVideoToTexture(gl, video, gl.RGBA, gl.RGBA, gl.FLOAT, - readAndVerifyRGBA32F, success, error); - } - - function testVideoToRGBA8Texture(videoElementName, success, error) { - var video = $(videoElementName); - var canvas = document.createElement('canvas'); - canvas.width = 96; - canvas.height = 96; - var gl = canvas.getContext('webgl'); - if (!gl) - return error({name:"WebGL is not available."}); - return testVideoToTexture(gl, video, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, - readAndVerifyRGBA8, success, error); - } - - function testVideoToR32FTexture(videoElementName, success, error) { - var video = $(videoElementName); - var canvas = document.createElement('canvas'); - canvas.width = 96; - canvas.height = 96; - var gl = canvas.getContext('webgl2'); - if (!gl) - return error({name:"WebGL2 is not available."}); - if (!gl.getExtension('EXT_color_buffer_float')) - return error({name:"EXT_color_buffer_float extension is not available."}); - return testVideoToTexture(gl, video, gl.R32F, gl.RED, gl.FLOAT, - readAndVerifyR32F, success, error); - } - - function testVideoToTexture(gl, video, internalformat, format, type, - readAndVerifyFunction, success, error) { - // Create framebuffer that we will use for reading back the texture. - var fb = gl.createFramebuffer(); - gl.bindFramebuffer(gl.FRAMEBUFFER, fb); - var tests = []; - // Premultiply alpha is ignored but we just test both values. - var cases = [ - {flip_y: false, premultiply_alpha: true}, - {flip_y: true, premultiply_alpha: false} - ]; - for (var i in cases) { - var flip_y = cases[i].flip_y; - var premultiply = cases[i].premultiply_alpha; - uploadVideoToTexture2D(gl, video, internalformat, format, type, flip_y, - premultiply); - tests.push(readAndVerifyFunction(gl, video.width, video.height, flip_y, - "TexImage_TEXTURE_2D")); - uploadVideoToSubTexture2D(gl, video, internalformat, format, type, flip_y, - premultiply); - tests.push(readAndVerifyFunction(gl, video.width, video.height, flip_y, - "TexSubImage_TEXTURE_2D")); - - // cubemap texImage2D. - var tex = uploadVideoToTextureCubemap(gl, video, internalformat, format, - type, flip_y, premultiply); - for (var i = 0; i < cubemapFaces(gl).length; ++i) { - // Attach the texture to framebuffer for readback. - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, - cubemapFaces(gl)[i], tex, 0); - tests.push(readAndVerifyFunction(gl, video.width, video.height, - flip_y, - "TexImage_" + cubemapFaces(gl)[i])); - } - - // cubemap texSubImage2D. - tex = uploadVideoToSubTextureCubemap(gl, video, internalformat, format, - type, flip_y, premultiply); - for (var i = 0; i < cubemapFaces(gl).length; ++i) { - // Attach the texture to framebuffer for readback. - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, - cubemapFaces(gl)[i], tex, 0); - tests.push(readAndVerifyFunction(gl, video.width, video.height, - flip_y, - "TexSubImage_" + cubemapFaces(gl)[i])); - } - } - return Promise.all(tests).then(success(), reason => { - return error({name: reason}); - }); - } - - // Test setup helper method: create the texture and set texture parameters. - // For cubemap, target is gl.TEXTURE_CUBE_MAP. For gl.TEXTURE_2D, it is - // gl.TEXTURE_2D. - function createTexture(gl, target, video, flip_y, premultiply_alpha) { - var tex = gl.createTexture(); - gl.bindTexture(target, tex); - gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); - gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); - gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, gl.LINEAR); - gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, gl.LINEAR); - gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flip_y); - gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, premultiply_alpha); - return tex; - } - - function uploadVideoToTexture2D(gl, video, internalformat, format, type, - flip_y, premultiply_alpha) { - var tex = createTexture(gl, gl.TEXTURE_2D, video, flip_y, - premultiply_alpha); - // Attach the texture to framebuffer for readback. - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, - tex, 0); - gl.texImage2D(gl.TEXTURE_2D, 0, internalformat, format, type, video); - return tex; - } - - function uploadVideoToSubTexture2D(gl, video, internalformat, format, type, - flip_y, premultiply_alpha) { - var tex = createTexture(gl, gl.TEXTURE_2D, video, flip_y, - premultiply_alpha); - // Attach the texture to framebuffer for readback. - gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, - tex, 0); - gl.texImage2D(gl.TEXTURE_2D, 0, internalformat, video.width, video.height, - 0, format, type, null); - gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, format, type, video); - return tex; - } - - function uploadVideoToTextureCubemap(gl, video, internalformat, format, type, - flip_y, premultiply_alpha) { - var tex = createTexture(gl, gl.TEXTURE_CUBE_MAP, video, flip_y, - premultiply_alpha); - for (var i = 0; i < cubemapFaces(gl).length; ++i) { - gl.texImage2D(cubemapFaces(gl)[i], 0, internalformat, format, type, - video); - } - return tex; - } - - function uploadVideoToSubTextureCubemap(gl, video, internalformat, format, - type, flip_y, premultiply_alpha) { - var tex = createTexture(gl, gl.TEXTURE_CUBE_MAP, video, flip_y, - premultiply_alpha); - for (var i = 0; i < cubemapFaces(gl).length; ++i) { - gl.texImage2D(cubemapFaces(gl)[i], 0, internalformat, video.width, - video.height, 0, format, type, null); - gl.texSubImage2D(cubemapFaces(gl)[i], 0, 0, 0, format, type, video); - } - return tex; - } - - function readAndVerifyRGBA8(gl, width, height, flip_y, test_name) { - var arr = new Uint8Array(width * height * 4); - gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, arr); - var color_step = 255.0 / (width + height); - return verifyPixels(arr, width, height, flip_y, color_step, - 255 /*wrap_around*/, 2 /*tolerance*/, test_name); - } - - function readAndVerifyRGBA32F(gl, width, height, flip_y, test_name) { - var arr = new Float32Array(width * height * 4); - gl.readPixels(0, 0, width, height, gl.RGBA, gl.FLOAT, arr); - var color_step = 1.0 / (width + height); - return verifyPixels(arr, width, height, flip_y, color_step, - 1.0 /*wrap_around*/, 1.5/65535 /*tolerance*/, - test_name); - } - - function readAndVerifyR32F(gl, width, height, flip_y, test_name) { - var arr = new Float32Array(width * height * 4); - gl.readPixels(0, 0, width, height, gl.RGBA, gl.FLOAT, arr); - var color_step = 1.0 / (width + height); - return verifyPixels(arr, width, height, flip_y, color_step, - 1.0 /*wrap_around*/, 1.5 / 65535 /*tolerance*/, - test_name); - } - - function onLoad() { - var query = /query=(.*)/.exec(window.location.href); - if (!query) - return; - if (query[1] == "RGBAUint8") - depthStreamToRGBAUint8Texture(); - else if (query[1] == "RGBAFloat") - depthStreamToRGBAFloatTexture(); - else if (query[1] == "R32Float") - depthStreamToR32FloatTexture(); - } - </script> -</head> -<body onload="onLoad()"> - <table border="0"> - <tr> - <td><video id="local-view-1" width="96" height="96" autoplay - style="display:none"></video></td> - <!-- The canvas is used to detect when video starts and stops. --> - <td><canvas id="local-view-1-canvas" width="96" height="96" - style="display:none"></canvas></td> - </tr> - </table> -</body> -</html>
diff --git a/content/test/gpu/gpu_tests/depth_capture_integration_test.py b/content/test/gpu/gpu_tests/depth_capture_integration_test.py deleted file mode 100644 index df969c9..0000000 --- a/content/test/gpu/gpu_tests/depth_capture_integration_test.py +++ /dev/null
@@ -1,100 +0,0 @@ -# Copyright 2016 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. - -from __future__ import print_function - -import os -import sys - -from gpu_tests import common_browser_args as cba -from gpu_tests import gpu_integration_test -from gpu_tests import path_util - -data_path = os.path.join(path_util.GetChromiumSrcDir(), 'content', 'test', - 'data', 'media') - -wait_timeout = 60 # seconds - -harness_script = r""" - var domAutomationController = {}; - - domAutomationController._succeeded = false; - domAutomationController._finished = false; - domAutomationController._error_msg = ""; - - domAutomationController.send = function(msg) { - if (msg == "OK") { - if (!domAutomationController._finished) { - domAutomationController._succeeded = true; - } - domAutomationController._finished = true; - } else { - domAutomationController._succeeded = false; - domAutomationController._finished = true; - domAutomationController._error_msg = msg; - } - } - - domAutomationController.reset = function() { - domAutomationController._succeeded = false; - domAutomationController._finished = false; - } - - window.domAutomationController = domAutomationController; - console.log("Harness injected."); -""" - - -class DepthCaptureIntegrationTest(gpu_integration_test.GpuIntegrationTest): - @classmethod - def Name(cls): - return 'depth_capture' - - @classmethod - def GenerateGpuTests(cls, options): - tests = (('DepthCapture_depthStreamToRGBAUint8Texture', - 'getusermedia-depth-capture.html?query=RGBAUint8'), - ('DepthCapture_depthStreamToRGBAFloatTexture', - 'getusermedia-depth-capture.html?query=RGBAFloat'), - ('DepthCapture_depthStreamToR32FloatTexture', - 'getusermedia-depth-capture.html?query=R32Float')) - for t in tests: - yield (t[0], t[1], ('_' + t[0])) - - def RunActualGpuTest(self, test_path, *args): - url = self.UrlOfStaticFilePath(test_path) - tab = self.tab - tab.Navigate(url, script_to_evaluate_on_commit=harness_script) - tab.action_runner.WaitForJavaScriptCondition( - 'domAutomationController._finished', timeout=60) - if not tab.EvaluateJavaScript('domAutomationController._succeeded'): - self.fail('page indicated test failure:' + - tab.EvaluateJavaScript('domAutomationController._error_msg')) - - @classmethod - def SetUpProcess(cls): - super(DepthCaptureIntegrationTest, cls).SetUpProcess() - cls.CustomizeBrowserArgs([ - cba.DISABLE_DOMAIN_BLOCKING_FOR_3D_APIS, - '--enable-es3-apis', - '--use-fake-ui-for-media-stream', - '--use-fake-device-for-media-stream=device-count=2', - # Required for about:gpucrash handling from Telemetry. - cba.ENABLE_GPU_BENCHMARKING, - ]) - cls.StartBrowser() - cls.SetStaticServerDirs([data_path]) - - @classmethod - def ExpectationsFiles(cls): - return [ - os.path.join( - os.path.dirname(os.path.abspath(__file__)), 'test_expectations', - 'depth_capture_expectations.txt') - ] - - -def load_tests(loader, tests, pattern): - del loader, tests, pattern # Unused. - return gpu_integration_test.LoadAllTestsInModule(sys.modules[__name__])
diff --git a/content/test/gpu/gpu_tests/test_expectations/depth_capture_expectations.txt b/content/test/gpu/gpu_tests/test_expectations/depth_capture_expectations.txt deleted file mode 100644 index 9c706b9..0000000 --- a/content/test/gpu/gpu_tests/test_expectations/depth_capture_expectations.txt +++ /dev/null
@@ -1,92 +0,0 @@ -# BEGIN TAG HEADER (autogenerated, see validate_tag_consistency.py) -# OS -# tags: [ android android-lollipop android-marshmallow android-nougat -# android-pie android-r android-s -# chromeos -# fuchsia -# linux ubuntu -# mac bigsur catalina lion highsierra mac-10.12 mojave monterey -# mountainlion sierra -# win win7 win8 win10 ] -# Devices -# tags: [ android-nexus-5 android-nexus-5x android-nexus-9 android-pixel-2 -# android-pixel-4 android-pixel-6 android-shield-android-tv -# chromeos-board-amd64-generic chromeos-board-kevin chromeos-board-eve -# fuchsia-board-astro fuchsia-board-sherlock fuchsia-board-qemu-x64 ] -# Platform -# tags: [ desktop -# mobile ] -# Browser -# tags: [ android-chromium android-webview-instrumentation -# debug debug-x64 -# release release-x64 ] -# GPU -# tags: [ amd amd-0x6613 amd-0x679e amd-0x6821 amd-0x7340 -# apple apple-apple-m1 apple-angle-metal-renderer:-apple-m1 -# arm -# google google-0xffff -# intel intel-0xa2e intel-0xd26 intel-0xa011 intel-0x3e92 intel-0x3e9b -# intel-0x5912 -# nvidia nvidia-0xfe9 nvidia-0x1cb3 nvidia-0x2184 -# qualcomm ] -# Decoder -# tags: [ passthrough no-passthrough ] -# ANGLE Backend -# tags: [ angle-disabled -# angle-d3d9 angle-d3d11 -# angle-metal -# angle-opengl angle-opengles -# angle-swiftshader -# angle-vulkan ] -# Skia Renderer -# tags: [ skia-renderer-dawn -# skia-renderer-disabled -# skia-renderer-gl -# skia-renderer-vulkan ] -# SwiftShader -# tags: [ swiftshader-gl no-swiftshader-gl ] -# Driver -# tags: [ intel_lt_25.20.100.6444 intel_lt_25.20.100.6577 -# intel_lt_26.20.100.7000 intel_lt_26.20.100.7870 -# intel_lt_26.20.100.7323 intel_lt_26.20.100.8141 -# intel_lt_27.20.100.8280 -# mesa_lt_19.1 mesa_ge_20.1 ] -# ASan -# tags: [ asan no-asan ] -# Display Server -# tags: [ display-server-wayland display-server-x ] -# OOP-Canvas -# tags: [ oop-c no-oop-c ] -# results: [ Failure RetryOnFailure Skip ] -# END TAG HEADER - -############################### -# Permanent Skip Expectations # -############################### -# The "Skip" expectations in this section are expected to never be removed. -# This is for things like tests that will never be supported on a particular -# platform/configuration. - -############################### -# Temporary Skip Expectations # -############################### -# The "Skip" expectations in this section are expected to be removable at some -# point. This is for things like tests that fail in a way that negatively and -# significantly impacts other tests, e.g. killing the test device. - -################### -# Failures/Flakes # -################### -# Non-"Skip" expectations go here to suppress regular flakes/failures. - -crbug.com/765913 [ android android-nexus-5 ] DepthCapture_depthStreamToR32FloatTexture [ Failure ] - -crbug.com/1080375 [ chromeos chromeos-board-kevin ] DepthCapture_depthStreamToRGBAFloatTexture [ Failure ] -crbug.com/1159394 [ chromeos chromeos-board-kevin ] DepthCapture_depthStreamToR32FloatTexture [ Failure ] -crbug.com/1159394 [ chromeos chromeos-board-kevin ] DepthCapture_depthStreamToRGBAUint8Texture [ Failure ] - -crbug.com/1286830 [ android android-pixel-6 ] DepthCapture_depthStreamToRGBAFloatTexture [ Failure ] - -####################################################################### -# Automated Entries After This Point - Do Not Manually Add Below Here # -#######################################################################
diff --git a/content/test/gpu/unexpected_pass_finder.py b/content/test/gpu/unexpected_pass_finder.py index ea3b566..fa72879 100755 --- a/content/test/gpu/unexpected_pass_finder.py +++ b/content/test/gpu/unexpected_pass_finder.py
@@ -86,7 +86,6 @@ # distinguish WebGL 1 from WebGL 2. choices=[ 'context_lost', - 'depth_capture', 'hardware_accelerated_feature', 'gpu_process', 'info_collection',
diff --git a/content/test/gpu/unexpected_passes/gpu_queries_unittest.py b/content/test/gpu/unexpected_passes/gpu_queries_unittest.py index 87e6488..95a646f 100755 --- a/content/test/gpu/unexpected_passes/gpu_queries_unittest.py +++ b/content/test/gpu/unexpected_passes/gpu_queries_unittest.py
@@ -604,7 +604,6 @@ """Tests that no filter is returned for non-WebGL suites.""" for suite in [ 'context_lost', - 'depth_capture', 'hardware_accelerated_feature', 'gpu_process', 'info_collection',
diff --git a/courgette/BUILD.gn b/courgette/BUILD.gn index a234bd2f..6b15c39 100644 --- a/courgette/BUILD.gn +++ b/courgette/BUILD.gn
@@ -232,7 +232,8 @@ data = [ "testdata/" ] if (is_fuchsia) { - use_cfv2 = true + # TODO(crbug.com/1256502): Switch back to CFv2 once the bug is fixed. + use_cfv2 = false } }
diff --git a/docs/clang_static_analyzer.md b/docs/clang_static_analyzer.md index 988fdc7..084c73e 100644 --- a/docs/clang_static_analyzer.md +++ b/docs/clang_static_analyzer.md
@@ -31,6 +31,17 @@ [cplusplus](https://clang-analyzer.llvm.org/available_checks.html#cplusplus_checkers), and [deadcode](https://clang-analyzer.llvm.org/available_checks.html#deadcode_checkers). +To easily run these checks against Chromium code via clang-tidy, follow +[these](clang_tidy.md#evaluating_running-clang_tidy-across-chromium) +instructions to pull down `tricium_clang_tidy.py` and then pass the following +argument when invoking the script (`-*` disables all checks and then the +remaining check name globs enable each category of checks): +``` +--tidy_checks="-*,clang-analyzer-core*,clang-analyzer-cplusplus*,clang-analyzer-unix*,clang-analyzer-deadcode*" +``` +A full list of Clang analyzer checks can be found in the +[Clang-Tidy Checks List](https://clang.llvm.org/extra/clang-tidy/checks/list.html). + ## Addressing false positives Some of the errors you encounter will be false positives, which occurs when the
diff --git a/docs/clang_tidy.md b/docs/clang_tidy.md index 604bb96a..ccc55cf6 100644 --- a/docs/clang_tidy.md +++ b/docs/clang_tidy.md
@@ -83,6 +83,9 @@ --all ``` +To only run clang-tidy against certain files, replace the `--all` parameter with +the individual file paths. + All clang-tidy checks are run on Linux builds of Chromium, so please set up your `args.gn` to build Linux.
diff --git a/docs/gpu/gpu_testing.md b/docs/gpu/gpu_testing.md index 66ccad4..23cd0eb2 100644 --- a/docs/gpu/gpu_testing.md +++ b/docs/gpu/gpu_testing.md
@@ -258,9 +258,6 @@ * `context_lost_tests` * `context_lost_validating_tests` * `gl_renderer_context_lost_tests` -* `depth_capture` - * `depth_capture_tests` - * `gl_renderer_depth_capture_tests` * `hardware_accelerated_feature` * `gl_renderer_hardware_accelerated_feature_tests` * `hardware_accelerated_feature_tests`
diff --git a/docs/security/web-mitigation-metrics.md b/docs/security/web-mitigation-metrics.md index 4ebe5b5f..cabfde43 100644 --- a/docs/security/web-mitigation-metrics.md +++ b/docs/security/web-mitigation-metrics.md
@@ -190,3 +190,15 @@ `kSanitizerAPIFromFragment` tell us what kind of input people are using. [sanitizer]: https://wicg.github.io/sanitizer-api/ + +## Private Network Access + +[Private Network Access][pna] helps to prevent the user agent from +inadvertently enabling attacks on devices running on a user's local intranet, +or services running on the user's machine directly. + +* Use of PNA in workers tracked via: + - `kPrivateNetworkAccessFetchesWorkerScript` + - `kPrivateNetworkAccessWithWorker` + +[pna]: https://wicg.github.io/private-network-access/
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index dae81e04..d276a1fb 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1681,6 +1681,7 @@ DEVELOPERPRIVATE_REMOVEUSERSPECIFIEDSITE = 1618, AUTOTESTPRIVATE_STARTARC = 1619, AUTOTESTPRIVATE_STOPARC = 1620, + PASSWORDSPRIVATE_MUTEINSECURECREDENTIAL = 1621, // Last entry: Add new entries above, then run: // python tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 11dead3..4728e57 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc
@@ -859,7 +859,11 @@ {"keep_alive", IDR_KEEP_ALIVE_JS}, {"mojo_bindings", IDR_MOJO_MOJO_BINDINGS_JS}, + +#if BUILDFLAG(IS_CHROMEOS_ASH) {"mojo_bindings_lite", IDR_MOJO_MOJO_BINDINGS_LITE_JS}, +#endif + {"extensions/common/mojom/keep_alive.mojom", IDR_KEEP_ALIVE_MOJOM_JS}, // Custom bindings.
diff --git a/headless/BUILD.gn b/headless/BUILD.gn index 60f85e0..38279a7c 100644 --- a/headless/BUILD.gn +++ b/headless/BUILD.gn
@@ -785,7 +785,8 @@ configs += [ ":headless_defines_config" ] if (is_fuchsia) { - use_cfv2 = true + # TODO(crbug.com/1256502): Switch back to CFv2 once the bug is fixed. + use_cfv2 = false } }
diff --git a/ios/chrome/browser/infobars/infobar_metrics_recorder.mm b/ios/chrome/browser/infobars/infobar_metrics_recorder.mm index a8fd0a4..477d88c 100644 --- a/ios/chrome/browser/infobars/infobar_metrics_recorder.mm +++ b/ios/chrome/browser/infobars/infobar_metrics_recorder.mm
@@ -105,6 +105,19 @@ const char kInfobarReadingListBadgeTappedHistogram[] = "Mobile.Messages.Badge.Tapped.InfobarTypeReadingList"; +// Histogram names for InfobarTypePermissions. +// Banner. +const char kInfobarPermissionsBannerEventHistogram[] = + "Mobile.Messages.Banner.Event.InfobarTypePermissions"; +const char kInfobarPermissionsBannerDismissTypeHistogram[] = + "Mobile.Messages.Banner.Dismiss.InfobarTypePermissions"; +// Modal. +const char kInfobarPermissionsModalEventHistogram[] = + "Mobile.Messages.Modal.Event.InfobarTypePermissions"; +// Badge. +const char kInfobarPermissionsBadgeTappedHistogram[] = + "Mobile.Messages.Badge.Tapped.InfobarTypeReadingList"; + } // namespace @interface InfobarMetricsRecorder () @@ -157,6 +170,10 @@ base::UmaHistogramEnumeration(kInfobarReadingListBannerEventHistogram, event); break; + case InfobarType::kInfobarTypePermissions: + base::UmaHistogramEnumeration(kInfobarPermissionsBannerEventHistogram, + event); + break; } } @@ -190,6 +207,10 @@ base::UmaHistogramEnumeration( kInfobarReadingListBannerDismissTypeHistogram, dismissType); break; + case InfobarType::kInfobarTypePermissions: + base::UmaHistogramEnumeration( + kInfobarPermissionsBannerDismissTypeHistogram, dismissType); + break; } } @@ -224,6 +245,10 @@ base::UmaHistogramEnumeration(kInfobarReadingListModalEventHistogram, event); break; + case InfobarType::kInfobarTypePermissions: + base::UmaHistogramEnumeration(kInfobarPermissionsModalEventHistogram, + event); + break; } } @@ -254,6 +279,10 @@ base::UmaHistogramEnumeration(kInfobarReadingListBadgeTappedHistogram, state); break; + case InfobarType::kInfobarTypePermissions: + base::UmaHistogramEnumeration(kInfobarPermissionsBadgeTappedHistogram, + state); + break; } }
diff --git a/ios/chrome/browser/infobars/infobar_type.h b/ios/chrome/browser/infobars/infobar_type.h index 9352e05..d49fc14 100644 --- a/ios/chrome/browser/infobars/infobar_type.h +++ b/ios/chrome/browser/infobars/infobar_type.h
@@ -22,6 +22,8 @@ kInfobarTypeSaveAutofillAddressProfile = 5, // Message Infobar for Adding to Reading List. kInfobarTypeAddToReadingList = 6, + // Message Infobar for media permissions. + kInfobarTypePermissions = 7, }; // Message "Confirm Infobars" types, these are the generic kInfobarTypeConfirm
diff --git a/ios/chrome/browser/infobars/overlays/default_infobar_overlay_request_factory.mm b/ios/chrome/browser/infobars/overlays/default_infobar_overlay_request_factory.mm index 107cb9af..bf6a073e 100644 --- a/ios/chrome/browser/infobars/overlays/default_infobar_overlay_request_factory.mm +++ b/ios/chrome/browser/infobars/overlays/default_infobar_overlay_request_factory.mm
@@ -10,6 +10,7 @@ #import "ios/chrome/browser/infobars/infobar_type.h" #import "ios/chrome/browser/overlays/public/infobar_banner/add_to_reading_list_infobar_banner_overlay_request_config.h" #import "ios/chrome/browser/overlays/public/infobar_banner/confirm_infobar_banner_overlay_request_config.h" +#import "ios/chrome/browser/overlays/public/infobar_banner/permissions_infobar_banner_overlay_request_config.h" #import "ios/chrome/browser/overlays/public/infobar_banner/save_address_profile_infobar_banner_overlay_request_config.h" #import "ios/chrome/browser/overlays/public/infobar_banner/save_card_infobar_banner_overlay_request_config.h" #import "ios/chrome/browser/overlays/public/infobar_banner/save_password_infobar_banner_overlay.h" @@ -134,7 +135,14 @@ default: return nullptr; } - + case InfobarType::kInfobarTypePermissions: + switch (overlay_type) { + case InfobarOverlayType::kBanner: + return OverlayRequest::CreateWithConfig< + PermissionsBannerRequestConfig>(infobar_ios); + default: + return nullptr; + } default: return nullptr; }
diff --git a/ios/chrome/browser/main/browser.h b/ios/chrome/browser/main/browser.h index 77d399c3..27e8a16 100644 --- a/ios/chrome/browser/main/browser.h +++ b/ios/chrome/browser/main/browser.h
@@ -30,13 +30,13 @@ ~Browser() override {} // Accessor for the owning ChromeBrowserState. - virtual ChromeBrowserState* GetBrowserState() const = 0; + virtual ChromeBrowserState* GetBrowserState() = 0; // Accessor for the WebStateList. - virtual WebStateList* GetWebStateList() const = 0; + virtual WebStateList* GetWebStateList() = 0; // Accessor for the CommandDispatcher. - virtual CommandDispatcher* GetCommandDispatcher() const = 0; + virtual CommandDispatcher* GetCommandDispatcher() = 0; // Adds and removes observers. virtual void AddObserver(BrowserObserver* observer) = 0;
diff --git a/ios/chrome/browser/main/browser_impl.h b/ios/chrome/browser/main/browser_impl.h index 5269517..ad6c36d 100644 --- a/ios/chrome/browser/main/browser_impl.h +++ b/ios/chrome/browser/main/browser_impl.h
@@ -32,9 +32,9 @@ ~BrowserImpl() override; // Browser. - ChromeBrowserState* GetBrowserState() const override; - WebStateList* GetWebStateList() const override; - CommandDispatcher* GetCommandDispatcher() const override; + ChromeBrowserState* GetBrowserState() override; + WebStateList* GetWebStateList() override; + CommandDispatcher* GetCommandDispatcher() override; void AddObserver(BrowserObserver* observer) override; void RemoveObserver(BrowserObserver* observer) override;
diff --git a/ios/chrome/browser/main/browser_impl.mm b/ios/chrome/browser/main/browser_impl.mm index 246785ee7..9f1a5c16 100644 --- a/ios/chrome/browser/main/browser_impl.mm +++ b/ios/chrome/browser/main/browser_impl.mm
@@ -42,15 +42,15 @@ } } -ChromeBrowserState* BrowserImpl::GetBrowserState() const { +ChromeBrowserState* BrowserImpl::GetBrowserState() { return browser_state_; } -WebStateList* BrowserImpl::GetWebStateList() const { +WebStateList* BrowserImpl::GetWebStateList() { return web_state_list_.get(); } -CommandDispatcher* BrowserImpl::GetCommandDispatcher() const { +CommandDispatcher* BrowserImpl::GetCommandDispatcher() { return command_dispatcher_; }
diff --git a/ios/chrome/browser/main/test_browser.h b/ios/chrome/browser/main/test_browser.h index e4dcbc78..d5d72fa 100644 --- a/ios/chrome/browser/main/test_browser.h +++ b/ios/chrome/browser/main/test_browser.h
@@ -33,9 +33,9 @@ ~TestBrowser() override; // Browser. - ChromeBrowserState* GetBrowserState() const override; - WebStateList* GetWebStateList() const override; - CommandDispatcher* GetCommandDispatcher() const override; + ChromeBrowserState* GetBrowserState() override; + WebStateList* GetWebStateList() override; + CommandDispatcher* GetCommandDispatcher() override; void AddObserver(BrowserObserver* observer) override; void RemoveObserver(BrowserObserver* observer) override;
diff --git a/ios/chrome/browser/main/test_browser.mm b/ios/chrome/browser/main/test_browser.mm index 9affd01..43dbc4d 100644 --- a/ios/chrome/browser/main/test_browser.mm +++ b/ios/chrome/browser/main/test_browser.mm
@@ -49,15 +49,15 @@ #pragma mark - Browser -ChromeBrowserState* TestBrowser::GetBrowserState() const { +ChromeBrowserState* TestBrowser::GetBrowserState() { return browser_state_; } -WebStateList* TestBrowser::GetWebStateList() const { +WebStateList* TestBrowser::GetWebStateList() { return web_state_list_; } -CommandDispatcher* TestBrowser::GetCommandDispatcher() const { +CommandDispatcher* TestBrowser::GetCommandDispatcher() { return command_dispatcher_; }
diff --git a/ios/chrome/browser/optimization_guide/tab_url_provider_impl.mm b/ios/chrome/browser/optimization_guide/tab_url_provider_impl.mm index ce4948b..1985758 100644 --- a/ios/chrome/browser/optimization_guide/tab_url_provider_impl.mm +++ b/ios/chrome/browser/optimization_guide/tab_url_provider_impl.mm
@@ -34,7 +34,7 @@ // Get all URLs from regular tabs. std::map<base::Time, GURL> urls; - for (const auto* browser : browser_list_->AllRegularBrowsers()) { + for (Browser* browser : browser_list_->AllRegularBrowsers()) { WebStateList* web_state_list = browser->GetWebStateList(); DCHECK(web_state_list); for (int i = 0; i < web_state_list->count(); ++i) {
diff --git a/ios/chrome/browser/overlays/public/infobar_banner/BUILD.gn b/ios/chrome/browser/overlays/public/infobar_banner/BUILD.gn index 4ebe6d52..79b2c0e 100644 --- a/ios/chrome/browser/overlays/public/infobar_banner/BUILD.gn +++ b/ios/chrome/browser/overlays/public/infobar_banner/BUILD.gn
@@ -12,6 +12,8 @@ "infobar_banner_overlay_responses.h", "infobar_banner_placeholder_request_config.h", "infobar_banner_placeholder_request_config.mm", + "permissions_infobar_banner_overlay_request_config.h", + "permissions_infobar_banner_overlay_request_config.mm", "save_address_profile_infobar_banner_overlay_request_config.h", "save_address_profile_infobar_banner_overlay_request_config.mm", "save_card_infobar_banner_overlay_request_config.h",
diff --git a/ios/chrome/browser/overlays/public/infobar_banner/permissions_infobar_banner_overlay_request_config.h b/ios/chrome/browser/overlays/public/infobar_banner/permissions_infobar_banner_overlay_request_config.h new file mode 100644 index 0000000..fe43873 --- /dev/null +++ b/ios/chrome/browser/overlays/public/infobar_banner/permissions_infobar_banner_overlay_request_config.h
@@ -0,0 +1,47 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_OVERLAYS_PUBLIC_INFOBAR_BANNER_PERMISSIONS_INFOBAR_BANNER_OVERLAY_REQUEST_CONFIG_H_ +#define IOS_CHROME_BROWSER_OVERLAYS_PUBLIC_INFOBAR_BANNER_PERMISSIONS_INFOBAR_BANNER_OVERLAY_REQUEST_CONFIG_H_ + +#include <CoreFoundation/CoreFoundation.h> + +#include "ios/chrome/browser/overlays/public/overlay_request_config.h" +#include "ios/chrome/browser/overlays/public/overlay_user_data.h" + +namespace infobars { +class InfoBar; +} + +// Configuration object for OverlayRequests for the banner UI for an Infobar. +class PermissionsBannerRequestConfig + : public OverlayRequestConfig<PermissionsBannerRequestConfig> { + public: + ~PermissionsBannerRequestConfig() override; + + // The title text. + NSString* title_text() const { return title_text_; } + + // The button text. + NSString* button_text() const { return button_text_; } + + // The name of the banner's icon image. + NSString* icon_image_name() const { return icon_image_name_; } + + private: + OVERLAY_USER_DATA_SETUP(PermissionsBannerRequestConfig); + explicit PermissionsBannerRequestConfig(infobars::InfoBar* infobar); + + // OverlayUserData: + void CreateAuxiliaryData(base::SupportsUserData* user_data) override; + + NSString* title_text_; + NSString* button_text_; + NSString* icon_image_name_ = nil; + + // The InfoBar causing this banner. + infobars::InfoBar* infobar_ = nullptr; +}; + +#endif // IOS_CHROME_BROWSER_OVERLAYS_PUBLIC_INFOBAR_BANNER_PERMISSIONS_INFOBAR_BANNER_OVERLAY_REQUEST_CONFIG_H_
diff --git a/ios/chrome/browser/overlays/public/infobar_banner/permissions_infobar_banner_overlay_request_config.mm b/ios/chrome/browser/overlays/public/infobar_banner/permissions_infobar_banner_overlay_request_config.mm new file mode 100644 index 0000000..b6d29d6 --- /dev/null +++ b/ios/chrome/browser/overlays/public/infobar_banner/permissions_infobar_banner_overlay_request_config.mm
@@ -0,0 +1,55 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/overlays/public/infobar_banner/permissions_infobar_banner_overlay_request_config.h" + +#include "base/strings/sys_string_conversions.h" +#include "components/infobars/core/infobar.h" +#include "ios/chrome/browser/infobars/infobar_ios.h" +#import "ios/chrome/browser/infobars/overlays/infobar_overlay_type.h" +#import "ios/chrome/browser/overlays/public/common/infobars/infobar_overlay_request_config.h" +#import "ios/chrome/browser/ui/reading_list/ios_add_to_reading_list_infobar_delegate.h" +#include "ios/chrome/grit/ios_strings.h" +#include "ui/base/l10n/l10n_util.h" +#include "url/gurl.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +using infobars::InfoBar; + +// TODO(crbug.com/1289645): Use appropriate images. +namespace { + +// Name of the camera icon image for the permissions banner. +NSString* const kCameraIconImageName = @"infobar_reading_list"; +// Name of the microphone icon image for the permissions banner. +NSString* const kMicrophoneIconImageName = @"infobar_reading_list"; + +} // namespace + +OVERLAY_USER_DATA_SETUP_IMPL(PermissionsBannerRequestConfig); + +PermissionsBannerRequestConfig::PermissionsBannerRequestConfig(InfoBar* infobar) + : infobar_(infobar) { + DCHECK(infobar_); + // TODO(crbug.com/1289645): Retrieve permissions from a delegate. + + // TODO(crbug.com/1289645): Use appropriate images. + icon_image_name_ = kCameraIconImageName; + + title_text_ = @"Placeholder"; + + button_text_ = l10n_util::GetNSString(IDS_IOS_EDIT_ACTION_TITLE); +} + +PermissionsBannerRequestConfig::~PermissionsBannerRequestConfig() = default; + +void PermissionsBannerRequestConfig::CreateAuxiliaryData( + base::SupportsUserData* user_data) { + InfobarOverlayRequestConfig::CreateForUserData( + user_data, static_cast<InfoBarIOS*>(infobar_), + InfobarOverlayType::kBanner, false); +}
diff --git a/ios/chrome/browser/passwords/ios_password_store_utils.mm b/ios/chrome/browser/passwords/ios_password_store_utils.mm index 12271c7..40a2398 100644 --- a/ios/chrome/browser/passwords/ios_password_store_utils.mm +++ b/ios/chrome/browser/passwords/ios_password_store_utils.mm
@@ -62,7 +62,6 @@ profile_store, /*account_store=*/nullptr, sync_service, identity_manager, pref_service, password_reuse_manager, /*is_under_advanced_protection=*/false, - /*for_primary_user_profile=*/true, base::BindOnce( &StoreMetricReporterHelper::RemoveInstanceFromBrowserStateUserData, weak_ptr_factory_.GetWeakPtr()));
diff --git a/ios/chrome/browser/policy/policy_egtest.mm b/ios/chrome/browser/policy/policy_egtest.mm index c60a538d..27b6cb3 100644 --- a/ios/chrome/browser/policy/policy_egtest.mm +++ b/ios/chrome/browser/policy/policy_egtest.mm
@@ -550,4 +550,28 @@ GREYAssertTrue(promptPresented, @"'Signed Out' prompt not shown"); } +// Tests that the UI notifying the user is displayed when sync is disabled by an +// administrator while the app is launched. +- (void)testSyncDisabledPromptWhileAppVisible { + FakeChromeIdentity* fakeIdentity = [FakeChromeIdentity fakeIdentity1]; + [SigninEarlGreyUI signinWithFakeIdentity:fakeIdentity]; + + // Enable SyncDisabled policy. + SetPolicy(true, policy::key::kSyncDisabled); + + // Check that the prompt is presented. + ConditionBlock condition = ^{ + NSError* error = nil; + [[EarlGrey + selectElementWithMatcher:grey_accessibilityLabel(l10n_util::GetNSString( + IDS_IOS_SYNC_SYNC_DISABLED))] + assertWithMatcher:grey_sufficientlyVisible() + error:&error]; + return error == nil; + }; + bool promptPresented = base::test::ios::WaitUntilConditionOrTimeout( + base::test::ios::kWaitForUIElementTimeout, condition); + GREYAssertTrue(promptPresented, @"'Sync Disabled' prompt not shown"); +} + @end
diff --git a/ios/chrome/browser/policy/policy_watcher_browser_agent.mm b/ios/chrome/browser/policy/policy_watcher_browser_agent.mm index 41a53d7..7ad6076 100644 --- a/ios/chrome/browser/policy/policy_watcher_browser_agent.mm +++ b/ios/chrome/browser/policy/policy_watcher_browser_agent.mm
@@ -7,6 +7,8 @@ #import <Foundation/Foundation.h> #include "base/metrics/histogram_functions.h" +#include "base/run_loop.h" +#include "base/task/post_task.h" #include "components/prefs/pref_change_registrar.h" #include "components/prefs/pref_service.h" #include "components/sync/base/pref_names.h" @@ -20,6 +22,7 @@ #import "ios/chrome/browser/ui/commands/policy_change_commands.h" #import "ios/chrome/browser/ui/main/scene_state.h" #import "ios/chrome/browser/ui/main/scene_state_browser_agent.h" +#include "ios/web/public/thread/web_task_traits.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -76,7 +79,10 @@ base::Unretained(this))); // Try to show the alert in case the policy changed since last time. - ShowSyncDisabledPromptIfNeeded(); + base::SequencedTaskRunnerHandle::Get()->PostTask( + FROM_HERE, + base::BindOnce(&PolicyWatcherBrowserAgent::ShowSyncDisabledPromptIfNeeded, + weak_factory_.GetWeakPtr())); } void PolicyWatcherBrowserAgent::ForceSignOutIfSigninDisabled() { @@ -114,9 +120,15 @@ syncer::prefs::kSyncManaged); if (!syncDisabledAlertShown && isSyncDisabledByAdministrator) { - [handler_ showSyncDisabledPrompt]; - // Will never trigger again unless policy changes. - [standard_defaults setBool:YES forKey:kSyncDisabledAlertShownKey]; + SceneState* scene_state = + SceneStateBrowserAgent::FromBrowser(browser_)->GetSceneState(); + BOOL scene_is_active = + scene_state.activationLevel >= SceneActivationLevelForegroundActive; + if (scene_is_active) { + [handler_ showSyncDisabledPrompt]; + // Will never trigger again unless policy changes. + [standard_defaults setBool:YES forKey:kSyncDisabledAlertShownKey]; + } } else if (syncDisabledAlertShown && !isSyncDisabledByAdministrator) { // Will trigger again, if policy is turned back on. [standard_defaults setBool:NO forKey:kSyncDisabledAlertShownKey];
diff --git a/ios/chrome/browser/policy/policy_watcher_browser_agent_unittest.mm b/ios/chrome/browser/policy/policy_watcher_browser_agent_unittest.mm index fee0ff8..bcc91b1 100644 --- a/ios/chrome/browser/policy/policy_watcher_browser_agent_unittest.mm +++ b/ios/chrome/browser/policy/policy_watcher_browser_agent_unittest.mm
@@ -366,30 +366,32 @@ AppState* app_state = [[AppState alloc] initWithBrowserLauncher:nil startupInformation:nil applicationDelegate:nil]; - FakeSceneState* scene_state = - [[FakeSceneState alloc] initWithAppState:app_state]; - scene_state.activationLevel = SceneActivationLevelForegroundActive; - SceneStateBrowserAgent::CreateForBrowser(browser.get(), scene_state); + @autoreleasepool { + FakeSceneState* scene_state = + [[FakeSceneState alloc] initWithAppState:app_state]; + scene_state.activationLevel = SceneActivationLevelForegroundActive; + SceneStateBrowserAgent::CreateForBrowser(browser.get(), scene_state); - id mockHandler = OCMProtocolMock(@protocol(PolicyChangeCommands)); - OCMExpect([mockHandler showSyncDisabledPrompt]); - agent->Initialize(mockHandler); + id mockHandler = OCMProtocolMock(@protocol(PolicyChangeCommands)); + OCMExpect([mockHandler showSyncDisabledPrompt]); + agent->Initialize(mockHandler); - // Update the pref. - browser_->GetBrowserState()->GetPrefs()->SetBoolean( - syncer::prefs::kSyncManaged, true); + // Update the pref. + browser_->GetBrowserState()->GetPrefs()->SetBoolean( + syncer::prefs::kSyncManaged, true); - EXPECT_OCMOCK_VERIFY(mockHandler); - EXPECT_TRUE([standard_defaults boolForKey:kSyncDisabledAlertShownKey]); + EXPECT_OCMOCK_VERIFY(mockHandler); + EXPECT_TRUE([standard_defaults boolForKey:kSyncDisabledAlertShownKey]); - [[mockHandler reject] showSyncDisabledPrompt]; + [[mockHandler reject] showSyncDisabledPrompt]; - // Update the pref. - browser_->GetBrowserState()->GetPrefs()->SetBoolean( - syncer::prefs::kSyncManaged, false); + // Update the pref. + browser_->GetBrowserState()->GetPrefs()->SetBoolean( + syncer::prefs::kSyncManaged, false); - EXPECT_OCMOCK_VERIFY(mockHandler); - EXPECT_FALSE([standard_defaults boolForKey:kSyncDisabledAlertShownKey]); + EXPECT_OCMOCK_VERIFY(mockHandler); + EXPECT_FALSE([standard_defaults boolForKey:kSyncDisabledAlertShownKey]); + } } // Tests that the handler is called and the alert shown at startup as expected. @@ -414,24 +416,28 @@ AppState* app_state = [[AppState alloc] initWithBrowserLauncher:nil startupInformation:nil applicationDelegate:nil]; - FakeSceneState* scene_state = - [[FakeSceneState alloc] initWithAppState:app_state]; - scene_state.activationLevel = SceneActivationLevelForegroundActive; - SceneStateBrowserAgent::CreateForBrowser(browser.get(), scene_state); + @autoreleasepool { + FakeSceneState* scene_state = + [[FakeSceneState alloc] initWithAppState:app_state]; + scene_state.activationLevel = SceneActivationLevelForegroundActive; + SceneStateBrowserAgent::CreateForBrowser(browser.get(), scene_state); - id mockHandler = OCMProtocolMock(@protocol(PolicyChangeCommands)); - OCMExpect([mockHandler showSyncDisabledPrompt]); - agent->Initialize(mockHandler); + id mockHandler = OCMProtocolMock(@protocol(PolicyChangeCommands)); + OCMExpect([mockHandler showSyncDisabledPrompt]); + agent->Initialize(mockHandler); - EXPECT_OCMOCK_VERIFY(mockHandler); - EXPECT_TRUE([standard_defaults boolForKey:kSyncDisabledAlertShownKey]); + base::RunLoop().RunUntilIdle(); - [[mockHandler reject] showSyncDisabledPrompt]; + EXPECT_OCMOCK_VERIFY(mockHandler); + EXPECT_TRUE([standard_defaults boolForKey:kSyncDisabledAlertShownKey]); - // Update the pref. - browser_->GetBrowserState()->GetPrefs()->SetBoolean( - syncer::prefs::kSyncManaged, false); + [[mockHandler reject] showSyncDisabledPrompt]; - EXPECT_OCMOCK_VERIFY(mockHandler); - EXPECT_FALSE([standard_defaults boolForKey:kSyncDisabledAlertShownKey]); + // Update the pref. + browser_->GetBrowserState()->GetPrefs()->SetBoolean( + syncer::prefs::kSyncManaged, false); + + EXPECT_OCMOCK_VERIFY(mockHandler); + EXPECT_FALSE([standard_defaults boolForKey:kSyncDisabledAlertShownKey]); + } }
diff --git a/ios/chrome/browser/tabs_search/tabs_search_service.mm b/ios/chrome/browser/tabs_search/tabs_search_service.mm index 9b6507c..6668bade 100644 --- a/ios/chrome/browser/tabs_search/tabs_search_service.mm +++ b/ios/chrome/browser/tabs_search/tabs_search_service.mm
@@ -159,7 +159,7 @@ std::vector<web::WebState*> results; - for (const Browser* browser : browsers) { + for (Browser* browser : browsers) { WebStateList* webStateList = browser->GetWebStateList(); for (int index = 0; index < webStateList->count(); ++index) { web::WebState* web_state = webStateList->GetWebStateAt(index);
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 725b6cf..7846893 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 @@ -051eb1c0368aa9c7ddf8badab17579c1e60b1240 \ No newline at end of file +c2d83790d17590989d1efe9d66ecd67ee201785e \ 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 9a8c252..653acee 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 @@ -34fda378ac7c0673d28fba21f88a11a99445b313 \ No newline at end of file +240cc33f62e0945d83587979527706092caa045f \ 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 edc04dee..52f2d3f 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 @@ -5c6c763bed8624b1dfda940a3d1f078e7f6cbdcf \ No newline at end of file +fbfbc9bfc286a6ae08944b69c94c20029f3bc00b \ 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 79f4e01..a2f0a17 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 @@ -b08a4696710b68ef82ea285e4c372900fdb48519 \ No newline at end of file +63e5c65b42f4c878baf969d0491b5f0339fae225 \ 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 529e4f2..8fb3030 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 @@ -d2fbb75e5099db6aae897155258b5fc0cccba401 \ No newline at end of file +2c1025f79ce5ad5d626c4fde0a6b843e9506ef1b \ 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 5ff5569..7e5426d 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 @@ -62ea1af4fa82e7edccf88b55509410ed324acbc5 \ No newline at end of file +16e7f46bbe0b506d2e6bb0fdbd76e38857b14fc3 \ 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 9e6bee1..82046088 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 @@ -c46c9a43a7260bd807e2a3735caeb58e5135727b \ No newline at end of file +9d3f8844c5d73e34beabea01a98c194a9e9a04c6 \ 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 f5d53f5d..a1977ef 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 @@ -2723fe046b5634d1c12397de8cc18e91460d6b0e \ No newline at end of file +78e8fa82d2e0cab7642df83257ba41d301c0b1cf \ 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 99ba09d..3136959b 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 @@ -8faf8172f18f165237cdad5724e351fc4d39f42e \ No newline at end of file +282cb5a6721879c733cb2bcdd61520605bdaa452 \ 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 7814fc9c..57dfda0 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 @@ -efeb8835abbe3c30801629080907c48fe2384744 \ No newline at end of file +4e9100e23c75a9f40f62681deb749706162cb2eb \ No newline at end of file
diff --git a/ipc/BUILD.gn b/ipc/BUILD.gn index ae4ac90..b1f63006 100644 --- a/ipc/BUILD.gn +++ b/ipc/BUILD.gn
@@ -294,7 +294,8 @@ } if (is_fuchsia) { - use_cfv2 = true + # TODO(crbug.com/1256502): Switch back to CFv2 once the bug is fixed. + use_cfv2 = false sources -= [ # No AF_UNIX domain sockets on Fuchsia. "sync_socket_unittest.cc",
diff --git a/media/gpu/vaapi/vaapi_unittest.cc b/media/gpu/vaapi/vaapi_unittest.cc index d8e362f..512d60c 100644 --- a/media/gpu/vaapi/vaapi_unittest.cc +++ b/media/gpu/vaapi/vaapi_unittest.cc
@@ -489,6 +489,18 @@ VAProfileVP9Profile2); EXPECT_TRUE(scalability_modes_vp9_profile2.empty()); + const auto scalability_modes_vp8 = VaapiWrapper::GetSupportedScalabilityModes( + VP8PROFILE_ANY, VAProfileVP8Version0_3); +#if BUILDFLAG(IS_CHROMEOS) + if (base::FeatureList::IsEnabled(kVaapiVp8TemporalLayerHWEncoding)) { + EXPECT_EQ(scalability_modes_vp8, kSupportedTemporalSVC); + } else { + EXPECT_TRUE(scalability_modes_vp8.empty()); + } +#else + EXPECT_TRUE(scalability_modes_vp8.empty()); +#endif + const auto scalability_modes_h264_baseline = VaapiWrapper::GetSupportedScalabilityModes( H264PROFILE_BASELINE, VAProfileH264ConstrainedBaseline);
diff --git a/mojo/public/js/mojo_bindings_resources.grd b/mojo/public/js/mojo_bindings_resources.grd index 62154f4..0a262e1 100644 --- a/mojo/public/js/mojo_bindings_resources.grd +++ b/mojo/public/js/mojo_bindings_resources.grd
@@ -26,16 +26,16 @@ use_base_dir="false" resource_path="mojo/mojo/public/js/bindings.js" type="BINDATA" /> - <include name="IDR_MOJO_MOJO_BINDINGS_LITE_HTML" - file="mojo_bindings_lite.html" - resource_path="mojo/mojo/public/js/mojo_bindings_lite.html" - type="BINDATA" /> - <include name="IDR_MOJO_MOJO_BINDINGS_LITE_JS" - file="${root_gen_dir}/mojo/public/js/mojo_bindings_lite.js" - use_base_dir="false" - resource_path="mojo/mojo/public/js/mojo_bindings_lite.js" - type="BINDATA" /> <if expr="chromeos_ash"> + <include name="IDR_MOJO_MOJO_BINDINGS_LITE_HTML" + file="mojo_bindings_lite.html" + resource_path="mojo/mojo/public/js/mojo_bindings_lite.html" + type="BINDATA" /> + <include name="IDR_MOJO_MOJO_BINDINGS_LITE_JS" + file="${root_gen_dir}/mojo/public/js/mojo_bindings_lite.js" + use_base_dir="false" + resource_path="mojo/mojo/public/js/mojo_bindings_lite.js" + type="BINDATA" /> <include name="IDR_MOJO_BIG_BUFFER_MOJOM_HTML" file="${root_gen_dir}/mojo/public/mojom/base/big_buffer.mojom.html" use_base_dir="false"
diff --git a/storage/browser/quota/quota_manager_unittest.cc b/storage/browser/quota/quota_manager_unittest.cc index 9dc62ef..678e823 100644 --- a/storage/browser/quota/quota_manager_unittest.cc +++ b/storage/browser/quota/quota_manager_unittest.cc
@@ -6,6 +6,7 @@ #include <stdint.h> #include <algorithm> +#include <cstdint> #include <memory> #include <set> #include <sstream> @@ -27,6 +28,7 @@ #include "base/test/metrics/histogram_tester.h" #include "base/test/scoped_feature_list.h" #include "base/test/task_environment.h" +#include "base/test/test_future.h" #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "components/services/storage/public/cpp/buckets/bucket_locator.h" @@ -69,6 +71,22 @@ const int64_t kDefaultPerHostQuota = 200; const int64_t kGigabytes = QuotaManagerImpl::kGBytes; +struct UsageAndQuotaResult { + QuotaStatusCode status; + int64_t usage; + int64_t quota; +}; + +struct GlobalUsageResult { + int64_t usage; + int64_t unlimited_usage; +}; + +struct StorageCapacityResult { + int64_t total_space; + int64_t available_space; +}; + // Returns a deterministic value for the amount of available disk space. int64_t GetAvailableDiskSpaceForTest() { return kAvailableSpaceForApp + kMustRemainAvailableForSystem; @@ -163,113 +181,72 @@ void OpenDatabase() { quota_manager_impl_->EnsureDatabaseOpened(); } - void GetOrCreateBucket(const StorageKey& storage_key, - const std::string& bucket_name) { - base::RunLoop run_loop; - quota_manager_impl_->GetOrCreateBucket( - storage_key, bucket_name, - base::BindOnce(&QuotaManagerImplTest::DidGetBucket, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); + QuotaErrorOr<BucketInfo> GetOrCreateBucket(const StorageKey& storage_key, + const std::string& bucket_name) { + base::test::TestFuture<QuotaErrorOr<BucketInfo>> future; + quota_manager_impl_->GetOrCreateBucket(storage_key, bucket_name, + future.GetCallback()); + return future.Take(); } - void CreateBucketForTesting(const StorageKey& storage_key, - const std::string& bucket_name, - blink::mojom::StorageType storage_type) { - base::RunLoop run_loop; + QuotaErrorOr<BucketInfo> CreateBucketForTesting( + const StorageKey& storage_key, + const std::string& bucket_name, + blink::mojom::StorageType storage_type) { + base::test::TestFuture<QuotaErrorOr<BucketInfo>> future; quota_manager_impl_->CreateBucketForTesting( - storage_key, bucket_name, storage_type, - base::BindOnce(&QuotaManagerImplTest::DidGetBucket, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); + storage_key, bucket_name, storage_type, future.GetCallback()); + return future.Take(); } - void GetBucket(const StorageKey& storage_key, - const std::string& bucket_name, - blink::mojom::StorageType storage_type) { - base::RunLoop run_loop; - quota_manager_impl_->GetBucket( - storage_key, bucket_name, storage_type, - base::BindOnce(&QuotaManagerImplTest::DidGetBucket, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); + QuotaErrorOr<BucketInfo> GetBucket(const StorageKey& storage_key, + const std::string& bucket_name, + blink::mojom::StorageType storage_type) { + base::test::TestFuture<QuotaErrorOr<BucketInfo>> future; + quota_manager_impl_->GetBucket(storage_key, bucket_name, storage_type, + future.GetCallback()); + return future.Take(); } - void GetStorageKeysForType(blink::mojom::StorageType storage_type) { - base::RunLoop run_loop; + std::set<StorageKey> GetStorageKeysForType( + blink::mojom::StorageType storage_type) { + base::test::TestFuture<std::set<StorageKey>> future; quota_manager_impl_->GetStorageKeysForType( - storage_type, - base::BindOnce(&QuotaManagerImplTest::DidGetStorageKeys, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); + storage_type, future.GetCallback<const std::set<StorageKey>&>()); + return future.Take(); } QuotaErrorOr<std::set<BucketLocator>> GetBucketsForType( blink::mojom::StorageType storage_type) { - base::RunLoop run_loop; - QuotaErrorOr<std::set<BucketLocator>> buckets; - quota_manager_impl_->GetBucketsForType( - storage_type, base::BindLambdaForTesting( - [&](QuotaErrorOr<std::set<BucketLocator>> result) { - buckets = std::move(result); - run_loop.Quit(); - })); - run_loop.Run(); - return buckets; + base::test::TestFuture<QuotaErrorOr<std::set<BucketLocator>>> future; + quota_manager_impl_->GetBucketsForType(storage_type, future.GetCallback()); + return future.Take(); } QuotaErrorOr<std::set<BucketLocator>> GetBucketsForHost( const std::string& host, blink::mojom::StorageType storage_type) { - base::RunLoop run_loop; - QuotaErrorOr<std::set<BucketLocator>> buckets; - quota_manager_impl_->GetBucketsForHost( - host, storage_type, - base::BindLambdaForTesting( - [&](QuotaErrorOr<std::set<BucketLocator>> result) { - buckets = std::move(result); - run_loop.Quit(); - })); - run_loop.Run(); - return buckets; + base::test::TestFuture<QuotaErrorOr<std::set<BucketLocator>>> future; + quota_manager_impl_->GetBucketsForHost(host, storage_type, + future.GetCallback()); + return future.Take(); } QuotaErrorOr<std::set<BucketLocator>> GetBucketsForStorageKey( const StorageKey& storage_key, blink::mojom::StorageType storage_type) { - base::RunLoop run_loop; - QuotaErrorOr<std::set<BucketLocator>> buckets; - quota_manager_impl_->GetBucketsForStorageKey( - storage_key, storage_type, - base::BindLambdaForTesting( - [&](QuotaErrorOr<std::set<BucketLocator>> result) { - buckets = std::move(result); - run_loop.Quit(); - })); - run_loop.Run(); - return buckets; + base::test::TestFuture<QuotaErrorOr<std::set<BucketLocator>>> future; + quota_manager_impl_->GetBucketsForStorageKey(storage_key, storage_type, + future.GetCallback()); + return future.Take(); } - void GetUsageInfo() { - usage_info_.clear(); - base::RunLoop run_loop; - quota_manager_impl_->GetUsageInfo( - base::BindOnce(&QuotaManagerImplTest::DidGetUsageInfo, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); - } - - void GetUsageAndQuotaForWebApps(const StorageKey& storage_key, - StorageType type) { - base::RunLoop run_loop; - quota_status_ = QuotaStatusCode::kUnknown; - usage_ = -1; - quota_ = -1; - quota_manager_impl_->GetUsageAndQuotaForWebApps( - storage_key, type, - base::BindOnce(&QuotaManagerImplTest::DidGetUsageAndQuota, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); + UsageAndQuotaResult GetUsageAndQuotaForWebApps(const StorageKey& storage_key, + StorageType type) { + base::test::TestFuture<QuotaStatusCode, int64_t, int64_t> future; + quota_manager_impl_->GetUsageAndQuotaForWebApps(storage_key, type, + future.GetCallback()); + return {future.Get<0>(), future.Get<1>(), future.Get<2>()}; } void GetUsageAndQuotaWithBreakdown(const StorageKey& storage_key, @@ -286,17 +263,13 @@ run_loop.Run(); } - void GetUsageAndQuotaForStorageClient(const StorageKey& storage_key, - StorageType type) { - base::RunLoop run_loop; - quota_status_ = QuotaStatusCode::kUnknown; - usage_ = -1; - quota_ = -1; - quota_manager_impl_->GetUsageAndQuota( - storage_key, type, - base::BindOnce(&QuotaManagerImplTest::DidGetUsageAndQuota, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); + UsageAndQuotaResult GetUsageAndQuotaForStorageClient( + const StorageKey& storage_key, + StorageType type) { + base::test::TestFuture<QuotaStatusCode, int64_t, int64_t> future; + quota_manager_impl_->GetUsageAndQuota(storage_key, type, + future.GetCallback()); + return {future.Get<0>(), future.Get<1>(), future.Get<2>()}; } void SetQuotaSettings(int64_t pool_size, @@ -319,32 +292,25 @@ quota_manager_impl_->SetGetVolumeInfoFnForTesting(fn); } - void GetPersistentHostQuota(const std::string& host) { - quota_status_ = QuotaStatusCode::kUnknown; - quota_ = -1; - quota_manager_impl_->GetPersistentHostQuota( - host, base::BindOnce(&QuotaManagerImplTest::DidGetHostQuota, - weak_factory_.GetWeakPtr())); + int64_t GetPersistentHostQuota(const std::string& host) { + base::test::TestFuture<QuotaStatusCode, int64_t> future; + quota_manager_impl_->GetPersistentHostQuota(host, future.GetCallback()); + EXPECT_EQ(future.Get<0>(), QuotaStatusCode::kOk); + return future.Get<1>(); } - void SetPersistentHostQuota(const std::string& host, int64_t new_quota) { - quota_status_ = QuotaStatusCode::kUnknown; - quota_ = -1; - quota_manager_impl_->SetPersistentHostQuota( - host, new_quota, - base::BindOnce(&QuotaManagerImplTest::DidGetHostQuota, - weak_factory_.GetWeakPtr())); + int64_t SetPersistentHostQuota(const std::string& host, int64_t new_quota) { + base::test::TestFuture<QuotaStatusCode, int64_t> future; + quota_manager_impl_->SetPersistentHostQuota(host, new_quota, + future.GetCallback()); + EXPECT_EQ(future.Get<0>(), QuotaStatusCode::kOk); + return future.Get<1>(); } - void GetGlobalUsage(StorageType type) { - usage_ = -1; - unlimited_usage_ = -1; - base::RunLoop run_loop; - quota_manager_impl_->GetGlobalUsage( - type, - base::BindOnce(&QuotaManagerImplTest::DidGetGlobalUsage, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); + GlobalUsageResult GetGlobalUsage(StorageType type) { + base::test::TestFuture<int64_t, int64_t> future; + quota_manager_impl_->GetGlobalUsage(type, future.GetCallback()); + return {future.Get<0>(), future.Get<1>()}; } void GetHostUsageWithBreakdown(const std::string& host, StorageType type) { @@ -365,62 +331,41 @@ weak_factory_.GetWeakPtr())); } - void DeleteClientStorageKeyData(mojom::QuotaClient* client, - const StorageKey& storage_key, - StorageType type) { - DCHECK(client); - quota_status_ = QuotaStatusCode::kUnknown; - client->DeleteStorageKeyData( - storage_key, type, - base::BindOnce(&QuotaManagerImplTest::StatusCallback, - weak_factory_.GetWeakPtr())); + QuotaStatusCode EvictBucketData(const BucketLocator& bucket) { + base::test::TestFuture<QuotaStatusCode> future; + quota_manager_impl_->EvictBucketData(bucket, future.GetCallback()); + return future.Get(); } - void EvictBucketData(const BucketLocator& bucket) { - quota_status_ = QuotaStatusCode::kUnknown; - quota_manager_impl_->EvictBucketData( - bucket, base::BindOnce(&QuotaManagerImplTest::StatusCallback, - weak_factory_.GetWeakPtr())); + QuotaStatusCode DeleteBucketData(const BucketLocator& bucket, + QuotaClientTypes quota_client_types) { + base::test::TestFuture<QuotaStatusCode> future; + quota_manager_impl_->DeleteBucketData(bucket, std::move(quota_client_types), + future.GetCallback()); + return future.Get(); } - void DeleteBucketData(const BucketLocator& bucket, - QuotaClientTypes quota_client_types) { - base::RunLoop run_loop; - quota_status_ = QuotaStatusCode::kUnknown; - quota_manager_impl_->DeleteBucketData( - bucket, std::move(quota_client_types), - base::BindOnce(&QuotaManagerImplTest::StatusCallbackSync, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); - } - - void DeleteHostData(const std::string& host, - StorageType type, - QuotaClientTypes quota_client_types) { - quota_status_ = QuotaStatusCode::kUnknown; + QuotaStatusCode DeleteHostData(const std::string& host, + StorageType type, + QuotaClientTypes quota_client_types) { + base::test::TestFuture<QuotaStatusCode> future; quota_manager_impl_->DeleteHostData( - host, type, std::move(quota_client_types), - base::BindOnce(&QuotaManagerImplTest::StatusCallback, - weak_factory_.GetWeakPtr())); + host, type, std::move(quota_client_types), future.GetCallback()); + return future.Get(); } - void FindAndDeleteBucketData(const StorageKey& storage_key, - const std::string& bucket_name) { - base::RunLoop run_loop; - quota_status_ = QuotaStatusCode::kUnknown; - quota_manager_impl_->FindAndDeleteBucketData( - storage_key, bucket_name, - base::BindOnce(&QuotaManagerImplTest::StatusCallbackSync, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); + QuotaStatusCode FindAndDeleteBucketData(const StorageKey& storage_key, + const std::string& bucket_name) { + base::test::TestFuture<QuotaStatusCode> future; + quota_manager_impl_->FindAndDeleteBucketData(storage_key, bucket_name, + future.GetCallback()); + return future.Get(); } - void GetStorageCapacity() { - available_space_ = -1; - total_space_ = -1; - quota_manager_impl_->GetStorageCapacity( - base::BindOnce(&QuotaManagerImplTest::DidGetStorageCapacity, - weak_factory_.GetWeakPtr())); + StorageCapacityResult GetStorageCapacity() { + base::test::TestFuture<int64_t, int64_t> future; + quota_manager_impl_->GetStorageCapacity(future.GetCallback()); + return {future.Get<0>(), future.Get<1>()}; } void GetEvictionRoundInfo() { @@ -452,57 +397,29 @@ weak_factory_.GetWeakPtr())); } - void GetBucketsModifiedBetween(StorageType type, - base::Time begin, - base::Time end) { - modified_buckets_.clear(); - modified_buckets_type_ = StorageType::kUnknown; - base::RunLoop run_loop; + std::set<BucketLocator> GetBucketsModifiedBetween(StorageType type, + base::Time begin, + base::Time end) { + base::test::TestFuture<std::set<BucketLocator>, StorageType> future; quota_manager_impl_->GetBucketsModifiedBetween( type, begin, end, - base::BindOnce(&QuotaManagerImplTest::DidGetModifiedBuckets, - weak_factory_.GetWeakPtr(), run_loop.QuitClosure())); - run_loop.Run(); + future.GetCallback<const std::set<BucketLocator>&, StorageType>()); + EXPECT_EQ(future.Get<1>(), type); + return future.Get<0>(); } - void DumpQuotaTable() { - quota_entries_.clear(); - quota_manager_impl_->DumpQuotaTable(base::BindOnce( - &QuotaManagerImplTest::DidDumpQuotaTable, weak_factory_.GetWeakPtr())); + QuotaTableEntries DumpQuotaTable() { + base::test::TestFuture<QuotaTableEntries> future; + quota_manager_impl_->DumpQuotaTable( + future.GetCallback<const QuotaTableEntries&>()); + return future.Get(); } - void DumpBucketTable() { - bucket_entries_.clear(); - quota_manager_impl_->DumpBucketTable(base::BindOnce( - &QuotaManagerImplTest::DidDumpBucketTable, weak_factory_.GetWeakPtr())); - } - - void DidGetBucket(base::OnceClosure quit_closure, - QuotaErrorOr<BucketInfo> result) { - bucket_ = std::move(result); - std::move(quit_closure).Run(); - } - - void DidGetStorageKeys(base::OnceClosure quit_closure, - const std::set<StorageKey>& storage_keys) { - storage_keys_ = std::move(storage_keys); - std::move(quit_closure).Run(); - } - - void DidGetUsageInfo(base::OnceClosure quit_closure, - UsageInfoEntries entries) { - usage_info_ = std::move(entries); - std::move(quit_closure).Run(); - } - - void DidGetUsageAndQuota(base::OnceClosure quit_closure, - QuotaStatusCode status, - int64_t usage, - int64_t quota) { - quota_status_ = status; - usage_ = usage; - quota_ = quota; - std::move(quit_closure).Run(); + BucketTableEntries DumpBucketTable() { + base::test::TestFuture<BucketTableEntries> future; + quota_manager_impl_->DumpBucketTable( + future.GetCallback<const BucketTableEntries&>()); + return future.Get(); } void DidGetUsageAndQuotaWithBreakdown( @@ -518,43 +435,6 @@ std::move(quit_closure).Run(); } - void DidGetQuota(QuotaStatusCode status, int64_t quota) { - quota_status_ = status; - quota_ = quota; - } - - void DidGetStorageCapacity(int64_t total_space, int64_t available_space) { - total_space_ = total_space; - available_space_ = available_space; - } - - void DidGetHostQuota(QuotaStatusCode status, int64_t quota) { - quota_status_ = status; - quota_ = quota; - } - - void DidGetGlobalUsage(base::OnceClosure quit_closure, - int64_t usage, - int64_t unlimited_usage) { - usage_ = usage; - unlimited_usage_ = unlimited_usage; - std::move(quit_closure).Run(); - } - - void DidGetHostUsage(int64_t usage) { usage_ = usage; } - - void StatusCallback(QuotaStatusCode status) { - ++status_callback_count_; - quota_status_ = status; - } - - void StatusCallbackSync(base::OnceClosure quit_closure, - QuotaStatusCode status) { - ++status_callback_count_; - quota_status_ = status; - std::move(quit_closure).Run(); - } - void DidGetHostUsageBreakdown( base::OnceClosure quit_closure, int64_t usage, @@ -583,22 +463,6 @@ !bucket->storage_key.origin().GetURL().is_empty()); } - void DidGetModifiedBuckets(base::OnceClosure quit_closure, - const std::set<BucketLocator>& buckets, - StorageType type) { - modified_buckets_ = buckets; - modified_buckets_type_ = type; - std::move(quit_closure).Run(); - } - - void DidDumpQuotaTable(const QuotaTableEntries& entries) { - quota_entries_ = entries; - } - - void DidDumpBucketTable(const BucketTableEntries& entries) { - bucket_entries_ = entries; - } - void GetUsage_WithModifyTestBody(const StorageType type); void SetStoragePressureCallback( @@ -624,6 +488,7 @@ QuotaManagerImpl* quota_manager_impl() const { return quota_manager_impl_.get(); } + void set_quota_manager_impl(QuotaManagerImpl* quota_manager_impl) { quota_manager_impl_ = quota_manager_impl; } @@ -661,33 +526,21 @@ } QuotaStatusCode status() const { return quota_status_; } - const UsageInfoEntries& usage_info() const { return usage_info_; } int64_t usage() const { return usage_; } const blink::mojom::UsageBreakdown& usage_breakdown() const { return *usage_breakdown_; } - int64_t unlimited_usage() const { return unlimited_usage_; } int64_t quota() const { return quota_; } int64_t total_space() const { return total_space_; } int64_t available_space() const { return available_space_; } const absl::optional<BucketLocator>& eviction_bucket() const { return eviction_bucket_; } - const std::set<BucketLocator>& modified_buckets() const { - return modified_buckets_; - } - StorageType modified_buckets_type() const { return modified_buckets_type_; } - const QuotaTableEntries& quota_entries() const { return quota_entries_; } - const BucketTableEntries& bucket_entries() const { return bucket_entries_; } const QuotaSettings& settings() const { return settings_; } - int status_callback_count() const { return status_callback_count_; } - void reset_status_callback_count() { status_callback_count_ = 0; } protected: base::test::ScopedFeatureList scoped_feature_list_; base::test::TaskEnvironment task_environment_; - QuotaErrorOr<BucketInfo> bucket_; - QuotaErrorOr<std::set<StorageKey>> storage_keys_; base::ScopedTempDir data_dir_; private: @@ -700,20 +553,13 @@ scoped_refptr<MockSpecialStoragePolicy> mock_special_storage_policy_; QuotaStatusCode quota_status_; - UsageInfoEntries usage_info_; int64_t usage_; blink::mojom::UsageBreakdownPtr usage_breakdown_; - int64_t unlimited_usage_; int64_t quota_; int64_t total_space_; int64_t available_space_; absl::optional<BucketLocator> eviction_bucket_; - std::set<BucketLocator> modified_buckets_; - StorageType modified_buckets_type_; - QuotaTableEntries quota_entries_; - BucketTableEntries bucket_entries_; QuotaSettings settings_; - int status_callback_count_; int additional_callback_count_; @@ -747,21 +593,26 @@ // When bootstrapping is complete, queued calls to the QuotaDatabase // should return successfully and buckets for registered storage keys should // already exist. - GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kTemp); + auto bucket = + GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kTemp); EXPECT_FALSE(is_db_bootstrapping()); - ASSERT_TRUE(bucket_.ok()); + ASSERT_TRUE(bucket.ok()); - GetBucket(ToStorageKey("http://foo.com:8080/"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); + bucket = GetBucket(ToStorageKey("http://foo.com:8080/"), kDefaultBucketName, + kTemp); + ASSERT_TRUE(bucket.ok()); - GetBucket(ToStorageKey("https://foo.com:8081/"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); + bucket = GetBucket(ToStorageKey("https://foo.com:8081/"), kDefaultBucketName, + kTemp); + ASSERT_TRUE(bucket.ok()); - GetBucket(ToStorageKey("http://bar.com/"), kDefaultBucketName, kPerm); - ASSERT_TRUE(bucket_.ok()); + bucket = + GetBucket(ToStorageKey("http://bar.com/"), kDefaultBucketName, kPerm); + ASSERT_TRUE(bucket.ok()); - GetBucket(ToStorageKey("http://example.com/"), kDefaultBucketName, kPerm); - ASSERT_TRUE(bucket_.ok()); + bucket = + GetBucket(ToStorageKey("http://example.com/"), kDefaultBucketName, kPerm); + ASSERT_TRUE(bucket.ok()); } TEST_F(QuotaManagerImplTest, GetUsageInfo) { @@ -784,13 +635,15 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetUsageInfo(); + base::test::TestFuture<UsageInfoEntries> future; + quota_manager_impl()->GetUsageInfo(future.GetCallback()); + auto entries = future.Get(); - EXPECT_THAT(usage_info(), testing::UnorderedElementsAre( - UsageInfo("foo.com", kTemp, 10 + 15 + 30 + 35), - UsageInfo("bar.com", kTemp, 20), - UsageInfo("bar.com", kPerm, 40 + 50), - UsageInfo("example.com", kPerm, 40))); + EXPECT_THAT(entries, testing::UnorderedElementsAre( + UsageInfo("foo.com", kTemp, 10 + 15 + 30 + 35), + UsageInfo("bar.com", kTemp, 20), + UsageInfo("bar.com", kPerm, 40 + 50), + UsageInfo("example.com", kPerm, 40))); } TEST_F(QuotaManagerImplTest, DatabaseDisabledAfterThreshold) { @@ -805,17 +658,17 @@ StorageKey storage_key = ToStorageKey("http://a.com/"); std::string bucket_name = "bucket_a"; - GetOrCreateBucket(storage_key, bucket_name); - ASSERT_FALSE(bucket_.ok()); + auto bucket = GetOrCreateBucket(storage_key, bucket_name); + ASSERT_FALSE(bucket.ok()); ASSERT_FALSE(is_db_disabled()); - GetOrCreateBucket(storage_key, bucket_name); - ASSERT_FALSE(bucket_.ok()); + bucket = GetOrCreateBucket(storage_key, bucket_name); + ASSERT_FALSE(bucket.ok()); ASSERT_FALSE(is_db_disabled()); // Disables access to QuotaDatabase after error counts passes threshold. - GetBucket(storage_key, bucket_name, kTemp); - ASSERT_FALSE(bucket_.ok()); + bucket = GetBucket(storage_key, bucket_name, kTemp); + ASSERT_FALSE(bucket.ok()); ASSERT_TRUE(is_db_disabled()); } @@ -823,32 +676,32 @@ StorageKey storage_key = ToStorageKey("http://a.com/"); std::string bucket_name = "bucket_a"; - GetOrCreateBucket(storage_key, bucket_name); - ASSERT_TRUE(bucket_.ok()); + auto bucket = GetOrCreateBucket(storage_key, bucket_name); + ASSERT_TRUE(bucket.ok()); - BucketId created_bucket_id = bucket_.value().id; + BucketId created_bucket_id = bucket.value().id; - GetOrCreateBucket(storage_key, bucket_name); - EXPECT_TRUE(bucket_.ok()); - EXPECT_EQ(bucket_.value().id, created_bucket_id); + bucket = GetOrCreateBucket(storage_key, bucket_name); + EXPECT_TRUE(bucket.ok()); + EXPECT_EQ(bucket.value().id, created_bucket_id); } TEST_F(QuotaManagerImplTest, GetBucket) { StorageKey storage_key = ToStorageKey("http://a.com/"); std::string bucket_name = "bucket_a"; - CreateBucketForTesting(storage_key, bucket_name, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo created_bucket = bucket_.value(); + auto bucket = CreateBucketForTesting(storage_key, bucket_name, kTemp); + ASSERT_TRUE(bucket.ok()); + BucketInfo created_bucket = bucket.value(); - GetBucket(storage_key, bucket_name, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo retrieved_bucket = bucket_.value(); + bucket = GetBucket(storage_key, bucket_name, kTemp); + ASSERT_TRUE(bucket.ok()); + BucketInfo retrieved_bucket = bucket.value(); EXPECT_EQ(created_bucket.id, retrieved_bucket.id); - GetBucket(storage_key, "bucket_b", kTemp); - ASSERT_FALSE(bucket_.ok()); - EXPECT_EQ(bucket_.error(), QuotaError::kNotFound); + bucket = GetBucket(storage_key, "bucket_b", kTemp); + ASSERT_FALSE(bucket.ok()); + EXPECT_EQ(bucket.error(), QuotaError::kNotFound); ASSERT_FALSE(is_db_disabled()); } @@ -857,25 +710,24 @@ StorageKey storage_key_b = ToStorageKey("http://b.com/"); StorageKey storage_key_c = ToStorageKey("http://c.com/"); - CreateBucketForTesting(storage_key_a, "bucket_a", kTemp); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_a = bucket_.value(); + auto bucket = CreateBucketForTesting(storage_key_a, "bucket_a", kTemp); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_a = bucket.value(); - CreateBucketForTesting(storage_key_b, "bucket_b", kTemp); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_b = bucket_.value(); + bucket = CreateBucketForTesting(storage_key_b, "bucket_b", kTemp); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_b = bucket.value(); - CreateBucketForTesting(storage_key_c, "bucket_c", kPerm); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_c = bucket_.value(); + bucket = CreateBucketForTesting(storage_key_c, "bucket_c", kPerm); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_c = bucket.value(); - GetStorageKeysForType(kTemp); - EXPECT_THAT(storage_keys_.value(), + std::set<StorageKey> storage_keys = GetStorageKeysForType(kTemp); + EXPECT_THAT(storage_keys, testing::UnorderedElementsAre(storage_key_a, storage_key_b)); - GetStorageKeysForType(kPerm); - EXPECT_THAT(storage_keys_.value(), - testing::UnorderedElementsAre(storage_key_c)); + storage_keys = GetStorageKeysForType(kPerm); + EXPECT_THAT(storage_keys, testing::UnorderedElementsAre(storage_key_c)); } TEST_F(QuotaManagerImplTest, GetStorageKeysForTypeWithDatabaseError) { @@ -886,8 +738,8 @@ disable_quota_database(true); // Return empty set when error is encountered. - GetStorageKeysForType(kTemp); - EXPECT_TRUE(storage_keys_.value().empty()); + std::set<StorageKey> storage_keys = GetStorageKeysForType(kTemp); + EXPECT_TRUE(storage_keys.empty()); } TEST_F(QuotaManagerImplTest, GetBucketsForType) { @@ -895,17 +747,17 @@ StorageKey storage_key_b = ToStorageKey("http://b.com/"); StorageKey storage_key_c = ToStorageKey("http://c.com/"); - CreateBucketForTesting(storage_key_a, "bucket_a", kTemp); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_a = bucket_.value(); + auto bucket = CreateBucketForTesting(storage_key_a, "bucket_a", kTemp); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_a = bucket.value(); - CreateBucketForTesting(storage_key_b, "bucket_b", kTemp); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_b = bucket_.value(); + bucket = CreateBucketForTesting(storage_key_b, "bucket_b", kTemp); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_b = bucket.value(); - CreateBucketForTesting(storage_key_c, "bucket_c", kPerm); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_c = bucket_.value(); + bucket = CreateBucketForTesting(storage_key_c, "bucket_c", kPerm); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_c = bucket.value(); QuotaErrorOr<std::set<BucketLocator>> result = GetBucketsForType(kTemp); EXPECT_TRUE(result.ok()); @@ -926,17 +778,19 @@ StorageKey host_a_storage_key_2 = ToStorageKey("https://a.com:123/"); StorageKey host_b_storage_key = ToStorageKey("http://b.com/"); - CreateBucketForTesting(host_a_storage_key_1, kDefaultBucketName, kTemp); - EXPECT_TRUE(bucket_.ok()); - BucketInfo host_a_bucket_1 = bucket_.value(); + auto bucket = + CreateBucketForTesting(host_a_storage_key_1, kDefaultBucketName, kTemp); + EXPECT_TRUE(bucket.ok()); + BucketInfo host_a_bucket_1 = bucket.value(); - CreateBucketForTesting(host_a_storage_key_2, "test", kTemp); - EXPECT_TRUE(bucket_.ok()); - BucketInfo host_a_bucket_2 = bucket_.value(); + bucket = CreateBucketForTesting(host_a_storage_key_2, "test", kTemp); + EXPECT_TRUE(bucket.ok()); + BucketInfo host_a_bucket_2 = bucket.value(); - CreateBucketForTesting(host_b_storage_key, kDefaultBucketName, kPerm); - EXPECT_TRUE(bucket_.ok()); - BucketInfo host_b_bucket = bucket_.value(); + bucket = + CreateBucketForTesting(host_b_storage_key, kDefaultBucketName, kPerm); + EXPECT_TRUE(bucket.ok()); + BucketInfo host_b_bucket = bucket.value(); QuotaErrorOr<std::set<BucketLocator>> result = GetBucketsForHost("a.com", kTemp); @@ -958,21 +812,21 @@ StorageKey storage_key_b = ToStorageKey("http://b.com/"); StorageKey storage_key_c = ToStorageKey("http://c.com/"); - CreateBucketForTesting(storage_key_a, "bucket_a1", kTemp); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_a1 = bucket_.value(); + auto bucket = CreateBucketForTesting(storage_key_a, "bucket_a1", kTemp); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_a1 = bucket.value(); - CreateBucketForTesting(storage_key_a, "bucket_a2", kTemp); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_a2 = bucket_.value(); + bucket = CreateBucketForTesting(storage_key_a, "bucket_a2", kTemp); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_a2 = bucket.value(); - CreateBucketForTesting(storage_key_b, "bucket_b", kTemp); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_b = bucket_.value(); + bucket = CreateBucketForTesting(storage_key_b, "bucket_b", kTemp); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_b = bucket.value(); - CreateBucketForTesting(storage_key_c, "bucket_c", kPerm); - EXPECT_TRUE(bucket_.ok()); - BucketInfo bucket_c = bucket_.value(); + bucket = CreateBucketForTesting(storage_key_c, "bucket_c", kPerm); + EXPECT_TRUE(bucket.ok()); + BucketInfo bucket_c = bucket.value(); QuotaErrorOr<std::set<BucketLocator>> result = GetBucketsForStorageKey(storage_key_a, kTemp); @@ -1004,31 +858,33 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(80, usage()); - EXPECT_EQ(0, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 80); + EXPECT_EQ(result.quota, 0); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10, usage()); - EXPECT_LE(0, quota()); - int64_t quota_returned_for_foo = quota(); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10); + EXPECT_GT(result.quota, 0); + int64_t quota_returned_for_foo = result.quota; - GetUsageAndQuotaForWebApps(ToStorageKey("http://bar.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); - EXPECT_EQ(quota_returned_for_foo, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://bar.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); + EXPECT_EQ(result.quota, quota_returned_for_foo); } TEST_F(QuotaManagerImplTest, GetUsage_NoClient) { - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(0, usage()); @@ -1036,13 +892,13 @@ GetHostUsageWithBreakdown("foo.com", kPerm); EXPECT_EQ(0, usage()); - GetGlobalUsage(kTemp); - EXPECT_EQ(0, usage()); - EXPECT_EQ(0, unlimited_usage()); + auto global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 0); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); - GetGlobalUsage(kPerm); - EXPECT_EQ(0, usage()); - EXPECT_EQ(0, unlimited_usage()); + global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 0); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); } TEST_F(QuotaManagerImplTest, GetUsage_EmptyClient) { @@ -1051,13 +907,14 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(0, usage()); @@ -1065,13 +922,13 @@ GetHostUsageWithBreakdown("foo.com", kPerm); EXPECT_EQ(0, usage()); - GetGlobalUsage(kTemp); - EXPECT_EQ(0, usage()); - EXPECT_EQ(0, unlimited_usage()); + auto global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 0); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); - GetGlobalUsage(kPerm); - EXPECT_EQ(0, usage()); - EXPECT_EQ(0, unlimited_usage()); + global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 0); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); } TEST_F(QuotaManagerImplTest, GetTemporaryUsageAndQuota_MultiStorageKeys) { @@ -1089,18 +946,19 @@ const int kPerHostQuota = 20; SetQuotaSettings(kPoolSize, kPerHostQuota, kMustRemainAvailableForSystem); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10 + 20, usage()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10 + 20); // The host's quota should be its full portion of the global quota // since there's plenty of diskspace. - EXPECT_EQ(kPerHostQuota, quota()); + EXPECT_EQ(result.quota, kPerHostQuota); - GetUsageAndQuotaForWebApps(ToStorageKey("http://bar.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(5 + 7, usage()); - EXPECT_EQ(kPerHostQuota, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://bar.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 5 + 7); + EXPECT_EQ(result.quota, kPerHostQuota); } TEST_F(QuotaManagerImplTest, GetUsage_MultipleClients) { @@ -1116,7 +974,7 @@ {"http://unlimited/", kTemp, 512}, }; mock_special_storage_policy()->AddUnlimited(GURL("http://unlimited/")); - GetStorageCapacity(); + auto storage_capacity = GetStorageCapacity(); CreateAndRegisterClient(kData1, QuotaClientType::kFileSystem, {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); @@ -1128,35 +986,34 @@ const int64_t kPerHostQuota = kPoolSize / 5; SetQuotaSettings(kPoolSize, kPerHostQuota, kMustRemainAvailableForSystem); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(1 + 128, usage()); - EXPECT_EQ(kPerHostQuota, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 1 + 128); + EXPECT_EQ(result.quota, kPerHostQuota); - GetUsageAndQuotaForWebApps(ToStorageKey("http://bar.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(4, usage()); - EXPECT_EQ(0, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://bar.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 4); + EXPECT_EQ(result.quota, 0); - GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(512, usage()); - EXPECT_EQ(available_space() + usage(), quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 512); + EXPECT_EQ(result.quota, storage_capacity.available_space + result.usage); - GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(8, usage()); - EXPECT_EQ(available_space() + usage(), quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 8); + EXPECT_EQ(result.quota, storage_capacity.available_space + result.usage); - GetGlobalUsage(kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(1 + 2 + 128 + 512, usage()); - EXPECT_EQ(512, unlimited_usage()); + auto global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 1 + 2 + 128 + 512); + EXPECT_EQ(global_usage_result.unlimited_usage, 512); - GetGlobalUsage(kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(4 + 8 + 256, usage()); - EXPECT_EQ(8, unlimited_usage()); + global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 4 + 8 + 256); + EXPECT_EQ(global_usage_result.unlimited_usage, 8); } TEST_F(QuotaManagerImplTest, GetUsageWithBreakdown_Simple) { @@ -1307,33 +1164,36 @@ void QuotaManagerImplTest::GetUsage_WithModifyTestBody(const StorageType type) { const MockStorageKeyData data[] = { {"http://foo.com/", type, 10}, + {"http://bar.com/", type, 0}, {"http://foo.com:1/", type, 20}, + {"https://foo.com/", type, 0}, }; MockQuotaClient* client = CreateAndRegisterClient(data, QuotaClientType::kFileSystem, {type}); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), type); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10 + 20, usage()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), type); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10 + 20); client->ModifyStorageKeyAndNotify(ToStorageKey("http://foo.com/"), type, 30); client->ModifyStorageKeyAndNotify(ToStorageKey("http://foo.com:1/"), type, -5); - client->AddStorageKeyAndNotify(ToStorageKey("https://foo.com/"), type, 1); + client->ModifyStorageKeyAndNotify(ToStorageKey("https://foo.com/"), type, 1); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), type); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10 + 20 + 30 - 5 + 1, usage()); - int foo_usage = usage(); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), type); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10 + 20 + 30 - 5 + 1); + int foo_usage = result.usage; - client->AddStorageKeyAndNotify(ToStorageKey("http://bar.com/"), type, 40); - GetUsageAndQuotaForWebApps(ToStorageKey("http://bar.com/"), type); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(40, usage()); + client->ModifyStorageKeyAndNotify(ToStorageKey("http://bar.com/"), type, 40); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://bar.com/"), type); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 40); - GetGlobalUsage(type); - EXPECT_EQ(foo_usage + 40, usage()); - EXPECT_EQ(0, unlimited_usage()); + auto global_usage_result = GetGlobalUsage(type); + EXPECT_EQ(global_usage_result.usage, foo_usage + 40); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); } TEST_F(QuotaManagerImplTest, GetTemporaryUsage_WithModify) { @@ -1357,19 +1217,20 @@ GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10 + 20, usage()); - EXPECT_EQ(kPerHostQuota, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10 + 20); + EXPECT_EQ(result.quota, kPerHostQuota); set_additional_callback_count(0); RunAdditionalUsageAndQuotaTask(ToStorageKey("http://foo.com/"), kTemp); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); RunAdditionalUsageAndQuotaTask(ToStorageKey("http://bar.com/"), kTemp); task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10 + 20, usage()); - EXPECT_EQ(kPerHostQuota, quota()); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10 + 20); + EXPECT_EQ(result.quota, kPerHostQuota); EXPECT_EQ(2, additional_callback_count()); } @@ -1393,13 +1254,18 @@ RunAdditionalUsageAndQuotaTask(ToStorageKey("http://foo.com/"), kTemp); RunAdditionalUsageAndQuotaTask(ToStorageKey("http://bar.com/"), kTemp); - DeleteHostData("foo.com", kTemp, AllQuotaClientTypes()); - DeleteHostData("bar.com", kTemp, AllQuotaClientTypes()); + base::test::TestFuture<QuotaStatusCode> future_foo; + base::test::TestFuture<QuotaStatusCode> future_bar; + quota_manager_impl()->DeleteHostData("foo.com", kTemp, AllQuotaClientTypes(), + future_foo.GetCallback()); + quota_manager_impl()->DeleteHostData("bar.com", kTemp, AllQuotaClientTypes(), + future_bar.GetCallback()); // Nuke before waiting for callbacks. set_quota_manager_impl(nullptr); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kErrorAbort, status()); + + EXPECT_EQ(QuotaStatusCode::kErrorAbort, future_foo.Get()); + EXPECT_EQ(QuotaStatusCode::kErrorAbort, future_bar.Get()); } TEST_F(QuotaManagerImplTest, GetTemporaryUsageAndQuota_Overbudget) { @@ -1417,24 +1283,25 @@ // Provided diskspace is not tight, global usage does not affect the // quota calculations for an individual storage key, so despite global usage // in excess of our poolsize, we still get the nominal quota value. - GetStorageCapacity(); - task_environment_.RunUntilIdle(); - EXPECT_LE(kMustRemainAvailableForSystem, available_space()); + auto storage_capacity = GetStorageCapacity(); + EXPECT_LE(kMustRemainAvailableForSystem, storage_capacity.available_space); - GetUsageAndQuotaForWebApps(ToStorageKey("http://usage1/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(1, usage()); - EXPECT_EQ(kPerHostQuota, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://usage1/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 1); + EXPECT_EQ(result.quota, kPerHostQuota); - GetUsageAndQuotaForWebApps(ToStorageKey("http://usage10/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10, usage()); - EXPECT_EQ(kPerHostQuota, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://usage10/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10); + EXPECT_EQ(result.quota, kPerHostQuota); - GetUsageAndQuotaForWebApps(ToStorageKey("http://usage200/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(200, usage()); - EXPECT_EQ(kPerHostQuota, quota()); // should be clamped to the nominal quota + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://usage200/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 200); + // Should be clamped to the nominal quota. + EXPECT_EQ(result.quota, kPerHostQuota); } TEST_F(QuotaManagerImplTest, GetTemporaryUsageAndQuota_Unlimited) { @@ -1444,88 +1311,92 @@ {"http://unlimited/", kTemp, 4000}, }; mock_special_storage_policy()->AddUnlimited(GURL("http://unlimited/")); - GetStorageCapacity(); + auto storage_capacity = GetStorageCapacity(); CreateAndRegisterClient(kData, QuotaClientType::kFileSystem, {blink::mojom::StorageType::kTemporary}); // Test when not overbugdet. const int kPerHostQuotaFor1000 = 200; SetQuotaSettings(1000, kPerHostQuotaFor1000, kMustRemainAvailableForSystem); - GetGlobalUsage(kTemp); - EXPECT_EQ(10 + 50 + 4000, usage()); - EXPECT_EQ(4000, unlimited_usage()); + auto global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 10 + 50 + 4000); + EXPECT_EQ(global_usage_result.unlimited_usage, 4000); - GetUsageAndQuotaForWebApps(ToStorageKey("http://usage10/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10, usage()); - EXPECT_EQ(kPerHostQuotaFor1000, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://usage10/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10); + EXPECT_EQ(result.quota, kPerHostQuotaFor1000); - GetUsageAndQuotaForWebApps(ToStorageKey("http://usage50/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(50, usage()); - EXPECT_EQ(kPerHostQuotaFor1000, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://usage50/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 50); + EXPECT_EQ(result.quota, kPerHostQuotaFor1000); - GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(4000, usage()); - EXPECT_EQ(available_space() + usage(), quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 4000); + EXPECT_EQ(result.quota, storage_capacity.available_space + result.usage); - GetUsageAndQuotaForStorageClient(ToStorageKey("http://unlimited/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); - EXPECT_EQ(QuotaManagerImpl::kNoLimit, quota()); + result = GetUsageAndQuotaForStorageClient(ToStorageKey("http://unlimited/"), + kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); + EXPECT_EQ(result.quota, QuotaManagerImpl::kNoLimit); - // Test when overbugdet. + // Test when overbudgeted. const int kPerHostQuotaFor100 = 20; SetQuotaSettings(100, kPerHostQuotaFor100, kMustRemainAvailableForSystem); - GetUsageAndQuotaForWebApps(ToStorageKey("http://usage10/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10, usage()); - EXPECT_EQ(kPerHostQuotaFor100, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://usage10/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10); + EXPECT_EQ(result.quota, kPerHostQuotaFor100); - GetUsageAndQuotaForWebApps(ToStorageKey("http://usage50/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(50, usage()); - EXPECT_EQ(kPerHostQuotaFor100, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://usage50/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 50); + EXPECT_EQ(result.quota, kPerHostQuotaFor100); - GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(4000, usage()); - EXPECT_EQ(available_space() + usage(), quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 4000); + EXPECT_EQ(result.quota, storage_capacity.available_space + result.usage); - GetUsageAndQuotaForStorageClient(ToStorageKey("http://unlimited/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); - EXPECT_EQ(QuotaManagerImpl::kNoLimit, quota()); + result = GetUsageAndQuotaForStorageClient(ToStorageKey("http://unlimited/"), + kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); + EXPECT_EQ(result.quota, QuotaManagerImpl::kNoLimit); // Revoke the unlimited rights and make sure the change is noticed. mock_special_storage_policy()->Reset(); mock_special_storage_policy()->NotifyCleared(); - GetGlobalUsage(kTemp); - EXPECT_EQ(10 + 50 + 4000, usage()); - EXPECT_EQ(0, unlimited_usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 10 + 50 + 4000); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); - GetUsageAndQuotaForWebApps(ToStorageKey("http://usage10/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10, usage()); - EXPECT_EQ(kPerHostQuotaFor100, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://usage10/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10); + EXPECT_EQ(result.quota, kPerHostQuotaFor100); - GetUsageAndQuotaForWebApps(ToStorageKey("http://usage50/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(50, usage()); - EXPECT_EQ(kPerHostQuotaFor100, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://usage50/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 50); + EXPECT_EQ(result.quota, kPerHostQuotaFor100); - GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(4000, usage()); - EXPECT_EQ(kPerHostQuotaFor100, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 4000); + EXPECT_EQ(result.quota, kPerHostQuotaFor100); - GetUsageAndQuotaForStorageClient(ToStorageKey("http://unlimited/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(4000, usage()); - EXPECT_EQ(kPerHostQuotaFor100, quota()); + result = GetUsageAndQuotaForStorageClient(ToStorageKey("http://unlimited/"), + kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 4000); + EXPECT_EQ(result.quota, kPerHostQuotaFor100); } TEST_F(QuotaManagerImplTest, GetAndSetPerststentHostQuota) { @@ -1534,60 +1405,59 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetPersistentHostQuota("foo.com"); - task_environment_.RunUntilIdle(); - EXPECT_EQ(0, quota()); + EXPECT_EQ(GetPersistentHostQuota("foo.com"), 0); + EXPECT_EQ(SetPersistentHostQuota("foo.com", 100), 100); - SetPersistentHostQuota("foo.com", 100); - task_environment_.RunUntilIdle(); - EXPECT_EQ(100, quota()); - - GetPersistentHostQuota("foo.com"); - SetPersistentHostQuota("foo.com", 200); - GetPersistentHostQuota("foo.com"); - SetPersistentHostQuota("foo.com", - QuotaManagerImpl::kPerHostPersistentQuotaLimit); - GetPersistentHostQuota("foo.com"); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaManagerImpl::kPerHostPersistentQuotaLimit, quota()); + // Should still succeed after multiple calls at once. + base::test::TestFuture<QuotaStatusCode, int64_t> future1; + base::test::TestFuture<QuotaStatusCode, int64_t> future2; + base::test::TestFuture<QuotaStatusCode, int64_t> future3; + quota_manager_impl()->SetPersistentHostQuota("foo.com", 200, + future1.GetCallback()); + quota_manager_impl()->SetPersistentHostQuota("foo.com", 300, + future2.GetCallback()); + quota_manager_impl()->SetPersistentHostQuota( + "foo.com", QuotaManagerImpl::kPerHostPersistentQuotaLimit, + future3.GetCallback()); + EXPECT_EQ(GetPersistentHostQuota("foo.com"), + QuotaManagerImpl::kPerHostPersistentQuotaLimit); // Persistent quota should be capped at the per-host quota limit. SetPersistentHostQuota("foo.com", QuotaManagerImpl::kPerHostPersistentQuotaLimit + 100); - GetPersistentHostQuota("foo.com"); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaManagerImpl::kPerHostPersistentQuotaLimit, quota()); + EXPECT_EQ(GetPersistentHostQuota("foo.com"), + QuotaManagerImpl::kPerHostPersistentQuotaLimit); } TEST_F(QuotaManagerImplTest, GetAndSetPersistentUsageAndQuota) { - GetStorageCapacity(); + auto storage_capacity = GetStorageCapacity(); CreateAndRegisterClient(base::span<MockStorageKeyData>(), QuotaClientType::kFileSystem, {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); - EXPECT_EQ(0, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); + EXPECT_EQ(result.quota, 0); SetPersistentHostQuota("foo.com", 100); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); - EXPECT_EQ(100, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); + EXPECT_EQ(result.quota, 100); // The actual space available is given to 'unlimited' storage keys as their // quota. mock_special_storage_policy()->AddUnlimited(GURL("http://unlimited/")); - GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kPerm); - EXPECT_EQ(available_space() + usage(), quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kPerm); + EXPECT_EQ(result.quota, storage_capacity.available_space + result.usage); - // GetUsageAndQuotaForStorageClient should just return 0 usage and - // kNoLimit quota. - GetUsageAndQuotaForStorageClient(ToStorageKey("http://unlimited/"), kPerm); - EXPECT_EQ(0, usage()); - EXPECT_EQ(QuotaManagerImpl::kNoLimit, quota()); + result = GetUsageAndQuotaForStorageClient(ToStorageKey("http://unlimited/"), + kPerm); + EXPECT_EQ(result.usage, 0); + EXPECT_EQ(result.quota, QuotaManagerImpl::kNoLimit); } TEST_F(QuotaManagerImplTest, GetQuotaLowAvailableDiskSpace) { @@ -1610,10 +1480,11 @@ static_cast<int>(GetAvailableDiskSpaceForTest() - 65536); SetQuotaSettings(kPoolSize, kPerHostQuota, kMustRemainAvailable); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(100000, usage()); - EXPECT_EQ(kPerHostQuota, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 100000); + EXPECT_EQ(result.quota, kPerHostQuota); } TEST_F(QuotaManagerImplTest, GetSyncableQuota) { @@ -1634,10 +1505,11 @@ // storage, shall have their quota calculation take into account the amount of // available disk space. mock_special_storage_policy()->AddUnlimited(GURL("http://unlimited/")); - GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kSync); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); - EXPECT_EQ(QuotaManagerImpl::kSyncableStorageDefaultHostQuota, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://unlimited/"), kSync); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); + EXPECT_EQ(result.quota, QuotaManagerImpl::kSyncableStorageDefaultHostQuota); } TEST_F(QuotaManagerImplTest, GetPersistentUsageAndQuota_MultiStorageKeys) { @@ -1652,10 +1524,11 @@ blink::mojom::StorageType::kPersistent}); SetPersistentHostQuota("foo.com", 100); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10 + 20 + 13 + 19, usage()); - EXPECT_EQ(100, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10 + 20 + 13 + 19); + EXPECT_EQ(result.quota, 100); } TEST_F(QuotaManagerImplTest, GetPersistentUsage_WithModify) { @@ -1676,19 +1549,20 @@ GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10 + 20, usage()); - EXPECT_EQ(100, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10 + 20); + EXPECT_EQ(result.quota, 100); set_additional_callback_count(0); RunAdditionalUsageAndQuotaTask(ToStorageKey("http://foo.com/"), kPerm); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); RunAdditionalUsageAndQuotaTask(ToStorageKey("http://bar.com/"), kPerm); task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10 + 20, usage()); - EXPECT_EQ(2, additional_callback_count()); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10 + 20); + EXPECT_EQ(additional_callback_count(), 2); } TEST_F(QuotaManagerImplTest, GetPersistentUsageAndQuota_NukeManager) { @@ -1733,13 +1607,13 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetGlobalUsage(kPerm); - EXPECT_EQ(usage(), 1 + 20 + 600000); - EXPECT_EQ(0, unlimited_usage()); + auto global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 1 + 20 + 600000); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); - GetGlobalUsage(kTemp); - EXPECT_EQ(usage(), 300 + 4000 + 50000 + 7000000); - EXPECT_EQ(0, unlimited_usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(300 + 4000 + 50000 + 7000000, global_usage_result.usage); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); GetHostUsageWithBreakdown("foo.com", kPerm); EXPECT_EQ(usage(), 1 + 20); @@ -1761,26 +1635,26 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetGlobalUsage(kPerm); - EXPECT_EQ(usage(), 1 + 20 + 600000); - EXPECT_EQ(0, unlimited_usage()); + auto global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 1 + 20 + 600000); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); client->ModifyStorageKeyAndNotify(ToStorageKey("http://foo.com/"), kPerm, 80000000); - GetGlobalUsage(kPerm); - EXPECT_EQ(usage(), 1 + 20 + 600000 + 80000000); - EXPECT_EQ(0, unlimited_usage()); + global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 1 + 20 + 600000 + 80000000); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); - GetGlobalUsage(kTemp); - EXPECT_EQ(usage(), 300 + 4000 + 50000 + 7000000); - EXPECT_EQ(0, unlimited_usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 300 + 4000 + 50000 + 7000000); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); client->ModifyStorageKeyAndNotify(ToStorageKey("http://foo.com/"), kTemp, 1); - GetGlobalUsage(kTemp); - EXPECT_EQ(usage(), 300 + 4000 + 50000 + 7000000 + 1); - EXPECT_EQ(0, unlimited_usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 300 + 4000 + 50000 + 7000000 + 1); + EXPECT_EQ(global_usage_result.unlimited_usage, 0); GetHostUsageWithBreakdown("buz.com", kTemp); EXPECT_EQ(usage(), 4000 + 50000); @@ -1804,8 +1678,8 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetGlobalUsage(kTemp); - int64_t predelete_global_tmp = usage(); + auto global_usage_result = GetGlobalUsage(kTemp); + int64_t predelete_global_tmp = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kTemp); int64_t predelete_host_tmp = usage(); @@ -1813,12 +1687,13 @@ GetHostUsageWithBreakdown("foo.com", kPerm); int64_t predelete_host_pers = usage(); - DeleteClientStorageKeyData(client, ToStorageKey("http://foo.com/"), kTemp); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kOk, status()); + base::test::TestFuture<QuotaStatusCode> future; + client->DeleteStorageKeyData(ToStorageKey("http://foo.com/"), kTemp, + future.GetCallback()); + EXPECT_EQ(future.Get(), QuotaStatusCode::kOk); - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp - 1, usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, predelete_global_tmp - 1); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_host_tmp - 1, usage()); @@ -1828,10 +1703,9 @@ } TEST_F(QuotaManagerImplTest, GetStorageCapacity) { - GetStorageCapacity(); - task_environment_.RunUntilIdle(); - EXPECT_LE(0, total_space()); - EXPECT_LE(0, available_space()); + auto storage_capacity = GetStorageCapacity(); + EXPECT_GE(storage_capacity.total_space, 0); + EXPECT_GE(storage_capacity.available_space, 0); } TEST_F(QuotaManagerImplTest, EvictBucketData) { @@ -1853,8 +1727,8 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetGlobalUsage(kTemp); - int64_t predelete_global_tmp = usage(); + auto global_usage_result = GetGlobalUsage(kTemp); + int64_t predelete_global_tmp = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kTemp); int64_t predelete_host_tmp = usage(); @@ -1872,24 +1746,22 @@ } task_environment_.RunUntilIdle(); - GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); + auto bucket = + GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kTemp); + ASSERT_TRUE(bucket.ok()); - EvictBucketData(bucket_->ToBucketLocator()); - task_environment_.RunUntilIdle(); + ASSERT_EQ(EvictBucketData(bucket->ToBucketLocator()), QuotaStatusCode::kOk); - DumpBucketTable(); - task_environment_.RunUntilIdle(); - - for (const auto& entry : bucket_entries()) { + const BucketTableEntries& entries = DumpBucketTable(); + for (const auto& entry : entries) { if (entry.type == kTemp) { EXPECT_NE(std::string("http://foo.com/"), entry.storage_key.origin().GetURL().spec()); } } - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp - (1 + 50000), usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(predelete_global_tmp - (1 + 50000), global_usage_result.usage); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_host_tmp - (1 + 50000), usage()); @@ -1902,8 +1774,8 @@ static const MockStorageKeyData kData[] = {{"http://foo.com/", kTemp, 100}}; CreateAndRegisterClient(kData, QuotaClientType::kFileSystem, {kTemp}); - GetGlobalUsage(kTemp); - int64_t predelete_global_tmp = usage(); + auto global_usage_result = GetGlobalUsage(kTemp); + int64_t predelete_global_tmp = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kTemp); int64_t predelete_host_tmp = usage(); @@ -1913,42 +1785,33 @@ base::Time::Now()); task_environment_.RunUntilIdle(); - CreateBucketForTesting(storage_key, "foo_bucket", kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo created_bucket = bucket_.value(); + auto bucket = CreateBucketForTesting(storage_key, "foo_bucket", kTemp); + ASSERT_TRUE(bucket.ok()); + BucketInfo created_bucket = bucket.value(); - EvictBucketData(created_bucket.ToBucketLocator()); - task_environment_.RunUntilIdle(); + ASSERT_EQ(EvictBucketData(bucket->ToBucketLocator()), QuotaStatusCode::kOk); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - - DumpBucketTable(); - task_environment_.RunUntilIdle(); - - for (const auto& entry : bucket_entries()) { + const BucketTableEntries& entries = DumpBucketTable(); + for (const auto& entry : entries) { if (entry.type == kTemp) EXPECT_NE(created_bucket.id, entry.bucket_id); } // Evicting non-default bucket should not change usage. - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp, usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(predelete_global_tmp, global_usage_result.usage); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_host_tmp, usage()); - GetBucket(storage_key, kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo default_bucket = bucket_.value(); + bucket = GetBucket(storage_key, kDefaultBucketName, kTemp); + ASSERT_TRUE(bucket.ok()); - EvictBucketData(default_bucket.ToBucketLocator()); - task_environment_.RunUntilIdle(); - - EXPECT_EQ(QuotaStatusCode::kOk, status()); + ASSERT_EQ(EvictBucketData(bucket->ToBucketLocator()), QuotaStatusCode::kOk); // Evicting default bucket should remove usage. - GetGlobalUsage(kTemp); - EXPECT_EQ(usage(), 0); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 0); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(usage(), 0); @@ -1966,11 +1829,11 @@ GetGlobalUsage(kTemp); - GetBucket(ToStorageKey("http://foo.com"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); + auto bucket = + GetBucket(ToStorageKey("http://foo.com"), kDefaultBucketName, kTemp); + ASSERT_TRUE(bucket.ok()); - EvictBucketData(bucket_->ToBucketLocator()); - task_environment_.RunUntilIdle(); + ASSERT_EQ(EvictBucketData(bucket->ToBucketLocator()), QuotaStatusCode::kOk); // Ensure use count and time since access are recorded. histograms.ExpectTotalCount( @@ -1987,11 +1850,10 @@ GetGlobalUsage(kTemp); - GetBucket(ToStorageKey("http://bar.com"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); + bucket = GetBucket(ToStorageKey("http://bar.com"), kDefaultBucketName, kTemp); + ASSERT_TRUE(bucket.ok()); - EvictBucketData(bucket_->ToBucketLocator()); - task_environment_.RunUntilIdle(); + ASSERT_EQ(EvictBucketData(bucket->ToBucketLocator()), QuotaStatusCode::kOk); // The new use count should be logged. histograms.ExpectTotalCount( @@ -2015,8 +1877,8 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetGlobalUsage(kTemp); - EXPECT_EQ((1 + 20 + 4000), usage()); + auto global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, (1 + 20 + 4000)); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ((1 + 20), usage()); @@ -2030,21 +1892,19 @@ client->AddStorageKeyToErrorSet(ToStorageKey("http://foo.com/"), kTemp); - GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); + auto bucket = + GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kTemp); + ASSERT_TRUE(bucket.ok()); for (int i = 0; i < QuotaManagerImpl::kThresholdOfErrorsToBeDenylisted + 1; ++i) { - EvictBucketData(bucket_->ToBucketLocator()); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kErrorInvalidModification, status()); + ASSERT_EQ(EvictBucketData(bucket->ToBucketLocator()), + QuotaStatusCode::kErrorInvalidModification); } - DumpBucketTable(); - task_environment_.RunUntilIdle(); - + const BucketTableEntries& entries = DumpBucketTable(); bool found_storage_key_in_database = false; - for (const auto& entry : bucket_entries()) { + for (const auto& entry : entries) { if (entry.type == kTemp && entry.name == kDefaultBucketName && entry.storage_key == ToStorageKey("http://foo.com/")) { found_storage_key_in_database = true; @@ -2069,8 +1929,8 @@ task_environment_.RunUntilIdle(); EXPECT_FALSE(eviction_bucket().has_value()); - GetGlobalUsage(kTemp); - EXPECT_EQ(1, usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 1); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(1, usage()); @@ -2105,9 +1965,8 @@ } TEST_F(QuotaManagerImplTest, DeleteHostDataNoClients) { - DeleteHostData(std::string(), kTemp, AllQuotaClientTypes()); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kOk, status()); + EXPECT_EQ(DeleteHostData(std::string(), kTemp, AllQuotaClientTypes()), + QuotaStatusCode::kOk); } TEST_F(QuotaManagerImplTest, DeleteHostDataSimple) { @@ -2118,8 +1977,8 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetGlobalUsage(kTemp); - const int64_t predelete_global_tmp = usage(); + auto global_usage_result = GetGlobalUsage(kTemp); + const int64_t predelete_global_tmp = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kTemp); int64_t predelete_host_tmp = usage(); @@ -2127,12 +1986,11 @@ GetHostUsageWithBreakdown("foo.com", kPerm); int64_t predelete_host_pers = usage(); - DeleteHostData(std::string(), kTemp, AllQuotaClientTypes()); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kOk, status()); + EXPECT_EQ(DeleteHostData(std::string(), kTemp, AllQuotaClientTypes()), + QuotaStatusCode::kOk); - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp, usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, predelete_global_tmp); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_host_tmp, usage()); @@ -2140,12 +1998,11 @@ GetHostUsageWithBreakdown("foo.com", kPerm); EXPECT_EQ(predelete_host_pers, usage()); - DeleteHostData("foo.com", kTemp, AllQuotaClientTypes()); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kOk, status()); + EXPECT_EQ(DeleteHostData("foo.com", kTemp, AllQuotaClientTypes()), + QuotaStatusCode::kOk); - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp - 1, usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(predelete_global_tmp - 1, global_usage_result.usage); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_host_tmp - 1, usage()); @@ -2173,8 +2030,8 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetGlobalUsage(kTemp); - const int64_t predelete_global_tmp = usage(); + auto global_usage_result = GetGlobalUsage(kTemp); + const int64_t predelete_global_tmp = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kTemp); const int64_t predelete_foo_tmp = usage(); @@ -2188,18 +2045,15 @@ GetHostUsageWithBreakdown("bar.com", kPerm); const int64_t predelete_bar_pers = usage(); - reset_status_callback_count(); - DeleteHostData("foo.com", kTemp, AllQuotaClientTypes()); - DeleteHostData("bar.com", kTemp, AllQuotaClientTypes()); - DeleteHostData("foo.com", kTemp, AllQuotaClientTypes()); - task_environment_.RunUntilIdle(); + EXPECT_EQ(DeleteHostData("foo.com", kTemp, AllQuotaClientTypes()), + QuotaStatusCode::kOk); + EXPECT_EQ(DeleteHostData("bar.com", kTemp, AllQuotaClientTypes()), + QuotaStatusCode::kOk); + EXPECT_EQ(DeleteHostData("foo.com", kTemp, AllQuotaClientTypes()), + QuotaStatusCode::kOk); - EXPECT_EQ(3, status_callback_count()); - - DumpBucketTable(); - task_environment_.RunUntilIdle(); - - for (const auto& entry : bucket_entries()) { + const BucketTableEntries& entries = DumpBucketTable(); + for (const auto& entry : entries) { if (entry.type != kTemp) continue; @@ -2213,9 +2067,9 @@ entry.storage_key.origin().GetURL().spec()); } - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp - (1 + 20 + 4000 + 50000 + 6000 + 80 + 9), - usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, + predelete_global_tmp - (1 + 20 + 4000 + 50000 + 6000 + 80 + 9)); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - (1 + 20 + 50000 + 6000 + 80), usage()); @@ -2249,8 +2103,8 @@ CreateAndRegisterClient(kData2, QuotaClientType::kDatabase, {blink::mojom::StorageType::kTemporary}); - GetGlobalUsage(kTemp); - const int64_t predelete_global_tmp = usage(); + auto global_usage_result = GetGlobalUsage(kTemp); + const int64_t predelete_global_tmp = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kTemp); const int64_t predelete_foo_tmp = usage(); @@ -2258,8 +2112,8 @@ GetHostUsageWithBreakdown("bar.com", kTemp); const int64_t predelete_bar_tmp = usage(); - GetGlobalUsage(kPerm); - EXPECT_EQ((1000 + 10 + 1), usage()); + global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, (1000 + 10 + 1)); GetHostUsageWithBreakdown("foo.com", kPerm); EXPECT_EQ((10 + 1), usage()); @@ -2267,17 +2121,13 @@ GetHostUsageWithBreakdown("bar.com", kPerm); EXPECT_EQ(1000, usage()); - reset_status_callback_count(); - DeleteHostData("foo.com", kPerm, AllQuotaClientTypes()); - DeleteHostData("bar.com", kPerm, AllQuotaClientTypes()); - task_environment_.RunUntilIdle(); + EXPECT_EQ(DeleteHostData("foo.com", kPerm, AllQuotaClientTypes()), + QuotaStatusCode::kOk); + EXPECT_EQ(DeleteHostData("bar.com", kPerm, AllQuotaClientTypes()), + QuotaStatusCode::kOk); - EXPECT_EQ(2, status_callback_count()); - - DumpBucketTable(); - task_environment_.RunUntilIdle(); - - for (const auto& entry : bucket_entries()) { + const BucketTableEntries& entries = DumpBucketTable(); + for (const auto& entry : entries) { if (entry.type != kPerm) continue; @@ -2291,8 +2141,8 @@ entry.storage_key.origin().GetURL().spec()); } - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp, usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, predelete_global_tmp); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp, usage()); @@ -2300,8 +2150,8 @@ GetHostUsageWithBreakdown("bar.com", kTemp); EXPECT_EQ(predelete_bar_tmp, usage()); - GetGlobalUsage(kPerm); - EXPECT_EQ(0, usage()); + global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, 0); GetHostUsageWithBreakdown("foo.com", kPerm); EXPECT_EQ(0, usage()); @@ -2311,13 +2161,12 @@ } TEST_F(QuotaManagerImplTest, DeleteBucketNoClients) { - CreateBucketForTesting(ToStorageKey("http://foo.com"), kDefaultBucketName, - kTemp); - ASSERT_TRUE(bucket_.ok()); + auto bucket = CreateBucketForTesting(ToStorageKey("http://foo.com"), + kDefaultBucketName, kTemp); + ASSERT_TRUE(bucket.ok()); - DeleteBucketData(bucket_->ToBucketLocator(), AllQuotaClientTypes()); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kOk, status()); + EXPECT_EQ(DeleteBucketData(bucket->ToBucketLocator(), AllQuotaClientTypes()), + QuotaStatusCode::kOk); } TEST_F(QuotaManagerImplTest, DeleteBucketDataMultiple) { @@ -2339,16 +2188,16 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetBucket(ToStorageKey("http://foo.com"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo foo_temp_bucket = bucket_.value(); + auto foo_temp_bucket = + GetBucket(ToStorageKey("http://foo.com"), kDefaultBucketName, kTemp); + ASSERT_TRUE(foo_temp_bucket.ok()); - GetBucket(ToStorageKey("http://bar.com"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo bar_temp_bucket = bucket_.value(); + auto bar_temp_bucket = + GetBucket(ToStorageKey("http://bar.com"), kDefaultBucketName, kTemp); + ASSERT_TRUE(bar_temp_bucket.ok()); - GetGlobalUsage(kTemp); - const int64_t predelete_global_tmp = usage(); + auto global_usage_result = GetGlobalUsage(kTemp); + const int64_t predelete_global_tmp = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kTemp); const int64_t predelete_foo_tmp = usage(); @@ -2372,18 +2221,18 @@ } task_environment_.RunUntilIdle(); - reset_status_callback_count(); - DeleteBucketData(foo_temp_bucket.ToBucketLocator(), AllQuotaClientTypes()); - DeleteBucketData(bar_temp_bucket.ToBucketLocator(), AllQuotaClientTypes()); - DeleteBucketData(foo_temp_bucket.ToBucketLocator(), AllQuotaClientTypes()); - task_environment_.RunUntilIdle(); + EXPECT_EQ(DeleteBucketData(foo_temp_bucket->ToBucketLocator(), + AllQuotaClientTypes()), + QuotaStatusCode::kOk); + EXPECT_EQ(DeleteBucketData(bar_temp_bucket->ToBucketLocator(), + AllQuotaClientTypes()), + QuotaStatusCode::kOk); + EXPECT_EQ(DeleteBucketData(foo_temp_bucket->ToBucketLocator(), + AllQuotaClientTypes()), + QuotaStatusCode::kOk); - EXPECT_EQ(3, status_callback_count()); - - DumpBucketTable(); - task_environment_.RunUntilIdle(); - - for (const auto& entry : bucket_entries()) { + const BucketTableEntries& entries = DumpBucketTable(); + for (const auto& entry : entries) { if (entry.type != kTemp) continue; @@ -2393,8 +2242,9 @@ entry.storage_key.origin().GetURL().spec()); } - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp - (1 + 4000 + 50000 + 9), usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, + predelete_global_tmp - (1 + 4000 + 50000 + 9)); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - (1 + 50000), usage()); @@ -2428,16 +2278,16 @@ CreateAndRegisterClient(kData2, QuotaClientType::kDatabase, {blink::mojom::StorageType::kTemporary}); - GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kPerm); - ASSERT_TRUE(bucket_.ok()); - BucketInfo foo_perm_bucket = bucket_.value(); + auto foo_perm_bucket = + GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kPerm); + ASSERT_TRUE(foo_perm_bucket.ok()); - GetBucket(ToStorageKey("http://bar.com/"), kDefaultBucketName, kPerm); - ASSERT_TRUE(bucket_.ok()); - BucketInfo bar_perm_bucket = bucket_.value(); + auto bar_perm_bucket = + GetBucket(ToStorageKey("http://bar.com/"), kDefaultBucketName, kPerm); + ASSERT_TRUE(bar_perm_bucket.ok()); - GetGlobalUsage(kTemp); - const int64_t predelete_global_tmp = usage(); + auto global_usage_result = GetGlobalUsage(kTemp); + const int64_t predelete_global_tmp = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kTemp); const int64_t predelete_foo_tmp = usage(); @@ -2445,8 +2295,8 @@ GetHostUsageWithBreakdown("bar.com", kTemp); const int64_t predelete_bar_tmp = usage(); - GetGlobalUsage(kPerm); - const int64_t predelete_global_pers = usage(); + global_usage_result = GetGlobalUsage(kPerm); + const int64_t predelete_global_pers = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kPerm); const int64_t predelete_foo_pers = usage(); @@ -2464,17 +2314,15 @@ } task_environment_.RunUntilIdle(); - reset_status_callback_count(); - DeleteBucketData(foo_perm_bucket.ToBucketLocator(), AllQuotaClientTypes()); - DeleteBucketData(bar_perm_bucket.ToBucketLocator(), AllQuotaClientTypes()); - task_environment_.RunUntilIdle(); + EXPECT_EQ(DeleteBucketData(foo_perm_bucket->ToBucketLocator(), + AllQuotaClientTypes()), + QuotaStatusCode::kOk); + EXPECT_EQ(DeleteBucketData(bar_perm_bucket->ToBucketLocator(), + AllQuotaClientTypes()), + QuotaStatusCode::kOk); - EXPECT_EQ(2, status_callback_count()); - - DumpBucketTable(); - task_environment_.RunUntilIdle(); - - for (const auto& entry : bucket_entries()) { + const BucketTableEntries& entries = DumpBucketTable(); + for (const auto& entry : entries) { if (entry.type != kPerm) continue; @@ -2484,8 +2332,8 @@ entry.storage_key.origin().GetURL().spec()); } - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp, usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, predelete_global_tmp); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp, usage()); @@ -2493,8 +2341,8 @@ GetHostUsageWithBreakdown("bar.com", kTemp); EXPECT_EQ(predelete_bar_tmp, usage()); - GetGlobalUsage(kPerm); - EXPECT_EQ(predelete_global_pers - (1 + 1000), usage()); + global_usage_result = GetGlobalUsage(kPerm); + EXPECT_EQ(global_usage_result.usage, predelete_global_pers - (1 + 1000)); GetHostUsageWithBreakdown("foo.com", kPerm); EXPECT_EQ(predelete_foo_pers - 1, usage()); @@ -2519,18 +2367,18 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetBucket(ToStorageKey("http://foo.com"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo foo_bucket = bucket_.value(); + auto foo_bucket = + GetBucket(ToStorageKey("http://foo.com"), kDefaultBucketName, kTemp); + ASSERT_TRUE(foo_bucket.ok()); - GetBucket(ToStorageKey("http://bar.com"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo bar_bucket = bucket_.value(); + auto bar_bucket = + GetBucket(ToStorageKey("http://bar.com"), kDefaultBucketName, kTemp); + ASSERT_TRUE(bar_bucket.ok()); // Check usage data before deletion. - GetGlobalUsage(kTemp); - const int64_t predelete_global_tmp = usage(); - ASSERT_EQ((1 + 9 + 4000 + 50000), usage()); + auto global_usage_result = GetGlobalUsage(kTemp); + ASSERT_EQ((1 + 9 + 4000 + 50000), global_usage_result.usage); + const int64_t predelete_global_tmp = global_usage_result.usage; GetHostUsageWithBreakdown("foo.com", kTemp); ASSERT_EQ((1 + 50000), usage()); @@ -2539,31 +2387,31 @@ ASSERT_EQ((9 + 4000), usage()); // Delete bucket for "http://foo.com/". - reset_status_callback_count(); - FindAndDeleteBucketData(foo_bucket.storage_key, foo_bucket.name); - EXPECT_EQ(1, status_callback_count()); + EXPECT_EQ(FindAndDeleteBucketData(foo_bucket->storage_key, foo_bucket->name), + QuotaStatusCode::kOk); - GetBucket(foo_bucket.storage_key, foo_bucket.name, foo_bucket.type); - ASSERT_FALSE(bucket_.ok()); - EXPECT_EQ(bucket_.error(), QuotaError::kNotFound); + auto bucket = + GetBucket(foo_bucket->storage_key, foo_bucket->name, foo_bucket->type); + ASSERT_FALSE(bucket.ok()); + EXPECT_EQ(bucket.error(), QuotaError::kNotFound); - GetGlobalUsage(kTemp); - EXPECT_EQ(predelete_global_tmp - (1 + 50000), usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, predelete_global_tmp - (1 + 50000)); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(0, usage()); // Delete bucket for "http://bar.com/". - reset_status_callback_count(); - FindAndDeleteBucketData(bar_bucket.storage_key, bar_bucket.name); - EXPECT_EQ(1, status_callback_count()); + EXPECT_EQ(FindAndDeleteBucketData(bar_bucket->storage_key, bar_bucket->name), + QuotaStatusCode::kOk); - GetBucket(bar_bucket.storage_key, bar_bucket.name, bar_bucket.type); - ASSERT_FALSE(bucket_.ok()); - EXPECT_EQ(bucket_.error(), QuotaError::kNotFound); + bucket = + GetBucket(bar_bucket->storage_key, bar_bucket->name, bar_bucket->type); + ASSERT_FALSE(bucket.ok()); + EXPECT_EQ(bucket.error(), QuotaError::kNotFound); - GetGlobalUsage(kTemp); - EXPECT_EQ(0, usage()); + global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 0); GetHostUsageWithBreakdown("bar.com", kTemp); EXPECT_EQ(0, usage()); @@ -2582,10 +2430,10 @@ MockQuotaDatabase* mock_database = quota_db.get(); SetQuotaDatabase(std::move(quota_db)); - CreateBucketForTesting(ToStorageKey("http://foo.com"), kDefaultBucketName, - kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo foo_bucket = bucket_.value(); + auto bucket = CreateBucketForTesting(ToStorageKey("http://foo.com"), + kDefaultBucketName, kTemp); + ASSERT_TRUE(bucket.ok()); + BucketInfo foo_bucket = bucket.value(); // Check usage data before deletion. GetHostUsageWithBreakdown("foo.com", kTemp); @@ -2595,16 +2443,12 @@ .Times(1) .WillOnce(testing::Return(QuotaError::kDatabaseError)); - // Try to delete bucket for "http://foo.com/". - reset_status_callback_count(); - FindAndDeleteBucketData(foo_bucket.storage_key, foo_bucket.name); + // Trying to delete bucket for "http://foo.com/" should return error. + EXPECT_EQ(FindAndDeleteBucketData(foo_bucket.storage_key, foo_bucket.name), + QuotaStatusCode::kErrorInvalidModification); - // Should return error if database deletion failed. - EXPECT_EQ(1, status_callback_count()); - EXPECT_EQ(QuotaStatusCode::kErrorInvalidModification, status()); - - GetGlobalUsage(kTemp); - EXPECT_EQ(0, usage()); + auto global_usage_result = GetGlobalUsage(kTemp); + EXPECT_EQ(global_usage_result.usage, 0); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(0, usage()); @@ -2649,18 +2493,19 @@ StorageKey storage_key_b = ToStorageKey("http://b.com/"); StorageKey storage_key_c = ToStorageKey("http://c.com/"); - CreateBucketForTesting(storage_key_a, kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo bucket_a = bucket_.value(); + auto bucket = + CreateBucketForTesting(storage_key_a, kDefaultBucketName, kTemp); + ASSERT_TRUE(bucket.ok()); + BucketInfo bucket_a = bucket.value(); - CreateBucketForTesting(storage_key_b, kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo bucket_b = bucket_.value(); + bucket = CreateBucketForTesting(storage_key_b, kDefaultBucketName, kTemp); + ASSERT_TRUE(bucket.ok()); + BucketInfo bucket_b = bucket.value(); // Persistent bucket. - CreateBucketForTesting(storage_key_c, kDefaultBucketName, kPerm); - ASSERT_TRUE(bucket_.ok()); - BucketInfo bucket_c = bucket_.value(); + bucket = CreateBucketForTesting(storage_key_c, kDefaultBucketName, kPerm); + ASSERT_TRUE(bucket.ok()); + BucketInfo bucket_c = bucket.value(); NotifyBucketAccessed(bucket_a.id); NotifyBucketAccessed(bucket_b.id); @@ -2696,9 +2541,9 @@ {blink::mojom::StorageType::kTemporary, blink::mojom::StorageType::kPersistent}); - GetBucketsModifiedBetween(kTemp, base::Time(), base::Time::Max()); - EXPECT_EQ(4U, modified_buckets().size()); - EXPECT_EQ(modified_buckets_type(), kTemp); + auto buckets = + GetBucketsModifiedBetween(kTemp, base::Time(), base::Time::Max()); + EXPECT_EQ(4U, buckets.size()); base::Time time1 = client->IncrementMockTime(); client->ModifyStorageKeyAndNotify(ToStorageKey("http://a.com/"), kTemp, 10); @@ -2709,33 +2554,29 @@ client->ModifyStorageKeyAndNotify(ToStorageKey("http://c.com/"), kTemp, 10); base::Time time3 = client->IncrementMockTime(); - GetBucketsModifiedBetween(kTemp, time1, base::Time::Max()); - EXPECT_EQ(modified_buckets_type(), kTemp); - EXPECT_THAT(modified_buckets(), - testing::UnorderedElementsAre( - testing::Field(&BucketLocator::storage_key, - ToStorageKey("http://a.com")), - testing::Field(&BucketLocator::storage_key, - ToStorageKey("http://a.com:1")), - testing::Field(&BucketLocator::storage_key, - ToStorageKey("https://a.com")), - testing::Field(&BucketLocator::storage_key, - ToStorageKey("http://c.com")))); + buckets = GetBucketsModifiedBetween(kTemp, time1, base::Time::Max()); + EXPECT_THAT(buckets, testing::UnorderedElementsAre( + testing::Field(&BucketLocator::storage_key, + ToStorageKey("http://a.com")), + testing::Field(&BucketLocator::storage_key, + ToStorageKey("http://a.com:1")), + testing::Field(&BucketLocator::storage_key, + ToStorageKey("https://a.com")), + testing::Field(&BucketLocator::storage_key, + ToStorageKey("http://c.com")))); - GetBucketsModifiedBetween(kTemp, time2, base::Time::Max()); - EXPECT_EQ(2U, modified_buckets().size()); + buckets = GetBucketsModifiedBetween(kTemp, time2, base::Time::Max()); + EXPECT_EQ(2U, buckets.size()); - GetBucketsModifiedBetween(kTemp, time3, base::Time::Max()); - EXPECT_TRUE(modified_buckets().empty()); - EXPECT_EQ(modified_buckets_type(), kTemp); + buckets = GetBucketsModifiedBetween(kTemp, time3, base::Time::Max()); + EXPECT_TRUE(buckets.empty()); client->ModifyStorageKeyAndNotify(ToStorageKey("http://a.com/"), kTemp, 10); - GetBucketsModifiedBetween(kTemp, time3, base::Time::Max()); - EXPECT_THAT(modified_buckets(), + buckets = GetBucketsModifiedBetween(kTemp, time3, base::Time::Max()); + EXPECT_THAT(buckets, testing::UnorderedElementsAre(testing::Field( &BucketLocator::storage_key, ToStorageKey("http://a.com/")))); - EXPECT_EQ(modified_buckets_type(), kTemp); } TEST_F(QuotaManagerImplTest, GetBucketsModifiedBetweenWithDatabaseError) { @@ -2745,11 +2586,11 @@ // Disable quota database for database error behavior. disable_quota_database(true); - GetBucketsModifiedBetween(kTemp, base::Time(), base::Time::Max()); + auto buckets = + GetBucketsModifiedBetween(kTemp, base::Time(), base::Time::Max()); // Return empty set when error is encountered. - EXPECT_TRUE(modified_buckets().empty()); - EXPECT_EQ(modified_buckets_type(), kTemp); + EXPECT_TRUE(buckets.empty()); } TEST_F(QuotaManagerImplTest, DumpQuotaTable) { @@ -2758,11 +2599,9 @@ SetPersistentHostQuota("example3.com", 300); task_environment_.RunUntilIdle(); - DumpQuotaTable(); - task_environment_.RunUntilIdle(); - + const QuotaTableEntries& entries = DumpQuotaTable(); EXPECT_THAT( - quota_entries(), + entries, testing::UnorderedElementsAre( QuotaTableEntry{.host = "example1.com", .type = kPerm, .quota = 1}, QuotaTableEntry{.host = "example2.com", .type = kPerm, .quota = 20}, @@ -2783,24 +2622,19 @@ base::Time::Now()); task_environment_.RunUntilIdle(); - DumpBucketTable(); - task_environment_.RunUntilIdle(); - - EXPECT_THAT(bucket_entries(), - testing::UnorderedElementsAre( - MatchesBucketTableEntry(kStorageKey, kTemp, 1), - MatchesBucketTableEntry(kStorageKey, kPerm, 2))); + const BucketTableEntries& entries = DumpBucketTable(); + EXPECT_THAT(entries, testing::UnorderedElementsAre( + MatchesBucketTableEntry(kStorageKey, kTemp, 1), + MatchesBucketTableEntry(kStorageKey, kPerm, 2))); } TEST_F(QuotaManagerImplTest, QuotaForEmptyHost) { - GetPersistentHostQuota(std::string()); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, quota()); + EXPECT_EQ(GetPersistentHostQuota(std::string()), 0); - SetPersistentHostQuota(std::string(), 10); - task_environment_.RunUntilIdle(); - EXPECT_EQ(QuotaStatusCode::kErrorNotSupported, status()); + base::test::TestFuture<QuotaStatusCode, int64_t> future; + quota_manager_impl()->SetPersistentHostQuota(std::string(), 10, + future.GetCallback()); + EXPECT_EQ(future.Get<0>(), QuotaStatusCode::kErrorNotSupported); } TEST_F(QuotaManagerImplTest, DeleteSpecificClientTypeSingleBucket) { @@ -2825,28 +2659,28 @@ CreateAndRegisterClient(kData4, QuotaClientType::kIndexedDatabase, {blink::mojom::StorageType::kTemporary}); - GetBucket(ToStorageKey("http://foo.com"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo foo_bucket = bucket_.value(); + auto foo_bucket = + GetBucket(ToStorageKey("http://foo.com"), kDefaultBucketName, kTemp); + ASSERT_TRUE(foo_bucket.ok()); GetHostUsageWithBreakdown("foo.com", kTemp); const int64_t predelete_foo_tmp = usage(); - DeleteBucketData(foo_bucket.ToBucketLocator(), + DeleteBucketData(foo_bucket->ToBucketLocator(), {QuotaClientType::kFileSystem}); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 1, usage()); - DeleteBucketData(foo_bucket.ToBucketLocator(), + DeleteBucketData(foo_bucket->ToBucketLocator(), {QuotaClientType::kServiceWorkerCache}); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); - DeleteBucketData(foo_bucket.ToBucketLocator(), {QuotaClientType::kDatabase}); + DeleteBucketData(foo_bucket->ToBucketLocator(), {QuotaClientType::kDatabase}); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 4 - 2 - 1, usage()); - DeleteBucketData(foo_bucket.ToBucketLocator(), + DeleteBucketData(foo_bucket->ToBucketLocator(), {QuotaClientType::kIndexedDatabase}); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); @@ -2877,23 +2711,25 @@ GetHostUsageWithBreakdown("foo.com", kTemp); const int64_t predelete_foo_tmp = usage(); - DeleteHostData("foo.com", kTemp, {QuotaClientType::kFileSystem}); - task_environment_.RunUntilIdle(); + EXPECT_EQ(DeleteHostData("foo.com", kTemp, {QuotaClientType::kFileSystem}), + QuotaStatusCode::kOk); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 1, usage()); - DeleteHostData("foo.com", kTemp, {QuotaClientType::kServiceWorkerCache}); - task_environment_.RunUntilIdle(); + EXPECT_EQ( + DeleteHostData("foo.com", kTemp, {QuotaClientType::kServiceWorkerCache}), + QuotaStatusCode::kOk); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); - DeleteHostData("foo.com", kTemp, {QuotaClientType::kDatabase}); - task_environment_.RunUntilIdle(); + EXPECT_EQ(DeleteHostData("foo.com", kTemp, {QuotaClientType::kDatabase}), + QuotaStatusCode::kOk); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 4 - 2 - 1, usage()); - DeleteHostData("foo.com", kTemp, {QuotaClientType::kIndexedDatabase}); - task_environment_.RunUntilIdle(); + EXPECT_EQ( + DeleteHostData("foo.com", kTemp, {QuotaClientType::kIndexedDatabase}), + QuotaStatusCode::kOk); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } @@ -2920,19 +2756,19 @@ CreateAndRegisterClient(kData4, QuotaClientType::kIndexedDatabase, {blink::mojom::StorageType::kTemporary}); - GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kTemp); - ASSERT_TRUE(bucket_.ok()); - BucketInfo foo_bucket = bucket_.value(); + auto foo_bucket = + GetBucket(ToStorageKey("http://foo.com/"), kDefaultBucketName, kTemp); + ASSERT_TRUE(foo_bucket.ok()); GetHostUsageWithBreakdown("foo.com", kTemp); const int64_t predelete_foo_tmp = usage(); - DeleteBucketData(foo_bucket.ToBucketLocator(), + DeleteBucketData(foo_bucket->ToBucketLocator(), {QuotaClientType::kFileSystem, QuotaClientType::kDatabase}); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 4 - 1, usage()); - DeleteBucketData(foo_bucket.ToBucketLocator(), + DeleteBucketData(foo_bucket->ToBucketLocator(), {QuotaClientType::kServiceWorkerCache, QuotaClientType::kIndexedDatabase}); GetHostUsageWithBreakdown("foo.com", kTemp); @@ -2964,17 +2800,17 @@ GetHostUsageWithBreakdown("foo.com", kTemp); const int64_t predelete_foo_tmp = usage(); - DeleteHostData( - "foo.com", kTemp, - {QuotaClientType::kFileSystem, QuotaClientType::kServiceWorkerCache}); - task_environment_.RunUntilIdle(); + EXPECT_EQ(DeleteHostData("foo.com", kTemp, + {QuotaClientType::kFileSystem, + QuotaClientType::kServiceWorkerCache}), + QuotaStatusCode::kOk); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 2 - 1, usage()); - DeleteHostData( - "foo.com", kTemp, - {QuotaClientType::kDatabase, QuotaClientType::kIndexedDatabase}); - task_environment_.RunUntilIdle(); + EXPECT_EQ(DeleteHostData("foo.com", kTemp, + {QuotaClientType::kDatabase, + QuotaClientType::kIndexedDatabase}), + QuotaStatusCode::kOk); GetHostUsageWithBreakdown("foo.com", kTemp); EXPECT_EQ(predelete_foo_tmp - 8 - 4 - 2 - 1, usage()); } @@ -2994,35 +2830,35 @@ GetGlobalUsage(kTemp); GetGlobalUsage(kPerm); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(80, usage()); - EXPECT_EQ(0, quota()); + auto result = + GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 80); + EXPECT_EQ(result.quota, 0); const int kPoolSize = 1000; const int kPerHostQuota = kPoolSize / 5; SetQuotaSettings(kPoolSize, kPerHostQuota, INT64_C(0)); - GetStorageCapacity(); - task_environment_.RunUntilIdle(); - EXPECT_EQ(kPoolSize, total_space()); - EXPECT_EQ(kPoolSize - 80 - 10, available_space()); + auto storage_capacity = GetStorageCapacity(); + EXPECT_EQ(storage_capacity.total_space, kPoolSize); + EXPECT_EQ(storage_capacity.available_space, kPoolSize - 80 - 10); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10, usage()); - EXPECT_LE(kPerHostQuota, quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10); + EXPECT_GE(result.quota, kPerHostQuota); mock_special_storage_policy()->AddUnlimited(GURL("http://foo.com/")); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(80, usage()); - EXPECT_EQ(available_space() + usage(), quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kPerm); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 80); + EXPECT_EQ(result.quota, storage_capacity.available_space + result.usage); - GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(10, usage()); - EXPECT_EQ(available_space() + usage(), quota()); + result = GetUsageAndQuotaForWebApps(ToStorageKey("http://foo.com/"), kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 10); + EXPECT_EQ(result.quota, storage_capacity.available_space + result.usage); } TEST_F(QuotaManagerImplTest, GetUsageAndQuota_SessionOnly) { @@ -3030,12 +2866,12 @@ mock_special_storage_policy()->AddSessionOnly( kEpheremalStorageKey.origin().GetURL()); - GetUsageAndQuotaForWebApps(kEpheremalStorageKey, kTemp); + auto result = GetUsageAndQuotaForWebApps(kEpheremalStorageKey, kTemp); EXPECT_EQ(quota_manager_impl()->settings().session_only_per_host_quota, - quota()); + result.quota); - GetUsageAndQuotaForWebApps(kEpheremalStorageKey, kPerm); - EXPECT_EQ(0, quota()); + result = GetUsageAndQuotaForWebApps(kEpheremalStorageKey, kPerm); + EXPECT_EQ(0, result.quota); } TEST_F(QuotaManagerImplTest, MaybeRunStoragePressureCallback) { @@ -3066,10 +2902,10 @@ base::BindLambdaForTesting([&]() { run_loop.Quit(); })); run_loop.Run(); - GetUsageAndQuotaForWebApps(storage_key, kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(0, usage()); - EXPECT_EQ(5000, quota()); + auto result = GetUsageAndQuotaForWebApps(storage_key, kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.usage, 0); + EXPECT_EQ(result.quota, 5000); } TEST_F(QuotaManagerImplTest, OverrideQuotaForStorageKey_Disable) { @@ -3083,9 +2919,9 @@ base::BindLambdaForTesting([&]() { run_loop1.Quit(); })); run_loop1.Run(); - GetUsageAndQuotaForWebApps(storage_key, kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(5000, quota()); + auto result = GetUsageAndQuotaForWebApps(storage_key, kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.quota, 5000); base::RunLoop run_loop2; handle2->OverrideQuotaForStorageKey( @@ -3093,9 +2929,9 @@ base::BindLambdaForTesting([&]() { run_loop2.Quit(); })); run_loop2.Run(); - GetUsageAndQuotaForWebApps(storage_key, kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(9000, quota()); + result = GetUsageAndQuotaForWebApps(storage_key, kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.quota, 9000); base::RunLoop run_loop3; handle2->OverrideQuotaForStorageKey( @@ -3103,9 +2939,9 @@ base::BindLambdaForTesting([&]() { run_loop3.Quit(); })); run_loop3.Run(); - GetUsageAndQuotaForWebApps(storage_key, kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(kDefaultPerHostQuota, quota()); + result = GetUsageAndQuotaForWebApps(storage_key, kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.quota, kDefaultPerHostQuota); } TEST_F(QuotaManagerImplTest, WithdrawQuotaOverride) { @@ -3119,9 +2955,9 @@ base::BindLambdaForTesting([&]() { run_loop1.Quit(); })); run_loop1.Run(); - GetUsageAndQuotaForWebApps(storage_key, kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(5000, quota()); + auto result = GetUsageAndQuotaForWebApps(storage_key, kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.quota, 5000); base::RunLoop run_loop2; handle1->OverrideQuotaForStorageKey( @@ -3129,22 +2965,22 @@ base::BindLambdaForTesting([&]() { run_loop2.Quit(); })); run_loop2.Run(); - GetUsageAndQuotaForWebApps(storage_key, kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(8000, quota()); + result = GetUsageAndQuotaForWebApps(storage_key, kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.quota, 8000); // Quota should remain overridden if only one of the two handles withdraws // it's overrides handle2.reset(); - GetUsageAndQuotaForWebApps(storage_key, kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(8000, quota()); + result = GetUsageAndQuotaForWebApps(storage_key, kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.quota, 8000); handle1.reset(); task_environment_.RunUntilIdle(); - GetUsageAndQuotaForWebApps(storage_key, kTemp); - EXPECT_EQ(QuotaStatusCode::kOk, status()); - EXPECT_EQ(kDefaultPerHostQuota, quota()); + result = GetUsageAndQuotaForWebApps(storage_key, kTemp); + EXPECT_EQ(result.status, QuotaStatusCode::kOk); + EXPECT_EQ(result.quota, kDefaultPerHostQuota); } TEST_F(QuotaManagerImplTest, QuotaChangeEvent_LargePartitionPressure) { @@ -3159,7 +2995,6 @@ return std::make_tuple(total, available); }); GetStorageCapacity(); - task_environment_.RunUntilIdle(); EXPECT_FALSE(quota_change_dispatched); SetGetVolumeInfoFn([](const base::FilePath&) -> std::tuple<int64_t, int64_t> { @@ -3168,7 +3003,6 @@ return std::make_tuple(total, available); }); GetStorageCapacity(); - task_environment_.RunUntilIdle(); EXPECT_TRUE(quota_change_dispatched); } @@ -3184,7 +3018,6 @@ return std::make_tuple(total, available); }); GetStorageCapacity(); - task_environment_.RunUntilIdle(); EXPECT_FALSE(quota_change_dispatched); SetGetVolumeInfoFn([](const base::FilePath&) -> std::tuple<int64_t, int64_t> { @@ -3196,7 +3029,6 @@ return std::make_tuple(total, available); }); GetStorageCapacity(); - task_environment_.RunUntilIdle(); EXPECT_TRUE(quota_change_dispatched); }
diff --git a/storage/browser/test/mock_quota_client.cc b/storage/browser/test/mock_quota_client.cc index 2dcafe8..cc01178 100644 --- a/storage/browser/test/mock_quota_client.cc +++ b/storage/browser/test/mock_quota_client.cc
@@ -36,18 +36,6 @@ MockQuotaClient::~MockQuotaClient() = default; -void MockQuotaClient::AddStorageKeyAndNotify( - const blink::StorageKey& storage_key, - blink::mojom::StorageType storage_type, - int64_t size) { - DCHECK(storage_key_data_.find({storage_key, storage_type}) == - storage_key_data_.end()); - DCHECK_GE(size, 0); - storage_key_data_[{storage_key, storage_type}] = size; - quota_manager_proxy_->NotifyStorageModified( - client_type_, storage_key, storage_type, size, IncrementMockTime()); -} - void MockQuotaClient::ModifyStorageKeyAndNotify( const blink::StorageKey& storage_key, blink::mojom::StorageType storage_type,
diff --git a/storage/browser/test/mock_quota_client.h b/storage/browser/test/mock_quota_client.h index 9b24fa97..8778c41 100644 --- a/storage/browser/test/mock_quota_client.h +++ b/storage/browser/test/mock_quota_client.h
@@ -45,10 +45,7 @@ ~MockQuotaClient() override; - // To add or modify mock data in this client. - void AddStorageKeyAndNotify(const blink::StorageKey& storage_key, - blink::mojom::StorageType type, - int64_t size); + // To modify mock data in this client. void ModifyStorageKeyAndNotify(const blink::StorageKey& storage_key, blink::mojom::StorageType type, int64_t delta);
diff --git a/testing/buildbot/chromium.clang.json b/testing/buildbot/chromium.clang.json index 9fd839e29..cf828daaa 100644 --- a/testing/buildbot/chromium.clang.json +++ b/testing/buildbot/chromium.clang.json
@@ -10025,39 +10025,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=web-engine-shell", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "fuchsia_telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "kvm": "1", - "os": "Ubuntu-16.04" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://content/test:fuchsia_telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=web-engine-shell",
diff --git a/testing/buildbot/chromium.fyi.json b/testing/buildbot/chromium.fyi.json index 3d3e635..63a9a712 100644 --- a/testing/buildbot/chromium.fyi.json +++ b/testing/buildbot/chromium.fyi.json
@@ -24413,39 +24413,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=web-engine-shell", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_fuchsia", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "kvm": "1", - "os": "Ubuntu-18.04" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_fuchsia/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=web-engine-shell", @@ -24910,40 +24877,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=fuchsia-chrome", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc", - "--custom-image=workstation.qemu-x64-release" - ], - "isolate_name": "telemetry_gpu_integration_test_fuchsia", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "kvm": "1", - "os": "Ubuntu-18.04" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_fuchsia/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=fuchsia-chrome",
diff --git a/testing/buildbot/chromium.gpu.fyi.json b/testing/buildbot/chromium.gpu.fyi.json index a0c364b..bc1c9f0 100644 --- a/testing/buildbot/chromium.gpu.fyi.json +++ b/testing/buildbot/chromium.gpu.fyi.json
@@ -974,50 +974,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_android_chrome", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "containment_type": "AUTO", - "dimension_sets": [ - { - "device_os": "N", - "device_os_type": "user", - "device_type": "foster", - "os": "Android", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=android-chromium", @@ -1626,50 +1582,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_android_chrome", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "containment_type": "AUTO", - "dimension_sets": [ - { - "device_os": "M", - "device_os_type": "userdebug", - "device_type": "hammerhead", - "os": "Android", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=android-chromium", @@ -2194,49 +2106,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_android_chrome", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "containment_type": "AUTO", - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_type": "userdebug", - "device_type": "bullhead", - "os": "Android" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=android-chromium", @@ -3049,50 +2918,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_android_chrome", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "containment_type": "AUTO", - "dimension_sets": [ - { - "device_os": "M", - "device_os_type": "userdebug", - "device_type": "flounder", - "os": "Android", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=android-chromium", @@ -3811,50 +3636,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_android_chrome", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "containment_type": "AUTO", - "dimension_sets": [ - { - "device_os": "R", - "device_os_type": "userdebug", - "device_type": "flame", - "os": "Android", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=android-chromium", @@ -4803,51 +4584,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_android_chrome", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "containment_type": "AUTO", - "dimension_sets": [ - { - "device_os": "S", - "device_os_type": "userdebug", - "device_type": "oriole", - "os": "Android", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=android-chromium", @@ -5796,57 +5532,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=cros-chrome", - "--passthrough", - "-v", - "--extra-browser-args=--log-level=0 --js-flags=--expose-gc", - "--remote=127.0.0.1", - "--remote-ssh-port=9222" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86", - "kvm": "1", - "os": "Ubuntu-18.04", - "pool": "chromium.tests" - } - ], - "idempotent": false, - "named_caches": [ - { - "name": "cros_vm", - "path": "magic_cros_vm_cache" - } - ], - "optional_dimensions": { - "60": [ - { - "caches": "cros_vm" - } - ] - }, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "context_lost", "--show-stdout", "--browser=cros-chrome", @@ -5898,57 +5583,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=cros-chrome", - "--passthrough", - "-v", - "--extra-browser-args=--log-level=0 --js-flags=--expose-gc --disable-features=UseSkiaRenderer", - "--remote=127.0.0.1", - "--remote-ssh-port=9222" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "gl_renderer_depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86", - "kvm": "1", - "os": "Ubuntu-18.04", - "pool": "chromium.tests" - } - ], - "idempotent": false, - "named_caches": [ - { - "name": "cros_vm", - "path": "magic_cros_vm_cache" - } - ], - "optional_dimensions": { - "60": [ - { - "caches": "cros_vm" - } - ] - }, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=cros-chrome", @@ -6911,46 +6545,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=cros-chrome", - "--passthrough", - "-v", - "--extra-browser-args=--log-level=0 --js-flags=--expose-gc", - "--remote=variable_chromeos_device_hostname" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "device_type": "kevin", - "os": "ChromeOS", - "pool": "chromium.tests" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/", - "trigger_script": { - "script": "//testing/trigger_scripts/chromeos_device_trigger.py" - } - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=cros-chrome", @@ -7512,45 +7106,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-features=UseOzonePlatform --ozone-platform=wayland", - "--xvfb", - "--no-xvfb", - "--use-weston", - "--weston-use-gl" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -8136,41 +7691,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=debug", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug", @@ -8671,42 +8191,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -9425,42 +8909,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "1002:7340", - "os": "Ubuntu", - "pool": "chromium.tests.gpu.experimental" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -10009,41 +9457,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -10617,42 +10030,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:3e92-20.0.8", - "os": "Ubuntu-18.04.5", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 7200, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -11201,41 +10578,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -11852,41 +11194,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-features=UseSkiaRenderer" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-19.0.2", - "os": "Ubuntu-19.04", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -12299,41 +11606,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc --enable-features=UseSkiaRenderer" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -12945,42 +12217,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "8086:3e9b", - "os": "Mac-11.5.2" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -13887,42 +13123,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=debug", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "8086:3e9b", - "os": "Mac-11.5.2" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug", @@ -14582,45 +13782,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-12.0|Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -15788,42 +14949,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "arm64", - "display_attached": "1", - "os": "Mac-11", - "pool": "chromium.tests" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -16892,42 +16017,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "8086:3e9b", - "os": "Mac-11.5.2" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -18020,44 +17109,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-11.4|Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -19054,44 +18105,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=debug", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-11.4|Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug", @@ -19848,44 +18861,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=debug", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "10de:0fe9", - "hidpi": "1", - "os": "Mac-10.14.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug", @@ -20497,44 +19472,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-11.4|Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -21665,44 +20602,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "10de:0fe9", - "hidpi": "1", - "os": "Mac-10.14.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -22633,44 +21532,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:679e", - "os": "Mac-10.12.6", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -23320,50 +22181,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_android_chrome", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "containment_type": "AUTO", - "dimension_sets": [ - { - "device_os": "R", - "device_os_type": "userdebug", - "device_type": "flame", - "os": "Android", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=android-chromium", @@ -24825,42 +23642,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "8086:3e9b", - "os": "Mac-11.5.2" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -25535,44 +24316,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-11.4|Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -27777,41 +26520,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=debug_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug_x64", @@ -28614,42 +27322,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "1002:7340", - "os": "Windows-10", - "pool": "chromium.tests.gpu.experimental" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release_x64", @@ -29438,41 +28110,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "8086:5912-26.20.100.8141|8086:3e92-26.20.100.8141", - "os": "Windows-10", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release_x64", @@ -30358,41 +28995,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release_x64", @@ -31401,41 +30003,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -32247,42 +30814,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "1002:6613", - "os": "Windows-2008ServerR2-SP1", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -32971,42 +31502,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-24.21.14.1195", - "os": "Windows-2008ServerR2-SP1", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -33733,42 +32228,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:1cb3-24.21.14.1195", - "os": "Windows-2008ServerR2-SP1", - "pool": "chromium.tests.gpu" - } - ], - "expiration": 21600, - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release_x64",
diff --git a/testing/buildbot/chromium.gpu.json b/testing/buildbot/chromium.gpu.json index 3c2a79cc..52ebaaf 100644 --- a/testing/buildbot/chromium.gpu.json +++ b/testing/buildbot/chromium.gpu.json
@@ -48,49 +48,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_android_chrome", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "containment_type": "AUTO", - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_type": "userdebug", - "device_type": "bullhead", - "os": "Android" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=android-chromium", @@ -616,41 +573,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=debug", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "screenshot_sync", "--show-stdout", "--browser=debug", @@ -1109,41 +1031,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "screenshot_sync", "--show-stdout", "--browser=release", @@ -1630,42 +1517,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=debug", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "8086:3e9b", - "os": "Mac-11.5.2" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug", @@ -2152,42 +2003,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "8086:3e9b", - "os": "Mac-11.5.2" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -2654,44 +2469,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=debug", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-11.4|Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug", @@ -3178,44 +2955,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "1002:6821", - "hidpi": "1", - "os": "Mac-11.4|Mac-12.1", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -3740,41 +3479,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=debug_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=debug_x64", @@ -4246,41 +3950,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release_x64", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "containment_type": "AUTO", - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release_x64",
diff --git a/testing/buildbot/client.v8.fyi.json b/testing/buildbot/client.v8.fyi.json index a1e36bd..0ecaa136 100644 --- a/testing/buildbot/client.v8.fyi.json +++ b/testing/buildbot/client.v8.fyi.json
@@ -47,48 +47,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=android-chromium", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test_android_chrome", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "cipd_packages": [ - { - "cipd_package": "infra/tools/luci/logdog/butler/${platform}", - "location": "bin", - "revision": "git_revision:ff387eadf445b24c935f1cf7d6ddd279f8a6b04c" - } - ], - "dimension_sets": [ - { - "device_os": "MMB29Q", - "device_os_type": "userdebug", - "device_type": "bullhead", - "os": "Android" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test_android_chrome/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=android-chromium", @@ -493,40 +451,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -861,40 +785,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:2184-440.100", - "os": "Ubuntu-18.04.5|Ubuntu-18.04.6", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -1230,41 +1120,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "cpu": "x86-64", - "display_attached": "1", - "gpu": "8086:3e9b", - "os": "Mac-11.5.2" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release", @@ -1927,40 +1782,6 @@ }, { "args": [ - "depth_capture", - "--show-stdout", - "--browser=release", - "--passthrough", - "-v", - "--extra-browser-args=--enable-logging=stderr --js-flags=--expose-gc" - ], - "isolate_name": "telemetry_gpu_integration_test", - "merge": { - "args": [], - "script": "//testing/merge_scripts/standard_isolated_script_merge.py" - }, - "name": "depth_capture_tests", - "resultdb": { - "enable": true, - "has_native_resultdb_integration": true - }, - "should_retry_with_patch": false, - "swarming": { - "can_use_on_swarming_builders": true, - "dimension_sets": [ - { - "gpu": "10de:2184-27.21.14.5638", - "os": "Windows-10-18363", - "pool": "chromium.tests.gpu" - } - ], - "idempotent": false, - "service_account": "chromium-tester@chops-service-accounts.iam.gserviceaccount.com" - }, - "test_id_prefix": "ninja://chrome/test:telemetry_gpu_integration_test/" - }, - { - "args": [ "gpu_process", "--show-stdout", "--browser=release",
diff --git a/testing/buildbot/test_suite_exceptions.pyl b/testing/buildbot/test_suite_exceptions.pyl index 8e96685..9a06c5e 100644 --- a/testing/buildbot/test_suite_exceptions.pyl +++ b/testing/buildbot/test_suite_exceptions.pyl
@@ -1518,13 +1518,6 @@ }, }, }, - 'depth_capture_tests': { - 'remove_from': [ - # TODO(https://crbug.com/850107): Remove the Android FYI Release (Pixel 2) - # exception once there is enough capacity to run these tests. - 'Android FYI Release (Pixel 2)', - ], - }, 'device_unittests': { 'modifications': { 'android-12-x64-fyi-rel': { @@ -1637,12 +1630,6 @@ 'Lacros FYI x64 Release (Intel)', ], }, - 'gl_renderer_depth_capture_tests': { - 'remove_from': [ - 'ChromeOS FYI Release (kevin)', - 'Lacros FYI x64 Release (Intel)', - ], - }, 'gl_renderer_gpu_process_launch_tests': { 'remove_from': [ 'ChromeOS FYI Release (kevin)',
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index 4b47816a..609a0d0 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -1788,12 +1788,6 @@ 'has_native_resultdb_integration', ], }, - 'depth_capture': { - 'isolate_name': 'fuchsia_telemetry_gpu_integration_test', - 'mixins': [ - 'has_native_resultdb_integration', - ], - }, 'gpu_process': { 'name': 'gpu_process_launch_tests', 'isolate_name': 'fuchsia_telemetry_gpu_integration_test', @@ -2886,18 +2880,6 @@ 'has_native_resultdb_integration', ], }, - 'gl_renderer_depth_capture_tests': { - 'telemetry_test_name': 'depth_capture', - 'args': [ - '--extra-browser-args=--disable-features=UseSkiaRenderer', - ], - 'chromeos_args': [ - '$$MAGIC_SUBSTITUTION_ChromeOSTelemetryRemote', - ], - 'mixins': [ - 'has_native_resultdb_integration', - ], - }, 'gl_renderer_gpu_process_launch_tests': { 'telemetry_test_name': 'gpu_process', 'args': [ @@ -3095,21 +3077,6 @@ 'has_native_resultdb_integration', ], }, - 'depth_capture': { - 'chromeos_args': [ - '$$MAGIC_SUBSTITUTION_ChromeOSTelemetryRemote', - ], - 'lacros_args': [ - '--extra-browser-args=--enable-features=UseOzonePlatform --ozone-platform=wayland', - '--xvfb', - '--no-xvfb', - '--use-weston', - '--weston-use-gl', - ], - 'mixins': [ - 'has_native_resultdb_integration', - ], - }, 'gpu_process': { 'name': 'gpu_process_launch_tests', 'chromeos_args': [ @@ -3322,14 +3289,6 @@ 'has_native_resultdb_integration', ], }, - 'depth_capture': { - 'args': [ - '--extra-browser-args=--enable-features=UseSkiaRenderer', - ], - 'mixins': [ - 'has_native_resultdb_integration', - ], - }, 'gpu_process': { 'name': 'gpu_process_launch_tests', 'args': [ @@ -3466,21 +3425,6 @@ 'has_native_resultdb_integration', ], }, - 'depth_capture': { - 'chromeos_args': [ - '$$MAGIC_SUBSTITUTION_ChromeOSTelemetryRemote', - ], - 'lacros_args': [ - '--extra-browser-args=--enable-features=UseOzonePlatform --ozone-platform=wayland', - '--xvfb', - '--no-xvfb', - '--use-weston', - '--weston-use-gl', - ], - 'mixins': [ - 'has_native_resultdb_integration', - ], - }, 'gpu_process': { 'name': 'gpu_process_launch_tests', 'chromeos_args': [
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 3cbf405..bde5d52c 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -208,29 +208,6 @@ ] } ], - "AndroidInProductHelpDownloadPageScreenshot": [ - { - "platforms": [ - "android" - ], - "experiments": [ - { - "name": "EnabledTracking", - "params": { - "availability": "any", - "event_screenshot_taken": "name:screenshot_taken_chrome_in_foreground;comparator:>=1;window:90;storage:360", - "event_trigger": "name:download_page_iph_would_have_triggered;comparator:==0;window:90;storage:360", - "event_used": "name:download_page_started;comparator:==0;window:90;storage:360", - "session_rate": "<=1", - "tracking_only": "true" - }, - "enable_features": [ - "IPH_DownloadPageScreenshot" - ] - } - ] - } - ], "AndroidInProductHelpDownloadSettings": [ { "platforms": [ @@ -390,22 +367,6 @@ ] } ], - "AndroidPictureInPictureAPI": [ - { - "platforms": [ - "android", - "android_weblayer" - ], - "experiments": [ - { - "name": "Disabled", - "disable_features": [ - "PictureInPictureAPI" - ] - } - ] - } - ], "AndroidRDSGlobal": [ { "platforms": [
diff --git a/third_party/abseil-cpp/BUILD.gn b/third_party/abseil-cpp/BUILD.gn index d3234b0..3b6eb6c 100644 --- a/third_party/abseil-cpp/BUILD.gn +++ b/third_party/abseil-cpp/BUILD.gn
@@ -188,6 +188,8 @@ "absl/container:node_slot_policy_test", "absl/container:sample_element_size_test", "absl/hash:low_level_hash_test", + # TODO(crbug.com/1291484): Re-enable when fixed. + # "absl/hash:hash_test", "absl/memory:memory_test", "absl/meta:type_traits_test", "absl/profiling:exponential_biased_test",
diff --git a/third_party/abseil-cpp/README.chromium b/third_party/abseil-cpp/README.chromium index f1b540b7..360212e 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: c59e7e59f5d29619ddc07fcb59be3dcba9585814 +Revision: e3fdd9b16a2a90c9e01e00de46605ce59bebc661 Security Critical: yes Description:
diff --git a/third_party/abseil-cpp/absl/base/attributes.h b/third_party/abseil-cpp/absl/base/attributes.h index 00aad48..4ab6fa2 100644 --- a/third_party/abseil-cpp/absl/base/attributes.h +++ b/third_party/abseil-cpp/absl/base/attributes.h
@@ -136,9 +136,9 @@ // for further information. // The MinGW compiler doesn't complain about the weak attribute until the link // step, presumably because Windows doesn't use ELF binaries. -#if (ABSL_HAVE_ATTRIBUTE(weak) || \ - (defined(__GNUC__) && !defined(__clang__))) && \ - (!defined(_WIN32) || (defined(__clang__) && __clang_major__ < 9)) && \ +#if (ABSL_HAVE_ATTRIBUTE(weak) || \ + (defined(__GNUC__) && !defined(__clang__))) && \ + (!defined(_WIN32) || (defined(__clang__) && __clang_major__ >= 9)) && \ !defined(__MINGW32__) #undef ABSL_ATTRIBUTE_WEAK #define ABSL_ATTRIBUTE_WEAK __attribute__((weak)) @@ -312,7 +312,6 @@ __attribute__((section(#name))) __attribute__((noinline)) #endif - // ABSL_ATTRIBUTE_SECTION_VARIABLE // // Tells the compiler/linker to put a given variable into a section and define @@ -339,8 +338,8 @@ // a no-op on ELF but not on Mach-O. // #ifndef ABSL_DECLARE_ATTRIBUTE_SECTION_VARS -#define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name) \ - extern char __start_##name[] ABSL_ATTRIBUTE_WEAK; \ +#define ABSL_DECLARE_ATTRIBUTE_SECTION_VARS(name) \ + extern char __start_##name[] ABSL_ATTRIBUTE_WEAK; \ extern char __stop_##name[] ABSL_ATTRIBUTE_WEAK #endif #ifndef ABSL_DEFINE_ATTRIBUTE_SECTION_VARS @@ -503,7 +502,7 @@ #define ABSL_XRAY_NEVER_INSTRUMENT [[clang::xray_never_instrument]] #if ABSL_HAVE_CPP_ATTRIBUTE(clang::xray_log_args) #define ABSL_XRAY_LOG_ARGS(N) \ - [[clang::xray_always_instrument, clang::xray_log_args(N)]] + [[clang::xray_always_instrument, clang::xray_log_args(N)]] #else #define ABSL_XRAY_LOG_ARGS(N) [[clang::xray_always_instrument]] #endif
diff --git a/third_party/abseil-cpp/absl/base/casts.h b/third_party/abseil-cpp/absl/base/casts.h index b16af233..bf100ef 100644 --- a/third_party/abseil-cpp/absl/base/casts.h +++ b/third_party/abseil-cpp/absl/base/casts.h
@@ -44,8 +44,12 @@ bool, sizeof(Dest) == sizeof(Source) && type_traits_internal::is_trivially_copyable<Source>::value && - type_traits_internal::is_trivially_copyable<Dest>::value && - std::is_default_constructible<Dest>::value> {}; + type_traits_internal::is_trivially_copyable<Dest>::value +#if !ABSL_HAVE_BUILTIN(__builtin_bit_cast) + && std::is_default_constructible<Dest>::value +#endif + > { +}; } // namespace internal_casts @@ -147,20 +151,26 @@ // introducing this undefined behavior (since the original value is never // accessed in the wrong way). // -// NOTE: The requirements here are stricter than the bit_cast of standard -// proposal P0476 due to the need for workarounds and lack of intrinsics. +// NOTE: The requirements here are more strict than the bit_cast of standard +// proposal P0476 when __builtin_bit_cast is not available. // Specifically, this implementation also requires `Dest` to be // default-constructible. template < typename Dest, typename Source, typename std::enable_if<internal_casts::is_bitcastable<Dest, Source>::value, int>::type = 0> +#if ABSL_HAVE_BUILTIN(__builtin_bit_cast) +inline constexpr Dest bit_cast(const Source& source) { + return __builtin_bit_cast(Dest, source); +} +#else inline Dest bit_cast(const Source& source) { Dest dest; memcpy(static_cast<void*>(std::addressof(dest)), static_cast<const void*>(std::addressof(source)), sizeof(dest)); return dest; } +#endif // NOTE: This overload is only picked if the requirements of bit_cast are // not met. It is therefore UB, but is provided temporarily as previous
diff --git a/third_party/abseil-cpp/absl/container/btree_test.cc b/third_party/abseil-cpp/absl/container/btree_test.cc index 13cb8186..b2c3d73 100644 --- a/third_party/abseil-cpp/absl/container/btree_test.cc +++ b/third_party/abseil-cpp/absl/container/btree_test.cc
@@ -15,6 +15,7 @@ #include "absl/container/btree_test.h" #include <cstdint> +#include <functional> #include <limits> #include <map> #include <memory> @@ -1344,38 +1345,34 @@ EXPECT_EQ(++it, range.second); } -template <typename Compare, typename K> -void AssertKeyCompareToAdapted() { - using Adapted = typename key_compare_to_adapter<Compare>::type; - static_assert(!std::is_same<Adapted, Compare>::value, - "key_compare_to_adapter should have adapted this comparator."); +template <typename Compare, typename Key> +void AssertKeyCompareStringAdapted() { + using Adapted = typename key_compare_adapter<Compare, Key>::type; static_assert( - std::is_same<absl::weak_ordering, - absl::result_of_t<Adapted(const K &, const K &)>>::value, - "Adapted comparator should be a key-compare-to comparator."); + std::is_same<Adapted, StringBtreeDefaultLess>::value || + std::is_same<Adapted, StringBtreeDefaultGreater>::value, + "key_compare_adapter should have string-adapted this comparator."); } -template <typename Compare, typename K> -void AssertKeyCompareToNotAdapted() { - using Unadapted = typename key_compare_to_adapter<Compare>::type; +template <typename Compare, typename Key> +void AssertKeyCompareNotStringAdapted() { + using Adapted = typename key_compare_adapter<Compare, Key>::type; static_assert( - std::is_same<Unadapted, Compare>::value, - "key_compare_to_adapter shouldn't have adapted this comparator."); - static_assert( - std::is_same<bool, - absl::result_of_t<Unadapted(const K &, const K &)>>::value, - "Un-adapted comparator should return bool."); + !std::is_same<Adapted, StringBtreeDefaultLess>::value && + !std::is_same<Adapted, StringBtreeDefaultGreater>::value, + "key_compare_adapter shouldn't have string-adapted this comparator."); } -TEST(Btree, KeyCompareToAdapter) { - AssertKeyCompareToAdapted<std::less<std::string>, std::string>(); - AssertKeyCompareToAdapted<std::greater<std::string>, std::string>(); - AssertKeyCompareToAdapted<std::less<absl::string_view>, absl::string_view>(); - AssertKeyCompareToAdapted<std::greater<absl::string_view>, - absl::string_view>(); - AssertKeyCompareToAdapted<std::less<absl::Cord>, absl::Cord>(); - AssertKeyCompareToAdapted<std::greater<absl::Cord>, absl::Cord>(); - AssertKeyCompareToNotAdapted<std::less<int>, int>(); - AssertKeyCompareToNotAdapted<std::greater<int>, int>(); +TEST(Btree, KeyCompareAdapter) { + AssertKeyCompareStringAdapted<std::less<std::string>, std::string>(); + AssertKeyCompareStringAdapted<std::greater<std::string>, std::string>(); + AssertKeyCompareStringAdapted<std::less<absl::string_view>, + absl::string_view>(); + AssertKeyCompareStringAdapted<std::greater<absl::string_view>, + absl::string_view>(); + AssertKeyCompareStringAdapted<std::less<absl::Cord>, absl::Cord>(); + AssertKeyCompareStringAdapted<std::greater<absl::Cord>, absl::Cord>(); + AssertKeyCompareNotStringAdapted<std::less<int>, int>(); + AssertKeyCompareNotStringAdapted<std::greater<int>, int>(); } TEST(Btree, RValueInsert) { @@ -1425,11 +1422,19 @@ EXPECT_EQ(tracker.swaps(), 0); } -// A btree set with a specific number of values per node. +template <typename Cmp> +struct CheckedCompareOptedOutCmp : Cmp, BtreeTestOnlyCheckedCompareOptOutBase { + using Cmp::Cmp; + CheckedCompareOptedOutCmp() {} + CheckedCompareOptedOutCmp(Cmp cmp) : Cmp(std::move(cmp)) {} // NOLINT +}; + +// A btree set with a specific number of values per node. Opt out of +// checked_compare so that we can expect exact numbers of comparisons. template <typename Key, int TargetValuesPerNode, typename Cmp = std::less<Key>> class SizedBtreeSet : public btree_set_container<btree< - set_params<Key, Cmp, std::allocator<Key>, + set_params<Key, CheckedCompareOptedOutCmp<Cmp>, std::allocator<Key>, BtreeNodePeer::GetTargetNodeSize<Key>(TargetValuesPerNode), /*Multi=*/false>>> { using Base = typename SizedBtreeSet::btree_set_container; @@ -2297,7 +2302,9 @@ }; using Cmp = decltype(cmp); - absl::btree_map<int, int, Cmp> m(cmp); + // Use a map that is opted out of key_compare being adapted so we can expect + // strict comparison call limits. + absl::btree_map<int, int, CheckedCompareOptedOutCmp<Cmp>> m(cmp); for (int i = 0; i < 128; ++i) { m.emplace(i, i); } @@ -2967,6 +2974,58 @@ absl::btree_set<MultiKey, MultiKeyComp> set = {{}, MultiKeyComp{}}; } +#ifndef NDEBUG +TEST(Btree, InvalidComparatorsCaught) { + { + struct ZeroAlwaysLessCmp { + bool operator()(int lhs, int rhs) const { + if (lhs == 0) return true; + return lhs < rhs; + } + }; + absl::btree_set<int, ZeroAlwaysLessCmp> set; + EXPECT_DEATH(set.insert({0, 1, 2}), "is_self_equivalent"); + } + { + struct ThreeWayAlwaysLessCmp { + absl::weak_ordering operator()(int, int) const { + return absl::weak_ordering::less; + } + }; + absl::btree_set<int, ThreeWayAlwaysLessCmp> set; + EXPECT_DEATH(set.insert({0, 1, 2}), "is_self_equivalent"); + } + { + struct SumGreaterZeroCmp { + bool operator()(int lhs, int rhs) const { + // First, do equivalence correctly - so we can test later condition. + if (lhs == rhs) return false; + return lhs + rhs > 0; + } + }; + absl::btree_set<int, SumGreaterZeroCmp> set; + // Note: '!' only needs to be escaped when it's the first character. + EXPECT_DEATH(set.insert({0, 1, 2}), + R"regex(\!lhs_comp_rhs \|\| !comp\(\)\(rhs, lhs\))regex"); + } + { + struct ThreeWaySumGreaterZeroCmp { + absl::weak_ordering operator()(int lhs, int rhs) const { + // First, do equivalence correctly - so we can test later condition. + if (lhs == rhs) return absl::weak_ordering::equivalent; + + if (lhs + rhs > 0) return absl::weak_ordering::less; + if (lhs + rhs == 0) return absl::weak_ordering::equivalent; + return absl::weak_ordering::greater; + } + }; + absl::btree_set<int, ThreeWaySumGreaterZeroCmp> set; + EXPECT_DEATH(set.insert({0, 1, 2}), + R"regex(lhs_comp_rhs < 0 -> rhs_comp_lhs > 0)regex"); + } +} +#endif + } // namespace } // namespace container_internal ABSL_NAMESPACE_END
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 f1c650c..0fb2ae6f 100644 --- a/third_party/abseil-cpp/absl/container/flat_hash_set.h +++ b/third_party/abseil-cpp/absl/container/flat_hash_set.h
@@ -67,7 +67,7 @@ // // By default, `flat_hash_set` uses the `absl::Hash` hashing framework. All // fundamental and Abseil types that support the `absl::Hash` framework have a -// compatible equality operator for comparing insertions into `flat_hash_map`. +// compatible equality operator for comparing insertions into `flat_hash_set`. // If your type is not yet supported by the `absl::Hash` framework, see // absl/hash/hash.h for information on extending Abseil hashing to user-defined // types. @@ -106,7 +106,7 @@ public: // Constructors and Assignment Operators // - // A flat_hash_set supports the same overload set as `std::unordered_map` + // A flat_hash_set supports the same overload set as `std::unordered_set` // for construction and assignment: // // * Default constructor @@ -173,7 +173,7 @@ // available within the `flat_hash_set`. // // NOTE: this member function is particular to `absl::flat_hash_set` and is - // not provided in the `std::unordered_map` API. + // not provided in the `std::unordered_set` API. using Base::capacity; // flat_hash_set::empty() @@ -332,7 +332,7 @@ // flat_hash_set::swap(flat_hash_set& other) // // Exchanges the contents of this `flat_hash_set` with those of the `other` - // flat hash map, avoiding invocation of any move, copy, or swap operations on + // flat hash set, avoiding invocation of any move, copy, or swap operations on // individual elements. // // All iterators and references on the `flat_hash_set` remain valid, excepting @@ -340,7 +340,7 @@ // // `swap()` requires that the flat hash set's hashing and key equivalence // functions be Swappable, and are exchaged using unqualified calls to - // non-member `swap()`. If the map's allocator has + // non-member `swap()`. If the set's allocator has // `std::allocator_traits<allocator_type>::propagate_on_container_swap::value` // set to `true`, the allocators are also exchanged using an unqualified call // to non-member `swap()`; otherwise, the allocators are not swapped. @@ -395,14 +395,14 @@ // flat_hash_set::bucket_count() // // Returns the number of "buckets" within the `flat_hash_set`. Note that - // because a flat hash map contains all elements within its internal storage, + // because a flat hash set contains all elements within its internal storage, // this value simply equals the current capacity of the `flat_hash_set`. using Base::bucket_count; // flat_hash_set::load_factor() // // Returns the current load factor of the `flat_hash_set` (the average number - // of slots occupied with a value within the hash map). + // of slots occupied with a value within the hash set). using Base::load_factor; // flat_hash_set::max_load_factor()
diff --git a/third_party/abseil-cpp/absl/container/internal/btree.h b/third_party/abseil-cpp/absl/container/internal/btree.h index 26bd5e1..bbc319c1 100644 --- a/third_party/abseil-cpp/absl/container/internal/btree.h +++ b/third_party/abseil-cpp/absl/container/internal/btree.h
@@ -74,12 +74,14 @@ ABSL_NAMESPACE_BEGIN namespace container_internal { +template <typename Compare, typename T, typename U> +using compare_result_t = absl::result_of_t<const Compare(const T &, const U &)>; + // A helper class that indicates if the Compare parameter is a key-compare-to // comparator. template <typename Compare, typename T> using btree_is_key_compare_to = - std::is_convertible<absl::result_of_t<Compare(const T &, const T &)>, - absl::weak_ordering>; + std::is_convertible<compare_result_t<Compare, T, T>, absl::weak_ordering>; struct StringBtreeDefaultLess { using is_transparent = void; @@ -146,49 +148,140 @@ } }; -// A helper class to convert a boolean comparison into a three-way "compare-to" -// comparison that returns an `absl::weak_ordering`. This helper -// class is specialized for less<std::string>, greater<std::string>, -// less<string_view>, greater<string_view>, less<absl::Cord>, and -// greater<absl::Cord>. -// -// key_compare_to_adapter is provided so that btree users -// automatically get the more efficient compare-to code when using common -// Abseil string types with common comparison functors. -// These string-like specializations also turn on heterogeneous lookup by -// default. +// See below comments for checked_compare. +template <typename Compare, bool is_class = std::is_class<Compare>::value> +struct checked_compare_base : Compare { + using Compare::Compare; + explicit checked_compare_base(Compare c) : Compare(std::move(c)) {} + const Compare &comp() const { return *this; } +}; template <typename Compare> -struct key_compare_to_adapter { - using type = Compare; +struct checked_compare_base<Compare, false> { + explicit checked_compare_base(Compare c) : compare(std::move(c)) {} + const Compare &comp() const { return compare; } + Compare compare; +}; + +// A mechanism for opting out of checked_compare for use only in btree_test.cc. +struct BtreeTestOnlyCheckedCompareOptOutBase {}; + +// A helper class to adapt the specified comparator for two use cases: +// (1) When using common Abseil string types with common comparison functors, +// convert a boolean comparison into a three-way comparison that returns an +// `absl::weak_ordering`. This helper class is specialized for +// less<std::string>, greater<std::string>, less<string_view>, +// greater<string_view>, less<absl::Cord>, and greater<absl::Cord>. +// (2) Adapt the comparator to diagnose cases of non-strict-weak-ordering (see +// https://en.cppreference.com/w/cpp/named_req/Compare) in debug mode. Whenever +// a comparison is made, we will make assertions to verify that the comparator +// is valid. +template <typename Compare, typename Key> +struct key_compare_adapter { + // Inherit from checked_compare_base to support function pointers and also + // keep empty-base-optimization (EBO) support for classes. + // Note: we can't use CompressedTuple here because that would interfere + // with the EBO for `btree::root_`. `btree::root_` is itself a CompressedTuple + // and nested `CompressedTuple`s don't support EBO. + // TODO(b/214288561): use CompressedTuple instead once it supports EBO for + // nested `CompressedTuple`s. + struct checked_compare : checked_compare_base<Compare> { + private: + using Base = typename checked_compare::checked_compare_base; + using Base::comp; + + // If possible, returns whether `t` is equivalent to itself. We can only do + // this for `Key`s because we can't be sure that it's safe to call + // `comp()(k, k)` otherwise. Even if SFINAE allows it, there could be a + // compilation failure inside the implementation of the comparison operator. + bool is_self_equivalent(const Key &k) const { + // Note: this works for both boolean and three-way comparators. + return comp()(k, k) == 0; + } + // If we can't compare `t` with itself, returns true unconditionally. + template <typename T> + bool is_self_equivalent(const T &) const { + return true; + } + + public: + using Base::Base; + checked_compare(Compare comp) : Base(std::move(comp)) {} // NOLINT + + // Allow converting to Compare for use in key_comp()/value_comp(). + explicit operator Compare() const { return comp(); } + + template <typename T, typename U, + absl::enable_if_t< + std::is_same<bool, compare_result_t<Compare, T, U>>::value, + int> = 0> + bool operator()(const T &lhs, const U &rhs) const { + // NOTE: if any of these assertions fail, then the comparator does not + // establish a strict-weak-ordering (see + // https://en.cppreference.com/w/cpp/named_req/Compare). + assert(is_self_equivalent(lhs)); + assert(is_self_equivalent(rhs)); + const bool lhs_comp_rhs = comp()(lhs, rhs); + assert(!lhs_comp_rhs || !comp()(rhs, lhs)); + return lhs_comp_rhs; + } + + template < + typename T, typename U, + absl::enable_if_t<std::is_convertible<compare_result_t<Compare, T, U>, + absl::weak_ordering>::value, + int> = 0> + absl::weak_ordering operator()(const T &lhs, const U &rhs) const { + // NOTE: if any of these assertions fail, then the comparator does not + // establish a strict-weak-ordering (see + // https://en.cppreference.com/w/cpp/named_req/Compare). + assert(is_self_equivalent(lhs)); + assert(is_self_equivalent(rhs)); + const absl::weak_ordering lhs_comp_rhs = comp()(lhs, rhs); +#ifndef NDEBUG + const absl::weak_ordering rhs_comp_lhs = comp()(rhs, lhs); + if (lhs_comp_rhs > 0) { + assert(rhs_comp_lhs < 0 && "lhs_comp_rhs > 0 -> rhs_comp_lhs < 0"); + } else if (lhs_comp_rhs == 0) { + assert(rhs_comp_lhs == 0 && "lhs_comp_rhs == 0 -> rhs_comp_lhs == 0"); + } else { + assert(rhs_comp_lhs > 0 && "lhs_comp_rhs < 0 -> rhs_comp_lhs > 0"); + } +#endif + return lhs_comp_rhs; + } + }; + using type = absl::conditional_t< + std::is_base_of<BtreeTestOnlyCheckedCompareOptOutBase, Compare>::value, + Compare, checked_compare>; }; template <> -struct key_compare_to_adapter<std::less<std::string>> { +struct key_compare_adapter<std::less<std::string>, std::string> { using type = StringBtreeDefaultLess; }; template <> -struct key_compare_to_adapter<std::greater<std::string>> { +struct key_compare_adapter<std::greater<std::string>, std::string> { using type = StringBtreeDefaultGreater; }; template <> -struct key_compare_to_adapter<std::less<absl::string_view>> { +struct key_compare_adapter<std::less<absl::string_view>, absl::string_view> { using type = StringBtreeDefaultLess; }; template <> -struct key_compare_to_adapter<std::greater<absl::string_view>> { +struct key_compare_adapter<std::greater<absl::string_view>, absl::string_view> { using type = StringBtreeDefaultGreater; }; template <> -struct key_compare_to_adapter<std::less<absl::Cord>> { +struct key_compare_adapter<std::less<absl::Cord>, absl::Cord> { using type = StringBtreeDefaultLess; }; template <> -struct key_compare_to_adapter<std::greater<absl::Cord>> { +struct key_compare_adapter<std::greater<absl::Cord>, absl::Cord> { using type = StringBtreeDefaultGreater; }; @@ -224,6 +317,13 @@ T, absl::void_t<typename T::absl_btree_prefer_linear_node_search>> : T::absl_btree_prefer_linear_node_search {}; +template <typename Compare, typename Key> +constexpr bool compare_has_valid_result_type() { + using compare_result_type = compare_result_t<Compare, Key, Key>; + return std::is_same<compare_result_type, bool>::value || + std::is_convertible<compare_result_type, absl::weak_ordering>::value; +} + template <typename Key, typename Compare, typename Alloc, int TargetNodeSize, bool Multi, typename SlotPolicy> struct common_params { @@ -231,7 +331,24 @@ // If Compare is a common comparator for a string-like type, then we adapt it // to use heterogeneous lookup and to be a key-compare-to comparator. - using key_compare = typename key_compare_to_adapter<Compare>::type; + // We also adapt the comparator to diagnose invalid comparators in debug mode. + // We disable this when `Compare` is invalid in a way that will cause + // adaptation to fail (having invalid return type) so that we can give a + // better compilation failure in static_assert_validation. If we don't do + // this, then there will be cascading compilation failures that are confusing + // for users. + using key_compare = + absl::conditional_t<!compare_has_valid_result_type<Compare, Key>(), + Compare, + typename key_compare_adapter<Compare, Key>::type>; + + static constexpr bool kIsKeyCompareStringAdapted = + std::is_same<key_compare, StringBtreeDefaultLess>::value || + std::is_same<key_compare, StringBtreeDefaultGreater>::value; + static constexpr bool kIsKeyCompareTransparent = + IsTransparent<original_key_compare>::value || + kIsKeyCompareStringAdapted; + // A type which indicates if we have a key-compare-to functor or a plain old // key-compare functor. using is_key_compare_to = btree_is_key_compare_to<key_compare, Key>; @@ -260,11 +377,9 @@ // that we know has the same equivalence classes for all lookup types. template <typename LookupKey> constexpr static bool can_have_multiple_equivalent_keys() { - return Multi || - (IsTransparent<key_compare>::value && - !std::is_same<LookupKey, Key>::value && - !std::is_same<key_compare, StringBtreeDefaultLess>::value && - !std::is_same<key_compare, StringBtreeDefaultGreater>::value); + return Multi || (IsTransparent<key_compare>::value && + !std::is_same<LookupKey, Key>::value && + !kIsKeyCompareStringAdapted); } enum { @@ -366,6 +481,7 @@ using field_type = typename Params::node_count_type; using allocator_type = typename Params::allocator_type; using slot_type = typename Params::slot_type; + using original_key_compare = typename Params::original_key_compare; public: using params_type = Params; @@ -387,15 +503,15 @@ // - Otherwise, choose binary. // TODO(ezb): Might make sense to add condition(s) based on node-size. using use_linear_search = std::integral_constant< - bool, - has_linear_node_search_preference<key_compare>::value - ? prefers_linear_node_search<key_compare>::value - : has_linear_node_search_preference<key_type>::value + bool, has_linear_node_search_preference<original_key_compare>::value + ? prefers_linear_node_search<original_key_compare>::value + : has_linear_node_search_preference<key_type>::value ? prefers_linear_node_search<key_type>::value : std::is_arithmetic<key_type>::value && - (std::is_same<std::less<key_type>, key_compare>::value || + (std::is_same<std::less<key_type>, + original_key_compare>::value || std::is_same<std::greater<key_type>, - key_compare>::value)>; + original_key_compare>::value)>; // This class is organized by absl::container_internal::Layout as if it had // the following structure: @@ -1821,11 +1937,8 @@ "target node size too large"); // Verify that key_compare returns an absl::{weak,strong}_ordering or bool. - using compare_result_type = - absl::result_of_t<key_compare(key_type, key_type)>; static_assert( - std::is_same<compare_result_type, bool>::value || - std::is_convertible<compare_result_type, absl::weak_ordering>::value, + compare_has_valid_result_type<key_compare, key_type>(), "key comparison function must return absl::{weak,strong}_ordering or " "bool.");
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 d28b244..bae5c6e 100644 --- a/third_party/abseil-cpp/absl/container/internal/btree_container.h +++ b/third_party/abseil-cpp/absl/container/internal/btree_container.h
@@ -44,8 +44,8 @@ // transparent case. template <class K> using key_arg = - typename KeyArg<IsTransparent<typename Tree::key_compare>::value>:: - template type<K, typename Tree::key_type>; + typename KeyArg<params_type::kIsKeyCompareTransparent>::template type< + K, typename Tree::key_type>; public: using key_type = typename Tree::key_type;
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 1d24db5f..322e054 100644 --- a/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc +++ b/third_party/abseil-cpp/absl/container/internal/hashtablez_sampler.cc
@@ -27,6 +27,7 @@ #include "absl/profiling/internal/exponential_biased.h" #include "absl/profiling/internal/sample_recorder.h" #include "absl/synchronization/mutex.h" +#include "absl/utility/utility.h" namespace absl { ABSL_NAMESPACE_BEGIN @@ -53,7 +54,7 @@ } // namespace #if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) -ABSL_PER_THREAD_TLS_KEYWORD int64_t global_next_sample = 0; +ABSL_PER_THREAD_TLS_KEYWORD SamplingState global_next_sample = {0, 0}; #endif // defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) HashtablezSampler& GlobalHashtablezSampler() { @@ -64,7 +65,8 @@ HashtablezInfo::HashtablezInfo() = default; HashtablezInfo::~HashtablezInfo() = default; -void HashtablezInfo::PrepareForSampling(size_t inline_element_size_value) { +void HashtablezInfo::PrepareForSampling(int64_t stride, + 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); @@ -77,6 +79,7 @@ max_reserve.store(0, std::memory_order_relaxed); create_time = absl::Now(); + weight = stride; // The inliner makes hardcoded skip_count difficult (especially when combined // with LTO). We use the ability to exclude stacks by regex when encoding // instead. @@ -105,23 +108,32 @@ return state == kForce; } -HashtablezInfo* SampleSlow(int64_t* next_sample, size_t inline_element_size) { +HashtablezInfo* SampleSlow(SamplingState& next_sample, + size_t inline_element_size) { if (ABSL_PREDICT_FALSE(ShouldForceSampling())) { - *next_sample = 1; + next_sample.next_sample = 1; + const int64_t old_stride = exchange(next_sample.sample_stride, 1); HashtablezInfo* result = - GlobalHashtablezSampler().Register(inline_element_size); + GlobalHashtablezSampler().Register(old_stride, inline_element_size); return result; } #if !defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) - *next_sample = std::numeric_limits<int64_t>::max(); + next_sample = { + std::numeric_limits<int64_t>::max(), + std::numeric_limits<int64_t>::max(), + }; return nullptr; #else - bool first = *next_sample < 0; - *next_sample = g_exponential_biased_generator.GetStride( + bool first = next_sample.next_sample < 0; + + const int64_t next_stride = g_exponential_biased_generator.GetStride( g_hashtablez_sample_parameter.load(std::memory_order_relaxed)); + + next_sample.next_sample = next_stride; + const int64_t old_stride = exchange(next_sample.sample_stride, next_stride); // Small values of interval are equivalent to just sampling next time. - ABSL_ASSERT(*next_sample >= 1); + ABSL_ASSERT(next_stride >= 1); // g_hashtablez_enabled can be dynamically flipped, we need to set a threshold // low enough that we will start sampling in a reasonable time, so we just use @@ -131,11 +143,11 @@ // We will only be negative on our first count, so we should just retry in // that case. if (first) { - if (ABSL_PREDICT_TRUE(--*next_sample > 0)) return nullptr; + if (ABSL_PREDICT_TRUE(--next_sample.next_sample > 0)) return nullptr; return SampleSlow(next_sample, inline_element_size); } - return GlobalHashtablezSampler().Register(inline_element_size); + return GlobalHashtablezSampler().Register(old_stride, 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 6738786c..e7c204e 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,7 @@ // 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(size_t inline_element_size_value) + void PrepareForSampling(int64_t stride, 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 @@ -145,7 +145,15 @@ std::memory_order_relaxed); } -HashtablezInfo* SampleSlow(int64_t* next_sample, size_t inline_element_size); +struct SamplingState { + int64_t next_sample; + // When we make a sampling decision, we record that distance so we can weight + // each sample. + int64_t sample_stride; +}; + +HashtablezInfo* SampleSlow(SamplingState& next_sample, + size_t inline_element_size); void UnsampleSlow(HashtablezInfo* info); #if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) @@ -235,7 +243,7 @@ #endif // defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) #if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) -extern ABSL_PER_THREAD_TLS_KEYWORD int64_t global_next_sample; +extern ABSL_PER_THREAD_TLS_KEYWORD SamplingState global_next_sample; #endif // defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) // Returns an RAII sampling handle that manages registration and unregistation @@ -243,11 +251,11 @@ inline HashtablezInfoHandle Sample( size_t inline_element_size ABSL_ATTRIBUTE_UNUSED) { #if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE) - if (ABSL_PREDICT_TRUE(--global_next_sample > 0)) { + if (ABSL_PREDICT_TRUE(--global_next_sample.next_sample > 0)) { return HashtablezInfoHandle(nullptr); } return HashtablezInfoHandle( - SampleSlow(&global_next_sample, inline_element_size)); + SampleSlow(global_next_sample, inline_element_size)); #else return HashtablezInfoHandle(nullptr); #endif // !ABSL_PER_THREAD_TLS
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 ac6ed9b..77cdf2f 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,8 +70,9 @@ } HashtablezInfo* Register(HashtablezSampler* s, size_t size) { + const int64_t test_stride = 123; const size_t test_element_size = 17; - auto* info = s->Register(test_element_size); + auto* info = s->Register(test_stride, test_element_size); assert(info != nullptr); info->size.store(size); return info; @@ -79,10 +80,11 @@ TEST(HashtablezInfoTest, PrepareForSampling) { absl::Time test_start = absl::Now(); + const int64_t test_stride = 123; const size_t test_element_size = 17; HashtablezInfo info; absl::MutexLock l(&info.init_mu); - info.PrepareForSampling(test_element_size); + info.PrepareForSampling(test_stride, test_element_size); EXPECT_EQ(info.capacity.load(), 0); EXPECT_EQ(info.size.load(), 0); @@ -95,6 +97,7 @@ EXPECT_EQ(info.hashes_bitwise_xor.load(), 0); EXPECT_EQ(info.max_reserve.load(), 0); EXPECT_GE(info.create_time, test_start); + EXPECT_EQ(info.weight, test_stride); EXPECT_EQ(info.inline_element_size, test_element_size); info.capacity.store(1, std::memory_order_relaxed); @@ -108,7 +111,7 @@ info.max_reserve.store(1, std::memory_order_relaxed); info.create_time = test_start - absl::Hours(20); - info.PrepareForSampling(test_element_size); + info.PrepareForSampling(test_stride * 2, test_element_size); EXPECT_EQ(info.capacity.load(), 0); EXPECT_EQ(info.size.load(), 0); EXPECT_EQ(info.num_erases.load(), 0); @@ -119,6 +122,7 @@ EXPECT_EQ(info.hashes_bitwise_and.load(), ~size_t{}); EXPECT_EQ(info.hashes_bitwise_xor.load(), 0); EXPECT_EQ(info.max_reserve.load(), 0); + EXPECT_EQ(info.weight, 2 * test_stride); EXPECT_EQ(info.inline_element_size, test_element_size); EXPECT_GE(info.create_time, test_start); } @@ -126,8 +130,9 @@ TEST(HashtablezInfoTest, RecordStorageChanged) { HashtablezInfo info; absl::MutexLock l(&info.init_mu); + const int64_t test_stride = 21; const size_t test_element_size = 19; - info.PrepareForSampling(test_element_size); + info.PrepareForSampling(test_stride, test_element_size); RecordStorageChangedSlow(&info, 17, 47); EXPECT_EQ(info.size.load(), 17); EXPECT_EQ(info.capacity.load(), 47); @@ -139,8 +144,9 @@ TEST(HashtablezInfoTest, RecordInsert) { HashtablezInfo info; absl::MutexLock l(&info.init_mu); + const int64_t test_stride = 25; const size_t test_element_size = 23; - info.PrepareForSampling(test_element_size); + info.PrepareForSampling(test_stride, test_element_size); EXPECT_EQ(info.max_probe_length.load(), 0); RecordInsertSlow(&info, 0x0000FF00, 6 * kProbeLength); EXPECT_EQ(info.max_probe_length.load(), 6); @@ -160,10 +166,11 @@ } TEST(HashtablezInfoTest, RecordErase) { + const int64_t test_stride = 31; const size_t test_element_size = 29; HashtablezInfo info; absl::MutexLock l(&info.init_mu); - info.PrepareForSampling(test_element_size); + info.PrepareForSampling(test_stride, test_element_size); EXPECT_EQ(info.num_erases.load(), 0); EXPECT_EQ(info.size.load(), 0); RecordInsertSlow(&info, 0x0000FF00, 6 * kProbeLength); @@ -175,10 +182,11 @@ } TEST(HashtablezInfoTest, RecordRehash) { + const int64_t test_stride = 33; const size_t test_element_size = 31; HashtablezInfo info; absl::MutexLock l(&info.init_mu); - info.PrepareForSampling(test_element_size); + info.PrepareForSampling(test_stride, test_element_size); RecordInsertSlow(&info, 0x1, 0); RecordInsertSlow(&info, 0x2, kProbeLength); RecordInsertSlow(&info, 0x4, kProbeLength); @@ -203,8 +211,9 @@ TEST(HashtablezInfoTest, RecordReservation) { HashtablezInfo info; absl::MutexLock l(&info.init_mu); + const int64_t test_stride = 35; const size_t test_element_size = 33; - info.PrepareForSampling(test_element_size); + info.PrepareForSampling(test_stride, test_element_size); RecordReservationSlow(&info, 3); EXPECT_EQ(info.max_reserve.load(), 3); @@ -224,9 +233,10 @@ SetHashtablezSampleParameter(100); for (int i = 0; i < 1000; ++i) { - int64_t next_sample = 0; - HashtablezInfo* sample = SampleSlow(&next_sample, test_element_size); - EXPECT_GT(next_sample, 0); + SamplingState next_sample = {0, 0}; + HashtablezInfo* sample = SampleSlow(next_sample, test_element_size); + EXPECT_GT(next_sample.next_sample, 0); + EXPECT_EQ(next_sample.next_sample, next_sample.sample_stride); EXPECT_NE(sample, nullptr); UnsampleSlow(sample); } @@ -238,9 +248,10 @@ SetHashtablezSampleParameter(std::numeric_limits<int32_t>::max()); for (int i = 0; i < 1000; ++i) { - int64_t next_sample = 0; - HashtablezInfo* sample = SampleSlow(&next_sample, test_element_size); - EXPECT_GT(next_sample, 0); + SamplingState next_sample = {0, 0}; + HashtablezInfo* sample = SampleSlow(next_sample, test_element_size); + EXPECT_GT(next_sample.next_sample, 0); + EXPECT_EQ(next_sample.next_sample, next_sample.sample_stride); EXPECT_NE(sample, nullptr); UnsampleSlow(sample); } @@ -267,14 +278,16 @@ TEST(HashtablezSamplerTest, Handle) { auto& sampler = GlobalHashtablezSampler(); + const int64_t test_stride = 41; const size_t test_element_size = 39; - HashtablezInfoHandle h(sampler.Register(test_element_size)); + HashtablezInfoHandle h(sampler.Register(test_stride, test_element_size)); auto* info = HashtablezInfoHandlePeer::GetInfo(&h); info->hashes_bitwise_and.store(0x12345678, std::memory_order_relaxed); bool found = false; sampler.Iterate([&](const HashtablezInfo& h) { if (&h == info) { + EXPECT_EQ(h.weight, test_stride); EXPECT_EQ(h.hashes_bitwise_and.load(), 0x12345678); found = true; } @@ -340,19 +353,20 @@ ThreadPool pool(10); for (int i = 0; i < 10; ++i) { + const int64_t sampling_stride = 11 + i % 3; const size_t elt_size = 10 + i % 2; - pool.Schedule([&sampler, &stop, elt_size]() { + pool.Schedule([&sampler, &stop, sampling_stride, 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(elt_size)); + infoz.push_back(sampler.Register(sampling_stride, elt_size)); } switch (std::uniform_int_distribution<>(0, 2)(gen)) { case 0: { - infoz.push_back(sampler.Register(elt_size)); + infoz.push_back(sampler.Register(sampling_stride, elt_size)); break; } case 1: { @@ -361,6 +375,7 @@ HashtablezInfo* info = infoz[p]; infoz[p] = infoz.back(); infoz.pop_back(); + EXPECT_EQ(info->weight, sampling_stride); sampler.Unregister(info); break; }
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 1157d25a..93a3fa8 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
@@ -1539,6 +1539,14 @@ return !(a == b); } + template <typename H> + friend typename std::enable_if<H::template is_hashable<value_type>::value, + H>::type + AbslHashValue(H h, const raw_hash_set& s) { + return H::combine(H::combine_unordered(std::move(h), s.begin(), s.end()), + s.size()); + } + friend void swap(raw_hash_set& a, raw_hash_set& b) noexcept(noexcept(a.swap(b))) { a.swap(b);
diff --git a/third_party/abseil-cpp/absl/container/internal/raw_hash_set_test.cc b/third_party/abseil-cpp/absl/container/internal/raw_hash_set_test.cc index 362b3ca..47015bcf 100644 --- a/third_party/abseil-cpp/absl/container/internal/raw_hash_set_test.cc +++ b/third_party/abseil-cpp/absl/container/internal/raw_hash_set_test.cc
@@ -1244,7 +1244,7 @@ case 16: if (kRandomizesInserts) { return {0.1, - 1.0, + 2.0, {{0.95, 0.1}}, {{0.95, 0}, {0.99, 1}, {0.999, 8}, {0.9999, 15}}}; } else { @@ -1258,7 +1258,7 @@ return {}; } -TEST(Table, DISABLED_EnsureNonQuadraticTopNXorSeedByProbeSeqLength) { +TEST(Table, EnsureNonQuadraticTopNXorSeedByProbeSeqLength) { ProbeStatsPerSize stats; std::vector<size_t> sizes = {Group::kWidth << 5, Group::kWidth << 10}; for (size_t size : sizes) { @@ -1330,17 +1330,17 @@ {{0.95, 0.3}}, {{0.95, 0}, {0.99, 1}, {0.999, 8}, {0.9999, 15}}}; } else { - return {0.15, - 0.5, - {{0.95, 0.3}}, - {{0.95, 0}, {0.99, 3}, {0.999, 15}, {0.9999, 25}}}; + return {0.4, + 0.6, + {{0.95, 0.5}}, + {{0.95, 1}, {0.99, 14}, {0.999, 23}, {0.9999, 26}}}; } case 16: if (kRandomizesInserts) { return {0.1, 0.4, {{0.95, 0.3}}, - {{0.95, 0}, {0.99, 1}, {0.999, 8}, {0.9999, 15}}}; + {{0.95, 1}, {0.99, 2}, {0.999, 9}, {0.9999, 15}}}; } else { return {0.05, 0.2, @@ -1352,7 +1352,7 @@ return {}; } -TEST(Table, DISABLED_EnsureNonQuadraticTopNLinearTransformByProbeSeqLength) { +TEST(Table, EnsureNonQuadraticTopNLinearTransformByProbeSeqLength) { ProbeStatsPerSize stats; std::vector<size_t> sizes = {Group::kWidth << 5, Group::kWidth << 10}; for (size_t size : sizes) {
diff --git a/third_party/abseil-cpp/absl/hash/BUILD.bazel b/third_party/abseil-cpp/absl/hash/BUILD.bazel index f0640d34..bcc316f 100644 --- a/third_party/abseil-cpp/absl/hash/BUILD.bazel +++ b/third_party/abseil-cpp/absl/hash/BUILD.bazel
@@ -41,6 +41,7 @@ "//absl/base:core_headers", "//absl/base:endian", "//absl/container:fixed_array", + "//absl/functional:function_ref", "//absl/meta:type_traits", "//absl/numeric:int128", "//absl/strings", @@ -74,7 +75,11 @@ ":hash_testing", ":spy_hash_state", "//absl/base:core_headers", + "//absl/container:btree", + "//absl/container:flat_hash_map", "//absl/container:flat_hash_set", + "//absl/container:node_hash_map", + "//absl/container:node_hash_set", "//absl/meta:type_traits", "//absl/numeric:int128", "//absl/strings:cord_test_helpers", @@ -93,6 +98,7 @@ deps = [ ":hash", "//absl/base:core_headers", + "//absl/container:flat_hash_set", "//absl/random", "//absl/strings", "//absl/strings:cord",
diff --git a/third_party/abseil-cpp/absl/hash/BUILD.gn b/third_party/abseil-cpp/absl/hash/BUILD.gn index bec226c..b2230a7 100644 --- a/third_party/abseil-cpp/absl/hash/BUILD.gn +++ b/third_party/abseil-cpp/absl/hash/BUILD.gn
@@ -18,6 +18,7 @@ "//third_party/abseil-cpp/absl/base:core_headers", "//third_party/abseil-cpp/absl/base:endian", "//third_party/abseil-cpp/absl/container:fixed_array", + "//third_party/abseil-cpp/absl/functional:function_ref", "//third_party/abseil-cpp/absl/meta:type_traits", "//third_party/abseil-cpp/absl/numeric:int128", "//third_party/abseil-cpp/absl/strings", @@ -39,6 +40,28 @@ ] } +# TODO(crbug.com/1291484): Re-enable when fixed. +# absl_source_set("hash_test") { +# testonly = true +# sources = [ "hash_test.cc" ] +# deps = [ +# ":hash", +# ":hash_testing", +# ":spy_hash_state", +# "//third_party/abseil-cpp/absl/base:core_headers", +# "//third_party/abseil-cpp/absl/container:btree", +# "//third_party/abseil-cpp/absl/container:flat_hash_map", +# "//third_party/abseil-cpp/absl/container:flat_hash_set", +# "//third_party/abseil-cpp/absl/container:node_hash_map", +# "//third_party/abseil-cpp/absl/container:node_hash_set", +# "//third_party/abseil-cpp/absl/meta:type_traits", +# "//third_party/abseil-cpp/absl/numeric:int128", +# "//third_party/abseil-cpp/absl/strings:cord_test_helpers", +# "//third_party/googletest:gtest", +# "//third_party/googletest:gmock", +# ] +# } + absl_source_set("spy_hash_state") { testonly = true public = [ "internal/spy_hash_state.h" ]
diff --git a/third_party/abseil-cpp/absl/hash/CMakeLists.txt b/third_party/abseil-cpp/absl/hash/CMakeLists.txt index 5916ae3c..34434fa 100644 --- a/third_party/abseil-cpp/absl/hash/CMakeLists.txt +++ b/third_party/abseil-cpp/absl/hash/CMakeLists.txt
@@ -30,6 +30,7 @@ absl::core_headers absl::endian absl::fixed_array + absl::function_ref absl::meta absl::int128 absl::strings @@ -68,7 +69,11 @@ absl::hash absl::hash_testing absl::core_headers + absl::btree + absl::flat_hash_map absl::flat_hash_set + absl::node_hash_map + absl::node_hash_set absl::spy_hash_state absl::meta absl::int128
diff --git a/third_party/abseil-cpp/absl/hash/hash.h b/third_party/abseil-cpp/absl/hash/hash.h index 8282ea5..f31fde4 100644 --- a/third_party/abseil-cpp/absl/hash/hash.h +++ b/third_party/abseil-cpp/absl/hash/hash.h
@@ -26,9 +26,9 @@ // support Abseil hashing without requiring you to define a hashing // algorithm. // * `HashState`, a type-erased class which implements the manipulation of the -// hash state (H) itself, contains member functions `combine()` and -// `combine_contiguous()`, which you can use to contribute to an existing -// hash state when hashing your types. +// hash state (H) itself; contains member functions `combine()`, +// `combine_contiguous()`, and `combine_unordered()`; and which you can use +// to contribute to an existing hash state when hashing your types. // // Unlike `std::hash` or other hashing frameworks, the Abseil hashing framework // provides most of its utility by abstracting away the hash algorithm (and its @@ -74,7 +74,9 @@ #define ABSL_HASH_HASH_H_ #include <tuple> +#include <utility> +#include "absl/functional/function_ref.h" #include "absl/hash/internal/hash.h" namespace absl { @@ -107,14 +109,27 @@ // * std::string_view (as well as any instance of std::basic_string that // uses char and std::char_traits) // * All the standard sequence containers (provided the elements are hashable) -// * All the standard ordered associative containers (provided the elements are +// * All the standard associative containers (provided the elements are // hashable) // * absl types such as the following: // * absl::string_view -// * absl::InlinedVector -// * absl::FixedArray // * absl::uint128 // * absl::Time, absl::Duration, and absl::TimeZone +// * absl containers (provided the elements are hashable) such as the +// following: +// * absl::flat_hash_set, absl::node_hash_set, absl::btree_set +// * absl::flat_hash_map, absl::node_hash_map, absl::btree_map +// * absl::btree_multiset, absl::btree_multimap +// * absl::InlinedVector +// * absl::FixedArray +// +// When absl::Hash is used to hash an unordered container with a custom hash +// functor, the elements are hashed using default absl::Hash semantics, not +// the custom hash functor. This is consistent with the behavior of +// operator==() on unordered containers, which compares elements pairwise with +// operator==() rather than the custom equality functor. It is usually a +// mistake to use either operator==() or absl::Hash on unordered collections +// that use functors incompatible with operator==() equality. // // Note: the list above is not meant to be exhaustive. Additional type support // may be added, in which case the above list will be updated. @@ -153,7 +168,8 @@ // that are otherwise difficult to extend using `AbslHashValue()`. (See the // `HashState` class below.) // -// The "hash state" concept contains two member functions for mixing hash state: +// The "hash state" concept contains three member functions for mixing hash +// state: // // * `H::combine(state, values...)` // @@ -187,6 +203,15 @@ // (it may perform internal optimizations). If you need this guarantee, use a // loop instead. // +// * `H::combine_unordered(state, begin, end)` +// +// Combines a set of elements denoted by an iterator pair into a hash +// state, returning the updated state. Note that the existing hash +// state is move-only and must be passed by value. +// +// Unlike the other two methods, the hashing is order-independent. +// This can be used to hash unordered collections. +// // ----------------------------------------------------------------------------- // Adding Type Support to `absl::Hash` // ----------------------------------------------------------------------------- @@ -243,8 +268,9 @@ // classes, virtual functions, etc.). The type erasure adds overhead so it // should be avoided unless necessary. // -// Note: This wrapper will only erase calls to: +// Note: This wrapper will only erase calls to // combine_contiguous(H, const unsigned char*, size_t) +// RunCombineUnordered(H, CombinerF) // // All other calls will be handled internally and will not invoke overloads // provided by the wrapped class. @@ -318,6 +344,8 @@ private: HashState() = default; + friend class HashState::HashStateBase; + template <typename T> static void CombineContiguousImpl(void* p, const unsigned char* first, size_t size) { @@ -329,16 +357,57 @@ void Init(T* state) { state_ = state; combine_contiguous_ = &CombineContiguousImpl<T>; + run_combine_unordered_ = &RunCombineUnorderedImpl<T>; + } + + template <typename HS> + struct CombineUnorderedInvoker { + template <typename T, typename ConsumerT> + void operator()(T inner_state, ConsumerT inner_cb) { + f(HashState::Create(&inner_state), + [&](HashState& inner_erased) { inner_cb(inner_erased.Real<T>()); }); + } + + absl::FunctionRef<void(HS, absl::FunctionRef<void(HS&)>)> f; + }; + + template <typename T> + static HashState RunCombineUnorderedImpl( + HashState state, + absl::FunctionRef<void(HashState, absl::FunctionRef<void(HashState&)>)> + f) { + // Note that this implementation assumes that inner_state and outer_state + // are the same type. This isn't true in the SpyHash case, but SpyHash + // types are move-convertible to each other, so this still works. + T& real_state = state.Real<T>(); + real_state = T::RunCombineUnordered( + std::move(real_state), CombineUnorderedInvoker<HashState>{f}); + return state; + } + + template <typename CombinerT> + static HashState RunCombineUnordered(HashState state, CombinerT combiner) { + auto* run = state.run_combine_unordered_; + return run(std::move(state), std::ref(combiner)); } // Do not erase an already erased state. void Init(HashState* state) { state_ = state->state_; combine_contiguous_ = state->combine_contiguous_; + run_combine_unordered_ = state->run_combine_unordered_; + } + + template <typename T> + T& Real() { + return *static_cast<T*>(state_); } void* state_; void (*combine_contiguous_)(void*, const unsigned char*, size_t); + HashState (*run_combine_unordered_)( + HashState state, + absl::FunctionRef<void(HashState, absl::FunctionRef<void(HashState&)>)>); }; ABSL_NAMESPACE_END
diff --git a/third_party/abseil-cpp/absl/hash/hash_benchmark.cc b/third_party/abseil-cpp/absl/hash/hash_benchmark.cc index d498ac2..8712a01 100644 --- a/third_party/abseil-cpp/absl/hash/hash_benchmark.cc +++ b/third_party/abseil-cpp/absl/hash/hash_benchmark.cc
@@ -19,6 +19,7 @@ #include <vector> #include "absl/base/attributes.h" +#include "absl/container/flat_hash_set.h" #include "absl/hash/hash.h" #include "absl/random/random.h" #include "absl/strings/cord.h" @@ -107,6 +108,44 @@ return result; } +template <typename T> +std::vector<T> Vector(size_t count) { + std::vector<T> result; + for (size_t v = 0; v < count; ++v) { + result.push_back(v); + } + return result; +} + +// Bogus type that replicates an unorderd_set's bit mixing, but with +// vector-speed iteration. This is intended to measure the overhead of unordered +// hashing without counting the speed of unordered_set iteration. +template <typename T> +struct FastUnorderedSet { + explicit FastUnorderedSet(size_t count) { + for (size_t v = 0; v < count; ++v) { + values.push_back(v); + } + } + std::vector<T> values; + + template <typename H> + friend H AbslHashValue(H h, const FastUnorderedSet& fus) { + return H::combine(H::combine_unordered(std::move(h), fus.values.begin(), + fus.values.end()), + fus.values.size()); + } +}; + +template <typename T> +absl::flat_hash_set<T> FlatHashSet(size_t count) { + absl::flat_hash_set<T> result; + for (size_t v = 0; v < count; ++v) { + result.insert(v); + } + return result; +} + // Generates a benchmark and a codegen method for the provided types. The // codegen method provides a well known entrypoint for dumping assembly. #define MAKE_BENCHMARK(hash, name, ...) \ @@ -145,10 +184,22 @@ MAKE_BENCHMARK(AbslHash, Cord_Flat_5000, FlatCord(5000)); MAKE_BENCHMARK(AbslHash, Cord_Fragmented_200, FragmentedCord(200)); MAKE_BENCHMARK(AbslHash, Cord_Fragmented_5000, FragmentedCord(5000)); -MAKE_BENCHMARK(AbslHash, VectorInt64_10, std::vector<int64_t>(10)); -MAKE_BENCHMARK(AbslHash, VectorInt64_100, std::vector<int64_t>(100)); -MAKE_BENCHMARK(AbslHash, VectorDouble_10, std::vector<double>(10, 1.1)); -MAKE_BENCHMARK(AbslHash, VectorDouble_100, std::vector<double>(100, 1.1)); +MAKE_BENCHMARK(AbslHash, VectorInt64_10, Vector<int64_t>(10)); +MAKE_BENCHMARK(AbslHash, VectorInt64_100, Vector<int64_t>(100)); +MAKE_BENCHMARK(AbslHash, VectorInt64_1000, Vector<int64_t>(1000)); +MAKE_BENCHMARK(AbslHash, VectorDouble_10, Vector<double>(10)); +MAKE_BENCHMARK(AbslHash, VectorDouble_100, Vector<double>(100)); +MAKE_BENCHMARK(AbslHash, VectorDouble_1000, Vector<double>(1000)); +MAKE_BENCHMARK(AbslHash, FlatHashSetInt64_10, FlatHashSet<int64_t>(10)); +MAKE_BENCHMARK(AbslHash, FlatHashSetInt64_100, FlatHashSet<int64_t>(100)); +MAKE_BENCHMARK(AbslHash, FlatHashSetInt64_1000, FlatHashSet<int64_t>(1000)); +MAKE_BENCHMARK(AbslHash, FlatHashSetDouble_10, FlatHashSet<double>(10)); +MAKE_BENCHMARK(AbslHash, FlatHashSetDouble_100, FlatHashSet<double>(100)); +MAKE_BENCHMARK(AbslHash, FlatHashSetDouble_1000, FlatHashSet<double>(1000)); +MAKE_BENCHMARK(AbslHash, FastUnorderedSetInt64_1000, + FastUnorderedSet<int64_t>(1000)); +MAKE_BENCHMARK(AbslHash, FastUnorderedSetDouble_1000, + FastUnorderedSet<double>(1000)); MAKE_BENCHMARK(AbslHash, PairStringString_0, std::make_pair(std::string(), std::string())); MAKE_BENCHMARK(AbslHash, PairStringString_10, @@ -180,6 +231,24 @@ std::vector<double>(10, 1.1)); MAKE_BENCHMARK(TypeErasedAbslHash, VectorDouble_100, std::vector<double>(100, 1.1)); +MAKE_BENCHMARK(TypeErasedAbslHash, VectorDouble_1000, + std::vector<double>(1000, 1.1)); +MAKE_BENCHMARK(TypeErasedAbslHash, FlatHashSetInt64_10, + FlatHashSet<int64_t>(10)); +MAKE_BENCHMARK(TypeErasedAbslHash, FlatHashSetInt64_100, + FlatHashSet<int64_t>(100)); +MAKE_BENCHMARK(TypeErasedAbslHash, FlatHashSetInt64_1000, + FlatHashSet<int64_t>(1000)); +MAKE_BENCHMARK(TypeErasedAbslHash, FlatHashSetDouble_10, + FlatHashSet<double>(10)); +MAKE_BENCHMARK(TypeErasedAbslHash, FlatHashSetDouble_100, + FlatHashSet<double>(100)); +MAKE_BENCHMARK(TypeErasedAbslHash, FlatHashSetDouble_1000, + FlatHashSet<double>(1000)); +MAKE_BENCHMARK(TypeErasedAbslHash, FastUnorderedSetInt64_1000, + FastUnorderedSet<int64_t>(1000)); +MAKE_BENCHMARK(TypeErasedAbslHash, FastUnorderedSetDouble_1000, + FastUnorderedSet<double>(1000)); // The latency benchmark attempts to model the speed of the hash function in // production. When a hash function is used for hashtable lookups it is rarely
diff --git a/third_party/abseil-cpp/absl/hash/hash_test.cc b/third_party/abseil-cpp/absl/hash/hash_test.cc index dbfacb2..39ff8f5 100644 --- a/third_party/abseil-cpp/absl/hash/hash_test.cc +++ b/third_party/abseil-cpp/absl/hash/hash_test.cc
@@ -34,12 +34,18 @@ #include <tuple> #include <type_traits> #include <unordered_map> +#include <unordered_set> #include <utility> #include <vector> #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "absl/container/btree_map.h" +#include "absl/container/btree_set.h" +#include "absl/container/flat_hash_map.h" #include "absl/container/flat_hash_set.h" +#include "absl/container/node_hash_map.h" +#include "absl/container/node_hash_set.h" #include "absl/hash/hash_testing.h" #include "absl/hash/internal/spy_hash_state.h" #include "absl/meta/type_traits.h" @@ -133,10 +139,10 @@ absl::Hash<std::tuple<TypeParam>>{}(std::tuple<TypeParam>(n))); } -REGISTER_TYPED_TEST_CASE_P(HashValueIntTest, BasicUsage, FastPath); +REGISTER_TYPED_TEST_SUITE_P(HashValueIntTest, BasicUsage, FastPath); using IntTypes = testing::Types<unsigned char, char, int, int32_t, int64_t, uint32_t, uint64_t, size_t>; -INSTANTIATE_TYPED_TEST_CASE_P(My, HashValueIntTest, IntTypes); +INSTANTIATE_TYPED_TEST_SUITE_P(My, HashValueIntTest, IntTypes); enum LegacyEnum { kValue1, kValue2, kValue3 }; @@ -433,6 +439,52 @@ std::bitset<kNumBits>(bit_strings[5].c_str())})); } // namespace +// Dummy type with unordered equality and hashing semantics. This preserves +// input order internally, and is used below to ensure we get test coverage +// for equal sequences with different iteraton orders. +template <typename T> +class UnorderedSequence { + public: + UnorderedSequence() = default; + template <typename TT> + UnorderedSequence(std::initializer_list<TT> l) + : values_(l.begin(), l.end()) {} + template <typename ForwardIterator, + typename std::enable_if<!std::is_integral<ForwardIterator>::value, + bool>::type = true> + UnorderedSequence(ForwardIterator begin, ForwardIterator end) + : values_(begin, end) {} + // one-argument constructor of value type T, to appease older toolchains that + // get confused by one-element initializer lists in some contexts + explicit UnorderedSequence(const T& v) : values_(&v, &v + 1) {} + + using value_type = T; + + size_t size() const { return values_.size(); } + typename std::vector<T>::const_iterator begin() const { + return values_.begin(); + } + typename std::vector<T>::const_iterator end() const { return values_.end(); } + + friend bool operator==(const UnorderedSequence& lhs, + const UnorderedSequence& rhs) { + return lhs.size() == rhs.size() && + std::is_permutation(lhs.begin(), lhs.end(), rhs.begin()); + } + friend bool operator!=(const UnorderedSequence& lhs, + const UnorderedSequence& rhs) { + return !(lhs == rhs); + } + template <typename H> + friend H AbslHashValue(H h, const UnorderedSequence& u) { + return H::combine(H::combine_unordered(std::move(h), u.begin(), u.end()), + u.size()); + } + + private: + std::vector<T> values_; +}; + template <typename T> class HashValueSequenceTest : public testing::Test { }; @@ -455,12 +507,15 @@ EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(exemplars)); } -REGISTER_TYPED_TEST_CASE_P(HashValueSequenceTest, BasicUsage); -using IntSequenceTypes = - testing::Types<std::deque<int>, std::forward_list<int>, std::list<int>, - std::vector<int>, std::vector<bool>, TypeErasedVector<int>, - TypeErasedVector<bool>, std::set<int>, std::multiset<int>>; -INSTANTIATE_TYPED_TEST_CASE_P(My, HashValueSequenceTest, IntSequenceTypes); +REGISTER_TYPED_TEST_SUITE_P(HashValueSequenceTest, BasicUsage); +using IntSequenceTypes = testing::Types< + std::deque<int>, std::forward_list<int>, std::list<int>, std::vector<int>, + std::vector<bool>, TypeErasedContainer<std::vector<int>>, std::set<int>, + std::multiset<int>, UnorderedSequence<int>, + TypeErasedContainer<UnorderedSequence<int>>, std::unordered_set<int>, + std::unordered_multiset<int>, absl::flat_hash_set<int>, + absl::node_hash_set<int>, absl::btree_set<int>>; +INSTANTIATE_TYPED_TEST_SUITE_P(My, HashValueSequenceTest, IntSequenceTypes); template <typename T> class HashValueNestedSequenceTest : public testing::Test {}; @@ -486,13 +541,17 @@ EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(exemplars)); } -REGISTER_TYPED_TEST_CASE_P(HashValueNestedSequenceTest, BasicUsage); -using NestedIntSequenceTypes = - testing::Types<std::vector<std::vector<int>>, - std::vector<TypeErasedVector<int>>, - TypeErasedVector<std::vector<int>>, - TypeErasedVector<TypeErasedVector<int>>>; -INSTANTIATE_TYPED_TEST_CASE_P(My, HashValueNestedSequenceTest, +REGISTER_TYPED_TEST_SUITE_P(HashValueNestedSequenceTest, BasicUsage); +template <typename T> +using TypeErasedSet = TypeErasedContainer<UnorderedSequence<T>>; + +using NestedIntSequenceTypes = testing::Types< + std::vector<std::vector<int>>, std::vector<UnorderedSequence<int>>, + std::vector<TypeErasedSet<int>>, UnorderedSequence<std::vector<int>>, + UnorderedSequence<UnorderedSequence<int>>, + UnorderedSequence<TypeErasedSet<int>>, TypeErasedSet<std::vector<int>>, + TypeErasedSet<UnorderedSequence<int>>, TypeErasedSet<TypeErasedSet<int>>>; +INSTANTIATE_TYPED_TEST_SUITE_P(My, HashValueNestedSequenceTest, NestedIntSequenceTypes); // Private type that only supports AbslHashValue to make sure our chosen hash @@ -673,9 +732,13 @@ EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(exemplars)); } -REGISTER_TYPED_TEST_CASE_P(HashValueAssociativeMapTest, BasicUsage); -using AssociativeMapTypes = testing::Types<std::map<int, std::string>>; -INSTANTIATE_TYPED_TEST_CASE_P(My, HashValueAssociativeMapTest, +REGISTER_TYPED_TEST_SUITE_P(HashValueAssociativeMapTest, BasicUsage); +using AssociativeMapTypes = testing::Types< + std::map<int, std::string>, std::unordered_map<int, std::string>, + absl::flat_hash_map<int, std::string>, + absl::node_hash_map<int, std::string>, absl::btree_map<int, std::string>, + UnorderedSequence<std::pair<const int, std::string>>>; +INSTANTIATE_TYPED_TEST_SUITE_P(My, HashValueAssociativeMapTest, AssociativeMapTypes); template <typename T> @@ -700,10 +763,11 @@ EXPECT_TRUE(absl::VerifyTypeImplementsAbslHashCorrectly(exemplars)); } -REGISTER_TYPED_TEST_CASE_P(HashValueAssociativeMultimapTest, BasicUsage); +REGISTER_TYPED_TEST_SUITE_P(HashValueAssociativeMultimapTest, BasicUsage); using AssociativeMultimapTypes = - testing::Types<std::multimap<int, std::string>>; -INSTANTIATE_TYPED_TEST_CASE_P(My, HashValueAssociativeMultimapTest, + testing::Types<std::multimap<int, std::string>, + std::unordered_multimap<int, std::string>>; +INSTANTIATE_TYPED_TEST_SUITE_P(My, HashValueAssociativeMultimapTest, AssociativeMultimapTypes); TEST(HashValueTest, ReferenceWrapper) { @@ -943,10 +1007,10 @@ Hash<CombineVariadic<TypeParam>>()({})); } -REGISTER_TYPED_TEST_CASE_P(HashIntTest, BasicUsage); +REGISTER_TYPED_TEST_SUITE_P(HashIntTest, BasicUsage); using IntTypes = testing::Types<unsigned char, char, int, int32_t, int64_t, uint32_t, uint64_t, size_t>; -INSTANTIATE_TYPED_TEST_CASE_P(My, HashIntTest, IntTypes); +INSTANTIATE_TYPED_TEST_SUITE_P(My, HashIntTest, IntTypes); struct StructWithPadding { char c; @@ -1062,6 +1126,14 @@ EXPECT_EQ(SpyHash(std::make_pair(TypeErasedValue<size_t>(7), 17)), SpyHash(std::make_pair(size_t{7}, 17))); + + absl::flat_hash_set<absl::flat_hash_set<int>> ss = {{1, 2}, {3, 4}}; + TypeErasedContainer<absl::flat_hash_set<absl::flat_hash_set<int>>> es = { + absl::flat_hash_set<int>{1, 2}, {3, 4}}; + absl::flat_hash_set<TypeErasedContainer<absl::flat_hash_set<int>>> se = { + {1, 2}, {3, 4}}; + EXPECT_EQ(SpyHash(ss), SpyHash(es)); + EXPECT_EQ(SpyHash(ss), SpyHash(se)); } struct ValueWithBoolConversion {
diff --git a/third_party/abseil-cpp/absl/hash/internal/hash.h b/third_party/abseil-cpp/absl/hash/internal/hash.h index 97b68ba..a424e014 100644 --- a/third_party/abseil-cpp/absl/hash/internal/hash.h +++ b/third_party/abseil-cpp/absl/hash/internal/hash.h
@@ -23,6 +23,7 @@ #include <array> #include <bitset> #include <cmath> +#include <cstddef> #include <cstring> #include <deque> #include <forward_list> @@ -36,6 +37,8 @@ #include <string> #include <tuple> #include <type_traits> +#include <unordered_map> +#include <unordered_set> #include <utility> #include <vector> @@ -54,6 +57,9 @@ namespace absl { ABSL_NAMESPACE_BEGIN + +class HashState; + namespace hash_internal { // Internal detail: Large buffers are hashed in smaller chunks. This function @@ -115,24 +121,66 @@ size_t position_; }; +// is_hashable() +// +// Trait class which returns true if T is hashable by the absl::Hash framework. +// Used for the AbslHashValue implementations for composite types below. +template <typename T> +struct is_hashable; + // HashStateBase // -// A hash state object represents an intermediate state in the computation -// of an unspecified hash algorithm. `HashStateBase` provides a CRTP style -// base class for hash state implementations. Developers adding type support -// for `absl::Hash` should not rely on any parts of the state object other than -// the following member functions: +// An internal implementation detail that contains common implementation details +// for all of the "hash state objects" objects generated by Abseil. This is not +// a public API; users should not create classes that inherit from this. +// +// A hash state object is the template argument `H` passed to `AbslHashValue`. +// It represents an intermediate state in the computation of an unspecified hash +// algorithm. `HashStateBase` provides a CRTP style base class for hash state +// implementations. Developers adding type support for `absl::Hash` should not +// rely on any parts of the state object other than the following member +// functions: // // * HashStateBase::combine() // * HashStateBase::combine_contiguous() +// * HashStateBase::combine_unordered() // -// A derived hash state class of type `H` must provide a static member function +// A derived hash state class of type `H` must provide a public member function // with a signature similar to the following: // // `static H combine_contiguous(H state, const unsigned char*, size_t)`. // +// It must also provide a private template method named RunCombineUnordered. +// +// A "consumer" is a 1-arg functor returning void. Its argument is a reference +// to an inner hash state object, and it may be called multiple times. When +// called, the functor consumes the entropy from the provided state object, +// and resets that object to its empty state. +// +// A "combiner" is a stateless 2-arg functor returning void. Its arguments are +// an inner hash state object and an ElementStateConsumer functor. A combiner +// uses the provided inner hash state object to hash each element of the +// container, passing the inner hash state object to the consumer after hashing +// each element. +// +// Given these definitions, a derived hash state class of type H +// must provide a private template method with a signature similar to the +// following: +// +// `template <typename CombinerT>` +// `static H RunCombineUnordered(H outer_state, CombinerT combiner)` +// +// This function is responsible for constructing the inner state object and +// providing a consumer to the combiner. It uses side effects of the consumer +// and combiner to mix the state of each element in an order-independent manner, +// and uses this to return an updated value of `outer_state`. +// +// This inside-out approach generates efficient object code in the normal case, +// but allows us to use stack storage to implement the absl::HashState type +// erasure mechanism (avoiding heap allocations while hashing). +// // `HashStateBase` will provide a complete implementation for a hash state -// object in terms of this method. +// object in terms of these two methods. // // Example: // @@ -141,6 +189,10 @@ // static H combine_contiguous(H state, const unsigned char*, size_t); // using MyHashState::HashStateBase::combine; // using MyHashState::HashStateBase::combine_contiguous; +// using MyHashState::HashStateBase::combine_unordered; +// private: +// template <typename CombinerT> +// static H RunCombineUnordered(H state, CombinerT combiner); // }; template <typename H> class HashStateBase { @@ -181,7 +233,30 @@ template <typename T> static H combine_contiguous(H state, const T* data, size_t size); + template <typename I> + static H combine_unordered(H state, I begin, I end); + using AbslInternalPiecewiseCombiner = PiecewiseCombiner; + + template <typename T> + using is_hashable = absl::hash_internal::is_hashable<T>; + + private: + // Common implementation of the iteration step of a "combiner", as described + // above. + template <typename I> + struct CombineUnorderedCallback { + I begin; + I end; + + template <typename InnerH, typename ElementStateConsumer> + void operator()(InnerH inner_state, ElementStateConsumer cb) { + for (; begin != end; ++begin) { + inner_state = H::combine(std::move(inner_state), *begin); + cb(inner_state); + } + } + }; }; // is_uniquely_represented @@ -350,13 +425,6 @@ // AbslHashValue for Composite Types // ----------------------------------------------------------------------------- -// is_hashable() -// -// Trait class which returns true if T is hashable by the absl::Hash framework. -// Used for the AbslHashValue implementations for composite types below. -template <typename T> -struct is_hashable; - // AbslHashValue() for hashing pairs template <typename H, typename T1, typename T2> typename std::enable_if<is_hashable<T1>::value && is_hashable<T2>::value, @@ -503,8 +571,10 @@ } // AbslHashValue special cases for hashing std::vector<bool> + #if defined(ABSL_IS_BIG_ENDIAN) && \ (defined(__GLIBCXX__) || defined(__GLIBCPP__)) + // std::hash in libstdc++ does not work correctly with vector<bool> on Big // Endian platforms therefore we need to implement a custom AbslHashValue for // it. More details on the bug: @@ -588,6 +658,55 @@ } // ----------------------------------------------------------------------------- +// AbslHashValue for Unordered Associative Containers +// ----------------------------------------------------------------------------- + +// AbslHashValue for hashing std::unordered_set +template <typename H, typename Key, typename Hash, typename KeyEqual, + typename Alloc> +typename std::enable_if<is_hashable<Key>::value, H>::type AbslHashValue( + H hash_state, const std::unordered_set<Key, Hash, KeyEqual, Alloc>& s) { + return H::combine( + H::combine_unordered(std::move(hash_state), s.begin(), s.end()), + s.size()); +} + +// AbslHashValue for hashing std::unordered_multiset +template <typename H, typename Key, typename Hash, typename KeyEqual, + typename Alloc> +typename std::enable_if<is_hashable<Key>::value, H>::type AbslHashValue( + H hash_state, + const std::unordered_multiset<Key, Hash, KeyEqual, Alloc>& s) { + return H::combine( + H::combine_unordered(std::move(hash_state), s.begin(), s.end()), + s.size()); +} + +// AbslHashValue for hashing std::unordered_set +template <typename H, typename Key, typename T, typename Hash, + typename KeyEqual, typename Alloc> +typename std::enable_if<is_hashable<Key>::value && is_hashable<T>::value, + H>::type +AbslHashValue(H hash_state, + const std::unordered_map<Key, T, Hash, KeyEqual, Alloc>& s) { + return H::combine( + H::combine_unordered(std::move(hash_state), s.begin(), s.end()), + s.size()); +} + +// AbslHashValue for hashing std::unordered_multiset +template <typename H, typename Key, typename T, typename Hash, + typename KeyEqual, typename Alloc> +typename std::enable_if<is_hashable<Key>::value && is_hashable<T>::value, + H>::type +AbslHashValue(H hash_state, + const std::unordered_multimap<Key, T, Hash, KeyEqual, Alloc>& s) { + return H::combine( + H::combine_unordered(std::move(hash_state), s.begin(), s.end()), + s.size()); +} + +// ----------------------------------------------------------------------------- // AbslHashValue for Wrapper Types // ----------------------------------------------------------------------------- @@ -830,6 +949,31 @@ // move-only ensures that there is only one non-moved-from object. MixingHashState() : state_(Seed()) {} + friend class MixingHashState::HashStateBase; + + template <typename CombinerT> + static MixingHashState RunCombineUnordered(MixingHashState state, + CombinerT combiner) { + uint64_t unordered_state = 0; + combiner(MixingHashState{}, [&](MixingHashState& inner_state) { + // Add the hash state of the element to the running total, but mix the + // carry bit back into the low bit. This in intended to avoid losing + // entropy to overflow, especially when unordered_multisets contain + // multiple copies of the same value. + auto element_state = inner_state.state_; + unordered_state += element_state; + if (unordered_state < element_state) { + ++unordered_state; + } + inner_state = MixingHashState{}; + }); + return MixingHashState::combine(std::move(state), unordered_state); + } + + // Allow the HashState type-erasure implementation to invoke + // RunCombinedUnordered() directly. + friend class absl::HashState; + // Workaround for MSVC bug. // We make the type copyable to fix the calling convention, even though we // never actually copy it. Keep it private to not affect the public API of the @@ -1064,6 +1208,14 @@ return hash_internal::hash_range_or_bytes(std::move(state), data, size); } +// HashStateBase::combine_unordered() +template <typename H> +template <typename I> +H HashStateBase<H>::combine_unordered(H state, I begin, I end) { + return H::RunCombineUnordered(std::move(state), + CombineUnorderedCallback<I>{begin, end}); +} + // HashStateBase::PiecewiseCombiner::add_buffer() template <typename H> H PiecewiseCombiner::add_buffer(H state, const unsigned char* data,
diff --git a/third_party/abseil-cpp/absl/hash/internal/spy_hash_state.h b/third_party/abseil-cpp/absl/hash/internal/spy_hash_state.h index c083120..0972826 100644 --- a/third_party/abseil-cpp/absl/hash/internal/spy_hash_state.h +++ b/third_party/abseil-cpp/absl/hash/internal/spy_hash_state.h
@@ -15,6 +15,7 @@ #ifndef ABSL_HASH_INTERNAL_SPY_HASH_STATE_H_ #define ABSL_HASH_INTERNAL_SPY_HASH_STATE_H_ +#include <algorithm> #include <ostream> #include <string> #include <vector> @@ -167,6 +168,24 @@ using SpyHashStateImpl::HashStateBase::combine_contiguous; + template <typename CombinerT> + static SpyHashStateImpl RunCombineUnordered(SpyHashStateImpl state, + CombinerT combiner) { + UnorderedCombinerCallback cb; + + combiner(SpyHashStateImpl<void>{}, std::ref(cb)); + + std::sort(cb.element_hash_representations.begin(), + cb.element_hash_representations.end()); + state.hash_representation_.insert(state.hash_representation_.end(), + cb.element_hash_representations.begin(), + cb.element_hash_representations.end()); + if (cb.error && cb.error->has_value()) { + state.error_ = std::move(cb.error); + } + return state; + } + absl::optional<std::string> error() const { if (moved_from_) { return "Returned a moved-from instance of the hash state object."; @@ -178,6 +197,22 @@ template <typename U> friend class SpyHashStateImpl; + struct UnorderedCombinerCallback { + std::vector<std::string> element_hash_representations; + std::shared_ptr<absl::optional<std::string>> error; + + // The inner spy can have a different type. + template <typename U> + void operator()(SpyHashStateImpl<U>& inner) { + element_hash_representations.push_back( + absl::StrJoin(inner.hash_representation_, "")); + if (inner.error_->has_value()) { + error = std::move(inner.error_); + } + inner = SpyHashStateImpl<void>{}; + } + }; + // This is true if SpyHashStateImpl<T> has been passed to a call of // AbslHashValue with the wrong type. This detects that the user called // AbslHashValue directly (because the hash state type does not match).
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 fc269bd..5f65983bc 100644 --- a/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h +++ b/third_party/abseil-cpp/absl/profiling/internal/sample_recorder.h
@@ -46,6 +46,7 @@ absl::Mutex init_mu; T* next = nullptr; T* dead ABSL_GUARDED_BY(init_mu) = nullptr; + int64_t weight; // How many sampling events were required to sample this one. }; // Holds samples and their associated stack traces with a soft limit of
diff --git a/third_party/abseil-cpp/absl/profiling/internal/sample_recorder_test.cc b/third_party/abseil-cpp/absl/profiling/internal/sample_recorder_test.cc index ec6e0fa..3373329 100644 --- a/third_party/abseil-cpp/absl/profiling/internal/sample_recorder_test.cc +++ b/third_party/abseil-cpp/absl/profiling/internal/sample_recorder_test.cc
@@ -36,7 +36,7 @@ struct Info : public Sample<Info> { public: - void PrepareForSampling() {} + void PrepareForSampling(int64_t w) { weight = w; } std::atomic<size_t> size; absl::Time create_time; }; @@ -49,8 +49,14 @@ return res; } -Info* Register(SampleRecorder<Info>* s, size_t size) { - auto* info = s->Register(); +std::vector<int64_t> GetWeights(SampleRecorder<Info>* s) { + std::vector<int64_t> res; + s->Iterate([&](const Info& info) { res.push_back(info.weight); }); + return res; +} + +Info* Register(SampleRecorder<Info>* s, int64_t weight, size_t size) { + auto* info = s->Register(weight); assert(info != nullptr); info->size.store(size); return info; @@ -58,13 +64,15 @@ TEST(SampleRecorderTest, Registration) { SampleRecorder<Info> sampler; - auto* info1 = Register(&sampler, 1); + auto* info1 = Register(&sampler, 31, 1); EXPECT_THAT(GetSizes(&sampler), UnorderedElementsAre(1)); + EXPECT_THAT(GetWeights(&sampler), UnorderedElementsAre(31)); - auto* info2 = Register(&sampler, 2); + auto* info2 = Register(&sampler, 32, 2); EXPECT_THAT(GetSizes(&sampler), UnorderedElementsAre(1, 2)); info1->size.store(3); EXPECT_THAT(GetSizes(&sampler), UnorderedElementsAre(3, 2)); + EXPECT_THAT(GetWeights(&sampler), UnorderedElementsAre(31, 32)); sampler.Unregister(info1); sampler.Unregister(info2); @@ -74,18 +82,22 @@ SampleRecorder<Info> sampler; std::vector<Info*> infos; for (size_t i = 0; i < 3; ++i) { - infos.push_back(Register(&sampler, i)); + infos.push_back(Register(&sampler, 33 + i, i)); } EXPECT_THAT(GetSizes(&sampler), UnorderedElementsAre(0, 1, 2)); + EXPECT_THAT(GetWeights(&sampler), UnorderedElementsAre(33, 34, 35)); sampler.Unregister(infos[1]); EXPECT_THAT(GetSizes(&sampler), UnorderedElementsAre(0, 2)); + EXPECT_THAT(GetWeights(&sampler), UnorderedElementsAre(33, 35)); - infos.push_back(Register(&sampler, 3)); - infos.push_back(Register(&sampler, 4)); + infos.push_back(Register(&sampler, 36, 3)); + infos.push_back(Register(&sampler, 37, 4)); EXPECT_THAT(GetSizes(&sampler), UnorderedElementsAre(0, 2, 3, 4)); + EXPECT_THAT(GetWeights(&sampler), UnorderedElementsAre(33, 35, 36, 37)); sampler.Unregister(infos[3]); EXPECT_THAT(GetSizes(&sampler), UnorderedElementsAre(0, 2, 4)); + EXPECT_THAT(GetWeights(&sampler), UnorderedElementsAre(33, 35, 37)); sampler.Unregister(infos[0]); sampler.Unregister(infos[2]); @@ -99,18 +111,18 @@ ThreadPool pool(10); for (int i = 0; i < 10; ++i) { - pool.Schedule([&sampler, &stop]() { + pool.Schedule([&sampler, &stop, i]() { std::random_device rd; std::mt19937 gen(rd()); std::vector<Info*> infoz; while (!stop.HasBeenNotified()) { if (infoz.empty()) { - infoz.push_back(sampler.Register()); + infoz.push_back(sampler.Register(i)); } switch (std::uniform_int_distribution<>(0, 2)(gen)) { case 0: { - infoz.push_back(sampler.Register()); + infoz.push_back(sampler.Register(i)); break; } case 1: { @@ -119,6 +131,7 @@ Info* info = infoz[p]; infoz[p] = infoz.back(); infoz.pop_back(); + EXPECT_EQ(info->weight, i); sampler.Unregister(info); break; } @@ -143,8 +156,8 @@ TEST(SampleRecorderTest, Callback) { SampleRecorder<Info> sampler; - auto* info1 = Register(&sampler, 1); - auto* info2 = Register(&sampler, 2); + auto* info1 = Register(&sampler, 39, 1); + auto* info2 = Register(&sampler, 40, 2); static const Info* expected;
diff --git a/third_party/abseil-cpp/absl/random/internal/randen.h b/third_party/abseil-cpp/absl/random/internal/randen.h index 9a3840b8..9ff4a7a 100644 --- a/third_party/abseil-cpp/absl/random/internal/randen.h +++ b/third_party/abseil-cpp/absl/random/internal/randen.h
@@ -43,10 +43,8 @@ // Generate updates the randen sponge. The outer portion of the sponge // (kCapacityBytes .. kStateBytes) may be consumed as PRNG state. - template <typename T, size_t N> - void Generate(T (&state)[N]) const { - static_assert(N * sizeof(T) == kStateBytes, - "Randen::Generate() requires kStateBytes of state"); + // REQUIRES: state points to kStateBytes of state. + inline void Generate(void* state) const { #if ABSL_RANDOM_INTERNAL_AES_DISPATCH // HW AES Dispatch. if (has_crypto_) { @@ -65,13 +63,9 @@ // Absorb incorporates additional seed material into the randen sponge. After // absorb returns, Generate must be called before the state may be consumed. - template <typename S, size_t M, typename T, size_t N> - void Absorb(const S (&seed)[M], T (&state)[N]) const { - static_assert(M * sizeof(S) == RandenTraits::kSeedBytes, - "Randen::Absorb() requires kSeedBytes of seed"); - - static_assert(N * sizeof(T) == RandenTraits::kStateBytes, - "Randen::Absorb() requires kStateBytes of state"); + // REQUIRES: seed points to kSeedBytes of seed. + // REQUIRES: state points to kStateBytes of state. + inline void Absorb(const void* seed, void* state) const { #if ABSL_RANDOM_INTERNAL_AES_DISPATCH // HW AES Dispatch. if (has_crypto_) {
diff --git a/third_party/abseil-cpp/absl/random/internal/randen_engine.h b/third_party/abseil-cpp/absl/random/internal/randen_engine.h index 372c3ac..b4708664 100644 --- a/third_party/abseil-cpp/absl/random/internal/randen_engine.h +++ b/third_party/abseil-cpp/absl/random/internal/randen_engine.h
@@ -42,7 +42,7 @@ // 'Strong' (well-distributed, unpredictable, backtracking-resistant) random // generator, faster in some benchmarks than std::mt19937_64 and pcg64_c32. template <typename T> -class alignas(16) randen_engine { +class alignas(8) randen_engine { public: // C++11 URBG interface: using result_type = T; @@ -58,7 +58,8 @@ return (std::numeric_limits<result_type>::max)(); } - explicit randen_engine(result_type seed_value = 0) { seed(seed_value); } + randen_engine() : randen_engine(0) {} + explicit randen_engine(result_type seed_value) { seed(seed_value); } template <class SeedSequence, typename = typename absl::enable_if_t< @@ -67,17 +68,27 @@ seed(seq); } - randen_engine(const randen_engine&) = default; + // alignment requirements dictate custom copy and move constructors. + randen_engine(const randen_engine& other) + : next_(other.next_), impl_(other.impl_) { + std::memcpy(state(), other.state(), kStateSizeT * sizeof(result_type)); + } + randen_engine& operator=(const randen_engine& other) { + next_ = other.next_; + impl_ = other.impl_; + std::memcpy(state(), other.state(), kStateSizeT * sizeof(result_type)); + return *this; + } // Returns random bits from the buffer in units of result_type. result_type operator()() { // Refill the buffer if needed (unlikely). + auto* begin = state(); if (next_ >= kStateSizeT) { next_ = kCapacityT; - impl_.Generate(state_); + impl_.Generate(begin); } - - return little_endian::ToHost(state_[next_++]); + return little_endian::ToHost(begin[next_++]); } template <class SeedSequence> @@ -92,9 +103,10 @@ void seed(result_type seed_value = 0) { next_ = kStateSizeT; // Zeroes the inner state and fills the outer state with seed_value to - // mimics behaviour of reseed - std::fill(std::begin(state_), std::begin(state_) + kCapacityT, 0); - std::fill(std::begin(state_) + kCapacityT, std::end(state_), seed_value); + // mimic the behaviour of reseed + auto* begin = state(); + std::fill(begin, begin + kCapacityT, 0); + std::fill(begin + kCapacityT, begin + kStateSizeT, seed_value); } // Inserts entropy into (part of) the state. Calling this periodically with @@ -105,7 +117,6 @@ using sequence_result_type = typename SeedSequence::result_type; static_assert(sizeof(sequence_result_type) == 4, "SeedSequence::result_type must be 32-bit"); - constexpr size_t kBufferSize = Randen::kSeedBytes / sizeof(sequence_result_type); alignas(16) sequence_result_type buffer[kBufferSize]; @@ -119,8 +130,8 @@ if (entropy_size < kBufferSize) { // ... and only request that many values, or 256-bits, when unspecified. const size_t requested_entropy = (entropy_size == 0) ? 8u : entropy_size; - std::fill(std::begin(buffer) + requested_entropy, std::end(buffer), 0); - seq.generate(std::begin(buffer), std::begin(buffer) + requested_entropy); + std::fill(buffer + requested_entropy, buffer + kBufferSize, 0); + seq.generate(buffer, buffer + requested_entropy); #ifdef ABSL_IS_BIG_ENDIAN // Randen expects the seed buffer to be in Little Endian; reverse it on // Big Endian platforms. @@ -146,9 +157,9 @@ std::swap(buffer[--dst], buffer[--src]); } } else { - seq.generate(std::begin(buffer), std::end(buffer)); + seq.generate(buffer, buffer + kBufferSize); } - impl_.Absorb(buffer, state_); + impl_.Absorb(buffer, state()); // Generate will be called when operator() is called next_ = kStateSizeT; @@ -159,9 +170,10 @@ count -= step; constexpr uint64_t kRateT = kStateSizeT - kCapacityT; + auto* begin = state(); while (count > 0) { next_ = kCapacityT; - impl_.Generate(state_); + impl_.Generate(*reinterpret_cast<result_type(*)[kStateSizeT]>(begin)); step = std::min<uint64_t>(kRateT, count); count -= step; } @@ -169,9 +181,9 @@ } bool operator==(const randen_engine& other) const { + const auto* begin = state(); return next_ == other.next_ && - std::equal(std::begin(state_), std::end(state_), - std::begin(other.state_)); + std::equal(begin, begin + kStateSizeT, other.state()); } bool operator!=(const randen_engine& other) const { @@ -185,11 +197,12 @@ using numeric_type = typename random_internal::stream_format_type<result_type>::type; auto saver = random_internal::make_ostream_state_saver(os); - for (const auto& elem : engine.state_) { + auto* it = engine.state(); + for (auto* end = it + kStateSizeT; it < end; ++it) { // In the case that `elem` is `uint8_t`, it must be cast to something // larger so that it prints as an integer rather than a character. For // simplicity, apply the cast all circumstances. - os << static_cast<numeric_type>(little_endian::FromHost(elem)) + os << static_cast<numeric_type>(little_endian::FromHost(*it)) << os.fill(); } os << engine.next_; @@ -215,7 +228,7 @@ if (is.fail()) { return is; } - std::memcpy(engine.state_, state, sizeof(engine.state_)); + std::memcpy(engine.state(), state, sizeof(state)); engine.next_ = next; return is; } @@ -226,9 +239,21 @@ static constexpr size_t kCapacityT = Randen::kCapacityBytes / sizeof(result_type); - // First kCapacityT are `inner', the others are accessible random bits. - alignas(16) result_type state_[kStateSizeT]; - size_t next_; // index within state_ + // Returns the state array pointer, which is aligned to 16 bytes. + // The first kCapacityT are the `inner' sponge; the remainder are available. + result_type* state() { + return reinterpret_cast<result_type*>( + (reinterpret_cast<uintptr_t>(&raw_state_) & 0xf) ? (raw_state_ + 8) + : raw_state_); + } + const result_type* state() const { + return const_cast<randen_engine*>(this)->state(); + } + + // raw state array, manually aligned in state(). This overallocates + // by 8 bytes since C++ does not guarantee extended heap alignment. + alignas(8) char raw_state_[Randen::kStateBytes + 8]; + size_t next_; // index within state() Randen impl_; };
diff --git a/third_party/abseil-cpp/absl/status/internal/status_internal.h b/third_party/abseil-cpp/absl/status/internal/status_internal.h index ac12940..34914d2 100644 --- a/third_party/abseil-cpp/absl/status/internal/status_internal.h +++ b/third_party/abseil-cpp/absl/status/internal/status_internal.h
@@ -16,6 +16,7 @@ #include <string> +#include "absl/base/attributes.h" #include "absl/container/inlined_vector.h" #include "absl/strings/cord.h" @@ -25,7 +26,14 @@ ABSL_NAMESPACE_BEGIN // Returned Status objects may not be ignored. Codesearch doesn't handle ifdefs // as part of a class definitions (b/6995610), so we use a forward declaration. +// +// TODO(b/176172494): ABSL_MUST_USE_RESULT should expand to the more strict +// [[nodiscard]]. For now, just use [[nodiscard]] directly when it is available. +#if ABSL_HAVE_CPP_ATTRIBUTE(nodiscard) +class [[nodiscard]] Status; +#else class ABSL_MUST_USE_RESULT Status; +#endif ABSL_NAMESPACE_END } // namespace absl #endif // !SWIG
diff --git a/third_party/abseil-cpp/absl/status/statusor.h b/third_party/abseil-cpp/absl/status/statusor.h index c051fbb3..d6ebdc2 100644 --- a/third_party/abseil-cpp/absl/status/statusor.h +++ b/third_party/abseil-cpp/absl/status/statusor.h
@@ -106,7 +106,13 @@ // Returned StatusOr objects may not be ignored. template <typename T> +#if ABSL_HAVE_CPP_ATTRIBUTE(nodiscard) +// TODO(b/176172494): ABSL_MUST_USE_RESULT should expand to the more strict +// [[nodiscard]]. For now, just use [[nodiscard]] directly when it is available. +class [[nodiscard]] StatusOr; +#else class ABSL_MUST_USE_RESULT StatusOr; +#endif // ABSL_HAVE_CPP_ATTRIBUTE(nodiscard) // absl::StatusOr<T> //
diff --git a/third_party/abseil-cpp/absl/strings/internal/escaping.cc b/third_party/abseil-cpp/absl/strings/internal/escaping.cc index c5271286a..7f87e124 100644 --- a/third_party/abseil-cpp/absl/strings/internal/escaping.cc +++ b/third_party/abseil-cpp/absl/strings/internal/escaping.cc
@@ -102,8 +102,8 @@ } } // To save time, we didn't update szdest or szsrc in the loop. So do it now. - szdest = limit_dest - cur_dest; - szsrc = limit_src - cur_src; + szdest = static_cast<size_t>(limit_dest - cur_dest); + szsrc = static_cast<size_t>(limit_src - cur_src); /* now deal with the tail (<=3 bytes) */ switch (szsrc) { @@ -154,7 +154,8 @@ // the loop because the loop above always reads 4 bytes, and the fourth // byte is past the end of the input. if (szdest < 4) return 0; - uint32_t in = (cur_src[0] << 16) + absl::big_endian::Load16(cur_src + 1); + uint32_t in = + (uint32_t{cur_src[0]} << 16) + absl::big_endian::Load16(cur_src + 1); cur_dest[0] = base64[in >> 18]; in &= 0x3FFFF; cur_dest[1] = base64[in >> 12]; @@ -172,7 +173,7 @@ ABSL_RAW_LOG(FATAL, "Logic problem? szsrc = %zu", szsrc); break; } - return (cur_dest - dest); + return static_cast<size_t>(cur_dest - dest); } } // namespace strings_internal
diff --git a/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc b/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc index 05324c780..dc6cfe1 100644 --- a/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc +++ b/third_party/abseil-cpp/absl/strings/internal/ostringstream.cc
@@ -27,7 +27,7 @@ std::streamsize OStringStream::xsputn(const char* s, std::streamsize n) { assert(s_); - s_->append(s, n); + s_->append(s, static_cast<size_t>(n)); return n; }
diff --git a/third_party/abseil-cpp/absl/strings/internal/utf8.cc b/third_party/abseil-cpp/absl/strings/internal/utf8.cc index 8fd8edc1..7ecb93d 100644 --- a/third_party/abseil-cpp/absl/strings/internal/utf8.cc +++ b/third_party/abseil-cpp/absl/strings/internal/utf8.cc
@@ -25,25 +25,25 @@ *buffer = static_cast<char>(utf8_char); return 1; } else if (utf8_char <= 0x7FF) { - buffer[1] = 0x80 | (utf8_char & 0x3F); + buffer[1] = static_cast<char>(0x80 | (utf8_char & 0x3F)); utf8_char >>= 6; - buffer[0] = 0xC0 | utf8_char; + buffer[0] = static_cast<char>(0xC0 | utf8_char); return 2; } else if (utf8_char <= 0xFFFF) { - buffer[2] = 0x80 | (utf8_char & 0x3F); + buffer[2] = static_cast<char>(0x80 | (utf8_char & 0x3F)); utf8_char >>= 6; - buffer[1] = 0x80 | (utf8_char & 0x3F); + buffer[1] = static_cast<char>(0x80 | (utf8_char & 0x3F)); utf8_char >>= 6; - buffer[0] = 0xE0 | utf8_char; + buffer[0] = static_cast<char>(0xE0 | utf8_char); return 3; } else { - buffer[3] = 0x80 | (utf8_char & 0x3F); + buffer[3] = static_cast<char>(0x80 | (utf8_char & 0x3F)); utf8_char >>= 6; - buffer[2] = 0x80 | (utf8_char & 0x3F); + buffer[2] = static_cast<char>(0x80 | (utf8_char & 0x3F)); utf8_char >>= 6; - buffer[1] = 0x80 | (utf8_char & 0x3F); + buffer[1] = static_cast<char>(0x80 | (utf8_char & 0x3F)); utf8_char >>= 6; - buffer[0] = 0xF0 | utf8_char; + buffer[0] = static_cast<char>(0xF0 | utf8_char); return 4; } }
diff --git a/third_party/abseil-cpp/symbols_arm64_dbg.def b/third_party/abseil-cpp/symbols_arm64_dbg.def index ff87ecc..cc1e519 100644 --- a/third_party/abseil-cpp/symbols_arm64_dbg.def +++ b/third_party/abseil-cpp/symbols_arm64_dbg.def
@@ -350,7 +350,6 @@ ??$FromInt64@$0DLJKMKAA@@time_internal@absl@@YA?AVDuration@1@_JV?$ratio@$00$0DLJKMKAA@@__1@std@@@Z ??$FromInt64@$0DOI@@time_internal@absl@@YA?AVDuration@1@_JV?$ratio@$00$0DOI@@__1@std@@@Z ??$FromInt64@$0PECEA@@time_internal@absl@@YA?AVDuration@1@_JV?$ratio@$00$0PECEA@@__1@std@@@Z - ??$Generate@I$0EA@@Randen@random_internal@absl@@QEBAXAEAY0EA@I@Z ??$GenericCompare@HVCord@absl@@@absl@@YAHAEBVCord@0@0_K@Z ??$GenericCompare@HVstring_view@absl@@@absl@@YAHAEBVCord@0@AEBVstring_view@0@_K@Z ??$GenericCompare@_NVCord@absl@@@absl@@YA_NAEBVCord@0@0_K@Z @@ -424,9 +423,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 + ??$PopDead@_J_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_J_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 + ??$Register@AEB_JAEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEB_JAEA_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 @@ -654,6 +653,7 @@ ??$emplace_back@PEAUCordRep@cord_internal@absl@@@?$InlinedVector@PEAUCordRep@cord_internal@absl@@$0CP@V?$allocator@PEAUCordRep@cord_internal@absl@@@__1@std@@@absl@@QEAAAEAPEAUCordRep@cord_internal@1@$$QEAPEAU231@@Z ??$emplace_back@UPayload@status_internal@absl@@@?$InlinedVector@UPayload@status_internal@absl@@$00V?$allocator@UPayload@status_internal@absl@@@__1@std@@@absl@@QEAAAEAUPayload@status_internal@1@$$QEAU231@@Z ??$emplace_back@USubRange@absl@@@?$InlinedVector@USubRange@absl@@$0CP@V?$allocator@USubRange@absl@@@__1@std@@@absl@@QEAAAEAUSubRange@1@$$QEAU21@@Z + ??$exchange@_JH@absl@@YA_JAEA_J$$QEAH@Z ??$find@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@@23@@__1@std@@QEAA?AV?$__hash_iterator@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@PEAX@__1@std@@@12@AEBV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@12@@Z ??$find_first_non_full@X@container_internal@absl@@YA?AUFindInfo@01@PEBW4ctrl_t@01@_K1@Z ??$forward@$$T@absl@@YA$$QEA$$TAEA$$T@Z @@ -695,6 +695,7 @@ ??$forward@AEBVCord@absl@@@__1@std@@YAAEBVCord@absl@@AEBV23@@Z ??$forward@AEBVCord@absl@@@absl@@YAAEBVCord@0@AEBV10@@Z ??$forward@AEBVstring_view@absl@@@__1@std@@YAAEBVstring_view@absl@@AEBV23@@Z + ??$forward@H@absl@@YA$$QEAHAEAH@Z ??$forward@I@absl@@YA$$QEAIAEAI@Z ??$forward@PEAPEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@PEAX@__1@std@@@__1@std@@@__1@std@@YA$$QEAPEAPEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@PEAX@__1@std@@@01@AEAPEAPEAU201@@Z ??$forward@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@YA$$QEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEAPEAPEBV23456@@Z @@ -807,6 +808,7 @@ ??$move@AEAVCord@absl@@@__1@std@@YA$$QEAVCord@absl@@AEAV23@@Z ??$move@AEAVInlineRep@Cord@absl@@@__1@std@@YA$$QEAVInlineRep@Cord@absl@@AEAV234@@Z ??$move@AEAVStatus@absl@@@__1@std@@YA$$QEAVStatus@absl@@AEAV23@@Z + ??$move@AEA_J@absl@@YA$$QEA_JAEA_J@Z ??$move@PEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@PEAPEAPEBV12345@@__1@std@@YAPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@PEAPEAPEBV23456@00@Z ??$move@PEAUTransition@cctz@time_internal@absl@@PEAU1234@@__1@std@@YAPEAUTransition@cctz@time_internal@absl@@PEAU2345@00@Z ??$move@PEAUTransitionType@cctz@time_internal@absl@@PEAU1234@@__1@std@@YAPEAUTransitionType@cctz@time_internal@absl@@PEAU2345@00@Z @@ -1586,7 +1588,6 @@ ?Align@adl_barrier@internal_layout@container_internal@absl@@YA_K_K0@Z ?AlignBegin@CordRepBtree@cord_internal@absl@@AEAAXXZ ?AlignEnd@CordRepBtree@cord_internal@absl@@AEAAXXZ - ?Alloc@LowLevelAlloc@base_internal@absl@@SAPEAX_K@Z ?AllocSize@?$LayoutImpl@V?$tuple@_KPEAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@_K$0A@$00$01@absl@@U45@@internal_layout@container_internal@absl@@QEBA_KXZ ?AllocSize@CordRepRing@cord_internal@absl@@SA_K_K@Z ?AllocWithArena@LowLevelAlloc@base_internal@absl@@SAPEAX_KPEAUArena@123@@Z @@ -1939,7 +1940,6 @@ ?FormatTime@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@1@VTime@1@VTimeZone@1@@Z ?FormatUntyped@str_format_internal@absl@@YA_NVFormatRawSinkImpl@12@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?FprintF@str_format_internal@absl@@YAHPEAU_iobuf@@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z - ?Free@LowLevelAlloc@base_internal@absl@@SAXPEAX@Z ?Frequency@CycleClock@base_internal@absl@@SANXZ ?Frequency@UnscaledCycleClock@base_internal@absl@@CANXZ ?FromChrono@absl@@YA?AVDuration@1@AEBV?$duration@_JV?$ratio@$00$0PECEA@@__1@std@@@chrono@__1@std@@@Z @@ -1958,6 +1958,7 @@ ?Generate@?$RandenPool@G@random_internal@absl@@KAGXZ ?Generate@?$RandenPool@I@random_internal@absl@@KAIXZ ?Generate@?$RandenPool@_K@random_internal@absl@@KA_KXZ + ?Generate@Randen@random_internal@absl@@QEBAXPEAX@Z ?Generate@RandenHwAes@random_internal@absl@@SAXPEBXPEAX@Z ?Generate@RandenSlow@random_internal@absl@@SAXPEBXPEAX@Z ?Get@RefcountAndFlags@cord_internal@absl@@QEBAHXZ @@ -2311,7 +2312,7 @@ ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ ?Post@PerThreadSem@synchronization_internal@absl@@CAXPEAUThreadIdentity@base_internal@3@@Z ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_J_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@Cord@absl@@QEAAXVstring_view@2@@Z @@ -2405,7 +2406,7 @@ ?RoundUpForTag@cord_internal@absl@@YA_K_K@Z ?SafeToDelete@CordzHandle@cord_internal@absl@@QEBA_NXZ ?SafeWriteToStderr@raw_logging_internal@absl@@YAXPEBD_K@Z - ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@PEA_J_K@Z + ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@AEAUSamplingState@12@_K@Z ?Seek@CordRepBtreeNavigator@cord_internal@absl@@QEAA?AUPosition@123@_K@Z ?Seek@CordRepBtreeReader@cord_internal@absl@@QEAA?AVstring_view@3@_K@Z ?SetAllocation@?$Storage@H$0CP@V?$allocator@H@__1@std@@@inlined_vector_internal@absl@@QEAAXU?$Allocation@V?$allocator@H@__1@std@@@23@@Z
diff --git a/third_party/abseil-cpp/symbols_arm64_rel.def b/third_party/abseil-cpp/symbols_arm64_rel.def index d7695d2d..25ee4ea 100644 --- a/third_party/abseil-cpp/symbols_arm64_rel.def +++ b/third_party/abseil-cpp/symbols_arm64_rel.def
@@ -76,9 +76,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 + ??$PopDead@_J_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_J_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 + ??$Register@AEB_JAEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEB_JAEA_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 @@ -235,7 +235,6 @@ ?AdvanceBytesBtree@ChunkIterator@Cord@absl@@AEAAX_K@Z ?AdvanceBytesSlowPath@ChunkIterator@Cord@absl@@AEAAX_K@Z ?AdvanceStack@ChunkIterator@Cord@absl@@AEAAAEAV123@XZ - ?Alloc@LowLevelAlloc@base_internal@absl@@SAPEAX_K@Z ?AllocWithArena@LowLevelAlloc@base_internal@absl@@SAPEAX_KPEAUArena@123@@Z ?Allocate@?$MallocAdapter@V?$allocator@PEAUCordRep@cord_internal@absl@@@__1@std@@$0A@@inlined_vector_internal@absl@@SA?AU?$Allocation@V?$allocator@PEAUCordRep@cord_internal@absl@@@__1@std@@@23@AEAV?$allocator@PEAUCordRep@cord_internal@absl@@@__1@std@@_K@Z ?Allocate@?$MallocAdapter@V?$allocator@PEAUCordRepConcat@cord_internal@absl@@@__1@std@@$0A@@inlined_vector_internal@absl@@SA?AU?$Allocation@V?$allocator@PEAUCordRepConcat@cord_internal@absl@@@__1@std@@@23@AEAV?$allocator@PEAUCordRepConcat@cord_internal@absl@@@__1@std@@_K@Z @@ -466,7 +465,6 @@ ?FormatTime@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@1@VTime@1@VTimeZone@1@@Z ?FormatUntyped@str_format_internal@absl@@YA_NVFormatRawSinkImpl@12@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?FprintF@str_format_internal@absl@@YAHPEAU_iobuf@@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z - ?Free@LowLevelAlloc@base_internal@absl@@SAXPEAX@Z ?Frequency@CycleClock@base_internal@absl@@SANXZ ?Frequency@UnscaledCycleClock@base_internal@absl@@CANXZ ?FromChrono@absl@@YA?AVTime@1@AEBV?$time_point@Vsystem_clock@chrono@__1@std@@V?$duration@_JV?$ratio@$00$0PECEA@@__1@std@@@234@@chrono@__1@std@@@Z @@ -643,7 +641,7 @@ ?PermissionDeniedError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_J_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@CordRepBtree@cord_internal@absl@@SAPEAV123@PEAV123@Vstring_view@3@_K@Z @@ -708,7 +706,7 @@ ?ReverseConsume@cord_internal@absl@@YAXPEAUCordRep@12@V?$FunctionRef@$$A6AXPEAUCordRep@cord_internal@absl@@_K1@Z@2@@Z ?SafeToDelete@CordzHandle@cord_internal@absl@@QEBA_NXZ ?SafeWriteToStderr@raw_logging_internal@absl@@YAXPEBD_K@Z - ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@PEA_J_K@Z + ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@AEAUSamplingState@12@_K@Z ?Seek@CordRepBtreeReader@cord_internal@absl@@QEAA?AVstring_view@3@_K@Z ?SetCapacityForTesting@CordRepRing@cord_internal@absl@@QEAAX_K@Z ?SetCurrentThreadIdentity@base_internal@absl@@YAXPEAUThreadIdentity@12@P6AXPEAX@Z@Z
diff --git a/third_party/abseil-cpp/symbols_x64_dbg.def b/third_party/abseil-cpp/symbols_x64_dbg.def index 4ed9529..a1d37062 100644 --- a/third_party/abseil-cpp/symbols_x64_dbg.def +++ b/third_party/abseil-cpp/symbols_x64_dbg.def
@@ -350,7 +350,6 @@ ??$FromInt64@$0DLJKMKAA@@time_internal@absl@@YA?AVDuration@1@_JV?$ratio@$00$0DLJKMKAA@@__1@std@@@Z ??$FromInt64@$0DOI@@time_internal@absl@@YA?AVDuration@1@_JV?$ratio@$00$0DOI@@__1@std@@@Z ??$FromInt64@$0PECEA@@time_internal@absl@@YA?AVDuration@1@_JV?$ratio@$00$0PECEA@@__1@std@@@Z - ??$Generate@I$0EA@@Randen@random_internal@absl@@QEBAXAEAY0EA@I@Z ??$GenericCompare@HVCord@absl@@@absl@@YAHAEBVCord@0@0_K@Z ??$GenericCompare@HVstring_view@absl@@@absl@@YAHAEBVCord@0@AEBVstring_view@0@_K@Z ??$GenericCompare@_NVCord@absl@@@absl@@YA_NAEBVCord@0@0_K@Z @@ -424,9 +423,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 + ??$PopDead@_J_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_J_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 + ??$Register@AEB_JAEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEB_JAEA_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 @@ -658,6 +657,7 @@ ??$emplace_back@PEAUCordRep@cord_internal@absl@@@?$InlinedVector@PEAUCordRep@cord_internal@absl@@$0CP@V?$allocator@PEAUCordRep@cord_internal@absl@@@__1@std@@@absl@@QEAAAEAPEAUCordRep@cord_internal@1@$$QEAPEAU231@@Z ??$emplace_back@UPayload@status_internal@absl@@@?$InlinedVector@UPayload@status_internal@absl@@$00V?$allocator@UPayload@status_internal@absl@@@__1@std@@@absl@@QEAAAEAUPayload@status_internal@1@$$QEAU231@@Z ??$emplace_back@USubRange@absl@@@?$InlinedVector@USubRange@absl@@$0CP@V?$allocator@USubRange@absl@@@__1@std@@@absl@@QEAAAEAUSubRange@1@$$QEAU21@@Z + ??$exchange@_JH@absl@@YA_JAEA_J$$QEAH@Z ??$find@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@@23@@__1@std@@QEAA?AV?$__hash_iterator@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@PEAX@__1@std@@@12@AEBV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@12@@Z ??$find_first_non_full@X@container_internal@absl@@YA?AUFindInfo@01@PEBW4ctrl_t@01@_K1@Z ??$forward@$$T@absl@@YA$$QEA$$TAEA$$T@Z @@ -699,6 +699,7 @@ ??$forward@AEBVCord@absl@@@__1@std@@YAAEBVCord@absl@@AEBV23@@Z ??$forward@AEBVCord@absl@@@absl@@YAAEBVCord@0@AEBV10@@Z ??$forward@AEBVstring_view@absl@@@__1@std@@YAAEBVstring_view@absl@@AEBV23@@Z + ??$forward@H@absl@@YA$$QEAHAEAH@Z ??$forward@I@absl@@YA$$QEAIAEAI@Z ??$forward@PEAPEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@PEAX@__1@std@@@__1@std@@@__1@std@@YA$$QEAPEAPEAU?$__hash_node_base@PEAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@PEAX@__1@std@@@01@AEAPEAPEAU201@@Z ??$forward@PEAPEBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@YA$$QEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@AEAPEAPEBV23456@@Z @@ -811,6 +812,7 @@ ??$move@AEAVCord@absl@@@__1@std@@YA$$QEAVCord@absl@@AEAV23@@Z ??$move@AEAVInlineRep@Cord@absl@@@__1@std@@YA$$QEAVInlineRep@Cord@absl@@AEAV234@@Z ??$move@AEAVStatus@absl@@@__1@std@@YA$$QEAVStatus@absl@@AEAV23@@Z + ??$move@AEA_J@absl@@YA$$QEA_JAEA_J@Z ??$move@PEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@PEAPEAPEBV12345@@__1@std@@YAPEAPEAPEBVImpl@time_zone@cctz@time_internal@absl@@PEAPEAPEBV23456@00@Z ??$move@PEAUTransition@cctz@time_internal@absl@@PEAU1234@@__1@std@@YAPEAUTransition@cctz@time_internal@absl@@PEAU2345@00@Z ??$move@PEAUTransitionType@cctz@time_internal@absl@@PEAU1234@@__1@std@@YAPEAUTransitionType@cctz@time_internal@absl@@PEAU2345@00@Z @@ -1589,7 +1591,6 @@ ?Align@adl_barrier@internal_layout@container_internal@absl@@YA_K_K0@Z ?AlignBegin@CordRepBtree@cord_internal@absl@@AEAAXXZ ?AlignEnd@CordRepBtree@cord_internal@absl@@AEAAXXZ - ?Alloc@LowLevelAlloc@base_internal@absl@@SAPEAX_K@Z ?AllocSize@?$LayoutImpl@V?$tuple@_KPEAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@_K$0A@$00$01@absl@@U45@@internal_layout@container_internal@absl@@QEBA_KXZ ?AllocSize@CordRepRing@cord_internal@absl@@SA_K_K@Z ?AllocWithArena@LowLevelAlloc@base_internal@absl@@SAPEAX_KPEAUArena@123@@Z @@ -1942,7 +1943,6 @@ ?FormatTime@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@1@VTime@1@VTimeZone@1@@Z ?FormatUntyped@str_format_internal@absl@@YA_NVFormatRawSinkImpl@12@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?FprintF@str_format_internal@absl@@YAHPEAU_iobuf@@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z - ?Free@LowLevelAlloc@base_internal@absl@@SAXPEAX@Z ?Frequency@CycleClock@base_internal@absl@@SANXZ ?Frequency@UnscaledCycleClock@base_internal@absl@@CANXZ ?FromChrono@absl@@YA?AVDuration@1@AEBV?$duration@_JV?$ratio@$00$0PECEA@@__1@std@@@chrono@__1@std@@@Z @@ -1960,6 +1960,7 @@ ?Generate@?$RandenPool@G@random_internal@absl@@KAGXZ ?Generate@?$RandenPool@I@random_internal@absl@@KAIXZ ?Generate@?$RandenPool@_K@random_internal@absl@@KA_KXZ + ?Generate@Randen@random_internal@absl@@QEBAXPEAX@Z ?Generate@RandenHwAes@random_internal@absl@@SAXPEBXPEAX@Z ?Generate@RandenSlow@random_internal@absl@@SAXPEBXPEAX@Z ?Get@RefcountAndFlags@cord_internal@absl@@QEBAHXZ @@ -2312,7 +2313,7 @@ ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ ?Post@PerThreadSem@synchronization_internal@absl@@CAXPEAUThreadIdentity@base_internal@3@@Z ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_J_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@Cord@absl@@QEAAXVstring_view@2@@Z @@ -2406,7 +2407,7 @@ ?RoundUpForTag@cord_internal@absl@@YA_K_K@Z ?SafeToDelete@CordzHandle@cord_internal@absl@@QEBA_NXZ ?SafeWriteToStderr@raw_logging_internal@absl@@YAXPEBD_K@Z - ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@PEA_J_K@Z + ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@AEAUSamplingState@12@_K@Z ?Seek@CordRepBtreeNavigator@cord_internal@absl@@QEAA?AUPosition@123@_K@Z ?Seek@CordRepBtreeReader@cord_internal@absl@@QEAA?AVstring_view@3@_K@Z ?SetAllocation@?$Storage@H$0CP@V?$allocator@H@__1@std@@@inlined_vector_internal@absl@@QEAAXU?$Allocation@V?$allocator@H@__1@std@@@23@@Z
diff --git a/third_party/abseil-cpp/symbols_x64_rel.def b/third_party/abseil-cpp/symbols_x64_rel.def index 4d392c6..bbd2172 100644 --- a/third_party/abseil-cpp/symbols_x64_rel.def +++ b/third_party/abseil-cpp/symbols_x64_rel.def
@@ -64,7 +64,6 @@ ??$ForEach@V<lambda_1>@?0???$Fill@$0A@@CordRepRing@cord_internal@absl@@AEAAXPEBV234@II@Z@@CordRepRing@cord_internal@absl@@QEBAXII$$QEAV<lambda_1>@?0???$Fill@$0A@@012@AEAAXPEBV012@II@Z@@Z ??$ForEach@V<lambda_2>@?0???$AddRing@$00@CordRepRing@cord_internal@absl@@CAPEAV234@PEAV234@0_K1@Z@@CordRepRing@cord_internal@absl@@QEBAXII$$QEAV<lambda_2>@?0???$AddRing@$00@012@CAPEAV012@PEAV012@0_K1@Z@@Z ??$ForEach@V<lambda_2>@?0???$AddRing@$0A@@CordRepRing@cord_internal@absl@@CAPEAV234@PEAV234@0_K1@Z@@CordRepRing@cord_internal@absl@@QEBAXII$$QEAV<lambda_2>@?0???$AddRing@$0A@@012@CAPEAV012@PEAV012@0_K1@Z@@Z - ??$Generate@I$0EA@@Randen@random_internal@absl@@QEBAXAEAY0EA@I@Z ??$GenericCompare@HVCord@absl@@@absl@@YAHAEBVCord@0@0_K@Z ??$GenericCompare@HVstring_view@absl@@@absl@@YAHAEBVCord@0@AEBVstring_view@0@_K@Z ??$GenericCompare@_NVCord@absl@@@absl@@YA_NAEBVCord@0@0_K@Z @@ -77,9 +76,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 + ??$PopDead@_J_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_J_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 + ??$Register@AEB_JAEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEB_JAEA_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 @@ -238,7 +237,6 @@ ?AdvanceBytesBtree@ChunkIterator@Cord@absl@@AEAAX_K@Z ?AdvanceBytesSlowPath@ChunkIterator@Cord@absl@@AEAAX_K@Z ?AdvanceStack@ChunkIterator@Cord@absl@@AEAAAEAV123@XZ - ?Alloc@LowLevelAlloc@base_internal@absl@@SAPEAX_K@Z ?AllocWithArena@LowLevelAlloc@base_internal@absl@@SAPEAX_KPEAUArena@123@@Z ?AlreadyExistsError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?Append@?$AppendUninitializedTraits@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@X@strings_internal@absl@@SAXPEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@_K@Z @@ -465,7 +463,6 @@ ?FormatTime@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@1@VTime@1@VTimeZone@1@@Z ?FormatUntyped@str_format_internal@absl@@YA_NVFormatRawSinkImpl@12@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?FprintF@str_format_internal@absl@@YAHPEAU_iobuf@@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z - ?Free@LowLevelAlloc@base_internal@absl@@SAXPEAX@Z ?Frequency@CycleClock@base_internal@absl@@SANXZ ?Frequency@UnscaledCycleClock@base_internal@absl@@CANXZ ?FromChrono@absl@@YA?AVTime@1@AEBV?$time_point@Vsystem_clock@chrono@__1@std@@V?$duration@_JV?$ratio@$00$0PECEA@@__1@std@@@234@@chrono@__1@std@@@Z @@ -643,7 +640,7 @@ ?PermissionDeniedError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_J_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@CordRepBtree@cord_internal@absl@@SAPEAV123@PEAV123@Vstring_view@3@_K@Z @@ -708,7 +705,7 @@ ?ReverseConsume@cord_internal@absl@@YAXPEAUCordRep@12@V?$FunctionRef@$$A6AXPEAUCordRep@cord_internal@absl@@_K1@Z@2@@Z ?SafeToDelete@CordzHandle@cord_internal@absl@@QEBA_NXZ ?SafeWriteToStderr@raw_logging_internal@absl@@YAXPEBD_K@Z - ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@PEA_J_K@Z + ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@AEAUSamplingState@12@_K@Z ?Seek@CordRepBtreeReader@cord_internal@absl@@QEAA?AVstring_view@3@_K@Z ?SetCapacityForTesting@CordRepRing@cord_internal@absl@@QEAAX_K@Z ?SetCurrentThreadIdentity@base_internal@absl@@YAXPEAUThreadIdentity@12@P6AXPEAX@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 01bc1fd..557aba6 100644 --- a/third_party/abseil-cpp/symbols_x64_rel_asan.def +++ b/third_party/abseil-cpp/symbols_x64_rel_asan.def
@@ -63,7 +63,6 @@ ??$ForEach@V<lambda_1>@?0???$Fill@$0A@@CordRepRing@cord_internal@absl@@AEAAXPEBV234@II@Z@@CordRepRing@cord_internal@absl@@QEBAXII$$QEAV<lambda_1>@?0???$Fill@$0A@@012@AEAAXPEBV012@II@Z@@Z ??$ForEach@V<lambda_2>@?0???$AddRing@$00@CordRepRing@cord_internal@absl@@CAPEAV234@PEAV234@0_K1@Z@@CordRepRing@cord_internal@absl@@QEBAXII$$QEAV<lambda_2>@?0???$AddRing@$00@012@CAPEAV012@PEAV012@0_K1@Z@@Z ??$ForEach@V<lambda_2>@?0???$AddRing@$0A@@CordRepRing@cord_internal@absl@@CAPEAV234@PEAV234@0_K1@Z@@CordRepRing@cord_internal@absl@@QEBAXII$$QEAV<lambda_2>@?0???$AddRing@$0A@@012@CAPEAV012@PEAV012@0_K1@Z@@Z - ??$Generate@I$0EA@@Randen@random_internal@absl@@QEBAXAEAY0EA@I@Z ??$GenericCompare@HVCord@absl@@@absl@@YAHAEBVCord@0@0_K@Z ??$GenericCompare@HVstring_view@absl@@@absl@@YAHAEBVCord@0@AEBVstring_view@0@_K@Z ??$GenericCompare@_NVCord@absl@@@absl@@YA_NAEBVCord@0@0_K@Z @@ -76,9 +75,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 + ??$PopDead@_J_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AEAAPEAUHashtablezInfo@container_internal@2@_J_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 + ??$Register@AEB_JAEA_K@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QEAAPEAUHashtablezInfo@container_internal@2@AEB_JAEA_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 @@ -247,7 +246,6 @@ ?AdvanceBytesBtree@ChunkIterator@Cord@absl@@AEAAX_K@Z ?AdvanceBytesSlowPath@ChunkIterator@Cord@absl@@AEAAX_K@Z ?AdvanceStack@ChunkIterator@Cord@absl@@AEAAAEAV123@XZ - ?Alloc@LowLevelAlloc@base_internal@absl@@SAPEAX_K@Z ?AllocWithArena@LowLevelAlloc@base_internal@absl@@SAPEAX_KPEAUArena@123@@Z ?AlreadyExistsError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?AnnotateConstruct@NonEmptyInlinedStorage@?$FixedArray@PEAUCordRep@cord_internal@absl@@$0?0V?$allocator@PEAUCordRep@cord_internal@absl@@@__1@std@@@absl@@QEAAX_K@Z @@ -475,7 +473,6 @@ ?FormatTime@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@1@VTime@1@VTimeZone@1@@Z ?FormatUntyped@str_format_internal@absl@@YA_NVFormatRawSinkImpl@12@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?FprintF@str_format_internal@absl@@YAHPEAU_iobuf@@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z - ?Free@LowLevelAlloc@base_internal@absl@@SAXPEAX@Z ?Frequency@CycleClock@base_internal@absl@@SANXZ ?Frequency@UnscaledCycleClock@base_internal@absl@@CANXZ ?FromChrono@absl@@YA?AVTime@1@AEBV?$time_point@Vsystem_clock@chrono@__1@std@@V?$duration@_JV?$ratio@$00$0PECEA@@__1@std@@@234@@chrono@__1@std@@@Z @@ -653,7 +650,7 @@ ?PermissionDeniedError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?Poke@Waiter@synchronization_internal@absl@@QEAAXXZ ?Post@Waiter@synchronization_internal@absl@@QEAAXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_K@Z + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QEAAX_J_K@Z ?PrepareToModify@Status@absl@@AEAAXXZ ?Prepend@Cord@absl@@QEAAXAEBV12@@Z ?Prepend@CordRepBtree@cord_internal@absl@@SAPEAV123@PEAV123@Vstring_view@3@_K@Z @@ -718,7 +715,7 @@ ?ReverseConsume@cord_internal@absl@@YAXPEAUCordRep@12@V?$FunctionRef@$$A6AXPEAUCordRep@cord_internal@absl@@_K1@Z@2@@Z ?SafeToDelete@CordzHandle@cord_internal@absl@@QEBA_NXZ ?SafeWriteToStderr@raw_logging_internal@absl@@YAXPEBD_K@Z - ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@PEA_J_K@Z + ?SampleSlow@container_internal@absl@@YAPEAUHashtablezInfo@12@AEAUSamplingState@12@_K@Z ?Seek@CordRepBtreeReader@cord_internal@absl@@QEAA?AVstring_view@3@_K@Z ?SetCapacityForTesting@CordRepRing@cord_internal@absl@@QEAAX_K@Z ?SetCurrentThreadIdentity@base_internal@absl@@YAXPEAUThreadIdentity@12@P6AXPEAX@Z@Z
diff --git a/third_party/abseil-cpp/symbols_x86_dbg.def b/third_party/abseil-cpp/symbols_x86_dbg.def index 36d5875..61838f97 100644 --- a/third_party/abseil-cpp/symbols_x86_dbg.def +++ b/third_party/abseil-cpp/symbols_x86_dbg.def
@@ -350,7 +350,6 @@ ??$FromInt64@$0DLJKMKAA@@time_internal@absl@@YA?AVDuration@1@_JV?$ratio@$00$0DLJKMKAA@@__1@std@@@Z ??$FromInt64@$0DOI@@time_internal@absl@@YA?AVDuration@1@_JV?$ratio@$00$0DOI@@__1@std@@@Z ??$FromInt64@$0PECEA@@time_internal@absl@@YA?AVDuration@1@_JV?$ratio@$00$0PECEA@@__1@std@@@Z - ??$Generate@I$0EA@@Randen@random_internal@absl@@QBEXAAY0EA@I@Z ??$GenericCompare@HVCord@absl@@@absl@@YAHABVCord@0@0I@Z ??$GenericCompare@HVstring_view@absl@@@absl@@YAHABVCord@0@ABVstring_view@0@I@Z ??$GenericCompare@_NVCord@absl@@@absl@@YA_NABVCord@0@0I@Z @@ -422,9 +421,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 + ??$PopDead@_JI@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AAEPAUHashtablezInfo@container_internal@2@_JI@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 + ??$Register@AB_JAAI@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QAEPAUHashtablezInfo@container_internal@2@AB_JAAI@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 @@ -654,6 +653,7 @@ ??$emplace_back@PAUCordRep@cord_internal@absl@@@?$InlinedVector@PAUCordRep@cord_internal@absl@@$0CP@V?$allocator@PAUCordRep@cord_internal@absl@@@__1@std@@@absl@@QAEAAPAUCordRep@cord_internal@1@$$QAPAU231@@Z ??$emplace_back@UPayload@status_internal@absl@@@?$InlinedVector@UPayload@status_internal@absl@@$00V?$allocator@UPayload@status_internal@absl@@@__1@std@@@absl@@QAEAAUPayload@status_internal@1@$$QAU231@@Z ??$emplace_back@USubRange@absl@@@?$InlinedVector@USubRange@absl@@$0CP@V?$allocator@USubRange@absl@@@__1@std@@@absl@@QAEAAUSubRange@1@$$QAU21@@Z + ??$exchange@_JH@absl@@YA_JAA_J$$QAH@Z ??$find@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@?$__hash_table@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@V?$__unordered_map_hasher@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@$00@23@V?$__unordered_map_equal@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@23@U?$equal_to@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@U?$hash@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@$00@23@V?$allocator@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@@23@@__1@std@@QAE?AV?$__hash_iterator@PAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@PAX@__1@std@@@12@ABV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@12@@Z ??$find_first_non_full@X@container_internal@absl@@YA?AUFindInfo@01@PBW4ctrl_t@01@II@Z ??$forward@$$T@absl@@YA$$QA$$TAA$$T@Z @@ -694,6 +694,7 @@ ??$forward@ABVCord@absl@@@__1@std@@YAABVCord@absl@@ABV23@@Z ??$forward@ABVCord@absl@@@absl@@YAABVCord@0@ABV10@@Z ??$forward@ABVstring_view@absl@@@__1@std@@YAABVstring_view@absl@@ABV23@@Z + ??$forward@H@absl@@YA$$QAHAAH@Z ??$forward@I@absl@@YA$$QAIAAI@Z ??$forward@PAPAU?$__hash_node_base@PAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@PAX@__1@std@@@__1@std@@@__1@std@@YA$$QAPAPAU?$__hash_node_base@PAU?$__hash_node@U?$__hash_value_type@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@PBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@PAX@__1@std@@@01@AAPAPAU201@@Z ??$forward@PAPBVImpl@time_zone@cctz@time_internal@absl@@@__1@std@@YA$$QAPAPBVImpl@time_zone@cctz@time_internal@absl@@AAPAPBV23456@@Z @@ -806,6 +807,7 @@ ??$move@AAVCord@absl@@@__1@std@@YA$$QAVCord@absl@@AAV23@@Z ??$move@AAVInlineRep@Cord@absl@@@__1@std@@YA$$QAVInlineRep@Cord@absl@@AAV234@@Z ??$move@AAVStatus@absl@@@__1@std@@YA$$QAVStatus@absl@@AAV23@@Z + ??$move@AA_J@absl@@YA$$QA_JAA_J@Z ??$move@PAPAPBVImpl@time_zone@cctz@time_internal@absl@@PAPAPBV12345@@__1@std@@YAPAPAPBVImpl@time_zone@cctz@time_internal@absl@@PAPAPBV23456@00@Z ??$move@PAUTransition@cctz@time_internal@absl@@PAU1234@@__1@std@@YAPAUTransition@cctz@time_internal@absl@@PAU2345@00@Z ??$move@PAUTransitionType@cctz@time_internal@absl@@PAU1234@@__1@std@@YAPAUTransitionType@cctz@time_internal@absl@@PAU2345@00@Z @@ -1584,7 +1586,6 @@ ?Align@adl_barrier@internal_layout@container_internal@absl@@YAIII@Z ?AlignBegin@CordRepBtree@cord_internal@absl@@AAEXXZ ?AlignEnd@CordRepBtree@cord_internal@absl@@AAEXXZ - ?Alloc@LowLevelAlloc@base_internal@absl@@SAPAXI@Z ?AllocSize@?$LayoutImpl@V?$tuple@IPAUCordRep@cord_internal@absl@@I@__1@std@@U?$integer_sequence@I$0A@$00$01@absl@@U45@@internal_layout@container_internal@absl@@QBEIXZ ?AllocSize@CordRepRing@cord_internal@absl@@SAII@Z ?AllocWithArena@LowLevelAlloc@base_internal@absl@@SAPAXIPAUArena@123@@Z @@ -1937,7 +1938,6 @@ ?FormatTime@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@1@VTime@1@VTimeZone@1@@Z ?FormatUntyped@str_format_internal@absl@@YA_NVFormatRawSinkImpl@12@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?FprintF@str_format_internal@absl@@YAHPAU_iobuf@@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z - ?Free@LowLevelAlloc@base_internal@absl@@SAXPAX@Z ?Frequency@CycleClock@base_internal@absl@@SANXZ ?Frequency@UnscaledCycleClock@base_internal@absl@@CANXZ ?FromChrono@absl@@YA?AVDuration@1@ABV?$duration@_JV?$ratio@$00$0PECEA@@__1@std@@@chrono@__1@std@@@Z @@ -1955,6 +1955,7 @@ ?Generate@?$RandenPool@G@random_internal@absl@@KAGXZ ?Generate@?$RandenPool@I@random_internal@absl@@KAIXZ ?Generate@?$RandenPool@_K@random_internal@absl@@KA_KXZ + ?Generate@Randen@random_internal@absl@@QBEXPAX@Z ?Generate@RandenHwAes@random_internal@absl@@SAXPBXPAX@Z ?Generate@RandenSlow@random_internal@absl@@SAXPBXPAX@Z ?Get@RefcountAndFlags@cord_internal@absl@@QBEHXZ @@ -2307,7 +2308,7 @@ ?Poke@Waiter@synchronization_internal@absl@@QAEXXZ ?Post@PerThreadSem@synchronization_internal@absl@@CAXPAUThreadIdentity@base_internal@3@@Z ?Post@Waiter@synchronization_internal@absl@@QAEXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QAEXI@Z + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QAEX_JI@Z ?PrepareToModify@Status@absl@@AAEXXZ ?Prepend@Cord@absl@@QAEXABV12@@Z ?Prepend@Cord@absl@@QAEXVstring_view@2@@Z @@ -2401,7 +2402,7 @@ ?RoundUpForTag@cord_internal@absl@@YAII@Z ?SafeToDelete@CordzHandle@cord_internal@absl@@QBE_NXZ ?SafeWriteToStderr@raw_logging_internal@absl@@YAXPBDI@Z - ?SampleSlow@container_internal@absl@@YAPAUHashtablezInfo@12@PA_JI@Z + ?SampleSlow@container_internal@absl@@YAPAUHashtablezInfo@12@AAUSamplingState@12@I@Z ?Seek@CordRepBtreeNavigator@cord_internal@absl@@QAE?AUPosition@123@I@Z ?Seek@CordRepBtreeReader@cord_internal@absl@@QAE?AVstring_view@3@I@Z ?SetAllocation@?$Storage@H$0CP@V?$allocator@H@__1@std@@@inlined_vector_internal@absl@@QAEXU?$Allocation@V?$allocator@H@__1@std@@@23@@Z
diff --git a/third_party/abseil-cpp/symbols_x86_rel.def b/third_party/abseil-cpp/symbols_x86_rel.def index e24357d..79d93e6f 100644 --- a/third_party/abseil-cpp/symbols_x86_rel.def +++ b/third_party/abseil-cpp/symbols_x86_rel.def
@@ -76,9 +76,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 + ??$PopDead@_JI@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@AAEPAUHashtablezInfo@container_internal@2@_JI@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 + ??$Register@AB_JAAI@?$SampleRecorder@UHashtablezInfo@container_internal@absl@@@profiling_internal@absl@@QAEPAUHashtablezInfo@container_internal@2@AB_JAAI@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 @@ -234,7 +234,6 @@ ?AdvanceBytesBtree@ChunkIterator@Cord@absl@@AAEXI@Z ?AdvanceBytesSlowPath@ChunkIterator@Cord@absl@@AAEXI@Z ?AdvanceStack@ChunkIterator@Cord@absl@@AAEAAV123@XZ - ?Alloc@LowLevelAlloc@base_internal@absl@@SAPAXI@Z ?AllocWithArena@LowLevelAlloc@base_internal@absl@@SAPAXIPAUArena@123@@Z ?Allocate@?$MallocAdapter@V?$allocator@PAUCordRep@cord_internal@absl@@@__1@std@@$0A@@inlined_vector_internal@absl@@SA?AU?$Allocation@V?$allocator@PAUCordRep@cord_internal@absl@@@__1@std@@@23@AAV?$allocator@PAUCordRep@cord_internal@absl@@@__1@std@@I@Z ?Allocate@?$MallocAdapter@V?$allocator@PAUCordRepConcat@cord_internal@absl@@@__1@std@@$0A@@inlined_vector_internal@absl@@SA?AU?$Allocation@V?$allocator@PAUCordRepConcat@cord_internal@absl@@@__1@std@@@23@AAV?$allocator@PAUCordRepConcat@cord_internal@absl@@@__1@std@@I@Z @@ -465,7 +464,6 @@ ?FormatTime@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@1@VTime@1@VTimeZone@1@@Z ?FormatUntyped@str_format_internal@absl@@YA_NVFormatRawSinkImpl@12@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z ?FprintF@str_format_internal@absl@@YAHPAU_iobuf@@VUntypedFormatSpecImpl@12@V?$Span@$$CBVFormatArgImpl@str_format_internal@absl@@@2@@Z - ?Free@LowLevelAlloc@base_internal@absl@@SAXPAX@Z ?Frequency@CycleClock@base_internal@absl@@SANXZ ?Frequency@UnscaledCycleClock@base_internal@absl@@CANXZ ?FromChrono@absl@@YA?AVTime@1@ABV?$time_point@Vsystem_clock@chrono@__1@std@@V?$duration@_JV?$ratio@$00$0PECEA@@__1@std@@@234@@chrono@__1@std@@@Z @@ -642,7 +640,7 @@ ?PermissionDeniedError@absl@@YA?AVStatus@1@Vstring_view@1@@Z ?Poke@Waiter@synchronization_internal@absl@@QAEXXZ ?Post@Waiter@synchronization_internal@absl@@QAEXXZ - ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QAEXI@Z + ?PrepareForSampling@HashtablezInfo@container_internal@absl@@QAEX_JI@Z ?PrepareToModify@Status@absl@@AAEXXZ ?Prepend@Cord@absl@@QAEXABV12@@Z ?Prepend@CordRepBtree@cord_internal@absl@@SAPAV123@PAV123@Vstring_view@3@I@Z @@ -707,7 +705,7 @@ ?ReverseConsume@cord_internal@absl@@YAXPAUCordRep@12@V?$FunctionRef@$$A6AXPAUCordRep@cord_internal@absl@@II@Z@2@@Z ?SafeToDelete@CordzHandle@cord_internal@absl@@QBE_NXZ ?SafeWriteToStderr@raw_logging_internal@absl@@YAXPBDI@Z - ?SampleSlow@container_internal@absl@@YAPAUHashtablezInfo@12@PA_JI@Z + ?SampleSlow@container_internal@absl@@YAPAUHashtablezInfo@12@AAUSamplingState@12@I@Z ?Seek@CordRepBtreeReader@cord_internal@absl@@QAE?AVstring_view@3@I@Z ?SetCapacityForTesting@CordRepRing@cord_internal@absl@@QAEXI@Z ?SetCurrentThreadIdentity@base_internal@absl@@YAXPAUThreadIdentity@12@P6AXPAX@Z@Z
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 a67364b..1ea05d6 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -1389,7 +1389,7 @@ kMediaStreamConstraintsDisableLocalEcho = 1935, kMediaStreamConstraintsGroupIdAudio = 1936, kMediaStreamConstraintsGroupIdVideo = 1937, - kMediaStreamConstraintsVideoKind = 1938, + kOBSOLETE_MediaStreamConstraintsVideoKind = 1938, kMediaStreamConstraintsMediaStreamSourceAudio = 1943, kMediaStreamConstraintsMediaStreamSourceVideo = 1944, kMediaStreamConstraintsRenderToAssociatedSink = 1945, @@ -3468,6 +3468,7 @@ kFrameNameContainsNewline = 4147, kAbortSignalThrowIfAborted = 4148, kClientHintsUAFull = 4149, + kPrivateNetworkAccessWithinWorker = 4150, // 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 3fb1274..3d430a3 100644 --- a/third_party/blink/renderer/bindings/generated_in_modules.gni +++ b/third_party/blink/renderer/bindings/generated_in_modules.gni
@@ -1106,6 +1106,8 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_compilation_message_type.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_cull_mode.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_cull_mode.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_device_lost_reason.cc", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_device_lost_reason.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_error_filter.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_error_filter.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_gpu_feature_name.cc", @@ -2607,6 +2609,8 @@ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_tcp_socket_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_udp_socket_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_udp_socket_options.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_udp_message.h", + "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_udp_message.cc", ] generated_interface_sources_in_modules += [ "$root_gen_dir/third_party/blink/renderer/bindings/modules/v8/v8_tcp_socket.cc",
diff --git a/third_party/blink/renderer/bindings/idl_in_modules.gni b/third_party/blink/renderer/bindings/idl_in_modules.gni index e52909ef..a0b21ce 100644 --- a/third_party/blink/renderer/bindings/idl_in_modules.gni +++ b/third_party/blink/renderer/bindings/idl_in_modules.gni
@@ -1156,6 +1156,7 @@ "//third_party/blink/renderer/modules/direct_sockets/navigator_socket.idl", "//third_party/blink/renderer/modules/direct_sockets/socket_options.idl", "//third_party/blink/renderer/modules/direct_sockets/tcp_socket.idl", + "//third_party/blink/renderer/modules/direct_sockets/udp_message.idl", "//third_party/blink/renderer/modules/direct_sockets/udp_socket.idl", ], "abspath")
diff --git a/third_party/blink/renderer/core/editing/frame_caret.cc b/third_party/blink/renderer/core/editing/frame_caret.cc index a9e33499..71b44c5 100644 --- a/third_party/blink/renderer/core/editing/frame_caret.cc +++ b/third_party/blink/renderer/core/editing/frame_caret.cc
@@ -85,7 +85,10 @@ bool visible, const TransformPaintPropertyNodeOrAlias& local_transform_space) const { EffectPaintPropertyNode::State state; - state.opacity = visible ? 1.f : 0.f; + // Use 0.001f instead of 0 to ensure cc will add quad for the caret layer. + // This is especially useful on Mac to limit the damage during caret blinking + // within the CALayer for the caret. + state.opacity = visible ? 1.f : 0.001f; state.local_transform_space = &local_transform_space; DEFINE_STATIC_LOCAL( CompositorElementId, element_id,
diff --git a/third_party/blink/renderer/core/editing/frame_caret.h b/third_party/blink/renderer/core/editing/frame_caret.h index 4d54e0b..fdacfa2 100644 --- a/third_party/blink/renderer/core/editing/frame_caret.h +++ b/third_party/blink/renderer/core/editing/frame_caret.h
@@ -103,7 +103,7 @@ void CaretBlinkTimerFired(TimerBase*); void UpdateAppearance(); void SetVisibleIfActive(bool visible); - bool IsVisibleIfActive() const { return effect_->Opacity() != 0; } + bool IsVisibleIfActive() const { return effect_->Opacity() == 1.f; } const Member<const SelectionEditor> selection_editor_; const Member<LocalFrame> frame_;
diff --git a/third_party/blink/renderer/core/inspector/inspector_network_agent.cc b/third_party/blink/renderer/core/inspector/inspector_network_agent.cc index c48a704..f07a1bb7 100644 --- a/third_party/blink/renderer/core/inspector/inspector_network_agent.cc +++ b/third_party/blink/renderer/core/inspector/inspector_network_agent.cc
@@ -1276,8 +1276,10 @@ if (bypass_service_worker_.Get()) request.SetSkipServiceWorker(true); - if (attach_debug_stack_enabled_.Get()) { - DCHECK(!request.GetDevToolsStackId().has_value()); + if (attach_debug_stack_enabled_.Get() && + // Preserving existing stack id when cloning requests instead of + // overwriting + !request.GetDevToolsStackId().has_value()) { ExecutionContext* context = nullptr; if (worker_global_scope_) { context = worker_global_scope_.Get();
diff --git a/third_party/blink/renderer/core/loader/DEPS b/third_party/blink/renderer/core/loader/DEPS index 54514489..f926910f 100644 --- a/third_party/blink/renderer/core/loader/DEPS +++ b/third_party/blink/renderer/core/loader/DEPS
@@ -12,6 +12,9 @@ "prefetched_signed_exchange_manager.cc": [ "+services/network/public/cpp/resource_request.h" ], + "resource_load_observer_for_worker.cc": [ + "+services/network/public/cpp/ip_address_space_util.h", + ], } include_rules = [ "+base/no_destructor.h",
diff --git a/third_party/blink/renderer/core/loader/resource_load_observer_for_worker.cc b/third_party/blink/renderer/core/loader/resource_load_observer_for_worker.cc index b952abff..717dcc55 100644 --- a/third_party/blink/renderer/core/loader/resource_load_observer_for_worker.cc +++ b/third_party/blink/renderer/core/loader/resource_load_observer_for_worker.cc
@@ -4,7 +4,9 @@ #include "third_party/blink/renderer/core/loader/resource_load_observer_for_worker.h" +#include "services/network/public/cpp/ip_address_space_util.h" #include "third_party/blink/renderer/core/core_probes_inl.h" +#include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/loader/mixed_content_checker.h" #include "third_party/blink/renderer/core/loader/worker_fetch_context.h" #include "third_party/blink/renderer/platform/loader/fetch/fetch_client_settings_object.h" @@ -47,12 +49,31 @@ ResourceLoadPriority priority, int intra_priority_value) {} +// Record use counter for private network access. +void RecordPrivateNetworkAccessFeature(ExecutionContext* execution_context, + const ResourceResponse& response) { + DCHECK(execution_context); + if (!network::IsLessPublicAddressSpace(response.AddressSpace(), + execution_context->AddressSpace())) + return; + // Only record the feature for worker contexts, not worklets. The address + // space of worklets is not yet specified. + // TODO(https://crbug.com/1291176): Revisit this if worklets should be subject + // to PNA checks. + if (!execution_context->IsWorkerGlobalScope()) + return; + execution_context->CountUse(WebFeature::kPrivateNetworkAccessWithinWorker); +} + void ResourceLoadObserverForWorker::DidReceiveResponse( uint64_t identifier, const ResourceRequest& request, const ResourceResponse& response, const Resource* resource, ResponseSource) { + RecordPrivateNetworkAccessFeature( + worker_fetch_context_->GetExecutionContext(), response); + if (response.HasMajorCertificateErrors()) { MixedContentChecker::HandleCertificateError( response, request.GetRequestContext(),
diff --git a/third_party/blink/renderer/modules/autofill_assistant/node_signals.cc b/third_party/blink/renderer/modules/autofill_assistant/node_signals.cc index 472782d..78837d0 100644 --- a/third_party/blink/renderer/modules/autofill_assistant/node_signals.cc +++ b/third_party/blink/renderer/modules/autofill_assistant/node_signals.cc
@@ -16,59 +16,79 @@ #include "third_party/blink/renderer/core/dom/element_traversal.h" #include "third_party/blink/renderer/core/dom/node.h" #include "third_party/blink/renderer/core/dom/node_computed_style.h" +#include "third_party/blink/renderer/core/dom/node_traversal.h" #include "third_party/blink/renderer/core/dom/qualified_name.h" #include "third_party/blink/renderer/core/dom/shadow_root.h" #include "third_party/blink/renderer/core/dom/space_split_string.h" +#include "third_party/blink/renderer/core/dom/text.h" #include "third_party/blink/renderer/core/html/html_element.h" #include "third_party/blink/renderer/core/html_names.h" +#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h" #include "third_party/blink/renderer/core/style/computed_style.h" #include "third_party/blink/renderer/core/style/computed_style_base_constants.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" +#include "third_party/blink/renderer/platform/wtf/text/string_builder.h" +#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" namespace blink { namespace { +constexpr int kMaxAncestorLevelForGeometry = 5; +constexpr double kToleranceForGeometry = 1e-5; +constexpr int kMaxCSSPixelDistance = 30; + +WebString JoinStrings(const WebVector<WebString>& strings, + const char* separator) { + StringBuilder builder; + for (wtf_size_t i = 0; i < strings.size(); ++i) { + if (i > 0) { + builder.Append(separator); + } + builder.Append(String::FromUTF8(strings[i].Utf8())); + } + return WebString::FromUTF8(builder.ToString().StripWhiteSpace().Utf8()); +} + bool IsVisible(const Element& element) { const ComputedStyle* computed_style = element.GetComputedStyle(); if (computed_style && computed_style->Visibility() != EVisibility::kVisible) { return false; } - gfx::RectF rect = element.GetBoundingClientRectNoLifecycleUpdate(); - if (rect.width() < 1e-6 || rect.height() < 1e-6) { - return false; - } - - return true; + return !element.BoundingBox().IsEmpty(); } WebString GetAttributes(const Element& element, const WebVector<QualifiedName>& attributes) { - std::string result; - std::string separator; + WebVector<WebString> values; for (const QualifiedName& attribute : attributes) { const auto& attribute_value = element.getAttribute(attribute); if (!attribute_value.IsNull() && !attribute_value.IsEmpty()) { - result += separator + attribute_value.Utf8(); - separator = " "; + values.push_back(attribute_value); } } - return WebString::FromUTF8(result); + return JoinStrings(values, " "); } -void AddAtomicIfNotNullOrEmpty(const AtomicString& atomic, +bool AddAtomicIfNotNullOrEmpty(const AtomicString& atomic, WebVector<WebString>* text) { - if (!atomic.IsNull() && !atomic.IsEmpty()) { - text->emplace_back(WebString(atomic)); + if (atomic.IsNull() || atomic.IsEmpty()) { + return false; } + + text->emplace_back(WebString(atomic)); + return true; } -void AddStringIfNotNullOrEmpty(const WebString& web_string, +bool AddStringIfNotNullOrEmpty(const WebString& web_string, WebVector<WebString>* text) { - if (!web_string.IsNull() && !web_string.IsEmpty()) { - text->emplace_back(web_string); + if (web_string.IsNull() || web_string.IsEmpty()) { + return false; } + + text->emplace_back(web_string); + return true; } absl::optional<WebVector<Element*>> ListOptions(const Element& element) { @@ -129,7 +149,7 @@ if (options) { for (Element* option : *options) { - AddStringIfNotNullOrEmpty(option->GetInnerTextWithoutUpdate(), text); + AddStringIfNotNullOrEmpty(option->innerText(), text); } } } @@ -157,7 +177,7 @@ if (!IsVisible(*label)) { return WebString(); } else { - return label->GetInnerTextWithoutUpdate(); + return label->innerText(); } } node = node->parentNode(); @@ -179,20 +199,21 @@ if (it == labels.end() || !it->value) { return WebString(); } - return it->value->GetInnerTextWithoutUpdate(); + return it->value->innerText(); } // Get labels using the aria-labelledby attribute. // Example: <div id="label">Label</div><input aria-labelledby="label"> -void AddLabelRelatedAriaLabelledby(const Element& element, +bool AddLabelRelatedAriaLabelledby(const Element& element, WebVector<WebString>* text) { // TODO(b/204839535): Find out if we need html_names::kAriaLabeledbyAttr. AtomicString labelledby = element.getAttribute(html_names::kAriaLabelledbyAttr); if (labelledby.IsNull() || labelledby.IsEmpty()) { - return; + return false; } + bool added_label = false; const Document& owner = element.GetDocument(); SpaceSplitString split(labelledby); @@ -201,24 +222,100 @@ if (!label || !IsVisible(*label)) { continue; } - AddStringIfNotNullOrEmpty(label->GetInnerTextWithoutUpdate(), text); + added_label = + AddStringIfNotNullOrEmpty(label->innerText(), text) || added_label; } + return added_label; +} + +double Distance(const PhysicalRect& a, const PhysicalRect& b) { + // There are only three ways rectangles can be positioned on each axis. For + // the y-axis we have: + // + // 1. b is above a then the y-axis distance is the y coordinate of + // b.y() - a.bottom() + // 2. b is below a then the y-axis distance is the y coordinate of + // a.y() - b.bottom() + // 3. b and a intersect in the y-axis (i.e. their projection on the y-axis + // intersect), then the distance on the y-axis is zero. + // + // The max defines what is the current situation. + double delta_y = std::max( + {(b.Y() - a.Bottom()).ToDouble(), (a.Y() - b.Bottom()).ToDouble(), 0.0}); + double delta_x = std::max( + {(b.X() - a.Right()).ToDouble(), (a.X() - b.Right()).ToDouble(), 0.0}); + return std::sqrt(delta_x * delta_x + delta_y * delta_y); } // Add label based on geometric position. // Example: <label>my_label</label><input> WebString GetLabelFromGeometry(const Element& element) { - // TODO(b/204839535): Implement. - return WebString(); + const PhysicalRect& element_rect = element.BoundingBox(); + + const Document* root = element.ownerDocument(); + int step = 0; + const Node* ancestor = &element; + while (ancestor != root && step < kMaxAncestorLevelForGeometry) { + ancestor = ancestor->parentNode(); + if (!ancestor) { + return WebString(); + } + ++step; + } + + WebVector<std::pair<double, WebString>> distance_and_text; + double closest_distance = std::numeric_limits<double>::max(); + for (Node& node : NodeTraversal::DescendantsOf(*ancestor)) { + if (!node.IsTextNode()) { + continue; + } + const PhysicalRect& rect = node.BoundingBox(); + if (rect.Y() > 0.5 * (element_rect.Y() + element_rect.Bottom()) && + !element_rect.Contains(rect)) { + continue; + } + double distance = Distance(rect, element_rect); + if (distance > kMaxCSSPixelDistance || + distance > closest_distance + kToleranceForGeometry) { + // No need to check text if element is far away. + continue; + } + + WebString text = DynamicTo<Text>(node)->wholeText(); + if (!text.IsNull() && !text.IsEmpty()) { + distance_and_text.push_back({distance, text}); + if (distance < closest_distance) { + closest_distance = distance; + } + } + } + + if (closest_distance > kMaxCSSPixelDistance) { + return WebString(); + } + WebVector<WebString> best_text; + for (const auto& entry : distance_and_text) { + if (entry.first <= closest_distance + kToleranceForGeometry) { + best_text.push_back(entry.second); + } + } + return JoinStrings(best_text, " "); } -void CollectLabelFeatures(const Element& element, +void CollectLabelFeatures(Element& element, const HashMap<AtomicString, Member<Element>>& labels, AutofillAssistantLabelFeatures* features) { - AddStringIfNotNullOrEmpty(GetLabelRelatedChild(element), &features->text); - AddStringIfNotNullOrEmpty(GetLabelRelatedAttribute(element, labels), - &features->text); - AddLabelRelatedAriaLabelledby(element, &features->text); + if (AddStringIfNotNullOrEmpty(GetLabelRelatedChild(element), + &features->text)) { + return; + } + if (AddStringIfNotNullOrEmpty(GetLabelRelatedAttribute(element, labels), + &features->text)) { + return; + } + if (AddLabelRelatedAriaLabelledby(element, &features->text)) { + return; + } AddStringIfNotNullOrEmpty(GetLabelFromGeometry(element), &features->text); }
diff --git a/third_party/blink/renderer/modules/autofill_assistant/node_signals_test.cc b/third_party/blink/renderer/modules/autofill_assistant/node_signals_test.cc index 45a3775..7a977b9 100644 --- a/third_party/blink/renderer/modules/autofill_assistant/node_signals_test.cc +++ b/third_party/blink/renderer/modules/autofill_assistant/node_signals_test.cc
@@ -90,17 +90,17 @@ TEST_F(NodeSignalsTest, IgnoresNonVisibleElements) { SetBodyContent(R"(<input style="display: none;">)"); - EXPECT_EQ(GetAutofillAssistantNodeSignals(WebDocument(&GetDocument())).size(), - 0u); + EXPECT_TRUE( + GetAutofillAssistantNodeSignals(WebDocument(&GetDocument())).empty()); SetBodyContent(R"(<input style="visibility: hidden;">)"); - EXPECT_EQ(GetAutofillAssistantNodeSignals(WebDocument(&GetDocument())).size(), - 0u); + EXPECT_TRUE( + GetAutofillAssistantNodeSignals(WebDocument(&GetDocument())).empty()); SetBodyContent(R"( <input style="height: 0; line-height: 0; padding: 0; border: none;">)"); - EXPECT_EQ(GetAutofillAssistantNodeSignals(WebDocument(&GetDocument())).size(), - 0u); + EXPECT_TRUE( + GetAutofillAssistantNodeSignals(WebDocument(&GetDocument())).empty()); // An element outside of the visible viewport should still be returned. SetBodyContent( @@ -164,7 +164,7 @@ ASSERT_EQ(results[1].node_features.text.size(), 1u); EXPECT_EQ(results[1].node_features.text[0], "value"); - ASSERT_EQ(results[2].node_features.text.size(), 0u); + EXPECT_TRUE(results[2].node_features.text.empty()); ASSERT_EQ(results[3].node_features.text.size(), 2u); EXPECT_EQ(results[3].node_features.text[0], "A"); @@ -181,7 +181,7 @@ ASSERT_EQ(results[0].label_features.text.size(), 1u); EXPECT_EQ(results[0].label_features.text[0], "Name"); - ASSERT_EQ(results[1].label_features.text.size(), 0u); + EXPECT_TRUE(results[1].label_features.text.empty()); } TEST_F(NodeSignalsTest, GetLabelByForAttribute) { @@ -195,7 +195,7 @@ ASSERT_EQ(results[0].label_features.text.size(), 1u); EXPECT_EQ(results[0].label_features.text[0], "Name"); - ASSERT_EQ(results[1].label_features.text.size(), 0u); + EXPECT_TRUE(results[1].label_features.text.empty()); } TEST_F(NodeSignalsTest, GetLabelByForAttributeWithCollision) { @@ -228,7 +228,46 @@ ASSERT_EQ(results[0].label_features.text.size(), 2u); EXPECT_EQ(results[0].label_features.text[0], "Billing"); - EXPECT_EQ(results[0].label_features.text[1], "Name"); + EXPECT_EQ(results[0].label_features.text[1], "Name"); // From Aria +} + +TEST_F(NodeSignalsTest, GetLabelFromGeometry) { + // Make sure nested elements don't get added multiple times. + // Make sure elements that are not "pure text" get added. + SetBodyContent(R"( + <div><div>Label <i class="icon"></i></div></div> + <div><input></div>)"); + + WebVector<AutofillAssistantNodeSignals> results_1 = + GetAutofillAssistantNodeSignals(WebDocument(&GetDocument())); + ASSERT_EQ(results_1.size(), 1u); + + ASSERT_EQ(results_1[0].label_features.text.size(), 1u); + EXPECT_EQ(results_1[0].label_features.text[0], "Label"); + + // Make sure for nested elements only the "closest" gets added. + SetBodyContent(R"( + <div>Label <div>Sublabel</div></div> + <div><input></div>)"); + + WebVector<AutofillAssistantNodeSignals> results_2 = + GetAutofillAssistantNodeSignals(WebDocument(&GetDocument())); + ASSERT_EQ(results_2.size(), 1u); + + ASSERT_EQ(results_2[0].label_features.text.size(), 1u); + EXPECT_EQ(results_2[0].label_features.text[0], "Sublabel"); + + // Make sure for all inline elements get added. + SetBodyContent(R"( + <div>Name <i>First</i></div> + <div><input></div>)"); + + WebVector<AutofillAssistantNodeSignals> results_3 = + GetAutofillAssistantNodeSignals(WebDocument(&GetDocument())); + ASSERT_EQ(results_3.size(), 1u); + + ASSERT_EQ(results_3[0].label_features.text.size(), 1u); + EXPECT_EQ(results_3[0].label_features.text[0], "Name First"); } } // namespace blink
diff --git a/third_party/blink/renderer/modules/direct_sockets/BUILD.gn b/third_party/blink/renderer/modules/direct_sockets/BUILD.gn index 070ee3ee..ac16f05 100644 --- a/third_party/blink/renderer/modules/direct_sockets/BUILD.gn +++ b/third_party/blink/renderer/modules/direct_sockets/BUILD.gn
@@ -16,6 +16,10 @@ "tcp_writable_stream_wrapper.h", "udp_socket.cc", "udp_socket.h", + "udp_socket_mojo_remote.cc", + "udp_socket_mojo_remote.h", + "udp_writable_stream_wrapper.cc", + "udp_writable_stream_wrapper.h", ] deps = [ "//net:net" ] } @@ -26,6 +30,7 @@ "tcp_readable_stream_wrapper_unittest.cc", "tcp_socket_unittest.cc", "tcp_writable_stream_wrapper_unittest.cc", + "udp_writable_stream_wrapper_unittest.cc", ] configs += [
diff --git a/third_party/blink/renderer/modules/direct_sockets/tcp_socket_unittest.cc b/third_party/blink/renderer/modules/direct_sockets/tcp_socket_unittest.cc index 54ba6650c..d8c1837 100644 --- a/third_party/blink/renderer/modules/direct_sockets/tcp_socket_unittest.cc +++ b/third_party/blink/renderer/modules/direct_sockets/tcp_socket_unittest.cc
@@ -33,7 +33,7 @@ return tcp_socket; } - ScriptPromise GetSciptPromise() { return create_promise_; } + ScriptPromise GetScriptPromise() { return create_promise_; } private: ScriptPromise create_promise_; @@ -43,13 +43,13 @@ V8TestingScope scope; TCPSocketCreator tcp_socket_creator; - auto create_promise = tcp_socket_creator.GetSciptPromise(); + auto create_promise = tcp_socket_creator.GetScriptPromise(); EXPECT_TRUE(create_promise.IsEmpty()); tcp_socket_creator.Create(scope); auto* script_state = scope.GetScriptState(); - create_promise = tcp_socket_creator.GetSciptPromise(); + create_promise = tcp_socket_creator.GetScriptPromise(); ScriptPromiseTester create_tester(script_state, create_promise); EXPECT_TRUE(create_promise.IsAssociatedWith(script_state)); @@ -62,7 +62,7 @@ auto* tcp_socket = tcp_socket_creator.Create(scope); auto* script_state = scope.GetScriptState(); - auto create_promise = tcp_socket_creator.GetSciptPromise(); + auto create_promise = tcp_socket_creator.GetScriptPromise(); ScriptPromiseTester create_tester(script_state, create_promise); ASSERT_FALSE(create_tester.IsRejected()); @@ -89,7 +89,7 @@ auto* tcp_socket = tcp_socket_creator.Create(scope); auto* script_state = scope.GetScriptState(); - auto create_promise = tcp_socket_creator.GetSciptPromise(); + auto create_promise = tcp_socket_creator.GetScriptPromise(); ScriptPromiseTester create_tester(script_state, create_promise); ASSERT_FALSE(create_tester.IsRejected()); @@ -121,7 +121,7 @@ auto* tcp_socket = tcp_socket_creator.Create(scope); auto* script_state = scope.GetScriptState(); - auto create_promise = tcp_socket_creator.GetSciptPromise(); + auto create_promise = tcp_socket_creator.GetScriptPromise(); ScriptPromiseTester create_tester(script_state, create_promise); ASSERT_FALSE(create_tester.IsFulfilled()); @@ -148,7 +148,7 @@ auto* tcp_socket = tcp_socket_creator.Create(scope); auto* script_state = scope.GetScriptState(); - auto create_promise = tcp_socket_creator.GetSciptPromise(); + auto create_promise = tcp_socket_creator.GetScriptPromise(); ScriptPromiseTester create_tester(script_state, create_promise); ASSERT_FALSE(create_tester.IsRejected());
diff --git a/third_party/blink/renderer/modules/direct_sockets/tcp_writable_stream_wrapper.h b/third_party/blink/renderer/modules/direct_sockets/tcp_writable_stream_wrapper.h index d0aab78..801c5ecb 100644 --- a/third_party/blink/renderer/modules/direct_sockets/tcp_writable_stream_wrapper.h +++ b/third_party/blink/renderer/modules/direct_sockets/tcp_writable_stream_wrapper.h
@@ -50,8 +50,6 @@ return writable_; } - ScriptState* GetScriptState() { return script_state_; } - void Reset(); State GetState() const { return state_; }
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_message.idl b/third_party/blink/renderer/modules/direct_sockets/udp_message.idl new file mode 100644 index 0000000..d7eb081 --- /dev/null +++ b/third_party/blink/renderer/modules/direct_sockets/udp_message.idl
@@ -0,0 +1,11 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// https://github.com/WICG/direct-sockets/blob/main/docs/explainer.md#udp + +dictionary UDPMessage { + ArrayBuffer data; + DOMString remoteAddress; + unsigned short remotePort; +};
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_socket.cc b/third_party/blink/renderer/modules/direct_sockets/udp_socket.cc index dd48ff8..861be46 100644 --- a/third_party/blink/renderer/modules/direct_sockets/udp_socket.cc +++ b/third_party/blink/renderer/modules/direct_sockets/udp_socket.cc
@@ -5,13 +5,18 @@ #include "third_party/blink/renderer/modules/direct_sockets/udp_socket.h" #include "base/metrics/histogram_functions.h" +#include "base/notreached.h" #include "net/base/net_errors.h" +#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/core/dom/dom_exception.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/fileapi/blob.h" +#include "third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.h" #include "third_party/blink/renderer/platform/bindings/exception_state.h" +#include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/persistent.h" +#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h" #include "third_party/blink/renderer/platform/scheduler/public/scheduling_policy.h" #include "third_party/blink/renderer/platform/wtf/functional.h" @@ -31,7 +36,9 @@ feature_handle_for_scheduler_( execution_context->GetScheduler()->RegisterFeature( SchedulingPolicy::Feature::kOutstandingNetworkRequestDirectSocket, - {SchedulingPolicy::DisableBackForwardCache()})) { + {SchedulingPolicy::DisableBackForwardCache()})), + udp_socket_(MakeGarbageCollected<UDPSocketMojoRemote>(execution_context)), + socket_listener_receiver_(this, execution_context) { DCHECK(init_resolver_); } @@ -40,13 +47,15 @@ mojo::PendingReceiver<blink::mojom::blink::DirectUDPSocket> UDPSocket::GetUDPSocketReceiver() { DCHECK(init_resolver_); - return udp_socket_.BindNewPipeAndPassReceiver(); + return udp_socket_->get().BindNewPipeAndPassReceiver( + GetExecutionContext()->GetTaskRunner(TaskType::kNetworking)); } mojo::PendingRemote<network::mojom::blink::UDPSocketListener> UDPSocket::GetUDPSocketListener() { DCHECK(init_resolver_); - auto result = socket_listener_receiver_.BindNewPipeAndPassRemote(); + auto result = socket_listener_receiver_.BindNewPipeAndPassRemote( + GetExecutionContext()->GetTaskRunner(TaskType::kNetworking)); socket_listener_receiver_.set_disconnect_handler(WTF::Bind( &UDPSocket::OnSocketListenerConnectionError, WrapPersistent(this))); @@ -60,6 +69,9 @@ DCHECK(init_resolver_); if (result == net::Error::OK && peer_addr.has_value()) { peer_addr_ = peer_addr; + udp_writable_stream_wrapper_ = + MakeGarbageCollected<UDPWritableStreamWrapper>( + init_resolver_->GetScriptState(), udp_socket_); init_resolver_->Resolve(this); } else { if (result != net::Error::OK) { @@ -74,11 +86,16 @@ } ScriptPromise UDPSocket::close(ScriptState* script_state, ExceptionState&) { - DoClose(/*is_local_close=*/true); + DoClose(); return ScriptPromise::CastUndefined(script_state); } +WritableStream* UDPSocket::writable() const { + DCHECK(udp_writable_stream_wrapper_); + return udp_writable_stream_wrapper_->Writable(); +} + String UDPSocket::remoteAddress() const { return String::FromUTF8(peer_addr_->ToStringWithoutPort()); } @@ -95,27 +112,37 @@ } bool UDPSocket::HasPendingActivity() const { - return !!send_resolver_; + if (!udp_writable_stream_wrapper_) { + return false; + } + return udp_writable_stream_wrapper_->HasPendingActivity(); } void UDPSocket::Trace(Visitor* visitor) const { visitor->Trace(init_resolver_); - visitor->Trace(send_resolver_); + visitor->Trace(udp_writable_stream_wrapper_); + visitor->Trace(udp_socket_); + visitor->Trace(socket_listener_receiver_); ScriptWrappable::Trace(visitor); ActiveScriptWrappable::Trace(visitor); ExecutionContextClient::Trace(visitor); } void UDPSocket::OnSocketListenerConnectionError() { - DoClose(/*is_local_close=*/false); + DoClose(); } -void UDPSocket::DoClose(bool is_local_close) { +void UDPSocket::DoClose() { init_resolver_ = nullptr; socket_listener_receiver_.reset(); - if (is_local_close && udp_socket_.is_bound()) - udp_socket_->Close(); - udp_socket_.reset(); + + // Reject pending write promises. + if (udp_writable_stream_wrapper_) { + udp_writable_stream_wrapper_->Dispose(); + } + // Close the socket. + udp_socket_->Close(); + feature_handle_for_scheduler_.reset(); }
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_socket.h b/third_party/blink/renderer/modules/direct_sockets/udp_socket.h index fd5a37ef..599831e 100644 --- a/third_party/blink/renderer/modules/direct_sockets/udp_socket.h +++ b/third_party/blink/renderer/modules/direct_sockets/udp_socket.h
@@ -5,6 +5,7 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_DIRECT_SOCKETS_UDP_SOCKET_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_DIRECT_SOCKETS_UDP_SOCKET_H_ +#include "base/callback_forward.h" #include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/receiver.h" @@ -15,10 +16,14 @@ #include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" +#include "third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.h" +#include "third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.h" #include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/member.h" +#include "third_party/blink/renderer/platform/mojo/heap_mojo_receiver.h" +#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h" #include "third_party/blink/renderer/platform/scheduler/public/frame_or_worker_scheduler.h" namespace net { @@ -56,6 +61,7 @@ // Web-exposed functions ScriptPromise close(ScriptState*, ExceptionState&); + WritableStream* writable() const; String remoteAddress() const; uint16_t remotePort() const; @@ -64,23 +70,23 @@ const absl::optional<::net::IPEndPoint>& src_addr, absl::optional<::base::span<const ::uint8_t>> data) override; - // ScriptWrappable: + // ActiveScriptWrappable overrides. bool HasPendingActivity() const override; void Trace(Visitor* visitor) const override; private: void OnSocketListenerConnectionError(); - void DoClose(bool is_local_close); + void DoClose(); Member<ScriptPromiseResolver> init_resolver_; FrameOrWorkerScheduler::SchedulingAffectingFeatureHandle feature_handle_for_scheduler_; - mojo::Remote<blink::mojom::blink::DirectUDPSocket> udp_socket_; - mojo::Receiver<network::mojom::blink::UDPSocketListener> - socket_listener_receiver_{this}; + const Member<UDPSocketMojoRemote> udp_socket_; + HeapMojoReceiver<network::mojom::blink::UDPSocketListener, UDPSocket> + socket_listener_receiver_; - Member<ScriptPromiseResolver> send_resolver_; + Member<UDPWritableStreamWrapper> udp_writable_stream_wrapper_; absl::optional<net::IPEndPoint> local_addr_; absl::optional<net::IPEndPoint> peer_addr_; };
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_socket.idl b/third_party/blink/renderer/modules/direct_sockets/udp_socket.idl index 6fcfebc..cecc059 100644 --- a/third_party/blink/renderer/modules/direct_sockets/udp_socket.idl +++ b/third_party/blink/renderer/modules/direct_sockets/udp_socket.idl
@@ -10,7 +10,7 @@ RuntimeEnabled=DirectSockets, DirectSocketEnabled ] interface UDPSocket { - // TODO(crbug.com/1119620): Add support for sending, receiving + // TODO(crbug.com/1119620): Add support for receiving // TODO(crbug.com/1119620): Add measurement [RaisesException, CallWith=ScriptState, Measure] @@ -18,4 +18,5 @@ readonly attribute DOMString remoteAddress; readonly attribute unsigned short remotePort; + readonly attribute WritableStream writable; };
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.cc b/third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.cc new file mode 100644 index 0000000..62bda653 --- /dev/null +++ b/third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.cc
@@ -0,0 +1,28 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.h" + +#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink.h" +#include "third_party/blink/renderer/core/execution_context/execution_context.h" + +namespace blink { + +UDPSocketMojoRemote::UDPSocketMojoRemote(ExecutionContext* execution_context) + : udp_socket_{execution_context} {} + +UDPSocketMojoRemote::~UDPSocketMojoRemote() = default; + +void UDPSocketMojoRemote::Close() { + if (udp_socket_.is_bound()) { + udp_socket_->Close(); + } + udp_socket_.reset(); +} + +void UDPSocketMojoRemote::Trace(Visitor* visitor) const { + visitor->Trace(udp_socket_); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.h b/third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.h new file mode 100644 index 0000000..fae3473 --- /dev/null +++ b/third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.h
@@ -0,0 +1,36 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_DIRECT_SOCKETS_UDP_SOCKET_MOJO_REMOTE_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_DIRECT_SOCKETS_UDP_SOCKET_MOJO_REMOTE_H_ + +#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink.h" +#include "third_party/blink/renderer/core/execution_context/execution_context.h" +#include "third_party/blink/renderer/modules/modules_export.h" +#include "third_party/blink/renderer/platform/heap/garbage_collected.h" +#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h" + +namespace blink { + +// A wrapper class of HeapMojoRemote<DirectUDPSocket> so that multiple owners +// share the same HeapmojoRemote. +class MODULES_EXPORT UDPSocketMojoRemote + : public GarbageCollected<UDPSocketMojoRemote> { + public: + explicit UDPSocketMojoRemote(ExecutionContext* execution_context); + ~UDPSocketMojoRemote(); + + HeapMojoRemote<mojom::blink::DirectUDPSocket>& get() { return udp_socket_; } + + void Close(); + + void Trace(Visitor* visitor) const; + + private: + HeapMojoRemote<mojom::blink::DirectUDPSocket> udp_socket_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_DIRECT_SOCKETS_UDP_SOCKET_MOJO_REMOTE_H_
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.cc b/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.cc new file mode 100644 index 0000000..104fa78 --- /dev/null +++ b/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.cc
@@ -0,0 +1,193 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.h" + +#include "net/base/net_errors.h" +#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_typedefs.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_union_arraybuffer_arraybufferview.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_udp_message.h" +#include "third_party/blink/renderer/core/dom/dom_exception.h" +#include "third_party/blink/renderer/core/execution_context/execution_context.h" +#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" +#include "third_party/blink/renderer/core/streams/underlying_sink_base.h" +#include "third_party/blink/renderer/core/streams/writable_stream.h" +#include "third_party/blink/renderer/core/streams/writable_stream_default_controller.h" +#include "third_party/blink/renderer/core/typed_arrays/dom_array_piece.h" +#include "third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.h" +#include "third_party/blink/renderer/platform/bindings/exception_code.h" +#include "third_party/blink/renderer/platform/bindings/exception_state.h" +#include "third_party/blink/renderer/platform/bindings/script_state.h" +#include "third_party/blink/renderer/platform/heap/garbage_collected.h" +#include "third_party/blink/renderer/platform/heap/persistent.h" +#include "third_party/blink/renderer/platform/wtf/functional.h" + +namespace blink { + +// UDPWritableStreamWrapper::UnderlyingSink declaration + +class UDPWritableStreamWrapper::UnderlyingSink final + : public UnderlyingSinkBase { + public: + explicit UnderlyingSink(UDPWritableStreamWrapper* udp_writable_stream_wrapper) + : udp_writable_stream_wrapper_(udp_writable_stream_wrapper) {} + + ScriptPromise start(ScriptState* script_state, + WritableStreamDefaultController* controller, + ExceptionState&) override; + ScriptPromise write(ScriptState* script_state, + ScriptValue chunk, + WritableStreamDefaultController*, + ExceptionState& exception_state) override; + ScriptPromise close(ScriptState* script_state, ExceptionState&) override; + ScriptPromise abort(ScriptState* script_state, + ScriptValue reason, + ExceptionState& exception_state) override; + + void Trace(Visitor* visitor) const override { + visitor->Trace(udp_writable_stream_wrapper_); + UnderlyingSinkBase::Trace(visitor); + } + + private: + const Member<UDPWritableStreamWrapper> udp_writable_stream_wrapper_; +}; + +// UDPWritableStreamWrapper::UnderlyingSink definition + +ScriptPromise UDPWritableStreamWrapper::UnderlyingSink::start( + ScriptState* script_state, + WritableStreamDefaultController* controller, + ExceptionState&) { + udp_writable_stream_wrapper_->controller_ = controller; + return ScriptPromise::CastUndefined(script_state); +} + +ScriptPromise UDPWritableStreamWrapper::UnderlyingSink::write( + ScriptState* script_state, + ScriptValue chunk, + WritableStreamDefaultController*, + ExceptionState& exception_state) { + return udp_writable_stream_wrapper_->SinkWrite(script_state, chunk, + exception_state); +} + +ScriptPromise UDPWritableStreamWrapper::UnderlyingSink::close( + ScriptState* script_state, + ExceptionState&) { + // The specification guarantees that this will only be called after all + // pending writes have been completed. + DCHECK(!udp_writable_stream_wrapper_->send_resolver_); + + // It's not possible to close the writable side of the UDP socket, therefore + // no action is taken. + return ScriptPromise::CastUndefined(script_state); +} + +ScriptPromise UDPWritableStreamWrapper::UnderlyingSink::abort( + ScriptState* script_state, + ScriptValue reason, + ExceptionState& exception_state) { + // The specification guarantees that this will only be called after all + // pending writes have been completed. + DCHECK(!udp_writable_stream_wrapper_->send_resolver_); + + // It's not possible to close the writable side of the UDP socket, therefore + // no action is taken. + return ScriptPromise::CastUndefined(script_state); +} + +// UDPWritableStreamWrapper definition + +UDPWritableStreamWrapper::UDPWritableStreamWrapper( + ScriptState* script_state, + const Member<UDPSocketMojoRemote> udp_socket) + : ExecutionContextClient(ExecutionContext::From(script_state)), + script_state_(script_state), + udp_socket_(udp_socket) { + ScriptState::Scope scope(script_state); + writable_ = WritableStream::CreateWithCountQueueingStrategy( + script_state_, + MakeGarbageCollected<UDPWritableStreamWrapper::UnderlyingSink>(this), 1); +} + +UDPWritableStreamWrapper::~UDPWritableStreamWrapper() = default; + +bool UDPWritableStreamWrapper::HasPendingActivity() const { + return !!send_resolver_; +} + +void UDPWritableStreamWrapper::Trace(Visitor* visitor) const { + visitor->Trace(script_state_); + visitor->Trace(udp_socket_); + visitor->Trace(send_resolver_); + visitor->Trace(writable_); + visitor->Trace(controller_); + ActiveScriptWrappable::Trace(visitor); + ExecutionContextClient::Trace(visitor); +} + +ScriptPromise UDPWritableStreamWrapper::SinkWrite( + ScriptState* script_state, + ScriptValue chunk, + ExceptionState& exception_state) { + // If socket has been closed. + if (!udp_socket_->get().is_bound()) { + exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError, + "Socket is disconnected."); + return ScriptPromise(); + } + + UDPMessage* message = UDPMessage::Create(script_state->GetIsolate(), + chunk.V8Value(), exception_state); + if (!message->hasData()) { + exception_state.ThrowDOMException(DOMExceptionCode::kDataError, + "UDPMessage: missing 'data' field."); + return ScriptPromise(); + } + + DOMArrayPiece array_piece(message->data()); + base::span<const uint8_t> data{array_piece.Bytes(), array_piece.ByteLength()}; + + DCHECK(!send_resolver_); + send_resolver_ = MakeGarbageCollected<ScriptPromiseResolver>(script_state); + + // Why not just return send_resolver_->Promise()? + // In view of the async nature of the write handler, the callback might get + // executed earlier than the function return statement. There are two + // concerns related to that behavior: + // -- send_resolver_ will be set to nullptr and the above call with crash; + // -- send_resover_->Reject() will be called earlier than + // send_resolver_->Promise(), and the resulting promise will be dummy + // (i.e. fulfilled by default). + ScriptPromise promise = send_resolver_->Promise(); + udp_socket_->get()->Send(data, WTF::Bind(&UDPWritableStreamWrapper::OnSend, + WrapWeakPersistent(this))); + return promise; +} + +void UDPWritableStreamWrapper::OnSend(int32_t result) { + if (send_resolver_) { + if (result == net::Error::OK) { + send_resolver_->Resolve(); + } else { + send_resolver_->Reject(MakeGarbageCollected<DOMException>( + DOMExceptionCode::kNetworkError, "Failed to send.")); + } + send_resolver_ = nullptr; + } +} + +void UDPWritableStreamWrapper::Dispose() { + if (send_resolver_) { + send_resolver_->Reject(MakeGarbageCollected<DOMException>( + DOMExceptionCode::kInvalidStateError, "Failed to send data.")); + send_resolver_ = nullptr; + } +} + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.h b/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.h new file mode 100644 index 0000000..1394550 --- /dev/null +++ b/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.h
@@ -0,0 +1,69 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_DIRECT_SOCKETS_UDP_WRITABLE_STREAM_WRAPPER_H_ +#define THIRD_PARTY_BLINK_RENDERER_MODULES_DIRECT_SOCKETS_UDP_WRITABLE_STREAM_WRAPPER_H_ + +#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink.h" +#include "third_party/blink/renderer/bindings/core/v8/active_script_wrappable.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" +#include "third_party/blink/renderer/core/dom/events/event_target_impl.h" +#include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" +#include "third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.h" +#include "third_party/blink/renderer/modules/modules_export.h" +#include "third_party/blink/renderer/platform/bindings/exception_code.h" +#include "third_party/blink/renderer/platform/bindings/script_state.h" +#include "third_party/blink/renderer/platform/heap/prefinalizer.h" +#include "third_party/blink/renderer/platform/mojo/heap_mojo_remote.h" + +namespace blink { + +class ScriptState; +class WritableStream; +class WritableStreamDefaultController; + +class MODULES_EXPORT UDPWritableStreamWrapper final + : public GarbageCollected<UDPWritableStreamWrapper>, + public ActiveScriptWrappable<UDPWritableStreamWrapper>, + public ExecutionContextClient { + USING_PRE_FINALIZER(UDPWritableStreamWrapper, Dispose); + + public: + UDPWritableStreamWrapper(ScriptState* script_state, + const Member<UDPSocketMojoRemote> udp_socket_); + ~UDPWritableStreamWrapper() override; + + WritableStream* Writable() const { return writable_; } + + // ActiveScriptWrappable overrides. + bool HasPendingActivity() const; + void Trace(Visitor*) const override; + + // Called before destruction of the StreamWrapper. + void Dispose(); + + private: + class UnderlyingSink; + + // Implements UnderlyingSink::write(). + ScriptPromise SinkWrite(ScriptState* script_state, + ScriptValue chunk, + ExceptionState& exception_state); + + // Callback for DirectUDPSocket::Send(). + void OnSend(int32_t result); + + const Member<ScriptState> script_state_; + + const Member<UDPSocketMojoRemote> udp_socket_; + Member<ScriptPromiseResolver> send_resolver_; + + Member<WritableStream> writable_; + Member<WritableStreamDefaultController> controller_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_DIRECT_SOCKETS_UDP_WRITABLE_STREAM_WRAPPER_H_
diff --git a/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper_unittest.cc b/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper_unittest.cc new file mode 100644 index 0000000..02ed0d8 --- /dev/null +++ b/third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper_unittest.cc
@@ -0,0 +1,249 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "third_party/blink/renderer/modules/direct_sockets/udp_writable_stream_wrapper.h" + +#include "base/bind.h" +#include "base/notreached.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "net/base/net_errors.h" +#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink-forward.h" +#include "third_party/blink/public/mojom/direct_sockets/direct_sockets.mojom-blink.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise.h" +#include "third_party/blink/renderer/bindings/core/v8/script_promise_tester.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_dom_exception.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_throw_dom_exception.h" +#include "third_party/blink/renderer/bindings/modules/v8/v8_udp_message.h" +#include "third_party/blink/renderer/core/dom/dom_exception.h" +#include "third_party/blink/renderer/core/streams/writable_stream.h" +#include "third_party/blink/renderer/core/streams/writable_stream_default_writer.h" +#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h" +#include "third_party/blink/renderer/core/typed_arrays/dom_typed_array.h" +#include "third_party/blink/renderer/modules/direct_sockets/udp_socket_mojo_remote.h" +#include "third_party/blink/renderer/platform/bindings/exception_code.h" +#include "third_party/blink/renderer/platform/bindings/exception_state.h" +#include "third_party/blink/renderer/platform/heap/garbage_collected.h" +#include "third_party/blink/renderer/platform/testing/unit_test_helpers.h" +#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" +#include "third_party/googletest/src/googlemock/include/gmock/gmock-matchers.h" + +namespace blink { + +namespace { + +class FakeDirectUDPSocket : public blink::mojom::blink::DirectUDPSocket { + public: + void Send(base::span<const uint8_t> data, SendCallback callback) override { + data_.Append(data.data(), static_cast<uint32_t>(data.size_bytes())); + std::move(callback).Run(net::Error::OK); + } + + void ReceiveMore(uint32_t num_additional_datagrams) override { NOTREACHED(); } + + void Close() override { NOTREACHED(); } + + const Vector<uint8_t>& GetReceivedData() const { return data_; } + + private: + Vector<uint8_t> data_; +}; + +class StreamCreator { + STACK_ALLOCATED(); + + public: + explicit StreamCreator(const V8TestingScope& scope, + FakeDirectUDPSocket* fake_udp_socket) + : scope_(scope), receiver_{fake_udp_socket} {} + + ~StreamCreator() { test::RunPendingTasks(); } + + UDPWritableStreamWrapper* Create() { + auto* udp_socket = + MakeGarbageCollected<UDPSocketMojoRemote>(scope_.GetExecutionContext()); + udp_socket->get().Bind( + receiver_.BindNewPipeAndPassRemote(), + scope_.GetExecutionContext()->GetTaskRunner(TaskType::kNetworking)); + + auto* script_state = scope_.GetScriptState(); + auto* udp_writable_stream_wrapper = + MakeGarbageCollected<UDPWritableStreamWrapper>(script_state, + udp_socket); + return udp_writable_stream_wrapper; + } + + private: + const V8TestingScope& scope_; + mojo::Receiver<blink::mojom::blink::DirectUDPSocket> receiver_; +}; + +TEST(UDPWritableStreamWrapperTest, Create) { + V8TestingScope scope; + FakeDirectUDPSocket fake_udp_socket; + StreamCreator stream_creator{scope, &fake_udp_socket}; + auto* udp_writable_stream_wrapper = stream_creator.Create(); + EXPECT_TRUE(udp_writable_stream_wrapper->Writable()); +} + +TEST(UDPWritableStreamWrapperTest, WriteUdpMessage) { + V8TestingScope scope; + FakeDirectUDPSocket fake_udp_socket; + StreamCreator stream_creator{scope, &fake_udp_socket}; + + auto* udp_writable_stream_wrapper = stream_creator.Create(); + auto* script_state = scope.GetScriptState(); + + auto* writer = udp_writable_stream_wrapper->Writable()->getWriter( + script_state, ASSERT_NO_EXCEPTION); + + auto* chunk = DOMArrayBuffer::Create("A", 1); + auto* message = UDPMessage::Create(); + message->setData(chunk); + + ScriptPromise result = + writer->write(script_state, ScriptValue::From(script_state, message), + ASSERT_NO_EXCEPTION); + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + + ASSERT_TRUE(tester.IsFulfilled()); + + EXPECT_THAT(fake_udp_socket.GetReceivedData(), ::testing::ElementsAre('A')); +} + +TEST(UDPWritableStreamWrapperTest, WriteUdpMessageWithEmptyDataField) { + V8TestingScope scope; + FakeDirectUDPSocket fake_udp_socket; + StreamCreator stream_creator{scope, &fake_udp_socket}; + + auto* udp_writable_stream_wrapper = stream_creator.Create(); + auto* script_state = scope.GetScriptState(); + + auto* writer = udp_writable_stream_wrapper->Writable()->getWriter( + script_state, ASSERT_NO_EXCEPTION); + + // Create empty DOMArrayBuffer. + auto* chunk = DOMArrayBuffer::Create(/*num_elements=*/static_cast<size_t>(0), + /*element_byte_size=*/1); + auto* message = UDPMessage::Create(); + message->setData(chunk); + + ScriptPromise result = + writer->write(script_state, ScriptValue::From(script_state, message), + ASSERT_NO_EXCEPTION); + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + + ASSERT_TRUE(tester.IsFulfilled()); + + // Nothing should have been written from the empty DOMArrayBuffer. + EXPECT_THAT(fake_udp_socket.GetReceivedData(), ::testing::ElementsAre()); +} + +TEST(UDPWritableStreamWrapperTest, WriteUdpMessageWithoutDataField) { + V8TestingScope scope; + FakeDirectUDPSocket fake_udp_socket; + StreamCreator stream_creator{scope, &fake_udp_socket}; + auto* udp_writable_stream_wrapper = stream_creator.Create(); + auto* script_state = scope.GetScriptState(); + + auto* writer = udp_writable_stream_wrapper->Writable()->getWriter( + script_state, ASSERT_NO_EXCEPTION); + + // Create empty message (without 'data' field). + auto* message = UDPMessage::Create(); + + ScriptPromise result = + writer->write(script_state, ScriptValue::From(script_state, message), + ASSERT_NO_EXCEPTION); + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + + // Should be rejected due to missing 'data' field. + ASSERT_TRUE(tester.IsRejected()); + + DOMException* exception = V8DOMException::ToImplWithTypeCheck( + scope.GetIsolate(), tester.Value().V8Value()); + + ASSERT_TRUE(exception); + ASSERT_EQ(exception->name(), "DataError"); + ASSERT_EQ(exception->message(), + "Failed to execute 'write' on 'UnderlyingSinkBase': UDPMessage: " + "missing 'data' field."); +} + +TEST(UDPWritableStreamWrapperTest, WriteAfterFinishedWrite) { + V8TestingScope scope; + FakeDirectUDPSocket fake_udp_socket; + StreamCreator stream_creator{scope, &fake_udp_socket}; + auto* udp_writable_stream_wrapper = stream_creator.Create(); + auto* script_state = scope.GetScriptState(); + + auto* writer = udp_writable_stream_wrapper->Writable()->getWriter( + script_state, ASSERT_NO_EXCEPTION); + + for (const auto* value : {"A", "B"}) { + auto* chunk = DOMArrayBuffer::Create(value, 1); + auto* message = UDPMessage::Create(); + message->setData(chunk); + + ScriptPromise result = + writer->write(script_state, ScriptValue::From(script_state, message), + ASSERT_NO_EXCEPTION); + + ScriptPromiseTester tester(script_state, result); + tester.WaitUntilSettled(); + + ASSERT_TRUE(tester.IsFulfilled()); + } + + EXPECT_THAT(fake_udp_socket.GetReceivedData(), + ::testing::ElementsAre('A', 'B')); +} + +TEST(UDPWritableStreamWrapperTest, WriteAfterClose) { + V8TestingScope scope; + FakeDirectUDPSocket fake_udp_socket; + StreamCreator stream_creator{scope, &fake_udp_socket}; + auto* udp_writable_stream_wrapper = stream_creator.Create(); + auto* script_state = scope.GetScriptState(); + + auto* writer = udp_writable_stream_wrapper->Writable()->getWriter( + script_state, ASSERT_NO_EXCEPTION); + + auto* chunk = DOMArrayBuffer::Create("A", 1); + auto* message = UDPMessage::Create(); + message->setData(chunk); + + ScriptPromise write_result = + writer->write(script_state, ScriptValue::From(script_state, message), + ASSERT_NO_EXCEPTION); + ScriptPromiseTester write_tester(script_state, write_result); + write_tester.WaitUntilSettled(); + + ASSERT_TRUE(write_tester.IsFulfilled()); + + ScriptPromise close_result = writer->close(script_state, ASSERT_NO_EXCEPTION); + ScriptPromiseTester close_tester(script_state, close_result); + close_tester.WaitUntilSettled(); + + ASSERT_TRUE(write_tester.IsFulfilled()); + + ScriptPromise write_after_close_result = + writer->write(script_state, ScriptValue::From(script_state, message), + ASSERT_NO_EXCEPTION); + ScriptPromiseTester write_after_close_tester(script_state, + write_after_close_result); + write_after_close_tester.WaitUntilSettled(); + + ASSERT_TRUE(write_after_close_tester.IsRejected()); +} + +} // namespace + +} // namespace blink
diff --git a/third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.cc b/third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.cc index be668257..ca7040a 100644 --- a/third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.cc +++ b/third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.cc
@@ -5,6 +5,7 @@ #include "third_party/blink/renderer/modules/mediastream/browser_capture_media_stream_track.h" #include "base/guid.h" +#include "base/metrics/histogram_functions.h" #include "base/token.h" #include "build/build_config.h" #include "media/capture/mojom/video_capture_types.mojom-blink.h" @@ -21,6 +22,23 @@ namespace { +// These values are persisted to logs. Entries should not be renumbered and +// numeric values should never be reused. +enum class CropToResult { + kResolved = 0, + kUnsupportedPlatform = 1, + kInvalidCropTargetFormat = 2, + kRejectedWithErrorGeneric = 3, + kRejectedWithUnsupportedCaptureDevice = 4, + kRejectedWithErrorUnknownDeviceId = 5, + kRejectedWithNotImplemented = 6, + kMaxValue = kRejectedWithNotImplemented +}; + +void RecordUma(CropToResult result) { + base::UmaHistogramEnumeration("Media.RegionCapture.CropTo.Result", result); +} + #if !BUILDFLAG(IS_ANDROID) // If crop_id is the empty string, returns an empty base::Token. // If crop_id is a valid UUID, returns a base::Token representing the ID. @@ -54,23 +72,28 @@ switch (result) { case media::mojom::CropRequestResult::kSuccess: + RecordUma(CropToResult::kResolved); // TODO(crbug.com/1247761): Delay reporting success to the Web-application // until "seeing" the last frame cropped to the previous crop-target. resolver->Resolve(); return; case media::mojom::CropRequestResult::kErrorGeneric: + RecordUma(CropToResult::kRejectedWithErrorGeneric); RaiseCropException(resolver, DOMExceptionCode::kAbortError, "Unknown error."); return; case media::mojom::CropRequestResult::kUnsupportedCaptureDevice: + RecordUma(CropToResult::kRejectedWithUnsupportedCaptureDevice); RaiseCropException(resolver, DOMExceptionCode::kAbortError, "Unsupported device."); return; case media::mojom::CropRequestResult::kErrorUnknownDeviceId: + RecordUma(CropToResult::kRejectedWithErrorUnknownDeviceId); RaiseCropException(resolver, DOMExceptionCode::kAbortError, "Unknown device."); return; case media::mojom::CropRequestResult::kNotImplemented: + RecordUma(CropToResult::kRejectedWithNotImplemented); RaiseCropException(resolver, DOMExceptionCode::kAbortError, "Not implemented."); return; @@ -119,6 +142,7 @@ ScriptPromise promise = resolver->Promise(); #if BUILDFLAG(IS_ANDROID) + RecordUma(CropToResult::kUnsupportedPlatform); resolver->Reject(MakeGarbageCollected<DOMException>( DOMExceptionCode::kUnknownError, "Not supported on Android.")); return promise; @@ -127,6 +151,7 @@ const absl::optional<base::Token> crop_id_token = CropIdStringToToken(crop_id); if (!crop_id_token.has_value()) { + RecordUma(CropToResult::kInvalidCropTargetFormat); resolver->Reject(MakeGarbageCollected<DOMException>( DOMExceptionCode::kUnknownError, "Invalid crop-ID.")); return promise;
diff --git a/third_party/blink/renderer/modules/mediastream/identifiability_metrics.cc b/third_party/blink/renderer/modules/mediastream/identifiability_metrics.cc index 961c981..c06668aa 100644 --- a/third_party/blink/renderer/modules/mediastream/identifiability_metrics.cc +++ b/third_party/blink/renderer/modules/mediastream/identifiability_metrics.cc
@@ -208,7 +208,6 @@ Visit(builder, set.getAutoGainControlOr(nullptr)); Visit(builder, set.getLatencyOr(nullptr)); Visit(builder, set.getChannelCountOr(nullptr)); - Visit(builder, set.getVideoKindOr(nullptr)); Visit(builder, set.getWhiteBalanceModeOr(nullptr)); Visit(builder, set.getExposureModeOr(nullptr)); Visit(builder, set.getFocusModeOr(nullptr));
diff --git a/third_party/blink/renderer/modules/mediastream/media_constraints_impl.cc b/third_party/blink/renderer/modules/mediastream/media_constraints_impl.cc index 13be65a..563d82db 100644 --- a/third_party/blink/renderer/modules/mediastream/media_constraints_impl.cc +++ b/third_party/blink/renderer/modules/mediastream/media_constraints_impl.cc
@@ -148,10 +148,6 @@ // https://crbug.com/579729 const char kGoogLeakyBucket[] = "googLeakyBucket"; const char kPowerLineFrequency[] = "googPowerLineFrequency"; -// mediacapture-depth: videoKind key and VideoKindEnum values. -const char kVideoKind[] = "videoKind"; -const char kVideoKindColor[] = "color"; -const char kVideoKindDepth[] = "depth"; // Names used for testing. const char kTestConstraint1[] = "valid_and_supported_1"; const char kTestConstraint2[] = "valid_and_supported_2"; @@ -436,14 +432,6 @@ mojom::ConsoleMessageLevel::kWarning, "Obsolete constraint named " + String(constraint.name_) + " is ignored. Please stop using it.")); - } else if (constraint.name_.Equals(kVideoKind)) { - if (!constraint.value_.Equals(kVideoKindColor) && - !constraint.value_.Equals(kVideoKindDepth)) { - error_state.ThrowConstraintError("Illegal value for constraint", - constraint.name_); - } else { - result.video_kind.SetExact(constraint.value_); - } } else if (constraint.name_.Equals(kTestConstraint1) || constraint.name_.Equals(kTestConstraint2)) { // These constraints are only for testing parsing. @@ -843,14 +831,6 @@ return false; } } - if (constraints_in->hasVideoKind()) { - if (!ValidateAndCopyStringConstraint( - constraints_in->videoKind(), naked_treatment, - constraint_buffer.video_kind, error_state)) { - DCHECK(error_state.HadException()); - return false; - } - } if (constraints_in->hasPan()) { CopyBooleanOrDoubleConstraint(constraints_in->pan(), naked_treatment, constraint_buffer.pan); @@ -1130,8 +1110,6 @@ output->setDeviceId(ConvertString(input.device_id, naked_treatment)); if (!input.group_id.IsUnconstrained()) output->setGroupId(ConvertString(input.group_id, naked_treatment)); - if (!input.video_kind.IsUnconstrained()) - output->setVideoKind(ConvertString(input.video_kind, naked_treatment)); if (!input.pan.IsUnconstrained()) output->setPan(ConvertBooleanOrDouble(input.pan, naked_treatment)); if (!input.tilt.IsUnconstrained())
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.cc b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.cc index 53f3639..fa8fadb8 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.cc
@@ -43,10 +43,6 @@ // device ID, noise reduction, resolution and frame rate. const int kNumDefaultDistanceEntries = 4; -// VideoKind enum values. See https://w3c.github.io/mediacapture-depth. -const char kVideoKindColor[] = "color"; -const char kVideoKindDepth[] = "depth"; - WebString ToWebString(mojom::blink::FacingMode facing_mode) { switch (facing_mode) { case mojom::blink::FacingMode::USER: @@ -213,9 +209,6 @@ return kMinDeviceCaptureFrameRate; } - // Convenience accessor for video kind using Blink type. - WebString VideoKind() const { return GetVideoKindForFormat(format_); } - // This function tries to apply |constraint_set| to this candidate format // and returns true if successful. If |constraint_set| cannot be satisfied, // false is returned, and the name of one of the constraints that @@ -259,12 +252,6 @@ return false; } - if (!constraint_set.video_kind.Matches(VideoKind())) { - UpdateFailedConstraintName(constraint_set.video_kind, - failed_constraint_name); - return false; - } - resolution_set_ = resolution_intersection; rescale_set_ = rescale_intersection; constrained_frame_rate_ = constrained_frame_rate_.Intersection( @@ -358,19 +345,16 @@ track_fitness_with_rescale += 1.0; } } - double fitness = StringConstraintFitnessDistance( - VideoKind(), basic_constraint_set.video_kind); + // If rescaling and not rescaling have the same fitness, prefer not // rescaling. if (track_fitness_without_rescale <= track_fitness_with_rescale) { - fitness += track_fitness_without_rescale; *track_settings = track_settings_without_rescale; - } else { - fitness += track_fitness_with_rescale; - *track_settings = track_settings_with_rescale; + return track_fitness_without_rescale; } - return fitness; + *track_settings = track_settings_with_rescale; + return track_fitness_with_rescale; } // Returns a custom "native" fitness distance that expresses how close the @@ -710,12 +694,6 @@ VideoInputDeviceCapabilities::~VideoInputDeviceCapabilities() = default; -WebString GetVideoKindForFormat(const media::VideoCaptureFormat& format) { - return (format.pixel_format == media::PIXEL_FORMAT_Y16) - ? WebString::FromASCII(kVideoKindDepth) - : WebString::FromASCII(kVideoKindColor); -} - MediaStreamTrackPlatform::FacingMode ToPlatformFacingMode( mojom::blink::FacingMode video_facing) { switch (video_facing) {
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.h b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.h index 4095728..6ec0670 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.h +++ b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device.h
@@ -15,16 +15,10 @@ namespace blink { class MediaConstraints; -class WebString; } // namespace blink namespace blink { -// Calculates and returns videoKind value for |format|. -// See https://w3c.github.io/mediacapture-depth. -MODULES_EXPORT WebString -GetVideoKindForFormat(const media::VideoCaptureFormat& format); - MODULES_EXPORT MediaStreamTrackPlatform::FacingMode ToPlatformFacingMode( mojom::blink::FacingMode video_facing);
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device_test.cc b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device_test.cc index eeb10b3..426fe965 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device_test.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_constraints_util_video_device_test.cc
@@ -296,16 +296,6 @@ result.failed_constraint_name()); } -TEST_F(MediaStreamConstraintsUtilVideoDeviceTest, OverconstrainedOnVideoKind) { - constraint_factory_.Reset(); - // No device in |capabilities_| has video kind infrared. - constraint_factory_.basic().video_kind.SetExact("infrared"); - auto result = SelectSettings(); - EXPECT_FALSE(result.HasValue()); - EXPECT_EQ(constraint_factory_.basic().video_kind.GetName(), - result.failed_constraint_name()); -} - TEST_F(MediaStreamConstraintsUtilVideoDeviceTest, OverconstrainedOnHeight) { constraint_factory_.Reset(); constraint_factory_.basic().height.SetExact(123467890); @@ -525,22 +515,6 @@ CheckTrackAdapterSettingsEqualsFormat(result); } -TEST_F(MediaStreamConstraintsUtilVideoDeviceTest, MandatoryVideoKind) { - constraint_factory_.Reset(); - constraint_factory_.basic().video_kind.SetExact("depth"); - auto result = SelectSettings(); - EXPECT_TRUE(result.HasValue()); - EXPECT_EQ(kDeviceID4, result.device_id()); - EXPECT_EQ(media::PIXEL_FORMAT_Y16, result.Format().pixel_format); - CheckTrackAdapterSettingsEqualsFormat(result); - - constraint_factory_.basic().video_kind.SetExact("color"); - result = SelectSettings(); - EXPECT_TRUE(result.HasValue()); - EXPECT_EQ(default_device_->device_id.Utf8(), result.device_id()); - CheckTrackAdapterSettingsEqualsFormat(result); -} - TEST_F(MediaStreamConstraintsUtilVideoDeviceTest, MandatoryNoiseReduction) { constraint_factory_.Reset(); const bool kNoiseReductionValues[] = {true, false};
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_track.cc b/third_party/blink/renderer/modules/mediastream/media_stream_track.cc index 17c91a1..7afb0ae2 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_track.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_track.cc
@@ -111,7 +111,7 @@ constraint_set->hasFrameRate() || constraint_set->hasGroupId() || constraint_set->hasHeight() || constraint_set->hasLatency() || constraint_set->hasSampleRate() || constraint_set->hasSampleSize() || - constraint_set->hasVideoKind() || constraint_set->hasWidth(); + constraint_set->hasWidth(); } bool ConstraintSetHasImageAndNonImageCapture( @@ -609,11 +609,6 @@ settings->setHeight(platform_settings.height); if (platform_settings.HasAspectRatio()) settings->setAspectRatio(platform_settings.aspect_ratio); - if (RuntimeEnabledFeatures::MediaCaptureDepthVideoKindEnabled() && - component_->Source()->GetType() == MediaStreamSource::kTypeVideo) { - if (platform_settings.HasVideoKind()) - settings->setVideoKind(platform_settings.video_kind); - } settings->setDeviceId(platform_settings.device_id); if (!platform_settings.group_id.IsNull()) settings->setGroupId(platform_settings.group_id);
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc b/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc index c2fb71f..8305cb0 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_video_track.cc
@@ -693,7 +693,6 @@ if (format) { if (frame_rate_ == 0.0) settings.frame_rate = format->frame_rate; - settings.video_kind = GetVideoKindForFormat(*format); } else { // Format is only set for local tracks. For other tracks, use the frame rate // reported through settings callback SetSizeAndComputedFrameRate().
diff --git a/third_party/blink/renderer/modules/mediastream/media_track_constraint_set.idl b/third_party/blink/renderer/modules/mediastream/media_track_constraint_set.idl index 84de1cb..a603973 100644 --- a/third_party/blink/renderer/modules/mediastream/media_track_constraint_set.idl +++ b/third_party/blink/renderer/modules/mediastream/media_track_constraint_set.idl
@@ -26,11 +26,6 @@ ConstrainLong channelCount; ConstrainDOMString deviceId; ConstrainDOMString groupId; - // Media Capture Depth Stream Extensions - // https://w3c.github.io/mediacapture-depth/#mediatrackconstraints - // TODO(riju): videoKind attribute should be declared as partial - // dictionary but IDL parser can't support it yet. http://crbug.com/579896. - [RuntimeEnabled=MediaCaptureDepthVideoKind] ConstrainDOMString videoKind; // W3C Image Capture API // https://w3c.github.io/mediacapture-image/#mediatrackconstraintset-section // TODO(mcasas) move out when partial dictionaries are supported
diff --git a/third_party/blink/renderer/modules/mediastream/media_track_settings.idl b/third_party/blink/renderer/modules/mediastream/media_track_settings.idl index eb71681..e6f9141c 100644 --- a/third_party/blink/renderer/modules/mediastream/media_track_settings.idl +++ b/third_party/blink/renderer/modules/mediastream/media_track_settings.idl
@@ -20,11 +20,6 @@ long channelCount; DOMString deviceId; DOMString groupId; - // Media Capture Depth Stream Extensions - // https://w3c.github.io/mediacapture-depth/#mediatracksettings-dictionary - // TODO(riju): videoKind attribute should be declared as partial - // dictionary but IDL parser can't support it yet. http://crbug.com/579896. - [RuntimeEnabled=MediaCaptureDepthVideoKind] DOMString videoKind; // W3C Image Capture API // https://w3c.github.io/mediacapture-image/#mediatracksettings-section
diff --git a/third_party/blink/renderer/modules/mediastream/media_track_supported_constraints.idl b/third_party/blink/renderer/modules/mediastream/media_track_supported_constraints.idl index c620762..c9ca5f9 100644 --- a/third_party/blink/renderer/modules/mediastream/media_track_supported_constraints.idl +++ b/third_party/blink/renderer/modules/mediastream/media_track_supported_constraints.idl
@@ -24,12 +24,6 @@ boolean deviceId = true; boolean groupId = true; - // Media Capture Depth Stream Extensions - // https://w3c.github.io/mediacapture-depth - // TODO(riju): videoKind attribute should be declared as partial - // dictionary but IDL parser can't support it yet. http://crbug.com/579896. - [RuntimeEnabled=MediaCaptureDepthVideoKind] boolean videoKind = true; - // W3C Image Capture API // https://w3c.github.io/mediacapture-image/#mediatracksupportedconstraints-section // TODO(mcasas) move out when partial dictionaries are supported
diff --git a/third_party/blink/renderer/modules/mediastream/user_media_request.cc b/third_party/blink/renderer/modules/mediastream/user_media_request.cc index 33fe5b7..dd69b06 100644 --- a/third_party/blink/renderer/modules/mediastream/user_media_request.cc +++ b/third_party/blink/renderer/modules/mediastream/user_media_request.cc
@@ -263,10 +263,6 @@ counter.Count(WebFeature::kMediaStreamConstraintsGroupIdVideo); } if (RequestUsesDiscreteConstraint( - constraints, &MediaTrackConstraintSetPlatform::video_kind)) { - counter.Count(WebFeature::kMediaStreamConstraintsVideoKind); - } - if (RequestUsesDiscreteConstraint( constraints, &MediaTrackConstraintSetPlatform::media_stream_source)) { counter.Count(WebFeature::kMediaStreamConstraintsMediaStreamSourceVideo); }
diff --git a/third_party/blink/renderer/platform/mediastream/media_constraints.cc b/third_party/blink/renderer/platform/mediastream/media_constraints.cc index e9642a5..549bbf0 100644 --- a/third_party/blink/renderer/platform/mediastream/media_constraints.cc +++ b/third_party/blink/renderer/platform/mediastream/media_constraints.cc
@@ -354,7 +354,6 @@ tilt("tilt"), zoom("zoom"), group_id("groupId"), - video_kind("videoKind"), media_stream_source("mediaStreamSource"), render_to_associated_sink("chromeRenderToAssociatedSink"), goog_echo_cancellation("googEchoCancellation"), @@ -403,7 +402,6 @@ &channel_count, &device_id, &group_id, - &video_kind, &media_stream_source, &disable_local_echo, &pan,
diff --git a/third_party/blink/renderer/platform/mediastream/media_constraints.h b/third_party/blink/renderer/platform/mediastream/media_constraints.h index 34f3d0f8..acdb8ad8 100644 --- a/third_party/blink/renderer/platform/mediastream/media_constraints.h +++ b/third_party/blink/renderer/platform/mediastream/media_constraints.h
@@ -248,8 +248,6 @@ DoubleConstraint tilt; DoubleConstraint zoom; StringConstraint group_id; - // https://w3c.github.io/mediacapture-depth/#mediatrackconstraints - StringConstraint video_kind; // Constraints not exposed in Blink at the moment, only through // the legacy name interface. StringConstraint media_stream_source; // tab, screen, desktop, system
diff --git a/third_party/blink/renderer/platform/mediastream/media_stream_track_platform.h b/third_party/blink/renderer/platform/mediastream/media_stream_track_platform.h index e849fed1..3aace98 100644 --- a/third_party/blink/renderer/platform/mediastream/media_stream_track_platform.h +++ b/third_party/blink/renderer/platform/mediastream/media_stream_track_platform.h
@@ -29,7 +29,6 @@ bool HasSampleSize() const { return sample_size >= 0; } bool HasChannelCount() const { return channel_count >= 0; } bool HasLatency() const { return latency >= 0; } - bool HasVideoKind() const { return !video_kind.IsNull(); } // The variables are read from // MediaStreamTrack::GetSettings only. double frame_rate = -1.0; @@ -49,9 +48,6 @@ int32_t channel_count = -1; double latency = -1.0; - // Media Capture Depth Stream Extensions. - String video_kind; - // Screen Capture extensions absl::optional<media::mojom::DisplayCaptureSurfaceType> display_surface; absl::optional<bool> logical_surface;
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index afa4b1c..9665fccc 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1416,10 +1416,6 @@ name: "MediaCapture", status: {"Android": "stable"}, }, - { - name: "MediaCaptureDepthVideoKind", - status: "experimental", - }, // Set to reflect the MediaCastOverlayButton feature. { name: "MediaCastOverlayButton",
diff --git a/third_party/blink/renderer/platform/wtf/threading_primitives.h b/third_party/blink/renderer/platform/wtf/threading_primitives.h index 0b9152d..2fc5616 100644 --- a/third_party/blink/renderer/platform/wtf/threading_primitives.h +++ b/third_party/blink/renderer/platform/wtf/threading_primitives.h
@@ -32,6 +32,8 @@ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_WTF_THREADING_PRIMITIVES_H_ #include "base/dcheck_is_on.h" +#include "base/synchronization/condition_variable.h" +#include "base/synchronization/lock.h" #include "base/thread_annotations.h" #include "build/build_config.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" @@ -56,10 +58,6 @@ ULONG_PTR align; // Make sure the alignment requirements match. }; -struct BLINK_CONDITION_VARIABLE { - PVOID Ptr; -}; - #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) #include <pthread.h> #endif @@ -75,7 +73,6 @@ BLINK_CRITICAL_SECTION internal_mutex_; size_t recursion_count_; }; -typedef BLINK_CONDITION_VARIABLE PlatformCondition; #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) struct PlatformMutex { pthread_mutex_t internal_mutex_; @@ -83,7 +80,6 @@ size_t recursion_count_; #endif }; -typedef pthread_cond_t PlatformCondition; #endif class WTF_EXPORT MutexBase { @@ -111,18 +107,25 @@ PlatformMutex mutex_; }; -class LOCKABLE WTF_EXPORT Mutex : public MutexBase { +class ThreadCondition; + +class LOCKABLE WTF_EXPORT Mutex { public: - Mutex() : MutexBase(false) {} - bool TryLock() EXCLUSIVE_TRYLOCK_FUNCTION(true); + Mutex() = default; + bool TryLock() EXCLUSIVE_TRYLOCK_FUNCTION(true) { return lock_.Try(); } // Overridden solely for the purpose of annotating them. // The compiler is expected to optimize the calls away. - void lock() EXCLUSIVE_LOCK_FUNCTION() { MutexBase::lock(); } - void unlock() UNLOCK_FUNCTION() { MutexBase::unlock(); } + void lock() EXCLUSIVE_LOCK_FUNCTION() { lock_.Acquire(); } + void unlock() UNLOCK_FUNCTION() { lock_.Release(); } void AssertAcquired() const ASSERT_EXCLUSIVE_LOCK() { - MutexBase::AssertAcquired(); + lock_.AssertAcquired(); } + + private: + base::Lock lock_; + + friend class ThreadCondition; }; // RecursiveMutex is deprecated AND WILL BE REMOVED. @@ -178,18 +181,17 @@ USING_FAST_MALLOC(ThreadCondition); // Only HeapTest.cpp requires. public: - explicit ThreadCondition(Mutex&); + explicit ThreadCondition(Mutex& mutex) : cv_(&mutex.lock_) {} ThreadCondition(const ThreadCondition&) = delete; ThreadCondition& operator=(const ThreadCondition&) = delete; - ~ThreadCondition(); + ~ThreadCondition() = default; - void Wait(); - void Signal(); - void Broadcast(); + void Wait() { cv_.Wait(); } + void Signal() { cv_.Signal(); } + void Broadcast() { cv_.Broadcast(); } private: - PlatformCondition condition_; - PlatformMutex& mutex_; + base::ConditionVariable cv_; }; } // namespace WTF
diff --git a/third_party/blink/renderer/platform/wtf/threading_pthreads.cc b/third_party/blink/renderer/platform/wtf/threading_pthreads.cc index 27edd5f7..fe350f7 100644 --- a/third_party/blink/renderer/platform/wtf/threading_pthreads.cc +++ b/third_party/blink/renderer/platform/wtf/threading_pthreads.cc
@@ -99,30 +99,6 @@ DCHECK_EQ(result, 0); } -// There is a separate tryLock implementation for the Mutex and the -// RecursiveMutex since on Windows we need to manually check if tryLock should -// succeed or not for the non-recursive mutex. On Linux the two implementations -// are equal except we can assert the recursion count is always zero for the -// non-recursive mutex. -bool Mutex::TryLock() { - int result = pthread_mutex_trylock(&mutex_.internal_mutex_); - if (result == 0) { -#if DCHECK_IS_ON() - // The Mutex class is not recursive, so the recursionCount should be - // zero after getting the lock. - DCHECK(!mutex_.recursion_count_) - << "WTF does not support recursive mutex acquisition!"; - ++mutex_.recursion_count_; -#endif - return true; - } - if (result == EBUSY) - return false; - - NOTREACHED(); - return false; -} - bool RecursiveMutex::TryLock() { int result = pthread_mutex_trylock(&mutex_.internal_mutex_); if (result == 0) { @@ -140,37 +116,6 @@ return false; } -ThreadCondition::ThreadCondition(Mutex& mutex) : mutex_(mutex.Impl()) { - pthread_cond_init(&condition_, nullptr); -} - -ThreadCondition::~ThreadCondition() { - pthread_cond_destroy(&condition_); -} - -void ThreadCondition::Wait() { - base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, - base::BlockingType::MAY_BLOCK); -#if DCHECK_IS_ON() - --mutex_.recursion_count_; -#endif - int result = pthread_cond_wait(&condition_, &mutex_.internal_mutex_); - DCHECK_EQ(result, 0); -#if DCHECK_IS_ON() - ++mutex_.recursion_count_; -#endif -} - -void ThreadCondition::Signal() { - int result = pthread_cond_signal(&condition_); - DCHECK_EQ(result, 0); -} - -void ThreadCondition::Broadcast() { - int result = pthread_cond_broadcast(&condition_); - DCHECK_EQ(result, 0); -} - } // namespace WTF #endif // BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
diff --git a/third_party/blink/renderer/platform/wtf/threading_win.cc b/third_party/blink/renderer/platform/wtf/threading_win.cc index 98ffae0..ab0b224 100644 --- a/third_party/blink/renderer/platform/wtf/threading_win.cc +++ b/third_party/blink/renderer/platform/wtf/threading_win.cc
@@ -113,16 +113,11 @@ namespace { static_assert(sizeof(BLINK_CRITICAL_SECTION) == sizeof(CRITICAL_SECTION), "Definition mismatch."); -static_assert(sizeof(BLINK_CONDITION_VARIABLE) == sizeof(CONDITION_VARIABLE), - "Definition mismatch."); CRITICAL_SECTION* GetCriticalSection(PlatformMutex* mutex) { return reinterpret_cast<CRITICAL_SECTION*>(&mutex->internal_mutex_); } -CONDITION_VARIABLE* ToConditionVariable(BLINK_CONDITION_VARIABLE* condition) { - return reinterpret_cast<CONDITION_VARIABLE*>(condition); -} } // namespace MutexBase::MutexBase(bool recursive) { @@ -147,35 +142,6 @@ LeaveCriticalSection(GetCriticalSection(&mutex_)); } -bool Mutex::TryLock() { - // This method is modeled after the behavior of pthread_mutex_trylock, - // which will return an error if the lock is already owned by the - // current thread. Since the primitive Win32 'TryEnterCriticalSection' - // treats this as a successful case, it changes the behavior of several - // tests in WebKit that check to see if the current thread already - // owned this mutex (see e.g., IconDatabase::getOrCreateIconRecord) - DWORD result = TryEnterCriticalSection(GetCriticalSection(&mutex_)); - - if (result != 0) { // We got the lock - // If this thread already had the lock, we must unlock and return - // false since this is a non-recursive mutex. This is to mimic the - // behavior of POSIX's pthread_mutex_trylock. We don't do this - // check in the lock method (presumably due to performance?). This - // means lock() will succeed even if the current thread has already - // entered the critical section. - DCHECK(!mutex_.recursion_count_) - << "WTF does not support recursive mutex acquisition!"; - if (mutex_.recursion_count_ > 0) { - LeaveCriticalSection(GetCriticalSection(&mutex_)); - return false; - } - ++mutex_.recursion_count_; - return true; - } - - return false; -} - bool RecursiveMutex::TryLock() { // CRITICAL_SECTION is recursive/reentrant so TryEnterCriticalSection will // succeed if the current thread is already in the critical section. @@ -189,29 +155,6 @@ return true; } -ThreadCondition::ThreadCondition(Mutex& mutex) - : condition_(CONDITION_VARIABLE_INIT), mutex_(mutex.Impl()) {} - -ThreadCondition::~ThreadCondition() {} - -void ThreadCondition::Wait() { - base::ScopedBlockingCall scoped_blocking_call(FROM_HERE, - base::BlockingType::MAY_BLOCK); - --mutex_.recursion_count_; - BOOL result = SleepConditionVariableCS(ToConditionVariable(&condition_), - GetCriticalSection(&mutex_), INFINITE); - DCHECK_NE(result, 0); - ++mutex_.recursion_count_; -} - -void ThreadCondition::Signal() { - WakeConditionVariable(ToConditionVariable(&condition_)); -} - -void ThreadCondition::Broadcast() { - WakeAllConditionVariable(ToConditionVariable(&condition_)); -} - } // namespace WTF #endif // BUILDFLAG(IS_WIN)
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-depth/dictionary-manual.https-expected.txt b/third_party/blink/web_tests/external/wpt/mediacapture-depth/dictionary-manual.https-expected.txt index 2b6107c..f99d27a7 100644 --- a/third_party/blink/web_tests/external/wpt/mediacapture-depth/dictionary-manual.https-expected.txt +++ b/third_party/blink/web_tests/external/wpt/mediacapture-depth/dictionary-manual.https-expected.txt
@@ -1,10 +1,10 @@ This is a testharness.js-based test. -PASS MediaTrackSupportedConstraints dictionary include attributes are correct +FAIL MediaTrackSupportedConstraints dictionary include attributes are correct assert_equals: Expect dictionary.videoKind to be boolean expected "boolean" but got "undefined" FAIL MediaTrackCapabilities dictionary of depth include attributes are correct assert_equals: Expect dictionary.videoKind to be string expected "string" but got "undefined" -PASS MediaTrackConstraintSet dictionary of depth include attributes are correct -PASS MediaTrackSettings dictionary of depth include attributes are correct +FAIL MediaTrackConstraintSet dictionary of depth include attributes are correct promise_test: Unhandled rejection with value: object "TypeError: Cannot read properties of undefined (reading '0')" +FAIL MediaTrackSettings dictionary of depth include attributes are correct assert_equals: Expect dictionary.videoKind to be string expected "string" but got "undefined" FAIL MediaTrackCapabilities dictionary of color include attributes are correct assert_equals: Expect dictionary.videoKind to be string expected "string" but got "undefined" -PASS MediaTrackConstraintSet dictionary of color include attributes are correct -PASS MediaTrackSettings dictionary of color include attributes are correct +FAIL MediaTrackConstraintSet dictionary of color include attributes are correct promise_test: Unhandled rejection with value: object "TypeError: Cannot read properties of undefined (reading '0')" +FAIL MediaTrackSettings dictionary of color include attributes are correct assert_equals: Expect dictionary.videoKind to be string expected "string" but got "undefined" Harness: the test ran to completion.
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-in-service-worker.https.html b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-in-service-worker.https.html new file mode 100644 index 0000000..389a30d0 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-in-service-worker.https.html
@@ -0,0 +1,24 @@ +<!doctype html> +<title>Test initialize MediaStreamTrackGenerator in a service worker</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src='/service-workers/service-worker/resources/test-helpers.sub.js'></script> +<script> +'use strict'; + +promise_test(async t => { + const registration = await navigator.serviceWorker.register('service-worker.js'); + await wait_for_state(t, registration.installing, 'activated'); + const result = new Promise((resolve, reject) => { + navigator.serviceWorker.addEventListener('message', (e) => { + if (e.data.result === 'Failure') { + reject('Failed with error ' + e.data.error); + } else { + resolve(); + } + }); + }); + registration.active.postMessage('hello world'); + return result; +}, 'A service worker is able to initialize a MediaStreamTrackGenerator without crashing'); +</script> \ No newline at end of file
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/service-worker.js b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/service-worker.js new file mode 100644 index 0000000..05a8b99a --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/service-worker.js
@@ -0,0 +1,8 @@ +self.addEventListener('message', (event) => { + try { + const mstg = new MediaStreamTrackGenerator({ kind: 'video' }); + event.source.postMessage({ result: 'Success' }); + } catch (e) { + event.source.postMessage({ result: 'Failure', error: e }); + }; +}); \ No newline at end of file
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/no-crash-with-stack-id-and-stale-while-revalidate-expected.txt b/third_party/blink/web_tests/http/tests/inspector-protocol/no-crash-with-stack-id-and-stale-while-revalidate-expected.txt new file mode 100644 index 0000000..3780745 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/no-crash-with-stack-id-and-stale-while-revalidate-expected.txt
@@ -0,0 +1,4 @@ +Tests that checks for no crashes when stale-while-revalidate is on +Request Will be Sent for stale-script.php +Request Will be Sent for stale-script.php +
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/no-crash-with-stack-id-and-stale-while-revalidate.js b/third_party/blink/web_tests/http/tests/inspector-protocol/no-crash-with-stack-id-and-stale-while-revalidate.js new file mode 100644 index 0000000..c031c78 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/no-crash-with-stack-id-and-stale-while-revalidate.js
@@ -0,0 +1,30 @@ +(async function(testRunner) { + + const {page, session, dp} = await testRunner.startURL( + 'resources/stale-while-revalidate.html', + `Tests that checks for no crashes when stale-while-revalidate is on`); + + dp.Debugger.enable(); + dp.Debugger.setAsyncCallStackDepth({maxDepth: 32}); + dp.Network.enable(); + dp.Network.setAttachDebugStack({enabled: true}); + await dp.Page.reload({ignoreCache: false}); + dp.Network.onRequestWillBeSent(request => { + const url = request.params.request.url; + if (/stale-script\.php$/.test(url)) { + testRunner.log('Request Will be Sent for ' + url.substr(url.lastIndexOf('stale-script.php'))); + } + }); + + let numResponses = 0; + + dp.Network.onResponseReceived(request => { + const url = request.params.response.url; + if (/stale-script\.php$/.test(url)) { + ++numResponses; + if (numResponses == 2) { + testRunner.completeTest(); + } + } + }); +})
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/resources/stale-script.php b/third_party/blink/web_tests/http/tests/inspector-protocol/resources/stale-script.php new file mode 100644 index 0000000..ada34e7 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/resources/stale-script.php
@@ -0,0 +1,8 @@ +<?php +$last_modified = gmdate(DATE_RFC1123, time() - 1); + +header('Cache-Control: private, max-age=0, stale-while-revalidate=10'); +header('Last-Modified: ' . $last_modified); +header('Content-Type: application/javascript'); +echo('report("' . uniqid() . '");'); +?>
diff --git a/third_party/blink/web_tests/http/tests/inspector-protocol/resources/stale-while-revalidate.html b/third_party/blink/web_tests/http/tests/inspector-protocol/resources/stale-while-revalidate.html new file mode 100644 index 0000000..2196c48 --- /dev/null +++ b/third_party/blink/web_tests/http/tests/inspector-protocol/resources/stale-while-revalidate.html
@@ -0,0 +1,11 @@ +<body> +<script> +function loadScript() { + const script = document.createElement("script"); + script.src = "stale-script.php"; + document.body.appendChild(script); +} +loadScript(); +setTimeout(loadScript, 10); +</script> +</body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-no-coep.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-no-coep.https.html index 75980a1..1aa623d 100644 --- a/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-no-coep.https.html +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-no-coep.https.html
@@ -2,6 +2,7 @@ <title>Test COEP properties set for a Fenced Frame Tree</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<script src="/common/get-host-info.sub.js"></script> <script src="/common/utils.js"></script> <script src="resources/utils.js"></script> <script src="resources/embedder-policy.js"></script>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-require-corp.https.html b/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-require-corp.https.html index 029fcc82..fbf20d43 100644 --- a/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-require-corp.https.html +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-require-corp.https.html
@@ -2,6 +2,7 @@ <title>Test COEP properties set for a Fenced Frame Tree</title> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> +<script src="/common/get-host-info.sub.js"></script> <script src="/common/utils.js"></script> <script src="resources/utils.js"></script> <script src="resources/embedder-policy.js"></script> @@ -22,5 +23,13 @@ const result = await nextValueFromServer(uuid); assert_unreached("embedded page should not be loaded."); }, "Create fencedframe without COEP header"); + +promise_test(async (t) => { + const uuid = token(); + t.step_timeout(() => t.done(), 3000); + const frame = setupTest("cross:coep:require-corp", uuid); + const result = await nextValueFromServer(uuid); + assert_unreached("violating CORP, embedded page should not be loaded."); +}, "Create fencedframe with a cross site COEP:require-corp and CORP:same-orign"); </script> </body>
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-require-corp.https.html.headers b/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-require-corp.https.html.headers index 8df9847..7b5e364d 100644 --- a/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-require-corp.https.html.headers +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/embedder-require-corp.https.html.headers
@@ -1 +1,2 @@ cross-origin-embedder-policy: require-corp +cross-origin-resource-policy: same-origin
diff --git a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/embedder-policy.js b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/embedder-policy.js index 9929b522..895ac1a3 100644 --- a/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/embedder-policy.js +++ b/third_party/blink/web_tests/wpt_internal/fenced_frame/resources/embedder-policy.js
@@ -1,4 +1,6 @@ -// This file should be loaded alongside with utils.js. +// This file should be loaded alongside with utils.js and +// /common/get-host-info.sub.js. +// // This file is loaded by: // - embedder-no-coep.https.html // - embedder-require-corp.https.html @@ -17,17 +19,27 @@ // Setup a fenced frame for embedder-* WPTs. async function setupTest(test_type, uuid) { let headers = ["Supports-Loading-Mode,fenced-frame"]; + let hostname = '' switch (test_type) { case "coep:require-corp": headers.push("cross-origin-embedder-policy,require-corp"); break; case "no coep": break; + case "cross:coep:require-corp": + // Make sure a different site is used. + hostname = get_host_info().REMOTE_HOST; + headers.push("cross-origin-embedder-policy,require-corp"); + break; default: assert_unreachable("unknown test_type:" + test_type); break; } - const header_pipe = generateHeader(headers); - const url = generateURL('resources/embeddee.html?pipe=' + header_pipe, [uuid]); + const tmp_url = new URL('resources/embeddee.html', location.href); + if (hostname) { + tmp_url.hostname = hostname; + } + tmp_url.searchParams.append("pipe", generateHeader(headers)); + const url = generateURL(tmp_url.toString(), [uuid]); return attachFencedFrame(url); }
diff --git a/third_party/closure_compiler/externs/passwords_private.js b/third_party/closure_compiler/externs/passwords_private.js index 8d7e3da..49ccabc2 100644 --- a/third_party/closure_compiler/externs/passwords_private.js +++ b/third_party/closure_compiler/externs/passwords_private.js
@@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2022 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -100,7 +100,8 @@ * @typedef {{ * compromiseTime: number, * elapsedTimeSinceCompromise: string, - * compromiseType: !chrome.passwordsPrivate.CompromiseType + * compromiseType: !chrome.passwordsPrivate.CompromiseType, + * isMuted: boolean * }} */ chrome.passwordsPrivate.CompromisedInfo; @@ -321,6 +322,15 @@ chrome.passwordsPrivate.removeInsecureCredential = function(credential, callback) {}; /** + * Requests to mute |credential| from the password store. Invokes |callback| on + * completion. + * @param {!chrome.passwordsPrivate.InsecureCredential} credential + * @param {function(): void=} callback + */ +chrome.passwordsPrivate.muteInsecureCredential = function( + credential, callback) {}; + +/** * Starts a check for insecure passwords. Invokes |callback| on completion. * @param {function(): void=} callback */
diff --git a/tools/clang/plugins/FindBadConstructsAction.cpp b/tools/clang/plugins/FindBadConstructsAction.cpp index d908f66b..f1618de 100644 --- a/tools/clang/plugins/FindBadConstructsAction.cpp +++ b/tools/clang/plugins/FindBadConstructsAction.cpp
@@ -58,7 +58,7 @@ } else if (args[i] == "raw-ptr-template-as-trivial-member") { options_.raw_ptr_template_as_trivial_member = true; } else if (args[i] == "use-classify-type") { - options_.use_classify_type = true; + // This option is ignored, will be removed soon. } else { parsed = false; llvm::errs() << "Unknown clang plugin argument: " << args[i] << "\n";
diff --git a/tools/clang/plugins/FindBadConstructsConsumer.cpp b/tools/clang/plugins/FindBadConstructsConsumer.cpp index d0f28a4..0dadc5eb 100644 --- a/tools/clang/plugins/FindBadConstructsConsumer.cpp +++ b/tools/clang/plugins/FindBadConstructsConsumer.cpp
@@ -384,27 +384,22 @@ for (RecordDecl::field_iterator it = record->field_begin(); it != record->field_end(); ++it) { - if (options_.use_classify_type) { - switch (ClassifyType(it->getType().getTypePtr())) { - case TypeClassification::kTrivial: - trivial_member += 1; - break; - case TypeClassification::kNonTrivial: - non_trivial_member += 1; - break; - case TypeClassification::kTrivialTemplate: - trivial_member += 1; - break; - case TypeClassification::kNonTrivialTemplate: - templated_non_trivial_member += 1; - break; - case TypeClassification::kNonTrivialExternTemplate: - non_trivial_member += 1; - break; - } - } else { - CountType(it->getType().getTypePtr(), &trivial_member, - &non_trivial_member, &templated_non_trivial_member); + switch (ClassifyType(it->getType().getTypePtr())) { + case TypeClassification::kTrivial: + trivial_member += 1; + break; + case TypeClassification::kNonTrivial: + non_trivial_member += 1; + break; + case TypeClassification::kTrivialTemplate: + trivial_member += 1; + break; + case TypeClassification::kNonTrivialTemplate: + templated_non_trivial_member += 1; + break; + case TypeClassification::kNonTrivialExternTemplate: + non_trivial_member += 1; + break; } } @@ -815,87 +810,6 @@ } } -void FindBadConstructsConsumer::CountType(const Type* type, - int* trivial_member, - int* non_trivial_member, - int* templated_non_trivial_member) { - switch (type->getTypeClass()) { - case Type::Record: { - auto* record_decl = type->getAsCXXRecordDecl(); - // Simplifying; the whole class isn't trivial if the dtor is, but - // we use this as a signal about complexity. - // Note that if a record doesn't have a definition, it doesn't matter how - // it's counted, since the translation unit will fail to build. In that - // case, just count it as a trivial member to avoid emitting warnings that - // might be spurious. - if (!record_decl->hasDefinition() || record_decl->hasTrivialDestructor()) - (*trivial_member)++; - else - (*non_trivial_member)++; - break; - } - case Type::TemplateSpecialization: { - TemplateName name = - dyn_cast<TemplateSpecializationType>(type)->getTemplateName(); - - // HACK: I'm at a loss about how to get the syntax checker to get - // whether a template is externed or not. For the first pass here, - // just do simple string comparisons. - if (TemplateDecl* decl = name.getAsTemplateDecl()) { - std::string base_name = decl->getQualifiedNameAsString(); - if (base_name == "std::basic_string") { - (*non_trivial_member)++; - break; - } - if (options_.checked_ptr_as_trivial_member && - base_name == "base::CheckedPtr") { - (*trivial_member)++; - break; - } - if (options_.raw_ptr_template_as_trivial_member && - base_name == "base::raw_ptr") { - (*trivial_member)++; - break; - } - } - - (*templated_non_trivial_member)++; - break; - } - case Type::Elaborated: { - CountType(dyn_cast<ElaboratedType>(type)->getNamedType().getTypePtr(), - trivial_member, - non_trivial_member, - templated_non_trivial_member); - break; - } - case Type::Typedef: { - while (const TypedefType* TT = dyn_cast<TypedefType>(type)) { - if (auto* decl = TT->getDecl()) { - const std::string name = decl->getNameAsString(); - auto* context = decl->getDeclContext(); - if (name == "atomic_int" && context->isStdNamespace()) { - (*trivial_member)++; - return; - } - type = decl->getUnderlyingType().getTypePtr(); - } - } - CountType(type, - trivial_member, - non_trivial_member, - templated_non_trivial_member); - break; - } - default: { - // Stupid assumption: anything we see that isn't the above is a POD - // or reference type. - (*trivial_member)++; - break; - } - } -} - // Check |record| for issues that are problematic for ref-counted types. // Note that |record| may not be a ref-counted type, but a base class for // a type that is.
diff --git a/tools/clang/plugins/FindBadConstructsConsumer.h b/tools/clang/plugins/FindBadConstructsConsumer.h index 72bb46b..41adcd4 100644 --- a/tools/clang/plugins/FindBadConstructsConsumer.h +++ b/tools/clang/plugins/FindBadConstructsConsumer.h
@@ -93,11 +93,6 @@ }; TypeClassification ClassifyType(const clang::Type* type); - void CountType(const clang::Type* type, - int* trivial_member, - int* non_trivial_member, - int* templated_non_trivial_member); - static RefcountIssue CheckRecordForRefcountIssue( const clang::CXXRecordDecl* record, clang::SourceLocation& loc);
diff --git a/tools/clang/plugins/Options.h b/tools/clang/plugins/Options.h index 693e877..e3e29e1 100644 --- a/tools/clang/plugins/Options.h +++ b/tools/clang/plugins/Options.h
@@ -14,7 +14,6 @@ bool check_layout_object_methods = false; bool checked_ptr_as_trivial_member = false; bool raw_ptr_template_as_trivial_member = false; - bool use_classify_type = false; }; } // namespace chrome_checker
diff --git a/tools/clang/plugins/tests/atomic_member.flags b/tools/clang/plugins/tests/atomic_member.flags deleted file mode 100644 index 5b0499f..0000000 --- a/tools/clang/plugins/tests/atomic_member.flags +++ /dev/null
@@ -1 +0,0 @@ --Xclang -plugin-arg-find-bad-constructs -Xclang use-classify-type
diff --git a/tools/clang/plugins/tests/missing_ctor.flags b/tools/clang/plugins/tests/missing_ctor.flags index bd23382f..8861a151d 100644 --- a/tools/clang/plugins/tests/missing_ctor.flags +++ b/tools/clang/plugins/tests/missing_ctor.flags
@@ -1 +1 @@ --Xclang -plugin-arg-find-bad-constructs -Xclang checked-ptr-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-template-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang use-classify-type +-Xclang -plugin-arg-find-bad-constructs -Xclang checked-ptr-as-trivial-member -Xclang -plugin-arg-find-bad-constructs -Xclang raw-ptr-template-as-trivial-member
diff --git a/tools/clang/scripts/build.py b/tools/clang/scripts/build.py index 14735df..2bf0a29 100755 --- a/tools/clang/scripts/build.py +++ b/tools/clang/scripts/build.py
@@ -1276,11 +1276,13 @@ [COMPILER_RT_DIR]) profile_a = 'libclang_rt.profile.a' asan_preinit_a = 'libclang_rt.asan-preinit.a' + asan_static_a = 'libclang_rt.asan_static.a' asan_so = 'libclang_rt.asan.so' ninja_command = ['ninja', profile_a] if sys.platform != 'darwin': ninja_command.append(asan_so) ninja_command.append(asan_preinit_a) + ninja_command.append(asan_static_a) RunCommand(ninja_command) CopyFile(os.path.join(build_phase2_dir, 'lib', target_spec, profile_a), fuchsia_lib_dst_dir) @@ -1290,6 +1292,9 @@ CopyFile( os.path.join(build_phase2_dir, 'lib', target_spec, asan_preinit_a), fuchsia_lib_dst_dir) + CopyFile( + os.path.join(build_phase2_dir, 'lib', target_spec, asan_static_a), + fuchsia_lib_dst_dir) # Run tests. if (not args.build_mac_arm and
diff --git a/tools/clang/scripts/package.py b/tools/clang/scripts/package.py index 7896ac07..8cc6358 100755 --- a/tools/clang/scripts/package.py +++ b/tools/clang/scripts/package.py
@@ -280,6 +280,8 @@ want.append('lib/clang/$V/lib/x86_64-unknown-fuchsia/libclang_rt.asan.so') want.append( 'lib/clang/$V/lib/x86_64-unknown-fuchsia/libclang_rt.asan-preinit.a') + want.append( + 'lib/clang/$V/lib/x86_64-unknown-fuchsia/libclang_rt.asan_static.a') if sys.platform == 'darwin': want.extend([ # AddressSanitizer runtime.
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 93bebfd9..6a6a077 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -36,7 +36,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-17086-g38e16e1c' -CLANG_SUB_REVISION = 2 +CLANG_SUB_REVISION = 3 PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION) RELEASE_VERSION = '14.0.0'
diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec index c7d1d9d..50a9e1b 100644 --- a/tools/gritsettings/resource_ids.spec +++ b/tools/gritsettings/resource_ids.spec
@@ -232,6 +232,10 @@ "META": {"sizes": {"includes": [500],}}, "includes": [1900], }, + "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/privacy_sandbox/resources.grd": { + "META": {"sizes": {"includes": [20],}}, + "includes": [1910], + }, "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/read_later/read_later_resources.grd": { "META": {"sizes": {"includes": [10],}}, "includes": [1920],
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 3a98576..19c986f9 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -22768,6 +22768,12 @@ <description>Settings: Manage power</description> </action> +<action name="Options_ShowPrivacySandbox"> + <owner>olesiamarukhno@google.com</owner> + <owner>dullweber@chromium.org</owner> + <description>Settings: Privacy sandbox</description> +</action> + <action name="Options_ShowProxySettings"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <description>Please enter the description of this user action.</description>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 7f5487f5..22a4d9d2 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -18429,6 +18429,16 @@ <int value="2" label="Navigation restarted"/> </enum> +<enum name="CropToResult"> + <int value="0" label="Resolved"/> + <int value="1" label="UnsupportedPlatform"/> + <int value="2" label="InvalidCropTargetFormat"/> + <int value="3" label="RejectedWithErrorGeneric"/> + <int value="4" label="RejectedWithUnsupportedCaptureDevice"/> + <int value="5" label="RejectedWithErrorUnknownDeviceId"/> + <int value="6" label="RejectedWithNotImplemented"/> +</enum> + <enum name="CrOSActionRecorderEvent"> <int value="0" label="Disabled"/> <int value="1" label="RecordAction"/> @@ -31395,6 +31405,7 @@ <int value="1618" label="DEVELOPERPRIVATE_REMOVEUSERSPECIFIEDSITE"/> <int value="1619" label="AUTOTESTPRIVATE_STARTARC"/> <int value="1620" label="AUTOTESTPRIVATE_STOPARC"/> + <int value="1621" label="PASSWORDSPRIVATE_MUTEINSECURECREDENTIAL"/> </enum> <enum name="ExtensionIconState"> @@ -34576,7 +34587,7 @@ <int value="1935" label="MediaStreamConstraintsDisableLocalEcho"/> <int value="1936" label="MediaStreamConstraintsGroupIdAudio"/> <int value="1937" label="MediaStreamConstraintsGroupIdVideo"/> - <int value="1938" label="MediaStreamConstraintsVideoKind"/> + <int value="1938" label="OBSOLETE_MediaStreamConstraintsVideoKind"/> <int value="1939" label="OBSOLETE_MediaStreamConstraintsDepthNear"/> <int value="1940" label="OBSOLETE_MediaStreamConstraintsDepthFar"/> <int value="1941" label="OBSOLETE_MediaStreamConstraintsFocalLengthX"/> @@ -36917,6 +36928,7 @@ <int value="4147" label="FrameNameContainsNewline"/> <int value="4148" label="AbortSignalThrowIfAborted"/> <int value="4149" label="ClientHintsUAFull"/> + <int value="4150" label="PrivateNetworkAccessWithinWorker"/> </enum> <enum name="FeaturePolicyAllowlistType"> @@ -86179,16 +86191,27 @@ </enum> <enum name="SyncStopSource"> - <int value="0" label="DEPRECATED 2018-06 Profile destruction"> - Supposedly meant that Sync was stopped due to the profile being destroyed. - However, it was recorded during most profile destructions, even if Sync was - never enabled in the first place. We stopped recording this in 2018-06. + <int value="0" label="(deprecated) Profile destruction"> + <obsolete> + Supposedly meant that Sync was stopped due to the profile being destroyed. + However, it was recorded during most profile destructions, even if Sync + was never enabled in the first place. We stopped recording this in + 2018-06. + </obsolete> </int> <int value="1" label="Sign out"/> <int value="2" label="Birthday error"/> <int value="3" label="Chrome sync settings"/> - <int value="4" label="Android Chrome sync setting"/> - <int value="5" label="Android master sync setting"/> + <int value="4" label="(deprecated) Android Chrome sync setting"> + <obsolete> + Removed on 01/2022. + </obsolete> + </int> + <int value="5" label="(deprecated) Android master sync setting"> + <obsolete> + Removed on 01/2022. + </obsolete> + </int> </enum> <enum name="SyncTypedUrlDatabaseError">
diff --git a/tools/metrics/histograms/metadata/media/histograms.xml b/tools/metrics/histograms/metadata/media/histograms.xml index a23db31..d846780 100644 --- a/tools/metrics/histograms/metadata/media/histograms.xml +++ b/tools/metrics/histograms/metadata/media/histograms.xml
@@ -1030,6 +1030,16 @@ </summary> </histogram> +<histogram name="Media.Audio.TabAudioMuted" enum="Boolean" + expires_after="2022-12-01"> + <owner>evliu@google.com</owner> + <owner>chrome-media-ux@google.com</owner> + <summary> + Logged when a user clicks on the audio indicator button in the tab strip. + Logs true if the click mutes the tab and false if the click unmutes the tab. + </summary> +</histogram> + <histogram name="Media.Audio.TrackAudioRenderer.DeviceStatus" enum="OutputDeviceStatus" expires_after="never"> <!-- expires-never: used for audio output devices monitoring. --> @@ -3539,6 +3549,16 @@ </summary> </histogram> +<histogram name="Media.RegionCapture.CropTo.Result" enum="CropToResult" + expires_after="2023-01-25"> + <owner>eladalon@chromium.org</owner> + <owner>jophba@chromium.org</owner> + <owner>mfoltz@chromium.org</owner> + <summary> + Tracks the result of calls to BrowserCaptureMediaStreamTrack.cropTo(). + </summary> +</histogram> + <histogram name="Media.RegionCapture.ProduceCropTarget.Function.Result" enum="ProduceCropTargetFunctionResult" expires_after="2023-01-25"> <owner>eladalon@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/password/histograms.xml b/tools/metrics/histograms/metadata/password/histograms.xml index 1f2bde24..77ef01e 100644 --- a/tools/metrics/histograms/metadata/password/histograms.xml +++ b/tools/metrics/histograms/metadata/password/histograms.xml
@@ -54,18 +54,6 @@ <variant name=".Other" summary="The scheme of the origin is something else."/> </variants> -<variants name="Store"> - <variant name="AccountStore." summary="for account-scoped store"/> - <variant name="ProfileStore." summary="for profile-scoped store"/> -</variants> - -<variants name="UserProfileLevel"> - <variant name="NonPrimaryUserProfile." - summary="the a profile that didn't create the current sessions."/> - <variant name="PrimaryUserProfile." - summary="the profile that created the current sessions."/> -</variants> - <histogram name="KeyboardAccessory.AccessoryActionImpression" enum="AccessoryAction" expires_after="2022-06-19"> <owner>fhorschig@chromium.org</owner> @@ -510,10 +498,6 @@ <histogram name="PasswordManager.AccountStoreVsProfileStore2.{DifferenceType}" units="accounts" expires_after="2022-05-31"> - <obsolete> - Removed in M100. Split into two different metrics for primary and - non-primary user profiles. - </obsolete> <owner>mamir@chromium.org</owner> <owner>treib@chromium.org</owner> <summary> @@ -1011,10 +995,6 @@ <histogram name="PasswordManager.CompromisedCredentials.{Issue}" units="credentials" expires_after="2022-06-12"> - <obsolete> - Removed in M100. Split into two different metrics for primary and - non-primary user profiles. - </obsolete> <owner>vasilii@chromium.org</owner> <owner>vsemeniuk@google.com</owner> <summary>Count of known {Issue}. Recorded on start-up.</summary> @@ -1122,10 +1102,6 @@ <histogram name="PasswordManager.CredentialsWithDuplicates" units="units" expires_after="2022-07-03"> - <obsolete> - Removed in M100. Split into two different metrics for primary and - non-primary user profiles. - </obsolete> <owner>kazinova@google.com</owner> <owner>vasilii@chromium.org</owner> <summary> @@ -1141,10 +1117,6 @@ <histogram name="PasswordManager.CredentialsWithMismatchedDuplicates" units="units" expires_after="2022-06-30"> - <obsolete> - Removed in M100. Split into two different metrics for primary and - non-primary user profiles. - </obsolete> <owner>kazinova@google.com</owner> <owner>vasilii@chromium.org</owner> <summary> @@ -2278,10 +2250,6 @@ <histogram name="PasswordManager.SyncingAccountState" enum="PasswordManagerSyncingAccountState" expires_after="2022-06-30"> - <obsolete> - Removed in M100. Split into two different metrics for primary and - non-primary user profiles. - </obsolete> <owner>kazinova@google.com</owner> <owner>vasilii@chromium.org</owner> <owner>chrome-password-manager-metrics-alerts@google.com</owner> @@ -2494,10 +2462,6 @@ <histogram name="PasswordManager.{Store}BlacklistedSitesHiRes{CustomPassphraseStatus}" units="sites" expires_after="2022-05-01"> - <obsolete> - Removed in M100. Split into two different metrics for primary and - non-primary user profiles. - </obsolete> <owner>kazinova@google.com</owner> <owner>mamir@chromium.org</owner> <owner>treib@chromium.org</owner> @@ -2554,10 +2518,6 @@ <histogram name="PasswordManager.{Store}TimesPasswordUsed.{PasswordType}{CustomPassphraseStatus}" units="PasswordUses" expires_after="2022-05-31"> - <obsolete> - Removed in M100. Split into two different metrics for primary and - non-primary user profiles. - </obsolete> <owner>kazinova@google.com</owner> <owner>battre@chromium.org</owner> <owner>mamir@chromium.org</owner> @@ -2579,10 +2539,6 @@ <histogram name="PasswordManager.{Store}TotalAccountsHiRes.WithScheme{Scheme}" units="accounts" expires_after="2022-05-31"> - <obsolete> - Removed in M100. Split into two different metrics for primary and - non-primary user profiles. - </obsolete> <owner>battre@chromium.org</owner> <owner>mamir@chromium.org</owner> <owner>treib@chromium.org</owner> @@ -2629,10 +2585,6 @@ <histogram name="PasswordManager.{Store}{Metric}.{PasswordType}{CustomPassphraseStatus}" units="units" expires_after="2022-04-24"> - <obsolete> - Removed in M100. Split into two different metrics for primary and - non-primary user profiles. - </obsolete> <owner>kazinova@google.com</owner> <owner>vasilii@chromium.org</owner> <owner>mamir@chromium.org</owner> @@ -2656,176 +2608,6 @@ <token key="CustomPassphraseStatus" variants="CustomPassphraseStatus"/> </histogram> -<histogram - name="PasswordManager.{UserProfileLevel}AccountStoreVsProfileStore2.{DifferenceType}" - units="accounts" expires_after="2022-05-31"> - <owner>mamir@chromium.org</owner> - <owner>treib@chromium.org</owner> - <summary> - The number of accounts {DifferenceType}. Recorded once per run of Chrome, - soon after startup, only for users who are opted in to the account-scoped - storage. Recorded for passwords in {UserProfileLevel}. - </summary> - <token key="UserProfileLevel" variants="UserProfileLevel"/> - <token key="DifferenceType"> - <variant name="Additional" - summary="stored in the password manager's account-scoped store that - don't exist in the profile-scoped store"/> - <variant name="Conflicting" - summary="stored in the password manager with a conflicting password - between the account-scoped store and profile-scoped store - (i.e. the signon realm and username match, but the password - does not)"/> - <variant name="Identical" - summary="stored in both the password manager's account-scoped store - and profile-scoped store"/> - <variant name="Missing" - summary="stored in the password manager's profile-scoped store that - don't exist in the account-scoped store"/> - </token> -</histogram> - -<histogram - name="PasswordManager.{UserProfileLevel}CompromisedCredentials.{Issue}" - units="credentials" expires_after="2022-06-12"> - <owner>vasilii@chromium.org</owner> - <owner>vsemeniuk@google.com</owner> - <summary> - Count of known {Issue}. Recorded on start-up in {UserProfileLevel}. - </summary> - <token key="UserProfileLevel" variants="UserProfileLevel"/> - <token key="Issue"> - <variant name="CountLeaked" summary="leaked credentials in the database"/> - <variant name="CountLeakedAfterBulkCheck" - summary="leaked credentials in the database if password bulk check - was executed at least once"/> - <variant name="CountPhished" summary="phished credentials in the database"/> - </token> -</histogram> - -<histogram name="PasswordManager.{UserProfileLevel}CredentialsWithDuplicates" - units="units" expires_after="2022-07-03"> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - The number of stored (non-blacklisted) credentials for which - "duplicates" exist. A duplicate is a credential with the same - signon realm, username, and password - i.e. indistinguishable from the - user's point of view. This records the number of *sets* of duplicated - credentials; the number of credentials in each set of duplicates is not - recorded. Recorded once per browser start-up. Recorded for the passwords - store in {UserProfileLevel}. - </summary> - <token key="UserProfileLevel" variants="UserProfileLevel"/> -</histogram> - -<histogram - name="PasswordManager.{UserProfileLevel}CredentialsWithMismatchedDuplicates" - units="units" expires_after="2022-06-30"> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - The number of stored (non-blacklisted) credentials for which - "mismatched duplicates" exist. A mismatched duplicate is a - credential with the same signon realm and username, but different password. - This records the number of *sets* of duplicated credentials; the number of - credentials in each set of duplicates is not recorded. Recorded once per - browser start-up. Recorded for the passwords store in {UserProfileLevel}. - </summary> - <token key="UserProfileLevel" variants="UserProfileLevel"/> -</histogram> - -<histogram name="PasswordManager.{UserProfileLevel}SyncingAccountState" - enum="PasswordManagerSyncingAccountState" expires_after="2022-06-30"> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <owner>chrome-password-manager-metrics-alerts@google.com</owner> - <summary> - Information about the user's current sync status crossed with whether their - synced password is saved. Record for {UserProfileLevel}. - </summary> - <token key="UserProfileLevel" variants="UserProfileLevel"/> -</histogram> - -<histogram - name="PasswordManager.{UserProfileLevel}{Store}BlacklistedSitesHiRes{CustomPassphraseStatus}" - units="sites" expires_after="2022-05-01"> - <owner>kazinova@google.com</owner> - <owner>mamir@chromium.org</owner> - <owner>treib@chromium.org</owner> - <owner>vasilii@chromium.org</owner> - <summary> - The total number of sites that the user has blocklisted in the password - manager's {Store}. Recorded by iterating over stored passwords once per run - of Chrome. Records the entries in {UserProfileLevel}. - </summary> - <token key="UserProfileLevel" variants="UserProfileLevel"/> - <token key="Store" variants="Store"/> - <token key="CustomPassphraseStatus" variants="CustomPassphraseStatus"/> -</histogram> - -<histogram - name="PasswordManager.{UserProfileLevel}{Store}TimesPasswordUsed.{PasswordType}{CustomPassphraseStatus}" - units="PasswordUses" expires_after="2022-05-31"> - <owner>kazinova@google.com</owner> - <owner>battre@chromium.org</owner> - <owner>mamir@chromium.org</owner> - <owner>treib@chromium.org</owner> - <summary> - The number of times each saved password from the {Store} has been used to - log in. Split by whether created by the user or generated by Chrome, and - further by whether the user used sync with custom passphrase or not. Records - the counts in {UserProfileLevel}. Recorded by iterating over stored - passwords once per browser run, soon after startup. - </summary> - <token key="UserProfileLevel" variants="UserProfileLevel"/> - <token key="Store" variants="Store"/> - <token key="PasswordType" variants="PasswordType"/> - <token key="CustomPassphraseStatus" variants="CustomPassphraseStatus"/> -</histogram> - -<histogram - name="PasswordManager.{UserProfileLevel}{Store}TotalAccountsHiRes.WithScheme{Scheme}" - units="accounts" expires_after="2022-05-31"> - <owner>battre@chromium.org</owner> - <owner>mamir@chromium.org</owner> - <owner>treib@chromium.org</owner> - <owner>vasilii@chromium.org</owner> - <summary> - The number of accounts stored in the password manager's {Store} (across all - sites) for origins with the scheme (e.g., HTTP, HTTPS, FTP) as given in the - histogram suffix. For each scheme, the count is recorded once per browser - start-up. Records the accounts stored in {UserProfileLevel}. - </summary> - <token key="UserProfileLevel" variants="UserProfileLevel"/> - <token key="Store" variants="Store"/> - <token key="Scheme" variants="Scheme"/> -</histogram> - -<histogram - name="PasswordManager.{UserProfileLevel}{Store}{Metric}.{PasswordType}{CustomPassphraseStatus}" - units="units" expires_after="2022-04-24"> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <owner>mamir@chromium.org</owner> - <owner>treib@chromium.org</owner> - <owner>battre@chromium.org</owner> - <summary> - The number of accounts stored {Metric} in the password manager's {Store}. , - split by whether created by the user or generated by Chrome, and further by - whether the user use sync with custom passphrase or not. Recorded during - browser start-up. Records the accounts stored in {UserProfileLevel}. - </summary> - <token key="UserProfileLevel" variants="UserProfileLevel"/> - <token key="Store" variants="Store"/> - <token key="Metric"> - <variant name="AccountsPerSiteHiRes" summary="per site"/> - <variant name="TotalAccountsHiRes.ByType" summary="across all sites"/> - </token> - <token key="PasswordType" variants="PasswordType"/> - <token key="CustomPassphraseStatus" variants="CustomPassphraseStatus"/> -</histogram> - <histogram name="PasswordProtection.DomFeatureExtractionDuration" units="ms" expires_after="2022-07-03"> <owner>drubery@chromium.org</owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index bcbfd8e..92dc464 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -5,24 +5,24 @@ "remote_path": "perfetto_binaries/trace_processor_shell/linux_arm64/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "win": { - "hash": "253a4ad52224f4ff41d30b2d31d7c07bcd819ecb", - "remote_path": "perfetto_binaries/trace_processor_shell/win/cfae0ba38e605c2a9d9dd08ac9c2f0225bb32063/trace_processor_shell.exe" + "hash": "b72104a2c634c6a0077ba53e276d3cc8cf0f4879", + "remote_path": "perfetto_binaries/trace_processor_shell/win/a0de991bf39c5744ab4eef00eae823c378eb99a9/trace_processor_shell.exe" }, "linux_arm": { "hash": "58893933be305d3bfe0a72ebebcacde2ac3ca893", "remote_path": "perfetto_binaries/trace_processor_shell/linux_arm/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "mac": { - "hash": "1f8ea64b13e45226c26e4c3fd44cda9ea9d4cffb", - "remote_path": "perfetto_binaries/trace_processor_shell/mac/d55790478283bd2e1ca01c02ad9b24f8bf4c600d/trace_processor_shell" + "hash": "7270d5dd8c35977685779103677c14d9b2839ddc", + "remote_path": "perfetto_binaries/trace_processor_shell/mac/a0de991bf39c5744ab4eef00eae823c378eb99a9/trace_processor_shell" }, "mac_arm64": { "hash": "c0397e87456ad6c6a7aa0133e5b81c97adbab4ab", "remote_path": "perfetto_binaries/trace_processor_shell/mac_arm64/cefb3e0ec3a0580c996f801e854fe02963c03d5c/trace_processor_shell" }, "linux": { - "hash": "656fe1487ec18f7e03b803a01e468be4c8fe0536", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/350b8fe08804c8cf1a3b939a906be63737b7ff39/trace_processor_shell" + "hash": "ee50898c0a4577b4a7ab121c958522c13dc0ab0c", + "remote_path": "perfetto_binaries/trace_processor_shell/linux/a0de991bf39c5744ab4eef00eae823c378eb99a9/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/typescript/definitions/passwords_private.d.ts b/tools/typescript/definitions/passwords_private.d.ts index d8fee6eb..0cb09d8c 100644 --- a/tools/typescript/definitions/passwords_private.d.ts +++ b/tools/typescript/definitions/passwords_private.d.ts
@@ -72,6 +72,7 @@ compromiseTime: number; elapsedTimeSinceCompromise: string; compromiseType: CompromiseType; + isMuted: boolean; } export interface InsecureCredential { @@ -137,6 +138,8 @@ callback?: () => void): void; export function removeInsecureCredential( credential: InsecureCredential, callback?: () => void): void; + export function muteInsecureCredential( + credential: InsecureCredential, callback?: () => void): void; export function startPasswordCheck(callback?: () => void): void; export function stopPasswordCheck(callback?: () => void): void; export function getPasswordCheckStatus(
diff --git a/tools/typescript/ts_library.py b/tools/typescript/ts_library.py index fb67440..28fe609 100644 --- a/tools/typescript/ts_library.py +++ b/tools/typescript/ts_library.py
@@ -99,22 +99,27 @@ if os.path.exists(to_check): os.remove(to_check) - node.RunNode([ - node_modules.PathToTypescript(), '--project', - os.path.join(args.gen_dir, 'tsconfig.json') - ]) - - if args.composite: - # `.tsbuildinfo` is generated by TypeScript for incremenetal compilation - # freshness checks. Since GN already decides which ts_library() targets are - # dirty, `.tsbuildinfo` is not needed for our purposes and is deleted. - # - # Moreover `.tsbuildinfo` can cause flakily failing builds since the TS - # compiler checks the `.tsbuildinfo` file and sees that none of the source - # files are changed and does not regenerate any output, without checking - # whether output files have been modified/deleted, which can lead to bad - # builds (missing files or picking up obsolete generated files). - os.remove(os.path.join(args.gen_dir, tsbuildinfo_name)) + try: + node.RunNode([ + node_modules.PathToTypescript(), '--project', + os.path.join(args.gen_dir, 'tsconfig.json') + ]) + finally: + if args.composite: + # `.tsbuildinfo` is generated by TypeScript for incremenetal compilation + # freshness checks. Since GN already decides which ts_library() targets + # are dirty, `.tsbuildinfo` is not needed for our purposes and is + # deleted. + # + # Moreover `.tsbuildinfo` can cause flakily failing builds since the TS + # compiler checks the `.tsbuildinfo` file and sees that none of the + # source files are changed and does not regenerate any output, without + # checking whether output files have been modified/deleted, which can + # lead to bad builds (missing files or picking up obsolete generated + # files). + tsbuildinfo_path = os.path.join(args.gen_dir, tsbuildinfo_name) + if os.path.exists(tsbuildinfo_path): + os.remove(tsbuildinfo_path) if args.in_files is not None: with open(os.path.join(args.gen_dir, 'tsconfig.manifest'), 'w') \
diff --git a/tools/typescript/ts_library_test.py b/tools/typescript/ts_library_test.py index 4a9314f..7415ba5 100755 --- a/tools/typescript/ts_library_test.py +++ b/tools/typescript/ts_library_test.py
@@ -206,10 +206,13 @@ gen_dir, '--in_files', 'errors.ts', + '--composite', ]) except RuntimeError as err: self.assertTrue('Type \'number\' is not assignable to type \'string\'' \ in str(err)) + self.assertFalse( + os.path.exists(os.path.join(gen_dir, 'tsconfig.tsbuildinfo'))) else: self.fail('Failed to detect type error')
diff --git a/ui/file_manager/BUILD.gn b/ui/file_manager/BUILD.gn index 00c99a8..66428c17 100644 --- a/ui/file_manager/BUILD.gn +++ b/ui/file_manager/BUILD.gn
@@ -279,7 +279,6 @@ "file_manager/foreground/js/ui/action_model_ui.js", "file_manager/foreground/js/ui/actions_submenu.js", "file_manager/foreground/js/ui/autocomplete_list.js", - "file_manager/foreground/js/ui/banners.js", "file_manager/foreground/js/ui/combobutton.js", "file_manager/foreground/js/ui/commandbutton.js", "file_manager/foreground/js/ui/default_task_dialog.js", @@ -356,7 +355,6 @@ # Files app Elements: "file_manager/foreground/elements/files_format_dialog.js", "file_manager/foreground/elements/files_icon_button.js", - "file_manager/foreground/elements/files_message.js", "file_manager/foreground/elements/files_metadata_box.js", "file_manager/foreground/elements/files_metadata_entry.js", "file_manager/foreground/elements/files_password_dialog.js",
diff --git a/ui/file_manager/file_manager/common/js/util.js b/ui/file_manager/file_manager/common/js/util.js index 0275d173..7931ec35 100644 --- a/ui/file_manager/file_manager/common/js/util.js +++ b/ui/file_manager/file_manager/common/js/util.js
@@ -1354,14 +1354,6 @@ }; /** - * Returns true if FilesBannerFramework flag is enabled. - * @return {boolean} - */ -util.isBannerFrameworkEnabled = () => { - return loadTimeData.getBoolean('FILES_BANNER_FRAMEWORK'); -}; - -/** * Returns true if FilesExtractArchive flag is enabled. * @return {boolean} */
diff --git a/ui/file_manager/file_manager/foreground/css/drive_welcome.css b/ui/file_manager/file_manager/foreground/css/drive_welcome.css deleted file mode 100644 index dc9ee64d..0000000 --- a/ui/file_manager/file_manager/foreground/css/drive_welcome.css +++ /dev/null
@@ -1,190 +0,0 @@ -/* Copyright (c) 2012 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. */ - -/* Google Drive welcome banners.*/ - -body.files-ng .drive-welcome-icon { - background-image: url(../images/files/ui/drive_logo.svg); - background-repeat: no-repeat; -} - -.drive-welcome-links { - flex: none; - margin: 6px 0; -} - -.drive-welcome .imitate-paper-button { - background-color: white; - color: rgb(79, 129, 232); - font-size: 13px; - font-weight: 500; - margin: 0; -} - -/* Header welcome banner. */ -body.files-ng .drive-welcome.header { - border-bottom: 1px solid var(--cr-separator-color, rgb(224, 224, 224)); - box-sizing: border-box; - flex: none; - height: 72px; - opacity: 1; - overflow-x: hidden; - overflow-y: auto; - position: relative; - transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1), - opacity 150ms ease 50ms; - visibility: visible; -} - -body.files-ng .dialog-container:not([drive-welcome='header']) -.drive-welcome.header { - height: 0; - opacity: 0; - visibility: hidden; -} - -body.files-ng .drive-welcome.header .drive-welcome-wrapper { - align-items: center; - display: flex; - flex-direction: row; - height: 71px; -} - -body.files-ng .drive-welcome.header .drive-welcome-icon { - background-position: center; - background-size: 32px 32px; - border-radius: 4px; - flex: none; - height: 32px; - margin-inline-end: 20px; - margin-inline-start: 16px; - width: 32px; -} - -body.files-ng .drive-welcome.header .drive-welcome-message { - z-index: 1; -} - -body.files-ng .drive-welcome.header .drive-welcome-title { - margin-bottom: 2px; -} - -body.files-ng .drive-welcome.header .drive-welcome-text { - display: inline; -} - -body.files-ng .drive-welcome.header .drive-welcome-links { - display: inline; - margin-inline-start: 4px; - z-index: 1; -} - -.drive-welcome.header .drive-welcome-links > a { - display: inline-block; - outline-offset: -1px; - padding: 0 4px; -} - -html[dir='ltr'] .drive-welcome.header .banner-people { - right: 38px; -} - -html[dir='rtl'] .drive-welcome.header .banner-people { - left: 38px; -} - -body.files-ng .drive-welcome.header .plain-link { - color: var(--google-blue-600); -} - -/* Full page welcome banner. */ -.drive-welcome.page { - bottom: 0; - flex: none; - left: 0; - position: absolute; - right: 0; - top: 0; -} - -.dialog-container:not([drive-welcome='page']) .drive-welcome.page { - display: none; -} - -.drive-welcome.page .cr-dialog-close { - display: none; -} - -.drive-welcome.page .drive-welcome-wrapper { - align-items: center; - background-color: white; - bottom: 0; - color: #333; - display: flex; - flex-direction: column; - font-size: 120%; - left: 0; - overflow: hidden; - position: absolute; - right: 0; - top: 0; -} - -.drive-welcome.page .drive-welcome-icon { - background-position: center; - background-size: 88px 88px; - height: 200px; - left: 0; - right: 0; - top: 0; - width: 100%; -} - -.drive-welcome.page .drive-welcome-message { - margin-inline-end: 10px; - margin-inline-start: 10px; - max-width: 525px; -} - -.drive-welcome.page .drive-welcome-title { - font-size: 133%; - margin-bottom: 30px; - text-align: center; -} - -.drive-welcome.page .drive-welcome-text { - font-size: 13px; - margin-bottom: 24px; -} - -.drive-welcome.page .drive-welcome-links { - display: flex; - flex-direction: row; - justify-content: flex-end; - margin: 12px 0; - max-width: 525px; - width: 100%; -} - -.drive-welcome.page .primary, -.drive-welcome.page .primary:hover { - background-color: rgb(51, 103, 214); - color: white; -} - -.drive-welcome.page .secondary { - color: rgb(100, 100, 100); -} - -.drive-welcome.page .secondary:hover { - color: rgb(51, 103, 214); -} - -body:not([type='full-page']) .drive-welcome.page .drive-welcome-wrapper { - background-position: 0 0; -} - -body:not([type='full-page']) .drive-welcome.page .drive-welcome-icon { - height: 200px; -}
diff --git a/ui/file_manager/file_manager/foreground/css/file_manager.css b/ui/file_manager/file_manager/foreground/css/file_manager.css index 3fcc8c3..49b32d2 100644 --- a/ui/file_manager/file_manager/foreground/css/file_manager.css +++ b/ui/file_manager/file_manager/foreground/css/file_manager.css
@@ -1508,42 +1508,6 @@ } } -/* Drive space warning banner. */ -body.files-ng .volume-warning { - align-items: center; - border-bottom: 1px solid var(--cr-separator-color, rgb(224, 224, 224)); - color: white; - display: flex; - flex: none; - flex-direction: row; - font-size: 13px; - height: 40px; - opacity: 1; - overflow: hidden; - position: relative; - transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1) 0s, - opacity 150ms ease 50ms; - visibility: visible; -} - -body.files-ng .volume-warning[hidden] { - border-top-width: 0; - display: flex !important; /* Overrides [hidden] for animation. */ - height: 0; - opacity: 0; - visibility: hidden; -} - -body.files-ng .volume-warning .drive-icon { - background: white url(../images/files/ui/drive_logo.svg) no-repeat center; - background-size: 20px 20px; - flex: none; - height: 20px; - margin-inline-end: 12px; - margin-inline-start: 8px; - width: 20px; -} - body.files-ng .button-group { display: flex; flex: 0 0 auto; @@ -1556,25 +1520,6 @@ text-decoration-line: none; } -body.files-ng .volume-warning .banner-button { - border: 0; - height: 32px; - margin-inline-end: 8px; - padding-inline-end: 16px; - padding-inline-start: 16px; -} - -body.files-ng .volume-warning .info-icon { - -webkit-mask-image: url(../images/files/ui/info.svg); - background-color: var(--cros-text-color-secondary); - background-size: 20px 20px; - flex: none; - height: 20px; - margin-inline-end: 16px; - margin-inline-start: 8px; - width: 20px; -} - body.files-ng .banner-close { border: 0; height: 32px; @@ -2307,7 +2252,6 @@ } /* Message panel for unmounted Drive */ -#unmounted-panel, #format-panel { bottom: 0; color: #333; @@ -2320,8 +2264,6 @@ top: 0; } -body[drive='mounting'] .dialog-container #unmounted-panel, -body[drive='error'] .dialog-container #unmounted-panel, body[unformatted] .dialog-container #format-panel { display: block; } @@ -2335,7 +2277,6 @@ opacity: 0; } -#unmounted-panel > *, #format-panel > * { align-items: center; display: none; @@ -2345,23 +2286,8 @@ margin-bottom: 10px; } -#unmounted-panel > .loading { - position: relative; -} - -#unmounted-panel > .loading > .spinner-box { - bottom: 0; - position: absolute; - right: 100%; - top: 0; - width: 40px; -} - body[unformatted] #format-panel > .error, -body[drive='mounting'] #unmounted-panel > .loading, -body[drive='error'] #unmounted-panel > .error, -#format-panel > #format-button, -#unmounted-panel.retry-enabled > .learn-more { +#format-panel > #format-button { display: flex; } @@ -2642,11 +2568,6 @@ white-space: pre-wrap; } -.drive-welcome-wrapper { - /* drive_welcome.css will override it once loaded. */ - display: none; -} - list.autocomplete-suggestions { background-color: var(--cros-bg-color-elevation-2); border-radius: 3px;
diff --git a/ui/file_manager/file_manager/foreground/css/holding_space_welcome.css b/ui/file_manager/file_manager/foreground/css/holding_space_welcome.css deleted file mode 100644 index 37790da..0000000 --- a/ui/file_manager/file_manager/foreground/css/holding_space_welcome.css +++ /dev/null
@@ -1,90 +0,0 @@ -/* 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. */ - -/* Holding space welcome banner. */ - -.holding-space-welcome { - border-bottom: 1px solid var(--cr-separator-color, rgb(224, 224, 224)); - box-sizing: border-box; - display: block !important; - flex: none; - height: 0; - opacity: 0; - overflow-x: hidden; - overflow-y: auto; - position: relative; - transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1), - opacity 150ms ease 50ms; - visibility: hidden; -} - -.holding-space-welcome:not([hidden]) { - height: 72px; - opacity: 1; - visibility: visible; -} - -.holding-space-welcome .holding-space-welcome-wrapper { - align-items: center; - display: flex; - flex-direction: row; - height: 71px; -} - -.holding-space-welcome .holding-space-welcome-icon { - background-image: url(../images/files/ui/holding_space_welcome_image.svg); - background-position: center; - background-repeat: no-repeat; - background-size: 32px 32px; - border-radius: 4px; - flex: none; - height: 32px; - margin-inline-end: 20px; - margin-inline-start: 16px; - width: 32px; -} - -.holding-space-welcome .holding-space-welcome-message { - z-index: 1; -} - -.holding-space-welcome .holding-space-welcome-title { - margin-bottom: 2px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.holding-space-welcome .holding-space-welcome-text { - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; -} - -.holding-space-welcome .holding-space-welcome-text span.icon { - -webkit-mask-image: url(../images/files/ui/menu_ng.svg); - -webkit-mask-position: center; - -webkit-mask-repeat: no-repeat; - -webkit-mask-size: 100%; - background-color: var(--cros-text-color-primary); - display: inline-block; - height: 100%; - width: 13px; -} - -body.tablet-mode-enabled .holding-space-welcome - .holding-space-welcome-text:not(.tablet-mode-enabled), -body:not(.tablet-mode-enabled) .holding-space-welcome - .holding-space-welcome-text.tablet-mode-enabled { - display: none; -} - -.holding-space-welcome .text-button { - border: 0; - height: 32px; - margin-inline-end: 20px; - padding-inline-end: 16px; - padding-inline-start: 16px; - position: relative; -}
diff --git a/ui/file_manager/file_manager/foreground/css/photos_welcome.css b/ui/file_manager/file_manager/foreground/css/photos_welcome.css deleted file mode 100644 index d41d1e5..0000000 --- a/ui/file_manager/file_manager/foreground/css/photos_welcome.css +++ /dev/null
@@ -1,60 +0,0 @@ -/* Copyright (c) 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. */ - -/* Google Photos welcome banner.*/ - -#photos-welcome { - border-bottom: 1px solid var(--cr-separator-color, rgb(224, 224, 224)); - box-sizing: border-box; - flex: none; - height: 72px; - opacity: 1; - overflow-x: hidden; - overflow-y: auto; - position: relative; - transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1), - opacity 150ms ease 50ms; - visibility: visible; -} - -#photos-welcome.photos-welcome-hidden { - height: 0; - opacity: 0; - visibility: hidden; -} - -#photos-welcome .photos-welcome-icon { - background-image: url(../images/files/ui/photos_logo.svg); - background-repeat: no-repeat; -} - -#photos-welcome .photos-welcome-wrapper { - align-items: center; - display: flex; - flex-direction: row; - height: 71px; -} - -#photos-welcome .photos-welcome-icon { - background-position: center; - background-size: 32px 32px; - border-radius: 4px; - flex: none; - height: 32px; - margin-inline-end: 20px; - margin-inline-start: 16px; - width: 32px; -} - -#photos-welcome .photos-welcome-message { - z-index: 1; -} - -#photos-welcome .photos-welcome-title { - margin-bottom: 2px; -} - -#photos-welcome .photos-welcome-text { - display: inline; -}
diff --git a/ui/file_manager/file_manager/foreground/elements/BUILD.gn b/ui/file_manager/file_manager/foreground/elements/BUILD.gn index 1ce4c667..78b7cbf 100644 --- a/ui/file_manager/file_manager/foreground/elements/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/elements/BUILD.gn
@@ -33,7 +33,6 @@ deps = [ ":files_format_dialog", ":files_icon_button", - ":files_message", ":files_metadata_box", ":files_metadata_entry", ":files_password_dialog", @@ -56,7 +55,6 @@ js_files = [ "files_format_dialog.js", "files_icon_button.js", - "files_message.js", "files_metadata_box.js", "files_metadata_entry.js", "files_password_dialog.js", @@ -102,22 +100,6 @@ ] } -js_unittest("files_message_unittest.m") { - deps = [ - ":files_message", - "//chrome/test/data/webui:chai_assert", - "//ui/webui/resources/js:assert.m", - ] -} - -js_library("files_message") { - deps = [ - "//ui/webui/resources/cr_elements/cr_button:cr_button.m", - "//ui/webui/resources/cr_elements/cr_icon_button:cr_icon_button.m", - "//ui/webui/resources/js:assert.m", - ] -} - js_library("files_metadata_box") { deps = [ "//third_party/polymer/v3_0/components-chromium/polymer:polymer_bundled", @@ -257,7 +239,6 @@ js_test_gen_html("js_test_gen_html_modules") { is_polymer3 = true deps = [ - ":files_message_unittest.m", ":files_password_dialog_unittest.m", ":files_toast_unittest.m", ":files_tooltip_unittest.m",
diff --git a/ui/file_manager/file_manager/foreground/elements/files_message.html b/ui/file_manager/file_manager/foreground/elements/files_message.html deleted file mode 100644 index 41845eb..0000000 --- a/ui/file_manager/file_manager/foreground/elements/files_message.html +++ /dev/null
@@ -1,68 +0,0 @@ -<!-- Copyright 2019 The Chromium Authors. All rights reserved. - -- Use of this source code is governed by a BSD-style license that can be - -- found in the LICENSE file. - --> - -<style> - :host([hidden]) { - display: none; - } - - :host { - border-bottom: 1px solid var(--google-grey-300); - color: var(--cr-primary-text-color); - display: flex; - height: 36px; - justify-content: space-between; - padding: 5px 0; - white-space: nowrap; - } - - cr-icon-button:not([iron-icon]) { - margin: 0; - visibility: hidden; - width: 16px; - } - - cr-icon-button[iron-icon] { - margin: 0 8px; - } - - cr-icon-button[role=img] { - --iron-icon-fill-color: var(--google-red-600); - pointer-events: none; - } - - #text[aria-label]::after { - content: attr(aria-label); - } - - #text[aria-label] { - margin-inline-end: 8px; - } - - #dismiss:not([aria-label]), - #action:not([aria-label]) { - display: none; - } - - #dismiss[aria-label]::after, - #action[aria-label]::after { - content: attr(aria-label); - } - - #dismiss, - #action { - padding: 0 calc(12px - 1px); - } -</style> - -<div role='alert'> - <cr-icon-button id='icon'></cr-icon-button> - <span id='text'></span> -</div> -<div> - <cr-button id='dismiss'></cr-button> - <cr-button id='action'></cr-button> - <cr-icon-button id='close'></cr-icon-button> -</div>
diff --git a/ui/file_manager/file_manager/foreground/elements/files_message.js b/ui/file_manager/file_manager/foreground/elements/files_message.js deleted file mode 100644 index 2a2a487..0000000 --- a/ui/file_manager/file_manager/foreground/elements/files_message.js +++ /dev/null
@@ -1,190 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import {assert} from 'chrome://resources/js/assert.m.js'; - -import {html} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; - -/** @type {!HTMLTemplateElement} */ -const htmlTemplate = html`{__html_template__}`; - -/** - * FilesMessage. - */ -export class FilesMessage extends HTMLElement { - constructor() { - super(); - - // Create element content. - const fragment = htmlTemplate.content.cloneNode(true); - this.attachShadow({mode: 'open'}).appendChild(fragment); - - /** - * FilesMessage visual signals user callback. - * @private @type {!function(*)} - */ - this.signal_ = console.log; - } - - /** - * Sets |this| properties (even its HTMLElement properties) from an object. - * @param {!Object} object Settable property name/value pairs. - * @public - */ - setContent(object) { - Object.assign(this, object); - } - - /** - * Sets the FilesMessage user visual signals callback. - * @param {?function(*)} signal - * @public - */ - setSignalCallback(signal) { - this.signal_ = signal || console.log; - } - - /** - * DOM connected. - * @private - */ - connectedCallback() { - this.onclick = this.onClicked_.bind(this); - } - - /** - * Handles Polymer 'click' events from our sub-elements and emits visual - * signals to the |signal_| callback if needed. - * @param {?Event} event - * @private - */ - onClicked_(event) { - event.stopImmediatePropagation(); - event.preventDefault(); - - let id = assert(event.target.id); - if (id === 'icon' || id === 'close') { - id = event.target.getAttribute('iron-icon'); - } else if (event.target === this) { - return; // Ignore main element clicks. - } - - this.signal_(id); - } - - /** - * Returns FilesMessage sub-element by |id|. - * @param {string} id - * @return {!HTMLElement} - * @private - */ - getShadowElement_(id) { - return assert(this.shadowRoot.getElementById(id)); - } - - /** - * Sets icon type, aria-label. Hides icon if |type| falsey. Note aria role - * and tabindex are reset here since 'set info' also calls 'set icon'. - * @param {?{ - * icon:string, - * label:?string, - * }} type - * @public - */ - set icon(type) { - const element = this.getShadowElement_('icon'); - element.setAttribute('role', 'button'); - if (type) { - element.setAttribute('aria-label', type.label || ''); - element.setAttribute('iron-icon', type.icon); - element.setAttribute('tabindex', '0'); - element.onclick = this.onclick; - } else { - element.removeAttribute('iron-icon'); // hide - element.onclick = null; - } - } - - /** - * Sets icon info type, aria-label. The icon is shown, non-clickable. - * @param {?{ - * icon:string, - * label:?string, - * }} type - * @public - */ - set info(type) { - this.icon = type; // Set icon property first. - - const element = this.getShadowElement_('icon'); - element.setAttribute('role', 'img'); - element.removeAttribute('tabindex'); - element.onclick = null; - } - - /** - * Sets the text message. - * @param {?string} text - * @public - */ - set message(text) { - const element = this.getShadowElement_('text'); - element.setAttribute('aria-label', text || ''); - } - - /** - * Sets dismiss button text. Hides dismiss button if |text| falsey. - * @param {?string} text - * @public - */ - set dismiss(text) { - const element = this.getShadowElement_('dismiss'); - if (text) { - element.setAttribute('aria-label', text); - element.onclick = this.onclick; - } else { - element.removeAttribute('aria-label'); // hide - element.onclick = null; - } - } - - /** - * Sets action button text. Hides action button if |text| falsey. - * @param {?string} text - * @public - */ - set action(text) { - const element = this.getShadowElement_('action'); - if (text) { - element.setAttribute('aria-label', text); - element.onclick = this.onclick; - } else { - element.removeAttribute('aria-label'); // hide - element.onclick = null; - } - } - - /** - * Sets close icon type, aria-label. Hides close icon if |type| falsey. - * @param {?{ - * label:?string, - * }} type - * @public - */ - set close(type) { - const element = this.getShadowElement_('close'); - if (type) { - element.setAttribute('aria-label', type.label || ''); - element.setAttribute('iron-icon', 'cr:close'); - element.onclick = this.onclick; - } else { - element.removeAttribute('iron-icon'); // hide - element.onclick = null; - } - } -} - -customElements.define('files-message', FilesMessage); - -//# sourceURL=//ui/file_manager/file_manager/foreground/elements/files_message.js
diff --git a/ui/file_manager/file_manager/foreground/elements/files_message_unittest.m.js b/ui/file_manager/file_manager/foreground/elements/files_message_unittest.m.js deleted file mode 100644 index 2425e6e..0000000 --- a/ui/file_manager/file_manager/foreground/elements/files_message_unittest.m.js +++ /dev/null
@@ -1,217 +0,0 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -import {assert} from 'chrome://resources/js/assert.m.js'; -import {assertEquals, assertFalse, assertNotEquals, assertTrue} from 'chrome://test/chai_assert.js'; - -import {FilesMessage} from './files_message.js'; - -/** - * Adds a FilesMessage element to the page, initially hidden. - */ -export function setUpPage() { - document.body.innerHTML += - '<files-message id="test-files-message" hidden></files-message>'; -} - -/** - * Sets the <files-message> element content, and returns the element. - * @return {!FilesMessage|!Element} - */ -function setFilesMessageContent() { - // Get the FilesMessage element. - /** @type {!FilesMessage|!Element} */ - const message = assert(document.querySelector('#test-files-message')); - - // Use the FilesMessage.setContent() method to assign all its settable - // properties in one go. - message.setContent({ - icon: {icon: 'cr:expand-more', label: 'More'}, - message: 'Some very informative text message', - dismiss: 'Dismiss', - action: 'View offline files', - close: {label: 'Close'}, - }); - - // <files-message> [hidden] controls visual display. - assertEquals('none', window.getComputedStyle(message).display); - assertNotEquals(null, message.getAttribute('hidden')); - assertTrue(message.hidden); - - // <files-message> extends HTMLElement and so the setContent() method - // can set its HTMLElement properties too, e.g., hidden here. - message.setContent({ - hidden: false, - }); - - // <files-message> element should be visually displayed. - assertNotEquals('none', window.getComputedStyle(message).display); - assertEquals(null, message.getAttribute('hidden')); - assertFalse(message.hidden); - - return message; -} - -/** - * Tests the <files-message> element: check display, clicking, aria roles, - * setting its content via the element's property setters, and hiding its - * sub-elements. - */ -export async function testFilesMessage(done) { - // Setup and return the <files-message> element. - /** @type {!FilesMessage|!Element} */ - const message = setFilesMessageContent(); - - // Get its sub-elements. - /** @type {!HTMLElement} */ - const icon = assert(message.shadowRoot.querySelector('#icon')); - /** @type {!HTMLElement} */ - const text = assert(message.shadowRoot.querySelector('#text')); - /** @type {!HTMLElement} */ - const dismiss = assert(message.shadowRoot.querySelector('#dismiss')); - /** @type {!HTMLElement} */ - const action = assert(message.shadowRoot.querySelector('#action')); - /** @type {!HTMLElement} */ - const close = assert(message.shadowRoot.querySelector('#close')); - - // The sub-elements should be displayed. - assertNotEquals('none', window.getComputedStyle(icon).display); - assertNotEquals('none', window.getComputedStyle(text).display); - assertNotEquals('none', window.getComputedStyle(dismiss).display); - assertNotEquals('none', window.getComputedStyle(action).display); - assertNotEquals('none', window.getComputedStyle(close).display); - - // To work with screen readers, the icon & text element containing - // parent element should have aria role 'alert'. - const iconParent = icon.parentElement; - assertEquals('alert', iconParent.getAttribute('role')); - const textParent = text.parentElement; - assertEquals('alert', textParent.getAttribute('role')); - - // The sub-elements should have aria-label content. - assertEquals('More', icon.getAttribute('aria-label')); - assertEquals('Dismiss', dismiss.getAttribute('aria-label')); - assertEquals('View offline files', action.getAttribute('aria-label')); - assertEquals('Close', close.getAttribute('aria-label')); - - // The text element has no aria role: it's just plain text. - assertEquals(null, text.getAttribute('role')); - const initialText = 'Some very informative text message'; - assertEquals(initialText, text.getAttribute('aria-label')); - assertEquals(null, text.getAttribute('tabindex')); - - // Setup the FilesMessage visual signals (click) callback. - /** @type {?string} */ - let signal = null; - message.setSignalCallback((name) => { - assert(typeof name === 'string'); - signal = name; - }); - - // Clicking the main element does not emit a visual signal. - signal = 'main-element-not-clickable'; - assertNotEquals(null, message.onclick); - message.click(); - assertEquals('main-element-not-clickable', signal); - - // Clicking sub-elements emits a visual signal, if needed. - icon.click(); - assertEquals('cr:expand-more', signal); - assertEquals(null, text.onclick); - signal = 'text-element-not-clickable'; - text.click(); - assertEquals('text-element-not-clickable', signal); - dismiss.click(); - assertEquals('dismiss', signal); - action.click(); - assertEquals('action', signal); - close.click(); - assertEquals('cr:close', signal); - - // The icon button icon type and label can be changed. - message.icon = {icon: 'cr:open', label: 'aria icon label'}; - assertEquals('aria icon label', icon.getAttribute('aria-label')); - assertEquals('cr:open', icon.getAttribute('iron-icon')); - assertEquals('0', icon.getAttribute('tabindex')); - - // Clicking the icon signals its iron-icon name. - signal = null; - icon.click(); - assertEquals('cr:open', signal); - - // The icon may be changed to be an informative icon. - message.info = {icon: 'cr:info', label: 'aria info label'}; - assertEquals('aria info label', icon.getAttribute('aria-label')); - assertEquals('cr:info', icon.getAttribute('iron-icon')); - - // The role of an informative icon is image, not button. - assertEquals('img', icon.getAttribute('role')); - assertEquals(null, icon.getAttribute('tabindex')); - - // Clicking an informative icon does not emit a signal. - signal = 'informative-icon-not-clickable'; - assertEquals(null, icon.onclick); - icon.click(); - assertEquals('informative-icon-not-clickable', signal); - - // Setting icon button to null, hides the button. - message.icon = null; - assertEquals('hidden', window.getComputedStyle(icon).visibility); - assertEquals(null, icon.getAttribute('iron-icon')); - signal = 'hidden-icon-not-clickable'; - assertEquals(null, icon.onclick); - icon.click(); - assertEquals('hidden-icon-not-clickable', signal); - - // The close button aria-label can be changed. - message.close = {label: 'aria close label'}; - assertEquals('aria close label', close.getAttribute('aria-label')); - assertEquals('cr:close', close.getAttribute('iron-icon')); - assertNotEquals(null, close.onclick); - signal = null; - close.click(); - assertEquals('cr:close', signal); - - // Setting close button to null, hides the button. - message.close = null; - assertEquals('hidden', window.getComputedStyle(close).visibility); - assertEquals(null, close.getAttribute('iron-icon')); - signal = 'hidden-close-icon-not-clickable'; - assertEquals(null, close.onclick); - close.click(); - assertEquals('hidden-close-icon-not-clickable', signal); - - // Setting message text, dismiss, and action, changes their text. - message.message = 'Change text'; - assertEquals('Change text', text.getAttribute('aria-label')); - message.dismiss = 'Change dismiss'; - assertEquals('Change dismiss', dismiss.getAttribute('aria-label')); - message.action = 'Change action'; - assertEquals('Change action', action.getAttribute('aria-label')); - - // Setting dimiss button to null, hides the button. - message.dismiss = null; - assertEquals('none', window.getComputedStyle(dismiss).display); - assertEquals(null, dismiss.getAttribute('aria-label')); - signal = 'hidden-dismiss-button-not-clickable'; - assertEquals(null, dismiss.onclick); - dismiss.click(); - assertEquals('hidden-dismiss-button-not-clickable', signal); - - // Setting action button to null, hides the button. - message.action = null; - assertEquals('none', window.getComputedStyle(action).display); - assertEquals(null, action.getAttribute('aria-label')); - signal = 'hidden-action-button-not-clickable'; - assertEquals(null, action.onclick); - action.click(); - assertEquals('hidden-action-button-not-clickable', signal); - - // Setting null text should display empty text. - message.message = null; - assertEquals('', text.getAttribute('aria-label')); - assertNotEquals('none', window.getComputedStyle(text).display); - - done(); -}
diff --git a/ui/file_manager/file_manager/foreground/js/BUILD.gn b/ui/file_manager/file_manager/foreground/js/BUILD.gn index 6fa950b..ad9a989 100644 --- a/ui/file_manager/file_manager/foreground/js/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/BUILD.gn
@@ -366,7 +366,6 @@ "//ui/file_manager/file_manager/common/js:util", "//ui/file_manager/file_manager/common/js:volume_manager_types", "//ui/file_manager/file_manager/externs/background:crostini", - "//ui/file_manager/file_manager/foreground/elements:files_message", "//ui/file_manager/file_manager/foreground/elements:files_toast", "//ui/webui/resources/js:assert.m", ] @@ -484,7 +483,6 @@ visibility += [ "//ui/file_manager:*" ] deps = [ "//ui/file_manager/file_manager/foreground/elements:files_format_dialog", - "//ui/file_manager/file_manager/foreground/elements:files_message", "//ui/file_manager/file_manager/foreground/elements:files_password_dialog", "//ui/file_manager/file_manager/foreground/elements:files_ripple", "//ui/file_manager/file_manager/foreground/elements:files_spinner", @@ -564,7 +562,6 @@ "metadata:metadata_model", "metadata:thumbnail_model", "ui:a11y_announce", - "ui:banners", "ui:commandbutton", "ui:directory_tree", "ui:file_grid", @@ -591,7 +588,6 @@ "//ui/file_manager/file_manager/externs/background:media_import_handler", "//ui/file_manager/file_manager/externs/background:media_scanner", "//ui/file_manager/file_manager/externs/background:progress_center", - "//ui/file_manager/file_manager/foreground/elements:files_message", "//ui/webui/resources/js:assert.m", "//ui/webui/resources/js:load_time_data.m", "//ui/webui/resources/js:util.m",
diff --git a/ui/file_manager/file_manager/foreground/js/crostini_controller.js b/ui/file_manager/file_manager/foreground/js/crostini_controller.js index 5b884be..d4e75dd 100644 --- a/ui/file_manager/file_manager/foreground/js/crostini_controller.js +++ b/ui/file_manager/file_manager/foreground/js/crostini_controller.js
@@ -5,10 +5,9 @@ import {assert} from 'chrome://resources/js/assert.m.js'; import {FakeEntryImpl} from '../../common/js/files_app_entry_types.js'; -import {str, strf, util} from '../../common/js/util.js'; +import {str, strf} from '../../common/js/util.js'; import {VolumeManagerCommon} from '../../common/js/volume_manager_types.js'; import {Crostini} from '../../externs/background/crostini.js'; -import {FilesMessage} from '../elements/files_message.js'; import {FilesToast} from '../elements/files_toast.js'; import {constants} from './constants.js'; @@ -23,18 +22,14 @@ export class CrostiniController { /** * @param {!Crostini} crostini Crostini background object. - * @param {!FilesMessage} filesMessage FilesMessage. * @param {!DirectoryModel} directoryModel DirectoryModel. * @param {!DirectoryTree} directoryTree DirectoryTree. */ - constructor(crostini, filesMessage, directoryModel, directoryTree) { + constructor(crostini, directoryModel, directoryTree) { /** @private @const */ this.crostini_ = crostini; /** @private @const */ - this.filesMessage_ = filesMessage; - - /** @private @const */ this.directoryModel_ = directoryModel; /** @private @const */ @@ -45,13 +40,6 @@ /** @private */ this.entrySharedWithPluginVm_ = false; - - // TODO(crbug.com/1228128): Remove this once migrated to the new banner - // framework. - if (!util.isBannerFrameworkEnabled()) { - directoryModel.addEventListener( - 'directory-changed', () => this.maybeShowSharedMessage()); - } } /** @@ -130,49 +118,4 @@ CommandHandler.MenuCommandsForUMA .MANAGE_PLUGIN_VM_SHARING_TOAST_STARTUP); } - - // TODO(crbug.com/1228128): Remove this once migrated to the new banner - // framework. - maybeShowSharedMessage() { - const entry = - /** @type {Entry} */ (this.directoryModel_.getCurrentDirEntry()); - if (!entry) { - return; - } - const sharedWithCrostini = this.crostini_.isPathShared('termina', entry); - const sharedWithPluginVm = this.crostini_.isPathShared('PvmDefault', entry); - if (sharedWithCrostini == this.entrySharedWithCrostini_ && - sharedWithPluginVm == this.entrySharedWithPluginVm_) { - return; - } - this.entrySharedWithCrostini_ = sharedWithCrostini; - this.entrySharedWithPluginVm_ = sharedWithPluginVm; - - let msg = ''; - let subpage = ''; - if (sharedWithCrostini && sharedWithPluginVm) { - msg = 'MESSAGE_FOLDER_SHARED_WITH_CROSTINI_AND_PLUGIN_VM'; - subpage = 'app-management/pluginVm/sharedPaths'; - } else if (sharedWithCrostini) { - msg = 'MESSAGE_FOLDER_SHARED_WITH_CROSTINI'; - subpage = 'crostini/sharedPaths'; - } else if (sharedWithPluginVm) { - msg = 'MESSAGE_FOLDER_SHARED_WITH_PLUGIN_VM'; - subpage = 'app-management/pluginVm/sharedPaths'; - } else { - this.filesMessage_.hidden = true; - return; - } - - this.filesMessage_.setContent({ - message: str(msg), - action: str('MANAGE_TOAST_BUTTON_LABEL'), - hidden: false, - }); - this.filesMessage_.setSignalCallback((signal) => { - if (signal === 'action') { - chrome.fileManagerPrivate.openSettingsSubpage(subpage); - } - }); - } }
diff --git a/ui/file_manager/file_manager/foreground/js/deferred_elements.m.js b/ui/file_manager/file_manager/foreground/js/deferred_elements.m.js index 4a68d68..9ca58e2 100644 --- a/ui/file_manager/file_manager/foreground/js/deferred_elements.m.js +++ b/ui/file_manager/file_manager/foreground/js/deferred_elements.m.js
@@ -8,7 +8,6 @@ import 'chrome://resources/cr_elements/cr_toggle/cr_toggle.m.js'; import '../elements/files_format_dialog.js'; -import '../elements/files_message.js'; import '../elements/files_password_dialog.js'; import '../elements/files_ripple.js'; import '../elements/files_spinner.js';
diff --git a/ui/file_manager/file_manager/foreground/js/file_manager.js b/ui/file_manager/file_manager/foreground/js/file_manager.js index c081cb2..16af1f24 100644 --- a/ui/file_manager/file_manager/foreground/js/file_manager.js +++ b/ui/file_manager/file_manager/foreground/js/file_manager.js
@@ -30,7 +30,6 @@ import {BackgroundWindow} from '../../externs/background_window.js'; import {CommandHandlerDeps} from '../../externs/command_handler_deps.js'; import {FakeEntry, FilesAppDirEntry} from '../../externs/files_app_entry_interfaces.js'; -import {FilesMessage} from '../elements/files_message.js'; import {ActionsController} from './actions_controller.js'; import {AndroidAppListModel} from './android_app_list_model.js'; @@ -77,7 +76,6 @@ import {TaskController} from './task_controller.js'; import {ToolbarController} from './toolbar_controller.js'; import {A11yAnnounce} from './ui/a11y_announce.js'; -import {Banners} from './ui/banners.js'; import {CommandButton} from './ui/commandbutton.js'; import {DirectoryTree} from './ui/directory_tree.js'; import {FileGrid} from './ui/file_grid.js'; @@ -777,17 +775,10 @@ this.selectionHandler_.onFileSelectionChanged(); this.ui_.listContainer.endBatchUpdates(); - if (util.isBannerFrameworkEnabled()) { - const bannerController = new BannerController( - this.directoryModel_, this.volumeManager_, assert(this.crostini_)); - this.ui_.initBanners(bannerController); - bannerController.initialize(); - } else { - this.ui_.initBanners(new Banners( - this.directoryModel_, this.volumeManager_, this.document_, - // Whether to show any welcome banner. - this.dialogType === DialogType.FULL_PAGE)); - } + const bannerController = new BannerController( + this.directoryModel_, this.volumeManager_, assert(this.crostini_)); + this.ui_.initBanners(bannerController); + bannerController.initialize(); this.ui_.attachFilesTooltip(); this.ui_.decorateFilesMenuItems(); @@ -1340,8 +1331,7 @@ chrome.fileManagerPrivate.onCrostiniChanged.addListener( this.onCrostiniChanged_.bind(this)); this.crostiniController_ = new CrostiniController( - assert(this.crostini_), /** @type {!FilesMessage} */ - (this.document_.querySelector('#files-message')), this.directoryModel_, + assert(this.crostini_), this.directoryModel_, assert(this.directoryTree)); await this.crostiniController_.redraw(); // Never show toast in an open-file dialog.
diff --git a/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn b/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn index e9b70c2..e892803 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn +++ b/ui/file_manager/file_manager/foreground/js/ui/BUILD.gn
@@ -25,7 +25,6 @@ ":action_model_ui", ":actions_submenu", ":autocomplete_list", - ":banners", ":combobutton", ":commandbutton", ":default_task_dialog", @@ -75,7 +74,6 @@ ":action_model_ui", ":actions_submenu", ":autocomplete_list", - ":banners", ":breadcrumb", ":combobutton", ":commandbutton", @@ -145,22 +143,6 @@ ] } -js_library("banners") { - deps = [ - "//ui/file_manager/file_manager/common/js:util", - "//ui/file_manager/file_manager/common/js:volume_manager_types", - "//ui/file_manager/file_manager/externs:volume_info", - "//ui/file_manager/file_manager/externs:volume_manager", - "//ui/file_manager/file_manager/foreground/js:constants", - "//ui/file_manager/file_manager/foreground/js:directory_model", - "//ui/file_manager/file_manager/foreground/js:holding_space_util", - "//ui/webui/resources/js:assert.m", - "//ui/webui/resources/js:cr.m", - "//ui/webui/resources/js:util.m", - "//ui/webui/resources/js/cr:event_target.m", - ] -} - js_library("breadcrumb") { deps = [ "//ui/webui/resources/cr_elements/cr_action_menu:cr_action_menu" ] } @@ -330,7 +312,6 @@ ":a11y_announce", ":action_model_ui", ":actions_submenu", - ":banners", ":combobutton", ":default_task_dialog", ":dialog_footer",
diff --git a/ui/file_manager/file_manager/foreground/js/ui/banners.js b/ui/file_manager/file_manager/foreground/js/ui/banners.js deleted file mode 100644 index 2323407..0000000 --- a/ui/file_manager/file_manager/foreground/js/ui/banners.js +++ /dev/null
@@ -1,1222 +0,0 @@ -// Copyright (c) 2012 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 {assert} from 'chrome://resources/js/assert.m.js'; -import {dispatchSimpleEvent} from 'chrome://resources/js/cr.m.js'; -import {NativeEventTarget as EventTarget} from 'chrome://resources/js/cr/event_target.m.js'; -import {queryRequiredElement} from 'chrome://resources/js/util.m.js'; - -import {str, strf, util} from '../../../common/js/util.js'; -import {VolumeManagerCommon} from '../../../common/js/volume_manager_types.js'; -import {xfm} from '../../../common/js/xfm.js'; -import {VolumeInfo} from '../../../externs/volume_info.js'; -import {VolumeManager} from '../../../externs/volume_manager.js'; -import {constants} from '../constants.js'; -import {DirectoryModel} from '../directory_model.js'; -import {HoldingSpaceUtil} from '../holding_space_util.js'; - - -/** - * Key in localStorage to keep number of times the Drive Welcome - * banner has shown. - */ -const WELCOME_HEADER_COUNTER_KEY = 'driveWelcomeHeaderCounter'; - -// If the warning was dismissed before, this key stores the quota value -// (as of the moment of dismissal). -// If the warning was never dismissed or was reset this key stores 0. -const DRIVE_WARNING_DISMISSED_KEY = 'driveSpaceWarningDismissed'; - -/** - * If the warning was dismissed before, this key stores the moment of dismissal - * in milliseconds since the UNIX epoch (i.e. the value of Date.now()). - * @const {string} - */ -const DOWNLOADS_WARNING_DISMISSED_KEY = 'downloadsSpaceWarningDismissed'; - -/** - * Key in localStorage to store the number of times the holding space welcome - * banner has shown. Note that if the user explicitly dismisses the banner then - * the value at this key will be `HOLDING_SPACE_WELCOME_BANNER_COUNTER_LIMIT`. - * @type {string} - */ -const HOLDING_SPACE_WELCOME_BANNER_COUNTER_KEY = - 'holdingSpaceWelcomeBannerCounter'; - -/** - * Key in localStorage to store the number of sessions the Offline Info banner - * message has shown in. - */ -const OFFLINE_INFO_BANNER_COUNTER_KEY = 'driveOfflineInfoBannerCounter'; - -/** - * Key in localStorage to keep number of times the Photos Welcome banner was - * shown. - * @const {string} - */ -const PHOTOS_WELCOME_COUNTER_KEY = 'photosWelcomeCounter'; - -/** - * Maximum times the holding space welcome banner could have shown. - * @type {number} - */ -const HOLDING_SPACE_WELCOME_BANNER_COUNTER_LIMIT = 3; - -/** - * Maximum times Drive Welcome banner could have shown. - */ -const WELCOME_HEADER_COUNTER_LIMIT = 25; - -/** - * If the remaining space in Drive is less than 10%, we'll show a warning. - * @const {number} - */ -const DRIVE_SPACE_WARNING_THRESHOLD_RATIO = 0.1; - -/** - * If the remaining space in Downloads is less than 1GB, we'll show a warning. - * This value is in bytes. - * @const {number} - */ -const DOWNLOADS_SPACE_WARNING_THRESHOLD_SIZE = 1 * 1024 * 1024 * 1024; - -/** - * After the warning banner is dismissed, we won't show it for 36 hours. - * This value is in milliseconds. - * @const {number} - */ -const DOWNLOADS_SPACE_WARNING_DISMISS_DURATION = 36 * 60 * 60 * 1000; - -/** - * Maximum sessions the Offline Info banner should be shown. - */ -const OFFLINE_INFO_BANNER_COUNTER_LIMIT = 3; - -/** - * Maximum times Google Photos welcome banner could have shown. - * @const {number} - */ -const PHOTOS_WELCOME_COUNTER_LIMIT = 3; - -/** - * Responsible for showing following banners in the file list. - * - WelcomeBanner - * - AuthFailBanner - */ -export class Banners extends EventTarget { - /** - * @param {DirectoryModel} directoryModel The model. - * @param {!VolumeManager} volumeManager The manager. - * @param {Document} document HTML document. - * @param {boolean} showWelcome True if the welcome banner can be shown. - */ - constructor(directoryModel, volumeManager, document, showWelcome) { - super(); - - this.directoryModel_ = directoryModel; - this.volumeManager_ = volumeManager; - this.document_ = assert(document); - this.showWelcome_ = showWelcome; - - /** @private {boolean} */ - this.previousDirWasOnDrive_ = false; - - this.privateOnDirectoryChangedBound_ = - this.privateOnDirectoryChanged_.bind(this); - - const handler = () => { - this.maybeShowDriveBanners_(); - this.maybeShowHoldingSpaceWelcomeBanner_(); - this.maybeShowPhotosWelcomeBanner_(); - }; - - this.directoryModel_.addEventListener('scan-completed', handler); - this.directoryModel_.addEventListener('rescan-completed', handler); - this.directoryModel_.addEventListener( - 'directory-changed', this.onDirectoryChanged_.bind(this)); - - this.unmountedPanel_ = this.document_.querySelector('#unmounted-panel'); - this.volumeManager_.volumeInfoList.addEventListener( - 'splice', this.onVolumeInfoListSplice_.bind(this)); - this.volumeManager_.addEventListener( - 'drive-connection-changed', this.onDriveConnectionChanged_.bind(this)); - - xfm.storage.onChanged.addListener(this.onStorageChange_.bind(this)); - - /** @private {number} */ - this.holdingSpaceWelcomeBannerCounter_ = - HOLDING_SPACE_WELCOME_BANNER_COUNTER_LIMIT; - - this.welcomeHeaderCounter_ = WELCOME_HEADER_COUNTER_LIMIT; - this.warningDismissedCounter_ = 0; - this.downloadsWarningDismissedTime_ = 0; - - /** - * Number of sessions the offline info banner has been shown in already. - * @private {!number} - */ - this.offlineInfoBannerCounter_ = 0; - - /** - * Whether or not the offline info banner has been shown this session. - * @private {!boolean} - */ - this.hasShownOfflineInfoBanner_ = false; - - /** - * How many times Google Photos welcome banner has been shown. - * @private {number} - */ - this.photosWelcomeCounter_ = PHOTOS_WELCOME_COUNTER_LIMIT; - - this.ready_ = new Promise((resolve, reject) => { - xfm.storage.local.get( - [ - HOLDING_SPACE_WELCOME_BANNER_COUNTER_KEY, - WELCOME_HEADER_COUNTER_KEY, - DRIVE_WARNING_DISMISSED_KEY, - DOWNLOADS_WARNING_DISMISSED_KEY, - OFFLINE_INFO_BANNER_COUNTER_KEY, - PHOTOS_WELCOME_COUNTER_KEY, - ], - values => { - if (chrome.runtime.lastError) { - reject( - 'Failed to load banner data from storage: ' + - chrome.runtime.lastError.message); - return; - } - this.holdingSpaceWelcomeBannerCounter_ = - parseInt( - values[HOLDING_SPACE_WELCOME_BANNER_COUNTER_KEY], 10) || - 0; - this.welcomeHeaderCounter_ = - parseInt(values[WELCOME_HEADER_COUNTER_KEY], 10) || 0; - this.warningDismissedCounter_ = - parseInt(values[DRIVE_WARNING_DISMISSED_KEY], 10) || 0; - this.downloadsWarningDismissedTime_ = - parseInt(values[DOWNLOADS_WARNING_DISMISSED_KEY], 10) || 0; - this.offlineInfoBannerCounter_ = - parseInt(values[OFFLINE_INFO_BANNER_COUNTER_KEY], 10) || 0; - this.photosWelcomeCounter_ = - parseInt(values[PHOTOS_WELCOME_COUNTER_KEY], 10) || 0; - - // If it's in test, override the counter to show the header by - // force. - if (chrome.test) { - this.holdingSpaceWelcomeBannerCounter_ = 0; - this.welcomeHeaderCounter_ = 0; - this.warningDismissedCounter_ = 0; - this.offlineInfoBannerCounter_ = 0; - } - resolve(); - }); - }); - - // Authentication failed banner. - this.authFailedBanner_ = - this.document_.querySelector('#drive-auth-failed-warning'); - const authFailedText = this.authFailedBanner_.querySelector('.drive-text'); - authFailedText.innerHTML = util.htmlUnescape(str('DRIVE_NOT_REACHED')); - authFailedText.querySelector('a').addEventListener('click', e => { - chrome.fileManagerPrivate.logoutUserForReauthentication(); - e.preventDefault(); - }); - this.maybeShowAuthFailBanner_(); - - /** - * Banner informing user they can make elements available offline. - * @private {!HTMLElement} - * @const - */ - this.offlineInfoBanner_ = queryRequiredElement('#offline-info-banner'); - util.setClampLine( - queryRequiredElement('.body2-primary', this.offlineInfoBanner_), '2'); - queryRequiredElement('#offline-learn-more').addEventListener('click', e => { - util.visitURL(str('GOOGLE_DRIVE_OFFLINE_HELP_URL')); - this.setOfflineInfoBannerCounter_(OFFLINE_INFO_BANNER_COUNTER_LIMIT); - this.offlineInfoBanner_.hidden = true; - this.hasShownOfflineInfoBanner_ = false; - e.preventDefault(); - }); - - /** @const @private {!HTMLElement} */ - this.holdingSpaceWelcomeBanner_ = - queryRequiredElement('.holding-space-welcome', this.document_); - } - - /** - * @param {number} value How many times the holding space welcome banner - * has shown. - * @private - */ - setHoldingSpaceWelcomeBannerCounter_(value) { - const values = {}; - values[HOLDING_SPACE_WELCOME_BANNER_COUNTER_KEY] = value; - xfm.storage.local.set(values); - } - - /** - * @param {number} value How many times the Drive Welcome header banner - * has shown. - * @private - */ - setWelcomeHeaderCounter_(value) { - const values = {}; - values[WELCOME_HEADER_COUNTER_KEY] = value; - xfm.storage.local.set(values); - } - - /** - * @param {number} value How many times the low space warning has dismissed. - * @private - */ - setWarningDismissedCounter_(value) { - const values = {}; - values[DRIVE_WARNING_DISMISSED_KEY] = value; - xfm.storage.local.set(values); - } - - /** - * @param {number} value How many sessions the Offline Info banner has shown - * in. - * @private - */ - setOfflineInfoBannerCounter_(value) { - const values = {}; - values[OFFLINE_INFO_BANNER_COUNTER_KEY] = value; - xfm.storage.local.set(values); - } - - /** - * @param {number} value How many times the Photos Welcome header banner was - * shown. - * @private - */ - setPhotosWelcomeCounter_(value) { - this.photosWelcomeCounter_ = value; - const values = {}; - values[PHOTOS_WELCOME_COUNTER_KEY] = value; - xfm.storage.local.set(values); - } - - /** - * xfm.storage.onChanged event handler. - * @param {Object<Object>} changes Changes values. - * @param {string} areaName "local" or "sync". - * @private - */ - onStorageChange_(changes, areaName) { - if (areaName == 'local' && - HOLDING_SPACE_WELCOME_BANNER_COUNTER_KEY in changes) { - this.holdingSpaceWelcomeBannerCounter_ = - changes[HOLDING_SPACE_WELCOME_BANNER_COUNTER_KEY].newValue; - } - if (areaName == 'local' && WELCOME_HEADER_COUNTER_KEY in changes) { - this.welcomeHeaderCounter_ = changes[WELCOME_HEADER_COUNTER_KEY].newValue; - } - if (areaName == 'local' && DRIVE_WARNING_DISMISSED_KEY in changes) { - this.warningDismissedCounter_ = - changes[DRIVE_WARNING_DISMISSED_KEY].newValue; - } - if (areaName == 'local' && DOWNLOADS_WARNING_DISMISSED_KEY in changes) { - this.downloadsWarningDismissedTime_ = - changes[DOWNLOADS_WARNING_DISMISSED_KEY].newValue; - } - if (areaName == 'local' && OFFLINE_INFO_BANNER_COUNTER_KEY in changes) { - this.offlineInfoBannerCounter_ = - changes[OFFLINE_INFO_BANNER_COUNTER_KEY].newValue; - } - } - - /** - * Invoked when the drive connection status is change in the volume manager. - * @private - */ - onDriveConnectionChanged_() { - this.maybeShowAuthFailBanner_(); - } - - /** - * Adds a stylesheet to the page if it does not exist already. - * @param {string} attrKey Attribute used to uniquely identify the stylesheet - * to check if it has been added. - * @param {string} cssUrl Path to the CSS file. - * @return {Object} The link element identified by |attrKey|. - * @private - */ - maybeAddStylesheet(attrKey, cssUrl) { - let style = this.document_.querySelector(`link[${attrKey}]`); - if (style) { - return style; - } - style = this.document_.createElement('link'); - style.rel = 'stylesheet'; - style.href = cssUrl; - style.setAttribute(attrKey, ''); - this.document_.head.appendChild(style); - return style; - } - - /** - * Shows the holding space welcome banner, creating the banner if necessary. - * @private - */ - prepareAndShowHoldingSpaceWelcomeBanner_() { - this.showHoldingSpaceWelcomeBanner_(true); - - // Do not recreate the banner. - if (this.holdingSpaceWelcomeBanner_.firstElementChild) { - return; - } - - // Add banner styles to document head. - const style = this.maybeAddStylesheet( - 'holding-space-welcome-style', constants.HOLDING_SPACE_WELCOME_CSS); - if (!style.onload) { - // The holding space welcome banner has inline styles to prevent it from - // being made visible to the user before its dynamically added styles have - // fully loaded. Once dynamically added styles have loaded, inline styles - // must be removed so that the banner can be made visible. - style.onload = () => { - this.holdingSpaceWelcomeBanner_.removeAttribute('style'); - }; - } - - const wrapper = util.createChild( - this.holdingSpaceWelcomeBanner_, 'holding-space-welcome-wrapper'); - util.createChild(wrapper, 'holding-space-welcome-icon'); - - const message = util.createChild(wrapper, 'holding-space-welcome-message'); - util.setClampLine(message, '2'); - - const title = - util.createChild(message, 'holding-space-welcome-title headline2'); - title.textContent = str('HOLDING_SPACE_WELCOME_TITLE'); - - // NOTE: Only one of either `text` or `textInTabletMode` will be displayed - // at a time depending on whether or not tablet mode is enabled. - const body = util.createChild(message, 'body2-primary'); - const text = util.createChild(body, 'holding-space-welcome-text'); - const textInTabletMode = util.createChild( - body, 'holding-space-welcome-text tablet-mode-enabled'); - text.textContent = str('HOLDING_SPACE_WELCOME_TEXT'); - textInTabletMode.innerHTML = strf( - 'HOLDING_SPACE_WELCOME_TEXT_IN_TABLET_MODE', - '<span class="icon"> </span>'); - - const buttonGroup = util.createChild(wrapper, 'button-group', 'div'); - const dismiss = util.createChild(buttonGroup, 'text-button', 'cr-button'); - dismiss.id = 'holding-space-welcome-dismiss'; - dismiss.setAttribute('aria-label', str('HOLDING_SPACE_WELCOME_DISMISS')); - dismiss.textContent = str('HOLDING_SPACE_WELCOME_DISMISS'); - dismiss.tabIndex = 0; - - dismiss.addEventListener( - 'click', this.closeHoldingSpaceWelcomeBanner_.bind(this)); - } - - /** - * @param {string} type 'none'|'page'|'header'. - * @param {string} messageId Resource ID of the message. - * @private - */ - prepareAndShowWelcomeBanner_(type, messageId) { - if (!this.showWelcome_) { - return; - } - - this.showWelcomeBanner_(type); - - const container = - queryRequiredElement('.drive-welcome.' + type, this.document_); - if (container.firstElementChild) { - return; - } // Do not re-create. - - this.maybeAddStylesheet('drive-welcome-style', constants.DRIVE_WELCOME_CSS); - - const wrapper = util.createChild(container, 'drive-welcome-wrapper'); - util.createChild(wrapper, 'drive-welcome-icon'); - - const message = util.createChild(wrapper, 'drive-welcome-message'); - util.setClampLine(message, '2'); - - const title = util.createChild(message, 'drive-welcome-title headline2'); - title.textContent = str('DRIVE_WELCOME_TITLE'); - - const body = util.createChild(message, 'body2-primary'); - - const text = util.createChild(body, 'drive-welcome-text'); - text.innerHTML = str(messageId); - - const links = util.createChild(body, 'drive-welcome-links'); - - // Hide link if it's trimmed by line-clamp so it does not get focus - // and break ellipsis render. - this.hideOverflowedElement(links, body); - - const buttonGroup = util.createChild(wrapper, 'button-group', 'div'); - - const close = - util.createChild(buttonGroup, 'banner-close text-button', 'cr-button'); - close.innerHTML = str('DRIVE_WELCOME_DISMISS'); - - close.setAttribute('aria-label', str('DRIVE_WELCOME_DISMISS')); - close.id = 'welcome-dismiss'; - close.tabIndex = 0; - close.addEventListener('click', this.closeWelcomeBanner_.bind(this)); - - const more = util.createChild(links, 'plain-link', 'a'); - more.textContent = str('DRIVE_LEARN_MORE'); - more.href = str('GOOGLE_DRIVE_OVERVIEW_URL'); - more.tabIndex = 0; - more.id = 'drive-welcome-link'; - more.rel = 'opener'; - more.target = '_blank'; - - this.previousDirWasOnDrive_ = false; - } - - /** - * Show or hide the "Low Google Drive space" warning. - * @param {boolean} show True if the box need to be shown. - * @param {Object=} opt_sizeStats Size statistics. Should be defined when - * showing the warning. - * @private - */ - showLowDriveSpaceWarning_(show, opt_sizeStats) { - const box = this.document_.querySelector('#volume-space-warning'); - - // Avoid showing two banners. - // TODO(kaznacheev): Unify the low space warning and the promo header. - if (show) { - this.cleanupWelcomeBanner_(); - } - - if (box.hidden == !show) { - return; - } - - if (this.warningDismissedCounter_) { - if (opt_sizeStats && - // Quota had not changed - this.warningDismissedCounter_ == opt_sizeStats.totalSize && - opt_sizeStats.remainingSize / opt_sizeStats.totalSize < 0.15) { - // Since the last dismissal decision the quota has not changed AND - // the user did not free up significant space. Obey the dismissal. - show = false; - } else { - // Forget the dismissal. Warning will be shown again. - this.setWarningDismissedCounter_(0); - } - } - - box.textContent = ''; - if (show && opt_sizeStats) { - const icon = this.document_.createElement('div'); - icon.className = 'drive-icon'; - box.appendChild(icon); - - const text = this.document_.createElement('div'); - text.className = 'body2-primary'; - text.textContent = strf( - 'DRIVE_SPACE_AVAILABLE_LONG', - util.bytesToString(opt_sizeStats.remainingSize)); - util.setClampLine(text, '2'); - box.appendChild(text); - - const buttonGroup = this.document_.createElement('div'); - buttonGroup.className = 'button-group'; - box.appendChild(buttonGroup); - - const close = this.document_.createElement('cr-button'); - close.setAttribute('aria-label', str('DRIVE_WELCOME_DISMISS')); - close.id = 'drive-space-warning-dismiss'; - close.innerHTML = str('DRIVE_WELCOME_DISMISS'); - close.className = 'banner-close text-button'; - buttonGroup.appendChild(close); - - const link = this.document_.createElement('a'); - link.href = str('GOOGLE_DRIVE_BUY_STORAGE_URL'); - link.rel = 'opener'; - link.target = '_blank'; - const buyMore = this.document_.createElement('cr-button'); - buyMore.className = 'banner-button text-button'; - buyMore.textContent = str('DRIVE_BUY_MORE_SPACE_LINK'); - link.appendChild(buyMore); - buttonGroup.appendChild(link); - - const totalSize = opt_sizeStats.totalSize; - close.addEventListener('click', () => { - const values = {}; - values[DRIVE_WARNING_DISMISSED_KEY] = totalSize; - xfm.storage.local.set(values); - box.hidden = true; - this.requestRelayout_(100); - }); - } - - if (box.hidden != !show) { - box.hidden = !show; - this.requestRelayout_(100); - } - } - - /** - * Closes the holding space welcome banner. - * @private - */ - closeHoldingSpaceWelcomeBanner_() { - this.cleanupHoldingSpaceWelcomeBanner_(); - - // Stop showing the welcome banner. - this.setHoldingSpaceWelcomeBannerCounter_( - HOLDING_SPACE_WELCOME_BANNER_COUNTER_LIMIT); - } - - /** - * Closes the Drive Welcome banner. - * @private - */ - closeWelcomeBanner_() { - this.cleanupWelcomeBanner_(); - // Stop showing the welcome banner. - this.setWelcomeHeaderCounter_(WELCOME_HEADER_COUNTER_LIMIT); - } - - /** - * Shows or hides the welcome banner for drive. - * @private - */ - maybeShowDriveBanners_() { - this.ready_.then(() => { - if (!this.isOnCurrentProfileDrive()) { - // We are not on the drive file system. Do not show (close) the drive - // banners. - this.cleanupWelcomeBanner_(); - this.previousDirWasOnDrive_ = false; - this.offlineInfoBanner_.hidden = true; - return; - } - - const driveVolume = this.volumeManager_.getCurrentProfileVolumeInfo( - VolumeManagerCommon.VolumeType.DRIVE); - if (!driveVolume || driveVolume.error) { - // Drive is not mounted, so do nothing. - return; - } - - if (this.welcomeHeaderCounter_ < WELCOME_HEADER_COUNTER_LIMIT) { - this.maybeShowWelcomeBanner_(); - } - - if (util.isDriveDssPinEnabled() && - (this.offlineInfoBannerCounter_ < OFFLINE_INFO_BANNER_COUNTER_LIMIT || - this.hasShownOfflineInfoBanner_)) { - this.offlineInfoBanner_.hidden = false; - if (!this.hasShownOfflineInfoBanner_) { - this.hasShownOfflineInfoBanner_ = true; - this.setOfflineInfoBannerCounter_(this.offlineInfoBannerCounter_ + 1); - } - } - }); - } - - /** - * Shows or hides the welcome banner for holding space. - * @return {Promise<void>} - * @private - */ - async maybeShowHoldingSpaceWelcomeBanner_() { - await this.ready_; - - if (!this.showWelcome_) { - this.showHoldingSpaceWelcomeBanner_(false); - return; - } - - // The holding space feature is only allowed for specific volume types so - // its banner should only be shown for those volumes. Note that the holding - // space banner is explicitly disallowed from showing in `DRIVE` to prevent - // the possibility of it being shown alongside the Drive banner. - const allowedVolumeTypes = HoldingSpaceUtil.getAllowedVolumeTypes(); - const currentRootType = this.directoryModel_.getCurrentRootType(); - if (!util.isRecentRootType(currentRootType)) { - const volumeInfo = this.directoryModel_.getCurrentVolumeInfo(); - if (!volumeInfo || !allowedVolumeTypes.includes(volumeInfo.volumeType) || - volumeInfo.volumeType === VolumeManagerCommon.VolumeType.DRIVE) { - this.showHoldingSpaceWelcomeBanner_(false); - return; - } - } - - // The holding space banner should not be shown after having been shown - // enough times to reach the defined limit. Note that if the user explicitly - // dismisses the banner the counter will be set to the limit to prevent any - // additional showings. - if (this.holdingSpaceWelcomeBannerCounter_ >= - HOLDING_SPACE_WELCOME_BANNER_COUNTER_LIMIT) { - return; - } - - // If the holding space banner is already showing, don't increment the count - // of how many times it has been shown since this is likely only occurring - // due to directory change or some other event in which the banner never - // disappeared from the user's view. - if (!this.holdingSpaceWelcomeBanner_.hasAttribute('hidden')) { - return; - } - - this.setHoldingSpaceWelcomeBannerCounter_( - this.holdingSpaceWelcomeBannerCounter_ + 1); - this.prepareAndShowHoldingSpaceWelcomeBanner_(); - } - - /** - * Decides which banner should be shown, and show it. This method is designed - * to be called only from maybeShowDriveBanners_. - * @private - */ - maybeShowWelcomeBanner_() { - this.ready_.then(() => { - // We do not want to increment the counter when the user navigates - // between different directories on Drive, but we increment the counter - // once anyway to prevent the full page banner from showing. - if (!this.previousDirWasOnDrive_ || this.welcomeHeaderCounter_ == 0) { - this.setWelcomeHeaderCounter_(this.welcomeHeaderCounter_ + 1); - this.prepareAndShowWelcomeBanner_( - 'header', 'DRIVE_WELCOME_TEXT_SHORT_FILESNG'); - } - this.previousDirWasOnDrive_ = true; - }); - } - - /** - * Loads and displays Google Photos welcome banner if it should be shown. - * @private - */ - async maybeShowPhotosWelcomeBanner_() { - await this.ready_; - - if (!this.photosWelcomeBannerShouldBeVisible_()) { - return; - } - - const container = queryRequiredElement('#photos-welcome', this.document_); - const isVisible = container.className == ''; - if (!isVisible) { - this.setPhotosWelcomeCounter_(this.photosWelcomeCounter_ + 1); - } - - if (container.firstElementChild) { - // Banner already loaded in DOM. - container.className = ''; - return; - } - - const style = this.maybeAddStylesheet( - 'photos-welcome-style', constants.PHOTOS_WELCOME_CSS); - style.onload = () => { - // Unhide the element when the style is loaded so that unstyled elements - // don't appear before that. - container.hidden = false; - // Switch styles asynchronously so that the initial CSS transition - // animation works after unhiding the element. - setTimeout(() => container.className = '', 1); - }; - - const wrapper = util.createChild(container, 'photos-welcome-wrapper'); - util.createChild(wrapper, 'photos-welcome-icon'); - - const message = util.createChild(wrapper, 'photos-welcome-message'); - util.setClampLine(message, '2'); - - const title = util.createChild(message, 'photos-welcome-title headline2'); - title.textContent = str('PHOTOS_WELCOME_TITLE'); - - const body = util.createChild(message, 'body2-primary'); - - const text = util.createChild(body, 'photos-welcome-text'); - text.innerHTML = str('PHOTOS_WELCOME_TEXT'); - - const buttonGroup = util.createChild(wrapper, 'button-group', 'div'); - - const close = - util.createChild(buttonGroup, 'banner-close text-button', 'cr-button'); - close.innerHTML = str('PHOTOS_WELCOME_DISMISS'); - - close.setAttribute('aria-label', str('PHOTOS_WELCOME_DISMISS')); - close.id = 'photos-welcome-dismiss'; - close.tabIndex = 0; - close.addEventListener('click', () => this.closePhotosWelcomeBanner_()); - } - - /** - * Hides Google Photos welcome banner if it should not be shown. - * @private - */ - maybeHidePhotosWelcomeBanner_() { - if (this.photosWelcomeBannerShouldBeVisible_()) { - return; - } - const container = queryRequiredElement('#photos-welcome', this.document_); - container.className = 'photos-welcome-hidden'; - } - - /** - * Closes Google Photos welcome banner and make sure it does not reopen. - * @private - */ - closePhotosWelcomeBanner_() { - this.setPhotosWelcomeCounter_(PHOTOS_WELCOME_COUNTER_LIMIT); - this.maybeHidePhotosWelcomeBanner_(); - } - - /** - * @return {boolean} True if Google Photos welcome banner should be displayed - * for the current directory. - * @private - */ - photosWelcomeBannerShouldBeVisible_() { - return this.isOnDocumentsProviderGooglePhotos() && - this.photosWelcomeCounter_ < PHOTOS_WELCOME_COUNTER_LIMIT; - } - - /** - * Shows trash delete forever after 30d banner if Trash is selected. - * @param {Event} event The directory-changed event. - * @private - */ - maybeShowTrashBanner_(event) { - this.document_.querySelector('#trash-deleted-forever').hidden = - event.newDirEntry.rootType !== VolumeManagerCommon.RootType.TRASH; - } - - /** - * @return {boolean} True if current directory is on Drive root of current - * profile. - */ - isOnCurrentProfileDrive() { - const entry = this.directoryModel_.getCurrentDirEntry(); - if (!entry || util.isFakeEntry(entry)) { - return false; - } - const locationInfo = this.volumeManager_.getLocationInfo(entry); - if (!locationInfo) { - return false; - } - return locationInfo.rootType === VolumeManagerCommon.RootType.DRIVE && - locationInfo.volumeInfo.profile.isCurrentProfile; - } - - /** - * @return {boolean} True if current directory is on Google Photos - * DocumentsProvider. - * @private - */ - isOnDocumentsProviderGooglePhotos() { - const entry = this.directoryModel_.getCurrentDirEntry(); - if (!entry || util.isFakeEntry(entry)) { - return false; - } - const locationInfo = this.volumeManager_.getLocationInfo(entry); - if (!locationInfo) { - return false; - } - return locationInfo.rootType === - VolumeManagerCommon.RootType.DOCUMENTS_PROVIDER && - locationInfo.volumeInfo.volumeId === - VolumeManagerCommon.PHOTOS_DOCUMENTS_PROVIDER_VOLUME_ID; - } - - /** - * Shows (or hides) the holding space welcome banner. - * @param {boolean} show - * @private - */ - showHoldingSpaceWelcomeBanner_(show) { - const /** boolean */ hidden = !show; - if (this.holdingSpaceWelcomeBanner_.hasAttribute('hidden') == hidden) { - return; - } - - if (hidden) { - this.holdingSpaceWelcomeBanner_.setAttribute('hidden', ''); - } else { - this.holdingSpaceWelcomeBanner_.removeAttribute('hidden'); - HoldingSpaceUtil.maybeStoreTimeOfFirstWelcomeBannerShow(); - } - - this.requestRelayout_(200); // Resize only after the animation is done. - } - - /** - * Shows the Drive Welcome banner. - * @param {string} type 'page'|'head'|'none'. - * @private - */ - showWelcomeBanner_(type) { - const container = this.document_.querySelector('.dialog-container'); - if (container.getAttribute('drive-welcome') != type) { - container.setAttribute('drive-welcome', type); - this.requestRelayout_(200); // Resize only after the animation is done. - } - } - - /** - * Update the UI when the current directory changes. - * - * @param {Event} event The directory-changed event. - * @private - */ - onDirectoryChanged_(event) { - this.maybeHidePhotosWelcomeBanner_(); - this.maybeShowTrashBanner_(event); - - const rootVolume = this.volumeManager_.getVolumeInfo(event.newDirEntry); - if (!rootVolume) { - return; - } - const previousRootVolume = event.previousDirEntry ? - this.volumeManager_.getVolumeInfo(event.previousDirEntry) : - null; - - // Show (or hide) the low space warning. - this.maybeShowLowSpaceWarning_(rootVolume); - - // Add or remove listener to show low space warning, if necessary. - const isLowSpaceWarningTarget = this.isLowSpaceWarningTarget_(rootVolume); - if (isLowSpaceWarningTarget !== - this.isLowSpaceWarningTarget_(previousRootVolume)) { - if (isLowSpaceWarningTarget) { - chrome.fileManagerPrivate.onDirectoryChanged.addListener( - this.privateOnDirectoryChangedBound_); - } else { - chrome.fileManagerPrivate.onDirectoryChanged.removeListener( - this.privateOnDirectoryChangedBound_); - } - } - - if (!this.isOnCurrentProfileDrive()) { - this.cleanupWelcomeBanner_(); - this.authFailedBanner_.hidden = true; - } - - this.updateDriveUnmountedPanel_(); - if (this.isOnCurrentProfileDrive()) { - this.unmountedPanel_.classList.remove('retry-enabled'); - this.maybeShowAuthFailBanner_(); - } - } - - /** - * @param {VolumeInfo} volumeInfo Volume info to be checked. - * @return {boolean} true if the file system specified by |root| is a target - * to show low space warning. Otherwise false. - * @private - */ - isLowSpaceWarningTarget_(volumeInfo) { - if (!volumeInfo) { - return false; - } - return volumeInfo.profile.isCurrentProfile && - (volumeInfo.volumeType === VolumeManagerCommon.VolumeType.DOWNLOADS || - volumeInfo.volumeType === VolumeManagerCommon.VolumeType.DRIVE); - } - - /** - * Callback which is invoked when the file system has been changed. - * @param {Object} event chrome.fileManagerPrivate.onDirectoryChanged event. - * @private - */ - privateOnDirectoryChanged_(event) { - const currentDirEntry = this.directoryModel_.getCurrentDirEntry(); - if (!currentDirEntry) { - return; - } - const currentVolume = this.volumeManager_.getVolumeInfo(currentDirEntry); - if (!currentVolume) { - return; - } - const eventVolume = this.volumeManager_.getVolumeInfo(event.entry); - if (currentVolume === eventVolume) { - // The file system we are currently on is changed. - // So, check the free space. - this.maybeShowLowSpaceWarning_(currentVolume); - } - } - - /** - * Shows or hides the low space warning. - * @param {VolumeInfo} volume Type of volume, which we are interested in. - * @private - */ - maybeShowLowSpaceWarning_(volume) { - // Never show low space warning banners in a test as it will cause flakes. - // TODO(crbug.com/1146265): Somehow figure out a way to test these banners. - if (window.IN_TEST) { - return; - } - - // TODO(kaznacheev): Unify the two low space warning. - switch (volume.volumeType) { - case VolumeManagerCommon.VolumeType.DOWNLOADS: - this.showLowDriveSpaceWarning_(false); - break; - case VolumeManagerCommon.VolumeType.DRIVE: - this.showLowDownloadsSpaceWarning_(false); - break; - default: - // If the current file system is neither the DOWNLOAD nor the DRIVE, - // just hide the warning. - this.showLowDownloadsSpaceWarning_(false); - this.showLowDriveSpaceWarning_(false); - return; - } - - // If not mounted correctly, then do not continue. - if (!volume.fileSystem) { - return; - } - - chrome.fileManagerPrivate.getSizeStats(volume.volumeId, sizeStats => { - const currentVolume = this.volumeManager_.getVolumeInfo( - assert(this.directoryModel_.getCurrentDirEntry())); - if (volume !== currentVolume) { - // This happens when the current directory is moved during requesting - // the file system size. Just ignore it. - return; - } - // sizeStats is undefined, if some error occurs. - if (!sizeStats || sizeStats.totalSize == 0) { - return; - } - - if (volume.volumeType === VolumeManagerCommon.VolumeType.DOWNLOADS) { - // Show the warning banner when the available space is less than 1GB. - this.showLowDownloadsSpaceWarning_( - sizeStats.remainingSize < DOWNLOADS_SPACE_WARNING_THRESHOLD_SIZE); - } else { - // Show the warning banner when the available space ls less than 10%. - const remainingRatio = sizeStats.remainingSize / sizeStats.totalSize; - this.showLowDriveSpaceWarning_( - remainingRatio < DRIVE_SPACE_WARNING_THRESHOLD_RATIO, sizeStats); - } - }); - } - - /** - * Removes the holding space welcome banner. - * @private - */ - cleanupHoldingSpaceWelcomeBanner_() { - this.showHoldingSpaceWelcomeBanner_(false); - } - - /** - * removes the Drive Welcome banner. - * @private - */ - cleanupWelcomeBanner_() { - this.showWelcomeBanner_('none'); - } - - /** - * Notifies the file manager what layout must be recalculated. - * @param {number} delay In milliseconds. - * @private - */ - requestRelayout_(delay) { - const self = this; - setTimeout(() => { - dispatchSimpleEvent(self, 'relayout'); - }, delay); - } - - /** - * Show or hide the "Low disk space" warning. - * @param {boolean} show True if the box need to be shown. - * @private - */ - showLowDownloadsSpaceWarning_(show) { - const box = this.document_.querySelector('.downloads-warning'); - - if (box.hidden == !show) { - return; - } - - if (this.downloadsWarningDismissedTime_) { - if (Date.now() - this.downloadsWarningDismissedTime_ < - DOWNLOADS_SPACE_WARNING_DISMISS_DURATION) { - show = false; - } - } - - box.textContent = ''; - if (show) { - const icon = this.document_.createElement('div'); - icon.className = 'warning-icon'; - const message = this.document_.createElement('div'); - message.className = 'warning-message'; - message.className += ' body2-primary'; - message.innerHTML = - util.htmlUnescape(str('DOWNLOADS_DIRECTORY_WARNING_FILESNG')); - util.setClampLine(message, '2'); - - // Wrap a div around link. - const link = message.querySelector('a'); - const linkWrapper = this.document_.createElement('div'); - linkWrapper.className = 'link-wrapper'; - message.appendChild(linkWrapper); - linkWrapper.appendChild(link); - - // Hide the link if it's trimmed by line-clamp so it does not get focus - // and break ellipsis render. - this.hideOverflowedElement(linkWrapper, message); - - box.appendChild(icon); - box.appendChild(message); - box.querySelector('a').addEventListener('click', e => { - util.visitURL(str('DOWNLOADS_LOW_SPACE_WARNING_HELP_URL')); - e.preventDefault(); - }); - - const buttonGroup = this.document_.createElement('div'); - buttonGroup.className = 'button-group'; - box.appendChild(buttonGroup); - - const closeType = 'cr-button'; - const close = this.document_.createElement(closeType); - close.className = 'banner-close'; - close.setAttribute('aria-label', str('DRIVE_WELCOME_DISMISS')); - close.id = 'downloads-space-warning-dismiss'; - close.innerHTML = str('DRIVE_WELCOME_DISMISS'); - close.className = 'banner-close text-button'; - buttonGroup.appendChild(close); - close.addEventListener('click', () => { - const values = {}; - values[DOWNLOADS_WARNING_DISMISSED_KEY] = Date.now(); - xfm.storage.local.set(values); - box.hidden = true; - // We explicitly mark the banner-close element as hidden as due to the - // use of position absolute in it's layout it does not get hidden by - // hiding it's parent. - close.hidden = true; - this.requestRelayout_(100); - }); - } - - box.hidden = !show; - this.requestRelayout_(100); - } - - /** - * Creates contents for the DRIVE unmounted panel. - * @private - */ - ensureDriveUnmountedPanelInitialized_() { - const panel = this.unmountedPanel_; - if (panel.firstElementChild) { - return; - } - - /** - * Creates an element using given parameters. - * @param {!Element} parent Parent element of the new element. - * @param {string} tag Tag of the new element. - * @param {string} className Class name of the new element. - * @param {string=} opt_textContent Text content of the new element. - * @return {!Element} The newly created element. - */ - const create = (parent, tag, className, opt_textContent) => { - const div = panel.ownerDocument.createElement(tag); - div.className = className; - div.textContent = opt_textContent || ''; - parent.appendChild(div); - return div; - }; - - create(panel, 'div', 'error', str('DRIVE_CANNOT_REACH')); - - const learnMore = - create(panel, 'a', 'learn-more plain-link', str('DRIVE_LEARN_MORE')); - learnMore.href = str('GOOGLE_DRIVE_ERROR_HELP_URL'); - learnMore.rel = 'opener'; - learnMore.target = '_blank'; - } - - /** - * Called when volume info list is updated. - * @param {Event} event Splice event data on volume info list. - * @private - */ - onVolumeInfoListSplice_(event) { - const isDriveVolume = volumeInfo => { - return volumeInfo.volumeType === VolumeManagerCommon.VolumeType.DRIVE; - }; - if (event.removed.some(isDriveVolume) || event.added.some(isDriveVolume)) { - this.updateDriveUnmountedPanel_(); - } - } - - /** - * Shows the panel when current directory is DRIVE and it's unmounted. - * Hides it otherwise. The panel shows an error message if it failed. - * @private - */ - updateDriveUnmountedPanel_() { - const node = this.document_.body; - if (this.isOnCurrentProfileDrive()) { - const driveVolume = this.volumeManager_.getCurrentProfileVolumeInfo( - VolumeManagerCommon.VolumeType.DRIVE); - if (driveVolume) { - if (driveVolume.error) { - this.ensureDriveUnmountedPanelInitialized_(); - this.unmountedPanel_.classList.add('retry-enabled'); - node.setAttribute('drive', 'error'); - } else { - node.setAttribute('drive', 'mounted'); - } - } else { - this.unmountedPanel_.classList.remove('retry-enabled'); - node.setAttribute('drive', 'unmounted'); - } - } else { - node.removeAttribute('drive'); - } - } - - /** - * Updates the visibility of Drive Connection Warning banner, retrieving the - * current connection information. - * @private - */ - maybeShowAuthFailBanner_() { - const connection = this.volumeManager_.getDriveConnectionState(); - const showDriveNotReachedMessage = this.isOnCurrentProfileDrive() && - connection.type == - chrome.fileManagerPrivate.DriveConnectionStateType.OFFLINE && - connection.reason == - chrome.fileManagerPrivate.DriveOfflineReason.NOT_READY; - this.authFailedBanner_.hidden = !showDriveNotReachedMessage; - } - - /** - * Hides element if it has overflowed its container after resizing. - * - * @param {!Element} element The element to hide. - * @param {!Element} container The container to observe overflow. - */ - hideOverflowedElement(element, container) { - const observer = new ResizeObserver(() => { - if (util.hasOverflow(container)) { - element.style.visibility = 'hidden'; - } else { - element.style.visibility = 'visible'; - } - }); - observer.observe(container); - } -}
diff --git a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js index 5d2e32d1..14b87aa 100644 --- a/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js +++ b/ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
@@ -25,7 +25,6 @@ import {A11yAnnounce} from './a11y_announce.js'; import {ActionModelUI} from './action_model_ui.js'; import {ActionsSubmenu} from './actions_submenu.js'; -import {Banners} from './banners.js'; import {ComboButton} from './combobutton.js'; import {DefaultTaskDialog} from './default_task_dialog.js'; import {DialogFooter} from './dialog_footer.js'; @@ -333,7 +332,7 @@ /** * Banners in the file list. - * @type {Banners|BannerController} + * @type {BannerController} */ this.banners = null; @@ -541,7 +540,7 @@ /** * TODO(mtomasz): Merge the method into initAdditionalUI if possible. - * @param {!Banners|!BannerController} banners + * @param {!BannerController} banners */ initBanners(banners) { this.banners = banners;
diff --git a/ui/file_manager/file_manager/main.html b/ui/file_manager/file_manager/main.html index 2653ca4..fb612a6 100644 --- a/ui/file_manager/file_manager/main.html +++ b/ui/file_manager/file_manager/main.html
@@ -514,33 +514,6 @@ <div class="main-panel"> <div class="filelist-panel"> <div id="banners"></div> - <div class="drive-welcome header"></div> - <div id="photos-welcome" class="photos-welcome-hidden" hidden></div> - <div class="holding-space-welcome" hidden style="height: 0; opacity: 0;"></div> - <div class="volume-warning banner-cloud-bg" id="volume-space-warning" hidden></div> - <div class="volume-warning banner-cloud-bg" id="drive-auth-failed-warning" hidden> - <div class="drive-icon"></div> - <div class="drive-text" id="drive-auth-failed-warning-text"></div> - </div> - <div class="volume-warning" id="offline-info-banner" hidden> - <div class="info-icon"></div> - <div id="offline-info-banner-text" class="body2-primary"> - $i18n{OFFLINE_BANNER_MESSAGE} - </div> - <div class="button-group"> - <cr-button id="offline-learn-more" class="banner-close text-button" - aria-labelledby="offline-info-banner-text" - aria-describedby="offline-learn-more" - aria-disabled="false" role="button" tabindex="0"> - $i18n{DRIVE_LEARN_MORE} - </cr-button> - </div> - </div> - <div class="downloads-warning" hidden></div> - <div id="trash-deleted-forever" class="trash-warning" hidden> - $i18n{TRASH_DELETED_FOREVER} - </div> - <files-message id='files-message' hidden></files-message> <div id="file-type-filter-container" hidden></div> <div id="list-container" role="main"> <div id="more-actions-info" hidden>$i18n{SEE_MENU_FOR_ACTIONS}</div> @@ -556,7 +529,6 @@ </div> </div> </div> - <div id="unmounted-panel"></div> <div id="format-panel"> <div class="error"></div> <button id="format-button" command="#format"></button>
diff --git a/ui/file_manager/file_manager_resources.grd b/ui/file_manager/file_manager_resources.grd index f2a18d8a..3bf2b13a 100644 --- a/ui/file_manager/file_manager_resources.grd +++ b/ui/file_manager/file_manager_resources.grd
@@ -29,11 +29,6 @@ <include name="IDR_FILE_MANAGER_ICON_192" file="file_manager/common/images/icon192.png" type="BINDATA" /> <include name="IDR_FILE_MANAGER_ICON_256" file="file_manager/common/images/icon256.png" type="BINDATA" /> - <!-- Resources used for non-flattened HTML files. --> - <include name="IDR_FILE_MANAGER_DRIVE_WELCOME_STYLE" file="file_manager/foreground/css/drive_welcome.css" type="BINDATA" /> - <include name="IDR_FILE_MANAGER_HOLDING_SPACE_WELCOME_STYLE" file="file_manager/foreground/css/holding_space_welcome.css" type="BINDATA" /> - <include name="IDR_FILE_MANAGER_PHOTOS_WELCOME_STYLE" file="file_manager/foreground/css/photos_welcome.css" type="BINDATA" /> - <!-- The AudioPlayer app pages and scripts. --> <include name="IDR_AUDIO_PLAYER_MANIFEST" file="audio_player/manifest.json" type="BINDATA" /> <include name="IDR_AUDIO_PLAYER_BACKGROUND_HTML" file="audio_player/background.html" type="BINDATA" />
diff --git a/ui/file_manager/integration_tests/file_manager/android_photos.js b/ui/file_manager/integration_tests/file_manager/android_photos.js index 04561009..c78ef301 100644 --- a/ui/file_manager/integration_tests/file_manager/android_photos.js +++ b/ui/file_manager/integration_tests/file_manager/android_photos.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addEntries, ENTRIES, RootPath, sendTestMessage} from '../test_util.js'; +import {addEntries, ENTRIES, RootPath} from '../test_util.js'; import {testcase} from '../testcase.js'; import {openNewWindow, remoteCall} from './background.js'; @@ -19,9 +19,6 @@ // Open Files app. const appId = await openNewWindow(RootPath.DOWNLOADS); - const isBannersFrameworkEnabled = - (await sendTestMessage({name: 'isBannersFrameworkEnabled'})) === 'true'; - const click = async (query) => { chrome.test.assertTrue( !!await remoteCall.callRemoteTestUtil('fakeMouseClick', appId, [query]), @@ -37,30 +34,21 @@ await remoteCall.waitForElement(appId, `#file-list [file-name="${name}"]`); }; - let photosBannerHiddenQuery = '#photos-welcome.photos-welcome-hidden'; - let photosBannerShownQuery = '#photos-welcome:not(.photos-welcome-hidden)'; - let photosBannerTextQuery = '.photos-welcome-message'; - let photosBannerDismissButton = '#photos-welcome-dismiss'; - if (isBannersFrameworkEnabled) { - await remoteCall.isolateBannerForTesting(appId, 'photos-welcome-banner'); - photosBannerHiddenQuery = '#banners > photos-welcome-banner[hidden]'; - photosBannerShownQuery = '#banners > photos-welcome-banner:not([hidden])'; - photosBannerTextQuery = [ - '#banners > photos-welcome-banner', 'educational-banner', - '#educational-text-group' - ]; - photosBannerDismissButton = [ - '#banners > photos-welcome-banner', 'educational-banner', - '#dismiss-button' - ]; - } + await remoteCall.isolateBannerForTesting(appId, 'photos-welcome-banner'); + const photosBannerHiddenQuery = '#banners > photos-welcome-banner[hidden]'; + const photosBannerShownQuery = + '#banners > photos-welcome-banner:not([hidden])'; + const photosBannerTextQuery = [ + '#banners > photos-welcome-banner', 'educational-banner', + '#educational-text-group' + ]; + const photosBannerDismissButton = [ + '#banners > photos-welcome-banner', 'educational-banner', '#dismiss-button' + ]; // Initial state: In the new framework banner is lazily loaded so will not be // attached to the DOM, without the banners framework the root element should // exist but the text should not be attached yet. - if (!isBannersFrameworkEnabled) { - await waitForElement('#photos-welcome[hidden]'); - } await waitForElementLost(photosBannerTextQuery); // Wait for the DocumentsProvider volume to mount and navigate to Photos.
diff --git a/ui/file_manager/integration_tests/file_manager/crostini.js b/ui/file_manager/integration_tests/file_manager/crostini.js index 816c16e6..1aed4a75 100644 --- a/ui/file_manager/integration_tests/file_manager/crostini.js +++ b/ui/file_manager/integration_tests/file_manager/crostini.js
@@ -45,20 +45,14 @@ '[command="#share-with-linux"]:not([hidden]):not([disabled])'; const menuNoShareWithLinux = '#file-context-menu:not([hidden]) ' + '[command="#share-with-linux"][hidden][disabled="disabled"]'; - const shareMessageHidden = '#files-message[hidden]'; - let shareMessageShown = '#files-message:not([hidden])'; + const shareMessageShown = + '#banners > shared-with-crostini-pluginvm-banner:not([hidden])'; const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.photos], []); - const isBannersFrameworkEnabled = - await sendTestMessage({name: 'isBannersFrameworkEnabled'}) === 'true'; - if (isBannersFrameworkEnabled) { - await remoteCall.isolateBannerForTesting( - appId, 'shared-with-crostini-pluginvm-banner'); - shareMessageShown = - '#banners > shared-with-crostini-pluginvm-banner:not([hidden])'; - } + await remoteCall.isolateBannerForTesting( + appId, 'shared-with-crostini-pluginvm-banner'); // Ensure fake Linux files root is shown. await remoteCall.waitForElement(appId, FAKE_LINUX_FILES); @@ -87,12 +81,8 @@ await remoteCall.waitForElement(appId, menuNoShareWithLinux); // Click 'photos' to go in photos directory, ensure share message is shown. - if (isBannersFrameworkEnabled) { - await remoteCall.waitForElementLost( - appId, '#banners > shared-with-crostini-pluginvm-banner'); - } else { - await remoteCall.waitForElement(appId, shareMessageHidden); - } + await remoteCall.waitForElementLost( + appId, '#banners > shared-with-crostini-pluginvm-banner'); remoteCall.callRemoteTestUtil('fakeMouseDoubleClick', appId, [photos]); await remoteCall.waitForElement(appId, shareMessageShown); };
diff --git a/ui/file_manager/integration_tests/file_manager/drive_specific.js b/ui/file_manager/integration_tests/file_manager/drive_specific.js index d4659d6..4076529 100644 --- a/ui/file_manager/integration_tests/file_manager/drive_specific.js +++ b/ui/file_manager/integration_tests/file_manager/drive_specific.js
@@ -831,18 +831,11 @@ // Open Files app on Drive. const appId = await setupAndWaitUntilReady(RootPath.DRIVE, []); - const isBannersFrameworkEnabled = - (await sendTestMessage({name: 'isBannersFrameworkEnabled'})) === 'true'; - - let driveWelcomeBannerQuery = '.drive-welcome-wrapper'; - let driveWelcomeBannerDismissButtonQuery = ['cr-button.banner-close']; - if (isBannersFrameworkEnabled) { - await remoteCall.isolateBannerForTesting(appId, 'drive-welcome-banner'); - driveWelcomeBannerQuery = '#banners > drive-welcome-banner'; - driveWelcomeBannerDismissButtonQuery = [ - '#banners > drive-welcome-banner', 'educational-banner', '#dismiss-button' - ]; - } + await remoteCall.isolateBannerForTesting(appId, 'drive-welcome-banner'); + const driveWelcomeBannerQuery = '#banners > drive-welcome-banner'; + const driveWelcomeBannerDismissButtonQuery = [ + '#banners > drive-welcome-banner', 'educational-banner', '#dismiss-button' + ]; // Open the Drive volume in the files-list. chrome.test.assertTrue(await remoteCall.callRemoteTestUtil( @@ -855,22 +848,8 @@ await remoteCall.waitAndClickElement( appId, driveWelcomeBannerDismissButtonQuery); - if (isBannersFrameworkEnabled) { - await remoteCall.waitForElement( - appId, '#banners > drive-welcome-banner[hidden]'); - return; - } - - // Check: the Drive banner should close. - const caller = getCaller(); - await repeatUntil(async () => { - const banner = await remoteCall.waitForElementStyles( - appId, '.drive-welcome', ['visibility']); - - if (banner.styles.visibility !== 'hidden') { - return pending(caller, 'Welcome banner is still visible.'); - } - }); + await remoteCall.waitForElement( + appId, '#banners > drive-welcome-banner[hidden]'); }; /** @@ -881,20 +860,14 @@ // Open Files app on Drive. const appId = await setupAndWaitUntilReady(RootPath.DRIVE, []); - let driveOfflineBannerShownQuery = '#offline-info-banner:not([hidden])'; - let driveOfflineBannerHiddenQuery = '#offline-info-banner[hidden]'; - let driveOfflineLearnMoreLinkQuery = '#offline-learn-more'; - - if ((await sendTestMessage({name: 'isBannersFrameworkEnabled'})) === 'true') { - await remoteCall.isolateBannerForTesting( - appId, 'drive-offline-pinning-banner'); - driveOfflineBannerShownQuery = - '#banners > drive-offline-pinning-banner:not([hidden])'; - driveOfflineBannerHiddenQuery = - '#banners > drive-offline-pinning-banner[hidden]'; - driveOfflineLearnMoreLinkQuery = - ['#banners > drive-offline-pinning-banner', '[slot="extra-button"]']; - } + await remoteCall.isolateBannerForTesting( + appId, 'drive-offline-pinning-banner'); + const driveOfflineBannerShownQuery = + '#banners > drive-offline-pinning-banner:not([hidden])'; + const driveOfflineBannerHiddenQuery = + '#banners > drive-offline-pinning-banner[hidden]'; + const driveOfflineLearnMoreLinkQuery = + ['#banners > drive-offline-pinning-banner', '[slot="extra-button"]']; // Check: the Drive Offline info banner should appear. await remoteCall.waitForElement(appId, driveOfflineBannerShownQuery); @@ -920,13 +893,10 @@ // Open Files app on Drive. const appId = await setupAndWaitUntilReady(RootPath.DRIVE, []); - let driveOfflineInfoBannerHiddenQuery = '#offline-info-banner:not([hidden])'; - if ((await sendTestMessage({name: 'isBannersFrameworkEnabled'})) === 'true') { - await remoteCall.isolateBannerForTesting( - appId, 'drive-offline-pinning-banner'); - driveOfflineInfoBannerHiddenQuery = - '#banners > drive-offline-pinning-banner'; - } + await remoteCall.isolateBannerForTesting( + appId, 'drive-offline-pinning-banner'); + const driveOfflineInfoBannerHiddenQuery = + '#banners > drive-offline-pinning-banner'; // Check: the Drive Offline info banner should not appear. await remoteCall.waitForElementLost(appId, driveOfflineInfoBannerHiddenQuery);
diff --git a/ui/file_manager/integration_tests/file_manager/grid_view.js b/ui/file_manager/integration_tests/file_manager/grid_view.js index df342a2..a8646ce6 100644 --- a/ui/file_manager/integration_tests/file_manager/grid_view.js +++ b/ui/file_manager/integration_tests/file_manager/grid_view.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addEntries, ENTRIES, getCaller, pending, repeatUntil, RootPath, sendTestMessage, TestEntryInfo} from '../test_util.js'; +import {addEntries, ENTRIES, getCaller, pending, repeatUntil, RootPath, TestEntryInfo} from '../test_util.js'; import {testcase} from '../testcase.js'; import {openNewWindow, remoteCall, setupAndWaitUntilReady} from './background.js'; @@ -25,20 +25,8 @@ // Open Files app on |rootPath|. const appId = await setupAndWaitUntilReady(rootPath); - const isBannersFrameworkEnabled = - await sendTestMessage({name: 'isBannersFrameworkEnabled'}) === 'true'; - // Disable all banners. - if (isBannersFrameworkEnabled) { - await remoteCall.disableBannersForTesting(appId); - } - - // Dismiss the Drive banners so Grid View can display the all entries. - if (rootPath === RootPath.DRIVE && !isBannersFrameworkEnabled) { - await remoteCall.waitAndClickElement( - appId, '.drive-welcome-wrapper .banner-close'); - await remoteCall.waitAndClickElement(appId, '#offline-learn-more'); - } + await remoteCall.disableBannersForTesting(appId); // Click the grid view button. await remoteCall.waitForElement(appId, '#view-button');
diff --git a/ui/file_manager/integration_tests/file_manager/holding_space.js b/ui/file_manager/integration_tests/file_manager/holding_space.js index 84a3def..af5186d 100644 --- a/ui/file_manager/integration_tests/file_manager/holding_space.js +++ b/ui/file_manager/integration_tests/file_manager/holding_space.js
@@ -5,7 +5,7 @@ import {getCaller, pending, repeatUntil, RootPath, sendTestMessage} from '../test_util.js'; import {testcase} from '../testcase.js'; -import {navigateWithDirectoryTree, openNewWindow, remoteCall, setupAndWaitUntilReady} from './background.js'; +import {navigateWithDirectoryTree, remoteCall, setupAndWaitUntilReady} from './background.js'; import {waitForDialog} from './file_dialog.js'; /** @@ -16,22 +16,16 @@ // Open Files app on Downloads. const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS); - let holdingSpaceBannerShown = '.holding-space-welcome:not([hidden][style])'; - let holdingSpaceBannerDismissButton = - '.holding-space-welcome cr-button.text-button'; - let holdingSpaceBannerHidden = '.holding-space-welcome[hidden]'; - if (await sendTestMessage({name: 'isBannersFrameworkEnabled'}) === 'true') { - await remoteCall.isolateBannerForTesting( - appId, 'holding-space-welcome-banner'); - holdingSpaceBannerShown = - '#banners > holding-space-welcome-banner:not([hidden])'; - holdingSpaceBannerDismissButton = [ - '#banners > holding-space-welcome-banner', 'educational-banner', - '#dismiss-button' - ]; - holdingSpaceBannerHidden = - '#banners > holding-space-welcome-banner[hidden]'; - } + await remoteCall.isolateBannerForTesting( + appId, 'holding-space-welcome-banner'); + const holdingSpaceBannerShown = + '#banners > holding-space-welcome-banner:not([hidden])'; + const holdingSpaceBannerDismissButton = [ + '#banners > holding-space-welcome-banner', 'educational-banner', + '#dismiss-button' + ]; + const holdingSpaceBannerHidden = + '#banners > holding-space-welcome-banner[hidden]'; // Check: the holding space welcome banner should appear. Note that inline // styles are removed once dynamic styles have finished loading. @@ -45,48 +39,6 @@ }; /** - * Tests that the holding space welcome banner will not continue to show after - * having been explicitly dismissed by the user. - */ -testcase.holdingSpaceWelcomeBannerWontShowAfterBeingDismissed = async () => { - // Open Files app on Downloads. - const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS); - - // Check: the holding space welcome banner should appear. - await remoteCall.waitForElement( - appId, '.holding-space-welcome:not([hidden])'); - - // Dismiss the holding space welcome banner. - await remoteCall.waitAndClickElement( - appId, '.holding-space-welcome cr-button.text-button'); - - // Check: the holding space welcome banner should be hidden. - await remoteCall.waitForElement(appId, '.holding-space-welcome[hidden]'); - - // Change to My Files folder. - await navigateWithDirectoryTree(appId, '/My files'); - - // Check: the holding space welcome banner should still be hidden. - await remoteCall.waitForElementLost(appId, '.holding-space-welcome[style]'); - await remoteCall.waitForElement(appId, '.holding-space-welcome[hidden]'); -}; - -/** - * Tests that the holding space welcome banner will not show for modal dialogs. - */ -testcase.holdingSpaceWelcomeBannerWontShowForModalDialogs = async () => { - // Open Save as dialog. - chrome.fileSystem.chooseEntry({type: 'saveFile'}, entry => {}); - const appId = await waitForDialog(); - - // Wait to finish initial load. - await remoteCall.waitFor('isFileManagerLoaded', appId, true); - - // Check: the holding space welcome banner should be hidden. - await remoteCall.waitForElement(appId, '.holding-space-welcome[hidden]'); -}; - -/** * Tests that the holding space welcome banner will show for modal dialogs when * using the new banners framework. */ @@ -108,24 +60,6 @@ }; /** - * Tests that the holding space welcome banner will not show on Drive. - */ -testcase.holdingSpaceWelcomeBannerWontShowOnDrive = async () => { - // Open Files app on Downloads. - const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS); - - // Check: the holding space welcome banner should appear. - await remoteCall.waitForElement( - appId, '.holding-space-welcome:not([hidden])'); - - // Change to My Drive folder. - await navigateWithDirectoryTree(appId, '/My Drive'); - - // Check: the holding space welcome banner should be hidden. - await remoteCall.waitForElement(appId, '.holding-space-welcome[hidden]'); -}; - -/** * Tests that the holding space welcome banner will update its text depending on * whether or not tablet mode is enabled. */ @@ -153,26 +87,18 @@ }); } - const isBannersFrameworkEnabled = - await sendTestMessage({name: 'isBannersFrameworkEnabled'}) === 'true'; - // Cache queries for `text` and `textInTabletMode`. - let text = '.holding-space-welcome-text:not(.tablet-mode-enabled)'; - let textInTabletMode = '.holding-space-welcome-text.tablet-mode-enabled'; - let expectedTextDisplayValue = 'block'; - if (isBannersFrameworkEnabled) { - await remoteCall.isolateBannerForTesting( - appId, 'holding-space-welcome-banner'); - text = [ - '#banners > holding-space-welcome-banner:not([hidden])', - 'educational-banner > span[slot="subtitle"].tablet-mode-disabled' - ]; - textInTabletMode = [ - '#banners > holding-space-welcome-banner:not([hidden])', - 'educational-banner > span[slot="subtitle"].tablet-mode-enabled' - ]; - expectedTextDisplayValue = 'inline'; - } + await remoteCall.isolateBannerForTesting( + appId, 'holding-space-welcome-banner'); + const text = [ + '#banners > holding-space-welcome-banner:not([hidden])', + 'educational-banner > span[slot="subtitle"].tablet-mode-disabled' + ]; + const textInTabletMode = [ + '#banners > holding-space-welcome-banner:not([hidden])', + 'educational-banner > span[slot="subtitle"].tablet-mode-enabled' + ]; + const expectedTextDisplayValue = 'inline'; // Check: `text` should be displayed but `textInTabletMode` should not. await waitForElementWithDisplay(text, expectedTextDisplayValue); await waitForElementWithDisplay(textInTabletMode, 'none');
diff --git a/ui/file_manager/integration_tests/file_manager/tab_index.js b/ui/file_manager/integration_tests/file_manager/tab_index.js index 5d83c490..3178941 100644 --- a/ui/file_manager/integration_tests/file_manager/tab_index.js +++ b/ui/file_manager/integration_tests/file_manager/tab_index.js
@@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -import {addEntries, RootPath, sendTestMessage, TestEntryInfo} from '../test_util.js'; +import {addEntries, RootPath, TestEntryInfo} from '../test_util.js'; import {testcase} from '../testcase.js'; import {openAndWaitForClosingDialog, remoteCall, setupAndWaitUntilReady} from './background.js'; @@ -42,14 +42,8 @@ // Open Files app on Drive. const appId = await setupAndWaitUntilReady(RootPath.DRIVE); - const isBannersFrameworkEnabled = - await sendTestMessage({name: 'isBannersFrameworkEnabled'}) === 'true'; - - let driveWelcomeLinkQuery = '#drive-welcome-link'; - if (isBannersFrameworkEnabled) { - await remoteCall.isolateBannerForTesting(appId, 'drive-welcome-banner'); - driveWelcomeLinkQuery = '#banners > drive-welcome-banner:not([hidden])'; - } + await remoteCall.isolateBannerForTesting(appId, 'drive-welcome-banner'); + const driveWelcomeLinkQuery = '#banners > drive-welcome-banner:not([hidden])'; // Check that the file list has the focus on launch. await Promise.all([ @@ -71,17 +65,10 @@ await remoteCall.checkNextTabFocus(appId, 'sort-button')); chrome.test.assertTrue( await remoteCall.checkNextTabFocus(appId, 'gear-button')); - if (isBannersFrameworkEnabled) { - chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'drive-learn-more-button')); - chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'dismiss-button')); - } else { - chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'drive-welcome-link')); - chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'welcome-dismiss')); - } + chrome.test.assertTrue( + await remoteCall.checkNextTabFocus(appId, 'drive-learn-more-button')); + chrome.test.assertTrue( + await remoteCall.checkNextTabFocus(appId, 'dismiss-button')); chrome.test.assertTrue( await remoteCall.checkNextTabFocus(appId, 'file-list')); }; @@ -94,13 +81,8 @@ // Open Files app on Downloads. const appId = await setupAndWaitUntilReady(RootPath.DOWNLOADS); - const isBannersFrameworkEnabled = - await sendTestMessage({name: 'isBannersFrameworkEnabled'}) === 'true'; - - if (isBannersFrameworkEnabled) { - await remoteCall.isolateBannerForTesting( - appId, 'holding-space-welcome-banner'); - } + await remoteCall.isolateBannerForTesting( + appId, 'holding-space-welcome-banner'); // Check that the file list has the focus on launch. await remoteCall.waitForElement(appId, ['#file-list:focus']); @@ -121,13 +103,8 @@ await remoteCall.checkNextTabFocus(appId, 'sort-button')); chrome.test.assertTrue( await remoteCall.checkNextTabFocus(appId, 'gear-button')); - if (isBannersFrameworkEnabled) { - chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'dismiss-button')); - } else { - chrome.test.assertTrue(await remoteCall.checkNextTabFocus( - appId, 'holding-space-welcome-dismiss')); - } + chrome.test.assertTrue( + await remoteCall.checkNextTabFocus(appId, 'dismiss-button')); chrome.test.assertTrue( await remoteCall.checkNextTabFocus(appId, 'file-list')); }; @@ -139,14 +116,8 @@ // Open Files app on Drive. const appId = await setupAndWaitUntilReady(RootPath.DRIVE); - const isBannersFrameworkEnabled = - await sendTestMessage({name: 'isBannersFrameworkEnabled'}) === 'true'; - - let driveWelcomeLinkQuery = '#drive-welcome-link'; - if (isBannersFrameworkEnabled) { - await remoteCall.isolateBannerForTesting(appId, 'drive-welcome-banner'); - driveWelcomeLinkQuery = '#banners > drive-welcome-banner:not([hidden])'; - } + await remoteCall.isolateBannerForTesting(appId, 'drive-welcome-banner'); + const driveWelcomeLinkQuery = '#banners > drive-welcome-banner:not([hidden])'; // Check that the file list has the focus on launch. await Promise.all([ @@ -195,18 +166,10 @@ await remoteCall.checkNextTabFocus(appId, 'sort-button')); chrome.test.assertTrue( await remoteCall.checkNextTabFocus(appId, 'gear-button')); - if (isBannersFrameworkEnabled) { - chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'drive-learn-more-button')); - chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'dismiss-button')); - } else { - chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'drive-welcome-link')); - - chrome.test.assertTrue( - await remoteCall.checkNextTabFocus(appId, 'welcome-dismiss')); - } + chrome.test.assertTrue( + await remoteCall.checkNextTabFocus(appId, 'drive-learn-more-button')); + chrome.test.assertTrue( + await remoteCall.checkNextTabFocus(appId, 'dismiss-button')); chrome.test.assertTrue( await remoteCall.checkNextTabFocus(appId, 'file-list')); @@ -282,21 +245,13 @@ const tabindexIds = [ 'cancel-button', 'ok-button', 'directory-tree', /* first breadcrumb */ 'first', 'search-button', 'view-button', - 'sort-button', 'gear-button' + 'sort-button', 'gear-button', 'dismiss-button', 'file-list' ]; - const isBannersFrameworkEnabled = - await sendTestMessage({name: 'isBannersFrameworkEnabled'}) === 'true'; - if (isBannersFrameworkEnabled) { - tabindexIds.push('dismiss-button'); - } - tabindexIds.push('file-list'); return tabindexFocus( {type: 'openFile'}, 'downloads', BASIC_LOCAL_ENTRY_SET, async (appId) => { await remoteCall.callRemoteTestUtil('selectFile', appId, ['hello.txt']); - if (isBannersFrameworkEnabled) { - await remoteCall.isolateBannerForTesting( - appId, 'holding-space-welcome-banner'); - } + await remoteCall.isolateBannerForTesting( + appId, 'holding-space-welcome-banner'); }, ['#ok-button:not([disabled])'], tabindexIds); }; @@ -306,26 +261,14 @@ */ testcase.tabindexOpenDialogDrive = async () => { const tabindexIds = [ - 'cancel-button', - 'ok-button', - 'search-button', - 'view-button', - 'sort-button', - 'gear-button', + 'cancel-button', 'ok-button', 'search-button', 'view-button', 'sort-button', + 'gear-button', 'drive-learn-more-button', 'dismiss-button', + 'directory-tree', 'file-list' ]; - const isBannersFrameworkEnabled = - await sendTestMessage({name: 'isBannersFrameworkEnabled'}) === 'true'; - if (isBannersFrameworkEnabled) { - tabindexIds.push('drive-learn-more-button', 'dismiss-button'); - } - tabindexIds.push('directory-tree', 'file-list'); return tabindexFocus( {type: 'openFile'}, 'drive', BASIC_DRIVE_ENTRY_SET, async (appId) => { await remoteCall.callRemoteTestUtil('selectFile', appId, ['hello.txt']); - if (isBannersFrameworkEnabled) { - await remoteCall.isolateBannerForTesting( - appId, 'drive-welcome-banner'); - } + await remoteCall.isolateBannerForTesting(appId, 'drive-welcome-banner'); }, ['#ok-button:not([disabled])'], tabindexIds); };
diff --git a/ui/ozone/platform/flatland/flatland_window.cc b/ui/ozone/platform/flatland/flatland_window.cc index bc05d280..2fa1924 100644 --- a/ui/ozone/platform/flatland/flatland_window.cc +++ b/ui/ozone/platform/flatland/flatland_window.cc
@@ -170,16 +170,15 @@ } void FlatlandWindow::SetCapture() { - NOTIMPLEMENTED_LOG_ONCE(); + has_capture_ = true; } void FlatlandWindow::ReleaseCapture() { - NOTIMPLEMENTED_LOG_ONCE(); + has_capture_ = false; } bool FlatlandWindow::HasCapture() const { - NOTIMPLEMENTED_LOG_ONCE(); - return false; + return has_capture_; } void FlatlandWindow::ToggleFullscreen() {
diff --git a/ui/ozone/platform/flatland/flatland_window.h b/ui/ozone/platform/flatland/flatland_window.h index 46fc1066..40a31319 100644 --- a/ui/ozone/platform/flatland/flatland_window.h +++ b/ui/ozone/platform/flatland/flatland_window.h
@@ -160,6 +160,10 @@ // True if |view_| is currently attached to a scene. bool is_view_attached_ = false; + + // True if SetCapture() was called. Currently does not reflect capture state + // in Scenic. + bool has_capture_ = false; }; } // namespace ui
diff --git a/ui/ozone/platform/wayland/common/wayland_util.cc b/ui/ozone/platform/wayland/common/wayland_util.cc index 834de30b..8823a54 100644 --- a/ui/ozone/platform/wayland/common/wayland_util.cc +++ b/ui/ozone/platform/wayland/common/wayland_util.cc
@@ -154,6 +154,14 @@ child_bounds.size()); } +gfx::RectF TranslateBoundsToParentCoordinatesF( + const gfx::RectF& child_bounds, + const gfx::RectF& parent_bounds) { + return gfx::RectF( + (child_bounds.origin() - parent_bounds.origin().OffsetFromOrigin()), + child_bounds.size()); +} + gfx::Rect TranslateBoundsToTopLevelCoordinates(const gfx::Rect& child_bounds, const gfx::Rect& parent_bounds) { return gfx::Rect( @@ -230,9 +238,9 @@ return result; } -gfx::Size ApplyWaylandTransform(const gfx::Size& size, - wl_output_transform transform) { - gfx::Size result = size; +gfx::SizeF ApplyWaylandTransform(const gfx::SizeF& size, + wl_output_transform transform) { + gfx::SizeF result = size; switch (transform) { case WL_OUTPUT_TRANSFORM_NORMAL: case WL_OUTPUT_TRANSFORM_FLIPPED:
diff --git a/ui/ozone/platform/wayland/common/wayland_util.h b/ui/ozone/platform/wayland/common/wayland_util.h index 85ebe02..b8f2983 100644 --- a/ui/ozone/platform/wayland/common/wayland_util.h +++ b/ui/ozone/platform/wayland/common/wayland_util.h
@@ -11,6 +11,7 @@ #include "base/containers/flat_map.h" #include "base/files/scoped_file.h" #include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/overlay_transform.h" #include "ui/ozone/platform/wayland/common/wayland_object.h" #include "ui/platform_window/platform_window_init_properties.h" @@ -55,6 +56,8 @@ // Translates bounds relative to top level window to specified parent. gfx::Rect TranslateBoundsToParentCoordinates(const gfx::Rect& child_bounds, const gfx::Rect& parent_bounds); +gfx::RectF TranslateBoundsToParentCoordinatesF(const gfx::RectF& child_bounds, + const gfx::RectF& parent_bounds); // Translates bounds relative to parent window to top level window. gfx::Rect TranslateBoundsToTopLevelCoordinates(const gfx::Rect& child_bounds, const gfx::Rect& parent_bounds); @@ -71,8 +74,8 @@ wl_output_transform transform); // Applies transformation to |size|. -gfx::Size ApplyWaylandTransform(const gfx::Size& size, - wl_output_transform transform); +gfx::SizeF ApplyWaylandTransform(const gfx::SizeF& size, + wl_output_transform transform); // Returns the root WaylandWindow for the given wl_surface. ui::WaylandWindow* RootWindowFromWlSurface(wl_surface* surface);
diff --git a/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.cc b/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.cc index 25503a4..fac2404 100644 --- a/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.cc +++ b/ui/ozone/platform/wayland/gpu/wayland_buffer_manager_gpu.cc
@@ -33,8 +33,7 @@ ui::ozone::mojom::WaylandOverlayConfig::New()}; wayland_overlay_config->z_order = input.overlay_plane_data.z_order; wayland_overlay_config->transform = input.overlay_plane_data.plane_transform; - wayland_overlay_config->bounds_rect = - gfx::ToNearestRect(input.overlay_plane_data.display_bounds); + wayland_overlay_config->bounds_rect = input.overlay_plane_data.display_bounds; wayland_overlay_config->crop_rect = input.overlay_plane_data.crop_rect; wayland_overlay_config->enable_blend = input.overlay_plane_data.enable_blend; wayland_overlay_config->opacity = input.overlay_plane_data.opacity; @@ -266,9 +265,10 @@ // the buffer to root_surface of wayland window. overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( INT32_MIN, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, buffer_id, - surface_scale_factor, bounds_rect, gfx::RectF(1.f, 1.f) /* no crop */, - damage_region, false, 1.0f /*opacity*/, gfx::GpuFenceHandle(), - gfx::OverlayPriorityHint::kNone, gfx::RRectF())); + surface_scale_factor, gfx::RectF(bounds_rect), + gfx::RectF(1.f, 1.f) /* no crop */, damage_region, false, + 1.0f /*opacity*/, gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, + gfx::RRectF())); CommitOverlays(widget, std::move(overlay_configs)); }
diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc index ac234f89..e2cf95e1 100644 --- a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc +++ b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.cc
@@ -270,7 +270,7 @@ return; for (auto& overlay : overlays) { - if (!ValidateBufferExistence(overlay->buffer_id)) { + if (!ValidateOverlayData(*overlay)) { TerminateGpuProcess(); return; } @@ -401,6 +401,27 @@ return error_message_.empty(); } +bool WaylandBufferManagerHost::ValidateOverlayData( + const ui::ozone::mojom::WaylandOverlayConfig& overlay_data) { + if (!ValidateBufferExistence(overlay_data.buffer_id)) + return false; + + std::string reason; + if (std::isnan(overlay_data.bounds_rect.x()) || + std::isnan(overlay_data.bounds_rect.y()) || + std::isnan(overlay_data.bounds_rect.width()) || + std::isnan(overlay_data.bounds_rect.height()) || + std::isinf(overlay_data.bounds_rect.x()) || + std::isinf(overlay_data.bounds_rect.y()) || + std::isinf(overlay_data.bounds_rect.width()) || + std::isinf(overlay_data.bounds_rect.height())) { + error_message_ = "Overlay bounds_rect is invalid (NaN or infinity)."; + return false; + } + + return true; +} + void WaylandBufferManagerHost::OnSubmission(gfx::AcceleratedWidget widget, uint32_t buffer_id, const gfx::SwapResult& swap_result,
diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h index 4be1778..218d3a5 100644 --- a/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h +++ b/ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h
@@ -149,6 +149,8 @@ uint32_t buffer_id); bool ValidateDataFromGpu(const gfx::Size& size, uint32_t buffer_id); bool ValidateBufferExistence(uint32_t buffer_id); + bool ValidateOverlayData( + const ui::ozone::mojom::WaylandOverlayConfig& overlay_data); // Terminates the GPU process on invalid data received void TerminateGpuProcess();
diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc index 99e6da1..9246a6d 100644 --- a/ui/ozone/platform/wayland/host/wayland_connection.cc +++ b/ui/ozone/platform/wayland/host/wayland_connection.cc
@@ -280,8 +280,9 @@ return; } + DCHECK(event_source_); DCHECK(event_queue_.get()); - wl_display_roundtrip_queue(display(), event_queue_.get()); + event_source_->RoundTripQueue(); } void WaylandConnection::SetShutdownCb(base::OnceCallback<void()> shutdown_cb) {
diff --git a/ui/ozone/platform/wayland/host/wayland_event_source.cc b/ui/ozone/platform/wayland/host/wayland_event_source.cc index f1fc7e3..536eb85 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_source.cc +++ b/ui/ozone/platform/wayland/host/wayland_event_source.cc
@@ -251,6 +251,10 @@ ResetPointerFlags(); } +void WaylandEventSource::RoundTripQueue() { + event_watcher_->RoundTripQueue(); +} + const gfx::PointF& WaylandEventSource::GetPointerLocation() const { return pointer_location_; }
diff --git a/ui/ozone/platform/wayland/host/wayland_event_source.h b/ui/ozone/platform/wayland/host/wayland_event_source.h index 62fe588..ce8eeb6 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_source.h +++ b/ui/ozone/platform/wayland/host/wayland_event_source.h
@@ -81,6 +81,10 @@ // button released event is not delivered (e.g: window moving, drag and drop). void ResetPointerFlags(); + // Forwards the call to WaylandEventWatcher, which calls + // wl_display_roundtrip_queue. + void RoundTripQueue(); + protected: // WaylandKeyboard::Delegate void OnKeyboardFocusChanged(WaylandWindow* window, bool focused) override;
diff --git a/ui/ozone/platform/wayland/host/wayland_event_watcher.cc b/ui/ozone/platform/wayland/host/wayland_event_watcher.cc index e3c43ad..995d105 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_watcher.cc +++ b/ui/ozone/platform/wayland/host/wayland_event_watcher.cc
@@ -64,6 +64,17 @@ watching_ = false; } +void WaylandEventWatcher::RoundTripQueue() { + // Read must be cancelled. Otherwise, wl_display_roundtrip_queue might block + // as its internal implementation also reads events, which may block if there + // are more than one preparation for reading within the same thread. + // + // TODO(1288181): this won't be needed once libevent is updated. See + // WaylandEventWatcherFdWatch::OnFileCanReadWithoutBlocking for more details. + WlDisplayCancelRead(); + wl_display_roundtrip_queue(display_, event_queue_); +} + bool WaylandEventWatcher::WlDisplayPrepareToRead() { if (prepared_) return true;
diff --git a/ui/ozone/platform/wayland/host/wayland_event_watcher.h b/ui/ozone/platform/wayland/host/wayland_event_watcher.h index 5e99ed4..6a66a2c 100644 --- a/ui/ozone/platform/wayland/host/wayland_event_watcher.h +++ b/ui/ozone/platform/wayland/host/wayland_event_watcher.h
@@ -46,6 +46,10 @@ // Stops polling for events from input devices. void StopProcessingEvents(); + // Calls wl_display_roundtrip_queue. Might be required during initialization + // of some objects that should block until they are initialized. + void RoundTripQueue(); + protected: WaylandEventWatcher(wl_display* display, wl_event_queue* event_queue);
diff --git a/ui/ozone/platform/wayland/host/wayland_frame_manager.cc b/ui/ozone/platform/wayland/host/wayland_frame_manager.cc index b825eea..cfc70450 100644 --- a/ui/ozone/platform/wayland/host/wayland_frame_manager.cc +++ b/ui/ozone/platform/wayland/host/wayland_frame_manager.cc
@@ -7,6 +7,8 @@ #include <presentation-time-client-protocol.h> #include <sync/sync.h> +#include "ui/gfx/geometry/rect_conversions.h" +#include "ui/gfx/geometry/size_conversions.h" #include "ui/ozone/platform/wayland/host/wayland_buffer_handle.h" #include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h" #include "ui/ozone/platform/wayland/host/wayland_connection.h" @@ -171,8 +173,9 @@ bool empty_frame = !root_config || !root_config->buffer_id; if (!empty_frame) { - window_->UpdateVisualSize(root_config->bounds_rect.size(), - root_config->surface_scale_factor); + window_->UpdateVisualSize( + gfx::ToRoundedSize(root_config->bounds_rect.size()), + root_config->surface_scale_factor); } // Configure subsurfaces. Traverse the deque backwards s.t. we can set @@ -261,7 +264,8 @@ surface->SetRoundedClipBounds(config->rounded_clip_bounds); surface->SetOverlayPriority(config->priority_hint); if (set_opaque_region) { - std::vector<gfx::Rect> region_px = {gfx::Rect(config->bounds_rect.size())}; + std::vector<gfx::Rect> region_px = { + gfx::Rect(gfx::ToRoundedSize(config->bounds_rect.size()))}; surface->SetOpaqueRegion(config->enable_blend ? nullptr : ®ion_px); }
diff --git a/ui/ozone/platform/wayland/host/wayland_subsurface.cc b/ui/ozone/platform/wayland/host/wayland_subsurface.cc index a0ef886..1a4891f36 100644 --- a/ui/ozone/platform/wayland/host/wayland_subsurface.cc +++ b/ui/ozone/platform/wayland/host/wayland_subsurface.cc
@@ -7,6 +7,8 @@ #include <cstdint> #include "ui/gfx/geometry/rect.h" +#include "ui/gfx/geometry/rect_conversions.h" +#include "ui/gfx/geometry/rect_f.h" #include "ui/ozone/platform/wayland/common/wayland_util.h" #include "ui/ozone/platform/wayland/host/wayland_buffer_manager_host.h" #include "ui/ozone/platform/wayland/host/wayland_connection.h" @@ -15,14 +17,13 @@ namespace { // Returns DIP bounds of the subsurface relative to the parent surface. -gfx::Rect AdjustSubsurfaceBounds(const gfx::Rect& bounds_px, - const gfx::Rect& parent_bounds_px, - float buffer_scale) { - const auto bounds_dip = - gfx::ScaleToEnclosingRect(bounds_px, 1.0f / buffer_scale); +gfx::RectF AdjustSubsurfaceBounds(const gfx::RectF& bounds_px, + const gfx::RectF& parent_bounds_px, + float buffer_scale) { + const auto bounds_dip = gfx::ScaleRect(bounds_px, 1.0f / buffer_scale); const auto parent_bounds_dip = - gfx::ScaleToEnclosingRect(parent_bounds_px, 1.0f / buffer_scale); - return wl::TranslateBoundsToParentCoordinates(bounds_dip, parent_bounds_dip); + gfx::ScaleRect(parent_bounds_px, 1.0f / buffer_scale); + return wl::TranslateBoundsToParentCoordinatesF(bounds_dip, parent_bounds_dip); } } // namespace @@ -83,8 +84,8 @@ } void WaylandSubsurface::ConfigureAndShowSurface( - const gfx::Rect& bounds_px, - const gfx::Rect& parent_bounds_px, + const gfx::RectF& bounds_px, + const gfx::RectF& parent_bounds_px, float buffer_scale, const WaylandSurface* reference_below, const WaylandSurface* reference_above) { @@ -97,9 +98,12 @@ bounds_px, parent_bounds_px, connection_->surface_submission_in_pixel_coordinates() ? 1.f : buffer_scale); - wl_subsurface_set_position(subsurface_.get(), - bounds_dip_in_parent_surface.x(), - bounds_dip_in_parent_surface.y()); + // TODO(msisov): use an augmented_subsurface to pass rects without loosing + // subpixel precision. + gfx::Rect enclosed_rect_in_parent = + gfx::ToEnclosedRect(bounds_dip_in_parent_surface); + wl_subsurface_set_position(subsurface_.get(), enclosed_rect_in_parent.x(), + enclosed_rect_in_parent.y()); // Setup the stacking order of this subsurface. DCHECK(!reference_above || !reference_below);
diff --git a/ui/ozone/platform/wayland/host/wayland_subsurface.h b/ui/ozone/platform/wayland/host/wayland_subsurface.h index e5c696d..8ed3a88 100644 --- a/ui/ozone/platform/wayland/host/wayland_subsurface.h +++ b/ui/ozone/platform/wayland/host/wayland_subsurface.h
@@ -36,8 +36,8 @@ // |reference_below| & |reference_above|: this subsurface is taken from the // subsurface stack and inserted back to be immediately below/above the // reference subsurface. - void ConfigureAndShowSurface(const gfx::Rect& bounds_px, - const gfx::Rect& parent_bounds_px, + void ConfigureAndShowSurface(const gfx::RectF& bounds_px, + const gfx::RectF& parent_bounds_px, float buffer_scale, const WaylandSurface* reference_below, const WaylandSurface* reference_above);
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.cc b/ui/ozone/platform/wayland/host/wayland_surface.cc index f656e41..d80c1d8 100644 --- a/ui/ozone/platform/wayland/host/wayland_surface.cc +++ b/ui/ozone/platform/wayland/host/wayland_surface.cc
@@ -327,7 +327,7 @@ pending_state_.use_blending = use_blending; } -void WaylandSurface::SetViewportDestination(const gfx::Size& dest_size_px) { +void WaylandSurface::SetViewportDestination(const gfx::SizeF& dest_size_px) { DCHECK(!apply_state_immediately_); pending_state_.viewport_px = dest_size_px; } @@ -480,8 +480,8 @@ // 2. buffer_scale (wl_surface.set_buffer_scale) // 3. crop and scale (wp_viewport.set*) // Apply buffer_transform (wl_surface.set_buffer_transform). - gfx::Size bounds = wl::ApplyWaylandTransform( - pending_state_.buffer_size_px, + gfx::SizeF bounds = wl::ApplyWaylandTransform( + gfx::SizeF(pending_state_.buffer_size_px), wl::ToWaylandTransform(pending_state_.buffer_transform)); int32_t applying_surface_scale; @@ -493,14 +493,14 @@ applying_surface_scale = 1; } else { applying_surface_scale = pending_state_.buffer_scale; - bounds = gfx::ScaleToCeiledSize(bounds, 1.f / pending_state_.buffer_scale); + bounds = gfx::ScaleSize(bounds, 1.f / pending_state_.buffer_scale); } if (!SurfaceSubmissionInPixelCoordinates()) wl_surface_set_buffer_scale(surface_.get(), applying_surface_scale); gfx::RectF viewport_src_dip; if (pending_state_.crop.IsEmpty()) { - viewport_src_dip = gfx::RectF(gfx::SizeF(bounds)); + viewport_src_dip = gfx::RectF(bounds); // Unset crop (wp_viewport.set_source). if (viewport()) { wp_viewport_set_source(viewport(), wl_fixed_from_int(-1), @@ -529,7 +529,7 @@ gfx::SizeF viewport_dst_dip = pending_state_.viewport_px.IsEmpty() ? viewport_src_dip.size() - : gfx::ScaleSize(gfx::SizeF(pending_state_.viewport_px), + : gfx::ScaleSize(pending_state_.viewport_px, 1.f / pending_state_.buffer_scale); if (viewport_dst_dip != viewport_src_dip.size()) { // Apply viewport scale (wp_viewport.set_destination).
diff --git a/ui/ozone/platform/wayland/host/wayland_surface.h b/ui/ozone/platform/wayland/host/wayland_surface.h index 95719ec..1e78c3d 100644 --- a/ui/ozone/platform/wayland/host/wayland_surface.h +++ b/ui/ozone/platform/wayland/host/wayland_surface.h
@@ -137,7 +137,7 @@ // |dest_size_px|, which should be in physical pixels. // Note this method sends corresponding wayland requests immediately because // it does not need a new buffer attach to take effect. - void SetViewportDestination(const gfx::Size& dest_size_px); + void SetViewportDestination(const gfx::SizeF& dest_size_px); // Creates a wl_subsurface relating this surface and a parent surface, // |parent|. Callers take ownership of the wl_subsurface. @@ -225,7 +225,7 @@ // Wayland compositor will scale the (cropped) buffer content to fit the // |viewport_px|. // If empty, no scaling is applied. - gfx::Size viewport_px = {0, 0}; + gfx::SizeF viewport_px = {0, 0}; // The opacity of the wl_surface used to call zcr_blending_v1_set_alpha. float opacity = 1.f; @@ -251,6 +251,7 @@ State state_; bool SurfaceSubmissionInPixelCoordinates() const; + // Creates (if not created) the synchronization surface and returns a pointer // to it. zwp_linux_surface_synchronization_v1* GetSurfaceSync();
diff --git a/ui/ozone/platform/wayland/host/wayland_window.cc b/ui/ozone/platform/wayland/host/wayland_window.cc index 8fad69a..c99f1f5 100644 --- a/ui/ozone/platform/wayland/host/wayland_window.cc +++ b/ui/ozone/platform/wayland/host/wayland_window.cc
@@ -805,7 +805,7 @@ if (split == overlays.end() && overlays.front()->z_order == INT32_MIN) main_overlay = overlays.begin(); - gfx::Size visual_size = (*main_overlay)->bounds_rect.size(); + gfx::SizeF visual_size = (*main_overlay)->bounds_rect.size(); float buffer_scale = (*main_overlay)->surface_scale_factor; auto& rounded_clip_bounds = (*main_overlay)->rounded_clip_bounds;
diff --git a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc index 339c000..178067e1 100644 --- a/ui/ozone/platform/wayland/host/wayland_window_unittest.cc +++ b/ui/ozone/platform/wayland/host/wayland_window_unittest.cc
@@ -3055,8 +3055,9 @@ wayland_subsurface->wayland_surface()->GetSurfaceId()); EXPECT_TRUE(mock_surface_subsurface); wayland_subsurface->ConfigureAndShowSurface( - subsurface_bounds, gfx::Rect(0, 0, 640, 480) /*parent_bounds_px*/, - 1.f /*buffer_scale*/, nullptr, nullptr); + gfx::RectF(subsurface_bounds), + gfx::RectF(0, 0, 640, 480) /*parent_bounds_px*/, 1.f /*buffer_scale*/, + nullptr, nullptr); connection_->ScheduleFlush(); Sync();
diff --git a/ui/ozone/platform/wayland/mojom/wayland_overlay_config.mojom b/ui/ozone/platform/wayland/mojom/wayland_overlay_config.mojom index de770cb3..74519dc 100644 --- a/ui/ozone/platform/wayland/mojom/wayland_overlay_config.mojom +++ b/ui/ozone/platform/wayland/mojom/wayland_overlay_config.mojom
@@ -31,7 +31,7 @@ // Specifies where it is supposed to be on the display in physical pixels. // This, after scaled by buffer_scale sets the destination rectangle of // Wayland Viewport. - gfx.mojom.Rect bounds_rect; + gfx.mojom.RectF bounds_rect; // Specifies the region within the buffer to be placed inside |bounds_rect|. // This sets the source rectangle of Wayland Viewport.
diff --git a/ui/ozone/platform/wayland/wayland_buffer_manager_unittest.cc b/ui/ozone/platform/wayland/wayland_buffer_manager_unittest.cc index 0e74f67..bca3acff 100644 --- a/ui/ozone/platform/wayland/wayland_buffer_manager_unittest.cc +++ b/ui/ozone/platform/wayland/wayland_buffer_manager_unittest.cc
@@ -132,6 +132,8 @@ void SetTerminateCallbackExpectationAndDestroyChannel( MockTerminateGpuCallback* callback, bool fail) { + channel_destroyed_error_message_.clear(); + if (!fail) { // To avoid warning messages as "Expected to be never called, but has 0 // WillOnce()s", split the expecations based on the expected call times. @@ -139,7 +141,10 @@ } else { EXPECT_CALL(*callback, Run(_)) .Times(1) - .WillRepeatedly(::testing::Invoke([this, callback](std::string) { + .WillRepeatedly(::testing::Invoke([this, callback]( + std::string error_string) { + channel_destroyed_error_message_ = error_string; + manager_host_->OnChannelDestroyed(); manager_host_->SetTerminateGpuCallback(callback->Get()); @@ -237,6 +242,8 @@ MockTerminateGpuCallback callback_; WaylandBufferManagerHost* manager_host_; + // Error message that is received when the manager_host destroys the channel. + std::string channel_destroyed_error_message_; }; TEST_P(WaylandBufferManagerTest, CreateDmabufBasedBuffers) { @@ -463,15 +470,16 @@ std::vector<ui::ozone::mojom::WaylandOverlayConfigPtr> overlay_configs; overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( INT32_MIN, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, 1u, - kDefaultScale, window_->GetBounds(), gfx::RectF(), window_->GetBounds(), - false, 1.0f, gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, - gfx::RRectF())); + kDefaultScale, gfx::RectF(window_->GetBounds()), gfx::RectF(), + window_->GetBounds(), false, 1.0f, gfx::GpuFenceHandle(), + gfx::OverlayPriorityHint::kNone, gfx::RRectF())); // Non-existing buffer id overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( 0, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, 2u, kDefaultScale, - window_->GetBounds(), gfx::RectF(), window_->GetBounds(), false, 1.0f, - gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, gfx::RRectF())); + gfx::RectF(window_->GetBounds()), gfx::RectF(), window_->GetBounds(), + false, 1.0f, gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, + gfx::RRectF())); buffer_manager_gpu_->CommitOverlays(window_->GetWidget(), std::move(overlay_configs)); @@ -489,12 +497,14 @@ std::vector<ui::ozone::mojom::WaylandOverlayConfigPtr> overlay_configs; overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( 0, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, 1u, kDefaultScale, - window_->GetBounds(), gfx::RectF(), window_->GetBounds(), false, 1.0f, - gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, gfx::RRectF())); + gfx::RectF(window_->GetBounds()), gfx::RectF(), window_->GetBounds(), + false, 1.0f, gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, + gfx::RRectF())); overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( 1, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, 1u, kDefaultScale, - window_->GetBounds(), gfx::RectF(), window_->GetBounds(), false, 1.0f, - gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, gfx::RRectF())); + gfx::RectF(window_->GetBounds()), gfx::RectF(), window_->GetBounds(), + false, 1.0f, gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, + gfx::RRectF())); buffer_manager_gpu_->CommitOverlays(window_->GetWidget(), std::move(overlay_configs)); @@ -527,6 +537,41 @@ Sync(); } +// Tests that committing overlays with bounds_rect containing NaN or infinity +// values is illegal - the host terminates the gpu process. +TEST_P(WaylandBufferManagerTest, CommitOverlaysNonsensicalBoundsRect) { + const std::vector<gfx::RectF> bounds_rect_test_data = { + gfx::RectF(std::nanf(""), window_->GetBounds().y(), std::nanf(""), + window_->GetBounds().height()), + gfx::RectF(window_->GetBounds().x(), + std::numeric_limits<float>::infinity(), + window_->GetBounds().width(), + std::numeric_limits<float>::infinity())}; + + for (const auto& bounds_rect : bounds_rect_test_data) { + CreateDmabufBasedBufferAndSetTerminateExpectation(false /*fail*/, 1u); + ProcessCreatedBufferResourcesWithExpectation(1u /* expected size */, + false /* fail */); + + // Can't commit for bounds rect containing NaN + SetTerminateCallbackExpectationAndDestroyChannel(&callback_, true /*fail*/); + + std::vector<ui::ozone::mojom::WaylandOverlayConfigPtr> overlay_configs; + overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( + 1u, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, 1u, kDefaultScale, + bounds_rect, gfx::RectF(), window_->GetBounds(), false, 1.0f, + gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, gfx::RRectF())); + + buffer_manager_gpu_->CommitOverlays(window_->GetWidget(), + std::move(overlay_configs)); + + Sync(); + + EXPECT_EQ("Overlay bounds_rect is invalid (NaN or infinity).", + channel_destroyed_error_message_); + } +} + TEST_P(WaylandBufferManagerTest, EnsureCorrectOrderOfCallbacks) { constexpr uint32_t kBufferId1 = 1; constexpr uint32_t kBufferId2 = 2; @@ -1739,15 +1784,15 @@ std::vector<ui::ozone::mojom::WaylandOverlayConfigPtr> overlay_configs; overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( INT32_MIN, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, kBufferId1, - kDefaultScale, bounds, gfx::RectF(), bounds, false, 1.0f, + kDefaultScale, gfx::RectF(bounds), gfx::RectF(), bounds, false, 1.0f, gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, gfx::RRectF())); overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( 0, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, kBufferId2, - kDefaultScale, bounds, gfx::RectF(), bounds, false, 1.0f, + kDefaultScale, gfx::RectF(bounds), gfx::RectF(), bounds, false, 1.0f, gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, gfx::RRectF())); overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( 1, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, kBufferId3, - kDefaultScale, bounds, gfx::RectF(), bounds, false, 1.0f, + kDefaultScale, gfx::RectF(bounds), gfx::RectF(), bounds, false, 1.0f, gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, gfx::RRectF())); buffer_manager_gpu_->CommitOverlays(window_->GetWidget(), std::move(overlay_configs)); @@ -2000,8 +2045,8 @@ overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( id == 1 ? INT32_MIN : id, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, id, kDefaultScale, - window_->GetBounds(), gfx::RectF(), window_->GetBounds(), false, 1.0f, - gfx::GpuFenceHandle(), priority.first, gfx::RRectF())); + gfx::RectF(window_->GetBounds()), gfx::RectF(), window_->GetBounds(), + false, 1.0f, gfx::GpuFenceHandle(), priority.first, gfx::RRectF())); } buffer_manager_gpu_->CommitOverlays(window_->GetWidget(), @@ -2076,9 +2121,9 @@ overlay_configs.push_back(ui::ozone::mojom::WaylandOverlayConfig::New( id == 1 ? INT32_MIN : id, gfx::OverlayTransform::OVERLAY_TRANSFORM_NONE, id, scale_factor, - window_->GetBounds(), gfx::RectF(), window_->GetBounds(), false, - 1.0f, gfx::GpuFenceHandle(), gfx::OverlayPriorityHint::kNone, - rounded_corners)); + gfx::RectF(window_->GetBounds()), gfx::RectF(), + window_->GetBounds(), false, 1.0f, gfx::GpuFenceHandle(), + gfx::OverlayPriorityHint::kNone, rounded_corners)); } buffer_manager_gpu_->CommitOverlays(window_->GetWidget(),
diff --git a/ui/webui/resources/mojo/BUILD.gn b/ui/webui/resources/mojo/BUILD.gn index bd0daed7..d4d038e1 100644 --- a/ui/webui/resources/mojo/BUILD.gn +++ b/ui/webui/resources/mojo/BUILD.gn
@@ -16,6 +16,7 @@ in_files = [ "mojo/public/mojom/base/big_buffer.mojom-webui.js", "mojo/public/mojom/base/file_path.mojom-webui.js", + "mojo/public/mojom/base/safe_base_name.mojom-webui.js", "mojo/public/mojom/base/string16.mojom-webui.js", "mojo/public/mojom/base/text_direction.mojom-webui.js", "mojo/public/mojom/base/time.mojom-webui.js",