diff --git a/DEPS b/DEPS index 018508d..2b88c06 100644 --- a/DEPS +++ b/DEPS
@@ -249,15 +249,15 @@ # 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': '237224ef731eb85e2ecdace97a3590facfb6189a', + 'v8_revision': 'eee0dc30cfd03f0e9fcf858a0b9bba218be24c6e', # 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': '770c81b91170b91586af7fc7ca96db84a2d50ada', + 'angle_revision': '652e3db46bf387e824d910d588b2a47abd2e3c57', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling SwiftShader # and whatever else without interference from each other. - 'swiftshader_revision': 'd7117384b0ee93b1217e06a300132aaa66ac3f2f', + 'swiftshader_revision': 'f6bdbed95b3703d782c2a2a537092afb39455442', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling PDFium # 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': '59fdfc17fa517522e2a6ce0af56bfadd4927824c', + 'devtools_frontend_revision': 'd177603690548ad07e34ea1bcf61fbc048877753', # 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': '9c08fd2c7781a5a00194d5d2a000006226d7d148', + 'dawn_revision': '13107a52514a77d69752e6620ab204e87729d12a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. @@ -722,7 +722,7 @@ 'packages': [ { 'package': 'chromium/rts/model/linux-amd64', - 'version': 'xPygu6w0owRCYrd5wH7NZAvz0U6vnSq72_rwt3G-Vx8C', + 'version': 'dg2x4u0Mz4Ao0TGHBWyhUHKZGT9PEnEAY0lmIhO93bcC', }, ], 'dep_type': 'cipd', @@ -733,7 +733,7 @@ 'packages': [ { 'package': 'chromium/rts/model/mac-amd64', - 'version': 'yFcuBwlY7sE1wRWRd_WakGCgyMnJCbpg41aVuqEg-wYC', + 'version': 'KQBG1Ib12Sj8gzaHsUNWC-rG0pzVEeajCDbCDJg4m2sC', }, ], 'dep_type': 'cipd', @@ -744,7 +744,7 @@ 'packages': [ { 'package': 'chromium/rts/model/windows-amd64', - 'version': 'Lw015P3FduT0GiaXQS1A40BOPJ5lH8KH3XHNbiu8m0cC', + 'version': '-v5_fp9xt-Rs4jBP5s7INfR8YmKAYat0PwcAfo646yEC', }, ], 'dep_type': 'cipd', @@ -1024,7 +1024,7 @@ # Tools used when building Chrome for Chrome OS. This affects both the Simple # Chrome workflow, as well as the chromeos-chrome ebuild. 'src/third_party/chromite': { - 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + 'b4123c772b4ce3a2714235498f9562b37bdc7c2b', + 'url': Var('chromium_git') + '/chromiumos/chromite.git' + '@' + '47a8e92463afb9c78b13fc843888606e9e63588e', 'condition': 'checkout_chromeos', }, @@ -1427,7 +1427,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'eff1df5f6a0a9d7124731cab1eed4043c5d186e8', + Var('android_git') + '/platform/external/perfetto.git' + '@' + 'cab0b04a19036bc1003ee08b1dd57f994be39d65', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1583,7 +1583,7 @@ Var('swiftshader_git') + '/SwiftShader.git' + '@' + Var('swiftshader_revision'), 'src/third_party/text-fragments-polyfill/src': { - 'url': Var('chromium_git') + '/external/github.com/GoogleChromeLabs/text-fragments-polyfill.git' + '@' + '95de7c17930c0364dc265c08df389e3115263531', + 'url': Var('chromium_git') + '/external/github.com/GoogleChromeLabs/text-fragments-polyfill.git' + '@' + '7d9395b2d0cb782a0d8ce64fa5c063bec28cbfb6', 'condition': 'checkout_ios', }, @@ -1594,7 +1594,7 @@ 'packages': [ { 'package': 'chromium/third_party/turbine', - 'version': 'ttEtncMGe74t-cysVW-3cc6loq-end5oDsc-Exn8WDsC', + 'version': '8Wzi8_CpwqQkJeczCQavMiPI6wJMCSLh_4jpRwUIlSkC', }, ], 'condition': 'checkout_android', @@ -1648,7 +1648,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + '72561785742eab5afee480368659cde144bca33c', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'cc9b7ec7401880e4c14e5c76c4637e191ab4490a', + Var('webrtc_git') + '/src.git' + '@' + '3226e563d8adb25ae8f5f6b6030089235bbc90ef', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1718,7 +1718,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@f5f9af7a6891ef3a91efa77dbb1be35c291e7e2b', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@1f234510e27f0f16455cdf27afcd558515c0160c', 'condition': 'checkout_src_internal', }, @@ -1748,7 +1748,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/help_app/app', - 'version': 'BB46-WGD69gWNLcJxkAf2UDxsp4Dfg7S1oJhbgwTtWoC', + 'version': 'yDyyv8OpQAd9OwJ2lNd2IrwPr6w9LK7FdY7VB6W2tZQC', }, ], 'condition': 'checkout_chromeos and checkout_src_internal', @@ -1759,7 +1759,7 @@ 'packages': [ { 'package': 'chromeos_internal/apps/media_app/app', - 'version': 'Bod3b1k2tnpQCRfjy81CrwGqXSKOGaO6XK1U4RkGwkUC', + 'version': '7d6J4YFJkQXaSC8ubPEfNtVxZorP9XEaohyNLvJDez0C', }, ], 'condition': 'checkout_chromeos and checkout_src_internal',
diff --git a/WATCHLISTS b/WATCHLISTS index d64b671d..c59260eb 100644 --- a/WATCHLISTS +++ b/WATCHLISTS
@@ -2054,6 +2054,7 @@ 'webid': { 'filepath': 'third_party/blink/renderer/modules/webid/'\ '|third_party/blink/public/mojom/webid/'\ + '|content/browser/webid'\ '|chrome/browser/.*webid', }, 'weblayer': { @@ -2277,8 +2278,7 @@ 'blink_layers': ['blink-layers+watch@chromium.org'], 'blink_layout': ['blink-reviews-layout@chromium.org', 'zoltan@webkit.org'], - 'blink_layout_ng': ['cbiesinger@chromium.org', - 'glebl+reviews@chromium.org', + 'blink_layout_ng': ['glebl+reviews@chromium.org', 'dgrogan+ng@chromium.org', 'atotic+reviews@chromium.org', 'lchoi+reviews@chromium.org', @@ -2902,7 +2902,7 @@ 'webcodecs': ['feature-media-reviews@chromium.org'], 'webgpu': ['cwallez+watch@chromium.org', 'kainino+watch@chromium.org'], - 'webid': ['yigu+watch@chromium.org'], + 'webid': ['yigu+watch@chromium.org', 'cbiesinger@chromium.org'], 'weblayer': ['cricke+watch@chromium.org'], 'weblayer_safe_browsing' : ['carlosil+watch@chromium.org'], 'weblayer_ssl' : ['carlosil+watch@chromium.org'],
diff --git a/ash/capture_mode/capture_mode_unittests.cc b/ash/capture_mode/capture_mode_unittests.cc index 0aab9dd0..9df4d82 100644 --- a/ash/capture_mode/capture_mode_unittests.cc +++ b/ash/capture_mode/capture_mode_unittests.cc
@@ -2654,7 +2654,8 @@ ->GetNumberOfVideoEncoderReconfigures()); } -TEST_F(CaptureModeRecordingSizeTest, CaptureAtPixelsRegion) { +// The test is flaky. https://crbug.com/1287724. +TEST_F(CaptureModeRecordingSizeTest, DISABLED_CaptureAtPixelsRegion) { float dsf = 1.6f; SetDeviceScaleFactor(dsf); auto* controller = StartVideoRecording(CaptureModeSource::kRegion); @@ -2699,7 +2700,8 @@ ->GetNumberOfVideoEncoderReconfigures()); } -TEST_F(CaptureModeRecordingSizeTest, CaptureAtPixelsWindow) { +// The test is flaky. https://crbug.com/1287724. +TEST_F(CaptureModeRecordingSizeTest, DISABLED_CaptureAtPixelsWindow) { float dsf = 1.6f; SetDeviceScaleFactor(dsf); auto* controller = StartVideoRecording(CaptureModeSource::kWindow);
diff --git a/ash/components/login/auth/user_context.cc b/ash/components/login/auth/user_context.cc index 1fcb71c..0d684a12 100644 --- a/ash/components/login/auth/user_context.cc +++ b/ash/components/login/auth/user_context.cc
@@ -159,12 +159,8 @@ return sync_trusted_vault_keys_; } -bool UserContext::IsLockableManagedGuestSession() const { - return !managed_guest_session_launch_extension_id_.empty(); -} - -std::string UserContext::GetManagedGuestSessionLaunchExtensionId() const { - return managed_guest_session_launch_extension_id_; +bool UserContext::CanLockManagedGuestSession() const { + return can_lock_managed_guest_session_; } bool UserContext::HasCredentials() const { @@ -265,10 +261,9 @@ is_under_advanced_protection_ = is_under_advanced_protection; } -void UserContext::SetManagedGuestSessionLaunchExtensionId( - const std::string& managed_guest_session_launch_extension_id) { - managed_guest_session_launch_extension_id_ = - managed_guest_session_launch_extension_id; +void UserContext::SetCanLockManagedGuestSession( + bool can_lock_managed_guest_session) { + can_lock_managed_guest_session_ = can_lock_managed_guest_session; } void UserContext::SetLoginInputMethodIdUsed(
diff --git a/ash/components/login/auth/user_context.h b/ash/components/login/auth/user_context.h index 72a81bb..55acff11 100644 --- a/ash/components/login/auth/user_context.h +++ b/ash/components/login/auth/user_context.h
@@ -91,9 +91,7 @@ const absl::optional<SamlPasswordAttributes>& GetSamlPasswordAttributes() const; const absl::optional<SyncTrustedVaultKeys>& GetSyncTrustedVaultKeys() const; - // True if |managed_guest_session_launch_extension_id_| is non-empty. - bool IsLockableManagedGuestSession() const; - std::string GetManagedGuestSessionLaunchExtensionId() const; + bool CanLockManagedGuestSession() const; bool HasCredentials() const; @@ -138,11 +136,7 @@ void SetSyncTrustedVaultKeys( const SyncTrustedVaultKeys& sync_trusted_vault_keys); void SetIsUnderAdvancedProtection(bool is_under_advanced_protection); - // Sets |managed_guest_session_launch_extension_id_| which is used to set the - // |kLoginExtensionApiLaunchExtensionId| pref when the user's profile is - // created. Setting this pref indicates that this Managed Guest Session is - // lockable. - void SetManagedGuestSessionLaunchExtensionId(const std::string& extension_id); + void SetCanLockManagedGuestSession(bool can_lock_managed_guest_session); // We need to pull input method used to log in into the user session to make // it consistent. This method will remember given input method to be used // when session starts. @@ -174,7 +168,7 @@ std::string gaps_cookie_; std::string reauth_proof_token_; bool is_under_advanced_protection_ = false; - std::string managed_guest_session_launch_extension_id_; + bool can_lock_managed_guest_session_ = false; // |login_input_method_id_used_| is non-empty if login password/code was used, // i.e. user used some input method to log in. std::string login_input_method_id_used_;
diff --git a/base/allocator/partition_allocator/starscan/pcscan_internal.cc b/base/allocator/partition_allocator/starscan/pcscan_internal.cc index 26a03c0..185d9ad 100644 --- a/base/allocator/partition_allocator/starscan/pcscan_internal.cc +++ b/base/allocator/partition_allocator/starscan/pcscan_internal.cc
@@ -90,7 +90,7 @@ }; thread_local size_t ReentrantScannerGuard::guard_ = 0; #else -struct ALLOW_UNUSED_TYPE ReentrantScannerGuard final {}; +struct [[maybe_unused]] ReentrantScannerGuard final{}; #endif // defined(PA_HAS_ALLOCATION_GUARD) // Scope that disables MTE checks. Only used inside scanning to avoid the race: @@ -942,10 +942,10 @@ #endif } -ALLOW_UNUSED_TYPE size_t -FreeAndUnmarkInCardTable(PartitionRoot<ThreadSafe>* root, - SlotSpanMetadata<ThreadSafe>* slot_span, - uintptr_t object) { +[[maybe_unused]] size_t FreeAndUnmarkInCardTable( + PartitionRoot<ThreadSafe>* root, + SlotSpanMetadata<ThreadSafe>* slot_span, + uintptr_t object) { object = memory::RemaskPtr(object); const size_t slot_size = slot_span->bucket->slot_size; uintptr_t slot_start = @@ -955,10 +955,10 @@ return slot_size; } -ALLOW_UNUSED_TYPE void SweepSuperPage(ThreadSafePartitionRoot* root, - uintptr_t super_page, - size_t epoch, - SweepStat& stat) { +[[maybe_unused]] void SweepSuperPage(ThreadSafePartitionRoot* root, + uintptr_t super_page, + size_t epoch, + SweepStat& stat) { auto* bitmap = StateBitmapFromAddr(super_page); ThreadSafePartitionRoot::FromFirstSuperPage(super_page); bitmap->IterateUnmarkedQuarantined(epoch, [root, &stat](uintptr_t object) { @@ -968,7 +968,7 @@ }); } -ALLOW_UNUSED_TYPE void SweepSuperPageAndDiscardMarkedQuarantine( +[[maybe_unused]] void SweepSuperPageAndDiscardMarkedQuarantine( ThreadSafePartitionRoot* root, uintptr_t super_page, size_t epoch, @@ -1002,7 +1002,7 @@ }); } -ALLOW_UNUSED_TYPE void SweepSuperPageWithBatchedFree( +[[maybe_unused]] void SweepSuperPageWithBatchedFree( ThreadSafePartitionRoot* root, uintptr_t super_page, size_t epoch,
diff --git a/base/allocator/partition_allocator/thread_cache_unittest.cc b/base/allocator/partition_allocator/thread_cache_unittest.cc index df56d28c..6b91d19 100644 --- a/base/allocator/partition_allocator/thread_cache_unittest.cc +++ b/base/allocator/partition_allocator/thread_cache_unittest.cc
@@ -494,7 +494,14 @@ #endif // defined(PA_ENABLE_THREAD_CACHE_STATISTICS) -TEST_F(PartitionAllocThreadCacheTest, PurgeAll) NO_THREAD_SAFETY_ANALYSIS { +// TODO(https://crbug.com/1287799): Flaky on IOS. +#if BUILDFLAG(IS_IOS) +#define MAYBE_PurgeAll DISABLED_PurgeAll +#else +#define MAYBE_PurgeAll PurgeAll +#endif +TEST_F(PartitionAllocThreadCacheTest, MAYBE_PurgeAll) +NO_THREAD_SAFETY_ANALYSIS { std::atomic<bool> other_thread_started{false}; std::atomic<bool> purge_called{false}; @@ -653,7 +660,13 @@ PlatformThread::Join(thread_handle_2); } -TEST_F(PartitionAllocThreadCacheTest, DynamicCountPerBucket) { +// TODO(https://crbug.com/1287799): Flaky on IOS. +#if BUILDFLAG(IS_IOS) +#define MAYBE_DynamicCountPerBucket DISABLED_DynamicCountPerBucket +#else +#define MAYBE_DynamicCountPerBucket DynamicCountPerBucket +#endif +TEST_F(PartitionAllocThreadCacheTest, MAYBE_DynamicCountPerBucket) { auto* tcache = root_->thread_cache_for_testing(); size_t bucket_index = FillThreadCacheAndReturnIndex(kMediumSize, kDefaultCountForMediumBucket); @@ -712,7 +725,16 @@ } } -TEST_F(PartitionAllocThreadCacheTest, DynamicCountPerBucketMultipleThreads) { +// TODO(https://crbug.com/1287799): Flaky on IOS. +#if BUILDFLAG(IS_IOS) +#define MAYBE_DynamicCountPerBucketMultipleThreads \ + DISABLED_DynamicCountPerBucketMultipleThreads +#else +#define MAYBE_DynamicCountPerBucketMultipleThreads \ + DynamicCountPerBucketMultipleThreads +#endif +TEST_F(PartitionAllocThreadCacheTest, + MAYBE_DynamicCountPerBucketMultipleThreads) { std::atomic<bool> other_thread_started{false}; std::atomic<bool> threshold_changed{false}; @@ -793,7 +815,8 @@ EXPECT_EQ(3u, alloc_miss_too_large_counter.Delta()); } -TEST_F(PartitionAllocThreadCacheTest, DynamicSizeThresholdPurge) { +// Disabled due to flakiness: crbug.com/1287811 +TEST_F(PartitionAllocThreadCacheTest, DISABLED_DynamicSizeThresholdPurge) { auto* tcache = root_->thread_cache_for_testing(); DeltaCounter alloc_miss_counter{tcache->stats_.alloc_misses}; DeltaCounter alloc_miss_too_large_counter{ @@ -845,7 +868,13 @@ EXPECT_EQ(nullptr, static_cast<void*>(tcache->buckets_[index].freelist_head)); } -TEST_F(PartitionAllocThreadCacheTest, Bookkeeping) { +// TODO(https://crbug.com/1287799): Flaky on IOS. +#if BUILDFLAG(IS_IOS) +#define MAYBE_Bookkeeping DISABLED_Bookkeeping +#else +#define MAYBE_Bookkeeping Bookkeeping +#endif +TEST_F(PartitionAllocThreadCacheTest, MAYBE_Bookkeeping) { void* arr[kFillCountForMediumBucket] = {}; auto* tcache = root_->thread_cache_for_testing();
diff --git a/build/config/arm.gni b/build/config/arm.gni index 6de8860..fa6522a0 100644 --- a/build/config/arm.gni +++ b/build/config/arm.gni
@@ -128,11 +128,7 @@ # - "pac": Enables Pointer Authentication Code (PAC, featured in Armv8.3) # - "standard": Enables both PAC and Branch Target Identification (Armv8.5). # - "none": No branch protection. - arm_control_flow_integrity = "pac" - # TODO(cavalcantii): enable the feature for the following OSes next. - if (is_mac || is_chromeos || is_fuchsia || is_win) { - arm_control_flow_integrity = "none" - } + arm_control_flow_integrity = "none" } assert(arm_control_flow_integrity == "none" || arm_control_flow_integrity == "standard" ||
diff --git a/build/config/gcc/BUILD.gn b/build/config/gcc/BUILD.gn index ff47e25..893dae1 100644 --- a/build/config/gcc/BUILD.gn +++ b/build/config/gcc/BUILD.gn
@@ -63,7 +63,7 @@ # configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] # } config("rpath_for_built_shared_libraries") { - if (!is_android && current_os != "aix") { + if (!is_android && !is_chromecast && current_os != "aix") { # Note: Android, Aix don't support rpath. if (current_toolchain != default_toolchain || gcc_target_rpath == "") { ldflags = [
diff --git a/build/fuchsia/common.py b/build/fuchsia/common.py index abe82c4a..4635c32 100644 --- a/build/fuchsia/common.py +++ b/build/fuchsia/common.py
@@ -18,6 +18,10 @@ DIR_SOURCE_ROOT, 'third_party', 'fuchsia-sdk', 'images') SDK_ROOT = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'fuchsia-sdk', 'sdk') +# The number of seconds to wait when trying to attach to a target. +ATTACH_RETRY_SECONDS = 120 + + def EnsurePathExists(path): """Checks that the file |path| exists on the filesystem and returns the path if it does, raising an exception otherwise."""
diff --git a/build/fuchsia/device_target.py b/build/fuchsia/device_target.py index 1ccb0493a..0865bbe 100644 --- a/build/fuchsia/device_target.py +++ b/build/fuchsia/device_target.py
@@ -13,8 +13,11 @@ import target import time -from common import EnsurePathExists, GetHostToolPathFromPlatform, \ - RunGnSdkFunction, SubprocessCallWithTimeout +import ffx_session + +from common import ATTACH_RETRY_SECONDS, EnsurePathExists, \ + GetHostToolPathFromPlatform, RunGnSdkFunction, \ + SubprocessCallWithTimeout # The maximum times to attempt mDNS resolution when connecting to a freshly # booted Fuchsia instance before aborting. @@ -90,6 +93,7 @@ self._system_image_dir = system_image_dir self._os_check = os_check self._pkg_repo = None + self._ffx_target = None if not self._system_image_dir and self._os_check != 'ignore': raise Exception("Image directory must be provided if a repave is needed.") @@ -217,12 +221,12 @@ def Start(self): if self._host: - self._WaitUntilReady() + self._ConnectToTarget() else: device_found = self._Discover() if device_found: - self._WaitUntilReady() + self._ConnectToTarget() if self._os_check == 'ignore': return @@ -252,6 +256,10 @@ 'to the host remotely, make sure that --host flag ' 'is set and that remote serving is set up.') + def GetFfxTarget(self): + assert self._ffx_target + return self._ffx_target + def _GetInstalledSdkVersion(self): """Retrieves installed OS version from device. @@ -327,11 +335,25 @@ raise Exception('Device %s couldn\'t be discovered via mDNS.' % self._node_name) - self._WaitUntilReady(); + self._ConnectToTarget() def _GetEndpoint(self): return (self._host, self._port) + def _ConnectToTarget(self): + logging.info('Connecting to Fuchsia using ffx.') + # Prefer connecting via node name over address:port. Assume that ffx already + # knows about the target, so there's no need to add/remove it. + self._ffx_target = ffx_session.FfxTarget( + self._ffx_runner, node_name=self._node_name) if self._node_name else \ + ffx_session.FfxTarget(self._ffx_runner, self._host, self._port) + self._ffx_target.wait(ATTACH_RETRY_SECONDS) + return super(DeviceTarget, self)._ConnectToTarget() + + def _DisconnectFromTarget(self): + super(DeviceTarget, self)._DisconnectFromTarget() + self._ffx_target = None + def _GetSshConfigPath(self): return self._ssh_config_path @@ -360,9 +382,10 @@ def Stop(self): try: - super(DeviceTarget, self).Stop() - finally: # End multiplexed ssh connection, ensure that ssh logging stops before # tests/scripts return. if self.IsStarted(): self.RunCommand(['-O', 'exit']) + finally: + self._DisconnectFromTarget() + super(DeviceTarget, self).Stop()
diff --git a/build/fuchsia/device_target_test.py b/build/fuchsia/device_target_test.py index 93fa150..f7796546 100755 --- a/build/fuchsia/device_target_test.py +++ b/build/fuchsia/device_target_test.py
@@ -27,12 +27,13 @@ def testNoNodeNameOneDeviceReturnNoneCheckNameAndAddress(self): with DeviceTarget.CreateFromArgs(self.args) as device_target_instance, \ mock.patch.object(DeviceTarget, 'RunFFXCommand') as mock_ffx, \ - mock.patch.object(Target, '_WaitUntilReady') as mock_waituntilready: + mock.patch.object( + DeviceTarget, '_ConnectToTarget') as mock_connecttotarget: mock_spec_popen = mock.create_autospec(subprocess.Popen, instance=True) mock_spec_popen.communicate.return_value = ('address device_name', '') mock_spec_popen.returncode = 0 mock_ffx.return_value = mock_spec_popen - mock_waituntilready.return_value = True + mock_connecttotarget.return_value = True self.assertIsNone(device_target_instance.Start()) self.assertEqual(device_target_instance._node_name, 'device_name') self.assertEqual(device_target_instance._host, 'address') @@ -67,11 +68,12 @@ self.args.node_name = 'device_name' with DeviceTarget.CreateFromArgs(self.args) as device_target_instance, \ mock.patch('subprocess.Popen') as mock_popen, \ - mock.patch.object(Target, '_WaitUntilReady') as mock_waituntilready: + mock.patch.object( + DeviceTarget, '_ConnectToTarget') as mock_connecttotarget: mock_popen.return_value.communicate.return_value = ('address', 'device_name') mock_popen.return_value.returncode = 0 - mock_waituntilready.return_value = True + mock_connecttotarget.return_value = True self.assertIsNone(device_target_instance.Start()) self.assertEqual(device_target_instance._node_name, 'device_name') self.assertEqual(device_target_instance._host, 'address') @@ -103,7 +105,7 @@ self.args.system_image_dir = 'mockdir' with DeviceTarget.CreateFromArgs(self.args) as device_target_instance, \ mock.patch.object(DeviceTarget, '_Discover') as mock_discover, \ - mock.patch.object(DeviceTarget, '_WaitUntilReady') as mock_ready, \ + mock.patch.object(DeviceTarget, '_ConnectToTarget') as mock_connect, \ mock.patch.object(DeviceTarget, '_GetSdkHash') as mock_hash, \ mock.patch.object( DeviceTarget, '_GetInstalledSdkVersion') as mock_version, \ @@ -119,7 +121,7 @@ self.args.system_image_dir = 'mockdir' with DeviceTarget.CreateFromArgs(self.args) as device_target_instance, \ mock.patch.object(DeviceTarget, '_Discover') as mock_discover, \ - mock.patch.object(DeviceTarget, '_WaitUntilReady') as mock_ready, \ + mock.patch.object(DeviceTarget, '_ConnectToTarget') as mock_ready, \ mock.patch.object(DeviceTarget, '_GetSdkHash') as mock_hash, \ mock.patch.object( DeviceTarget, '_GetInstalledSdkVersion') as mock_version, \
diff --git a/build/fuchsia/emu_target.py b/build/fuchsia/emu_target.py index e4b330d..6043417f 100644 --- a/build/fuchsia/emu_target.py +++ b/build/fuchsia/emu_target.py
@@ -13,6 +13,7 @@ import boot_data import common +import ffx_session import pkg_repo import target @@ -29,7 +30,8 @@ super(EmuTarget, self).__init__(out_dir, target_cpu, logs_dir) self._emu_process = None self._pkg_repo = None - self._target_added = False + self._target_context = None + self._ffx_target = None def __enter__(self): return self @@ -46,11 +48,11 @@ # On the bots, we sometimes find that a previous ffx daemon instance is # wedged, leading to failures. Reach out and stop an old daemon if there # happens to be one. - self._StopFfxDaemon() + self._ffx_runner.stop_daemon() # Bots may accumulate stale manually-added targets with the same address # as the one to be added here. Preemtively remove any unknown targets at # this address before starting the emulator and adding it as a target. - self._RemoveStaleTargets(self.LOCAL_ADDRESS) + self._ffx_runner.remove_stale_targets(self.LOCAL_ADDRESS) emu_command = self._BuildCommand() logging.debug(' '.join(emu_command)) @@ -75,20 +77,24 @@ stderr=subprocess.STDOUT, env=self._SetEnv()) try: - self._WaitUntilReady() + self._ConnectToTarget() self.LogProcessStatistics('proc_stat_ready_log') - self._AddFfxTarget() except target.FuchsiaTargetException: + self._DisconnectFromTarget() if temporary_log_file: logging.info('Kernel logs:\n' + open(temporary_log_file.name, 'r').read()) raise + def GetFfxTarget(self): + assert self._ffx_target + return self._ffx_target + def Stop(self): try: - super(EmuTarget, self).Stop() - finally: self.Shutdown() + finally: + super(EmuTarget, self).Stop() def GetPkgRepo(self): if not self._pkg_repo: @@ -100,9 +106,8 @@ if not self._emu_process: logging.error('%s did not start' % (self.EMULATOR_NAME)) return - self._RemoveFfxTarget() if common.IsRunningUnattended(): - self._StopFfxDaemon() + self._ffx_runner.stop_daemon() returncode = self._emu_process.poll() if returncode == None: logging.info('Shutting down %s' % (self.EMULATOR_NAME)) @@ -118,7 +123,7 @@ self.LogProcessStatistics('proc_stat_end_log') self.LogSystemStatistics('system_statistics_end_log') - + self._DisconnectFromTarget() def _IsEmuStillRunning(self): if not self._emu_process: @@ -130,99 +135,25 @@ raise Exception('%s quit unexpectedly.' % (self.EMULATOR_NAME)) return (self.LOCAL_ADDRESS, self._host_ssh_port) + def _ConnectToTarget(self): + logging.info('Connecting to Fuchsia using ffx.') + host, port = self._GetEndpoint() + # The target is a freshly-started emulator, so add it as a target to ffx. + self._target_context = self._ffx_runner.scoped_target_context(host, port) + self._ffx_target = self._target_context.__enter__() + self._ffx_target.wait(common.ATTACH_RETRY_SECONDS) + return super(EmuTarget, self)._ConnectToTarget() + + def _DisconnectFromTarget(self): + super(EmuTarget, self)._DisconnectFromTarget() + if self._target_context: + self._ffx_target = None + self._target_context.__exit__(None, None, None) + self._target_context = None + def _GetSshConfigPath(self): return boot_data.GetSSHConfigPath() - def _RunFfxCommand(self, arguments): - """Runs an ffx command with some arguments. - - Args: - arguments: An iterable of the argument strings to pass to ffx. - - Returns: - A string holding merged stdout and stderr from the command if the command - succeeded. - - Raises: - Any exception raised by subprocess.run(). - """ - ffx = os.path.join(common.SDK_ROOT, 'tools', - common.GetHostArchFromPlatform(), 'ffx') - command = [ffx] - command.extend(arguments) - logging.debug(command) - try: - completed_process = subprocess.run(command, - check=True, - stdin=open(os.devnull, 'r'), - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, - encoding='utf-8') - if completed_process.stdout: - logging.debug('ffx succeeded with output\n%s' % - completed_process.stdout) - return completed_process.stdout - except subprocess.CalledProcessError as cpe: - logging.exception('ffx failed with output\n%s' % cpe.stdout) - raise - - def _StopFfxDaemon(self): - try: - self._RunFfxCommand(['daemon', 'stop']) - return - except subprocess.CalledProcessError as cpe: - pass - logging.error('Failed to stop the damon. Attempting to restart it via ffx' + - ' doctor') - self._RunFfxCommand(['doctor', '--restart-daemon']) - - def _RemoveStaleTargets(self, address): - """Removes any targets from ffx that are listening at a given address. - - Args: - address: A string representation of the target's ip address. - """ - json_targets = self._RunFfxCommand(['target', 'list', '-f', 'j']) - if not json_targets: - return - try: - targets = json.loads(json_targets) - except json.JSONDecodeError as e: - logging.debug('ffx target list returned non-json text: %s' % json_targets) - return - for target in targets: - if target['rcs_state'] == 'N' and address in target['addresses']: - self._RunFfxCommand(['target', 'remove', address]) - - def _SetDefaultFfxTarget(self, address): - """Sets the default target for other ffx commands. - - Args: - address: A string representation of the target's ip address. - """ - targets = json.loads(self._RunFfxCommand(['target', 'list', '-f', 'j'])) - for target in targets: - if (target['rcs_state'] == 'N' or target['nodename'] == '<unknown>' - or address not in target['addresses']): - continue - self._RunFfxCommand(['target', 'default', 'set', target['nodename']]) - break - - def _AddFfxTarget(self): - """Adds a target to ffx for the emulated target.""" - endpoint = self._GetEndpoint() - self._RunFfxCommand(['target', 'add', ':'.join(map(str, endpoint))]) - self._target_added = True - self._SetDefaultFfxTarget(endpoint[0]) - - def _RemoveFfxTarget(self): - """Removes the emulated target from ffx.""" - if not self._target_added: - return - self._RunFfxCommand( - ['target', 'remove', ':'.join(map(str, self._GetEndpoint()))]) - self._target_added = False - def LogSystemStatistics(self, log_file_name): self._LaunchSubprocessWithLogs(['top', '-b', '-n', '1'], log_file_name) self._LaunchSubprocessWithLogs(['ps', '-ax'], log_file_name)
diff --git a/build/fuchsia/exit_on_sig_term.py b/build/fuchsia/exit_on_sig_term.py new file mode 100644 index 0000000..7db10cbd --- /dev/null +++ b/build/fuchsia/exit_on_sig_term.py
@@ -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. + +import signal +import sys + + +# TODO(grt): Derive from contextlib.AbstractContextManager when p3 is supported. +class ExitOnSigTerm(): + """A context manager that calls sys.exit(0) upon receipt of SIGTERM. This + results in a SystemExit exception being raised, which causes any finally + clauses to be run and other contexts to be cleaned up. + """ + + def __init__(self): + self._previous_handler = None + + def __enter__(self): + self._previous_handler = signal.signal( + signal.SIGTERM, lambda sig_num, frame: sys.exit(0)) + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + signal.signal(signal.SIGTERM, self._previous_handler) + return False
diff --git a/build/fuchsia/ffx_session.py b/build/fuchsia/ffx_session.py new file mode 100755 index 0000000..df985e5 --- /dev/null +++ b/build/fuchsia/ffx_session.py
@@ -0,0 +1,347 @@ +#!/usr/bin/env vpython +# 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. +"""A helper tool for running Fuchsia's `ffx`. +""" + +# Enable use of the print() built-in function. +from __future__ import print_function + +import argparse +import contextlib +import errno +import json +import logging +import os +import shutil +import subprocess +import sys +import tempfile + +import common +import log_manager + + +def get_ffx_path(): + """Returns the full path to `ffx`.""" + return os.path.join(common.SDK_ROOT, 'tools', + common.GetHostArchFromPlatform(), 'ffx') + + +class FfxRunner(): + """A helper to run `ffx` commands.""" + + def __init__(self, log_manager): + self._ffx = get_ffx_path() + self._log_manager = log_manager + + def run_ffx(self, args, check=True): + """Runs `ffx` with the given arguments, waiting for it to exit. + Args: + args: A sequence of arguments to ffx. + check: If True, CalledProcessError is raised if ffx returns a non-zero + exit code. + Returns: + A string containing combined stdout and stderr. + Raises: + CalledProcessError if `check` is true. + """ + log_file = self._log_manager.Open('ffx_log') \ + if self._log_manager.IsLoggingEnabled() else None + command = [self._ffx] + command.extend(args) + logging.debug(command) + if log_file: + print(command, file=log_file) + try: + # TODO(grt): Switch to subprocess.run() with encoding='utf-8' when p3 is + # supported. + process = subprocess.Popen(command, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + stdoutdata = process.communicate()[0].decode('utf-8') + if check and process.returncode != 0: + raise subprocess.CalledProcessError(process.returncode, command, + stdoutdata) + except subprocess.CalledProcessError as cpe: + if log_file: + log_file.write('Process exited with code %d. Output: %s\n' % + (cpe.returncode, cpe.output.strip())) + raise + if log_file: + log_file.write('Process exited with code %d. Output: %s\n' % + (process.returncode, stdoutdata.strip())) + logging.debug('ffx command returned %d with output %s', process.returncode, + stdoutdata.strip()) + return stdoutdata + + def open_ffx(self, args): + """Runs `ffx` with some arguments. + Args: + args: A sequence of arguments to ffx. + Returns: + A subprocess.Popen object. + """ + log_file = self._log_manager.Open('ffx_log') \ + if self._log_manager.IsLoggingEnabled() else None + command = [self._ffx] + command.extend(args) + logging.debug(command) + if log_file: + print(command, file=log_file) + try: + # TODO(grt): Add encoding='utf-8' when p3 is supported. + return subprocess.Popen(command, + stdin=open(os.devnull, 'r'), + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + except: + logging.exception('Failed to open ffx') + if log_file: + print('Exception caught while opening ffx: %s' % str(sys.exc_info[1])) + raise + + @contextlib.contextmanager + def scoped_config(self, name, value): + """Temporarily overrides `ffx` configuration. + + Args: + name: The name of the property to set. + value: The value to associate with `name`. + + Returns: + Yields nothing. Restores the previous value upon exit. + """ + assert value is not None + # Cache the current value. + old_value = None + try: + old_value = self.run_ffx(['config', 'get', name]).strip() + except subprocess.CalledProcessError as cpe: + if cpe.returncode != 2: + raise # The failure was for something other than value not found. + # Set the new value if it is different. + if value != old_value: + self.run_ffx(['config', 'set', name, value]) + try: + yield None + finally: + if value == old_value: + return # There is no need to restore an old value. + # Clear the new value. + self.run_ffx(['config', 'remove', name]) + if old_value is None: + return + # Did removing the new value restore the original value on account of it + # either being the default or being set in a different scope? + if (self.run_ffx(['config', 'get', name], + check=False).strip() == old_value): + return + # If not, explicitly set the original value. + self.run_ffx(['config', 'set', name, old_value]) + + def stop_daemon(self): + """Stops the ffx daemon. + + If an initial attempt to stop it via `ffx daemon stop` fails, + `ffx doctor --restart-daemon` is used to force a restart. + """ + try: + self.run_ffx(['daemon', 'stop']) + return + except subprocess.CalledProcessError: + pass + logging.error('Failed to stop the damon. Attempting to restart it via ffx' + + ' doctor') + self.run_ffx(['doctor', '--restart-daemon'], check=False) + + def remove_stale_targets(self, address): + """Removes any targets from ffx that are listening at a given address. + + Args: + address: A string representation of the target's ip address. + """ + json_targets = self.run_ffx(['target', 'list', '-f', 'j']) + if not json_targets: + return + try: + targets = json.loads(json_targets) + except ValueError: + # TODO(grt): Change to json.JSONDecodeError once p3 is supported. + logging.debug('No stale targets to remove') + return + for target in targets: + if target['rcs_state'] == 'N' and address in target['addresses']: + self.run_ffx(['target', 'remove', address]) + + @contextlib.contextmanager + def scoped_target_context(self, address, port): + """Temporarily adds a new target. + + Args: + address: The IP address at which the target is listening. + port: The port number on which the target is listening. + + Yields: + An FfxTarget for interacting with the target. + """ + address_and_port = '%s:%d' % (address, port) + self.run_ffx(['target', 'add', address_and_port]) + try: + yield FfxTarget(self, address=address, port=port) + finally: + self.run_ffx(['target', 'remove', address_and_port], check=False) + + +class FfxTarget(): + """A helper to run `ffx` commands for a specific target.""" + + def __init__(self, ffx_runner, address=None, port=None, node_name=None): + """Args: + ffx_runner: The runner to use to run ffx. + address: The IP address at which the target is listening. + port: The port number on which the target is listening. + node_name: The target's node name. + """ + # Both or neither address and port must be specified. + assert (address is not None) == (port is not None) + # Either node_name or address+port must be specified. + assert (node_name is not None) != (address is not None) + self._ffx_runner = ffx_runner + self._address = address + self._port = port + self._node_name = node_name + target_identifier = node_name if (node_name is not None) else \ + ('%s:%d' % (self._address, self._port)) + self._target_args = ('--target', target_identifier) + + def wait(self, timeout=None): + """Waits for ffx to establish a connection with the target. + + Args: + timeout: The number of seconds to wait (60 if not specified). + """ + command = list(self._target_args) + command.extend(('target', 'wait')) + if timeout is not None: + command.extend(('-t', '%d' % int(timeout))) + self._ffx_runner.run_ffx(command) + + def open_ffx(self, command): + """Runs `ffx` for the target with some arguments. + Args: + command: A command and its arguments to run on the target. + Returns: + A subprocess.Popen object. + """ + args = list(self._target_args) + args.extend(command) + return self._ffx_runner.open_ffx(args) + + +# TODO(grt): Derive from contextlib.AbstractContextManager when p3 is supported. +class FfxSession(): + """A context manager that manages a session for running a test via `ffx`. + + Upon entry, an instance of this class configures `ffx` to retrieve files + generated by a test and prepares a directory to hold these files either in a + LogManager's log directory or in tmp. On exit, any previous configuration of + `ffx` is restored and the temporary directory, if used, is deleted. + + The prepared directory is used when invoking `ffx test run`. + """ + + def __init__(self, log_manager): + """Args: + log_manager: A Target's LogManager. + """ + self._log_manager = log_manager + self._ffx = FfxRunner(log_manager) + self._structured_output_config = None + self._own_output_dir = False + self._output_dir = None + + def __enter__(self): + # Enable experimental structured output for ffx. + self._structured_output_config = self._ffx.scoped_config( + 'test.experimental_structured_output', 'true') + self._structured_output_config.__enter__() + if self._log_manager.IsLoggingEnabled(): + # Use a subdir of the configured log directory to hold test outputs. + self._output_dir = os.path.join(self._log_manager.GetLogDirectory(), + 'test_outputs') + # TODO(grt): Use exist_ok=True when p3 is supported. + try: + os.makedirs(self._output_dir) + except OSError as ose: + if ose.errno != errno.EEXIST: + raise + else: + # Create a temporary directory to hold test outputs. + # TODO(grt): Switch to tempfile.TemporaryDirectory when p3 is supported. + self._own_output_dir = True + self._output_dir = tempfile.mkdtemp(prefix='ffx_session_tmp_') + return self + + def __exit__(self, exc_type, exc_val, exc_tb): + # Restore the previous test.output_path setting. + if self._own_output_dir: + # Clean up the temporary output directory. + shutil.rmtree(self._output_dir, ignore_errors=True) + self._own_output_dir = False + self._output_dir = None + # Restore the previous experimental structured output setting. + self._structured_output_config.__exit__(exc_type, exc_val, exc_tb) + self._structured_output_config = None + return False + + def get_output_dir(self): + """Returns the temporary output directory for the session.""" + assert self._output_dir, 'FfxSession must be used in a context' + return self._output_dir + + def test_run(self, ffx_target, component_uri, package_args): + """Runs a test on a target. + Args: + ffx_target: The target on which to run the test. + component_uri: The test component URI. + package_args: Arguments to the test package. + Returns: + A subprocess.Popen object. + """ + command = [ + 'test', 'run', '--output-directory', self._output_dir, component_uri, + '--' + ] + command.extend(package_args) + return ffx_target.open_ffx(command) + + +def make_arg_parser(): + parser = argparse.ArgumentParser( + description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + parser.add_argument('--logs-dir', help='Directory to write logs to.') + parser.add_argument('--verbose', + '-v', + action='store_true', + default=False, + help='Enable debug logging') + return parser + + +def main(args): + args = make_arg_parser().parse_args(args) + + logging.basicConfig(format='%(asctime)s:%(levelname)s:%(name)s:%(message)s', + level=logging.DEBUG if args.verbose else logging.INFO) + log_mgr = log_manager.LogManager(args.logs_dir) + + with FfxSession(log_mgr) as ffx_session: + logging.info(ffx_session.get_output_dir()) + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv[1:]))
diff --git a/build/fuchsia/fvdl_target.py b/build/fuchsia/fvdl_target.py index 058ded0..304cdf88 100644 --- a/build/fuchsia/fvdl_target.py +++ b/build/fuchsia/fvdl_target.py
@@ -174,10 +174,10 @@ for flag in env_flags: emu_command.extend(['--envs', flag]) - def _WaitUntilReady(self): + def _ConnectToTarget(self): # Indicates the FVDL command finished running. self._emu_process.communicate() - super(FvdlTarget, self)._WaitUntilReady() + super(FvdlTarget, self)._ConnectToTarget() def _IsEmuStillRunning(self): if not self._pid:
diff --git a/build/fuchsia/generic_x64_target.py b/build/fuchsia/generic_x64_target.py index 439aff7..a058971 100644 --- a/build/fuchsia/generic_x64_target.py +++ b/build/fuchsia/generic_x64_target.py
@@ -51,7 +51,7 @@ should_provision = False if self._Discover(): - self._WaitUntilReady() + self._ConnectToTarget() if self._os_check != 'ignore': if self._SDKHashMatches():
diff --git a/build/fuchsia/run_test_package.py b/build/fuchsia/run_test_package.py index aa4e99e..f594e500 100644 --- a/build/fuchsia/run_test_package.py +++ b/build/fuchsia/run_test_package.py
@@ -19,6 +19,7 @@ import time import uuid +from exit_on_sig_term import ExitOnSigTerm from symbolizer import BuildIdsPaths, RunSymbolizer FAR = common.GetHostToolPathFromPlatform('far') @@ -167,13 +168,13 @@ return RunSymbolizer(input_fd, subprocess.PIPE, ids_txt_files) -def RunTestPackage(output_dir, target, package_paths, package_name, +def RunTestPackage(target, ffx_session, package_paths, package_name, package_component_version, package_args, args): """Installs the Fuchsia package at |package_path| on the target, executes it with |package_args|, and symbolizes its output. - output_dir: The path containing the build output files. target: The deployment Target object that will run the package. + ffx_session: An FfxSession object if the test is to be run via ffx, or None. package_paths: The paths to the .far packages to be installed. package_name: The name of the primary package to run. package_component_version: The component version of the primary package to @@ -193,7 +194,7 @@ log_output_thread.daemon = True log_output_thread.start() - with target.GetPkgRepo(): + with ExitOnSigTerm(), target.GetPkgRepo(): on_target = True start_time = time.time() target.InstallPackage(package_paths) @@ -206,17 +207,10 @@ logging.info('Running application.') component_uri = _GetComponentUri(package_name, package_component_version) - if package_component_version == '2': - ffx = os.path.join(common.SDK_ROOT, 'tools', - common.GetHostArchFromPlatform(), 'ffx') - command = [ - ffx, '--config', 'test.experimental_structured_output=true', 'test', - 'run' - ] - if args.output_directory: - command += ['--output-directory', args.output_directory] - command += [component_uri, '--'] - on_target = False + process = None + if ffx_session: + process = ffx_session.test_run(target.GetFfxTarget(), component_uri, + package_args) elif args.code_coverage: # TODO(crbug.com/1156768): Deprecate runtests. # runtests requires specifying an output directory and a double dash @@ -225,27 +219,23 @@ if args.test_realm_label: command += ['--realm-label', args.test_realm_label] command += ['--'] + command.extend(package_args) elif args.use_run_test_component: command = ['run-test-component'] if args.test_realm_label: command += ['--realm-label=%s' % args.test_realm_label] command.append(component_uri) command.append('--') + command.extend(package_args) else: command = ['run', component_uri] - command.extend(package_args) + command.extend(package_args) - if on_target: + if process is None: process = target.RunCommandPiped(command, stdin=open(os.devnull, 'r'), stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - else: - logging.debug(command) - process = subprocess.Popen(command, - stdin=open(os.devnull, 'r'), - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) # Symbolize klog and systemlog as separate streams. The symbolizer # protocol is stateful, so comingled raw stack dumps can yield
diff --git a/build/fuchsia/start_emulator.py b/build/fuchsia/start_emulator.py index 2b6db18a9..2f369e9 100755 --- a/build/fuchsia/start_emulator.py +++ b/build/fuchsia/start_emulator.py
@@ -13,6 +13,7 @@ import subprocess from aemu_target import AemuTarget +from exit_on_sig_term import ExitOnSigTerm from fvdl_target import FvdlTarget @@ -29,7 +30,8 @@ args.device = 'fvdl' args.cpu_cores = 4 common_args.ConfigureLogging(args) - with common_args.GetDeploymentTargetForArgs(args) as fvdl_target: + with ExitOnSigTerm(), \ + common_args.GetDeploymentTargetForArgs(args) as fvdl_target: if fvdl_target._with_network: logging.info('If you haven\'t set up tuntap, you may be prompted ' 'for your sudo password to set up tuntap.')
diff --git a/build/fuchsia/target.py b/build/fuchsia/target.py index e723e7c..73c388f 100644 --- a/build/fuchsia/target.py +++ b/build/fuchsia/target.py
@@ -9,6 +9,7 @@ import time import common +import ffx_session import remote_cmd from log_manager import LogManager @@ -17,7 +18,6 @@ _SHUTDOWN_CMD = ['dm', 'poweroff'] _ATTACH_RETRY_INTERVAL = 1 -_ATTACH_RETRY_SECONDS = 120 # Amount of time to wait for a complete package installation, as a # mitigation against hangs due to pkg/network-related failures. @@ -76,6 +76,7 @@ self._ffx_path = os.path.join(common.SDK_ROOT, 'tools', common.GetHostArchFromPlatform(), 'ffx') self._log_manager = LogManager(logs_dir) + self._ffx_runner = ffx_session.FfxRunner(self._log_manager) @staticmethod def CreateFromArgs(args): @@ -100,6 +101,10 @@ commands.""" return self._started + def GetFfxTarget(self): + """Returns the FfxTarget instance to use to interact with this target.""" + raise NotImplementedError() + def Stop(self): """Stop all subprocesses and close log streams.""" if self._symbolizer_proc: @@ -289,11 +294,11 @@ def _AssertIsStarted(self): assert self.IsStarted() - def _WaitUntilReady(self): + def _ConnectToTarget(self): logging.info('Connecting to Fuchsia using SSH.') host, port = self._GetEndpoint() - end_time = time.time() + _ATTACH_RETRY_SECONDS + end_time = time.time() + common.ATTACH_RETRY_SECONDS ssh_diagnostic_log = self._log_manager.Open('ssh_diagnostic_log') while time.time() < end_time: runner = remote_cmd.CommandRunner(self._GetSshConfigPath(), host, port) @@ -312,6 +317,9 @@ raise FuchsiaTargetException('Couldn\'t connect using SSH.') + def _DisconnectFromTarget(self): + pass + def _GetSshConfigPath(self, path): raise NotImplementedError()
diff --git a/build/fuchsia/test_runner.py b/build/fuchsia/test_runner.py index bcede99e..29dc33f 100755 --- a/build/fuchsia/test_runner.py +++ b/build/fuchsia/test_runner.py
@@ -12,6 +12,7 @@ import sys import tempfile +import ffx_session from common_args import AddCommonArgs, AddTargetSpecificArgs, \ ConfigureLogging, GetDeploymentTargetForArgs from net_test_server import SetupTestServer @@ -41,6 +42,9 @@ def __exit__(self, exc_type, exc_val, exc_tb): return False + def GetFfxSession(self): + raise NotImplementedError() + def GetDevicePath(self, path): """Returns an absolute device-local variant of a path.""" return '' @@ -51,7 +55,7 @@ class TargetTestOutputs(TestOutputs): - """A TestOutputs implementation for CFv2 tests, where tests emit files into + """A TestOutputs implementation for CFv1 tests, where tests emit files into /tmp that are retrieved from the device via ssh.""" def __init__(self, target, package_name, test_realms): @@ -60,6 +64,9 @@ self._package_name = package_name self._test_realms = test_realms + def GetFfxSession(self): + return None # ffx is not used to run CFv1 tests. + def GetDevicePath(self, path): return TEST_DATA_DIR + '/' + path @@ -80,33 +87,41 @@ """A TestOutputs implementation for CFv2 tests, where tests emit files into /custom_artifacts that are retrieved from the device automatically via ffx.""" - def __init__(self): + def __init__(self, target): super(CustomArtifactsTestOutputs, self).__init__() - self._directory_manager = tempfile.TemporaryDirectory() + self._target = target + self._ffx_session_context = ffx_session.FfxSession(target._log_manager) + self._ffx_session = None def __enter__(self): - self._directory_manager.__enter__() + self._ffx_session = self._ffx_session_context.__enter__() return self def __exit__(self, exc_type, exc_val, exc_tb): - return self._directory_manager.__exit__(exc_type, exc_val, exc_tb) + self._ffx_session = None + self._ffx_session_context.__exit__(exc_type, exc_val, exc_tb) + return False + + def GetFfxSession(self): + assert self._ffx_session + return self._ffx_session def GetDevicePath(self, path): return '/custom_artifacts/' + path def GetOutputDirectory(self): - return self._directory_manager.name + return self._ffx_session.get_output_dir() def GetFile(self, glob, destination): """Places all files/directories matched by a glob into a destination.""" shutil.copy( - os.path.join(self._directory_manager.name, 'artifact-0', 'custom-0', - glob), destination) + os.path.join(self.GetOutputDirectory(), 'artifact-0', 'custom-0', glob), + destination) def MakeTestOutputs(component_version, target, package_name, test_realms): if component_version == '2': - return CustomArtifactsTestOutputs() + return CustomArtifactsTestOutputs(target) return TargetTestOutputs(target, package_name, test_realms) @@ -334,9 +349,10 @@ run_package_args.use_run_test_component = True if args.component_version == "2": run_package_args.output_directory = test_outputs.GetOutputDirectory() - returncode = RunTestPackage(args.out_dir, target, args.package, - args.package_name, args.component_version, - child_args, run_package_args) + returncode = RunTestPackage(target, test_outputs.GetFfxSession(), + args.package, args.package_name, + args.component_version, child_args, + run_package_args) if test_server: test_server.Stop()
diff --git a/cc/paint/oop_pixeltest.cc b/cc/paint/oop_pixeltest.cc index 06e3e3c..ef52ee3 100644 --- a/cc/paint/oop_pixeltest.cc +++ b/cc/paint/oop_pixeltest.cc
@@ -79,7 +79,7 @@ gles2_context_provider_ = base::MakeRefCounted<viz::TestInProcessContextProvider>( /*enable_gles2_interface=*/true, /*support_locking=*/true, - viz::RasterInterfaceType::LEGACY_GPU); + viz::RasterInterfaceType::GPU); gpu::ContextResult result = gles2_context_provider_->BindToCurrentThread(); DCHECK_EQ(result, gpu::ContextResult::kSuccess); const int gles2_max_texture_size = @@ -105,7 +105,8 @@ raster_context_provider_ = base::MakeRefCounted<viz::TestInProcessContextProvider>( /*enable_gles2_interface=*/false, /*support_locking=*/true, - viz::RasterInterfaceType::GPU, &gr_shader_cache_, &activity_flags_); + viz::RasterInterfaceType::OOPR, &gr_shader_cache_, + &activity_flags_); gpu::ContextResult result = raster_context_provider_->BindToCurrentThread(); DCHECK_EQ(result, gpu::ContextResult::kSuccess); const int raster_max_texture_size =
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index 3fdc2959..951c2b6 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc
@@ -79,7 +79,7 @@ viz::RasterInterfaceType worker_ri_type; switch (raster_type()) { case TestRasterType::kGpu: - worker_ri_type = viz::RasterInterfaceType::GPU; + worker_ri_type = viz::RasterInterfaceType::OOPR; break; case TestRasterType::kOneCopy: worker_ri_type = viz::RasterInterfaceType::Software;
diff --git a/cc/tiles/gpu_image_decode_cache_perftest.cc b/cc/tiles/gpu_image_decode_cache_perftest.cc index 77b10ee3..b018856 100644 --- a/cc/tiles/gpu_image_decode_cache_perftest.cc +++ b/cc/tiles/gpu_image_decode_cache_perftest.cc
@@ -35,7 +35,7 @@ return SkM44::Scale(scale.width(), scale.height()); } -enum class TestMode { kGpu, kSw }; +enum class TestMode { kGpu, kTransferCache, kSw }; class GpuImageDecodeCachePerfTest : public testing::Test, @@ -64,18 +64,23 @@ size_t MaxTextureSize() const { switch (GetParam()) { case TestMode::kGpu: + case TestMode::kTransferCache: return 4096; case TestMode::kSw: return 0; } } - bool UseTransferCache() const { return GetParam() == TestMode::kGpu; } + bool UseTransferCache() const { + return GetParam() == TestMode::kTransferCache; + } const char* ParamName() const { switch (GetParam()) { case TestMode::kGpu: return "GPU"; + case TestMode::kTransferCache: + return "TransferCache"; case TestMode::kSw: return "SW"; } @@ -85,6 +90,8 @@ switch (mode) { case TestMode::kGpu: return viz::RasterInterfaceType::GPU; + case TestMode::kTransferCache: + return viz::RasterInterfaceType::OOPR; case TestMode::kSw: return viz::RasterInterfaceType::Software; default: @@ -108,7 +115,9 @@ INSTANTIATE_TEST_SUITE_P(P, GpuImageDecodeCachePerfTest, - testing::Values(TestMode::kGpu, TestMode::kSw)); + testing::Values(TestMode::kGpu, + TestMode::kTransferCache, + TestMode::kSw)); TEST_P(GpuImageDecodeCachePerfTest, DecodeWithColorConversion) { timer_.Reset(); @@ -135,7 +144,8 @@ using GpuImageDecodeCachePerfTestNoSw = GpuImageDecodeCachePerfTest; INSTANTIATE_TEST_SUITE_P(P, GpuImageDecodeCachePerfTestNoSw, - testing::Values(TestMode::kGpu)); + testing::Values(TestMode::kGpu, + TestMode::kTransferCache)); TEST_P(GpuImageDecodeCachePerfTestNoSw, DecodeWithMips) { // Surface to render into. @@ -155,6 +165,15 @@ DecodedDrawImage decoded_image = cache_->GetDecodedImageForDraw(image); + if (GetParam() == TestMode::kGpu) { + SkSamplingOptions sampling(SkFilterMode::kLinear, SkMipmapMode::kLinear); + surface->getCanvas()->drawImageRect( + decoded_image.image().get(), SkRect::MakeWH(1024, 2048), + SkRect::MakeWH(614, 1229), sampling, nullptr, + SkCanvas::kStrict_SrcRectConstraint); + surface->flushAndSubmit(); + } + cache_->DrawWithImageFinished(image, decoded_image); timer_.NextLap(); } while (!timer_.HasTimeLimitExpired());
diff --git a/chrome/VERSION b/chrome/VERSION index 2c9bf2eb..9ce3fbbc 100644 --- a/chrome/VERSION +++ b/chrome/VERSION
@@ -1,4 +1,4 @@ MAJOR=99 MINOR=0 -BUILD=4836 +BUILD=4837 PATCH=0
diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni index d68119ad..3cf8e16 100644 --- a/chrome/android/chrome_java_resources.gni +++ b/chrome/android/chrome_java_resources.gni
@@ -73,7 +73,6 @@ "java/res/drawable-hdpi/infobar_translate.png", "java/res/drawable-hdpi/jcb_card.png", "java/res/drawable-hdpi/location_bar_incognito_badge.png", - "java/res/drawable-hdpi/logo_card_back.png", "java/res/drawable-hdpi/mc_card.png", "java/res/drawable-hdpi/menu_update.png", "java/res/drawable-hdpi/offline_pin.png", @@ -169,7 +168,6 @@ "java/res/drawable-mdpi/infobar_translate.png", "java/res/drawable-mdpi/jcb_card.png", "java/res/drawable-mdpi/location_bar_incognito_badge.png", - "java/res/drawable-mdpi/logo_card_back.png", "java/res/drawable-mdpi/mc_card.png", "java/res/drawable-mdpi/menu_update.png", "java/res/drawable-mdpi/offline_pin.png", @@ -266,7 +264,6 @@ "java/res/drawable-xhdpi/infobar_translate.png", "java/res/drawable-xhdpi/jcb_card.png", "java/res/drawable-xhdpi/location_bar_incognito_badge.png", - "java/res/drawable-xhdpi/logo_card_back.png", "java/res/drawable-xhdpi/mc_card.png", "java/res/drawable-xhdpi/menu_update.png", "java/res/drawable-xhdpi/offline_pin.png",
diff --git a/chrome/android/expectations/lint-suppressions.xml b/chrome/android/expectations/lint-suppressions.xml index e356c47..00d58576 100644 --- a/chrome/android/expectations/lint-suppressions.xml +++ b/chrome/android/expectations/lint-suppressions.xml
@@ -23,7 +23,7 @@ <!-- This is intentional to reduce APK size. See: http://crrev/c/1352161 --> <ignore regexp="chrome/android/features/autofill_assistant/java/res/drawable-*"/> <!-- Originals are gone, so ignore these specific ones: crbug.com/457918 --> - <ignore regexp="btn_bg_holo_active_normal.png, btn_bg_holo_active_pressed.png, btn_bg_holo_pressed.png, logo_card_back.png"/> + <ignore regexp="btn_bg_holo_active_normal.png, btn_bg_holo_active_pressed.png, btn_bg_holo_pressed.png"/> <!-- This is intentional to save on WebAPKs' size. --> <ignore regexp="chrome/android/webapk/shell_apk/res/drawable-*"/> </issue>
diff --git a/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/StartSurfaceLayout.java b/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/StartSurfaceLayout.java index e7c16a3..b067f83e7 100644 --- a/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/StartSurfaceLayout.java +++ b/chrome/android/features/start_surface/internal/java/src/org/chromium/chrome/features/start_surface/StartSurfaceLayout.java
@@ -114,7 +114,7 @@ public StartSurfaceLayout(Context context, LayoutUpdateHost updateHost, LayoutRenderHost renderHost, StartSurface startSurface, JankTracker jankTracker) { super(context, updateHost, renderHost); - mDummyLayoutTab = createLayoutTab(Tab.INVALID_TAB_ID, false, false, false); + mDummyLayoutTab = createLayoutTab(Tab.INVALID_TAB_ID, false); mDummyLayoutTab.setShowToolbar(true); mStartSurface = startSurface; mStartSurface.setOnTabSelectingListener(this::onTabSelecting); @@ -246,8 +246,8 @@ // Keep the current tab in mLayoutTabs even if we are not going to show the shrinking // animation so that thumbnail taking is not blocked. - LayoutTab sourceLayoutTab = createLayoutTab(mTabModelSelector.getCurrentTabId(), - mTabModelSelector.isIncognitoSelected(), NO_CLOSE_BUTTON, NO_TITLE); + LayoutTab sourceLayoutTab = createLayoutTab( + mTabModelSelector.getCurrentTabId(), mTabModelSelector.isIncognitoSelected()); sourceLayoutTab.setDecorationAlpha(0); mLayoutTabs = new LayoutTab[] {sourceLayoutTab}; @@ -331,8 +331,8 @@ sourceTabId = mTabModelSelector.getCurrentTabId(); } - LayoutTab sourceLayoutTab = createLayoutTab( - sourceTabId, mTabModelSelector.isIncognitoSelected(), NO_CLOSE_BUTTON, NO_TITLE); + LayoutTab sourceLayoutTab = + createLayoutTab(sourceTabId, mTabModelSelector.isIncognitoSelected()); sourceLayoutTab.setDecorationAlpha(0); List<LayoutTab> layoutTabs = new ArrayList<>(); @@ -341,8 +341,8 @@ if (sourceTabId != mTabModelSelector.getCurrentTabId()) { // Keep the original tab in mLayoutTabs to unblock thumbnail taking at the end of // the animation. - LayoutTab originalTab = createLayoutTab(mTabModelSelector.getCurrentTabId(), - mTabModelSelector.isIncognitoSelected(), NO_CLOSE_BUTTON, NO_TITLE); + LayoutTab originalTab = createLayoutTab( + mTabModelSelector.getCurrentTabId(), mTabModelSelector.isIncognitoSelected()); originalTab.setScale(0); originalTab.setDecorationAlpha(0); layoutTabs.add(originalTab);
diff --git a/chrome/android/java/res/drawable-hdpi/logo_card_back.png b/chrome/android/java/res/drawable-hdpi/logo_card_back.png deleted file mode 100644 index bc84ddb..0000000 --- a/chrome/android/java/res/drawable-hdpi/logo_card_back.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-mdpi/logo_card_back.png b/chrome/android/java/res/drawable-mdpi/logo_card_back.png deleted file mode 100644 index d086bcd..0000000 --- a/chrome/android/java/res/drawable-mdpi/logo_card_back.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/drawable-xhdpi/logo_card_back.png b/chrome/android/java/res/drawable-xhdpi/logo_card_back.png deleted file mode 100644 index 6a333bf..0000000 --- a/chrome/android/java/res/drawable-xhdpi/logo_card_back.png +++ /dev/null Binary files differ
diff --git a/chrome/android/java/res/values/colors.xml b/chrome/android/java/res/values/colors.xml index eb4ccf60..d7a6da06 100644 --- a/chrome/android/java/res/values/colors.xml +++ b/chrome/android/java/res/values/colors.xml
@@ -14,8 +14,6 @@ <!-- Tab Switcher Colors --> <color name="tab_switcher_background">#14181C</color> <color name="accessibility_tab_switcher_list_item">#252525</color> - <color name="tab_back">#F1F1F1</color> - <color name="tab_back_incognito">#4F4F4F</color> <!-- App menu colors --> <color name="update_menu_item_text_color">@color/default_red</color>
diff --git a/chrome/android/java/res/values/dimens.xml b/chrome/android/java/res/values/dimens.xml index 9ec6f62b..734efbe 100644 --- a/chrome/android/java/res/values/dimens.xml +++ b/chrome/android/java/res/values/dimens.xml
@@ -16,8 +16,6 @@ <dimen name="toolbar_swipe_space_between_tabs">30dp</dimen> <!-- TabSwitcher - The minimum distance from the edge to commit a toolbar side swap. --> <dimen name="toolbar_swipe_commit_distance">90dp</dimen> - <!-- TabSwitcher - The size of the close button on each tab. --> - <dimen name="tab_switcher_close_button_size">20dp</dimen> <!-- Tab title --> <dimen name="border_texture_title_fade">24dp</dimen> <!-- 40px hdpi -->
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivitySessionTracker.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivitySessionTracker.java index 5d3dade3..5276ca1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivitySessionTracker.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivitySessionTracker.java
@@ -29,6 +29,7 @@ import org.chromium.chrome.browser.metrics.VariationsSession; import org.chromium.chrome.browser.notifications.NotificationPlatformBridge; import org.chromium.chrome.browser.partnercustomizations.PartnerBrowserCustomizations; +import org.chromium.chrome.browser.password_manager.PasswordManagerLifecycleHelper; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; @@ -162,6 +163,7 @@ mPowerBroadcastReceiver.onForegroundSessionStart(); AppHooks.get().getChimeDelegate().startSession(); ReadingListBridge.onStartChromeForeground(); + PasswordManagerLifecycleHelper.getInstance().onStartForegroundSession(); // Track the ratio of Chrome startups that are caused by notification clicks. // TODO(johnme): Add other reasons (and switch to recordEnumeratedHistogram).
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/Layout.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/Layout.java index 3f2ed2d..2aa4b47 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/Layout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/Layout.java
@@ -64,12 +64,6 @@ int USE_PREVIOUS_BROWSER_CONTROLS_STATE = 3; } - // Defines to make the code easier to read. - public static final boolean NEED_TITLE = true; - public static final boolean NO_TITLE = false; - public static final boolean SHOW_CLOSE_BUTTON = true; - public static final boolean NO_CLOSE_BUTTON = false; - /** Length of the unstalling animation. **/ public static final long UNSTALLED_ANIMATION_DURATION_MS = 500; @@ -171,31 +165,26 @@ * Creates a {@link LayoutTab}. * @param id The id of the reference {@link Tab} in the {@link TabModel}. * @param isIncognito Whether the new tab is incognito. - * @param showCloseButton True to show and activate a close button on the border. - * @param isTitleNeeded Whether a title will be shown. * @return The newly created {@link LayoutTab}. */ - public LayoutTab createLayoutTab( - int id, boolean isIncognito, boolean showCloseButton, boolean isTitleNeeded) { - return createLayoutTab(id, isIncognito, showCloseButton, isTitleNeeded, -1.f, -1.f); + public LayoutTab createLayoutTab(int id, boolean isIncognito) { + return createLayoutTab(id, isIncognito, -1.f, -1.f); } /** * Creates a {@link LayoutTab}. * @param id The id of the reference {@link Tab} in the {@link TabModel}. * @param isIncognito Whether the new tab is incognito. - * @param showCloseButton True to show and activate a close button on the border. - * @param isTitleNeeded Whether a title will be shown. * @param maxContentWidth The max content width of the tab. Negative numbers will use the * original content width. * @param maxContentHeight The max content height of the tab. Negative numbers will use the * original content height. * @return The newly created {@link LayoutTab}. */ - public LayoutTab createLayoutTab(int id, boolean isIncognito, boolean showCloseButton, - boolean isTitleNeeded, float maxContentWidth, float maxContentHeight) { - LayoutTab layoutTab = mUpdateHost.createLayoutTab( - id, isIncognito, showCloseButton, isTitleNeeded, maxContentWidth, maxContentHeight); + public LayoutTab createLayoutTab( + int id, boolean isIncognito, float maxContentWidth, float maxContentHeight) { + LayoutTab layoutTab = + mUpdateHost.createLayoutTab(id, isIncognito, maxContentWidth, maxContentHeight); initLayoutTabFromHost(layoutTab); return layoutTab; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerImpl.java index 9e218fbe..7cf0c885 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutManagerImpl.java
@@ -789,15 +789,14 @@ } @Override - public LayoutTab createLayoutTab(int id, boolean incognito, boolean showCloseButton, - boolean isTitleNeeded, float maxContentWidth, float maxContentHeight) { + public LayoutTab createLayoutTab( + int id, boolean incognito, float maxContentWidth, float maxContentHeight) { LayoutTab tab = mTabCache.get(id); if (tab == null) { - tab = new LayoutTab(id, incognito, mHost.getWidth(), mHost.getHeight(), showCloseButton, - isTitleNeeded); + tab = new LayoutTab(id, incognito, mHost.getWidth(), mHost.getHeight()); mTabCache.put(id, tab); } else { - tab.init(mHost.getWidth(), mHost.getHeight(), showCloseButton, isTitleNeeded); + tab.init(mHost.getWidth(), mHost.getHeight()); } if (maxContentWidth > 0.f) tab.setMaxContentWidth(maxContentWidth); if (maxContentHeight > 0.f) tab.setMaxContentHeight(maxContentHeight);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutUpdateHost.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutUpdateHost.java index 8627cebe..a1a7453cd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutUpdateHost.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/LayoutUpdateHost.java
@@ -71,16 +71,14 @@ * @param id The id of the reference tab in the * {@link org.chromium.chrome.browser.tabmodel.TabModel}. * @param incognito Whether the new tab is incognito. - * @param showCloseButton True to show and activate a close button on the border. - * @param isTitleNeeded Whether a title will be shown. * @param maxContentWidth The maximum layout width this tab can be. Negative numbers will use * the original content width. * @param maxContentHeight The maximum layout height this tab can be. Negative numbers will use * the original content height. * @return The created or recycled {@link LayoutTab}. */ - LayoutTab createLayoutTab(int id, boolean incognito, boolean showCloseButton, - boolean isTitleNeeded, float maxContentWidth, float maxContentHeight); + LayoutTab createLayoutTab( + int id, boolean incognito, float maxContentWidth, float maxContentHeight); /** * Notifies the host that the {@link LayoutTab} is no longer needed by the layout.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/ToolbarSwipeLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/ToolbarSwipeLayout.java index 7396fff..b036cdd 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/ToolbarSwipeLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/ToolbarSwipeLayout.java
@@ -159,7 +159,7 @@ if (model == null) return; int fromTabId = mTabModelSelector.getCurrentTabId(); if (fromTabId == TabModel.INVALID_TAB_INDEX) return; - mFromTab = createLayoutTab(fromTabId, model.isIncognito(), NO_CLOSE_BUTTON, NEED_TITLE); + mFromTab = createLayoutTab(fromTabId, model.isIncognito()); prepareLayoutTabForSwipe(mFromTab, false); } @@ -207,14 +207,13 @@ TabModel model = mTabModelSelector.getCurrentModel(); if (0 <= leftIndex && leftIndex < model.getCount()) { leftTabId = model.getTabAt(leftIndex).getId(); - mLeftTab = createLayoutTab(leftTabId, model.isIncognito(), NO_CLOSE_BUTTON, NEED_TITLE); + mLeftTab = createLayoutTab(leftTabId, model.isIncognito()); prepareLayoutTabForSwipe(mLeftTab, leftIndex != fromIndex); mLeftTabSupplier.set(model.getTabAt(leftIndex)); } if (0 <= rightIndex && rightIndex < model.getCount()) { rightTabId = model.getTabAt(rightIndex).getId(); - mRightTab = - createLayoutTab(rightTabId, model.isIncognito(), NO_CLOSE_BUTTON, NEED_TITLE); + mRightTab = createLayoutTab(rightTabId, model.isIncognito()); prepareLayoutTabForSwipe(mRightTab, rightIndex != fromIndex); mRightTabSupplier.set(model.getTabAt(rightIndex)); }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java index b7e8494..30724364 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/components/LayoutTab.java
@@ -41,16 +41,6 @@ // Fields initialized in init() public static final WritableFloatPropertyKey SCALE = new WritableFloatPropertyKey(); - public static final WritableFloatPropertyKey TILT_X_IN_DEGREES = new WritableFloatPropertyKey(); - - public static final WritableFloatPropertyKey TILT_Y_IN_DEGREES = new WritableFloatPropertyKey(); - - public static final WritableFloatPropertyKey TILT_X_PIVOT_OFFSET = - new WritableFloatPropertyKey(); - - public static final WritableFloatPropertyKey TILT_Y_PIVOT_OFFSET = - new WritableFloatPropertyKey(); - public static final WritableFloatPropertyKey X = new WritableFloatPropertyKey(); public static final WritableFloatPropertyKey Y = new WritableFloatPropertyKey(); @@ -75,9 +65,6 @@ public static final WritableFloatPropertyKey BORDER_ALPHA = new WritableFloatPropertyKey(); - public static final WritableFloatPropertyKey BORDER_CLOSE_BUTTON_ALPHA = - new WritableFloatPropertyKey(); - public static final WritableFloatPropertyKey BORDER_SCALE = new WritableFloatPropertyKey(); public static final WritableFloatPropertyKey ORIGINAL_CONTENT_WIDTH_IN_DP = @@ -161,17 +148,15 @@ public static final PropertyModel.WritableFloatPropertyKey CONTENT_OFFSET = new PropertyModel.WritableFloatPropertyKey(); - public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {TAB_ID, IS_INCOGNITO, SCALE, - TILT_X_IN_DEGREES, TILT_Y_IN_DEGREES, TILT_X_PIVOT_OFFSET, TILT_Y_PIVOT_OFFSET, X, Y, - RENDER_X, RENDER_Y, CLIPPED_X, CLIPPED_Y, CLIPPED_WIDTH, CLIPPED_HEIGHT, ALPHA, - SATURATION, BORDER_ALPHA, BORDER_CLOSE_BUTTON_ALPHA, BORDER_SCALE, - ORIGINAL_CONTENT_WIDTH_IN_DP, ORIGINAL_CONTENT_HEIGHT_IN_DP, MAX_CONTENT_WIDTH, - MAX_CONTENT_HEIGHT, STATIC_TO_VIEW_BLEND, BRIGHTNESS, IS_VISIBLE, SHOULD_STALL, - CAN_USE_LIVE_TEXTURE, SHOW_TOOLBAR, ANONYMIZE_TOOLBAR, TOOLBAR_ALPHA, - INSET_BORDER_VERTICAL, TOOLBAR_Y_OFFSET, SIDE_BORDER_SCALE, CLOSE_BUTTON_IS_ON_RIGHT, - BOUNDS, CLOSE_PLACEMENT, DECORATION_ALPHA, IS_TITLE_NEEDED, INIT_FROM_HOST_CALLED, - BACKGROUND_COLOR, TOOLBAR_BACKGROUND_COLOR, TEXT_BOX_BACKGROUND_COLOR, TEXT_BOX_ALPHA, - CONTENT_OFFSET}; + public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {TAB_ID, IS_INCOGNITO, SCALE, X, + Y, RENDER_X, RENDER_Y, CLIPPED_X, CLIPPED_Y, CLIPPED_WIDTH, CLIPPED_HEIGHT, ALPHA, + SATURATION, BORDER_ALPHA, BORDER_SCALE, ORIGINAL_CONTENT_WIDTH_IN_DP, + ORIGINAL_CONTENT_HEIGHT_IN_DP, MAX_CONTENT_WIDTH, MAX_CONTENT_HEIGHT, + STATIC_TO_VIEW_BLEND, BRIGHTNESS, IS_VISIBLE, SHOULD_STALL, CAN_USE_LIVE_TEXTURE, + SHOW_TOOLBAR, ANONYMIZE_TOOLBAR, TOOLBAR_ALPHA, INSET_BORDER_VERTICAL, TOOLBAR_Y_OFFSET, + SIDE_BORDER_SCALE, CLOSE_BUTTON_IS_ON_RIGHT, BOUNDS, CLOSE_PLACEMENT, DECORATION_ALPHA, + IS_TITLE_NEEDED, INIT_FROM_HOST_CALLED, BACKGROUND_COLOR, TOOLBAR_BACKGROUND_COLOR, + TEXT_BOX_BACKGROUND_COLOR, TEXT_BOX_ALPHA, CONTENT_OFFSET}; /** * Default constructor for a {@link LayoutTab}. @@ -180,13 +165,9 @@ * @param isIncognito Whether the tab in the in the incognito stack. * @param maxContentTextureWidth The maximum width for drawing the content in px. * @param maxContentTextureHeight The maximum height for drawing the content in px. - * @param showCloseButton Whether a close button should be displayed in the corner. - * @param isTitleNeeded Whether that tab need a title texture. This is an - * optimization to save cycles and memory. This is - * ignored if the title texture is already set. */ public LayoutTab(int tabId, boolean isIncognito, int maxContentTextureWidth, - int maxContentTextureHeight, boolean showCloseButton, boolean isTitleNeeded) { + int maxContentTextureHeight) { super(ALL_KEYS); set(TAB_ID, tabId); @@ -198,7 +179,7 @@ set(TEXT_BOX_BACKGROUND_COLOR, Color.WHITE); set(TEXT_BOX_ALPHA, 1.0f); - init(maxContentTextureWidth, maxContentTextureHeight, showCloseButton, isTitleNeeded); + init(maxContentTextureWidth, maxContentTextureHeight); } /** @@ -206,26 +187,18 @@ * * @param maxContentTextureWidth The maximum width of the page content in px. * @param maxContentTextureHeight The maximum height of the page content in px. - * @param showCloseButton Whether to show the close button on the tab border. - * @param isTitleNeeded Whether that tab need a title texture. This is an - * optimization to save cycles and memory. This is - * ignored if the title texture is already set. */ - public void init(int maxContentTextureWidth, int maxContentTextureHeight, - boolean showCloseButton, boolean isTitleNeeded) { + public void init(int maxContentTextureWidth, int maxContentTextureHeight) { set(ALPHA, 1.0f); set(SATURATION, 1.0f); set(BRIGHTNESS, 1.0f); set(BORDER_ALPHA, 1.0f); - set(BORDER_CLOSE_BUTTON_ALPHA, showCloseButton ? 1.f : 0.f); set(BORDER_SCALE, 1.0f); set(CLIPPED_X, 0.0f); set(CLIPPED_Y, 0.0f); set(CLIPPED_WIDTH, Float.MAX_VALUE); set(CLIPPED_HEIGHT, Float.MAX_VALUE); set(SCALE, 1.0f); - set(TILT_X_IN_DEGREES, 0.0f); - set(TILT_Y_IN_DEGREES, 0.0f); set(IS_VISIBLE, true); set(X, 0.0f); set(Y, 0.0f); @@ -233,7 +206,6 @@ set(RENDER_Y, 0.0f); set(STATIC_TO_VIEW_BLEND, 0.0f); set(DECORATION_ALPHA, 1.0f); - set(IS_TITLE_NEEDED, isTitleNeeded); set(CAN_USE_LIVE_TEXTURE, true); set(SHOW_TOOLBAR, false); set(ANONYMIZE_TOOLBAR, false); @@ -304,52 +276,6 @@ } /** - * @param tilt The tilt angle around the X axis of the tab in degree. - * @param pivotOffset The offset of the X axis of the tilt pivot. - */ - public void setTiltX(float tilt, float pivotOffset) { - set(TILT_X_IN_DEGREES, tilt); - set(TILT_X_PIVOT_OFFSET, pivotOffset); - } - - /** - * @return The tilt angle around the X axis of the tab in degree. - */ - public float getTiltX() { - return get(TILT_X_IN_DEGREES); - } - - /** - * @return The offset of the X axis of the tilt pivot. - */ - public float getTiltXPivotOffset() { - return get(TILT_X_PIVOT_OFFSET); - } - - /** - * @param tilt The tilt angle around the Y axis of the tab in degree. - * @param pivotOffset The offset of the Y axis of the tilt pivot. - */ - public void setTiltY(float tilt, float pivotOffset) { - set(TILT_Y_IN_DEGREES, tilt); - set(TILT_Y_PIVOT_OFFSET, pivotOffset); - } - - /** - * @return The tilt angle around the Y axis of the tab in degree. - */ - public float getTiltY() { - return get(TILT_Y_IN_DEGREES); - } - - /** - * @return The offset of the Y axis of the tilt pivot. - */ - public float getTiltYPivotOffset() { - return get(TILT_Y_IN_DEGREES); - } - - /** * Set the clipping offset. This apply on the scaled content. * * @param clippedX The top left X offset of the clipped rectangle. @@ -588,20 +514,6 @@ } /** - * @param alpha The maximum alpha value of the close button on the border. - */ - public void setBorderCloseButtonAlpha(float alpha) { - set(BORDER_CLOSE_BUTTON_ALPHA, alpha); - } - - /** - * @return The current alpha value at which the close button on the border is drawn. - */ - public float getBorderCloseButtonAlpha() { - return get(BORDER_CLOSE_BUTTON_ALPHA); - } - - /** * @param scale The scale factor of the border. * 1.0f yields 1:1 pixel with the source image. */ @@ -708,13 +620,6 @@ } /** - * @return Whether the tab title should be displayed. - */ - public boolean isTitleNeeded() { - return get(IS_TITLE_NEEDED); - } - - /** * @param visible True if the {@link LayoutTab} is visible and need to be drawn. */ public void setVisible(boolean visible) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/SimpleAnimationLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/SimpleAnimationLayout.java index 17884c9a..3b8529e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/SimpleAnimationLayout.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/layouts/phone/SimpleAnimationLayout.java
@@ -155,8 +155,7 @@ // Just draw the source tab on the screen. TabModel sourceModel = mTabModelSelector.getModelForTabId(sourceTabId); if (sourceModel == null) return; - LayoutTab sourceLayoutTab = - createLayoutTab(sourceTabId, sourceModel.isIncognito(), NO_CLOSE_BUTTON, NO_TITLE); + LayoutTab sourceLayoutTab = createLayoutTab(sourceTabId, sourceModel.isIncognito()); sourceLayoutTab.setBorderAlpha(0.0f); mLayoutTabs = new LayoutTab[] {sourceLayoutTab}; @@ -186,7 +185,7 @@ */ private void tabCreatedInForeground( int id, int sourceId, boolean newIsIncognito, float originX, float originY) { - LayoutTab newLayoutTab = createLayoutTab(id, newIsIncognito, NO_CLOSE_BUTTON, NO_TITLE); + LayoutTab newLayoutTab = createLayoutTab(id, newIsIncognito); if (mLayoutTabs == null || mLayoutTabs.length == 0) { mLayoutTabs = new LayoutTab[] {newLayoutTab}; } else { @@ -234,7 +233,7 @@ */ private void tabCreatedInBackground( int id, int sourceId, boolean newIsIncognito, float originX, float originY) { - LayoutTab newLayoutTab = createLayoutTab(id, newIsIncognito, NO_CLOSE_BUTTON, NEED_TITLE); + LayoutTab newLayoutTab = createLayoutTab(id, newIsIncognito); // mLayoutTabs should already have the source tab from tabCreating(). assert mLayoutTabs.length == 1; LayoutTab sourceLayoutTab = mLayoutTabs[0]; @@ -357,7 +356,7 @@ // Create the {@link LayoutTab} for the tab before it is destroyed. TabModel model = mTabModelSelector.getModelForTabId(id); if (model != null) { - mClosedTab = createLayoutTab(id, model.isIncognito(), NO_CLOSE_BUTTON, NO_TITLE); + mClosedTab = createLayoutTab(id, model.isIncognito()); mClosedTab.setBorderAlpha(0.0f); mLayoutTabs = new LayoutTab[] {mClosedTab}; updateCacheVisibleIds(new LinkedList<Integer>(Arrays.asList(id))); @@ -379,8 +378,7 @@ if (mClosedTab != null) { TabModel nextModel = mTabModelSelector.getModelForTabId(nextId); if (nextModel != null) { - LayoutTab nextLayoutTab = - createLayoutTab(nextId, nextModel.isIncognito(), NO_CLOSE_BUTTON, NO_TITLE); + LayoutTab nextLayoutTab = createLayoutTab(nextId, nextModel.isIncognito()); nextLayoutTab.setDrawDecoration(false); mLayoutTabs = new LayoutTab[] {nextLayoutTab, mClosedTab};
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabListSceneLayer.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabListSceneLayer.java index de8f780..654e433 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabListSceneLayer.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/scene_layer/TabListSceneLayer.java
@@ -6,10 +6,8 @@ import android.content.Context; import android.content.res.Resources; -import android.graphics.Color; import android.graphics.RectF; -import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.annotations.JNINamespace; import org.chromium.base.annotations.NativeMethods; import org.chromium.chrome.R; @@ -109,15 +107,6 @@ int defaultThemeColor = ChromeColors.getDefaultThemeColor(context, useIncognitoColors); - int closeButtonColor = useIncognitoColors - ? Color.WHITE - : SemanticColorUtils.getDefaultIconColorSecondary(context); - float closeButtonSizePx = - res.getDimensionPixelSize(R.dimen.tab_switcher_close_button_size); - - int borderColorResource = - t.isIncognito() ? R.color.tab_back_incognito : R.color.tab_back; - int[] relatedTabIds = getRelatedTabIds(t.getId()); float toolbarYOffset = 0; @@ -131,29 +120,24 @@ // TODO(dtrainor, clholgat): remove "* dpToPx" once the native part fully supports dp. TabListSceneLayerJni.get().putTabLayer(mNativePtr, TabListSceneLayer.this, t.getId(), relatedTabIds, mUseAdditionalIds, R.id.control_container, - R.drawable.btn_delete_24dp, R.drawable.tabswitcher_border_frame_shadow, - R.drawable.tabswitcher_border_frame_decoration, R.drawable.logo_card_back, + R.drawable.tabswitcher_border_frame_shadow, + R.drawable.tabswitcher_border_frame_decoration, R.drawable.tabswitcher_border_frame, R.drawable.tabswitcher_border_frame_inner_shadow, t.canUseLiveTexture(), - t.getBackgroundColor(), - ApiCompatibilityUtils.getColor(res, borderColorResource), t.isIncognito(), - t.isCloseButtonOnRight(), t.getRenderX() * dpToPx, t.getRenderY() * dpToPx, - t.getScaledContentWidth() * dpToPx, t.getScaledContentHeight() * dpToPx, - t.getOriginalContentWidth() * dpToPx, t.getOriginalContentHeight() * dpToPx, - t.getClippedX() * dpToPx, t.getClippedY() * dpToPx, + t.getBackgroundColor(), t.isIncognito(), t.getRenderX() * dpToPx, + t.getRenderY() * dpToPx, t.getScaledContentWidth() * dpToPx, + t.getScaledContentHeight() * dpToPx, t.getOriginalContentWidth() * dpToPx, + t.getOriginalContentHeight() * dpToPx, t.getClippedX() * dpToPx, + t.getClippedY() * dpToPx, Math.min(t.getClippedWidth(), t.getScaledContentWidth()) * dpToPx, Math.min(t.getClippedHeight(), t.getScaledContentHeight()) * dpToPx, - t.getTiltXPivotOffset() * dpToPx, t.getTiltYPivotOffset() * dpToPx, - t.getTiltX(), t.getTiltY(), t.getAlpha(), t.getBorderAlpha() * decoration, + t.getAlpha(), t.getBorderAlpha() * decoration, t.getBorderInnerShadowAlpha() * decoration, decoration, - shadowAlpha * decoration, t.getBorderCloseButtonAlpha() * decoration, - LayoutTab.CLOSE_BUTTON_WIDTH_DP * dpToPx, closeButtonSizePx, - t.getStaticToViewBlend(), t.getBorderScale(), t.getSaturation(), - t.getBrightness(), t.showToolbar(), defaultThemeColor, - t.getToolbarBackgroundColor(), closeButtonColor, t.anonymizeToolbar(), - t.isTitleNeeded(), urlBarBackgroundId, t.getTextBoxBackgroundColor(), - t.getToolbarAlpha(), toolbarYOffset, contentOffset, t.getSideBorderScale(), - t.insetBorderVertical()); + shadowAlpha * decoration, t.getStaticToViewBlend(), t.getBorderScale(), + t.getSaturation(), t.getBrightness(), t.showToolbar(), defaultThemeColor, + t.getToolbarBackgroundColor(), t.anonymizeToolbar(), urlBarBackgroundId, + t.getTextBoxBackgroundColor(), t.getToolbarAlpha(), toolbarYOffset, + contentOffset, t.getSideBorderScale(), t.insetBorderVertical()); } TabListSceneLayerJni.get().finishBuildingFrame(mNativePtr, TabListSceneLayer.this); } @@ -204,21 +188,17 @@ float viewportHeight); // TODO(meiliang): Need to provide a resource that indicates the selected tab on the layer. void putTabLayer(long nativeTabListSceneLayer, TabListSceneLayer caller, int selectedId, - int[] ids, boolean useAdditionalIds, int toolbarResourceId, - int closeButtonResourceId, int shadowResourceId, int contourResourceId, - int backLogoResourceId, int borderResourceId, int borderInnerShadowResourceId, - boolean canUseLiveLayer, int tabBackgroundColor, int backLogoColor, - boolean incognito, boolean isPortrait, float x, float y, float width, float height, - float contentWidth, float contentHeight, float shadowX, float shadowY, - float shadowWidth, float shadowHeight, float pivotX, float pivotY, float rotationX, - float rotationY, float alpha, float borderAlpha, float borderInnerShadowAlpha, - float contourAlpha, float shadowAlpha, float closeAlpha, float closeBtnWidth, - float closeBtnAssetSize, float staticToViewBlend, float borderScale, - float saturation, float brightness, boolean showToolbar, int defaultThemeColor, - int toolbarBackgroundColor, int closeButtonColor, boolean anonymizeToolbar, - boolean showTabTitle, int toolbarTextBoxResource, int toolbarTextBoxBackgroundColor, - float toolbarTextBoxAlpha, float toolbarYOffset, float contentOffset, - float sideBorderScale, boolean insetVerticalBorder); + int[] ids, boolean useAdditionalIds, int toolbarResourceId, int shadowResourceId, + int contourResourceId, int borderResourceId, int borderInnerShadowResourceId, + boolean canUseLiveLayer, int tabBackgroundColor, boolean incognito, float x, + float y, float width, float height, float contentWidth, float contentHeight, + float shadowX, float shadowY, float shadowWidth, float shadowHeight, float alpha, + float borderAlpha, float borderInnerShadowAlpha, float contourAlpha, + float shadowAlpha, float staticToViewBlend, float borderScale, float saturation, + float brightness, boolean showToolbar, int defaultThemeColor, + int toolbarBackgroundColor, boolean anonymizeToolbar, int toolbarTextBoxResource, + int toolbarTextBoxBackgroundColor, float toolbarTextBoxAlpha, float toolbarYOffset, + float contentOffset, float sideBorderScale, boolean insetVerticalBorder); void putBackgroundLayer(long nativeTabListSceneLayer, TabListSceneLayer caller, int resourceId, float alpha, int topOffset);
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 e6ef840..1e00aae 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
@@ -1166,6 +1166,7 @@ } void updateThemeColor(int themeColor) { + if (mThemeColor == themeColor) return; mThemeColor = themeColor; RewindableIterator<TabObserver> observers = getTabObservers(); while (observers.hasNext()) observers.next().onDidChangeThemeColor(this, themeColor);
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java index b97b18b..b580146 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/modaldialog/ModalDialogViewRenderTest.java
@@ -153,6 +153,40 @@ @Test @MediumTest @Feature({"ModalDialog", "RenderTest"}) + public void testRender_PrimaryButtonWithIcon() throws IOException { + final Drawable icon = UiUtils.getTintedDrawable(getActivity(), + org.chromium.chrome.R.drawable.ic_add, R.color.default_icon_color_tint_list); + + setUpViews(R.style.Theme_Chromium_ModalDialog_TextPrimaryButton); + createModel( + mModelBuilder.with(ModalDialogProperties.TITLE, mResources, R.string.title) + .with(ModalDialogProperties.MESSAGE, "Message") + .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, mResources, R.string.ok) + .with(ModalDialogProperties.POSITIVE_BUTTON_ICON, icon)); + mRenderTestRule.render(mModalDialogView, "primary_button_with_icon"); + } + + @Test + @MediumTest + @Feature({"ModalDialog", "RenderTest"}) + public void testRender_FilledPrimaryButtonWithIcon() throws IOException { + final Drawable icon = UiUtils.getTintedDrawable(getActivity(), + org.chromium.chrome.R.drawable.ic_add, R.color.default_icon_color_inverse); + + setUpViews(R.style.Theme_Chromium_ModalDialog_FilledPrimaryButton); + createModel( + mModelBuilder.with(ModalDialogProperties.TITLE, mResources, R.string.title) + .with(ModalDialogProperties.MESSAGE, "Message") + .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, mResources, R.string.ok) + .with(ModalDialogProperties.POSITIVE_BUTTON_ICON, icon) + .with(ModalDialogProperties.NEGATIVE_BUTTON_TEXT, mResources, + R.string.cancel)); + mRenderTestRule.render(mModalDialogView, "filled_primary_button_with_icon"); + } + + @Test + @MediumTest + @Feature({"ModalDialog", "RenderTest"}) public void testRender_ScrollableTitle() throws IOException { setUpViews(R.style.Theme_Chromium_ModalDialog_TextPrimaryButton); createModel(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/ExpandablePaymentHandlerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/ExpandablePaymentHandlerTest.java index 8d42b960..f0b7100 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/payments/ExpandablePaymentHandlerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/payments/ExpandablePaymentHandlerTest.java
@@ -405,6 +405,7 @@ @SmallTest @Feature({"Payments"}) @ParameterAnnotations.UseMethodParameter(BadCertParams.class) + @FlakyTest(message = "https://crbug.com/1288003") public void testInsecureConnectionNotShowUi(int badCertificate) throws Throwable { startServer(badCertificate); PaymentHandlerCoordinator paymentHandler = createPaymentHandlerAndShow(mDefaultIsIncognito);
diff --git a/chrome/app/chromeos_strings.grdp b/chrome/app/chromeos_strings.grdp index 3e6a5bc..1fa854f 100644 --- a/chrome/app/chromeos_strings.grdp +++ b/chrome/app/chromeos_strings.grdp
@@ -1139,13 +1139,13 @@ Installing <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> will overwrite all data on your device. </message> <message name="IDS_OS_INSTALL_SCREEN_INTRO_CONTENT_0" desc="First part of body text of the OS install screen's introduction step."> - Before starting, make sure you have a backup of your data. Installing <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> will overwrite your hard drive. Learn more at g.co/TBD. + Before starting, make sure you have a backup of your data. Installing <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> will overwrite your hard drive. Learn more at g.co/CR2/InstallGuide. </message> <message name="IDS_OS_INSTALL_SCREEN_INTRO_CONTENT_1" desc="Second part of body text of the OS install screen's introduction step."> Installation takes a few easy steps. You’ll have another chance to confirm before changes are made to your computer. </message> <message name="IDS_OS_INSTALL_SCREEN_INTRO_FOOTER" desc="Footer text of the OS install screen's introduction step."> - Google isn’t responsible for any data loss, and <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> may not work on uncertified models. Learn more at g.co/TBD. + Google isn’t responsible for any data loss, and <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> may not work on uncertified models. Learn more at g.co/CR2/InstallGuide. </message> <message name="IDS_OS_INSTALL_SCREEN_INTRO_NEXT_BUTTON" desc="Text of the next button on the introduction page of the OS install screen"> Install <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> @@ -1171,7 +1171,7 @@ </message> <message name="IDS_OS_INSTALL_SCREEN_ERROR_FAILED_SUBTITLE" desc="Subtitle of the error page of the OS install screen for general failure."> <ph name="BEGIN_PARAGRAPH1"><p></ph>Something went wrong and <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> couldn’t be installed.<ph name="END_PARAGRAPH1"></p></ph> - <ph name="BEGIN_PARAGRAPH2"><p></ph>For more help visit: g.co/xxxxx<ph name="END_PARAGRAPH2"></p></ph> + <ph name="BEGIN_PARAGRAPH2"><p></ph>For more help, visit: g.co/CR2/InstallErrors.<ph name="END_PARAGRAPH2"></p></ph> </message> <message name="IDS_OS_INSTALL_SCREEN_ERROR_VIEW_LOGS" desc="Label for an actionable link that opens dialog with installation logs."> View logs @@ -1188,7 +1188,7 @@ <ph name="LIST_ITEM"><li></ph>Make sure you're using a certified model and check install notes <ph name="END_LIST"></ul></ph> <ph name="END_PARAGRAPH1"></p></ph> - <ph name="BEGIN_PARAGRAPH2"><p></ph>For more help, visit: g.co/xxxxx<ph name="END_PARAGRAPH2"></p></ph> + <ph name="BEGIN_PARAGRAPH2"><p></ph>For more help, visit: g.co/CR2/InstallErrors.<ph name="END_PARAGRAPH2"></p></ph> </message> <message name="IDS_OS_INSTALL_SCREEN_SUCCESS_TITLE" desc="Title of the success page of the OS install screen"> Installation complete @@ -2250,7 +2250,7 @@ <message name="IDS_LOGIN_ERROR_ENROLLMENT_TPM_FAILURE_CONTENT" desc="Steps that can help users to properly setup TPM manually."> <ph name="BEGIN_PARAGRAPH1"><p></ph>Before enrolling you need to clear the TPM so <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> can take ownership of the device.<ph name="END_PARAGRAPH1"></p></ph> <ph name="BEGIN_PARAGRAPH2"><p></ph>You can also turn off the TPM device entirely. Your data will still be stored safely with software encryption, but certain security features such as hardware-backed certificates will be disabled.<ph name="END_PARAGRAPH2"></p></ph> - <ph name="BEGIN_PARAGRAPH3"><p></ph>You can change your TPM settings by rebooting and entering the system BIOS/UEFI settings. Steps vary based on the device model. For more info, open the <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> documentation on a separate device before you reboot: [URL link]<ph name="END_PARAGRAPH3"></p></ph> + <ph name="BEGIN_PARAGRAPH3"><p></ph>You can change your TPM settings by rebooting and entering the system BIOS/UEFI settings. Steps vary based on the device model. For more info, open the <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> documentation on a separate device before you reboot: g.co/CR2/TPMHelp.<ph name="END_PARAGRAPH3"></p></ph> </message> <message name="IDS_LOGIN_ERROR_TPM_FAILURE_REBOOT_BUTTON" desc="Label on button that restarts device."> Restart @@ -4068,10 +4068,10 @@ <message name="IDS_HW_DATA_COLLECTION_CONTENT" desc="Content of the hardware data collection notice screen."> <ph name="BEGIN_PARAGRAPH1"><p></ph>To provide the best experience, <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> collects hardware data about devices and shares it with Google to determine which updates should be delivered. Optionally, you can allow Google to use this data for additional purposes like support and improvements to the <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> experience and service.<ph name="END_PARAGRAPH1"></p></ph> <ph name="BEGIN_PARAGRAPH2"><p></ph>You can log in on this device and visit the CLOUDREADY_HARDWARE_INFO section in chrome://system to see the data sent to Google for update filtering, as well as any other instances where you choose to share data with Google.<ph name="END_PARAGRAPH2"></p></ph> - <ph name="BEGIN_PARAGRAPH3"><p></ph>For more details on data <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> may share with Google, and how it is used visit g.co/xxxxx<ph name="END_PARAGRAPH3"></p></ph> + <ph name="BEGIN_PARAGRAPH3"><p></ph>For more details on data <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph> may share with Google, and how it is used visit g.co/CR2/HWDataCollection.<ph name="END_PARAGRAPH3"></p></ph> </message> <message name="IDS_HW_DATA_COLLECTION_USAGE_INFO" desc="Checkbox description for additional hardware data usage. This message is followed by a 'Learn more' link."> - Let Google use your hardware data to help improve <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph>. If you decline, this data is still sent to Google to determine proper updates, but is not stored or used otherwise. + Let Google use your hardware data to help improve <ph name="DEVICE_OS">$1<ex>CloudReady 2.0</ex></ph>. If you decline, this data is still sent to Google to determine proper updates, but is not stored or used otherwise. Learn more at g.co/CR2/HWDataCollection. </message> <message name="IDS_HW_DATA_COLLECTION_ACCEPT_AND_CONTINUE_BUTTON_TEXT" desc="Label on a button on the hardware data collection notice screen to accept the terms and continue."> Accept and continue
diff --git a/chrome/app/chromeos_strings_grdp/IDS_HW_DATA_COLLECTION_CONTENT.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_HW_DATA_COLLECTION_CONTENT.png.sha1 index 8a793c7..6dac3e2f 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_HW_DATA_COLLECTION_CONTENT.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_HW_DATA_COLLECTION_CONTENT.png.sha1
@@ -1 +1 @@ -f70eed626a83764bf0a17e4ef682d05836174007 \ No newline at end of file +641b38d403637860d333d15522d37671d2dfeca8 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_HW_DATA_COLLECTION_USAGE_INFO.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_HW_DATA_COLLECTION_USAGE_INFO.png.sha1 index 8a793c7..6dac3e2f 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_HW_DATA_COLLECTION_USAGE_INFO.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_HW_DATA_COLLECTION_USAGE_INFO.png.sha1
@@ -1 +1 @@ -f70eed626a83764bf0a17e4ef682d05836174007 \ No newline at end of file +641b38d403637860d333d15522d37671d2dfeca8 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_LOGIN_ERROR_ENROLLMENT_TPM_FAILURE_CONTENT.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_LOGIN_ERROR_ENROLLMENT_TPM_FAILURE_CONTENT.png.sha1 index 91383f6..aac30de 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_LOGIN_ERROR_ENROLLMENT_TPM_FAILURE_CONTENT.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_LOGIN_ERROR_ENROLLMENT_TPM_FAILURE_CONTENT.png.sha1
@@ -1 +1 @@ -00bf94a0c0429420977d548dc06096ccbc605018 \ No newline at end of file +ab2d19b333c7fdbad0f58a87e3cc1167d21f5762 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_ERROR_FAILED_SUBTITLE.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_ERROR_FAILED_SUBTITLE.png.sha1 index b45f7798..b992be14 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_ERROR_FAILED_SUBTITLE.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_ERROR_FAILED_SUBTITLE.png.sha1
@@ -1 +1 @@ -bd6e337a3a695d468d7383b385308519fd97f7ef \ No newline at end of file +c32332fad21109c739c484b1eae96cab80243aed \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_ERROR_NO_DEST_CONTENT.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_ERROR_NO_DEST_CONTENT.png.sha1 index 53f38ae..1916af5d 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_ERROR_NO_DEST_CONTENT.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_ERROR_NO_DEST_CONTENT.png.sha1
@@ -1 +1 @@ -48ac6c07316e57f0c821ef566205be95eaa1ff3f \ No newline at end of file +f7c0bce19683500b506d4fc7796ea0ba75483579 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_INTRO_CONTENT_0.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_INTRO_CONTENT_0.png.sha1 index bb7d199..241b8d39 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_INTRO_CONTENT_0.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_INTRO_CONTENT_0.png.sha1
@@ -1 +1 @@ -65d31330241ef84c77020ffa4d1a77e9095bed4e \ No newline at end of file +9fc499fc8f20bb67e316eb45867187fa6f174785 \ No newline at end of file
diff --git a/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_INTRO_FOOTER.png.sha1 b/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_INTRO_FOOTER.png.sha1 index bb7d199..241b8d39 100644 --- a/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_INTRO_FOOTER.png.sha1 +++ b/chrome/app/chromeos_strings_grdp/IDS_OS_INSTALL_SCREEN_INTRO_FOOTER.png.sha1
@@ -1 +1 @@ -65d31330241ef84c77020ffa4d1a77e9095bed4e \ No newline at end of file +9fc499fc8f20bb67e316eb45867187fa6f174785 \ No newline at end of file
diff --git a/chrome/app/resources/generated_resources_az.xtb b/chrome/app/resources/generated_resources_az.xtb index 6dfa8f6..cc90788 100644 --- a/chrome/app/resources/generated_resources_az.xtb +++ b/chrome/app/resources/generated_resources_az.xtb
@@ -237,6 +237,7 @@ <translation id="1235458158152011030">Tanış şəbəkələr</translation> <translation id="123578888592755962">Disk doludur</translation> <translation id="1235924639474699896">{COUNT,plural, =1{mətn}other{# mətn}}</translation> +<translation id="1236009322878349843">Telefonu redaktə edin</translation> <translation id="1239594683407221485">Fayllar tətbiqində cihazın kontentini kəşf edin.</translation> <translation id="1241066500170667906"><ph name="EXPERIMENT_NAME" /> üçün eksperiment vəziyyəti seçin</translation> <translation id="124116460088058876">Digər dillər</translation> @@ -1939,6 +1940,7 @@ <translation id="2939908794993783865">Əlavə deaktiv aaytlar</translation> <translation id="2939938020978911855">Əlçatan Bluetooth cihazlarını göstərin</translation> <translation id="2941112035454246133">Aşağı</translation> +<translation id="2941696810925320401">Saytlar adətən ekranlarınızda əlavə sənədlər və ya tam ekran məzmunu göstərmək üçün pəncərələri açır və yerləşdirir</translation> <translation id="2942279350258725020">Android Mesaj</translation> <translation id="2942560570858569904">Gözlənilir...</translation> <translation id="2942581856830209953">Bu səhifəni fərdiləşdirin</translation> @@ -2091,6 +2093,7 @@ <translation id="3099836255427453137">{NUM_EXTENSIONS,plural, =1{1 potensial zərərli artırma deaktiv edilib. Onu silə də bilərsiniz.}other{{NUM_EXTENSIONS} potensial zərərli artırma deaktiv edilib. Onları silə də bilərsiniz.}}</translation> <translation id="3101126716313987672">İşığın qaraldılması</translation> <translation id="3101709781009526431">Tarix və saat</translation> +<translation id="3103451787721578293">Bu məlumatları yükləmək üçün səbəb daxil edin:</translation> <translation id="3103941660000130485">Linux güncəllənərkən xəta baş verdi</translation> <translation id="3105796011181310544">Google seçiminə qayıtmaq istəyirsiniz?</translation> <translation id="310671807099593501">Sayt bluetooth istifadə edir</translation> @@ -2616,6 +2619,7 @@ <translation id="3670113805793654926">Hər hansı vendordan olan cihazlar</translation> <translation id="3670229581627177274">Bluetooth aktivləşdirilsin?</translation> <translation id="3672681487849735243">Zavod xətası aşkar edildi</translation> +<translation id="3673097791729989571">Giriş hostu: <ph name="SAML_DOMAIN" /></translation> <translation id="367645871420407123">Əgər əsas parolu defolt test şəkil dəyərinə ayarlamaq istəyirsinizsə, boş saxlayın</translation> <translation id="3677106374019847299">Fərdi təminatçı daxil edin</translation> <translation id="3677911431265050325">Mobil saytı tələb edin</translation> @@ -3396,6 +3400,7 @@ <translation id="4481467543947557978">xidmət işçisi</translation> <translation id="4481530544597605423">Ayrılmış cihazlar</translation> <translation id="4482990632723642375">Son Qapadılan Tab</translation> +<translation id="4484922932728109422">Saytların pəncərələri açmaq və yerləşdirmək üçün ekranlarınız haqqında məlumatdan istifadə etməsinə icazə verməyin</translation> <translation id="4487489714832036847">Chromebook'larda ənənəvi proqram əvəzinə tətbiqlər istifadə olunur. Məhsuldarlıq, əyləncə və daha çoxu üçün tətbiqlər əldə edin.</translation> <translation id="4488257340342212116">Kameranızdan istifadə etmək icazəsi verilib</translation> <translation id="4488502501195719518">Bütün data silinsin?</translation> @@ -3478,6 +3483,7 @@ <translation id="4565917129334815774">Sistem loqlarını saxlayın</translation> <translation id="4566417217121906555">Mikrofonu susdurun</translation> <translation id="456717285308019641">Tərcümə ediləcək səhifənin dili</translation> +<translation id="4567512141633030272">Giriş seçimi yanlışdır?</translation> <translation id="4567533462991917415">Ayarlamadan sonra həmişə daha çoxunu əlavə edə bilərsiniz. Hər bir şəxs öz hesabını fərdiləşdirə və datanı məxfi saxlaya bilər.</translation> <translation id="4567772783389002344">Söz əlavə edin</translation> <translation id="4568025708905928793">Təhlükəsizlik açarı tələb olunur</translation> @@ -3723,6 +3729,7 @@ <translation id="4841741146571978176">Tələb edilən virtual cihaz mövcud deyil. Davam etmək üçün <ph name="VM_TYPE" /> ayarlayın</translation> <translation id="4842976633412754305">Bu səhifə doğrulanmamış mənbələrdən skript yükləməyə çalışır.</translation> <translation id="4844333629810439236">Digər klaviaturalar</translation> +<translation id="4844633725025837809">Təhlükəsizliyi artırmaq üçün Google Parol Menecerində saxlanmazdan əvvəl cihazınızda parolları şifrələyin</translation> <translation id="4846680374085650406">Bu ayar üçün administratorun tövsiyələrinə əməl edirsiniz.</translation> <translation id="4847902821209177679"><ph name="TOPIC_SOURCE" /> <ph name="TOPIC_SOURCE_DESC" /> seçilib, <ph name="TOPIC_SOURCE" /> albomlarını seçmək üçün Enter düyməsinə basın</translation> <translation id="4848191975108266266">Google Assistent üçün "Ok Google" ifadəsi</translation> @@ -3863,6 +3870,7 @@ <translation id="499165176004408815">Yüksək kontrast rejimi istifadə edin</translation> <translation id="4992458225095111526">Sıfırlamanı təsdiq edin</translation> <translation id="4992473555164495036">Administrator əlçatan giriş üsullarını məhdudlaşdırdı.</translation> +<translation id="4992984395680162305">Bu cihazlar QR kodu skan etməklə əlaqələndirilib.</translation> <translation id="4994474651455208930">Saytlara defolt protokol icraçıları olmağa icazə verin</translation> <translation id="4994754230098574403">Ayarlanır</translation> <translation id="4995131849631312693"><ph name="BEGIN_PARAGRAPH1" />Qeydiyyatdan keçmədən əvvəl, <ph name="DEVICE_OS" /> cihazın sahibi ola bilməsi üçün TPM'i silməlisiniz.<ph name="END_PARAGRAPH1" /> @@ -3981,6 +3989,7 @@ <translation id="5123433949759960244">Basketbol</translation> <translation id="5125751979347152379">Yanlış URL.</translation> <translation id="5126611267288187364">Dəyişikliklərə baxın</translation> +<translation id="5127242257756472928">Pəncərələri açmaq və yerləşdirmək üçün ekranlarınız haqqında məlumatdan istifadə etməyə icazə verilmir</translation> <translation id="5127620150973591153">Təhlükəsiz bağlantı ID'si: <ph name="TOKEN" /></translation> <translation id="5127805178023152808">Sinx deaktivdir</translation> <translation id="5127881134400491887">Şəbəkə bağlantılarını idarə edin</translation> @@ -4093,6 +4102,7 @@ <translation id="5243522832766285132">Qısa zaman ərzində yenidən cəhd edin.</translation> <translation id="5244474230056479698"><ph name="EMAIL" /> e-poçtuna sinxronizasiya olunur</translation> <translation id="5245610266855777041">Məktəb hesabı ilə başlayın</translation> +<translation id="5246036036039717045">Bu cihazlarda Chrome'a daxil olduğunuz üçün onlar təhlükəsizlik açarı kimi istifadə oluna bilər.</translation> <translation id="5246282308050205996"><ph name="APP_NAME" /> qəzaya uğradı. Tətbiqi yenidən başlatmaq üçün bu topa klikləyin.</translation> <translation id="5247051749037287028">Display adı (istəyə görə)</translation> <translation id="5249624017678798539">Endirmə tamamlanmamış brauzer sındı-töküldü.</translation> @@ -4581,6 +4591,7 @@ <translation id="5757375109985023827">Önizləmək üçün tab seçin</translation> <translation id="5758631781033351321">Oxu siyahısını burada tapa bilərsiniz</translation> <translation id="5759728514498647443"><ph name="APP_NAME" /> vasitəsilə çapa göndərdiyiniz sənədlər <ph name="APP_NAME" /> tərəfindən oxuna bilər.</translation> +<translation id="5762787084360227629">Google Hesabı haqqında məlumatı daxil edin</translation> <translation id="5763751966069581670">USB cihazı tapılmadı</translation> <translation id="5764483294734785780">Audionun saxlanma formatı:</translation> <translation id="57646104491463491">Dəyişdirilmə Tarixi</translation> @@ -5724,6 +5735,7 @@ <translation id="6965382102122355670">OK</translation> <translation id="6965648386495488594">Port</translation> <translation id="6965978654500191972">Cihaz</translation> +<translation id="6966370001499648704">Təhlükəsizlik açarı kimi hansı telefonları istifadə etdiyinizə nəzarət edin</translation> <translation id="6967430741871315905">Cihaza icazə verilib-verilmədiyini yoxlamaq olmur</translation> <translation id="696780070563539690">Saytlar müxtəlif saytlarda baxış fəaliyyətinizi (məsələn, reklamları fərdiləşdirmək üçün) görmək üçün kukilərinizdən istifadə edə bilmir</translation> <translation id="6968288415730398122">Ekran kilidini konfiqurasiya etmək üçün parolu daxil edin</translation> @@ -5898,6 +5910,7 @@ <translation id="7135729336746831607">Bluetooth aktiv edilsin?</translation> <translation id="7136694880210472378">Defolt edin</translation> <translation id="7136993520339022828">Xəta baş verdi. Fərqli şəkil seçin və yenidən cəhd edin.</translation> +<translation id="7137472406312798422">Saytlar pəncərələri açmaq və yerləşdirmək üçün ekranlarınız haqqında məlumatdan istifadə etməyi istəyə bilər</translation> <translation id="7138515695467025690">Deaktiv / Gün batanda avtomatik aktiv olacaq</translation> <translation id="7138678301420049075">Digər</translation> <translation id="7139627972753429585"><ph name="APP_NAME" /> mikrofonunuzdan istifadə edir</translation> @@ -6783,6 +6796,7 @@ <translation id="8028803902702117856"><ph name="SIZE" />, <ph name="FILE_NAME" /> endirilir</translation> <translation id="8028993641010258682">Ölçü</translation> <translation id="8029492516535178472"><ph name="WINDOW_TITLE" /> - İcazə tələb edilib, cavablandırmaq üçün ⌘ + Seçim + Yuxarı ox düyməsini basın</translation> +<translation id="8029539783236818164">Pəncərələri açmaq və yerləşdirmək üçün ekranlarınız haqqında məlumatdan istifadə etməyə icazə verilir</translation> <translation id="8030169304546394654">Bağlantı kəsildi</translation> <translation id="8030852056903932865">Təsdiq edin</translation> <translation id="8032244173881942855">Tabeli yayımlamaq mümkün olmadı.</translation> @@ -6795,6 +6809,7 @@ <translation id="8038399858950372766">Cihaz <ph name="DEVICE_INDEX" />/<ph name="DEVICE_COUNT" />, <ph name="DEVICE_NAME" /> adlı klaviatura</translation> <translation id="8041089156583427627">Geri Əlaqə Göndərin</translation> <translation id="8042142357103597104">Mətnin qeyri-şəffaflığı</translation> +<translation id="8042331986490021244">Parollarınız Google Parol Menecerində saxlanmazdan əvvəl cihazınızda şifrələnir</translation> <translation id="8044262338717486897"><ph name="LINUX_APP_NAME" /> cavab vermir.</translation> <translation id="8044899503464538266">Yavaş</translation> <translation id="8045253504249021590">Sinxronizasiya Google Alətlər Paneli vasitəsilə dayandırıldı.</translation> @@ -7550,6 +7565,7 @@ <translation id="8838234842677265403"><ph name="WEB_DRIVE_MESSAGE" /> (<ph name="SUPPORT_INFO" />)</translation> <translation id="8838601485495657486">Qeyri-şəffaf</translation> <translation id="8838770651474809439">Hamburger</translation> +<translation id="8838778928843281408">Telefonların idarə edilməsi</translation> <translation id="883911313571074303">Şəklə qeydlər edin</translation> <translation id="8841843049738266382">İcazə verilənlər siyahısında olan istifadəçiləri oxuyun və dəyişin</translation> <translation id="8842594465773264717">Bu barmaq izini silin</translation>
diff --git a/chrome/app/resources/generated_resources_ja.xtb b/chrome/app/resources/generated_resources_ja.xtb index eb53f51..c4381bc 100644 --- a/chrome/app/resources/generated_resources_ja.xtb +++ b/chrome/app/resources/generated_resources_ja.xtb
@@ -239,6 +239,7 @@ <translation id="1235458158152011030">既知のネットワーク</translation> <translation id="123578888592755962">ディスクがいっぱいです</translation> <translation id="1235924639474699896">{COUNT,plural, =1{テキスト}other{# 件のテキスト}}</translation> +<translation id="1236009322878349843">スマートフォンの編集</translation> <translation id="1239594683407221485">ファイルアプリでデバイスのコンテンツを検索します。</translation> <translation id="1241066500170667906"><ph name="EXPERIMENT_NAME" /> の試験運用機能の状態を選択</translation> <translation id="124116460088058876">その他の言語</translation> @@ -1938,6 +1939,7 @@ <translation id="2939908794993783865">追加の無効なサイト</translation> <translation id="2939938020978911855">使用可能な Bluetooth デバイスを表示</translation> <translation id="2941112035454246133">低</translation> +<translation id="2941696810925320401">サイトでは通常、画面上に追加のドキュメントや全画面コンテンツを表示するためにウィンドウを開いて配置します</translation> <translation id="2942279350258725020">Android メッセージ</translation> <translation id="2942560570858569904">待機しています…</translation> <translation id="2942581856830209953">このページをカスタマイズ</translation> @@ -2090,6 +2092,7 @@ <translation id="3099836255427453137">{NUM_EXTENSIONS,plural, =1{1 個の有害な可能性がある拡張機能がオフになっています。削除することもできます。}other{{NUM_EXTENSIONS} 個の有害な可能性がある拡張機能がオフになっています。削除することもできます。}}</translation> <translation id="3101126716313987672">ライトを暗くする</translation> <translation id="3101709781009526431">日時</translation> +<translation id="3103451787721578293">このデータをアップロードする理由を入力してください。</translation> <translation id="3103941660000130485">Linux のアップグレード中にエラーが発生しました</translation> <translation id="3105796011181310544">Google に戻しますか?</translation> <translation id="310671807099593501">サイトで Bluetooth が使用されています</translation> @@ -2615,6 +2618,7 @@ <translation id="3670113805793654926">任意のベンダーのデバイス</translation> <translation id="3670229581627177274">Bluetooth を ON にする</translation> <translation id="3672681487849735243">出荷時のエラーが見つかりました</translation> +<translation id="3673097791729989571">ログインは <ph name="SAML_DOMAIN" /> でホストされています</translation> <translation id="367645871420407123">既定のテストイメージの値にルート パスワードを設定する場合は、空欄のままにします</translation> <translation id="3677106374019847299">カスタム プロバイダを入力</translation> <translation id="3677911431265050325">モバイルサイトをリクエスト</translation> @@ -3392,6 +3396,7 @@ <translation id="4481467543947557978">Service Worker</translation> <translation id="4481530544597605423">ペア設定されていないデバイス</translation> <translation id="4482990632723642375">最近閉じたタブ</translation> +<translation id="4484922932728109422">画面に関する情報を基にウィンドウを開いて配置することをサイトに許可しない</translation> <translation id="4487489714832036847">Chromebook では従来のソフトウェアではなくアプリを使用します。仕事効率化やエンタメなど、豊富なアプリが揃っています。</translation> <translation id="4488257340342212116">カメラの使用を許可するサイト</translation> <translation id="4488502501195719518">データをすべて消去しますか?</translation> @@ -3474,6 +3479,7 @@ <translation id="4565917129334815774">システムログを保存</translation> <translation id="4566417217121906555">マイクをミュート</translation> <translation id="456717285308019641">翻訳するページの言語</translation> +<translation id="4567512141633030272">ログイン オプションが間違っている場合</translation> <translation id="4567533462991917415">セットアップが完了したら、いつでもユーザーを追加できます。ユーザーごとにアカウントをカスタマイズして、データのプライバシーを確保できます。</translation> <translation id="4567772783389002344">単語を追加</translation> <translation id="4568025708905928793">セキュリティ キーがリクエストされています</translation> @@ -3719,6 +3725,7 @@ <translation id="4841741146571978176">必要な仮想マシンが存在しません。続行するには <ph name="VM_TYPE" /> を設定してください</translation> <translation id="4842976633412754305">このページは承認されていないソースからのスクリプトを読み込もうとしています。</translation> <translation id="4844333629810439236">他のキーボード</translation> +<translation id="4844633725025837809">セキュリティ強化のため、Google パスワード マネージャーに保存する前にデバイス上でパスワードを暗号化します</translation> <translation id="4846680374085650406">管理者が推奨する設定を使用しています。</translation> <translation id="4847902821209177679"><ph name="TOPIC_SOURCE" /> <ph name="TOPIC_SOURCE_DESC" /> が選択されています。<ph name="TOPIC_SOURCE" /> アルバムを選択するには Enter キーを押してください</translation> <translation id="4848191975108266266">Google アシスタントの「OK Google」</translation> @@ -3859,6 +3866,7 @@ <translation id="499165176004408815">ハイコントラスト モードを使用</translation> <translation id="4992458225095111526">Powerwash の実行を確認</translation> <translation id="4992473555164495036">使用できる入力方法が管理者によって制限されています。</translation> +<translation id="4992984395680162305">次のデバイスは、QR コードのスキャンによりリンクされています。</translation> <translation id="4994474651455208930">プロトコルのデフォルト ハンドラへのサイトの登録要求を許可する</translation> <translation id="4994754230098574403">設定しています</translation> <translation id="4995131849631312693"><ph name="BEGIN_PARAGRAPH1" />登録する前に、<ph name="DEVICE_OS" /> がデバイスのオーナー権限を取得できるよう TPM を消去する必要があります。<ph name="END_PARAGRAPH1" /><ph name="BEGIN_PARAGRAPH2" />デバイスの TPM を完全にオフにすることもできます。データは、ソフトウェアによる暗号化で引き続き安全に保存されますが、ハードウェア式証明書など、特定のセキュリティ機能は無効になります。<ph name="END_PARAGRAPH2" /><ph name="BEGIN_PARAGRAPH3" />TPM の設定を変更するには、再起動してシステム BIOS / UEFI の設定に入ってください。手順はデバイスモデルに応じて異なります。詳しくは、再起動する前に別のデバイスで <ph name="DEVICE_OS" /> のドキュメントをご確認ください: [URL リンク]<ph name="END_PARAGRAPH3" /></translation> @@ -3975,6 +3983,7 @@ <translation id="5123433949759960244">バスケットボール</translation> <translation id="5125751979347152379">URL が無効です。</translation> <translation id="5126611267288187364">変更の表示</translation> +<translation id="5127242257756472928">画面に関する情報を基にウィンドウを開いて配置することを許可しない</translation> <translation id="5127620150973591153">安全な接続 ID: <ph name="TOKEN" /></translation> <translation id="5127805178023152808">同期は無効です</translation> <translation id="5127881134400491887">ネットワーク接続の管理</translation> @@ -4086,6 +4095,7 @@ <translation id="5243522832766285132">しばらくしてからもう一度お試しください</translation> <translation id="5244474230056479698"><ph name="EMAIL" /> に同期しています</translation> <translation id="5245610266855777041">学校用アカウントのご利用開始</translation> +<translation id="5246036036039717045">次のデバイスはセキュリティ キーとして使用できます(デバイス上で Chrome にログインしています)。</translation> <translation id="5246282308050205996"><ph name="APP_NAME" /> がクラッシュしました。このバルーンをクリックして再起動してください。</translation> <translation id="5247051749037287028">表示名(省略可)</translation> <translation id="5249624017678798539">ダウンロードの完了前にブラウザで問題が発生しました。</translation> @@ -4570,6 +4580,7 @@ <translation id="5757375109985023827">プレビューするタブを選択します</translation> <translation id="5758631781033351321">リーディング リストはここに表示されます</translation> <translation id="5759728514498647443">「<ph name="APP_NAME" />」を使用して印刷に送信したドキュメントは「<ph name="APP_NAME" />」で読めます。</translation> +<translation id="5762787084360227629">Google アカウントの情報を入力</translation> <translation id="5763751966069581670">USB デバイスが見つかりませんでした</translation> <translation id="5764483294734785780">名前を付けてオーディオを保存(&V)...</translation> <translation id="57646104491463491">更新日</translation> @@ -5710,6 +5721,7 @@ <translation id="6965382102122355670">OK</translation> <translation id="6965648386495488594">ポート</translation> <translation id="6965978654500191972">デバイス</translation> +<translation id="6966370001499648704">セキュリティ キーとして使用するスマートフォンを管理します</translation> <translation id="6967430741871315905">デバイスが許可されているかどうか確認できません</translation> <translation id="696780070563539690">サイトは、Cookie を使用して別のサイトでのあなたの閲覧アクティビティを確認できません(広告のカスタマイズなどが行えません)</translation> <translation id="6968288415730398122">画面ロックを設定するにはパスワードを入力します</translation> @@ -5884,6 +5896,7 @@ <translation id="7135729336746831607">Bluetooth をオンにしますか?</translation> <translation id="7136694880210472378">デフォルトに設定</translation> <translation id="7136993520339022828">エラーが発生しました。別の画像を選択して、もう一度お試しください。</translation> +<translation id="7137472406312798422">サイトが画面に関する情報を基にウィンドウを開いて配置することを要求できるようにする</translation> <translation id="7138515695467025690">オフ / 日の入りに自動的にオン</translation> <translation id="7138678301420049075">その他</translation> <translation id="7139627972753429585"><ph name="APP_NAME" /> がマイクを使用しています</translation> @@ -6769,6 +6782,7 @@ <translation id="8028803902702117856"><ph name="FILE_NAME" /> をダウンロードしています。<ph name="SIZE" /> 完了</translation> <translation id="8028993641010258682">サイズ</translation> <translation id="8029492516535178472"><ph name="WINDOW_TITLE" /> - 権限がリクエストされました。対応するには、⌘+option+上矢印キーを押してください</translation> +<translation id="8029539783236818164">画面に関する情報を基にウィンドウを開いて配置することを許可する</translation> <translation id="8030169304546394654">切断済み</translation> <translation id="8030852056903932865">承認</translation> <translation id="8032244173881942855">タブをキャストできません。</translation> @@ -6781,6 +6795,7 @@ <translation id="8038399858950372766">デバイス <ph name="DEVICE_INDEX" /> / <ph name="DEVICE_COUNT" />、キーボード <ph name="DEVICE_NAME" /></translation> <translation id="8041089156583427627">フィードバックを送信</translation> <translation id="8042142357103597104">テキストの透明度</translation> +<translation id="8042331986490021244">Google パスワード マネージャーに保存する前にデバイス上でパスワードを暗号化します</translation> <translation id="8044262338717486897"><ph name="LINUX_APP_NAME" /> から応答がありません。</translation> <translation id="8044899503464538266">遅い</translation> <translation id="8045253504249021590">同期は Google ダッシュボードで停止されています。</translation> @@ -7538,6 +7553,7 @@ <translation id="8838234842677265403"><ph name="WEB_DRIVE_MESSAGE" />(<ph name="SUPPORT_INFO" />)</translation> <translation id="8838601485495657486">不透明</translation> <translation id="8838770651474809439">ハンバーガー</translation> +<translation id="8838778928843281408">スマートフォンの管理</translation> <translation id="883911313571074303">画像に注釈を付ける</translation> <translation id="8841843049738266382">許可リストに登録されたユーザーの読み取りと変更</translation> <translation id="8842594465773264717">この指紋を削除</translation>
diff --git a/chrome/app/resources/generated_resources_ko.xtb b/chrome/app/resources/generated_resources_ko.xtb index 451cc35..34784911 100644 --- a/chrome/app/resources/generated_resources_ko.xtb +++ b/chrome/app/resources/generated_resources_ko.xtb
@@ -241,6 +241,7 @@ <translation id="1235458158152011030">알려진 네트워크</translation> <translation id="123578888592755962">디스크가 가득 참</translation> <translation id="1235924639474699896">{COUNT,plural, =1{텍스트}other{텍스트 #개}}</translation> +<translation id="1236009322878349843">휴대전화 수정</translation> <translation id="1239594683407221485">파일 앱에서 기기의 콘텐츠를 탐색하세요.</translation> <translation id="1241066500170667906"><ph name="EXPERIMENT_NAME" />의 실험 상태 선택</translation> <translation id="124116460088058876">다른 언어</translation> @@ -1956,6 +1957,7 @@ <translation id="2939908794993783865">추가 비활성 사이트</translation> <translation id="2939938020978911855">사용 가능한 블루투스 기기 표시</translation> <translation id="2941112035454246133">낮음</translation> +<translation id="2941696810925320401">사이트에서는 일반적으로 창을 열고 배치하여 화면에 추가 문서 또는 전체 화면 콘텐츠를 표시합니다.</translation> <translation id="2942279350258725020">Android 메시지</translation> <translation id="2942560570858569904">대기 중...</translation> <translation id="2942581856830209953">페이지 맞춤설정</translation> @@ -2108,6 +2110,7 @@ <translation id="3099836255427453137">{NUM_EXTENSIONS,plural, =1{1개의 잠재적으로 위험한 확장 프로그램이 사용 중지되었습니다. 삭제할 수도 있습니다.}other{{NUM_EXTENSIONS}개의 잠재적으로 위험한 확장 프로그램이 사용 중지되었습니다. 삭제할 수도 있습니다.}}</translation> <translation id="3101126716313987672">조명 밝기 줄이기</translation> <translation id="3101709781009526431">날짜 및 시간</translation> +<translation id="3103451787721578293">이 데이터를 업로드하는 이유를 입력하세요</translation> <translation id="3103941660000130485">Linux 업그레이드 중 오류 발생</translation> <translation id="3105796011181310544">Google로 되돌리시겠습니까?</translation> <translation id="310671807099593501">사이트에서 블루투스를 사용하고 있습니다.</translation> @@ -2633,6 +2636,7 @@ <translation id="3670113805793654926">모든 공급업체의 기기</translation> <translation id="3670229581627177274">블루투스 켜기</translation> <translation id="3672681487849735243">하드웨어에서 문제가 발견되었습니다.</translation> +<translation id="3673097791729989571">로그인 호스팅 제공: <ph name="SAML_DOMAIN" /></translation> <translation id="367645871420407123">루트 비밀번호를 기본 테스트 이미지 값으로 설정하려면 비워두세요.</translation> <translation id="3677106374019847299">사용자설정 제공업체 입력</translation> <translation id="3677911431265050325">모바일 버전으로 보기</translation> @@ -3413,6 +3417,7 @@ <translation id="4481467543947557978">서비스 워커</translation> <translation id="4481530544597605423">페어링 해제된 기기</translation> <translation id="4482990632723642375">최근에 닫은 탭</translation> +<translation id="4484922932728109422">사이트에서 화면 정보를 사용하여 창을 열고 배치하는 것을 허용하지 않음</translation> <translation id="4487489714832036847">Chromebook에서는 기존 소프트웨어 대신 앱을 사용합니다. 생산성, 엔터테인먼트 등을 위한 앱을 활용해 보세요.</translation> <translation id="4488257340342212116">카메라 사용이 허용됨</translation> <translation id="4488502501195719518">모든 데이터를 삭제하시겠습니까?</translation> @@ -3495,6 +3500,7 @@ <translation id="4565917129334815774">시스템 로그 저장</translation> <translation id="4566417217121906555">마이크 음소거</translation> <translation id="456717285308019641">번역할 페이지 언어</translation> +<translation id="4567512141633030272">잘못된 로그인 옵션인가요?</translation> <translation id="4567533462991917415">설정이 완료된 후에도 언제든지 사용자를 추가할 수 있습니다. 모든 사용자는 자신의 계정을 맞춤설정하고 데이터를 비공개로 유지할 수 있습니다.</translation> <translation id="4567772783389002344">단어 추가</translation> <translation id="4568025708905928793">보안 키 요청됨</translation> @@ -3740,6 +3746,7 @@ <translation id="4841741146571978176">필수 가상 머신이 존재하지 않습니다. 계속하려면 <ph name="VM_TYPE" /> VM을 설정해 보세요.</translation> <translation id="4842976633412754305">이 페이지가 인증되지 않은 소스에서 스크립트를 로드하려고 시도하고 있습니다.</translation> <translation id="4844333629810439236">기타 키보드</translation> +<translation id="4844633725025837809">보안 강화를 위해 비밀번호를 기기 내에서 암호화한 후 Google 비밀번호 관리자에 저장합니다</translation> <translation id="4846680374085650406">이 설정에 대한 관리자 권장사항을 따릅니다.</translation> <translation id="4847902821209177679"><ph name="TOPIC_SOURCE" /> <ph name="TOPIC_SOURCE_DESC" /> 선택됨, <ph name="TOPIC_SOURCE" /> 앨범을 선택하려면 Enter를 누르세요</translation> <translation id="4848191975108266266">Google 어시스턴트 'Ok Google'</translation> @@ -3880,6 +3887,7 @@ <translation id="499165176004408815">고대비 모드 사용</translation> <translation id="4992458225095111526">Powerwash 확인</translation> <translation id="4992473555164495036">관리자가 사용 가능한 입력 방법을 제한했습니다.</translation> +<translation id="4992984395680162305">기기가 QR 코드 스캔을 통해 연결되었습니다.</translation> <translation id="4994474651455208930">사이트에서 프로토콜 기본 핸들러로 사용할지 여부를 묻도록 허용</translation> <translation id="4994754230098574403">설정 중입니다.</translation> <translation id="4995131849631312693"><ph name="BEGIN_PARAGRAPH1" />등록하기 전에 <ph name="DEVICE_OS" />에서 기기 소유권을 가질 수 있도록 TPM을 삭제해야 합니다.<ph name="END_PARAGRAPH1" /> @@ -3998,6 +4006,7 @@ <translation id="5123433949759960244">농구공</translation> <translation id="5125751979347152379">잘못된 URL입니다.</translation> <translation id="5126611267288187364">변경사항 보기</translation> +<translation id="5127242257756472928">화면에 관한 정보를 사용하여 창을 열고 배치하는 것 허용되지 않음</translation> <translation id="5127620150973591153">보안 연결 ID: <ph name="TOKEN" /></translation> <translation id="5127805178023152808">동기화 사용 안함</translation> <translation id="5127881134400491887">네트워크 연결 관리</translation> @@ -4110,6 +4119,7 @@ <translation id="5243522832766285132">잠시 후 다시 시도해 주세요.</translation> <translation id="5244474230056479698"><ph name="EMAIL" />에 동기화</translation> <translation id="5245610266855777041">학교 계정으로 시작하세요</translation> +<translation id="5246036036039717045">기기가 Chrome에 로그인되어 있으므로 기기를 보안 키로 사용할 수 있습니다.</translation> <translation id="5246282308050205996"><ph name="APP_NAME" />이(가) 다운되었습니다. 앱을 다시 시작하려면 이 풍선을 클릭하세요.</translation> <translation id="5247051749037287028">표시 이름(선택사항)</translation> <translation id="5249624017678798539">다운로드가 완료되기 전에 브라우저가 종료되었습니다.</translation> @@ -4598,6 +4608,7 @@ <translation id="5757375109985023827">미리 볼 탭 선택</translation> <translation id="5758631781033351321">여기에서 읽기 목록을 확인할 수 있습니다</translation> <translation id="5759728514498647443"><ph name="APP_NAME" />을(를) 통해 인쇄하려고 전송한 문서를 <ph name="APP_NAME" />에서 읽을 수 있습니다.</translation> +<translation id="5762787084360227629">Google 계정 정보 입력</translation> <translation id="5763751966069581670">USB 기기를 찾을 수 없습니다.</translation> <translation id="5764483294734785780">오디오를 다른 이름으로 저장...(&V)</translation> <translation id="57646104491463491">수정된 날짜</translation> @@ -5743,6 +5754,7 @@ <translation id="6965382102122355670">확인</translation> <translation id="6965648386495488594">포트</translation> <translation id="6965978654500191972">기기</translation> +<translation id="6966370001499648704">보안 키로 사용하는 전화를 제어합니다.</translation> <translation id="6967430741871315905">기기 허용 여부를 확인할 수 없습니다.</translation> <translation id="696780070563539690">사이트에서 사용자의 다양한 사이트 탐색 활동 정보를 이용해 광고 맞춤설정 등의 작업을 하기 위해 쿠키를 사용할 수 없습니다.</translation> <translation id="6968288415730398122">비밀번호를 입력하여 화면 잠금을 설정하세요.</translation> @@ -5917,6 +5929,7 @@ <translation id="7135729336746831607">블루투스를 사용 설정하시겠습니까?</translation> <translation id="7136694880210472378">기본으로 설정</translation> <translation id="7136993520339022828">오류가 발생했습니다. 다른 이미지를 선택하고 다시 시도해 보세요.</translation> +<translation id="7137472406312798422">사이트에서 화면 정보를 사용하여 창을 열고 배치하도록 요청할 수 있음</translation> <translation id="7138515695467025690">사용 안함 / 일몰 시 자동으로 켜짐</translation> <translation id="7138678301420049075">기타</translation> <translation id="7139627972753429585"><ph name="APP_NAME" />에서 마이크를 사용 중입니다.</translation> @@ -6804,6 +6817,7 @@ <translation id="8028803902702117856"><ph name="SIZE" /> 다운로드 중, <ph name="FILE_NAME" /></translation> <translation id="8028993641010258682">크기</translation> <translation id="8029492516535178472"><ph name="WINDOW_TITLE" /> - 권한 요청됨, ⌘ 키와 Option 키와 위쪽 화살표 키를 눌러 응답</translation> +<translation id="8029539783236818164">화면에 관한 정보를 사용하여 창을 열고 배치하는 것 허용됨</translation> <translation id="8030169304546394654">연결 끊김</translation> <translation id="8030852056903932865">승인</translation> <translation id="8032244173881942855">탭을 전송할 수 없습니다.</translation> @@ -6816,6 +6830,7 @@ <translation id="8038399858950372766">기기 <ph name="DEVICE_COUNT" />대 중 <ph name="DEVICE_INDEX" />번째, 이름이 <ph name="DEVICE_NAME" />인 키보드</translation> <translation id="8041089156583427627">의견 보내기</translation> <translation id="8042142357103597104">텍스트 불투명도</translation> +<translation id="8042331986490021244">비밀번호가 Google 비밀번호 관리자에 저장되기 전에 기기에서 암호화됩니다</translation> <translation id="8044262338717486897"><ph name="LINUX_APP_NAME" />이(가) 응답하지 않음</translation> <translation id="8044899503464538266">느리게</translation> <translation id="8045253504249021590">Google 대시보드를 통해 동기화가 중지되었습니다.</translation> @@ -7573,6 +7588,7 @@ <translation id="8838234842677265403"><ph name="WEB_DRIVE_MESSAGE" />(<ph name="SUPPORT_INFO" />)</translation> <translation id="8838601485495657486">불투명</translation> <translation id="8838770651474809439">햄버거</translation> +<translation id="8838778928843281408">휴대전화 관리</translation> <translation id="883911313571074303">이미지에 주석 달기</translation> <translation id="8841843049738266382">허용 목록에 있는 사용자를 읽고 변경하기</translation> <translation id="8842594465773264717">이 지문 삭제</translation>
diff --git a/chrome/app/resources/generated_resources_my.xtb b/chrome/app/resources/generated_resources_my.xtb index f7b05d32..6eb0109 100644 --- a/chrome/app/resources/generated_resources_my.xtb +++ b/chrome/app/resources/generated_resources_my.xtb
@@ -241,6 +241,7 @@ <translation id="1235458158152011030">သိထားသည့် ကွန်ရက်များ</translation> <translation id="123578888592755962">ဒီစ်က် ပြည့်နေ</translation> <translation id="1235924639474699896">{COUNT,plural, =1{စာတို}other{စာတို # စောင်}}</translation> +<translation id="1236009322878349843">ဖုန်းအချက်အလက် တည်းဖြတ်ခြင်း</translation> <translation id="1239594683407221485">ကိရိယာ၏ အကြောင်းအရာများကို Files အက်ပ်ထဲတွင် စူးစမ်းကြည့်ပါ။</translation> <translation id="1241066500170667906"><ph name="EXPERIMENT_NAME" /> အတွက် စမ်းသပ်မှုအခြေအနေကို ရွေးရန်</translation> <translation id="124116460088058876">နောက်ထပ် ဘာသာစကားများ</translation> @@ -1954,6 +1955,7 @@ <translation id="2939908794993783865">မသုံးသော နောက်ထပ်ဝဘ်ဆိုက်များ</translation> <translation id="2939938020978911855">ရရှိနိုင်သော ဘလူးတုသ် စက်ပစ္စည်းများကို ပြရန်</translation> <translation id="2941112035454246133">နိမ့်</translation> +<translation id="2941696810925320401">ထပ်ဆောင်းမှတ်တမ်းများ (သို့) ဖန်သားပြင်အပြည့် အချက်အလက်ကို သင့်ဖန်သားပြင်၌ပြရန် ဝဘ်ဆိုက်များက ဝင်းဒိုးများဖွင့်ပြီး နေရာချလေ့ရှိသည်</translation> <translation id="2942279350258725020">Android messages</translation> <translation id="2942560570858569904">စောင့်နေသည်...</translation> <translation id="2942581856830209953">ဤစာမျက်နှာကို စိတ်ကြိုက်လုပ်ရန်</translation> @@ -2106,6 +2108,7 @@ <translation id="3099836255427453137">{NUM_EXTENSIONS,plural, =1{အန္တရာယ်ရှိနိုင်သော နောက်ဆက်တွဲ ၁ ခုကို ပိတ်ထားသည်။ သင်၎င်းကို ဖယ်ရှားနိုင်သည်။}other{အန္တရာယ်ရှိနိုင်သော နောက်ဆက်တွဲ {NUM_EXTENSIONS} ခုကို ပိတ်ထားသည်။ သင်၎င်းတို့ကို ဖယ်ရှားနိုင်သည်။}}</translation> <translation id="3101126716313987672">မီးရောင်အမှိန်</translation> <translation id="3101709781009526431">ရက်စွဲ နှင့် အချိန်</translation> +<translation id="3103451787721578293">ဤဒေတာကို အပ်လုဒ်လုပ်ခြင်းအတွက် အကြောင်းပြချက် ထည့်ပါ-</translation> <translation id="3103941660000130485">Linux ကို အဆင့်မြှင့်ရာတွင် အမှားအယွင်းရှိနေသည်</translation> <translation id="3105796011181310544">Google သို့ ပြန်ပြောင်းမလား။</translation> <translation id="310671807099593501">ဝဘ်ဆိုက်က ဘလူးတုသ်ကို အသုံးပြုနေသည်</translation> @@ -2631,6 +2634,7 @@ <translation id="3670113805793654926">မည်သည့်ရောင်းချသူမဆိုထံမှ စက်ပစ္စည်းများ</translation> <translation id="3670229581627177274">ဘလူးတုသ်ကို ဖွင့်ရန်</translation> <translation id="3672681487849735243">စက်ရုံ အမှား တစ်ခု ရှာတွေခဲ့</translation> +<translation id="3673097791729989571">လက်မှတ်ထိုးဝင်ခြင်းကို <ph name="SAML_DOMAIN" /> က လက်ခံဆောင်ရွက်သည်</translation> <translation id="367645871420407123">ရုပ်ပုံတန်ဖိုးအား မူလပုံစံစမ်းသပ်မှုတွင် root စကားဝှက် သတ်မှတ်လိုပါက ကွပ်လပ်အတိုင်းထားခဲ့ပါ</translation> <translation id="3677106374019847299">စိတ်ကြိုက် ပံ့ပိုးသူကို ထည့်ရန်</translation> <translation id="3677911431265050325">မိုဘိုင်းဝဘ်ဆိုက်ကို တောင်းဆိုရန်</translation> @@ -3412,6 +3416,7 @@ <translation id="4481467543947557978">ဝန်ဆောင်မှု ဆောင်ရွက်စနစ်</translation> <translation id="4481530544597605423">ချိတ်ဆက်မှု ဖြုတ်ထားသည့် စက်ပစ္စည်းများ</translation> <translation id="4482990632723642375">လတ်တလောပိတ်လိုက်သော တဘ်</translation> +<translation id="4484922932728109422">ဝင်းဒိုးများဖွင့်ပြီး နေရာချထားရန်အတွက် သင့်ဖန်သားပြင်အချက်အလက်ကို ဝဘ်ဆိုက်များအား အသုံးပြုခွင့် မပေးပါ</translation> <translation id="4487489714832036847">Chromebooks သည် သာမန်ဆော့ဖ်ဝဲအစား အက်ပ်များကိုသုံးသည်။ အလုပ်ပြီးမြောက်မှု၊ ဖျော်ဖြေရေးနှင့် အခြားအရာများအတွက် အက်ပ်များရယူပါ။</translation> <translation id="4488257340342212116">သင့်ကင်မရာကို သုံးရန် ခွင့်ပြုထားသည်</translation> <translation id="4488502501195719518">ဒေတာအားလုံး ရှင်းထုတ်မလား။</translation> @@ -3495,6 +3500,7 @@ <translation id="4565917129334815774">စနစ် မှတ်တမ်းများ သိမ်းရန်</translation> <translation id="4566417217121906555">မိုက်ခရိုဖုန်းကို အသံပိတ်ရန်</translation> <translation id="456717285308019641">ပြန်ဆိုရမည့် စာမျက်နှာ ဘာသာစကား</translation> +<translation id="4567512141633030272">လက်မှတ်ထိုးဝင်ပုံ လွဲနေပါသလား။</translation> <translation id="4567533462991917415">စနစ်ထည့်သွင်းပြီးနောက်တွင် နောက်ထပ်လူများကို အမြဲထည့်သွင်းနိုင်သည်။ လူတစ်ဦးချင်းစီက သူတို့၏အကောင့်ကို ပုဂ္ဂိုလ်ရေးသီးသန့်ပြုလုပ်နိုင်ပြီး ဒေတာကို သီးသန့်သိမ်းနိုင်သည်။</translation> <translation id="4567772783389002344">စကားလုံးထည့်ရန်</translation> <translation id="4568025708905928793">လုံခြုံရေးကီးကို တောင်းဆိုထားသည်</translation> @@ -3740,6 +3746,7 @@ <translation id="4841741146571978176">သတ်မှတ်ထားသော ပကတိအသွင်စက် မရှိပါ။ ရှေ့ဆက်ရန် <ph name="VM_TYPE" /> ကို စနစ်ထည့်သွင်းကြည့်ပါ</translation> <translation id="4842976633412754305">ဤစာမျက်နှာသည် အထောက်အထားမခိုင်လုံသော အရင်းအမြစ်များမှ စခရစ်များ ရယူရန် ကြိုးစားနေသည်။</translation> <translation id="4844333629810439236">အခြားကီးဘုတ်များ</translation> +<translation id="4844633725025837809">လုံခြုံရေးပိုမိုကောင်းမွန်စေရန် စကားဝှက်များကို ‘Google စကားဝှက်မန်နေဂျာ’ သို့ မသိမ်းမီ သင်၏စက်၌ အသွင်ဝှက်ပါ</translation> <translation id="4846680374085650406">ဤဆက်တင်အတွက် ကြီးကြပ်သူ၏ အကြံပြုချက်အား သင်လိုက်နာနေ။</translation> <translation id="4847902821209177679"><ph name="TOPIC_SOURCE" /> <ph name="TOPIC_SOURCE_DESC" /> ကို ရွေးချယ်ထားသည်၊ <ph name="TOPIC_SOURCE" /> အယ်လ်ဘမ်များကိုရွေးရန် Enter နှိပ်ပါ</translation> <translation id="4848191975108266266">Google Assistant "Ok Google"</translation> @@ -3880,6 +3887,7 @@ <translation id="499165176004408815">ဖြူမဲခြားနားချက် မြင့်မားသည့် မုဒ်ကို သုံးရန်</translation> <translation id="4992458225095111526">Powerwash အား အတည်ပြုရန်</translation> <translation id="4992473555164495036">စီမံခန့်ခွဲသူက ရရှိနိုင်သော လက်ကွက်များကို ကန့်သတ်ထားသည်။</translation> +<translation id="4992984395680162305">ဤစက်များကို QR ကုဒ် စကင်ဖတ်ခြင်းဖြင့် ချိတ်ဆက်ထားသည်။</translation> <translation id="4994474651455208930">လုပ်ထုံးလုပ်နည်းများအား မူရင်းစီမံသူများအဖြစ် ဆိုက်များကို တောင်းဆိုခွင့်ပြုပါ</translation> <translation id="4994754230098574403">စနစ်ထည့်သွင်းနေပါသည်</translation> <translation id="4995131849631312693"><ph name="BEGIN_PARAGRAPH1" /><ph name="DEVICE_OS" /> က စက်၏ပိုင်ဆိုင်မှုကို ရယူနိုင်ရန်အတွက် စာရင်းမသွင်းမီ TPM ကို ရှင်းရန်လိုအပ်သည်။<ph name="END_PARAGRAPH1" /> @@ -3998,6 +4006,7 @@ <translation id="5123433949759960244">ဘတ်စကက်ဘော</translation> <translation id="5125751979347152379">URL မမှန်</translation> <translation id="5126611267288187364">ပြောင်းလဲမှုများကို ကြည့်ရန်</translation> +<translation id="5127242257756472928">ဝင်းဒိုးများဖွင့်ပြီး နေရာချထားရန်အတွက် သင့်ဖန်သားပြင်အချက်အလက်ကို အသုံးပြုရန် ခွင့်ပြုမထားပါ</translation> <translation id="5127620150973591153">လုံခြုံသော ချိတ်ဆက်မှု ID−<ph name="TOKEN" /></translation> <translation id="5127805178023152808">စင့် ပိတ်ထား၏</translation> <translation id="5127881134400491887">ကွန်ရက် ချိတ်ဆက်မှုများကို စီမံကွပ်ကဲရန်</translation> @@ -4110,6 +4119,7 @@ <translation id="5243522832766285132">ခေတ္တအကြာတွင် ထပ်စမ်းကြည့်ပါ</translation> <translation id="5244474230056479698"><ph name="EMAIL" /> သို့စင့်ခ်လုပ်နေသည်</translation> <translation id="5245610266855777041">ကျောင်းသုံးအကောင့်ဖြင့် စတင်ခြင်း</translation> +<translation id="5246036036039717045">သင်သည် ဤစက်များတွင် Chrome ကို လက်မှတ်ထိုးဝင်ထားသည့်အတွက် ၎င်းတို့ကို လုံခြုံရေးကီးများအဖြစ် အသုံးပြုနိုင်သည်။</translation> <translation id="5246282308050205996"><ph name="APP_NAME" /> မှာ ပျက်စီးသွားပြီ။ အက်ပ်ကို ပြန်ဖွင့်ရန် ဒီပူဖောင်းကို န။</translation> <translation id="5247051749037287028">ဖော်ပြရန်အမည် (ချန်လှပ်ထားနိုင်သည်)</translation> <translation id="5249624017678798539">ဒေါင်းလုဒ် မပြီးခင် ဘရောင်ဇာ ပျက်ကျသွားသည်။</translation> @@ -4599,6 +4609,7 @@ <translation id="5757375109985023827">အစမ်းကြည့်ရန် တဘ်ရွေးပါ</translation> <translation id="5758631781033351321">သင့်ဖတ်ရန်စာရင်းကို ဤနေရာတွင် ပြပါမည်</translation> <translation id="5759728514498647443"><ph name="APP_NAME" /> မှတစ်ဆင့် ပုံနှိပ်ထုတ်မည့် စာရွက်စာတမ်းများအား <ph name="APP_NAME" /> ဖြင့် ဖတ်နိုင်သည်။</translation> +<translation id="5762787084360227629">Google Account အချက်အလက် ထည့်ရန်</translation> <translation id="5763751966069581670">မည်သည့် USB စက်ပစ္စည်းကိုမျှ မတွေ့ပါ</translation> <translation id="5764483294734785780">အသံကို သိမ်း&ဆည်းရန်...</translation> <translation id="57646104491463491">မွမ်းမံခဲ့သည့် ရက်စွဲ</translation> @@ -5618,7 +5629,7 @@ <translation id="6828182567531805778">သင့်ဒေတာများ စင့်ခ်လုပ်ရန် သင်၏စကားဝှက်စာ ထည့်ပါ</translation> <translation id="682871081149631693">QuickFix</translation> <translation id="6828860976882136098">အသုံးပြုသူများ အားလုံးအတွက် အလိုအလျောက်အပ်ဒိတ်များ စနစထည့်သွင်းမှု ပြုလုပ်ခြင်း မအောင်မြင်ပါ (လေယာဉ်မထွက်မီ စတင်ခြင်း ချွတ်ယွင်းချက် − <ph name="ERROR_NUMBER" />)</translation> -<translation id="682971198310367122">Google ပုဂ္ဂိုလ်ရေးဆိုင်ရာမူဝါဒ</translation> +<translation id="682971198310367122">Google ကိုယ်ရေးအချက်အလက်လုံခြုံမှုဆိုင်ရာ မူဝါဒ</translation> <translation id="6831043979455480757">ဘာသာပြန်ရန်</translation> <translation id="6833479554815567477"><ph name="GROUP_NAME" /> အုပ်စုမှ တဘ်ကို ဖယ်ရှားလိုက်သည် - <ph name="GROUP_CONTENTS" /></translation> <translation id="683373380308365518">ပါးနပ်ပြီး လုံခြုံမှုရှိသော ဘရောင်ဇာသို့ ပြောင်းလိုက်ပါ</translation> @@ -5741,6 +5752,7 @@ <translation id="6965382102122355670">OK</translation> <translation id="6965648386495488594">ပို့တ်</translation> <translation id="6965978654500191972">စက်ပစ္စည်း</translation> +<translation id="6966370001499648704">မည်သည့်ဖုန်းကို လုံခြုံရေးကီးအဖြစ်သုံးရန် ထိန်းချုပ်နိုင်သည်</translation> <translation id="6967430741871315905">စက်ကို ခွင့်ပြုထားခြင်း ရှိ၊ မရှိ စစ်ဆေး၍မရပါ</translation> <translation id="696780070563539690">ဝဘ်ဆိုက်များသည် ကြော်ငြာများကို ပုဂ္ဂိုလ်ရေးသီးသန့်ပြုလုပ်ရန် ဥပမာအားဖြင့် မတူညီသည့် ဝဘ်ဆိုက်များတစ်လျှောက်တွင် ကွတ်ကီးများသုံးပြီး သင့်ကြည့်ရှုခြင်းများကို ကြည့်နိုင်မည်မဟုတ်ပါ</translation> <translation id="6968288415730398122">မျက်နှာပြင်လော့ခ်ကို စီစဉ်သတ်မှတ်ရန် စကားဝှက်ထည့်ပါ</translation> @@ -5915,6 +5927,7 @@ <translation id="7135729336746831607">ဘလူးတုသ် ဖွင့်မလား။</translation> <translation id="7136694880210472378">ပုံသေ လုပ်ရန်</translation> <translation id="7136993520339022828">အမှားအယွင်းရှိနေသည်။ အခြားပုံများကို ရွေးပြီး ထပ်စမ်းကြည့်ပါ။</translation> +<translation id="7137472406312798422">ဝင်းဒိုးများဖွင့်ပြီး နေရာချထားရန်အတွက် သင့်ဖန်သားပြင်အချက်အလက်ကို အသုံးပြုရန် ဝဘ်ဆိုက်များက ခွင့်တောင်းနိုင်သည်</translation> <translation id="7138515695467025690">ပိတ် / နေဝင်ချိန်တွင် အလိုအလျောက် ပွင့်မည်</translation> <translation id="7138678301420049075">အခြား</translation> <translation id="7139627972753429585"><ph name="APP_NAME" /> က သင့်မိုက်ခရိုဖုန်းကို အသုံးပြုနေသည်</translation> @@ -6801,6 +6814,7 @@ <translation id="8028803902702117856"><ph name="FILE_NAME" />၊ <ph name="SIZE" /> ကို ဒေါင်းလုဒ်လုပ်နေသည်</translation> <translation id="8028993641010258682">ဆိုက်</translation> <translation id="8029492516535178472"><ph name="WINDOW_TITLE" /> - ခွင့်ပြုချက်တောင်းထားသည်၊ တုံ့ပြန်ရန် ⌘ + Option + 'အပေါ်ညွှန်မြား' နှိပ်ပါ</translation> +<translation id="8029539783236818164">ဝင်းဒိုးများဖွင့်ပြီး နေရာချထားရန်အတွက် သင့်ဖန်သားပြင်အချက်အလက်ကို အသုံးပြုရန် ခွင့်ပြုထားသည်</translation> <translation id="8030169304546394654">ချိတ်ဆက်မှု ဖြုတ်ထား</translation> <translation id="8030852056903932865">အတည်ပြုရန်</translation> <translation id="8032244173881942855">တဘ်ကို ကာစ်တ်မလုပ်နိုင်ပါ။</translation> @@ -6813,6 +6827,7 @@ <translation id="8038399858950372766"><ph name="DEVICE_COUNT" /> အနက် စက် <ph name="DEVICE_INDEX" />၊ <ph name="DEVICE_NAME" /> အမည်ရှိသော ကီးဘုတ်</translation> <translation id="8041089156583427627">အကြံပြုချက် ပို့ရန်</translation> <translation id="8042142357103597104">စာသား အလင်းပိတ်နှုန်း</translation> +<translation id="8042331986490021244">စကားဝှက်များကို ‘Google စကားဝှက်မန်နေဂျာ’ သို့ မသိမ်းမီ သင်၏စက်၌ အသွင်ဝှက်ပြီးပါပြီ</translation> <translation id="8044262338717486897"><ph name="LINUX_APP_NAME" /> တုံ့ပြန်မှုမရှိခြင်း။</translation> <translation id="8044899503464538266">နှေး</translation> <translation id="8045253504249021590">Google Dashboard မှတစ်ဆင့် စင့်ခ်လုပ်ခြင်းကို ရပ်တန့်လိုက်ပါပြီ။</translation> @@ -7570,6 +7585,7 @@ <translation id="8838234842677265403"><ph name="WEB_DRIVE_MESSAGE" /> (<ph name="SUPPORT_INFO" />)</translation> <translation id="8838601485495657486">အလင်းပိတ်သည်</translation> <translation id="8838770651474809439">ဟမ်ဘာဂါ</translation> +<translation id="8838778928843281408">ဖုန်းများစီမံခြင်း</translation> <translation id="883911313571074303">ပုံတွင် မှတ်ချက်ပေးရန်</translation> <translation id="8841843049738266382">ခွင့်ပြုစာရင်းပါ အသုံးပြုသူများကို ဖတ်ရှုပြီး ပြောင်းလဲပါ</translation> <translation id="8842594465773264717">ဤလက်ဗွေကို ဖျက်ရန်</translation>
diff --git a/chrome/app/resources/generated_resources_th.xtb b/chrome/app/resources/generated_resources_th.xtb index 9afc96c1..84e7d85 100644 --- a/chrome/app/resources/generated_resources_th.xtb +++ b/chrome/app/resources/generated_resources_th.xtb
@@ -239,6 +239,7 @@ <translation id="1235458158152011030">เครือข่ายที่รู้จัก</translation> <translation id="123578888592755962">ดิสก์เต็ม</translation> <translation id="1235924639474699896">{COUNT,plural, =1{ข้อความ}other{# ข้อความ}}</translation> +<translation id="1236009322878349843">แก้ไขโทรศัพท์</translation> <translation id="1239594683407221485">สำรวจเนื้อหาของอุปกรณ์ในแอป Files</translation> <translation id="1241066500170667906">เลือกสถานะการทดสอบสำหรับ<ph name="EXPERIMENT_NAME" /></translation> <translation id="124116460088058876">ภาษาเพิ่มเติม</translation> @@ -1940,6 +1941,7 @@ <translation id="2939908794993783865">เว็บไซต์อื่นที่ไม่ได้ใช้งาน</translation> <translation id="2939938020978911855">แสดงอุปกรณ์บลูทูธที่ใช้ได้</translation> <translation id="2941112035454246133">ต่ำ</translation> +<translation id="2941696810925320401">เว็บไซต์มักจะเปิดและวางหน้าต่างเพื่อแสดงเอกสารเพิ่มเติมหรือเนื้อหาแบบเต็มหน้าจอบนหน้าจอของคุณ</translation> <translation id="2942279350258725020">Android Messages</translation> <translation id="2942560570858569904">กำลังรอ...</translation> <translation id="2942581856830209953">ปรับแต่งหน้านี้</translation> @@ -2092,6 +2094,7 @@ <translation id="3099836255427453137">{NUM_EXTENSIONS,plural, =1{ระบบปิดส่วนขยายที่อาจเป็นอันตรายไป 1 รายการ คุณจะนำส่วนขยายนี้ออกก็ได้}other{ระบบปิดส่วนขยายที่อาจเป็นอันตรายไป {NUM_EXTENSIONS} รายการ คุณจะนำส่วนขยายเหล่านี้ออกก็ได้}}</translation> <translation id="3101126716313987672">แสงสลัว</translation> <translation id="3101709781009526431">วันที่และเวลา</translation> +<translation id="3103451787721578293">โปรดป้อนเหตุผลของการอัปโหลดข้อมูลนี้</translation> <translation id="3103941660000130485">เกิดข้อผิดพลาดในการอัปเกรด Linux</translation> <translation id="3105796011181310544">ต้องการเปลี่ยนกลับไปใช้ Google ไหม</translation> <translation id="310671807099593501">เว็บไซต์กำลังใช้บลูทูธ</translation> @@ -2617,6 +2620,7 @@ <translation id="3670113805793654926">อุปกรณ์จากผู้ให้บริการรายใดก็ได้</translation> <translation id="3670229581627177274">เปิดบลูทูธ</translation> <translation id="3672681487849735243">ตรวจพบข้อผิดพลาดจากโรงงาน</translation> +<translation id="3673097791729989571">การลงชื่อเข้าใช้ที่โฮสต์โดย <ph name="SAML_DOMAIN" /></translation> <translation id="367645871420407123">เว้นว่างไว้หากคุณต้องการตั้งรหัสผ่านระดับรูทเป็นภาพทดสอบเริ่มต้น</translation> <translation id="3677106374019847299">ป้อนชื่อผู้ให้บริการที่กำหนดเอง</translation> <translation id="3677911431265050325">ขอเว็บไซต์ในอุปกรณ์เคลื่อนที่</translation> @@ -3399,6 +3403,7 @@ <translation id="4481467543947557978">Service Worker</translation> <translation id="4481530544597605423">อุปกรณ์ที่ไม่ได้จับคู่</translation> <translation id="4482990632723642375">แท็บที่เพิ่งปิด</translation> +<translation id="4484922932728109422">ไม่อนุญาตให้เว็บไซต์ใช้ข้อมูลเกี่ยวกับหน้าจอเพื่อเปิดและวางหน้าต่าง</translation> <translation id="4487489714832036847">Chromebook จะใช้งานแอปแทนซอฟต์แวร์ดั้งเดิม รับแอปเพื่อประสิทธิภาพการทำงาน ความบันเทิง และอื่นๆ</translation> <translation id="4488257340342212116">ได้รับอนุญาตให้ใช้กล้อง</translation> <translation id="4488502501195719518">ล้างข้อมูลทั้งหมดไหม</translation> @@ -3481,6 +3486,7 @@ <translation id="4565917129334815774">จัดเก็บบันทึกระบบ</translation> <translation id="4566417217121906555">ปิดเสียงไมโครโฟน</translation> <translation id="456717285308019641">ภาษาปลายทางของหน้า</translation> +<translation id="4567512141633030272">หากตัวเลือกการลงชื่อเข้าใช้ไม่ถูกต้อง</translation> <translation id="4567533462991917415">คุณเพิ่มคนได้อีกเสมอหลังจากตั้งค่าแล้ว โดยแต่ละคนจะปรับเปลี่ยนการตั้งค่าบัญชีในแบบของตนและเก็บเป็นข้อมูลส่วนตัวได้</translation> <translation id="4567772783389002344">เพิ่มคำ</translation> <translation id="4568025708905928793">กำลังขอคีย์ความปลอดภัย</translation> @@ -3726,6 +3732,7 @@ <translation id="4841741146571978176">ไม่มีเครื่องเสมือนที่จำเป็น โปรดลองตั้งค่า <ph name="VM_TYPE" /> เพื่อดำเนินการต่อ</translation> <translation id="4842976633412754305">หน้านี้พยายามโหลดสคริปต์จากแหล่งที่มาที่ไม่มีการรับรอง</translation> <translation id="4844333629810439236">แป้นพิมพ์อื่นๆ</translation> +<translation id="4844633725025837809">เข้ารหัสให้กับรหัสผ่านในอุปกรณ์ก่อนบันทึกลงในเครื่องมือจัดการรหัสผ่านของ Google เพื่อเพิ่มความปลอดภัย</translation> <translation id="4846680374085650406">คุณทำตามคำแนะนำของผู้ดูแลระบบสำหรับการตั้งค่านี้</translation> <translation id="4847902821209177679">เลือก <ph name="TOPIC_SOURCE" /> <ph name="TOPIC_SOURCE_DESC" /> อยู่ กด Enter เพื่อเลือกอัลบั้ม <ph name="TOPIC_SOURCE" /></translation> <translation id="4848191975108266266">"Ok Google" ใน Google Assistant</translation> @@ -3866,6 +3873,7 @@ <translation id="499165176004408815">ใช้โหมดคอนทราสต์สูง</translation> <translation id="4992458225095111526">ยืนยัน Powerwash</translation> <translation id="4992473555164495036">ผู้ดูแลระบบจำกัดวิธีการป้อนข้อมูลที่ใช้ได้เอาไว้</translation> +<translation id="4992984395680162305">อุปกรณ์เหล่านี้ลิงก์ด้วยการสแกนคิวอาร์โค้ด</translation> <translation id="4994474651455208930">อนุญาตให้ไซต์แจ้งขอเป็นตัวจัดการเริ่มต้นสำหรับโปรโตคอล</translation> <translation id="4994754230098574403">กำลังตั้งค่า</translation> <translation id="4995131849631312693"><ph name="BEGIN_PARAGRAPH1" />ก่อนลงทะเบียน คุณต้องล้างข้อมูลใน TPM เพื่อให้ <ph name="DEVICE_OS" /> เข้าเป็นเจ้าของอุปกรณ์ได้<ph name="END_PARAGRAPH1" /> @@ -3984,6 +3992,7 @@ <translation id="5123433949759960244">บาสเกตบอล</translation> <translation id="5125751979347152379">URL ไม่ถูกต้อง</translation> <translation id="5126611267288187364">ดูการเปลี่ยนแปลง</translation> +<translation id="5127242257756472928">ไม่ได้รับอนุญาตให้ใช้ข้อมูลเกี่ยวกับหน้าจอเพื่อเปิดและวางหน้าต่าง</translation> <translation id="5127620150973591153">รหัสการเชื่อมต่อที่ปลอดภัย: <ph name="TOKEN" /></translation> <translation id="5127805178023152808">การซิงค์ปิดอยู่</translation> <translation id="5127881134400491887">จัดการการเชื่อมต่อเครือข่าย</translation> @@ -4096,6 +4105,7 @@ <translation id="5243522832766285132">โปรดลองอีกครั้งในอีกสักครู่</translation> <translation id="5244474230056479698">กำลังซิงค์กับ <ph name="EMAIL" /></translation> <translation id="5245610266855777041">เริ่มต้นใช้งานบัญชีโรงเรียน</translation> +<translation id="5246036036039717045">อุปกรณ์เหล่านี้ใช้เป็นคีย์ความปลอดภัยได้เนื่องจากคุณลงชื่อเข้าใช้ Chrome ในอุปกรณ์ดังกล่าว</translation> <translation id="5246282308050205996"><ph name="APP_NAME" /> ขัดข้อง คลิกที่บอลลูนนี้เพื่อรีสตาร์ตแอปพลิเคชันนี้</translation> <translation id="5247051749037287028">ชื่อที่แสดง (ไม่บังคับ)</translation> <translation id="5249624017678798539">เบราว์เซอร์ขัดข้องก่อนที่จะดาวน์โหลดเสร็จ</translation> @@ -4584,6 +4594,7 @@ <translation id="5757375109985023827">เลือกแท็บเพื่อแสดงตัวอย่าง</translation> <translation id="5758631781033351321">คุณจะเห็นเรื่องรออ่านที่นี่</translation> <translation id="5759728514498647443"><ph name="APP_NAME" /> สามารถอ่านเอกสารที่คุณส่งไปพิมพ์ผ่าน <ph name="APP_NAME" /> ได้</translation> +<translation id="5762787084360227629">ป้อนข้อมูลบัญชี Google</translation> <translation id="5763751966069581670">ไม่พบอุปกรณ์ USB</translation> <translation id="5764483294734785780">บั&นทึกวิดีโอเป็น...</translation> <translation id="57646104491463491">วันที่แก้ไข</translation> @@ -5729,6 +5740,7 @@ <translation id="6965382102122355670">ตกลง</translation> <translation id="6965648386495488594">พอร์ต</translation> <translation id="6965978654500191972">อุปกรณ์</translation> +<translation id="6966370001499648704">ควบคุมโทรศัพท์ที่คุณจะใช้เป็นคีย์ความปลอดภัย</translation> <translation id="6967430741871315905">ไม่สามารถตรวจสอบว่าอุปกรณ์ได้รับอนุญาตหรือไม่</translation> <translation id="696780070563539690">เว็บไซต์ใช้คุกกี้เพื่อดูกิจกรรมการท่องเว็บของคุณในเว็บไซต์ต่างๆ เช่น เพื่อปรับโฆษณาตามโปรไฟล์ของคุณไม่ได้</translation> <translation id="6968288415730398122">ป้อนรหัสผ่านเพื่อกำหนดค่าการล็อกหน้าจอ</translation> @@ -5903,6 +5915,7 @@ <translation id="7135729336746831607">เปิดบลูทูธไหม</translation> <translation id="7136694880210472378">ทำให้เป็นค่าเริ่มต้น</translation> <translation id="7136993520339022828">เกิดข้อผิดพลาด โปรดลองอีกครั้งโดยเลือกภาพอื่น</translation> +<translation id="7137472406312798422">เว็บไซต์สามารถขอใช้ข้อมูลเกี่ยวกับหน้าจอเพื่อเปิดและวางหน้าต่าง</translation> <translation id="7138515695467025690">ปิดอยู่ / จะเปิดโดยอัตโนมัติเมื่อพระอาทิตย์ตก</translation> <translation id="7138678301420049075">อื่นๆ</translation> <translation id="7139627972753429585"><ph name="APP_NAME" /> กำลังใช้ไมโครโฟน</translation> @@ -6788,6 +6801,7 @@ <translation id="8028803902702117856">กำลังดาวน์โหลด <ph name="SIZE" /> <ph name="FILE_NAME" /></translation> <translation id="8028993641010258682">ขนาด</translation> <translation id="8029492516535178472"><ph name="WINDOW_TITLE" /> - ขอสิทธิ์ กด ⌘ + Option + ลูกศรขึ้นเพื่อตอบกลับ</translation> +<translation id="8029539783236818164">ได้รับอนุญาตให้ใช้ข้อมูลเกี่ยวกับหน้าจอเพื่อเปิดและวางหน้าต่าง</translation> <translation id="8030169304546394654">ยกเลิกการเชื่อมต่อแล้ว</translation> <translation id="8030852056903932865">อนุญาต</translation> <translation id="8032244173881942855">ไม่สามารถแคสต์แท็บ</translation> @@ -6800,6 +6814,7 @@ <translation id="8038399858950372766">อุปกรณ์ที่ <ph name="DEVICE_INDEX" /> จาก <ph name="DEVICE_COUNT" />, แป้นพิมพ์ชื่อ <ph name="DEVICE_NAME" /></translation> <translation id="8041089156583427627">ส่งความคิดเห็น</translation> <translation id="8042142357103597104">ความทึบแสงของข้อความ</translation> +<translation id="8042331986490021244">ระบบจะเข้ารหัสให้กับรหัสผ่านในอุปกรณ์ก่อนบันทึกลงในเครื่องมือจัดการรหัสผ่านของ Google</translation> <translation id="8044262338717486897"><ph name="LINUX_APP_NAME" /> ไม่ตอบสนอง</translation> <translation id="8044899503464538266">ช้า</translation> <translation id="8045253504249021590">หยุดการซิงค์ผ่าน Google แดชบอร์ดแล้ว</translation> @@ -7557,6 +7572,7 @@ <translation id="8838234842677265403"><ph name="WEB_DRIVE_MESSAGE" /> (<ph name="SUPPORT_INFO" />)</translation> <translation id="8838601485495657486">ทึบ</translation> <translation id="8838770651474809439">แฮมเบอร์เกอร์</translation> +<translation id="8838778928843281408">จัดการโทรศัพท์</translation> <translation id="883911313571074303">ใส่หมายเหตุในรูปภาพ</translation> <translation id="8841843049738266382">อ่านและเปลี่ยนผู้ใช้ในรายการที่อนุญาต</translation> <translation id="8842594465773264717">ลบลายนิ้วมือนี้</translation>
diff --git a/chrome/app/resources/generated_resources_zh-CN.xtb b/chrome/app/resources/generated_resources_zh-CN.xtb index bd048b4..3c2d797 100644 --- a/chrome/app/resources/generated_resources_zh-CN.xtb +++ b/chrome/app/resources/generated_resources_zh-CN.xtb
@@ -5438,7 +5438,7 @@ <translation id="6655458902729017087">隐藏帐号</translation> <translation id="6657585470893396449">密码</translation> <translation id="6659213950629089752">此页面已由“<ph name="NAME" />”扩展程序缩放</translation> -<translation id="6659594942844771486">标签页</translation> +<translation id="6659594942844771486">Tab 键</translation> <translation id="666099631117081440">打印服务器</translation> <translation id="6662931079349804328">企业政策已更改。实验按钮已从工具栏移除。</translation> <translation id="6663190258859265334">对您的 <ph name="DEVICE_TYPE" /> 执行 Powerwash 操作,使其还原到先前的版本。</translation>
diff --git a/chrome/app/resources/generated_resources_zh-HK.xtb b/chrome/app/resources/generated_resources_zh-HK.xtb index feaf08f..2cf6cc3c 100644 --- a/chrome/app/resources/generated_resources_zh-HK.xtb +++ b/chrome/app/resources/generated_resources_zh-HK.xtb
@@ -1956,7 +1956,7 @@ <translation id="2939908794993783865">其他無效網站</translation> <translation id="2939938020978911855">顯示可用的藍牙裝置</translation> <translation id="2941112035454246133">低</translation> -<translation id="2941696810925320401">網站通常會開啟及放置視窗,以便在畫面上顯示其他文件或全螢幕內容</translation> +<translation id="2941696810925320401">網站通常會開啟及放置視窗,以便在螢幕上顯示其他文件或全螢幕內容</translation> <translation id="2942279350258725020">Android 訊息</translation> <translation id="2942560570858569904">正在等待…</translation> <translation id="2942581856830209953">自訂呢個頁面</translation> @@ -2109,7 +2109,7 @@ <translation id="3099836255427453137">{NUM_EXTENSIONS,plural, =1{已停用 1 個可能有害的擴充程式,但您可將之移除。}other{已停用 {NUM_EXTENSIONS} 個可能有害的擴充程式,但您可將之移除。}}</translation> <translation id="3101126716313987672">光線昏暗</translation> <translation id="3101709781009526431">日期和時間</translation> -<translation id="3103451787721578293">請提供上傳這項資料的原因:</translation> +<translation id="3103451787721578293">請提供上載這些資料的原因:</translation> <translation id="3103941660000130485">升級 Linux 時發生錯誤</translation> <translation id="3105796011181310544">要改回使用 Google 嗎?</translation> <translation id="310671807099593501">網站正在使用藍牙</translation> @@ -2635,7 +2635,7 @@ <translation id="3670113805793654926">來自任何供應商的裝置</translation> <translation id="3670229581627177274">開啟藍牙功能</translation> <translation id="3672681487849735243">系統偵測到原廠錯誤</translation> -<translation id="3673097791729989571">登入作業由 <ph name="SAML_DOMAIN" /> 代管</translation> +<translation id="3673097791729989571">登入由 <ph name="SAML_DOMAIN" /> 代管</translation> <translation id="367645871420407123">如果您想為預設測試影像值設定 Root 密碼,請留空</translation> <translation id="3677106374019847299">輸入自訂的供應商</translation> <translation id="3677911431265050325">切換至流動網站</translation> @@ -3418,7 +3418,7 @@ <translation id="4481467543947557978">Service Worker</translation> <translation id="4481530544597605423">未配對的裝置</translation> <translation id="4482990632723642375">最近閂咗嘅分頁</translation> -<translation id="4484922932728109422">不允許網站使用畫面中的資訊開啟及放置視窗</translation> +<translation id="4484922932728109422">不允許網站使用螢幕中的資料開啟及放置視窗</translation> <translation id="4487489714832036847">Chromebook 使用應用程式代替傳統軟件。下載各種應用程式,以提升生產力、享受娛樂體驗等等。</translation> <translation id="4488257340342212116">已允許使用您的攝錄機</translation> <translation id="4488502501195719518">要清除所有資料嗎?</translation> @@ -3502,7 +3502,7 @@ <translation id="4565917129334815774">儲存系統記錄</translation> <translation id="4566417217121906555">將麥克風設定為靜音</translation> <translation id="456717285308019641">要翻譯的網頁語言</translation> -<translation id="4567512141633030272">登入選項有誤?</translation> +<translation id="4567512141633030272">登入選項有錯嗎?</translation> <translation id="4567533462991917415">您可在設定後隨時新增更多使用者。每位使用者都可將帳戶個人化,以確保資料私隱。</translation> <translation id="4567772783389002344">新增字詞</translation> <translation id="4568025708905928793">請提供安全密鑰</translation> @@ -3748,7 +3748,7 @@ <translation id="4841741146571978176">必要的虛擬機器不存在。如要繼續,請嘗試設定 <ph name="VM_TYPE" /></translation> <translation id="4842976633412754305">這個網頁正嘗試從未授權的來源載入指令碼。</translation> <translation id="4844333629810439236">其他鍵盤</translation> -<translation id="4844633725025837809">為進一步加強安全性,系統會先在裝置上將密碼加密,再儲存至 Google 密碼管理員</translation> +<translation id="4844633725025837809">為進一步增強安全性,請先在裝置上將密碼加密,然後才將密碼儲存至 Google 密碼管理工具</translation> <translation id="4846680374085650406">您目前所採用的是管理員的建議設定。</translation> <translation id="4847902821209177679">揀咗「<ph name="TOPIC_SOURCE" /> <ph name="TOPIC_SOURCE_DESC" />」,㩒一下 [Enter] 鍵就可以揀「<ph name="TOPIC_SOURCE" />」相簿</translation> <translation id="4848191975108266266">Google 助理及「Ok Google」</translation> @@ -3889,7 +3889,7 @@ <translation id="499165176004408815">使用高對比度模式</translation> <translation id="4992458225095111526">確認執行 Powerwash</translation> <translation id="4992473555164495036">您的管理員已限制可用的輸入方法。</translation> -<translation id="4992984395680162305">這些是透過掃描 QR 圖碼所連結的裝置</translation> +<translation id="4992984395680162305">這些是透過掃瞄 QR 碼所連結的裝置</translation> <translation id="4994474651455208930">允許網站要求成為通訊協定的預設處理常式</translation> <translation id="4994754230098574403">正在設定</translation> <translation id="4995131849631312693"><ph name="BEGIN_PARAGRAPH1" />在註冊裝置前,您需要清除 TPM,<ph name="DEVICE_OS" /> 才能取得裝置的擁有權。<ph name="END_PARAGRAPH1" /> @@ -4009,7 +4009,7 @@ <translation id="5123433949759960244">籃球</translation> <translation id="5125751979347152379">網址無效。</translation> <translation id="5126611267288187364">查看變更</translation> -<translation id="5127242257756472928">不允許使用畫面中的資訊開啟及放置視窗</translation> +<translation id="5127242257756472928">不允許使用螢幕中的資料開啟及放置視窗</translation> <translation id="5127620150973591153">安全連線 ID:<ph name="TOKEN" /></translation> <translation id="5127805178023152808">同步處理已停用</translation> <translation id="5127881134400491887">管理網絡連線</translation> @@ -4122,7 +4122,7 @@ <translation id="5243522832766285132">請稍後再試</translation> <translation id="5244474230056479698">正在同步至 <ph name="EMAIL" /></translation> <translation id="5245610266855777041">登入學校帳戶即可開始使用</translation> -<translation id="5246036036039717045">你已透過這些裝置登入 Chrome,因此這些裝置可以做為安全金鑰使用。</translation> +<translation id="5246036036039717045">由於您已在這些裝置上登入 Chrome,因此這些裝置可以用作安全密鑰。</translation> <translation id="5246282308050205996"><ph name="APP_NAME" /> 當機了,請按一下這個汽球來重新啟動應用程式。</translation> <translation id="5247051749037287028">顯示名稱 (選填)</translation> <translation id="5249624017678798539">瀏覽器在下載尚未完成時當機。</translation> @@ -4611,7 +4611,7 @@ <translation id="5757375109985023827">選取要預覽的分頁</translation> <translation id="5758631781033351321">您可在此查看閱讀清單</translation> <translation id="5759728514498647443">您透過「<ph name="APP_NAME" />」傳送列印的文件可使用「<ph name="APP_NAME" />」讀取。</translation> -<translation id="5762787084360227629">輸入 Google 帳戶資訊</translation> +<translation id="5762787084360227629">輸入 Google 帳戶資料</translation> <translation id="5763751966069581670">找不到 USB 裝置</translation> <translation id="5764483294734785780">另存音效檔案為(&V)…</translation> <translation id="57646104491463491">已修改日期</translation> @@ -5757,7 +5757,7 @@ <translation id="6965382102122355670">確定</translation> <translation id="6965648386495488594">連接埠</translation> <translation id="6965978654500191972">裝置</translation> -<translation id="6966370001499648704">控管要使用哪些手機做為安全金鑰</translation> +<translation id="6966370001499648704">控制要使用哪些手機作為安全密鑰</translation> <translation id="6967430741871315905">無法檢查裝置是否已獲准</translation> <translation id="696780070563539690">網站不可使用 Cookie 查看您在各網站的瀏覽活動,例如放送個人化廣告</translation> <translation id="6968288415730398122">如要設定螢幕鎖定功能,請輸入您的密碼</translation> @@ -5932,7 +5932,7 @@ <translation id="7135729336746831607">要開啟藍牙嗎?</translation> <translation id="7136694880210472378">設定為預設</translation> <translation id="7136993520339022828">發生錯誤。請選擇其他圖片並再試一次。</translation> -<translation id="7137472406312798422">網站可以要求使用畫面中的資訊開啟及放置視窗</translation> +<translation id="7137472406312798422">網站可要求使用螢幕中的資料開啟及放置視窗</translation> <translation id="7138515695467025690">關閉/將於日落時自動開啟</translation> <translation id="7138678301420049075">其他</translation> <translation id="7139627972753429585"><ph name="APP_NAME" /> 正在使用您的麥克風</translation> @@ -6820,7 +6820,7 @@ <translation id="8028803902702117856">下載緊 <ph name="FILE_NAME" />,檔案大小係 <ph name="SIZE" /></translation> <translation id="8028993641010258682">大小</translation> <translation id="8029492516535178472"><ph name="WINDOW_TITLE" /> - 要求咗權限,㩒 ⌘ + Option + 向上箭咀就可以回覆</translation> -<translation id="8029539783236818164">允許使用畫面中的資訊開啟及放置視窗</translation> +<translation id="8029539783236818164">允許使用螢幕中的資料開啟及放置視窗</translation> <translation id="8030169304546394654">已中斷連線</translation> <translation id="8030852056903932865">核准</translation> <translation id="8032244173881942855">無法投放分頁。</translation> @@ -6833,7 +6833,7 @@ <translation id="8038399858950372766">裝置 <ph name="DEVICE_INDEX" />,總共 <ph name="DEVICE_COUNT" /> 個,叫做 <ph name="DEVICE_NAME" /> 嘅鍵盤</translation> <translation id="8041089156583427627">提供意見</translation> <translation id="8042142357103597104">文字透明度</translation> -<translation id="8042331986490021244">系統會先在裝置上將密碼加密,再儲存至 Google 密碼管理員</translation> +<translation id="8042331986490021244">您的密碼會先在裝置上加密,然後才儲存至 Google 密碼管理工具</translation> <translation id="8044262338717486897"><ph name="LINUX_APP_NAME" /> 沒有回應。</translation> <translation id="8044899503464538266">慢</translation> <translation id="8045253504249021590">已透過「Google 資訊主頁」停用同步功能。</translation>
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp index 4c36ab3..b77c23a 100644 --- a/chrome/app/settings_strings.grdp +++ b/chrome/app/settings_strings.grdp
@@ -1460,7 +1460,7 @@ Features on some sites may not work </message> <message name="IDS_SETTINGS_PRIVACY_REVIEW_COOKIES_CARD_BLOCK_TPC_PRIVACY_DESCRIPTION1" desc="A part of the privacy description of the third party cookie blocking section of the cookies card in the privacy review."> - Sites can only use your cookies to see your browsing activity on their own site + Sites can only use cookies to see your browsing activity on their own site </message> <message name="IDS_SETTINGS_PRIVACY_REVIEW_SAFE_BROWSING_CARD_HEADER" desc="Header of the safe browsing card in the privacy review."> Choose your Safe Browsing protection
diff --git a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_REVIEW_COOKIES_CARD_BLOCK_TPC_PRIVACY_DESCRIPTION1.png.sha1 b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_REVIEW_COOKIES_CARD_BLOCK_TPC_PRIVACY_DESCRIPTION1.png.sha1 index 59edeb0f..1eba3f4 100644 --- a/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_REVIEW_COOKIES_CARD_BLOCK_TPC_PRIVACY_DESCRIPTION1.png.sha1 +++ b/chrome/app/settings_strings_grdp/IDS_SETTINGS_PRIVACY_REVIEW_COOKIES_CARD_BLOCK_TPC_PRIVACY_DESCRIPTION1.png.sha1
@@ -1 +1 @@ -e5f991fa224b96c83195d3d09e576949637eafbf \ No newline at end of file +78571143bfb1b30667e19c154cedcf83537d916b \ No newline at end of file
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn index 9e0fe7c6..3f5331e2 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn
@@ -2524,6 +2524,10 @@ "policy/system_features_disable_list_policy_handler.cc", "policy/system_features_disable_list_policy_handler.h", ] + deps += [ + "//chrome/browser/policy:onc", + "//chromeos/components/onc:onc", + ] } if (is_linux || is_chromeos) { deps += [ "//chrome/browser/error_reporting" ] @@ -4995,7 +4999,6 @@ allow_circular_includes_from += [ "//chrome/browser/ash/crosapi", "//chrome/browser/chromeos", - "//chrome/browser/policy:onc", ] if (target_cpu == "x64") { @@ -5309,6 +5312,7 @@ "//chromeos/dbus/constants", "//chromeos/ui/wm", ] + allow_circular_includes_from += [ "//chrome/browser/policy:onc" ] } if (is_win) {
diff --git a/chrome/browser/android/compositor/layer/tab_layer.cc b/chrome/browser/android/compositor/layer/tab_layer.cc index e48d179..8eadc90d 100644 --- a/chrome/browser/android/compositor/layer/tab_layer.cc +++ b/chrome/browser/android/compositor/layer/tab_layer.cc
@@ -12,7 +12,6 @@ #include "cc/layers/layer_collections.h" #include "cc/layers/nine_patch_layer.h" #include "cc/layers/solid_color_layer.h" -#include "cc/layers/ui_resource_layer.h" #include "cc/resources/scoped_ui_resource.h" #include "chrome/browser/android/compositor/layer/content_layer.h" #include "chrome/browser/android/compositor/layer/tabgroup_content_layer.h" @@ -94,15 +93,11 @@ const std::vector<int>& ids, bool can_use_live_layer, int toolbar_resource_id, - int unused_close_button_resource_id, int shadow_resource_id, int contour_resource_id, - int back_logo_resource_id, int border_resource_id, int border_inner_shadow_resource_id, int default_background_color, - int back_logo_color, - bool unused_close_button_on_right, float x, float y, float width, @@ -111,21 +106,14 @@ float shadow_y, float shadow_width, float shadow_height, - float pivot_x, - float pivot_y, - float rotation_x, - float rotation_y, float alpha, float border_alpha, float border_inner_shadow_alpha, float contour_alpha, float shadow_alpha, - float unused_close_alpha, float border_scale, float saturation, float brightness, - float close_btn_width, - float close_btn_asset_size, float static_to_view_blend, float content_width, float content_height, @@ -133,9 +121,7 @@ bool show_toolbar, int default_theme_color, int toolbar_background_color, - int unused_close_button_color, bool anonymize_toolbar, - bool show_tab_title, int toolbar_textbox_resource_id, int toolbar_textbox_background_color, float toolbar_alpha, @@ -163,7 +149,6 @@ ui::NinePatchResource* contour_resource = ui::NinePatchResource::From(resource_manager_->GetResource( ui::ANDROID_RESOURCE_TYPE_STATIC, contour_resource_id)); - ui::Resource* back_logo_resource = nullptr; //---------------------------------------------------------------------------- // Handle Border Scaling (Upscale/Downscale everything until final scaling) @@ -184,9 +169,6 @@ const gfx::RectF shadow_padding(shadow_resource->padding()); const gfx::RectF contour_padding(contour_resource->padding()); - const bool back_visible = cos(rotation_x * SK_ScalarPI / 180.0f) < 0 || - cos(rotation_y * SK_ScalarPI / 180.0f) < 0; - const float content_scale = width / content_width; gfx::RectF content_area(0.f, 0.f, content_width, content_height); gfx::RectF scaled_local_content_area(shadow_x, shadow_y, shadow_width, @@ -224,7 +206,7 @@ toolbar_layer_->UpdateProgressBar(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); float toolbar_impact_height = 0; - if (show_toolbar && !back_visible) + if (show_toolbar) toolbar_impact_height = content_offset; //---------------------------------------------------------------------------- @@ -235,11 +217,6 @@ shadow_alpha *= alpha; toolbar_alpha *= alpha; - if (back_visible) { - border_alpha = 0.f; - border_inner_shadow_alpha = 0.f; - } - bool border_visible = border_alpha > 0.f; bool border_inner_shadow_visible = border_inner_shadow_alpha > 0.f; bool contour_visible = border_alpha < contour_alpha && contour_alpha > 0.f; @@ -258,15 +235,6 @@ gfx::Size contour_size( width + contour_padding_size.width() * side_border_scale, height + contour_padding_size.height()); - gfx::Size back_logo_size; - // TODO(clholgat): Figure out why the back logo is null sometimes. - if (back_visible) { - back_logo_resource = - resource_manager_->GetResource(ui::ANDROID_RESOURCE_TYPE_STATIC, - back_logo_resource_id); - if (back_logo_resource) - back_logo_size = back_logo_resource->size(); - } // Store this size at a point as it might go negative during the inset // calculations. @@ -292,13 +260,6 @@ gfx::PointF toolbar_position( 0.f, toolbar_layer_->layer()->bounds().height() - toolbar_size.height()); gfx::PointF content_position(0.f, toolbar_impact_height); - gfx::PointF back_logo_position( - ((descaled_local_content_area.width() - back_logo_->bounds().width()) * - content_scale) / - 2.0f, - ((descaled_local_content_area.height() - back_logo_->bounds().height()) * - content_scale) / - 2.0f); //---------------------------------------------------------------------------- // Handle Insetting the Top Border Component @@ -346,7 +307,7 @@ bool content_visible = desired_content_size.GetArea() > 0.f; // TODO(dtrainor): Improve these calculations to prune these layers out. - bool toolbar_visible = show_toolbar && toolbar_alpha > 0.f && !back_visible; + bool toolbar_visible = show_toolbar && toolbar_alpha > 0.f; //---------------------------------------------------------------------------- // Fix jaggies @@ -385,25 +346,17 @@ front_border_inner_shadow_->SetBorder(border_inner_shadow_resource->Border( border_inner_shadow_size)); - side_padding_->SetBackgroundColor(back_visible ? back_logo_color - : default_background_color); - bottom_padding_->SetBackgroundColor(back_visible ? back_logo_color - : default_background_color); + side_padding_->SetBackgroundColor(default_background_color); + bottom_padding_->SetBackgroundColor(default_background_color); - if (!back_visible) { - gfx::Rect rounded_descaled_content_area( - base::ClampRound(descaled_local_content_area.x()), - base::ClampRound(descaled_local_content_area.y()), - desired_content_size.width(), desired_content_size.height()); + gfx::Rect rounded_descaled_content_area( + base::ClampRound(descaled_local_content_area.x()), + base::ClampRound(descaled_local_content_area.y()), + desired_content_size.width(), desired_content_size.height()); - SetContentProperties( - id, ids, can_use_live_layer, static_to_view_blend, true, alpha, - saturation, true, rounded_descaled_content_area, - border_inner_shadow_resource, border_inner_shadow_alpha); - - } else if (back_logo_resource) { - back_logo_->SetUIResourceId(back_logo_resource->ui_resource()->id()); - } + SetContentProperties(id, ids, can_use_live_layer, static_to_view_blend, true, + alpha, saturation, true, rounded_descaled_content_area, + border_inner_shadow_resource, border_inner_shadow_alpha); //---------------------------------------------------------------------------- // Push Size, Position, Alpha and Transformations to Layers @@ -455,34 +408,20 @@ if (content_visible) { { - // content_ and back_logo_ Transforms gfx::Transform transform; transform.Scale(content_scale, content_scale); transform.Translate(content_position.x(), content_position.y()); transform.Translate(descaled_local_content_area.x(), descaled_local_content_area.y()); - content_->layer()->SetHideLayerAndSubtree(back_visible); - back_logo_->SetHideLayerAndSubtree(!back_visible); - - if (!back_visible) { - content_->layer()->SetTransformOrigin(gfx::Point3F(0.f, 0.f, 0.f)); - content_->layer()->SetTransform(transform); - } else { - back_logo_->SetPosition(back_logo_position); - back_logo_->SetBounds(back_logo_size); - back_logo_->SetTransformOrigin(gfx::Point3F(0.f, 0.f, 0.f)); - back_logo_->SetTransform(transform); - // TODO: Set back logo alpha on leaf. - } + content_->layer()->SetHideLayerAndSubtree(false); + content_->layer()->SetTransformOrigin(gfx::Point3F(0.f, 0.f, 0.f)); + content_->layer()->SetTransform(transform); } { // padding_ Transform - gfx::Size content_bounds; - if (!back_visible) - content_bounds = content_->ComputeSize(id); - + gfx::Size content_bounds = content_->ComputeSize(id); gfx::Rect side_padding_rect; gfx::Rect bottom_padding_rect; if (content_bounds.width() == 0 || content_bounds.height() == 0) { @@ -500,7 +439,6 @@ alpha, content_position, descaled_local_content_area); } } else { - back_logo_->SetHideLayerAndSubtree(true); side_padding_->SetHideLayerAndSubtree(true); bottom_padding_->SetHideLayerAndSubtree(true); content_->layer()->SetHideLayerAndSubtree(true); @@ -508,29 +446,10 @@ { // Global Transform - gfx::PointF pivot_origin(pivot_y, pivot_x); gfx::Transform transform; - - if (rotation_x != 0 || rotation_y != 0) { - // Apply screen perspective if there are rotations. - transform.Translate(content_width / 2, content_height / 2); - transform.ApplyPerspectiveDepth( - content_width > content_height ? content_width : content_height); - transform.Translate(-content_width / 2, -content_height / 2); - - // Translate to correct position on the screen - transform.Translate(x, y); - - // Apply pivot rotations - transform.Translate(pivot_origin.x(), pivot_origin.y()); - transform.RotateAboutYAxis(rotation_y); - transform.RotateAboutXAxis(-rotation_x); - transform.Translate(-pivot_origin.x(), -pivot_origin.y()); - } else { - // Translate to correct position on the screen - transform.Translate(x, y); - } + // Translate to correct position on the screen + transform.Translate(x, y); transform.Scale(border_scale, border_scale); layer_->SetTransform(transform); } @@ -565,14 +484,12 @@ front_border_inner_shadow_(cc::NinePatchLayer::Create()), contour_shadow_(cc::NinePatchLayer::Create()), shadow_(cc::NinePatchLayer::Create()), - back_logo_(cc::UIResourceLayer::Create()), brightness_(1.f) { layer_->AddChild(shadow_); layer_->AddChild(contour_shadow_); layer_->AddChild(side_padding_); layer_->AddChild(bottom_padding_); layer_->AddChild(content_->layer()); - layer_->AddChild(back_logo_); layer_->AddChild(front_border_inner_shadow_); layer_->AddChild(front_border_); layer_->AddChild(toolbar_layer_->layer()); @@ -583,7 +500,6 @@ front_border_->SetIsDrawable(true); front_border_inner_shadow_->SetIsDrawable(true); shadow_->SetIsDrawable(true); - back_logo_->SetIsDrawable(true); front_border_->SetFillCenter(false); }
diff --git a/chrome/browser/android/compositor/layer/tab_layer.h b/chrome/browser/android/compositor/layer/tab_layer.h index 996cbc2..9f158c59 100644 --- a/chrome/browser/android/compositor/layer/tab_layer.h +++ b/chrome/browser/android/compositor/layer/tab_layer.h
@@ -16,7 +16,6 @@ class Layer; class NinePatchLayer; class SolidColorLayer; -class UIResourceLayer; } namespace gfx { @@ -50,15 +49,11 @@ const std::vector<int>& ids, bool can_use_live_layer, int toolbar_resource_id, - int close_button_resource_id, int shadow_resource_id, int contour_resource_id, - int back_logo_resource_id, int border_resource_id, int border_inner_shadow_resource_id, int default_background_color, - int back_logo_color, - bool is_portrait, float x, float y, float width, @@ -67,21 +62,14 @@ float shadow_y, float shadow_width, float shadow_height, - float pivot_x, - float pivot_y, - float rotation_x, - float rotation_y, float alpha, float border_alpha, float border_inner_shadow_alpha, float contour_alpha, float shadow_alpha, - float close_alpha, float border_scale, float saturation, float brightness, - float close_btn_width, - float close_btn_asset_size, float static_to_view_blend, float content_width, float content_height, @@ -89,9 +77,7 @@ bool show_toolbar, int default_theme_color, int toolbar_background_color, - int close_button_color, bool anonymize_toolbar, - bool show_tab_title, int toolbar_textbox_resource_id, int toolbar_textbox_background_color, float toolbar_alpha, @@ -135,12 +121,9 @@ // [layer]-+-[toolbar] // +-[front border] // +-[content] - // +-[back_logo] // +-[padding] // +-[contour_shadow] // +-[shadow] - // - // [back logo] scoped_refptr<cc::Layer> layer_; scoped_refptr<ToolbarLayer> toolbar_layer_; scoped_refptr<ContentLayer> content_; @@ -153,7 +136,6 @@ scoped_refptr<cc::NinePatchLayer> contour_shadow_; scoped_refptr<cc::NinePatchLayer> shadow_; - scoped_refptr<cc::UIResourceLayer> back_logo_; float brightness_; };
diff --git a/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc b/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc index 05f269f..6ccae83d 100644 --- a/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc +++ b/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.cc
@@ -75,17 +75,13 @@ const base::android::JavaRef<jintArray>& tab_ids_list, jboolean use_tab_ids_list, jint toolbar_resource_id, - jint close_button_resource_id, jint shadow_resource_id, jint contour_resource_id, - jint back_logo_resource_id, jint border_resource_id, jint border_inner_shadow_resource_id, jboolean can_use_live_layer, jint tab_background_color, - jint back_logo_color, jboolean incognito, - jboolean close_button_on_right, jfloat x, jfloat y, jfloat width, @@ -96,18 +92,11 @@ jfloat shadow_y, jfloat shadow_width, jfloat shadow_height, - jfloat pivot_x, - jfloat pivot_y, - jfloat rotation_x, - jfloat rotation_y, jfloat alpha, jfloat border_alpha, jfloat border_inner_shadow_alpha, jfloat contour_alpha, jfloat shadow_alpha, - jfloat close_alpha, - jfloat close_btn_width, - jfloat close_btn_asset_size, jfloat static_to_view_blend, jfloat border_scale, jfloat saturation, @@ -115,9 +104,7 @@ jboolean show_toolbar, jint default_theme_color, jint toolbar_background_color, - jint close_button_color, jboolean anonymize_toolbar, - jboolean show_tab_title, jint toolbar_textbox_resource_id, jint toolbar_textbox_background_color, jfloat toolbar_alpha, @@ -152,19 +139,16 @@ // used to indicate the currently selected tab for the TabLayer. layer->SetProperties( id, tab_ids, can_use_live_layer, toolbar_resource_id, - close_button_resource_id, shadow_resource_id, contour_resource_id, - back_logo_resource_id, border_resource_id, - border_inner_shadow_resource_id, tab_background_color, back_logo_color, - close_button_on_right, x, y, width, height, shadow_x, shadow_y, - shadow_width, shadow_height, pivot_x, pivot_y, rotation_x, rotation_y, - alpha, border_alpha, border_inner_shadow_alpha, contour_alpha, - shadow_alpha, close_alpha, border_scale, saturation, brightness, - close_btn_width, close_btn_asset_size, static_to_view_blend, + shadow_resource_id, contour_resource_id, border_resource_id, + border_inner_shadow_resource_id, tab_background_color, x, y, width, + height, shadow_x, shadow_y, shadow_width, shadow_height, alpha, + border_alpha, border_inner_shadow_alpha, contour_alpha, shadow_alpha, + border_scale, saturation, brightness, static_to_view_blend, content_width, content_height, content_width, show_toolbar, - default_theme_color, toolbar_background_color, close_button_color, - anonymize_toolbar, show_tab_title, toolbar_textbox_resource_id, - toolbar_textbox_background_color, toolbar_alpha, toolbar_y_offset, - content_offset, side_border_scale, inset_border); + default_theme_color, toolbar_background_color, anonymize_toolbar, + toolbar_textbox_resource_id, toolbar_textbox_background_color, + toolbar_alpha, toolbar_y_offset, content_offset, side_border_scale, + inset_border); } gfx::RectF self(own_tree_->position(), gfx::SizeF(own_tree_->bounds()));
diff --git a/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.h b/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.h index 59f74929..f998ad3 100644 --- a/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.h +++ b/chrome/browser/android/compositor/scene_layer/tab_list_scene_layer.h
@@ -55,17 +55,13 @@ const base::android::JavaRef<jintArray>& tab_ids_list, jboolean use_tab_ids_list, jint toolbar_resource_id, - jint close_button_resource_id, jint shadow_resource_id, jint contour_resource_id, - jint back_logo_resource_id, jint border_resource_id, jint border_inner_shadow_resource_id, jboolean can_use_live_layer, jint tab_background_color, - jint back_logo_color, jboolean incognito, - jboolean close_button_on_right, jfloat x, jfloat y, jfloat width, @@ -76,18 +72,11 @@ jfloat shadow_y, jfloat shadow_width, jfloat shadow_height, - jfloat pivot_x, - jfloat pivot_y, - jfloat rotation_x, - jfloat rotation_y, jfloat alpha, jfloat border_alpha, jfloat border_inner_shadow_alpha, jfloat contour_alpha, jfloat shadow_alpha, - jfloat close_alpha, - jfloat close_btn_width, - jfloat close_btn_asset_size, jfloat static_to_view_blend, jfloat border_scale, jfloat saturation, @@ -95,9 +84,7 @@ jboolean show_toolbar, jint default_theme_color, jint toolbar_background_color, - jint close_button_color, jboolean anonymize_toolbar, - jboolean show_tab_title, jint toolbar_textbox_resource_id, jint toolbar_textbox_background_color, jfloat toolbar_alpha,
diff --git a/chrome/browser/ash/account_manager/account_apps_availability.cc b/chrome/browser/ash/account_manager/account_apps_availability.cc index 3339d1b..1248190 100644 --- a/chrome/browser/ash/account_manager/account_apps_availability.cc +++ b/chrome/browser/ash/account_manager/account_apps_availability.cc
@@ -149,8 +149,8 @@ void RemoveAccountFromPrefs(PrefService* prefs, const std::string& gaia_id) { DCHECK(!IsPrimaryGaiaAccount(gaia_id)); - DictionaryPrefUpdateDeprecated update( - prefs, account_manager::prefs::kAccountAppsAvailability); + DictionaryPrefUpdate update(prefs, + account_manager::prefs::kAccountAppsAvailability); const bool success = update->RemoveKey(gaia_id); DCHECK(success); } @@ -165,16 +165,16 @@ account_entry.SetKey(account_manager::prefs::kIsAvailableInArcKey, base::Value(is_available_in_arc)); - DictionaryPrefUpdateDeprecated update( - prefs, account_manager::prefs::kAccountAppsAvailability); + DictionaryPrefUpdate update(prefs, + account_manager::prefs::kAccountAppsAvailability); update->SetKey(gaia_id, std::move(account_entry)); } void UpdateAccountInPrefs(PrefService* prefs, const std::string& gaia_id, bool is_available_in_arc) { - DictionaryPrefUpdateDeprecated update( - prefs, account_manager::prefs::kAccountAppsAvailability); + DictionaryPrefUpdate update(prefs, + account_manager::prefs::kAccountAppsAvailability); base::Value* account_entry = update->FindDictKey(gaia_id); DCHECK(account_entry); @@ -376,8 +376,8 @@ prefs_->Set(account_manager::prefs::kAccountAppsAvailability, base::Value(base::Value::Type::DICTIONARY)); - DictionaryPrefUpdateDeprecated update( - prefs_, account_manager::prefs::kAccountAppsAvailability); + DictionaryPrefUpdate update(prefs_, + account_manager::prefs::kAccountAppsAvailability); DCHECK(update->DictEmpty()); // See structure of `update` dictionary at the top of the file.
diff --git a/chrome/browser/ash/app_mode/startup_app_launcher.cc b/chrome/browser/ash/app_mode/startup_app_launcher.cc index a25cd90..ba9c71e4 100644 --- a/chrome/browser/ash/app_mode/startup_app_launcher.cc +++ b/chrome/browser/ash/app_mode/startup_app_launcher.cc
@@ -61,7 +61,7 @@ } StartupAppLauncher::~StartupAppLauncher() { - if (waiting_for_window_) + if (state_ == LaunchState::kWaitingForWindow) window_registry_->RemoveObserver(this); } @@ -71,14 +71,13 @@ void StartupAppLauncher::ContinueWithNetworkReady() { SYSLOG(INFO) << "ContinueWithNetworkReady" - << ", network_ready_handled_=" << network_ready_handled_ - << ", ready_to_launch_=" << ready_to_launch_; + << ", state_=" + << static_cast<typename std::underlying_type<LaunchState>::type>( + state_); - if (ready_to_launch_ || network_ready_handled_) + if (state_ != LaunchState::kInitializingNetwork) return; - network_ready_handled_ = true; - if (delegate_->ShouldSkipAppInstallation()) { FinalizeAppInstall(); return; @@ -87,7 +86,7 @@ // The network might not be ready when KioskAppManager tries to update // external cache initially. Update the external cache now that the network // is ready for sure. - wait_for_crx_update_ = true; + state_ = LaunchState::kWaitingForCache; KioskAppManager::Get()->UpdateExternalCache(); } @@ -95,7 +94,7 @@ // Do not allow restarts after the launcher finishes kiosk apps installation - // notify the delegate that kiosk app is ready to launch, in case the launch // was delayed, for example by network config dialog. - if (ready_to_launch_) { + if (state_ == LaunchState::kReadyToLaunch) { delegate_->OnAppPrepared(); return; } @@ -115,9 +114,9 @@ } void StartupAppLauncher::MaybeInitializeNetwork() { - DCHECK(!ready_to_launch_); - - network_ready_handled_ = false; + DCHECK(state_ != LaunchState::kReadyToLaunch && + state_ != LaunchState::kWaitingForWindow && + state_ != LaunchState::kLaunchSucceeded); const Extension* extension = GetPrimaryAppExtension(); bool crx_cached = KioskAppManager::Get()->HasCachedCrx(app_id_); @@ -130,6 +129,8 @@ << ", requires_network=" << requires_network << ", network_ready=" << delegate_->IsNetworkReady(); + state_ = LaunchState::kInitializingNetwork; + if (requires_network) { delegate_->InitializeNetwork(); return; @@ -160,13 +161,12 @@ void StartupAppLauncher::OnKioskAppDataLoadStatusChanged( const std::string& app_id) { - if (ready_to_launch_) + if (state_ != LaunchState::kWaitingForCache) return; - if (app_id != app_id_ || !wait_for_crx_update_) + if (app_id != app_id_) return; - wait_for_crx_update_ = false; if (KioskAppManager::Get()->HasCachedCrx(app_id_)) BeginInstall(); else @@ -180,7 +180,7 @@ } void StartupAppLauncher::LaunchApp() { - if (!ready_to_launch_) { + if (state_ != LaunchState::kReadyToLaunch) { NOTREACHED(); SYSLOG(ERROR) << "LaunchApp() called but launcher is not initialized."; } @@ -210,21 +210,22 @@ void StartupAppLauncher::OnLaunchSuccess() { delegate_->OnAppLaunched(); + state_ = LaunchState::kWaitingForWindow; window_registry_ = extensions::AppWindowRegistry::Get(profile_); // Start waiting for app window. if (!window_registry_->GetAppWindowsForApp(app_id_).empty()) { delegate_->OnAppWindowCreated(); + state_ = LaunchState::kLaunchSucceeded; return; } else { - waiting_for_window_ = true; window_registry_->AddObserver(this); } } void StartupAppLauncher::OnAppWindowAdded(extensions::AppWindow* app_window) { if (app_window->extension_id() == app_id_) { - waiting_for_window_ = false; + state_ = LaunchState::kLaunchSucceeded; window_registry_->RemoveObserver(this); delegate_->OnAppWindowCreated(); } @@ -242,6 +243,7 @@ } void StartupAppLauncher::BeginInstall(bool finalize_only) { + state_ = LaunchState::kInstallingApp; if (!finalize_only) { delegate_->OnAppInstalling(); } @@ -253,9 +255,11 @@ void StartupAppLauncher::OnInstallComplete( ChromeAppKioskAppInstaller::InstallResult result) { + DCHECK(state_ == LaunchState::kInstallingApp); + switch (result) { case ChromeAppKioskAppInstaller::InstallResult::kSuccess: - ready_to_launch_ = true; + state_ = LaunchState::kReadyToLaunch; // Updates to cached primary app crx will be ignored after this point, so // there is no need to observe the kiosk app manager any longer. kiosk_app_manager_observation_.Reset();
diff --git a/chrome/browser/ash/app_mode/startup_app_launcher.h b/chrome/browser/ash/app_mode/startup_app_launcher.h index 3241131..27556457 100644 --- a/chrome/browser/ash/app_mode/startup_app_launcher.h +++ b/chrome/browser/ash/app_mode/startup_app_launcher.h
@@ -45,6 +45,18 @@ // Class used to watch for app window creation. class AppWindowWatcher; + // Launch state of the kiosk application + enum class LaunchState { + kNotStarted, + kInitializingNetwork, + kWaitingForCache, + kInstallingApp, + kReadyToLaunch, + kWaitingForWindow, + kLaunchSucceeded, + kLaunchFailed + }; + // KioskAppLauncher: void Initialize() override; void ContinueWithNetworkReady() override; @@ -72,11 +84,8 @@ Profile* const profile_; const std::string app_id_; - bool network_ready_handled_ = false; int launch_attempt_ = 0; - bool wait_for_crx_update_ = false; - bool waiting_for_window_ = false; - bool ready_to_launch_ = false; + LaunchState state_ = LaunchState::kNotStarted; std::unique_ptr<ChromeAppKioskAppInstaller> installer_;
diff --git a/chrome/browser/ash/arc/auth/arc_auth_service.cc b/chrome/browser/ash/arc/auth/arc_auth_service.cc index 2ad6f88e..f87754c 100644 --- a/chrome/browser/ash/arc/auth/arc_auth_service.cc +++ b/chrome/browser/ash/arc/auth/arc_auth_service.cc
@@ -567,8 +567,19 @@ DCHECK(ash::AccountAppsAvailability::IsArcAccountRestrictionsEnabled()); DCHECK(ash::IsAccountManagerAvailable(profile_)); - UpsertAccountToArc(identity_manager_->FindExtendedAccountInfoByEmailAddress( - account.raw_email)); + CoreAccountInfo account_info = + identity_manager_->FindExtendedAccountInfoByEmailAddress( + account.raw_email); + // If account doesn't have a refresh token, `account_info` will be empty. In + // this case `OnAccountAvailableInArc` will be called again after the refresh + // token is loaded. + if (account_info.IsEmpty()) { + VLOG(1) << "Ignoring account update because CoreAccountInfo is empty for " + "account: " + << account.raw_email; + return; + } + UpsertAccountToArc(account_info); } void ArcAuthService::OnAccountUnavailableInArc(
diff --git a/chrome/browser/ash/login/arc_terms_of_service_browsertest.cc b/chrome/browser/ash/login/arc_terms_of_service_browsertest.cc index 6a41701..df4e0c7 100644 --- a/chrome/browser/ash/login/arc_terms_of_service_browsertest.cc +++ b/chrome/browser/ash/login/arc_terms_of_service_browsertest.cc
@@ -6,6 +6,7 @@ #include "ash/components/arc/arc_prefs.h" #include "ash/components/arc/arc_util.h" +#include "ash/constants/ash_features.h" #include "ash/constants/ash_switches.h" #include "ash/public/cpp/login_screen_test_api.h" #include "base/callback_helpers.h" @@ -14,6 +15,7 @@ #include "base/memory/ptr_util.h" #include "base/strings/strcat.h" #include "base/strings/stringprintf.h" +#include "base/test/scoped_feature_list.h" #include "chrome/browser/ash/arc/arc_util.h" #include "chrome/browser/ash/arc/session/arc_service_launcher.h" #include "chrome/browser/ash/login/existing_user_controller.h" @@ -142,7 +144,11 @@ class ArcTermsOfServiceScreenTest : public OobeBaseTest { public: - ArcTermsOfServiceScreenTest() = default; + ArcTermsOfServiceScreenTest() { + // ARC ToS screen is not shown when OobeConsolidatedConsent is enabled, and + // its content is moved to the consolidated consent screen. + feature_list_.InitAndDisableFeature(features::kOobeConsolidatedConsent); + } ArcTermsOfServiceScreenTest(const ArcTermsOfServiceScreenTest&) = delete; ArcTermsOfServiceScreenTest& operator=(const ArcTermsOfServiceScreenTest&) = @@ -293,6 +299,7 @@ bool serve_tos_with_privacy_policy_footer_ = false; + base::test::ScopedFeatureList feature_list_; absl::optional<ArcTermsOfServiceScreen::Result> screen_exit_result_; ArcTermsOfServiceScreen::ScreenExitCallback original_callback_; base::OnceClosure on_screen_exit_called_ = base::DoNothing();
diff --git a/chrome/browser/ash/login/eula_browsertest.cc b/chrome/browser/ash/login/eula_browsertest.cc index 356fd3d8..47cd16b 100644 --- a/chrome/browser/ash/login/eula_browsertest.cc +++ b/chrome/browser/ash/login/eula_browsertest.cc
@@ -7,6 +7,7 @@ #include <string> #include <utility> +#include "ash/constants/ash_features.h" #include "base/bind.h" #include "base/callback.h" #include "base/run_loop.h" @@ -15,6 +16,7 @@ #include "base/task/post_task.h" #include "base/test/bind.h" #include "base/test/metrics/histogram_tester.h" +#include "base/test/scoped_feature_list.h" #include "build/build_config.h" #include "chrome/browser/ash/login/test/dialog_window_waiter.h" #include "chrome/browser/ash/login/test/fake_eula_mixin.h" @@ -62,7 +64,11 @@ class EulaTest : public OobeBaseTest { public: - EulaTest() = default; + EulaTest() { + // EULA screen is not shown when OobeConsolidatedConsent is enabled, and + // its content is moved to the consolidated consent screen. + feature_list_.InitAndDisableFeature(features::kOobeConsolidatedConsent); + } EulaTest(const EulaTest&) = delete; EulaTest& operator=(const EulaTest&) = delete; @@ -124,6 +130,7 @@ return consented; } + base::test::ScopedFeatureList feature_list_; FakeEulaMixin fake_eula_{&mixin_host_, embedded_test_server()}; };
diff --git a/chrome/browser/ash/login/existing_user_controller.cc b/chrome/browser/ash/login/existing_user_controller.cc index 783fc9a..323262a 100644 --- a/chrome/browser/ash/login/existing_user_controller.cc +++ b/chrome/browser/ash/login/existing_user_controller.cc
@@ -255,15 +255,17 @@ return GetLoginDisplayHost()->GetLoginDisplay(); } -void SetLoginExtensionApiLaunchExtensionIdPref(const AccountId& account_id, - const std::string extension_id) { +void SetLoginExtensionApiCanLockManagedGuestSessionPref( + const AccountId& account_id, + bool can_lock_managed_guest_session) { const user_manager::User* user = user_manager::UserManager::Get()->FindUser(account_id); DCHECK(user); Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); DCHECK(profile); PrefService* prefs = profile->GetPrefs(); - prefs->SetString(::prefs::kLoginExtensionApiLaunchExtensionId, extension_id); + prefs->SetBoolean(::prefs::kLoginExtensionApiCanLockManagedGuestSession, + can_lock_managed_guest_session); prefs->CommitPendingWrite(); } @@ -929,15 +931,15 @@ DeviceSettingsService::Get()->MarkWillEstablishConsumerOwnership(); } - if (user_context.IsLockableManagedGuestSession()) { + if (user_context.CanLockManagedGuestSession()) { CHECK(user_context.GetUserType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT); user_manager::User* user = user_manager::UserManager::Get()->FindUserAndModify( user_context.GetAccountId()); DCHECK(user); - user->AddProfileCreatedObserver(base::BindOnce( - &SetLoginExtensionApiLaunchExtensionIdPref, user_context.GetAccountId(), - user_context.GetManagedGuestSessionLaunchExtensionId())); + user->AddProfileCreatedObserver( + base::BindOnce(&SetLoginExtensionApiCanLockManagedGuestSessionPref, + user_context.GetAccountId(), true)); } UserSessionManager::StartSessionType start_session_type =
diff --git a/chrome/browser/ash/login/users/chrome_user_manager_impl.cc b/chrome/browser/ash/login/users/chrome_user_manager_impl.cc index f3d9641e..6695800 100644 --- a/chrome/browser/ash/login/users/chrome_user_manager_impl.cc +++ b/chrome/browser/ash/login/users/chrome_user_manager_impl.cc
@@ -253,7 +253,7 @@ bool PolicyHasWebTrustedAuthorityCertificate( policy::DeviceLocalAccountPolicyBroker* broker) { - return policy::UserNetworkConfigurationUpdater:: + return policy::UserNetworkConfigurationUpdaterAsh:: PolicyHasWebTrustedAuthorityCertificate( broker->core()->store()->policy_map()); } @@ -1183,12 +1183,11 @@ if (user->HasGaiaAccount()) GetUserImageManager(user->GetAccountId())->UserProfileCreated(); - // Allow managed guest session user to lock if - // `kLoginExtensionApiLaunchExtensionId` is set. + // Managed Guest Sessions can be lockable if launched via the chrome.login + // extension API. if (user->GetType() == user_manager::USER_TYPE_PUBLIC_ACCOUNT && - !profile->GetPrefs() - ->GetString(::prefs::kLoginExtensionApiLaunchExtensionId) - .empty()) { + profile->GetPrefs()->GetBoolean( + ::prefs::kLoginExtensionApiCanLockManagedGuestSession)) { user->set_can_lock(true); } }
diff --git a/chrome/browser/ash/login/wizard_controller.cc b/chrome/browser/ash/login/wizard_controller.cc index 068e65f5..96c0d40a 100644 --- a/chrome/browser/ash/login/wizard_controller.cc +++ b/chrome/browser/ash/login/wizard_controller.cc
@@ -325,10 +325,8 @@ screen_name[0] = std::toupper(screen_name[0]); std::string histogram_name_with_reason = "OOBE.StepCompletionTimeByExitReason." + screen_name + "." + exit_reason; - base::HistogramBase* histogram_with_reason = base::Histogram::FactoryTimeGet( - histogram_name_with_reason, base::Milliseconds(10), base::Minutes(10), - 100, base::HistogramBase::kUmaTargetedHistogramFlag); - histogram_with_reason->AddTime(step_time); + base::UmaHistogramCustomTimes(histogram_name_with_reason, step_time, + base::Milliseconds(10), base::Minutes(10), 100); } LoginDisplayHost* GetLoginDisplayHost() {
diff --git a/chrome/browser/ash/policy/core/browser_policy_connector_ash.cc b/chrome/browser/ash/policy/core/browser_policy_connector_ash.cc index b325188..12031ad 100644 --- a/chrome/browser/ash/policy/core/browser_policy_connector_ash.cc +++ b/chrome/browser/ash/policy/core/browser_policy_connector_ash.cc
@@ -244,13 +244,13 @@ SetTimezoneIfPolicyAvailable(); device_network_configuration_updater_ = - DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( + DeviceNetworkConfigurationUpdaterAsh::CreateForDevicePolicy( GetPolicyService(), chromeos::NetworkHandler::Get() ->managed_network_configuration_handler(), chromeos::NetworkHandler::Get()->network_device_handler(), ash::CrosSettings::Get(), - DeviceNetworkConfigurationUpdater::DeviceAssetIDFetcher()); + DeviceNetworkConfigurationUpdaterAsh::DeviceAssetIDFetcher()); // NetworkCertLoader may be not initialized in tests. if (chromeos::NetworkCertLoader::IsInitialized()) { chromeos::NetworkCertLoader::Get()->SetDevicePolicyCertificateProvider(
diff --git a/chrome/browser/ash/policy/core/browser_policy_connector_ash.h b/chrome/browser/ash/policy/core/browser_policy_connector_ash.h index 463f79a2..8cfd7ed 100644 --- a/chrome/browser/ash/policy/core/browser_policy_connector_ash.h +++ b/chrome/browser/ash/policy/core/browser_policy_connector_ash.h
@@ -48,7 +48,7 @@ class DeviceDockMacAddressHandler; class DeviceLocalAccountPolicyService; class DeviceNamePolicyHandler; -class DeviceNetworkConfigurationUpdater; +class DeviceNetworkConfigurationUpdaterAsh; class DeviceWiFiAllowedHandler; struct EnrollmentConfig; class MinimumVersionPolicyHandler; @@ -174,7 +174,7 @@ return minimum_version_policy_handler_.get(); } - DeviceNetworkConfigurationUpdater* GetDeviceNetworkConfigurationUpdater() + DeviceNetworkConfigurationUpdaterAsh* GetDeviceNetworkConfigurationUpdater() const { return device_network_configuration_updater_.get(); } @@ -316,7 +316,7 @@ // pointer to get to the ProxyPolicyProvider at SetUserPolicyDelegate(). ProxyPolicyProvider* global_user_cloud_policy_provider_ = nullptr; - std::unique_ptr<DeviceNetworkConfigurationUpdater> + std::unique_ptr<DeviceNetworkConfigurationUpdaterAsh> device_network_configuration_updater_; // The ConfigurationPolicyProviders created in the constructor are initially
diff --git a/chrome/browser/ash/policy/core/device_local_account_browsertest.cc b/chrome/browser/ash/policy/core/device_local_account_browsertest.cc index 184f8d3..2bd9f423 100644 --- a/chrome/browser/ash/policy/core/device_local_account_browsertest.cc +++ b/chrome/browser/ash/policy/core/device_local_account_browsertest.cc
@@ -2317,7 +2317,7 @@ } void WaitForCertificateUpdate() { - policy::DeviceNetworkConfigurationUpdater* updater = + policy::DeviceNetworkConfigurationUpdaterAsh* updater = g_browser_process->platform_part() ->browser_policy_connector_ash() ->GetDeviceNetworkConfigurationUpdater();
diff --git a/chrome/browser/ash/policy/networking/policy_certs_browsertest.cc b/chrome/browser/ash/policy/networking/policy_certs_browsertest.cc index 233901fb..51464f1 100644 --- a/chrome/browser/ash/policy/networking/policy_certs_browsertest.cc +++ b/chrome/browser/ash/policy/networking/policy_certs_browsertest.cc
@@ -275,7 +275,7 @@ void SetONCUserPolicy(Profile* profile, MockConfigurationPolicyProvider* mock_policy_provider, const std::string& onc_policy_data) { - UserNetworkConfigurationUpdater* user_network_configuration_updater = + NetworkConfigurationUpdater* user_network_configuration_updater = UserNetworkConfigurationUpdaterFactory::GetForBrowserContext(profile); WebTrustedCertsChangedObserver trust_roots_changed_observer;
diff --git a/chrome/browser/ash/policy/off_hours/device_off_hours_controller_unittest.cc b/chrome/browser/ash/policy/off_hours/device_off_hours_controller_unittest.cc index 46d32a5..7bf98b0 100644 --- a/chrome/browser/ash/policy/off_hours/device_off_hours_controller_unittest.cc +++ b/chrome/browser/ash/policy/off_hours/device_off_hours_controller_unittest.cc
@@ -40,7 +40,7 @@ constexpr base::TimeDelta kHour = base::Hours(1); constexpr base::TimeDelta kDay = base::Days(1); -const char kUtcTimezone[] = "UTC"; +const char kGmtTimezone[] = "GMT"; const int kDeviceAllowNewUsersPolicyTag = 3; const int kDeviceGuestModeEnabledPolicyTag = 8; @@ -96,6 +96,37 @@ } } +// Return number of weekday from 1 to 7 in |input_time|. +// (1 = Monday etc.) +int ExtractDayOfWeek(base::Time input_time) { + base::Time::Exploded exploded; + input_time.UTCExplode(&exploded); + int current_day_of_week = exploded.day_of_week; + if (current_day_of_week == 0) + current_day_of_week = 7; + return current_day_of_week; +} + +// Return next day of week. |day_of_week| and return value are from 1 to 7. +// (1 = Monday etc.) +int NextDayOfWeek(int day_of_week) { + return day_of_week % 7 + 1; +} + +// Add DeviceOffHours policy to |proto| with an interval that includes the +// current time (until tomorrow at 10am). +// That gives us at least 10 hours to test things that depend on OffHours being +// active. +void SetOffHoursNowInProto(em::ChromeDeviceSettingsProto* proto) { + const int current_day_of_week = ExtractDayOfWeek(base::Time::Now()); + SetOffHoursPolicyToProto( + proto, + OffHoursPolicy(kGmtTimezone, + {WeeklyTimeInterval( + WeeklyTime(current_day_of_week, 0, 0), + WeeklyTime(NextDayOfWeek(current_day_of_week), + base::Hours(10).InMilliseconds(), 0))})); +} } // namespace class DeviceOffHoursControllerSimpleTest : public ash::DeviceSettingsTestBase { @@ -118,8 +149,6 @@ device_settings_service_->SetDeviceOffHoursControllerForTesting( std::make_unique<policy::off_hours::DeviceOffHoursController>()); - device_off_hours_controller_ = - device_settings_service_->device_off_hours_controller(); } void TearDown() override { @@ -133,30 +162,21 @@ ReloadDeviceSettings(); } - // Return number of weekday from 1 to 7 in |input_time|. (1 = Monday etc.) - int ExtractDayOfWeek(base::Time input_time) { - base::Time::Exploded exploded; - input_time.UTCExplode(&exploded); - int current_day_of_week = exploded.day_of_week; - if (current_day_of_week == 0) - current_day_of_week = 7; - return current_day_of_week; + bool IsGuestModeEnabled() const { + DCHECK(device_settings_service_); + DCHECK(device_settings_service_->device_settings()); + return device_settings_service_->device_settings() + ->guest_mode_enabled() + .guest_mode_enabled(); } - // Return next day of week. |day_of_week| and return value are from 1 to 7. (1 - // = Monday etc.) - int NextDayOfWeek(int day_of_week) { return day_of_week % 7 + 1; } - chromeos::SystemClockClient::TestInterface* system_clock_client() { return chromeos::SystemClockClient::Get()->GetTestInterface(); } policy::off_hours::DeviceOffHoursController* device_off_hours_controller() { - return device_off_hours_controller_; + return device_settings_service_->device_off_hours_controller(); } - - // The object is owned by DeviceSettingsService class. - policy::off_hours::DeviceOffHoursController* device_off_hours_controller_; }; TEST_F(DeviceOffHoursControllerSimpleTest, CheckOffHoursUnset) { @@ -166,14 +186,10 @@ em::ChromeDeviceSettingsProto& proto(device_policy_->payload()); proto.mutable_guest_mode_enabled()->set_guest_mode_enabled(false); UpdateDeviceSettings(); - EXPECT_FALSE(device_settings_service_->device_settings() - ->guest_mode_enabled() - .guest_mode_enabled()); + EXPECT_FALSE(IsGuestModeEnabled()); RemoveOffHoursPolicyFromProto(&proto); UpdateDeviceSettings(); - EXPECT_FALSE(device_settings_service_->device_settings() - ->guest_mode_enabled() - .guest_mode_enabled()); + EXPECT_FALSE(IsGuestModeEnabled()); } TEST_F(DeviceOffHoursControllerSimpleTest, CheckOffHoursModeOff) { @@ -183,22 +199,18 @@ em::ChromeDeviceSettingsProto& proto(device_policy_->payload()); proto.mutable_guest_mode_enabled()->set_guest_mode_enabled(false); UpdateDeviceSettings(); - EXPECT_FALSE(device_settings_service_->device_settings() - ->guest_mode_enabled() - .guest_mode_enabled()); + EXPECT_FALSE(IsGuestModeEnabled()); int current_day_of_week = ExtractDayOfWeek(base::Time::Now()); SetOffHoursPolicyToProto( &proto, - OffHoursPolicy(kUtcTimezone, + OffHoursPolicy(kGmtTimezone, {WeeklyTimeInterval( WeeklyTime(NextDayOfWeek(current_day_of_week), base::Hours(10).InMilliseconds(), 0), WeeklyTime(NextDayOfWeek(current_day_of_week), base::Hours(15).InMilliseconds(), 0))})); UpdateDeviceSettings(); - EXPECT_FALSE(device_settings_service_->device_settings() - ->guest_mode_enabled() - .guest_mode_enabled()); + EXPECT_FALSE(IsGuestModeEnabled()); } TEST_F(DeviceOffHoursControllerSimpleTest, CheckOffHoursModeOn) { @@ -208,21 +220,10 @@ em::ChromeDeviceSettingsProto& proto(device_policy_->payload()); proto.mutable_guest_mode_enabled()->set_guest_mode_enabled(false); UpdateDeviceSettings(); - EXPECT_FALSE(device_settings_service_->device_settings() - ->guest_mode_enabled() - .guest_mode_enabled()); - int current_day_of_week = ExtractDayOfWeek(base::Time::Now()); - SetOffHoursPolicyToProto( - &proto, - OffHoursPolicy(kUtcTimezone, - {WeeklyTimeInterval( - WeeklyTime(current_day_of_week, 0, 0), - WeeklyTime(NextDayOfWeek(current_day_of_week), - base::Hours(10).InMilliseconds(), 0))})); + EXPECT_FALSE(IsGuestModeEnabled()); + SetOffHoursNowInProto(&proto); UpdateDeviceSettings(); - EXPECT_TRUE(device_settings_service_->device_settings() - ->guest_mode_enabled() - .guest_mode_enabled()); + EXPECT_TRUE(IsGuestModeEnabled()); } TEST_F(DeviceOffHoursControllerSimpleTest, @@ -231,14 +232,7 @@ em::ChromeDeviceSettingsProto& proto(device_policy_->payload()); proto.mutable_guest_mode_enabled()->set_guest_mode_enabled(false); UpdateDeviceSettings(); - int current_day_of_week = ExtractDayOfWeek(base::Time::Now()); - SetOffHoursPolicyToProto( - &proto, - OffHoursPolicy(kUtcTimezone, - {WeeklyTimeInterval( - WeeklyTime(current_day_of_week, 0, 0), - WeeklyTime(NextDayOfWeek(current_day_of_week), - base::Hours(10).InMilliseconds(), 0))})); + SetOffHoursNowInProto(&proto); UpdateDeviceSettings(); // Trust the time until response from SystemClock is received. EXPECT_TRUE(device_off_hours_controller()->is_off_hours_mode()); @@ -260,20 +254,10 @@ em::ChromeDeviceSettingsProto& proto(device_policy_->payload()); proto.mutable_guest_mode_enabled()->set_guest_mode_enabled(false); UpdateDeviceSettings(); - EXPECT_FALSE(device_settings_service_->device_settings() - ->guest_mode_enabled() - .guest_mode_enabled()); - int current_day_of_week = ExtractDayOfWeek(base::Time::Now()); - SetOffHoursPolicyToProto( - &proto, - OffHoursPolicy(kUtcTimezone, - {WeeklyTimeInterval( - WeeklyTime(current_day_of_week, 0, 0), - WeeklyTime(NextDayOfWeek(current_day_of_week), - base::Hours(10).InMilliseconds(), 0))})); - EXPECT_FALSE(device_settings_service_->device_settings() - ->guest_mode_enabled() - .guest_mode_enabled()); + EXPECT_FALSE(IsGuestModeEnabled()); + SetOffHoursNowInProto(&proto); + UpdateDeviceSettings(); + EXPECT_FALSE(IsGuestModeEnabled()); } TEST_F(DeviceOffHoursControllerSimpleTest, @@ -290,14 +274,7 @@ em::ChromeDeviceSettingsProto& proto(device_policy_->payload()); proto.mutable_guest_mode_enabled()->set_guest_mode_enabled(false); - int current_day_of_week = ExtractDayOfWeek(base::Time::Now()); - SetOffHoursPolicyToProto( - &proto, - OffHoursPolicy(kUtcTimezone, - {WeeklyTimeInterval( - WeeklyTime(current_day_of_week, 0, 0), - WeeklyTime(NextDayOfWeek(current_day_of_week), - base::Hours(10).InMilliseconds(), 0))})); + SetOffHoursNowInProto(&proto); UpdateDeviceSettings(); EXPECT_FALSE( @@ -364,7 +341,7 @@ em::ChromeDeviceSettingsProto& proto(device_policy_->payload()); SetOffHoursPolicyToProto( &proto, - OffHoursPolicy(kUtcTimezone, + OffHoursPolicy(kGmtTimezone, {WeeklyTimeInterval( WeeklyTime(current_day_of_week, base::Hours(14).InMilliseconds(), 0), @@ -381,11 +358,10 @@ TEST_F(DeviceOffHoursControllerFakeClockTest, CheckUnderSuspend) { system_clock_client()->SetServiceIsAvailable(true); int current_day_of_week = ExtractDayOfWeek(clock()->Now()); - LOG(ERROR) << "day " << current_day_of_week; em::ChromeDeviceSettingsProto& proto(device_policy_->payload()); SetOffHoursPolicyToProto( &proto, - OffHoursPolicy(kUtcTimezone, + OffHoursPolicy(kGmtTimezone, {WeeklyTimeInterval( WeeklyTime(NextDayOfWeek(current_day_of_week), 0, 0), WeeklyTime(NextDayOfWeek(current_day_of_week), @@ -420,54 +396,32 @@ is_off_hours_expected()); } +// This is an interval from 1am to 2am on Thursdays. +// We use Thursday, because 1970-01-01 was a Thursday and we use that date in +// |DeviceOffHoursControllerFakeClockTest|. +const auto kOffHoursInterval = + WeeklyTimeInterval(WeeklyTime(em::WeeklyTimeProto::THURSDAY, + base::Hours(1).InMilliseconds(), + 0), + WeeklyTime(em::WeeklyTimeProto::THURSDAY, + base::Hours(2).InMilliseconds(), + 0)); INSTANTIATE_TEST_SUITE_P( TestCases, DeviceOffHoursControllerUpdateTest, testing::Values( - std::make_tuple( - OffHoursPolicy( - kUtcTimezone, - {WeeklyTimeInterval(WeeklyTime(em::WeeklyTimeProto::THURSDAY, - base::Hours(1).InMilliseconds(), - 0), - WeeklyTime(em::WeeklyTimeProto::THURSDAY, - base::Hours(2).InMilliseconds(), - 0))}), - kHour, - true), - std::make_tuple( - OffHoursPolicy( - kUtcTimezone, - {WeeklyTimeInterval(WeeklyTime(em::WeeklyTimeProto::THURSDAY, - base::Hours(1).InMilliseconds(), - 0), - WeeklyTime(em::WeeklyTimeProto::THURSDAY, - base::Hours(2).InMilliseconds(), - 0))}), - kHour * 2, - false), - std::make_tuple( - OffHoursPolicy( - kUtcTimezone, - {WeeklyTimeInterval(WeeklyTime(em::WeeklyTimeProto::THURSDAY, - base::Hours(1).InMilliseconds(), - 0), - WeeklyTime(em::WeeklyTimeProto::THURSDAY, - base::Hours(2).InMilliseconds(), - 0))}), - kHour * 1.5, - true), - std::make_tuple( - OffHoursPolicy( - kUtcTimezone, - {WeeklyTimeInterval(WeeklyTime(em::WeeklyTimeProto::THURSDAY, - base::Hours(1).InMilliseconds(), - 0), - WeeklyTime(em::WeeklyTimeProto::THURSDAY, - base::Hours(2).InMilliseconds(), - 0))}), - kHour * 3, - false))); + std::make_tuple(OffHoursPolicy(kGmtTimezone, {kOffHoursInterval}), + kHour, // Advancing to 1970-01-01T01:00:00 + true), + std::make_tuple(OffHoursPolicy(kGmtTimezone, {kOffHoursInterval}), + kHour * 1.5, + true), // Advancing to 1970-01-01T01:30:00 + std::make_tuple(OffHoursPolicy(kGmtTimezone, {kOffHoursInterval}), + kHour * 2, + false), // Advancing to 1970-01-01T02:00:00 + std::make_tuple(OffHoursPolicy(kGmtTimezone, {kOffHoursInterval}), + kHour * 3, // Advancing to 1970-01-01T03:00:00 + false))); } // namespace off_hours } // namespace policy
diff --git a/chrome/browser/ash/policy/reporting/OWNERS b/chrome/browser/ash/policy/reporting/OWNERS index dcdc9422..62c9f7f 100644 --- a/chrome/browser/ash/policy/reporting/OWNERS +++ b/chrome/browser/ash/policy/reporting/OWNERS
@@ -1,3 +1,5 @@ file://ash/components/policy/OWNERS swapnilgupta@google.com + +per-file *user_event_reporter*=file://components/reporting/OWNERS
diff --git a/chrome/browser/ash/policy/reporting/user_event_reporter_helper.cc b/chrome/browser/ash/policy/reporting/user_event_reporter_helper.cc index f9ccbc1..e5c18b30 100644 --- a/chrome/browser/ash/policy/reporting/user_event_reporter_helper.cc +++ b/chrome/browser/ash/policy/reporting/user_event_reporter_helper.cc
@@ -9,12 +9,15 @@ #include "base/logging.h" #include "chrome/browser/ash/login/users/chrome_user_manager.h" #include "components/reporting/client/report_queue_factory.h" +#include "content/public/browser/browser_task_traits.h" +#include "content/public/browser/browser_thread.h" namespace reporting { -UserEventReporterHelper::UserEventReporterHelper(Destination destination) +UserEventReporterHelper::UserEventReporterHelper(Destination destination, + EventType event_type) : report_queue_( - ReportQueueFactory::CreateSpeculativeReportQueue(EventType::kDevice, + ReportQueueFactory::CreateSpeculativeReportQueue(event_type, destination)) {} UserEventReporterHelper::UserEventReporterHelper( @@ -24,11 +27,13 @@ UserEventReporterHelper::~UserEventReporterHelper() = default; bool UserEventReporterHelper::ShouldReportUser(const std::string& email) const { + DCHECK_CURRENTLY_ON(::content::BrowserThread::UI); return ash::ChromeUserManager::Get()->ShouldReportUser(email); } bool UserEventReporterHelper::ReportingEnabled( const std::string& policy_path) const { + DCHECK_CURRENTLY_ON(::content::BrowserThread::UI); bool enabled = false; chromeos::CrosSettings::Get()->GetBoolean(policy_path, &enabled); return enabled; @@ -54,4 +59,10 @@ bool UserEventReporterHelper::IsCurrentUserNew() const { return user_manager::UserManager::Get()->IsCurrentUserNew(); } + +// static +scoped_refptr<base::SequencedTaskRunner> +UserEventReporterHelper::valid_task_runner() { + return ::content::GetUIThreadTaskRunner({}); +} } // namespace reporting
diff --git a/chrome/browser/ash/policy/reporting/user_event_reporter_helper.h b/chrome/browser/ash/policy/reporting/user_event_reporter_helper.h index cd3e3fda..0a1ea1e 100644 --- a/chrome/browser/ash/policy/reporting/user_event_reporter_helper.h +++ b/chrome/browser/ash/policy/reporting/user_event_reporter_helper.h
@@ -9,13 +9,14 @@ #include "base/task/sequenced_task_runner.h" #include "components/reporting/client/report_queue.h" -#include "components/reporting/client/report_queue_provider.h" +#include "components/reporting/client/report_queue_configuration.h" namespace reporting { class UserEventReporterHelper { public: - explicit UserEventReporterHelper(Destination destination); + explicit UserEventReporterHelper(Destination destination, + EventType event_type = EventType::kDevice); // Allows test classes to pass in user defined report queues for testing. explicit UserEventReporterHelper( std::unique_ptr<::reporting::ReportQueue, base::OnTaskRunnerDeleter> @@ -28,17 +29,24 @@ // Returns whether the user email can be included in the report. By default, // only affiliated user emails are included. Function can accept // canonicalized and non canonicalized user_email. + // Must be called on UI task runner (returned by valid_task_runner() below). virtual bool ShouldReportUser(const std::string& user_email) const; // Returns whether the provided reporting policy is set. + // Must be called on UI task runner (returned by valid_task_runner() below). virtual bool ReportingEnabled(const std::string& policy_path) const; // Reports an event to the queue. + // Thread safe, can be called on any thread. virtual void ReportEvent(const google::protobuf::MessageLite* record, Priority priority); virtual bool IsCurrentUserNew() const; + // Returns the only valid seq task runner for calls to ShouldReportUser and + // ReportingEnabled. + static scoped_refptr<base::SequencedTaskRunner> valid_task_runner(); + private: const std::unique_ptr<ReportQueue, base::OnTaskRunnerDeleter> report_queue_; };
diff --git a/chrome/browser/ash/policy/scheduled_task_handler/test/fake_scheduled_task_executor.cc b/chrome/browser/ash/policy/scheduled_task_handler/test/fake_scheduled_task_executor.cc index b2dd4f2d0..557d430 100644 --- a/chrome/browser/ash/policy/scheduled_task_handler/test/fake_scheduled_task_executor.cc +++ b/chrome/browser/ash/policy/scheduled_task_handler/test/fake_scheduled_task_executor.cc
@@ -28,9 +28,7 @@ icu::UnicodeString::fromUTF8(kESTTimeZoneID))); } -FakeScheduledTaskExecutor::~FakeScheduledTaskExecutor() { - delayed_task_handle_.CancelTask(); -} +FakeScheduledTaskExecutor::~FakeScheduledTaskExecutor() = default; void FakeScheduledTaskExecutor::Start( ScheduledTaskData* scheduled_task_data, @@ -54,16 +52,11 @@ base::SequencedTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(result_cb), true)); - delayed_task_handle_ = - base::SequencedTaskRunnerHandle::Get()->PostCancelableDelayedTask( - base::subtle::PostDelayedTaskPassKeyForTesting(), FROM_HERE, - base::BindOnce(std::move(timer_expired_cb)), delay.value()); + timer_.Start(FROM_HERE, delay.value(), std::move(timer_expired_cb)); } void FakeScheduledTaskExecutor::Reset() { - if (delayed_task_handle_.IsValid()) { - delayed_task_handle_.CancelTask(); - } + timer_.Stop(); } void FakeScheduledTaskExecutor::SetTimeZone(
diff --git a/chrome/browser/ash/policy/scheduled_task_handler/test/fake_scheduled_task_executor.h b/chrome/browser/ash/policy/scheduled_task_handler/test/fake_scheduled_task_executor.h index 076fba14..6bee13aa 100644 --- a/chrome/browser/ash/policy/scheduled_task_handler/test/fake_scheduled_task_executor.h +++ b/chrome/browser/ash/policy/scheduled_task_handler/test/fake_scheduled_task_executor.h
@@ -5,9 +5,9 @@ #ifndef CHROME_BROWSER_ASH_POLICY_SCHEDULED_TASK_HANDLER_TEST_FAKE_SCHEDULED_TASK_EXECUTOR_H_ #define CHROME_BROWSER_ASH_POLICY_SCHEDULED_TASK_HANDLER_TEST_FAKE_SCHEDULED_TASK_EXECUTOR_H_ -#include "base/task/delayed_task_handle.h" #include "base/time/clock.h" #include "base/time/time.h" +#include "base/timer/timer.h" #include "chrome/browser/ash/policy/scheduled_task_handler/scheduled_task_executor.h" #include "third_party/icu/source/i18n/unicode/timezone.h" @@ -48,7 +48,7 @@ bool simulate_calculate_next_update_check_failure_ = false; // Timer that is scheduled to execute the task. - base::DelayedTaskHandle delayed_task_handle_; + base::OneShotTimer timer_; }; } // namespace policy
diff --git a/chrome/browser/ash/preferences.cc b/chrome/browser/ash/preferences.cc index 0e5c790..746c210a 100644 --- a/chrome/browser/ash/preferences.cc +++ b/chrome/browser/ash/preferences.cc
@@ -463,9 +463,9 @@ registry->RegisterBooleanPref(::prefs::kSettingsShowOSBanner, true); // This pref is a per-session pref and must not be synced. - registry->RegisterStringPref(::prefs::kLoginExtensionApiLaunchExtensionId, - std::string(), - PrefRegistry::NO_REGISTRATION_FLAGS); + registry->RegisterBooleanPref( + ::prefs::kLoginExtensionApiCanLockManagedGuestSession, false, + PrefRegistry::NO_REGISTRATION_FLAGS); registry->RegisterBooleanPref(prefs::kLoginDisplayPasswordButtonEnabled, true);
diff --git a/chrome/browser/browsing_data/counters/conditional_cache_counting_helper_browsertest.cc b/chrome/browser/browsing_data/counters/conditional_cache_counting_helper_browsertest.cc index 8d87564..d7031e17 100644 --- a/chrome/browser/browsing_data/counters/conditional_cache_counting_helper_browsertest.cc +++ b/chrome/browser/browsing_data/counters/conditional_cache_counting_helper_browsertest.cc
@@ -10,6 +10,7 @@ #include "base/bind.h" #include "base/run_loop.h" #include "base/strings/strcat.h" +#include "build/build_config.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" @@ -119,7 +120,13 @@ // Tests that ConditionalCacheCountingHelper only counts those cache entries // that match the condition. -IN_PROC_BROWSER_TEST_F(ConditionalCacheCountingHelperBrowserTest, Count) { +// TODO(https://crbug.com/1287432): The test is flaky on Win. +#if defined(OS_WIN) +#define MAYBE_Count DISABLED_Count +#else +#define MAYBE_Count Count +#endif +IN_PROC_BROWSER_TEST_F(ConditionalCacheCountingHelperBrowserTest, MAYBE_Count) { // Create 5 entries. std::set<std::string> keys1 = {"1", "2", "3", "4", "5"};
diff --git a/chrome/browser/certificate_manager_model.cc b/chrome/browser/certificate_manager_model.cc index 36df573..b677672 100644 --- a/chrome/browser/certificate_manager_model.cc +++ b/chrome/browser/certificate_manager_model.cc
@@ -32,15 +32,19 @@ #include "net/cert/x509_util_nss.h" #include "ui/base/l10n/l10n_util.h" +#if BUILDFLAG(IS_CHROMEOS) +#include "chrome/browser/policy/networking/user_network_configuration_updater.h" +#include "chrome/browser/policy/networking/user_network_configuration_updater_factory.h" +#include "chromeos/network/policy_certificate_provider.h" +#endif // BUILDFLAG(IS_CHROMEOS) + #if BUILDFLAG(IS_CHROMEOS_ASH) #include "chrome/browser/ash/certificate_provider/certificate_provider.h" #include "chrome/browser/ash/certificate_provider/certificate_provider_service.h" #include "chrome/browser/ash/certificate_provider/certificate_provider_service_factory.h" #include "chrome/browser/policy/networking/user_network_configuration_updater_ash.h" -#include "chrome/browser/policy/networking/user_network_configuration_updater_factory.h" #include "chromeos/components/onc/certificate_scope.h" -#include "chromeos/network/policy_certificate_provider.h" -#endif +#endif // BUILDFLAG(IS_CHROMEOS_ASH) using content::BrowserThread; @@ -77,12 +81,12 @@ return org; } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) // Log message for an operation that can not be performed on a certificate of a // given source. constexpr char kOperationNotPermitted[] = "Operation not permitted on a certificate. Source: "; -#endif // BUILDFLAG(IS_CHROMEOS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS) } // namespace @@ -284,7 +288,7 @@ base::WeakPtrFactory<CertsSourcePlatformNSS> weak_ptr_factory_{this}; }; -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) // Provides certificates installed through enterprise policy. class CertsSourcePolicy : public CertificateManagerModel::CertsSource, chromeos::PolicyCertificateProvider::Observer { @@ -384,7 +388,9 @@ chromeos::PolicyCertificateProvider* policy_certs_provider_; Mode mode_; }; +#endif // BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_CHROMEOS_ASH) // Provides certificates made available by extensions through the // chrome.certificateProvider API. class CertsSourceExtensions : public CertificateManagerModel::CertsSource { @@ -453,7 +459,6 @@ base::WeakPtrFactory<CertsSourceExtensions> weak_ptr_factory_{this}; }; - #endif // BUILDFLAG(IS_CHROMEOS_ASH) } // namespace @@ -501,12 +506,13 @@ DCHECK_CURRENTLY_ON(BrowserThread::UI); std::unique_ptr<Params> params = std::make_unique<Params>(); -#if BUILDFLAG(IS_CHROMEOS_ASH) - policy::UserNetworkConfigurationUpdater* user_network_configuration_updater = +#if BUILDFLAG(IS_CHROMEOS) + params->policy_certs_provider = policy::UserNetworkConfigurationUpdaterFactory::GetForBrowserContext( browser_context); - params->policy_certs_provider = user_network_configuration_updater; +#endif +#if BUILDFLAG(IS_CHROMEOS_ASH) chromeos::CertificateProviderService* certificate_provider_service = chromeos::CertificateProviderServiceFactory::GetForBrowserContext( browser_context); @@ -536,7 +542,7 @@ base::RepeatingClosure certs_source_updated_callback = base::BindRepeating( &CertificateManagerModel::OnCertsSourceUpdated, base::Unretained(this)); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) // Certificates installed and web trusted by enterprise policy is the highest // priority CertsSource. // UserNetworkConfigurationUpdater is only available for the primary user's @@ -552,7 +558,7 @@ certs_sources_.push_back(std::make_unique<CertsSourcePlatformNSS>( certs_source_updated_callback, nss_cert_database)); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) // Certificates installed by enterprise policy without web trust are lower // priority than the main NSS DB based CertsSource. // Rationale: The user should be able to add trust to policy-provided @@ -562,7 +568,9 @@ certs_source_updated_callback, params->policy_certs_provider, CertsSourcePolicy::Mode::kPolicyCertsWithoutWebTrust)); } +#endif +#if BUILDFLAG(IS_CHROMEOS_ASH) // Extensions is the lowest priority CertsSource. if (params->extension_certificate_provider) { certs_sources_.push_back(std::make_unique<CertsSourceExtensions>(
diff --git a/chrome/browser/certificate_manager_model.h b/chrome/browser/certificate_manager_model.h index a9f90f9..1edffbf 100644 --- a/chrome/browser/certificate_manager_model.h +++ b/chrome/browser/certificate_manager_model.h
@@ -26,7 +26,9 @@ namespace ash { class CertificateProvider; } // namespace ash +#endif +#if BUILDFLAG(IS_CHROMEOS) namespace chromeos { class PolicyCertificateProvider; } @@ -126,9 +128,11 @@ // Holds parameters during construction. struct Params { -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) // May be nullptr. chromeos::PolicyCertificateProvider* policy_certs_provider = nullptr; +#endif +#if BUILDFLAG(IS_CHROMEOS_ASH) // May be nullptr. std::unique_ptr<ash::CertificateProvider> extension_certificate_provider; #endif
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc index aecef7b..5dc4deb9 100644 --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc
@@ -365,8 +365,6 @@ #include "chrome/browser/chromeos/fileapi/external_file_url_loader_factory.h" #include "chrome/browser/chromeos/fileapi/file_system_backend.h" #include "chrome/browser/chromeos/fileapi/mtp_file_system_backend_delegate.h" -#include "chrome/browser/policy/networking/policy_cert_service.h" -#include "chrome/browser/policy/networking/policy_cert_service_factory.h" #include "chrome/browser/speech/tts_chromeos.h" #include "chrome/browser/ui/ash/chrome_browser_main_extra_parts_ash.h" #include "chrome/browser/ui/browser_dialogs.h" @@ -421,6 +419,11 @@ #include "ui/accessibility/accessibility_features.h" #endif // !BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) +#include "chrome/browser/policy/networking/policy_cert_service.h" +#include "chrome/browser/policy/networking/policy_cert_service_factory.h" +#endif + #if !defined(OS_ANDROID) #include "chrome/browser/devtools/chrome_devtools_manager_delegate.h" #include "chrome/browser/devtools/devtools_window.h" @@ -2810,7 +2813,7 @@ } } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void ChromeContentBrowserClient::OnTrustAnchorUsed( content::BrowserContext* browser_context) { policy::PolicyCertService* service =
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h index fd28446..7392f7d 100644 --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h
@@ -299,7 +299,7 @@ const url::Origin* impression_origin, const url::Origin* conversion_origin, const url::Origin* reporting_origin) override; -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void OnTrustAnchorUsed(content::BrowserContext* browser_context) override; #endif scoped_refptr<network::SharedURLLoaderFactory>
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/login_api.cc b/chrome/browser/chromeos/extensions/login_screen/login/login_api.cc index 44582b8..c20f4989 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/login_api.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/login_api.cc
@@ -30,17 +30,6 @@ namespace extensions { -namespace { - -std::string GetLaunchExtensionIdPrefValue(const user_manager::User* user) { - Profile* profile = ash::ProfileHelper::Get()->GetProfileByUser(user); - DCHECK(profile); - PrefService* prefs = profile->GetPrefs(); - return prefs->GetString(prefs::kLoginExtensionApiLaunchExtensionId); -} - -} // namespace - namespace login_api { void RegisterLocalStatePrefs(PrefRegistrySimple* registry) { @@ -58,11 +47,11 @@ "Another login attempt is in progress"; const char kNoManagedGuestSessionAccounts[] = "No managed guest session accounts"; -const char kNoPermissionToLock[] = - "The extension does not have permission to lock this session"; +const char kNoLockableManagedGuestSession[] = + "There is no lockable Managed Guest Session"; const char kSessionIsNotActive[] = "Session is not active"; -const char kNoPermissionToUnlock[] = - "The extension does not have permission to unlock this session"; +const char kNoUnlockableManagedGuestSession[] = + "There is no unlockable Managed Guest Session"; const char kSessionIsNotLocked[] = "Session is not locked"; const char kAnotherUnlockAttemptInProgress[] = "Another unlock attempt is in progress"; @@ -114,7 +103,7 @@ user->GetAccountId()); if (parameters->password) { context.SetKey(ash::Key(*parameters->password)); - context.SetManagedGuestSessionLaunchExtensionId(extension_id()); + context.SetCanLockManagedGuestSession(true); } existing_user_controller->Login(context, ash::SigninSpecifics()); @@ -174,7 +163,7 @@ if (!active_user || active_user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT || !user_manager->CanCurrentUserLock()) { - return RespondNow(Error(login_api_errors::kNoPermissionToLock)); + return RespondNow(Error(login_api_errors::kNoLockableManagedGuestSession)); } if (session_manager::SessionManager::Get()->session_state() != @@ -199,12 +188,14 @@ api::login::UnlockManagedGuestSession::Params::Create(args()); EXTENSION_FUNCTION_VALIDATE(parameters); - const user_manager::User* active_user = - user_manager::UserManager::Get()->GetActiveUser(); + const user_manager::UserManager* user_manager = + user_manager::UserManager::Get(); + const user_manager::User* active_user = user_manager->GetActiveUser(); if (!active_user || active_user->GetType() != user_manager::USER_TYPE_PUBLIC_ACCOUNT || - extension_id() != GetLaunchExtensionIdPrefValue(active_user)) { - return RespondNow(Error(login_api_errors::kNoPermissionToUnlock)); + !user_manager->CanCurrentUserLock()) { + return RespondNow( + Error(login_api_errors::kNoUnlockableManagedGuestSession)); } if (session_manager::SessionManager::Get()->session_state() != @@ -298,11 +289,12 @@ auto parameters = api::login::UnlockSharedSession::Params::Create(args()); EXTENSION_FUNCTION_VALIDATE(parameters); - const user_manager::User* active_user = - user_manager::UserManager::Get()->GetActiveUser(); - if (!active_user || - extension_id() != GetLaunchExtensionIdPrefValue(active_user)) { - return RespondNow(Error(login_api_errors::kNoPermissionToUnlock)); + const user_manager::UserManager* user_manager = + user_manager::UserManager::Get(); + const user_manager::User* active_user = user_manager->GetActiveUser(); + if (!active_user || !user_manager->CanCurrentUserLock()) { + return RespondNow( + Error(login_api_errors::kNoUnlockableManagedGuestSession)); } chromeos::SharedSessionHandler::Get()->UnlockSharedSession(
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/login_api.h b/chrome/browser/chromeos/extensions/login_screen/login/login_api.h index 4490ddd2..9263ac30 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/login_api.h +++ b/chrome/browser/chromeos/extensions/login_screen/login/login_api.h
@@ -22,9 +22,9 @@ extern const char kLoginScreenIsNotActive[]; extern const char kAnotherLoginAttemptInProgress[]; extern const char kNoManagedGuestSessionAccounts[]; -extern const char kNoPermissionToLock[]; +extern const char kNoLockableManagedGuestSession[]; extern const char kSessionIsNotActive[]; -extern const char kNoPermissionToUnlock[]; +extern const char kNoUnlockableManagedGuestSession[]; extern const char kSessionIsNotLocked[]; extern const char kAnotherUnlockAttemptInProgress[]; extern const char kAuthenticationFailed[];
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/login_api_unittest.cc b/chrome/browser/chromeos/extensions/login_screen/login/login_api_unittest.cc index ca645430..1896eca9 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/login_api_unittest.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/login_api_unittest.cc
@@ -56,8 +56,6 @@ const char kEmail[] = "email@test"; const char kGaiaId[] = "gaia@test"; -const char kExtensionName[] = "extension_name"; -const char kExtensionId[] = "abcdefghijklmnopqrstuvwxyzabcdef"; class MockExistingUserController : public ash::ExistingUserController { public: @@ -123,13 +121,6 @@ AccountId::FromUserEmail(email)); } -void SetLoginExtensionApiLaunchExtensionIdPref( - Profile* profile, - const std::string& extension_id) { - profile->GetPrefs()->SetString(prefs::kLoginExtensionApiLaunchExtensionId, - extension_id); -} - } // namespace namespace extensions { @@ -175,14 +166,6 @@ ExtensionApiUnittest::TearDown(); } - void SetExtensionWithId(const std::string& extension_id) { - scoped_refptr<const extensions::Extension> extension = - extensions::ExtensionBuilder(kExtensionName) - .SetID(extension_id) - .Build(); - set_extension(extension); - } - std::unique_ptr<ScopedTestingProfile> AddPublicAccountUser( const std::string& email) { AccountId account_id = AccountId::FromUserEmail(email); @@ -357,7 +340,7 @@ } TEST_F(LoginApiUnittest, LockManagedGuestSessionNoActiveUser) { - ASSERT_EQ(login_api_errors::kNoPermissionToLock, + ASSERT_EQ(login_api_errors::kNoLockableManagedGuestSession, RunFunctionAndReturnError( new LoginLockManagedGuestSessionFunction(), "[]")); } @@ -367,7 +350,7 @@ fake_chrome_user_manager_->AddUser(account_id); fake_chrome_user_manager_->SwitchActiveUser(account_id); - ASSERT_EQ(login_api_errors::kNoPermissionToLock, + ASSERT_EQ(login_api_errors::kNoLockableManagedGuestSession, RunFunctionAndReturnError( new LoginLockManagedGuestSessionFunction(), "[]")); } @@ -377,7 +360,7 @@ fake_chrome_user_manager_->SwitchActiveUser(AccountId::FromUserEmail(kEmail)); fake_chrome_user_manager_->set_current_user_can_lock(false); - ASSERT_EQ(login_api_errors::kNoPermissionToLock, + ASSERT_EQ(login_api_errors::kNoLockableManagedGuestSession, RunFunctionAndReturnError( new LoginLockManagedGuestSessionFunction(), "[]")); } @@ -398,12 +381,10 @@ base::TimeTicks now_ = base::TimeTicks::Now(); ui::UserActivityDetector::Get()->set_now_for_test(now_); - SetExtensionWithId(kExtensionId); std::unique_ptr<ScopedTestingProfile> scoped_profile = AddPublicAccountUser(kEmail); - SetLoginExtensionApiLaunchExtensionIdPref(scoped_profile->profile(), - kExtensionId); fake_chrome_user_manager_->SwitchActiveUser(AccountId::FromUserEmail(kEmail)); + fake_chrome_user_manager_->set_current_user_can_lock(true); session_manager::SessionManager::Get()->SetSessionState( session_manager::SessionState::LOCKED); @@ -425,7 +406,7 @@ TEST_F(LoginApiUnittest, UnlockManagedGuestSessionNoActiveUser) { ASSERT_EQ( - login_api_errors::kNoPermissionToUnlock, + login_api_errors::kNoUnlockableManagedGuestSession, RunFunctionAndReturnError(new LoginUnlockManagedGuestSessionFunction(), "[\"password\"]")); } @@ -436,31 +417,26 @@ fake_chrome_user_manager_->SwitchActiveUser(account_id); ASSERT_EQ( - login_api_errors::kNoPermissionToUnlock, + login_api_errors::kNoUnlockableManagedGuestSession, RunFunctionAndReturnError(new LoginUnlockManagedGuestSessionFunction(), "[\"password\"]")); } -TEST_F(LoginApiUnittest, UnlockManagedGuestSessionWrongExtensionId) { - SetExtensionWithId(kExtensionId); +TEST_F(LoginApiUnittest, UnlockManagedGuestSessionCannotUnlock) { std::unique_ptr<ScopedTestingProfile> scoped_profile = AddPublicAccountUser(kEmail); - SetLoginExtensionApiLaunchExtensionIdPref(scoped_profile->profile(), - "wrong_extension_id"); fake_chrome_user_manager_->SwitchActiveUser(AccountId::FromUserEmail(kEmail)); ASSERT_EQ( - login_api_errors::kNoPermissionToUnlock, + login_api_errors::kNoUnlockableManagedGuestSession, RunFunctionAndReturnError(new LoginUnlockManagedGuestSessionFunction(), "[\"password\"]")); } TEST_F(LoginApiUnittest, UnlockManagedGuestSessionSessionNotLocked) { - SetExtensionWithId(kExtensionId); std::unique_ptr<ScopedTestingProfile> scoped_profile = AddPublicAccountUser(kEmail); - SetLoginExtensionApiLaunchExtensionIdPref(scoped_profile->profile(), - kExtensionId); + fake_chrome_user_manager_->set_current_user_can_lock(true); fake_chrome_user_manager_->SwitchActiveUser(AccountId::FromUserEmail(kEmail)); ASSERT_EQ( @@ -470,11 +446,9 @@ } TEST_F(LoginApiUnittest, UnlockManagedGuestSessionUnlockInProgress) { - SetExtensionWithId(kExtensionId); std::unique_ptr<ScopedTestingProfile> scoped_profile = AddPublicAccountUser(kEmail); - SetLoginExtensionApiLaunchExtensionIdPref(scoped_profile->profile(), - kExtensionId); + fake_chrome_user_manager_->set_current_user_can_lock(true); fake_chrome_user_manager_->SwitchActiveUser(AccountId::FromUserEmail(kEmail)); session_manager::SessionManager::Get()->SetSessionState( session_manager::SessionState::LOCKED); @@ -488,11 +462,9 @@ } TEST_F(LoginApiUnittest, UnlockManagedGuestSessionAuthenticationFailed) { - SetExtensionWithId(kExtensionId); std::unique_ptr<ScopedTestingProfile> scoped_profile = AddPublicAccountUser(kEmail); - SetLoginExtensionApiLaunchExtensionIdPref(scoped_profile->profile(), - kExtensionId); + fake_chrome_user_manager_->set_current_user_can_lock(true); fake_chrome_user_manager_->SwitchActiveUser(AccountId::FromUserEmail(kEmail)); session_manager::SessionManager::Get()->SetSessionState( session_manager::SessionState::LOCKED); @@ -583,7 +555,6 @@ } void LaunchSharedManagedGuestSession(const std::string& password) { - SetExtensionWithId(kExtensionId); EXPECT_CALL(*mock_existing_user_controller_, Login(_, MatchSigninSpecifics(chromeos::SigninSpecifics()))) .Times(1); @@ -593,8 +564,7 @@ RunFunction(new LoginLaunchSharedManagedGuestSessionFunction(), "[\"" + password + "\"]"); - SetLoginExtensionApiLaunchExtensionIdPref(testing_profile_->profile(), - kExtensionId); + fake_chrome_user_manager_->set_current_user_can_lock(true); fake_chrome_user_manager_->SwitchActiveUser( AccountId::FromUserEmail(kEmail)); @@ -623,7 +593,6 @@ TEST_F(LoginApiSharedSessionUnittest, LaunchSharedManagedGuestSession) { base::TimeTicks now_ = base::TimeTicks::Now(); ui::UserActivityDetector::Get()->set_now_for_test(now_); - SetExtensionWithId(kExtensionId); std::unique_ptr<ScopedTestingProfile> profile = AddPublicAccountUser(kEmail); ash::UserContext user_context; EXPECT_CALL(*mock_existing_user_controller_, @@ -632,8 +601,7 @@ RunFunction(new LoginLaunchSharedManagedGuestSessionFunction(), "[\"foo\"]"); - EXPECT_EQ(user_context.GetManagedGuestSessionLaunchExtensionId(), - kExtensionId); + EXPECT_TRUE(user_context.CanLockManagedGuestSession()); chromeos::SharedSessionHandler* handler = chromeos::SharedSessionHandler::Get(); const std::string& session_secret = handler->GetSessionSecretForTesting(); @@ -713,11 +681,9 @@ // Test that calling `login.unlockSharedSession()` returns an error when the // session is not locked. TEST_F(LoginApiSharedSessionUnittest, UnlockSharedSessionNotLocked) { - SetExtensionWithId(kExtensionId); std::unique_ptr<ScopedTestingProfile> scoped_profile = AddPublicAccountUser(kEmail); - SetLoginExtensionApiLaunchExtensionIdPref(scoped_profile->profile(), - kExtensionId); + fake_chrome_user_manager_->set_current_user_can_lock(true); ASSERT_EQ(login_api_errors::kSessionIsNotLocked, RunFunctionAndReturnError(new LoginUnlockSharedSessionFunction(), "[\"foo\"]")); @@ -726,11 +692,9 @@ // Test that calling `login.unlockSharedSession()` returns an error when there // is no shared MGS launched. TEST_F(LoginApiSharedSessionUnittest, UnlockSharedSessionNoSharedMGS) { - SetExtensionWithId(kExtensionId); std::unique_ptr<ScopedTestingProfile> scoped_profile = AddPublicAccountUser(kEmail); - SetLoginExtensionApiLaunchExtensionIdPref(scoped_profile->profile(), - kExtensionId); + fake_chrome_user_manager_->set_current_user_can_lock(true); session_manager::SessionManager::Get()->SetSessionState( session_manager::SessionState::LOCKED); ASSERT_EQ(login_api_errors::kNoSharedMGSFound, @@ -778,30 +742,15 @@ "[\"foo\"]")); } -// Test that calling `login.unlockSharedSession()` returns an error when it is -// called by an extension with a different ID. -TEST_F(LoginApiSharedSessionUnittest, UnlockSharedSessionWrongExtension) { - LaunchSharedManagedGuestSession("foo"); - session_manager::SessionManager::Get()->SetSessionState( - session_manager::SessionState::LOCKED); - SetExtensionWithId("wrong_extension_id"); - - ASSERT_EQ(login_api_errors::kNoPermissionToUnlock, - RunFunctionAndReturnError(new LoginUnlockSharedSessionFunction(), - "[\"foo\"]")); -} - // Test that calling `login.unlockSharedSession()` returns an error when the -// extension ID does not match the `kLoginExtensionApiLaunchExtensionId` pref. -TEST_F(LoginApiSharedSessionUnittest, UnlockSharedSessionWrongExtensionId) { +// MGS cannot be unlocked. +TEST_F(LoginApiSharedSessionUnittest, UnlockSharedSessionCannotUnlock) { LaunchSharedManagedGuestSession("foo"); session_manager::SessionManager::Get()->SetSessionState( session_manager::SessionState::LOCKED); + fake_chrome_user_manager_->set_current_user_can_lock(false); - SetLoginExtensionApiLaunchExtensionIdPref(testing_profile_->profile(), - "wrong_extension_id"); - - ASSERT_EQ(login_api_errors::kNoPermissionToUnlock, + ASSERT_EQ(login_api_errors::kNoUnlockableManagedGuestSession, RunFunctionAndReturnError(new LoginUnlockSharedSessionFunction(), "[\"foo\"]")); }
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc b/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc index ad2539d6..9085603 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/login_apitest.cc
@@ -57,7 +57,6 @@ constexpr char kInSessionExtensionId[] = "ofcpkomnogjenhfajfjadjmjppbegnad"; const char kInSessionExtensionUpdateManifestPath[] = "/extensions/api_test/login_screen_apis/update_manifest.xml"; -constexpr char kWrongExtensionId[] = "abcdefghijklmnopqrstuvwxyzabcdef"; // launchManagedGuestSession tests. constexpr char kLaunchManagedGuestSession[] = "LoginLaunchManagedGuestSession"; @@ -81,17 +80,9 @@ "LoginUnlockManagedGuestSessionWrongPassword"; constexpr char kUnlockManagedGuestSessionNotLocked[] = "LoginUnlockManagedGuestSessionNotLocked"; -constexpr char kUnlockManagedGuestSessionNotManagedGuestSession[] = - "LoginUnlockManagedGuestSessionNotManagedGuestSession"; -constexpr char kUnlockManagedGuestSessionWrongExtensionId[] = - "LoginUnlockManagedGuestSessionWrongExtensionId"; // In-session extension tests. constexpr char kInSessionLoginLockManagedGuestSession[] = "InSessionLoginLockManagedGuestSession"; -constexpr char kInSessionLoginLockManagedGuestSessionNoPermission[] = - "InSessionLoginLockManagedGuestSessionNoPermission"; -constexpr char kInSessionUnlockManagedGuestSessionNoPermission[] = - "InSessionLoginUnlockManagedGuestSessionNoPermission"; } // namespace @@ -282,17 +273,6 @@ RunTest(kLockManagedGuestSessionNotActive); } -IN_PROC_BROWSER_TEST_F(LoginApitest, LockManagedGuestSessionNoPermission) { - SetUpDeviceLocalAccountPolicy(); - SessionStateWaiter waiter(session_manager::SessionState::ACTIVE); - SetUpLoginScreenExtensionAndRunTest(kLaunchManagedGuestSession); - waiter.Wait(); - - SetUpTestListeners(); - SetUpInSessionExtension(); - RunTest(kInSessionLoginLockManagedGuestSessionNoPermission); -} - IN_PROC_BROWSER_TEST_F(LoginApitest, UnlockManagedGuestSession) { SetUpDeviceLocalAccountPolicy(); LogInWithPassword(); @@ -347,18 +327,9 @@ RunTest(kUnlockManagedGuestSessionWrongPassword); } -IN_PROC_BROWSER_TEST_F(LoginApitest, UnlockManagedGuestSessionNoPermission) { - SetUpDeviceLocalAccountPolicy(); - LogInWithPassword(); - - SetUpTestListeners(); - SetUpInSessionExtension(); - RunTest(kInSessionUnlockManagedGuestSessionNoPermission); -} - // This test checks that the case where the profile has been created (which -// sets the |kLoginExtensionApiLaunchExtensionId| pref, but the session is not -// yet active. +// sets the |kLoginExtensionApiCanLockManagedGuestSession| pref), but the +// session is not yet active. IN_PROC_BROWSER_TEST_F(LoginApitest, UnlockManagedGuestSessionNotLocked) { SetUpDeviceLocalAccountPolicy(); LogInWithPassword(); @@ -370,23 +341,6 @@ RunTest(kUnlockManagedGuestSessionNotLocked); } -IN_PROC_BROWSER_TEST_F(LoginApitest, - UnlockManagedGuestSessionWrongExtensionId) { - SetUpDeviceLocalAccountPolicy(); - LogInWithPassword(); - - const user_manager::User* active_user = - user_manager::UserManager::Get()->GetActiveUser(); - Profile* profile = ash::ProfileHelper::Get()->GetProfileByUser(active_user); - PrefService* prefs = profile->GetPrefs(); - prefs->SetString(prefs::kLoginExtensionApiLaunchExtensionId, - kWrongExtensionId); - - SetUpTestListeners(); - LockScreen(); - RunTest(kUnlockManagedGuestSessionWrongExtensionId); -} - class LoginApitestWithEnterpriseUser : public LoginApitest { public: LoginApitestWithEnterpriseUser() = default; @@ -447,21 +401,8 @@ kLaunchManagedGuestSessionAlreadyExistsActiveSession); } -IN_PROC_BROWSER_TEST_F(LoginApitestWithEnterpriseUser, - UnlockManagedGuestSessionNotManagedGuestSession) { - LoginUser(); - LockScreen(); - SetUpLoginScreenExtensionAndRunTest( - kUnlockManagedGuestSessionNotManagedGuestSession); -} - -// TODO(https://crbug.com/1075511) Flaky test. -IN_PROC_BROWSER_TEST_F(LoginApitestWithEnterpriseUser, - DISABLED_LockManagedGuestSessionNotManagedGuestSession) { - LoginUser(); - SetUpTestListeners(); - SetUpInSessionExtension(); - RunTest(kInSessionLoginLockManagedGuestSessionNoPermission); -} +// TODO(b/214555030): Re-add +// LoginUnlockManagedGuestSessionNotManagedGuestSession API test with the +// correct error message when crrev.com/c/3284871 is landed. } // namespace chromeos
diff --git a/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc b/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc index 1f9115c..648e417 100644 --- a/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc +++ b/chrome/browser/chromeos/extensions/login_screen/login/shared_session_handler.cc
@@ -100,7 +100,7 @@ ash::UserContext context(user_manager::USER_TYPE_PUBLIC_ACCOUNT, user->GetAccountId()); context.SetKey(ash::Key(session_secret_)); - context.SetManagedGuestSessionLaunchExtensionId(extension_id); + context.SetCanLockManagedGuestSession(true); existing_user_controller->Login(context, chromeos::SigninSpecifics()); return absl::nullopt;
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/BUILD.gn b/chrome/browser/chromeos/extensions/telemetry/api/BUILD.gn index a5021d0..7fd8cb6 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/BUILD.gn +++ b/chrome/browser/chromeos/extensions/telemetry/api/BUILD.gn
@@ -24,6 +24,8 @@ "hardware_info_delegate.h", "telemetry_api.cc", "telemetry_api.h", + "telemetry_api_converters.cc", + "telemetry_api_converters.h", ] deps = [ @@ -95,7 +97,10 @@ source_set("unit_tests") { testonly = true - sources = [ "diagnostics_api_converters_unittest.cc" ] + sources = [ + "diagnostics_api_converters_unittest.cc", + "telemetry_api_converters_unittest.cc", + ] deps = [ ":api",
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_api_guard_function_browsertest.cc b/chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_api_guard_function_browsertest.cc index 16714b5..68477f3 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_api_guard_function_browsertest.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/base_telemetry_extension_api_guard_function_browsertest.cc
@@ -29,6 +29,14 @@ std::string service_worker = R"( const tests = [ // Telemetry APIs. + async function getCpuInfo() { + await chrome.test.assertPromiseRejects( + chrome.os.telemetry.getCpuInfo(), + 'Error: Unauthorized access to chrome.os.telemetry.getCpuInfo.' + + ' %s' + ); + chrome.test.succeed(); + }, async function getMemoryInfo() { await chrome.test.assertPromiseRejects( chrome.os.telemetry.getMemoryInfo(),
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.cc b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.cc index 71ef8609..ce00d8c 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.cc
@@ -12,6 +12,7 @@ #include "base/bind.h" #include "base/values.h" +#include "chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h" #include "chrome/common/chromeos/extensions/api/telemetry.h" #include "extensions/common/permissions/permissions_data.h" @@ -144,4 +145,38 @@ ArgumentList(api::os_telemetry::GetMemoryInfo::Results::Create(result))); } +// OsTelemetryGetCpuInfoFunction ----------------------------------------------- + +OsTelemetryGetCpuInfoFunction::OsTelemetryGetCpuInfoFunction() = default; +OsTelemetryGetCpuInfoFunction::~OsTelemetryGetCpuInfoFunction() = default; + +void OsTelemetryGetCpuInfoFunction::RunIfAllowed() { + auto cb = base::BindOnce(&OsTelemetryGetCpuInfoFunction::OnResult, this); + + remote_probe_service_->ProbeTelemetryInfo( + {ash::health::mojom::ProbeCategoryEnum::kCpu}, std::move(cb)); +} + +void OsTelemetryGetCpuInfoFunction::OnResult( + ash::health::mojom::TelemetryInfoPtr ptr) { + if (!ptr || !ptr->cpu_result || !ptr->cpu_result->is_cpu_info()) { + Respond(Error("API internal error")); + return; + } + + const auto& cpu_info = ptr->cpu_result->get_cpu_info(); + + api::os_telemetry::CpuInfo result; + if (cpu_info->num_total_threads) { + result.num_total_threads = + std::make_unique<int32_t>(cpu_info->num_total_threads->value); + } + result.architecture = converters::Convert(cpu_info->architecture); + result.physical_cpus = + converters::ConvertPtrVector<api::os_telemetry::PhysicalCpuInfo>( + std::move(cpu_info->physical_cpus)); + + Respond(ArgumentList(api::os_telemetry::GetCpuInfo::Results::Create(result))); +} + } // namespace chromeos
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.h b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.h index 5cc2e260..5d2cd122 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.h +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.h
@@ -86,6 +86,24 @@ void OnResult(ash::health::mojom::TelemetryInfoPtr ptr); }; +class OsTelemetryGetCpuInfoFunction : public TelemetryApiFunctionBase { + public: + DECLARE_EXTENSION_FUNCTION("os.telemetry.getCpuInfo", OS_TELEMETRY_GETCPUINFO) + + OsTelemetryGetCpuInfoFunction(); + OsTelemetryGetCpuInfoFunction(const OsTelemetryGetCpuInfoFunction&) = delete; + OsTelemetryGetCpuInfoFunction& operator=( + const OsTelemetryGetCpuInfoFunction&) = delete; + + private: + ~OsTelemetryGetCpuInfoFunction() override; + + // BaseTelemetryExtensionApiGuardFunction: + void RunIfAllowed() override; + + void OnResult(ash::health::mojom::TelemetryInfoPtr ptr); +}; + } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_TELEMETRY_API_H_
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_browsertest.cc b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_browsertest.cc index 2edfcd8..f970815 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_browsertest.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_browsertest.cc
@@ -176,6 +176,142 @@ )"); } +IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, + GetCpuInfo_Error) { + CreateExtensionAndRunServiceWorker(R"( + chrome.test.runTests([ + async function getCpuInfo() { + await chrome.test.assertPromiseRejects( + chrome.os.telemetry.getCpuInfo(), + 'Error: API internal error' + ); + chrome.test.succeed(); + } + ]); + )"); +} + +IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, + GetCpuInfo_Success) { + // Configure fake cros_healthd response. + { + auto telemetry_info = cros_healthd::mojom::TelemetryInfo::New(); + + { + auto c_state1 = chromeos::cros_healthd::mojom::CpuCStateInfo::New(); + c_state1->name = "C1"; + c_state1->time_in_state_since_last_boot_us = 1125899906875957; + + auto c_state2 = chromeos::cros_healthd::mojom::CpuCStateInfo::New(); + c_state2->name = "C2"; + c_state2->time_in_state_since_last_boot_us = 1125899906877777; + + auto logical_info1 = chromeos::cros_healthd::mojom::LogicalCpuInfo::New(); + logical_info1->max_clock_speed_khz = 2147473647; + logical_info1->scaling_max_frequency_khz = 1073764046; + logical_info1->scaling_current_frequency_khz = 536904245; + // Idle time cannot be tested in browser test, because it requires USER_HZ + // system constant to convert idle_time_user_hz to milliseconds. + logical_info1->idle_time_user_hz = 0; + logical_info1->c_states.push_back(std::move(c_state1)); + logical_info1->c_states.push_back(std::move(c_state2)); + + auto logical_info2 = chromeos::cros_healthd::mojom::LogicalCpuInfo::New(); + logical_info2->max_clock_speed_khz = 1147494759; + logical_info2->scaling_max_frequency_khz = 1063764046; + logical_info2->scaling_current_frequency_khz = 936904246; + // Idle time cannot be tested in browser test, because it requires USER_HZ + // system constant to convert idle_time_user_hz to milliseconds. + logical_info2->idle_time_user_hz = 0; + + auto physical_info1 = + chromeos::cros_healthd::mojom::PhysicalCpuInfo::New(); + physical_info1->model_name = "i9"; + physical_info1->logical_cpus.push_back(std::move(logical_info1)); + physical_info1->logical_cpus.push_back(std::move(logical_info2)); + + auto logical_info3 = chromeos::cros_healthd::mojom::LogicalCpuInfo::New(); + logical_info3->max_clock_speed_khz = 1247494759; + logical_info3->scaling_max_frequency_khz = 1263764046; + logical_info3->scaling_current_frequency_khz = 946904246; + // Idle time cannot be tested in browser test, because it requires USER_HZ + // system constant to convert idle_time_user_hz to milliseconds. + logical_info3->idle_time_user_hz = 0; + + auto physical_info2 = + chromeos::cros_healthd::mojom::PhysicalCpuInfo::New(); + physical_info2->model_name = "i9-low-powered"; + physical_info2->logical_cpus.push_back(std::move(logical_info3)); + + auto cpu_info = chromeos::cros_healthd::mojom::CpuInfo::New(); + cpu_info->num_total_threads = 2147483647; + cpu_info->architecture = + chromeos::cros_healthd::mojom::CpuArchitectureEnum::kArmv7l; + cpu_info->physical_cpus.push_back(std::move(physical_info1)); + cpu_info->physical_cpus.push_back(std::move(physical_info2)); + + telemetry_info->cpu_result = + chromeos::cros_healthd::mojom::CpuResult::NewCpuInfo( + std::move(cpu_info)); + } + + ASSERT_TRUE(cros_healthd::FakeCrosHealthdClient::Get()); + + cros_healthd::FakeCrosHealthdClient::Get() + ->SetProbeTelemetryInfoResponseForTesting(telemetry_info); + } + + CreateExtensionAndRunServiceWorker(R"( + chrome.test.runTests([ + async function getCpuInfo() { + const result = await chrome.os.telemetry.getCpuInfo(); + + chrome.test.assertEq( + // The dictionary members are ordered lexicographically by the Unicode + // codepoints that comprise their identifiers. + { + 'architecture': 'armv7l', + 'numTotalThreads': 2147483647, + 'physicalCpus': [{ + 'logicalCpus': [{ + 'cStates': [{ + 'name': 'C1', + 'timeInStateSinceLastBootUs': 1125899906875957, + }, + { + 'name': 'C2', + 'timeInStateSinceLastBootUs': 1125899906877777, + }], + 'idleTimeMs': 0, + 'maxClockSpeedKhz': 2147473647, + 'scalingCurrentFrequencyKhz': 536904245, + 'scalingMaxFrequencyKhz': 1073764046, + }, { + 'cStates': [], + 'idleTimeMs': 0, + 'maxClockSpeedKhz': 1147494759, + 'scalingCurrentFrequencyKhz': 936904246, + 'scalingMaxFrequencyKhz': 1063764046, + }], + 'modelName': 'i9', + }, { + 'logicalCpus': [{ + 'cStates': [], + 'idleTimeMs': 0, + 'maxClockSpeedKhz': 1247494759, + 'scalingCurrentFrequencyKhz': 946904246, + 'scalingMaxFrequencyKhz': 1263764046, + }], + 'modelName': 'i9-low-powered', + }], + }, result); + + chrome.test.succeed(); + } + ]); + )"); +} + class TelemetryExtensionTelemetryApiWithoutSerialNumberBrowserTest : public TelemetryExtensionTelemetryApiBrowserTest { public:
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.cc b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.cc new file mode 100644 index 0000000..4d134573 --- /dev/null +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.cc
@@ -0,0 +1,97 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h" + +#include <inttypes.h> + +#include <memory> +#include <string> +#include <utility> +#include <vector> + +#include "ash/webui/telemetry_extension_ui/mojom/probe_service.mojom.h" +#include "base/notreached.h" +#include "chrome/common/chromeos/extensions/api/telemetry.h" + +namespace chromeos { +namespace converters { + +namespace { + +namespace telemetry_api = ::chromeos::api::os_telemetry; +namespace telemetry_service = ::ash::health::mojom; + +} // namespace + +namespace unchecked { + +telemetry_api::CpuCStateInfo UncheckedConvertPtr( + telemetry_service::CpuCStateInfoPtr input) { + telemetry_api::CpuCStateInfo result; + if (input->name.has_value()) { + result.name = std::make_unique<std::string>(input->name.value()); + } + if (input->time_in_state_since_last_boot_us) { + result.time_in_state_since_last_boot_us = std::make_unique<double_t>( + input->time_in_state_since_last_boot_us->value); + } + return result; +} + +telemetry_api::LogicalCpuInfo UncheckedConvertPtr( + telemetry_service::LogicalCpuInfoPtr input) { + telemetry_api::LogicalCpuInfo result; + if (input->max_clock_speed_khz) { + result.max_clock_speed_khz = + std::make_unique<int32_t>(input->max_clock_speed_khz->value); + } + if (input->scaling_max_frequency_khz) { + result.scaling_max_frequency_khz = + std::make_unique<int32_t>(input->scaling_max_frequency_khz->value); + } + if (input->scaling_current_frequency_khz) { + result.scaling_current_frequency_khz = + std::make_unique<int32_t>(input->scaling_current_frequency_khz->value); + } + if (input->idle_time_ms) { + result.idle_time_ms = + std::make_unique<double_t>(input->idle_time_ms->value); + } + result.c_states = ConvertPtrVector<telemetry_api::CpuCStateInfo>( + std::move(input->c_states)); + return result; +} + +telemetry_api::PhysicalCpuInfo UncheckedConvertPtr( + telemetry_service::PhysicalCpuInfoPtr input) { + telemetry_api::PhysicalCpuInfo result; + if (input->model_name.has_value()) { + result.model_name = + std::make_unique<std::string>(input->model_name.value()); + } + result.logical_cpus = ConvertPtrVector<telemetry_api::LogicalCpuInfo>( + std::move(input->logical_cpus)); + return result; +} + +} // namespace unchecked + +telemetry_api::CpuArchitectureEnum Convert( + telemetry_service::CpuArchitectureEnum input) { + switch (input) { + case telemetry_service::CpuArchitectureEnum::kUnknown: + return telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_UNKNOWN; + case telemetry_service::CpuArchitectureEnum::kX86_64: + return telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_X86_64; + case telemetry_service::CpuArchitectureEnum::kAArch64: + return telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_AARCH64; + case telemetry_service::CpuArchitectureEnum::kArmv7l: + return telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_ARMV7L; + } + NOTREACHED(); +} + +} // namespace converters +} // namespace chromeos
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h new file mode 100644 index 0000000..31c285b --- /dev/null +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h
@@ -0,0 +1,61 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_TELEMETRY_API_CONVERTERS_H_ +#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_TELEMETRY_API_CONVERTERS_H_ + +#include <utility> +#include <vector> + +#include "ash/webui/telemetry_extension_ui/mojom/probe_service.mojom.h" +#include "base/check.h" +#include "chrome/common/chromeos/extensions/api/telemetry.h" + +namespace chromeos { + +namespace converters { + +// This file contains helper functions used by telemetry_api.cc to convert its +// types to/from telemetry service types. + +namespace unchecked { + +// Functions in unchecked namespace do not verify whether input pointer is +// nullptr, they should be called only via ConvertPtr wrapper that checks +// whether input pointer is nullptr. + +chromeos::api::os_telemetry::CpuCStateInfo UncheckedConvertPtr( + ash::health::mojom::CpuCStateInfoPtr input); + +chromeos::api::os_telemetry::LogicalCpuInfo UncheckedConvertPtr( + ash::health::mojom::LogicalCpuInfoPtr input); + +chromeos::api::os_telemetry::PhysicalCpuInfo UncheckedConvertPtr( + ash::health::mojom::PhysicalCpuInfoPtr input); + +} // namespace unchecked + +chromeos::api::os_telemetry::CpuArchitectureEnum Convert( + ash::health::mojom::CpuArchitectureEnum input); + +template <class OutputT, class InputT> +std::vector<OutputT> ConvertPtrVector(std::vector<InputT> input) { + std::vector<OutputT> output; + for (auto&& element : input) { + DCHECK(!element.is_null()); + output.push_back(unchecked::UncheckedConvertPtr(std::move(element))); + } + return output; +} + +template <class OutputT, class InputT> +OutputT ConvertPtr(InputT input) { + return (!input.is_null()) ? unchecked::UncheckedConvertPtr(std::move(input)) + : OutputT(); +} + +} // namespace converters +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_TELEMETRY_API_TELEMETRY_API_CONVERTERS_H_
diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters_unittest.cc b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters_unittest.cc new file mode 100644 index 0000000..e5aeb34f5 --- /dev/null +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters_unittest.cc
@@ -0,0 +1,126 @@ +// 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 <inttypes.h> + +#include <memory> +#include <string> +#include <utility> +#include <vector> + +#include "ash/webui/telemetry_extension_ui/mojom/probe_service.mojom.h" +#include "chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h" +#include "chrome/common/chromeos/extensions/api/telemetry.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace chromeos { + +namespace { + +namespace telemetry_api = ::chromeos::api::os_telemetry; +namespace telemetry_service = ::ash::health::mojom; + +} // namespace + +namespace converters { + +TEST(TelemetryApiConverters, CpuArchitectureEnum) { + EXPECT_EQ(telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_UNKNOWN, + Convert(telemetry_service::CpuArchitectureEnum::kUnknown)); + EXPECT_EQ(telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_X86_64, + Convert(telemetry_service::CpuArchitectureEnum::kX86_64)); + EXPECT_EQ(telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_AARCH64, + Convert(telemetry_service::CpuArchitectureEnum::kAArch64)); + EXPECT_EQ(telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_ARMV7L, + Convert(telemetry_service::CpuArchitectureEnum::kArmv7l)); +} + +TEST(TelemetryApiConverters, CpuCStateInfo) { + constexpr char kName[] = "C0"; + constexpr uint64_t kTimeInStateSinceLastBootUs = 123456; + + auto input = telemetry_service::CpuCStateInfo::New( + kName, telemetry_service::UInt64Value::New(kTimeInStateSinceLastBootUs)); + + auto result = ConvertPtr<telemetry_api::CpuCStateInfo>(std::move(input)); + EXPECT_EQ(kName, *result.name); + EXPECT_EQ(kTimeInStateSinceLastBootUs, + *result.time_in_state_since_last_boot_us); +} + +TEST(TelemetryApiConverters, LogicalCpuInfo) { + constexpr char kCpuCStateName[] = "C1"; + constexpr uint64_t kCpuCStateTime = (1 << 27) + 50000; + + std::vector<telemetry_service::CpuCStateInfoPtr> expected_c_states; + expected_c_states.push_back(telemetry_service::CpuCStateInfo::New( + kCpuCStateName, telemetry_service::UInt64Value::New(kCpuCStateTime))); + + constexpr uint32_t kMaxClockSpeedKhz = (1 << 30) + 10000; + constexpr uint32_t kScalingMaxFrequencyKhz = (1 << 30) + 20000; + constexpr uint32_t kScalingCurrentFrequencyKhz = (1 << 29) + 30000; + constexpr uint64_t kIdleTime = (1ULL << 52) + 40000; + + auto input = telemetry_service::LogicalCpuInfo::New( + telemetry_service::UInt32Value::New(kMaxClockSpeedKhz), + telemetry_service::UInt32Value::New(kScalingMaxFrequencyKhz), + telemetry_service::UInt32Value::New(kScalingCurrentFrequencyKhz), + telemetry_service::UInt64Value::New(kIdleTime), + std::move(expected_c_states)); + + auto result = ConvertPtr<telemetry_api::LogicalCpuInfo>(std::move(input)); + EXPECT_EQ(kMaxClockSpeedKhz, *result.max_clock_speed_khz); + EXPECT_EQ(kScalingMaxFrequencyKhz, *result.scaling_max_frequency_khz); + EXPECT_EQ(kScalingCurrentFrequencyKhz, *result.scaling_current_frequency_khz); + EXPECT_EQ(kIdleTime, *result.idle_time_ms); + EXPECT_EQ(1, result.c_states.size()); + EXPECT_EQ(kCpuCStateName, *result.c_states[0].name); + EXPECT_EQ(kCpuCStateTime, + *result.c_states[0].time_in_state_since_last_boot_us); +} + +TEST(TelemetryApiConverters, PhysicalCpuInfo) { + constexpr char kCpuCStateName[] = "C2"; + constexpr uint64_t kCpuCStateTime = (1 << 27) + 90000; + + std::vector<telemetry_service::CpuCStateInfoPtr> expected_c_states; + expected_c_states.push_back(telemetry_service::CpuCStateInfo::New( + kCpuCStateName, telemetry_service::UInt64Value::New(kCpuCStateTime))); + + constexpr uint32_t kMaxClockSpeedKhz = (1 << 30) + 80000; + constexpr uint32_t kScalingMaxFrequencyKhz = (1 << 30) + 70000; + constexpr uint32_t kScalingCurrentFrequencyKhz = (1 << 29) + 60000; + constexpr uint64_t kIdleTime = (1ULL << 52) + 50000; + + std::vector<telemetry_service::LogicalCpuInfoPtr> logical_cpus; + logical_cpus.push_back(telemetry_service::LogicalCpuInfo::New( + telemetry_service::UInt32Value::New(kMaxClockSpeedKhz), + telemetry_service::UInt32Value::New(kScalingMaxFrequencyKhz), + telemetry_service::UInt32Value::New(kScalingCurrentFrequencyKhz), + telemetry_service::UInt64Value::New(kIdleTime), + std::move(expected_c_states))); + + constexpr char kModelName[] = "i9"; + + auto input = telemetry_service::PhysicalCpuInfo::New(kModelName, + std::move(logical_cpus)); + + auto result = ConvertPtr<telemetry_api::PhysicalCpuInfo>(std::move(input)); + EXPECT_EQ(kModelName, *result.model_name); + EXPECT_EQ(1, result.logical_cpus.size()); + EXPECT_EQ(kMaxClockSpeedKhz, *result.logical_cpus[0].max_clock_speed_khz); + EXPECT_EQ(kScalingMaxFrequencyKhz, + *result.logical_cpus[0].scaling_max_frequency_khz); + EXPECT_EQ(kScalingCurrentFrequencyKhz, + *result.logical_cpus[0].scaling_current_frequency_khz); + EXPECT_EQ(kIdleTime, *result.logical_cpus[0].idle_time_ms); + EXPECT_EQ(1, result.logical_cpus[0].c_states.size()); + EXPECT_EQ(kCpuCStateName, *result.logical_cpus[0].c_states[0].name); + EXPECT_EQ( + kCpuCStateTime, + *result.logical_cpus[0].c_states[0].time_in_state_since_last_boot_us); +} + +} // namespace converters +} // namespace chromeos
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_api_interactive_test.cc b/chrome/browser/extensions/api/omnibox/omnibox_api_interactive_test.cc index 61b0579..bb0e04c7 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_api_interactive_test.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_api_interactive_test.cc
@@ -357,8 +357,8 @@ } // Tests deleting a deletable omnibox extension suggestion result. -// Flaky on Windows. https://crbug.com/801316 -#if BUILDFLAG(IS_WIN) +// Flaky on Windows and Linux TSan. https://crbug.com/1287949 +#if BUILDFLAG(IS_WIN) || (defined(OS_LINUX) && defined(THREAD_SANITIZER)) #define MAYBE_DeleteOmniboxSuggestionResult \ DISABLED_DeleteOmniboxSuggestionResult #else
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.cc index 785cbfa..77d3095 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.cc
@@ -9,6 +9,7 @@ namespace web_navigation_api_constants { const char kErrorKey[] = "error"; +const char kDocumentIdKey[] = "documentId"; const char kFrameIdKey[] = "frameId"; const char kParentFrameIdKey[] = "parentFrameId"; const char kProcessIdKey[] = "processId";
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.h b/chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.h index d0d28744..3ab39913 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.h +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api_constants.h
@@ -13,6 +13,7 @@ // Keys. extern const char kErrorKey[]; +extern const char kDocumentIdKey[]; extern const char kFrameIdKey[]; extern const char kParentFrameIdKey[]; extern const char kProcessIdKey[];
diff --git a/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc b/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc index 6d3a9f3..78d5087 100644 --- a/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc +++ b/chrome/browser/extensions/api/web_navigation/web_navigation_api_helpers.cc
@@ -70,6 +70,9 @@ ExtensionTabUtil::GetTabId(navigation_handle->GetWebContents()); details.url = url.spec(); details.process_id = -1; + // There is no documentId for this event because the document has not + // been created yet. It will first appear in the OnCommitted event. The + // frameId can be used to associate OnBeforeNavigate and OnCommitted together. details.frame_id = ExtensionApiFrameIdMap::GetFrameId(navigation_handle); details.parent_frame_id = ExtensionApiFrameIdMap::GetParentFrameId(navigation_handle); @@ -110,6 +113,8 @@ ExtensionApiFrameIdMap::GetFrameId(frame_host)); dict->SetInteger(web_navigation_api_constants::kParentFrameIdKey, ExtensionApiFrameIdMap::GetParentFrameId(frame_host)); + dict->SetString(web_navigation_api_constants::kDocumentIdKey, + ExtensionApiFrameIdMap::GetDocumentId(frame_host).ToString()); if (navigation_handle->WasServerRedirect()) { transition_type = ui::PageTransitionFromInt( @@ -159,6 +164,8 @@ details.frame_id = ExtensionApiFrameIdMap::GetFrameId(frame_host); details.parent_frame_id = ExtensionApiFrameIdMap::GetParentFrameId(frame_host); + details.document_id = + ExtensionApiFrameIdMap::GetDocumentId(frame_host).ToString(); details.time_stamp = MilliSecondsFromTime(base::Time::Now()); content::BrowserContext* browser_context = web_contents->GetBrowserContext(); @@ -180,6 +187,8 @@ details.frame_id = ExtensionApiFrameIdMap::GetFrameId(frame_host); details.parent_frame_id = ExtensionApiFrameIdMap::GetParentFrameId(frame_host); + details.document_id = + ExtensionApiFrameIdMap::GetDocumentId(frame_host).ToString(); details.time_stamp = MilliSecondsFromTime(base::Time::Now()); content::BrowserContext* browser_context = web_contents->GetBrowserContext(); @@ -240,6 +249,8 @@ details.parent_frame_id = ExtensionApiFrameIdMap::GetParentFrameId(frame_host); details.error = net::ErrorToString(error_code); + details.document_id = + ExtensionApiFrameIdMap::GetDocumentId(frame_host).ToString(); details.time_stamp = MilliSecondsFromTime(base::Time::Now()); content::BrowserContext* browser_context = web_contents->GetBrowserContext(); @@ -263,6 +274,8 @@ details.error = (navigation_handle->GetNetErrorCode() != net::OK) ? net::ErrorToString(navigation_handle->GetNetErrorCode()) : net::ErrorToString(net::ERR_ABORTED); + details.document_id = + ExtensionApiFrameIdMap::GetDocumentId(navigation_handle).ToString(); details.time_stamp = MilliSecondsFromTime(base::Time::Now()); content::BrowserContext* browser_context =
diff --git a/chrome/browser/extensions/tab_helper.cc b/chrome/browser/extensions/tab_helper.cc index 8ff6a58..37939d9 100644 --- a/chrome/browser/extensions/tab_helper.cc +++ b/chrome/browser/extensions/tab_helper.cc
@@ -187,8 +187,8 @@ // The ActiveTabPermissionManager requires a session ID; ensure this // WebContents has one. CreateSessionServiceTabHelper(web_contents); - // The Unretained() is safe because ForEachFrame() is synchronous. - web_contents->ForEachFrame( + // The Unretained() is safe because ForEachRenderFrameHost() is synchronous. + web_contents->ForEachRenderFrameHost( base::BindRepeating(&TabHelper::SetTabId, base::Unretained(this))); active_tab_permission_granter_ = std::make_unique<ActiveTabPermissionGranter>( web_contents, sessions::SessionTabHelper::IdForTab(web_contents).id(),
diff --git a/chrome/browser/media/webrtc/webrtc_mediadevices_interactive_uitest.cc b/chrome/browser/media/webrtc/webrtc_mediadevices_interactive_uitest.cc index e23839cd..f9f581d2 100644 --- a/chrome/browser/media/webrtc/webrtc_mediadevices_interactive_uitest.cc +++ b/chrome/browser/media/webrtc/webrtc_mediadevices_interactive_uitest.cc
@@ -212,7 +212,8 @@ ASSERT_TRUE(embedded_test_server()->Start()); GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); - AddTabAtIndexToBrowser(browser(), 1, url, ui::PAGE_TRANSITION_LINK, true); + ASSERT_TRUE(AddTabAtIndexToBrowser(browser(), 1, url, + ui::PAGE_TRANSITION_LINK, true)); content::WebContents* focused_tab = browser()->tab_strip_model()->GetWebContentsAt(1); @@ -228,7 +229,8 @@ ASSERT_TRUE(embedded_test_server()->Start()); GURL url(embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); - AddTabAtIndexToBrowser(browser(), 1, url, ui::PAGE_TRANSITION_LINK, true); + ASSERT_TRUE(AddTabAtIndexToBrowser(browser(), 1, url, + ui::PAGE_TRANSITION_LINK, true)); content::WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0); GetUserMediaReturnsFalseIfWaitIsTooLong(tab, kAudioVideoCallConstraints);
diff --git a/chrome/browser/net/profile_network_context_service.cc b/chrome/browser/net/profile_network_context_service.cc index a57c77f..ffe852e 100644 --- a/chrome/browser/net/profile_network_context_service.cc +++ b/chrome/browser/net/profile_network_context_service.cc
@@ -63,6 +63,11 @@ #include "services/network/public/mojom/network_service.mojom.h" #include "third_party/blink/public/common/features.h" +#if BUILDFLAG(IS_CHROMEOS) +#include "chrome/browser/policy/networking/policy_cert_service.h" +#include "chrome/browser/policy/networking/policy_cert_service_factory.h" +#endif + #if BUILDFLAG(IS_CHROMEOS_ASH) #include "ash/constants/ash_features.h" #include "ash/constants/ash_switches.h" @@ -71,8 +76,6 @@ #include "chrome/browser/ash/certificate_provider/certificate_provider_service_factory.h" #include "chrome/browser/ash/net/client_cert_store_ash.h" #include "chrome/browser/ash/profiles/profile_helper.h" -#include "chrome/browser/policy/networking/policy_cert_service.h" -#include "chrome/browser/policy/networking/policy_cert_service_factory.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" @@ -129,7 +132,7 @@ return net::HttpUtil::GenerateAcceptLanguageHeader(accept_languages_str); } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) network::mojom::AdditionalCertificatesPtr GetAdditionalCertificates( const policy::PolicyCertService* policy_cert_service, const base::FilePath& storage_partition_path) { @@ -145,8 +148,8 @@ // profile type. bool IsAmbientAuthAllowedForProfile(Profile* profile) { // Ambient authentication is always enabled for regular and system profiles. - // System profiles (used in profile picker) may require authentication to let - // user login. + // System profiles (used in profile picker) may require authentication to + // let user login. if (profile->IsRegularProfile() || profile->IsSystemProfile()) return true; @@ -308,7 +311,7 @@ } } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void ProfileNetworkContextService::UpdateAdditionalCertificates() { const policy::PolicyCertService* policy_cert_service = policy::PolicyCertServiceFactory::GetForProfile(profile_); @@ -655,6 +658,21 @@ current_field_trial_status != previous_field_trial_status; } +#if BUILDFLAG(IS_CHROMEOS) +void ProfileNetworkContextService::PopulateInitialAdditionalCerts( + const base::FilePath& relative_partition_path, + network::mojom::NetworkContextParams* network_context_params) { + if (policy::PolicyCertServiceFactory::CreateAndStartObservingForProfile( + profile_)) { + const policy::PolicyCertService* policy_cert_service = + policy::PolicyCertServiceFactory::GetForProfile(profile_); + network_context_params->initial_additional_certificates = + GetAdditionalCertificates(policy_cert_service, + GetPartitionPath(relative_partition_path)); + } +} +#endif // BUILDFLAG(IS_CHROMEOS) + void ProfileNetworkContextService::ConfigureNetworkContextParamsInternal( bool in_memory, const base::FilePath& relative_partition_path, @@ -866,6 +884,11 @@ metrics::prefs::kMetricsReportingEnabled); } +#if BUILDFLAG(IS_CHROMEOS_LACROS) + PopulateInitialAdditionalCerts(relative_partition_path, + network_context_params); +#endif + #if BUILDFLAG(IS_CHROMEOS_ASH) bool profile_supports_policy_certs = false; if (ash::ProfileHelper::IsSigninProfile(profile_)) @@ -884,14 +907,9 @@ profile_supports_policy_certs = true; } } - if (profile_supports_policy_certs && - policy::PolicyCertServiceFactory::CreateAndStartObservingForProfile( - profile_)) { - const policy::PolicyCertService* policy_cert_service = - policy::PolicyCertServiceFactory::GetForProfile(profile_); - network_context_params->initial_additional_certificates = - GetAdditionalCertificates(policy_cert_service, - GetPartitionPath(relative_partition_path)); + if (profile_supports_policy_certs) { + PopulateInitialAdditionalCerts(relative_partition_path, + network_context_params); } // Disable idle sockets close on memory pressure if configured by finch or // about://flags.
diff --git a/chrome/browser/net/profile_network_context_service.h b/chrome/browser/net/profile_network_context_service.h index 4d2b2b2..8e0ebc6 100644 --- a/chrome/browser/net/profile_network_context_service.h +++ b/chrome/browser/net/profile_network_context_service.h
@@ -76,7 +76,7 @@ cert_verifier::mojom::CertVerifierCreationParams* cert_verifier_creation_params); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void UpdateAdditionalCertificates(); #endif @@ -158,6 +158,12 @@ base::FilePath GetPartitionPath( const base::FilePath& relative_partition_path); + // Populates |network_context_params| with initial additional server and + // authority certificates for |relative_partition_path|. + void PopulateInitialAdditionalCerts( + const base::FilePath& relative_partition_path, + network::mojom::NetworkContextParams* network_context_params); + // content_settings::Observer: void OnContentSettingChanged(const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern,
diff --git a/chrome/browser/password_manager/android/BUILD.gn b/chrome/browser/password_manager/android/BUILD.gn index a5ec3d4..dcf018b 100644 --- a/chrome/browser/password_manager/android/BUILD.gn +++ b/chrome/browser/password_manager/android/BUILD.gn
@@ -27,6 +27,8 @@ sources = [ "android_backend_error.cc", "android_backend_error.h", + "password_manager_lifecycle_helper.cc", + "password_manager_lifecycle_helper.h", "password_store_android_backend.cc", "password_store_android_backend.h", "password_store_android_backend_bridge.h", @@ -81,6 +83,7 @@ sources = [ "java/src/org/chromium/chrome/browser/password_manager/ConfirmationDialogHelper.java", "java/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelper.java", + "java/src/org/chromium/chrome/browser/password_manager/PasswordManagerLifecycleHelper.java", "java/src/org/chromium/chrome/browser/password_manager/PasswordScriptsFetcherBridge.java", "java/src/org/chromium/chrome/browser/password_manager/PasswordStoreAndroidBackendBridgeImpl.java", "java/src/org/chromium/chrome/browser/password_manager/PasswordStoreBridge.java", @@ -101,6 +104,7 @@ "//chrome/browser", ] sources = [ + "java/src/org/chromium/chrome/browser/password_manager/PasswordManagerLifecycleHelper.java", "java/src/org/chromium/chrome/browser/password_manager/PasswordScriptsFetcherBridge.java", "java/src/org/chromium/chrome/browser/password_manager/PasswordStoreAndroidBackendBridgeImpl.java", "java/src/org/chromium/chrome/browser/password_manager/PasswordStoreBridge.java", @@ -113,6 +117,7 @@ sources = [ "junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerHelperTest.java", + "junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerLifecycleHelperTest.java", "junit/src/org/chromium/chrome/browser/password_manager/PasswordStoreAndroidBackendBridgeTest.java", "junit/src/org/chromium/chrome/browser/password_manager/settings/PasswordReauthenticationFragmentTest.java", "junit/src/org/chromium/chrome/browser/password_manager/settings/ReauthenticationManagerTest.java",
diff --git a/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerLifecycleHelper.java b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerLifecycleHelper.java new file mode 100644 index 0000000..fdf7c47 --- /dev/null +++ b/chrome/browser/password_manager/android/java/src/org/chromium/chrome/browser/password_manager/PasswordManagerLifecycleHelper.java
@@ -0,0 +1,62 @@ +// 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.password_manager; + +import androidx.annotation.VisibleForTesting; + +import org.chromium.base.ObserverList; +import org.chromium.base.annotations.CalledByNative; +import org.chromium.base.annotations.NativeMethods; + +/** + * This helper forwards lifecycle events to password manager classes. + */ +public class PasswordManagerLifecycleHelper { + private static PasswordManagerLifecycleHelper sInstance; + private ObserverList<Long> mNativeObservers = new ObserverList<>(); + + /** + * Returns the singleton instance of this class and lazily creates it if that hasn't happened. + * + * @return The only {@link PasswordManagerLifecycleHelper}. + */ + @CalledByNative + public static PasswordManagerLifecycleHelper getInstance() { + if (sInstance == null) sInstance = new PasswordManagerLifecycleHelper(); + return sInstance; + } + + /** + * Notifies all observers that a foreground session has begun. + */ + public void onStartForegroundSession() { + for (Long observer : mNativeObservers) { + assert observer != 0; + PasswordManagerLifecycleHelperJni.get().onForegroundSessionStart(observer); + } + } + + @CalledByNative + @VisibleForTesting + void registerObserver(long nativePasswordManagerLifecycleHelper) { + mNativeObservers.addObserver(nativePasswordManagerLifecycleHelper); + } + + @CalledByNative + @VisibleForTesting + void unregisterObserver(long nativePasswordManagerLifecycleHelper) { + mNativeObservers.removeObserver(nativePasswordManagerLifecycleHelper); + } + + private PasswordManagerLifecycleHelper() {} + + /** + * C++ method signatures. + */ + @NativeMethods + interface Natives { + void onForegroundSessionStart(long nativePasswordManagerLifecycleHelper); + } +}
diff --git a/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerLifecycleHelperTest.java b/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerLifecycleHelperTest.java new file mode 100644 index 0000000..f454f84 --- /dev/null +++ b/chrome/browser/password_manager/android/junit/src/org/chromium/chrome/browser/password_manager/PasswordManagerLifecycleHelperTest.java
@@ -0,0 +1,71 @@ +// 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.password_manager; + +import static org.junit.Assert.assertSame; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.robolectric.annotation.Config; + +import org.chromium.base.test.BaseRobolectricTestRunner; +import org.chromium.base.test.util.Batch; +import org.chromium.base.test.util.JniMocker; + +/** + * Test class for {@link PasswordManagerLifecycleHelper}. + */ +@RunWith(BaseRobolectricTestRunner.class) +@Config(manifest = Config.NONE) +@Batch(Batch.PER_CLASS) +public class PasswordManagerLifecycleHelperTest { + private static final long sDummyNativePointer = 96024; + + @Rule + public JniMocker mJniMocker = new JniMocker(); + + @Mock + private PasswordManagerLifecycleHelper.Natives mBridgeJniMock; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + mJniMocker.mock(PasswordManagerLifecycleHelperJni.TEST_HOOKS, mBridgeJniMock); + } + + @Test + public void testReuseInstance() { + assertSame(PasswordManagerLifecycleHelper.getInstance(), + PasswordManagerLifecycleHelper.getInstance()); + } + + @Test + public void testSendNoNotificationWithoutObservers() { + PasswordManagerLifecycleHelper.getInstance().onStartForegroundSession(); + verifyNoMoreInteractions(mBridgeJniMock); + } + + @Test + public void testNotifyForegroundSessionStart() { + PasswordManagerLifecycleHelper.getInstance().registerObserver(sDummyNativePointer); + PasswordManagerLifecycleHelper.getInstance().onStartForegroundSession(); + verify(mBridgeJniMock).onForegroundSessionStart(sDummyNativePointer); + } + + @Test + public void testDonNotifyAfterUnregister() { + PasswordManagerLifecycleHelper.getInstance().registerObserver(sDummyNativePointer); + PasswordManagerLifecycleHelper.getInstance().unregisterObserver(sDummyNativePointer); + PasswordManagerLifecycleHelper.getInstance().onStartForegroundSession(); + verify(mBridgeJniMock, never()).onForegroundSessionStart(sDummyNativePointer); + } +}
diff --git a/chrome/browser/password_manager/android/password_manager_lifecycle_helper.cc b/chrome/browser/password_manager/android/password_manager_lifecycle_helper.cc new file mode 100644 index 0000000..1420f50 --- /dev/null +++ b/chrome/browser/password_manager/android/password_manager_lifecycle_helper.cc
@@ -0,0 +1,33 @@ +// 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/password_manager/android/password_manager_lifecycle_helper.h" + +#include <jni.h> +#include <cstdint> +#include <utility> + +#include "base/android/jni_android.h" +#include "chrome/browser/password_manager/android/jni_headers/PasswordManagerLifecycleHelper_jni.h" + +PasswordManagerLifecycleHelper::PasswordManagerLifecycleHelper( + base::RepeatingClosure foregrounding_callback) { + java_object_ = Java_PasswordManagerLifecycleHelper_getInstance( + base::android::AttachCurrentThread()); + foregrounding_callback_ = std::move(foregrounding_callback); + Java_PasswordManagerLifecycleHelper_registerObserver( + base::android::AttachCurrentThread(), java_object_, + reinterpret_cast<intptr_t>(this)); +} + +PasswordManagerLifecycleHelper::~PasswordManagerLifecycleHelper() { + Java_PasswordManagerLifecycleHelper_unregisterObserver( + base::android::AttachCurrentThread(), java_object_, + reinterpret_cast<intptr_t>(this)); +} + +void PasswordManagerLifecycleHelper::OnForegroundSessionStart(JNIEnv* env) { + DCHECK(foregrounding_callback_); + foregrounding_callback_.Run(); +}
diff --git a/chrome/browser/password_manager/android/password_manager_lifecycle_helper.h b/chrome/browser/password_manager/android/password_manager_lifecycle_helper.h new file mode 100644 index 0000000..08315eb --- /dev/null +++ b/chrome/browser/password_manager/android/password_manager_lifecycle_helper.h
@@ -0,0 +1,42 @@ +// 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_PASSWORD_MANAGER_ANDROID_PASSWORD_MANAGER_LIFECYCLE_HELPER_H_ +#define CHROME_BROWSER_PASSWORD_MANAGER_ANDROID_PASSWORD_MANAGER_LIFECYCLE_HELPER_H_ + +#include "base/android/scoped_java_ref.h" +#include "base/callback.h" // callback_forward doesn't suffice for members. + +// This helper listens to Android lifecycle events like OnForegroundSessionStart +// and calls a registered callback synchronously if it occurs. +// Lifecycle events are not buffered or repeated — if the helper was added after +// an event happened, it will not be triggered. +class PasswordManagerLifecycleHelper { + public: + // The passed `foregrounding_callback` is called synchronously every time + // chrome starts a foreground session (see `OnForegroundSessionStart` below). + explicit PasswordManagerLifecycleHelper( + base::RepeatingClosure foregrounding_callback); + ~PasswordManagerLifecycleHelper(); + PasswordManagerLifecycleHelper(PasswordManagerLifecycleHelper&&) = delete; + PasswordManagerLifecycleHelper(const PasswordManagerLifecycleHelper&) = + delete; + PasswordManagerLifecycleHelper& operator=(PasswordManagerLifecycleHelper&&) = + delete; + PasswordManagerLifecycleHelper& operator=( + const PasswordManagerLifecycleHelper&) = delete; + + // Called via JNI. Called when chrome starts a top-level activity if none + // has been in the foreground yet. Check the java implementation at + // ChromeActivitySessionTrack#onForegroundSessionStart for more details. + void OnForegroundSessionStart(JNIEnv* env); + + private: + base::RepeatingClosure foregrounding_callback_; + + // Reference to the singleton instance of the Java counterpart of this class. + base::android::ScopedJavaGlobalRef<jobject> java_object_; +}; + +#endif // CHROME_BROWSER_PASSWORD_MANAGER_ANDROID_PASSWORD_MANAGER_LIFECYCLE_HELPER_H_
diff --git a/chrome/browser/password_manager/multi_profile_credentials_filter_unittest.cc b/chrome/browser/password_manager/multi_profile_credentials_filter_unittest.cc index 3691b90..0181558 100644 --- a/chrome/browser/password_manager/multi_profile_credentials_filter_unittest.cc +++ b/chrome/browser/password_manager/multi_profile_credentials_filter_unittest.cc
@@ -43,7 +43,9 @@ base::OnceCallback<void(SigninInterceptionResult)> callback) override { return nullptr; } - void ShowProfileCustomizationBubble(Browser* browser) override {} + void ShowFirstRunExperienceInNewProfile( + Browser* browser, + const CoreAccountId& account_id) override {} }; class TestPasswordManagerClient
diff --git a/chrome/browser/password_manager/password_generation_interactive_uitest.cc b/chrome/browser/password_manager/password_generation_interactive_uitest.cc index 3891adc..955a8e7 100644 --- a/chrome/browser/password_manager/password_generation_interactive_uitest.cc +++ b/chrome/browser/password_manager/password_generation_interactive_uitest.cc
@@ -408,8 +408,16 @@ content::test::PrerenderTestHelper prerender_helper_; }; +// TODO(https://crbug.com/1287785): Fails on the linux-wayland-rel bot. +#if defined(OZONE_PLATFORM_WAYLAND) +#define MAYBE_PasswordGenerationPopupControllerInPrerendering \ + DISABLED_PasswordGenerationPopupControllerInPrerendering +#else +#define MAYBE_PasswordGenerationPopupControllerInPrerendering \ + PasswordGenerationPopupControllerInPrerendering +#endif IN_PROC_BROWSER_TEST_F(PasswordGenerationPopupViewPrerenderingTest, - PasswordGenerationPopupControllerInPrerendering) { + MAYBE_PasswordGenerationPopupControllerInPrerendering) { // Open popup. FocusPasswordField(); EXPECT_TRUE(GenerationPopupShowing());
diff --git a/chrome/browser/policy/BUILD.gn b/chrome/browser/policy/BUILD.gn index ebcc3427..9f77c4ab 100644 --- a/chrome/browser/policy/BUILD.gn +++ b/chrome/browser/policy/BUILD.gn
@@ -39,48 +39,62 @@ source_set("onc") { sources = [] - if (is_chromeos_ash) { + + if (is_chromeos) { sources += [ - "networking/device_network_configuration_updater_ash.cc", - "networking/device_network_configuration_updater_ash.h", "networking/network_configuration_updater.cc", "networking/network_configuration_updater.h", "networking/policy_cert_service.cc", "networking/policy_cert_service.h", "networking/policy_cert_service_factory.cc", "networking/policy_cert_service_factory.h", - "networking/user_network_configuration_updater_ash.cc", - "networking/user_network_configuration_updater_ash.h", + "networking/user_network_configuration_updater.cc", + "networking/user_network_configuration_updater.h", "networking/user_network_configuration_updater_factory.cc", "networking/user_network_configuration_updater_factory.h", ] } - deps = [] if (is_chromeos_ash) { + sources += [ + "networking/device_network_configuration_updater_ash.cc", + "networking/device_network_configuration_updater_ash.h", + "networking/user_network_configuration_updater_ash.cc", + "networking/user_network_configuration_updater_ash.h", + ] + } + + deps = [] + + if (is_chromeos) { deps += [ - "//ash/components/settings:settings", - "//ash/constants:constants", - "//base", - "//base", "//build:chromeos_buildflags", "//chrome/browser:browser_process", "//chrome/browser/extensions:extensions", "//chrome/browser/profiles:profile", "//chrome/browser/profiles:profiles", "//chrome/common:constants", - "//chromeos/components/onc:onc", - "//chromeos/network:network", - "//chromeos/system:system", - "//chromeos/tpm:tpm", + "//chromeos/components/onc", "//components/keyed_service/content:content", "//components/onc:onc", "//components/policy/core/common", - "//components/policy/core/common:common_constants", "//components/prefs:prefs", + "//extensions/browser:browser", + "//net", + ] + } + + if (is_chromeos_ash) { + deps += [ + "//ash/components/settings:settings", + "//ash/constants:constants", + "//base", + "//chromeos/network:network", + "//chromeos/system:system", + "//chromeos/tpm:tpm", + "//components/policy/core/common:common_constants", "//components/user_manager:user_manager", "//dbus", - "//extensions/browser:browser", ] } } @@ -368,21 +382,34 @@ testonly = true sources = [] - deps = [] + + if (is_chromeos) { + sources += [ "networking/network_configuration_updater_unittest.cc" ] + } if (is_chromeos_ash) { sources += [ "networking/network_configuration_updater_ash_unittest.cc", "networking/policy_cert_service_factory_ash_unittest.cc", ] + } + deps = [] + + if (is_chromeos) { deps += [ ":onc", - "//chrome/browser/chromeos:test_support", "//chrome/test:test_support", + "//chromeos/components/onc:onc", "//chromeos/components/onc:test_support", - "//chromeos/system:system", "//components/onc:onc", ] } + + if (is_chromeos_ash) { + deps += [ + "//chrome/browser/chromeos:test_support", + "//chromeos/system:system", + ] + } }
diff --git a/chrome/browser/policy/networking/device_network_configuration_updater_ash.cc b/chrome/browser/policy/networking/device_network_configuration_updater_ash.cc index 3b6b149..9b1d18b6 100644 --- a/chrome/browser/policy/networking/device_network_configuration_updater_ash.cc +++ b/chrome/browser/policy/networking/device_network_configuration_updater_ash.cc
@@ -41,37 +41,37 @@ } // namespace -DeviceNetworkConfigurationUpdater::~DeviceNetworkConfigurationUpdater() = +DeviceNetworkConfigurationUpdaterAsh::~DeviceNetworkConfigurationUpdaterAsh() = default; // static -std::unique_ptr<DeviceNetworkConfigurationUpdater> -DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( +std::unique_ptr<DeviceNetworkConfigurationUpdaterAsh> +DeviceNetworkConfigurationUpdaterAsh::CreateForDevicePolicy( PolicyService* policy_service, chromeos::ManagedNetworkConfigurationHandler* network_config_handler, chromeos::NetworkDeviceHandler* network_device_handler, ash::CrosSettings* cros_settings, - const DeviceNetworkConfigurationUpdater::DeviceAssetIDFetcher& + const DeviceNetworkConfigurationUpdaterAsh::DeviceAssetIDFetcher& device_asset_id_fetcher) { - std::unique_ptr<DeviceNetworkConfigurationUpdater> updater( - new DeviceNetworkConfigurationUpdater( + std::unique_ptr<DeviceNetworkConfigurationUpdaterAsh> updater( + new DeviceNetworkConfigurationUpdaterAsh( policy_service, network_config_handler, network_device_handler, cros_settings, device_asset_id_fetcher)); updater->Init(); return updater; } -DeviceNetworkConfigurationUpdater::DeviceNetworkConfigurationUpdater( +DeviceNetworkConfigurationUpdaterAsh::DeviceNetworkConfigurationUpdaterAsh( PolicyService* policy_service, chromeos::ManagedNetworkConfigurationHandler* network_config_handler, chromeos::NetworkDeviceHandler* network_device_handler, ash::CrosSettings* cros_settings, - const DeviceNetworkConfigurationUpdater::DeviceAssetIDFetcher& + const DeviceNetworkConfigurationUpdaterAsh::DeviceAssetIDFetcher& device_asset_id_fetcher) : NetworkConfigurationUpdater(onc::ONC_SOURCE_DEVICE_POLICY, key::kDeviceOpenNetworkConfiguration, - policy_service, - network_config_handler), + policy_service), + network_config_handler_(network_config_handler), network_device_handler_(network_device_handler), cros_settings_(cros_settings), device_asset_id_fetcher_(device_asset_id_fetcher) { @@ -79,13 +79,13 @@ data_roaming_setting_subscription_ = cros_settings->AddSettingsObserver( ash::kSignedDataRoamingEnabled, base::BindRepeating( - &DeviceNetworkConfigurationUpdater::OnDataRoamingSettingChanged, + &DeviceNetworkConfigurationUpdaterAsh::OnDataRoamingSettingChanged, base::Unretained(this))); if (device_asset_id_fetcher_.is_null()) device_asset_id_fetcher_ = base::BindRepeating(&GetDeviceAssetID); } -void DeviceNetworkConfigurationUpdater::Init() { +void DeviceNetworkConfigurationUpdaterAsh::Init() { NetworkConfigurationUpdater::Init(); // The highest authority regarding whether cellular data roaming should be @@ -106,12 +106,12 @@ !chromeos::InstallAttributes::Get()->IsEnterpriseManaged()); } -void DeviceNetworkConfigurationUpdater::ImportClientCertificates() { +void DeviceNetworkConfigurationUpdaterAsh::ImportClientCertificates() { LOG(WARNING) << "Importing client certificates from device policy is not implemented."; } -void DeviceNetworkConfigurationUpdater::ApplyNetworkPolicy( +void DeviceNetworkConfigurationUpdaterAsh::ApplyNetworkPolicy( base::ListValue* network_configs_onc, base::DictionaryValue* global_network_config) { // Ensure this is runnng on the UI thead because we're accessing global data @@ -138,10 +138,10 @@ *global_network_config); } -void DeviceNetworkConfigurationUpdater::OnDataRoamingSettingChanged() { +void DeviceNetworkConfigurationUpdaterAsh::OnDataRoamingSettingChanged() { ash::CrosSettingsProvider::TrustedStatus trusted_status = cros_settings_->PrepareTrustedValues(base::BindOnce( - &DeviceNetworkConfigurationUpdater::OnDataRoamingSettingChanged, + &DeviceNetworkConfigurationUpdaterAsh::OnDataRoamingSettingChanged, weak_factory_.GetWeakPtr())); if (trusted_status == ash::CrosSettingsProvider::TEMPORARILY_UNTRUSTED) {
diff --git a/chrome/browser/policy/networking/device_network_configuration_updater_ash.h b/chrome/browser/policy/networking/device_network_configuration_updater_ash.h index a0726b0..e8f553e 100644 --- a/chrome/browser/policy/networking/device_network_configuration_updater_ash.h +++ b/chrome/browser/policy/networking/device_network_configuration_updater_ash.h
@@ -34,14 +34,15 @@ // Implements addtional special handling of ONC device policies, which requires // listening for notifications from CrosSettings. -class DeviceNetworkConfigurationUpdater : public NetworkConfigurationUpdater { +class DeviceNetworkConfigurationUpdaterAsh + : public NetworkConfigurationUpdater { public: - DeviceNetworkConfigurationUpdater(const DeviceNetworkConfigurationUpdater&) = - delete; - DeviceNetworkConfigurationUpdater& operator=( - const DeviceNetworkConfigurationUpdater&) = delete; + DeviceNetworkConfigurationUpdaterAsh( + const DeviceNetworkConfigurationUpdaterAsh&) = delete; + DeviceNetworkConfigurationUpdaterAsh& operator=( + const DeviceNetworkConfigurationUpdaterAsh&) = delete; - ~DeviceNetworkConfigurationUpdater() override; + ~DeviceNetworkConfigurationUpdaterAsh() override; // Fetches the device's administrator-annotated asset ID. using DeviceAssetIDFetcher = base::RepeatingCallback<std::string()>; @@ -53,7 +54,7 @@ // administrator-annotated asset ID of the device and is used for variable // replacement. If a null callback is passed, the asset ID from device policy // will be used. - static std::unique_ptr<DeviceNetworkConfigurationUpdater> + static std::unique_ptr<DeviceNetworkConfigurationUpdaterAsh> CreateForDevicePolicy( PolicyService* policy_service, chromeos::ManagedNetworkConfigurationHandler* network_config_handler, @@ -62,7 +63,7 @@ const DeviceAssetIDFetcher& device_asset_id_fetcher); private: - DeviceNetworkConfigurationUpdater( + DeviceNetworkConfigurationUpdaterAsh( PolicyService* policy_service, chromeos::ManagedNetworkConfigurationHandler* network_config_handler, chromeos::NetworkDeviceHandler* network_device_handler, @@ -77,14 +78,18 @@ base::DictionaryValue* global_network_config) override; void OnDataRoamingSettingChanged(); - chromeos::NetworkDeviceHandler* network_device_handler_; - ash::CrosSettings* cros_settings_; + // Pointer to the global singleton or a test instance. + chromeos::ManagedNetworkConfigurationHandler* const network_config_handler_; + + chromeos::NetworkDeviceHandler* const network_device_handler_; + ash::CrosSettings* const cros_settings_; base::CallbackListSubscription data_roaming_setting_subscription_; // Returns the device's administrator-set asset id. DeviceAssetIDFetcher device_asset_id_fetcher_; - base::WeakPtrFactory<DeviceNetworkConfigurationUpdater> weak_factory_{this}; + base::WeakPtrFactory<DeviceNetworkConfigurationUpdaterAsh> weak_factory_{ + this}; }; } // namespace policy
diff --git a/chrome/browser/policy/networking/network_configuration_updater.cc b/chrome/browser/policy/networking/network_configuration_updater.cc index 9af423a..5ee2774 100644 --- a/chrome/browser/policy/networking/network_configuration_updater.cc +++ b/chrome/browser/policy/networking/network_configuration_updater.cc
@@ -146,10 +146,8 @@ NetworkConfigurationUpdater::NetworkConfigurationUpdater( onc::ONCSource onc_source, std::string policy_key, - PolicyService* policy_service, - chromeos::ManagedNetworkConfigurationHandler* network_config_handler) + PolicyService* policy_service) : onc_source_(onc_source), - network_config_handler_(network_config_handler), policy_key_(policy_key), policy_change_registrar_( policy_service, @@ -192,35 +190,6 @@ global_network_config, certificates); } -// static -bool NetworkConfigurationUpdater::PolicyHasWebTrustedAuthorityCertificate( - const PolicyMap& policy_map, - onc::ONCSource onc_source, - const std::string& policy_key) { - const base::Value* policy_value = policy_map.GetValue(policy_key); - - if (!policy_value || policy_value->type() != base::Value::Type::STRING) - return false; - - base::ListValue certificates_value; - chromeos::onc::ParseAndValidateOncForImport( - policy_value->GetString(), onc_source, /*passphrase=*/std::string(), - /*network_configs=*/nullptr, /*global_network_config=*/nullptr, - &certificates_value); - chromeos::onc::OncParsedCertificates onc_parsed_certificates( - certificates_value); - for (const auto& server_or_authority_cert : - onc_parsed_certificates.server_or_authority_certificates()) { - if (server_or_authority_cert.type() == - OncParsedCertificates::ServerOrAuthorityCertificate::Type:: - kAuthority && - server_or_authority_cert.web_trust_requested()) { - return true; - } - } - return false; -} - const std::vector<OncParsedCertificates::ClientCertificate>& NetworkConfigurationUpdater::GetClientCertificates() const { return certs_->client_certificates();
diff --git a/chrome/browser/policy/networking/network_configuration_updater.h b/chrome/browser/policy/networking/network_configuration_updater.h index cd7b9a3..e8d21050 100644 --- a/chrome/browser/policy/networking/network_configuration_updater.h +++ b/chrome/browser/policy/networking/network_configuration_updater.h
@@ -24,20 +24,15 @@ class Value; } // namespace base -namespace chromeos { -class ManagedNetworkConfigurationHandler; -} // namespace chromeos - namespace policy { class PolicyMap; -// Implements the common part of tracking a OpenNetworkConfiguration device or -// user policy. Pushes the network configs to the -// ManagedNetworkConfigurationHandler, which in turn writes configurations to -// Shill. User client certificates are imported with the -// chromeos::onc::CertificateImporter. For user policies the subclass -// UserNetworkConfigurationUpdater must be used. Does not handle proxy settings. +// Implements the common part of tracking the OpenNetworkConfiguration device +// and user policy. Implements the handling of server and authority certificates +// (that will be propagated to the network service). Provides entry points for +// handling client certificates and network configurations in subclasses. +// Does not handle proxy settings. class NetworkConfigurationUpdater : public chromeos::PolicyCertificateProvider, public PolicyService::Observer { public: @@ -73,11 +68,9 @@ const override; protected: - NetworkConfigurationUpdater( - onc::ONCSource onc_source, - std::string policy_key, - PolicyService* policy_service, - chromeos::ManagedNetworkConfigurationHandler* network_config_handler); + NetworkConfigurationUpdater(onc::ONCSource onc_source, + std::string policy_key, + PolicyService* policy_service); virtual void Init(); @@ -86,9 +79,9 @@ // |GetClientcertificates()|. virtual void ImportClientCertificates() = 0; - // Pushes the network part of the policy to the - // ManagedNetworkConfigurationHandler. This can be overridden by subclasses to - // modify |network_configs_onc| before the actual application. + // Parses the incoming policy, applies server and authority certificates. + // Calls the specialized methods from subclasses to handle client certificates + // and network configs. virtual void ApplyNetworkPolicy( base::ListValue* network_configs_onc, base::DictionaryValue* global_network_config) = 0; @@ -103,22 +96,11 @@ base::DictionaryValue* global_network_config, base::ListValue* certificates); - // Determines if |policy_map| contains an ONC policy under |policy_key| that - // mandates that at least one additional certificate should be used and - // assignd 'Web' trust. - static bool PolicyHasWebTrustedAuthorityCertificate( - const PolicyMap& policy_map, - onc::ONCSource onc_source, - const std::string& policy_key); - const std::vector<chromeos::onc::OncParsedCertificates::ClientCertificate>& GetClientCertificates() const; onc::ONCSource onc_source_; - // Pointer to the global singleton or a test instance. - chromeos::ManagedNetworkConfigurationHandler* network_config_handler_; - SEQUENCE_CHECKER(sequence_checker_); private:
diff --git a/chrome/browser/policy/networking/network_configuration_updater_ash_unittest.cc b/chrome/browser/policy/networking/network_configuration_updater_ash_unittest.cc index 9d3a1f10..237f2706 100644 --- a/chrome/browser/policy/networking/network_configuration_updater_ash_unittest.cc +++ b/chrome/browser/policy/networking/network_configuration_updater_ash_unittest.cc
@@ -257,41 +257,6 @@ "Type": "UnencryptedConfiguration" })"; -const char kFakeONCWithExtensionScopedCert[] = R"( - { "Certificates": [ - { "GUID": "{extension-scoped-certificate}", - "TrustBits": [ - "Web" - ], - "Scope": { - "Type": "Extension", - "Id": "ngjobkbdodapjbbncmagbccommkggmnj" - }, - "Type": "Authority", - "X509": "-----BEGIN CERTIFICATE-----\n - MIIC8zCCAdugAwIBAgIJALF9qhLor0+aMA0GCSqGSIb3DQEBBQUAMBcxFTATBgNV\n - BAMMDFRlc3QgUm9vdCBDQTAeFw0xNDA4MTQwMzA1MjlaFw0yNDA4MTEwMzA1Mjla\n - MBcxFTATBgNVBAMMDFRlc3QgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP\n - ADCCAQoCggEBALZJQeNCAVGofzx6cdP7zZE1F4QajvY2x9FwHfqG8267dm/oMi43\n - /TiSPWjkin1CMxRGG9wE9pFuVEDECgn97C1i4l7huiycwbFgTNrH+CJcgiBlQh5W\n - d3VP65AsSupXDiKNbJWsEerM1+72cA0J3aY1YV3Jdm2w8h6/MIbYd1I2lZcO0UbF\n - 7YE9G7DyYZU8wUA4719dumGf7yucn4WJdHBj1XboNX7OAeHzERGQHA31/Y3OEGyt\n - fFUaIW/XLfR4FeovOL2RnjwdB0b1Q8GCi68SU2UZimlpZgay2gv6KgChKhWESfEB\n - v5swBtAVoB+dUZFH4VNf717swmF5whSfxOMCAwEAAaNCMEAwDwYDVR0TAQH/BAUw\n - AwEB/zAdBgNVHQ4EFgQUvPcw0TzA8nn675/JbFyT84poq4MwDgYDVR0PAQH/BAQD\n - AgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBXByn7f+j/sObYWGrDkKE4HLTzaLHs6Ikj\n - JNeo8iHDYOSkSVwAv9/HgniAKxj3rd3QYl6nsMzwqrTOcBJZZWd2BQAYmv/EKhfj\n - 8VXYvlxe68rLU4cQ1QkyNqdeQfRT2n5WYNJ+TpqlCF9ddennMMsi6e8ZSYOlI6H4\n - YEzlNtU5eBjxXr/OqgtTgSx4qQpr2xMQIRR/G3A9iRpAigYsXVAZYvnHRYnyPWYF\n - PX11W1UegEJyoZp8bQp09u6mIWw6mPt3gl/ya1bm3ZuOUPDGrv3qpgUHqSYGVrOy\n - 2bI3oCE+eQYfuVG+9LFJTZC1M+UOx15bQMVqBNFDepRqpE9h/ILg\n - -----END CERTIFICATE-----" }, - ], - "Type": "UnencryptedConfiguration" - })"; - -const char kExtensionIdWithScopedCert[] = "ngjobkbdodapjbbncmagbccommkggmnj"; - std::string ValueToString(const base::Value& value) { std::stringstream str; str << value; @@ -346,9 +311,9 @@ } // namespace -class NetworkConfigurationUpdaterTest : public testing::Test { +class NetworkConfigurationUpdaterAshTest : public testing::Test { protected: - NetworkConfigurationUpdaterTest() : certificate_importer_(NULL) {} + NetworkConfigurationUpdaterAshTest() : certificate_importer_(NULL) {} void SetUp() override { ash::UserSessionManager::GetInstance()->set_start_session_type_for_testing( @@ -428,11 +393,11 @@ base::RunLoop().RunUntilIdle(); } - UserNetworkConfigurationUpdater* + UserNetworkConfigurationUpdaterAsh* CreateNetworkConfigurationUpdaterForUserPolicy( bool set_client_cert_importer) { - UserNetworkConfigurationUpdater* updater = - UserNetworkConfigurationUpdater::CreateForUserPolicy( + UserNetworkConfigurationUpdaterAsh* updater = + UserNetworkConfigurationUpdaterAsh::CreateForUserPolicy( &profile_, fake_user_, policy_service_.get(), &network_config_handler_) .release(); @@ -450,7 +415,7 @@ auto testing_device_asset_id_getter = base::BindRepeating([] { return std::string(kFakeAssetId); }); network_configuration_updater_ = - DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( + DeviceNetworkConfigurationUpdaterAsh::CreateForDevicePolicy( policy_service_.get(), &network_config_handler_, &network_device_handler_, ash::CrosSettings::Get(), testing_device_asset_id_getter); @@ -505,7 +470,7 @@ chromeos::ScopedFakeSessionManagerClient scoped_session_manager_client_; }; -TEST_F(NetworkConfigurationUpdaterTest, CellularRoamingDefaults) { +TEST_F(NetworkConfigurationUpdaterAshTest, CellularRoamingDefaults) { // Ignore network config updates. EXPECT_CALL(network_config_handler_, SetPolicy(_, _, _, _)).Times(AtLeast(1)); @@ -514,7 +479,7 @@ EXPECT_TRUE(network_device_handler_.policy_allow_roaming_); } -TEST_F(NetworkConfigurationUpdaterTest, CellularPolicyAllowRoamingManaged) { +TEST_F(NetworkConfigurationUpdaterAshTest, CellularPolicyAllowRoamingManaged) { // Ignore network config updates. EXPECT_CALL(network_config_handler_, SetPolicy(_, _, _, _)).Times(AtLeast(1)); @@ -534,7 +499,8 @@ EXPECT_FALSE(network_device_handler_.policy_allow_roaming_); } -TEST_F(NetworkConfigurationUpdaterTest, CellularPolicyAllowRoamingUnmanaged) { +TEST_F(NetworkConfigurationUpdaterAshTest, + CellularPolicyAllowRoamingUnmanaged) { // Ignore network config updates. EXPECT_CALL(network_config_handler_, SetPolicy(_, _, _, _)).Times(AtLeast(1)); @@ -553,7 +519,7 @@ EXPECT_TRUE(network_device_handler_.policy_allow_roaming_); } -TEST_F(NetworkConfigurationUpdaterTest, PolicyIsValidatedAndRepaired) { +TEST_F(NetworkConfigurationUpdaterAshTest, PolicyIsValidatedAndRepaired) { std::unique_ptr<base::DictionaryValue> onc_repaired = chromeos::onc::test_utils::ReadTestDictionary( "repaired_toplevel_partially_invalid.onc"); @@ -596,135 +562,7 @@ EXPECT_EQ(1u, certificate_importer_->GetAndResetImportCount()); } -TEST_F(NetworkConfigurationUpdaterTest, - WebTrustedCertificatesFromPolicyInitially) { - // Ignore network configuration changes. - EXPECT_CALL(network_config_handler_, SetPolicy(_, _, _, _)) - .Times(AnyNumber()); - - UserNetworkConfigurationUpdater* updater = - CreateNetworkConfigurationUpdaterForUserPolicy( - false /* set certificate importer */); - - MockPolicyProvidedCertsObserver observer; - EXPECT_CALL(observer, OnPolicyProvidedCertsChanged()); - updater->AddPolicyProvidedCertsObserver(&observer); - - PolicyMap policy; - policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(kFakeONC), - nullptr); - UpdateProviderPolicy(policy); - MarkPolicyProviderInitialized(); - base::RunLoop().RunUntilIdle(); - - // Certificates with the "Web" trust flag set will be returned. - const auto kDefaultScope = chromeos::onc::CertificateScope::Default(); - EXPECT_EQ(1u, updater->GetWebTrustedCertificates(kDefaultScope).size()); - EXPECT_EQ(1u, updater->GetCertificatesWithoutWebTrust(kDefaultScope).size()); - EXPECT_EQ( - 2u, updater->GetAllServerAndAuthorityCertificates(kDefaultScope).size()); - EXPECT_EQ(0u, updater - ->GetAllServerAndAuthorityCertificates( - chromeos::onc::CertificateScope::ForExtension( - kExtensionIdWithScopedCert)) - .size()); - - updater->RemovePolicyProvidedCertsObserver(&observer); -} - -TEST_F(NetworkConfigurationUpdaterTest, - WebTrustedCertificatesFromPolicyOnUpdate) { - // Ignore network configuration changes. - EXPECT_CALL(network_config_handler_, SetPolicy(_, _, _, _)) - .Times(AnyNumber()); - - // Start with an empty certificate list. - UserNetworkConfigurationUpdater* updater = - CreateNetworkConfigurationUpdaterForUserPolicy( - false /* set certificate importer */); - MockPolicyProvidedCertsObserver observer; - EXPECT_CALL(observer, OnPolicyProvidedCertsChanged()).Times(0); - updater->AddPolicyProvidedCertsObserver(&observer); - - MarkPolicyProviderInitialized(); - base::RunLoop().RunUntilIdle(); - - // Verify that the returned certificate list is empty. - const auto kDefaultScope = chromeos::onc::CertificateScope::Default(); - EXPECT_TRUE(updater->GetWebTrustedCertificates(kDefaultScope).empty()); - EXPECT_TRUE(updater->GetCertificatesWithoutWebTrust(kDefaultScope).empty()); - EXPECT_TRUE( - updater->GetAllServerAndAuthorityCertificates(kDefaultScope).empty()); - - // No call has been made to the policy-provided certificates observer. - Mock::VerifyAndClearExpectations(&observer); - EXPECT_CALL(observer, OnPolicyProvidedCertsChanged()); - - // Change to ONC policy with web trust certs. - PolicyMap policy; - policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(kFakeONC), - nullptr); - UpdateProviderPolicy(policy); - base::RunLoop().RunUntilIdle(); - - // Certificates with the "Web" trust flag set will be returned and forwarded - // to observers. - EXPECT_EQ(1u, updater->GetWebTrustedCertificates(kDefaultScope).size()); - EXPECT_EQ(1u, updater->GetCertificatesWithoutWebTrust(kDefaultScope).size()); - EXPECT_EQ( - 2u, updater->GetAllServerAndAuthorityCertificates(kDefaultScope).size()); - EXPECT_EQ(0u, updater - ->GetAllServerAndAuthorityCertificates( - chromeos::onc::CertificateScope::ForExtension( - kExtensionIdWithScopedCert)) - .size()); - - updater->RemovePolicyProvidedCertsObserver(&observer); -} - -TEST_F(NetworkConfigurationUpdaterTest, ExtensionScopedWebTrustedCertificate) { - // Ignore network configuration changes. - EXPECT_CALL(network_config_handler_, SetPolicy(_, _, _, _)) - .Times(AnyNumber()); - - NetworkConfigurationUpdater* updater = - CreateNetworkConfigurationUpdaterForDevicePolicy(); - - MockPolicyProvidedCertsObserver observer; - EXPECT_CALL(observer, OnPolicyProvidedCertsChanged()); - updater->AddPolicyProvidedCertsObserver(&observer); - - PolicyMap policy; - policy.Set(key::kDeviceOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, - POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, - base::Value(kFakeONCWithExtensionScopedCert), nullptr); - UpdateProviderPolicy(policy); - MarkPolicyProviderInitialized(); - base::RunLoop().RunUntilIdle(); - - // Certificates with the "Web" trust flag set will be returned. - const auto kDefaultScope = chromeos::onc::CertificateScope::Default(); - EXPECT_EQ(0u, updater->GetWebTrustedCertificates(kDefaultScope).size()); - EXPECT_EQ(0u, updater->GetCertificatesWithoutWebTrust(kDefaultScope).size()); - EXPECT_EQ( - 0u, updater->GetAllServerAndAuthorityCertificates(kDefaultScope).size()); - EXPECT_EQ(1u, updater - ->GetAllServerAndAuthorityCertificates( - chromeos::onc::CertificateScope::ForExtension( - kExtensionIdWithScopedCert)) - .size()); - EXPECT_EQ(1u, updater - ->GetWebTrustedCertificates( - chromeos::onc::CertificateScope::ForExtension( - kExtensionIdWithScopedCert)) - .size()); - - updater->RemovePolicyProvidedCertsObserver(&observer); -} - -TEST_F(NetworkConfigurationUpdaterTest, +TEST_F(NetworkConfigurationUpdaterAshTest, DontImportCertificateBeforeCertificateImporterSet) { PolicyMap policy; policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, @@ -738,7 +576,7 @@ IsEqualTo(GetExpectedFakeNetworkConfigs(source)), IsEqualTo(GetExpectedFakeGlobalNetworkConfig()))); - UserNetworkConfigurationUpdater* updater = + UserNetworkConfigurationUpdaterAsh* updater = CreateNetworkConfigurationUpdaterForUserPolicy( false /* do not set certificate importer */); MarkPolicyProviderInitialized(); @@ -755,7 +593,7 @@ EXPECT_EQ(1u, certificate_importer_->GetAndResetImportCount()); } -TEST_F(NetworkConfigurationUpdaterTest, ReplaceDeviceOncPlaceholders) { +TEST_F(NetworkConfigurationUpdaterAshTest, ReplaceDeviceOncPlaceholders) { PolicyMap policy; policy.Set(key::kDeviceOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, POLICY_SOURCE_CLOUD, base::Value(kFakeONC), @@ -802,9 +640,8 @@ policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(kONCWithoutWebTrustedCert), nullptr); - EXPECT_FALSE( - UserNetworkConfigurationUpdater::PolicyHasWebTrustedAuthorityCertificate( - policy)); + EXPECT_FALSE(UserNetworkConfigurationUpdaterAsh:: + PolicyHasWebTrustedAuthorityCertificate(policy)); } TEST(UserNetworkConfigurationStaticsTest, TestHasWebTrustedCertsYes) { @@ -840,16 +677,14 @@ policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(kONCWithWebTrustedCert), nullptr); - EXPECT_TRUE( - UserNetworkConfigurationUpdater::PolicyHasWebTrustedAuthorityCertificate( - policy)); + EXPECT_TRUE(UserNetworkConfigurationUpdaterAsh:: + PolicyHasWebTrustedAuthorityCertificate(policy)); } TEST(UserNetworkConfigurationStaticsTest, TestHasWebTrustedCertsNoPolicy) { PolicyMap policy; - EXPECT_FALSE( - UserNetworkConfigurationUpdater::PolicyHasWebTrustedAuthorityCertificate( - policy)); + EXPECT_FALSE(UserNetworkConfigurationUpdaterAsh:: + PolicyHasWebTrustedAuthorityCertificate(policy)); } TEST(UserNetworkConfigurationStaticsTest, TestHasWebTrustedCertsInvalidPolicy) { @@ -858,13 +693,12 @@ policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(kInvalidONC), nullptr); - EXPECT_FALSE( - UserNetworkConfigurationUpdater::PolicyHasWebTrustedAuthorityCertificate( - policy)); + EXPECT_FALSE(UserNetworkConfigurationUpdaterAsh:: + PolicyHasWebTrustedAuthorityCertificate(policy)); } -class NetworkConfigurationUpdaterTestWithParam - : public NetworkConfigurationUpdaterTest, +class NetworkConfigurationUpdaterAshTestWithParam + : public NetworkConfigurationUpdaterAshTest, public testing::WithParamInterface<const char*> { protected: // Returns the currently tested ONC source. @@ -899,7 +733,7 @@ } }; -TEST_P(NetworkConfigurationUpdaterTestWithParam, InitialUpdates) { +TEST_P(NetworkConfigurationUpdaterAshTestWithParam, InitialUpdates) { PolicyMap policy; policy.Set(GetParam(), POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(kFakeONC), nullptr); @@ -919,7 +753,7 @@ certificate_importer_->GetAndResetImportCount()); } -TEST_P(NetworkConfigurationUpdaterTestWithParam, +TEST_P(NetworkConfigurationUpdaterAshTestWithParam, PolicyNotSetBeforePolicyProviderInitialized) { PolicyMap policy; policy.Set(GetParam(), POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, @@ -944,7 +778,7 @@ certificate_importer_->GetAndResetImportCount()); } -TEST_P(NetworkConfigurationUpdaterTestWithParam, +TEST_P(NetworkConfigurationUpdaterAshTestWithParam, PolicyAppliedImmediatelyIfProvidersInitialized) { MarkPolicyProviderInitialized(); @@ -967,7 +801,7 @@ certificate_importer_->GetAndResetImportCount()); } -TEST_P(NetworkConfigurationUpdaterTestWithParam, PolicyChange) { +TEST_P(NetworkConfigurationUpdaterAshTestWithParam, PolicyChange) { // Ignore the initial updates. EXPECT_CALL(network_config_handler_, SetPolicy(_, _, _, _)).Times(AtLeast(1)); @@ -1007,8 +841,8 @@ certificate_importer_->GetAndResetImportCount()); } -INSTANTIATE_TEST_SUITE_P(NetworkConfigurationUpdaterTestWithParamInstance, - NetworkConfigurationUpdaterTestWithParam, +INSTANTIATE_TEST_SUITE_P(NetworkConfigurationUpdaterAshTestWithParamInstance, + NetworkConfigurationUpdaterAshTestWithParam, testing::Values(key::kDeviceOpenNetworkConfiguration, key::kOpenNetworkConfiguration));
diff --git a/chrome/browser/policy/networking/network_configuration_updater_unittest.cc b/chrome/browser/policy/networking/network_configuration_updater_unittest.cc new file mode 100644 index 0000000..c6cc228 --- /dev/null +++ b/chrome/browser/policy/networking/network_configuration_updater_unittest.cc
@@ -0,0 +1,370 @@ +// 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 <stddef.h> + +#include <memory> +#include <utility> + +#include "base/run_loop.h" +#include "base/values.h" +#include "chrome/browser/policy/networking/user_network_configuration_updater.h" +#include "chromeos/components/onc/certificate_scope.h" +#include "chromeos/components/onc/onc_test_utils.h" +#include "chromeos/network/policy_certificate_provider.h" +#include "components/onc/onc_constants.h" +#include "components/policy/core/common/mock_configuration_policy_provider.h" +#include "components/policy/core/common/policy_map.h" +#include "components/policy/core/common/policy_service_impl.h" +#include "components/policy/core/common/policy_types.h" +#include "components/policy/policy_constants.h" +#include "content/public/test/browser_task_environment.h" +#include "content/public/test/test_utils.h" +#include "net/test/cert_test_util.h" +#include "net/test/test_data_directory.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using testing::_; +using testing::Mock; +using testing::Ne; +using testing::Return; +using testing::StrictMock; + +namespace policy { + +namespace { + +class MockPolicyProvidedCertsObserver + : public chromeos::PolicyCertificateProvider::Observer { + public: + MockPolicyProvidedCertsObserver() = default; + + MockPolicyProvidedCertsObserver(const MockPolicyProvidedCertsObserver&) = + delete; + MockPolicyProvidedCertsObserver& operator=( + const MockPolicyProvidedCertsObserver&) = delete; + + MOCK_METHOD0(OnPolicyProvidedCertsChanged, void()); +}; + +// Note: HexSSID 737369642D6E6F6E65 maps to "ssid-none". +// HexSSID 7465737431323334 maps to "test1234" +const char kFakeONC[] = R"( + { "NetworkConfigurations": [ + { "GUID": "{485d6076-dd44-6b6d-69787465725f5040}", + "Type": "WiFi", + "Name": "My WiFi Network", + "WiFi": { + "HexSSID": "737369642D6E6F6E65", + "HiddenSSID": false, + "Security": "None" } + }, + { "GUID": "{guid-for-wifi-with-device-exp}", + "Type": "WiFi", + "Name": "My WiFi with device placeholder expansions", + "WiFi": { + "EAP": { + "Outer": "EAP-TLS", + "Identity": "${DEVICE_SERIAL_NUMBER}-${DEVICE_ASSET_ID}" + }, + "HexSSID": "7465737431323334", + "HiddenSSID": false, + "Security": "WPA-EAP", + "SSID": "test1234", + } + } + ], + "GlobalNetworkConfiguration": { + "AllowOnlyPolicyNetworksToAutoconnect": true, + }, + "Certificates": [ + { "GUID": "{f998f760-272b-6939-4c2beffe428697ac}", + "PKCS12": "YWJj", + "Type": "Client" }, + { "GUID": "{d443ad0d-ea16-4301-9089-588115e2f5c4}", + "TrustBits": [ + "Web" + ], + "Type": "Authority", + "X509": "-----BEGIN CERTIFICATE-----\n + MIIC8zCCAdugAwIBAgIJALF9qhLor0+aMA0GCSqGSIb3DQEBBQUAMBcxFTATBgNV\n + BAMMDFRlc3QgUm9vdCBDQTAeFw0xNDA4MTQwMzA1MjlaFw0yNDA4MTEwMzA1Mjla\n + MBcxFTATBgNVBAMMDFRlc3QgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP\n + ADCCAQoCggEBALZJQeNCAVGofzx6cdP7zZE1F4QajvY2x9FwHfqG8267dm/oMi43\n + /TiSPWjkin1CMxRGG9wE9pFuVEDECgn97C1i4l7huiycwbFgTNrH+CJcgiBlQh5W\n + d3VP65AsSupXDiKNbJWsEerM1+72cA0J3aY1YV3Jdm2w8h6/MIbYd1I2lZcO0UbF\n + 7YE9G7DyYZU8wUA4719dumGf7yucn4WJdHBj1XboNX7OAeHzERGQHA31/Y3OEGyt\n + fFUaIW/XLfR4FeovOL2RnjwdB0b1Q8GCi68SU2UZimlpZgay2gv6KgChKhWESfEB\n + v5swBtAVoB+dUZFH4VNf717swmF5whSfxOMCAwEAAaNCMEAwDwYDVR0TAQH/BAUw\n + AwEB/zAdBgNVHQ4EFgQUvPcw0TzA8nn675/JbFyT84poq4MwDgYDVR0PAQH/BAQD\n + AgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBXByn7f+j/sObYWGrDkKE4HLTzaLHs6Ikj\n + JNeo8iHDYOSkSVwAv9/HgniAKxj3rd3QYl6nsMzwqrTOcBJZZWd2BQAYmv/EKhfj\n + 8VXYvlxe68rLU4cQ1QkyNqdeQfRT2n5WYNJ+TpqlCF9ddennMMsi6e8ZSYOlI6H4\n + YEzlNtU5eBjxXr/OqgtTgSx4qQpr2xMQIRR/G3A9iRpAigYsXVAZYvnHRYnyPWYF\n + PX11W1UegEJyoZp8bQp09u6mIWw6mPt3gl/ya1bm3ZuOUPDGrv3qpgUHqSYGVrOy\n + 2bI3oCE+eQYfuVG+9LFJTZC1M+UOx15bQMVqBNFDepRqpE9h/ILg\n + -----END CERTIFICATE-----" }, + { "GUID": "{dac8e282-8ff3-4bb9-a20f-b5ef22b2f83b}", + "Type": "Authority", + "X509": "-----BEGIN CERTIFICATE-----\n + MIIDvzCCAqegAwIBAgIBAzANBgkqhkiG9w0BAQsFADBjMQswCQYDVQQGEwJVUzET\n + MBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNTW91bnRhaW4gVmlldzEQMA4G\n + A1UECgwHVGVzdCBDQTEVMBMGA1UEAwwMVGVzdCBSb290IENBMB4XDTE3MDYwNTE3\n + MTA0NloXDTI3MDYwMzE3MTA0NlowYDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNh\n + bGlmb3JuaWExFjAUBgNVBAcMDU1vdW50YWluIFZpZXcxEDAOBgNVBAoMB1Rlc3Qg\n + Q0ExEjAQBgNVBAMMCTEyNy4wLjAuMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC\n + AQoCggEBALS/0pcz5RNbd2W9cxp1KJtHWea3MOhGM21YW9ofCv/k5C3yHfiJ6GQu\n + 9sPN16OO1/fN59gOEMPnVtL85ebTTuL/gk0YY4ewo97a7wo3e6y1t0PO8gc53xTp\n + w6RBPn5oRzSbe2HEGOYTzrO0puC6A+7k6+eq9G2+l1uqBpdQAdB4uNaSsOTiuUOI\n + ta4UZH1ScNQFHAkl1eJPyaiC20Exw75EbwvU/b/B7tlivzuPtQDI0d9dShOtceRL\n + X9HZckyD2JNAv2zNL2YOBNa5QygkySX9WXD+PfKpCk7Cm8TenldeXRYl5ni2REkp\n + nfa/dPuF1g3xZVjyK9aPEEnIAC2I4i0CAwEAAaOBgDB+MAwGA1UdEwEB/wQCMAAw\n + HQYDVR0OBBYEFODc4C8HiHQ6n9Mwo3GK+dal5aZTMB8GA1UdIwQYMBaAFJsmC4qY\n + qbsduR8c4xpAM+2OF4irMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAP\n + BgNVHREECDAGhwR/AAABMA0GCSqGSIb3DQEBCwUAA4IBAQB6FEQuUDRcC5jkX3aZ\n + uuTeZEqMVL7JXgvgFqzXsPb8zIdmxr/tEDfwXx2qDf2Dpxts7Fq4vqUwimK4qV3K\n + 7heLnWV2+FBvV1eeSfZ7AQj+SURkdlyo42r41+t13QUf+Z0ftR9266LSWLKrukeI\n + Mxk73hOkm/u8enhTd00dy/FN9dOFBFHseVMspWNxIkdRILgOmiyfQNRgxNYdOf0e\n + EfELR8Hn6WjZ8wAbvO4p7RTrzu1c/RZ0M+NLkID56Brbl70GC2h5681LPwAOaZ7/\n + mWQ5kekSyJjmLfF12b+h9RVAt5MrXZgk2vNujssgGf4nbWh4KZyQ6qrs778ZdDLm\n + yfUn\n + -----END CERTIFICATE-----" } + ], + "Type": "UnencryptedConfiguration" + })"; + +const char kFakeONCWithExtensionScopedCert[] = R"( + { "Certificates": [ + { "GUID": "{extension-scoped-certificate}", + "TrustBits": [ + "Web" + ], + "Scope": { + "Type": "Extension", + "Id": "ngjobkbdodapjbbncmagbccommkggmnj" + }, + "Type": "Authority", + "X509": "-----BEGIN CERTIFICATE-----\n + MIIC8zCCAdugAwIBAgIJALF9qhLor0+aMA0GCSqGSIb3DQEBBQUAMBcxFTATBgNV\n + BAMMDFRlc3QgUm9vdCBDQTAeFw0xNDA4MTQwMzA1MjlaFw0yNDA4MTEwMzA1Mjla\n + MBcxFTATBgNVBAMMDFRlc3QgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP\n + ADCCAQoCggEBALZJQeNCAVGofzx6cdP7zZE1F4QajvY2x9FwHfqG8267dm/oMi43\n + /TiSPWjkin1CMxRGG9wE9pFuVEDECgn97C1i4l7huiycwbFgTNrH+CJcgiBlQh5W\n + d3VP65AsSupXDiKNbJWsEerM1+72cA0J3aY1YV3Jdm2w8h6/MIbYd1I2lZcO0UbF\n + 7YE9G7DyYZU8wUA4719dumGf7yucn4WJdHBj1XboNX7OAeHzERGQHA31/Y3OEGyt\n + fFUaIW/XLfR4FeovOL2RnjwdB0b1Q8GCi68SU2UZimlpZgay2gv6KgChKhWESfEB\n + v5swBtAVoB+dUZFH4VNf717swmF5whSfxOMCAwEAAaNCMEAwDwYDVR0TAQH/BAUw\n + AwEB/zAdBgNVHQ4EFgQUvPcw0TzA8nn675/JbFyT84poq4MwDgYDVR0PAQH/BAQD\n + AgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBXByn7f+j/sObYWGrDkKE4HLTzaLHs6Ikj\n + JNeo8iHDYOSkSVwAv9/HgniAKxj3rd3QYl6nsMzwqrTOcBJZZWd2BQAYmv/EKhfj\n + 8VXYvlxe68rLU4cQ1QkyNqdeQfRT2n5WYNJ+TpqlCF9ddennMMsi6e8ZSYOlI6H4\n + YEzlNtU5eBjxXr/OqgtTgSx4qQpr2xMQIRR/G3A9iRpAigYsXVAZYvnHRYnyPWYF\n + PX11W1UegEJyoZp8bQp09u6mIWw6mPt3gl/ya1bm3ZuOUPDGrv3qpgUHqSYGVrOy\n + 2bI3oCE+eQYfuVG+9LFJTZC1M+UOx15bQMVqBNFDepRqpE9h/ILg\n + -----END CERTIFICATE-----" }, + ], + "Type": "UnencryptedConfiguration" + })"; + +const char kExtensionIdWithScopedCert[] = "ngjobkbdodapjbbncmagbccommkggmnj"; + +} // namespace + +class NetworkConfigurationUpdaterTest : public testing::Test { + protected: + NetworkConfigurationUpdaterTest() {} + + void SetUp() override { + EXPECT_CALL(provider_, IsInitializationComplete(_)) + .WillRepeatedly(Return(false)); + EXPECT_CALL(provider_, IsFirstPolicyLoadComplete(_)) + .WillRepeatedly(Return(false)); + provider_.Init(); + PolicyServiceImpl::Providers providers; + providers.push_back(&provider_); + policy_service_ = std::make_unique<PolicyServiceImpl>(std::move(providers)); + } + + base::Value* GetExpectedFakeGlobalNetworkConfig() { + return &fake_global_network_config_; + } + + void TearDown() override { + network_configuration_updater_.reset(); + provider_.Shutdown(); + base::RunLoop().RunUntilIdle(); + } + + void MarkPolicyProviderInitialized() { + Mock::VerifyAndClearExpectations(&provider_); + EXPECT_CALL(provider_, IsInitializationComplete(_)) + .WillRepeatedly(Return(true)); + EXPECT_CALL(provider_, IsFirstPolicyLoadComplete(_)) + .WillRepeatedly(Return(true)); + provider_.SetAutoRefresh(); + provider_.RefreshPolicies(); + base::RunLoop().RunUntilIdle(); + } + + void UpdateProviderPolicy(const PolicyMap& policy) { + provider_.UpdateChromePolicy(policy); + base::RunLoop().RunUntilIdle(); + } + + NetworkConfigurationUpdater* + CreateNetworkConfigurationUpdaterForUserPolicy() { + network_configuration_updater_ = + UserNetworkConfigurationUpdater::CreateForUserPolicy( + policy_service_.get()); + return network_configuration_updater_.get(); + } + + content::BrowserTaskEnvironment task_environment_; + + StrictMock<MockConfigurationPolicyProvider> provider_; + std::unique_ptr<PolicyServiceImpl> policy_service_; + + std::unique_ptr<NetworkConfigurationUpdater> network_configuration_updater_; + + private: + base::Value fake_network_configs_; + base::DictionaryValue fake_global_network_config_; +}; + +TEST_F(NetworkConfigurationUpdaterTest, CaPolicyIsValidatedAndRepaired) { + std::string onc_policy = chromeos::onc::test_utils::ReadTestData( + "toplevel_ca_partially_invalid.onc"); + PolicyMap policy; + policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(onc_policy), + nullptr); + UpdateProviderPolicy(policy); + + NetworkConfigurationUpdater* updater = + CreateNetworkConfigurationUpdaterForUserPolicy(); + MarkPolicyProviderInitialized(); + + const auto kDefaultScope = chromeos::onc::CertificateScope::Default(); + EXPECT_EQ(0u, updater->GetWebTrustedCertificates(kDefaultScope).size()); + EXPECT_EQ(1u, updater->GetCertificatesWithoutWebTrust(kDefaultScope).size()); + EXPECT_EQ( + 1u, updater->GetAllServerAndAuthorityCertificates(kDefaultScope).size()); +} + +TEST_F(NetworkConfigurationUpdaterTest, + WebTrustedCertificatesFromPolicyInitially) { + NetworkConfigurationUpdater* updater = + CreateNetworkConfigurationUpdaterForUserPolicy(); + + MockPolicyProvidedCertsObserver observer; + EXPECT_CALL(observer, OnPolicyProvidedCertsChanged()); + updater->AddPolicyProvidedCertsObserver(&observer); + + PolicyMap policy; + policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(kFakeONC), + nullptr); + UpdateProviderPolicy(policy); + MarkPolicyProviderInitialized(); + base::RunLoop().RunUntilIdle(); + + // Certificates with the "Web" trust flag set will be returned. + const auto kDefaultScope = chromeos::onc::CertificateScope::Default(); + EXPECT_EQ(1u, updater->GetWebTrustedCertificates(kDefaultScope).size()); + EXPECT_EQ(1u, updater->GetCertificatesWithoutWebTrust(kDefaultScope).size()); + EXPECT_EQ( + 2u, updater->GetAllServerAndAuthorityCertificates(kDefaultScope).size()); + EXPECT_EQ(0u, updater + ->GetAllServerAndAuthorityCertificates( + chromeos::onc::CertificateScope::ForExtension( + kExtensionIdWithScopedCert)) + .size()); + + updater->RemovePolicyProvidedCertsObserver(&observer); +} + +TEST_F(NetworkConfigurationUpdaterTest, + WebTrustedCertificatesFromPolicyOnUpdate) { + // Start with an empty certificate list. + NetworkConfigurationUpdater* updater = + CreateNetworkConfigurationUpdaterForUserPolicy(); + MockPolicyProvidedCertsObserver observer; + EXPECT_CALL(observer, OnPolicyProvidedCertsChanged()).Times(0); + updater->AddPolicyProvidedCertsObserver(&observer); + + MarkPolicyProviderInitialized(); + base::RunLoop().RunUntilIdle(); + + // Verify that the returned certificate list is empty. + const auto kDefaultScope = chromeos::onc::CertificateScope::Default(); + EXPECT_TRUE(updater->GetWebTrustedCertificates(kDefaultScope).empty()); + EXPECT_TRUE(updater->GetCertificatesWithoutWebTrust(kDefaultScope).empty()); + EXPECT_TRUE( + updater->GetAllServerAndAuthorityCertificates(kDefaultScope).empty()); + + // No call has been made to the policy-provided certificates observer. + Mock::VerifyAndClearExpectations(&observer); + EXPECT_CALL(observer, OnPolicyProvidedCertsChanged()); + + // Change to ONC policy with web trust certs. + PolicyMap policy; + policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, base::Value(kFakeONC), + nullptr); + UpdateProviderPolicy(policy); + base::RunLoop().RunUntilIdle(); + + // Certificates with the "Web" trust flag set will be returned and forwarded + // to observers. + EXPECT_EQ(1u, updater->GetWebTrustedCertificates(kDefaultScope).size()); + EXPECT_EQ(1u, updater->GetCertificatesWithoutWebTrust(kDefaultScope).size()); + EXPECT_EQ( + 2u, updater->GetAllServerAndAuthorityCertificates(kDefaultScope).size()); + EXPECT_EQ(0u, updater + ->GetAllServerAndAuthorityCertificates( + chromeos::onc::CertificateScope::ForExtension( + kExtensionIdWithScopedCert)) + .size()); + + updater->RemovePolicyProvidedCertsObserver(&observer); +} + +TEST_F(NetworkConfigurationUpdaterTest, ExtensionScopedWebTrustedCertificate) { + NetworkConfigurationUpdater* updater = + CreateNetworkConfigurationUpdaterForUserPolicy(); + + MockPolicyProvidedCertsObserver observer; + EXPECT_CALL(observer, OnPolicyProvidedCertsChanged()); + updater->AddPolicyProvidedCertsObserver(&observer); + + PolicyMap policy; + policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, + POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, + base::Value(kFakeONCWithExtensionScopedCert), nullptr); + UpdateProviderPolicy(policy); + MarkPolicyProviderInitialized(); + base::RunLoop().RunUntilIdle(); + + // Certificates with the "Web" trust flag set will be returned. + const auto kDefaultScope = chromeos::onc::CertificateScope::Default(); + EXPECT_EQ(0u, updater->GetWebTrustedCertificates(kDefaultScope).size()); + EXPECT_EQ(0u, updater->GetCertificatesWithoutWebTrust(kDefaultScope).size()); + EXPECT_EQ( + 0u, updater->GetAllServerAndAuthorityCertificates(kDefaultScope).size()); + EXPECT_EQ(1u, updater + ->GetAllServerAndAuthorityCertificates( + chromeos::onc::CertificateScope::ForExtension( + kExtensionIdWithScopedCert)) + .size()); + EXPECT_EQ(1u, updater + ->GetWebTrustedCertificates( + chromeos::onc::CertificateScope::ForExtension( + kExtensionIdWithScopedCert)) + .size()); + + updater->RemovePolicyProvidedCertsObserver(&observer); +} + +} // namespace policy
diff --git a/chrome/browser/policy/networking/policy_cert_service.cc b/chrome/browser/policy/networking/policy_cert_service.cc index fbd8b13f..a8e70ff 100644 --- a/chrome/browser/policy/networking/policy_cert_service.cc +++ b/chrome/browser/policy/networking/policy_cert_service.cc
@@ -25,7 +25,6 @@ #include "content/public/browser/storage_partition.h" #include "extensions/browser/extension_util.h" #include "net/cert/x509_certificate.h" -#include "policy_cert_service.h" #include "services/network/nss_temp_certs_cache_chromeos.h" #include "url/gurl.h"
diff --git a/chrome/browser/policy/networking/policy_cert_service_factory.cc b/chrome/browser/policy/networking/policy_cert_service_factory.cc index 50b609d..6c392e9 100644 --- a/chrome/browser/policy/networking/policy_cert_service_factory.cc +++ b/chrome/browser/policy/networking/policy_cert_service_factory.cc
@@ -6,25 +6,30 @@ #include "base/containers/contains.h" #include "base/memory/singleton.h" -#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" -#include "chrome/browser/ash/profiles/profile_helper.h" +#include "build/chromeos_buildflags.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process_platform_part.h" -#include "chrome/browser/policy/networking/device_network_configuration_updater_ash.h" #include "chrome/browser/policy/networking/policy_cert_service.h" -#include "chrome/browser/policy/networking/user_network_configuration_updater_ash.h" +#include "chrome/browser/policy/networking/user_network_configuration_updater.h" #include "chrome/browser/policy/networking/user_network_configuration_updater_factory.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/pref_names.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/prefs/scoped_user_pref_update.h" -#include "components/user_manager/user_manager.h" #include "services/network/cert_verifier_with_trust_anchors.h" +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ash/policy/core/browser_policy_connector_ash.h" +#include "chrome/browser/ash/profiles/profile_helper.h" +#include "chrome/browser/policy/networking/device_network_configuration_updater_ash.h" +#include "components/user_manager/user_manager.h" +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + namespace policy { namespace { +#if BUILDFLAG(IS_CHROMEOS_ASH) // Returns the PolicyCertificateProvider that should be used for |profile|. // May return nullptr, which should be treated as no policy-provided // certificates set. @@ -39,26 +44,63 @@ return UserNetworkConfigurationUpdaterFactory::GetForBrowserContext(profile); } +KeyedService* BuildServiceInstanceAsh(content::BrowserContext* context) { + Profile* profile = Profile::FromBrowserContext(context); + + chromeos::PolicyCertificateProvider* policy_certificate_provider = + GetPolicyCertificateProvider(profile); + if (!policy_certificate_provider) + return nullptr; + + if (chromeos::ProfileHelper::Get()->IsSigninProfile(profile)) { + return new PolicyCertService(profile, policy_certificate_provider, + /*may_use_profile_wide_trust_anchors=*/false); + } + + // Don't allow policy-provided certificates for "special" Profiles except the + // one listed above. + user_manager::UserManager* user_manager = user_manager::UserManager::Get(); + const user_manager::User* user = + chromeos::ProfileHelper::Get()->GetUserByProfile( + profile->GetOriginalProfile()); + if (!user) + return nullptr; + + PolicyCertServiceFactory::MigrateLocalStatePrefIntoProfilePref( + user->GetAccountId().GetUserEmail(), profile); + + // Only allow trusted policy-provided certificates for non-guest primary + // users. Guest users don't have user policy, but set + // `may_use_profile_wide_trust_anchors`=false for them out of caution against + // future changes. + bool may_use_profile_wide_trust_anchors = + user == user_manager->GetPrimaryUser() && + user->GetType() != user_manager::USER_TYPE_GUEST; + + return new PolicyCertService(profile, policy_certificate_provider, + may_use_profile_wide_trust_anchors); +} + +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + +#if BUILDFLAG(IS_CHROMEOS_LACROS) +KeyedService* BuildServiceInstanceLacros(content::BrowserContext* context) { + Profile* profile = Profile::FromBrowserContext(context); + + chromeos::PolicyCertificateProvider* policy_certificate_provider = + UserNetworkConfigurationUpdaterFactory::GetForBrowserContext(profile); + if (!policy_certificate_provider) + return nullptr; + + return new PolicyCertService( + profile, policy_certificate_provider, + /*may_use_profile_wide_trust_anchors=*/profile->IsMainProfile()); +} +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) + } // namespace -// static -PolicyCertService* PolicyCertServiceFactory::GetForProfile(Profile* profile) { - return static_cast<PolicyCertService*>( - GetInstance()->GetServiceForBrowserContext(profile, false)); -} - -// static -bool PolicyCertServiceFactory::CreateAndStartObservingForProfile( - Profile* profile) { - // Note that this can be called multiple times if the network process crashes. - return GetInstance()->GetServiceForBrowserContext(profile, true) != nullptr; -} - -// static -PolicyCertServiceFactory* PolicyCertServiceFactory::GetInstance() { - return base::Singleton<PolicyCertServiceFactory>::get(); -} - +#if BUILDFLAG(IS_CHROMEOS_ASH) // static bool PolicyCertServiceFactory::MigrateLocalStatePrefIntoProfilePref( const std::string& user_email, @@ -85,6 +127,25 @@ prefs::kUsedPolicyCertificates); return (update->EraseListValue(base::Value(user_email)) > 0); } +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + +// static +PolicyCertService* PolicyCertServiceFactory::GetForProfile(Profile* profile) { + return static_cast<PolicyCertService*>( + GetInstance()->GetServiceForBrowserContext(profile, false)); +} + +// static +bool PolicyCertServiceFactory::CreateAndStartObservingForProfile( + Profile* profile) { + // Note that this can be called multiple times if the network process crashes. + return GetInstance()->GetServiceForBrowserContext(profile, true) != nullptr; +} + +// static +PolicyCertServiceFactory* PolicyCertServiceFactory::GetInstance() { + return base::Singleton<PolicyCertServiceFactory>::get(); +} PolicyCertServiceFactory::PolicyCertServiceFactory() : BrowserContextKeyedServiceFactory( @@ -97,39 +158,13 @@ KeyedService* PolicyCertServiceFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { - Profile* profile = Profile::FromBrowserContext(context); +#if BUILDFLAG(IS_CHROMEOS_ASH) + return BuildServiceInstanceAsh(context); +#endif // BUILDFLAG(IS_CHROMEOS_ASH) - chromeos::PolicyCertificateProvider* policy_certificate_provider = - GetPolicyCertificateProvider(profile); - if (!policy_certificate_provider) - return nullptr; - - if (ash::ProfileHelper::Get()->IsSigninProfile(profile)) { - return new PolicyCertService(profile, policy_certificate_provider, - /*may_use_profile_wide_trust_anchors=*/false); - } - - // Don't allow policy-provided certificates for "special" Profiles except the - // one listed above. - user_manager::UserManager* user_manager = user_manager::UserManager::Get(); - const user_manager::User* user = ash::ProfileHelper::Get()->GetUserByProfile( - profile->GetOriginalProfile()); - if (!user) - return nullptr; - - MigrateLocalStatePrefIntoProfilePref(user->GetAccountId().GetUserEmail(), - profile); - - // Only allow trusted policy-provided certificates for non-guest primary - // users. Guest users don't have user policy, but set - // `may_use_profile_wide_trust_anchors`=false for them out of caution against - // future changes. - bool may_use_profile_wide_trust_anchors = - user == user_manager->GetPrimaryUser() && - user->GetType() != user_manager::USER_TYPE_GUEST; - - return new PolicyCertService(profile, policy_certificate_provider, - may_use_profile_wide_trust_anchors); +#if BUILDFLAG(IS_CHROMEOS_LACROS) + return BuildServiceInstanceLacros(context); +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) } content::BrowserContext* PolicyCertServiceFactory::GetBrowserContextToUse(
diff --git a/chrome/browser/policy/networking/policy_cert_service_factory.h b/chrome/browser/policy/networking/policy_cert_service_factory.h index 4ca8125a..8b73f73 100644 --- a/chrome/browser/policy/networking/policy_cert_service_factory.h +++ b/chrome/browser/policy/networking/policy_cert_service_factory.h
@@ -8,6 +8,7 @@ #include <memory> #include <string> +#include "build/chromeos_buildflags.h" #include "components/keyed_service/content/browser_context_keyed_service_factory.h" namespace base { @@ -43,6 +44,7 @@ PolicyCertServiceFactory(const PolicyCertServiceFactory&) = delete; PolicyCertServiceFactory& operator=(const PolicyCertServiceFactory&) = delete; +#if BUILDFLAG(IS_CHROMEOS_ASH) // Migrates the `prefs::kUsedPolicyCertificates` preference from local state // into per-profile pref storage. Returns true if the local pref was present // and was successfully migrated. @@ -58,6 +60,7 @@ // TODO(b/202492163) This can be deleted after the local state -> profile pref // migration is finished. static bool ClearUsedPolicyCertificates(const std::string& user_email); +#endif // BUILDFLAG(IS_CHROMEOS_ASH) private: friend struct base::DefaultSingletonTraits<PolicyCertServiceFactory>;
diff --git a/chrome/browser/policy/networking/user_network_configuration_updater.cc b/chrome/browser/policy/networking/user_network_configuration_updater.cc new file mode 100644 index 0000000..10234c5 --- /dev/null +++ b/chrome/browser/policy/networking/user_network_configuration_updater.cc
@@ -0,0 +1,27 @@ +// 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/policy/networking/user_network_configuration_updater.h" + +#include "components/policy/policy_constants.h" + +namespace policy { + +// static +std::unique_ptr<UserNetworkConfigurationUpdater> +UserNetworkConfigurationUpdater::CreateForUserPolicy( + PolicyService* policy_service) { + auto updater = + std::make_unique<UserNetworkConfigurationUpdater>(policy_service); + updater->Init(); + return updater; +} + +UserNetworkConfigurationUpdater::UserNetworkConfigurationUpdater( + PolicyService* policy_service) + : NetworkConfigurationUpdater(onc::ONC_SOURCE_USER_POLICY, + key::kOpenNetworkConfiguration, + policy_service) {} + +} // namespace policy
diff --git a/chrome/browser/policy/networking/user_network_configuration_updater.h b/chrome/browser/policy/networking/user_network_configuration_updater.h new file mode 100644 index 0000000..cfafac4 --- /dev/null +++ b/chrome/browser/policy/networking/user_network_configuration_updater.h
@@ -0,0 +1,40 @@ + +// 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_POLICY_NETWORKING_USER_NETWORK_CONFIGURATION_UPDATER_H_ +#define CHROME_BROWSER_POLICY_NETWORKING_USER_NETWORK_CONFIGURATION_UPDATER_H_ + +#include <memory> + +#include "base/values.h" +#include "chrome/browser/policy/networking/network_configuration_updater.h" +#include "components/keyed_service/core/keyed_service.h" +#include "components/policy/core/common/policy_service.h" + +namespace policy { + +// Handles server and authority certificates from the user ONC policy. Ignores +// client certificates and network configs. +class UserNetworkConfigurationUpdater : public NetworkConfigurationUpdater, + public KeyedService { + public: + // Creates an updater that applies the server and authority part of ONC user + // policy from |policy_service| once the policy service is completely + // initialized and on each policy change. + static std::unique_ptr<UserNetworkConfigurationUpdater> CreateForUserPolicy( + PolicyService* policy_service); + + explicit UserNetworkConfigurationUpdater(PolicyService* policy_service); + + // NetworkConfigurationUpdater + void ImportClientCertificates() override {} + void ApplyNetworkPolicy( + base::ListValue* network_configs_onc, + base::DictionaryValue* global_network_config) override {} +}; + +} // namespace policy + +#endif // CHROME_BROWSER_POLICY_NETWORKING_USER_NETWORK_CONFIGURATION_UPDATER_H_
diff --git a/chrome/browser/policy/networking/user_network_configuration_updater_ash.cc b/chrome/browser/policy/networking/user_network_configuration_updater_ash.cc index 55a29bf..6f0524d4 100644 --- a/chrome/browser/policy/networking/user_network_configuration_updater_ash.cc +++ b/chrome/browser/policy/networking/user_network_configuration_updater_ash.cc
@@ -18,6 +18,7 @@ #include "chrome/browser/net/nss_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chromeos/components/onc/onc_parsed_certificates.h" +#include "chromeos/components/onc/onc_utils.h" #include "chromeos/network/managed_network_configuration_handler.h" #include "chromeos/network/network_cert_loader.h" #include "chromeos/network/onc/network_onc_utils.h" @@ -46,7 +47,7 @@ } // namespace -UserNetworkConfigurationUpdater::~UserNetworkConfigurationUpdater() { +UserNetworkConfigurationUpdaterAsh::~UserNetworkConfigurationUpdaterAsh() { // NetworkCertLoader may be not initialized in tests. if (chromeos::NetworkCertLoader::IsInitialized()) { chromeos::NetworkCertLoader::Get()->SetUserPolicyCertificateProvider( @@ -55,42 +56,62 @@ } // static -std::unique_ptr<UserNetworkConfigurationUpdater> -UserNetworkConfigurationUpdater::CreateForUserPolicy( +std::unique_ptr<UserNetworkConfigurationUpdaterAsh> +UserNetworkConfigurationUpdaterAsh::CreateForUserPolicy( Profile* profile, const user_manager::User& user, PolicyService* policy_service, chromeos::ManagedNetworkConfigurationHandler* network_config_handler) { - std::unique_ptr<UserNetworkConfigurationUpdater> updater( - new UserNetworkConfigurationUpdater(profile, user, policy_service, - network_config_handler)); + std::unique_ptr<UserNetworkConfigurationUpdaterAsh> updater( + new UserNetworkConfigurationUpdaterAsh(profile, user, policy_service, + network_config_handler)); updater->Init(); return updater; } -void UserNetworkConfigurationUpdater::SetClientCertificateImporterForTest( +void UserNetworkConfigurationUpdaterAsh::SetClientCertificateImporterForTest( std::unique_ptr<chromeos::onc::CertificateImporter> client_certificate_importer) { SetClientCertificateImporter(std::move(client_certificate_importer)); } // static -bool UserNetworkConfigurationUpdater::PolicyHasWebTrustedAuthorityCertificate( - const PolicyMap& policy_map) { - return NetworkConfigurationUpdater::PolicyHasWebTrustedAuthorityCertificate( - policy_map, onc::ONC_SOURCE_USER_POLICY, key::kOpenNetworkConfiguration); +bool UserNetworkConfigurationUpdaterAsh:: + PolicyHasWebTrustedAuthorityCertificate(const PolicyMap& policy_map) { + const base::Value* policy_value = + policy_map.GetValue(key::kOpenNetworkConfiguration); + + if (!policy_value || policy_value->type() != base::Value::Type::STRING) + return false; + + base::ListValue certificates_value; + chromeos::onc::ParseAndValidateOncForImport( + policy_value->GetString(), onc::ONC_SOURCE_USER_POLICY, + /*passphrase=*/std::string(), + /*network_configs=*/nullptr, /*global_network_config=*/nullptr, + &certificates_value); + chromeos::onc::OncParsedCertificates onc_parsed_certificates( + certificates_value); + for (const auto& server_or_authority_cert : + onc_parsed_certificates.server_or_authority_certificates()) { + if (server_or_authority_cert.type() == + chromeos::onc::OncParsedCertificates::ServerOrAuthorityCertificate:: + Type::kAuthority && + server_or_authority_cert.web_trust_requested()) { + return true; + } + } + return false; } -UserNetworkConfigurationUpdater::UserNetworkConfigurationUpdater( +UserNetworkConfigurationUpdaterAsh::UserNetworkConfigurationUpdaterAsh( Profile* profile, const user_manager::User& user, PolicyService* policy_service, chromeos::ManagedNetworkConfigurationHandler* network_config_handler) - : NetworkConfigurationUpdater(onc::ONC_SOURCE_USER_POLICY, - key::kOpenNetworkConfiguration, - policy_service, - network_config_handler), - user_(&user) { + : UserNetworkConfigurationUpdater(policy_service), + user_(&user), + network_config_handler_(network_config_handler) { // The updater is created with |client_certificate_importer_| unset and is // responsible for creating it. This requires |GetNSSCertDatabaseForProfile| // call, which is not safe before the profile initialization is finalized. @@ -101,14 +122,14 @@ // Make sure that the |NetworkCertLoader| which makes certificates available // to the chromeos network code gets policy-pushed certificates from the - // primary profile. This assumes that a |UserNetworkConfigurationUpdater| is - // only created for the primary profile. NetworkCertLoader may be not + // primary profile. This assumes that a |UserNetworkConfigurationUpdaterAsh| + // is only created for the primary profile. NetworkCertLoader may be not // initialized in tests. if (chromeos::NetworkCertLoader::IsInitialized()) chromeos::NetworkCertLoader::Get()->SetUserPolicyCertificateProvider(this); } -void UserNetworkConfigurationUpdater::ImportClientCertificates() { +void UserNetworkConfigurationUpdaterAsh::ImportClientCertificates() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); // If certificate importer is not yet set, the import of client certificates @@ -119,7 +140,7 @@ } } -void UserNetworkConfigurationUpdater::ApplyNetworkPolicy( +void UserNetworkConfigurationUpdaterAsh::ApplyNetworkPolicy( base::ListValue* network_configs_onc, base::DictionaryValue* global_network_config) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -140,7 +161,7 @@ *global_network_config); } -void UserNetworkConfigurationUpdater::Observe( +void UserNetworkConfigurationUpdaterAsh::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { @@ -159,12 +180,12 @@ ->CreateNSSCertDatabaseGetterForIOThread(), base::BindPostTask( base::SequencedTaskRunnerHandle::Get(), - base::BindOnce(&UserNetworkConfigurationUpdater:: + base::BindOnce(&UserNetworkConfigurationUpdaterAsh:: CreateAndSetClientCertificateImporter, weak_factory_.GetWeakPtr())))); } -void UserNetworkConfigurationUpdater::CreateAndSetClientCertificateImporter( +void UserNetworkConfigurationUpdaterAsh::CreateAndSetClientCertificateImporter( net::NSSCertDatabase* database) { DCHECK(database); SetClientCertificateImporter( @@ -172,7 +193,7 @@ content::GetIOThreadTaskRunner({}), database)); } -void UserNetworkConfigurationUpdater::SetClientCertificateImporter( +void UserNetworkConfigurationUpdaterAsh::SetClientCertificateImporter( std::unique_ptr<chromeos::onc::CertificateImporter> client_certificate_importer) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git a/chrome/browser/policy/networking/user_network_configuration_updater_ash.h b/chrome/browser/policy/networking/user_network_configuration_updater_ash.h index 53c0ab58..204bbd0 100644 --- a/chrome/browser/policy/networking/user_network_configuration_updater_ash.h +++ b/chrome/browser/policy/networking/user_network_configuration_updater_ash.h
@@ -10,8 +10,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/policy/networking/network_configuration_updater.h" -#include "components/keyed_service/core/keyed_service.h" +#include "chrome/browser/policy/networking/user_network_configuration_updater.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "net/cert/scoped_nss_types.h" @@ -33,6 +32,7 @@ } // namespace net namespace chromeos { +class ManagedNetworkConfigurationHandler; namespace onc { class CertificateImporter; @@ -47,22 +47,23 @@ // Implements additional special handling of ONC user policies. Namely string // expansion with the user's name (or email address, etc.) and handling of "Web" // trust of certificates. -class UserNetworkConfigurationUpdater : public NetworkConfigurationUpdater, - public KeyedService, - public content::NotificationObserver { +class UserNetworkConfigurationUpdaterAsh + : public UserNetworkConfigurationUpdater, + public content::NotificationObserver { public: - UserNetworkConfigurationUpdater(const UserNetworkConfigurationUpdater&) = - delete; - UserNetworkConfigurationUpdater& operator=( - const UserNetworkConfigurationUpdater&) = delete; + UserNetworkConfigurationUpdaterAsh( + const UserNetworkConfigurationUpdaterAsh&) = delete; + UserNetworkConfigurationUpdaterAsh& operator=( + const UserNetworkConfigurationUpdaterAsh&) = delete; - ~UserNetworkConfigurationUpdater() override; + ~UserNetworkConfigurationUpdaterAsh() override; // Creates an updater that applies the ONC user policy from |policy_service| // for user |user| once the policy service is completely initialized and on // each policy change. A reference to |user| is stored. It must outlive the // returned updater. - static std::unique_ptr<UserNetworkConfigurationUpdater> CreateForUserPolicy( + static std::unique_ptr<UserNetworkConfigurationUpdaterAsh> + CreateForUserPolicy( Profile* profile, const user_manager::User& user, PolicyService* policy_service, @@ -76,14 +77,14 @@ // Determines if |policy_map| contains a OpenNetworkConfiguration policy that // mandates that at least one additional certificate should be used and - // assignd 'Web' trust. + // assigned 'Web' trust. static bool PolicyHasWebTrustedAuthorityCertificate( const PolicyMap& policy_map); private: class CrosTrustAnchorProvider; - UserNetworkConfigurationUpdater( + UserNetworkConfigurationUpdaterAsh( Profile* profile, const user_manager::User& user, PolicyService* policy_service, @@ -112,7 +113,10 @@ std::unique_ptr<chromeos::onc::CertificateImporter> certificate_importer); // The user for whom the user policy will be applied. - const user_manager::User* user_; + const user_manager::User* const user_; + + // Pointer to the global singleton or a test instance. + chromeos::ManagedNetworkConfigurationHandler* const network_config_handler_; // Certificate importer to be used for importing policy defined client // certificates. Set by |SetClientCertificateImporter|. @@ -121,7 +125,7 @@ content::NotificationRegistrar registrar_; - base::WeakPtrFactory<UserNetworkConfigurationUpdater> weak_factory_{this}; + base::WeakPtrFactory<UserNetworkConfigurationUpdaterAsh> weak_factory_{this}; }; } // namespace policy
diff --git a/chrome/browser/policy/networking/user_network_configuration_updater_factory.cc b/chrome/browser/policy/networking/user_network_configuration_updater_factory.cc index 9fab0e5..f9e896b 100644 --- a/chrome/browser/policy/networking/user_network_configuration_updater_factory.cc +++ b/chrome/browser/policy/networking/user_network_configuration_updater_factory.cc
@@ -5,17 +5,21 @@ #include "chrome/browser/policy/networking/user_network_configuration_updater_factory.h" #include "base/memory/singleton.h" -#include "chrome/browser/ash/profiles/profile_helper.h" #include "chrome/browser/net/nss_service_factory.h" -#include "chrome/browser/policy/networking/user_network_configuration_updater_ash.h" +#include "chrome/browser/policy/networking/user_network_configuration_updater.h" #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/profiles/incognito_helpers.h" #include "chrome/browser/profiles/profile.h" #include "chromeos/network/network_handler.h" #include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" + +#if BUILDFLAG(IS_CHROMEOS_ASH) +#include "chrome/browser/ash/profiles/profile_helper.h" +#include "chrome/browser/policy/networking/user_network_configuration_updater_ash.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" +#endif // BUILDFLAG(IS_CHROMEOS_ASH) namespace policy { @@ -58,6 +62,7 @@ return true; } +#if BUILDFLAG(IS_CHROMEOS_ASH) KeyedService* UserNetworkConfigurationUpdaterFactory::BuildServiceInstanceFor( content::BrowserContext* context) const { // On the login/lock screen only device network policies apply. @@ -80,12 +85,38 @@ // set for all user sessions. // TODO(https://crbug.com/1001490): Evaluate if this is can be solved in a // more elegant way. - return UserNetworkConfigurationUpdater::CreateForUserPolicy( + return UserNetworkConfigurationUpdaterAsh::CreateForUserPolicy( profile, *user, profile->GetProfilePolicyConnector()->policy_service(), chromeos::NetworkHandler::Get() ->managed_network_configuration_handler()) .release(); } +#endif // BUILDFLAG(IS_CHROMEOS_ASH) + +#if BUILDFLAG(IS_CHROMEOS_LACROS) +KeyedService* UserNetworkConfigurationUpdaterFactory::BuildServiceInstanceFor( + content::BrowserContext* context) const { + // Lacros only handles CA certificates from the ONC policy and it is only + // supported for the main profile. + Profile* profile = Profile::FromBrowserContext(context); + if (!profile->IsMainProfile()) { + return nullptr; + } + + // Lacros only handles CA certificates from the ONC policy, so the simple + // UserNetworkConfigurationUpdater is sufficient for it. Client certs and + // network configs will be processed by Ash. + // Note that sessions which don't have policy (e.g. guest sessions) still + // expect to have UserNetworkConfigurationUpdater, because + // ManagedNetworkConfigurationHandler requires a (possibly empty) policy to be + // set for all user sessions. + // TODO(https://crbug.com/1001490): Evaluate if this is can be solved in a + // more elegant way. + return UserNetworkConfigurationUpdater::CreateForUserPolicy( + profile->GetProfilePolicyConnector()->policy_service()) + .release(); +} +#endif // BUILDFLAG(IS_CHROMEOS_LACROS) } // namespace policy
diff --git a/chrome/browser/policy/networking/user_network_configuration_updater_factory.h b/chrome/browser/policy/networking/user_network_configuration_updater_factory.h index 3d37d886..035ac61 100644 --- a/chrome/browser/policy/networking/user_network_configuration_updater_factory.h +++ b/chrome/browser/policy/networking/user_network_configuration_updater_factory.h
@@ -20,7 +20,8 @@ class UserNetworkConfigurationUpdater; -// Factory to create UserNetworkConfigurationUpdater. +// Factory to create UserNetworkConfigurationUpdater for the the per-user +// OpenNetworkConfiguration policy. class UserNetworkConfigurationUpdaterFactory : public BrowserContextKeyedServiceFactory { public:
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.cc b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.cc index 219e539..1bd41fd3 100644 --- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.cc +++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.cc
@@ -47,7 +47,7 @@ } #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void PrefetchProxyNetworkContextClient::OnTrustAnchorUsed() {} #endif
diff --git a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.h b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.h index 3f253c8b..d1c8e5e 100644 --- a/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.h +++ b/chrome/browser/prefetch/prefetch_proxy/prefetch_proxy_network_context_client.h
@@ -38,7 +38,7 @@ const std::string& spn, OnGenerateHttpNegotiateAuthTokenCallback callback) override; #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void OnTrustAnchorUsed() override; #endif void OnTrustTokenIssuanceDivertedToSystem(
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc index d476e10..9a4e298 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc
@@ -265,6 +265,7 @@ #if BUILDFLAG(IS_CHROMEOS) #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_impl.h" #include "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_platform_keys_api.h" +#include "chrome/browser/policy/networking/policy_cert_service.h" #include "chrome/browser/policy/system_features_disable_list_policy_handler.h" #include "chrome/browser/ui/webui/certificates_handler.h" #if defined(USE_CUPS) @@ -365,7 +366,6 @@ #include "chrome/browser/extensions/extension_assets_manager_chromeos.h" #include "chrome/browser/media/protected_media_identifier_permission_context.h" #include "chrome/browser/metrics/chromeos_metrics_provider.h" -#include "chrome/browser/policy/networking/policy_cert_service.h" #include "chrome/browser/ui/app_list/app_list_syncable_service.h" #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" #include "chrome/browser/ui/ash/shelf/chrome_shelf_prefs.h" @@ -1365,6 +1365,7 @@ #if BUILDFLAG(IS_CHROMEOS) extensions::platform_keys::RegisterProfilePrefs(registry); certificate_manager::CertificatesHandler::RegisterProfilePrefs(registry); + policy::PolicyCertService::RegisterProfilePrefs(registry); #if defined(USE_CUPS) extensions::PrintingAPIHandler::RegisterProfilePrefs(registry); #endif // defined(USE_CUPS) @@ -1438,7 +1439,6 @@ ash::cert_provisioning::RegisterProfilePrefs(registry); borealis::prefs::RegisterProfilePrefs(registry); ash::ChromeScanningAppDelegate::RegisterProfilePrefs(registry); - policy::PolicyCertService::RegisterProfilePrefs(registry); ProjectorAppClientImpl::RegisterProfilePrefs(registry); #endif // BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java index f87bef2..0f6d26eea 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java
@@ -58,7 +58,10 @@ // Configure the toggle. ChromeSwitchPreference flocToggle = (ChromeSwitchPreference) findPreference(FLOC_TOGGLE); flocToggle.setOnPreferenceChangeListener(this); - flocToggle.setChecked(PrivacySandboxBridge.isFlocEnabled()); + // Disable FLoC while OT not active. + // TODO(crbug.com/1287951): Perform cleanup / adjustment as required. + flocToggle.setChecked(false); + flocToggle.setEnabled(false); // Configure the reset button. Preference resetButton = findPreference(RESET_FLOC_BUTTON); resetButton.setOnPreferenceClickListener(this);
diff --git a/chrome/browser/privacy_sandbox/generated_floc_pref.cc b/chrome/browser/privacy_sandbox/generated_floc_pref.cc index b6371bfc..1db016d29 100644 --- a/chrome/browser/privacy_sandbox/generated_floc_pref.cc +++ b/chrome/browser/privacy_sandbox/generated_floc_pref.cc
@@ -42,37 +42,13 @@ std::unique_ptr<extensions::api::settings_private::PrefObject> GeneratedFlocPref::GetPrefObject() const { - auto* privacy_sandbox_pref = - profile_->GetPrefs()->FindPreference(prefs::kPrivacySandboxApisEnabled); - const bool privacy_sandbox_pref_enabled = - privacy_sandbox_pref->GetValue()->GetBool(); - - const bool real_floc_pref_enabled = - profile_->GetPrefs()->GetBoolean(prefs::kPrivacySandboxFlocEnabled); - + // Disable FLoC control while OT not active. + // TODO(crbug.com/1287951): Perform cleanup / adjustment as required. auto floc_pref_object = std::make_unique<settings_api::PrefObject>(); floc_pref_object->key = kGeneratedFlocPref; floc_pref_object->type = settings_api::PREF_TYPE_BOOLEAN; - - // The generated pref is only enabled if both the Privacy Sandbox APIs pref, - // and the real FLoC pref, are both enabled enabled. - floc_pref_object->value = std::make_unique<base::Value>( - privacy_sandbox_pref_enabled && real_floc_pref_enabled); - - // If the Privacy Sandbox APIs are disabled for any reason (including by - // policy), then user control over the generated pref is disabled. - floc_pref_object->user_control_disabled = - std::make_unique<bool>(!privacy_sandbox_pref_enabled); - - // Management state is completely inherited from the Privacy Sandbox APIs - // pref. No management control is exposed over the real FLoC pref, and so - // it does not need to be considered. - if (!privacy_sandbox_pref->IsUserModifiable()) { - floc_pref_object->enforcement = - settings_api::Enforcement::ENFORCEMENT_ENFORCED; - extensions::settings_private::GeneratedPref::ApplyControlledByFromPref( - floc_pref_object.get(), privacy_sandbox_pref); - } + floc_pref_object->value = std::make_unique<base::Value>(false); + floc_pref_object->user_control_disabled = std::make_unique<bool>(true); return floc_pref_object; }
diff --git a/chrome/browser/privacy_sandbox/generated_floc_pref_unittest.cc b/chrome/browser/privacy_sandbox/generated_floc_pref_unittest.cc index bfbb2c3..6d3d180f 100644 --- a/chrome/browser/privacy_sandbox/generated_floc_pref_unittest.cc +++ b/chrome/browser/privacy_sandbox/generated_floc_pref_unittest.cc
@@ -75,25 +75,27 @@ // When the Privacy Sandbox APIs pref is enabled, the generated pref should // follow the state of the real FLoC pref, and user control should be enabled. + // TODO(crbug.com/1287951): User control disabled while OT is not active. prefs()->SetUserPref(prefs::kPrivacySandboxApisEnabled, std::make_unique<base::Value>(true)); prefs()->SetUserPref(prefs::kPrivacySandboxFlocEnabled, std::make_unique<base::Value>(true)); - EXPECT_TRUE(pref->GetPrefObject()->value->GetBool()); - EXPECT_FALSE(*pref->GetPrefObject()->user_control_disabled); + EXPECT_FALSE(pref->GetPrefObject()->value->GetBool()); + EXPECT_TRUE(*pref->GetPrefObject()->user_control_disabled); prefs()->SetUserPref(prefs::kPrivacySandboxFlocEnabled, std::make_unique<base::Value>(false)); EXPECT_FALSE(pref->GetPrefObject()->value->GetBool()); - EXPECT_FALSE(*pref->GetPrefObject()->user_control_disabled); + EXPECT_TRUE(*pref->GetPrefObject()->user_control_disabled); // The generated pref should inherit the management state of the Privacy // Sandbox APIs pref. + // TODO(crbug.com/1287951): No managenent state while OT not active. prefs()->SetManagedPref(prefs::kPrivacySandboxApisEnabled, std::make_unique<base::Value>(false)); - EXPECT_EQ(settings_api::Enforcement::ENFORCEMENT_ENFORCED, + EXPECT_EQ(settings_api::Enforcement::ENFORCEMENT_NONE, pref->GetPrefObject()->enforcement); - EXPECT_EQ(settings_api::ControlledBy::CONTROLLED_BY_DEVICE_POLICY, + EXPECT_EQ(settings_api::ControlledBy::CONTROLLED_BY_NONE, pref->GetPrefObject()->controlled_by); }
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_service.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_service.cc index fcd52b01..72313f7 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_service.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_service.cc
@@ -199,17 +199,8 @@ } std::u16string PrivacySandboxService::GetFlocStatusForDisplay() const { - const bool floc_feature_enabled = base::FeatureList::IsEnabled( - blink::features::kInterestCohortAPIOriginTrial); - const bool floc_setting_enabled = privacy_sandbox_settings_->IsFlocAllowed(); - if (floc_setting_enabled) { - return floc_feature_enabled - ? l10n_util::GetStringUTF16( - IDS_PRIVACY_SANDBOX_FLOC_STATUS_ACTIVE) - : l10n_util::GetStringUTF16( - IDS_PRIVACY_SANDBOX_FLOC_STATUS_ELIGIBLE_NOT_ACTIVE); - } - + // FLoC always disabled while OT not active. + // TODO(crbug.com/1287951): Perform cleanup / adjustment as required. return l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE); }
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc index 3e1e2d1..dc269ef 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_service_unittest.cc
@@ -270,14 +270,16 @@ // Check the status of the user's FLoC is correctly returned. This depends // on whether the FLoC origin trial feature is enabled, and whether the user // has FLoC enabled. + // TODO(crbug.com/1287951): FLoC is always disabled if OT is not active. feature_list()->InitWithFeatures( {blink::features::kInterestCohortAPIOriginTrial}, {}); profile()->GetTestingPrefService()->SetBoolean( prefs::kPrivacySandboxFlocEnabled, true); profile()->GetTestingPrefService()->SetBoolean( prefs::kPrivacySandboxApisEnabled, true); - EXPECT_EQ(l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_ACTIVE), - privacy_sandbox_service()->GetFlocStatusForDisplay()); + EXPECT_EQ( + l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE), + privacy_sandbox_service()->GetFlocStatusForDisplay()); // The Privacy Sandbox APIs pref & FLoC pref should disable the trial when // either is disabled. @@ -300,9 +302,9 @@ feature_list()->Reset(); feature_list()->InitWithFeatures( {}, {blink::features::kInterestCohortAPIOriginTrial}); - EXPECT_EQ(l10n_util::GetStringUTF16( - IDS_PRIVACY_SANDBOX_FLOC_STATUS_ELIGIBLE_NOT_ACTIVE), - privacy_sandbox_service()->GetFlocStatusForDisplay()); + EXPECT_EQ( + l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE), + privacy_sandbox_service()->GetFlocStatusForDisplay()); } TEST_F(PrivacySandboxServiceTest, IsFlocIdResettable) {
diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc index b6f1fc0..c90b3e9 100644 --- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc +++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
@@ -163,8 +163,6 @@ #include "chrome/browser/ash/system_extensions/system_extensions_provider.h" #include "chrome/browser/ash/system_extensions/system_extensions_provider_factory.h" #include "chrome/browser/nearby_sharing/nearby_sharing_service_factory.h" -#include "chrome/browser/policy/networking/policy_cert_service_factory.h" -#include "chrome/browser/policy/networking/user_network_configuration_updater_factory.h" #else #include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" #include "chrome/browser/profiles/gaia_info_update_service_factory.h" @@ -173,6 +171,8 @@ #if BUILDFLAG(IS_CHROMEOS) #include "chrome/browser/chromeos/policy/dlp/dlp_rules_manager_factory.h" #include "chrome/browser/policy/messaging_layer/util/heartbeat_event_factory.h" +#include "chrome/browser/policy/networking/policy_cert_service_factory.h" +#include "chrome/browser/policy/networking/user_network_configuration_updater_factory.h" #endif #if BUILDFLAG(IS_WIN) @@ -266,8 +266,6 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) ash::login::SecurityTokenSessionControllerFactory::GetInstance(); ash::EnsureBrowserContextKeyedServiceFactoriesBuilt(); - policy::PolicyCertServiceFactory::GetInstance(); - policy::UserNetworkConfigurationUpdaterFactory::GetInstance(); #endif AboutSigninInternalsFactory::GetInstance(); @@ -428,6 +426,8 @@ #endif #if BUILDFLAG(IS_CHROMEOS) policy::DlpRulesManagerFactory::GetInstance(); + policy::PolicyCertServiceFactory::GetInstance(); + policy::UserNetworkConfigurationUpdaterFactory::GetInstance(); #endif policy::UserCloudPolicyInvalidatorFactory::GetInstance(); #if !BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/resource_coordinator/tab_activity_watcher_browsertest.cc b/chrome/browser/resource_coordinator/tab_activity_watcher_browsertest.cc index 0fd4bb1e..bfa6433 100644 --- a/chrome/browser/resource_coordinator/tab_activity_watcher_browsertest.cc +++ b/chrome/browser/resource_coordinator/tab_activity_watcher_browsertest.cc
@@ -207,7 +207,7 @@ ScopedSetTickClockForTesting scoped_set_tick_clock_for_testing(&test_clock); test_clock.Advance(base::Minutes(1)); - AddTabAtIndex(1, test_urls_[0], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(1, test_urls_[0], ui::PAGE_TRANSITION_LINK)); test_clock.Advance(base::Minutes(1)); browser()->tab_strip_model()->ActivateTabAt( @@ -241,14 +241,14 @@ UkmMetricMap expected_metrics = kBasicMetricValues; // Adding a new foreground tab logs the previously active tab. - AddTabAtIndex(1, kTabUrls[1], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(1, kTabUrls[1], ui::PAGE_TRANSITION_LINK)); { SCOPED_TRACE(""); ukm_entry_checker_->ExpectNewEntry(kTabMetricsEntryName, kTabUrls[0], expected_metrics); } - AddTabAtIndex(2, kTabUrls[2], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(2, kTabUrls[2], ui::PAGE_TRANSITION_LINK)); { SCOPED_TRACE(""); ukm_entry_checker_->ExpectNewEntry(kTabMetricsEntryName, kTabUrls[1], @@ -291,16 +291,20 @@ Browser* browser_2 = CreateBrowser(browser()->profile()); EXPECT_EQ(0, ukm_entry_checker_->NumNewEntriesRecorded(kTabMetricsEntryName)); - AddTabAtIndexToBrowser(browser(), 1, test_urls_[0], ui::PAGE_TRANSITION_LINK, - kCheckNavigationSuccess); + EXPECT_EQ( + AddTabAtIndexToBrowser(browser(), 1, test_urls_[0], + ui::PAGE_TRANSITION_LINK, kCheckNavigationSuccess), + kCheckNavigationSuccess); { SCOPED_TRACE(""); ukm_entry_checker_->ExpectNewEntry(kTabMetricsEntryName, GURL(), kBasicMetricValues); } - AddTabAtIndexToBrowser(browser_2, 1, test_urls_[1], ui::PAGE_TRANSITION_LINK, - kCheckNavigationSuccess); + EXPECT_EQ( + AddTabAtIndexToBrowser(browser_2, 1, test_urls_[1], + ui::PAGE_TRANSITION_LINK, kCheckNavigationSuccess), + kCheckNavigationSuccess); { SCOPED_TRACE(""); ukm_entry_checker_->ExpectNewEntry(kTabMetricsEntryName, GURL(), @@ -323,7 +327,7 @@ ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), url)); // Log metrics for the first tab by switching to a new tab. - AddTabAtIndex(1, test_urls_[0], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(1, test_urls_[0], ui::PAGE_TRANSITION_LINK)); UkmMetricMap expected_metrics = kBasicMetricValues; expected_metrics[TabManager_TabMetrics::kHasBeforeUnloadHandlerName] = 1; expected_metrics[TabManager_TabMetrics::kNavigationEntryCountName] = 2; @@ -356,8 +360,10 @@ ASSERT_TRUE(ui_test_utils::NavigateToURL(browser_2, kBrowser2StartUrl)); // Adding a tab backgrounds the original tab in the window. - AddTabAtIndexToBrowser(browser(), 1, kDraggedTabUrl, ui::PAGE_TRANSITION_LINK, - kCheckNavigationSuccess); + EXPECT_EQ( + AddTabAtIndexToBrowser(browser(), 1, kDraggedTabUrl, + ui::PAGE_TRANSITION_LINK, kCheckNavigationSuccess), + kCheckNavigationSuccess); { SCOPED_TRACE(""); UkmMetricMap expected_metrics_1 = kBasicMetricValues; @@ -428,7 +434,7 @@ EXPECT_EQ(0u, ukm_entry_checker_->NumEntries(kTabMetricsEntryName)); // Adding a new foreground tab logs the previously active tab. - AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK)); { SCOPED_TRACE(""); ukm_entry_checker_->ExpectNewEntry( @@ -516,7 +522,7 @@ ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_urls_[0])); // Adding a new foreground tab logs the previously active tab. - AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK)); { SCOPED_TRACE(""); UkmMetricMap expected_metrics = { @@ -559,10 +565,10 @@ ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_urls_[0])); // Insert the tab@1. - AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK)); test_clock.Advance(base::Minutes(1)); // Insert the tab@2. - AddTabAtIndex(2, test_urls_[2], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(2, test_urls_[2], ui::PAGE_TRANSITION_LINK)); test_clock.Advance(base::Minutes(1)); // Activate tab@0. browser()->tab_strip_model()->ActivateTabAt( @@ -664,7 +670,7 @@ TabActivityWatcherTestWithBackgroundLogDisabledAndOnlyOneOldestTab, DiscardedTabGetsCorrectLabelId) { ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_urls_[0])); - AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK)); // No TabMetrics events are logged till now. EXPECT_EQ(0u, ukm_entry_checker_->NumEntries(kTabMetricsEntryName)); @@ -742,7 +748,7 @@ TabActivityWatcherTestWithBackgroundLogDisabledAndOnlyOneOldestTab, TabsAlreadyHaveLabelIdGetIncrementalLabelIds) { ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), test_urls_[0])); - AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK)); // No TabMetrics events are logged till now. EXPECT_EQ(0u, ukm_entry_checker_->NumEntries(kTabMetricsEntryName)); @@ -812,7 +818,7 @@ prerender_helper().AddPrerender(prerender_url); // Adding a new foreground tab logs the previously active tab. - AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE(AddTabAtIndex(1, test_urls_[1], ui::PAGE_TRANSITION_LINK)); { SCOPED_TRACE(""); ukm_entry_checker_->ExpectNewEntry(
diff --git a/chrome/browser/resource_coordinator/tab_metrics_logger_interactive_uitest.cc b/chrome/browser/resource_coordinator/tab_metrics_logger_interactive_uitest.cc index 9b3d06b..a5b5d625 100644 --- a/chrome/browser/resource_coordinator/tab_metrics_logger_interactive_uitest.cc +++ b/chrome/browser/resource_coordinator/tab_metrics_logger_interactive_uitest.cc
@@ -94,14 +94,14 @@ // Updated metrics after adding tabs. { SCOPED_TRACE(""); - AddTabAtIndex(1, GURL(kTestUrl), ui::PAGE_TRANSITION_LINK); + ASSERT_FALSE(AddTabAtIndex(1, GURL(kTestUrl), ui::PAGE_TRANSITION_LINK)); expected_metrics.tab_count++; EXPECT_EQ(TabMetricsLogger::CreateWindowFeatures(browser()), expected_metrics); } { SCOPED_TRACE(""); - AddTabAtIndex(0, GURL(kTestUrl), ui::PAGE_TRANSITION_LINK); + ASSERT_FALSE(AddTabAtIndex(0, GURL(kTestUrl), ui::PAGE_TRANSITION_LINK)); expected_metrics.tab_count++; EXPECT_EQ(TabMetricsLogger::CreateWindowFeatures(browser()), expected_metrics); @@ -115,7 +115,7 @@ IN_PROC_BROWSER_TEST_F(TabMetricsLoggerTest, GetDiscardCount) { // We need at least two tabs because "transition from DISCARDED to DISCARDED // is not allowed". - AddTabAtIndex(1, GURL(kTestUrl), ui::PAGE_TRANSITION_LINK); + ASSERT_FALSE(AddTabAtIndex(1, GURL(kTestUrl), ui::PAGE_TRANSITION_LINK)); EXPECT_EQ(CurrentTabFeatures(0).discard_count, 0); DiscardTabAt(0); EXPECT_EQ(CurrentTabFeatures(0).discard_count, 1);
diff --git a/chrome/browser/resources/chromeos/login/components/oobe_vars/oobe_shared_vars_css.html b/chrome/browser/resources/chromeos/login/components/oobe_vars/oobe_shared_vars_css.html index c135ede..e90a8e2 100644 --- a/chrome/browser/resources/chromeos/login/components/oobe_vars/oobe_shared_vars_css.html +++ b/chrome/browser/resources/chromeos/login/components/oobe_vars/oobe_shared_vars_css.html
@@ -37,7 +37,7 @@ --oobe-header-text-color: var(--google-grey-900); --oobe-subheader-text-color: var(--google-grey-700); - --oobe-footer-text-color: var(--google-grey-500); + --oobe-footer-text-color: var(--google-grey-700); --oobe-radio-card-label-line-height: 24px; /* Fonts vars end */
diff --git a/chrome/browser/resources/chromeos/login/screens/common/hw_data_collection.html b/chrome/browser/resources/chromeos/login/screens/common/hw_data_collection.html index f776e512..c4c8d530 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/hw_data_collection.html +++ b/chrome/browser/resources/chromeos/login/screens/common/hw_data_collection.html
@@ -43,10 +43,6 @@ <span id="dataUsageLabel"> [[i18nDynamic(locale, 'HWDataCollectionUsageInfo')]] </span> - <a id="learnMore" class="oobe-local-link" is="action-link" - on-click="onDataUsageHelpLinkClicked_"> - [[i18nDynamic(locale, 'learnMore')]] - </a> </div> </cr-checkbox> </div>
diff --git a/chrome/browser/resources/chromeos/login/screens/common/hw_data_collection.js b/chrome/browser/resources/chromeos/login/screens/common/hw_data_collection.js index 3326d275..acff78f 100644 --- a/chrome/browser/resources/chromeos/login/screens/common/hw_data_collection.js +++ b/chrome/browser/resources/chromeos/login/screens/common/hw_data_collection.js
@@ -84,11 +84,6 @@ this.userActed('unselect-hw-data-usage'); } } - - /** - * @private - */ - onDataUsageHelpLinkClicked_() {} } customElements.define(HWDataCollectionScreen.is, HWDataCollectionScreen);
diff --git a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc index 6e70552..2c558f3 100644 --- a/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_protection/download_protection_service_unittest.cc
@@ -1926,7 +1926,7 @@ Mock::VerifyAndClearExpectations(binary_feature_extractor_.get()); } -#endif // OS_MAC +#endif // BUILDFLAG(IS_MAC) TEST_F(DownloadProtectionServiceTest, CheckClientDownloadValidateRequest) { #if BUILDFLAG(IS_MAC) @@ -1948,7 +1948,7 @@ "http://www.google.com/", // referrer FILE_PATH_LITERAL("bla.tmp"), // tmp_path FILE_PATH_LITERAL("bla.exe")); // final_path -#endif // OS_MAC +#endif // BUILDFLAG(IS_MAC) content::DownloadItemUtils::AttachInfoForTesting(&item, profile(), nullptr); std::string remote_address = "10.11.12.13"; @@ -1964,7 +1964,7 @@ ExtractImageFeatures( tmp_path_, BinaryFeatureExtractor::kDefaultOptions, _, _)) .WillOnce(SetDosHeaderContents("dummy dos header")); -#endif // OS_MAC +#endif // BUILDFLAG(IS_MAC) PrepareResponse(ClientDownloadResponse::SAFE, net::HTTP_OK, net::OK); @@ -2003,7 +2003,7 @@ EXPECT_TRUE(headers.has_pe_headers()); EXPECT_TRUE(headers.pe_headers().has_dos_header()); EXPECT_EQ("dummy dos header", headers.pe_headers().dos_header()); -#endif // OS_MAC +#endif // BUILDFLAG(IS_MAC) } // Similar to above, but with an unsigned binary. @@ -2013,7 +2013,7 @@ std::string download_file_path("ftp://www.google.com/bla.dmg"); #else std::string download_file_path("ftp://www.google.com/bla.exe"); -#endif // OS_MAC +#endif // BUILDFLAG(IS_MAC) NiceMockDownloadItem item; #if BUILDFLAG(IS_MAC) @@ -2028,7 +2028,7 @@ "http://www.google.com/", // referrer FILE_PATH_LITERAL("bla.tmp"), // tmp_path FILE_PATH_LITERAL("bla.exe")); // final_path -#endif // OS_MAC +#endif // BUILDFLAG(IS_MAC) content::DownloadItemUtils::AttachInfoForTesting(&item, profile(), nullptr); std::string remote_address = "10.11.12.13"; @@ -2041,7 +2041,7 @@ EXPECT_CALL(*binary_feature_extractor_.get(), ExtractImageFeatures( tmp_path_, BinaryFeatureExtractor::kDefaultOptions, _, _)); -#endif // OS_MAC +#endif // BUILDFLAG(IS_MAC) PrepareResponse(ClientDownloadResponse::SAFE, net::HTTP_OK, net::OK);
diff --git a/chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc index be0de1c..aec5c84 100644 --- a/chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/state_store_unittest.cc
@@ -57,11 +57,11 @@ registry_util::RegistryOverrideManager registry_override_manager_; }; -#else // OS_WIN +#else // BUILDFLAG(IS_WIN) using PlatformStateStoreTestBase = ::testing::Test; -#endif // !OS_WIN +#endif // BUILDFLAG(IS_WIN) // A test fixture with a testing profile that writes its user prefs to a json // file.
diff --git a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/link_to_text/LinkToTextCoordinator.java b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/link_to_text/LinkToTextCoordinator.java index ffff0d4..a294db5 100644 --- a/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/link_to_text/LinkToTextCoordinator.java +++ b/chrome/browser/share/android/java/src/org/chromium/chrome/browser/share/link_to_text/LinkToTextCoordinator.java
@@ -57,21 +57,32 @@ private static final int PREVIEW_SELECTED_TEXT_CUTOFF_LENGTH = 32; private static final String PREVIEW_ELLIPSIS = "..."; - private final ChromeOptionShareCallback mChromeOptionShareCallback; - private final Tab mTab; - private final ChromeShareExtras mChromeShareExtras; - private final long mShareStartTime; + private ChromeOptionShareCallback mChromeOptionShareCallback; + private Tab mTab; + private ChromeShareExtras mChromeShareExtras; + private long mShareStartTime; private String mShareUrl; private TextFragmentReceiver mProducer; private String mSelectedText; private ShareParams mShareLinkParams; private ShareParams mShareTextParams; - private @RemoteRequestStatus int mRemoteRequestStatus; + public @RemoteRequestStatus int mRemoteRequestStatus; + + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + LinkToTextCoordinator() {} public LinkToTextCoordinator(Tab tab, ChromeOptionShareCallback chromeOptionShareCallback, ChromeShareExtras chromeShareExtras, long shareStartTime, String visibleUrl, String selectedText) { + initLinkToTextCoordinator(tab, chromeOptionShareCallback, chromeShareExtras, shareStartTime, + visibleUrl, selectedText); + } + + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + void initLinkToTextCoordinator(Tab tab, ChromeOptionShareCallback chromeOptionShareCallback, + ChromeShareExtras chromeShareExtras, long shareStartTime, String visibleUrl, + String selectedText) { mTab = tab; mChromeOptionShareCallback = chromeOptionShareCallback; mChromeShareExtras = chromeShareExtras; @@ -149,7 +160,8 @@ requestSelectorForCanonicalUrl(); } - private void reshareHighlightedText() { + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + void reshareHighlightedText() { setTextFragmentReceiver(); if (mProducer == null) { completeReshareWithFailure(LinkToTextReshareStatus.NO_REMOTE_CONNECTION); @@ -160,15 +172,19 @@ mRemoteRequestStatus = RemoteRequestStatus.REQUESTED; LinkToTextHelper.extractTextFragmentsMatches(mProducer, (matches) -> { mSelectedText = String.join(",", matches); - LinkToTextHelper.getExistingSelectorsAllFrames(mTab, (selectors) -> { - if (mRemoteRequestStatus == RemoteRequestStatus.CANCELLED) return; - - mRemoteRequestStatus = RemoteRequestStatus.COMPLETED; - completeRemoteRequestWithSuccess(selectors); - }); + LinkToTextHelper.getExistingSelectorsAllFrames( + mTab, this::onReshareSelectorsRemoteRequestCompleted); }); } + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + void onReshareSelectorsRemoteRequestCompleted(String selectors) { + if (mRemoteRequestStatus == RemoteRequestStatus.CANCELLED) return; + + mRemoteRequestStatus = RemoteRequestStatus.COMPLETED; + completeRemoteRequestWithSuccess(selectors); + } + // Discard results if tab is not on foreground anymore. @Override public void onHidden(Tab tab, @TabHidingType int type) { @@ -199,12 +215,34 @@ } } - private void requestSelector() { - if (ChromeFeatureList.isEnabled(ChromeFeatureList.PREEMPTIVE_LINK_TO_TEXT_GENERATION)) { - LinkToTextMetricsHelper.recordLinkToTextDiagnoseStatus( - LinkToTextMetricsHelper.LinkToTextDiagnoseStatus.REQUEST_SELECTOR); + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + void onRemoteRequestCompleted(String selector, Integer error, Integer readyStatus) { + if (mRemoteRequestStatus == RemoteRequestStatus.CANCELLED) return; + + mRemoteRequestStatus = RemoteRequestStatus.COMPLETED; + boolean success = !selector.isEmpty(); + assert error != null; + + if (success) { + assert error == LinkGenerationError.NONE; + completeRemoteRequestWithSuccess(selector); + } else { + assert error != LinkGenerationError.NONE; + completeRequestWithFailure(error.intValue()); } + assert readyStatus != null; + + @LinkGenerationStatus + int status = success ? LinkGenerationStatus.FAILURE : LinkGenerationStatus.SUCCESS; + LinkToTextBridge.logLinkRequestedBeforeStatus(status, readyStatus.intValue()); + } + + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + void requestSelector() { + LinkToTextMetricsHelper.recordLinkToTextDiagnoseStatus( + LinkToTextMetricsHelper.LinkToTextDiagnoseStatus.REQUEST_SELECTOR); + setTextFragmentReceiver(); if (mProducer == null) { @@ -213,27 +251,7 @@ } mRemoteRequestStatus = RemoteRequestStatus.REQUESTED; - LinkToTextHelper.requestSelector(mProducer, (selector, error, readyStatus) -> { - if (mRemoteRequestStatus == RemoteRequestStatus.CANCELLED) return; - - mRemoteRequestStatus = RemoteRequestStatus.COMPLETED; - boolean success = !selector.isEmpty(); - assert error != null; - - if (success) { - assert error == LinkGenerationError.NONE; - completeRemoteRequestWithSuccess(selector); - } else { - assert error != LinkGenerationError.NONE; - completeRequestWithFailure(error.intValue()); - } - - assert readyStatus != null; - - @LinkGenerationStatus - int status = success ? LinkGenerationStatus.FAILURE : LinkGenerationStatus.SUCCESS; - LinkToTextBridge.logLinkRequestedBeforeStatus(status, readyStatus.intValue()); - }); + LinkToTextHelper.requestSelector(mProducer, this::onRemoteRequestCompleted); } public boolean isAmpUrl(String url) { @@ -310,7 +328,8 @@ mTab.removeObserver(this); } - private void timeout() { + @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE) + void timeout() { assert (mRemoteRequestStatus == RemoteRequestStatus.REQUESTED || mRemoteRequestStatus == RemoteRequestStatus.COMPLETED);
diff --git a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/link_to_text/LinkToTextCoordinatorTest.java b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/link_to_text/LinkToTextCoordinatorTest.java index 17c6dd6..8c240bb 100644 --- a/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/link_to_text/LinkToTextCoordinatorTest.java +++ b/chrome/browser/share/android/javatests/src/org/chromium/chrome/browser/share/link_to_text/LinkToTextCoordinatorTest.java
@@ -5,9 +5,11 @@ package org.chromium.chrome.browser.share.link_to_text; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -65,8 +67,18 @@ private WebContents mWebContents; @Mock private DomDistillerUrlUtils.Natives mDistillerUrlUtilsJniMock; + @Mock + private LinkToTextBridge.Natives mLinkToTextBridge; + private LinkToTextCoordinator mLinkToTextCoordinator; private Activity mActivity; + private ChromeShareExtras mChromeShareExtras; + private ChromeShareExtras mReshareChromeShareExtras; + private String mSelector; + private Integer mError; + private Integer mReadyStatus; + private boolean mIsRemoteRequestResultSet; + private static final String SELECTED_TEXT = "selection"; private static final String VISIBLE_URL = JUnitTestGURLs.EXAMPLE_URL; private static final String AMP_URL = JUnitTestGURLs.AMP_URL; @@ -76,8 +88,39 @@ private static final String MOBILE_SUBDOMAIN_URL = "https://m.foo.com"; private static final String AMP_MOBILE_SUBDOMAIN_URL = "https://m.google.com/amp/www.nyt.com/ampthml/blogs.html"; + private static final String BLOCKLIST_URL = JUnitTestGURLs.URL_1; private static final String SELECTED_TEXT_LONG = "This textbook has more freedom than most (but see some exceptions)."; + private static final long SHARE_START_TIME = 1L; + + private void checkShowsShareSheetWithNoLink() { + ShareParams shareParams = mLinkToTextCoordinator.getShareParams(LinkToggleState.NO_LINK); + verify(mShareCallback, times(1)) + .showShareSheet(eq(shareParams), any(), eq(SHARE_START_TIME)); + Assert.assertEquals("", shareParams.getUrl()); + Assert.assertEquals(false, shareParams.getLinkToTextSuccessful()); + } + + private void checkShowsShareSheetWithLink(String url) { + ShareParams shareParams = mLinkToTextCoordinator.getShareParams(LinkToggleState.LINK); + verify(mShareCallback, times(1)) + .showShareSheet(eq(shareParams), any(), eq(SHARE_START_TIME)); + Assert.assertEquals(url, shareParams.getUrl()); + Assert.assertEquals(true, shareParams.getLinkToTextSuccessful()); + } + + private void setGenerationRemoteRequestResults( + String selector, Integer error, Integer readyStatus) { + mIsRemoteRequestResultSet = true; + mSelector = selector; + mError = error; + mReadyStatus = readyStatus; + } + + private void setReshareRemoteRequestResults(String selector) { + mIsRemoteRequestResultSet = true; + mSelector = selector; + } @Before public void setUpTest() { @@ -88,10 +131,37 @@ .thenAnswer((invocation) -> { return new GURL((String) invocation.getArguments()[0]); }); - doNothing().when(mShareCallback).showThirdPartyShareSheet(any(), any(), anyLong()); doNothing().when(mShareCallback).showShareSheet(any(), any(), anyLong()); - Mockito.when(mTab.getWebContents()).thenReturn(mWebContents); - Mockito.when(mTab.getWindowAndroid()).thenReturn(mWindow); + when(mTab.getWebContents()).thenReturn(mWebContents); + when(mTab.getWindowAndroid()).thenReturn(mWindow); + + jniMocker.mock(LinkToTextBridgeJni.TEST_HOOKS, mLinkToTextBridge); + when(mLinkToTextBridge.shouldOfferLinkToText(any(GURL.class))).thenAnswer((invocation) -> { + return !((GURL) invocation.getArguments()[0]).getSpec().equals(BLOCKLIST_URL); + }); + mChromeShareExtras = new ChromeShareExtras.Builder().build(); + mReshareChromeShareExtras = + new ChromeShareExtras.Builder().setIsReshareHighlightedText(true).build(); + + mLinkToTextCoordinator = Mockito.spy(new LinkToTextCoordinator() { + @Override + void requestSelector() { + // Consider solutions that will not leak implementation details to tests. + mLinkToTextCoordinator.mRemoteRequestStatus = RemoteRequestStatus.REQUESTED; + if (mIsRemoteRequestResultSet) { + mLinkToTextCoordinator.onRemoteRequestCompleted( + mSelector, mError, mReadyStatus); + } + } + + @Override + void reshareHighlightedText() { + mLinkToTextCoordinator.mRemoteRequestStatus = RemoteRequestStatus.REQUESTED; + if (mIsRemoteRequestResultSet) { + mLinkToTextCoordinator.onReshareSelectorsRemoteRequestCompleted(mSelector); + } + } + }); } @Test @@ -99,15 +169,10 @@ public void showShareSheetTest_LinkGeneration() { String selector = "selector"; String expectedUrlToShare = VISIBLE_URL + "#:~:text=selector"; - - ChromeShareExtras chromeShareExtras = new ChromeShareExtras.Builder().build(); - LinkToTextCoordinator coordinator = new LinkToTextCoordinator( - mTab, mShareCallback, chromeShareExtras, 1, VISIBLE_URL, SELECTED_TEXT); - coordinator.onSelectorReady(selector); - ShareParams shareParams = coordinator.getShareParams(LinkToggleState.LINK); - verify(mShareCallback).showShareSheet(eq(shareParams), any(), anyLong()); - Assert.assertEquals(expectedUrlToShare, shareParams.getUrl()); - Assert.assertEquals(true, shareParams.getLinkToTextSuccessful()); + mLinkToTextCoordinator.initLinkToTextCoordinator(mTab, mShareCallback, mChromeShareExtras, + SHARE_START_TIME, VISIBLE_URL, SELECTED_TEXT); + mLinkToTextCoordinator.onSelectorReady(selector); + checkShowsShareSheetWithLink(expectedUrlToShare); } @Test @@ -119,14 +184,10 @@ String expectedUrlToShare = VISIBLE_URL + "#:~:text=selector1&text=selector2&text=selector3"; - ChromeShareExtras chromeShareExtras = new ChromeShareExtras.Builder().build(); - LinkToTextCoordinator coordinator = new LinkToTextCoordinator( - mTab, mShareCallback, chromeShareExtras, 1, VISIBLE_URL, SELECTED_TEXT); - coordinator.onSelectorReady(fragmentDirective); - ShareParams shareParams = coordinator.getShareParams(LinkToggleState.LINK); - verify(mShareCallback).showShareSheet(eq(shareParams), any(), anyLong()); - Assert.assertEquals(expectedUrlToShare, shareParams.getUrl()); - Assert.assertEquals(true, shareParams.getLinkToTextSuccessful()); + mLinkToTextCoordinator.initLinkToTextCoordinator(mTab, mShareCallback, mChromeShareExtras, + SHARE_START_TIME, VISIBLE_URL, SELECTED_TEXT); + mLinkToTextCoordinator.onSelectorReady(fragmentDirective); + checkShowsShareSheetWithLink(expectedUrlToShare); } @Test @@ -135,48 +196,225 @@ String selector = ""; String expectedUrlToShare = ""; - ChromeShareExtras chromeShareExtras = new ChromeShareExtras.Builder().build(); - LinkToTextCoordinator coordinator = new LinkToTextCoordinator( - mTab, mShareCallback, chromeShareExtras, 1, VISIBLE_URL, SELECTED_TEXT); - coordinator.onSelectorReady(selector); - ShareParams shareParams = coordinator.getShareParams(LinkToggleState.NO_LINK); - verify(mShareCallback).showShareSheet(eq(shareParams), any(), anyLong()); - Assert.assertEquals(expectedUrlToShare, shareParams.getUrl()); - Assert.assertEquals(false, shareParams.getLinkToTextSuccessful()); + mLinkToTextCoordinator.initLinkToTextCoordinator( + mTab, mShareCallback, mChromeShareExtras, 1, VISIBLE_URL, SELECTED_TEXT); + mLinkToTextCoordinator.onSelectorReady(selector); + checkShowsShareSheetWithNoLink(); } @Test @SmallTest public void isAmpUrlTest() { - ChromeShareExtras chromeShareExtras = new ChromeShareExtras.Builder().build(); - LinkToTextCoordinator coordinator = new LinkToTextCoordinator( - mTab, mShareCallback, chromeShareExtras, 1, AMP_URL, SELECTED_TEXT); + Assert.assertEquals(true, mLinkToTextCoordinator.isAmpUrl(AMP_URL)); + Assert.assertEquals(false, mLinkToTextCoordinator.isAmpUrl(VISIBLE_URL)); - Assert.assertEquals(true, coordinator.isAmpUrl(AMP_URL)); - Assert.assertEquals(false, coordinator.isAmpUrl(VISIBLE_URL)); + Assert.assertEquals(true, mLinkToTextCoordinator.isAmpUrl(AMP_MOBILE_URL)); + Assert.assertEquals(false, mLinkToTextCoordinator.isAmpUrl(MOBILE_URL)); - Assert.assertEquals(true, coordinator.isAmpUrl(AMP_MOBILE_URL)); - Assert.assertEquals(false, coordinator.isAmpUrl(MOBILE_URL)); - - Assert.assertEquals(true, coordinator.isAmpUrl(AMP_MOBILE_SUBDOMAIN_URL)); - Assert.assertEquals(false, coordinator.isAmpUrl(MOBILE_SUBDOMAIN_URL)); + Assert.assertEquals(true, mLinkToTextCoordinator.isAmpUrl(AMP_MOBILE_SUBDOMAIN_URL)); + Assert.assertEquals(false, mLinkToTextCoordinator.isAmpUrl(MOBILE_SUBDOMAIN_URL)); } @Test @SmallTest public void getPreviewTextLongTest() { - ChromeShareExtras chromeShareExtras = new ChromeShareExtras.Builder().build(); - LinkToTextCoordinator coordinator = new LinkToTextCoordinator( - mTab, mShareCallback, chromeShareExtras, 1, VISIBLE_URL, SELECTED_TEXT_LONG); - Assert.assertEquals("This textbook has more freedom t...", coordinator.getPreviewText()); + mLinkToTextCoordinator.initLinkToTextCoordinator(mTab, mShareCallback, mChromeShareExtras, + SHARE_START_TIME, VISIBLE_URL, SELECTED_TEXT_LONG); + Assert.assertEquals( + "This textbook has more freedom t...", mLinkToTextCoordinator.getPreviewText()); } @Test @SmallTest public void getPreviewTextTest() { - ChromeShareExtras chromeShareExtras = new ChromeShareExtras.Builder().build(); - LinkToTextCoordinator coordinator = new LinkToTextCoordinator( - mTab, mShareCallback, chromeShareExtras, 1, VISIBLE_URL, SELECTED_TEXT); - Assert.assertEquals("selection", coordinator.getPreviewText()); + mLinkToTextCoordinator.initLinkToTextCoordinator(mTab, mShareCallback, mChromeShareExtras, + SHARE_START_TIME, VISIBLE_URL, SELECTED_TEXT); + Assert.assertEquals("selection", mLinkToTextCoordinator.getPreviewText()); + } + + @Test + @SmallTest + public void shareLinkToTextTest_BlocklistUrl() { + mLinkToTextCoordinator.initLinkToTextCoordinator(mTab, mShareCallback, mChromeShareExtras, + SHARE_START_TIME, BLOCKLIST_URL, SELECTED_TEXT); + mLinkToTextCoordinator.shareLinkToText(); + + // Check that shows share sheet without link to text + checkShowsShareSheetWithNoLink(); + + // Check that histogram will be recorded correctly. + verify(mLinkToTextBridge, times(1)).logFailureMetrics(LinkGenerationError.BLOCK_LIST); + } + + @Test + @SmallTest + public void shareLinkToTextTest_GenerationError() { + mLinkToTextCoordinator.initLinkToTextCoordinator( + mTab, mShareCallback, mChromeShareExtras, SHARE_START_TIME, VISIBLE_URL, ""); + setGenerationRemoteRequestResults("", new Integer(LinkGenerationError.EMPTY_SELECTION), + new Integer(LinkGenerationReadyStatus.REQUESTED_AFTER_READY)); + mLinkToTextCoordinator.shareLinkToText(); + + // Check that shows share sheet without link to text + checkShowsShareSheetWithNoLink(); + + // Check that histogram will be recorded correctly. + verify(mLinkToTextBridge, times(1)).logFailureMetrics(LinkGenerationError.EMPTY_SELECTION); + } + + @Test + @SmallTest + public void shareLinkToTextTest_Timeout_BeforeRemoteRequestComplete() { + mLinkToTextCoordinator.initLinkToTextCoordinator( + mTab, mShareCallback, mChromeShareExtras, SHARE_START_TIME, VISIBLE_URL, ""); + mLinkToTextCoordinator.shareLinkToText(); + mLinkToTextCoordinator.timeout(); + + // Check that shows share sheet without link to text + checkShowsShareSheetWithNoLink(); + + // Check that histogram will be recorded correctly. + verify(mLinkToTextBridge, times(1)).logFailureMetrics(LinkGenerationError.TIMEOUT); + + // Receiving generation result after timeout, should not trigger another sharesheet. + mLinkToTextCoordinator.onRemoteRequestCompleted("", + new Integer(LinkGenerationError.EMPTY_SELECTION), + new Integer(LinkGenerationReadyStatus.REQUESTED_BEFORE_READY)); + verify(mShareCallback, times(1)).showShareSheet(any(), any(), anyLong()); + + // No new histogram is recorded. + verify(mLinkToTextBridge, times(1)).logFailureMetrics(anyInt()); + verify(mLinkToTextBridge, times(0)).logSuccessMetrics(); + } + + @Test + @SmallTest + public void shareLinkToTextTest_Timeout_AfterRemoteRequestComplete() { + mLinkToTextCoordinator.initLinkToTextCoordinator( + mTab, mShareCallback, mChromeShareExtras, SHARE_START_TIME, VISIBLE_URL, ""); + setGenerationRemoteRequestResults("selector", new Integer(LinkGenerationError.NONE), + new Integer(LinkGenerationReadyStatus.REQUESTED_AFTER_READY)); + mLinkToTextCoordinator.shareLinkToText(); + + // Check that shows share sheet without link to text + checkShowsShareSheetWithLink(VISIBLE_URL + "#:~:text=selector"); + verify(mLinkToTextBridge, times(1)).logSuccessMetrics(); + + // Timeout after remote request was completed should not trigger another sharesheet. + mLinkToTextCoordinator.timeout(); + verify(mShareCallback, times(1)).showShareSheet(any(), any(), anyLong()); + + // No new histogram is recorded. + verify(mLinkToTextBridge, times(0)).logFailureMetrics(anyInt()); + verify(mLinkToTextBridge, times(1)).logSuccessMetrics(); + } + + @Test + @SmallTest + public void shareLinkToTextTest_OmniboxNavigation_BeforeRemoteRequestComplete() { + mLinkToTextCoordinator.initLinkToTextCoordinator( + mTab, mShareCallback, mChromeShareExtras, SHARE_START_TIME, VISIBLE_URL, ""); + mLinkToTextCoordinator.shareLinkToText(); + mLinkToTextCoordinator.onUpdateUrl(mTab, new GURL(VISIBLE_URL)); + + // check doesn't show share sheet + verify(mShareCallback, times(0)).showShareSheet(any(), any(), anyLong()); + + // Check that histogram will be recorded correctly. + verify(mLinkToTextBridge, times(1)) + .logFailureMetrics(LinkGenerationError.OMNIBOX_NAVIGATION); + + // Receiving generation result should not trigger another sharesheet. + mLinkToTextCoordinator.onRemoteRequestCompleted("", + new Integer(LinkGenerationError.EMPTY_SELECTION), + new Integer(LinkGenerationReadyStatus.REQUESTED_BEFORE_READY)); + verify(mShareCallback, times(0)).showShareSheet(any(), any(), anyLong()); + + // No new histogram is recorded. + verify(mLinkToTextBridge, times(1)).logFailureMetrics(anyInt()); + verify(mLinkToTextBridge, times(0)).logSuccessMetrics(); + } + + @Test + @SmallTest + public void shareLinkToTextTest_Reshare_Success() { + mLinkToTextCoordinator.initLinkToTextCoordinator( + mTab, mShareCallback, mReshareChromeShareExtras, SHARE_START_TIME, VISIBLE_URL, ""); + setReshareRemoteRequestResults("selector"); + mLinkToTextCoordinator.shareLinkToText(); + + // Check that shows share sheet without link to text + checkShowsShareSheetWithLink(VISIBLE_URL + "#:~:text=selector"); + + // Check that histogram will be recorded correctly. + verify(mLinkToTextBridge, times(1)) + .logLinkToTextReshareStatus(LinkToTextReshareStatus.SUCCESS); + } + + @Test + @SmallTest + public void shareLinkToTextTest_Reshare_Timeout_BeforeRemoteRequestComplete() { + mLinkToTextCoordinator.initLinkToTextCoordinator( + mTab, mShareCallback, mReshareChromeShareExtras, SHARE_START_TIME, VISIBLE_URL, ""); + mLinkToTextCoordinator.shareLinkToText(); + mLinkToTextCoordinator.timeout(); + + // Check that shows share sheet without link to text + checkShowsShareSheetWithNoLink(); + + // Check that histogram will be recorded correctly. + verify(mLinkToTextBridge, times(1)) + .logLinkToTextReshareStatus(LinkToTextReshareStatus.TIMEOUT); + + // Receiving generation result after timeout, should not trigger another sharesheet. + mLinkToTextCoordinator.onReshareSelectorsRemoteRequestCompleted(""); + verify(mShareCallback, times(1)).showShareSheet(any(), any(), anyLong()); + + // No new histogram is recorded. + verify(mLinkToTextBridge, times(1)).logLinkToTextReshareStatus(anyInt()); + } + + @Test + @SmallTest + public void shareLinkToTextTest_Reshare_Timeout_AfterRemoteRequestComplete() { + mLinkToTextCoordinator.initLinkToTextCoordinator( + mTab, mShareCallback, mReshareChromeShareExtras, SHARE_START_TIME, VISIBLE_URL, ""); + setReshareRemoteRequestResults("selector"); + mLinkToTextCoordinator.shareLinkToText(); + + // Check that shows share sheet without link to text + checkShowsShareSheetWithLink(VISIBLE_URL + "#:~:text=selector"); + verify(mLinkToTextBridge, times(1)) + .logLinkToTextReshareStatus(LinkToTextReshareStatus.SUCCESS); + + // Timeout after remote request was completed should not trigger another sharesheet. + mLinkToTextCoordinator.timeout(); + verify(mShareCallback, times(1)).showShareSheet(any(), any(), anyLong()); + + // No new histogram is recorded. + verify(mLinkToTextBridge, times(1)).logLinkToTextReshareStatus(anyInt()); + } + + @Test + @SmallTest + public void shareLinkToTextTest_Reshare_OmniboxNavigation_BeforeRemoteRequestComplete() { + mLinkToTextCoordinator.initLinkToTextCoordinator( + mTab, mShareCallback, mReshareChromeShareExtras, SHARE_START_TIME, VISIBLE_URL, ""); + mLinkToTextCoordinator.shareLinkToText(); + mLinkToTextCoordinator.onUpdateUrl(mTab, new GURL(VISIBLE_URL)); + + // check doesn't show share sheet + verify(mShareCallback, times(0)).showShareSheet(any(), any(), anyLong()); + + // Check that histogram will be recorded correctly. + verify(mLinkToTextBridge, times(1)) + .logLinkToTextReshareStatus(LinkToTextReshareStatus.OMNIBOX_NAVIGATION); + + // Receiving generation result should not trigger another sharesheet. + mLinkToTextCoordinator.onReshareSelectorsRemoteRequestCompleted(""); + verify(mShareCallback, times(0)).showShareSheet(any(), any(), anyLong()); + + // No new histogram is recorded. + verify(mLinkToTextBridge, times(1)).logLinkToTextReshareStatus(anyInt()); } }
diff --git a/chrome/browser/share/android/test_java_sources.gni b/chrome/browser/share/android/test_java_sources.gni index 446bb7d..d43abc7 100644 --- a/chrome/browser/share/android/test_java_sources.gni +++ b/chrome/browser/share/android/test_java_sources.gni
@@ -41,4 +41,5 @@ "//chrome/browser/paint_preview/android:java", "//chrome/browser/paint_preview/android:java", "//components/paint_preview/player/android:java", + "//components/shared_highlighting/core/common:shared_highlighting_android_enums_java", ]
diff --git a/chrome/browser/signin/dice_web_signin_interceptor.cc b/chrome/browser/signin/dice_web_signin_interceptor.cc index dc2955c..e0cfa68 100644 --- a/chrome/browser/signin/dice_web_signin_interceptor.cc +++ b/chrome/browser/signin/dice_web_signin_interceptor.cc
@@ -38,7 +38,6 @@ #include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/browser_finder.h" #include "chrome/browser/ui/browser_list.h" -#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" #include "chrome/browser/ui/signin/profile_colors_util.h" #include "chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h" @@ -357,6 +356,7 @@ DCHECK(!session_startup_helper_); DCHECK(bubble_handle); interception_bubble_handle_ = std::move(bubble_handle); + account_id_ = account_id; session_startup_helper_ = std::make_unique<DiceInterceptedSessionStartupHelper>( profile_, is_new_profile, account_id, intercepted_contents); @@ -759,17 +759,9 @@ if (!is_new_profile || profile_->IsGuestSession()) return; - // Don't show the customization bubble if a valid policy theme is set. Browser* browser = chrome::FindBrowserWithProfile(profile_); - if (ThemeServiceFactory::GetForProfile(profile_)->UsingPolicyTheme()) { - // Show the profile switch IPH that is normally shown after the - // customization bubble. - browser->window()->MaybeShowProfileSwitchIPH(); - return; - } - DCHECK(browser); - delegate_->ShowProfileCustomizationBubble(browser); + delegate_->ShowFirstRunExperienceInNewProfile(browser, account_id_); } // static
diff --git a/chrome/browser/signin/dice_web_signin_interceptor.h b/chrome/browser/signin/dice_web_signin_interceptor.h index 0e3a03f4..1de53c81 100644 --- a/chrome/browser/signin/dice_web_signin_interceptor.h +++ b/chrome/browser/signin/dice_web_signin_interceptor.h
@@ -188,8 +188,11 @@ const BubbleParameters& bubble_parameters, base::OnceCallback<void(SigninInterceptionResult)> callback) = 0; - // Shows the profile customization bubble. - virtual void ShowProfileCustomizationBubble(Browser* browser) = 0; + // Shows the first run experience for `account_id` in `browser` opened for + // a newly created profile. + virtual void ShowFirstRunExperienceInNewProfile( + Browser* browser, + const CoreAccountId& account_id) = 0; }; DiceWebSigninInterceptor(Profile* profile,
diff --git a/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc b/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc index c8b39f4f..87b5c74 100644 --- a/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc +++ b/chrome/browser/signin/dice_web_signin_interceptor_browsertest.cc
@@ -103,13 +103,18 @@ return bubble_handle; } - void ShowProfileCustomizationBubble(Browser* browser) override { - EXPECT_FALSE(customized_browser_) - << "Customization must be shown only once."; - customized_browser_ = browser; + void ShowFirstRunExperienceInNewProfile( + Browser* browser, + const CoreAccountId& account_id) override { + EXPECT_FALSE(fre_browser_) + << "First run experience must be shown only once."; + fre_browser_ = browser; + fre_account_id_ = account_id; } - Browser* customized_browser() { return customized_browser_; } + Browser* fre_browser() { return fre_browser_; } + + const CoreAccountId& fre_account_id() { return fre_account_id_; } void set_expected_interception_type( DiceWebSigninInterceptor::SigninInterceptionType type) { @@ -127,7 +132,8 @@ } private: - raw_ptr<Browser> customized_browser_ = nullptr; + raw_ptr<Browser> fre_browser_ = nullptr; + CoreAccountId fre_account_id_; DiceWebSigninInterceptor::SigninInterceptionType expected_interception_type_ = DiceWebSigninInterceptor::SigninInterceptionType::kMultiUser; SigninInterceptionResult expected_interception_result_ = @@ -382,9 +388,11 @@ EXPECT_TRUE(source_interceptor_delegate->intercept_bubble_destroyed()); EXPECT_FALSE(new_interceptor_delegate->intercept_bubble_shown()); EXPECT_FALSE(new_interceptor_delegate->intercept_bubble_destroyed()); - // Profile customization UI was shown exactly once in the new profile. - EXPECT_EQ(new_interceptor_delegate->customized_browser(), added_browser); - EXPECT_EQ(source_interceptor_delegate->customized_browser(), nullptr); + // First run experience UI was shown exactly once in the new profile. + EXPECT_EQ(new_interceptor_delegate->fre_browser(), added_browser); + EXPECT_EQ(new_interceptor_delegate->fre_account_id(), + account_info.account_id); + EXPECT_EQ(source_interceptor_delegate->fre_browser(), nullptr); } // Tests the complete profile switch flow when the profile is not loaded. @@ -458,9 +466,9 @@ SigninInterceptionHeuristicOutcome::kInterceptProfileSwitch); // Interception bubble was closed. EXPECT_TRUE(source_interceptor_delegate->intercept_bubble_destroyed()); - // Profile customization was not shown. - EXPECT_EQ(GetInterceptorDelegate(new_profile)->customized_browser(), nullptr); - EXPECT_EQ(source_interceptor_delegate->customized_browser(), nullptr); + // First run experience was not shown. + EXPECT_EQ(GetInterceptorDelegate(new_profile)->fre_browser(), nullptr); + EXPECT_EQ(source_interceptor_delegate->fre_browser(), nullptr); } // Tests the complete profile switch flow when the profile is already loaded. @@ -535,10 +543,9 @@ CheckHistograms(histogram_tester, SigninInterceptionHeuristicOutcome::kInterceptProfileSwitch); - // Profile customization was not shown. - EXPECT_EQ(GetInterceptorDelegate(other_profile)->customized_browser(), - nullptr); - EXPECT_EQ(GetInterceptorDelegate(profile())->customized_browser(), nullptr); + // First run experience was not shown. + EXPECT_EQ(GetInterceptorDelegate(other_profile)->fre_browser(), nullptr); + EXPECT_EQ(GetInterceptorDelegate(profile())->fre_browser(), nullptr); } // Close the source tab during the interception and check that the NTP is opened @@ -717,9 +724,11 @@ FakeDiceWebSigninInterceptorDelegate* new_interceptor_delegate = GetInterceptorDelegate(new_profile); - // Profile customization UI was shown exactly once in the new profile. - EXPECT_EQ(new_interceptor_delegate->customized_browser(), added_browser); - EXPECT_EQ(source_interceptor_delegate->customized_browser(), nullptr); + // First run experience UI was shown exactly once in the new profile. + EXPECT_EQ(new_interceptor_delegate->fre_browser(), added_browser); + EXPECT_EQ(new_interceptor_delegate->fre_account_id(), + account_info.account_id); + EXPECT_EQ(source_interceptor_delegate->fre_browser(), nullptr); } // Tests the complete interception flow including profile and browser creation. @@ -815,9 +824,11 @@ FakeDiceWebSigninInterceptorDelegate* new_interceptor_delegate = GetInterceptorDelegate(new_profile); - // Profile customization UI was shown exactly once in the new profile. - EXPECT_EQ(new_interceptor_delegate->customized_browser(), added_browser); - EXPECT_EQ(source_interceptor_delegate->customized_browser(), nullptr); + // First run experience UI was shown exactly once in the new profile. + EXPECT_EQ(new_interceptor_delegate->fre_browser(), added_browser); + EXPECT_EQ(new_interceptor_delegate->fre_account_id(), + account_info.account_id); + EXPECT_EQ(source_interceptor_delegate->fre_browser(), nullptr); } // Tests the complete interception flow including profile and browser creation. @@ -895,9 +906,11 @@ FakeDiceWebSigninInterceptorDelegate* new_interceptor_delegate = GetInterceptorDelegate(new_profile); - // Profile customization UI was shown exactly once in the new profile. - EXPECT_EQ(new_interceptor_delegate->customized_browser(), added_browser); - EXPECT_EQ(source_interceptor_delegate->customized_browser(), nullptr); + // First run experience UI was shown exactly once in the new profile. + EXPECT_EQ(new_interceptor_delegate->fre_browser(), added_browser); + EXPECT_EQ(new_interceptor_delegate->fre_account_id(), + account_info.account_id); + EXPECT_EQ(source_interceptor_delegate->fre_browser(), nullptr); } // Tests the complete interception flow for a reauth of the primary account of a @@ -1114,9 +1127,9 @@ // Interception bubble was closed. EXPECT_TRUE(source_interceptor_delegate->intercept_bubble_destroyed()); - // Profile customization was not shown. - EXPECT_EQ(GetInterceptorDelegate(new_profile)->customized_browser(), nullptr); - EXPECT_EQ(source_interceptor_delegate->customized_browser(), nullptr); + // First run experience was not shown. + EXPECT_EQ(GetInterceptorDelegate(new_profile)->fre_browser(), nullptr); + EXPECT_EQ(source_interceptor_delegate->fre_browser(), nullptr); } // Failed run on MAC CI builder. https://crbug.com/1245200 @@ -1202,8 +1215,7 @@ CheckHistograms(histogram_tester, SigninInterceptionHeuristicOutcome:: kInterceptEnterpriseForcedProfileSwitch); - // Profile customization was not shown. - EXPECT_EQ(GetInterceptorDelegate(other_profile)->customized_browser(), - nullptr); - EXPECT_EQ(GetInterceptorDelegate(profile())->customized_browser(), nullptr); + // First run experience was not shown. + EXPECT_EQ(GetInterceptorDelegate(other_profile)->fre_browser(), nullptr); + EXPECT_EQ(GetInterceptorDelegate(profile())->fre_browser(), nullptr); }
diff --git a/chrome/browser/signin/dice_web_signin_interceptor_unittest.cc b/chrome/browser/signin/dice_web_signin_interceptor_unittest.cc index 235b4e40..bd2fc1d 100644 --- a/chrome/browser/signin/dice_web_signin_interceptor_unittest.cc +++ b/chrome/browser/signin/dice_web_signin_interceptor_unittest.cc
@@ -49,7 +49,9 @@ const BubbleParameters& bubble_parameters, base::OnceCallback<void(SigninInterceptionResult)> callback), (override)); - void ShowProfileCustomizationBubble(Browser* browser) override {} + void ShowFirstRunExperienceInNewProfile( + Browser* browser, + const CoreAccountId& account_id) override {} }; // Matches BubbleParameters fields excepting the color. This is useful in the
diff --git a/chrome/browser/signin/identity_test_environment_profile_adaptor.cc b/chrome/browser/signin/identity_test_environment_profile_adaptor.cc index ff94a971..16a7474 100644 --- a/chrome/browser/signin/identity_test_environment_profile_adaptor.cc +++ b/chrome/browser/signin/identity_test_environment_profile_adaptor.cc
@@ -52,8 +52,10 @@ // static void IdentityTestEnvironmentProfileAdaptor:: SetIdentityTestEnvironmentFactoriesOnBrowserContext( - content::BrowserContext* context) { - for (const auto& factory_pair : GetIdentityTestEnvironmentFactories()) { + content::BrowserContext* context, + signin::AccountConsistencyMethod account_consistency) { + for (const auto& factory_pair : + GetIdentityTestEnvironmentFactories(account_consistency)) { factory_pair.first->SetTestingFactory(context, factory_pair.second); } }
diff --git a/chrome/browser/signin/identity_test_environment_profile_adaptor.h b/chrome/browser/signin/identity_test_environment_profile_adaptor.h index ef477efd..8b020805 100644 --- a/chrome/browser/signin/identity_test_environment_profile_adaptor.h +++ b/chrome/browser/signin/identity_test_environment_profile_adaptor.h
@@ -44,7 +44,9 @@ // requires explicitly on a Profile that is passed to it. // See the above variant for comments on common parameters. static void SetIdentityTestEnvironmentFactoriesOnBrowserContext( - content::BrowserContext* browser_context); + content::BrowserContext* browser_context, + signin::AccountConsistencyMethod account_consistency = + signin::AccountConsistencyMethod::kDisabled); // Appends the set of testing factories that signin::IdentityTestEnvironment // requires to |factories_to_append_to|, which should be the set of testing
diff --git a/chrome/browser/signin/process_dice_header_delegate_impl_unittest.cc b/chrome/browser/signin/process_dice_header_delegate_impl_unittest.cc index 60c8423..0a21367 100644 --- a/chrome/browser/signin/process_dice_header_delegate_impl_unittest.cc +++ b/chrome/browser/signin/process_dice_header_delegate_impl_unittest.cc
@@ -51,7 +51,9 @@ return nullptr; } - void ShowProfileCustomizationBubble(Browser* browser) override {} + void ShowFirstRunExperienceInNewProfile( + Browser* browser, + const CoreAccountId& account_id) override {} }; class MockDiceWebSigninInterceptor : public DiceWebSigninInterceptor {
diff --git a/chrome/browser/signin/signin_features.cc b/chrome/browser/signin/signin_features.cc index 5afe1ba..85e2f5fe 100644 --- a/chrome/browser/signin/signin_features.cc +++ b/chrome/browser/signin/signin_features.cc
@@ -14,3 +14,7 @@ // the profile picker. const base::Feature kAccountPoliciesLoadedWithoutSync{ "AccountPoliciesLoadedWithoutSync", base::FEATURE_ENABLED_BY_DEFAULT}; + +// Enables the sync promo after the sign-in intercept. +const base::Feature kSyncPromoAfterSigninIntercept{ + "SyncPromoAfterSigninIntercept", base::FEATURE_DISABLED_BY_DEFAULT};
diff --git a/chrome/browser/signin/signin_features.h b/chrome/browser/signin/signin_features.h index 311e4040..70af1ca 100644 --- a/chrome/browser/signin/signin_features.h +++ b/chrome/browser/signin/signin_features.h
@@ -11,4 +11,6 @@ extern const base::Feature kAccountPoliciesLoadedWithoutSync; +extern const base::Feature kSyncPromoAfterSigninIntercept; + #endif // CHROME_BROWSER_SIGNIN_SIGNIN_FEATURES_H_
diff --git a/chrome/browser/ssl/security_state_tab_helper.cc b/chrome/browser/ssl/security_state_tab_helper.cc index b7e113c..ad3d85b 100644 --- a/chrome/browser/ssl/security_state_tab_helper.cc +++ b/chrome/browser/ssl/security_state_tab_helper.cc
@@ -51,10 +51,10 @@ #include "url/gurl.h" #include "url/origin.h" -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) #include "chrome/browser/policy/networking/policy_cert_service.h" #include "chrome/browser/policy/networking/policy_cert_service_factory.h" -#endif // BUILDFLAG(IS_CHROMEOS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS) #if BUILDFLAG(FULL_SAFE_BROWSING) #include "chrome/browser/safe_browsing/chrome_password_protection_service.h" @@ -168,7 +168,7 @@ } bool SecurityStateTabHelper::UsedPolicyInstalledCertificate() const { -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) policy::PolicyCertService* service = policy::PolicyCertServiceFactory::GetForProfile( Profile::FromBrowserContext(web_contents()->GetBrowserContext()));
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn index 5921e9b..d198b088 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn
@@ -3179,6 +3179,7 @@ "window_sizer/window_sizer_chromeos.h", ] deps += [ + "//chrome/browser/policy:onc", "//chromeos/crosapi/mojom", "//chromeos/lacros", "//chromeos/ui/base", @@ -3359,6 +3360,8 @@ "passwords/account_storage_auth_helper.h", "signin/dice_web_signin_interceptor_delegate.cc", "signin/dice_web_signin_interceptor_delegate.h", + "signin_intercept_first_run_experience_dialog.cc", + "signin_intercept_first_run_experience_dialog.h", "signin_reauth_view_controller.cc", "signin_reauth_view_controller.h", "views/profiles/dice_web_signin_interception_bubble_view.cc",
diff --git a/chrome/browser/ui/DEPS b/chrome/browser/ui/DEPS index 7e7417c..7ff1f75 100644 --- a/chrome/browser/ui/DEPS +++ b/chrome/browser/ui/DEPS
@@ -43,4 +43,8 @@ "hid_chooser_controller_unittest\.cc": [ "+services/device/hid", ], + "signin_intercept_first_run_experience_dialog_browsertest.cc": [ + "+chrome/browser/ui/views/profiles/avatar_toolbar_button.h", + "+chrome/browser/ui/views/user_education/feature_promo_controller_views.h", + ], }
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_az.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_az.xtb index 4261ad2..a2b7372 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_az.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_az.xtb
@@ -210,6 +210,7 @@ <translation id="2227444325776770048"><ph name="USER_FULL_NAME" /> kimi davam edin</translation> <translation id="2230777942707397948">Boş pəncərə</translation> <translation id="2239812875700136898">"Kəşf edin" düyməsi üçün Seçimlərdən hekayələrinizi idarə edin</translation> +<translation id="2248941474044011069">Parollarınız Google Parol Menecerində saxlanmazdan əvvəl cihazınızda şifrələnir</translation> <translation id="2259659629660284697">Parolları eksport edin...</translation> <translation id="2276696007612801991">Parollarınızı yoxlamaq üçün Google hesabınıza daxil olun</translation> <translation id="2278052315791335171">Bu parolu sildikdə <ph name="SITE" /> saytında hesabınız silinməyəcək</translation> @@ -659,6 +660,7 @@ <translation id="4837753911714442426">Səhifəni çap etmək üçün seçimləri açın</translation> <translation id="4842092870884894799">Parol yaradılması popapı göstərilir</translation> <translation id="4842515939542199281">Səsinizlə axtarış etmək üçün mikrofona toxunun</translation> +<translation id="4844633725025837809">Təhlükəsizliyi artırmaq üçün Google Parol Menecerində saxlanmazdan əvvəl cihazınızda parolları şifrələyin</translation> <translation id="4850886885716139402">Görünüş</translation> <translation id="4860895144060829044">Zəng</translation> <translation id="4864369630010738180">Daxil olunur...</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_ja.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_ja.xtb index 2ec1101..e87bbde 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_ja.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_ja.xtb
@@ -210,6 +210,7 @@ <translation id="2227444325776770048"><ph name="USER_FULL_NAME" /> として続行</translation> <translation id="2230777942707397948">空のウィンドウ</translation> <translation id="2239812875700136898">Discover ボタンのオプションから記事を管理できます</translation> +<translation id="2248941474044011069">Google パスワード マネージャーに保存する前にデバイス上でパスワードを暗号化します</translation> <translation id="2259659629660284697">パスワードをエクスポート…</translation> <translation id="2276696007612801991">パスワードを確認するには、Google アカウントにログインしてください</translation> <translation id="2278052315791335171">このパスワードを削除しても、<ph name="SITE" /> のアカウントは削除されません</translation> @@ -659,6 +660,7 @@ <translation id="4837753911714442426">ページの印刷オプションを開く</translation> <translation id="4842092870884894799">パスワード作成のポップアップを表示しています</translation> <translation id="4842515939542199281">声を使って検索するには、マイクをタップします</translation> +<translation id="4844633725025837809">セキュリティ強化のため、Google パスワード マネージャーに保存する前にデバイス上でパスワードを暗号化します</translation> <translation id="4850886885716139402">表示</translation> <translation id="4860895144060829044">通話</translation> <translation id="4864369630010738180">ログインしています...</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_ko.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_ko.xtb index 4f2a73a..6cf1c1f 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_ko.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_ko.xtb
@@ -210,6 +210,7 @@ <translation id="2227444325776770048"><ph name="USER_FULL_NAME" />(으)로 계속</translation> <translation id="2230777942707397948">빈 창</translation> <translation id="2239812875700136898">디스커버 버튼 옵션으로 새 탭 페이지에 표시될 뉴스를 관리하세요</translation> +<translation id="2248941474044011069">비밀번호를 기기 내에서 암호화한 후 Google 비밀번호 관리자에 저장합니다</translation> <translation id="2259659629660284697">비밀번호 내보내기...</translation> <translation id="2276696007612801991">비밀번호를 확인하려면 Google 계정에 로그인하세요.</translation> <translation id="2278052315791335171">비밀번호를 삭제해도 <ph name="SITE" /> 계정은 삭제되지 않습니다.</translation> @@ -659,6 +660,7 @@ <translation id="4837753911714442426">옵션을 열어 페이지 인쇄</translation> <translation id="4842092870884894799">비밀번호 생성 팝업 표시</translation> <translation id="4842515939542199281">음성으로 검색하려면 마이크 탭하기</translation> +<translation id="4844633725025837809">보안 강화를 위해 비밀번호를 기기 내에서 암호화한 후 Google 비밀번호 관리자에 저장합니다</translation> <translation id="4850886885716139402">보기</translation> <translation id="4860895144060829044">전화걸기</translation> <translation id="4864369630010738180">로그인 중...</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_my.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_my.xtb index 36a3590..cac46e4 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_my.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_my.xtb
@@ -210,6 +210,7 @@ <translation id="2227444325776770048"><ph name="USER_FULL_NAME" /> အဖြစ် ရှေ့ဆက်ရန်</translation> <translation id="2230777942707397948">ဝင်းဒိုးအလွတ်</translation> <translation id="2239812875700136898">သင့်သတင်းဆောင်းပါးများကို 'Discover အတွက် ရွေးစရာများ' ခလုတ်မှ ထိန်းချုပ်ပါ</translation> +<translation id="2248941474044011069">စကားဝှက်များကို ‘Google စကားဝှက်မန်နေဂျာ’ သို့ မသိမ်းမီ သင်၏စက်၌ အသွင်ဝှက်ပြီးပါပြီ</translation> <translation id="2259659629660284697">စကားဝှက်များကို တင်ပို့ခြင်း…</translation> <translation id="2276696007612801991">သင့်စကားဝှက်များကိုစစ်ရန် သင့် Google အကောင့်သို့ လက်မှတ်ထိုးဝင်ပါ</translation> <translation id="2278052315791335171">ဤစကားဝှက်ကို ဖျက်ခြင်းဖြင့် <ph name="SITE" /> ရှိ သင့်အကောင့်ကို ဖျက်မည်မဟုတ်ပါ</translation> @@ -659,6 +660,7 @@ <translation id="4837753911714442426">စာမျက်နှာကို ပုံနှိပ်ဖို့ နည်းလမ်း အားဖွင့်ရန်</translation> <translation id="4842092870884894799">စကားဝှက် ထုတ်လုပ်ခြင်း ပေါ့ပ်အပ် ပြနေစဉ်</translation> <translation id="4842515939542199281">သင့်အသံဖြင့်ရှာရန် မိုက်ခရိုဖုန်းကို တို့ပါ</translation> +<translation id="4844633725025837809">လုံခြုံရေးပိုမိုကောင်းမွန်စေရန် စကားဝှက်များကို ‘Google စကားဝှက်မန်နေဂျာ’ သို့ မသိမ်းမီ သင်၏စက်၌ အသွင်ဝှက်ပါ</translation> <translation id="4850886885716139402">မြင်ကွင်း</translation> <translation id="4860895144060829044">ဖုန်းခေါ်ရန်</translation> <translation id="4864369630010738180">လက်မှတ်ထိုးဝင်နေသည်...</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_th.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_th.xtb index 00158a5..b127bfa27 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_th.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_th.xtb
@@ -210,6 +210,7 @@ <translation id="2227444325776770048">ดำเนินการต่อในชื่อ <ph name="USER_FULL_NAME" /></translation> <translation id="2230777942707397948">หน้าต่างว่าง</translation> <translation id="2239812875700136898">ควบคุมเรื่องราวของคุณจากปุ่ม "ตัวเลือกสำหรับ Discover"</translation> +<translation id="2248941474044011069">ระบบจะเข้ารหัสให้กับรหัสผ่านในอุปกรณ์ก่อนบันทึกลงในเครื่องมือจัดการรหัสผ่านของ Google</translation> <translation id="2259659629660284697">ส่งออกรหัสผ่าน…</translation> <translation id="2276696007612801991">ลงชื่อเข้าใช้บัญชี Google เพื่อตรวจสอบรหัสผ่าน</translation> <translation id="2278052315791335171">การลบรหัสผ่านนี้จะไม่ลบบัญชีของคุณใน <ph name="SITE" /></translation> @@ -659,6 +660,7 @@ <translation id="4837753911714442426">เปิดตัวเลือกในการพิมพ์หน้า</translation> <translation id="4842092870884894799">กำลังแสดงป๊อปอัปการสร้างรหัสผ่าน</translation> <translation id="4842515939542199281">แตะไมโครโฟนเพื่อค้นหาด้วยเสียง</translation> +<translation id="4844633725025837809">เข้ารหัสให้กับรหัสผ่านในอุปกรณ์ก่อนบันทึกลงในเครื่องมือจัดการรหัสผ่านของ Google เพื่อเพิ่มความปลอดภัย</translation> <translation id="4850886885716139402">มุมมอง</translation> <translation id="4860895144060829044">โทร</translation> <translation id="4864369630010738180">กำลังลงชื่อเข้าใช้...</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-CN.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-CN.xtb index 3299ca7..2dcc3f11 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-CN.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-CN.xtb
@@ -1001,7 +1001,7 @@ <translation id="6648977384226967773">{CONTACT,plural, =1{<ph name="CONTACT_PREVIEW" />\u2026以及另外 <ph name="NUMBER_OF_ADDITIONAL_CONTACTS" /> 个联系人}other{<ph name="CONTACT_PREVIEW" />\u2026以及另外 <ph name="NUMBER_OF_ADDITIONAL_CONTACTS" /> 个联系人}}</translation> <translation id="6649642165559792194">预览图片<ph name="BEGIN_NEW" />新<ph name="END_NEW" /></translation> <translation id="6657585470893396449">密码</translation> -<translation id="6659594942844771486">标签页</translation> +<translation id="6659594942844771486">Tab 键</translation> <translation id="666731172850799929">在 <ph name="APP_NAME" />中打开</translation> <translation id="6671495933530132209">复制图片</translation> <translation id="6674571176963658787">若要开始同步,请输入您的密码</translation>
diff --git a/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-HK.xtb b/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-HK.xtb index 9ef8241..5d874cc 100644 --- a/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-HK.xtb +++ b/chrome/browser/ui/android/strings/translations/android_chrome_strings_zh-HK.xtb
@@ -210,7 +210,7 @@ <translation id="2227444325776770048">以<ph name="USER_FULL_NAME" />的身分繼續</translation> <translation id="2230777942707397948">空白視窗</translation> <translation id="2239812875700136898">按一下 [探索的選項] 按鈕來控制您的報導</translation> -<translation id="2248941474044011069">系統會先在裝置上將密碼加密,再儲存至 Google 密碼管理員</translation> +<translation id="2248941474044011069">您的密碼會先在裝置上加密,然後才儲存至 Google 密碼管理工具</translation> <translation id="2259659629660284697">匯出密碼…</translation> <translation id="2276696007612801991">登入 Google 帳戶以檢查密碼</translation> <translation id="2278052315791335171">刪除此密碼不會刪除您在 <ph name="SITE" /> 的帳戶</translation> @@ -660,7 +660,7 @@ <translation id="4837753911714442426">開啟列印網頁選項</translation> <translation id="4842092870884894799">正在顯示密碼產生彈出式視窗</translation> <translation id="4842515939542199281">如要透過語音進行搜尋,請輕按「麥克風」圖示</translation> -<translation id="4844633725025837809">為進一步加強安全性,系統會先在裝置上將密碼加密,再儲存至 Google 密碼管理員</translation> +<translation id="4844633725025837809">為進一步增強安全性,請先在裝置上將密碼加密,然後才將密碼儲存至 Google 密碼管理工具</translation> <translation id="4850886885716139402">檢視</translation> <translation id="4860895144060829044">撥號</translation> <translation id="4864369630010738180">正在登入…</translation>
diff --git a/chrome/browser/ui/browser_dialogs.h b/chrome/browser/ui/browser_dialogs.h index 22035d08..875f10c 100644 --- a/chrome/browser/ui/browser_dialogs.h +++ b/chrome/browser/ui/browser_dialogs.h
@@ -412,8 +412,9 @@ SIGNIN_ENTERPRISE_INTERCEPTION = 110, APP_IDENTITY_UPDATE_CONFIRMATION = 111, BLUETOOTH_DEVICE_CREDENTIALS = 112, - // Add values above this line with a corresponding label in - // tools/metrics/histograms/enums.xml + SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE = 113, + // Add values above this line with a corresponding label to the "DialogName" + // enum in tools/metrics/histograms/enums.xml MAX_VALUE };
diff --git a/chrome/browser/ui/cocoa/tab_contents/web_contents_view_mac_interactive_uitest.mm b/chrome/browser/ui/cocoa/tab_contents/web_contents_view_mac_interactive_uitest.mm index 0e7c398..83345c7 100644 --- a/chrome/browser/ui/cocoa/tab_contents/web_contents_view_mac_interactive_uitest.mm +++ b/chrome/browser/ui/cocoa/tab_contents/web_contents_view_mac_interactive_uitest.mm
@@ -61,8 +61,9 @@ EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); EXPECT_TRUE(embedded_test_server()->Start()); - AddTabAtIndex(1, GURL(embedded_test_server()->GetURL("/select.html")), - ui::PAGE_TRANSITION_LINK); + ASSERT_TRUE( + AddTabAtIndex(1, GURL(embedded_test_server()->GetURL("/select.html")), + ui::PAGE_TRANSITION_LINK)); content::WebContents* web_contents = browser()->tab_strip_model()->GetActiveWebContents();
diff --git a/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.cc b/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.cc index 3d284197..eb20bf2 100644 --- a/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.cc +++ b/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.cc
@@ -11,11 +11,18 @@ #include "base/memory/raw_ptr.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" +#include "chrome/browser/signin/identity_manager_factory.h" #include "chrome/browser/signin/signin_features.h" +#include "chrome/browser/themes/theme_service.h" +#include "chrome/browser/themes/theme_service_factory.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" +#include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/ui_features.h" #include "chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h" +#include "components/signin/public/base/signin_metrics.h" +#include "components/signin/public/identity_manager/identity_manager.h" +#include "google_apis/gaia/core_account_id.h" #include "google_apis/gaia/gaia_auth_util.h" namespace { @@ -131,7 +138,21 @@ std::move(callback)); } -void DiceWebSigninInterceptorDelegate::ShowProfileCustomizationBubble( - Browser* browser) { - ShowProfileCustomizationBubbleInternal(browser); +void DiceWebSigninInterceptorDelegate::ShowFirstRunExperienceInNewProfile( + Browser* browser, + const CoreAccountId& account_id) { + if (base::FeatureList::IsEnabled(kSyncPromoAfterSigninIntercept)) { + browser->signin_view_controller() + ->ShowModalInterceptFirstRunExperienceDialog(account_id); + } else { + // Don't show the customization bubble if a valid policy theme is set. + if (ThemeServiceFactory::GetForProfile(browser->profile()) + ->UsingPolicyTheme()) { + // Show the profile switch IPH that is normally shown after the + // customization bubble. + browser->window()->MaybeShowProfileSwitchIPH(); + return; + } + ShowProfileCustomizationBubbleInternal(browser); + } }
diff --git a/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.h b/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.h index b796032..0fd9371 100644 --- a/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.h +++ b/chrome/browser/ui/signin/dice_web_signin_interceptor_delegate.h
@@ -14,6 +14,7 @@ } class Browser; +struct CoreAccountId; class DiceWebSigninInterceptorDelegate : public DiceWebSigninInterceptor::Delegate { @@ -27,7 +28,9 @@ content::WebContents* web_contents, const BubbleParameters& bubble_parameters, base::OnceCallback<void(SigninInterceptionResult)> callback) override; - void ShowProfileCustomizationBubble(Browser* browser) override; + void ShowFirstRunExperienceInNewProfile( + Browser* browser, + const CoreAccountId& account_id) override; private: // Implemented in dice_web_signin_interception_bubble_view.cc
diff --git a/chrome/browser/ui/signin_intercept_first_run_experience_dialog.cc b/chrome/browser/ui/signin_intercept_first_run_experience_dialog.cc new file mode 100644 index 0000000..3465f24 --- /dev/null +++ b/chrome/browser/ui/signin_intercept_first_run_experience_dialog.cc
@@ -0,0 +1,340 @@ +// 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/signin_intercept_first_run_experience_dialog.h" + +#include "base/bind.h" +#include "base/callback.h" +#include "base/check_op.h" +#include "base/notreached.h" +#include "chrome/browser/themes/theme_service.h" +#include "chrome/browser/themes/theme_service_factory.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/browser_dialogs.h" +#include "chrome/browser/ui/browser_window.h" +#include "chrome/browser/ui/chrome_pages.h" +#include "chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h" +#include "chrome/browser/ui/webui/signin/login_ui_service.h" +#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" +#include "chrome/browser/ui/webui/signin/profile_customization_ui.h" +#include "chrome/common/webui_url_constants.h" +#include "components/signin/public/base/signin_metrics.h" +#include "content/public/browser/navigation_handle.h" +#include "content/public/browser/web_contents.h" +#include "content/public/browser/web_contents_observer.h" +#include "ui/base/page_transition_types.h" +#include "url/gurl.h" + +// Delegate class for DiceTurnSyncOnHelper. Determines what will be the next +// step for the first run based on Sync availabitily. +class SigninInterceptFirstRunExperienceDialog::InterceptTurnSyncOnHelperDelegate + : public DiceTurnSyncOnHelper::Delegate, + public LoginUIService::Observer { + public: + explicit InterceptTurnSyncOnHelperDelegate( + base::WeakPtr<SigninInterceptFirstRunExperienceDialog> dialog); + ~InterceptTurnSyncOnHelperDelegate() override; + + // DiceTurnSyncOnHelper::Delegate: + void ShowLoginError(const SigninUIError& error) override; + void ShowMergeSyncDataConfirmation( + const std::string& previous_email, + const std::string& new_email, + DiceTurnSyncOnHelper::SigninChoiceCallback callback) override; + void ShowEnterpriseAccountConfirmation( + const AccountInfo& account_info, + DiceTurnSyncOnHelper::SigninChoiceCallback callback) override; + void ShowSyncConfirmation( + base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)> + callback) override; + void ShowSyncDisabledConfirmation( + bool is_managed_account, + base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)> + callback) override; + void ShowSyncSettings() override; + void SwitchToProfile(Profile* new_profile) override; + + // LoginUIService::Observer: + void OnSyncConfirmationUIClosed( + LoginUIService::SyncConfirmationUIClosedResult result) override; + + private: + base::WeakPtr<SigninInterceptFirstRunExperienceDialog> dialog_; + + base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)> + sync_confirmation_callback_; + base::ScopedObservation<LoginUIService, LoginUIService::Observer> + scoped_login_ui_service_observation_{this}; +}; + +SigninInterceptFirstRunExperienceDialog::InterceptTurnSyncOnHelperDelegate:: + InterceptTurnSyncOnHelperDelegate( + base::WeakPtr<SigninInterceptFirstRunExperienceDialog> dialog) + : dialog_(std::move(dialog)) {} +SigninInterceptFirstRunExperienceDialog::InterceptTurnSyncOnHelperDelegate:: + ~InterceptTurnSyncOnHelperDelegate() = default; + +void SigninInterceptFirstRunExperienceDialog:: + InterceptTurnSyncOnHelperDelegate::ShowLoginError( + const SigninUIError& error) { + // Do not display the sync error since the user hasn't asked for sync + // explicitly. Skip to the next step. + if (dialog_) + dialog_->DoNextStep(Step::kTurnOnSync, Step::kProfileCustomization); +} + +void SigninInterceptFirstRunExperienceDialog:: + InterceptTurnSyncOnHelperDelegate::ShowMergeSyncDataConfirmation( + const std::string& previous_email, + const std::string& new_email, + DiceTurnSyncOnHelper::SigninChoiceCallback callback) { + NOTREACHED() << "Sign-in intercept shouldn't create a profile for an " + "account known to Chrome"; +} + +void SigninInterceptFirstRunExperienceDialog:: + InterceptTurnSyncOnHelperDelegate::ShowEnterpriseAccountConfirmation( + const AccountInfo& account_info, + DiceTurnSyncOnHelper::SigninChoiceCallback callback) { + // This is a brand new profile. Skip the enterprise confirmation. + // TODO(crbug.com/1282157): Do not show the sync promo if either + // - PromotionalTabsEnabled policy is set to False, or + // - the user went through the Profile Separation dialog. + std::move(callback).Run(DiceTurnSyncOnHelper::SIGNIN_CHOICE_CONTINUE); +} + +void SigninInterceptFirstRunExperienceDialog:: + InterceptTurnSyncOnHelperDelegate::ShowSyncConfirmation( + base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)> + callback) { + if (!dialog_) { + std::move(callback).Run(LoginUIService::ABORT_SYNC); + return; + } + + scoped_login_ui_service_observation_.Observe( + LoginUIServiceFactory::GetForProfile(dialog_->browser_->profile())); + DCHECK(!sync_confirmation_callback_); + sync_confirmation_callback_ = std::move(callback); + dialog_->DoNextStep(Step::kTurnOnSync, Step::kSyncConfirmation); +} + +void SigninInterceptFirstRunExperienceDialog:: + InterceptTurnSyncOnHelperDelegate::ShowSyncDisabledConfirmation( + bool is_managed_account, + base::OnceCallback<void(LoginUIService::SyncConfirmationUIClosedResult)> + callback) { + // Abort the sync flow and proceed to profile customization. + if (dialog_) { + dialog_->DoNextStep(Step::kTurnOnSync, Step::kProfileCustomization); + } + + // `SYNC_WITH_DEFAULT_SETTINGS` for the sync disable confirmation means "stay + // signed in". See https://crbug.com/1141341. + std::move(callback).Run(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); +} + +void SigninInterceptFirstRunExperienceDialog:: + InterceptTurnSyncOnHelperDelegate::ShowSyncSettings() { + if (dialog_) { + // Dialog's step is updated in OnSyncConfirmationUIClosed(). This + // function only needs to open the Sync Settings. + DCHECK_EQ(dialog_->current_step_, Step::kSyncConfirmation); + chrome::ShowSettingsSubPage(dialog_->browser_, chrome::kSyncSetupSubPage); + } +} + +void SigninInterceptFirstRunExperienceDialog:: + InterceptTurnSyncOnHelperDelegate::SwitchToProfile(Profile* new_profile) { + NOTREACHED() << "Sign-in intercept shouldn't create a new profile for an " + "account known to Chrome"; +} + +void SigninInterceptFirstRunExperienceDialog:: + InterceptTurnSyncOnHelperDelegate::OnSyncConfirmationUIClosed( + LoginUIService::SyncConfirmationUIClosedResult result) { + scoped_login_ui_service_observation_.Reset(); + + Step next_step; + switch (result) { + case LoginUIService::SYNC_WITH_DEFAULT_SETTINGS: + case LoginUIService::ABORT_SYNC: + next_step = Step::kProfileCustomization; + break; + case LoginUIService::UI_CLOSED: + case LoginUIService::CONFIGURE_SYNC_FIRST: + next_step = Step::kProfileSwitchIPHAndCloseModal; + break; + } + + if (result == LoginUIService::UI_CLOSED) { + // Sync must be aborted if the user didn't interact explicitly with the + // dialog. + result = LoginUIService::ABORT_SYNC; + } + + // Save a local reference to `dialog_` before `this` is destroyed. + auto local_dialog = dialog_; + + // Run the callback before moving to the next step to give + // `DiceTurnSyncOnHelper` the last opportunity to call `dialog_`'s methods. + // This is important for `ShowSyncSettings()`, for example. + DCHECK(sync_confirmation_callback_); + std::move(sync_confirmation_callback_).Run(result); + // `this` may now be deleted. + + if (local_dialog) { + local_dialog->DoNextStep(Step::kSyncConfirmation, next_step); + } +} + +SigninInterceptFirstRunExperienceDialog:: + SigninInterceptFirstRunExperienceDialog(Browser* browser, + const CoreAccountId& account_id, + base::OnceClosure on_close_callback) + : SigninModalDialog(std::move(on_close_callback)), + browser_(browser), + account_id_(account_id) { + DoNextStep(Step::kStart, Step::kTurnOnSync); +} + +SigninInterceptFirstRunExperienceDialog:: + ~SigninInterceptFirstRunExperienceDialog() = default; + +void SigninInterceptFirstRunExperienceDialog::CloseModalDialog() { + if (dialog_delegate_) { + // Delegate will notify `this` when modal signin is closed. + dialog_delegate_->CloseModalSignin(); + } else { + // No dialog is displayed yet, so close `this` directly. + OnModalDialogClosed(); + } +} +void SigninInterceptFirstRunExperienceDialog::ResizeNativeView(int height) { + DCHECK(dialog_delegate_); + dialog_delegate_->ResizeNativeView(height); +} + +content::WebContents* +SigninInterceptFirstRunExperienceDialog::GetModalDialogWebContentsForTesting() { + return dialog_delegate_ ? dialog_delegate_->GetWebContents() : nullptr; +} + +void SigninInterceptFirstRunExperienceDialog::OnModalDialogClosed() { + DCHECK(!dialog_delegate_ || + dialog_delegate_observation_.IsObservingSource(dialog_delegate_)); + dialog_delegate_observation_.Reset(); + dialog_delegate_ = nullptr; + NotifyModalDialogClosed(); +} + +void SigninInterceptFirstRunExperienceDialog::DoNextStep( + Step expected_current_step, + Step step) { + DCHECK_EQ(expected_current_step, current_step_); + // Going to a previous step is not allowed. + DCHECK_GT(step, current_step_); + current_step_ = step; + + switch (step) { + case Step::kStart: + NOTREACHED(); + return; + case Step::kTurnOnSync: + DoTurnOnSync(); + return; + case Step::kSyncConfirmation: + DoSyncConfirmation(); + return; + case Step::kProfileCustomization: + DoProfileCustomization(); + return; + case Step::kProfileSwitchIPHAndCloseModal: + DoProfileSwitchIPHAndCloseModal(); + return; + } +} + +void SigninInterceptFirstRunExperienceDialog::DoTurnOnSync() { + // DiceTurnSyncOnHelper deletes itself once done. + new DiceTurnSyncOnHelper( + browser_->profile(), + signin_metrics::AccessPoint:: + ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE, + signin_metrics::PromoAction::PROMO_ACTION_NO_SIGNIN_PROMO, + signin_metrics::Reason::kSigninPrimaryAccount, account_id_, + DiceTurnSyncOnHelper::SigninAbortedMode::KEEP_ACCOUNT, + std::make_unique<InterceptTurnSyncOnHelperDelegate>( + weak_ptr_factory_.GetWeakPtr()), + base::OnceClosure()); +} + +void SigninInterceptFirstRunExperienceDialog::DoSyncConfirmation() { + SetDialogDelegate( + SigninViewControllerDelegate::CreateSyncConfirmationDelegate(browser_)); + PreloadProfileCustomizationUI(); +} + +void SigninInterceptFirstRunExperienceDialog::DoProfileCustomization() { + // Don't show the customization bubble if a valid policy theme is set. + if (ThemeServiceFactory::GetForProfile(browser_->profile()) + ->UsingPolicyTheme()) { + // Show the profile switch IPH that is normally shown after the + // customization bubble. + DoNextStep(Step::kProfileCustomization, + Step::kProfileSwitchIPHAndCloseModal); + return; + } + + if (!dialog_delegate_) { + // Modal dialog doesn't exist yet, create a new one. + SetDialogDelegate( + SigninViewControllerDelegate::CreateProfileCustomizationDelegate( + browser_)); + return; + } + + DCHECK(profile_customization_preloaded_contents_); + dialog_delegate_->SetWebContents( + profile_customization_preloaded_contents_.get()); +} + +void SigninInterceptFirstRunExperienceDialog:: + DoProfileSwitchIPHAndCloseModal() { + browser_->window()->MaybeShowProfileSwitchIPH(); + CloseModalDialog(); +} + +void SigninInterceptFirstRunExperienceDialog::SetDialogDelegate( + SigninViewControllerDelegate* delegate) { + DCHECK(!dialog_delegate_); + DCHECK(!dialog_delegate_observation_.IsObserving()); + dialog_delegate_ = delegate; + dialog_delegate_observation_.Observe(dialog_delegate_); +} + +void SigninInterceptFirstRunExperienceDialog::PreloadProfileCustomizationUI() { + profile_customization_preloaded_contents_ = + content::WebContents::Create(content::WebContents::CreateParams( + browser_->profile(), + content::SiteInstance::Create(browser_->profile()))); + profile_customization_preloaded_contents_->GetController().LoadURL( + GURL(chrome::kChromeUIProfileCustomizationURL), content::Referrer(), + ui::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); + ProfileCustomizationUI* web_ui = + profile_customization_preloaded_contents_->GetWebUI() + ->GetController() + ->GetAs<ProfileCustomizationUI>(); + DCHECK(web_ui); + web_ui->Initialize( + base::BindOnce(&SigninInterceptFirstRunExperienceDialog:: + OnProfileCustomizationDoneButtonClicked, + // Unretained is fine because `this` owns the web contents. + base::Unretained(this))); +} + +void SigninInterceptFirstRunExperienceDialog:: + OnProfileCustomizationDoneButtonClicked() { + DoNextStep(Step::kProfileCustomization, Step::kProfileSwitchIPHAndCloseModal); +}
diff --git a/chrome/browser/ui/signin_intercept_first_run_experience_dialog.h b/chrome/browser/ui/signin_intercept_first_run_experience_dialog.h new file mode 100644 index 0000000..ad338e6 --- /dev/null +++ b/chrome/browser/ui/signin_intercept_first_run_experience_dialog.h
@@ -0,0 +1,91 @@ +// 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_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE_DIALOG_H_ +#define CHROME_BROWSER_UI_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE_DIALOG_H_ + +#include "base/callback_forward.h" +#include "base/memory/raw_ptr.h" +#include "base/memory/weak_ptr.h" +#include "base/scoped_observation.h" +#include "chrome/browser/ui/signin_modal_dialog.h" +#include "chrome/browser/ui/signin_view_controller_delegate.h" +#include "google_apis/gaia/core_account_id.h" + +class Browser; + +// First run experience modal dialog shown after the user created a new profile +// through the signin interception. +// +// First run consists of the following steps in order: +// - Sync confirmation, if Sync can be enabled for this account +// - Profile customization, if profile theme isn't overridden by a policy +// - Profile switching IPH (outside of the dialog, after it closes) +// If neither of the conditions is satisfied, the dialog never shows and +// silently deletes itself through calling `on_close_callback`. +class SigninInterceptFirstRunExperienceDialog + : public SigninModalDialog, + public SigninViewControllerDelegate::Observer { + public: + explicit SigninInterceptFirstRunExperienceDialog( + Browser* browser, + const CoreAccountId& account_id, + base::OnceClosure on_close_callback); + ~SigninInterceptFirstRunExperienceDialog() override; + + // SigninModalDialog: + void CloseModalDialog() override; + void ResizeNativeView(int height) override; + content::WebContents* GetModalDialogWebContentsForTesting() override; + + // SigninViewControllerDelegate::Observer: + void OnModalDialogClosed() override; + + private: + // `InterceptTurnSyncOnHelperDelegate` needs access to private methods of + // `SigninInterceptFirstRunExperienceDialog`. + class InterceptTurnSyncOnHelperDelegate; + friend class SigninInterceptFirstRunExperienceDialogBrowserTest; + + // Ordered list of first run steps. Some steps might be skipped but they + // always appear in this order. + enum class Step { + kStart, + kTurnOnSync, + kSyncConfirmation, + kProfileCustomization, + kProfileSwitchIPHAndCloseModal, + }; + + // Moves the dialog from `expected_current_step` to `step`. + void DoNextStep(Step expected_current_step, Step step); + + // Actions executed right after moving to a corresponding step. + void DoTurnOnSync(); + void DoSyncConfirmation(); + void DoProfileCustomization(); + void DoProfileSwitchIPHAndCloseModal(); + + void SetDialogDelegate(SigninViewControllerDelegate* delegate); + void PreloadProfileCustomizationUI(); + void OnProfileCustomizationDoneButtonClicked(); + + const raw_ptr<Browser> browser_; + const CoreAccountId account_id_; + + Step current_step_ = Step::kStart; + + raw_ptr<SigninViewControllerDelegate> dialog_delegate_ = nullptr; + base::ScopedObservation<SigninViewControllerDelegate, + SigninViewControllerDelegate::Observer> + dialog_delegate_observation_{this}; + + std::unique_ptr<content::WebContents> + profile_customization_preloaded_contents_; + + base::WeakPtrFactory<SigninInterceptFirstRunExperienceDialog> + weak_ptr_factory_{this}; +}; + +#endif // CHROME_BROWSER_UI_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE_DIALOG_H_
diff --git a/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc b/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc new file mode 100644 index 0000000..9d54bcff --- /dev/null +++ b/chrome/browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc
@@ -0,0 +1,377 @@ +// 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/signin_intercept_first_run_experience_dialog.h" + +#include "base/test/bind.h" +#include "chrome/browser/feature_engagement/tracker_factory.h" +#include "chrome/browser/policy/cloud/user_policy_signin_service.h" +#include "chrome/browser/policy/cloud/user_policy_signin_service_factory.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/identity_manager_factory.h" +#include "chrome/browser/signin/identity_test_environment_profile_adaptor.h" +#include "chrome/browser/sync/sync_service_factory.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/browser/ui/signin_view_controller.h" +#include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h" +#include "chrome/browser/ui/views/user_education/feature_promo_controller_views.h" +#include "chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h" +#include "chrome/browser/ui/webui/signin/login_ui_service.h" +#include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "components/feature_engagement/public/feature_constants.h" +#include "components/feature_engagement/public/tracker.h" +#include "components/feature_engagement/test/test_tracker.h" +#include "components/keyed_service/core/keyed_service.h" +#include "components/signin/public/base/account_consistency_method.h" +#include "components/sync/driver/test_sync_service.h" +#include "content/public/browser/web_contents.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/test_navigation_observer.h" +#include "google_apis/gaia/core_account_id.h" +#include "url/gurl.h" + +namespace { + +// Sync might use email address as an heuristic to determine whether an account +// might be managed. +const char kConsumerEmail[] = "test@example.com"; +const char kEnterpriseEmail[] = "test@managed.com"; + +// Fake user policy signin service immediately invoking the callbacks. +// TODO(alexilin): write a common FakeUserPolicySigninService for using in +// sign-in tests instead of maintaining several copies. +class FakeUserPolicySigninService : public policy::UserPolicySigninService { + public: + FakeUserPolicySigninService(Profile* profile, + signin::IdentityManager* identity_manager) + : UserPolicySigninService(profile, + nullptr, + nullptr, + nullptr, + identity_manager, + nullptr) {} + + // policy::UserPolicySigninService: + void RegisterForPolicyWithAccountId( + const std::string& username, + const CoreAccountId& account_id, + PolicyRegistrationCallback callback) override { + std::move(callback).Run(std::string(), std::string()); + } + + // policy::UserPolicySigninServiceBase: + void FetchPolicyForSignedInUser( + const AccountId& account_id, + const std::string& dm_token, + const std::string& client_id, + scoped_refptr<network::SharedURLLoaderFactory> test_shared_loader_factory, + PolicyFetchCallback callback) override { + std::move(callback).Run(true); + } +}; + +std::unique_ptr<KeyedService> CreateTestTracker(content::BrowserContext*) { + return feature_engagement::CreateTestTracker(); +} + +std::unique_ptr<KeyedService> CreateTestSyncService(content::BrowserContext*) { + return std::make_unique<syncer::TestSyncService>(); +} + +std::unique_ptr<KeyedService> CreateTestUserPolicySigninService( + content::BrowserContext* context) { + Profile* profile = Profile::FromBrowserContext(context); + return std::make_unique<FakeUserPolicySigninService>( + profile, IdentityManagerFactory::GetForProfile(profile)); +} + +} // namespace + +// Browser tests for SigninInterceptFirstRunExperienceDialog. +class SigninInterceptFirstRunExperienceDialogBrowserTest + : public InProcessBrowserTest { + public: + SigninInterceptFirstRunExperienceDialogBrowserTest() + : feature_list_(feature_engagement::kIPHProfileSwitchFeature) {} + ~SigninInterceptFirstRunExperienceDialogBrowserTest() override = default; + + void SetUpInProcessBrowserTestFixture() override { + InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); + create_services_subscription_ = + BrowserContextDependencyManager::GetInstance() + ->RegisterCreateServicesCallbackForTesting(base::BindRepeating( + &SigninInterceptFirstRunExperienceDialogBrowserTest:: + OnWillCreateBrowserContextServices, + base::Unretained(this))); + } + + void OnWillCreateBrowserContextServices(content::BrowserContext* context) { + IdentityTestEnvironmentProfileAdaptor:: + SetIdentityTestEnvironmentFactoriesOnBrowserContext( + context, signin::AccountConsistencyMethod::kDice); + feature_engagement::TrackerFactory::GetInstance()->SetTestingFactory( + context, base::BindRepeating(&CreateTestTracker)); + SyncServiceFactory::GetInstance()->SetTestingFactory( + context, base::BindRepeating(&CreateTestSyncService)); + policy::UserPolicySigninServiceFactory::GetInstance()->SetTestingFactory( + context, base::BindRepeating(&CreateTestUserPolicySigninService)); + } + + void SetUpOnMainThread() override { + InProcessBrowserTest::SetUpOnMainThread(); + identity_test_env_profile_adaptor_ = + std::make_unique<IdentityTestEnvironmentProfileAdaptor>( + browser()->profile()); + identity_test_env()->SetAutomaticIssueOfAccessTokens(true); + + // Needed for profile switch IPH testing. + AvatarToolbarButton::SetIPHMinDelayAfterCreationForTesting( + base::Seconds(0)); + FeaturePromoControllerViews::BlockActiveWindowCheckForTesting(); + } + + // Returns true if the profile switch IPH has been shown. + bool ProfileSwitchPromoHasBeenShown() { + feature_engagement::Tracker* tracker = + feature_engagement::TrackerFactory::GetForBrowserContext( + browser()->profile()); + + base::RunLoop loop; + tracker->AddOnInitializedCallback( + base::BindLambdaForTesting([&loop](bool success) { + DCHECK(success); + loop.Quit(); + })); + loop.Run(); + + EXPECT_TRUE(tracker->IsInitialized()); + return tracker->GetTriggerState( + feature_engagement::kIPHProfileSwitchFeature) == + feature_engagement::Tracker::TriggerState::HAS_BEEN_DISPLAYED; + } + + void SignIn(const std::string& email) { + account_id_ = + identity_test_env() + ->MakePrimaryAccountAvailable(email, signin::ConsentLevel::kSignin) + .account_id; + EXPECT_EQ( + identity_manager()->GetPrimaryAccountId(signin::ConsentLevel::kSignin), + account_id()); + } + + void SimulateSyncConfirmationUIClosing( + LoginUIService::SyncConfirmationUIClosedResult result) { + LoginUIServiceFactory::GetForProfile(browser()->profile()) + ->SyncConfirmationUIClosed(result); + } + + void SimulateProfileCustomizationUIClosing() { + dialog()->OnProfileCustomizationDoneButtonClicked(); + } + + // `kSignin` consent level means that Sync should be disabled. + void ExpectPrimaryAccountWithExactConsentLevel( + signin::ConsentLevel consent_level) { + EXPECT_EQ( + identity_manager()->GetPrimaryAccountId(signin::ConsentLevel::kSignin), + account_id()); + EXPECT_EQ( + identity_manager()->HasPrimaryAccount(signin::ConsentLevel::kSync), + consent_level == signin::ConsentLevel::kSync); + } + + signin::IdentityTestEnvironment* identity_test_env() { + return identity_test_env_profile_adaptor_->identity_test_env(); + } + + signin::IdentityManager* identity_manager() { + return IdentityManagerFactory::GetForProfile(browser()->profile()); + } + + syncer::TestSyncService* sync_service() { + return static_cast<syncer::TestSyncService*>( + SyncServiceFactory::GetForProfile(browser()->profile())); + } + + SigninViewController* controller() { + return browser()->signin_view_controller(); + } + + SigninInterceptFirstRunExperienceDialog* dialog() { + return static_cast<SigninInterceptFirstRunExperienceDialog*>( + controller()->GetModalDialogForTesting()); + } + + CoreAccountId account_id() { return account_id_; } + + protected: + const GURL kSyncConfirmationUrl = GURL("chrome://sync-confirmation"); + const GURL kProfileCustomizationUrl = GURL("chrome://profile-customization"); + const GURL kSyncSettingsUrl = GURL("chrome://settings/syncSetup"); + + private: + base::CallbackListSubscription create_services_subscription_; + std::unique_ptr<IdentityTestEnvironmentProfileAdaptor> + identity_test_env_profile_adaptor_; + base::test::ScopedFeatureList feature_list_; + + CoreAccountId account_id_; +}; + +// Shows and closes the fre dialog. +IN_PROC_BROWSER_TEST_F(SigninInterceptFirstRunExperienceDialogBrowserTest, + ShowAndCloseDialog) { + SignIn(kConsumerEmail); + controller()->ShowModalInterceptFirstRunExperienceDialog(account_id()); + EXPECT_TRUE(controller()->ShowsModalDialog()); + controller()->CloseModalSignin(); + EXPECT_FALSE(controller()->ShowsModalDialog()); +} + +// Goes through all steps of the fre dialog. The user enables sync. +IN_PROC_BROWSER_TEST_F(SigninInterceptFirstRunExperienceDialogBrowserTest, + AcceptSync) { + SignIn(kConsumerEmail); + content::TestNavigationObserver sync_confirmation_observer( + kSyncConfirmationUrl); + content::TestNavigationObserver profile_customization_observer( + kProfileCustomizationUrl); + sync_confirmation_observer.StartWatchingNewWebContents(); + profile_customization_observer.StartWatchingNewWebContents(); + + controller()->ShowModalInterceptFirstRunExperienceDialog(account_id()); + EXPECT_TRUE(controller()->ShowsModalDialog()); + sync_confirmation_observer.Wait(); + EXPECT_EQ( + dialog()->GetModalDialogWebContentsForTesting()->GetLastCommittedURL(), + kSyncConfirmationUrl); + + SimulateSyncConfirmationUIClosing(LoginUIService::SYNC_WITH_DEFAULT_SETTINGS); + ExpectPrimaryAccountWithExactConsentLevel(signin::ConsentLevel::kSync); + EXPECT_TRUE(controller()->ShowsModalDialog()); + profile_customization_observer.Wait(); + EXPECT_EQ( + dialog()->GetModalDialogWebContentsForTesting()->GetLastCommittedURL(), + kProfileCustomizationUrl); + + SimulateProfileCustomizationUIClosing(); + EXPECT_FALSE(controller()->ShowsModalDialog()); + EXPECT_TRUE(ProfileSwitchPromoHasBeenShown()); +} + +// Goes through all steps of the fre dialog. The user declines sync. +IN_PROC_BROWSER_TEST_F(SigninInterceptFirstRunExperienceDialogBrowserTest, + DeclineSync) { + SignIn(kConsumerEmail); + content::TestNavigationObserver sync_confirmation_observer( + kSyncConfirmationUrl); + content::TestNavigationObserver profile_customization_observer( + kProfileCustomizationUrl); + sync_confirmation_observer.StartWatchingNewWebContents(); + profile_customization_observer.StartWatchingNewWebContents(); + + controller()->ShowModalInterceptFirstRunExperienceDialog(account_id()); + EXPECT_TRUE(controller()->ShowsModalDialog()); + sync_confirmation_observer.Wait(); + EXPECT_EQ( + dialog()->GetModalDialogWebContentsForTesting()->GetLastCommittedURL(), + kSyncConfirmationUrl); + + SimulateSyncConfirmationUIClosing(LoginUIService::ABORT_SYNC); + ExpectPrimaryAccountWithExactConsentLevel(signin::ConsentLevel::kSignin); + EXPECT_TRUE(controller()->ShowsModalDialog()); + profile_customization_observer.Wait(); + EXPECT_EQ( + dialog()->GetModalDialogWebContentsForTesting()->GetLastCommittedURL(), + kProfileCustomizationUrl); + + SimulateProfileCustomizationUIClosing(); + EXPECT_FALSE(controller()->ShowsModalDialog()); + EXPECT_TRUE(ProfileSwitchPromoHasBeenShown()); +} + +// The user chooses to manage sync settings in the sync confirmation dialog. +// The profile customization is not shown in this case. +IN_PROC_BROWSER_TEST_F(SigninInterceptFirstRunExperienceDialogBrowserTest, + SyncSettings) { + SignIn(kConsumerEmail); + content::TestNavigationObserver sync_confirmation_observer( + kSyncConfirmationUrl); + sync_confirmation_observer.StartWatchingNewWebContents(); + + controller()->ShowModalInterceptFirstRunExperienceDialog(account_id()); + EXPECT_TRUE(controller()->ShowsModalDialog()); + sync_confirmation_observer.Wait(); + EXPECT_EQ( + dialog()->GetModalDialogWebContentsForTesting()->GetLastCommittedURL(), + kSyncConfirmationUrl); + + SimulateSyncConfirmationUIClosing(LoginUIService::CONFIGURE_SYNC_FIRST); + // kSync consent level is not revoked. + ExpectPrimaryAccountWithExactConsentLevel(signin::ConsentLevel::kSync); + // Browser displays a sync settings tab. + EXPECT_EQ( + browser()->tab_strip_model()->GetActiveWebContents()->GetVisibleURL(), + kSyncSettingsUrl); + // Sync settings abort the fre dialog. + EXPECT_FALSE(controller()->ShowsModalDialog()); + EXPECT_TRUE(ProfileSwitchPromoHasBeenShown()); +} + +// Closes the fre dialog before the sync confirmation is shown. Tests that +// `DiceTurnSyncOnHelper` is eventually destroyed. +IN_PROC_BROWSER_TEST_F(SigninInterceptFirstRunExperienceDialogBrowserTest, + CloseDialogBeforeSyncConfirmationIsShown) { + // It's important to use an enterprise email here in order to block the sync + // confirmation UI until the sync engine starts. + SignIn(kEnterpriseEmail); + // Delays the sync confirmation UI. + sync_service()->SetTransportState( + syncer::SyncService::TransportState::INITIALIZING); + + controller()->ShowModalInterceptFirstRunExperienceDialog(account_id()); + EXPECT_TRUE(controller()->ShowsModalDialog()); + + controller()->CloseModalSignin(); + EXPECT_FALSE(controller()->ShowsModalDialog()); + + // `DiceTurnSyncOnHelper` should be destroyed after the sync engine is up and + // running. + sync_service()->SetTransportState( + syncer::SyncService::TransportState::ACTIVE); + sync_service()->FireStateChanged(); + EXPECT_FALSE(DiceTurnSyncOnHelper::HasCurrentDiceTurnSyncOnHelperForTesting( + browser()->profile())); + // Sync is aborted. + ExpectPrimaryAccountWithExactConsentLevel(signin::ConsentLevel::kSignin); +} + +// Tests the case when sync is disabled by policy. The fre dialog starts with +// the profile customization UI. +IN_PROC_BROWSER_TEST_F(SigninInterceptFirstRunExperienceDialogBrowserTest, + SyncDisabled) { + SignIn(kEnterpriseEmail); + sync_service()->SetDisableReasons( + syncer::SyncService::DISABLE_REASON_ENTERPRISE_POLICY); + content::TestNavigationObserver profile_customization_observer( + kProfileCustomizationUrl); + profile_customization_observer.StartWatchingNewWebContents(); + + // Sync confirmation is skipped. + controller()->ShowModalInterceptFirstRunExperienceDialog(account_id()); + EXPECT_TRUE(controller()->ShowsModalDialog()); + profile_customization_observer.Wait(); + EXPECT_EQ( + dialog()->GetModalDialogWebContentsForTesting()->GetLastCommittedURL(), + kProfileCustomizationUrl); + // Sync consent is granted even though Sync cannot be enabled. + ExpectPrimaryAccountWithExactConsentLevel(signin::ConsentLevel::kSync); + + SimulateProfileCustomizationUIClosing(); + EXPECT_FALSE(controller()->ShowsModalDialog()); + EXPECT_TRUE(ProfileSwitchPromoHasBeenShown()); +}
diff --git a/chrome/browser/ui/signin_view_controller.cc b/chrome/browser/ui/signin_view_controller.cc index 9eb9b74b..1c83a7e 100644 --- a/chrome/browser/ui/signin_view_controller.cc +++ b/chrome/browser/ui/signin_view_controller.cc
@@ -15,8 +15,10 @@ #include "chrome/browser/signin/signin_ui_util.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_dialogs.h" +#include "chrome/browser/ui/signin_intercept_first_run_experience_dialog.h" #include "chrome/browser/ui/signin_modal_dialog.h" #include "chrome/browser/ui/signin_modal_dialog_impl.h" +#include "chrome/browser/ui/signin_view_controller_delegate.h" #include "components/signin/public/base/consent_level.h" #include "components/signin/public/base/signin_buildflags.h" #include "components/signin/public/identity_manager/account_info.h" @@ -225,6 +227,15 @@ chrome::RecordDialogCreation(chrome::DialogIdentifier::SIGNIN_REAUTH); return abort_handle; } + +void SigninViewController::ShowModalInterceptFirstRunExperienceDialog( + const CoreAccountId& account_id) { + CloseModalSignin(); + dialog_ = std::make_unique<SigninInterceptFirstRunExperienceDialog>( + browser_, account_id, GetOnModalDialogClosedCallback()); + chrome::RecordDialogCreation( + chrome::DialogIdentifier::SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE); +} #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) void SigninViewController::ShowModalSyncConfirmationDialog() {
diff --git a/chrome/browser/ui/signin_view_controller.h b/chrome/browser/ui/signin_view_controller.h index 7a343a5..6159e186 100644 --- a/chrome/browser/ui/signin_view_controller.h +++ b/chrome/browser/ui/signin_view_controller.h
@@ -124,6 +124,12 @@ const CoreAccountId& account_id, signin_metrics::ReauthAccessPoint access_point, base::OnceCallback<void(signin::ReauthResult)> reauth_callback); + + // Shows the modal signin intercept first run experience dialog as a + // browser-modal dialog on top of the `browser_`'s window. `account_id` + // corresponds to the intercepted account. + void ShowModalInterceptFirstRunExperienceDialog( + const CoreAccountId& account_id); #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) // Shows the modal sync confirmation dialog as a browser-modal dialog on top @@ -165,6 +171,7 @@ CloseImmediately); friend class login_ui_test_utils::SigninViewControllerTestUtil; friend class SigninReauthViewControllerBrowserTest; + friend class SigninInterceptFirstRunExperienceDialogBrowserTest; #if BUILDFLAG(ENABLE_DICE_SUPPORT) // Shows the DICE-specific sign-in flow: opens a Gaia sign-in webpage in a new
diff --git a/chrome/browser/ui/signin_view_controller_delegate.h b/chrome/browser/ui/signin_view_controller_delegate.h index e2a7bdd..30b5c7a3 100644 --- a/chrome/browser/ui/signin_view_controller_delegate.h +++ b/chrome/browser/ui/signin_view_controller_delegate.h
@@ -10,6 +10,7 @@ #include "base/observer_list_types.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" +#include "components/signin/public/base/signin_buildflags.h" #include "third_party/skia/include/core/SkColor.h" class Browser; @@ -56,6 +57,7 @@ static SigninViewControllerDelegate* CreateSigninErrorDelegate( Browser* browser); +#if BUILDFLAG(ENABLE_DICE_SUPPORT) // Returns a platform-specific SigninViewContolllerDelegate instance that // displays the reauth confirmation modal dialog. The returned object should // delete itself when the window it's managing is closed. @@ -64,6 +66,13 @@ const CoreAccountId& account_id, signin_metrics::ReauthAccessPoint access_point); + // Returns a platform-specific SigninViewControllerDelegate instance that + // displays the profile customization modal dialog. The returned object should + // delete itself when the window it's managing is closed. + static SigninViewControllerDelegate* CreateProfileCustomizationDelegate( + Browser* browser); +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) + #if defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || \ BUILDFLAG(IS_CHROMEOS_LACROS) // Returns a platform-specific SigninViewContolllerDelegate instance that
diff --git a/chrome/browser/ui/views/permission_bubble/permission_chip_interactive_test.cc b/chrome/browser/ui/views/permission_bubble/permission_chip_interactive_test.cc index fe19c82..ea7e130 100644 --- a/chrome/browser/ui/views/permission_bubble/permission_chip_interactive_test.cc +++ b/chrome/browser/ui/views/permission_bubble/permission_chip_interactive_test.cc
@@ -520,7 +520,7 @@ } IN_PROC_BROWSER_TEST_F(QuietChipAutoPopupBubbleInteractiveTest, - QuietChipAbusiveUmaTest) { + PermissionIgnoredQuietChipAbusiveUmaTest) { base::HistogramTester histograms; for (QuietUiReason reason : {QuietUiReason::kTriggeredByCrowdDeny, @@ -555,6 +555,122 @@ } IN_PROC_BROWSER_TEST_F(QuietChipAutoPopupBubbleInteractiveTest, + PermissionGrantedQuietChipAbusiveUmaTest) { + base::HistogramTester histograms; + + for (QuietUiReason reason : {QuietUiReason::kTriggeredByCrowdDeny, + QuietUiReason::kTriggeredDueToAbusiveRequests, + QuietUiReason::kTriggeredDueToAbusiveContent}) { + SetCannedUiDecision(reason, absl::nullopt); + + RequestPermission(permissions::RequestType::kNotifications); + + ASSERT_EQ( + test_api_->manager()->current_request_prompt_disposition_for_testing(), + permissions::PermissionPromptDisposition:: + LOCATION_BAR_LEFT_QUIET_ABUSIVE_CHIP); + + ClickOnChip(GetChip()); + + test_api_->manager()->Accept(); + base::RunLoop().RunUntilIdle(); + } + + metrics::SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.LocationBarLeftQuietAbusiveChip." + "Accepted.DidClickLearnMore", + static_cast<int>(false), 3); +} + +IN_PROC_BROWSER_TEST_F(QuietChipAutoPopupBubbleInteractiveTest, + PermissionGrantedOnceQuietChipAbusiveUmaTest) { + base::HistogramTester histograms; + + for (QuietUiReason reason : {QuietUiReason::kTriggeredByCrowdDeny, + QuietUiReason::kTriggeredDueToAbusiveRequests, + QuietUiReason::kTriggeredDueToAbusiveContent}) { + SetCannedUiDecision(reason, absl::nullopt); + + RequestPermission(permissions::RequestType::kNotifications); + + ASSERT_EQ( + test_api_->manager()->current_request_prompt_disposition_for_testing(), + permissions::PermissionPromptDisposition:: + LOCATION_BAR_LEFT_QUIET_ABUSIVE_CHIP); + + ClickOnChip(GetChip()); + + test_api_->manager()->AcceptThisTime(); + base::RunLoop().RunUntilIdle(); + } + + metrics::SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.LocationBarLeftQuietAbusiveChip." + "AcceptedOnce.DidClickLearnMore", + static_cast<int>(false), 3); +} + +IN_PROC_BROWSER_TEST_F(QuietChipAutoPopupBubbleInteractiveTest, + PermissionDeniedOnceQuietChipAbusiveUmaTest) { + base::HistogramTester histograms; + + for (QuietUiReason reason : {QuietUiReason::kTriggeredByCrowdDeny, + QuietUiReason::kTriggeredDueToAbusiveRequests, + QuietUiReason::kTriggeredDueToAbusiveContent}) { + SetCannedUiDecision(reason, absl::nullopt); + + RequestPermission(permissions::RequestType::kNotifications); + + ASSERT_EQ( + test_api_->manager()->current_request_prompt_disposition_for_testing(), + permissions::PermissionPromptDisposition:: + LOCATION_BAR_LEFT_QUIET_ABUSIVE_CHIP); + + ClickOnChip(GetChip()); + + test_api_->manager()->Deny(); + base::RunLoop().RunUntilIdle(); + } + + metrics::SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.LocationBarLeftQuietAbusiveChip." + "Denied.DidClickLearnMore", + static_cast<int>(false), 3); +} + +IN_PROC_BROWSER_TEST_F(QuietChipAutoPopupBubbleInteractiveTest, + PermissionDismissedOnceQuietChipAbusiveUmaTest) { + base::HistogramTester histograms; + + for (QuietUiReason reason : {QuietUiReason::kTriggeredByCrowdDeny, + QuietUiReason::kTriggeredDueToAbusiveRequests, + QuietUiReason::kTriggeredDueToAbusiveContent}) { + SetCannedUiDecision(reason, absl::nullopt); + + RequestPermission(permissions::RequestType::kNotifications); + + ASSERT_EQ( + test_api_->manager()->current_request_prompt_disposition_for_testing(), + permissions::PermissionPromptDisposition:: + LOCATION_BAR_LEFT_QUIET_ABUSIVE_CHIP); + + ClickOnChip(GetChip()); + + test_api_->manager()->Dismiss(); + base::RunLoop().RunUntilIdle(); + } + + metrics::SubprocessMetricsProvider::MergeHistogramDeltasForTesting(); + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.LocationBarLeftQuietAbusiveChip." + "Dismissed.DidClickLearnMore", + static_cast<int>(false), 3); +} + +IN_PROC_BROWSER_TEST_F(QuietChipAutoPopupBubbleInteractiveTest, QuietChipAbusiveClickLearnMoreUmaTest) { base::HistogramTester histograms;
diff --git a/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view_browsertest.cc b/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view_browsertest.cc index 54d3c896..d148d1c 100644 --- a/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view_browsertest.cc +++ b/chrome/browser/ui/views/permission_bubble/permission_prompt_bubble_view_browsertest.cc
@@ -5,6 +5,7 @@ #include "base/callback_helpers.h" #include "base/feature_list.h" #include "base/run_loop.h" +#include "base/test/metrics/histogram_tester.h" #include "build/build_config.h" #include "build/chromeos_buildflags.h" #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" @@ -517,6 +518,8 @@ // when permission is not considered abusive. IN_PROC_BROWSER_TEST_P(PermissionPromptBubbleViewBrowserTest, DispositionNoAbusiveTest) { + base::HistogramTester histograms; + ShowUi("geolocation"); EXPECT_EQ( @@ -525,9 +528,30 @@ ? permissions::PermissionPromptDisposition::LOCATION_BAR_LEFT_CHIP : permissions::PermissionPromptDisposition::ANCHORED_BUBBLE); + base::TimeDelta duration = base::Milliseconds(42); + test_api_->manager()->set_time_to_decision_for_test(duration); + test_api_->manager()->Accept(); base::RunLoop().RunUntilIdle(); + if (GetParam()) { + histograms.ExpectBucketCount( + "Permissions.Prompt.Geolocation.LocationBarLeftChip.Action", + static_cast<int>(permissions::PermissionAction::GRANTED), 1); + histograms.ExpectTimeBucketCount( + "Permissions.Prompt.Geolocation.LocationBarLeftChip.Accepted." + "TimeToAction", + duration, 1); + } else { + histograms.ExpectBucketCount( + "Permissions.Prompt.Geolocation.AnchoredBubble.Action", + static_cast<int>(permissions::PermissionAction::GRANTED), 1); + histograms.ExpectTimeBucketCount( + "Permissions.Prompt.Geolocation.AnchoredBubble.Accepted." + "TimeToAction", + duration, 1); + } + ShowUi("notifications"); EXPECT_EQ( @@ -536,8 +560,98 @@ ? permissions::PermissionPromptDisposition::LOCATION_BAR_LEFT_CHIP : permissions::PermissionPromptDisposition::ANCHORED_BUBBLE); + duration = base::Milliseconds(42); + test_api_->manager()->set_time_to_decision_for_test(duration); + test_api_->manager()->Accept(); base::RunLoop().RunUntilIdle(); + + if (GetParam()) { + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.LocationBarLeftChip.Action", + static_cast<int>(permissions::PermissionAction::GRANTED), 1); + histograms.ExpectTimeBucketCount( + "Permissions.Prompt.Notifications.LocationBarLeftChip.Accepted." + "TimeToAction", + duration, 1); + } else { + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.AnchoredBubble.Action", + static_cast<int>(permissions::PermissionAction::GRANTED), 1); + histograms.ExpectTimeBucketCount( + "Permissions.Prompt.Notifications.AnchoredBubble.Accepted." + "TimeToAction", + duration, 1); + } +} + +IN_PROC_BROWSER_TEST_P(PermissionPromptBubbleViewBrowserTest, + AcceptedOnceDispositionNoAbusiveTest) { + base::HistogramTester histograms; + + ShowUi("geolocation"); + + EXPECT_EQ( + test_api_->manager()->current_request_prompt_disposition_for_testing(), + GetParam() + ? permissions::PermissionPromptDisposition::LOCATION_BAR_LEFT_CHIP + : permissions::PermissionPromptDisposition::ANCHORED_BUBBLE); + + base::TimeDelta duration = base::Milliseconds(42); + test_api_->manager()->set_time_to_decision_for_test(duration); + + test_api_->manager()->AcceptThisTime(); + base::RunLoop().RunUntilIdle(); + + if (GetParam()) { + histograms.ExpectBucketCount( + "Permissions.Prompt.Geolocation.LocationBarLeftChip.Action", + static_cast<int>(permissions::PermissionAction::GRANTED_ONCE), 1); + histograms.ExpectTimeBucketCount( + "Permissions.Prompt.Geolocation.LocationBarLeftChip.AcceptedOnce." + "TimeToAction", + duration, 1); + } else { + histograms.ExpectBucketCount( + "Permissions.Prompt.Geolocation.AnchoredBubble.Action", + static_cast<int>(permissions::PermissionAction::GRANTED_ONCE), 1); + histograms.ExpectTimeBucketCount( + "Permissions.Prompt.Geolocation.AnchoredBubble.AcceptedOnce." + "TimeToAction", + duration, 1); + } + + ShowUi("notifications"); + + EXPECT_EQ( + test_api_->manager()->current_request_prompt_disposition_for_testing(), + GetParam() + ? permissions::PermissionPromptDisposition::LOCATION_BAR_LEFT_CHIP + : permissions::PermissionPromptDisposition::ANCHORED_BUBBLE); + + duration = base::Milliseconds(42); + test_api_->manager()->set_time_to_decision_for_test(duration); + + test_api_->manager()->AcceptThisTime(); + base::RunLoop().RunUntilIdle(); + + if (GetParam()) { + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.LocationBarLeftChip.Action", + static_cast<int>(permissions::PermissionAction::GRANTED_ONCE), 1); + histograms.ExpectTimeBucketCount( + "Permissions.Prompt.Notifications.LocationBarLeftChip.AcceptedOnce." + "TimeToAction", + duration, 1); + } else { + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.AnchoredBubble.Action", + static_cast<int>(permissions::PermissionAction::GRANTED_ONCE), 1); + histograms.ExpectTimeBucketCount( + "Permissions.Prompt.Notifications.AnchoredBubble.AcceptedOnce." + "TimeToAction", + duration, 1); + } } class PermissionPromptBubbleViewQuietUiBrowserTest @@ -574,6 +688,8 @@ SetCannedUiDecision(QuietUiReason::kTriggeredDueToAbusiveContent, WarningReason::kAbusiveContent); + base::HistogramTester histograms; + ShowUi("geolocation"); EXPECT_EQ( @@ -585,11 +701,23 @@ test_api_->manager()->Accept(); base::RunLoop().RunUntilIdle(); + histograms.ExpectBucketCount( + GetParam() ? "Permissions.Prompt.Geolocation.LocationBarLeftChip.Action" + : "Permissions.Prompt.Geolocation.AnchoredBubble.Action", + static_cast<int>(permissions::PermissionAction::GRANTED), 1); + ShowUi("notifications"); EXPECT_EQ( test_api_->manager()->current_request_prompt_disposition_for_testing(), permissions::PermissionPromptDisposition::LOCATION_BAR_RIGHT_STATIC_ICON); + + test_api_->manager()->Accept(); + base::RunLoop().RunUntilIdle(); + + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.LocationBarRightStaticIcon.Action", + static_cast<int>(permissions::PermissionAction::GRANTED), 1); } IN_PROC_BROWSER_TEST_P(PermissionPromptBubbleViewQuietUiBrowserTest, @@ -620,6 +748,8 @@ DispositionEnabledInPrefsTest) { SetCannedUiDecision(QuietUiReason::kEnabledInPrefs, absl::nullopt); + base::HistogramTester histograms; + ShowUi("geolocation"); EXPECT_EQ( @@ -631,12 +761,24 @@ test_api_->manager()->Accept(); base::RunLoop().RunUntilIdle(); + histograms.ExpectBucketCount( + GetParam() ? "Permissions.Prompt.Geolocation.LocationBarLeftChip.Action" + : "Permissions.Prompt.Geolocation.AnchoredBubble.Action", + static_cast<int>(permissions::PermissionAction::GRANTED), 1); + ShowUi("notifications"); EXPECT_EQ( test_api_->manager()->current_request_prompt_disposition_for_testing(), permissions::PermissionPromptDisposition:: LOCATION_BAR_RIGHT_ANIMATED_ICON); + + test_api_->manager()->Accept(); + base::RunLoop().RunUntilIdle(); + + histograms.ExpectBucketCount( + "Permissions.Prompt.Notifications.LocationBarRightAnimatedIcon.Action", + static_cast<int>(permissions::PermissionAction::GRANTED), 1); } // For `QuietUiReason::kPredictedVeryUnlikelyGrant` reputation we show an
diff --git a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc index 53d8f8142..9007228c 100644 --- a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc +++ b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc
@@ -5,7 +5,7 @@ #include "chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h" #include "base/bind.h" -#include "base/callback.h" +#include "base/memory/weak_ptr.h" #include "build/build_config.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_avatar_icon_util.h" @@ -18,10 +18,12 @@ #include "chrome/browser/ui/signin_view_controller.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" #include "chrome/browser/ui/views/frame/browser_view.h" +#include "chrome/browser/ui/webui/signin/profile_customization_ui.h" #include "chrome/browser/ui/webui/signin/sync_confirmation_ui.h" #include "chrome/common/url_constants.h" #include "chrome/common/webui_url_constants.h" #include "components/constrained_window/constrained_window_views.h" +#include "components/signin/public/base/signin_buildflags.h" #include "components/signin/public/base/signin_metrics.h" #include "components/web_modal/web_contents_modal_dialog_host.h" #include "content/public/browser/render_widget_host_view.h" @@ -41,8 +43,11 @@ const int kSyncConfirmationDialogWidth = 512; const int kSyncConfirmationDialogHeight = 487; const int kSigninErrorDialogHeight = 164; + +#if BUILDFLAG(ENABLE_DICE_SUPPORT) const int kReauthDialogWidth = 540; const int kReauthDialogHeight = 520; +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) int GetSyncConfirmationDialogPreferredHeight(Profile* profile) { // If sync is disabled, then the sync confirmation dialog looks like an error @@ -52,6 +57,13 @@ : kSigninErrorDialogHeight; } +#if BUILDFLAG(ENABLE_DICE_SUPPORT) +void CloseModalSigninInBrowser(base::WeakPtr<Browser> browser) { + if (browser) + browser->signin_view_controller()->CloseModalSignin(); +} +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) + } // namespace // static @@ -72,6 +84,7 @@ InitializeSigninWebDialogUI(true)); } +#if BUILDFLAG(ENABLE_DICE_SUPPORT) // static std::unique_ptr<views::WebView> SigninViewControllerDelegateViews::CreateReauthConfirmationWebView( @@ -83,6 +96,26 @@ InitializeSigninWebDialogUI(false)); } +// static +std::unique_ptr<views::WebView> +SigninViewControllerDelegateViews::CreateProfileCustomizationWebView( + Browser* browser) { + std::unique_ptr<views::WebView> web_view = CreateDialogWebView( + browser, GURL(chrome::kChromeUIProfileCustomizationURL), + kSyncConfirmationDialogHeight, kSyncConfirmationDialogWidth, + InitializeSigninWebDialogUI(false)); + + ProfileCustomizationUI* web_ui = web_view->GetWebContents() + ->GetWebUI() + ->GetController() + ->GetAs<ProfileCustomizationUI>(); + DCHECK(web_ui); + web_ui->Initialize( + base::BindOnce(&CloseModalSigninInBrowser, browser->AsWeakPtr())); + return web_view; +} +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_CHROMEOS_LACROS) // static @@ -334,6 +367,7 @@ browser, ui::MODAL_TYPE_WINDOW, true, false); } +#if BUILDFLAG(ENABLE_DICE_SUPPORT) // static SigninViewControllerDelegate* SigninViewControllerDelegate::CreateReauthConfirmationDelegate( @@ -346,6 +380,17 @@ browser, ui::MODAL_TYPE_CHILD, false, true); } +// static +SigninViewControllerDelegate* +SigninViewControllerDelegate::CreateProfileCustomizationDelegate( + Browser* browser) { + return new SigninViewControllerDelegateViews( + SigninViewControllerDelegateViews::CreateProfileCustomizationWebView( + browser), + browser, ui::MODAL_TYPE_WINDOW, false, false); +} +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_CHROMEOS_LACROS) // static
diff --git a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h index 13466c1..8413b06 100644 --- a/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h +++ b/chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h
@@ -14,6 +14,7 @@ #include "chrome/browser/ui/profile_chooser_constants.h" #include "chrome/browser/ui/signin_view_controller_delegate.h" #include "chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.h" +#include "components/signin/public/base/signin_buildflags.h" #include "content/public/browser/web_contents_delegate.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/base/metadata/metadata_header_macros.h" @@ -60,10 +61,15 @@ static std::unique_ptr<views::WebView> CreateSigninErrorWebView( Browser* browser); +#if BUILDFLAG(ENABLE_DICE_SUPPORT) static std::unique_ptr<views::WebView> CreateReauthConfirmationWebView( Browser* browser, signin_metrics::ReauthAccessPoint); + static std::unique_ptr<views::WebView> CreateProfileCustomizationWebView( + Browser* browser); +#endif // BUILDFLAG(ENABLE_DICE_SUPPORT) + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_CHROMEOS_LACROS) static std::unique_ptr<views::WebView> CreateEnterpriseConfirmationWebView(
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc index 5d1013e..7f6af90f 100644 --- a/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc +++ b/chrome/browser/ui/views/ssl_client_certificate_selector_browsertest.cc
@@ -277,7 +277,14 @@ Mock::VerifyAndClear(auth_requestor_.get()); } -IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorMultiTabTest, Escape) { +// TODO(https://crbug.com/1287764): Fails on the linux-wayland-rel bot. +#if defined(OZONE_PLATFORM_WAYLAND) +#define MAYBE_EscapeTest DISABLED_Escape +#else +#define MAYBE_EscapeTest Escape +#endif +IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorMultiTabTest, + MAYBE_EscapeTest) { // auth_requestor_1_ should get selected automatically by the // SSLClientAuthObserver when selector_2_ is accepted, since both 1 & 2 have // the same host:port. @@ -298,7 +305,14 @@ EXPECT_CALL(*auth_requestor_, CancelCertificateSelection()); } -IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorMultiTabTest, SelectSecond) { +// TODO(https://crbug.com/1287784): Fails on the linux-wayland-rel bot. +#if defined(OZONE_PLATFORM_WAYLAND) +#define MAYBE_SelectSecond DISABLED_SelectSecond +#else +#define MAYBE_SelectSecond SelectSecond +#endif +IN_PROC_BROWSER_TEST_F(SSLClientCertificateSelectorMultiTabTest, + MAYBE_SelectSecond) { // auth_requestor_1_ should get selected automatically by the // SSLClientAuthObserver when selector_2_ is accepted, since both 1 & 2 have // the same host:port.
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc index 02236592..8015c4f 100644 --- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc +++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.cc
@@ -584,6 +584,12 @@ g_show_sync_enabled_ui_for_testing_ = show_sync_enabled_ui_for_testing; } +// static +bool DiceTurnSyncOnHelper::HasCurrentDiceTurnSyncOnHelperForTesting( + Profile* profile) { + return !!GetCurrentDiceTurnSyncOnHelper(profile); +} + void DiceTurnSyncOnHelper::ShowSyncConfirmationUI() { if (g_show_sync_enabled_ui_for_testing_ || GetSyncService()) { delegate_->ShowSyncConfirmation(
diff --git a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h index af1aaf2..966b976 100644 --- a/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h +++ b/chrome/browser/ui/webui/signin/dice_turn_sync_on_helper.h
@@ -180,6 +180,9 @@ static void SetShowSyncEnabledUiForTesting( bool show_sync_enabled_ui_for_testing); + // Returns true if a `DiceTurnSyncOnHelper` is currently active for `profile`. + static bool HasCurrentDiceTurnSyncOnHelperForTesting(Profile* profile); + private: friend class base::DeleteHelper<DiceTurnSyncOnHelper>;
diff --git a/chrome/build/linux.pgo.txt b/chrome/build/linux.pgo.txt index eb82b22..e1840ce 100644 --- a/chrome/build/linux.pgo.txt +++ b/chrome/build/linux.pgo.txt
@@ -1 +1 @@ -chrome-linux-main-1642419484-a8698b4b814eaf5a78e3d10ef061a5d9f3796c17.profdata +chrome-linux-main-1642442175-429df754df9ff036ce2311fcb3eb226c528d7931.profdata
diff --git a/chrome/build/mac.pgo.txt b/chrome/build/mac.pgo.txt index 5e1e748c..5b9a48f 100644 --- a/chrome/build/mac.pgo.txt +++ b/chrome/build/mac.pgo.txt
@@ -1 +1 @@ -chrome-mac-main-1642398910-e0a97b07ae42942f82233086184439cc651801d8.profdata +chrome-mac-main-1642419484-a3e64505e37a14fef484677ee6981a4ddccb3bbf.profdata
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index c990f576..d994afef 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-main-1642409701-22a7bc66d567e666fab61811ca7142493e15c24e.profdata +chrome-win32-main-1642419484-3d71e6ef1f4645f6d884b035fe3474158a3bef42.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index 4a2daaf2..9e557016 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-main-1642409701-ae9a232f765cefa610e56c69b2bebbe2df3ea4e5.profdata +chrome-win64-main-1642431535-96dbb7a3150a58be3d84645c102e90a0ebe74500.profdata
diff --git a/chrome/common/chromeos/extensions/api/telemetry.idl b/chrome/common/chromeos/extensions/api/telemetry.idl index 5604c1a..77e30fe 100644 --- a/chrome/common/chromeos/extensions/api/telemetry.idl +++ b/chrome/common/chromeos/extensions/api/telemetry.idl
@@ -37,6 +37,46 @@ callback MemoryInfoCallback = void (MemoryInfo cpuInfo); + enum CpuArchitectureEnum { + unknown, + x86_64, + aarch64, + armv7l + }; + + dictionary CpuCStateInfo { + // Name of the state. + DOMString? name; + // Time spent in the state since the last reboot, in microseconds. + double? timeInStateSinceLastBootUs; + }; + + dictionary LogicalCpuInfo { + // The max CPU clock speed in kHz. + long? maxClockSpeedKhz; + // Maximum frequency the CPU is allowed to run at, by policy. + long? scalingMaxFrequencyKhz; + // Current frequency the CPU is running at. + long? scalingCurrentFrequencyKhz; + // Idle time since last boot, in milliseconds. + double? idleTimeMs; + // Information about the logical CPU's time in various C-states. + CpuCStateInfo[] cStates; + }; + + dictionary PhysicalCpuInfo { + DOMString? modelName; + LogicalCpuInfo[] logicalCpus; + }; + + dictionary CpuInfo { + long? numTotalThreads; + CpuArchitectureEnum architecture; + PhysicalCpuInfo[] physicalCpus; + }; + + callback CpuInfoCallback = void (CpuInfo cpuInfo); + interface Functions { // Retrieves VPD info. [supportsPromises] static void getVpdInfo(VpdInfoCallback callback); @@ -45,5 +85,7 @@ [supportsPromises] static void getOemData(OemDataCallback callback); [supportsPromises] static void getMemoryInfo(MemoryInfoCallback callback); + + [supportsPromises] static void getCpuInfo(CpuInfoCallback callback); }; };
diff --git a/chrome/common/extensions/api/web_navigation.json b/chrome/common/extensions/api/web_navigation.json index 2df5fc32..77b4792 100644 --- a/chrome/common/extensions/api/web_navigation.json +++ b/chrome/common/extensions/api/web_navigation.json
@@ -175,7 +175,8 @@ "parentFrameId": {"type": "integer", "description": "The ID of the parent frame, or <code>-1</code> if this is the main frame."}, "transitionType": {"$ref": "TransitionType", "description": "Cause of the navigation."}, "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"$ref": "TransitionQualifier"}}, - "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."} + "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."}, + "documentId": {"type": "string", "description": "A UUID of the document loaded.", "nodoc": true} } } ] @@ -202,7 +203,8 @@ "processId": {"type": "integer", "description": "The ID of the process that runs the renderer for this frame."}, "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "The ID of the parent frame, or <code>-1</code> if this is the main frame."}, - "timeStamp": {"type": "number", "description": "The time when the page's DOM was fully constructed, in milliseconds since the epoch."} + "timeStamp": {"type": "number", "description": "The time when the page's DOM was fully constructed, in milliseconds since the epoch."}, + "documentId": {"type": "string", "description": "A UUID of the document loaded.", "nodoc": true} } } ] @@ -229,7 +231,8 @@ "processId": {"type": "integer", "description": "The ID of the process that runs the renderer for this frame."}, "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "The ID of the parent frame, or <code>-1</code> if this is the main frame."}, - "timeStamp": {"type": "number", "description": "The time when the document finished loading, in milliseconds since the epoch."} + "timeStamp": {"type": "number", "description": "The time when the document finished loading, in milliseconds since the epoch."}, + "documentId": {"type": "string", "description": "A UUID of the document loaded.", "nodoc": true} } } ] @@ -261,7 +264,8 @@ "frameId": {"type": "integer", "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab."}, "parentFrameId": {"type": "integer", "description": "The ID of the parent frame, or <code>-1</code> if this is the main frame."}, "error": {"type": "string", "description": "The error description."}, - "timeStamp": {"type": "number", "description": "The time when the error occurred, in milliseconds since the epoch."} + "timeStamp": {"type": "number", "description": "The time when the error occurred, in milliseconds since the epoch."}, + "documentId": {"type": "string", "description": "A UUID of the document loaded.", "nodoc": true} } } ] @@ -317,7 +321,8 @@ "parentFrameId": {"type": "integer", "description": "The ID of the parent frame, or <code>-1</code> if this is the main frame."}, "transitionType": {"$ref": "TransitionType", "description": "Cause of the navigation."}, "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"$ref": "TransitionQualifier"}}, - "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."} + "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."}, + "documentId": {"type": "string", "description": "A UUID of the document loaded.", "nodoc": true} } } ] @@ -362,7 +367,8 @@ "parentFrameId": {"type": "integer", "description": "The ID of the parent frame, or <code>-1</code> if this is the main frame."}, "transitionType": {"$ref": "TransitionType", "description": "Cause of the navigation."}, "transitionQualifiers": {"type": "array", "description": "A list of transition qualifiers.", "items": {"$ref": "TransitionQualifier"}}, - "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."} + "timeStamp": {"type": "number", "description": "The time when the navigation was committed, in milliseconds since the epoch."}, + "documentId": {"type": "string", "description": "A UUID of the document loaded.", "nodoc": true} } } ]
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 3fccbf8..3143e94 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc
@@ -1096,13 +1096,11 @@ const char kLoginExtensionApiDataForNextLoginAttempt[] = "extensions_api.login.data_for_next_login_attempt"; -// A string user profile pref containing the ID of the extension which launched -// the current Managed Guest Session using the chrome.login extension API. A -// non-empty ID indicates that the current Managed Guest Session is lockable, -// and can only be unlocked by the specified extension using the chrome.login -// extension API. -const char kLoginExtensionApiLaunchExtensionId[] = - "extensions_api.login.launch_extension_id"; +// A boolean user profile pref which indicates that the current Managed Guest +// Session is lockable. Set by the chrome.login extension API and read by +// `UserManager`. +const char kLoginExtensionApiCanLockManagedGuestSession[] = + "extensions_api.login.can_lock_managed_guest_session"; // String containing last RSU lookup key uploaded. Empty until first upload. const char kLastRsuDeviceIdUploaded[] = "rsu.last_rsu_device_id_uploaded"; @@ -1149,6 +1147,18 @@ // Boolean user profile pref that determines whether to show a banner in browser // settings that links to OS settings. const char kSettingsShowOSBanner[] = "settings.cros.show_os_banner"; + +// This pref is used in two contexts: +// In Profile prefs, it is a bool pref which encodes whether the Profile has +// used a policy-provided trusted CA certificate. This is used to display the +// "enterprise icon" security indicator in the URL bar. +// +// Legacy usage: In Local State prefs, it is a list of usernames encoding the +// same thing for the Profile associated with the user name. +// +// There is code migrating from the legacy Local State pref to the Profile pref +// in policy_cert_service_factory_ash.cc::MigrateLocalPrefIntoProfilePref . +const char kUsedPolicyCertificates[] = "policy.used_policy_certificates"; #endif // defined(OS_CHROMEOS) // A boolean pref set to true if a Home button to open the Home pages should be @@ -2434,18 +2444,6 @@ // the OOBE. const char kHelpAppTabletModeDuringOobe[] = "help_app.tablet_mode_during_oobe"; -// This pref is used in two contexts: -// In Profile prefs, it is a bool pref which encodes whether the Profile has -// used a policy-provided trusted CA certificate. This is used to display the -// "enterprise icon" security indicator in the URL bar. -// -// Legacy usage: In Local State prefs, it is a list of usernames encoding the -// same thing for the Profile associated with the user name. -// -// There is code migrating from the legacy Local State pref to the Profile pref -// in policy_cert_service_factory.cc::MigrateLocalPrefIntoProfilePref . -const char kUsedPolicyCertificates[] = "policy.used_policy_certificates"; - // A dictionary containing server-provided device state pulled form the cloud // after recovery. const char kServerBackedDeviceState[] = "server_backed_device_state";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 17b732a3..25334eb 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h
@@ -351,7 +351,7 @@ extern const char kAppReinstallRecommendationEnabled[]; extern const char kStartupBrowserWindowLaunchSuppressed[]; extern const char kLoginExtensionApiDataForNextLoginAttempt[]; -extern const char kLoginExtensionApiLaunchExtensionId[]; +extern const char kLoginExtensionApiCanLockManagedGuestSession[]; extern const char kUpdateRequiredTimerStartTime[]; extern const char kUpdateRequiredWarningPeriod[]; extern const char kSystemProxyUserTrafficHostAndPort[]; @@ -362,6 +362,7 @@ extern const char kExternalStorageDisabled[]; extern const char kExternalStorageReadOnly[]; extern const char kSettingsShowOSBanner[]; +extern const char kUsedPolicyCertificates[]; #endif // defined(OS_CHROMEOS) extern const char kShowHomeButton[]; extern const char kSpeechRecognitionFilterProfanities[]; @@ -776,7 +777,6 @@ extern const char kHelpAppShouldShowGetStarted[]; extern const char kHelpAppShouldShowParentalControl[]; extern const char kHelpAppTabletModeDuringOobe[]; -extern const char kUsedPolicyCertificates[]; extern const char kServerBackedDeviceState[]; extern const char kCustomizationDefaultWallpaperURL[]; extern const char kLogoutStartedLast[];
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index d558855..e60d81fe 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -2469,6 +2469,7 @@ "../browser/signin/dice_browsertest.cc", "../browser/signin/dice_web_signin_interceptor_browsertest.cc", "../browser/signin/signin_ui_util_browsertest.cc", + "../browser/ui/signin_intercept_first_run_experience_dialog_browsertest.cc", "../browser/ui/signin_reauth_view_controller_browsertest.cc", "../browser/ui/views/sync/inline_login_ui_browsertest.cc", "../browser/unified_consent/unified_consent_browsertest.cc", @@ -6512,6 +6513,9 @@ deps += [ "//chrome/browser:dlp_policy_event_proto", + "//chrome/browser/policy:onc", + "//chrome/browser/policy:unit_tests", + "//chromeos/components/onc:onc", "//chromeos/crosapi/mojom", "//chromeos/dbus/dlp:dlp", "//chromeos/lacros:test_support",
diff --git a/chrome/test/data/extensions/api_test/webnavigation/backForwardCache/test_forwardBack.js b/chrome/test/data/extensions/api_test/webnavigation/backForwardCache/test_forwardBack.js index 86aeca0c..cc0c1731 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/backForwardCache/test_forwardBack.js +++ b/chrome/test/data/extensions/api_test/webnavigation/backForwardCache/test_forwardBack.js
@@ -34,7 +34,8 @@ url: URL_A }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -44,7 +45,8 @@ url: URL_A }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -52,7 +54,8 @@ url: URL_A }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -68,7 +71,8 @@ url: URL_B }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 1, tabId: 0, @@ -78,7 +82,8 @@ url: URL_B }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 1, tabId: 0, @@ -86,7 +91,8 @@ url: URL_B }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 1, tabId: 0, @@ -102,7 +108,10 @@ url: URL_A }}, { label: "c-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { // documentId is the same as the first navigation + // because the document was restored from the cache. + documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -112,7 +121,8 @@ url: URL_A }}, { label: "c-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/test_clientRedirect.js b/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/test_clientRedirect.js index 16e1897..8d04bde1 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/test_clientRedirect.js +++ b/chrome/test/data/extensions/api_test/webnavigation/clientRedirect/test_clientRedirect.js
@@ -22,7 +22,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -32,7 +33,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -40,7 +42,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -56,7 +59,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -66,7 +70,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -74,7 +79,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/crash/test_crash.js b/chrome/test/data/extensions/api_test/webnavigation/crash/test_crash.js index faef79a3..ade9ecfb 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/crash/test_crash.js +++ b/chrome/test/data/extensions/api_test/webnavigation/crash/test_crash.js
@@ -30,7 +30,8 @@ url: URL_A }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -40,7 +41,8 @@ url: URL_A }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -48,7 +50,8 @@ url: URL_A }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -64,7 +67,8 @@ url: URL_B }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -74,7 +78,8 @@ url: URL_B }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -82,7 +87,8 @@ url: URL_B }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/crossProcess/test_crossProcess.js b/chrome/test/data/extensions/api_test/webnavigation/crossProcess/test_crossProcess.js index 5bf1c61..64392b9c 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/crossProcess/test_crossProcess.js +++ b/chrome/test/data/extensions/api_test/webnavigation/crossProcess/test_crossProcess.js
@@ -39,6 +39,7 @@ label: 'a-onCommitted', event: 'onCommitted', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -53,6 +54,7 @@ label: 'a-onDOMContentLoaded', event: 'onDOMContentLoaded', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -65,6 +67,7 @@ label: 'a-onCompleted', event: 'onCompleted', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -89,6 +92,7 @@ label: 'b-onCommitted', event: 'onCommitted', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -103,6 +107,7 @@ label: 'b-onDOMContentLoaded', event: 'onDOMContentLoaded', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -115,6 +120,7 @@ label: 'b-onCompleted', event: 'onCompleted', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -149,6 +155,7 @@ label: 'a-onCommitted', event: 'onCommitted', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -163,6 +170,7 @@ label: 'a-onDOMContentLoaded', event: 'onDOMContentLoaded', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -175,6 +183,7 @@ label: 'a-onCompleted', event: 'onCompleted', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -199,6 +208,7 @@ label: 'c-onCommitted', event: 'onCommitted', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -213,6 +223,7 @@ label: 'c-onDOMContentLoaded', event: 'onDOMContentLoaded', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -225,6 +236,7 @@ label: 'c-onCompleted', event: 'onCompleted', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -384,7 +396,8 @@ url: getURL('d.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -394,7 +407,8 @@ url: getURL('d.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -402,7 +416,8 @@ url: getURL('d.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -419,6 +434,7 @@ { label: "b-onErrorOccurred", event: "onErrorOccurred", details: { error: "net::ERR_ABORTED", + documentId: 2, frameId: 0, parentFrameId: -1, processId: -1, @@ -435,7 +451,8 @@ url: getURL('empty.html') }}, { label: "c-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -445,7 +462,8 @@ url: getURL('empty.html') }}, { label: "c-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -453,7 +471,8 @@ url: getURL('empty.html') }}, { label: "c-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/crossProcessHistory/test_crossProcessHistory.js b/chrome/test/data/extensions/api_test/webnavigation/crossProcessHistory/test_crossProcessHistory.js index 00e3b54..27fc48e 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/crossProcessHistory/test_crossProcessHistory.js +++ b/chrome/test/data/extensions/api_test/webnavigation/crossProcessHistory/test_crossProcessHistory.js
@@ -33,6 +33,7 @@ label: 'a-onCommitted', event: 'onCommitted', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -47,6 +48,7 @@ label: 'a-onDOMContentLoaded', event: 'onDOMContentLoaded', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -59,6 +61,7 @@ label: 'a-onCompleted', event: 'onCompleted', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -71,6 +74,7 @@ label: 'a-onHistoryStateUpdated', event: 'onHistoryStateUpdated', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -97,6 +101,7 @@ label: 'b-onCommitted', event: 'onCommitted', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -111,6 +116,7 @@ label: 'b-onDOMContentLoaded', event: 'onDOMContentLoaded', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -123,6 +129,7 @@ label: 'b-onCompleted', event: 'onCompleted', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -157,7 +164,8 @@ url: getURL('h.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -167,7 +175,8 @@ url: getURL('h.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -175,7 +184,8 @@ url: getURL('h.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -183,7 +193,8 @@ url: getURL('empty.html') }}, { label: "a-onHistoryStateUpdated", event: "onHistoryStateUpdated", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -201,7 +212,8 @@ url: URL_TEST + "5" }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 1, tabId: 0, @@ -211,7 +223,8 @@ url: URL_TEST + "5" }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 1, tabId: 0, @@ -219,7 +232,8 @@ url: URL_TEST + "5" }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 1, tabId: 0, @@ -253,6 +267,7 @@ label: 'a-onCommitted', event: 'onCommitted', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -267,6 +282,7 @@ label: 'a-onDOMContentLoaded', event: 'onDOMContentLoaded', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -279,6 +295,7 @@ label: 'a-onCompleted', event: 'onCompleted', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -291,6 +308,7 @@ label: 'a-onHistoryStateUpdated', event: 'onHistoryStateUpdated', details: { + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -317,6 +335,7 @@ label: 'b-onCommitted', event: 'onCommitted', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -331,6 +350,7 @@ label: 'b-onDOMContentLoaded', event: 'onDOMContentLoaded', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1, @@ -343,6 +363,7 @@ label: 'b-onCompleted', event: 'onCompleted', details: { + documentId: 2, frameId: 0, parentFrameId: -1, processId: 1,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/crossProcessIframe/test_crossProcessIframe.js b/chrome/test/data/extensions/api_test/webnavigation/crossProcessIframe/test_crossProcessIframe.js index 1dcf530..679974d 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/crossProcessIframe/test_crossProcessIframe.js +++ b/chrome/test/data/extensions/api_test/webnavigation/crossProcessIframe/test_crossProcessIframe.js
@@ -37,7 +37,8 @@ url: URL_MAIN }}, { label: 'main-onCommitted', event: 'onCommitted', - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -47,7 +48,8 @@ url: URL_MAIN }}, { label: 'main-onDOMContentLoaded', event: 'onDOMContentLoaded', - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -55,7 +57,8 @@ url: URL_MAIN }}, { label: 'main-onCompleted', event: 'onCompleted', - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -71,7 +74,8 @@ url: URL_FRAME1 }}, { label: 'a.com-onCommitted', event: 'onCommitted', - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 1, tabId: 0, @@ -81,7 +85,8 @@ url: URL_FRAME1 }}, { label: 'a.com-onDOMContentLoaded', event: 'onDOMContentLoaded', - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 1, tabId: 0, @@ -89,7 +94,8 @@ url: URL_FRAME1 }}, { label: 'a.com-onCompleted', event: 'onCompleted', - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 1, tabId: 0, @@ -105,7 +111,8 @@ url: URL_FRAME2 }}, { label: 'b.com-onCommitted', event: 'onCommitted', - details: { frameId: 1, + details: { documentId: 3, + frameId: 1, parentFrameId: 0, processId: 2, tabId: 0, @@ -115,7 +122,8 @@ url: URL_FRAME2 }}, { label: 'b.com-onDOMContentLoaded', event: 'onDOMContentLoaded', - details: { frameId: 1, + details: { documentId: 3, + frameId: 1, parentFrameId: 0, processId: 2, tabId: 0, @@ -123,7 +131,8 @@ url: URL_FRAME2 }}, { label: 'b.com-onCompleted', event: 'onCompleted', - details: { frameId: 1, + details: { documentId: 3, + frameId: 1, parentFrameId: 0, processId: 2, tabId: 0, @@ -139,7 +148,8 @@ url: URL_FRAME3 }}, { label: 'c.com-onCommitted', event: 'onCommitted', - details: { frameId: 1, + details: { documentId: 4, + frameId: 1, parentFrameId: 0, processId: 3, tabId: 0, @@ -149,7 +159,8 @@ url: URL_FRAME3 }}, { label: 'c.com-onDOMContentLoaded', event: 'onDOMContentLoaded', - details: { frameId: 1, + details: { documentId: 4, + frameId: 1, parentFrameId: 0, processId: 3, tabId: 0, @@ -157,7 +168,8 @@ url: URL_FRAME3 }}, { label: 'c.com-onCompleted', event: 'onCompleted', - details: { frameId: 1, + details: { documentId: 4, + frameId: 1, parentFrameId: 0, processId: 3, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/download/test_download.js b/chrome/test/data/extensions/api_test/webnavigation/download/test_download.js index 950b3681..85f4851 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/download/test_download.js +++ b/chrome/test/data/extensions/api_test/webnavigation/download/test_download.js
@@ -30,7 +30,8 @@ url: URL_START }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -40,7 +41,8 @@ url: URL_START }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -48,7 +50,8 @@ url: URL_START }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/failures/test_failures.js b/chrome/test/data/extensions/api_test/webnavigation/failures/test_failures.js index dad2ff4..66ee306 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/failures/test_failures.js +++ b/chrome/test/data/extensions/api_test/webnavigation/failures/test_failures.js
@@ -23,7 +23,8 @@ url: getURL('d.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -33,7 +34,8 @@ url: getURL('d.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -41,7 +43,8 @@ url: getURL('d.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -58,6 +61,7 @@ { label: "b-onErrorOccurred", event: "onErrorOccurred", details: { error: "net::ERR_FILE_NOT_FOUND", + documentId: 2, frameId: 1, parentFrameId: 0, processId: -1, @@ -83,7 +87,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -93,7 +98,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -101,7 +107,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -117,7 +124,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -127,7 +135,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -135,7 +144,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -152,6 +162,7 @@ { label: "c-onErrorOccurred", event: "onErrorOccurred", details: { error: "net::ERR_FILE_NOT_FOUND", + documentId: 3, parentFrameId: 0, frameId: 1, processId: -1, @@ -179,7 +190,8 @@ url: getURL('e.html') }}, { label: "onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -190,6 +202,7 @@ { label: "onErrorOccurred", event: "onErrorOccurred", details: { error: "net::ERR_ABORTED", + documentId: 1, frameId: 0, parentFrameId: -1, processId: 0, @@ -219,6 +232,7 @@ { label: "onErrorOccurred", event: "onErrorOccurred", details: { error: "net::ERR_FILE_NOT_FOUND", + documentId: 1, frameId: 0, parentFrameId: -1, processId: -1,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/fencedFrames/test_fencedFrame.js b/chrome/test/data/extensions/api_test/webnavigation/fencedFrames/test_fencedFrame.js index b2316f3..78a58475 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/fencedFrames/test_fencedFrame.js +++ b/chrome/test/data/extensions/api_test/webnavigation/fencedFrames/test_fencedFrame.js
@@ -32,7 +32,8 @@ url: URL_MAIN }}, { label: 'main-onCommitted', event: 'onCommitted', - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -42,7 +43,8 @@ url: URL_MAIN }}, { label: 'main-onDOMContentLoaded', event: 'onDOMContentLoaded', - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -50,7 +52,8 @@ url: URL_MAIN }}, { label: 'main-onCompleted', event: 'onCompleted', - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -66,7 +69,8 @@ url: URL_INTERMEDIATE_IFRAME }}, { label: 'intermediate-onCommitted', event: 'onCommitted', - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -76,7 +80,8 @@ url: URL_INTERMEDIATE_IFRAME }}, { label: 'intermediate-onDOMContentLoaded', event: 'onDOMContentLoaded', - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -84,7 +89,8 @@ url: URL_INTERMEDIATE_IFRAME }}, { label: 'intermediate-onCompleted', event: 'onCompleted', - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -100,7 +106,8 @@ url: URL_FENCED_FRAME }}, { label: 'a.com-onCommitted', event: 'onCommitted', - details: { frameId: 2, + details: { documentId: 3, + frameId: 2, parentFrameId: 1, processId: 1, tabId: 0, @@ -110,7 +117,8 @@ url: URL_FENCED_FRAME }}, { label: 'a.com-onDOMContentLoaded', event: 'onDOMContentLoaded', - details: { frameId: 2, + details: { documentId: 3, + frameId: 2, parentFrameId: 1, processId: 1, tabId: 0, @@ -118,7 +126,8 @@ url: URL_FENCED_FRAME }}, { label: 'a.com-onCompleted', event: 'onCompleted', - details: { frameId: 2, + details: { documentId: 3, + frameId: 2, parentFrameId: 1, processId: 1, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/formSubmission/test_formSubmission.js b/chrome/test/data/extensions/api_test/webnavigation/formSubmission/test_formSubmission.js index ef5bdc8..95cd9d2 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/formSubmission/test_formSubmission.js +++ b/chrome/test/data/extensions/api_test/webnavigation/formSubmission/test_formSubmission.js
@@ -22,7 +22,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -32,7 +33,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -40,7 +42,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -56,7 +59,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -66,7 +70,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -74,7 +79,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/test_forwardBack.js b/chrome/test/data/extensions/api_test/webnavigation/forwardBack/test_forwardBack.js index 8e3e27b..1ac5d49 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/forwardBack/test_forwardBack.js +++ b/chrome/test/data/extensions/api_test/webnavigation/forwardBack/test_forwardBack.js
@@ -24,7 +24,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -34,7 +35,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -42,7 +44,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -58,7 +61,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -68,7 +72,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -76,7 +81,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -92,7 +98,8 @@ url: getURL('a.html') }}, { label: "c-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -102,7 +109,8 @@ url: getURL('a.html') }}, { label: "c-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -110,7 +118,8 @@ url: getURL('a.html') }}, { label: "c-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/framework.js b/chrome/test/data/extensions/api_test/webnavigation/framework.js index c40b064..44885de 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/framework.js +++ b/chrome/test/data/extensions/api_test/webnavigation/framework.js
@@ -8,7 +8,9 @@ var capturedEventData; var nextFrameId; var frameIds; +var documentIds; var nextTabId; +var nextDocumentId; var tabIds; var nextProcessId; var processIds; @@ -59,6 +61,8 @@ capturedEventData = []; expectedEventOrder = order; nextFrameId = 1; + nextDocumentId = 1; + documentIds = {}; frameIds = {}; nextTabId = 0; tabIds = {}; @@ -116,6 +120,15 @@ if ('timeStamp' in details) { details.timeStamp = 0; } + // Since the documentId is a unique random identifier it is + // not useful to tests. Normalize it so that test cases can assert + // against a fixed number. + if ('documentId' in details) { + if (documentIds[details.documentId] === undefined) { + documentIds[details.documentId] = nextDocumentId++; + } + details.documentId = documentIds[details.documentId]; + } if (('frameId' in details) && (details.frameId != 0)) { if (frameIds[details.frameId] === undefined) { frameIds[details.frameId] = nextFrameId++;
diff --git a/chrome/test/data/extensions/api_test/webnavigation/history/test_history.js b/chrome/test/data/extensions/api_test/webnavigation/history/test_history.js index 73cedf8..e8c0e8d 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/history/test_history.js +++ b/chrome/test/data/extensions/api_test/webnavigation/history/test_history.js
@@ -23,7 +23,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -33,7 +34,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -41,7 +43,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -49,7 +52,8 @@ url: getURL('b.html') }}, { label: "a-onHistoryStateUpdated", event: "onHistoryStateUpdated", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -74,7 +78,8 @@ url: getURL('c.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -84,7 +89,8 @@ url: getURL('c.html') }}, { label: "a-onHistoryStateUpdated", event: "onHistoryStateUpdated", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -94,7 +100,8 @@ url: getURL('d.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -102,7 +109,8 @@ url: getURL('d.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/iframe/test_iframe.js b/chrome/test/data/extensions/api_test/webnavigation/iframe/test_iframe.js index 360eea86..0e8e9764 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/iframe/test_iframe.js +++ b/chrome/test/data/extensions/api_test/webnavigation/iframe/test_iframe.js
@@ -24,7 +24,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -34,7 +35,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -42,7 +44,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -58,7 +61,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -68,7 +72,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -76,7 +81,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -92,7 +98,8 @@ url: getURL('c.html') }}, { label: "c-onCommitted", event: "onCommitted", - details: { frameId: 1, + details: { documentId: 3, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -102,7 +109,8 @@ url: getURL('c.html') }}, { label: "c-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 1, + details: { documentId: 3, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -110,7 +118,8 @@ url: getURL('c.html') }}, { label: "c-onCompleted", event: "onCompleted", - details: { frameId: 1, + details: { documentId: 3, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -139,7 +148,8 @@ url: getURL('d.html') }}, { label: "d-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -149,7 +159,8 @@ url: getURL('d.html') }}, { label: "d-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -157,7 +168,8 @@ url: getURL('d.html') }}, { label: "d-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -173,7 +185,8 @@ url: getURL('e.html') }}, { label: "e-onCommitted", event: "onCommitted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -183,7 +196,8 @@ url: getURL('e.html') }}, { label: "e-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -191,7 +205,8 @@ url: getURL('e.html') }}, { label: "e-onCompleted", event: "onCompleted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -207,7 +222,8 @@ url: getURL('f.html') }}, { label: "f-onCommitted", event: "onCommitted", - details: { frameId: 2, + details: { documentId: 3, + frameId: 2, parentFrameId: 0, processId: 0, tabId: 0, @@ -217,7 +233,8 @@ url: getURL('f.html') }}, { label: "f-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 2, + details: { documentId: 3, + frameId: 2, parentFrameId: 0, processId: 0, tabId: 0, @@ -225,7 +242,8 @@ url: getURL('f.html') }}, { label: "f-onCompleted", event: "onCompleted", - details: { frameId: 2, + details: { documentId: 3, + frameId: 2, parentFrameId: 0, processId: 0, tabId: 0, @@ -241,7 +259,8 @@ url: getURL('g.html') }}, { label: "g-onCommitted", event: "onCommitted", - details: { frameId: 2, + details: { documentId: 4, + frameId: 2, parentFrameId: 0, processId: 0, tabId: 0, @@ -251,7 +270,8 @@ url: getURL('g.html') }}, { label: "g-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 2, + details: { documentId: 4, + frameId: 2, parentFrameId: 0, processId: 0, tabId: 0, @@ -259,7 +279,8 @@ url: getURL('g.html') }}, { label: "g-onCompleted", event: "onCompleted", - details: { frameId: 2, + details: { documentId: 4, + frameId: 2, parentFrameId: 0, processId: 0, tabId: 0, @@ -290,7 +311,8 @@ url: getURL('h.html') }}, { label: "h-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -300,7 +322,8 @@ url: getURL('h.html') }}, { label: "h-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -308,7 +331,8 @@ url: getURL('h.html') }}, { label: "h-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -324,7 +348,8 @@ url: getURL('i.html') }}, { label: "i-onCommitted", event: "onCommitted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -334,7 +359,8 @@ url: getURL('i.html') }}, { label: "i-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -342,7 +368,8 @@ url: getURL('i.html') }}, { label: "i-onCompleted", event: "onCompleted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -358,7 +385,8 @@ url: getURL('c.html') }}, { label: "c-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -368,7 +396,8 @@ url: getURL('c.html') }}, { label: "c-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -376,7 +405,8 @@ url: getURL('c.html') }}, { label: "c-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/openTab/test_openTab.js b/chrome/test/data/extensions/api_test/webnavigation/openTab/test_openTab.js index e994c93..1a38002 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/openTab/test_openTab.js +++ b/chrome/test/data/extensions/api_test/webnavigation/openTab/test_openTab.js
@@ -23,7 +23,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -33,7 +34,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -41,7 +43,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -65,7 +68,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -75,7 +79,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -83,7 +88,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -109,7 +115,8 @@ url: getURL('c.html') }}, { label: "c-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -119,7 +126,8 @@ url: getURL('c.html') }}, { label: "c-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -127,7 +135,8 @@ url: getURL('c.html') }}, { label: "c-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -143,7 +152,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -153,7 +163,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -161,7 +172,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -185,7 +197,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -195,7 +208,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -203,7 +217,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/test_referenceFragment.js b/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/test_referenceFragment.js index f909783..5f7e89d9 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/test_referenceFragment.js +++ b/chrome/test/data/extensions/api_test/webnavigation/referenceFragment/test_referenceFragment.js
@@ -23,7 +23,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -33,7 +34,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -41,7 +43,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -49,7 +52,8 @@ url: getURL('a.html#anchor') }}, { label: "a-onReferenceFragmentUpdated", event: "onReferenceFragmentUpdated", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -80,7 +84,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -90,7 +95,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -98,7 +104,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -106,7 +113,8 @@ url: getURL('b.html') }}, { label: "b-onReferenceFragmentUpdated", event: "onReferenceFragmentUpdated", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -124,7 +132,8 @@ url: getURL('b.html') }}, { label: "b1-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -134,7 +143,8 @@ url: getURL('b.html') }}, { label: "b1-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -142,7 +152,8 @@ url: getURL('b.html') }}, { label: "b1-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/requestOpenTab/test_requestOpenTab.js b/chrome/test/data/extensions/api_test/webnavigation/requestOpenTab/test_requestOpenTab.js index 3bc58d8..e1ac82a1 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/requestOpenTab/test_requestOpenTab.js +++ b/chrome/test/data/extensions/api_test/webnavigation/requestOpenTab/test_requestOpenTab.js
@@ -23,7 +23,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -33,7 +34,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -41,7 +43,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -65,7 +68,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -75,7 +79,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -83,7 +88,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/serverRedirect/test_serverRedirect.js b/chrome/test/data/extensions/api_test/webnavigation/serverRedirect/test_serverRedirect.js index 0b673d4a..9ff9f96 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/serverRedirect/test_serverRedirect.js +++ b/chrome/test/data/extensions/api_test/webnavigation/serverRedirect/test_serverRedirect.js
@@ -28,7 +28,8 @@ url: URL_LOAD_REDIRECT }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -38,7 +39,8 @@ url: URL_LOAD }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -46,7 +48,8 @@ url: URL_LOAD }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/serverRedirectSingleProcess/test_serverRedirectSingleProcess.js b/chrome/test/data/extensions/api_test/webnavigation/serverRedirectSingleProcess/test_serverRedirectSingleProcess.js index 541c97e..b768d94 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/serverRedirectSingleProcess/test_serverRedirectSingleProcess.js +++ b/chrome/test/data/extensions/api_test/webnavigation/serverRedirectSingleProcess/test_serverRedirectSingleProcess.js
@@ -32,7 +32,8 @@ url: URL_LOAD }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -42,7 +43,8 @@ url: URL_LOAD }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -50,7 +52,8 @@ url: URL_LOAD }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -66,7 +69,8 @@ url: URL_REDIRECT }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 1, tabId: 0, @@ -76,7 +80,8 @@ url: URL_TARGET }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 1, tabId: 0, @@ -84,7 +89,8 @@ url: URL_TARGET }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 1, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/test_simpleLoad.js b/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/test_simpleLoad.js index 89611e20..92eebc6 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/test_simpleLoad.js +++ b/chrome/test/data/extensions/api_test/webnavigation/simpleLoad/test_simpleLoad.js
@@ -23,7 +23,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -33,7 +34,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -41,7 +43,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/srcdoc/test_srcdoc.js b/chrome/test/data/extensions/api_test/webnavigation/srcdoc/test_srcdoc.js index 14d754c..e5194fa 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/srcdoc/test_srcdoc.js +++ b/chrome/test/data/extensions/api_test/webnavigation/srcdoc/test_srcdoc.js
@@ -23,7 +23,8 @@ url: getURL('a.html') }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -33,7 +34,8 @@ url: getURL('a.html') }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -41,7 +43,8 @@ url: getURL('a.html') }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -57,7 +60,8 @@ url: 'about:srcdoc' }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -67,7 +71,8 @@ url: 'about:srcdoc' }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0, @@ -75,7 +80,8 @@ url: 'about:srcdoc' }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 0, tabId: 0,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/targetBlank/test_targetBlank.js b/chrome/test/data/extensions/api_test/webnavigation/targetBlank/test_targetBlank.js index 92d7464..bd00291 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/targetBlank/test_targetBlank.js +++ b/chrome/test/data/extensions/api_test/webnavigation/targetBlank/test_targetBlank.js
@@ -30,7 +30,8 @@ url: URL_LOAD }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -40,7 +41,8 @@ url: URL_LOAD }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -48,7 +50,8 @@ url: URL_LOAD }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -72,7 +75,8 @@ url: URL_TARGET }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -82,7 +86,8 @@ url: URL_TARGET }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -90,7 +95,8 @@ url: URL_TARGET }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 2, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/userAction/test_userAction.js b/chrome/test/data/extensions/api_test/webnavigation/userAction/test_userAction.js index 29c077ad..b9af613 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/userAction/test_userAction.js +++ b/chrome/test/data/extensions/api_test/webnavigation/userAction/test_userAction.js
@@ -29,7 +29,8 @@ url: URL_MAIN }}, { label: "a-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -39,7 +40,8 @@ url: URL_MAIN }}, { label: "a-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -47,7 +49,8 @@ url: URL_MAIN }}, { label: "a-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -64,7 +67,8 @@ url: SUBFRAME_URL }}, { label: "subframe-onCommitted", event: "onCommitted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 1, tabId: 0, @@ -74,7 +78,8 @@ url: SUBFRAME_URL }}, { label: "subframe-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 1, tabId: 0, @@ -82,7 +87,8 @@ url: SUBFRAME_URL }}, { label: "subframe-onCompleted", event: "onCompleted", - details: { frameId: 1, + details: { documentId: 2, + frameId: 1, parentFrameId: 0, processId: 1, tabId: 0, @@ -107,7 +113,8 @@ url: getURL('b.html') }}, { label: "b-onCommitted", event: "onCommitted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -117,7 +124,8 @@ url: getURL('b.html') }}, { label: "b-onDOMContentLoaded", event: "onDOMContentLoaded", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1, @@ -125,7 +133,8 @@ url: getURL('b.html') }}, { label: "b-onCompleted", event: "onCompleted", - details: { frameId: 0, + details: { documentId: 3, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 1,
diff --git a/chrome/test/data/extensions/api_test/webnavigation/xslt/test_xslt.js b/chrome/test/data/extensions/api_test/webnavigation/xslt/test_xslt.js index 40204776..5be9278a 100644 --- a/chrome/test/data/extensions/api_test/webnavigation/xslt/test_xslt.js +++ b/chrome/test/data/extensions/api_test/webnavigation/xslt/test_xslt.js
@@ -34,7 +34,8 @@ url: URL_MAIN }}, { label: 'main-onCommitted', event: 'onCommitted', - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -44,7 +45,8 @@ url: URL_MAIN }}, { label: 'main-onDOMContentLoaded', event: 'onDOMContentLoaded', - details: { frameId: 0, + details: { documentId: 1, + frameId: 0, parentFrameId: -1, processId: 0, tabId: 0, @@ -52,20 +54,22 @@ url: URL_MAIN }}, { label: 'main-onDOMContentLoaded', event: 'onDOMContentLoaded', - details: { frameId: 0, - parentFrameId: -1, - processId: 0, - tabId: 0, - timeStamp: 0, - url: URL_MAIN }}, + details: { documentId: 1, + frameId: 0, + parentFrameId: -1, + processId: 0, + tabId: 0, + timeStamp: 0, + url: URL_MAIN }}, { label: 'main-onCompleted', event: 'onCompleted', - details: { frameId: 0, - parentFrameId: -1, - processId: 0, - tabId: 0, - timeStamp: 0, - url: URL_MAIN }}], + details: { documentId: 1, + frameId: 0, + parentFrameId: -1, + processId: 0, + tabId: 0, + timeStamp: 0, + url: URL_MAIN }}], [ [ "main-onBeforeNavigate", "main-onCommitted",
diff --git a/chromeos/components/test/data/onc/toplevel_ca_partially_invalid.onc b/chromeos/components/test/data/onc/toplevel_ca_partially_invalid.onc new file mode 100644 index 0000000..d01c59a --- /dev/null +++ b/chromeos/components/test/data/onc/toplevel_ca_partially_invalid.onc
@@ -0,0 +1,93 @@ +{ "Type": "UnencryptedConfiguration", + "NetworkConfigurations": + [ { "GUID": "123", + "Type": "VPN", + "Name": "testopenvpn", + "StaticIPConfig": { + "Type": "IPv4", + "IPAddress": "127.0.0.1", + "RoutingPrefix": 32 + }, + "VPN": { + "Host": "policys host", + "Recommended": ["Host"], + "Type": "OpenVPN", + "OpenVPN": { + "Port": 1194, + "Username": "abc ${LOGIN_ID} def", + "Recommended": [ "Username", "Password", "UNKNOWN_FIELD" ], + "ClientCertType": "Pattern", + "ClientCertPattern": { + "IssuerCARef": [ "test-ca" ], + "Recommended": [ "EnrollmentURI", "IssuerCARef" ] + } + }, + "UNKNOWN_FIELD" : "abcdef", + "IPsec": { + "AuthenticationType": "PSK", + "PSK": "sharedkey", + "IKEVersion": 1 + } + } + }, + { + "GUID": "456", + "Type": "WiFi", + "Name": "My WiFi Network", + "WiFi": { + "Security": "None", + "SSID": "OpenWrt" + } + }, + { "GUID": "guid", + "Name": "name", + "Ethernet": { + "Authentication": "None" + } + } + ], + "Certificates": [ + { + "GUID": "test-ca", + "TrustBits": [ "Web" ], + "X509": "MIIG", + "Type": "Authority" + }, + { + "GUID": "{d443ad0d-ea16-4301-9089-588115e2f5c4}", + "Type": "Authority", + "X509": "-----BEGIN CERTIFICATE-----\n + MIIC8zCCAdugAwIBAgIJALF9qhLor0+aMA0GCSqGSIb3DQEBBQUAMBcxFTATBgNV\n + BAMMDFRlc3QgUm9vdCBDQTAeFw0xNDA4MTQwMzA1MjlaFw0yNDA4MTEwMzA1Mjla\n + MBcxFTATBgNVBAMMDFRlc3QgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP\n + ADCCAQoCggEBALZJQeNCAVGofzx6cdP7zZE1F4QajvY2x9FwHfqG8267dm/oMi43\n + /TiSPWjkin1CMxRGG9wE9pFuVEDECgn97C1i4l7huiycwbFgTNrH+CJcgiBlQh5W\n + d3VP65AsSupXDiKNbJWsEerM1+72cA0J3aY1YV3Jdm2w8h6/MIbYd1I2lZcO0UbF\n + 7YE9G7DyYZU8wUA4719dumGf7yucn4WJdHBj1XboNX7OAeHzERGQHA31/Y3OEGyt\n + fFUaIW/XLfR4FeovOL2RnjwdB0b1Q8GCi68SU2UZimlpZgay2gv6KgChKhWESfEB\n + v5swBtAVoB+dUZFH4VNf717swmF5whSfxOMCAwEAAaNCMEAwDwYDVR0TAQH/BAUw\n + AwEB/zAdBgNVHQ4EFgQUvPcw0TzA8nn675/JbFyT84poq4MwDgYDVR0PAQH/BAQD\n + AgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBXByn7f+j/sObYWGrDkKE4HLTzaLHs6Ikj\n + JNeo8iHDYOSkSVwAv9/HgniAKxj3rd3QYl6nsMzwqrTOcBJZZWd2BQAYmv/EKhfj\n + 8VXYvlxe68rLU4cQ1QkyNqdeQfRT2n5WYNJ+TpqlCF9ddennMMsi6e8ZSYOlI6H4\n + YEzlNtU5eBjxXr/OqgtTgSx4qQpr2xMQIRR/G3A9iRpAigYsXVAZYvnHRYnyPWYF\n + PX11W1UegEJyoZp8bQp09u6mIWw6mPt3gl/ya1bm3ZuOUPDGrv3qpgUHqSYGVrOy\n + 2bI3oCE+eQYfuVG+9LFJTZC1M+UOx15bQMVqBNFDepRqpE9h/ILg\n + -----END CERTIFICATE-----" + }, + { + "GUID": "{f998f760-272b-6939-4c2beffe428697ac}", + "PKCS12": "MIIGUQIBAzCCBhcGCSqGSIb3DQEHAaCCBggEggYEMIIGADCCAv8GCSqGSIb3DQEHBqCCAvAwggLsAgEAMIIC5QYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIHnFaWM2Y0BgCAggAgIICuG4ou9mxkhpus8WictLJe+JOnSQrdNXV3FMQr4pPJ6aJJFBMKZ80W2GpR8XNY/SSKkdaNr1puDm1bDBFGaHQuCKXYcWO8ynBQ1uoZaFaTTFxWbbHo89Jrvw+gIrgpoOHQ0KECEbh5vOZCjGHoaQb4QZOkw/6Cuc4QRoCPJAI3pbSPG44kRbOuOaTZvBHSIPkGf3+R6byTvZ3Yiuw7IIzxUp2fYjtpCWd/NvtI70heJCWdb5hwCeNafIEpX+MTVuhUegysIFkOMMlUBIQSI5ky8kjx0Yi82BT/dpz9QgrqFL8NnTMXp0JlKFGLQwsIQhvGjw/E52fEWRy85B5eezgNsD4QOLeZkF0bQAz8kXfLi+0djxsHvH9W9X2pwaFiAveXR15/v+wfCwQGSsRhISGLzg/gO1agbQdaexI9GlEeZW0FEY7TblarKh8TVGNrauU7GCGDmD2w7wx2HTXfo9SbViFoYVKuxcrpHGGEtBffnIeAwN6BBee4v11jxv0i/QUdK5G6FbHqlD1AhHsm0YvidYKqJ0cnN262xIJH7dhKq/qUiAT+qk3+d3/obqxbvVY+bDoJQ10Gzj1ASMy4zcSL7KW1l99xxMr6OlKr4Sr23oGw4BIN73FB8S8qMzz/VzL4azDUyGpPkzWl0yXPsHpFWh1nZlsQehyknyWDH/waKrrG8tVWxHZLgq+zrFxQTh63UHXSD+TXB+AQg2xmQMeWlfvRcsKL8titZ6PnWCHTmZY+3ibv5avDsg7He6OcZOi9ZmYMx82QHuzb4aZ/T+OC05oA97nVNbTN6t8okkRtBamMvVhtTJANVpsdPi8saEaVF8e9liwmpq2w7pqXnzgdzvjSUpPAa4dZBjWnZJvFOHuxZqiRzQdZbeh9+bXwsQJhRNe+d4EgFwuqebQOczeUi4NVTHTFiuPEjCCAvkGCSqGSIb3DQEHAaCCAuoEggLmMIIC4jCCAt4GCyqGSIb3DQEMCgECoIICpjCCAqIwHAYKKoZIhvcNAQwBAzAOBAi0znbEekG/MgICCAAEggKAJfFPaQyYYLohEA1ruAZfepwMVrR8eLMx00kkfXN9EoZeFPj2q7TGdqmbkUSqXnZK1ums7pFCPLgP1CsPlsq/4ZPDT2LLVFZNLOgmdQBOSTvycfsj0iKYrwRC55wJI2OXsc062sT7oa99apkgrEyHq7JbOhszfnv5+aVy/6O115dncqFPW2ei4CBzLEZyYa+Mka6CGqSdm97WVmv0emDKTFEP/FN4TH/tS8Qm6Y7DTKGCujC+hb6lTRFYJAD4uld132dv0xQFkwDZGfdnuGJuNZBDC0gZk3BYvOaCUD8Y9UB5IjfGJax2yrurY1wSGSlTurafDTPrKqIdBovwCPsad2xz1YHC2Yy0h1FyR+2uitDyNfTiETfug3bFbjwodu9wmt31A2ZFn4JpUrTYoZ3LZXngC3nNTayU0Tkd1ICMep2GbCReL3ajOlgOKGFVoOm/qDnhiH6W/ebtAQXqVpuKut8uY0X0Ocmx7mTpmxlfDSRiBY9rvnrGfnpfLMxtFeF9jv3n8vSwvA0Xn0okAv1FWYLStiCpNxnD6lmXQvcmL/skAlJJpHY9/58qt/e5sGYrkKBw3jnX40zaK4W7GeJvhij0MRr6yUL2lvaEcWDnK6K1F90G/ybKRCTHBCJzyBe7yHhZCc+ZcvKK6DTi83fELTyupy08BkXt7oPdapxmKlZxTldo9FpPXSqrdRtAWhDkEkIEf8dMf8QrQr3glCWfbcQ047URYX45AHRnLTLLkJfdY8+Y3KsHoqL2UrOrct+J1u0mmnLbonN3pB2B4nd9X9vf9/uSFrgvk0iPO0Ro3UPRUIIYEP2Kx51pZZVDd++hl5gXtqe0NIpphGhxLycIdzElMCMGCSqGSIb3DQEJFTEWBBR1uVpGjHRddIEYuJhz/FgG4Onh6jAxMCEwCQYFKw4DAhoFAAQU1M+0WRDkoVGbGg1jj7q2fI67qHIECBzRYESpgt5iAgIIAA==", + "Type": "Client" + }, + { + "GUID": "{456}", + "PKCS12": "ERROR MIIGUQIBAzCCBhcGCSqGSIb3DQEHAaCCBggEggYEMIIGADCCAv8GCSqGSIb3DQEHBqCCAvAwggLsAgEAMIIC5QYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIHnFaWM2Y0BgCAggAgIICuG4ou9mxkhpus8WictLJe+JOnSQrdNXV3FMQr4pPJ6aJJFBMKZ80W2GpR8XNY/SSKkdaNr1puDm1bDBFGaHQuCKXYcWO8ynBQ1uoZaFaTTFxWbbHo89Jrvw+gIrgpoOHQ0KECEbh5vOZCjGHoaQb4QZOkw/6Cuc4QRoCPJAI3pbSPG44kRbOuOaTZvBHSIPkGf3+R6byTvZ3Yiuw7IIzxUp2fYjtpCWd/NvtI70heJCWdb5hwCeNafIEpX+MTVuhUegysIFkOMMlUBIQSI5ky8kjx0Yi82BT/dpz9QgrqFL8NnTMXp0JlKFGLQwsIQhvGjw/E52fEWRy85B5eezgNsD4QOLeZkF0bQAz8kXfLi+0djxsHvH9W9X2pwaFiAveXR15/v+wfCwQGSsRhISGLzg/gO1agbQdaexI9GlEeZW0FEY7TblarKh8TVGNrauU7GCGDmD2w7wx2HTXfo9SbViFoYVKuxcrpHGGEtBffnIeAwN6BBee4v11jxv0i/QUdK5G6FbHqlD1AhHsm0YvidYKqJ0cnN262xIJH7dhKq/qUiAT+qk3+d3/obqxbvVY+bDoJQ10Gzj1ASMy4zcSL7KW1l99xxMr6OlKr4Sr23oGw4BIN73FB8S8qMzz/VzL4azDUyGpPkzWl0yXPsHpFWh1nZlsQehyknyWDH/waKrrG8tVWxHZLgq+zrFxQTh63UHXSD+TXB+AQg2xmQMeWlfvRcsKL8titZ6PnWCHTmZY+3ibv5avDsg7He6OcZOi9ZmYMx82QHuzb4aZ/T+OC05oA97nVNbTN6t8okkRtBamMvVhtTJANVpsdPi8saEaVF8e9liwmpq2w7pqXnzgdzvjSUpPAa4dZBjWnZJvFOHuxZqiRzQdZbeh9+bXwsQJhRNe+d4EgFwuqebQOczeUi4NVTHTFiuPEjCCAvkGCSqGSIb3DQEHAaCCAuoEggLmMIIC4jCCAt4GCyqGSIb3DQEMCgECoIICpjCCAqIwHAYKKoZIhvcNAQwBAzAOBAi0znbEekG/MgICCAAEggKAJfFPaQyYYLohEA1ruAZfepwMVrR8eLMx00kkfXN9EoZeFPj2q7TGdqmbkUSqXnZK1ums7pFCPLgP1CsPlsq/4ZPDT2LLVFZNLOgmdQBOSTvycfsj0iKYrwRC55wJI2OXsc062sT7oa99apkgrEyHq7JbOhszfnv5+aVy/6O115dncqFPW2ei4CBzLEZyYa+Mka6CGqSdm97WVmv0emDKTFEP/FN4TH/tS8Qm6Y7DTKGCujC+hb6lTRFYJAD4uld132dv0xQFkwDZGfdnuGJuNZBDC0gZk3BYvOaCUD8Y9UB5IjfGJax2yrurY1wSGSlTurafDTPrKqIdBovwCPsad2xz1YHC2Yy0h1FyR+2uitDyNfTiETfug3bFbjwodu9wmt31A2ZFn4JpUrTYoZ3LZXngC3nNTayU0Tkd1ICMep2GbCReL3ajOlgOKGFVoOm/qDnhiH6W/ebtAQXqVpuKut8uY0X0Ocmx7mTpmxlfDSRiBY9rvnrGfnpfLMxtFeF9jv3n8vSwvA0Xn0okAv1FWYLStiCpNxnD6lmXQvcmL/skAlJJpHY9/58qt/e5sGYrkKBw3jnX40zaK4W7GeJvhij0MRr6yUL2lvaEcWDnK6K1F90G/ybKRCTHBCJzyBe7yHhZCc+ZcvKK6DTi83fELTyupy08BkXt7oPdapxmKlZxTldo9FpPXSqrdRtAWhDkEkIEf8dMf8QrQr3glCWfbcQ047URYX45AHRnLTLLkJfdY8+Y3KsHoqL2UrOrct+J1u0mmnLbonN3pB2B4nd9X9vf9/uSFrgvk0iPO0Ro3UPRUIIYEP2Kx51pZZVDd++hl5gXtqe0NIpphGhxLycIdzElMCMGCSqGSIb3DQEJFTEWBBR1uVpGjHRddIEYuJhz/FgG4Onh6jAxMCEwCQYFKw4DAhoFAAQU1M+0WRDkoVGbGg1jj7q2fI67qHIECBzRYESpgt5iAgIIAA==", + "Type": "Client" + } + ], + "GlobalNetworkConfiguration": { + "AllowOnlyPolicyNetworksToAutoconnect": true, + "Unknown option": "abc" + } +}
diff --git a/chromeos/network/policy_certificate_provider.h b/chromeos/network/policy_certificate_provider.h index 5b5d048f..3745844 100644 --- a/chromeos/network/policy_certificate_provider.h +++ b/chromeos/network/policy_certificate_provider.h
@@ -51,7 +51,7 @@ // Returns the server and authority certificates which were successfully // parsed from ONC and were granted web trust. This means that the // certificates had the "Web" trust bit set, and this - // UserNetworkConfigurationUpdater instance was created with + // NetworkConfigurationUpdater instance was created with // |allow_trusted_certs_from_policy| = true. virtual net::CertificateList GetWebTrustedCertificates( const chromeos::onc::CertificateScope& scope) const = 0;
diff --git a/components/accuracy_tips/accuracy_service.cc b/components/accuracy_tips/accuracy_service.cc index 8af00800..d033e7e 100644 --- a/components/accuracy_tips/accuracy_service.cc +++ b/components/accuracy_tips/accuracy_service.cc
@@ -233,8 +233,8 @@ ukm::SourceId ukm_source_id, AccuracyTipInteraction interaction) { DCHECK(ui_task_runner_->RunsTasksInCurrentSequence()); - ListPrefUpdateDeprecated update(pref_service_, - GetPreviousInteractionsPrefName(disable_ui_)); + ListPrefUpdate update(pref_service_, + GetPreviousInteractionsPrefName(disable_ui_)); base::Value* interaction_list = update.Get(); interaction_list->Append(static_cast<int>(interaction));
diff --git a/components/autofill/content/renderer/form_cache_browsertest.cc b/components/autofill/content/renderer/form_cache_browsertest.cc index 4b67f0a..c6a503b 100644 --- a/components/autofill/content/renderer/form_cache_browsertest.cc +++ b/components/autofill/content/renderer/form_cache_browsertest.cc
@@ -6,6 +6,7 @@ #include "base/ranges/algorithm.h" #include "base/strings/utf_string_conversions.h" +#include "build/build_config.h" #include "components/autofill/content/renderer/focus_test_utils.h" #include "components/autofill/content/renderer/form_autofill_util.h" #include "components/autofill/content/renderer/form_cache.h" @@ -771,7 +772,13 @@ // - the forms [kMaxParseableChildFrames, kMaxParseableFields) should have // empty FormData::child_frames, // - the forms [kMaxParseableFields, end) should be skipped. -TEST_P(FormCacheIframeBrowserTest, FieldAndFrameLimit) { +// TODO(https://crbug.com/1287782): Flaky on android. +#if defined(OS_ANDROID) +#define MAYBE_FieldAndFrameLimit DISABLED_FieldAndFrameLimit +#else +#define MAYBE_FieldAndFrameLimit FieldAndFrameLimit +#endif +TEST_P(FormCacheIframeBrowserTest, MAYBE_FieldAndFrameLimit) { ASSERT_LE(kMaxParseableChildFrames, kMaxParseableFields); std::string html;
diff --git a/components/autofill/ios/browser/BUILD.gn b/components/autofill/ios/browser/BUILD.gn index e369d6b..b54e496 100644 --- a/components/autofill/ios/browser/BUILD.gn +++ b/components/autofill/ios/browser/BUILD.gn
@@ -129,6 +129,7 @@ "//ios/web/public", "//ios/web/public/js_messaging", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//services/metrics/public/cpp:ukm_builders", "//testing/gmock",
diff --git a/components/autofill/ios/form_util/BUILD.gn b/components/autofill/ios/form_util/BUILD.gn index fb4e88d..ca4e91e2 100644 --- a/components/autofill/ios/form_util/BUILD.gn +++ b/components/autofill/ios/form_util/BUILD.gn
@@ -93,6 +93,7 @@ "//ios/web/public", "//ios/web/public/js_messaging", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//testing/gtest", ] } @@ -116,6 +117,7 @@ "//components/autofill/ios/form_util:form_handler_feature", "//ios/web/public/js_messaging", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/web_state/js", "//testing/gtest",
diff --git a/components/browser_ui/modaldialog/android/java/res/values/dimens.xml b/components/browser_ui/modaldialog/android/java/res/values/dimens.xml index 1f250d80..47709df 100644 --- a/components/browser_ui/modaldialog/android/java/res/values/dimens.xml +++ b/components/browser_ui/modaldialog/android/java/res/values/dimens.xml
@@ -8,5 +8,7 @@ <dimen name="modal_dialog_control_horizontal_padding">8dp</dimen> <dimen name="modal_dialog_control_vertical_padding_filled">10dp</dimen> <dimen name="modal_dialog_control_horizontal_padding_filled">16dp</dimen> + <dimen name="modal_dialog_button_with_icon_start_padding">12dp</dimen> + <dimen name="modal_dialog_button_with_icon_text_padding">8dp</dimen> <dimen name="modal_dialog_max_height">560dp</dimen> </resources>
diff --git a/components/browser_ui/modaldialog/android/java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogView.java b/components/browser_ui/modaldialog/android/java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogView.java index 8a7ba262..bfa6c57 100644 --- a/components/browser_ui/modaldialog/android/java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogView.java +++ b/components/browser_ui/modaldialog/android/java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogView.java
@@ -302,6 +302,20 @@ } /** + * @param drawable The icon drawable on the positive button. + */ + void setPositiveButtonIcon(Drawable drawable) { + Button button = getButton(ModalDialogProperties.ButtonType.POSITIVE); + button.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, null, null, null); + button.setCompoundDrawablePadding(getResources().getDimensionPixelSize( + R.dimen.modal_dialog_button_with_icon_text_padding)); + button.setPaddingRelative(getResources().getDimensionPixelSize( + R.dimen.modal_dialog_button_with_icon_start_padding), + button.getPaddingTop(), button.getPaddingEnd(), button.getPaddingBottom()); + updateButtonVisibility(); + } + + /** * Sets content description for the specified button. * @param buttonType The {@link ModalDialogProperties.ButtonType} of the button. * @param contentDescription The content description to be set for the specified button.
diff --git a/components/browser_ui/modaldialog/android/java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogViewBinder.java b/components/browser_ui/modaldialog/android/java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogViewBinder.java index 902dd3f5..3b36473 100644 --- a/components/browser_ui/modaldialog/android/java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogViewBinder.java +++ b/components/browser_ui/modaldialog/android/java/src/org/chromium/components/browser_ui/modaldialog/ModalDialogViewBinder.java
@@ -34,6 +34,8 @@ assert checkFilterTouchConsistency(model); view.setButtonText(ModalDialogProperties.ButtonType.POSITIVE, model.get(ModalDialogProperties.POSITIVE_BUTTON_TEXT)); + } else if (ModalDialogProperties.POSITIVE_BUTTON_ICON == propertyKey) { + view.setPositiveButtonIcon(model.get(ModalDialogProperties.POSITIVE_BUTTON_ICON)); } else if (ModalDialogProperties.POSITIVE_BUTTON_CONTENT_DESCRIPTION == propertyKey) { view.setButtonContentDescription(ModalDialogProperties.ButtonType.POSITIVE, model.get(ModalDialogProperties.POSITIVE_BUTTON_CONTENT_DESCRIPTION));
diff --git a/components/browser_ui/strings/android/translations/browser_ui_strings_az.xtb b/components/browser_ui/strings/android/translations/browser_ui_strings_az.xtb index 2750294c..01fea6aa 100644 --- a/components/browser_ui/strings/android/translations/browser_ui_strings_az.xtb +++ b/components/browser_ui/strings/android/translations/browser_ui_strings_az.xtb
@@ -90,6 +90,7 @@ <translation id="3115898365077584848">Məlumatı göstərin</translation> <translation id="3123473560110926937">Bəzi saytlarda bloklandı</translation> <translation id="3198916472715691905"><ph name="STORAGE_AMOUNT" /> saxlanılan data</translation> +<translation id="3203366800380907218">Vebdən</translation> <translation id="321187648315454507"><ph name="APP_NAME" /> tətbiqinə sizə bildiriş göndərmək icazəsi vermək üçün <ph name="BEGIN_LINK" />Android Ayarlarında<ph name="END_LINK" /> bildirişləri də aktiv edin.</translation> <translation id="3227137524299004712">Mikrofon</translation> <translation id="3277252321222022663">Saytların sensorlara daxil olmasına icazə verin (tövsiyə edilir)</translation>
diff --git a/components/browser_ui/strings/android/translations/browser_ui_strings_bs.xtb b/components/browser_ui/strings/android/translations/browser_ui_strings_bs.xtb index b818e5c3..5cc689ae 100644 --- a/components/browser_ui/strings/android/translations/browser_ui_strings_bs.xtb +++ b/components/browser_ui/strings/android/translations/browser_ui_strings_bs.xtb
@@ -90,7 +90,7 @@ <translation id="3115898365077584848">Prikaži informacije</translation> <translation id="3123473560110926937">Blokirano na nekim web lokacijama</translation> <translation id="3198916472715691905"><ph name="STORAGE_AMOUNT" /> pohranjenih podataka</translation> -<translation id="3203366800380907218">S weba</translation> +<translation id="3203366800380907218">S interneta</translation> <translation id="321187648315454507">Da dozvolite da vam aplikacija <ph name="APP_NAME" /> šalje obavještenja, također uključite obavještenja u <ph name="BEGIN_LINK" />Postavkama Androida<ph name="END_LINK" />.</translation> <translation id="3227137524299004712">Mikrofon</translation> <translation id="3277252321222022663">Dozvolite web lokacijama pristup senzorima (preporučeno)</translation>
diff --git a/components/browser_ui/strings/android/translations/browser_ui_strings_ka.xtb b/components/browser_ui/strings/android/translations/browser_ui_strings_ka.xtb index ebdc65a..ce96cc5c 100644 --- a/components/browser_ui/strings/android/translations/browser_ui_strings_ka.xtb +++ b/components/browser_ui/strings/android/translations/browser_ui_strings_ka.xtb
@@ -90,6 +90,7 @@ <translation id="3115898365077584848">ინფორმაციის ჩვენება</translation> <translation id="3123473560110926937">დაბლოკილია ზოგიერთ საიტზე</translation> <translation id="3198916472715691905"><ph name="STORAGE_AMOUNT" /> შენახული მონაცემები</translation> +<translation id="3203366800380907218">ვებიდან</translation> <translation id="321187648315454507"><ph name="APP_NAME" />-მა შეტყობინებები რომ გამოგიგზავნოთ, გაააქტიურეთ შეტყობინებებზე წვდომის ნებართვაც <ph name="BEGIN_LINK" />Android-ის პარამეტრებიდან<ph name="END_LINK" />.</translation> <translation id="3227137524299004712">მიკროფონი</translation> <translation id="3277252321222022663">საიტებისთვის სენსორებზე წვდომის დაშვება (რეკომენდებული)</translation>
diff --git a/components/browser_ui/strings/android/translations/browser_ui_strings_si.xtb b/components/browser_ui/strings/android/translations/browser_ui_strings_si.xtb index d15f7ba..859bf7e 100644 --- a/components/browser_ui/strings/android/translations/browser_ui_strings_si.xtb +++ b/components/browser_ui/strings/android/translations/browser_ui_strings_si.xtb
@@ -90,6 +90,7 @@ <translation id="3115898365077584848">තතු පෙන්වන්න</translation> <translation id="3123473560110926937">සමහර වෙබ් අඩවිවල අවහිර කෙරේ</translation> <translation id="3198916472715691905"><ph name="STORAGE_AMOUNT" /> ගබඩා කළ දත්ත</translation> +<translation id="3203366800380907218">වෙබය වෙතින්</translation> <translation id="321187648315454507"><ph name="APP_NAME" /> හට ඔබට දැනුම්දීම් එවීමට ඉඩ දීමට <ph name="BEGIN_LINK" />Android සැකසීම්<ph name="END_LINK" /> තුළ දැනුම්දීම්ද ක්රියාත්මක කරන්න.</translation> <translation id="3227137524299004712">මයික්රෆෝනය:</translation> <translation id="3277252321222022663">වෙබ් අඩවිවලට සංවේදක වෙත ප්රවේශ වීමට ඉඩ දෙන්න (නිර්දේශිතයි)</translation>
diff --git a/components/browser_ui/strings/android/translations/browser_ui_strings_th.xtb b/components/browser_ui/strings/android/translations/browser_ui_strings_th.xtb index 8b142b68..26f2e8e 100644 --- a/components/browser_ui/strings/android/translations/browser_ui_strings_th.xtb +++ b/components/browser_ui/strings/android/translations/browser_ui_strings_th.xtb
@@ -90,6 +90,7 @@ <translation id="3115898365077584848">แสดงข้อมูล</translation> <translation id="3123473560110926937">บล็อกในบางเว็บไซต์</translation> <translation id="3198916472715691905">ข้อมูลที่จัดเก็บมี <ph name="STORAGE_AMOUNT" /></translation> +<translation id="3203366800380907218">จากเว็บ</translation> <translation id="321187648315454507">หากต้องการอนุญาตให้ <ph name="APP_NAME" /> ส่งการแจ้งเตือนให้คุณ ให้เปิดใช้การแจ้งเตือนใน<ph name="BEGIN_LINK" />การตั้งค่า Android<ph name="END_LINK" /> ด้วย</translation> <translation id="3227137524299004712">ไมโครโฟน</translation> <translation id="3277252321222022663">อนุญาตให้เว็บไซต์เข้าถึงเซ็นเซอร์ (แนะนำ)</translation>
diff --git a/components/certificate_transparency/data/log_list.json b/components/certificate_transparency/data/log_list.json index abae851f6..84db802 100644 --- a/components/certificate_transparency/data/log_list.json +++ b/components/certificate_transparency/data/log_list.json
@@ -1,6 +1,6 @@ { - "version": "4.91", - "log_list_timestamp": "2022-01-16T01:34:35Z", + "version": "4.92", + "log_list_timestamp": "2022-01-17T01:35:38Z", "operators": [ { "name": "Google",
diff --git a/components/password_manager/core/browser/ui/insecure_credentials_manager.cc b/components/password_manager/core/browser/ui/insecure_credentials_manager.cc index 142bb5b8..8ab11817 100644 --- a/components/password_manager/core/browser/ui/insecure_credentials_manager.cc +++ b/components/password_manager/core/browser/ui/insecure_credentials_manager.cc
@@ -38,6 +38,7 @@ std::vector<PasswordForm> forms; InsecureCredentialTypeFlags type = InsecureCredentialTypeFlags::kSecure; base::Time latest_time; + IsMuted is_muted; }; namespace { @@ -123,6 +124,7 @@ credential_to_form.type |= ConvertInsecureType(pair.first); credential_to_form.latest_time = std::max(credential_to_form.latest_time, pair.second.create_time); + credential_to_form.is_muted = pair.second.is_muted; } // Populate the map. The values are vectors, because it is // possible that multiple saved passwords match to the same @@ -155,6 +157,7 @@ CredentialWithPassword credential(credential_to_forms.first); credential.insecure_type = credential_to_forms.second.type; credential.create_time = credential_to_forms.second.latest_time; + credential.is_muted = credential_to_forms.second.is_muted; credentials.push_back(std::move(credential)); } } @@ -214,7 +217,8 @@ /*password=*/{}, /*last_used_time=*/base::Time()), create_time(credential.create_time), - insecure_type(ConvertInsecureType(credential.insecure_type)) {} + insecure_type(ConvertInsecureType(credential.insecure_type)), + is_muted(credential.is_muted) {} CredentialWithPassword& CredentialWithPassword::operator=( const CredentialWithPassword& other) = default; @@ -268,6 +272,37 @@ } } +bool InsecureCredentialsManager::MuteCredential( + const CredentialView& credential) { + auto it = credentials_to_forms_.find(credential); + if (it == credentials_to_forms_.end()) + return false; + + // Mute all matching compromised credentials from the store. + // For a match, all insecureity types saved in the store are muted. + // Return whether any credentials were muted. + const auto& saved_passwords = it->second.forms; + bool muted = false; + for (const PasswordForm& saved_password : saved_passwords) { + PasswordForm form_to_update = saved_password; + bool form_changed = false; + for (const auto& password_issue : saved_password.password_issues) { + if (!password_issue.second.is_muted.value()) { + form_to_update.password_issues.insert_or_assign( + password_issue.first, + InsecurityMetadata(password_issue.second.create_time, + IsMuted(true))); + form_changed = true; + } + } + if (form_changed) { + GetStoreFor(saved_password).UpdateLogin(form_to_update); + muted = true; + } + } + return muted; +} + bool InsecureCredentialsManager::UpdateCredential( const CredentialView& credential, const base::StringPiece password) {
diff --git a/components/password_manager/core/browser/ui/insecure_credentials_manager.h b/components/password_manager/core/browser/ui/insecure_credentials_manager.h index 9bedab7..280d9bd2 100644 --- a/components/password_manager/core/browser/ui/insecure_credentials_manager.h +++ b/components/password_manager/core/browser/ui/insecure_credentials_manager.h
@@ -115,7 +115,6 @@ struct CredentialWithPassword : CredentialView { explicit CredentialWithPassword(const CredentialView& credential); explicit CredentialWithPassword(const InsecureCredential& credential); - CredentialWithPassword(const CredentialWithPassword& other); CredentialWithPassword(CredentialWithPassword&& other); ~CredentialWithPassword(); @@ -125,6 +124,7 @@ base::Time create_time; InsecureCredentialTypeFlags insecure_type = InsecureCredentialTypeFlags::kSecure; + IsMuted is_muted{false}; }; // Comparator that can compare CredentialView or CredentialsWithPasswords. @@ -139,10 +139,10 @@ struct CredentialMetadata; // This class provides clients with saved insecure credentials and possibility -// to save new LeakedCredentials, edit/delete insecure credentials and match -// insecure credentials with corresponding autofill::PasswordForms. It supports -// an observer interface, and clients can register themselves to get notified -// about changes to the list. +// to save new LeakedCredentials, edit/delete/mute insecure credentials and +// match insecure credentials with corresponding autofill::PasswordForms. It +// supports an observer interface, and clients can register themselves to get +// notified about changes to the list. class InsecureCredentialsManager : public SavedPasswordsPresenter::Observer { public: using CredentialsView = base::span<const CredentialWithPassword>; @@ -184,6 +184,10 @@ // the remove succeeded. bool RemoveCredential(const CredentialView& credential); + // Attempts to mute |credential| from the password store. + // Returns whether the mute succeeded. + bool MuteCredential(const CredentialView& credential); + // Returns a vector of currently insecure credentials. std::vector<CredentialWithPassword> GetInsecureCredentials() const;
diff --git a/components/password_manager/core/browser/ui/insecure_credentials_manager_unittest.cc b/components/password_manager/core/browser/ui/insecure_credentials_manager_unittest.cc index 84645e4..138e399 100644 --- a/components/password_manager/core/browser/ui/insecure_credentials_manager_unittest.cc +++ b/components/password_manager/core/browser/ui/insecure_credentials_manager_unittest.cc
@@ -84,10 +84,12 @@ CredentialWithPassword MakeCompromisedCredential( const PasswordForm& form, - InsecureCredentialTypeFlags type = - InsecureCredentialTypeFlags::kCredentialLeaked) { + const InsecureCredentialTypeFlags type = + InsecureCredentialTypeFlags::kCredentialLeaked, + const bool is_muted = false) { CredentialWithPassword credential_with_password((CredentialView(form))); credential_with_password.insecure_type = type; + credential_with_password.is_muted = IsMuted(is_muted); return credential_with_password; } @@ -692,6 +694,98 @@ .password_issues.at(InsecureType::kLeaked)); } +TEST_F(InsecureCredentialsManagerTest, MuteCompromisedCredential) { + PasswordForm password = + MakeSavedPassword(kExampleCom, kUsername1, kPassword1); + password.password_issues.insert( + {InsecureType::kLeaked, InsecurityMetadata()}); + + store().AddLogin(password); + RunUntilIdle(); + + CredentialWithPassword expected = MakeCompromisedCredential(password); + + EXPECT_THAT(provider().GetInsecureCredentials(), ElementsAre(expected)); + EXPECT_FALSE(provider().GetInsecureCredentials()[0].is_muted); + + EXPECT_TRUE(provider().MuteCredential(expected)); + RunUntilIdle(); + EXPECT_TRUE(provider().GetInsecureCredentials()[0].is_muted); + EXPECT_TRUE(store() + .stored_passwords() + .at(kExampleCom) + .back() + .password_issues.at(InsecureType::kLeaked) + .is_muted.value()); +} + +TEST_F(InsecureCredentialsManagerTest, MuteCompromisedCredentialOnMutedIsNoOp) { + PasswordForm password = + MakeSavedPassword(kExampleCom, kUsername1, kPassword1); + password.password_issues.insert( + {InsecureType::kLeaked, InsecurityMetadata(base::Time(), IsMuted(true))}); + + store().AddLogin(password); + RunUntilIdle(); + + CredentialWithPassword expected = MakeCompromisedCredential( + password, InsecureCredentialTypeFlags::kCredentialLeaked, true); + + EXPECT_THAT(provider().GetInsecureCredentials(), ElementsAre(expected)); + EXPECT_TRUE(provider().GetInsecureCredentials()[0].is_muted); + + EXPECT_FALSE(provider().MuteCredential(expected)); + RunUntilIdle(); + EXPECT_TRUE(provider().GetInsecureCredentials()[0].is_muted); + EXPECT_TRUE(store() + .stored_passwords() + .at(kExampleCom) + .back() + .password_issues.at(InsecureType::kLeaked) + .is_muted.value()); +} + +TEST_F(InsecureCredentialsManagerTest, + MuteCompromisedCredentialLeakedMutesMultipleInsecurityTypes) { + PasswordForm password = + MakeSavedPassword(kExampleCom, kUsername1, kPassword1); + password.password_issues.insert( + {InsecureType::kLeaked, + InsecurityMetadata(base::Time(), IsMuted(false))}); + password.password_issues.insert( + {InsecureType::kPhished, + InsecurityMetadata(base::Time(), IsMuted(false))}); + + store().AddLogin(password); + RunUntilIdle(); + + CredentialWithPassword expected = MakeCompromisedCredential( + password, + InsecureCredentialTypeFlags::kCredentialLeaked | + InsecureCredentialTypeFlags::kCredentialPhished, + true); + + EXPECT_THAT(provider().GetInsecureCredentials(), ElementsAre(expected)); + + EXPECT_FALSE(provider().GetInsecureCredentials()[0].is_muted); + + EXPECT_TRUE(provider().MuteCredential(expected)); + RunUntilIdle(); + EXPECT_TRUE(provider().GetInsecureCredentials()[0].is_muted); + EXPECT_TRUE(store() + .stored_passwords() + .at(kExampleCom) + .back() + .password_issues.at(InsecureType::kLeaked) + .is_muted.value()); + EXPECT_TRUE(store() + .stored_passwords() + .at(kExampleCom) + .back() + .password_issues.at(InsecureType::kPhished) + .is_muted.value()); +} + // Test verifies that editing Compromised Credential via provider change the // original password form. TEST_F(InsecureCredentialsManagerTest, UpdateCompromisedPassword) {
diff --git a/components/password_manager/ios/BUILD.gn b/components/password_manager/ios/BUILD.gn index 4aceeb7..9ebf405 100644 --- a/components/password_manager/ios/BUILD.gn +++ b/components/password_manager/ios/BUILD.gn
@@ -122,6 +122,7 @@ "//components/password_manager/ios:password_manager_feature", "//ios/web/public/js_messaging", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//testing/gmock", "//testing/gtest",
diff --git a/components/payments/content/utility/payment_manifest_parser.cc b/components/payments/content/utility/payment_manifest_parser.cc index 52ef0d5c..f5d876c 100644 --- a/components/payments/content/utility/payment_manifest_parser.cc +++ b/components/payments/content/utility/payment_manifest_parser.cc
@@ -322,6 +322,17 @@ } } +bool GetString(const base::Value* dict, + base::StringPiece key, + std::string& result) { + DCHECK(dict); + const std::string* value = dict->FindStringKey(key); + if (value) { + result = *value; + } + return value; +} + } // namespace PaymentManifestParser::WebAppIcon::WebAppIcon() = default; @@ -492,14 +503,14 @@ fingerprint_dict = &base::Value::AsDictionaryValue(fingerprint_dict_value); } - const std::string* fingerprint_type = - fingerprint_dict->FindStringKey("type"); - const std::string* fingerprint_value = - fingerprint_dict->FindStringKey("value"); - if (!fingerprint_dict || !fingerprint_type || - *fingerprint_type != "sha256_cert" || !fingerprint_value || - fingerprint_value->empty() || - !base::IsStringASCII(*fingerprint_value)) { + std::string fingerprint_type; + std::string fingerprint_value; + if (!fingerprint_dict || + !GetString(fingerprint_dict, "type", fingerprint_type) || + fingerprint_type != "sha256_cert" || + !GetString(fingerprint_dict, "value", fingerprint_value) || + fingerprint_value.empty() || + !base::IsStringASCII(fingerprint_value)) { log.Error(base::StringPrintf( "Each entry in \"%s\" must be a dictionary with \"type\": " "\"sha256_cert\" and a non-empty ASCII string \"value\".", @@ -509,7 +520,7 @@ } std::vector<uint8_t> hash = - FingerprintStringToByteArray(*fingerprint_value, log); + FingerprintStringToByteArray(fingerprint_value, log); if (hash.empty()) { output->clear(); return false;
diff --git a/components/permissions/permission_uma_util.cc b/components/permissions/permission_uma_util.cc index de98ec2..9fc81d3 100644 --- a/components/permissions/permission_uma_util.cc +++ b/components/permissions/permission_uma_util.cc
@@ -639,25 +639,29 @@ if (permission_action == PermissionAction::IGNORED && ui_disposition != - PermissionPromptDisposition::LOCATION_BAR_LEFT_CHIP_AUTO_BUBBLE) { + PermissionPromptDisposition::LOCATION_BAR_LEFT_CHIP_AUTO_BUBBLE && + ui_disposition != PermissionPromptDisposition::ANCHORED_BUBBLE) { base::UmaHistogramBoolean("Permissions.Prompt." + permission_type + "." + permission_disposition + ".Ignored.DidShowBubble", did_show_prompt); } - if (ui_disposition == - PermissionPromptDisposition::LOCATION_BAR_LEFT_QUIET_CHIP) { - base::UmaHistogramBoolean("Permissions.Prompt." + permission_type + "." + - permission_disposition + "." + action_string + - ".DidClickManage", - did_click_managed); - } else if (ui_disposition == PermissionPromptDisposition:: - LOCATION_BAR_LEFT_QUIET_ABUSIVE_CHIP) { - base::UmaHistogramBoolean("Permissions.Prompt." + permission_type + "." + - permission_disposition + "." + action_string + - ".DidClickLearnMore", - did_click_learn_more); + if (requests[0]->request_type() == RequestType::kGeolocation || + requests[0]->request_type() == RequestType::kNotifications) { + if (ui_disposition == + PermissionPromptDisposition::LOCATION_BAR_LEFT_QUIET_CHIP) { + base::UmaHistogramBoolean("Permissions.Prompt." + permission_type + "." + + permission_disposition + "." + + action_string + ".DidClickManage", + did_click_managed); + } else if (ui_disposition == PermissionPromptDisposition:: + LOCATION_BAR_LEFT_QUIET_ABUSIVE_CHIP) { + base::UmaHistogramBoolean("Permissions.Prompt." + permission_type + "." + + permission_disposition + "." + + action_string + ".DidClickLearnMore", + did_click_learn_more); + } } } // namespace permissions
diff --git a/components/policy/resources/policy_templates_ja.xtb b/components/policy/resources/policy_templates_ja.xtb index 1019923..16aa4ce 100644 --- a/components/policy/resources/policy_templates_ja.xtb +++ b/components/policy/resources/policy_templates_ja.xtb
@@ -4178,6 +4178,11 @@ 注: これらの制限は、ウェブページのコンテンツや [リンクをダウンロード] メニューからダウンロードした場合に適用されます。現在表示中のページをダウンロードした場合や印刷オプションから PDF として保存した場合は適用されません。セーフ ブラウジングについて詳しくは、https://developers.google.com/safe-browsing をご覧ください。</translation> <translation id="6123052603197028610">タイムスタンプを取得するために Google サーバーへクエリを送信することを許可しない</translation> +<translation id="6130229425991722726">このポリシーを 0(デフォルト)に設定した場合、デベロッパー ツールと JavaScript コンソールにアクセスできますが、企業ポリシーによってインストールされた拡張機能でのアクセスは許可されません。このポリシーを 1 に設定した場合、あらゆる状況でデベロッパー ツールと JavaScript コンソールにアクセスできます。企業ポリシーによってインストールされた拡張機能でのアクセスも許可されます。このポリシーを 2 に設定した場合、デベロッパー ツールにアクセスできず、ウェブサイト要素も検査できなくなります。 + + この設定では、デベロッパー ツールや JavaScript コンソールを開くためのキーボード ショートカット、メニューのエントリ、コンテキスト メニューのエントリも無効になります。 + + <ph name="PRODUCT_NAME" /> バージョン 99 ではさらに、この設定により「ページのソースを表示」機能のエントリ ポイントも制御されます。このポリシーを「DeveloperToolsDisallowed」(値 2)に設定した場合、ユーザーはキーボード ショートカットまたはコンテキスト メニューを介してソースを表示することはできません。なお、ソースの表示を完全にブロックするには、<ph name="URL_BLOCKLIST_POLICY_NAME" /> ポリシーに「view-source:*」を追加することも必要です。</translation> <translation id="6132506775968708399">サードパーティ Cookie をブロックする</translation> <translation id="6133088669883929098">すべてのサイトにキー生成の使用を許可する</translation> <translation id="6135398260575578389">セーフ ブラウジングを強化モードで有効にする。このモードではセキュリティが強化されますが、より多くの閲覧情報を Google に提供する必要があります。</translation>
diff --git a/components/policy/resources/policy_templates_ko.xtb b/components/policy/resources/policy_templates_ko.xtb index 8ef77c86..506283f 100644 --- a/components/policy/resources/policy_templates_ko.xtb +++ b/components/policy/resources/policy_templates_ko.xtb
@@ -4321,6 +4321,11 @@ 참고: 이러한 제한은 웹페이지 콘텐츠 또는 '링크 다운로드...' 메뉴 옵션을 통해 실행된 다운로드에 적용됩니다. 이러한 제한은 현재 표시된 페이지의 다운로드 또는 인쇄 옵션 중 'PDF로 저장'에는 적용되지 않습니다. 세이프 브라우징에 관해 자세히 알아보세요(https://developers.google.com/safe-browsing).</translation> <translation id="6123052603197028610">Google 서버로 전송된 쿼리가 타임스탬프를 가져오도록 허용하지 않음</translation> +<translation id="6130229425991722726">정책을 0(기본값)으로 설정하면 개발자 도구 및 자바스크립트 콘솔에 액세스할 수 있지만 기업 정책으로 설치한 확장 프로그램에서는 액세스할 수 없습니다. 정책을 1로 설정하면 기업 정책으로 설치한 확장 프로그램을 비롯하여 모든 상황에서 개발자 도구 및 자바스크립트 콘솔에 액세스할 수 있습니다. 정책을 2로 설정하면 개발자 도구에 액세스할 수 없으며 웹사이트 요소를 검사할 수 없습니다. + + 또한 이 설정은 개발자 도구 또는 자바스크립트 콘솔을 여는 단축키, 메뉴 항목, 컨텍스트 메뉴 항목의 사용을 중지합니다. + + <ph name="PRODUCT_NAME" /> 버전 99를 기준으로 이 설정은 또한 '페이지 소스 보기' 기능의 진입점을 제어합니다. 이 정책을 'DeveloperToolsDisallowed'(값 2)로 설정하면 사용자가 단축키 또는 컨텍스트 메뉴를 통해 소스 보기에 액세스할 수 없습니다. 소스 보기를 완전히 차단하려면 <ph name="URL_BLOCKLIST_POLICY_NAME" /> 정책에 'view-source:*'도 추가해야 합니다.</translation> <translation id="6132506775968708399">타사 쿠키 차단</translation> <translation id="6133088669883929098">모든 사이트에서 키 생성 사용 허용</translation> <translation id="6135398260575578389">세이프 브라우징이 강화 모드에서 활성화됩니다. 이 모드에서는 보안이 강화되지만 Google과 인터넷 사용 정보를 더 많이 공유해야 합니다.</translation>
diff --git a/components/policy/resources/policy_templates_th.xtb b/components/policy/resources/policy_templates_th.xtb index 1df0bb3..7e25097f 100644 --- a/components/policy/resources/policy_templates_th.xtb +++ b/components/policy/resources/policy_templates_th.xtb
@@ -847,6 +847,7 @@ <translation id="199764499252435679">เปิดใช้การอัปเดตคอมโพเนนต์ใน <ph name="PRODUCT_NAME" /></translation> <translation id="1998504583649140526">การตั้งค่าคำขอเครือข่ายส่วนตัว</translation> <translation id="1999000620918508488">บังคับให้หน้าจอลงชื่อเข้าใช้แสดงหรือซ่อนข้อมูลของระบบ</translation> +<translation id="2000937390924915996">ไม่เรียกใช้การทำความสะอาดดิสก์อัตโนมัติในระหว่างเข้าสู่ระบบ</translation> <translation id="2001420846508294174">การตั้งค่านโยบายนี้จะตั้งค่ากฎในการเลือกเครื่องพิมพ์เริ่มต้นใน <ph name="PRODUCT_NAME" /> โดยจะลบล้างกฎเริ่มต้น การเลือกเครื่องพิมพ์เกิดขึ้นในครั้งแรกที่ผู้ใช้พยายามจะสั่งพิมพ์ เมื่อ <ph name="PRODUCT_NAME" /> หาเครื่องพิมพ์ที่ตรงกับแอตทริบิวต์ที่ระบุ ในกรณีที่การจับคู่ไม่สมบูรณ์แบบ จะตั้งค่า <ph name="PRODUCT_NAME" /> ให้เลือกเครื่องพิมพ์ที่ตรงกันเครื่องใดก็ได้โดยขึ้นอยู่กับลำดับในการค้นพบเครื่องพิมพ์ หากไม่ตั้งค่านโยบายหรือตั้งค่าเป็นแอตทริบิวต์ที่จับคู่ไม่ได้ เครื่องพิมพ์ PDF ในตัวจะเป็นค่าเริ่มต้น หากไม่มีเครื่องพิมพ์ PDF ค่าเริ่มต้นของ <ph name="PRODUCT_NAME" /> จะเป็น "ไม่มี" @@ -917,6 +918,7 @@ <translation id="2070744136203607632">ไม่ทำการตรวจสอบการสกัดกั้น DNS</translation> <translation id="2073552873076775140">อนุญาตให้ลงชื่อเข้าใช้ <ph name="PRODUCT_NAME" /></translation> <translation id="2075732129949889165">Crostini Ansible Playbook</translation> +<translation id="2076158466157390917">ควบคุมการทำความสะอาดอัตโนมัติในระหว่างเข้าสู่ระบบ</translation> <translation id="2077129598763517140">ใช้การเร่งฮาร์ดแวร์เมื่อสามารถใช้ได้</translation> <translation id="2077273864382355561">ระยะหน่วงเวลาการปิดหน้าจอเมื่อทำงานโดยใช้พลังงานแบตเตอรี่</translation> <translation id="2082205219176343977">กำหนดค่าเวอร์ชัน Chrome ขั้นต่ำที่อุปกรณ์จะใช้ได้</translation> @@ -1817,6 +1819,7 @@ รูปแบบ URL ต้องไม่ขัดแย้งกับ <ph name="SERIAL_BLOCKED_FOR_URLS_POLICY_NAME" /> ไม่มีนโยบายที่จะมีความสำคัญสูงกว่าหาก URL ตรงกับทั้ง 2 นโยบาย ดูข้อมูลโดยละเอียดเกี่ยวกับรูปแบบ <ph name="URL_LABEL" /> ที่ถูกต้องได้ที่ https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns <ph name="WILDCARD_VALUE" /> ไม่ใช่ค่าที่ยอมรับสำหรับนโยบายนี้</translation> +<translation id="305106159605171619">การลด User Agent ปิดใช้อยู่ และไม่ได้เปิดใช้ผ่านช่วงทดลองใช้งานภาคสนามหรือช่วงทดลองใช้จากต้นทาง</translation> <translation id="3053265701996417839">Microsoft Windows 7</translation> <translation id="3064530882228745118">ใช้การค้นหา CNAME ระหว่างการตรวจสอบสิทธิ์ Kerberos</translation> <translation id="3066446511111537292">อนุญาตให้ผู้ใช้ที่เชื่อมโยงของอุปกรณ์นี้ใช้การโหลดจากแหล่งที่ไม่รู้จักของ ADB</translation> @@ -3615,6 +3618,9 @@ หากตั้งค่าเป็นจริงหรือไม่ได้กำหนดค่า ผู้ใช้รายนี้จะสามารถสร้างและจัดการผู้ใช้ภายใต้การควบคุมดูแลได้</translation> <translation id="5369937289900051171">การพิมพ์สีเท่านั้น</translation> <translation id="5370279767682621504">เปิดใช้การรองรับ HTTP/0.9 บนพอร์ตที่ไม่ใช่ค่าเริ่มต้น</translation> +<translation id="5370765433640162225">เมื่อตั้งค่านโยบายนี้เป็น "จริง" ระบบจะดำเนินการทำความสะอาดอัตโนมัติในระหว่างเข้าสู่ระบบเพื่อให้มีพื้นที่ว่างในดิสก์เพียงพอ + การทำความสะอาดจะทำงานเฉพาะเมื่อจำเป็นจริงๆ แต่จะยังคงมีผลต่อเวลาในการเข้าสู่ระบบ + การตั้งค่านโยบายเป็น "เท็จ" (ค่าเริ่มต้น) จะทำให้ไม่มีผลกระทบต่อเวลาในการเข้าสู่ระบบ</translation> <translation id="5371152055157582429">ผู้ใช้จะปรับแต่งพื้นหลังของหน้าแท็บใหม่ได้</translation> <translation id="5377606826822211923">ควบคุมการใช้แอป Android จากแหล่งที่มาที่ไม่น่าเชื่อถือสำหรับผู้ใช้แต่ละราย</translation> <translation id="5377668121137111316">การตั้งค่านโยบายเป็น "จริง" จะเปิดแป้นพิมพ์บนหน้าจอไว้ตลอด การตั้งค่านโยบายเป็น "เท็จ" จะปิดแป้นพิมพ์บนหน้าจอไว้ตลอด @@ -4276,9 +4282,15 @@ หมายเหตุ: ข้อจำกัดเหล่านี้มีผลกับการดาวน์โหลดที่ทริกเกอร์จากเนื้อหาของหน้าเว็บ รวมถึงตัวเลือกเมนู "ดาวน์โหลดลิงก์..." ด้วย โดยข้อจำกัดเหล่านี้ไม่มีผลกับการดาวน์โหลดของหน้าที่แสดงอยู่ หรือกับการบันทึกเป็น PDF จากตัวเลือกการพิมพ์ อ่านเพิ่มเติมเกี่ยวกับ Google Safe Browsing (https://developers.google.com/safe-browsing)</translation> <translation id="6123052603197028610">ไม่อนุญาตการค้นหาไปยังเซิร์ฟเวอร์ของ Google เพื่อเรียกการประทับเวลา</translation> +<translation id="6130229425991722726">การตั้งค่านโยบายเป็น 0 (ค่าเริ่มต้น) หมายความว่าคุณจะเข้าถึงเครื่องมือสำหรับนักพัฒนาซอฟต์แวร์และคอนโซล JavaScript ได้ แต่ไม่ใช่ในบริบทของส่วนขยายที่ติดตั้งโดยนโยบายระดับองค์กร การตั้งค่านโยบายเป็น 1 หมายความว่าคุณจะเข้าถึงเครื่องมือสำหรับนักพัฒนาซอฟต์แวร์และคอนโซล JavaScript ได้ในทุกบริบท ซึ่งรวมถึงส่วนขยายที่ติดตั้งโดยนโยบายระดับองค์กร การตั้งค่านโยบายเป็น 2 หมายความว่าคุณจะเข้าถึงเครื่องมือสำหรับนักพัฒนาซอฟต์แวร์ไม่ได้และตรวจสอบองค์ประกอบของเว็บไซต์ไม่ได้ + + การตั้งค่านี้ยังปิดแป้นพิมพ์ลัดและเมนูหรือรายการในเมนูตามบริบทเพื่อเปิดเครื่องมือสำหรับนักพัฒนาซอฟต์แวร์หรือคอนโซล JavaScript ด้วย + + ตั้งแต่ <ph name="PRODUCT_NAME" /> เวอร์ชัน 99 การตั้งค่านี้ยังควบคุมจุดแรกเข้าสำหรับฟีเจอร์ "ดูที่มาของหน้าเว็บ" ด้วย หากตั้งค่านโยบายนี้เป็น "DeveloperToolsDisallowed" (ค่า 2) ผู้ใช้จะเข้าถึงการดูที่มาผ่านแป้นพิมพ์ลัดหรือเมนูตามบริบทไม่ได้ หากต้องการบล็อกการดูที่มาโดยสมบูรณ์ คุณต้องเพิ่ม "view-source:*" ลงในนโยบาย <ph name="URL_BLOCKLIST_POLICY_NAME" /> ด้วย</translation> <translation id="6132506775968708399">บล็อกคุกกี้ของบุคคลที่สาม</translation> <translation id="6133088669883929098">อนุญาตให้เว็บไซต์ทั้งหมดใช้การสร้างคีย์</translation> <translation id="6135398260575578389">Google Safe Browsing ทำงานในโหมดเพิ่มประสิทธิภาพ โหมดนี้รักษาความปลอดภัยได้ดีขึ้นแต่ต้องมีการแชร์ข้อมูลการท่องเว็บกับ Google มากขึ้น</translation> +<translation id="6135552820180449830">Crosh (รองรับตั้งแต่เวอร์ชัน 99)</translation> <translation id="6138636318340561140">ตรวจสอบสถานะ Google Safe Browsing ของ URL แบบเรียลไทม์</translation> <translation id="6141402445226505817">ใช้การตรวจหาเขตเวลาคร่าวๆ ทุกครั้ง</translation> <translation id="6142501278956229253">DPI การพิมพ์ PDF แรสเตอร์</translation> @@ -5761,6 +5773,7 @@ หมายเหตุ: หากต้องการควบคุมเว็บไซต์ที่แสดง <ph name="FLASH_PLUGIN_NAME" /> ได้ โปรดดูนโยบาย <ph name="DEFAULT_PLUGINS_SETTING_POLICY_NAME" />, <ph name="PLUGINS_ALLOWED_FOR_URLS_POLICY_NAME" /> และ <ph name="PLUGINS_BLOCKED_FOR_URLS_POLICY_NAME" /></translation> <translation id="780629758750905699">อนุญาตให้มีการเพิ่มบัญชี Family Link ลงในอุปกรณ์</translation> +<translation id="7807120658089613760">กำหนดค่ากล้อง การตั้งค่าเบราว์เซอร์ การตั้งค่าระบบปฏิบัติการ ฟีเจอร์การสแกน ฟีเจอร์ในเว็บสโตร์ ฟีเจอร์ใน Canvas ฟีเจอร์การสำรวจ และฟีเจอร์ Crosh ที่จะปิดใช้</translation> <translation id="7807139251387225825">รายการของประเภทที่จะไม่รวมในการซิงค์ข้อมูล</translation> <translation id="781268256210530471">การตั้งค่าปลั๊กอิน</translation> <translation id="7814528532170362496">นโยบายนี้ควบคุมการตรวจสอบ URL แบบเรียลไทม์เพื่อระบุ URL ที่เป็นอันตราย @@ -6555,6 +6568,7 @@ <translation id="8705895771006864851">การตั้งค่านโยบายเป็น "จริง" จะเสนอฟังก์ชันแปลภาษาแก่ผู้ใช้ตามความเหมาะสมด้วยการแสดงแถบเครื่องมือแปลภาษาที่ผสานรวมอยู่ใน <ph name="PRODUCT_NAME" /> และตัวเลือกการแปลเมื่อคลิกขวาที่เมนูตามบริบท การตั้งค่านโยบายเป็น "เท็จ" จะปิดฟีเจอร์แปลภาษาในตัวทั้งหมด หากคุณตั้งค่านโยบายนี้ ผู้ใช้จะเปลี่ยนฟังก์ชันนี้ไม่ได้ การไม่ตั้งค่าจะให้ผู้ใช้เปลี่ยนการตั้งค่าได้</translation> +<translation id="8707790573162457301">เรียกใช้การทำความสะอาดดิสก์อัตโนมัติในระหว่างเข้าสู่ระบบ</translation> <translation id="8713535263782304771">ปิดใช้ Google Safe Browsing</translation> <translation id="8715885991031124968">อนุญาตกล่องโต้ตอบ JavaScript ที่เกิดจากเฟรมย่อยที่เป็นต้นทางเฟรมอื่น</translation> <translation id="8720547069538712402">อนุญาตให้ผู้ใช้เปิดใช้หรือปิดใช้การตรวจตัวสะกด</translation>
diff --git a/components/security_state/ios/BUILD.gn b/components/security_state/ios/BUILD.gn index 22149a2a..2c36d3c 100644 --- a/components/security_state/ios/BUILD.gn +++ b/components/security_state/ios/BUILD.gn
@@ -29,5 +29,6 @@ "//components/security_state/core", "//ios/web/public/security", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", ] }
diff --git a/components/sessions/BUILD.gn b/components/sessions/BUILD.gn index 463df08f..0c19868 100644 --- a/components/sessions/BUILD.gn +++ b/components/sessions/BUILD.gn
@@ -235,7 +235,10 @@ "//content/test:test_support", ] } else { - deps += [ "//ios/web/public/test" ] + deps += [ + "//ios/web/public/test", + "//ios/web/public/test:test_fixture", + ] } }
diff --git a/components/signin/ios/browser/BUILD.gn b/components/signin/ios/browser/BUILD.gn index 79715757..55fdf5b 100644 --- a/components/signin/ios/browser/BUILD.gn +++ b/components/signin/ios/browser/BUILD.gn
@@ -82,6 +82,7 @@ "//components/sync_preferences:test_support", "//ios/web", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//net:test_support", "//testing/gmock",
diff --git a/components/signin/public/base/signin_metrics.cc b/components/signin/public/base/signin_metrics.cc index 164b017..6e7403f8 100644 --- a/components/signin/public/base/signin_metrics.cc +++ b/components/signin/public/base/signin_metrics.cc
@@ -134,6 +134,7 @@ case AccessPoint::ACCESS_POINT_FORCED_SIGNIN: case AccessPoint::ACCESS_POINT_ACCOUNT_RENAMED: case AccessPoint::ACCESS_POINT_WEB_SIGNIN: + case AccessPoint::ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: NOTREACHED() << "Access point " << static_cast<int>(access_point) << " is not supposed to log signin user actions."; break; @@ -216,6 +217,7 @@ case AccessPoint::ACCESS_POINT_WEB_SIGNIN: case AccessPoint::ACCESS_POINT_SAFETY_CHECK: case AccessPoint::ACCESS_POINT_KALEIDOSCOPE: + case AccessPoint::ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: NOTREACHED() << "Signin_SigninWithDefault_From* user actions" << " are not recorded for access_point " << static_cast<int>(access_point) @@ -296,6 +298,7 @@ case AccessPoint::ACCESS_POINT_WEB_SIGNIN: case AccessPoint::ACCESS_POINT_SAFETY_CHECK: case AccessPoint::ACCESS_POINT_KALEIDOSCOPE: + case AccessPoint::ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: NOTREACHED() << "Signin_SigninNotDefault_From* user actions" << " are not recorded for access point " << static_cast<int>(access_point) @@ -380,6 +383,7 @@ case AccessPoint::ACCESS_POINT_WEB_SIGNIN: case AccessPoint::ACCESS_POINT_SAFETY_CHECK: case AccessPoint::ACCESS_POINT_KALEIDOSCOPE: + case AccessPoint::ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: // These access points do not support personalized sign-in promos, so // |Signin_SigninNewAccountNoExistingAccount_From*| user actions should // not be recorded for them. Note: To avoid bloating the sign-in APIs, the @@ -467,6 +471,7 @@ case AccessPoint::ACCESS_POINT_WEB_SIGNIN: case AccessPoint::ACCESS_POINT_SAFETY_CHECK: case AccessPoint::ACCESS_POINT_KALEIDOSCOPE: + case AccessPoint::ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: // These access points do not support personalized sign-in promos, so // |Signin_SigninNewAccountExistingAccount_From*| user actions should not // be recorded for them. Note: To avoid bloating the sign-in APIs, the @@ -880,6 +885,7 @@ case AccessPoint::ACCESS_POINT_ACCOUNT_RENAMED: case AccessPoint::ACCESS_POINT_WEB_SIGNIN: case AccessPoint::ACCESS_POINT_SAFETY_CHECK: + case AccessPoint::ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: NOTREACHED() << "Signin_Impression_From* user actions" << " are not recorded for access point " << static_cast<int>(access_point); @@ -1015,6 +1021,7 @@ case AccessPoint::ACCESS_POINT_WEB_SIGNIN: case AccessPoint::ACCESS_POINT_SAFETY_CHECK: case AccessPoint::ACCESS_POINT_KALEIDOSCOPE: + case AccessPoint::ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: NOTREACHED() << "Signin_Impression{With|WithNo}Account_From* user actions" << " are not recorded for access point " << static_cast<int>(access_point)
diff --git a/components/signin/public/base/signin_metrics.h b/components/signin/public/base/signin_metrics.h index eb4b485c..21f8683 100644 --- a/components/signin/public/base/signin_metrics.h +++ b/components/signin/public/base/signin_metrics.h
@@ -168,6 +168,9 @@ ACCESS_POINT_SAFETY_CHECK = 32, ACCESS_POINT_KALEIDOSCOPE = 33, ACCESS_POINT_ENTERPRISE_SIGNOUT_COORDINATOR = 34, + ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE = 35, + // Add values above this line with a corresponding label to the + // "SigninAccessPoint" enum in tools/metrics/histograms/enums.xml ACCESS_POINT_MAX, // This must be last. };
diff --git a/components/signin/public/base/signin_metrics_unittest.cc b/components/signin/public/base/signin_metrics_unittest.cc index 4002a43..5858139 100644 --- a/components/signin/public/base/signin_metrics_unittest.cc +++ b/components/signin/public/base/signin_metrics_unittest.cc
@@ -146,6 +146,8 @@ return "Kaleidoscope"; case AccessPoint::ACCESS_POINT_ENTERPRISE_SIGNOUT_COORDINATOR: return "EnterpriseSignoutResignSheet"; + case AccessPoint::ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: + return "SigninInterceptFirstRunExperience"; case AccessPoint::ACCESS_POINT_MAX: NOTREACHED(); return "";
diff --git a/components/strings/components_strings_az.xtb b/components/strings/components_strings_az.xtb index 9c85eee..162b43eb 100644 --- a/components/strings/components_strings_az.xtb +++ b/components/strings/components_strings_az.xtb
@@ -480,6 +480,7 @@ <translation id="2465655957518002998">Çatdırılma Üsulu seçin</translation> <translation id="2465688316154986572">Ştapel vurun</translation> <translation id="2465914000209955735">Chrome'da endirdiyiniz faylları idarə edin</translation> +<translation id="2466004615675155314">Vebdən məlumatları göstərin</translation> <translation id="2467694685043708798"><ph name="BEGIN_LINK" />Şəbəkə Diaqnostikası İşləyir<ph name="END_LINK" /></translation> <translation id="2469153820345007638">1-N sırası</translation> <translation id="2470767536994572628">Annotasiyaları redaktə etdiyiniz zaman bu sənəd bir səhifəlik görünüşə və ilkin vəziyyətinə qayıdacaq</translation> @@ -526,6 +527,7 @@ <translation id="2609632851001447353">Variasiyalar</translation> <translation id="2610561535971892504">Kopyalamaq üçün klikləyin</translation> <translation id="2618023639789766142">C10 (Zərf)</translation> +<translation id="2623663032199728144">Ekranlarınız haqqında məlumatdan istifadə etməyi istəyə bilər</translation> <translation id="2625385379895617796">Saatınız irəlidədir</translation> <translation id="262745152991669301">Saytlar USB cihazlarına qoşulmaq icazəsi istəyə bilər</translation> <translation id="2629325967560697240">Chrome'un ən yüksək təhlükəsizlik səviyyəsini əldə etmək üçün<ph name="BEGIN_ENHANCED_PROTECTION_LINK" />genişləndirilmiş qorumanı aktiv edin<ph name="END_ENHANCED_PROTECTION_LINK" /></translation> @@ -684,6 +686,7 @@ <translation id="3197136577151645743">Saytlar bu cihazdan nə vaxt aktiv istifadə etdiyinizi öyrənmək üçün icazə istəyə bilər</translation> <translation id="3202497928925179914"><ph name="MANAGE_SYNC_FOCUSED_FRIENDLY_MATCH_TEXT" />, Chrome ayarlarında sinxronlaşdırdığınız məlumatları idarə etmək üçün Tab, sonra Enter düyməsinə basın</translation> <translation id="320323717674993345">Ödənişi ləğv edin</translation> +<translation id="3203366800380907218">Vebdən</translation> <translation id="3207960819495026254">Əlfəcinlənib</translation> <translation id="3209034400446768650">Səhifədə pul çıxıla bilər</translation> <translation id="3212581601480735796"><ph name="HOSTNAME" /> hostundakı fəaliyyətinizə nəzarət edilir</translation> @@ -2353,6 +2356,7 @@ <translation id="865032292777205197">hərəkət sensorları</translation> <translation id="8663226718884576429">Sifarişin Yekunu, <ph name="TOTAL_LABEL" />, Daha Çox Məlumat</translation> <translation id="8666678546361132282">Ingilis</translation> +<translation id="8669306706049782872">Pəncərələri açmaq və yerləşdirmək üçün ekranlarınız haqqında məlumatdan istifadə edin</translation> <translation id="867224526087042813">İmza</translation> <translation id="8676424191133491403">Gecikmə yoxdur</translation> <translation id="8680536109547170164"><ph name="QUERY" />, cavab, <ph name="ANSWER" /></translation>
diff --git a/components/strings/components_strings_bs.xtb b/components/strings/components_strings_bs.xtb index e38d68f..4ea0405 100644 --- a/components/strings/components_strings_bs.xtb +++ b/components/strings/components_strings_bs.xtb
@@ -480,7 +480,7 @@ <translation id="2465655957518002998">Odaberi način isporuke</translation> <translation id="2465688316154986572">Spajanje</translation> <translation id="2465914000209955735">Upravljajte fajlovima koje ste preuzeli u Chromeu</translation> -<translation id="2466004615675155314">Prikaži informacije s weba</translation> +<translation id="2466004615675155314">Pogledajte informacije s interneta</translation> <translation id="2467694685043708798"><ph name="BEGIN_LINK" />Pokrenuti dijagnostiku mreže<ph name="END_LINK" /></translation> <translation id="2469153820345007638">Redoslijed od 1 do N</translation> <translation id="2470767536994572628">Kada uredite bilješke, ovaj dokument će se vratiti na prikaz na jednoj stranici i na svoju izvornu rotaciju</translation> @@ -688,7 +688,7 @@ <translation id="3197136577151645743">Može tražiti da zna kada aktivno koristite ovaj uređaj</translation> <translation id="3202497928925179914"><ph name="MANAGE_SYNC_FOCUSED_FRIENDLY_MATCH_TEXT" />, pritisnite Tab, a zatim Enter da upravljate time koje ćete informacije sinhronizirati u postavkama Chromea</translation> <translation id="320323717674993345">Otkaži plaćanje</translation> -<translation id="3203366800380907218">S weba</translation> +<translation id="3203366800380907218">S interneta</translation> <translation id="3207960819495026254">Označeno</translation> <translation id="3209034400446768650">Stranica se možda naplaćuje</translation> <translation id="3212581601480735796">Vaša aktivnost na <ph name="HOSTNAME" /> je pod nadzorom</translation>
diff --git a/components/strings/components_strings_ja.xtb b/components/strings/components_strings_ja.xtb index 9d9c2b5e..f2190a9 100644 --- a/components/strings/components_strings_ja.xtb +++ b/components/strings/components_strings_ja.xtb
@@ -522,6 +522,7 @@ <translation id="2609632851001447353">バリエーション</translation> <translation id="2610561535971892504">クリックしてコピー</translation> <translation id="2618023639789766142">C10(封筒)</translation> +<translation id="2623663032199728144">画面に関する情報の使用を要求できる</translation> <translation id="2625385379895617796">時計が進んでいます</translation> <translation id="262745152991669301">USB デバイスへの接続を要求できる</translation> <translation id="2629325967560697240">Chrome の最高レベルのセキュリティで保護するには、<ph name="BEGIN_ENHANCED_PROTECTION_LINK" />保護強化機能を有効にしてください<ph name="END_ENHANCED_PROTECTION_LINK" />。</translation> @@ -2350,6 +2351,7 @@ <translation id="865032292777205197">モーション センサー</translation> <translation id="8663226718884576429">ご注文の概要、<ph name="TOTAL_LABEL" />、その他の詳細</translation> <translation id="8666678546361132282">英語</translation> +<translation id="8669306706049782872">画面に関する情報を基にウィンドウを開いて配置する</translation> <translation id="867224526087042813">署名</translation> <translation id="8676424191133491403">今すぐ</translation> <translation id="8680536109547170164">「<ph name="QUERY" />」に対する答え: 「<ph name="ANSWER" />」</translation>
diff --git a/components/strings/components_strings_ka.xtb b/components/strings/components_strings_ka.xtb index 1a93fa0..d24b258 100644 --- a/components/strings/components_strings_ka.xtb +++ b/components/strings/components_strings_ka.xtb
@@ -476,6 +476,7 @@ <translation id="2465655957518002998">მიწოდების მეთოდის არჩევა</translation> <translation id="2465688316154986572">დასტეპლერება</translation> <translation id="2465914000209955735">Chrome-ის მეშვეობით ჩამოტვირთული ფაილების მართვა</translation> +<translation id="2466004615675155314">ინფორმაციის ჩვენება ვებიდან</translation> <translation id="2467694685043708798"><ph name="BEGIN_LINK" />ქსელის დიაგნოსტიკის ხელსაწყოს გაშვება<ph name="END_LINK" /></translation> <translation id="2469153820345007638">მიმდევრობა 1-დან N-მდე</translation> <translation id="2470767536994572628">ანოტაციების რედაქტირებისას ეს დოკუმენტი დაბრუნდება ერთგვერდიან ხედზე და შეტრიალდება თავდაპირველი ვერსიის მიხედვით</translation> @@ -683,6 +684,7 @@ <translation id="3197136577151645743">შეუძლია ითხოვოს, რომ გაიგოს, როდის იყენებთ აქტიურად ამ მოწყობილობას</translation> <translation id="3202497928925179914"><ph name="MANAGE_SYNC_FOCUSED_FRIENDLY_MATCH_TEXT" />, თქვენ მიერ სინქრონიზებული ინფორმაციის Chrome-ის პარამეტრებიდან სამართავად დააჭირეთ კლავიშს Tab, შემდეგ კი Enter-ს</translation> <translation id="320323717674993345">გადახდის გაუქმება</translation> +<translation id="3203366800380907218">ვებიდან</translation> <translation id="3207960819495026254">ჩანიშნულია</translation> <translation id="3209034400446768650">გვერდმა შეიძლება დაგაკისროთ თანხის გადახდა</translation> <translation id="3212581601480735796"><ph name="HOSTNAME" />-ზე თქვენი აქტივობა მონიტორინგის ქვეშაა</translation>
diff --git a/components/strings/components_strings_ko.xtb b/components/strings/components_strings_ko.xtb index aabced9..cd63e80 100644 --- a/components/strings/components_strings_ko.xtb +++ b/components/strings/components_strings_ko.xtb
@@ -522,6 +522,7 @@ <translation id="2609632851001447353">유사 버전</translation> <translation id="2610561535971892504">클릭하여 복사</translation> <translation id="2618023639789766142">C10(봉투)</translation> +<translation id="2623663032199728144">화면에 관한 정보 사용을 요청할 수 있음</translation> <translation id="2625385379895617796">시간이 너무 먼 미래로 설정되어 있습니다.</translation> <translation id="262745152991669301">USB 기기에 연결하도록 요청할 수 있음</translation> <translation id="2629325967560697240">Chrome에서 가장 강력한 보안 기능을 사용하려면 <ph name="BEGIN_ENHANCED_PROTECTION_LINK" />향상된 보호 모드를 사용 설정<ph name="END_ENHANCED_PROTECTION_LINK" />하세요.</translation> @@ -2348,6 +2349,7 @@ <translation id="865032292777205197">움직임 감지 센서</translation> <translation id="8663226718884576429">주문 요약, <ph name="TOTAL_LABEL" />, 세부정보 더보기</translation> <translation id="8666678546361132282">영어</translation> +<translation id="8669306706049782872">화면에 관한 정보를 사용하여 창을 열고 배치합니다.</translation> <translation id="867224526087042813">서명</translation> <translation id="8676424191133491403">지연 없음</translation> <translation id="8680536109547170164"><ph name="QUERY" />, 답변, <ph name="ANSWER" /></translation>
diff --git a/components/strings/components_strings_my.xtb b/components/strings/components_strings_my.xtb index 4373f4ba..f157f4c 100644 --- a/components/strings/components_strings_my.xtb +++ b/components/strings/components_strings_my.xtb
@@ -531,6 +531,7 @@ <translation id="2609632851001447353">မူကွဲများ</translation> <translation id="2610561535971892504">မိတ္တူကူးရန် နှိပ်ပါ</translation> <translation id="2618023639789766142">C10 (စာအိတ်)</translation> +<translation id="2623663032199728144">သင့်ဖန်သားပြင်အချက်အလက်ကို သုံးရန် ခွင့်တောင်းနိုင်သည်</translation> <translation id="2625385379895617796">သင်၏ နာရီမှာ စောနေ</translation> <translation id="262745152991669301">USB ကိရိယာများနှင့် ချိတ်ဆက်ရန် ခွင့်တောင်းနိုင်သည်</translation> <translation id="2629325967560697240">Chrome ၏ အမြင့်ဆုံးလုံခြုံရေး ရရှိရန် <ph name="BEGIN_ENHANCED_PROTECTION_LINK" />အဆင့်မြှင့်တင်ထားသော ကာကွယ်မှုကို ဖွင့်ပါ<ph name="END_ENHANCED_PROTECTION_LINK" /></translation> @@ -2360,6 +2361,7 @@ <translation id="865032292777205197">လှုပ်ရှားမှု အာရုံခံစနစ်များ</translation> <translation id="8663226718884576429">မှာယူမှု အနှစ်ချုပ်၊ <ph name="TOTAL_LABEL" />၊ နောက်ထပ် အသေးစိတ်အချက်အလက်များ</translation> <translation id="8666678546361132282">အင်္ဂလိပ်</translation> +<translation id="8669306706049782872">ဝင်းဒိုးများဖွင့်ပြီး နေရာချထားရန် သင့်ဖန်သားပြင်အချက်အလက်ကို အသုံးပြုခြင်း</translation> <translation id="867224526087042813">လက်မှတ်</translation> <translation id="8676424191133491403">မနှောင့်နှေးရ</translation> <translation id="8680536109547170164"><ph name="QUERY" /> ဖြေကြားပါ၊ <ph name="ANSWER" /></translation>
diff --git a/components/strings/components_strings_si.xtb b/components/strings/components_strings_si.xtb index 45263ca..530cdcf 100644 --- a/components/strings/components_strings_si.xtb +++ b/components/strings/components_strings_si.xtb
@@ -480,6 +480,7 @@ <translation id="2465655957518002998">බෙදා හැරීමේ ක්රමය තෝරාගන්න</translation> <translation id="2465688316154986572">ස්ටේපල්</translation> <translation id="2465914000209955735">Chrome තුළ ඔබ බාගෙන ඇති ගොනු කළමනාකරණය කරන්න</translation> +<translation id="2466004615675155314">වෙබය වෙතින් තොරතුරු පෙන්වන්න</translation> <translation id="2467694685043708798"><ph name="BEGIN_LINK" />ජාල දෝෂහරණ ධාවනය කරමින්<ph name="END_LINK" /></translation> <translation id="2469153820345007638">1-සිට-N පිළිවෙළ</translation> <translation id="2470767536994572628">ඔබ අනුසටහන් සංස්කරණය කරන විට, මෙම ලේඛනය තනි පිටු දසුනකට සහ එහි මුල් කරකැවීමට ආපසු යනු ඇත</translation> @@ -686,6 +687,7 @@ <translation id="3197136577151645743">ඔබ මෙම උපාංගය සක්රියව භාවිත කරන අවස්ථාව දැන ගැනීමට ඉල්ලිය හැකිය</translation> <translation id="3202497928925179914"><ph name="MANAGE_SYNC_FOCUSED_FRIENDLY_MATCH_TEXT" />, Chrome සැකසීම් තුළ ඔබ සමමුහුර්ත කරන තොරතුරු කළමනාකරණය කිරීමට Tab ඔබා අනතුරුව Enter ඔබන්න</translation> <translation id="320323717674993345">ගෙවීම අවලංගු කරන්න</translation> +<translation id="3203366800380907218">වෙබය වෙතින්</translation> <translation id="3207960819495026254">පිටුසලකුණු කළ</translation> <translation id="3209034400446768650">පිටුවට මුදල් අය කළ හැකිය</translation> <translation id="3212581601480735796"><ph name="HOSTNAME" /> මත ඔබේ ක්රියාකාරකම නිරීක්ෂණ කෙරේ</translation>
diff --git a/components/strings/components_strings_th.xtb b/components/strings/components_strings_th.xtb index 9a0c25d..f60e80b 100644 --- a/components/strings/components_strings_th.xtb +++ b/components/strings/components_strings_th.xtb
@@ -476,6 +476,7 @@ <translation id="2465655957518002998">เลือกวิธีนำส่งสินค้า</translation> <translation id="2465688316154986572">เย็บด้วยลวดเย็บกระดาษ</translation> <translation id="2465914000209955735">จัดการไฟล์ที่คุณดาวน์โหลดใน Chrome</translation> +<translation id="2466004615675155314">แสดงข้อมูลจากเว็บ</translation> <translation id="2467694685043708798"><ph name="BEGIN_LINK" />เรียกใช้การวินิจฉัยเครือข่าย<ph name="END_LINK" /></translation> <translation id="2469153820345007638">ลำดับ 1 ถึง N</translation> <translation id="2470767536994572628">เมื่อคุณแก้ไขคำอธิบายประกอบ เอกสารนี้จะกลับไปเป็นมุมมองแบบหน้าเดียวและกลับไปใช้การหมุนแบบเดิม</translation> @@ -522,6 +523,7 @@ <translation id="2609632851001447353">รูปแบบต่างๆ</translation> <translation id="2610561535971892504">คลิกเพื่อคัดลอก</translation> <translation id="2618023639789766142">C10 (ซองจดหมาย)</translation> +<translation id="2623663032199728144">สามารถขอใช้ข้อมูลเกี่ยวกับหน้าจอได้</translation> <translation id="2625385379895617796">นาฬิกาเร็วเกินไป</translation> <translation id="262745152991669301">สามารถขอเชื่อมต่อกับอุปกรณ์ USB ได้</translation> <translation id="2629325967560697240"><ph name="BEGIN_ENHANCED_PROTECTION_LINK" />เปิดการปกป้องที่ปรับปรุงแล้ว<ph name="END_ENHANCED_PROTECTION_LINK" />เพื่อให้ Chrome รักษาความปลอดภัยในระดับสูงสุด</translation> @@ -682,6 +684,7 @@ <translation id="3197136577151645743">สามารถขอทราบเวลาที่คุณใช้งานอุปกรณ์อยู่ได้</translation> <translation id="3202497928925179914"><ph name="MANAGE_SYNC_FOCUSED_FRIENDLY_MATCH_TEXT" /> กด Tab ตามด้วย Enter เพื่อจัดการข้อมูลที่คุณซิงค์ในการตั้งค่า Chrome</translation> <translation id="320323717674993345">ยกเลิกการชำระเงิน</translation> +<translation id="3203366800380907218">จากเว็บ</translation> <translation id="3207960819495026254">บุ๊กมาร์กแล้ว</translation> <translation id="3209034400446768650">อาจมีการเรียกเก็บเงินในหน้านี้</translation> <translation id="3212581601480735796">มีการตรวจสอบกิจกรรมที่คุณทำใน <ph name="HOSTNAME" /></translation> @@ -2349,6 +2352,7 @@ <translation id="865032292777205197">เซ็นเซอร์ตรวจจับการเคลื่อนไหว</translation> <translation id="8663226718884576429">สรุปคำสั่งซื้อ <ph name="TOTAL_LABEL" /> รายละเอียดเพิ่มเติม</translation> <translation id="8666678546361132282">อังกฤษ</translation> +<translation id="8669306706049782872">ใช้ข้อมูลเกี่ยวกับหน้าจอเพื่อเปิดและวางหน้าต่าง</translation> <translation id="867224526087042813">ลายเซ็น</translation> <translation id="8676424191133491403">ไม่หน่วงเวลา</translation> <translation id="8680536109547170164"><ph name="QUERY" />, คำตอบ, <ph name="ANSWER" /></translation>
diff --git a/components/strings/components_strings_zh-HK.xtb b/components/strings/components_strings_zh-HK.xtb index 1122c7e..6867494f 100644 --- a/components/strings/components_strings_zh-HK.xtb +++ b/components/strings/components_strings_zh-HK.xtb
@@ -523,7 +523,7 @@ <translation id="2609632851001447353">變化</translation> <translation id="2610561535971892504">點擊複製</translation> <translation id="2618023639789766142">C10 (信封)</translation> -<translation id="2623663032199728144">可以要求使用畫面中的資訊</translation> +<translation id="2623663032199728144">可要求使用螢幕中的資料</translation> <translation id="2625385379895617796">您時鐘的時間過快</translation> <translation id="262745152991669301">可要求連接 USB 裝置</translation> <translation id="2629325967560697240">如要獲得 Chrome 最高程度的安全防護,請<ph name="BEGIN_ENHANCED_PROTECTION_LINK" />啟用強化保護功能<ph name="END_ENHANCED_PROTECTION_LINK" /></translation> @@ -2351,7 +2351,7 @@ <translation id="865032292777205197">動作感應器</translation> <translation id="8663226718884576429">訂單摘要、<ph name="TOTAL_LABEL" /> 及更多詳情</translation> <translation id="8666678546361132282">英文</translation> -<translation id="8669306706049782872">使用畫面中的資訊開啟及放置視窗</translation> +<translation id="8669306706049782872">使用螢幕中的資料開啟及放置視窗</translation> <translation id="867224526087042813">簽名</translation> <translation id="8676424191133491403">不延遲</translation> <translation id="8680536109547170164"><ph name="QUERY" />,答案:<ph name="ANSWER" /></translation>
diff --git a/components/sync/driver/sync_service_impl.cc b/components/sync/driver/sync_service_impl.cc index 019eb6ac..d685d46 100644 --- a/components/sync/driver/sync_service_impl.cc +++ b/components/sync/driver/sync_service_impl.cc
@@ -1417,6 +1417,7 @@ // Sync is no longer disabled by policy. Try starting it up if appropriate. DCHECK(!engine_); startup_controller_->TryStart(/*force_immediate=*/true); + NotifyObservers(); } }
diff --git a/components/translate/ios/browser/BUILD.gn b/components/translate/ios/browser/BUILD.gn index eae2942f..17a5101e 100644 --- a/components/translate/ios/browser/BUILD.gn +++ b/components/translate/ios/browser/BUILD.gn
@@ -66,6 +66,7 @@ "//components/language/ios/browser", "//components/resources", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//testing/gtest", "//ui/base", "//url",
diff --git a/components/ukm/ios/BUILD.gn b/components/ukm/ios/BUILD.gn index 65d1cd47..c027e845 100644 --- a/components/ukm/ios/BUILD.gn +++ b/components/ukm/ios/BUILD.gn
@@ -43,6 +43,7 @@ "//components/ukm:test_support", "//ios/web/public", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//net:test_support", "//services/metrics/public/cpp:metrics_cpp", "//testing/gtest",
diff --git a/components/viz/test/test_in_process_context_provider.cc b/components/viz/test/test_in_process_context_provider.cc index 1302e48..8969821 100644 --- a/components/viz/test/test_in_process_context_provider.cc +++ b/components/viz/test/test_in_process_context_provider.cc
@@ -106,13 +106,13 @@ } gpu::ContextResult TestInProcessContextProvider::BindToCurrentThread() { - if (raster_interface_type_ == RasterInterfaceType::GPU || + if (raster_interface_type_ == RasterInterfaceType::OOPR || raster_interface_type_ == RasterInterfaceType::Software) { DCHECK(!enable_gles2_interface_); gpu::ContextCreationAttribs attribs; attribs.bind_generates_resource = false; attribs.enable_oop_rasterization = - raster_interface_type_ == RasterInterfaceType::GPU; + raster_interface_type_ == RasterInterfaceType::OOPR; attribs.enable_raster_interface = true; attribs.enable_gles2_interface = false; @@ -130,7 +130,7 @@ base::ThreadTaskRunnerHandle::Get()); caps_ = raster_context_->GetCapabilities(); - } else if (raster_interface_type_ == RasterInterfaceType::LEGACY_GPU || + } else if (raster_interface_type_ == RasterInterfaceType::GPU || enable_gles2_interface_) { display_controller_ = std::make_unique<DisplayCompositorMemoryAndTaskController>( @@ -144,7 +144,7 @@ cache_controller_ = std::make_unique<ContextCacheController>( gles2_context_->GetImplementation(), base::ThreadTaskRunnerHandle::Get()); - if (raster_interface_type_ == RasterInterfaceType::LEGACY_GPU) { + if (raster_interface_type_ == RasterInterfaceType::GPU) { raster_implementation_gles2_ = std::make_unique<gpu::raster::RasterImplementationGLES>( gles2_context_->GetImplementation(), ContextSupport()); @@ -157,8 +157,8 @@ // service will return for this capability. But we want to use gpu // rasterization if and only if the test requests it. caps_.gpu_rasterization = - raster_interface_type_ == RasterInterfaceType::LEGACY_GPU || - raster_interface_type_ == RasterInterfaceType::GPU; + raster_interface_type_ == RasterInterfaceType::GPU || + raster_interface_type_ == RasterInterfaceType::OOPR; cache_controller_->SetLock(GetLock()); return gpu::ContextResult::kSuccess;
diff --git a/components/viz/test/test_in_process_context_provider.h b/components/viz/test/test_in_process_context_provider.h index c9938cb16..2d1e8ba8 100644 --- a/components/viz/test/test_in_process_context_provider.h +++ b/components/viz/test/test_in_process_context_provider.h
@@ -39,7 +39,7 @@ std::unique_ptr<gpu::GLInProcessContext> CreateTestInProcessContext(); -enum RasterInterfaceType { None, Software, LEGACY_GPU, GPU }; +enum RasterInterfaceType { None, Software, GPU, OOPR }; class TestInProcessContextProvider : public base::RefCountedThreadSafe<TestInProcessContextProvider>,
diff --git a/content/browser/attribution_reporting/storable_trigger.h b/content/browser/attribution_reporting/storable_trigger.h index 6899ed7..3655cb03 100644 --- a/content/browser/attribution_reporting/storable_trigger.h +++ b/content/browser/attribution_reporting/storable_trigger.h
@@ -34,23 +34,23 @@ StorableTrigger& operator=(StorableTrigger&& other); ~StorableTrigger(); - [[nodiscard]] uint64_t trigger_data() const { return trigger_data_; } + uint64_t trigger_data() const { return trigger_data_; } - [[nodiscard]] const net::SchemefulSite& conversion_destination() const { + const net::SchemefulSite& conversion_destination() const { return conversion_destination_; } - [[nodiscard]] const url::Origin& reporting_origin() const { + const url::Origin& reporting_origin() const { return reporting_origin_; } - [[nodiscard]] uint64_t event_source_trigger_data() const { + uint64_t event_source_trigger_data() const { return event_source_trigger_data_; } - [[nodiscard]] int64_t priority() const { return priority_; } + int64_t priority() const { return priority_; } - [[nodiscard]] const absl::optional<int64_t>& dedup_key() const { + const absl::optional<int64_t>& dedup_key() const { return dedup_key_; }
diff --git a/content/browser/back_forward_cache_internal_browsertest.cc b/content/browser/back_forward_cache_internal_browsertest.cc index aa02d44c..26077b08 100644 --- a/content/browser/back_forward_cache_internal_browsertest.cc +++ b/content/browser/back_forward_cache_internal_browsertest.cc
@@ -22,7 +22,6 @@ #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test_utils.h" #include "content/public/test/mock_web_contents_observer.h" -#include "content/public/test/test_navigation_observer.h" #include "content/public/test/test_utils.h" #include "content/shell/browser/shell.h" #include "content/shell/browser/shell_content_browser_client.h" @@ -3407,17 +3406,7 @@ // 2) Navigate to B, and inject a blank subframe just before it commits. { InjectCreateChildFrame injector(shell()->web_contents(), url_b); - - TestNavigationObserver navigation_observer(shell()->web_contents(), 1); - navigation_observer.set_expected_initial_url(url_b); - shell()->LoadURL(url_b); - - // Waiting for DidNavigationFinished is sufficient to ensure that - // `injector.was_called()`. We can't waiting for DidStopLoading, because - // running a nested message loop in the injector confuses - // TestNavigationObserver by changing the order of notifications. - navigation_observer.WaitForNavigationFinished(); - + ASSERT_TRUE(NavigateToURL(shell(), url_b)); EXPECT_TRUE(injector.was_called()); }
diff --git a/content/browser/launch_as_mojo_client_browsertest.cc b/content/browser/launch_as_mojo_client_browsertest.cc index d085371..496c7fb6 100644 --- a/content/browser/launch_as_mojo_client_browsertest.cc +++ b/content/browser/launch_as_mojo_client_browsertest.cc
@@ -77,7 +77,9 @@ #if BUILDFLAG(IS_CHROMEOS_ASH) command_line.AppendSwitchASCII(switches::kUseGL, - gl::kGLImplementationSwiftShaderName); + gl::kGLImplementationANGLEName); + command_line.AppendSwitchASCII(switches::kUseANGLE, + gl::kANGLEImplementationSwiftShaderName); #endif return command_line; }
diff --git a/content/browser/network_context_client_base_impl.cc b/content/browser/network_context_client_base_impl.cc index 9a7c0d1..def773f 100644 --- a/content/browser/network_context_client_base_impl.cc +++ b/content/browser/network_context_client_base_impl.cc
@@ -115,7 +115,7 @@ } #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void NetworkContextClientBase::OnTrustAnchorUsed() {} #endif
diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index b116b1f7..cbc416b 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc
@@ -2068,7 +2068,7 @@ } #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void StoragePartitionImpl::OnTrustAnchorUsed() { GetContentClient()->browser()->OnTrustAnchorUsed(browser_context_); }
diff --git a/content/browser/storage_partition_impl.h b/content/browser/storage_partition_impl.h index 5838473..4f3ba3c 100644 --- a/content/browser/storage_partition_impl.h +++ b/content/browser/storage_partition_impl.h
@@ -275,7 +275,7 @@ const std::string& spn, OnGenerateHttpNegotiateAuthTokenCallback callback) override; #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void OnTrustAnchorUsed() override; #endif void OnTrustTokenIssuanceDivertedToSystem(
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h index c6abdaf1..2b8a84d3 100644 --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h
@@ -827,7 +827,7 @@ const url::Origin* conversion_origin, const url::Origin* reporting_origin); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) // Notification that a trust anchor was used by the given user. virtual void OnTrustAnchorUsed(BrowserContext* browser_context) {} #endif
diff --git a/content/public/browser/network_context_client_base.h b/content/public/browser/network_context_client_base.h index 76c973e..2480f128 100644 --- a/content/public/browser/network_context_client_base.h +++ b/content/public/browser/network_context_client_base.h
@@ -41,7 +41,7 @@ const std::string& spn, OnGenerateHttpNegotiateAuthTokenCallback callback) override; #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void OnTrustAnchorUsed() override; #endif void OnTrustTokenIssuanceDivertedToSystem(
diff --git a/content/public/test/test_navigation_observer.cc b/content/public/test/test_navigation_observer.cc index eab992b..355a54d 100644 --- a/content/public/test/test_navigation_observer.cc +++ b/content/public/test/test_navigation_observer.cc
@@ -321,7 +321,7 @@ // Find the real URL being navigated to (e.g. stripping the "view-source:" // prefix if necessary). - GURL expected_url = *expected_initial_url_; + GURL expected_url = navigation_request->GetOriginalRequestURL(); BrowserContext* browser_context = navigation_request->frame_tree_node() ->navigator() .controller()
diff --git a/extensions/browser/extension_api_frame_id_map.cc b/extensions/browser/extension_api_frame_id_map.cc index 6f7f87c..ff798a2 100644 --- a/extensions/browser/extension_api_frame_id_map.cc +++ b/extensions/browser/extension_api_frame_id_map.cc
@@ -43,11 +43,13 @@ ExtensionApiFrameIdMap::FrameData::FrameData(int frame_id, int parent_frame_id, int tab_id, - int window_id) + int window_id, + const DocumentId& document_id) : frame_id(frame_id), parent_frame_id(parent_frame_id), tab_id(tab_id), - window_id(window_id) {} + window_id(window_id), + document_id(document_id) {} ExtensionApiFrameIdMap::FrameData::~FrameData() = default; @@ -145,7 +147,8 @@ ExtensionsBrowserClient::Get()->GetTabAndWindowIdForWebContents( content::WebContents::FromRenderFrameHost(rfh), &tab_id, &window_id); } - return FrameData(GetFrameId(rfh), GetParentFrameId(rfh), tab_id, window_id); + return FrameData(GetFrameId(rfh), GetParentFrameId(rfh), tab_id, window_id, + GetDocumentId(rfh)); } ExtensionApiFrameIdMap::FrameData ExtensionApiFrameIdMap::GetFrameData( @@ -158,6 +161,27 @@ return KeyToValue(rfh_id, true /* require_live_frame */); } +ExtensionApiFrameIdMap::DocumentId ExtensionApiFrameIdMap::GetDocumentId( + content::RenderFrameHost* rfh) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + DCHECK(rfh); + return ExtensionDocumentUserData::GetOrCreateForCurrentDocument(rfh) + ->document_id(); +} + +ExtensionApiFrameIdMap::DocumentId ExtensionApiFrameIdMap::GetDocumentId( + content::NavigationHandle* navigation_handle) { + // We can only access NavigationHandle::GetRenderFrameHost if the navigation + // handle has committed or is waiting to commit. This is fine because + // otherwise the documentId is useless as it will point at the old + // document. + if (navigation_handle->IsWaitingToCommit() || + navigation_handle->HasCommitted()) { + return GetDocumentId(navigation_handle->GetRenderFrameHost()); + } + return DocumentId(); +} + void ExtensionApiFrameIdMap::OnRenderFrameDeleted( content::RenderFrameHost* rfh) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); @@ -179,4 +203,14 @@ base::Unretained(this), key)); } +ExtensionApiFrameIdMap::ExtensionDocumentUserData::ExtensionDocumentUserData( + content::RenderFrameHost* render_frame_host) + : content::DocumentUserData<ExtensionDocumentUserData>(render_frame_host), + document_id_(DocumentId::Create()) {} + +ExtensionApiFrameIdMap::ExtensionDocumentUserData:: + ~ExtensionDocumentUserData() = default; + +DOCUMENT_USER_DATA_KEY_IMPL(ExtensionApiFrameIdMap::ExtensionDocumentUserData); + } // namespace extensions
diff --git a/extensions/browser/extension_api_frame_id_map.h b/extensions/browser/extension_api_frame_id_map.h index 84fbfbd..a89255a 100644 --- a/extensions/browser/extension_api_frame_id_map.h +++ b/extensions/browser/extension_api_frame_id_map.h
@@ -10,6 +10,8 @@ #include <set> #include "base/lazy_instance.h" +#include "base/unguessable_token.h" +#include "content/public/browser/document_user_data.h" #include "content/public/browser/global_routing_id.h" namespace content { @@ -40,11 +42,17 @@ // The non-static methods of this class use an internal cache. class ExtensionApiFrameIdMap { public: + using DocumentId = base::UnguessableToken; + // The data for a RenderFrame. Every GlobalRenderFrameHostId maps to a // FrameData. struct FrameData { FrameData(); - FrameData(int frame_id, int parent_frame_id, int tab_id, int window_id); + FrameData(int frame_id, + int parent_frame_id, + int tab_id, + int window_id, + const DocumentId& document_id); ~FrameData(); FrameData(const FrameData&); @@ -63,6 +71,9 @@ // The id of the window that the frame is in, or -1 if the frame isn't in a // window. int window_id; + + // The extennsion API document ID of the document in the frame. + DocumentId document_id; }; // An invalid extension API frame ID. @@ -88,6 +99,12 @@ // Get the extension API frame ID for the parent of |navigation_handle|. static int GetParentFrameId(content::NavigationHandle* navigation_handle); + // Get the extension API document ID for the current document of |rfh|. + static DocumentId GetDocumentId(content::RenderFrameHost* rfh); + + // Get the extension API document ID for the document of |navigation_handle|. + static DocumentId GetDocumentId(content::NavigationHandle* navigation_handle); + // Find the current RenderFrameHost for a given WebContents and extension // frame ID. // Returns nullptr if not found. @@ -105,6 +122,21 @@ protected: friend struct base::LazyInstanceTraitsBase<ExtensionApiFrameIdMap>; + class ExtensionDocumentUserData + : public content::DocumentUserData<ExtensionDocumentUserData> { + public: + explicit ExtensionDocumentUserData( + content::RenderFrameHost* render_frame_host); + ~ExtensionDocumentUserData() override; + + const DocumentId& document_id() const { return document_id_; } + + private: + friend content::DocumentUserData<ExtensionDocumentUserData>; + DOCUMENT_USER_DATA_KEY_DECL(); + + DocumentId document_id_; + }; ExtensionApiFrameIdMap(); ~ExtensionApiFrameIdMap();
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index 6e276e1..28a650d 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h
@@ -1674,6 +1674,7 @@ WEB_AUTHENTICATION_PROXY_COMPLETE_CREATE_REQUEST = 1611, DEVELOPERPRIVATE_GETUSERSITESETTINGS = 1612, ACTION_OPENPOPUP = 1613, + OS_TELEMETRY_GETCPUINFO = 1614, // Last entry: Add new entries above, then run: // python tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY
diff --git a/extensions/browser/extension_navigation_ui_data.cc b/extensions/browser/extension_navigation_ui_data.cc index d69a9fd..c4e0a33 100644 --- a/extensions/browser/extension_navigation_ui_data.cc +++ b/extensions/browser/extension_navigation_ui_data.cc
@@ -36,8 +36,8 @@ window_id, ExtensionApiFrameIdMap::GetFrameId(navigation_handle), ExtensionApiFrameIdMap::GetParentFrameId(navigation_handle), - GetFrameRoutingId( - navigation_handle->GetParentFrameOrOuterDocument())) { + GetFrameRoutingId(navigation_handle->GetParentFrameOrOuterDocument()), + ExtensionApiFrameIdMap::GetDocumentId(navigation_handle)) { // TODO(clamy): See if it would be possible to have just one source for the // FrameData that works both for navigations and subresources loads. } @@ -52,7 +52,8 @@ window_id, ExtensionApiFrameIdMap::GetFrameId(frame_host), ExtensionApiFrameIdMap::GetParentFrameId(frame_host), - GetFrameRoutingId(frame_host->GetParentOrOuterDocument())) {} + GetFrameRoutingId(frame_host->GetParentOrOuterDocument()), + ExtensionApiFrameIdMap::GetDocumentId(frame_host)) {} // static std::unique_ptr<ExtensionNavigationUIData> @@ -63,7 +64,8 @@ return base::WrapUnique(new ExtensionNavigationUIData( web_contents, tab_id, window_id, ExtensionApiFrameIdMap::kTopFrameId, ExtensionApiFrameIdMap::kInvalidFrameId, - content::GlobalRenderFrameHostId())); + content::GlobalRenderFrameHostId(), + ExtensionApiFrameIdMap::GetDocumentId(web_contents->GetMainFrame()))); } std::unique_ptr<ExtensionNavigationUIData> ExtensionNavigationUIData::DeepCopy() @@ -83,8 +85,9 @@ int window_id, int frame_id, int parent_frame_id, - content::GlobalRenderFrameHostId parent_routing_id) - : frame_data_(frame_id, parent_frame_id, tab_id, window_id), + content::GlobalRenderFrameHostId parent_routing_id, + const ExtensionApiFrameIdMap::DocumentId& document_id) + : frame_data_(frame_id, parent_frame_id, tab_id, window_id, document_id), parent_routing_id_(parent_routing_id) { WebViewGuest* web_view = WebViewGuest::FromWebContents(web_contents); if (web_view) {
diff --git a/extensions/browser/extension_navigation_ui_data.h b/extensions/browser/extension_navigation_ui_data.h index 6c8ac970..7bb1f58 100644 --- a/extensions/browser/extension_navigation_ui_data.h +++ b/extensions/browser/extension_navigation_ui_data.h
@@ -52,12 +52,14 @@ } private: - ExtensionNavigationUIData(content::WebContents* web_contents, - int tab_id, - int window_id, - int frame_id, - int parent_frame_id, - content::GlobalRenderFrameHostId parent_routing_id); + ExtensionNavigationUIData( + content::WebContents* web_contents, + int tab_id, + int window_id, + int frame_id, + int parent_frame_id, + content::GlobalRenderFrameHostId parent_routing_id, + const ExtensionApiFrameIdMap::DocumentId& document_id); ExtensionApiFrameIdMap::FrameData frame_data_; bool is_web_view_;
diff --git a/infra/config/generated/luci/cr-buildbucket.cfg b/infra/config/generated/luci/cr-buildbucket.cfg index 78b3fc0..04b673e 100644 --- a/infra/config/generated/luci/cr-buildbucket.cfg +++ b/infra/config/generated/luci/cr-buildbucket.cfg
@@ -30774,12 +30774,12 @@ ' "builder_group": "chromium.angle",' ' "perf_dashboard_machine_group": "ChromiumANGLE",' ' "recipe": "angle_chromium",' - ' "xcode_build_version": "12d4e"' + ' "xcode_build_version": "13a233"' '}' execution_timeout_secs: 10800 caches { - name: "xcode_ios_12d4e" - path: "xcode_ios_12d4e.app" + name: "xcode_ios_13a233" + path: "xcode_ios_13a233.app" } build_numbers: YES service_account: "chromium-ci-gpu-builder@chops-service-accounts.iam.gserviceaccount.com"
diff --git a/infra/config/subprojects/chromium/ci/chromium.angle.star b/infra/config/subprojects/chromium/ci/chromium.angle.star index a7610f98..6131ca0 100644 --- a/infra/config/subprojects/chromium/ci/chromium.angle.star +++ b/infra/config/subprojects/chromium/ci/chromium.angle.star
@@ -157,7 +157,7 @@ ci.gpu.mac_builder( name = "ios-angle-builder", - xcode = xcode.x12d4e, + xcode = xcode.x13main, console_view_entry = consoles.console_view_entry( category = "iOS|Builder|ANGLE", short_name = "x64",
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd index 693c06f..61fdeff 100644 --- a/ios/chrome/app/strings/ios_strings.grd +++ b/ios/chrome/app/strings/ios_strings.grd
@@ -1431,10 +1431,10 @@ <message name="IDS_IOS_OPTIONS_IMPORT_DATA_IMPORT_TITLE" desc="The title of the Import Data option on the Import Data settings screen. [60em]"> Combine my data </message> - <message name="IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SUBTITLE_SIGNIN" desc="The subtitle of the Keep Data Separate option on the Import Data settings screen when signing in. [400em]"> + <message name="IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_SUBTITLE" desc="The subtitle of the Keep Data Separate option on the Import Data settings screen. [400em]"> Delete existing data. </message> - <message name="IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_TITLE" desc="The title of the Keep Data Separate option on the Import Data settings screen. [60em]"> + <message name="IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_TITLE" desc="The title of the Keep Data Separate option on the Import Data settings screen. [60em]"> Keep my data separate </message> <message name="IDS_IOS_OPTIONS_PRELOAD_WEBPAGES" desc="Title for opening the setting for if/when to preload webpages. [Length: 20em] [iOS only]">
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_SUBTITLE.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_SUBTITLE.png.sha1 new file mode 100644 index 0000000..853fc4ce --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_SUBTITLE.png.sha1
@@ -0,0 +1 @@ +5814580bd46fe44dc1a3577ee9cc2350890c022e \ No newline at end of file
diff --git a/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_TITLE.png.sha1 b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_TITLE.png.sha1 new file mode 100644 index 0000000..853fc4ce --- /dev/null +++ b/ios/chrome/app/strings/ios_strings_grd/IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_TITLE.png.sha1
@@ -0,0 +1 @@ +5814580bd46fe44dc1a3577ee9cc2350890c022e \ No newline at end of file
diff --git a/ios/chrome/browser/bookmarks/bookmark_model_factory.cc b/ios/chrome/browser/bookmarks/bookmark_model_factory.cc index 69b1871..9ad5115 100644 --- a/ios/chrome/browser/bookmarks/bookmark_model_factory.cc +++ b/ios/chrome/browser/bookmarks/bookmark_model_factory.cc
@@ -23,6 +23,25 @@ namespace ios { +namespace { + +std::unique_ptr<KeyedService> BuildBookmarkModel(web::BrowserState* context) { + ChromeBrowserState* browser_state = + ChromeBrowserState::FromBrowserState(context); + std::unique_ptr<bookmarks::BookmarkModel> bookmark_model( + new bookmarks::BookmarkModel(std::make_unique<BookmarkClientImpl>( + browser_state, + ManagedBookmarkServiceFactory::GetForBrowserState(browser_state), + ios::BookmarkSyncServiceFactory::GetForBrowserState(browser_state)))); + bookmark_model->Load(browser_state->GetPrefs(), + browser_state->GetStatePath()); + ios::BookmarkUndoServiceFactory::GetForBrowserState(browser_state) + ->Start(bookmark_model.get()); + return bookmark_model; +} + +} // namespace + // static bookmarks::BookmarkModel* BookmarkModelFactory::GetForBrowserState( ChromeBrowserState* browser_state) { @@ -43,6 +62,11 @@ return instance.get(); } +// static +BookmarkModelFactory::TestingFactory BookmarkModelFactory::GetDefaultFactory() { + return base::BindRepeating(&BuildBookmarkModel); +} + BookmarkModelFactory::BookmarkModelFactory() : BrowserStateKeyedServiceFactory( "BookmarkModel", @@ -60,18 +84,7 @@ std::unique_ptr<KeyedService> BookmarkModelFactory::BuildServiceInstanceFor( web::BrowserState* context) const { - ChromeBrowserState* browser_state = - ChromeBrowserState::FromBrowserState(context); - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model( - new bookmarks::BookmarkModel(std::make_unique<BookmarkClientImpl>( - browser_state, - ManagedBookmarkServiceFactory::GetForBrowserState(browser_state), - ios::BookmarkSyncServiceFactory::GetForBrowserState(browser_state)))); - bookmark_model->Load(browser_state->GetPrefs(), - browser_state->GetStatePath()); - ios::BookmarkUndoServiceFactory::GetForBrowserState(browser_state) - ->Start(bookmark_model.get()); - return bookmark_model; + return BuildBookmarkModel(context); } web::BrowserState* BookmarkModelFactory::GetBrowserStateToUse(
diff --git a/ios/chrome/browser/bookmarks/bookmark_model_factory.h b/ios/chrome/browser/bookmarks/bookmark_model_factory.h index b87d6c0..ea4d835 100644 --- a/ios/chrome/browser/bookmarks/bookmark_model_factory.h +++ b/ios/chrome/browser/bookmarks/bookmark_model_factory.h
@@ -30,6 +30,9 @@ BookmarkModelFactory(const BookmarkModelFactory&) = delete; BookmarkModelFactory& operator=(const BookmarkModelFactory&) = delete; + // Returns the default factory, useful in tests where it's null by default. + static TestingFactory GetDefaultFactory(); + private: friend class base::NoDestructor<BookmarkModelFactory>;
diff --git a/ios/chrome/browser/browser_state/test_chrome_browser_state.h b/ios/chrome/browser/browser_state/test_chrome_browser_state.h index 770cf88..0f4d284 100644 --- a/ios/chrome/browser/browser_state/test_chrome_browser_state.h +++ b/ios/chrome/browser/browser_state/test_chrome_browser_state.h
@@ -68,15 +68,6 @@ // Creates a WebDataService. If not invoked, the web data service is null. void CreateWebDataService(); - // Creates the BookmkarBarModel. If not invoked the bookmark bar model is - // NULL. If |delete_file| is true, the bookmarks file is deleted first, then - // the model is created. As TestChromeBrowserState deletes the directory - // containing the files used by HistoryService, the boolean only matters if - // you're recreating the BookmarkModel. - // - // NOTE: this does not block until the bookmarks are loaded. - void CreateBookmarkModel(bool delete_file); - // !!!!!!!! WARNING: THIS IS GENERALLY NOT SAFE TO CALL! !!!!!!!! // Creates the history service. // TODO(crbug.com/1106699): Remove when all callers are migrated.
diff --git a/ios/chrome/browser/browser_state/test_chrome_browser_state.mm b/ios/chrome/browser/browser_state/test_chrome_browser_state.mm index cacea5b..bc724d48 100644 --- a/ios/chrome/browser/browser_state/test_chrome_browser_state.mm +++ b/ios/chrome/browser/browser_state/test_chrome_browser_state.mm
@@ -19,8 +19,6 @@ #include "base/task/thread_pool.h" #include "base/test/test_file_util.h" #include "base/threading/thread_task_runner_handle.h" -#include "components/bookmarks/browser/bookmark_model.h" -#include "components/bookmarks/common/bookmark_constants.h" #include "components/history/core/browser/history_database_params.h" #include "components/history/core/browser/history_service.h" #include "components/history/core/browser/top_sites.h" @@ -31,14 +29,11 @@ #include "components/profile_metrics/browser_profile_type.h" #include "components/sync_preferences/pref_service_syncable.h" #include "components/sync_preferences/testing_pref_service_syncable.h" -#include "components/undo/bookmark_undo_service.h" #include "components/user_prefs/user_prefs.h" #include "components/webdata_services/web_data_service_wrapper.h" #include "ios/chrome/browser/application_context.h" #include "ios/chrome/browser/autocomplete/in_memory_url_index_factory.h" -#include "ios/chrome/browser/bookmarks/bookmark_client_impl.h" #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" -#include "ios/chrome/browser/bookmarks/bookmark_sync_service_factory.h" #include "ios/chrome/browser/browser_state/browser_state_keyed_service_factories.h" #include "ios/chrome/browser/history/history_client_impl.h" #include "ios/chrome/browser/history/history_service_factory.h" @@ -46,7 +41,6 @@ #include "ios/chrome/browser/history/web_history_service_factory.h" #include "ios/chrome/browser/prefs/browser_prefs.h" #include "ios/chrome/browser/prefs/ios_chrome_pref_service_factory.h" -#include "ios/chrome/browser/undo/bookmark_undo_service_factory.h" #include "ios/chrome/browser/webdata_services/web_data_service_factory.h" #include "ios/web/public/thread/web_task_traits.h" #include "ios/web/public/thread/web_thread.h" @@ -66,20 +60,6 @@ nullptr); } -std::unique_ptr<KeyedService> BuildBookmarkModel(web::BrowserState* context) { - ChromeBrowserState* browser_state = - ChromeBrowserState::FromBrowserState(context); - std::unique_ptr<bookmarks::BookmarkModel> bookmark_model( - new bookmarks::BookmarkModel(std::make_unique<BookmarkClientImpl>( - browser_state, nullptr, - ios::BookmarkSyncServiceFactory::GetForBrowserState(browser_state)))); - bookmark_model->Load(browser_state->GetPrefs(), - browser_state->GetStatePath()); - ios::BookmarkUndoServiceFactory::GetForBrowserState(browser_state) - ->Start(bookmark_model.get()); - return bookmark_model; -} - std::unique_ptr<KeyedService> BuildWebDataService(web::BrowserState* context) { const base::FilePath& browser_state_path = context->GetStatePath(); return std::make_unique<WebDataServiceWrapper>( @@ -281,16 +261,6 @@ run_loop.RunUntilIdle(); } -void TestChromeBrowserState::CreateBookmarkModel(bool delete_file) { - if (delete_file) { - base::DeleteFile(GetOriginalChromeBrowserState()->GetStatePath().Append( - bookmarks::kBookmarksFileName)); - } - std::ignore = - ios::BookmarkModelFactory::GetInstance()->SetTestingFactoryAndUse( - this, base::BindRepeating(&BuildBookmarkModel)); -} - bool TestChromeBrowserState::CreateHistoryService() { // Should never be created multiple times. DCHECK(!ios::HistoryServiceFactory::GetForBrowserStateIfExists(
diff --git a/ios/chrome/browser/search_engines/search_engine_tab_helper_unittest.mm b/ios/chrome/browser/search_engines/search_engine_tab_helper_unittest.mm index 7680943a7..13a492b3 100644 --- a/ios/chrome/browser/search_engines/search_engine_tab_helper_unittest.mm +++ b/ios/chrome/browser/search_engines/search_engine_tab_helper_unittest.mm
@@ -16,7 +16,6 @@ #include "ios/chrome/browser/favicon/favicon_service_factory.h" #include "ios/chrome/browser/search_engines/template_url_service_factory.h" #include "ios/chrome/browser/web/chrome_web_test.h" -#import "ios/web/public/test/web_state_test_util.h" #import "ios/web/public/test/web_view_interaction_test_util.h" #include "net/test/embedded_test_server/embedded_test_server.h" #include "net/test/embedded_test_server/http_request.h" @@ -232,7 +231,7 @@ template_url_service()->GetTemplateURLs(); // Load an empty page, and send a message of openSearchUrl from Js. - web::test::LoadHtml(@"<html></html>", page_url, incognito_web_state()); + LoadHtmlInWebState(@"<html></html>", page_url, incognito_web_state()); SearchEngineTabHelper::FromWebState(incognito_web_state()) ->AddTemplateURLByOSDD(page_url, osdd_url); @@ -264,7 +263,7 @@ template_url_service()->GetTemplateURLs(); // Load an empty page, and send a message of openSearchUrl from Js. - web::test::LoadHtml(html, page_url, incognito_web_state()); + LoadHtmlInWebState(html, page_url, incognito_web_state()); SearchEngineTabHelper::FromWebState(incognito_web_state()) ->SetSearchableUrl(searchable_url); SubmitWebViewFormWithId(incognito_web_state(), "f");
diff --git a/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm b/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm index c26e2d3..0e4e7cb 100644 --- a/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm +++ b/ios/chrome/browser/ui/authentication/signin_promo_view_mediator.mm
@@ -74,6 +74,8 @@ case signin_metrics::AccessPoint::ACCESS_POINT_KALEIDOSCOPE: case signin_metrics::AccessPoint:: ACCESS_POINT_ENTERPRISE_SIGNOUT_COORDINATOR: + case signin_metrics::AccessPoint:: + ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: case signin_metrics::AccessPoint::ACCESS_POINT_MAX: return false; } @@ -127,6 +129,8 @@ case signin_metrics::AccessPoint::ACCESS_POINT_WEB_SIGNIN: case signin_metrics::AccessPoint::ACCESS_POINT_SAFETY_CHECK: case signin_metrics::AccessPoint::ACCESS_POINT_KALEIDOSCOPE: + case signin_metrics::AccessPoint:: + ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: case signin_metrics::AccessPoint::ACCESS_POINT_MAX: NOTREACHED() << "Unexpected value for access point " << static_cast<int>(access_point); @@ -182,6 +186,8 @@ case signin_metrics::AccessPoint::ACCESS_POINT_WEB_SIGNIN: case signin_metrics::AccessPoint::ACCESS_POINT_SAFETY_CHECK: case signin_metrics::AccessPoint::ACCESS_POINT_KALEIDOSCOPE: + case signin_metrics::AccessPoint:: + ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: case signin_metrics::AccessPoint::ACCESS_POINT_MAX: NOTREACHED() << "Unexpected value for access point " << static_cast<int>(access_point); @@ -237,6 +243,8 @@ case signin_metrics::AccessPoint::ACCESS_POINT_WEB_SIGNIN: case signin_metrics::AccessPoint::ACCESS_POINT_SAFETY_CHECK: case signin_metrics::AccessPoint::ACCESS_POINT_KALEIDOSCOPE: + case signin_metrics::AccessPoint:: + ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: case signin_metrics::AccessPoint::ACCESS_POINT_MAX: NOTREACHED() << "Unexpected value for access point " << static_cast<int>(access_point); @@ -284,6 +292,8 @@ case signin_metrics::AccessPoint::ACCESS_POINT_KALEIDOSCOPE: case signin_metrics::AccessPoint:: ACCESS_POINT_ENTERPRISE_SIGNOUT_COORDINATOR: + case signin_metrics::AccessPoint:: + ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: case signin_metrics::AccessPoint::ACCESS_POINT_MAX: return nullptr; } @@ -329,6 +339,8 @@ case signin_metrics::AccessPoint::ACCESS_POINT_KALEIDOSCOPE: case signin_metrics::AccessPoint:: ACCESS_POINT_ENTERPRISE_SIGNOUT_COORDINATOR: + case signin_metrics::AccessPoint:: + ACCESS_POINT_SIGNIN_INTERCEPT_FIRST_RUN_EXPERIENCE: case signin_metrics::AccessPoint::ACCESS_POINT_MAX: return nullptr; }
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.mm b/ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.mm index b401dec..f53d76c 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.mm
@@ -5,7 +5,6 @@ #include "ios/chrome/browser/ui/bookmarks/bookmark_ios_unittest.h" #include <memory> -#include "base/files/scoped_temp_dir.h" #include "base/strings/sys_string_conversions.h" #include "components/bookmarks/browser/bookmark_model.h" #include "components/bookmarks/test/bookmark_test_helpers.h" @@ -32,9 +31,11 @@ AuthenticationServiceFactory::GetInstance(), base::BindRepeating( &AuthenticationServiceFake::CreateAuthenticationService)); + test_cbs_builder.AddTestingFactory( + ios::BookmarkModelFactory::GetInstance(), + ios::BookmarkModelFactory::GetDefaultFactory()); chrome_browser_state_ = test_cbs_builder.Build(); - chrome_browser_state_->CreateBookmarkModel(true); bookmark_model_ = ios::BookmarkModelFactory::GetForBrowserState( chrome_browser_state_.get());
diff --git a/ios/chrome/browser/ui/browser_view/browser_view_controller_helper_unittest.mm b/ios/chrome/browser/ui/browser_view/browser_view_controller_helper_unittest.mm index 8fa83414..5a14590 100644 --- a/ios/chrome/browser/ui/browser_view/browser_view_controller_helper_unittest.mm +++ b/ios/chrome/browser/ui/browser_view/browser_view_controller_helper_unittest.mm
@@ -41,9 +41,11 @@ test_cbs_builder.AddTestingFactory( ios::HistoryServiceFactory::GetInstance(), ios::HistoryServiceFactory::GetDefaultFactory()); + test_cbs_builder.AddTestingFactory( + ios::BookmarkModelFactory::GetInstance(), + ios::BookmarkModelFactory::GetDefaultFactory()); chrome_browser_state_ = test_cbs_builder.Build(); - chrome_browser_state_->CreateBookmarkModel(true); bookmarks::test::WaitForBookmarkModelToLoad( ios::BookmarkModelFactory::GetForBrowserState( chrome_browser_state_.get()));
diff --git a/ios/chrome/browser/ui/menu/BUILD.gn b/ios/chrome/browser/ui/menu/BUILD.gn index d6def306c..0c4a3fc 100644 --- a/ios/chrome/browser/ui/menu/BUILD.gn +++ b/ios/chrome/browser/ui/menu/BUILD.gn
@@ -38,10 +38,14 @@ "resources:share", "resources:show_preview", "//base", + "//components/open_from_clipboard", "//components/prefs", + "//components/search_engines", "//ios/chrome/app/strings", "//ios/chrome/browser:pref_names", "//ios/chrome/browser/browser_state", + "//ios/chrome/browser/policy:policy_util", + "//ios/chrome/browser/search_engines", "//ios/chrome/browser/ui:feature_flags", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/incognito_reauth:incognito_reauth_scene_agent", @@ -95,10 +99,12 @@ "resources:share", "//base", "//base/test:test_support", + "//components/sync_preferences:test_support", "//ios/chrome/app/strings", "//ios/chrome/browser", "//ios/chrome/browser/browser_state:test_support", "//ios/chrome/browser/main:test_support", + "//ios/chrome/browser/policy:policy_util", "//ios/chrome/browser/sessions:test_support", "//ios/chrome/browser/ui/commands", "//ios/chrome/browser/ui/main:scene_state_header",
diff --git a/ios/chrome/browser/ui/menu/action_factory.h b/ios/chrome/browser/ui/menu/action_factory.h index 80ef241d..925f880 100644 --- a/ios/chrome/browser/ui/menu/action_factory.h +++ b/ios/chrome/browser/ui/menu/action_factory.h
@@ -21,6 +21,11 @@ // |scenario|. - (instancetype)initWithScenario:(MenuScenario)scenario; +// Returns a Symbol named |symbolName| configured to be used in a context menu. +// |systemSymbol| is used to specify if it is a SFSymbol or a custom symbol. +- (UIImage*)configuredSymbolNamed:(NSString*)symbolName + systemSymbol:(BOOL)systemSymbol; + // Creates a UIAction instance configured with the given |title| and |image|. // Upon execution, the action's |type| will be recorded and the |block| will be // run. @@ -102,6 +107,7 @@ // |title|. Invokes the given |completion| block after execution. - (UIAction*)actionSearchImageWithTitle:(NSString*)title Block:(ProceduralBlock)block; + // Creates a UIAction instance for closing all tabs. - (UIAction*)actionToCloseAllTabsWithBlock:(ProceduralBlock)block;
diff --git a/ios/chrome/browser/ui/menu/action_factory.mm b/ios/chrome/browser/ui/menu/action_factory.mm index 5af1c23..b5a53c8 100644 --- a/ios/chrome/browser/ui/menu/action_factory.mm +++ b/ios/chrome/browser/ui/menu/action_factory.mm
@@ -50,6 +50,19 @@ }]; } +- (UIImage*)configuredSymbolNamed:(NSString*)symbolName + systemSymbol:(BOOL)systemSymbol { + UIImageSymbolConfiguration* configuration = [UIImageSymbolConfiguration + configurationWithWeight:UIImageSymbolWeightMedium]; + if (systemSymbol) { + return [UIImage systemImageNamed:symbolName + withConfiguration:configuration]; + } + return [UIImage imageNamed:symbolName + inBundle:nil + withConfiguration:configuration]; +} + - (UIAction*)actionToCopyURL:(const GURL)URL { return [self actionWithTitle:l10n_util::GetNSString(IDS_IOS_COPY_LINK_ACTION_TITLE)
diff --git a/ios/chrome/browser/ui/menu/browser_action_factory.h b/ios/chrome/browser/ui/menu/browser_action_factory.h index 79482e5..926a5000 100644 --- a/ios/chrome/browser/ui/menu/browser_action_factory.h +++ b/ios/chrome/browser/ui/menu/browser_action_factory.h
@@ -69,6 +69,36 @@ // Creates a UIAction instance for hidding an element. - (UIAction*)actionToHideLinkPreview; +// Creates a UIAction instance for opening a new tab. +- (UIAction*)actionToOpenNewTab; + +// Creates a UIAction instance for opening a new incognito tab. +- (UIAction*)actionToOpenNewIncognitoTab; + +// Creates a UIAction instance for closing the current tab. +- (UIAction*)actionToCloseCurrentTab; + +// Creates a UIAction instance for showing the QR Scanner. +- (UIAction*)actionToShowQRScanner; + +// Creates a UIAction instance for starting a voice search. +- (UIAction*)actionToStartVoiceSearch; + +// Creates a UIAction instance for opening a new search. +- (UIAction*)actionToStartNewSearch; + +// Creates a UIAction instance for opening a new incognito search. +- (UIAction*)actionToStartNewIncognitoSearch; + +// Creates a UIAction instance for searching for the image in the pasteboard. +- (UIAction*)actionToSearchCopiedImage; + +// Creates a UIAction instance for searching for the URL in the pasteboard. +- (UIAction*)actionToSearchCopiedURL; + +// Creates a UIAction instance for searching for the text in the pasteboard. +- (UIAction*)actionToSearchCopiedText; + @end #endif // IOS_CHROME_BROWSER_UI_MENU_BROWSER_ACTION_FACTORY_H_
diff --git a/ios/chrome/browser/ui/menu/browser_action_factory.mm b/ios/chrome/browser/ui/menu/browser_action_factory.mm index a095b0c..bb5f176 100644 --- a/ios/chrome/browser/ui/menu/browser_action_factory.mm +++ b/ios/chrome/browser/ui/menu/browser_action_factory.mm
@@ -4,15 +4,25 @@ #import "ios/chrome/browser/ui/menu/browser_action_factory.h" +#include "base/strings/sys_string_conversions.h" +#include "components/open_from_clipboard/clipboard_recent_content.h" #include "components/prefs/pref_service.h" +#include "components/search_engines/template_url_service.h" #include "ios/chrome/browser/browser_state/chrome_browser_state.h" +#import "ios/chrome/browser/policy/policy_util.h" #include "ios/chrome/browser/pref_names.h" +#import "ios/chrome/browser/search_engines/template_url_service_factory.h" #import "ios/chrome/browser/ui/commands/application_commands.h" +#import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" +#import "ios/chrome/browser/ui/commands/load_query_commands.h" +#import "ios/chrome/browser/ui/commands/open_new_tab_command.h" +#import "ios/chrome/browser/ui/commands/qr_scanner_commands.h" #import "ios/chrome/browser/ui/incognito_reauth/incognito_reauth_scene_agent.h" #import "ios/chrome/browser/ui/main/scene_state_browser_agent.h" #include "ios/chrome/browser/ui/ui_feature_flags.h" #import "ios/chrome/browser/ui/util/pasteboard_util.h" +#import "ios/chrome/browser/url_loading/image_search_param_generator.h" #import "ios/chrome/browser/url_loading/url_loading_browser_agent.h" #import "ios/chrome/browser/url_loading/url_loading_params.h" #import "ios/chrome/grit/ios_strings.h" @@ -184,4 +194,214 @@ return action; } +- (UIAction*)actionToOpenNewTab { + id<ApplicationCommands> handler = HandlerForProtocol( + self.browser->GetCommandDispatcher(), ApplicationCommands); + UIAction* action = + [self actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_TAB) + image:[self configuredSymbolNamed:@"plus.square" + systemSymbol:YES] + type:MenuActionType::OpenNewTab + block:^{ + [handler openURLInNewTab:[OpenNewTabCommand + commandWithIncognito:NO]]; + }]; + if (IsIncognitoModeForced(self.browser->GetBrowserState()->GetPrefs())) { + action.attributes = UIMenuElementAttributesDisabled; + } + return action; +} + +- (UIAction*)actionToOpenNewIncognitoTab { + id<ApplicationCommands> handler = HandlerForProtocol( + self.browser->GetCommandDispatcher(), ApplicationCommands); + // TODO(crbug.com/1285015): Add the image. + UIAction* action = + [self actionWithTitle:l10n_util::GetNSString( + IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_TAB) + image:nil + type:MenuActionType::OpenNewIncognitoTab + block:^{ + [handler openURLInNewTab:[OpenNewTabCommand + commandWithIncognito:YES]]; + }]; + if (IsIncognitoModeDisabled(self.browser->GetBrowserState()->GetPrefs())) { + action.attributes = UIMenuElementAttributesDisabled; + } + return action; +} + +- (UIAction*)actionToCloseCurrentTab { + __weak id<BrowserCommands> handler = + static_cast<id<BrowserCommands>>(self.browser->GetCommandDispatcher()); + UIAction* action = [self + actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_CLOSE_TAB) + image:[self configuredSymbolNamed:@"xmark" systemSymbol:YES] + type:MenuActionType::CloseCurrentTabs + block:^{ + [handler closeCurrentTab]; + }]; + action.attributes = UIMenuElementAttributesDestructive; + return action; +} + +- (UIAction*)actionToShowQRScanner { + id<QRScannerCommands> handler = HandlerForProtocol( + self.browser->GetCommandDispatcher(), QRScannerCommands); + return [self + actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_QR_SCANNER) + image:[self configuredSymbolNamed:@"qrcode.viewfinder" + systemSymbol:YES] + type:MenuActionType::ShowQRScanner + block:^{ + [handler showQRScanner]; + }]; +} + +- (UIAction*)actionToStartVoiceSearch { + id<ApplicationCommands> handler = HandlerForProtocol( + self.browser->GetCommandDispatcher(), ApplicationCommands); + return [self + actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_VOICE_SEARCH) + image:[self configuredSymbolNamed:@"mic" systemSymbol:YES] + type:MenuActionType::StartVoiceSearch + block:^{ + [handler startVoiceSearch]; + }]; +} + +- (UIAction*)actionToStartNewSearch { + id<ApplicationCommands> handler = HandlerForProtocol( + self.browser->GetCommandDispatcher(), ApplicationCommands); + UIAction* action = [self + actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_SEARCH) + image:[self configuredSymbolNamed:@"magnifyingglass" + systemSymbol:YES] + type:MenuActionType::StartNewSearch + block:^{ + OpenNewTabCommand* command = + [OpenNewTabCommand commandWithIncognito:NO]; + command.shouldFocusOmnibox = YES; + [handler openURLInNewTab:command]; + }]; + + if (IsIncognitoModeForced(self.browser->GetBrowserState()->GetPrefs())) { + action.attributes = UIMenuElementAttributesDisabled; + } + + return action; +} + +- (UIAction*)actionToStartNewIncognitoSearch { + id<ApplicationCommands> handler = HandlerForProtocol( + self.browser->GetCommandDispatcher(), ApplicationCommands); + // TODO(crbug.com/1285015): Add the image. + UIAction* action = + [self actionWithTitle:l10n_util::GetNSString( + IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_SEARCH) + image:nil + type:MenuActionType::StartNewIcognitoSearch + block:^{ + OpenNewTabCommand* command = + [OpenNewTabCommand commandWithIncognito:NO]; + command.shouldFocusOmnibox = YES; + [handler openURLInNewTab:command]; + }]; + + if (IsIncognitoModeDisabled(self.browser->GetBrowserState()->GetPrefs())) { + action.attributes = UIMenuElementAttributesDisabled; + } + + return action; +} + +- (UIAction*)actionToSearchCopiedImage { + __weak __typeof(self) weakSelf = self; + + void (^clipboardAction)(absl::optional<gfx::Image>) = + ^(absl::optional<gfx::Image> optionalImage) { + if (!optionalImage || !weakSelf) { + return; + } + __typeof(weakSelf) strongSelf = weakSelf; + + TemplateURLService* templateURLService = + ios::TemplateURLServiceFactory::GetForBrowserState( + strongSelf.browser->GetBrowserState()); + + UIImage* image = [optionalImage.value().ToUIImage() copy]; + + web::NavigationManager::WebLoadParams webParams = + ImageSearchParamGenerator::LoadParamsForImage(image, + templateURLService); + UrlLoadParams params = UrlLoadParams::InCurrentTab(webParams); + + UrlLoadingBrowserAgent::FromBrowser(strongSelf.browser)->Load(params); + }; + // TODO(crbug.com/1285015): Add the image. + return [self actionWithTitle:l10n_util::GetNSString( + IDS_IOS_TOOLS_MENU_SEARCH_COPIED_IMAGE) + image:nil + type:MenuActionType::SearchCopiedImage + block:^{ + ClipboardRecentContent::GetInstance() + ->GetRecentImageFromClipboard( + base::BindOnce(clipboardAction)); + }]; +} + +- (UIAction*)actionToSearchCopiedURL { + id<LoadQueryCommands> handler = HandlerForProtocol( + self.browser->GetCommandDispatcher(), LoadQueryCommands); + + void (^clipboardAction)(absl::optional<GURL>) = + ^(absl::optional<GURL> optionalURL) { + if (!optionalURL) { + return; + } + NSString* URL = base::SysUTF8ToNSString(optionalURL.value().spec()); + dispatch_async(dispatch_get_main_queue(), ^{ + [handler loadQuery:URL immediately:YES]; + }); + }; + + // TODO(crbug.com/1285015): Add the image. + return [self actionWithTitle:l10n_util::GetNSString( + IDS_IOS_TOOLS_MENU_VISIT_COPIED_LINK) + image:nil + type:MenuActionType::VisitCopiedLink + block:^{ + ClipboardRecentContent::GetInstance() + ->GetRecentURLFromClipboard( + base::BindOnce(clipboardAction)); + }]; +} + +- (UIAction*)actionToSearchCopiedText { + id<LoadQueryCommands> handler = HandlerForProtocol( + self.browser->GetCommandDispatcher(), LoadQueryCommands); + + void (^clipboardAction)(absl::optional<std::u16string>) = + ^(absl::optional<std::u16string> optionalText) { + if (!optionalText) { + return; + } + NSString* query = base::SysUTF16ToNSString(optionalText.value()); + dispatch_async(dispatch_get_main_queue(), ^{ + [handler loadQuery:query immediately:YES]; + }); + }; + + // TODO(crbug.com/1285015): Add the image. + return [self actionWithTitle:l10n_util::GetNSString( + IDS_IOS_TOOLS_MENU_SEARCH_COPIED_TEXT) + image:nil + type:MenuActionType::SearchCopiedText + block:^{ + ClipboardRecentContent::GetInstance() + ->GetRecentTextFromClipboard( + base::BindOnce(clipboardAction)); + }]; +} + @end
diff --git a/ios/chrome/browser/ui/menu/browser_action_factory_unittest.mm b/ios/chrome/browser/ui/menu/browser_action_factory_unittest.mm index 6d57ad7b..033e153 100644 --- a/ios/chrome/browser/ui/menu/browser_action_factory_unittest.mm +++ b/ios/chrome/browser/ui/menu/browser_action_factory_unittest.mm
@@ -6,10 +6,16 @@ #import "base/test/metrics/histogram_tester.h" #import "base/test/task_environment.h" +#include "components/sync_preferences/testing_pref_service_syncable.h" +#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/main/test_browser.h" +#import "ios/chrome/browser/policy/policy_util.h" +#include "ios/chrome/browser/pref_names.h" #import "ios/chrome/browser/sessions/test_session_service.h" #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" +#import "ios/chrome/browser/ui/commands/load_query_commands.h" +#import "ios/chrome/browser/ui/commands/qr_scanner_commands.h" #import "ios/chrome/browser/ui/main/scene_state.h" #import "ios/chrome/browser/ui/main/scene_state_browser_agent.h" #import "ios/chrome/browser/ui/menu/menu_action_type.h" @@ -40,10 +46,14 @@ protected: BrowserActionFactoryTest() : test_title_(@"SomeTitle"), - test_browser_(std::make_unique<TestBrowser>()), scene_state_([[SceneState alloc] initWithAppState:nil]) {} void SetUp() override { + TestChromeBrowserState::Builder test_cbs_builder; + chrome_browser_state_ = test_cbs_builder.Build(); + + test_browser_ = std::make_unique<TestBrowser>(chrome_browser_state_.get()); + SceneStateBrowserAgent::CreateForBrowser(test_browser_.get(), scene_state_); mock_application_commands_handler_ = @@ -57,20 +67,29 @@ [test_browser_->GetCommandDispatcher() startDispatchingToTarget:mock_application_settings_commands_handler_ forProtocol:@protocol(ApplicationSettingsCommands)]; - } - // Creates a blue square. - UIImage* CreateMockImage() { - return ui::test::uiimage_utils::UIImageWithSizeAndSolidColor( - CGSizeMake(10, 10), [UIColor blueColor]); + mock_qr_scanner_commands_handler_ = + OCMStrictProtocolMock(@protocol(QRScannerCommands)); + [test_browser_->GetCommandDispatcher() + startDispatchingToTarget:mock_qr_scanner_commands_handler_ + forProtocol:@protocol(QRScannerCommands)]; + + mock_load_query_commands_handler_ = + OCMStrictProtocolMock(@protocol(LoadQueryCommands)); + [test_browser_->GetCommandDispatcher() + startDispatchingToTarget:mock_load_query_commands_handler_ + forProtocol:@protocol(LoadQueryCommands)]; } base::test::TaskEnvironment task_environment_; base::HistogramTester histogram_tester_; NSString* test_title_; + std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; std::unique_ptr<TestBrowser> test_browser_; id mock_application_commands_handler_; id mock_application_settings_commands_handler_; + id mock_qr_scanner_commands_handler_; + id mock_load_query_commands_handler_; SceneState* scene_state_; }; @@ -226,3 +245,204 @@ EXPECT_TRUE([expectedTitle isEqualToString:action.title]); EXPECT_EQ(expectedImage, action.image); } + +// Tests that the hide preview action has the right title and image. +TEST_F(BrowserActionFactoryTest, OpenNewTabAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = [factory configuredSymbolNamed:@"plus.square" + systemSymbol:YES]; + NSString* expectedTitle = l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_TAB); + + UIAction* action = [factory actionToOpenNewTab]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); + EXPECT_EQ(0U, action.attributes); + + chrome_browser_state_->GetTestingPrefService()->SetManagedPref( + prefs::kIncognitoModeAvailability, + std::make_unique<base::Value>( + static_cast<int>(IncognitoModePrefs::kForced))); + + UIAction* managed_action = [factory actionToOpenNewTab]; + EXPECT_EQ(UIMenuElementAttributesDisabled, managed_action.attributes); +} + +// Tests that the action has the right title and image. +TEST_F(BrowserActionFactoryTest, OpenNewIncognitoTabAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = nil; + NSString* expectedTitle = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_TAB); + + UIAction* action = [factory actionToOpenNewIncognitoTab]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); + EXPECT_EQ(0U, action.attributes); + + chrome_browser_state_->GetTestingPrefService()->SetManagedPref( + prefs::kIncognitoModeAvailability, + std::make_unique<base::Value>( + static_cast<int>(IncognitoModePrefs::kDisabled))); + + UIAction* managed_action = [factory actionToOpenNewIncognitoTab]; + EXPECT_EQ(UIMenuElementAttributesDisabled, managed_action.attributes); +} + +// Tests that the action has the right title and image. +TEST_F(BrowserActionFactoryTest, CloseCurrentTabAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = [factory configuredSymbolNamed:@"xmark" + systemSymbol:YES]; + NSString* expectedTitle = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_CLOSE_TAB); + + UIAction* action = [factory actionToCloseCurrentTab]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); + EXPECT_EQ(UIMenuElementAttributesDestructive, action.attributes); +} + +// Tests that the action has the right title and image. +TEST_F(BrowserActionFactoryTest, ShowQRScannerAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = [factory configuredSymbolNamed:@"qrcode.viewfinder" + systemSymbol:YES]; + NSString* expectedTitle = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_QR_SCANNER); + + UIAction* action = [factory actionToShowQRScanner]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); +} + +// Tests that the action has the right title and image. +TEST_F(BrowserActionFactoryTest, StartVoiceSearchAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = [factory configuredSymbolNamed:@"mic" + systemSymbol:YES]; + NSString* expectedTitle = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_VOICE_SEARCH); + + UIAction* action = [factory actionToStartVoiceSearch]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); +} + +// Tests that the action has the right title, image and attributes. +TEST_F(BrowserActionFactoryTest, StartNewSearchAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = [factory configuredSymbolNamed:@"magnifyingglass" + systemSymbol:YES]; + NSString* expectedTitle = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_SEARCH); + + UIAction* action = [factory actionToStartNewSearch]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); + EXPECT_EQ(0U, action.attributes); + + chrome_browser_state_->GetTestingPrefService()->SetManagedPref( + prefs::kIncognitoModeAvailability, + std::make_unique<base::Value>( + static_cast<int>(IncognitoModePrefs::kForced))); + + UIAction* managed_action = [factory actionToStartNewSearch]; + EXPECT_EQ(UIMenuElementAttributesDisabled, managed_action.attributes); +} + +// Tests that the action has the right title, image and attributes. +TEST_F(BrowserActionFactoryTest, NewIncognitoSearchAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = nil; + NSString* expectedTitle = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_SEARCH); + + UIAction* action = [factory actionToStartNewIncognitoSearch]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); + EXPECT_EQ(0U, action.attributes); + + chrome_browser_state_->GetTestingPrefService()->SetManagedPref( + prefs::kIncognitoModeAvailability, + std::make_unique<base::Value>( + static_cast<int>(IncognitoModePrefs::kDisabled))); + + UIAction* managed_action = [factory actionToStartNewIncognitoSearch]; + EXPECT_EQ(UIMenuElementAttributesDisabled, managed_action.attributes); +} + +// Tests that the action has the right title and image. +TEST_F(BrowserActionFactoryTest, SearchCopiedImageAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = nil; + NSString* expectedTitle = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_SEARCH_COPIED_IMAGE); + + UIAction* action = [factory actionToSearchCopiedImage]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); +} + +// Tests that the action has the right title and image. +TEST_F(BrowserActionFactoryTest, SearchCopiedURLAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = nil; + NSString* expectedTitle = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_VISIT_COPIED_LINK); + + UIAction* action = [factory actionToSearchCopiedURL]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); +} + +// Tests that the action has the right title and image. +TEST_F(BrowserActionFactoryTest, SearchCopiedTextAction) { + BrowserActionFactory* factory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; + + UIImage* expectedImage = nil; + NSString* expectedTitle = + l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_SEARCH_COPIED_TEXT); + + UIAction* action = [factory actionToSearchCopiedText]; + + EXPECT_TRUE([expectedTitle isEqualToString:action.title]); + EXPECT_EQ(expectedImage, action.image); +}
diff --git a/ios/chrome/browser/ui/menu/menu_action_type.h b/ios/chrome/browser/ui/menu/menu_action_type.h index 9ad565a..88f3e6d 100644 --- a/ios/chrome/browser/ui/menu/menu_action_type.h +++ b/ios/chrome/browser/ui/menu/menu_action_type.h
@@ -38,7 +38,17 @@ SearchImageWithLens = 26, ShowLinkPreview = 27, HideLinkPreview = 28, - kMaxValue = HideLinkPreview + OpenNewTab = 29, + OpenNewIncognitoTab = 30, + CloseCurrentTabs = 31, + ShowQRScanner = 32, + StartVoiceSearch = 33, + StartNewSearch = 34, + StartNewIcognitoSearch = 35, + SearchCopiedImage = 36, + VisitCopiedLink = 37, + SearchCopiedText = 38, + kMaxValue = SearchCopiedText }; #endif // IOS_CHROME_BROWSER_UI_MENU_MENU_ACTION_TYPE_H_
diff --git a/ios/chrome/browser/ui/menu/menu_histograms.h b/ios/chrome/browser/ui/menu/menu_histograms.h index 9cfd1ca..6cb7633 100644 --- a/ios/chrome/browser/ui/menu/menu_histograms.h +++ b/ios/chrome/browser/ui/menu/menu_histograms.h
@@ -22,7 +22,8 @@ kTabGridEntry = 10, kTabGridAddTo = 11, kTabGridEdit = 12, - kMaxValue = kTabGridEdit, + kToolbarMenu = 13, + kMaxValue = kToolbarMenu, }; // Records a menu shown histogram metric for the |scenario|.
diff --git a/ios/chrome/browser/ui/menu/menu_histograms.mm b/ios/chrome/browser/ui/menu/menu_histograms.mm index 3e702043..2755b45 100644 --- a/ios/chrome/browser/ui/menu/menu_histograms.mm +++ b/ios/chrome/browser/ui/menu/menu_histograms.mm
@@ -40,6 +40,8 @@ "Mobile.ContextMenu.WebImageLink.Actions"; const char KContextMenuLinkActionsHistogram[] = "Mobile.ContextMenu.WebLink.Actions"; +const char kToolbarMenuActionsHistogram[] = + "Mobile.ContextMenu.Toolbar.Actions"; } // namespace void RecordMenuShown(MenuScenario scenario) { @@ -74,5 +76,7 @@ return kTabGridAddToActionsHistogram; case MenuScenario::kTabGridEdit: return kTabGridEditActionsHistogram; + case MenuScenario::kToolbarMenu: + return kToolbarMenuActionsHistogram; } }
diff --git a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator_unittest.mm b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator_unittest.mm index 5fb573e9..466636e 100644 --- a/ios/chrome/browser/ui/popup_menu/popup_menu_mediator_unittest.mm +++ b/ios/chrome/browser/ui/popup_menu/popup_menu_mediator_unittest.mm
@@ -125,6 +125,11 @@ } protected: + TestChromeBrowserState::TestingFactories GetTestingFactories() override { + return {{ios::BookmarkModelFactory::GetInstance(), + ios::BookmarkModelFactory::GetDefaultFactory()}}; + } + PopupMenuMediator* CreateMediator(PopupMenuType type, BOOL is_incognito, BOOL trigger_incognito_hint) { @@ -159,9 +164,9 @@ } void SetUpBookmarks() { - GetBrowserState()->CreateBookmarkModel(false); bookmark_model_ = ios::BookmarkModelFactory::GetForBrowserState(GetBrowserState()); + DCHECK(bookmark_model_); bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_); mediator_.bookmarkModel = bookmark_model_; }
diff --git a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm index 2d41d5e..d9e7a5e1 100644 --- a/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm +++ b/ios/chrome/browser/ui/settings/google_services/manage_sync_settings_coordinator.mm
@@ -127,6 +127,7 @@ self.browser->GetBrowserState()); syncSetupService->CommitSyncChanges(); } + _syncObserver.reset(); } #pragma mark - Properties
diff --git a/ios/chrome/browser/ui/settings/import_data_table_view_controller.mm b/ios/chrome/browser/ui/settings/import_data_table_view_controller.mm index 103feca..62ee900 100644 --- a/ios/chrome/browser/ui/settings/import_data_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/import_data_table_view_controller.mm
@@ -36,8 +36,8 @@ typedef NS_ENUM(NSInteger, ItemType) { ItemTypeFooter = kItemTypeEnumZero, - ItemTypeOptionImportData, ItemTypeOptionKeepDataSeparate, + ItemTypeOptionImportData, }; } // namespace @@ -51,8 +51,8 @@ // any choice to import or clear the data. ShouldClearData _shouldClearData; - SettingsImageDetailTextItem* _importDataItem; SettingsImageDetailTextItem* _keepDataSeparateItem; + SettingsImageDetailTextItem* _importDataItem; } #pragma mark - Initialization @@ -102,13 +102,13 @@ [model addItem:[self descriptionItem] toSectionWithIdentifier:SectionIdentifierDisclaimer]; - _importDataItem = [self importDataItem]; _keepDataSeparateItem = [self keepDataSeparateItem]; + _importDataItem = [self importDataItem]; [model addSectionWithIdentifier:SectionIdentifierOptions]; - [model addItem:_importDataItem - toSectionWithIdentifier:SectionIdentifierOptions]; [model addItem:_keepDataSeparateItem toSectionWithIdentifier:SectionIdentifierOptions]; + [model addItem:_importDataItem + toSectionWithIdentifier:SectionIdentifierOptions]; } #pragma mark - Items @@ -140,9 +140,10 @@ SettingsImageDetailTextItem* item = [[SettingsImageDetailTextItem alloc] initWithType:ItemTypeOptionKeepDataSeparate]; - item.text = l10n_util::GetNSString(IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_TITLE); - item.detailText = - l10n_util::GetNSString(IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SUBTITLE_SIGNIN); + item.text = + l10n_util::GetNSString(IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_TITLE); + item.detailText = l10n_util::GetNSString( + IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_SUBTITLE); item.accessoryType = UITableViewCellAccessoryNone; item.accessibilityIdentifier = kImportDataKeepSeparateCellId; return item; @@ -198,7 +199,7 @@ _keepDataSeparateItem.accessoryType = UITableViewCellAccessoryNone; break; } - [self reconfigureCellsForItems:@[ _importDataItem, _keepDataSeparateItem ]]; + [self reconfigureCellsForItems:@[ _keepDataSeparateItem, _importDataItem ]]; } - (void)didTapContinue {
diff --git a/ios/chrome/browser/ui/settings/import_data_table_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/import_data_table_view_controller_unittest.mm index 99c8655..5e8e0fc 100644 --- a/ios/chrome/browser/ui/settings/import_data_table_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/settings/import_data_table_view_controller_unittest.mm
@@ -22,8 +22,8 @@ namespace { typedef NS_ENUM(NSInteger, ItemIndex) { - kImportDataItemIndex = 0, - kKeepDataSeparateItemIndex = 1, + kKeepDataSeparateItemIndex = 0, + kImportDataItemIndex = 1, }; } // namespace @@ -86,18 +86,20 @@ item.text); EXPECT_EQ(2, NumberOfItemsInSection(1)); CheckTextCellTextAndDetailText( + l10n_util::GetNSString(IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_TITLE), + l10n_util::GetNSString( + IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SEPARATE_SUBTITLE), + 1, kKeepDataSeparateItemIndex); + CheckTextCellTextAndDetailText( l10n_util::GetNSString(IDS_IOS_OPTIONS_IMPORT_DATA_IMPORT_TITLE), l10n_util::GetNSStringF(IDS_IOS_OPTIONS_IMPORT_DATA_IMPORT_SUBTITLE, base::SysNSStringToUTF16(@"toEmail@gmail.com")), - 1, 0); - CheckTextCellTextAndDetailText( - l10n_util::GetNSString(IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_TITLE), - l10n_util::GetNSString(IDS_IOS_OPTIONS_IMPORT_DATA_KEEP_SUBTITLE_SIGNIN), - 1, 1); + 1, kImportDataItemIndex); // No item is selected by default. - CheckAccessoryType(UITableViewCellAccessoryNone, 1, 1); - CheckAccessoryType(UITableViewCellAccessoryNone, 1, 1); + CheckAccessoryType(UITableViewCellAccessoryNone, 1, + kKeepDataSeparateItemIndex); + CheckAccessoryType(UITableViewCellAccessoryNone, 1, kImportDataItemIndex); // Continue button is disabled by default. EXPECT_FALSE(controller().navigationItem.rightBarButtonItem.enabled);
diff --git a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm index 9100da2..e087434 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm
@@ -1894,10 +1894,13 @@ - (void)configureSigninPromoWithConfigurator: (SigninPromoViewConfigurator*)configurator identityChanged:(BOOL)identityChanged { - DCHECK(!self.isSigninInProgress); - if (![self.tableViewModel + if (self.isSigninInProgress || + ![self.tableViewModel hasItemForItemType:SettingsItemTypeSigninPromo sectionIdentifier:SettingsSectionIdentifierSignIn]) { + // Don't reload the sign-in promo if sign-in is in progress, to avoid having + // UI glitches. The table view should be reloaded once the sign-in is + // finished. return; } NSIndexPath* signinPromoCellIndexPath = [self.tableViewModel
diff --git a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_coordinator_unittest.mm b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_coordinator_unittest.mm index 59949ae6..4c296f5c 100644 --- a/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/tab_switcher/tab_grid/tab_grid_coordinator_unittest.mm
@@ -97,8 +97,10 @@ AuthenticationServiceFactory::GetInstance(), base::BindRepeating( &AuthenticationServiceFake::CreateAuthenticationService)); + test_cbs_builder.AddTestingFactory( + ios::BookmarkModelFactory::GetInstance(), + ios::BookmarkModelFactory::GetDefaultFactory()); chrome_browser_state_ = test_cbs_builder.Build(); - chrome_browser_state_->CreateBookmarkModel(true); bookmark_model_ = ios::BookmarkModelFactory::GetForBrowserState( chrome_browser_state_.get());
diff --git a/ios/chrome/browser/ui/toolbar/BUILD.gn b/ios/chrome/browser/ui/toolbar/BUILD.gn index 98e681c..10148cf 100644 --- a/ios/chrome/browser/ui/toolbar/BUILD.gn +++ b/ios/chrome/browser/ui/toolbar/BUILD.gn
@@ -52,6 +52,7 @@ "//ios/chrome/browser/ui/fullscreen:feature_flags", "//ios/chrome/browser/ui/gestures", "//ios/chrome/browser/ui/location_bar", + "//ios/chrome/browser/ui/menu", "//ios/chrome/browser/ui/ntp", "//ios/chrome/browser/ui/ntp:util", "//ios/chrome/browser/ui/omnibox", @@ -148,10 +149,12 @@ "//ios/chrome/browser", "//ios/chrome/browser/bookmarks", "//ios/chrome/browser/browser_state:test_support", + "//ios/chrome/browser/main:test_support", "//ios/chrome/browser/policy:feature_flags", "//ios/chrome/browser/policy:policy_util", "//ios/chrome/browser/search_engines", "//ios/chrome/browser/ui/commands", + "//ios/chrome/browser/ui/menu", "//ios/chrome/browser/ui/popup_menu/public", "//ios/chrome/browser/ui/toolbar/buttons", "//ios/chrome/browser/ui/toolbar/public",
diff --git a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator.mm b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator.mm index 1f15111989..d2ac8eb 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator.mm
@@ -10,6 +10,7 @@ #import "ios/chrome/browser/overlays/public/overlay_presenter.h" #import "ios/chrome/browser/search_engines/template_url_service_factory.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" +#import "ios/chrome/browser/ui/menu/browser_action_factory.h" #import "ios/chrome/browser/ui/ntp/ntp_util.h" #import "ios/chrome/browser/ui/toolbar/adaptive_toolbar_coordinator+subclassing.h" #import "ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.h" @@ -65,15 +66,12 @@ self.mediator.webStateList = self.browser->GetWebStateList(); self.mediator.webContentAreaOverlayPresenter = OverlayPresenter::FromBrowser( self.browser, OverlayModality::kWebContentArea); - self.mediator.prefService = self.browser->GetBrowserState()->GetPrefs(); self.mediator.templateURLService = ios::TemplateURLServiceFactory::GetForBrowserState( self.browser->GetBrowserState()); - self.mediator.commandHandler = - static_cast<id<ApplicationCommands, BrowserCommands, LoadQueryCommands>>( - self.browser->GetCommandDispatcher()); - self.mediator.URLLoadingBrowserAgent = - UrlLoadingBrowserAgent::FromBrowser(self.browser); + self.mediator.actionFactory = + [[BrowserActionFactory alloc] initWithBrowser:self.browser + scenario:MenuScenario::kToolbarMenu]; self.viewController.menuProvider = self.mediator; }
diff --git a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.mm b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.mm index e9b3ebe3..1e1bb9bc 100644 --- a/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.mm +++ b/ios/chrome/browser/ui/toolbar/adaptive_toolbar_view_controller.mm
@@ -450,6 +450,8 @@ image:nil identifier:kContextMenuActionIdentifier handler:^(UIAction* action) { + base::RecordAction( + base::UserMetricsAction("MobileMenuToolbarMenuTriggered")); weakButton.menu = [weakSelf.menuProvider menuForButtonOfType:buttonType]; }];
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_mediator.h b/ios/chrome/browser/ui/toolbar/toolbar_mediator.h index 35432ce9..b5ca6c8 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_mediator.h +++ b/ios/chrome/browser/ui/toolbar/toolbar_mediator.h
@@ -12,14 +12,10 @@ namespace web { class WebState; } -@protocol ApplicationCommands; -@protocol BrowserCommands; -@protocol LoadQueryCommands; +@class BrowserActionFactory; class OverlayPresenter; -class PrefService; class TemplateURLService; @protocol ToolbarConsumer; -class UrlLoadingBrowserAgent; class WebStateList; // A mediator object that provides the relevant properties of a web state @@ -33,11 +29,6 @@ // number of Webstates. @property(nonatomic, assign) WebStateList* webStateList; -// Command handler. -@property(nonatomic, weak) - id<ApplicationCommands, BrowserCommands, LoadQueryCommands> - commandHandler; - // The consumer for this object. This can change during the lifetime of this // object and may be nil. @property(nonatomic, strong) id<ToolbarConsumer> consumer; @@ -47,15 +38,12 @@ // should be enabled. @property(nonatomic, assign) OverlayPresenter* webContentAreaOverlayPresenter; -// Pref service to retrieve preference values. -@property(nonatomic, assign) PrefService* prefService; - // The template url service to use for checking whether search by image is // available. @property(nonatomic, assign) TemplateURLService* templateURLService; -// The URL loading service, used to load the reverse image search. -@property(nonatomic, assign) UrlLoadingBrowserAgent* URLLoadingBrowserAgent; +// Action factory. +@property(nonatomic, strong) BrowserActionFactory* actionFactory; // Updates the consumer to conforms to |webState|. - (void)updateConsumerForWebState:(web::WebState*)webState;
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_mediator.mm b/ios/chrome/browser/ui/toolbar/toolbar_mediator.mm index b065e005..f5f14444 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_mediator.mm +++ b/ios/chrome/browser/ui/toolbar/toolbar_mediator.mm
@@ -20,6 +20,7 @@ #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/load_query_commands.h" #import "ios/chrome/browser/ui/commands/open_new_tab_command.h" +#import "ios/chrome/browser/ui/menu/browser_action_factory.h" #import "ios/chrome/browser/ui/ntp/ntp_util.h" #import "ios/chrome/browser/ui/toolbar/toolbar_consumer.h" #import "ios/chrome/browser/ui/ui_feature_flags.h" @@ -43,9 +44,6 @@ #error "This file requires ARC support." #endif -using base::RecordAction; -using base::UserMetricsAction; - @interface ToolbarMediator () <CRWWebStateObserver, OverlayPresenterObserving, WebStateListObserving> @@ -375,57 +373,11 @@ // Returns the menu for the new tab button. - (UIMenu*)menuForNewTabButton { - __weak __typeof(self) weakSelf = self; - UIAction* QRCodeSearch = [UIAction - actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_QR_SCANNER) - image:[UIImage imageNamed:@"popup_menu_qr_scanner"] - identifier:nil - handler:^(UIAction* action) { - RecordAction(UserMetricsAction("MobileMenuScanQRCode")); - [weakSelf.commandHandler showQRScanner]; - }]; - - UIAction* voiceSearch = [UIAction - actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_VOICE_SEARCH) - image:[UIImage imageNamed:@"popup_menu_voice_search"] - identifier:nil - handler:^(UIAction* action) { - RecordAction(UserMetricsAction("MobileMenuVoiceSearch")); - [weakSelf.commandHandler startVoiceSearch]; - }]; - - UIAction* newSearch = [UIAction - actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_SEARCH) - image:[UIImage imageNamed:@"popup_menu_search"] - identifier:nil - handler:^(UIAction* action) { - RecordAction(UserMetricsAction("MobileMenuSearch")); - OpenNewTabCommand* command = - [OpenNewTabCommand commandWithIncognito:NO]; - command.shouldFocusOmnibox = YES; - [weakSelf.commandHandler openURLInNewTab:command]; - }]; - - if (IsIncognitoModeForced(self.prefService)) { - newSearch.attributes = UIMenuElementAttributesDisabled; - } - - UIAction* newIncognitoSearch = [UIAction - actionWithTitle:l10n_util::GetNSString( - IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_SEARCH) - image:[UIImage imageNamed:@"popup_menu_new_incognito_tab"] - identifier:nil - handler:^(UIAction* action) { - RecordAction(UserMetricsAction("MobileMenuIncognitoSearch")); - OpenNewTabCommand* command = - [OpenNewTabCommand commandWithIncognito:YES]; - command.shouldFocusOmnibox = YES; - [weakSelf.commandHandler openURLInNewTab:command]; - }]; - - if (IsIncognitoModeDisabled(self.prefService)) { - newIncognitoSearch.attributes = UIMenuElementAttributesDisabled; - } + UIAction* QRCodeSearch = [self.actionFactory actionToShowQRScanner]; + UIAction* voiceSearch = [self.actionFactory actionToStartVoiceSearch]; + UIAction* newSearch = [self.actionFactory actionToStartNewSearch]; + UIAction* newIncognitoSearch = + [self.actionFactory actionToStartNewIncognitoSearch]; NSArray* staticActions = @[ newSearch, newIncognitoSearch, voiceSearch, QRCodeSearch ]; @@ -446,39 +398,10 @@ // Returns the menu for the TabGrid button. - (UIMenu*)menuForTabGridButton { - __weak __typeof(self) weakSelf = self; - UIAction* openNewTab = [UIAction - actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_TAB) - image:[UIImage imageNamed:@"popup_menu_new_tab"] - identifier:nil - handler:^(UIAction* action) { - RecordAction(UserMetricsAction("MobileMenuNewTab")); - [weakSelf.commandHandler - openURLInNewTab:[OpenNewTabCommand - commandWithIncognito:NO - originPoint:CGPointZero]]; - }]; + UIAction* openNewTab = [self.actionFactory actionToOpenNewTab]; - if (IsIncognitoModeForced(self.prefService)) { - openNewTab.attributes = UIMenuElementAttributesDisabled; - } - - UIAction* openNewIncognitoTab = [UIAction - actionWithTitle:l10n_util::GetNSString( - IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_TAB) - image:[UIImage imageNamed:@"popup_menu_new_incognito_tab"] - identifier:nil - handler:^(UIAction* action) { - RecordAction(UserMetricsAction("MobileMenuNewIncognitoTab")); - [weakSelf.commandHandler - openURLInNewTab:[OpenNewTabCommand - commandWithIncognito:YES - originPoint:CGPointZero]]; - }]; - - if (IsIncognitoModeDisabled(self.prefService)) { - openNewIncognitoTab.attributes = UIMenuElementAttributesDisabled; - } + UIAction* openNewIncognitoTab = + [self.actionFactory actionToOpenNewIncognitoTab]; UIMenu* newTabActions = [UIMenu menuWithTitle:@"" @@ -487,89 +410,32 @@ options:UIMenuOptionsDisplayInline children:@[ openNewTab, openNewIncognitoTab ]]; - UIAction* closeTab = [UIAction - actionWithTitle:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_CLOSE_TAB) - image:[UIImage imageNamed:@"popup_menu_close_tab"] - identifier:nil - handler:^(UIAction* action) { - RecordAction(UserMetricsAction("MobileMenuCloseTab")); - [weakSelf.commandHandler closeCurrentTab]; - }]; - closeTab.attributes = UIMenuElementAttributesDestructive; + UIAction* closeTab = [self.actionFactory actionToCloseCurrentTab]; return [UIMenu menuWithTitle:@"" children:@[ newTabActions, closeTab ]]; } // Returns the UIMenuElement for the content of the pasteboard. Can return nil. - (UIMenuElement*)menuElementForPasteboard { - __weak __typeof(self) weakSelf = self; + absl::optional<std::set<ClipboardContentType>> clipboardContentType = + ClipboardRecentContent::GetInstance()->GetCachedClipboardContentTypes(); - ClipboardRecentContent* clipboardRecentContent = - ClipboardRecentContent::GetInstance(); + if (clipboardContentType.has_value()) { + std::set<ClipboardContentType> clipboardContentTypeValues = + clipboardContentType.value(); - absl::optional<GURL> optionalURL = - clipboardRecentContent->GetRecentURLFromClipboard(); - absl::optional<std::u16string> optionalText = - clipboardRecentContent->GetRecentTextFromClipboard(); - - if (search_engines::SupportsSearchByImage(self.templateURLService) && - clipboardRecentContent->HasRecentImageFromClipboard()) { - return [UIAction - actionWithTitle:l10n_util::GetNSString( - IDS_IOS_TOOLS_MENU_SEARCH_COPIED_IMAGE) - image:[UIImage imageNamed:@"popup_menu_paste_and_go"] - identifier:nil - handler:^(UIAction* action) { - RecordAction( - UserMetricsAction("MobileMenuSearchCopiedImage")); - ClipboardRecentContent* clipboardRecentContent = - ClipboardRecentContent::GetInstance(); - clipboardRecentContent->GetRecentImageFromClipboard( - base::BindOnce( - ^(absl::optional<gfx::Image> optionalImage) { - if (!optionalImage) { - return; - } - UIImage* image = - [optionalImage.value().ToUIImage() copy]; - web::NavigationManager::WebLoadParams webParams = - ImageSearchParamGenerator::LoadParamsForImage( - image, self.templateURLService); - UrlLoadParams params = - UrlLoadParams::InCurrentTab(webParams); - - self.URLLoadingBrowserAgent->Load(params); - })); - }]; - } else if (optionalURL) { - return [UIAction - actionWithTitle:l10n_util::GetNSString( - IDS_IOS_TOOLS_MENU_VISIT_COPIED_LINK) - image:[UIImage imageNamed:@"popup_menu_paste_and_go"] - identifier:nil - handler:^(UIAction* action) { - RecordAction(UserMetricsAction("MobileMenuPasteAndGo")); - [weakSelf.commandHandler - loadQuery:base::SysUTF8ToNSString( - optionalURL.value().spec()) - immediately:YES]; - }]; - - } else if (optionalText) { - return [UIAction - actionWithTitle:l10n_util::GetNSString( - IDS_IOS_TOOLS_MENU_SEARCH_COPIED_TEXT) - image:[UIImage imageNamed:@"popup_menu_paste_and_go"] - identifier:nil - handler:^(UIAction* action) { - RecordAction(UserMetricsAction("MobileMenuPasteAndGo")); - - [weakSelf.commandHandler - loadQuery:base::SysUTF16ToNSString(optionalText.value()) - immediately:YES]; - }]; + if (search_engines::SupportsSearchByImage(self.templateURLService) && + clipboardContentTypeValues.find(ClipboardContentType::Image) != + clipboardContentTypeValues.end()) { + return [self.actionFactory actionToSearchCopiedImage]; + } else if (clipboardContentTypeValues.find(ClipboardContentType::URL) != + clipboardContentTypeValues.end()) { + return [self.actionFactory actionToSearchCopiedURL]; + } else if (clipboardContentTypeValues.find(ClipboardContentType::Text) != + clipboardContentTypeValues.end()) { + return [self.actionFactory actionToSearchCopiedText]; + } } - return nil; }
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_mediator_unittest.mm b/ios/chrome/browser/ui/toolbar/toolbar_mediator_unittest.mm index 4a369bff..72967fad 100644 --- a/ios/chrome/browser/ui/toolbar/toolbar_mediator_unittest.mm +++ b/ios/chrome/browser/ui/toolbar/toolbar_mediator_unittest.mm
@@ -12,13 +12,16 @@ #include "base/strings/utf_string_conversions.h" #include "components/open_from_clipboard/clipboard_recent_content.h" #include "components/open_from_clipboard/fake_clipboard_recent_content.h" -#include "components/prefs/pref_service.h" -#include "components/sync_preferences/testing_pref_service_syncable.h" #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/chrome/browser/chrome_url_constants.h" +#import "ios/chrome/browser/main/test_browser.h" #include "ios/chrome/browser/policy/policy_features.h" #import "ios/chrome/browser/policy/policy_util.h" -#include "ios/chrome/browser/pref_names.h" +#import "ios/chrome/browser/ui/commands/application_commands.h" +#import "ios/chrome/browser/ui/commands/command_dispatcher.h" +#import "ios/chrome/browser/ui/commands/load_query_commands.h" +#import "ios/chrome/browser/ui/commands/qr_scanner_commands.h" +#import "ios/chrome/browser/ui/menu/browser_action_factory.h" #import "ios/chrome/browser/ui/toolbar/test/toolbar_test_navigation_manager.h" #import "ios/chrome/browser/ui/toolbar/toolbar_consumer.h" #include "ios/chrome/browser/web_state_list/fake_web_state_list_delegate.h" @@ -52,6 +55,8 @@ namespace { +MenuScenario kTestMenuScenario = MenuScenario::kHistoryEntry; + static const int kNumberOfWebStates = 3; static const char kTestUrl[] = "http://www.chromium.org"; @@ -63,6 +68,8 @@ TestChromeBrowserState::Builder test_cbs_builder; chrome_browser_state_ = test_cbs_builder.Build(); + test_browser_ = std::make_unique<TestBrowser>(chrome_browser_state_.get()); + std::unique_ptr<ToolbarTestNavigationManager> navigation_manager = std::make_unique<ToolbarTestNavigationManager>(); navigation_manager_ = navigation_manager.get(); @@ -72,10 +79,37 @@ test_web_state_->SetLoading(true); web_state_ = test_web_state_.get(); mediator_ = [[TestToolbarMediator alloc] init]; + mediator_.actionFactory = + [[BrowserActionFactory alloc] initWithBrowser:test_browser_.get() + scenario:kTestMenuScenario]; consumer_ = OCMProtocolMock(@protocol(ToolbarConsumer)); strict_consumer_ = OCMStrictProtocolMock(@protocol(ToolbarConsumer)); SetUpWebStateList(); + mock_application_commands_handler_ = + OCMStrictProtocolMock(@protocol(ApplicationCommands)); + [test_browser_->GetCommandDispatcher() + startDispatchingToTarget:mock_application_commands_handler_ + forProtocol:@protocol(ApplicationCommands)]; + + mock_application_settings_commands_handler_ = + OCMStrictProtocolMock(@protocol(ApplicationSettingsCommands)); + [test_browser_->GetCommandDispatcher() + startDispatchingToTarget:mock_application_settings_commands_handler_ + forProtocol:@protocol(ApplicationSettingsCommands)]; + + mock_qr_scanner_commands_handler_ = + OCMStrictProtocolMock(@protocol(QRScannerCommands)); + [test_browser_->GetCommandDispatcher() + startDispatchingToTarget:mock_qr_scanner_commands_handler_ + forProtocol:@protocol(QRScannerCommands)]; + + mock_load_query_commands_handler_ = + OCMStrictProtocolMock(@protocol(LoadQueryCommands)); + [test_browser_->GetCommandDispatcher() + startDispatchingToTarget:mock_load_query_commands_handler_ + forProtocol:@protocol(LoadQueryCommands)]; + [[UIPasteboard generalPasteboard] setItems:@[]]; ClipboardRecentContent::SetInstance( @@ -117,12 +151,17 @@ void SetUpActiveWebState() { web_state_list_->ActivateWebStateAt(0); } TestToolbarMediator* mediator_; + std::unique_ptr<TestBrowser> test_browser_; web::FakeWebState* web_state_; ToolbarTestNavigationManager* navigation_manager_; std::unique_ptr<WebStateList> web_state_list_; FakeWebStateListDelegate web_state_list_delegate_; id consumer_; id strict_consumer_; + id mock_application_commands_handler_; + id mock_application_settings_commands_handler_; + id mock_qr_scanner_commands_handler_; + id mock_load_query_commands_handler_; std::unique_ptr<TestChromeBrowserState> chrome_browser_state_; private: @@ -422,112 +461,6 @@ EXPECT_EQ(UIMenuElementAttributesDestructive, close_tab.attributes); } -// Tests the menu elements when incognito is forced. -TEST_F(ToolbarMediatorTest, MenuElementsForcedIncognito) { - mediator_.webStateList = web_state_list_.get(); - SetUpActiveWebState(); - sync_preferences::TestingPrefServiceSyncable* pref_service = - new sync_preferences::TestingPrefServiceSyncable(); - pref_service->registry()->RegisterIntegerPref( - prefs::kIncognitoModeAvailability, 0); - pref_service->SetManagedPref(prefs::kIncognitoModeAvailability, - std::make_unique<base::Value>(static_cast<int>( - IncognitoModePrefs::kForced))); - mediator_.prefService = pref_service; - - UIMenu* new_tab_menu = - [mediator_ menuForButtonOfType:AdaptiveToolbarButtonTypeNewTab]; - - ASSERT_EQ(4U, new_tab_menu.children.count); - for (UIMenuElement* element in new_tab_menu.children) { - ASSERT_TRUE([element isKindOfClass:[UIAction class]]); - UIAction* action = (UIAction*)element; - if ([action.title - isEqual:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_SEARCH)]) { - EXPECT_EQ(UIMenuElementAttributesDisabled, action.attributes); - } else { - EXPECT_EQ(0U, action.attributes); - } - } - - UIMenu* tab_grid_menu = - [mediator_ menuForButtonOfType:AdaptiveToolbarButtonTypeTabGrid]; - - ASSERT_EQ(2U, tab_grid_menu.children.count); - ASSERT_TRUE([tab_grid_menu.children[0] isKindOfClass:[UIMenu class]]); - UIMenu* open_tab_menu = (UIMenu*)tab_grid_menu.children[0]; - ASSERT_EQ(2U, open_tab_menu.children.count); - for (UIMenuElement* element in open_tab_menu.children) { - ASSERT_TRUE([element isKindOfClass:[UIAction class]]); - UIAction* action = (UIAction*)element; - if ([action.title - isEqual:l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_NEW_TAB)]) { - EXPECT_EQ(UIMenuElementAttributesDisabled, action.attributes); - } else { - EXPECT_EQ(0U, action.attributes); - } - } - - ASSERT_TRUE([tab_grid_menu.children[1] isKindOfClass:[UIAction class]]); - UIAction* close_tab = (UIAction*)tab_grid_menu.children[1]; - EXPECT_NSEQ(l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_CLOSE_TAB), - close_tab.title); - EXPECT_EQ(UIMenuElementAttributesDestructive, close_tab.attributes); -} - -// Tests the menu elements when incognito is disabled. -TEST_F(ToolbarMediatorTest, MenuElementsDisabledIncognito) { - mediator_.webStateList = web_state_list_.get(); - SetUpActiveWebState(); - sync_preferences::TestingPrefServiceSyncable* pref_service = - new sync_preferences::TestingPrefServiceSyncable(); - pref_service->registry()->RegisterIntegerPref( - prefs::kIncognitoModeAvailability, 0); - pref_service->SetManagedPref(prefs::kIncognitoModeAvailability, - std::make_unique<base::Value>(static_cast<int>( - IncognitoModePrefs::kDisabled))); - mediator_.prefService = pref_service; - - UIMenu* new_tab_menu = - [mediator_ menuForButtonOfType:AdaptiveToolbarButtonTypeNewTab]; - - ASSERT_EQ(4U, new_tab_menu.children.count); - for (UIMenuElement* element in new_tab_menu.children) { - ASSERT_TRUE([element isKindOfClass:[UIAction class]]); - UIAction* action = (UIAction*)element; - if ([action.title isEqual:l10n_util::GetNSString( - IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_SEARCH)]) { - EXPECT_EQ(UIMenuElementAttributesDisabled, action.attributes); - } else { - EXPECT_EQ(0U, action.attributes); - } - } - - UIMenu* tab_grid_menu = - [mediator_ menuForButtonOfType:AdaptiveToolbarButtonTypeTabGrid]; - - ASSERT_EQ(2U, tab_grid_menu.children.count); - ASSERT_TRUE([tab_grid_menu.children[0] isKindOfClass:[UIMenu class]]); - UIMenu* open_tab_menu = (UIMenu*)tab_grid_menu.children[0]; - ASSERT_EQ(2U, open_tab_menu.children.count); - for (UIMenuElement* element in open_tab_menu.children) { - ASSERT_TRUE([element isKindOfClass:[UIAction class]]); - UIAction* action = (UIAction*)element; - if ([action.title isEqual:l10n_util::GetNSString( - IDS_IOS_TOOLS_MENU_NEW_INCOGNITO_TAB)]) { - EXPECT_EQ(UIMenuElementAttributesDisabled, action.attributes); - } else { - EXPECT_EQ(0U, action.attributes); - } - } - - ASSERT_TRUE([tab_grid_menu.children[1] isKindOfClass:[UIAction class]]); - UIAction* close_tab = (UIAction*)tab_grid_menu.children[1]; - EXPECT_NSEQ(l10n_util::GetNSString(IDS_IOS_TOOLS_MENU_CLOSE_TAB), - close_tab.title); - EXPECT_EQ(UIMenuElementAttributesDestructive, close_tab.attributes); -} - // Tests the back/forward items for the menu. TEST_F(ToolbarMediatorTest, MenuElementsBackForward) { std::unique_ptr<web::FakeNavigationManager> navigation_manager =
diff --git a/ios/chrome/browser/web/BUILD.gn b/ios/chrome/browser/web/BUILD.gn index fcc15c4..1b13c96 100644 --- a/ios/chrome/browser/web/BUILD.gn +++ b/ios/chrome/browser/web/BUILD.gn
@@ -289,6 +289,7 @@ "//ios/chrome/browser/web", "//ios/web", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", ] }
diff --git a/ios/chrome/test/BUILD.gn b/ios/chrome/test/BUILD.gn index 95959fa..52b4344 100644 --- a/ios/chrome/test/BUILD.gn +++ b/ios/chrome/test/BUILD.gn
@@ -128,6 +128,7 @@ "//ios/public/provider/chrome/browser/app_utils:app_utils_api", "//ios/web/public", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//testing/gtest", "//ui/base", "//url",
diff --git a/ios/public/provider/chrome/browser/BUILD.gn b/ios/public/provider/chrome/browser/BUILD.gn index 2494038b..fea87a9 100644 --- a/ios/public/provider/chrome/browser/BUILD.gn +++ b/ios/public/provider/chrome/browser/BUILD.gn
@@ -15,7 +15,6 @@ "//components/metrics", "//ios/public/provider/chrome/browser/mailto", "//ios/public/provider/chrome/browser/signin", - "//ios/public/provider/chrome/browser/ui_utils:ui_utils_api", "//ios/web/public", "//ios/web/public/js_messaging", "//url",
diff --git a/ios/public/provider/chrome/browser/chrome_browser_provider.h b/ios/public/provider/chrome/browser/chrome_browser_provider.h index e4bb919..f398887 100644 --- a/ios/public/provider/chrome/browser/chrome_browser_provider.h +++ b/ios/public/provider/chrome/browser/chrome_browser_provider.h
@@ -21,14 +21,8 @@ class MailtoHandlerProvider; class UserFeedbackProvider; -namespace web { -class WebState; -} - -@protocol LogoVendor; @class UITextField; @class UIView; -class Browser; namespace ios { @@ -75,9 +69,6 @@ ChromeBrowserProvider(); virtual ~ChromeBrowserProvider(); - // This is called after web startup. - virtual void Initialize() const; - // Sets the current instance of Chrome identity service. Used for testing. void SetChromeIdentityServiceForTesting( std::unique_ptr<ChromeIdentityService> service); @@ -85,23 +76,10 @@ ChromeIdentityService* GetChromeIdentityService(); // Returns an instance of a Chrome trusted vault service. virtual ChromeTrustedVaultService* GetChromeTrustedVaultService(); - // Creates and returns a new styled text field. - virtual UITextField* CreateStyledTextField() const NS_RETURNS_RETAINED; - - virtual id<LogoVendor> CreateLogoVendor(Browser* browser, - web::WebState* web_state) const - NS_RETURNS_RETAINED; // Returns an instance of the user feedback provider. virtual UserFeedbackProvider* GetUserFeedbackProvider() const; - // Hides immediately the modals related to this provider. - virtual void HideModalViewStack() const; - - // Logs if any modals created by this provider are still presented. It does - // not dismiss them. - virtual void LogIfModalViewsArePresented() const; - // Returns a valid non-null instance of the mailto handler provider. virtual MailtoHandlerProvider* GetMailtoHandlerProvider() const;
diff --git a/ios/public/provider/chrome/browser/chrome_browser_provider.mm b/ios/public/provider/chrome/browser/chrome_browser_provider.mm index 6d8dcd0f..7d7185d9 100644 --- a/ios/public/provider/chrome/browser/chrome_browser_provider.mm +++ b/ios/public/provider/chrome/browser/chrome_browser_provider.mm
@@ -10,7 +10,6 @@ #include "components/metrics/metrics_provider.h" #import "ios/public/provider/chrome/browser/mailto/mailto_handler_provider.h" #import "ios/public/provider/chrome/browser/signin/chrome_identity_service.h" -#import "ios/public/provider/chrome/browser/ui_utils/ui_utils_api.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -46,10 +45,6 @@ observer.OnChromeBrowserProviderWillBeDestroyed(); } -void ChromeBrowserProvider::Initialize() const { - provider::InitializeUI(); -} - void ChromeBrowserProvider::SetChromeIdentityServiceForTesting( std::unique_ptr<ChromeIdentityService> service) { chrome_identity_service_ = std::move(service); @@ -68,16 +63,6 @@ return nullptr; } -UITextField* ChromeBrowserProvider::CreateStyledTextField() const { - return provider::CreateStyledTextField(); -} - -id<LogoVendor> ChromeBrowserProvider::CreateLogoVendor( - Browser* browser, - web::WebState* web_state) const { - return provider::CreateLogoVendor(browser, web_state); -} - UserFeedbackProvider* ChromeBrowserProvider::GetUserFeedbackProvider() const { return nullptr; } @@ -94,14 +79,6 @@ return mailto_handler_provider_.get(); } -void ChromeBrowserProvider::HideModalViewStack() const { - provider::HideModalViewStack(); -} - -void ChromeBrowserProvider::LogIfModalViewsArePresented() const { - provider::LogIfModalViewsArePresented(); -} - void ChromeBrowserProvider::AddObserver(Observer* observer) { observer_list_.AddObserver(observer); }
diff --git a/ios/web/BUILD.gn b/ios/web/BUILD.gn index 1baf37cb..b5acf2e 100644 --- a/ios/web/BUILD.gn +++ b/ios/web/BUILD.gn
@@ -138,6 +138,7 @@ "//base", "//base/test:test_support", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/http_server", "//mojo/core/embedder", ] @@ -252,6 +253,7 @@ "//ios/web/public/session", "//ios/web/public/session", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/session", "//ios/web/test:mojo_bindings", @@ -305,6 +307,7 @@ "//ios/web/public", "//ios/web/public/security", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/security", "//ios/web/test:mojo_bindings", @@ -352,6 +355,7 @@ "//ios/web/navigation:core", "//ios/web/public/navigation:referrer", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/text_fragments", "//ios/web/web_state:web_state_impl_header", @@ -393,6 +397,7 @@ "//ios/web/public/security", "//ios/web/public/session", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/security", "//ios/web/security", @@ -446,6 +451,7 @@ "//ios/web/public", "//ios/web/public/js_messaging", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/test:mojo_bindings", "//ios/web/test:test_constants", @@ -526,6 +532,7 @@ "//ios/net", "//ios/testing:ocmock_support", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/public/webui", "//ios/web/test:mojo_bindings", @@ -575,6 +582,7 @@ "//ios/web/public/session", "//ios/web/public/test", "//ios/web/public/test:element_selector", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/http_server", "//ios/web/public/webui", "//ios/web/test:mojo_bindings",
diff --git a/ios/web/browsing_data/BUILD.gn b/ios/web/browsing_data/BUILD.gn index c8a30f8b..a00557a 100644 --- a/ios/web/browsing_data/BUILD.gn +++ b/ios/web/browsing_data/BUILD.gn
@@ -36,6 +36,7 @@ "//ios/web/common:uikit", "//ios/web/net/cookies", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//testing/gtest", ]
diff --git a/ios/web/download/BUILD.gn b/ios/web/download/BUILD.gn index f9bf4b4d..0f380d4 100644 --- a/ios/web/download/BUILD.gn +++ b/ios/web/download/BUILD.gn
@@ -65,6 +65,8 @@ "//ios/web/net/cookies", "//ios/web/public/download", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/test/fakes", "//net", @@ -89,6 +91,7 @@ "//ios/web/public", "//ios/web/public/download", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//net:test_support", ]
diff --git a/ios/web/favicon/BUILD.gn b/ios/web/favicon/BUILD.gn index 98765b90..9078b1e 100644 --- a/ios/web/favicon/BUILD.gn +++ b/ios/web/favicon/BUILD.gn
@@ -45,6 +45,7 @@ "//base", "//ios/web/favicon", "//ios/web/public/favicon", + "//ios/web/public/test:test_fixture", "//testing/gtest", ] sources = [ "favicon_util_unittest.mm" ] @@ -59,6 +60,7 @@ "//ios/web/public", "//ios/web/public:web_state_observer", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", ] sources = [ "favicon_callbacks_inttest.mm" ] }
diff --git a/ios/web/find_in_page/BUILD.gn b/ios/web/find_in_page/BUILD.gn index 869794c..feae6ea 100644 --- a/ios/web/find_in_page/BUILD.gn +++ b/ios/web/find_in_page/BUILD.gn
@@ -57,6 +57,7 @@ "//ios/web/public/find_in_page", "//ios/web/public/js_messaging", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/test/fakes", "//ios/web/web_state/ui:wk_web_view_configuration_provider_header",
diff --git a/ios/web/js_features/context_menu/BUILD.gn b/ios/web/js_features/context_menu/BUILD.gn index 6e8b376..8c48562f 100644 --- a/ios/web/js_features/context_menu/BUILD.gn +++ b/ios/web/js_features/context_menu/BUILD.gn
@@ -56,6 +56,7 @@ "//ios/web/js_messaging", "//ios/web/js_messaging:java_script_feature", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/test/fakes", "//testing/gtest", ]
diff --git a/ios/web/js_features/window_error/BUILD.gn b/ios/web/js_features/window_error/BUILD.gn index d480aaa..a923673 100644 --- a/ios/web/js_features/window_error/BUILD.gn +++ b/ios/web/js_features/window_error/BUILD.gn
@@ -37,6 +37,7 @@ "//base/test:test_support", "//ios/web/js_messaging:java_script_feature", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//testing/gtest", ]
diff --git a/ios/web/js_messaging/BUILD.gn b/ios/web/js_messaging/BUILD.gn index 7dce5999..1fe4da2 100644 --- a/ios/web/js_messaging/BUILD.gn +++ b/ios/web/js_messaging/BUILD.gn
@@ -155,6 +155,7 @@ "//ios/web/common:web_view_creation_util", "//ios/web/public/js_messaging", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/test:js_test_util_internal", "//ios/web/test/fakes", @@ -196,6 +197,7 @@ "//ios/web/public", "//ios/web/public/js_messaging", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test:util", "//ios/web/public/test/fakes", "//ios/web/test:js_test_util_internal",
diff --git a/ios/web/public/test/BUILD.gn b/ios/web/public/test/BUILD.gn index d40da66..e8dfd1b8 100644 --- a/ios/web/public/test/BUILD.gn +++ b/ios/web/public/test/BUILD.gn
@@ -13,9 +13,10 @@ ] deps = [ + ":test_fixture", "//base", "//base/test:test_support", - "//ios/web:web", + "//ios/web", "//ios/web/common:features", "//ios/web/js_messaging", "//ios/web/js_messaging:java_script_feature", @@ -27,7 +28,10 @@ "//ui/base", ] - allow_circular_includes_from = [ "//ios/web/test:test_support" ] + allow_circular_includes_from = [ + ":test_fixture", + "//ios/web/test:test_support", + ] sources = [ "scoped_testing_web_client.h", @@ -35,15 +39,57 @@ "test_redirect_observer.h", "test_redirect_observer.mm", "test_web_thread.h", + "web_task_environment.h", + ] +} + +# Those fixtures *must* not be used directly from //ios/chrome code as they +# create web::BrowserState* as the BrowserState which violates one important +# invariant of //ios/chrome code (the invariant that all BrowserStates are of +# a sub-class of ChromeBrowserState). This is why the classes are defined in +# a target that limits its visibility to //ios/web, //components and to the +# targets in //ios/chrome that safely wraps those fixtures. +source_set("test_fixture") { + configs += [ "//build/config/compiler:enable_arc" ] + testonly = true + + visibility = [ + "//components/*", + "//ios/web/*", + "//ios/web_view/*", + + # Do not add new targets from //ios/chrome here. If you want to do it, + # please contact sdefresne@ or rohitrao@ to check with them. If you just + # want to use WebTest or WebTestWithWebState in //ios/chrome, instead use + # ChromeTest or ChromeWebTest respectively. + "//ios/chrome/browser/web:test_support", + "//ios/chrome/test:ios_chrome_unit_test_suite", + ] + + sources = [ "web_state_test_util.h", "web_state_test_util.mm", - "web_task_environment.h", "web_test.h", "web_test.mm", "web_test_suite.h", "web_test_with_web_state.h", "web_test_with_web_state.mm", ] + + deps = [ + "//base/test:test_support", + "//ios/web", + "//ios/web/common:features", + "//ios/web/js_messaging:java_script_feature", + "//ios/web/navigation", + "//ios/web/navigation:wk_navigation_util", + "//ios/web/public/deprecated", + "//ios/web/public/test:util", + "//ios/web/public/test/fakes", + "//ios/web/test:js_test_util_internal", + "//ui/base", + "//url", + ] } source_set("element_selector") {
diff --git a/ios/web/public/test/web_test_with_web_state.h b/ios/web/public/test/web_test_with_web_state.h index 54d9115..68f5651 100644 --- a/ios/web/public/test/web_test_with_web_state.h +++ b/ios/web/public/test/web_test_with_web_state.h
@@ -40,12 +40,22 @@ // Adds a pending item to the NavigationManager associated with the WebState. void AddPendingItem(const GURL& url, ui::PageTransition transition); - // Loads the specified HTML content with URL into the WebState. + // Loads the specified HTML content with URL into the WebState. Equivalent + // to calling `LoadHtmlInWebState(html, url, web_state())`. void LoadHtml(NSString* html, const GURL& url); // Loads the specified HTML content into the WebState, using test url name. + // Equivalent to calling `LoadHtmlInWebState(html, web_state())`. void LoadHtml(NSString* html); // Loads the specified HTML content into the WebState, using test url name. + // Equivalent to calling `LoadHtmlInWebState(html, web_state())`. [[nodiscard]] bool LoadHtml(const std::string& html); + // Loads the specified HTML content with URL into |web_state|. + void LoadHtmlInWebState(NSString* html, const GURL& url, WebState* web_state); + // Loads the specified HTML content into |web_state|, using test url name. + void LoadHtmlInWebState(NSString* html, WebState* web_state); + // Loads the specified HTML content into |web_state|, using test url name. + [[nodiscard]] bool LoadHtmlInWebState(const std::string& html, + WebState* web_state); // Loads the specified HTML content with URL into the WebState. None of the // subresources will be fetched. // This function is only supported on iOS11+. On iOS10, this function simply
diff --git a/ios/web/public/test/web_test_with_web_state.mm b/ios/web/public/test/web_test_with_web_state.mm index 8a55760..d013c7e 100644 --- a/ios/web/public/test/web_test_with_web_state.mm +++ b/ios/web/public/test/web_test_with_web_state.mm
@@ -118,16 +118,32 @@ } void WebTestWithWebState::LoadHtml(NSString* html, const GURL& url) { - web::test::LoadHtml(html, url, web_state()); + LoadHtmlInWebState(html, url, web_state()); } void WebTestWithWebState::LoadHtml(NSString* html) { - web::test::LoadHtml(html, web_state()); + LoadHtmlInWebState(html, web_state()); } bool WebTestWithWebState::LoadHtml(const std::string& html) { - LoadHtml(base::SysUTF8ToNSString(html)); - // TODO(crbug.com/780062): LoadHtml(NSString*) should return bool. + return LoadHtmlInWebState(html, web_state()); +} + +void WebTestWithWebState::LoadHtmlInWebState(NSString* html, + const GURL& url, + WebState* web_state) { + web::test::LoadHtml(html, url, web_state); +} + +void WebTestWithWebState::LoadHtmlInWebState(NSString* html, + WebState* web_state) { + web::test::LoadHtml(html, web_state); +} + +bool WebTestWithWebState::LoadHtmlInWebState(const std::string& html, + WebState* web_state) { + LoadHtmlInWebState(base::SysUTF8ToNSString(html), web_state); + // TODO(crbug.com/780062): LoadHtmlInWebState(NSString*) should return bool. return true; }
diff --git a/ios/web/security/BUILD.gn b/ios/web/security/BUILD.gn index 3aba46d0..5bfc2bd 100644 --- a/ios/web/security/BUILD.gn +++ b/ios/web/security/BUILD.gn
@@ -51,6 +51,7 @@ "//ios/web/public", "//ios/web/public/security", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//ios/web/public/test/fakes", "//ios/web/test/fakes", "//ios/web/web_state:web_state_impl_header",
diff --git a/ios/web/test/BUILD.gn b/ios/web/test/BUILD.gn index a53b82c..ea42b72 100644 --- a/ios/web/test/BUILD.gn +++ b/ios/web/test/BUILD.gn
@@ -61,6 +61,7 @@ "//ios/web/common:uikit", "//ios/web/common:web_view_creation_util", "//ios/web/navigation:core", + "//ios/web/public/test:test_fixture", "//ios/web/public/test:util", "//ios/web/public/test/fakes", "//ios/web/public/test/http_server",
diff --git a/ios/web_view/BUILD.gn b/ios/web_view/BUILD.gn index 1853e2e..578788d 100644 --- a/ios/web_view/BUILD.gn +++ b/ios/web_view/BUILD.gn
@@ -479,6 +479,7 @@ "//ios/web/public/js_messaging", "//ios/web/public/security", "//ios/web/public/test", + "//ios/web/public/test:test_fixture", "//testing/gtest", "//third_party/ocmock", ]
diff --git a/media/renderers/paint_canvas_video_renderer_unittest.cc b/media/renderers/paint_canvas_video_renderer_unittest.cc index a0265418..f6d5700 100644 --- a/media/renderers/paint_canvas_video_renderer_unittest.cc +++ b/media/renderers/paint_canvas_video_renderer_unittest.cc
@@ -935,8 +935,9 @@ 2 /*xoffset*/, 1 /*yoffset*/, false /*flip_y*/, true); } -// Fixture for tests that require a GL context. -class PaintCanvasVideoRendererWithGLTest : public testing::Test { +// Fixture for tests that require a GL context. The input parameter indicates +// whether OOPR mode is enabled. +class PaintCanvasVideoRendererWithGLTest : public testing::TestWithParam<bool> { public: using GetColorCallback = base::RepeatingCallback<SkColor(int, int)>; @@ -945,7 +946,9 @@ enable_pixels_.emplace(); media_context_ = base::MakeRefCounted<viz::TestInProcessContextProvider>( /*enable_gles2_interface=*/false, - /*support_locking=*/false, viz::RasterInterfaceType::GPU); + /*support_locking=*/false, + GetParam() ? viz::RasterInterfaceType::OOPR + : viz::RasterInterfaceType::GPU); gpu::ContextResult result = media_context_->BindToCurrentThread(); ASSERT_EQ(result, gpu::ContextResult::kSuccess); @@ -1136,7 +1139,11 @@ base::test::TaskEnvironment task_environment_; }; -TEST_F(PaintCanvasVideoRendererWithGLTest, CopyVideoFrameYUVDataToGLTexture) { +INSTANTIATE_TEST_SUITE_P(OopRasterMode, + PaintCanvasVideoRendererWithGLTest, + testing::Bool()); + +TEST_P(PaintCanvasVideoRendererWithGLTest, CopyVideoFrameYUVDataToGLTexture) { auto* destination_gl = destination_context_->ContextGL(); DCHECK(destination_gl); GLenum target = GL_TEXTURE_2D; @@ -1167,7 +1174,7 @@ destination_gl->DeleteTextures(1, &texture); } -TEST_F(PaintCanvasVideoRendererWithGLTest, +TEST_P(PaintCanvasVideoRendererWithGLTest, CopyVideoFrameYUVDataToGLTexture_FlipY) { auto* destination_gl = destination_context_->ContextGL(); DCHECK(destination_gl); @@ -1201,7 +1208,7 @@ // Checks that we correctly copy a RGBA shared image VideoFrame when using // CopyVideoFrameYUVDataToGLTexture, including correct cropping. -TEST_F(PaintCanvasVideoRendererWithGLTest, +TEST_P(PaintCanvasVideoRendererWithGLTest, CopyVideoFrameTexturesToGLTextureRGBA) { base::RunLoop run_loop; scoped_refptr<VideoFrame> frame = CreateTestRGBAFrame(run_loop.QuitClosure()); @@ -1215,7 +1222,7 @@ // Checks that we correctly copy a RGBA shared image VideoFrame that needs read // lock fences, when using CopyVideoFrameYUVDataToGLTexture, including correct // cropping. -TEST_F(PaintCanvasVideoRendererWithGLTest, +TEST_P(PaintCanvasVideoRendererWithGLTest, CopyVideoFrameTexturesToGLTextureRGBA_ReadLockFence) { base::RunLoop run_loop; scoped_refptr<VideoFrame> frame = CreateTestRGBAFrame(run_loop.QuitClosure()); @@ -1229,7 +1236,7 @@ // Checks that we correctly paint a RGBA shared image VideoFrame, including // correct cropping. -TEST_F(PaintCanvasVideoRendererWithGLTest, PaintRGBA) { +TEST_P(PaintCanvasVideoRendererWithGLTest, PaintRGBA) { base::RunLoop run_loop; scoped_refptr<VideoFrame> frame = CreateTestRGBAFrame(run_loop.QuitClosure()); @@ -1241,7 +1248,7 @@ // Checks that we correctly copy an I420 shared image VideoFrame when using // CopyVideoFrameYUVDataToGLTexture, including correct cropping. -TEST_F(PaintCanvasVideoRendererWithGLTest, +TEST_P(PaintCanvasVideoRendererWithGLTest, CopyVideoFrameTexturesToGLTextureI420) { base::RunLoop run_loop; scoped_refptr<VideoFrame> frame = CreateTestI420Frame(run_loop.QuitClosure()); @@ -1254,7 +1261,7 @@ // Checks that we correctly paint a I420 shared image VideoFrame, including // correct cropping. -TEST_F(PaintCanvasVideoRendererWithGLTest, PaintI420) { +TEST_P(PaintCanvasVideoRendererWithGLTest, PaintI420) { base::RunLoop run_loop; scoped_refptr<VideoFrame> frame = CreateTestI420Frame(run_loop.QuitClosure()); @@ -1266,7 +1273,7 @@ // Checks that we correctly paint a I420 shared image VideoFrame, including // correct cropping. -TEST_F(PaintCanvasVideoRendererWithGLTest, PaintI420NotSubset) { +TEST_P(PaintCanvasVideoRendererWithGLTest, PaintI420NotSubset) { base::RunLoop run_loop; scoped_refptr<VideoFrame> frame = CreateTestI420FrameNotSubset(run_loop.QuitClosure()); @@ -1279,7 +1286,7 @@ // Checks that we correctly copy a NV12 shared image VideoFrame when using // CopyVideoFrameYUVDataToGLTexture, including correct cropping. -TEST_F(PaintCanvasVideoRendererWithGLTest, +TEST_P(PaintCanvasVideoRendererWithGLTest, CopyVideoFrameTexturesToGLTextureNV12) { base::RunLoop run_loop; scoped_refptr<VideoFrame> frame = CreateTestNV12Frame(run_loop.QuitClosure()); @@ -1296,7 +1303,7 @@ // Checks that we correctly paint a NV12 shared image VideoFrame, including // correct cropping. -TEST_F(PaintCanvasVideoRendererWithGLTest, PaintNV12) { +TEST_P(PaintCanvasVideoRendererWithGLTest, PaintNV12) { base::RunLoop run_loop; scoped_refptr<VideoFrame> frame = CreateTestNV12Frame(run_loop.QuitClosure()); if (!frame) {
diff --git a/net/quic/dedicated_web_transport_http3_client_test.cc b/net/quic/dedicated_web_transport_http3_client_test.cc index f7fd69b2..a60b3d0 100644 --- a/net/quic/dedicated_web_transport_http3_client_test.cc +++ b/net/quic/dedicated_web_transport_http3_client_test.cc
@@ -9,6 +9,7 @@ #include "base/memory/raw_ptr.h" #include "base/strings/strcat.h" #include "base/threading/thread_task_runner_handle.h" +#include "build/build_config.h" #include "net/base/schemeful_site.h" #include "net/cert/mock_cert_verifier.h" #include "net/dns/mock_host_resolver.h" @@ -204,7 +205,13 @@ Run(); } -TEST_F(DedicatedWebTransportHttp3Test, CloseTimeout) { +// TODO(https://crbug.com/1288036): The test is flaky on Mac. +#if defined(OS_MAC) +#define MAYBE_CloseTimeout DISABLED_CloseTimeout +#else +#define MAYBE_CloseTimeout CloseTimeout +#endif +TEST_F(DedicatedWebTransportHttp3Test, MAYBE_CloseTimeout) { StartServer(); client_ = std::make_unique<DedicatedWebTransportHttp3Client>( GetURL("/echo"), origin_, &visitor_, isolation_key_, context_.get(),
diff --git a/net/reporting/reporting_uploader.cc b/net/reporting/reporting_uploader.cc index d432bbd3..074a1cc 100644 --- a/net/reporting/reporting_uploader.cc +++ b/net/reporting/reporting_uploader.cc
@@ -283,17 +283,18 @@ // Check that the preflight succeeded: it must have an HTTP OK status code, // with the following headers: // - Access-Control-Allow-Origin: * or the report origin - // - Access-Control-Allow-Methods: POST - // - Access-Control-Allow-Headers: Content-Type + // - Access-Control-Allow-Headers: * or Content-Type + // Note that * is allowed here as the credentials mode is never 'include'. + // Access-Control-Allow-Methods is not checked, as the preflight is always + // for a POST method, which is safelisted. URLRequest* request = upload->request.get(); bool preflight_succeeded = (response_code >= 200 && response_code <= 299) && HasHeaderValues( request, "Access-Control-Allow-Origin", {"*", base::ToLowerASCII(upload->report_origin.Serialize())}) && - HasHeaderValues(request, "Access-Control-Allow-Methods", {"post"}) && HasHeaderValues(request, "Access-Control-Allow-Headers", - {"content-type"}); + {"*", "content-type"}); if (!preflight_succeeded) { upload->RunCallback(ReportingUploader::Outcome::FAILURE); return;
diff --git a/net/reporting/reporting_uploader_unittest.cc b/net/reporting/reporting_uploader_unittest.cc index 945cdf4..94ef3eb 100644 --- a/net/reporting/reporting_uploader_unittest.cc +++ b/net/reporting/reporting_uploader_unittest.cc
@@ -332,7 +332,39 @@ false, callback.callback()); callback.WaitForCall(); - EXPECT_EQ(ReportingUploader::Outcome::FAILURE, callback.outcome()); + EXPECT_EQ(ReportingUploader::Outcome::SUCCESS, callback.outcome()); +} + +std::unique_ptr<test_server::HttpResponse> ReturnPreflightWithWildcardMethods( + const test_server::HttpRequest& request) { + if (request.method_string != "OPTIONS") { + return nullptr; + } + auto it = request.headers.find("Origin"); + EXPECT_TRUE(it != request.headers.end()); + auto response = std::make_unique<test_server::BasicHttpResponse>(); + response->AddCustomHeader("Access-Control-Allow-Origin", it->second); + response->AddCustomHeader("Access-Control-Allow-Headers", "Content-Type"); + response->AddCustomHeader("Access-Control-Allow-Methods", "*"); + response->set_code(HTTP_OK); + response->set_content(""); + response->set_content_type("text/plain"); + return std::move(response); +} + +TEST_F(ReportingUploaderTest, CorsPreflightWildcardMethods) { + server_.RegisterRequestHandler( + base::BindRepeating(&ReturnPreflightWithWildcardMethods)); + server_.RegisterRequestHandler(base::BindRepeating(&ReturnResponse, HTTP_OK)); + ASSERT_TRUE(server_.Start()); + + TestUploadCallback callback; + uploader_->StartUpload(kOrigin, server_.GetURL("/"), + IsolationInfo::CreateTransient(), kUploadBody, 0, + false, callback.callback()); + callback.WaitForCall(); + + EXPECT_EQ(ReportingUploader::Outcome::SUCCESS, callback.outcome()); } std::unique_ptr<test_server::HttpResponse> ReturnPreflightWithoutHeaders( @@ -366,6 +398,38 @@ EXPECT_EQ(ReportingUploader::Outcome::FAILURE, callback.outcome()); } +std::unique_ptr<test_server::HttpResponse> ReturnPreflightWithWildcardHeaders( + const test_server::HttpRequest& request) { + if (request.method_string != "OPTIONS") { + return nullptr; + } + auto it = request.headers.find("Origin"); + EXPECT_TRUE(it != request.headers.end()); + auto response = std::make_unique<test_server::BasicHttpResponse>(); + response->AddCustomHeader("Access-Control-Allow-Origin", it->second); + response->AddCustomHeader("Access-Control-Allow-Headers", "*"); + response->AddCustomHeader("Access-Control-Allow-Methods", "POST"); + response->set_code(HTTP_OK); + response->set_content(""); + response->set_content_type("text/plain"); + return std::move(response); +} + +TEST_F(ReportingUploaderTest, CorsPreflightWildcardHeaders) { + server_.RegisterRequestHandler( + base::BindRepeating(&ReturnPreflightWithWildcardHeaders)); + server_.RegisterRequestHandler(base::BindRepeating(&ReturnResponse, HTTP_OK)); + ASSERT_TRUE(server_.Start()); + + TestUploadCallback callback; + uploader_->StartUpload(kOrigin, server_.GetURL("/"), + IsolationInfo::CreateTransient(), kUploadBody, 0, + false, callback.callback()); + callback.WaitForCall(); + + EXPECT_EQ(ReportingUploader::Outcome::SUCCESS, callback.outcome()); +} + TEST_F(ReportingUploaderTest, RemoveEndpoint) { server_.RegisterRequestHandler(base::BindRepeating(&AllowPreflight)); server_.RegisterRequestHandler(
diff --git a/remoting/resources/remoting_strings_cs.xtb b/remoting/resources/remoting_strings_cs.xtb index f583518..7f88136f 100644 --- a/remoting/resources/remoting_strings_cs.xtb +++ b/remoting/resources/remoting_strings_cs.xtb
@@ -36,6 +36,7 @@ <translation id="2599300881200251572">Tato služba umožňuje příchozí připojení od klientů Vzdálené plochy Chrome.</translation> <translation id="2647232381348739934">Služba funkce Chromoting</translation> <translation id="2676780859508944670">Probíhá zpracování…</translation> +<translation id="2692522824157224199">Copyright 2022 Google LLC. Všechna práva vyhrazena.</translation> <translation id="2699970397166997657">Chromoting</translation> <translation id="2758123043070977469">Při ověřování došlo k problému. Přihlaste se prosím znovu.</translation> <translation id="2803375539583399270">Zadejte kód PIN</translation> @@ -72,6 +73,7 @@ <translation id="4257751272692708833">Nástroj k předávání adres URL pro klienta <ph name="PRODUCT_NAME" /></translation> <translation id="4277736576214464567">Přístupový kód je neplatný. Zkuste to prosím znovu.</translation> <translation id="4281844954008187215">Smluvní podmínky</translation> +<translation id="4372650392690220936">Copyright 2022 Autoři prohlížeče Chromium. Všechna práva vyhrazena.</translation> <translation id="4405930547258349619">Základní knihovna</translation> <translation id="443560535555262820">Otevřít nastavení přístupnosti</translation> <translation id="4450893287417543264">Tuto zprávu již nezobrazovat</translation>
diff --git a/remoting/resources/remoting_strings_th.xtb b/remoting/resources/remoting_strings_th.xtb index 6b6e2eb..1529635b 100644 --- a/remoting/resources/remoting_strings_th.xtb +++ b/remoting/resources/remoting_strings_th.xtb
@@ -36,6 +36,7 @@ <translation id="2599300881200251572">บริการนี้จะช่วยให้สามารถใช้การเชื่อมต่อขาเข้าจากไคลเอ็นต์ Chrome Remote Desktop</translation> <translation id="2647232381348739934">Chromoting Service</translation> <translation id="2676780859508944670">กำลังทำงาน…</translation> +<translation id="2692522824157224199">Copyright 2022 Google LLC. All Rights Reserved.</translation> <translation id="2699970397166997657">Chromoting</translation> <translation id="2758123043070977469">มีปัญหาในการตรวจสอบสิทธิ์ โปรดเข้าสู่ระบบอีกครั้ง</translation> <translation id="2803375539583399270">ป้อน PIN</translation> @@ -72,6 +73,7 @@ <translation id="4257751272692708833">ผู้ส่งต่อ URL ของ <ph name="PRODUCT_NAME" /></translation> <translation id="4277736576214464567">รหัสการเข้าถึงไม่ถูกต้อง โปรดลองอีกครั้ง</translation> <translation id="4281844954008187215">ข้อกำหนดในการให้บริการ</translation> +<translation id="4372650392690220936">Copyright 2022 The Chromium Authors. All Rights Reserved.</translation> <translation id="4405930547258349619">Core Library</translation> <translation id="443560535555262820">เปิดค่ากำหนดการเข้าถึง</translation> <translation id="4450893287417543264">ไม่ต้องแสดงอีก</translation>
diff --git a/services/network/BUILD.gn b/services/network/BUILD.gn index 45070bd..53250cf 100644 --- a/services/network/BUILD.gn +++ b/services/network/BUILD.gn
@@ -213,17 +213,22 @@ ] } - if (is_chromeos_ash) { + if (is_chromeos) { sources += [ "cert_verifier_with_trust_anchors.cc", "cert_verifier_with_trust_anchors.h", - "dhcp_pac_file_fetcher_mojo.cc", - "dhcp_pac_file_fetcher_mojo.h", "nss_temp_certs_cache_chromeos.cc", "nss_temp_certs_cache_chromeos.h", ] } + if (is_chromeos_ash) { + sources += [ + "dhcp_pac_file_fetcher_mojo.cc", + "dhcp_pac_file_fetcher_mojo.h", + ] + } + configs += [ "//build/config/compiler:wexit_time_destructors" ] deps = [
diff --git a/services/network/network_context.cc b/services/network/network_context.cc index 4f399e5..59a4a09 100644 --- a/services/network/network_context.cc +++ b/services/network/network_context.cc
@@ -132,9 +132,9 @@ #include "services/network/sct_auditing/sct_auditing_handler.h" #endif // BUILDFLAG(IS_CT_SUPPORTED) -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) #include "services/network/cert_verifier_with_trust_anchors.h" -#endif // BUILDFLAG(IS_CHROMEOS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS) #if !BUILDFLAG(IS_IOS) #include "services/network/websocket_factory.h" @@ -1266,7 +1266,7 @@ network_delegate_->set_enable_referrers(enable_referrers); } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void NetworkContext::UpdateAdditionalCertificates( mojom::AdditionalCertificatesPtr additional_certificates) { if (!cert_verifier_with_trust_anchors_) { @@ -1283,7 +1283,7 @@ additional_certificates->trust_anchors, additional_certificates->all_certificates); } -#endif // BUILDFLAG(IS_CHROMEOS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS) #if BUILDFLAG(IS_CT_SUPPORTED) void NetworkContext::SetCTPolicy(mojom::CTPolicyPtr ct_policy) { @@ -2137,7 +2137,7 @@ std::make_unique<net::CoalescingCertVerifier>( std::move(cert_verifier))); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) cert_verifier_with_trust_anchors_ = new CertVerifierWithTrustAnchors(base::BindRepeating( &NetworkContext::TrustAnchorUsed, base::Unretained(this))); @@ -2146,7 +2146,7 @@ cert_verifier_with_trust_anchors_->InitializeOnIOThread( std::move(cert_verifier)); cert_verifier = base::WrapUnique(cert_verifier_with_trust_anchors_); -#endif // BUILDFLAG(IS_CHROMEOS_ASH) +#endif // BUILDFLAG(IS_CHROMEOS) } builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier( @@ -2730,7 +2730,7 @@ .Run(result, *pending_cert_verify->result.get()); } -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void NetworkContext::TrustAnchorUsed() { client_->OnTrustAnchorUsed(); }
diff --git a/services/network/network_context.h b/services/network/network_context.h index cec665b..b2be0106 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h
@@ -274,7 +274,7 @@ mojom::NetworkConditionsPtr conditions) override; void SetAcceptLanguage(const std::string& new_accept_language) override; void SetEnableReferrers(bool enable_referrers) override; -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void UpdateAdditionalCertificates( mojom::AdditionalCertificatesPtr additional_certificates) override; #endif @@ -621,7 +621,7 @@ void OnVerifyCertForSignedExchangeComplete(int cert_verify_id, int result); -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void TrustAnchorUsed(); #endif @@ -753,7 +753,7 @@ std::unique_ptr<SCTAuditingHandler> sct_auditing_handler_; #endif // BUILDFLAG(IS_CT_SUPPORTED) -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) CertVerifierWithTrustAnchors* cert_verifier_with_trust_anchors_ = nullptr; #endif
diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom index 2fe90683..d7c10e5a 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom
@@ -137,7 +137,7 @@ ClearBadProxiesCache(); }; -[EnableIf=is_chromeos_ash] +[EnableIf=is_chromeos] struct AdditionalCertificates { // List of all additional certificates. array<X509Certificate> all_certificates; @@ -437,7 +437,7 @@ // Initial additional certificates that will be used for certificate // validation. - [EnableIf=is_chromeos_ash] + [EnableIf=is_chromeos] AdditionalCertificates? initial_additional_certificates; // Parameters for constructing the cookie manager. @@ -769,7 +769,7 @@ (int32 result, string auth_token); // Notification that a trust anchor was used for the given user. - [EnableIf=is_chromeos_ash] + [EnableIf=is_chromeos] OnTrustAnchorUsed(); // If it's supported by the implementation, attempts to provide a response to @@ -1042,7 +1042,7 @@ SetEnableReferrers(bool enable_referrers); // Updates the additional trust anchors for certificate verification. - [EnableIf=is_chromeos_ash] + [EnableIf=is_chromeos] UpdateAdditionalCertificates(AdditionalCertificates? additional_certificates); // Updates the CT policy to be used for requests. Only applies if the
diff --git a/services/network/test/test_network_context.h b/services/network/test/test_network_context.h index b766ae3a..309a96f 100644 --- a/services/network/test/test_network_context.h +++ b/services/network/test/test_network_context.h
@@ -136,7 +136,7 @@ mojom::NetworkConditionsPtr conditions) override {} void SetAcceptLanguage(const std::string& new_accept_language) override {} void SetEnableReferrers(bool enable_referrers) override {} -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void UpdateAdditionalCertificates( mojom::AdditionalCertificatesPtr additional_certificates) override {} #endif
diff --git a/services/network/test/test_network_context_client.h b/services/network/test/test_network_context_client.h index 7366307..5a5aa08 100644 --- a/services/network/test/test_network_context_client.h +++ b/services/network/test/test_network_context_client.h
@@ -49,7 +49,7 @@ const std::string& spn, OnGenerateHttpNegotiateAuthTokenCallback callback) override {} #endif -#if BUILDFLAG(IS_CHROMEOS_ASH) +#if BUILDFLAG(IS_CHROMEOS) void OnTrustAnchorUsed() override {} #endif #if BUILDFLAG(IS_CT_SUPPORTED)
diff --git a/testing/buildbot/filters/android.emulator_11_12.media_unittests.filter b/testing/buildbot/filters/android.emulator_11_12.media_unittests.filter index 33612d2..cd4d62a 100644 --- a/testing/buildbot/filters/android.emulator_11_12.media_unittests.filter +++ b/testing/buildbot/filters/android.emulator_11_12.media_unittests.filter
@@ -1,5 +1,5 @@ # https://crbug.com/1189284 # Not applicable to emulator due to not supporting fence sync --PaintCanvasVideoRendererWithGLTest.CopyVideoFrameTexturesToGLTexture* --PaintCanvasVideoRendererWithGLTest.CopyVideoFrameYUVDataToGLTexture* --PaintCanvasVideoRendererWithGLTest.Paint* +-OopRasterMode/PaintCanvasVideoRendererWithGLTest.CopyVideoFrameTexturesToGLTexture*/1 +-OopRasterMode/PaintCanvasVideoRendererWithGLTest.CopyVideoFrameYUVDataToGLTexture*/1 +-OopRasterMode/PaintCanvasVideoRendererWithGLTest.Paint*/1 \ No newline at end of file
diff --git a/testing/buildbot/filters/fuchsia.debug.media_unittests.filter b/testing/buildbot/filters/fuchsia.debug.media_unittests.filter index 2e0369fc..489ab52 100644 --- a/testing/buildbot/filters/fuchsia.debug.media_unittests.filter +++ b/testing/buildbot/filters/fuchsia.debug.media_unittests.filter
@@ -1,2 +1,2 @@ # https://crbug.com/1241502 --PaintCanvasVideoRendererWithGLTest.* +-OopRasterMode/PaintCanvasVideoRendererWithGLTest.*
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 82ae4f2..0dbd291 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -2201,6 +2201,25 @@ { "name": "CandidateB", "params": { + "hide_switch_when_no_incognito_tabs": "true", + "open_ntp_instead_of_start": "true", + "show_last_active_tab_only": "true", + "signin_promo_NTP_count_limit": "5", + "signin_promo_NTP_reset_after_hours": "336", + "signin_promo_NTP_since_first_time_shown_limit_hours": "672", + "start_surface_variation": "single", + "support_accessibility": "true", + "tab_count_button_on_start_surface": "true", + "tab_switcher_on_return_time_ms": "3600000" + }, + "enable_features": [ + "StartSurfaceAndroid", + "TabSwitcherOnReturn" + ] + }, + { + "name": "CandidateBwithEnhancedProtectionPromoCard", + "params": { "MaxSigninPromoImpressions": "5", "hide_switch_when_no_incognito_tabs": "true", "open_ntp_instead_of_start": "true",
diff --git a/third_party/abseil-cpp/symbols_arm64_rel.def b/third_party/abseil-cpp/symbols_arm64_rel.def index d7695d2d..883c8cf 100644 --- a/third_party/abseil-cpp/symbols_arm64_rel.def +++ b/third_party/abseil-cpp/symbols_arm64_rel.def
@@ -84,8 +84,6 @@ ??$SetEdge@$0A@@CordRepBtree@cord_internal@absl@@QEAA?AUOpResult@012@_NPEAUCordRep@12@_K@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YA?AV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@Vstring_view@0@AEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@3@@Z ??$StrReplaceAll@V?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@@absl@@YAHAEBV?$initializer_list@U?$pair@Vstring_view@absl@@V12@@__1@std@@@std@@PEAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@2@@Z - ??$ToChronoDuration@V?$duration@_JV?$ratio@$00$0DOI@@__1@std@@@chrono@__1@std@@@time_internal@absl@@YA?AV?$duration@_JV?$ratio@$00$0DOI@@__1@std@@@chrono@__1@std@@VDuration@1@@Z - ??$ToChronoDuration@V?$duration@_JV?$ratio@$00$0PECEA@@__1@std@@@chrono@__1@std@@@time_internal@absl@@YA?AV?$duration@_JV?$ratio@$00$0PECEA@@__1@std@@@chrono@__1@std@@VDuration@1@@Z ??$__construct_node_hash@AEBUpiecewise_construct_t@__1@std@@V?$tuple@AEBV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@V?$tuple@$$V@23@@?$__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@@AEAA?AV?$unique_ptr@U?$__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@@V?$__hash_node_destructor@V?$allocator@U?$__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@@@23@@12@_KAEBUpiecewise_construct_t@12@$$QEAV?$tuple@AEBV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@12@$$QEAV?$tuple@$$V@12@@Z ??$__emplace_back_slow_path@AEAVstring_view@absl@@AEBV12@AEA_K@?$vector@UViableSubstitution@strings_internal@absl@@V?$allocator@UViableSubstitution@strings_internal@absl@@@__1@std@@@__1@std@@AEAAXAEAVstring_view@absl@@AEBV34@AEA_K@Z ??$__emplace_unique_key_args@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@AEBUpiecewise_construct_t@23@V?$tuple@AEBV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@23@V?$tuple@$$V@23@@?$__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?AU?$pair@V?$__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@@@__1@std@@_N@12@AEBV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@12@AEBUpiecewise_construct_t@12@$$QEAV?$tuple@AEBV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@12@$$QEAV?$tuple@$$V@12@@Z
diff --git a/third_party/abseil-cpp/symbols_x64_rel.def b/third_party/abseil-cpp/symbols_x64_rel.def index 4d392c6..034462b 100644 --- a/third_party/abseil-cpp/symbols_x64_rel.def +++ b/third_party/abseil-cpp/symbols_x64_rel.def
@@ -204,6 +204,7 @@ ??Gdetail@cctz@time_internal@absl@@YA?AV?$civil_time@Uday_tag@detail@cctz@time_internal@absl@@@0123@V40123@_J@Z ??Gdetail@cctz@time_internal@absl@@YA?AV?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@0123@V40123@_J@Z ??Hdetail@cctz@time_internal@absl@@YA?AV?$civil_time@Uday_tag@detail@cctz@time_internal@absl@@@0123@V40123@_J@Z + ??Hdetail@cctz@time_internal@absl@@YA?AV?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@0123@V40123@_J@Z ??Kabsl@@YA?AVint128@0@V10@0@Z ??Kabsl@@YA?AVuint128@0@V10@0@Z ??Labsl@@YA?AVint128@0@V10@0@Z @@ -911,6 +912,7 @@ ?max@?$RandenPool@G@random_internal@absl@@SAGXZ ?max@?$RandenPool@I@random_internal@absl@@SAIXZ ?max@?$RandenPool@_K@random_internal@absl@@SA_KXZ + ?max@?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@detail@cctz@time_internal@absl@@SA?AV12345@XZ ?memcasecmp@strings_internal@absl@@YAHPEBD0_K@Z ?memcspn@strings_internal@absl@@YA_KPEBD_K0@Z ?memdup@strings_internal@absl@@YAPEADPEBD_K@Z
diff --git a/third_party/abseil-cpp/symbols_x64_rel_asan.def b/third_party/abseil-cpp/symbols_x64_rel_asan.def index 01bc1fd..b675dff8 100644 --- a/third_party/abseil-cpp/symbols_x64_rel_asan.def +++ b/third_party/abseil-cpp/symbols_x64_rel_asan.def
@@ -213,6 +213,7 @@ ??Gdetail@cctz@time_internal@absl@@YA?AV?$civil_time@Uday_tag@detail@cctz@time_internal@absl@@@0123@V40123@_J@Z ??Gdetail@cctz@time_internal@absl@@YA?AV?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@0123@V40123@_J@Z ??Hdetail@cctz@time_internal@absl@@YA?AV?$civil_time@Uday_tag@detail@cctz@time_internal@absl@@@0123@V40123@_J@Z + ??Hdetail@cctz@time_internal@absl@@YA?AV?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@0123@V40123@_J@Z ??Kabsl@@YA?AVint128@0@V10@0@Z ??Kabsl@@YA?AVuint128@0@V10@0@Z ??Labsl@@YA?AVint128@0@V10@0@Z @@ -957,6 +958,7 @@ ?max@?$RandenPool@G@random_internal@absl@@SAGXZ ?max@?$RandenPool@I@random_internal@absl@@SAIXZ ?max@?$RandenPool@_K@random_internal@absl@@SA_KXZ + ?max@?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@detail@cctz@time_internal@absl@@SA?AV12345@XZ ?memcasecmp@strings_internal@absl@@YAHPEBD0_K@Z ?memcspn@strings_internal@absl@@YA_KPEBD_K0@Z ?memdup@strings_internal@absl@@YAPEADPEBD_K@Z
diff --git a/third_party/abseil-cpp/symbols_x86_rel.def b/third_party/abseil-cpp/symbols_x86_rel.def index e24357d..1ee0b5d 100644 --- a/third_party/abseil-cpp/symbols_x86_rel.def +++ b/third_party/abseil-cpp/symbols_x86_rel.def
@@ -908,6 +908,7 @@ ?max@?$RandenPool@G@random_internal@absl@@SAGXZ ?max@?$RandenPool@I@random_internal@absl@@SAIXZ ?max@?$RandenPool@_K@random_internal@absl@@SA_KXZ + ?max@?$civil_time@Usecond_tag@detail@cctz@time_internal@absl@@@detail@cctz@time_internal@absl@@SA?AV12345@XZ ?memcasecmp@strings_internal@absl@@YAHPBD0I@Z ?memcspn@strings_internal@absl@@YAIPBDI0@Z ?memdup@strings_internal@absl@@YAPADPBDI@Z
diff --git a/third_party/blink/common/BUILD.gn b/third_party/blink/common/BUILD.gn index b6ffbb5..bdba239 100644 --- a/third_party/blink/common/BUILD.gn +++ b/third_party/blink/common/BUILD.gn
@@ -49,6 +49,27 @@ ] } +blink_python_runner("make_generated_origin_trials") { + script = "../renderer/build/scripts/make_origin_trials.py" + + inputs = scripts_for_json5_files + [ + "../renderer/build/scripts/make_origin_trials.py", + "../renderer/platform/runtime_enabled_features.json5", + "../renderer/build/scripts/templates/origin_trials.cc.tmpl", + ] + outputs = [ + "$root_gen_dir/third_party/blink/common/origin_trials/origin_trials.cc", + ] + + args = [ + rebase_path("../renderer/platform/runtime_enabled_features.json5", + root_build_dir), + "--output_dir", + rebase_path("$root_gen_dir/third_party/blink/common/origin_trials", + root_build_dir), + ] +} + config("blink_common_implementation") { defines = [ "BLINK_COMMON_IMPLEMENTATION=1" ] } @@ -160,6 +181,7 @@ "notifications/notification_mojom_traits.cc", "notifications/notification_resources.cc", "notifications/platform_notification_data.cc", + "origin_trials/navigation_origin_trial_features.cc", "origin_trials/trial_token.cc", "origin_trials/trial_token_result.cc", "origin_trials/trial_token_validator.cc", @@ -202,10 +224,12 @@ ] sources += get_target_outputs(":make_generated_document_policy_features") + sources += get_target_outputs(":make_generated_origin_trials") sources += get_target_outputs(":make_generated_permissions_policy_features") public_deps = [ ":make_generated_document_policy_features", + ":make_generated_origin_trials", ":make_generated_permissions_policy_features", "//third_party/blink/common/privacy_budget:privacy_budget", "//third_party/blink/public/common:common_export", @@ -307,6 +331,7 @@ "messaging/message_port_descriptor_unittest.cc", "mime_util/mime_util_unittest.cc", "notifications/notification_mojom_traits_unittest.cc", + "origin_trials/origin_trials_test.cc", "origin_trials/trial_token_unittest.cc", "origin_trials/trial_token_validator_unittest.cc", "page/content_to_visible_time_reporter_unittest.cc",
diff --git a/third_party/blink/common/origin_trials/OWNERS b/third_party/blink/common/origin_trials/OWNERS index 50c5c0d..9e491c4 100644 --- a/third_party/blink/common/origin_trials/OWNERS +++ b/third_party/blink/common/origin_trials/OWNERS
@@ -7,3 +7,6 @@ chasej@chromium.org iclelland@chromium.org mek@chromium.org + +per-file navigation_origin_trial_features.cc=set noparent +per-file navigation_origin_trial_features.cc=file://third_party/blink/SECURITY_OWNERS
diff --git a/third_party/blink/common/origin_trials/navigation_origin_trial_features.cc b/third_party/blink/common/origin_trials/navigation_origin_trial_features.cc new file mode 100644 index 0000000..df471b6d --- /dev/null +++ b/third_party/blink/common/origin_trials/navigation_origin_trial_features.cc
@@ -0,0 +1,30 @@ +// 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. + +// This file provides FeatureEnabledForNavigation which is declared in +// origin_trials.h. FeatureEnabledForNavigation is defined in this file since +// changes to it require review from security reviewers, listed in the +// SECURITY_OWNERS file. + +#include "third_party/blink/public/common/origin_trials/origin_trials.h" + +#include "base/containers/contains.h" + +namespace blink { + +namespace origin_trials { + +bool FeatureEnabledForNavigation(OriginTrialFeature feature) { + static OriginTrialFeature const kEnabledForNavigation[] = { + // Enable the kOriginTrialsSampleAPINavigation feature as a navigation + // feature, for tests. + OriginTrialFeature::kOriginTrialsSampleAPINavigation, + OriginTrialFeature::kTextFragmentIdentifiers, + }; + return base::Contains(kEnabledForNavigation, feature); +} + +} // namespace origin_trials + +} // namespace blink
diff --git a/third_party/blink/renderer/core/origin_trials/origin_trials_test.cc b/third_party/blink/common/origin_trials/origin_trials_test.cc similarity index 94% rename from third_party/blink/renderer/core/origin_trials/origin_trials_test.cc rename to third_party/blink/common/origin_trials/origin_trials_test.cc index 805430d..0a4bbca 100644 --- a/third_party/blink/renderer/core/origin_trials/origin_trials_test.cc +++ b/third_party/blink/common/origin_trials/origin_trials_test.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 "third_party/blink/renderer/core/origin_trials/origin_trials.h" +#include "third_party/blink/public/common/origin_trials/origin_trials.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/third_party/blink/public/common/BUILD.gn b/third_party/blink/public/common/BUILD.gn index f76a8544..cd03ac01 100644 --- a/third_party/blink/public/common/BUILD.gn +++ b/third_party/blink/public/common/BUILD.gn
@@ -7,6 +7,7 @@ import("//build/config/features.gni") import("//testing/test.gni") import("//third_party/blink/public/public_features.gni") +import("//third_party/blink/renderer/build/scripts/scripts.gni") import("//third_party/protobuf/proto_library.gni") import("//third_party/webrtc/webrtc.gni") @@ -14,6 +15,26 @@ import("//build/config/android/rules.gni") } +blink_python_runner("make_generated_origin_trial_feature") { + script = "../../renderer/build/scripts/make_origin_trial_feature.py" + + inputs = + scripts_for_json5_files + [ + "../../renderer/build/scripts/make_origin_trial_feature.py", + "../../renderer/platform/runtime_enabled_features.json5", + "../../renderer/build/scripts/templates/origin_trial_feature.h.tmpl", + ] + outputs = [ "$root_gen_dir/third_party/blink/public/common/origin_trials/origin_trial_feature.h" ] + + args = [ + rebase_path("../../renderer/platform/runtime_enabled_features.json5", + root_build_dir), + "--output_dir", + rebase_path("$root_gen_dir/third_party/blink/public/common/origin_trials", + root_build_dir), + ] +} + # Public common API headers, mojom and libraries that can be linked and # referenced both by browser-side and renderer-side components. component("common") { @@ -182,6 +203,7 @@ "oom_intervention/oom_intervention_types.h", "origin_trials/origin_trial_policy.h", "origin_trials/origin_trial_public_key.h", + "origin_trials/origin_trials.h", "origin_trials/trial_token.h", "origin_trials/trial_token_result.h", "origin_trials/trial_token_validator.h", @@ -233,7 +255,10 @@ "widget/visual_properties.h", ] + sources += get_target_outputs(":make_generated_origin_trial_feature") + public_deps = [ + ":make_generated_origin_trial_feature", "//base", "//mojo/public/cpp/bindings", "//services/metrics/public/cpp:metrics_cpp",
diff --git a/third_party/blink/public/common/origin_trials/origin_trials.h b/third_party/blink/public/common/origin_trials/origin_trials.h new file mode 100644 index 0000000..0664c51 --- /dev/null +++ b/third_party/blink/public/common/origin_trials/origin_trials.h
@@ -0,0 +1,59 @@ +// 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. + +// The implementation for this header file is auto-generated. + +#ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_ORIGIN_TRIALS_ORIGIN_TRIALS_H_ +#define THIRD_PARTY_BLINK_PUBLIC_COMMON_ORIGIN_TRIALS_ORIGIN_TRIALS_H_ + +#include "base/containers/span.h" +#include "base/strings/string_piece.h" +#include "third_party/blink/public/common/common_export.h" +#include "third_party/blink/public/common/origin_trials/origin_trial_feature.h" + +namespace blink { + +enum class OriginTrialType { kDefault = 0, kDeprecation, kIntervention }; + +// A namespace with dynamic tests for experimental features which can be +// enabled by the origin trials framework via origin trial tokens. +namespace origin_trials { + +// Return true if there is a feature with the passed |trial_name|. +BLINK_COMMON_EXPORT bool IsTrialValid(base::StringPiece trial_name); + +// Return true if |trial_name| can be enabled in an insecure context. +BLINK_COMMON_EXPORT bool IsTrialEnabledForInsecureContext( + base::StringPiece trial_name); + +// Return true if |trial_name| can be enabled from third party origins. +BLINK_COMMON_EXPORT bool IsTrialEnabledForThirdPartyOrigins( + base::StringPiece trial_name); + +// Returns the trial type of the given |feature|. +OriginTrialType GetTrialType(OriginTrialFeature feature); + +// Return origin trials features that are enabled by the passed |trial_name|. +// The trial name MUST be valid (call IsTrialValid() before calling this +// function). +BLINK_COMMON_EXPORT base::span<const OriginTrialFeature> FeaturesForTrial( + base::StringPiece trial_name); + +// Return the list of features which will also be enabled if the given +// |feature| is enabled. +BLINK_COMMON_EXPORT base::span<const OriginTrialFeature> GetImpliedFeatures( + OriginTrialFeature feature); + +// Returns true if |feature| is enabled on the current platform. +BLINK_COMMON_EXPORT bool FeatureEnabledForOS(OriginTrialFeature feature); + +// Returns true if |feature| can be enabled across navigations. +BLINK_COMMON_EXPORT bool FeatureEnabledForNavigation( + OriginTrialFeature feature); + +} // namespace origin_trials + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_ORIGIN_TRIALS_ORIGIN_TRIALS_H_
diff --git a/third_party/blink/renderer/bindings/bindings.gni b/third_party/blink/renderer/bindings/bindings.gni index 8e33b477..ab83a70 100644 --- a/third_party/blink/renderer/bindings/bindings.gni +++ b/third_party/blink/renderer/bindings/bindings.gni
@@ -213,6 +213,7 @@ "core/v8/native_value_traits_impl_test.cc", "core/v8/native_value_traits_test.cc", "core/v8/no_alloc_direct_call_host_test.cc", + "core/v8/profiler_trace_builder_test.cc", "core/v8/referrer_script_info_test.cc", "core/v8/script_promise_property_test.cc", "core/v8/script_promise_resolver_test.cc",
diff --git a/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.cc b/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.cc index edcdd04..5931634 100644 --- a/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.cc +++ b/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.cc
@@ -3,9 +3,9 @@ // found in the LICENSE file. #include "third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.h" - #include "base/time/time.h" #include "third_party/blink/renderer/bindings/core/v8/v8_profiler_frame.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_profiler_marker.h" #include "third_party/blink/renderer/bindings/core/v8/v8_profiler_sample.h" #include "third_party/blink/renderer/bindings/core/v8/v8_profiler_stack.h" #include "third_party/blink/renderer/bindings/core/v8/v8_profiler_trace.h" @@ -30,7 +30,8 @@ const auto* node = profile->GetSample(i); auto timestamp = base::TimeTicks() + base::Microseconds(profile->GetSampleTimestamp(i)); - builder->AddSample(node, timestamp); + const auto state = profile->GetSampleState(i); + builder->AddSample(node, timestamp, state); } } return builder->GetTrace(); @@ -51,7 +52,8 @@ } void ProfilerTraceBuilder::AddSample(const v8::CpuProfileNode* node, - base::TimeTicks timestamp) { + base::TimeTicks timestamp, + const v8::StateTag state) { auto* sample = ProfilerSample::Create(); // TODO(yoav): This should not use MonotonicTimeToDOMHighResTimeStamp, as // these timestamps are clamped, which makes no sense for traces. Since this @@ -65,6 +67,9 @@ if (absl::optional<wtf_size_t> stack_id = GetOrInsertStackId(node)) sample->setStackId(*stack_id); + if (absl::optional<blink::V8ProfilerMarker> marker = VMStateToMarker(state)) + sample->setMarker(*marker); + samples_.push_back(sample); }
diff --git a/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.h b/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.h index 6f2cf40d..8ae9561 100644 --- a/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.h +++ b/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.h
@@ -5,8 +5,11 @@ #ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_PROFILER_TRACE_BUILDER_H_ #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_PROFILER_TRACE_BUILDER_H_ +#include "base/gtest_prod_util.h" #include "base/time/time.h" #include "third_party/abseil-cpp/absl/types/optional.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_profiler_marker.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" #include "third_party/blink/renderer/platform/heap/garbage_collected.h" #include "third_party/blink/renderer/platform/heap/member.h" @@ -67,7 +70,7 @@ // // The trace format is described at: // https://wicg.github.io/js-self-profiling/#the-profilertrace-dictionary -class ProfilerTraceBuilder final +class CORE_EXPORT ProfilerTraceBuilder final : public GarbageCollected<ProfilerTraceBuilder> { public: static ProfilerTrace* FromProfile(ScriptState*, @@ -87,7 +90,9 @@ private: // Adds a stack sample from V8 to the trace, performing necessary filtering // and coalescing. - void AddSample(const v8::CpuProfileNode* node, base::TimeTicks timestamp); + void AddSample(const v8::CpuProfileNode* node, + base::TimeTicks timestamp, + const v8::StateTag); // Obtains the stack ID of the substack with the given node as its leaf, // performing origin-based filtering. absl::optional<wtf_size_t> GetOrInsertStackId(const v8::CpuProfileNode* node); @@ -98,6 +103,18 @@ ProfilerTrace* GetTrace() const; + inline absl::optional<V8ProfilerMarker> VMStateToMarker(v8::StateTag state) { + switch (state) { + case v8::GC: + return V8ProfilerMarker(V8ProfilerMarker::Enum::kGc); + case v8::JS: + case v8::ATOMICS_WAIT: + return V8ProfilerMarker(V8ProfilerMarker::Enum::kScript); + default: + return absl::optional<V8ProfilerMarker>(); + } + } + // Discards metadata frames and performs an origin check on the given stack // frame, returning true if it either has the same origin as the profiler, or // if it should be shared cross origin. @@ -123,6 +140,8 @@ // A mapping from a V8 internal script ID to whether or not it passes the // same-origin policy for the ScriptState that the trace belongs to. HashMap<int, bool> script_same_origin_cache_; + + FRIEND_TEST_ALL_PREFIXES(ProfilerTraceBuilderTest, AddVMStateMarker); }; } // namespace blink
diff --git a/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder_test.cc b/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder_test.cc new file mode 100644 index 0000000..5fa29b2 --- /dev/null +++ b/third_party/blink/renderer/bindings/core/v8/profiler_trace_builder_test.cc
@@ -0,0 +1,33 @@ +// 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. + +#include "third_party/blink/renderer/bindings/core/v8/profiler_trace_builder.h" + +#include "base/time/time.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_profiler_marker.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_profiler_sample.h" +#include "third_party/blink/renderer/bindings/core/v8/v8_profiler_trace.h" +#include "v8/include/v8.h" +namespace blink { + +TEST(ProfilerTraceBuilderTest, AddVMStateMarker) { + V8TestingScope scope; + auto* script_state = scope.GetScriptState(); + + ProfilerTraceBuilder* builder = MakeGarbageCollected<ProfilerTraceBuilder>( + script_state, nullptr, base::TimeTicks::Now()); + + base::TimeTicks sample_ticks = base::TimeTicks::Now(); + builder->AddSample(nullptr, sample_ticks, v8::StateTag::GC); + + auto* profiler_trace = builder->GetTrace(); + const auto& samples = profiler_trace->samples(); + EXPECT_EQ(samples.size(), 1u); + auto* sample = samples.at(0).Get(); + EXPECT_EQ(sample->marker(), V8ProfilerMarker::Enum::kGc); +} + +} // namespace blink
diff --git a/third_party/blink/renderer/bindings/generated_in_core.gni b/third_party/blink/renderer/bindings/generated_in_core.gni index 742ba0e..29b2887 100644 --- a/third_party/blink/renderer/bindings/generated_in_core.gni +++ b/third_party/blink/renderer/bindings/generated_in_core.gni
@@ -295,6 +295,8 @@ "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_structured_serialize_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_profiler_frame.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_profiler_frame.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_profiler_marker.h", + "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_profiler_marker.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_profiler_init_options.cc", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_profiler_init_options.h", "$root_gen_dir/third_party/blink/renderer/bindings/core/v8/v8_profiler_sample.cc",
diff --git a/third_party/blink/renderer/build/scripts/make_origin_trial_feature.py b/third_party/blink/renderer/build/scripts/make_origin_trial_feature.py new file mode 100644 index 0000000..d39d939 --- /dev/null +++ b/third_party/blink/renderer/build/scripts/make_origin_trial_feature.py
@@ -0,0 +1,33 @@ +# Copyright 2021 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import sys + +import json5_generator +import make_runtime_features +import template_expander + + +# We want exactly the same parsing as RuntimeFeatureWriter +# but generate different files. +class OriginTrialsWriter(make_runtime_features.BaseRuntimeFeatureWriter): + file_basename = 'origin_trial_feature' + + def __init__(self, json5_file_path, output_dir): + super(OriginTrialsWriter, self).__init__(json5_file_path, output_dir) + self._outputs = { + (self.file_basename + '.h'): self.generate_header, + } + + @template_expander.use_jinja('templates/' + file_basename + '.h.tmpl') + def generate_header(self): + return { + 'features': self._features, + 'input_files': self._input_files, + 'header_guard': self._header_guard, + } + + +if __name__ == '__main__': + json5_generator.Maker(OriginTrialsWriter).main()
diff --git a/third_party/blink/renderer/build/scripts/templates/origin_trial_feature.h.tmpl b/third_party/blink/renderer/build/scripts/templates/origin_trial_feature.h.tmpl new file mode 100644 index 0000000..0c381ae --- /dev/null +++ b/third_party/blink/renderer/build/scripts/templates/origin_trial_feature.h.tmpl
@@ -0,0 +1,26 @@ +{% from 'templates/macros.tmpl' import license, source_files_for_generated_file %} +{{license()}} + +{{source_files_for_generated_file(template_file, input_files)}} + +#ifndef {{header_guard}} +#define {{header_guard}} + +#include <cstdint> + +namespace blink { + +enum class OriginTrialFeature : int32_t { + // For testing + kNonExisting = 0, + + {% for feature in features %} + {% if feature.origin_trial_feature_name %} + k{{feature.name}}, + {% endif %} + {% endfor %} +}; + +} // namespace blink + +#endif // {{header_guard}}
diff --git a/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl b/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl index 2baddc4..9f19393 100644 --- a/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl
@@ -3,15 +3,14 @@ {{source_files_for_generated_file(template_file, input_files)}} -#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" +#include "third_party/blink/public/common/origin_trials/origin_trials.h" #include <algorithm> #include <array> #include <iterator> #include "base/containers/contains.h" #include "build/chromeos_buildflags.h" -#include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h" -#include "third_party/blink/renderer/platform/runtime_enabled_features.h" +#include "third_party/blink/public/common/origin_trials/origin_trial_feature.h" namespace blink { @@ -32,13 +31,13 @@ } // namespace -bool origin_trials::IsTrialValid(const StringView& trial_name) { +bool origin_trials::IsTrialValid(base::StringPiece trial_name) { return std::any_of( std::begin(kTrialToFeaturesMap), std::end(kTrialToFeaturesMap), [&](const auto& entry) { return entry.trial_name == trial_name; }); } -bool origin_trials::IsTrialEnabledForInsecureContext(const StringView& trial_name) { +bool origin_trials::IsTrialEnabledForInsecureContext(base::StringPiece trial_name) { static const char* const kEnabledForInsecureContext[] = { {% for trial in origin_trial_features|selectattr('origin_trial_allows_insecure')|map(attribute='origin_trial_feature_name')|unique %} "{{trial}}", @@ -47,7 +46,7 @@ return base::Contains(kEnabledForInsecureContext, trial_name); } -bool origin_trials::IsTrialEnabledForThirdPartyOrigins(const StringView& trial_name) { +bool origin_trials::IsTrialEnabledForThirdPartyOrigins(base::StringPiece trial_name) { static const char* const kEnabledForThirdPartyOrigins[] = { {% for trial in origin_trial_features|selectattr('origin_trial_allows_third_party')|map(attribute='origin_trial_feature_name')|unique %} "{{trial}}", @@ -69,7 +68,7 @@ base::span<const OriginTrialFeature> origin_trials::FeaturesForTrial( - const StringView& trial_name) { + base::StringPiece trial_name) { auto it = std::find_if( std::begin(kTrialToFeaturesMap), std::end(kTrialToFeaturesMap), [&](const auto& entry) { return entry.trial_name == trial_name; });
diff --git a/third_party/blink/renderer/build/scripts/templates/policy_helper.cc.tmpl b/third_party/blink/renderer/build/scripts/templates/policy_helper.cc.tmpl index 27bc0ef..f2b69d5e 100644 --- a/third_party/blink/renderer/build/scripts/templates/policy_helper.cc.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/policy_helper.cc.tmpl
@@ -9,7 +9,6 @@ #include "third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom-blink.h" #include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-blink.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" #include "third_party/blink/renderer/core/inspector/protocol/page.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
diff --git a/third_party/blink/renderer/build/scripts/templates/runtime_enabled_features.h.tmpl b/third_party/blink/renderer/build/scripts/templates/runtime_enabled_features.h.tmpl index 0325bd26..f5462b5f 100644 --- a/third_party/blink/renderer/build/scripts/templates/runtime_enabled_features.h.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/runtime_enabled_features.h.tmpl
@@ -9,6 +9,7 @@ #include <string> #include "base/gtest_prod_util.h" +#include "third_party/blink/public/common/origin_trials/origin_trial_feature.h" #include "third_party/blink/renderer/platform/platform_export.h" #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" @@ -20,17 +21,6 @@ namespace blink { -enum class OriginTrialFeature : int32_t { - // For testing - kNonExisting = 0, - - {% for feature in features %} - {% if feature.origin_trial_feature_name %} - k{{feature.name}}, - {% endif %} - {% endfor %} -}; - // A pure virtual interface for checking the availability of origin trial // features in a context. class PLATFORM_EXPORT FeatureContext {
diff --git a/third_party/blink/renderer/build/scripts/templates/web_origin_trials.cc.tmpl b/third_party/blink/renderer/build/scripts/templates/web_origin_trials.cc.tmpl index d2d3eab..7977a366 100644 --- a/third_party/blink/renderer/build/scripts/templates/web_origin_trials.cc.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/web_origin_trials.cc.tmpl
@@ -7,7 +7,8 @@ #include "third_party/blink/renderer/core/dom/document.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" +#include "third_party/blink/public/common/origin_trials/origin_trial_feature.h" +#include "third_party/blink/public/common/origin_trials/origin_trials.h" #include "third_party/blink/public/platform/web_string.h" #include "third_party/blink/public/web/web_document.h" @@ -15,10 +16,10 @@ bool WebOriginTrials::isTrialEnabled(const WebDocument* web_document, const WebString& trial) { if (!web_document) return false; - if (!origin_trials::IsTrialValid(trial)) + if (!origin_trials::IsTrialValid(trial.Utf8())) return false; Document* document = *web_document; - for (OriginTrialFeature feature : origin_trials::FeaturesForTrial(trial)) { + for (OriginTrialFeature feature : origin_trials::FeaturesForTrial(trial.Utf8())) { switch (feature) { {% for feature in features %} {% if feature.origin_trial_feature_name %}
diff --git a/third_party/blink/renderer/core/BUILD.gn b/third_party/blink/renderer/core/BUILD.gn index 3f124e3a..05653076 100644 --- a/third_party/blink/renderer/core/BUILD.gn +++ b/third_party/blink/renderer/core/BUILD.gn
@@ -1057,23 +1057,6 @@ deps = make_core_generated_deps } -blink_python_runner("make_core_generated_origin_trials") { - script = "../build/scripts/make_origin_trials.py" - - inputs = scripts_for_json5_files + [ - "../build/scripts/make_origin_trials.py", - "../platform/runtime_enabled_features.json5", - "../build/scripts/templates/origin_trials.cc.tmpl", - ] - outputs = [ "$blink_core_output_dir/origin_trials/origin_trials.cc" ] - - args = [ - rebase_path("../platform/runtime_enabled_features.json5", root_build_dir), - "--output_dir", - "$rel_blink_core_gen_dir/origin_trials", - ] -} - blink_python_runner("make_core_generated_web_origin_trials") { script = "../build/scripts/make_web_origin_trials.py" @@ -1121,7 +1104,6 @@ ":make_core_generated_media_feature_names", ":make_core_generated_media_features", ":make_core_generated_media_type_names", - ":make_core_generated_origin_trials", ":make_core_generated_performance_entry_names", ":make_core_generated_permissions_policy_helper", ":make_core_generated_pointer_type_names", @@ -1401,7 +1383,6 @@ "messaging/message_port_descriptor_mojom_traits_test.cc", "mobile_metrics/mobile_friendliness_checker_test.cc", "origin_trials/origin_trial_context_test.cc", - "origin_trials/origin_trials_test.cc", "page/autoscroll_controller_test.cc", "page/chrome_client_impl_test.cc", "page/chrome_client_test.cc",
diff --git a/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc b/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc index ae56fefa..2908d00 100644 --- a/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc +++ b/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.cc
@@ -69,10 +69,8 @@ void ViewportStyleResolver::Reset() { property_set_ = nullptr; - has_viewport_units_ = false; DCHECK(initial_style_); - initial_style_->SetHasViewportUnits(false); - needs_update_ = kNoUpdate; + needs_update_ = false; } void ViewportStyleResolver::CollectViewportRulesFromUASheets() { @@ -156,10 +154,6 @@ description.SetViewportFit(ViewportFitValue()); document_->GetViewportData().SetViewportDescription(description); - - DCHECK(initial_style_); - if (initial_style_->HasViewportUnits()) - has_viewport_units_ = true; } float ViewportStyleResolver::ViewportArgumentValue(CSSPropertyID id) const { @@ -248,8 +242,7 @@ CSSToLengthConversionData::FontSizes font_sizes(initial_style_.get(), initial_style_.get()); - CSSToLengthConversionData::ViewportSize viewport_size( - view->InitialViewportWidth(), view->InitialViewportHeight()); + CSSToLengthConversionData::ViewportSize viewport_size; CSSToLengthConversionData::ContainerSizes container_sizes; Length result = primitive_value->ConvertToLength(CSSToLengthConversionData( @@ -287,27 +280,17 @@ initial_style_ = nullptr; // We need to recollect if the initial font size changed and media queries // depend on font relative lengths. - needs_update_ = kCollectRules; + needs_update_ = true; } -void ViewportStyleResolver::InitialViewportChanged() { - if (needs_update_ == kCollectRules) - return; - if (has_viewport_units_) - needs_update_ = kResolve; - if (needs_update_ == kNoUpdate) - return; - document_->ScheduleLayoutTreeUpdateIfNeeded(); -} - -void ViewportStyleResolver::SetNeedsCollectRules() { - needs_update_ = kCollectRules; +void ViewportStyleResolver::SetNeedsUpdate() { + needs_update_ = true; document_->ScheduleLayoutTreeUpdateIfNeeded(); } void ViewportStyleResolver::UpdateViewport( DocumentStyleSheetCollection& collection) { - if (needs_update_ == kNoUpdate) { + if (!needs_update_) { // If initial_style_ is cleared it means things are dirty, so we should not // end up here. DCHECK(initial_style_); @@ -315,12 +298,10 @@ } if (!initial_style_) initial_style_ = document_->GetStyleResolver().StyleForViewport(); - if (needs_update_ == kCollectRules) { - Reset(); - CollectViewportRulesFromUASheets(); - } + Reset(); + CollectViewportRulesFromUASheets(); Resolve(); - needs_update_ = kNoUpdate; + needs_update_ = false; } void ViewportStyleResolver::Trace(Visitor* visitor) const {
diff --git a/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h b/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h index d12a8068..405dcd8 100644 --- a/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h +++ b/third_party/blink/renderer/core/css/resolver/viewport_style_resolver.h
@@ -50,8 +50,7 @@ explicit ViewportStyleResolver(Document&); void InitialStyleChanged(); - void InitialViewportChanged(); - void SetNeedsCollectRules(); + void SetNeedsUpdate(); bool NeedsUpdate() const { return needs_update_; } void UpdateViewport(DocumentStyleSheetCollection&); @@ -63,8 +62,6 @@ void Reset(); void Resolve(); - enum UpdateType { kNoUpdate, kResolve, kCollectRules }; - void CollectViewportRulesFromUASheets(); void CollectViewportRules(const HeapVector<Member<StyleRuleBase>>&); void AddViewportRule(StyleRuleViewport&); @@ -76,8 +73,7 @@ Member<Document> document_; Member<MutableCSSPropertyValueSet> property_set_; scoped_refptr<ComputedStyle> initial_style_; - bool has_viewport_units_ = false; - UpdateType needs_update_ = kCollectRules; + bool needs_update_ = true; }; } // namespace blink
diff --git a/third_party/blink/renderer/core/css/style_engine.cc b/third_party/blink/renderer/core/css/style_engine.cc index 1fb834a..9a5ba90 100644 --- a/third_party/blink/renderer/core/css/style_engine.cc +++ b/third_party/blink/renderer/core/css/style_engine.cc
@@ -1584,14 +1584,9 @@ StyleChangeReasonForTracing::Create(style_change_reason::kSettings)); } -void StyleEngine::InitialViewportChanged() { - if (viewport_resolver_) - viewport_resolver_->InitialViewportChanged(); -} - void StyleEngine::ViewportRulesChanged() { if (viewport_resolver_) - viewport_resolver_->SetNeedsCollectRules(); + viewport_resolver_->SetNeedsUpdate(); // When we remove an import link and re-insert it into the document, the // import Document and CSSStyleSheet pointers are persisted. That means the
diff --git a/third_party/blink/renderer/core/css/style_engine.h b/third_party/blink/renderer/core/css/style_engine.h index e255156..9f79bcd9 100644 --- a/third_party/blink/renderer/core/css/style_engine.h +++ b/third_party/blink/renderer/core/css/style_engine.h
@@ -207,7 +207,6 @@ mojom::blink::ColorScheme GetOwnerColorScheme() const { return owner_color_scheme_; } - void InitialViewportChanged(); void ViewportRulesChanged(); void InjectSheet(const StyleSheetKey&, StyleSheetContents*,
diff --git a/third_party/blink/renderer/core/exported/web_view_impl.cc b/third_party/blink/renderer/core/exported/web_view_impl.cc index 505112e..37f973b 100644 --- a/third_party/blink/renderer/core/exported/web_view_impl.cc +++ b/third_party/blink/renderer/core/exported/web_view_impl.cc
@@ -1146,7 +1146,6 @@ GetPage()->GetVisualViewport().SetSize(visible_viewport_size); if (MainFrameImpl()->GetFrameView()) { - MainFrameImpl()->GetFrameView()->SetInitialViewportSize(icb_size); if (!MainFrameImpl()->GetFrameView()->NeedsLayout()) resize_viewport_anchor_->ResizeFrameView(MainFrameSize()); } @@ -3420,7 +3419,6 @@ GetPage()->GetVisualViewport().SetSize(size_); GetPageScaleConstraintsSet().DidChangeInitialContainingBlockSize(size_); - view->SetInitialViewportSize(size_); web_view_client_->DidAutoResize(size_); web_widget_->DidAutoResize(size_);
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.cc b/third_party/blink/renderer/core/frame/local_frame_view.cc index 0c732947..d5a2579 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.cc +++ b/third_party/blink/renderer/core/frame/local_frame_view.cc
@@ -4501,25 +4501,6 @@ !have_deferred_commits_; } -void LocalFrameView::SetInitialViewportSize(const gfx::Size& viewport_size) { - if (viewport_size == initial_viewport_size_) - return; - - initial_viewport_size_ = viewport_size; - if (Document* document = frame_->GetDocument()) - document->GetStyleEngine().InitialViewportChanged(); -} - -int LocalFrameView::InitialViewportWidth() const { - DCHECK(frame_->IsMainFrame()); - return initial_viewport_size_.width(); -} - -int LocalFrameView::InitialViewportHeight() const { - DCHECK(frame_->IsMainFrame()); - return initial_viewport_size_.height(); -} - MainThreadScrollingReasons LocalFrameView::MainThreadScrollingReasonsPerFrame() const { MainThreadScrollingReasons reasons =
diff --git a/third_party/blink/renderer/core/frame/local_frame_view.h b/third_party/blink/renderer/core/frame/local_frame_view.h index 17bacfad..5bfa4552 100644 --- a/third_party/blink/renderer/core/frame/local_frame_view.h +++ b/third_party/blink/renderer/core/frame/local_frame_view.h
@@ -250,10 +250,6 @@ return layout_size_fixed_to_frame_size_; } - void SetInitialViewportSize(const gfx::Size&); - int InitialViewportWidth() const; - int InitialViewportHeight() const; - bool GetIntrinsicSizingInfo(IntrinsicSizingInfo&) const override; bool HasIntrinsicSizingInfo() const override; @@ -1040,7 +1036,6 @@ Member<FrameViewAutoSizeInfo> auto_size_info_; gfx::Size layout_size_; - gfx::Size initial_viewport_size_; bool layout_size_fixed_to_frame_size_; bool needs_update_geometries_;
diff --git a/third_party/blink/renderer/core/frame/page_scale_constraints_set.h b/third_party/blink/renderer/core/frame/page_scale_constraints_set.h index 7a3eede..110833c 100644 --- a/third_party/blink/renderer/core/frame/page_scale_constraints_set.h +++ b/third_party/blink/renderer/core/frame/page_scale_constraints_set.h
@@ -107,7 +107,6 @@ void DidChangeInitialContainingBlockSize(const gfx::Size&); gfx::Size GetLayoutSize() const; - gfx::Size InitialViewportSize() const { return icb_size_; } private: PageScaleConstraints ComputeConstraintsStack() const;
diff --git a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc index 79e835a5..c06e1fd3 100644 --- a/third_party/blink/renderer/core/frame/web_local_frame_impl.cc +++ b/third_party/blink/renderer/core/frame/web_local_frame_impl.cc
@@ -2252,10 +2252,6 @@ base_background_color = Color::kTransparent; GetFrame()->CreateView(initial_size, base_background_color); - if (is_main_frame) { - GetFrame()->View()->SetInitialViewportSize( - web_view->GetPageScaleConstraintsSet().InitialViewportSize()); - } if (web_view->ShouldAutoResize() && GetFrame()->IsLocalRoot()) { GetFrame()->View()->EnableAutoSizeMode(web_view->MinAutoSize(), web_view->MaxAutoSize());
diff --git a/third_party/blink/renderer/core/origin_trials/OWNERS b/third_party/blink/renderer/core/origin_trials/OWNERS index 5a9194d2..73686a7 100644 --- a/third_party/blink/renderer/core/origin_trials/OWNERS +++ b/third_party/blink/renderer/core/origin_trials/OWNERS
@@ -1,4 +1 @@ file://third_party/blink/common/origin_trials/OWNERS - -per-file navigation_origin_trial_features.cc=set noparent -per-file navigation_origin_trial_features.cc=file://third_party/blink/SECURITY_OWNERS
diff --git a/third_party/blink/renderer/core/origin_trials/build.gni b/third_party/blink/renderer/core/origin_trials/build.gni index fbd8c26..a895a1e9 100644 --- a/third_party/blink/renderer/core/origin_trials/build.gni +++ b/third_party/blink/renderer/core/origin_trials/build.gni
@@ -3,8 +3,6 @@ # found in the LICENSE file. blink_core_sources_origin_trials = [ - "navigation_origin_trial_features.cc", "origin_trial_context.cc", "origin_trial_context.h", - "origin_trials.h", ]
diff --git a/third_party/blink/renderer/core/origin_trials/navigation_origin_trial_features.cc b/third_party/blink/renderer/core/origin_trials/navigation_origin_trial_features.cc deleted file mode 100644 index cc313e1..0000000 --- a/third_party/blink/renderer/core/origin_trials/navigation_origin_trial_features.cc +++ /dev/null
@@ -1,28 +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. - -// This file provides GetNavigationOriginTrialFeatures which is declared in -// origin_trials.h. GetNavigationOriginTrialFeatures is defined in this file -// since changes to it require review from security reviewers, listed in the -// SECURITY_OWNERS file. - -#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" - -namespace blink { - -namespace origin_trials { - -const HashSet<OriginTrialFeature>& GetNavigationOriginTrialFeatures() { - DEFINE_THREAD_SAFE_STATIC_LOCAL( - HashSet<OriginTrialFeature>, navigation_origin_trial_features, - ({// Enable the kOriginTrialsSampleAPINavigation feature as a navigation - // feature, for tests. - OriginTrialFeature::kOriginTrialsSampleAPINavigation, - OriginTrialFeature::kTextFragmentIdentifiers})); - return navigation_origin_trial_features; -} - -} // namespace origin_trials - -} // namespace blink
diff --git a/third_party/blink/renderer/core/origin_trials/origin_trial_context.cc b/third_party/blink/renderer/core/origin_trials/origin_trial_context.cc index 8d0759e..ee512c2 100644 --- a/third_party/blink/renderer/core/origin_trials/origin_trial_context.cc +++ b/third_party/blink/renderer/core/origin_trials/origin_trial_context.cc
@@ -11,6 +11,7 @@ #include "base/time/time.h" #include "services/network/public/cpp/features.h" #include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/common/origin_trials/origin_trials.h" #include "third_party/blink/public/common/origin_trials/trial_token.h" #include "third_party/blink/public/common/origin_trials/trial_token_result.h" #include "third_party/blink/public/common/origin_trials/trial_token_validator.h" @@ -25,7 +26,6 @@ #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/settings.h" -#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" #include "third_party/blink/renderer/core/workers/worklet_global_scope.h" #include "third_party/blink/renderer/platform/bindings/origin_trial_features.h" #include "third_party/blink/renderer/platform/bindings/script_state.h" @@ -96,7 +96,7 @@ // features reviewed and approved by security reviewers can be activated across // navigations. bool IsCrossNavigationFeature(OriginTrialFeature feature) { - return origin_trials::GetNavigationOriginTrialFeatures().Contains(feature); + return origin_trials::FeatureEnabledForNavigation(feature); } std::ostream& operator<<(std::ostream& stream, OriginTrialTokenStatus status) { @@ -469,7 +469,7 @@ const Vector<String>& trial_names) { bool is_valid = false; for (const auto& trial_name : trial_names) { - DCHECK(origin_trials::IsTrialValid(trial_name)); + DCHECK(origin_trials::IsTrialValid(trial_name.Utf8())); is_valid |= EnableTrialFromName(trial_name, /*expiry_time=*/base::Time::Max()) == OriginTrialStatus::kEnabled; @@ -531,7 +531,7 @@ bool did_enable_feature = false; for (OriginTrialFeature feature : - origin_trials::FeaturesForTrial(trial_name)) { + origin_trials::FeaturesForTrial(trial_name.Utf8())) { if (!origin_trials::FeatureEnabledForOS(feature)) { DVLOG(1) << "EnableTrialFromName: feature " << static_cast<int>(feature) << " is disabled on current OS."; @@ -561,22 +561,20 @@ void OriginTrialContext::ValidateTokenResult(bool is_origin_secure, bool is_script_origin_secure, - String& trial_name, TrialTokenResult& token_result) { DCHECK_EQ(token_result.Status(), OriginTrialTokenStatus::kSuccess); const TrialToken& parsed_token = *token_result.ParsedToken(); - trial_name = String::FromUTF8(parsed_token.feature_name().data(), - parsed_token.feature_name().size()); - if (!origin_trials::IsTrialValid(trial_name)) { + if (!origin_trials::IsTrialValid(parsed_token.feature_name())) { token_result.SetStatus(OriginTrialTokenStatus::kUnknownTrial); return; } bool is_secure = is_origin_secure; if (parsed_token.is_third_party()) { - if (!origin_trials::IsTrialEnabledForThirdPartyOrigins(trial_name)) { + if (!origin_trials::IsTrialEnabledForThirdPartyOrigins( + parsed_token.feature_name())) { DVLOG(1) << "ValidateTokenResult: feature disabled for third party trial"; token_result.SetStatus(OriginTrialTokenStatus::kFeatureDisabled); return; @@ -588,8 +586,8 @@ // Origin trials are only enabled for secure origins. The only exception // is for deprecation trials. - if (!is_secure && - !origin_trials::IsTrialEnabledForInsecureContext(trial_name)) { + if (!is_secure && !origin_trials::IsTrialEnabledForInsecureContext( + parsed_token.feature_name())) { DVLOG(1) << "ValidateTokenResult: not secure"; token_result.SetStatus(OriginTrialTokenStatus::kInsecure); } @@ -620,11 +618,13 @@ << ", token = " << token; if (token_result.Status() == OriginTrialTokenStatus::kSuccess) { - String trial_name; - ValidateTokenResult(is_origin_secure, is_script_origin_secure, trial_name, + ValidateTokenResult(is_origin_secure, is_script_origin_secure, token_result); if (token_result.Status() == OriginTrialTokenStatus::kSuccess) { + String trial_name = + String::FromUTF8(token_result.ParsedToken()->feature_name().data(), + token_result.ParsedToken()->feature_name().size()); trial_status = EnableTrialFromName( trial_name, token_result.ParsedToken()->expiry_time()); }
diff --git a/third_party/blink/renderer/core/origin_trials/origin_trial_context.h b/third_party/blink/renderer/core/origin_trials/origin_trial_context.h index a75a6a0..cb7e472d 100644 --- a/third_party/blink/renderer/core/origin_trials/origin_trial_context.h +++ b/third_party/blink/renderer/core/origin_trials/origin_trial_context.h
@@ -10,7 +10,6 @@ #include "third_party/blink/public/common/origin_trials/trial_token_validator.h" #include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h" -#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" #include "third_party/blink/renderer/platform/wtf/hash_map.h" #include "third_party/blink/renderer/platform/wtf/hash_set.h" #include "third_party/blink/renderer/platform/wtf/text/string_hash.h" @@ -62,7 +61,7 @@ // Instead, the name provided by the feature implementation is validated against // any provided tokens. // -// For more information, see https://github.com/jpchase/OriginTrials. +// For more information, see https://github.com/GoogleChrome/OriginTrials. class CORE_EXPORT OriginTrialContext final : public GarbageCollected<OriginTrialContext> { public: @@ -70,8 +69,7 @@ void SetTrialTokenValidatorForTesting(std::unique_ptr<TrialTokenValidator>); - // Parses an Origin-Trial header as specified in - // https://jpchase.github.io/OriginTrials/#header into individual tokens. + // Parses an Origin-Trial header into individual tokens. // Returns null if the header value was malformed and could not be parsed. // If the header does not contain any tokens, this returns an empty vector. static std::unique_ptr<Vector<String>> ParseHeaderValue( @@ -211,13 +209,10 @@ const String& token); // Validate the token result returned from token validator. - // `trial_name` is returned to avoid multiple conversions from `std::string` - // to `WTF::String`. // `token_result` is modified in place to reflect the `OriginTrialTokenStatus` // change. void ValidateTokenResult(bool is_secure, bool is_secure_script_origin, - String& trial_name, TrialTokenResult& token_result); // Installs a series of OriginTrialFeatures listed in a HashSet. The return
diff --git a/third_party/blink/renderer/core/origin_trials/origin_trial_context_test.cc b/third_party/blink/renderer/core/origin_trials/origin_trial_context_test.cc index 12f8889..b73e9d5 100644 --- a/third_party/blink/renderer/core/origin_trials/origin_trial_context_test.cc +++ b/third_party/blink/renderer/core/origin_trials/origin_trial_context_test.cc
@@ -9,6 +9,7 @@ #include "base/test/scoped_feature_list.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/blink/public/common/features.h" +#include "third_party/blink/public/common/origin_trials/origin_trials.h" #include "third_party/blink/public/common/origin_trials/trial_token.h" #include "third_party/blink/public/common/origin_trials/trial_token_result.h" #include "third_party/blink/public/common/origin_trials/trial_token_validator.h" @@ -21,7 +22,6 @@ #include "third_party/blink/renderer/core/html/html_head_element.h" #include "third_party/blink/renderer/core/html/html_meta_element.h" #include "third_party/blink/renderer/core/html_names.h" -#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" #include "third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.h" #include "third_party/blink/renderer/core/testing/dummy_page_holder.h" #include "third_party/blink/renderer/core/testing/null_execution_context.h"
diff --git a/third_party/blink/renderer/core/origin_trials/origin_trials.h b/third_party/blink/renderer/core/origin_trials/origin_trials.h deleted file mode 100644 index 9d9b69d..0000000 --- a/third_party/blink/renderer/core/origin_trials/origin_trials.h +++ /dev/null
@@ -1,57 +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. - -// The implementation for this header file is auto-generated. - -#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_ORIGIN_TRIALS_ORIGIN_TRIALS_H_ -#define THIRD_PARTY_BLINK_RENDERER_CORE_ORIGIN_TRIALS_ORIGIN_TRIALS_H_ - -#include "base/containers/span.h" -#include "third_party/blink/renderer/core/core_export.h" -#include "third_party/blink/renderer/platform/runtime_enabled_features.h" -#include "third_party/blink/renderer/platform/wtf/hash_set.h" -#include "third_party/blink/renderer/platform/wtf/text/string_view.h" -#include "third_party/blink/renderer/platform/wtf/vector.h" - -namespace blink { - -enum class OriginTrialType { kDefault = 0, kDeprecation, kIntervention }; - -// A namespace with dynamic tests for experimental features which can be -// enabled by the origin trials framework via origin trial tokens. -namespace origin_trials { - -// Return true if there is a feature with the passed |trial_name|. -CORE_EXPORT bool IsTrialValid(const StringView& trial_name); - -// Return true if |trial_name| can be enabled in an insecure context. -CORE_EXPORT bool IsTrialEnabledForInsecureContext(const StringView& trial_name); - -// Return true if |trial_name| can be enabled from third party origins. -CORE_EXPORT bool IsTrialEnabledForThirdPartyOrigins( - const StringView& trial_name); - -// Returns the trial type of the given |feature|. -CORE_EXPORT OriginTrialType GetTrialType(OriginTrialFeature feature); - -// Return origin trials features that are enabled by the passed |trial_name|. -// The trial name MUST be valid (call IsTrialValid() before calling this -// function). -CORE_EXPORT base::span<const OriginTrialFeature> FeaturesForTrial( - const StringView& trial_name); - -// Return the list of features which will also be enabled if the given -// |feature| is enabled. -base::span<const OriginTrialFeature> GetImpliedFeatures( - OriginTrialFeature feature); - -bool FeatureEnabledForOS(OriginTrialFeature feature); - -const HashSet<OriginTrialFeature>& GetNavigationOriginTrialFeatures(); - -} // namespace origin_trials - -} // namespace blink - -#endif // THIRD_PARTY_BLINK_RENDERER_CORE_ORIGIN_TRIALS_ORIGIN_TRIALS_H_
diff --git a/third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.cc b/third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.cc index e30b290..c1003ae 100644 --- a/third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.cc +++ b/third_party/blink/renderer/core/permissions_policy/permissions_policy_parser.cc
@@ -14,7 +14,6 @@ #include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/core/frame/web_feature.h" #include "third_party/blink/renderer/core/origin_trials/origin_trial_context.h" -#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" #include "third_party/blink/renderer/platform/instrumentation/use_counter.h" #include "third_party/blink/renderer/platform/json/json_values.h" #include "third_party/blink/renderer/platform/network/http_parsers.h"
diff --git a/third_party/blink/renderer/core/timing/profiler_sample.idl b/third_party/blink/renderer/core/timing/profiler_sample.idl index bea7c30..4ac8be3e 100644 --- a/third_party/blink/renderer/core/timing/profiler_sample.idl +++ b/third_party/blink/renderer/core/timing/profiler_sample.idl
@@ -3,8 +3,11 @@ // found in the LICENSE file. // https://wicg.github.io/js-self-profiling/#the-profilersample-dictionary +// https://github.com/WICG/js-self-profiling/pull/64 +enum ProfilerMarker { "gc", "layout", "paint", "script", "style" }; dictionary ProfilerSample { required DOMHighResTimeStamp timestamp; unsigned long long stackId; + [RuntimeEnabled=ExperimentalJSProfilerMarkers, CrossOriginIsolated] ProfilerMarker marker; };
diff --git a/third_party/blink/renderer/modules/mediastream/media_stream_renderer_factory.cc b/third_party/blink/renderer/modules/mediastream/media_stream_renderer_factory.cc index 8d320bd..bc54881d 100644 --- a/third_party/blink/renderer/modules/mediastream/media_stream_renderer_factory.cc +++ b/third_party/blink/renderer/modules/mediastream/media_stream_renderer_factory.cc
@@ -139,6 +139,17 @@ std::move(on_render_error_callback)); } + // Get the AudioDevice associated with the frame where this track was created, + // in case the track has been moved to eg a same origin iframe. Without this, + // one can get into a situation where media is piped to a different audio + // device to that where control signals are sent, leading to no audio being + // played out - see crbug/1239207. + WebLocalFrame* track_creation_frame = + audio_components[0].Get()->CreationFrame(); + if (track_creation_frame) { + frame = To<LocalFrame>(WebLocalFrame::ToCoreFrame(*track_creation_frame)); + } + // This is a remote WebRTC media stream. WebRtcAudioDeviceImpl* audio_device = PeerConnectionDependencyFactory::From(*frame->DomWindow())
diff --git a/third_party/blink/renderer/modules/mediastream/remote_media_stream_track_adapter.cc b/third_party/blink/renderer/modules/mediastream/remote_media_stream_track_adapter.cc index 144361374..005a960 100644 --- a/third_party/blink/renderer/modules/mediastream/remote_media_stream_track_adapter.cc +++ b/third_party/blink/renderer/modules/mediastream/remote_media_stream_track_adapter.cc
@@ -20,8 +20,11 @@ RemoteVideoTrackAdapter::RemoteVideoTrackAdapter( const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, webrtc::VideoTrackInterface* webrtc_track, - scoped_refptr<MetronomeProvider> metronome_provider) - : RemoteMediaStreamTrackAdapter(main_thread, webrtc_track), + scoped_refptr<MetronomeProvider> metronome_provider, + ExecutionContext* track_execution_context) + : RemoteMediaStreamTrackAdapter(main_thread, + webrtc_track, + track_execution_context), metronome_provider_(std::move(metronome_provider)) { std::unique_ptr<TrackObserver> observer( new TrackObserver(main_thread, observed_track().get())); @@ -65,8 +68,11 @@ RemoteAudioTrackAdapter::RemoteAudioTrackAdapter( const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, - webrtc::AudioTrackInterface* webrtc_track) - : RemoteMediaStreamTrackAdapter(main_thread, webrtc_track), + webrtc::AudioTrackInterface* webrtc_track, + ExecutionContext* track_execution_context) + : RemoteMediaStreamTrackAdapter(main_thread, + webrtc_track, + track_execution_context), #if DCHECK_IS_ON() unregistered_(false), #endif
diff --git a/third_party/blink/renderer/modules/mediastream/remote_media_stream_track_adapter.h b/third_party/blink/renderer/modules/mediastream/remote_media_stream_track_adapter.h index 2a88193..9641adc6 100644 --- a/third_party/blink/renderer/modules/mediastream/remote_media_stream_track_adapter.h +++ b/third_party/blink/renderer/modules/mediastream/remote_media_stream_track_adapter.h
@@ -9,9 +9,12 @@ #include "base/dcheck_is_on.h" #include "base/memory/scoped_refptr.h" #include "third_party/blink/public/platform/web_string.h" +#include "third_party/blink/renderer/core/frame/local_dom_window.h" #include "third_party/blink/renderer/modules/modules_export.h" +#include "third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_component.h" #include "third_party/blink/renderer/platform/mediastream/media_stream_source.h" +#include "third_party/blink/renderer/platform/wtf/casting.h" #include "third_party/blink/renderer/platform/wtf/functional.h" #include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h" #include "third_party/webrtc/api/media_stream_interface.h" @@ -35,9 +38,11 @@ public: RemoteMediaStreamTrackAdapter( const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, - WebRtcMediaStreamTrackType* webrtc_track) + WebRtcMediaStreamTrackType* webrtc_track, + ExecutionContext* track_execution_context) : main_thread_(main_thread), webrtc_track_(webrtc_track), + track_execution_context_(track_execution_context), id_(String::FromUTF8(webrtc_track->id())) {} RemoteMediaStreamTrackAdapter(const RemoteMediaStreamTrackAdapter&) = delete; @@ -83,6 +88,18 @@ auto* source = MakeGarbageCollected<MediaStreamSource>(id_, type, id_, true /*remote*/); component_ = MakeGarbageCollected<MediaStreamComponent>(id_, source); + // If we have a reference to a window frame where the track was created, + // store it on the component. This allows other code to use the correct + // per-frame object for the track, such as the audio device for playout. + if (track_execution_context_ && track_execution_context_->IsWindow() && + To<LocalDOMWindow>(track_execution_context_.Get())->GetFrame()) { + // IsWindow() being true means that the ExecutionContext is a + // LocalDOMWindow, so these casts should be safe. + component_->SetCreationFrame( + WebFrame::FromCoreFrame( + To<LocalDOMWindow>(track_execution_context_.Get())->GetFrame()) + ->ToWebLocalFrame()); + } DCHECK(component_); } @@ -96,6 +113,7 @@ private: const scoped_refptr<WebRtcMediaStreamTrackType> webrtc_track_; CrossThreadPersistent<MediaStreamComponent> component_; + CrossThreadPersistent<ExecutionContext> track_execution_context_; // const copy of the webrtc track id that allows us to check it from both the // main and signaling threads without incurring a synchronous thread hop. const String id_; @@ -108,7 +126,8 @@ RemoteVideoTrackAdapter( const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, webrtc::VideoTrackInterface* webrtc_track, - scoped_refptr<MetronomeProvider> metronome_provider); + scoped_refptr<MetronomeProvider> metronome_provider, + ExecutionContext* execution_context); protected: ~RemoteVideoTrackAdapter() override; @@ -130,7 +149,8 @@ // Called on the signaling thread. RemoteAudioTrackAdapter( const scoped_refptr<base::SingleThreadTaskRunner>& main_thread, - webrtc::AudioTrackInterface* webrtc_track); + webrtc::AudioTrackInterface* webrtc_track, + ExecutionContext* execution_context); RemoteAudioTrackAdapter(const RemoteAudioTrackAdapter&) = delete; RemoteAudioTrackAdapter& operator=(const RemoteAudioTrackAdapter&) = delete;
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.cc b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.cc index f2281e9..1f7c0ff 100644 --- a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.cc +++ b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.cc
@@ -55,13 +55,17 @@ scoped_refptr<WebRtcMediaStreamTrackAdapter> remote_track_adapter( base::AdoptRef(new WebRtcMediaStreamTrackAdapter(factory, main_thread))); if (webrtc_track->kind() == webrtc::MediaStreamTrackInterface::kAudioKind) { - remote_track_adapter->InitializeRemoteAudioTrack(base::WrapRefCounted( - static_cast<webrtc::AudioTrackInterface*>(webrtc_track.get()))); + remote_track_adapter->InitializeRemoteAudioTrack( + base::WrapRefCounted( + static_cast<webrtc::AudioTrackInterface*>(webrtc_track.get())), + factory->GetSupplementable()); } else { DCHECK_EQ(webrtc_track->kind(), webrtc::MediaStreamTrackInterface::kVideoKind); - remote_track_adapter->InitializeRemoteVideoTrack(base::WrapRefCounted( - static_cast<webrtc::VideoTrackInterface*>(webrtc_track.get()))); + remote_track_adapter->InitializeRemoteVideoTrack( + base::WrapRefCounted( + static_cast<webrtc::VideoTrackInterface*>(webrtc_track.get())), + factory->GetSupplementable()); } return remote_track_adapter; } @@ -223,7 +227,8 @@ } void WebRtcMediaStreamTrackAdapter::InitializeRemoteAudioTrack( - const scoped_refptr<webrtc::AudioTrackInterface>& webrtc_audio_track) { + const scoped_refptr<webrtc::AudioTrackInterface>& webrtc_audio_track, + ExecutionContext* track_execution_context) { DCHECK(!main_thread_->BelongsToCurrentThread()); DCHECK(!is_initialized_); DCHECK(!remote_track_can_complete_initialization_.IsSignaled()); @@ -234,7 +239,7 @@ base::StringPrintf("InitializeRemoteAudioTrack([this=%p])", this)); remote_audio_track_adapter_ = base::MakeRefCounted<blink::RemoteAudioTrackAdapter>( - main_thread_, webrtc_audio_track.get()); + main_thread_, webrtc_audio_track.get(), track_execution_context); webrtc_track_ = webrtc_audio_track; // Set the initial volume to zero. When the track is put in an audio tag for // playout, its volume is set to that of the tag. Without this, we could end @@ -250,7 +255,8 @@ } void WebRtcMediaStreamTrackAdapter::InitializeRemoteVideoTrack( - const scoped_refptr<webrtc::VideoTrackInterface>& webrtc_video_track) { + const scoped_refptr<webrtc::VideoTrackInterface>& webrtc_video_track, + ExecutionContext* track_execution_context) { DCHECK(!main_thread_->BelongsToCurrentThread()); DCHECK(webrtc_video_track); DCHECK_EQ(webrtc_video_track->kind(), @@ -258,7 +264,7 @@ remote_video_track_adapter_ = base::MakeRefCounted<blink::RemoteVideoTrackAdapter>( main_thread_, webrtc_video_track.get(), - factory_->metronome_provider()); + factory_->metronome_provider(), track_execution_context); webrtc_track_ = webrtc_video_track; remote_track_can_complete_initialization_.Signal(); PostCrossThreadTask(
diff --git a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.h b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.h index 866be6f1..1ab4dd8 100644 --- a/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.h +++ b/third_party/blink/renderer/modules/peerconnection/webrtc_media_stream_track_adapter.h
@@ -99,9 +99,11 @@ // Initialization of remote tracks starts on the webrtc signaling thread and // finishes on the main thread. void InitializeRemoteAudioTrack( - const scoped_refptr<webrtc::AudioTrackInterface>& webrtc_audio_track); + const scoped_refptr<webrtc::AudioTrackInterface>& webrtc_audio_track, + ExecutionContext* execution_context); void InitializeRemoteVideoTrack( - const scoped_refptr<webrtc::VideoTrackInterface>& webrtc_video_track); + const scoped_refptr<webrtc::VideoTrackInterface>& webrtc_video_track, + ExecutionContext* execution_context); void FinalizeRemoteTrackInitializationOnMainThread(); void EnsureTrackIsInitialized();
diff --git a/third_party/blink/renderer/platform/mediastream/media_stream_component.h b/third_party/blink/renderer/platform/mediastream/media_stream_component.h index 0d05fb024..d46f8f3 100644 --- a/third_party/blink/renderer/platform/mediastream/media_stream_component.h +++ b/third_party/blink/renderer/platform/mediastream/media_stream_component.h
@@ -36,6 +36,7 @@ #include "third_party/blink/public/platform/modules/mediastream/web_media_stream_track.h" #include "third_party/blink/public/platform/web_vector.h" +#include "third_party/blink/public/web/web_local_frame.h" #include "third_party/blink/renderer/platform/audio/audio_source_provider.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h" #include "third_party/blink/renderer/platform/heap/handle.h" @@ -106,6 +107,11 @@ void GetSettings(MediaStreamTrackPlatform::Settings&); MediaStreamTrackPlatform::CaptureHandle GetCaptureHandle(); + WebLocalFrame* CreationFrame() { return creation_frame_; } + void SetCreationFrame(WebLocalFrame* creation_frame) { + creation_frame_ = creation_frame; + } + String ToString() const; void Trace(Visitor*) const; @@ -138,6 +144,7 @@ AudioSourceProviderImpl source_provider_; Member<MediaStreamSource> source_; + String id_; int unique_id_; bool enabled_ = true; @@ -146,6 +153,8 @@ WebMediaStreamTrack::ContentHintType::kNone; MediaConstraints constraints_; std::unique_ptr<MediaStreamTrackPlatform> platform_track_; + // Frame where the referenced platform track was created, if applicable. + WebLocalFrame* creation_frame_; }; typedef HeapVector<Member<MediaStreamComponent>> MediaStreamComponentVector;
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 64b23fdc..0548afc 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -995,6 +995,10 @@ status: "stable" }, { + name: "ExperimentalJSProfilerMarkers", + status: "experimental" + }, + { name: "ExperimentalPolicies", depends_on: ["DocumentPolicy"], status: "experimental"
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 0a8fb0e..5f24bdb 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -1501,7 +1501,7 @@ crbug.com/1121942 virtual/layout_ng_printing/printing/fixed-positioned-composited.html [ Crash ] crbug.com/1121942 virtual/layout_ng_printing/printing/fixed-positioned-headers-and-footers-absolute-covering-some-pages.html [ Crash ] crbug.com/1121942 virtual/layout_ng_printing/printing/fixed-positioned-headers-and-footers-clipped.html [ Crash ] -crbug.com/1121942 virtual/layout_ng_printing/printing/fixed-positioned-headers-and-footers-inside-transform.html [ Crash ] +crbug.com/1121942 virtual/layout_ng_printing/printing/fixed-positioned-headers-and-footers-inside-transform.html [ Crash Failure ] crbug.com/1121942 virtual/layout_ng_printing/printing/fixed-positioned-headers-and-footers-larger-than-page.html [ Crash ] crbug.com/1121942 virtual/layout_ng_printing/printing/fixed-positioned-headers-and-footers-transformed.html [ Crash ] crbug.com/1121942 virtual/layout_ng_printing/printing/fixed-positioned-headers-and-footers.html [ Crash ] @@ -6137,22 +6137,6 @@ crbug.com/1123116 external/wpt/permissions-policy/permissions-policy-frame-policy-allowed-for-some.https.sub.html [ Failure Skip Timeout ] crbug.com/1123116 external/wpt/permissions-policy/permissions-policy-frame-policy-disallowed-for-all.https.sub.html [ Failure Skip Timeout ] -# Rename "feature-policy-violation" report type to "permissions-policy-violation" report type. -crbug.com/1123116 external/wpt/feature-policy/reporting/camera-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/encrypted-media-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/fullscreen-reporting.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/generic-sensor-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/geolocation-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/microphone-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/midi-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/payment-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/picture-in-picture-reporting.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/screen-wake-lock-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/serial-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/sync-xhr-reporting.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/usb-reporting.https.html [ Timeout ] -crbug.com/1123116 external/wpt/feature-policy/reporting/xr-reporting.https.html [ Timeout ] - crbug.com/1159445 [ Mac ] paint/invalidation/repaint-overlay/layers-overlay.html [ Failure ] #Sheriff 2020-10-21 @@ -7180,7 +7164,6 @@ crbug.com/1249176 [ Mac11-arm64 ] inspector-protocol/page/set-font-families.js [ Failure Pass ] crbug.com/1249176 [ Mac ] http/tests/text-autosizing/wide-iframe.html [ Failure Pass ] crbug.com/1249176 [ Mac11-arm64 ] external/wpt/layout-instability/recent-input.html [ Failure Pass ] -crbug.com/1249176 [ Mac11-arm64 ] virtual/gpu-rasterization/images/color-profile-background-image-cover.html [ Failure Pass ] crbug.com/1249176 [ Mac11-arm64 ] inspector-protocol/performance/perf-metrics.js [ Failure Pass ] crbug.com/1249176 [ Mac11-arm64 ] external/wpt/event-timing/event-retarget.html [ Failure Pass ] crbug.com/1249176 [ Mac11-arm64 ] external/wpt/mimesniff/media/media-sniff.window.html [ Failure Pass ] @@ -7344,7 +7327,6 @@ crbug.com/1257570 [ Win7 ] fast/dom/vertical-scrollbar-in-rtl.html [ Failure Pass ] crbug.com/crbug.com/1256763 [ Win7 ] virtual/gpu-rasterization/images/color-profile-animate.html [ Failure Pass ] crbug.com/crbug.com/1256763 [ Win7 ] virtual/gpu-rasterization/images/color-profile-animate-rotate.html [ Failure Pass ] -crbug.com/crbug.com/1256763 [ Win7 ] virtual/gpu-rasterization/images/color-profile-background-image-cover.html [ Failure Pass ] crbug.com/crbug.com/1256763 [ Win7 ] virtual/gpu-rasterization/images/color-profile-background-image-space.html [ Failure Pass ] crbug.com/crbug.com/1256763 [ Win7 ] virtual/gpu-rasterization/images/color-profile-clip.html [ Failure Pass ] crbug.com/crbug.com/1256763 [ Win7 ] virtual/gpu-rasterization/images/color-profile-image-shape.html [ Failure Pass ] @@ -7645,6 +7627,7 @@ # Sheriff 2022-01-17 crbug.com/1287928 [ Mac ] external/wpt/webrtc/RTCPeerConnection-perfect-negotiation-stress-glare.https.html [ Failure Pass ] - +crbug.com/1233938 http/tests/notifications/click-shared-worker.html [ Pass Timeout ] # Temporarily disable test to allow fixing of devtools path escaping crbug.com/1094436 http/tests/devtools/overrides/project-added-with-existing-files-bind.js [ Skip Timeout Failure ] +crbug.com/1256763 virtual/gpu-rasterization/images/color-profile-background-image-cover.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/camera-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/camera-reporting.https.html index 9ec7e0b..708d3fa 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/camera-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/camera-reporting.https.html
@@ -13,7 +13,7 @@ var check_report_format = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "camera"); assert_equals(report.body.sourceFile, document.location.href); @@ -23,7 +23,7 @@ }; new ReportingObserver(t.step_func_done(check_report_format), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); setMediaPermission("granted", ["camera"]).then(() => navigator.mediaDevices.getUserMedia({video: true})) .then(
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/encrypted-media-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/encrypted-media-reporting.https.html index 1f891a57..32a5a2cc 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/encrypted-media-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/encrypted-media-reporting.https.html
@@ -8,7 +8,7 @@ <script> var check_report_format = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "encrypted-media"); assert_equals(report.body.disposition, "enforce"); @@ -20,7 +20,7 @@ promise_test(async t => { const report = new Promise(resolve => { new ReportingObserver((reports, observer) => resolve([reports, observer]), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); }); await promise_rejects_dom(t, "SecurityError", navigator.requestMediaKeySystemAccess("org.w3.clearkey",
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/fullscreen-reporting.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/fullscreen-reporting.html index 3ac1ef4..d7b9057 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/fullscreen-reporting.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/fullscreen-reporting.html
@@ -15,7 +15,7 @@ observer1.disconnect(); observer2.disconnect(); let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "fullscreen"); assert_equals(report.body.sourceFile, document.location.href); @@ -26,16 +26,16 @@ var check_second_observer = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.body.featureId, "fullscreen"); }; async_test(t => { observer1 = new ReportingObserver(t.step_func(check_report_format), - {types: ['feature-policy-violation']}); + {types: ['permissions-policy-violation']}); observer1.observe(); observer2 = new ReportingObserver(t.step_func_done(check_second_observer), - {types: ['feature-policy-violation']}); + {types: ['permissions-policy-violation']}); observer2.observe(); document.getElementById('fs').requestFullscreen().then(t.unreached_func( "Fullscreen should not be allowed in this document.")).catch(()=>{});
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/generic-sensor-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/generic-sensor-reporting.https.html index 9a5d404d..c29c069e 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/generic-sensor-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/generic-sensor-reporting.https.html
@@ -24,7 +24,7 @@ assert_false(sensor_features_verified[report.body.featureId]); // Validate the remainder of the report - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.sourceFile, document.location.href); assert_equals(typeof report.body.lineNumber, "number"); @@ -44,7 +44,7 @@ async_test(t => { new ReportingObserver(t.step_func(check_report_format), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); assert_throws_dom("SecurityError", () => new Accelerometer(), "Constructing sensors should be blocked by policy"); assert_throws_dom("SecurityError", () => new AmbientLightSensor(), "Constructing sensors should be blocked by policy"); assert_throws_dom("SecurityError", () => new Gyroscope(), "Constructing sensors should be blocked by policy");
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/geolocation-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/geolocation-reporting.https.html index fe8761f8..e0eb275b 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/geolocation-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/geolocation-reporting.https.html
@@ -10,7 +10,7 @@ var check_report_format = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "geolocation"); assert_equals(report.body.sourceFile, document.location.href); @@ -20,7 +20,7 @@ }; new ReportingObserver(t.step_func_done(check_report_format), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); navigator.geolocation.getCurrentPosition( t.unreached_func("geolocation should be disabled in this document"),
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/microphone-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/microphone-reporting.https.html index 465c9d7..14ae976 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/microphone-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/microphone-reporting.https.html
@@ -13,7 +13,7 @@ var check_report_format = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "microphone"); assert_equals(report.body.sourceFile, document.location.href); @@ -23,7 +23,7 @@ }; new ReportingObserver(t.step_func_done(check_report_format), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); setMediaPermission().then(() => navigator.mediaDevices.getUserMedia({audio: true})) .then(
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/midi-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/midi-reporting.https.html index 9e8a6eb..6cc07f5 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/midi-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/midi-reporting.https.html
@@ -8,7 +8,7 @@ <script> var check_report_format = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "midi"); assert_equals(report.body.sourceFile, document.location.href); @@ -20,7 +20,7 @@ promise_test(async (t) => { const report = new Promise(resolve => { new ReportingObserver((reports, observer) => resolve([reports, observer]), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); }); await promise_rejects_dom(t, 'SecurityError', navigator.requestMIDIAccess(), "MIDI device access should not be allowed in this document.");
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/payment-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/payment-reporting.https.html index 417dfed7..fcd0156 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/payment-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/payment-reporting.https.html
@@ -11,7 +11,7 @@ var check_report_format = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "payment"); assert_equals(report.body.sourceFile, document.location.href); @@ -22,7 +22,7 @@ }; new ReportingObserver(t.step_func_done(check_report_format), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); t.step_func(() => { assert_throws_dom('SecurityError',
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/picture-in-picture-reporting.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/picture-in-picture-reporting.html index d1c641d..177e4d5c02 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/picture-in-picture-reporting.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/picture-in-picture-reporting.html
@@ -12,7 +12,7 @@ <script> const check_report_format = (reports, observer) => { const report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "picture-in-picture"); assert_equals(report.body.sourceFile, document.location.href); @@ -32,7 +32,7 @@ promise_pip_test(async (t) => { const report = new Promise(resolve => { new ReportingObserver((reports, observer) => resolve([reports, observer]), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); }); const videoElement = await loadVideo(); await test_driver.bless('picture-in-picture');
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/screen-wake-lock-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/screen-wake-lock-reporting.https.html index ce0cbdca..4ddfc69 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/screen-wake-lock-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/screen-wake-lock-reporting.https.html
@@ -9,7 +9,7 @@ promise_test(async (t) => { const reportPromise = new Promise(resolve => { new ReportingObserver((reports, observer) => resolve(reports), - {types: ["feature-policy-violation"]}).observe(); + {types: ["permissions-policy-violation"]}).observe(); }); // Even though we do not explicitly allow screen wake lock requests in // testdriver, per spec Permissions Policy checks should happen earlier. @@ -19,7 +19,7 @@ assert_equals(reports.length, 1); const report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "screen-wake-lock"); assert_equals(report.body.sourceFile, document.location.href);
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/serial-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/serial-reporting.https.html index 827bc893..c96d8f8 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/serial-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/serial-reporting.https.html
@@ -10,7 +10,7 @@ <script> var check_report_format = ([reports, observer]) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "serial"); assert_equals(report.body.sourceFile, document.location.href); @@ -22,7 +22,7 @@ promise_test(async t => { const report = new Promise(resolve => { new ReportingObserver((reports, observer) => resolve([reports, observer]), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); }); await test_driver.bless('Activate document for serial.requestPort'); @@ -38,7 +38,7 @@ promise_test(async t => { const report = new Promise(resolve => { new ReportingObserver((reports, observer) => resolve([reports, observer]), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); }); try {
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/sync-xhr-reporting.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/sync-xhr-reporting.html index dbdcc126..416edf0 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/sync-xhr-reporting.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/sync-xhr-reporting.html
@@ -11,7 +11,7 @@ var check_report_format = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "sync-xhr"); assert_equals(report.body.sourceFile, document.location.href); @@ -22,7 +22,7 @@ }; new ReportingObserver(t.step_func_done(check_report_format), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); t.step_func(() => { var xhr = new XMLHttpRequest();
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/usb-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/usb-reporting.https.html index a63f301..1ec5ba4 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/usb-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/usb-reporting.https.html
@@ -10,7 +10,7 @@ var check_report_format = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "usb"); assert_equals(report.body.sourceFile, document.location.href); @@ -20,7 +20,7 @@ }; new ReportingObserver(t.step_func_done(check_report_format), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); navigator.usb.getDevices().then( t.unreached_func("USB device access should not be allowed in this document.")
diff --git a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/xr-reporting.https.html b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/xr-reporting.https.html index 3d62923..d87d4fb02 100644 --- a/third_party/blink/web_tests/external/wpt/feature-policy/reporting/xr-reporting.https.html +++ b/third_party/blink/web_tests/external/wpt/feature-policy/reporting/xr-reporting.https.html
@@ -8,7 +8,7 @@ <script> var check_report_format = (reports, observer) => { let report = reports[0]; - assert_equals(report.type, "feature-policy-violation"); + assert_equals(report.type, "permissions-policy-violation"); assert_equals(report.url, document.location.href); assert_equals(report.body.featureId, "xr-spatial-tracking"); assert_equals(report.body.sourceFile, document.location.href); @@ -20,7 +20,7 @@ promise_test(async (t) => { const report = new Promise(resolve => { new ReportingObserver((reports, observer) => resolve([reports, observer]), - {types: ['feature-policy-violation']}).observe(); + {types: ['permissions-policy-violation']}).observe(); }); await promise_rejects_dom(t, 'SecurityError', navigator.xr.isSessionSupported('immersive-vr'),
diff --git a/third_party/blink/web_tests/external/wpt/js-self-profiling/resources/profile-utils.js b/third_party/blink/web_tests/external/wpt/js-self-profiling/resources/profile-utils.js index 33338a6..2c32f34 100644 --- a/third_party/blink/web_tests/external/wpt/js-self-profiling/resources/profile-utils.js +++ b/third_party/blink/web_tests/external/wpt/js-self-profiling/resources/profile-utils.js
@@ -1,5 +1,6 @@ (function(global) { const TEST_SAMPLE_INTERVAL = 10; + const ENSURE_SAMPLE_SPIN_WAIT_MS = 500; function forceSample() { // Spin for |TEST_SAMPLE_INTERVAL + 500|ms to ensure that a sample occurs @@ -8,7 +9,10 @@ // // More reliable sampling will be handled in a future testdriver RFC // (https://github.com/web-platform-tests/rfcs/pull/81). - for (const deadline = performance.now() + TEST_SAMPLE_INTERVAL + 500; performance.now() < deadline;); + for (const deadline = performance.now() + TEST_SAMPLE_INTERVAL + + ENSURE_SAMPLE_SPIN_WAIT_MS; + performance.now() < deadline;) + ; } // Creates a new profile that captures the execution of when the given @@ -82,6 +86,24 @@ return trace.resources.includes(expectedResource); } + // Returns true if a trace contains a sample matching the given specification. + // We define a "match" as follows: a sample A matches an expectation E if (and + // only if) for each field of E, A has the same value. + function containsSample(trace, expectedSample) { + return trace.samples.find(sample => { + return sampleMatches(sample, expectedSample); + }) !== undefined; + } + + // Compares each set field of `expected` against the given frame `actual`. + function sampleMatches(actual, expected) { + return (expected.timestamp === undefined || + expected.timestamp === actual.timestamp) && + (expected.stackId === undefined || + expected.stackId === actual.stackId) && + (expected.marker === undefined || expected.marker === actual.marker); + } + // Compares each set field of `expected` against the given frame `actual`. function frameMatches(actual, expected) { return (expected.name === undefined || expected.name === actual.name) && @@ -116,6 +138,7 @@ containsFrame, containsSubstack, containsResource, + containsSample, // Cross-frame sampling forceSampleFrame,
diff --git a/third_party/blink/web_tests/external/wpt/js-self-profiling/tentative/README.md b/third_party/blink/web_tests/external/wpt/js-self-profiling/tentative/README.md new file mode 100644 index 0000000..a6b8d00 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/js-self-profiling/tentative/README.md
@@ -0,0 +1,3 @@ +Tests in this directory are for the proposed js-self-profiling API marker extension. This is not yet standardised and browsers should not be expected to pass these tests. + +See the explainer at https://github.com/WICG/js-self-profiling/blob/main/markers.md for more information about the API.
diff --git a/third_party/blink/web_tests/external/wpt/js-self-profiling/tentative/marker-vm-state.https.html b/third_party/blink/web_tests/external/wpt/js-self-profiling/tentative/marker-vm-state.https.html new file mode 100644 index 0000000..07dbe7f --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/js-self-profiling/tentative/marker-vm-state.https.html
@@ -0,0 +1,37 @@ +<!DOCTYPE html> +<html> + +<head> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + + <script src="../resources/profile-utils.js"></script> +</head> + +<body> + + <script> + // Note: moving these function definitions will change the expected + // outcomes below. + function scriptFunction(sample) { + sample(); + } + </script> + + <script> + promise_test(async t => { + // *.headers file should ensure we sesrve COOP and COEP headers. + assert_true(self.crossOriginIsolated, + "Cross origin isolation is required to surface markers"); + const trace = await ProfileUtils.profileFunction(scriptFunction); + + assert_true(ProfileUtils.containsSample(trace, { + stackId: 7, + marker: 'script' + })); + }, 'markers logged correctly'); + + </script> +</body> + +</html>
diff --git a/third_party/blink/web_tests/external/wpt/js-self-profiling/tentative/marker-vm-state.https.html.headers b/third_party/blink/web_tests/external/wpt/js-self-profiling/tentative/marker-vm-state.https.html.headers new file mode 100644 index 0000000..228047a1 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/js-self-profiling/tentative/marker-vm-state.https.html.headers
@@ -0,0 +1,3 @@ +Document-Policy: js-profiling +Cross-Origin-Embedder-Policy: require-corp +Cross-Origin-Opener-Policy: same-origin
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-pipes-data-in-worker.https-expected.txt b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-pipes-data-in-worker.https-expected.txt new file mode 100644 index 0000000..df92162 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-pipes-data-in-worker.https-expected.txt
@@ -0,0 +1,4 @@ +This is a testharness.js-based test. +FAIL A worker is able to pipe data through a MediaStreamTrackGenerator without crashing promise_test: Unhandled rejection with value: "Failed with error ReferenceError: MediaStreamTrackGenerator is not defined" +Harness: the test ran to completion. +
diff --git a/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-pipes-data-in-worker.https.html b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-pipes-data-in-worker.https.html new file mode 100644 index 0000000..61a6f03 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/mediacapture-insertable-streams/MediaStreamTrackGenerator-pipes-data-in-worker.https.html
@@ -0,0 +1,41 @@ +<!doctype html> +<title>Test piping data through MediaStreamTrackGenerator in a worker</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script id="workerCode" type="javascript/worker"> +self.onmessage = (e) => { + try { + const generator = new MediaStreamTrackGenerator({kind: 'video'}); + e.data.readable.pipeTo(generator.writable); + self.postMessage({result: 'Success'}); + } catch (e) { + self.postMessage({result: 'Failure', error: e}); + } +} +</script> +<script> +'use strict'; + +promise_test(async t => { + const workerBlob = new Blob([document.querySelector('#workerCode').textContent], + { type: "text/javascript" }); + const workerUrl = window.URL.createObjectURL(workerBlob); + const worker = new Worker(workerUrl); + window.URL.revokeObjectURL(workerUrl); + const result = new Promise((resolve, reject) => { + worker.onmessage = (e) => { + if (e.data.result === 'Failure') { + reject('Failed with error ' + e.data.error); + } else { + resolve(); + } + }; + }); + const stream = await navigator.mediaDevices.getUserMedia({ video: true }); + const track = stream.getVideoTracks()[0]; + const processor = new MediaStreamTrackProcessor({ track: track }); + worker.postMessage({ readable: processor.readable }, + [processor.readable]); + return result; +}, 'A worker is able to pipe data through a MediaStreamTrackGenerator without crashing'); +</script> \ No newline at end of file
diff --git a/tools/android/python_utils/PRESUBMIT.py b/tools/android/python_utils/PRESUBMIT.py new file mode 100644 index 0000000..30387f2 --- /dev/null +++ b/tools/android/python_utils/PRESUBMIT.py
@@ -0,0 +1,26 @@ +# Lint as: python3 +# 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. +"""Top-level presubmit script for python_utils. + +See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts +for more details on the presubmit API built into depot_tools. +""" + +USE_PYTHON3 = True +PRESUBMIT_VERSION = '2.0.0' + + +def CheckChange(input_api, output_api): + """Presubmit checks to run on upload and on commit of a CL.""" + checks = input_api.canned_checks.GetUnitTestsRecursively( + input_api, + output_api, + input_api.PresubmitLocalPath(), + files_to_check=[r'.+_unittest\.py$'], + files_to_skip=[], + run_on_python2=False, + run_on_python3=True) + + return input_api.RunTests(checks, False)
diff --git a/tools/android/python_utils/git_metadata_utils.py b/tools/android/python_utils/git_metadata_utils.py index c9f62681..5977c81 100644 --- a/tools/android/python_utils/git_metadata_utils.py +++ b/tools/android/python_utils/git_metadata_utils.py
@@ -7,7 +7,7 @@ import datetime as dt import functools import pathlib -from typing import Optional +from typing import Optional, Union from . import subprocess_utils @@ -28,14 +28,15 @@ f'_CHROMIUM_SRC_ROOT "{_CHROMIUM_SRC_ROOT}" should end in "src".') try: - _assert_git_repository(str(_CHROMIUM_SRC_ROOT)) + _assert_git_repository(_CHROMIUM_SRC_ROOT) except (ValueError, RuntimeError): raise AssertionError return _CHROMIUM_SRC_ROOT -def get_head_commit_hash(git_repo: Optional[str] = None) -> str: +def get_head_commit_hash(git_repo: Optional[Union[str, pathlib.Path]] = None + ) -> str: """Gets the hash of the commit at HEAD for a Git repository. This returns the full, non-abbreviated, SHA1 hash of the commit as a string @@ -59,7 +60,10 @@ loop. """ if not git_repo: - git_repo = str(get_chromium_src_path()) + git_repo = get_chromium_src_path() + + if not isinstance(git_repo, pathlib.Path): + git_repo = pathlib.Path(git_repo) _assert_git_repository(git_repo) @@ -67,7 +71,8 @@ ['git', 'show', '--no-patch', f'--pretty=format:%H'], cwd=git_repo) -def get_head_commit_datetime(git_repo: Optional[str] = None) -> dt.datetime: +def get_head_commit_datetime( + git_repo: Optional[Union[str, pathlib.Path]] = None) -> dt.datetime: """Gets the datetime of the commit at HEAD for a Git repository in UTC. The datetime returned contains timezone information (in timezone.utc) so @@ -91,7 +96,10 @@ loop. """ if not git_repo: - git_repo = str(get_chromium_src_path()) + git_repo = get_chromium_src_path() + + if not isinstance(git_repo, pathlib.Path): + git_repo = pathlib.Path(git_repo) _assert_git_repository(git_repo) @@ -101,9 +109,9 @@ return dt.datetime.fromtimestamp(float(timestamp), tz=dt.timezone.utc) -def _assert_git_repository(git_repo_root: str) -> None: +def _assert_git_repository(git_repo_root: pathlib.Path) -> None: try: - repo_path = pathlib.Path(git_repo_root).resolve(strict=True) + repo_path = git_repo_root.resolve(strict=True) except FileNotFoundError as err: raise ValueError( f'The Git repository root "{git_repo_root}" is invalid;'
diff --git a/tools/android/python_utils/git_metadata_utils_unittest.py b/tools/android/python_utils/git_metadata_utils_unittest.py index 52c11cc..ad1cf2c 100755 --- a/tools/android/python_utils/git_metadata_utils_unittest.py +++ b/tools/android/python_utils/git_metadata_utils_unittest.py
@@ -9,7 +9,7 @@ import unittest from datetime import datetime, timezone -_TOOLS_ANDROID_PATH = pathlib.Path(__file__).parents[1].resolve() +_TOOLS_ANDROID_PATH = pathlib.Path(__file__).resolve(strict=True).parents[1] if str(_TOOLS_ANDROID_PATH) not in sys.path: sys.path.append(str(_TOOLS_ANDROID_PATH)) from python_utils import git_metadata_utils @@ -55,10 +55,20 @@ self.assertRegex(commit_hash, _SHA1_HASH_REGEX, f'"{commit_hash}" is not a SHA1 hash.') + def test_get_head_commit_hash_chromium_repo_path(self): + """Tests that get_head_commit_hash handles pathlib Paths.""" + expected_commit_hash = git_metadata_utils.get_head_commit_hash( + git_repo=str(_CHROMIUM_SRC_ROOT)) + + commit_hash = git_metadata_utils.get_head_commit_hash( + git_repo=_CHROMIUM_SRC_ROOT) + + self.assertEqual(expected_commit_hash, commit_hash) + def test_get_head_commit_hash_default_repo(self): """Tests that the Chromium repo is used when no git_repo specified.""" expected_commit_hash = git_metadata_utils.get_head_commit_hash( - git_repo=str(_CHROMIUM_SRC_ROOT)) + git_repo=_CHROMIUM_SRC_ROOT) commit_hash = git_metadata_utils.get_head_commit_hash() @@ -69,7 +79,7 @@ chromium_commit_hash = git_metadata_utils.get_head_commit_hash() commit_hash = git_metadata_utils.get_head_commit_hash( - git_repo=str(_V8_GIT_ROOT)) + git_repo=_V8_GIT_ROOT) self.assertRegex(commit_hash, _SHA1_HASH_REGEX, f'"{commit_hash}" is not a SHA1 hash.') @@ -79,7 +89,7 @@ """Tests that ValueError is raised when git_repo is not a repo path.""" with self.assertRaises(ValueError) as error_cm: git_metadata_utils.get_head_commit_hash( - git_repo=str(_MISSING_FILE_FOLDER)) + git_repo=_MISSING_FILE_FOLDER) self.assertEqual( f'The Git repository root "{_MISSING_FILE_FOLDER}" is' @@ -89,8 +99,7 @@ def test_get_head_commit_hash_invalid_repo(self): """Tests that ValueError is raised when git_repo is not a repo path.""" with self.assertRaises(ValueError) as error_cm: - git_metadata_utils.get_head_commit_hash( - git_repo=str(_TEST_FILE_FOLDER)) + git_metadata_utils.get_head_commit_hash(git_repo=_TEST_FILE_FOLDER) self.assertEqual( f'The path "{_TEST_FILE_FOLDER}" is not a root directory for a Git' @@ -108,7 +117,7 @@ UTC) and that the datetime is sane. """ commit_datetime = git_metadata_utils.get_head_commit_datetime( - git_repo=str(_CHROMIUM_SRC_ROOT)) + git_repo=_CHROMIUM_SRC_ROOT) self.assertIsNotNone(commit_datetime.tzinfo) self.assertIsNotNone(commit_datetime.utcoffset()) @@ -118,10 +127,20 @@ self.assertLess(commit_datetime, datetime(2050, 1, 1, tzinfo=timezone.utc)) + def test_get_head_commit_datetime_chromium_repo_path(self): + """Tests that get_head_commit_datetime handles pathlib Paths.""" + expected_commit_datetime = git_metadata_utils.get_head_commit_datetime( + git_repo=str(_CHROMIUM_SRC_ROOT)) + + commit_datetime = git_metadata_utils.get_head_commit_datetime( + git_repo=_CHROMIUM_SRC_ROOT) + + self.assertEqual(expected_commit_datetime, commit_datetime) + def test_get_head_commit_datetime_default_repo(self): """Tests that the Chromium repo is used when no git_repo specified.""" expected_commit_datetime = git_metadata_utils.get_head_commit_datetime( - git_repo=str(_CHROMIUM_SRC_ROOT)) + git_repo=_CHROMIUM_SRC_ROOT) commit_datetime = git_metadata_utils.get_head_commit_datetime() @@ -132,7 +151,7 @@ chromium_datetime = git_metadata_utils.get_head_commit_datetime() commit_datetime = git_metadata_utils.get_head_commit_datetime( - git_repo=str(_V8_GIT_ROOT)) + git_repo=_V8_GIT_ROOT) self.assertNotEqual(chromium_datetime, commit_datetime) @@ -140,7 +159,7 @@ """Tests that ValueError is raised when git_repo is not a repo path.""" with self.assertRaises(ValueError) as error_cm: git_metadata_utils.get_head_commit_datetime( - git_repo=str(_MISSING_FILE_FOLDER)) + git_repo=_MISSING_FILE_FOLDER) self.assertEqual( f'The Git repository root "{_MISSING_FILE_FOLDER}" is' @@ -151,7 +170,7 @@ """Tests that ValueError is raised when git_repo is not a repo path.""" with self.assertRaises(ValueError) as error_cm: git_metadata_utils.get_head_commit_datetime( - git_repo=str(_TEST_FILE_FOLDER)) + git_repo=_TEST_FILE_FOLDER) self.assertEqual( f'The path "{_TEST_FILE_FOLDER}" is not a root directory for a Git'
diff --git a/tools/android/python_utils/subprocess_utils.py b/tools/android/python_utils/subprocess_utils.py index a674a4d..ae3c50e 100644 --- a/tools/android/python_utils/subprocess_utils.py +++ b/tools/android/python_utils/subprocess_utils.py
@@ -5,15 +5,16 @@ """Helper functions for running commands as subprocesses.""" import logging +import pathlib import subprocess -from typing import Optional, Sequence +from typing import Optional, Sequence, Union def run_command( command: Sequence[str], *, # Ensures that the rest of the args are passed explicitly. - cwd: Optional[str] = None, + cwd: Optional[Union[str, pathlib.Path]] = None, cmd_input: Optional[str] = None, exitcode_only: bool = False) -> str: """Runs a command and returns the output as a string.
diff --git a/tools/android/python_utils/subprocess_utils_unittest.py b/tools/android/python_utils/subprocess_utils_unittest.py index c2a1ad4..eb8d322 100755 --- a/tools/android/python_utils/subprocess_utils_unittest.py +++ b/tools/android/python_utils/subprocess_utils_unittest.py
@@ -5,6 +5,7 @@ """Tests for subprocess_utils.""" import os +import pathlib import subprocess import unittest @@ -31,6 +32,14 @@ self.assertEqual(expected_cwd, pwd_output) + def test_run_command_custom_cwd_path(self): + expected_cwd = '/usr/local/bin' + + pwd_output = subprocess_utils.run_command( + ['pwd'], cwd=pathlib.Path(expected_cwd).resolve(strict=True)) + + self.assertEqual(expected_cwd, pwd_output) + def test_run_command_multiple_args(self): expected_output = 'some sample output'
diff --git a/tools/android/test_health/test_health_extractor.py b/tools/android/test_health/test_health_extractor.py index 4a31e98..154b9dcf 100644 --- a/tools/android/test_health/test_health_extractor.py +++ b/tools/android/test_health/test_health_extractor.py
@@ -135,8 +135,5 @@ def _get_git_repo_info(git_repo: pathlib.Path) -> GitRepoInfo: - return GitRepoInfo( - # TODO(crbug/3372331): Update git_metadata_utils API to accept both - # str and pathlib.Path. - git_metadata_utils.get_head_commit_hash(str(git_repo)), - git_metadata_utils.get_head_commit_datetime(str(git_repo))) + return GitRepoInfo(git_metadata_utils.get_head_commit_hash(git_repo), + git_metadata_utils.get_head_commit_datetime(git_repo))
diff --git a/tools/autotest.py b/tools/autotest.py index 7a335fd..37b891e 100755 --- a/tools/autotest.py +++ b/tools/autotest.py
@@ -427,10 +427,6 @@ args, _extras = parser.parse_known_args() - # Use CWD as out_dir when build.ninja exists. - if not args.out_dir and os.path.exists('build.ninja'): - args.out_dir = '.' - if args.out_dir: constants.SetOutputDirectory(args.out_dir) constants.CheckOutputDirectory()
diff --git a/tools/binary_size/diagnose_bloat.py b/tools/binary_size/diagnose_bloat.py index 915e6329..650a794 100755 --- a/tools/binary_size/diagnose_bloat.py +++ b/tools/binary_size/diagnose_bloat.py
@@ -10,11 +10,10 @@ Note: this tool will perform gclient sync/git checkout on your local repo. """ -import atexit import argparse +import atexit import collections from contextlib import contextmanager -import distutils.spawn import json import logging import os @@ -22,8 +21,7 @@ import shutil import subprocess import sys -import tempfile -import zipfile + _COMMIT_COUNT_WARN_THRESHOLD = 15 _ALLOWED_CONSECUTIVE_FAILURES = 2 @@ -31,14 +29,14 @@ os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)) _DEFAULT_ARCHIVE_DIR = os.path.join(_SRC_ROOT, 'out', 'binary-size-results') _DEFAULT_OUT_DIR = os.path.join(_SRC_ROOT, 'out', 'binary-size-build') -_BINARY_SIZE_DIR = os.path.join(_SRC_ROOT, 'tools', 'binary_size') +_SUPERSIZE_PATH = os.path.join(_SRC_ROOT, 'tools', 'binary_size', 'supersize') _RESOURCE_SIZES_PATH = os.path.join( _SRC_ROOT, 'build', 'android', 'resource_sizes.py') -_LLVM_TOOLS_DIR = os.path.join( - _SRC_ROOT, 'third_party', 'llvm-build', 'Release+Asserts', 'bin') +_GN_PATH = os.path.join(_SRC_ROOT, 'third_party', 'depot_tools', 'gn') +_LLVM_TOOLS_DIR = os.path.join(_SRC_ROOT, 'third_party', 'llvm-build', + 'Release+Asserts', 'bin') _CLANG_UPDATE_PATH = os.path.join(_SRC_ROOT, 'tools', 'clang', 'scripts', 'update.py') -_GN_PATH = os.path.join(_SRC_ROOT, 'third_party', 'depot_tools', 'gn') _DiffResult = collections.namedtuple('DiffResult', ['name', 'value', 'units']) @@ -92,9 +90,8 @@ r'Section Sizes \(Total=(?P<value>-?[0-9\.]+) ?(?P<units>\w+)') _SUMMARY_STAT_NAME = 'Native Library Delta' - def __init__(self, size_name, supersize_path): + def __init__(self, size_name): self._size_name = size_name - self._supersize_path = supersize_path self._diff = [] super().__init__('Native Diff') @@ -115,7 +112,7 @@ def ProduceDiff(self, before_dir, after_dir): before_size = os.path.join(before_dir, self._size_name) after_size = os.path.join(after_dir, self._size_name) - cmd = [self._supersize_path, 'diff', before_size, after_size] + cmd = [_SUPERSIZE_PATH, 'diff', before_size, after_size] self._diff = _RunCmd(cmd)[0].replace('{', '{{').replace('}', '}}') @@ -412,7 +409,7 @@ self.metadata = _Metadata([self], build, metadata_path, subrepo) self._save_unstripped = save_unstripped - def ArchiveBuildResults(self, supersize_path, tool_prefix=None): + def ArchiveBuildResults(self): """Save build artifacts necessary for diffing.""" logging.info('Saving build results to: %s', self.dir) _EnsureDirsExist(self.dir) @@ -422,7 +419,7 @@ for path in self.build.abs_mapping_paths: self._ArchiveFile(path) self._ArchiveResourceSizes() - self._ArchiveSizeFile(supersize_path, tool_prefix) + self._ArchiveSizeFile() if self._save_unstripped: self._ArchiveFile(self.build.abs_main_lib_path) self.metadata.Write() @@ -462,8 +459,8 @@ _Die('missing expected file: %s', filename) shutil.copy(filename, self.dir) - def _ArchiveSizeFile(self, supersize_path, tool_prefix): - supersize_cmd = [supersize_path, 'archive', self.archived_size_path] + def _ArchiveSizeFile(self): + supersize_cmd = [_SUPERSIZE_PATH, 'archive', self.archived_size_path] if self.build.IsAndroid(): supersize_cmd += [ '-f', self.build.supersize_input, '--aux-elf-file', @@ -472,8 +469,6 @@ else: supersize_cmd += ['--elf-file', self.build.abs_main_lib_path] supersize_cmd += ['--output-directory', self.build.output_directory] - if tool_prefix: - supersize_cmd += ['--tool-prefix', tool_prefix] logging.info('Creating .size file') _RunCmd(supersize_cmd) @@ -532,11 +527,10 @@ diff_path) return - supersize_path = os.path.join(_BINARY_SIZE_DIR, 'supersize') report_path = os.path.join(diff_path, 'diff.sizediff') supersize_cmd = [ - supersize_path, 'save_diff', before.archived_size_path, + _SUPERSIZE_PATH, 'save_diff', before.archived_size_path, after.archived_size_path, report_path ] @@ -584,13 +578,13 @@ if num_archives <= 2: if not all(a.Exists() for a in self.build_archives): return - supersize_path = os.path.join(_BINARY_SIZE_DIR, 'supersize') size2 = '' if num_archives == 2: size2 = os.path.relpath(self.build_archives[-1].archived_size_path) logging.info('Enter supersize console via: %s console %s %s', - os.path.relpath(supersize_path), - os.path.relpath(self.build_archives[0].archived_size_path), size2) + os.path.relpath(_SUPERSIZE_PATH), + os.path.relpath(self.build_archives[0].archived_size_path), + size2) def _AddDiffSummaryStat(self, before, after): @@ -812,28 +806,6 @@ sys.stdout.write(f.read()) -@contextmanager -def _TmpCopyBinarySizeDir(): - """Recursively copy files to a temp dir and yield temp paths.""" - # Needs to be at same level of nesting as the real //tools/binary_size - # since supersize uses this to find d3 in //third_party. - tmp_dir = tempfile.mkdtemp(dir=_SRC_ROOT) - try: - bs_dir = os.path.join(tmp_dir, 'binary_size') - shutil.copytree(_BINARY_SIZE_DIR, bs_dir) - # We also copy the tools supersize needs, but only if they exist. - tool_prefix = None - if os.path.exists(_CLANG_UPDATE_PATH): - if not os.path.exists(os.path.join(_LLVM_TOOLS_DIR, 'llvm-readelf')): - _RunCmd([_CLANG_UPDATE_PATH, '--package=objdump']) - tools_dir = os.path.join(bs_dir, 'bintools') - tool_prefix = os.path.join(tools_dir, 'llvm-') - shutil.copytree(_LLVM_TOOLS_DIR, tools_dir) - yield (os.path.join(bs_dir, 'supersize'), tool_prefix) - finally: - shutil.rmtree(tmp_dir) - - def _CurrentGitHash(subrepo): return _GitCmd(['rev-parse', 'HEAD'], subrepo) @@ -942,47 +914,52 @@ if build.IsLinux(): _VerifyUserAccepts('Linux diffs have known deficiencies (crbug/717550).') + # llvm-objdump always exists for android checkouts, which run it as DEPS hook, + # but not for linux. + if not os.path.exists(os.path.join(_LLVM_TOOLS_DIR, 'llvm-objdump')): + _RunCmd([_CLANG_UPDATE_PATH, '--package=objdump']) + reference_rev = args.reference_rev or args.rev + '^' if args.single: reference_rev = args.rev _ValidateRevs(args.rev, reference_rev, subrepo, args.extra_rev) revs = _GenerateRevList(args.rev, reference_rev, args.all, subrepo, args.step) - with _TmpCopyBinarySizeDir() as paths: - supersize_path, tool_prefix = paths - diffs = [NativeDiff(build.size_name, supersize_path)] - if build.IsAndroid(): - diffs += [ResourceSizesDiff()] - diff_mngr = _DiffArchiveManager(revs, args.archive_directory, diffs, build, - subrepo, args.unstripped) - consecutive_failures = 0 - i = 0 - for i, archive in enumerate(diff_mngr.build_archives): - if archive.Exists(): - logging.info('Found matching metadata for %s, skipping build step.', - archive.rev) + + diffs = [NativeDiff(build.size_name)] + if build.IsAndroid(): + diffs += [ResourceSizesDiff()] + diff_mngr = _DiffArchiveManager(revs, args.archive_directory, diffs, build, + subrepo, args.unstripped) + consecutive_failures = 0 + i = 0 + for i, archive in enumerate(diff_mngr.build_archives): + if archive.Exists(): + logging.info('Found matching metadata for %s, skipping build step.', + archive.rev) + else: + build_failure = _SyncAndBuild(archive, build, subrepo, args.no_gclient, + args.extra_rev) + if build_failure: + logging.info( + 'Build failed for %s, diffs using this rev will be skipped.', + archive.rev) + consecutive_failures += 1 + if len(diff_mngr.build_archives) <= 2: + _Die('Stopping due to build failure.') + elif consecutive_failures > _ALLOWED_CONSECUTIVE_FAILURES: + _Die('%d builds failed in a row, last failure was %s.', + consecutive_failures, archive.rev) else: - build_failure = _SyncAndBuild(archive, build, subrepo, args.no_gclient, - args.extra_rev) - if build_failure: - logging.info( - 'Build failed for %s, diffs using this rev will be skipped.', - archive.rev) - consecutive_failures += 1 - if len(diff_mngr.build_archives) <= 2: - _Die('Stopping due to build failure.') - elif consecutive_failures > _ALLOWED_CONSECUTIVE_FAILURES: - _Die('%d builds failed in a row, last failure was %s.', - consecutive_failures, archive.rev) - else: - archive.ArchiveBuildResults(supersize_path, tool_prefix) - consecutive_failures = 0 + archive.ArchiveBuildResults() + consecutive_failures = 0 - if i != 0: - diff_mngr.MaybeDiff(i - 1, i) + if i != 0: + diff_mngr.MaybeDiff(i - 1, i) - diff_mngr.GenerateHtmlReport( - 0, i, is_internal=args.enable_chrome_android_internal) - diff_mngr.Summarize() + diff_mngr.GenerateHtmlReport(0, + i, + is_internal=args.enable_chrome_android_internal) + diff_mngr.Summarize() return 0
diff --git a/tools/binary_size/libsupersize/archive.py b/tools/binary_size/libsupersize/archive.py index 14ab273..a5879292 100644 --- a/tools/binary_size/libsupersize/archive.py +++ b/tools/binary_size/libsupersize/archive.py
@@ -83,12 +83,15 @@ @dataclasses.dataclass class NativeSpec: # One (or more) of apk_so_path, map_path, elf_path must be non-None. - tool_prefix: str # Never None. # Path within the .apk of the .so file. Non-None only when apk_spec is. apk_so_path: str = None + # Path to linker map file (if present). map_path: str = None - elf_path: str = None # Unstripped .so path. - linker_name: str = None # Requires map_path. Either 'gold' or 'lld'. + # Path to unstripped ELF file (if present). + elf_path: str = None + # Requires map_path. Either 'gold' or 'lld'. + linker_name: str = None + # Whether to create symbols for each string literal. track_string_literals: bool = True # component to use for all symbols. component: str = None @@ -614,9 +617,10 @@ (name, address, ','.join('%x' % a for a in missing_names[name]))) if float(num_new_symbols) / len(raw_symbols) < .05: - logging.warning('Number of aliases is oddly low (%.0f%%). It should ' - 'usually be around 25%%. Ensure --tool-prefix is correct. ', - float(num_new_symbols) / len(raw_symbols) * 100) + logging.warning( + 'Number of aliases is oddly low (%.0f%%). It should ' + 'usually be around 25%%.', + float(num_new_symbols) / len(raw_symbols) * 100) # Step 2: Create new symbols as siblings to each existing one. logging.debug('Creating %d new symbols from nm output', num_new_symbols) @@ -722,10 +726,6 @@ update_build_config(models.BUILD_CONFIG_GIT_REVISION, git_rev) if native_spec: - relative_tool_prefix = path_util.ToToolsSrcRootRelative( - native_spec.tool_prefix) - update_build_config(models.BUILD_CONFIG_TOOL_PREFIX, relative_tool_prefix) - metadata[models.METADATA_ELF_ALGORITHM] = native_spec.algorithm if native_spec.linker_name: update_build_config(models.BUILD_CONFIG_LINKER_NAME, @@ -734,20 +734,17 @@ if native_spec.elf_path: metadata[models.METADATA_ELF_FILENAME] = shorten_path( native_spec.elf_path) - architecture = readelf.ArchFromElf(native_spec.elf_path, - native_spec.tool_prefix) + architecture = readelf.ArchFromElf(native_spec.elf_path) # TODO(agrieve): We could add these in when elf_path=None and apk_so_path. metadata[models.METADATA_ELF_ARCHITECTURE] = architecture timestamp_obj = datetime.datetime.utcfromtimestamp( os.path.getmtime(native_spec.elf_path)) timestamp = calendar.timegm(timestamp_obj.timetuple()) metadata[models.METADATA_ELF_MTIME] = timestamp - build_id = readelf.BuildIdFromElf(native_spec.elf_path, - native_spec.tool_prefix) + build_id = readelf.BuildIdFromElf(native_spec.elf_path) metadata[models.METADATA_ELF_BUILD_ID] = build_id - relocations_count = _CountRelocationsFromElf(native_spec.elf_path, - native_spec.tool_prefix) + relocations_count = _CountRelocationsFromElf(native_spec.elf_path) metadata[models.METADATA_ELF_RELOCATIONS_COUNT] = relocations_count if native_spec.map_path: @@ -811,7 +808,7 @@ num_deduced, num_arbitrations, num_unassigned) -def _NameStringLiterals(raw_symbols, elf_path, tool_prefix): +def _NameStringLiterals(raw_symbols, elf_path): # Assign ASCII-readable string literals names like "string contents". STRING_LENGTH_CUTOFF = 30 @@ -819,8 +816,7 @@ for ch in string.printable: PRINTABLE_TBL[ord(ch)] = True - for sym, name in string_extract.ReadStringLiterals(raw_symbols, elf_path, - tool_prefix): + for sym, name in string_extract.ReadStringLiterals(raw_symbols, elf_path): # Newlines and tabs are used as delimiters in file_format.py # At this point, names still have a terminating null byte. name = name.replace(b'\n', b'').replace(b'\t', b'').strip(b'\00') @@ -842,16 +838,14 @@ assert native_spec.map_path or not native_spec.track_string_literals, ( 'track_string_literals not yet implemented without map file') if native_spec.elf_path: - elf_section_ranges = readelf.SectionInfoFromElf(native_spec.elf_path, - native_spec.tool_prefix) + elf_section_ranges = readelf.SectionInfoFromElf(native_spec.elf_path) # Run nm on the elf file to retrieve the list of symbol names per-address. # This list is required because the .map file contains only a single name # for each address, yet multiple symbols are often coalesced when they are # identical. This coalescing happens mainly for small symbols and for C++ # templates. Such symbols make up ~500kb of libchrome.so on Android. - elf_nm_result = nm.CollectAliasesByAddressAsync(native_spec.elf_path, - native_spec.tool_prefix) + elf_nm_result = nm.CollectAliasesByAddressAsync(native_spec.elf_path) # Run nm on all .o/.a files to retrieve the symbol names within them. # The list is used to detect when mutiple .o files contain the same symbol @@ -863,7 +857,6 @@ # common ancestor of all paths. if outdir_context and native_spec.map_path: bulk_analyzer = obj_analyzer.BulkObjectFileAnalyzer( - native_spec.tool_prefix, outdir_context.output_directory, track_string_literals=native_spec.track_string_literals) bulk_analyzer.AnalyzePaths(outdir_context.elf_object_paths) @@ -879,7 +872,6 @@ else: logging.info('Collecting symbols from nm') raw_symbols = nm.CreateUniqueSymbols(native_spec.elf_path, - native_spec.tool_prefix, elf_section_ranges) if native_spec.elf_path and native_spec.map_path: @@ -918,7 +910,7 @@ # Map file for some reason doesn't demangle all names. # Demangle prints its own log statement. - demangle.DemangleRemainingSymbols(raw_symbols, native_spec.tool_prefix) + demangle.DemangleRemainingSymbols(raw_symbols) object_paths_by_name = {} if native_spec.elf_path: @@ -968,8 +960,7 @@ linker_map_extras) if native_spec.elf_path and native_spec.track_string_literals: - _NameStringLiterals(raw_symbols, native_spec.elf_path, - native_spec.tool_prefix) + _NameStringLiterals(raw_symbols, native_spec.elf_path) # If we have an ELF file, use its ranges as the source of truth, since some # sections can differ from the .map. @@ -1178,8 +1169,7 @@ if apk_spec and native_spec.apk_so_path: # Extraction takes around 1 second, so do it in parallel. apk_elf_result = parallel.ForkAndCall( - _ElfInfoFromApk, - (apk_spec.apk_path, native_spec.apk_so_path, native_spec.tool_prefix)) + _ElfInfoFromApk, (apk_spec.apk_path, native_spec.apk_so_path)) raw_symbols = [] ninja_source_mapper = None @@ -1193,7 +1183,7 @@ elif native_spec.elf_path: logging.info('Parsing source path info via dwarfdump') dwarf_source_mapper = dwarfdump.CreateAddressSourceMapper( - native_spec.elf_path, native_spec.tool_prefix) + native_spec.elf_path) logging.info('Found %d source paths across %s ranges', dwarf_source_mapper.NumberOfPaths(), dwarf_source_mapper.num_ranges) @@ -1246,11 +1236,10 @@ # debug sections. with tempfile.NamedTemporaryFile( suffix=os.path.basename(native_spec.elf_path)) as f: - strip_path = path_util.GetStripPath(native_spec.tool_prefix) + strip_path = path_util.GetStripPath() subprocess.run([strip_path, '-o', f.name, native_spec.elf_path], check=True) - section_ranges = readelf.SectionInfoFromElf(f.name, - native_spec.tool_prefix) + section_ranges = readelf.SectionInfoFromElf(f.name) elf_overhead_size = _CalculateElfOverhead(section_ranges, f.name) source_path = '' @@ -1571,13 +1560,13 @@ return None -def _ElfIsMainPartition(elf_path, tool_prefix): - section_ranges = readelf.SectionInfoFromElf(elf_path, tool_prefix) +def _ElfIsMainPartition(elf_path): + section_ranges = readelf.SectionInfoFromElf(elf_path) return models.SECTION_PART_END in section_ranges.keys() -def _CountRelocationsFromElf(elf_path, tool_prefix): - args = [path_util.GetObjDumpPath(tool_prefix), '--private-headers', elf_path] +def _CountRelocationsFromElf(elf_path): + args = [path_util.GetObjDumpPath(), '--private-headers', elf_path] stdout = subprocess.check_output(args).decode('ascii') relocations = re.search('REL[AR]?COUNT\s*(.+)', stdout).group(1) return int(relocations, 16) @@ -1602,11 +1591,11 @@ return linker_map_parser.DetectLinkerNameFromMapFile(f) -def _ElfInfoFromApk(apk_path, apk_so_path, tool_prefix): +def _ElfInfoFromApk(apk_path, apk_so_path): """Returns a tuple of (build_id, section_ranges, elf_overhead_size).""" with zip_util.UnzipToTemp(apk_path, apk_so_path) as temp: - build_id = readelf.BuildIdFromElf(temp, tool_prefix) - section_ranges = readelf.SectionInfoFromElf(temp, tool_prefix) + build_id = readelf.BuildIdFromElf(temp) + section_ranges = readelf.SectionInfoFromElf(temp) elf_overhead_size = _CalculateElfOverhead(section_ranges, temp) return build_id, section_ranges, elf_overhead_size @@ -1659,10 +1648,6 @@ help='Regular expression for which containers to create') group = parser.add_argument_group(title='Analysis Options for Native Code') - if is_top_args: - group.add_argument( - '--tool-prefix', - help='Path prefix for binaries such as nm, readelf, objdump') group.add_argument('--no-string-literals', dest='track_string_literals', default=True, @@ -1805,7 +1790,7 @@ return sub_args_list -def _MakeNativeSpec(tentative_output_dir, json_config, **kwargs): +def _MakeNativeSpec(json_config, **kwargs): native_spec = NativeSpec(**kwargs) if native_spec.elf_path or native_spec.map_path: basename = os.path.basename(native_spec.elf_path or native_spec.map_path) @@ -1821,16 +1806,11 @@ return native_spec native_spec.linker_name = _DetectLinkerName(native_spec.map_path) - tool_prefix_finder = path_util.ToolPrefixFinder( - value=native_spec.tool_prefix, - output_directory=tentative_output_dir, - linker_name=native_spec.linker_name) - native_spec.tool_prefix = tool_prefix_finder.Finalized() return native_spec -def _DeduceMapPath(elf_path, tool_prefix): - if _ElfIsMainPartition(elf_path, tool_prefix): +def _DeduceMapPath(elf_path): + if _ElfIsMainPartition(elf_path): map_path = elf_path.replace('.so', '__combined.so') + '.map' else: map_path = elf_path + '.map' @@ -1846,24 +1826,22 @@ def _CreateNativeSpecs(*, tentative_output_dir, apk_infolist, elf_path, map_path, abi_filters, auto_abi_filters, - track_string_literals, ignore_linker_map, tool_prefix, - json_config, on_config_error): + track_string_literals, ignore_linker_map, json_config, + on_config_error): if ignore_linker_map: map_path = None elif (map_path and not map_path.endswith('.map') and not map_path.endswith('.map.gz')): on_config_error('Expected --map-file to end with .map or .map.gz') elif elf_path and not map_path: - map_path = _DeduceMapPath(elf_path, tool_prefix) + map_path = _DeduceMapPath(elf_path) ret = [] # if --elf-path or --map-path (rather than --aux-elf-path, --aux-map-path): if not apk_infolist: if map_path or elf_path: ret.append( - _MakeNativeSpec(tentative_output_dir, - json_config, - tool_prefix=tool_prefix, + _MakeNativeSpec(json_config, apk_so_path=None, map_path=map_path, elf_path=elf_path, @@ -1911,7 +1889,7 @@ cur_map_path = map_path map_path = None elif cur_elf_path and not ignore_linker_map: - cur_map_path = _DeduceMapPath(cur_elf_path, tool_prefix) + cur_map_path = _DeduceMapPath(cur_elf_path) if auto_abi_filters: abi_filters = [posixpath.basename(posixpath.dirname(apk_so_path))] @@ -1919,9 +1897,7 @@ auto_abi_filters = False ret.append( - _MakeNativeSpec(tentative_output_dir, - json_config, - tool_prefix=tool_prefix, + _MakeNativeSpec(json_config, apk_so_path=apk_so_path, map_path=cur_map_path, elf_path=cur_elf_path, @@ -2041,11 +2017,6 @@ apk_pak_paths=apk_pak_paths) if analyze_native: - tool_prefix_finder = path_util.ToolPrefixFinder( - value=top_args.tool_prefix, - output_directory=top_args.output_directory, - linker_name='lld') - # Allow top-level --abi-filter to override values set in .ssargs. abi_filters = top_args.abi_filters or sub_args.abi_filters aux_elf_file = sub_args.aux_elf_file @@ -2066,7 +2037,6 @@ and sub_args.track_string_literals), ignore_linker_map=(top_args.ignore_linker_map or sub_args.ignore_linker_map), - tool_prefix=tool_prefix_finder.Finalized(), json_config=json_config, on_config_error=on_config_error) @@ -2171,6 +2141,8 @@ def Run(top_args, on_config_error): + path_util.CheckLlvmToolsAvailable() + if not top_args.size_file.endswith('.size'): on_config_error('size_file must end with .size') if top_args.check_data_quality:
diff --git a/tools/binary_size/libsupersize/bcanalyzer.py b/tools/binary_size/libsupersize/bcanalyzer.py index 8473059..fa7c4df6 100755 --- a/tools/binary_size/libsupersize/bcanalyzer.py +++ b/tools/binary_size/libsupersize/bcanalyzer.py
@@ -327,9 +327,11 @@ class _BcAnalyzerRunner: """Helper to run bcanalyzer and extract output lines. """ - def __init__(self, tool_prefix, output_directory): - self._args = [path_util.GetBcAnalyzerPath(tool_prefix), '--dump', - '--disable-histogram'] + + def __init__(self, output_directory): + self._args = [ + path_util.GetBcAnalyzerPath(), '--dump', '--disable-histogram' + ] self._output_directory = output_directory def RunOnFile(self, obj_file): @@ -339,14 +341,14 @@ # This is a target for BulkForkAndCall(). -def RunBcAnalyzerOnIntermediates(target, tool_prefix, output_directory): +def RunBcAnalyzerOnIntermediates(target, output_directory): """Calls bcanalyzer and returns encoded map from path to strings. Args: target: A list of BC file paths. """ assert isinstance(target, list) - runner = _BcAnalyzerRunner(tool_prefix, output_directory) + runner = _BcAnalyzerRunner(output_directory) strings_by_path = {} for t in target: strings_by_path[t] = [s for _, s in _ParseBcAnalyzer(runner.RunOnFile(t))] @@ -357,14 +359,13 @@ def main(): parser = argparse.ArgumentParser() - parser.add_argument('--tool-prefix', required=True) parser.add_argument('--output-directory', default='.') parser.add_argument('--char-width-limit', type=int) parser.add_argument('objects', type=os.path.realpath, nargs='+') args = parser.parse_args() base_path = os.path.normpath(args.output_directory) - runner = _BcAnalyzerRunner(args.tool_prefix, args.output_directory) + runner = _BcAnalyzerRunner(args.output_directory) if args.char_width_limit is not None: global _CHAR_WIDTH_LIMIT _CHAR_WIDTH_LIMIT = args.char_width_limit
diff --git a/tools/binary_size/libsupersize/bcanalyzer_test.py b/tools/binary_size/libsupersize/bcanalyzer_test.py index ab46476..37a26bf 100755 --- a/tools/binary_size/libsupersize/bcanalyzer_test.py +++ b/tools/binary_size/libsupersize/bcanalyzer_test.py
@@ -10,14 +10,7 @@ import bcanalyzer import parallel - - -_SCRIPT_DIR = os.path.dirname(__file__) -_TEST_DATA_DIR = os.path.join(_SCRIPT_DIR, 'testdata') -_TEST_SOURCE_DIR = os.path.join(_TEST_DATA_DIR, 'mock_source_directory') -_TEST_OUTPUT_DIR = os.path.join(_TEST_SOURCE_DIR, 'out', 'Release') -_TEST_TOOL_PREFIX = os.path.join( - os.path.abspath(_TEST_DATA_DIR), 'mock_toolchain', 'llvm-') +import test_util def _MakeBytes(bits, toks): @@ -104,8 +97,10 @@ # Tweak global param in bcanalyzer. bcanalyzer._CHAR_WIDTH_LIMIT = width_limit - encoded_results = bcanalyzer.RunBcAnalyzerOnIntermediates( - ['test.o'], _TEST_TOOL_PREFIX, _TEST_OUTPUT_DIR) + with test_util.AddMocksToPath(): + encoded_results = bcanalyzer.RunBcAnalyzerOnIntermediates( + ['test.o'], test_util.TEST_OUTPUT_DIR) + results = parallel.DecodeDictOfLists( encoded_results, value_transform=ast.literal_eval) self.assertEqual(['test.o'], list(results.keys()))
diff --git a/tools/binary_size/libsupersize/console.py b/tools/binary_size/libsupersize/console.py index 72eae61..28c9b724 100644 --- a/tools/binary_size/libsupersize/console.py +++ b/tools/binary_size/libsupersize/console.py
@@ -83,7 +83,7 @@ class _Session: - def __init__(self, size_infos, output_directory_finder, tool_prefix_finder): + def __init__(self, size_infos, output_directory_finder): self._printed_variables = [] self._variables = { 'Print': self._PrintFunc, @@ -103,7 +103,6 @@ 'models': models, } self._output_directory_finder = output_directory_finder - self._tool_prefix_finder = tool_prefix_finder self._size_infos = size_infos if len(size_infos) == 1: @@ -139,12 +138,11 @@ return [] size_info = self._SizeInfoForSymbol(first_sym) container = first_sym.container - tool_prefix = self._ToolPrefixForSymbol(size_info) - elf_path = self._ElfPathForSymbol(size_info, container, tool_prefix, - elf_path) + elf_path = self._ElfPathForSymbol(size_info, container, elf_path) - return string_extract.ReadStringLiterals( - thing, elf_path, tool_prefix, all_rodata=all_rodata) + return string_extract.ReadStringLiterals(thing, + elf_path, + all_rodata=all_rodata) def _DiffFunc(self, before=None, after=None, sort=True): """Diffs two SizeInfo objects. Returns a DeltaSizeInfo. @@ -267,25 +265,9 @@ format_name='csv') _WriteToStream(lines, use_pager=use_pager, to_file=to_file) - def _ToolPrefixForSymbol(self, size_info): - tool_prefix = self._tool_prefix_finder.Tentative() - orig_tool_prefix = size_info.build_config.get( - models.BUILD_CONFIG_TOOL_PREFIX) - if orig_tool_prefix: - orig_tool_prefix = path_util.FromToolsSrcRootRelative(orig_tool_prefix) - if os.path.exists(path_util.GetObjDumpPath(orig_tool_prefix)): - tool_prefix = orig_tool_prefix - - # TODO(agrieve): Would be even better to use objdump --info to check that - # the toolchain is for the correct architecture. - assert tool_prefix is not None, ( - 'Could not determine --tool-prefix. Possible fixes include setting ' - '--tool-prefix, or setting --output-directory') - return tool_prefix - - def _ElfPathForSymbol(self, size_info, container, tool_prefix, elf_path=None): + def _ElfPathForSymbol(self, size_info, container, elf_path=None): def build_id_matches(elf_path): - found_build_id = readelf.BuildIdFromElf(elf_path, tool_prefix) + found_build_id = readelf.BuildIdFromElf(elf_path) expected_build_id = container.metadata.get(models.METADATA_ELF_BUILD_ID) return found_build_id == expected_build_id @@ -347,9 +329,7 @@ 'passing .before_symbol or .after_symbol.') size_info = self._SizeInfoForSymbol(symbol) container = symbol.container - tool_prefix = self._ToolPrefixForSymbol(size_info) - elf_path = self._ElfPathForSymbol(size_info, container, tool_prefix, - elf_path) + elf_path = self._ElfPathForSymbol(size_info, container, elf_path) # Always use Android NDK's objdump because llvm-objdump does not print # the target of jump instructions, which is really useful. output_directory_finder = self._output_directory_finder @@ -357,34 +337,20 @@ output_directory_finder = path_util.OutputDirectoryFinder( any_path_within_output_directory=elf_path) if output_directory_finder.Tentative(): - tool_prefix = path_util.ToolPrefixFinder( - output_directory=output_directory_finder.Finalized(), - linker_name='ld').Finalized() # Running objdump from an output directory means that objdump can # interleave source file lines in the disassembly. objdump_pwd = output_directory_finder.Finalized() else: - # Output directory is not set, so we cannot load tool_prefix from - # build_vars.json, nor resolve the output directory-relative path stored - # size_info.metadata. - is_android = next( - filter(None, (m.get(models.METADATA_APK_FILENAME) - for m in size_info.metadata)), None) - arch = next( - filter(None, (m.get(models.METADATA_ELF_ARCHITECTURE) - for m in size_info.metadata)), None) - # Hardcode path for arm32. - if is_android and arch == 'arm': - tool_prefix = path_util.ANDROID_ARM_NDK_TOOL_PREFIX # If we do not know/guess the output directory, run from any directory 2 # levels below src since it is better than a random cwd (because usually # source file paths are relative to an output directory two levels below # src and start with ../../). - objdump_pwd = os.path.join(path_util.TOOLS_SRC_ROOT, 'tools', - 'binary_size') + objdump_pwd = path_util.FromToolsSrcRoot('tools', 'binary_size') + arch = readelf.ArchFromElf(elf_path) + objdump_path = path_util.GetDisassembleObjDumpPath(arch) args = [ - os.path.relpath(path_util.GetObjDumpPath(tool_prefix), objdump_pwd), + os.path.relpath(objdump_path, objdump_pwd), '--disassemble', '--source', '--line-numbers', @@ -417,7 +383,6 @@ A new SizeInfo. """ size_info = size_info or self._size_infos[0] - tool_prefix = self._ToolPrefixForSymbol(size_info) new_syms = [] new_containers = [] @@ -433,9 +398,8 @@ new_containers.append(container) - elf_path = self._ElfPathForSymbol(size_info, container, tool_prefix) - relro_addresses = readelf.CollectRelocationAddresses( - elf_path, tool_prefix) + elf_path = self._ElfPathForSymbol(size_info, container) + relro_addresses = readelf.CollectRelocationAddresses(elf_path) # More likely for there to be a bug in supersize than an ELF to have any # relative relocations. @@ -579,9 +543,6 @@ parser.add_argument('--query', help='Execute the given snippet. ' 'Example: Print(size_info)') - parser.add_argument('--tool-prefix', - help='Path prefix for objdump. Required only for ' - 'Disassemble().') parser.add_argument('--output-directory', help='Path to the root build directory. Used only for ' 'Disassemble().') @@ -602,12 +563,7 @@ output_directory_finder = path_util.OutputDirectoryFinder( value=args.output_directory, any_path_within_output_directory=args.inputs[0]) - linker_name = size_infos[-1].build_config.get(models.BUILD_CONFIG_LINKER_NAME) - tool_prefix_finder = path_util.ToolPrefixFinder( - value=args.tool_prefix, - output_directory=output_directory_finder.Tentative(), - linker_name=linker_name) - session = _Session(size_infos, output_directory_finder, tool_prefix_finder) + session = _Session(size_infos, output_directory_finder) if args.query: logging.info('Running query from command-line.')
diff --git a/tools/binary_size/libsupersize/demangle.py b/tools/binary_size/libsupersize/demangle.py index 7476da1..39aa53b 100644 --- a/tools/binary_size/libsupersize/demangle.py +++ b/tools/binary_size/libsupersize/demangle.py
@@ -51,7 +51,7 @@ name = name[pos:] # Some mangled symbols end with '$' followed by 32 lower-case hex digits, - # and possibly '.cfi'. These interfere with demangling by c++filt, and + # and possibly '.cfi'. These interfere with demangling by cxxfilt, and # should be stripped. if name.endswith('.cfi'): name = name[:-4] @@ -68,10 +68,10 @@ return new_name -def _DemangleNames(names, tool_prefix): - """Uses c++filt to demangle a list of names.""" +def _DemangleNames(names): + """Uses cxxfilt to demangle a list of names.""" # pylint: disable=unexpected-keyword-arg - proc = subprocess.Popen([path_util.GetCppFiltPath(tool_prefix)], + proc = subprocess.Popen([path_util.GetCppFiltPath()], stdin=subprocess.PIPE, stdout=subprocess.PIPE, encoding='utf-8') @@ -89,19 +89,19 @@ return ret -def DemangleRemainingSymbols(raw_symbols, tool_prefix): +def DemangleRemainingSymbols(raw_symbols): """Demangles any symbols that need it.""" to_process = [s for s in raw_symbols if _CanDemangle(s.full_name)] if not to_process: return logging.info('Demangling %d symbols', len(to_process)) - names = _DemangleNames([s.full_name for s in to_process], tool_prefix) + names = _DemangleNames([s.full_name for s in to_process]) for i, name in enumerate(names): to_process[i].full_name = name -def DemangleSetsInDictsInPlace(key_to_names, tool_prefix): +def DemangleSetsInDictsInPlace(key_to_names): """Demangles values as sets. |key_to_names| is a dict from key to sets (or lists) of mangled names. @@ -113,7 +113,7 @@ return key_to_names logging.info('Demangling %d values', len(all_names)) - it = iter(_DemangleNames(all_names, tool_prefix)) + it = iter(_DemangleNames(all_names)) for key, names in key_to_names.items(): key_to_names[key] = set(next(it) if _CanDemangle(n) else n for n in names) assert(next(it, None) is None) @@ -121,7 +121,7 @@ return None -def DemangleKeysAndMergeLists(name_to_list, tool_prefix): +def DemangleKeysAndMergeLists(name_to_list): """Demangles keys of a dict of lists, and returns the result. Keys may demangle to a common name. When this happens, the corresponding lists @@ -132,7 +132,7 @@ return name_to_list logging.info('Demangling %d keys', len(keys)) - key_iter = iter(_DemangleNames(keys, tool_prefix)) + key_iter = iter(_DemangleNames(keys)) ret = collections.defaultdict(list) for key, val in name_to_list.items(): ret[next(key_iter) if _CanDemangle(key) else key] += val
diff --git a/tools/binary_size/libsupersize/diff.py b/tools/binary_size/libsupersize/diff.py index 2297e5d7..62288634 100644 --- a/tools/binary_size/libsupersize/diff.py +++ b/tools/binary_size/libsupersize/diff.py
@@ -1,7 +1,7 @@ # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -"""Logic for diffing two SizeInfo objects.""" +"""Logic for diffing two SizeInfo objects. See: ./docs/diffs.md""" import collections import itertools @@ -149,7 +149,10 @@ def Diff(before, after, sort=False): - """Diffs two SizeInfo objects. Returns a DeltaSizeInfo.""" + """Diffs two SizeInfo objects. Returns a DeltaSizeInfo. + + See docs/diffs.md for diffing algorithm. + """ assert isinstance(before, models.SizeInfo) assert isinstance(after, models.SizeInfo) containers_diff = _DiffContainerLists(before.containers, after.containers)
diff --git a/tools/binary_size/libsupersize/docs/data_model.md b/tools/binary_size/libsupersize/docs/data_model.md index 36c4af66..4cedd898 100644 --- a/tools/binary_size/libsupersize/docs/data_model.md +++ b/tools/binary_size/libsupersize/docs/data_model.md
@@ -57,6 +57,7 @@ Diffs are represented in Python using `DeltaSizeInfo`, which contains a list of `DeltaSymbol` instances. `DeltaSymbols` maintain the full fidelity of symbols in the diff by storing a pointer to the before / after symbol that they represent. +See [diffs.md](diffs.md) for more details. ## Concepts
diff --git a/tools/binary_size/libsupersize/docs/diffs.md b/tools/binary_size/libsupersize/docs/diffs.md new file mode 100644 index 0000000..4aa76d7 --- /dev/null +++ b/tools/binary_size/libsupersize/docs/diffs.md
@@ -0,0 +1,47 @@ +# SuperSize Diffs + +Diffs are represented by a `DeltaSizeInfo`, where each `DeltaSymbol` contains a +reference to a `before` and `after` symbol. + +For new symbols, `before` is None, and for removed symbols, `after` is None. + +## Diff Algorithm + +The diffing algorithm is optimized for the common case of many unchanged +symbols. + +1. Create a map of `$DIFF_KEY` -> `symbol` for all "before" symbols. +2. For all "after" symbols, find matches using the map. +3. Repeat steps 1 and 2 for all remaining symbols using different `$DIFF_KEYs` +4. Treat all unmatches symbols as added or removed. + +`DeltaSymbols` for symbols that have not changed are created when diffing, but +discarded when writing `.sizediff` files (see [file_format.md](file_format.md)). + +The `$DIFF_KEYs` are: + +1. `DIFF_KEY=(container, section, full_name, path, s.size_without_padding)` + * Ensures identical symbols are matched. +2. `DIFF_KEY=(container, section, full_name, path)` + * Ensures identical symbols that have changed in size are matched. +3. `DIFF_KEY=(container, section, name, path)` + * Match up symbols with the same name, but differing function signatures. +4. `DIFF_KEY=(container, section, full_name)` + * Match symbols that have changed paths. + * Does not often match moved Java files, since package names tend to change. + +## Diffs and Padding + +Since symbol padding tends to fluctuate from build to build, changes to padding +is not considered. Padding is removed from all symbols when diffing and +per-section cumulative change in padding is shown by a symbol called +`Overhead: aggregate padding of diff'ed symbol`. + +## Diffs and Aliases + +No special treatment is made for symbols aliases. If the number of symbols in an +alias group changes, a diff will show a size change for all symbols in the +group. In the past there was an attempt to have diffs exclude showing changes to +the number of aliases in a group, but it never worked reliably and added a lot +of complexity. E.g., A symbol from one alias group changes to belong to a +different alias group.
diff --git a/tools/binary_size/libsupersize/dwarfdump.py b/tools/binary_size/libsupersize/dwarfdump.py index 1e9c75aa..37c7ddf 100755 --- a/tools/binary_size/libsupersize/dwarfdump.py +++ b/tools/binary_size/libsupersize/dwarfdump.py
@@ -62,9 +62,9 @@ return self._unmatched_queries_count / self._total_queries_count -def CreateAddressSourceMapper(elf_path, tool_prefix): +def CreateAddressSourceMapper(elf_path): """Runs dwarfdump. Returns object for querying source path given address.""" - return _SourceMapper(_Parse(elf_path, tool_prefix)) + return _SourceMapper(_Parse(elf_path)) def CreateAddressSourceMapperForTest(lines): @@ -75,9 +75,9 @@ return _ParseDumpOutput(lines) -def _Parse(elf_path, tool_prefix): +def _Parse(elf_path): cmd = [ - path_util.GetDwarfdumpPath(tool_prefix), + path_util.GetDwarfdumpPath(), elf_path, '--debug-info', '--recurse-depth=0',
diff --git a/tools/binary_size/libsupersize/integration_test.py b/tools/binary_size/libsupersize/integration_test.py index 97ed9dbda..6ff07fb 100755 --- a/tools/binary_size/libsupersize/integration_test.py +++ b/tools/binary_size/libsupersize/integration_test.py
@@ -3,7 +3,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import contextlib import copy import glob import io @@ -28,12 +27,9 @@ _SCRIPT_DIR = os.path.dirname(__file__) -_TEST_DATA_DIR = os.path.join(_SCRIPT_DIR, 'testdata') -_TEST_SDK_DIR = os.path.join(_TEST_DATA_DIR, 'mock_sdk') -_TEST_SOURCE_DIR = os.path.join(_TEST_DATA_DIR, 'mock_source_directory') -_TEST_OUTPUT_DIR = os.path.join(_TEST_SOURCE_DIR, 'out', 'Release') -_TEST_TOOL_PREFIX = os.path.join( - os.path.abspath(_TEST_DATA_DIR), 'mock_toolchain', '') +_TEST_DATA_DIR = test_util.TEST_DATA_DIR +_TEST_SOURCE_DIR = test_util.TEST_SOURCE_DIR +_TEST_OUTPUT_DIR = test_util.TEST_OUTPUT_DIR _TEST_APK_ROOT_DIR = os.path.join(_TEST_DATA_DIR, 'mock_apk') _TEST_MAP_PATH = os.path.join(_TEST_DATA_DIR, 'test.map') _TEST_PAK_INFO_PATH = os.path.join( @@ -90,25 +86,10 @@ return real_decorator -@contextlib.contextmanager -def _AddMocksToPath(): - prev_path = os.environ['PATH'] - os.environ['PATH'] = _TEST_TOOL_PREFIX[:-1] + os.path.pathsep + prev_path - os.environ['APK_ANALYZER'] = os.path.join(_TEST_SDK_DIR, 'tools', 'bin', - 'apkanalyzer') - os.environ['AAPT2'] = os.path.join(_TEST_SDK_DIR, 'tools', 'bin', 'aapt2') - try: - yield - finally: - os.environ['PATH'] = prev_path - del os.environ['APK_ANALYZER'] - del os.environ['AAPT2'] - - def _RunApp(name, args, debug_measures=False): argv = [os.path.join(_SCRIPT_DIR, 'main.py'), name] argv.extend(args) - with _AddMocksToPath(): + with test_util.AddMocksToPath(): env = None if debug_measures: env = os.environ.copy() @@ -222,7 +203,7 @@ _TEST_APK_LOCALE_PAK_SUBPATH, _TEST_APK_PAK_SUBPATH ] - native_spec = archive.NativeSpec(tool_prefix=_TEST_TOOL_PREFIX) + native_spec = archive.NativeSpec() # TODO(crbug.com/1193507): Remove when we implement string literal # tracking without map files. @@ -280,7 +261,7 @@ raw_symbols_list = [] build_config = {} - with _AddMocksToPath(): + with test_util.AddMocksToPath(): pak_id_map = pakfile.PakIdMap() for container_name, apk_spec, pak_spec, native_spec in iter_specs(): metadata = archive.CreateMetadata(build_config=build_config, @@ -322,8 +303,6 @@ archive_path, '--source-directory', _TEST_SOURCE_DIR, - '--tool-prefix', - _TEST_TOOL_PREFIX, '--json-config', _TEST_CONFIG_JSON, ]
diff --git a/tools/binary_size/libsupersize/main.py b/tools/binary_size/libsupersize/main.py index 34e2486..f6d22368 100755 --- a/tools/binary_size/libsupersize/main.py +++ b/tools/binary_size/libsupersize/main.py
@@ -43,7 +43,6 @@ @staticmethod def Run(args, on_config_error): args.output_directory = None - args.tool_prefix = None args.inputs = [args.before, args.after] args.query = '\n'.join([ 'd = Diff()',
diff --git a/tools/binary_size/libsupersize/models.py b/tools/binary_size/libsupersize/models.py index 65476172..26f8d7d3 100644 --- a/tools/binary_size/libsupersize/models.py +++ b/tools/binary_size/libsupersize/models.py
@@ -18,13 +18,11 @@ BUILD_CONFIG_GIT_REVISION = 'git_revision' BUILD_CONFIG_GN_ARGS = 'gn_args' BUILD_CONFIG_LINKER_NAME = 'linker_name' -BUILD_CONFIG_TOOL_PREFIX = 'tool_prefix' # Path relative to SRC_ROOT. BUILD_CONFIG_KEYS = ( BUILD_CONFIG_GIT_REVISION, BUILD_CONFIG_GN_ARGS, BUILD_CONFIG_LINKER_NAME, - BUILD_CONFIG_TOOL_PREFIX, ) METADATA_APK_FILENAME = 'apk_file_name' # Path relative to output_directory. @@ -34,7 +32,7 @@ METADATA_SIGNING_BLOCK_SIZE = 'apk_signature_block_size' # Size in bytes. METADATA_MAP_FILENAME = 'map_file_name' # Path relative to output_directory. METADATA_ELF_ALGORITHM = 'elf_algorithm' # linker_map / dwarf / sections. -METADATA_ELF_ARCHITECTURE = 'elf_arch' # "Machine" field from readelf -h +METADATA_ELF_ARCHITECTURE = 'elf_arch' # "arm", "arm64", "x86", or "x64". METADATA_ELF_FILENAME = 'elf_file_name' # Path relative to output_directory. METADATA_ELF_MTIME = 'elf_mtime' # int timestamp in utc. METADATA_ELF_BUILD_ID = 'elf_build_id'
diff --git a/tools/binary_size/libsupersize/nm.py b/tools/binary_size/libsupersize/nm.py index 693bdf76..ef0e723a 100755 --- a/tools/binary_size/libsupersize/nm.py +++ b/tools/binary_size/libsupersize/nm.py
@@ -81,7 +81,7 @@ return name not in ('CSWTCH', 'lock', '__compound_literal', 'table') -def CollectAliasesByAddress(elf_path, tool_prefix): +def CollectAliasesByAddress(elf_path): """Runs nm on |elf_path| and returns a dict of address->[names]""" # Constructors often show up twice, so use sets to ensure no duplicates. names_by_address = collections.defaultdict(set) @@ -101,8 +101,7 @@ # About 60mb of output, but piping takes ~30s, and loading it into RAM # directly takes 3s. - args = [path_util.GetNmPath(tool_prefix), '--no-sort', '--defined-only', - elf_path] + args = [path_util.GetNmPath(), '--no-sort', '--defined-only', elf_path] # pylint: disable=unexpected-keyword-arg proc = subprocess.Popen(args, stdout=subprocess.PIPE, @@ -138,7 +137,7 @@ names_by_address[address].add(name) # Demangle all names. - demangle.DemangleSetsInDictsInPlace(names_by_address, tool_prefix) + demangle.DemangleSetsInDictsInPlace(names_by_address) # Since this is run in a separate process, minimize data passing by returning # only aliased symbols. @@ -150,7 +149,7 @@ } -def CreateUniqueSymbols(elf_path, tool_prefix, section_ranges): +def CreateUniqueSymbols(elf_path, section_ranges): """Creates symbols from nm --print-size output. Creates only one symbol for each address (does not create symbol aliases). @@ -164,8 +163,8 @@ max_address = sum(section_ranges[-1][1]) args = [ - path_util.GetNmPath(tool_prefix), '--no-sort', '--defined-only', - '--print-size', elf_path + path_util.GetNmPath(), '--no-sort', '--defined-only', '--print-size', + elf_path ] # pylint: disable=unexpected-keyword-arg stdout = subprocess.check_output(args, @@ -292,19 +291,18 @@ return raw_symbols -def _CollectAliasesByAddressAsyncHelper(elf_path, tool_prefix): - result = CollectAliasesByAddress(elf_path, tool_prefix) +def _CollectAliasesByAddressAsyncHelper(elf_path): + result = CollectAliasesByAddress(elf_path) return parallel.EncodeDictOfLists(result, key_transform=str) -def CollectAliasesByAddressAsync(elf_path, tool_prefix): +def CollectAliasesByAddressAsync(elf_path): """Calls CollectAliasesByAddress in a helper process. Returns a Result.""" def decode(encoded): return parallel.DecodeDictOfLists(encoded, key_transform=int) - return parallel.ForkAndCall( - _CollectAliasesByAddressAsyncHelper, (elf_path, tool_prefix), - decode_func=decode) + return parallel.ForkAndCall(_CollectAliasesByAddressAsyncHelper, (elf_path, ), + decode_func=decode) def _ParseOneObjectFileNmOutput(lines): @@ -332,19 +330,18 @@ # This is a target for BulkForkAndCall(). -def RunNmOnIntermediates(target, tool_prefix, output_directory): +def RunNmOnIntermediates(target, output_directory): """Returns encoded_symbol_names_by_path, encoded_string_addresses_by_path. Args: target: Either a single path to a .a (as a string), or a list of .o paths. """ is_archive = isinstance(target, str) - args = [path_util.GetNmPath(tool_prefix), '--no-sort', '--defined-only'] + args = [path_util.GetNmPath(), '--no-sort', '--defined-only'] if is_archive: args.append(target) else: args.extend(target) - # pylint: disable=unexpected-keyword-arg proc = subprocess.Popen( args, cwd=output_directory, @@ -392,7 +389,6 @@ def main(): parser = argparse.ArgumentParser() - parser.add_argument('--tool-prefix', required=True) parser.add_argument('--output-directory', required=True) parser.add_argument('elf_path', type=os.path.realpath) @@ -401,8 +397,8 @@ format='%(levelname).1s %(relativeCreated)6d %(message)s') # Other functions in this file have test entrypoints in object_analyzer.py. - section_ranges = readelf.SectionInfoFromElf(args.elf_path, args.tool_prefix) - symbols = CreateUniqueSymbols(args.elf_path, args.tool_prefix, section_ranges) + section_ranges = readelf.SectionInfoFromElf(args.elf_path) + symbols = CreateUniqueSymbols(args.elf_path, section_ranges) for s in symbols: print(s) logging.warning('Printed %d symbols', len(symbols))
diff --git a/tools/binary_size/libsupersize/obj_analyzer.py b/tools/binary_size/libsupersize/obj_analyzer.py index a9cd1d6..e83576f 100755 --- a/tools/binary_size/libsupersize/obj_analyzer.py +++ b/tools/binary_size/libsupersize/obj_analyzer.py
@@ -70,15 +70,6 @@ return (int(x[:sep_idx]), int(x[sep_idx + 1:])) -def _MakeToolPrefixAbsolute(tool_prefix): - # Ensure tool_prefix is absolute so that CWD does not affect it - if os.path.sep in tool_prefix: - # Use abspath() on the dirname to avoid it stripping a trailing /. - dirname = os.path.dirname(tool_prefix) - tool_prefix = os.path.abspath(dirname) + tool_prefix[len(dirname):] - return tool_prefix - - class _PathsByType: def __init__(self, arch, obj, bc): self.arch = arch @@ -87,8 +78,7 @@ class _BulkObjectFileAnalyzerWorker: - def __init__(self, tool_prefix, output_directory, track_string_literals=True): - self._tool_prefix = _MakeToolPrefixAbsolute(tool_prefix) + def __init__(self, output_directory, track_string_literals=True): self._output_directory = output_directory self._track_string_literals = track_string_literals self._list_of_encoded_elf_string_ranges_by_path = None @@ -131,7 +121,6 @@ return parallel.BulkForkAndCall( runner, batches, - tool_prefix=self._tool_prefix, output_directory=self._output_directory) def _RunNm(self, paths_by_type): @@ -183,15 +172,14 @@ def SortPaths(self): # Demangle all names, which can result in some merging of lists. self._paths_by_name = demangle.DemangleKeysAndMergeLists( - self._paths_by_name, self._tool_prefix) + self._paths_by_name) # Sort and uniquefy. for key in self._paths_by_name.keys(): self._paths_by_name[key] = sorted(set(self._paths_by_name[key])) def _ReadElfStringData(self, elf_path, elf_string_ranges): # Read string_data from elf_path, to be shared with forked processes. - address, offset, _ = string_extract.LookupElfRodataInfo( - elf_path, self._tool_prefix) + address, offset, _ = string_extract.LookupElfRodataInfo(elf_path) adjust = address - offset abs_elf_string_ranges = ( (addr - adjust, s) for addr, s in elf_string_ranges) @@ -206,7 +194,6 @@ string_extract.ResolveStringPiecesIndirect, params, string_data=string_data, - tool_prefix=self._tool_prefix, output_directory=self._output_directory) return list(results) @@ -264,8 +251,8 @@ class _BulkObjectFileAnalyzerHost: """Runs BulkObjectFileAnalyzer in a subprocess.""" - def __init__(self, tool_prefix, output_directory, track_string_literals=True): - self._tool_prefix = tool_prefix + + def __init__(self, output_directory, track_string_literals=True): self._output_directory = output_directory self._track_string_literals = track_string_literals self._child_pid = None @@ -287,7 +274,7 @@ logging.root.handlers[0].setFormatter(logging.Formatter( 'obj_analyzer: %(levelname).1s %(relativeCreated)6d %(message)s')) worker_analyzer = _BulkObjectFileAnalyzerWorker( - self._tool_prefix, self._output_directory, + self._output_directory, track_string_literals=self._track_string_literals) delegate = _BulkObjectFileAnalyzerDelegate(worker_analyzer, child_conn) delegate.Run() @@ -412,7 +399,6 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('--multiprocess', action='store_true') - parser.add_argument('--tool-prefix', required=True) parser.add_argument('--output-directory', required=True) parser.add_argument('--elf-file', type=os.path.realpath) parser.add_argument('--show-names', action='store_true') @@ -424,12 +410,10 @@ format='%(levelname).1s %(relativeCreated)6d %(message)s') if args.multiprocess: - bulk_analyzer = _BulkObjectFileAnalyzerHost(args.tool_prefix, - args.output_directory) + bulk_analyzer = _BulkObjectFileAnalyzerHost(args.output_directory) else: parallel.DISABLE_ASYNC = True - bulk_analyzer = _BulkObjectFileAnalyzerWorker( - args.tool_prefix, args.output_directory) + bulk_analyzer = _BulkObjectFileAnalyzerWorker(args.output_directory) # Pass individually to test multiple calls. for path in args.objects: @@ -443,8 +427,7 @@ print('{}: {!r}'.format(name, paths)) if args.elf_file: - address, offset, size = string_extract.LookupElfRodataInfo( - args.elf_file, args.tool_prefix) + address, offset, size = string_extract.LookupElfRodataInfo(args.elf_file) bulk_analyzer.AnalyzeStringLiterals(args.elf_file, ((address, size),)) positions_by_path = bulk_analyzer.GetStringPositions()[0]
diff --git a/tools/binary_size/libsupersize/pakfile.py b/tools/binary_size/libsupersize/pakfile.py index 44e79fe..c486602 100644 --- a/tools/binary_size/libsupersize/pakfile.py +++ b/tools/binary_size/libsupersize/pakfile.py
@@ -14,7 +14,7 @@ import models import path_util -sys.path.insert(1, os.path.join(path_util.TOOLS_SRC_ROOT, 'tools', 'grit')) +sys.path.insert(1, path_util.FromToolsSrcRoot('tools', 'grit')) from grit.format import data_pack _UNCOMPRESSED_COMPRESSION_RATIO_THRESHOLD = 0.9
diff --git a/tools/binary_size/libsupersize/path_util.py b/tools/binary_size/libsupersize/path_util.py index b2d60ea..f003f4c 100644 --- a/tools/binary_size/libsupersize/path_util.py +++ b/tools/binary_size/libsupersize/path_util.py
@@ -2,11 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -"""Functions for dealing with determining --tool-prefix.""" +"""Functions for getting paths to things.""" import abc -import distutils.spawn -import json import logging import os @@ -15,18 +13,11 @@ # Src root of SuperSize being run. Not to be confused with src root of the input # binary being archived. -TOOLS_SRC_ROOT = os.environ.get( +_TOOLS_SRC_ROOT = os.environ.get( 'CHECKOUT_SOURCE_ROOT', os.path.abspath( - os.path.join( - os.path.dirname(__file__), os.pardir, os.pardir, os.pardir))) - -_SAMPLE_TOOL_SUFFIX = 'readelf' - -ANDROID_ARM_NDK_TOOL_PREFIX = os.path.join(TOOLS_SRC_ROOT, 'third_party', - 'android_ndk', 'toolchains', 'llvm', - 'prebuilt', 'linux-x86_64', 'bin', - 'arm-linux-androideabi-') + os.path.join(os.path.dirname(__file__), os.pardir, os.pardir, + os.pardir))) class _PathFinder: @@ -87,64 +78,6 @@ 'Use --no-output-directory to disable features that rely on it.'. format(self._value)) - -class ToolPrefixFinder(_PathFinder): - def __init__(self, value=None, output_directory=None, linker_name=None): - super().__init__(name='tool-prefix', value=value) - self._output_directory = output_directory - self._linker_name = linker_name; - - def IsLld(self): - return self._linker_name.startswith('lld') if self._linker_name else True - - def Detect(self): - output_directory = self._output_directory - if output_directory: - ret = None - if self.IsLld(): - ret = os.path.join(TOOLS_SRC_ROOT, 'third_party', 'llvm-build', - 'Release+Asserts', 'bin', 'llvm-') - else: - # Auto-detect from build_vars.json - build_vars = _LoadBuildVars(output_directory) - tool_prefix = build_vars.get('android_tool_prefix') - if tool_prefix: - ret = os.path.normpath(os.path.join(output_directory, tool_prefix)) - # Maintain a trailing '/' if needed. - if tool_prefix.endswith(os.path.sep): - ret += os.path.sep - if ret: - # Check for output directories that have a stale build_vars.json - if os.path.isfile(ret + _SAMPLE_TOOL_SUFFIX): - return ret - err_lines = ['tool-prefix not found: %s' % ret] - if ret.endswith('llvm-'): - err_lines.append('Probably need to run: ' - 'tools/clang/scripts/update.py --package=objdump') - raise Exception('\n'.join(err_lines)) - from_path = distutils.spawn.find_executable(_SAMPLE_TOOL_SUFFIX) - if from_path: - return from_path[:-7] - return None - - def Verify(self): - if os.path.sep not in self._value: - full_path = distutils.spawn.find_executable( - self._value + _SAMPLE_TOOL_SUFFIX) - else: - full_path = self._value + _SAMPLE_TOOL_SUFFIX - if not full_path or not os.path.isfile(full_path): - raise Exception('Bad --%s. Path not found: %s' % (self._name, full_path)) - - -def _LoadBuildVars(output_directory): - build_vars_path = os.path.join(output_directory, 'build_vars.json') - if os.path.exists(build_vars_path): - with open(build_vars_path) as f: - return json.load(f) - return {} - - def GetSrcRootFromOutputDirectory(output_directory): """Returns the source root directory from output directory. @@ -168,80 +101,102 @@ break logging.warning('Cannot deduce src root from output directory. Falling back ' 'to tools src root.') - return TOOLS_SRC_ROOT + return _TOOLS_SRC_ROOT -def FromToolsSrcRootRelative(path): - ret = os.path.relpath(os.path.join(TOOLS_SRC_ROOT, path)) +def FromToolsSrcRoot(*args): + ret = os.path.relpath(os.path.join(_TOOLS_SRC_ROOT, *args)) # Need to maintain a trailing /. - if path.endswith(os.path.sep): + if args[-1].endswith(os.path.sep): ret += os.path.sep return ret -def ToToolsSrcRootRelative(path): - ret = os.path.relpath(path, TOOLS_SRC_ROOT) - # Need to maintain a trailing /. - if path.endswith(os.path.sep): - ret += os.path.sep - return ret +def _LlvmTool(name): + default = FromToolsSrcRoot('third_party', 'llvm-build', 'Release+Asserts', + 'bin', 'llvm-') + actual = os.environ.get('SUPERSIZE_TOOL_PREFIX', default) + # abspath since some executions use cwd= argument. + return os.path.abspath(actual + name) -def GetCppFiltPath(tool_prefix): - if tool_prefix[-5:] == 'llvm-': - return tool_prefix + 'cxxfilt' - return tool_prefix + 'c++filt' +def CheckLlvmToolsAvailable(): + test_path = _LlvmTool('objdump') + if not os.path.isfile(test_path): + raise Exception( + ('File not found: {}\nProbably need to run: ' + 'tools/clang/scripts/update.py --package=objdump').format(test_path)) -def GetDwarfdumpPath(tool_prefix): - return tool_prefix + 'dwarfdump' +def GetCppFiltPath(): + return _LlvmTool('cxxfilt') -def GetStripPath(tool_prefix): +def GetDwarfdumpPath(): + return _LlvmTool('dwarfdump') + + +def GetNmPath(): + return _LlvmTool('nm') + + +def GetReadElfPath(): + return _LlvmTool('readelf') + + +def GetBcAnalyzerPath(): + return _LlvmTool('bcanalyzer') + + +def GetObjDumpPath(): + return _LlvmTool('objdump') + + +def GetDisassembleObjDumpPath(arch): + path = None + if arch == 'arm': + path = FromToolsSrcRoot('third_party', 'android_ndk', 'toolchains', + 'arm-linux-androideabi-4.9', 'prebuilt', + 'linux-x86_64', 'bin', + 'arm-linux-androideabi-objdump') + elif arch == 'arm64': + path = FromToolsSrcRoot('third_party', 'android_ndk', 'toolchains', + 'aarch64-linux-android-4.9', 'prebuilt', + 'linux-x86_64', 'bin', + 'aarch64-linux-android-objdump') + if path and os.path.exists(path): + return path + + logging.warning('Falling back to llvm-objdump for arch %s', arch) + return GetObjDumpPath() + + +def GetStripPath(): # Chromium's toolchain uses //buildtools/third_party/eu-strip, but first # look for the test-only "fakestrip" for the sake of tests. - fake_strip = tool_prefix + 'fakestrip' + fake_strip = _LlvmTool('fakestrip') if os.path.exists(fake_strip): return fake_strip - return FromToolsSrcRootRelative( - os.path.join('buildtools', 'third_party', 'eu-strip', 'bin', 'eu-strip')) - - -def GetNmPath(tool_prefix): - return tool_prefix + 'nm' + return FromToolsSrcRoot('buildtools', 'third_party', 'eu-strip', 'bin', + 'eu-strip') def GetApkAnalyzerPath(): - default_path = FromToolsSrcRootRelative( - os.path.join('third_party', 'android_sdk', 'public', 'cmdline-tools', - 'latest', 'bin', 'apkanalyzer')) - return os.environ.get('APK_ANALYZER', default_path) + default_path = FromToolsSrcRoot('third_party', 'android_sdk', 'public', + 'cmdline-tools', 'latest', 'bin', + 'apkanalyzer') + return os.environ.get('SUPERSIZE_APK_ANALYZER', default_path) def GetAapt2Path(): - default_path = FromToolsSrcRootRelative( - os.path.join('third_party', 'android_build_tools', 'aapt2', 'aapt2')) - return os.environ.get('AAPT2', default_path) + default_path = FromToolsSrcRoot('third_party', 'android_build_tools', 'aapt2', + 'aapt2') + return os.environ.get('SUPERSIZE_AAPT2', default_path) def GetJavaHome(): - return FromToolsSrcRootRelative(os.path.join('third_party', 'jdk', 'current')) - - -def GetObjDumpPath(tool_prefix): - return tool_prefix + 'objdump' - - -def GetReadElfPath(tool_prefix): - return tool_prefix + 'readelf' - - -def GetBcAnalyzerPath(tool_prefix): - if tool_prefix[-5:] != 'llvm-': - raise ValueError('BC analyzer is only supported in LLVM.') - return tool_prefix + 'bcanalyzer' + return FromToolsSrcRoot('third_party', 'jdk', 'current') def GetDefaultJsonConfigPath(): - return FromToolsSrcRootRelative( - os.path.join('tools', 'binary_size', 'supersize.json')) + return FromToolsSrcRoot('tools', 'binary_size', 'supersize.json')
diff --git a/tools/binary_size/libsupersize/readelf.py b/tools/binary_size/libsupersize/readelf.py index ec1edf3..ec60449 100644 --- a/tools/binary_size/libsupersize/readelf.py +++ b/tools/binary_size/libsupersize/readelf.py
@@ -9,18 +9,18 @@ import path_util -def BuildIdFromElf(elf_path, tool_prefix): +def BuildIdFromElf(elf_path): """Returns the Build ID for the given binary.""" - args = [path_util.GetReadElfPath(tool_prefix), '-n', elf_path] + args = [path_util.GetReadElfPath(), '-n', elf_path] stdout = subprocess.check_output(args, encoding='ascii') match = re.search(r'Build ID: (\w+)', stdout) assert match, 'Build ID not found from running: ' + ' '.join(args) return match.group(1) -def ArchFromElf(elf_path, tool_prefix): +def ArchFromElf(elf_path): """Returns the GN architecture for the given binary.""" - args = [path_util.GetReadElfPath(tool_prefix), '-h', elf_path] + args = [path_util.GetReadElfPath(), '-h', elf_path] stdout = subprocess.check_output(args, encoding='ascii') machine = re.search('Machine:\s*(.+)', stdout).group(1) if machine == 'Intel 80386': @@ -34,13 +34,13 @@ return machine -def SectionInfoFromElf(elf_path, tool_prefix): +def SectionInfoFromElf(elf_path): """Finds the address and size of all ELF sections Returns: A dict of section_name->(start_address, size). """ - args = [path_util.GetReadElfPath(tool_prefix), '-S', '--wide', elf_path] + args = [path_util.GetReadElfPath(), '-S', '--wide', elf_path] stdout = subprocess.check_output(args, encoding='ascii') section_ranges = {} # Matches [ 2] .hash HASH 00000000006681f0 0001f0 003154 04 A 3 0 8 @@ -50,9 +50,9 @@ return section_ranges -def CollectRelocationAddresses(elf_path, tool_prefix): +def CollectRelocationAddresses(elf_path): """Returns the list of addresses that are targets for relative relocations.""" - cmd = [path_util.GetReadElfPath(tool_prefix), '--relocs', elf_path] + cmd = [path_util.GetReadElfPath(), '--relocs', elf_path] ret = subprocess.check_output(cmd, encoding='ascii').splitlines() # Grab first column from (sample output) '02de6d5c 00000017 R_ARM_RELATIVE' return [int(l.split(maxsplit=1)[0], 16) for l in ret if 'R_ARM_RELATIVE' in l]
diff --git a/tools/binary_size/libsupersize/string_extract.py b/tools/binary_size/libsupersize/string_extract.py index 819c3372..8f5f043 100644 --- a/tools/binary_size/libsupersize/string_extract.py +++ b/tools/binary_size/libsupersize/string_extract.py
@@ -44,9 +44,9 @@ import path_util -def LookupElfRodataInfo(elf_path, tool_prefix): +def LookupElfRodataInfo(elf_path): """Returns (address, offset, size) for the .rodata section.""" - args = [path_util.GetReadElfPath(tool_prefix), '-S', '--wide', elf_path] + args = [path_util.GetReadElfPath(), '-S', '--wide', elf_path] output = subprocess.check_output(args).decode('ascii') lines = output.splitlines() for line in lines: @@ -82,14 +82,14 @@ return None -def _LookupStringSectionPositions(target, tool_prefix, output_directory): +def _LookupStringSectionPositions(target, output_directory): """Returns a dict of object_path -> [(offset, size)...] of .rodata sections. Args: target: An archive path string (e.g., "foo.a") or a list of object paths. """ is_archive = isinstance(target, str) - args = [path_util.GetReadElfPath(tool_prefix), '-S', '--wide'] + args = [path_util.GetReadElfPath(), '-S', '--wide'] if is_archive: args.append(target) else: @@ -254,7 +254,7 @@ # This is a target for BulkForkAndCall(). def ResolveStringPiecesIndirect(encoded_string_addresses_by_path, string_data, - tool_prefix, output_directory): + output_directory): string_addresses_by_path = parallel.DecodeDictOfLists( encoded_string_addresses_by_path) # Assign |target| as archive path, or a list of object paths. @@ -265,7 +265,7 @@ # Run readelf to find location of .rodata within the .o files. section_positions_by_path = _LookupStringSectionPositions( - target, tool_prefix, output_directory) + target, output_directory) # Load the .rodata sections (from object files) as strings. string_sections_by_path = _ReadStringSections( target, output_directory, section_positions_by_path) @@ -295,7 +295,7 @@ return [parallel.EncodeDictOfLists(x) for x in ret] -def ReadStringLiterals(symbols, elf_path, tool_prefix, all_rodata=False): +def ReadStringLiterals(symbols, elf_path, all_rodata=False): """Returns an iterable of (symbol, string) for all string literal symbols. Args: @@ -304,7 +304,7 @@ all_rodata: Assume every symbol within .rodata that ends with a \0 is a string literal. """ - address, offset, _ = LookupElfRodataInfo(elf_path, tool_prefix) + address, offset, _ = LookupElfRodataInfo(elf_path) adjust = offset - address with open(elf_path, 'rb') as f: for symbol in symbols:
diff --git a/tools/binary_size/libsupersize/test_util.py b/tools/binary_size/libsupersize/test_util.py index b02c9787..94ec4f32 100644 --- a/tools/binary_size/libsupersize/test_util.py +++ b/tools/binary_size/libsupersize/test_util.py
@@ -2,12 +2,23 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import contextlib import difflib import logging +import os import describe +_SCRIPT_DIR = os.path.dirname(__file__) +TEST_DATA_DIR = os.path.join(_SCRIPT_DIR, 'testdata') +_MOCK_TOOL_PREFIX = os.path.join(os.path.abspath(TEST_DATA_DIR), + 'mock_toolchain', '') +_MOCK_SDK_DIR = os.path.join(TEST_DATA_DIR, 'mock_sdk') +TEST_SOURCE_DIR = os.path.join(TEST_DATA_DIR, 'mock_source_directory') +TEST_OUTPUT_DIR = os.path.join(TEST_SOURCE_DIR, 'out', 'Release') + + class Golden: """Utility to use or manage "Golden" test files.""" @@ -31,3 +42,21 @@ assert actual == expected, ( ('Did not match %s.\n' % golden_path) + ''.join( difflib.unified_diff(expected, actual, 'expected', 'actual'))) + + +@contextlib.contextmanager +def AddMocksToPath(): + prev_path = os.environ['PATH'] + os.environ['PATH'] = _MOCK_TOOL_PREFIX[:-1] + os.path.pathsep + prev_path + os.environ['SUPERSIZE_APK_ANALYZER'] = os.path.join(_MOCK_SDK_DIR, 'tools', + 'bin', 'apkanalyzer') + os.environ['SUPERSIZE_AAPT2'] = os.path.join(_MOCK_SDK_DIR, 'tools', 'bin', + 'aapt2') + os.environ['SUPERSIZE_TOOL_PREFIX'] = _MOCK_TOOL_PREFIX + try: + yield + finally: + del os.environ['SUPERSIZE_TOOL_PREFIX'] + del os.environ['SUPERSIZE_AAPT2'] + del os.environ['SUPERSIZE_APK_ANALYZER'] + os.environ['PATH'] = prev_path
diff --git a/tools/binary_size/libsupersize/testdata/Archive.golden b/tools/binary_size/libsupersize/testdata/Archive.golden index 045356c2..8e1a716 100644 --- a/tools/binary_size/libsupersize/testdata/Archive.golden +++ b/tools/binary_size/libsupersize/testdata/Archive.golden
@@ -2,7 +2,6 @@ git_revision=abc123 linker_name=gold map_file_name=test.map -tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Section .text: has 100.0% of 35982248 bytes accounted for from 17 symbols. 0 bytes are unaccounted for. * Padding accounts for 13808 bytes (0.0%) * 0 have source paths. Accounts for 0 bytes (0.0%).
diff --git a/tools/binary_size/libsupersize/testdata/ArchiveContainers.golden b/tools/binary_size/libsupersize/testdata/ArchiveContainers.golden index 3230a28..20fa05b8 100644 --- a/tools/binary_size/libsupersize/testdata/ArchiveContainers.golden +++ b/tools/binary_size/libsupersize/testdata/ArchiveContainers.golden
@@ -2,7 +2,6 @@ git_revision=abc123 gn_args=var1=true var2="foo" linker_name=gold -tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Metadata: Container1: apk_file_name=test.apk
diff --git a/tools/binary_size/libsupersize/testdata/Archive_Apk.golden b/tools/binary_size/libsupersize/testdata/Archive_Apk.golden index 02ee746..5c8379f8 100644 --- a/tools/binary_size/libsupersize/testdata/Archive_Apk.golden +++ b/tools/binary_size/libsupersize/testdata/Archive_Apk.golden
@@ -11,7 +11,6 @@ gn_args=var1=true var2="foo" linker_name=gold map_file_name=../../../test.map -tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ zipalign_padding=32 Section .text: has 100.0% of 35982248 bytes accounted for from 22 symbols. 0 bytes are unaccounted for. * Padding accounts for 13808 bytes (0.0%)
diff --git a/tools/binary_size/libsupersize/testdata/Archive_Elf.golden b/tools/binary_size/libsupersize/testdata/Archive_Elf.golden index b00fd5ba..40c09707 100644 --- a/tools/binary_size/libsupersize/testdata/Archive_Elf.golden +++ b/tools/binary_size/libsupersize/testdata/Archive_Elf.golden
@@ -8,7 +8,6 @@ gn_args=var1=true var2="foo" linker_name=gold map_file_name=../../../test.map -tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Section .text: has 100.0% of 35982248 bytes accounted for from 22 symbols. 0 bytes are unaccounted for. * Padding accounts for 13808 bytes (0.0%) * 16 have source paths. Accounts for 73986 bytes (0.2%).
diff --git a/tools/binary_size/libsupersize/testdata/Archive_Elf_No_Map.golden b/tools/binary_size/libsupersize/testdata/Archive_Elf_No_Map.golden index 341979b..ee0569b 100644 --- a/tools/binary_size/libsupersize/testdata/Archive_Elf_No_Map.golden +++ b/tools/binary_size/libsupersize/testdata/Archive_Elf_No_Map.golden
@@ -6,7 +6,6 @@ elf_relocations_count=394087 git_revision=abc123 gn_args=var1=true var2="foo" -tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Section .text: has 100.0% of 35982248 bytes accounted for from 11 symbols. 0 bytes are unaccounted for. * Padding accounts for 83704 bytes (0.2%) * 11 have source paths. Accounts for 35982248 bytes (100.0%).
diff --git a/tools/binary_size/libsupersize/testdata/Archive_MinimalApks.golden b/tools/binary_size/libsupersize/testdata/Archive_MinimalApks.golden index 055ea1e..2fe77e56 100644 --- a/tools/binary_size/libsupersize/testdata/Archive_MinimalApks.golden +++ b/tools/binary_size/libsupersize/testdata/Archive_MinimalApks.golden
@@ -1,7 +1,6 @@ git_revision=abc123 gn_args=var1=true var2="foo" linker_name=gold -tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ apk_file_name=Bundle.minimal.apks apk_signature_block_size=0 apk_size=147858981
diff --git a/tools/binary_size/libsupersize/testdata/Archive_OutputDirectory.golden b/tools/binary_size/libsupersize/testdata/Archive_OutputDirectory.golden index 51d2d3d..5faa0c5 100644 --- a/tools/binary_size/libsupersize/testdata/Archive_OutputDirectory.golden +++ b/tools/binary_size/libsupersize/testdata/Archive_OutputDirectory.golden
@@ -3,7 +3,6 @@ gn_args=var1=true var2="foo" linker_name=gold map_file_name=../../../test.map -tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Section .text: has 100.0% of 35982248 bytes accounted for from 17 symbols. 0 bytes are unaccounted for. * Padding accounts for 13808 bytes (0.0%) * 14 have source paths. Accounts for 74034 bytes (0.2%).
diff --git a/tools/binary_size/libsupersize/testdata/Archive_Pak_Files.golden b/tools/binary_size/libsupersize/testdata/Archive_Pak_Files.golden index fc97c4b..5e847480 100644 --- a/tools/binary_size/libsupersize/testdata/Archive_Pak_Files.golden +++ b/tools/binary_size/libsupersize/testdata/Archive_Pak_Files.golden
@@ -8,7 +8,6 @@ gn_args=var1=true var2="foo" linker_name=gold map_file_name=../../../test.map -tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Section .text: has 100.0% of 35982248 bytes accounted for from 22 symbols. 0 bytes are unaccounted for. * Padding accounts for 13808 bytes (0.0%) * 16 have source paths. Accounts for 73986 bytes (0.2%).
diff --git a/tools/binary_size/libsupersize/testdata/Console.golden b/tools/binary_size/libsupersize/testdata/Console.golden index 689fc9c..727a3cf 100644 --- a/tools/binary_size/libsupersize/testdata/Console.golden +++ b/tools/binary_size/libsupersize/testdata/Console.golden
@@ -73,7 +73,6 @@ gn_args=var1=true var2="foo" linker_name=gold map_file_name=../../../test.map - tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Section Sizes (Total=128.0mb (134218045 bytes)): .bss: 1.24mb (1300456 bytes) (not included in totals)
diff --git a/tools/binary_size/libsupersize/testdata/Diff_Basic.golden b/tools/binary_size/libsupersize/testdata/Diff_Basic.golden index bf90202..1ab20af5 100644 --- a/tools/binary_size/libsupersize/testdata/Diff_Basic.golden +++ b/tools/binary_size/libsupersize/testdata/Diff_Basic.golden
@@ -3,7 +3,6 @@ foo=1 gn_args=var1=true var2="foo" linker_name=gold - tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Old Metadata: bar=[1, 2, 3] git_revision=abc123
diff --git a/tools/binary_size/libsupersize/testdata/Diff_NullDiff.golden b/tools/binary_size/libsupersize/testdata/Diff_NullDiff.golden index 17037e9..d87cbf1c 100644 --- a/tools/binary_size/libsupersize/testdata/Diff_NullDiff.golden +++ b/tools/binary_size/libsupersize/testdata/Diff_NullDiff.golden
@@ -9,7 +9,6 @@ gn_args=var1=true var2="foo" linker_name=gold map_file_name=../../../test.map - tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Old Metadata: New Metadata:
diff --git a/tools/binary_size/libsupersize/testdata/FullDescription.golden b/tools/binary_size/libsupersize/testdata/FullDescription.golden index 4bfbffea..404fd234 100644 --- a/tools/binary_size/libsupersize/testdata/FullDescription.golden +++ b/tools/binary_size/libsupersize/testdata/FullDescription.golden
@@ -9,7 +9,6 @@ gn_args=var1=true var2="foo" linker_name=gold map_file_name=../../../test.map - tool_prefix=tools/binary_size/libsupersize/testdata/mock_toolchain/ Section Sizes (Total=128.0mb (134218045 bytes)): .bss: 1.24mb (1300456 bytes) (not included in totals)
diff --git a/tools/binary_size/libsupersize/testdata/mock_toolchain/llvm-bcanalyzer b/tools/binary_size/libsupersize/testdata/mock_toolchain/bcanalyzer similarity index 100% rename from tools/binary_size/libsupersize/testdata/mock_toolchain/llvm-bcanalyzer rename to tools/binary_size/libsupersize/testdata/mock_toolchain/bcanalyzer
diff --git a/tools/binary_size/libsupersize/testdata/mock_toolchain/c++filt b/tools/binary_size/libsupersize/testdata/mock_toolchain/cxxfilt similarity index 100% rename from tools/binary_size/libsupersize/testdata/mock_toolchain/c++filt rename to tools/binary_size/libsupersize/testdata/mock_toolchain/cxxfilt
diff --git a/tools/binary_size/libsupersize/viewer/caspian/diff.cc b/tools/binary_size/libsupersize/viewer/caspian/diff.cc index 42cb6ede0..e4339ef 100644 --- a/tools/binary_size/libsupersize/viewer/caspian/diff.cc +++ b/tools/binary_size/libsupersize/viewer/caspian/diff.cc
@@ -199,6 +199,7 @@ namespace caspian { +// See docs/diffs.md for diffing algorithm. DeltaSizeInfo Diff(const SizeInfo* before, const SizeInfo* after) { DeltaSizeInfo ret(before, after);
diff --git a/tools/binary_size/libsupersize/zip_util_test.py b/tools/binary_size/libsupersize/zip_util_test.py index 0167a078..b026ed6 100755 --- a/tools/binary_size/libsupersize/zip_util_test.py +++ b/tools/binary_size/libsupersize/zip_util_test.py
@@ -16,8 +16,8 @@ def _FindZipAlign(): # SDK does not exist on presubmit CQ bot. candidates = glob.glob( - path_util.FromToolsSrcRootRelative( - 'third_party/android_sdk/public/build-tools/*/zipalign')) + path_util.FromToolsSrcRoot( + 'third_party/android_sdk/public/build-tools/*/zipalign')) # Any version will do. return candidates[0] if candidates else None
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index 3b4b414..8224d4a 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -35,8 +35,8 @@ # https://chromium.googlesource.com/chromium/src/+/main/docs/updating_clang.md # 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-14241-ged3a4a49' -CLANG_SUB_REVISION = 1 +CLANG_REVISION = 'llvmorg-14-init-12719-gc4b45eeb' +CLANG_SUB_REVISION = 3 PACKAGE_VERSION = '%s-%s' % (CLANG_REVISION, CLANG_SUB_REVISION) RELEASE_VERSION = '14.0.0'
diff --git a/tools/licenses.py b/tools/licenses.py index 3ccf0845..e788d67 100755 --- a/tools/licenses.py +++ b/tools/licenses.py
@@ -129,6 +129,8 @@ os.path.join('testing', 'gmock'), os.path.join('testing', 'gtest'), os.path.join('third_party', 'boringssl', 'src', 'third_party', 'fiat'), + os.path.join('third_party', 'devtools-frontend', 'src', 'front_end', + 'third_party'), os.path.join('tools', 'gyp'), os.path.join('tools', 'page_cycler', 'acid3'), os.path.join('url', 'third_party', 'mozilla'),
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 69cce54..ddd1250 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml
@@ -17685,6 +17685,14 @@ <description>User pressed 'Zoom Text' in the app menu</description> </action> +<action name="MobileMenuToolbarMenuTriggered"> + <owner>gambard@chromium.org</owner> + <owner>rkgibson@google.com</owner> + <description> + User triggered the presentation of a context menu on the toolbar + </description> +</action> + <action name="MobileMenuTranslate"> <owner>frechette@chromium.org</owner> <description>User pressed the 'Translate' in the app menu.</description>
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index fffab0c..24a9ca7 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -22212,6 +22212,7 @@ <int value="110" label="Enterprise confirmation"/> <int value="111" label="App Identity Update Confirmation"/> <int value="112" label="Bluetooth device pairing credentials"/> + <int value="113" label="Signin Intercept First Run Experience"/> </enum> <enum name="DialogOriginRelationship"> @@ -31235,6 +31236,7 @@ <int value="1611" label="WEB_AUTHENTICATION_PROXY_COMPLETE_CREATE_REQUEST"/> <int value="1612" label="DEVELOPERPRIVATE_GETUSERSITESETTINGS"/> <int value="1613" label="ACTION_OPENPOPUP"/> + <int value="1614" label="OS_TELEMETRY_GETCPUINFO"/> </enum> <enum name="ExtensionIconState"> @@ -46927,6 +46929,16 @@ <int value="26" label="Search with Google Lens"/> <int value="27" label="Show Link Preview"/> <int value="28" label="Hide Link Preview"/> + <int value="29" label="Open a New Tab"/> + <int value="30" label="Open a New Incognito Tab"/> + <int value="31" label="Close Current Tab"/> + <int value="32" label="Show QR Scanner"/> + <int value="33" label="Start Voice Search"/> + <int value="34" label="Start New Search"/> + <int value="35" label="Start New Incognito Search"/> + <int value="36" label="Search Copied Image"/> + <int value="37" label="Search Copied URL"/> + <int value="38" label="Search Copied Text"/> </enum> <enum name="IOSMenuScenario"> @@ -46942,6 +46954,8 @@ <int value="9" label="Link on a Web page"/> <int value="10" label="Tab Grid Entry"/> <int value="11" label="Tab Grid Add To"/> + <int value="12" label="Tab Grid Edit"/> + <int value="13" label="Toolbar Popup Menus"/> </enum> <enum name="IOSMultiWindowConfiguration"> @@ -81020,6 +81034,8 @@ <int value="31" label="Sign-in promo in the web sign-in flow"/> <int value="32" label="Safety check settings page"/> <int value="33" label="Kaleidoscope"/> + <int value="34" label="Enterprise sign-out coordinator"/> + <int value="35" label="Signin intercept first run experience"/> </enum> <enum name="SigninAccountEquality">
diff --git a/tools/metrics/histograms/metadata/cros/histograms.xml b/tools/metrics/histograms/metadata/cros/histograms.xml index d29ef71..734513a 100644 --- a/tools/metrics/histograms/metadata/cros/histograms.xml +++ b/tools/metrics/histograms/metadata/cros/histograms.xml
@@ -64,21 +64,6 @@ </summary> </histogram> -<histogram name="CrosDisks.Fuse.Archivemount" enum="ArchivemountError" - expires_after="2022-04-17"> - <obsolete> - Deprecated 10/2021. This feature (using the older archivemount program - instead of newer fuse-archive) was never enabled-by-default, although some - people opted into the chrome://flags/#files-archivemount flag anyway. - </obsolete> - <owner>fdegros@chromium.org</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - The error code returned by the archivemount program, which is called every - time a user opens various archive files in ChromeOS Files App. - </summary> -</histogram> - <histogram name="CrosDisks.Fuse.FuseArchive" enum="FuseArchiveError" expires_after="2022-04-17"> <owner>fdegros@chromium.org</owner> @@ -176,86 +161,6 @@ </summary> </histogram> -<histogram name="CrosFirstRun.DialogShown" units="units" - expires_after="2020-12-01"> - <obsolete> - Deprecated 01/2020 in Issue 1001460 when Welcome Tour was deleted. - </obsolete> - <owner>alemate@chromium.org</owner> - <owner>cros-oac@google.com</owner> - <summary> - Records the number of times when first-run dialog was shown. - </summary> -</histogram> - -<histogram name="CrosFirstRun.FurthestStep" units="units" - expires_after="2020-12-01"> - <obsolete> - Deprecated 01/2020 in Issue 1001460 when Welcome Tour was deleted. - </obsolete> - <owner>alemate@chromium.org</owner> - <owner>cros-oac@google.com</owner> - <summary> - Index of furthest step that was reached during tutorial. Since order of - steps could change eventially and new steps could apear we use index here - instead of step name. - </summary> -</histogram> - -<histogram name="CrosFirstRun.TimeSpent" units="ms" expires_after="2020-12-01"> - <obsolete> - Deprecated 01/2020 in Issue 1001460 when Welcome Tour was deleted. - </obsolete> - <owner>alemate@chromium.org</owner> - <owner>cros-oac@google.com</owner> - <summary>The total time that user spent on first-run tutorial.</summary> -</histogram> - -<histogram name="CrosFirstRun.TimeSpentOnStep" units="ms" - expires_after="2020-12-01"> - <obsolete> - Deprecated 01/2020 in Issue 1001460 when Welcome Tour was deleted. - </obsolete> - <owner>alemate@chromium.org</owner> - <owner>cros-oac@google.com</owner> - <summary>The time that user spent on some step of tutorial.</summary> -</histogram> - -<histogram name="CrosFirstRun.TutorialCompletion" - enum="CrosFirstRunTutorialCompletionType" expires_after="2020-12-01"> - <obsolete> - Deprecated 01/2020 in Issue 1001460 when Welcome Tour was deleted. - </obsolete> - <owner>alemate@chromium.org</owner> - <owner>cros-oac@google.com</owner> - <summary>Tracks the way how user left tutorial.</summary> -</histogram> - -<histogram name="CrosFirstRun.TutorialLaunched" units="units" - expires_after="2020-12-01"> - <obsolete> - Deprecated 01/2020 in Issue 1001460 when Welcome Tour was deleted. - </obsolete> - <owner>alemate@chromium.org</owner> - <owner>cros-oac@google.com</owner> - <summary> - Records the number of times when first-run tutorial has been launched. - </summary> -</histogram> - -<histogram name="CrosUsb.NotificationClosed" enum="CrosUsbNotificationClosed" - expires_after="2021-01-31"> - <obsolete> - Removed 01/2021. We haven't been making use of this. - </obsolete> - <owner>clumptini@google.com</owner> - <owner>tbuckley@chromium.org</owner> - <summary> - Records the reason why the "Cros USB device detected" notification - was dismissed. Recorded on notificiation close, after usb attached. - </summary> -</histogram> - </histograms> </histogram-configuration>
diff --git a/tools/metrics/histograms/metadata/crostini/histograms.xml b/tools/metrics/histograms/metadata/crostini/histograms.xml index 6e19286..a8f1e9c 100644 --- a/tools/metrics/histograms/metadata/crostini/histograms.xml +++ b/tools/metrics/histograms/metadata/crostini/histograms.xml
@@ -187,50 +187,6 @@ </summary> </histogram> -<histogram name="Crostini.Crosvm.CpuPercentage" units="%" - expires_after="2022-05-15"> - <obsolete> - Removed in M99, no longer useful for Crostini as it measured all crosvm - processes. - </obsolete> - <owner>clumptini@google.com</owner> - <owner>laurentt@google.com</owner> - <summary> - The percentage of the system CPU that crosvm processes used during the - 10-minute measuring period. This is recorded once every 10 minutes when - crosvm is running. - </summary> -</histogram> - -<histogram name="Crostini.Crosvm.Processes.Count" units="processes" - expires_after="2022-01-06"> - <obsolete> - Removed in M99, no longer useful for Crostini as it measured all crosvm - processes. - </obsolete> - <owner>clumptini@google.com</owner> - <owner>laurentt@google.com</owner> - <summary> - The number of crosvm processes that are running at the end of the 10-minute - interval. This is recorded once every 10 minutes when crosvm is running. - </summary> -</histogram> - -<histogram name="Crostini.Crosvm.RssPercentage" units="%" - expires_after="2022-05-15"> - <obsolete> - Removed in M99, no longer useful for Crostini as it measured all crosvm - processes. - </obsolete> - <owner>clumptini@google.com</owner> - <owner>laurentt@google.com</owner> - <summary> - The percentage of the system memory that crosvm processes used at the end of - the 10-minute measuring period. This is recorded once every 10 minutes when - crosvm is running. - </summary> -</histogram> - <histogram name="Crostini.DiskResize.Result" enum="CrostiniDiskImageStatus" expires_after="2022-05-15"> <owner>clumptini@google.com</owner> @@ -362,21 +318,6 @@ </summary> </histogram> -<histogram name="Crostini.RestarterTimeInState.{state}" units="ms" - expires_after="2023-01-06"> - <obsolete> - Removed in M93, and had misleading data before M93. Do not use. - </obsolete> - <owner>clumptini@google.com</owner> - <owner>laurentt@google.com</owner> - <summary> - Was intended to be time spent in each state in the restarter flow, but there - were some issues with how the metric was emitted. Use - Crostini.RestarterTimeInState2.* instead. - </summary> - <token key="state" variants="CrostiniState"/> -</histogram> - <histogram name="Crostini.RestarterTimeInState2.{state}" units="ms" expires_after="2023-01-06"> <owner>clumptini@google.com</owner>
diff --git a/tools/metrics/histograms/metadata/dev/histograms.xml b/tools/metrics/histograms/metadata/dev/histograms.xml index 3b2b9c3..9f57b01 100644 --- a/tools/metrics/histograms/metadata/dev/histograms.xml +++ b/tools/metrics/histograms/metadata/dev/histograms.xml
@@ -94,34 +94,6 @@ </token> </histogram> -<histogram name="DevTools.ColorPicker.FixedColor" - enum="DevToolsColorPickerFixedColor" expires_after="2021-10-04"> - <obsolete> - Removed in M95 because it is no longer needed for analysis. - </obsolete> - <owner>yangguo@chromium.org</owner> - <owner>mathias@chromium.org</owner> - <owner>alexrudenko@chromium.org</owner> - <summary> - Records which color contrast threshold was fixed by the user in the Color - Picker. - </summary> -</histogram> - -<histogram name="DevTools.ComputedStyleGrouping" - enum="DevToolsComputedStyleGrouping" expires_after="M87"> - <obsolete> - Removed in M88 because it is no longer needed for analysis. - </obsolete> - <owner>changhaohan@chromium.org</owner> - <owner>yangguo@chromium.org</owner> - <owner>mathias@chromium.org</owner> - <summary> - Records state changes for DevTools computed style grouping toggled from the - Computed pane. - </summary> -</histogram> - <histogram name="DevTools.ConsoleShowsCorsErrors" enum="DevToolsConsoleShowsCorsErrors" expires_after="2022-12-01"> <owner>dsv@chromium.org</owner> @@ -132,35 +104,6 @@ </summary> </histogram> -<histogram name="DevTools.CssEditorOpened" enum="DevToolsCssEditorOpened" - expires_after="2021-09-14"> - <obsolete> - Removed in M95 because it is no longer needed for analysis. See - crbug.com/1235544. - </obsolete> - <owner>yangguo@chromium.org</owner> - <owner>michael.liao@microsoft.com</owner> - <owner>shanejc@microsoft.com</owner> - <summary> - Records the usage of each of the Styles Pane property editors while the font - editor experiment is enabled. The four editors are the color picker, the CSS - shadow editor, the bezier editor and the font editor. - </summary> -</histogram> - -<histogram name="DevTools.CSSGridSettings2" enum="DevtoolsGridSettingChanged2" - expires_after="M88"> - <obsolete> - Removed in M89 because it is no longer needed for analysis. - </obsolete> - <owner>yangguo@chromium.org</owner> - <owner>brgoddar@microsoft.com</owner> - <owner>leo.lee@microsoft.com</owner> - <summary> - DevTools settings for CSS grid recorded on launch of the DevTools. - </summary> -</histogram> - <histogram name="DevTools.DeveloperResourceLoaded" enum="DevToolsDeveloperResourceLoaded" expires_after="2022-12-01"> <owner>yangguo@chromium.org</owner> @@ -214,22 +157,6 @@ </summary> </histogram> -<histogram name="DevTools.DualScreenDeviceEmulated" - enum="DevToolsDualScreenDeviceEmulated" expires_after="M87"> - <obsolete> - Removed in M87 as it is no longer needed for analysis. See - crbug.com/1125666. - </obsolete> - <owner>yangguo@chromium.org</owner> - <owner>soxia@microsoft.com</owner> - <owner>leo.lee@microsoft.com</owner> - <summary> - Records the usage of dual screen device emulation: a dual screen or fold - device is selected for emulation; the span button is hit; or the platform - support of dual screen is utilized. - </summary> -</histogram> - <histogram name="DevTools.ExperimentDisabled" enum="DevtoolsExperiments" expires_after="2022-12-01"> <owner>yangguo@chromium.org</owner> @@ -257,33 +184,6 @@ </summary> </histogram> -<histogram name="DevTools.GridOverlayOpenedFrom" - enum="DevToolsGridOverlayOpenedFrom" expires_after="M88"> - <obsolete> - Removed in M89 because it is no longer needed for analysis. - </obsolete> - <owner>changhaohan@chromium.org</owner> - <owner>yangguo@chromium.org</owner> - <owner>mathias@chromium.org</owner> - <summary> - Records which UI element is being used to open Grid overlays. - </summary> -</histogram> - -<histogram name="DevTools.HighlightedPersistentCSSGridCount" - enum="DevToolsHighlightedPersistentCSSGridCount" expires_after="M88"> - <obsolete> - Removed in M89 because it is no longer needed for analysis. - </obsolete> - <owner>yangguo@chromium.org</owner> - <owner>patrick.brosset@microsoft.com</owner> - <owner>leo.lee@microsoft.com</owner> - <summary> - Number of simultaneous persistent CSS grid overlays in DevTools, recorded - after each change. - </summary> -</histogram> - <histogram name="DevTools.InspectElement" units="ms" expires_after="2022-12-01"> <owner>yangguo@chromium.org</owner> <owner>bmeurer@chromium.org</owner> @@ -462,17 +362,6 @@ </summary> </histogram> -<histogram name="DevTools.SettingChanged" enum="DevToolsSetting" - expires_after="2021-12-05"> - <obsolete> - Instrumentation was removed before M76. - </obsolete> - <owner>alph@chromium.org</owner> - <owner>yangguo@chromium.org</owner> - <owner>bmeurer@chromium.org</owner> - <summary>Specified DevTools setting was changed.</summary> -</histogram> - <histogram name="DevTools.SidebarPaneShown" enum="DevToolsSidebarPane" expires_after="2022-07-01"> <owner>changhaohan@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/extension/histograms.xml b/tools/metrics/histograms/metadata/extension/histograms.xml index d577b25d..5edfacb 100644 --- a/tools/metrics/histograms/metadata/extension/histograms.xml +++ b/tools/metrics/histograms/metadata/extension/histograms.xml
@@ -77,46 +77,6 @@ </summary> </histogram> -<histogram name="ExtensionBubble.DevModeUserSelection" - enum="ExtensionBubbleAction" expires_after="2021-04-01"> - <obsolete> - Code removed 2021/06. - </obsolete> - <owner>rdevlin.cronin@chromium.org</owner> - <owner>extensions-core@chromium.org</owner> - <summary> - The action taken by the user when seeing the bubble, logged right after the - action is taken. - </summary> -</histogram> - -<histogram name="ExtensionBubble.ExtensionsInDevModeCount" - units="Developer Mode Extensions" expires_after="2021-04-01"> - <obsolete> - Code removed 2021/06. - </obsolete> - <owner>rdevlin.cronin@chromium.org</owner> - <owner>extensions-core@chromium.org</owner> - <summary> - The total number of extensions found to be loaded under Developer Mode, - logged when the devmode bubble is shown (once per startup per profile, if - any devmode extension is found). - </summary> -</histogram> - -<histogram name="ExtensionBubble.ExtensionWipeoutCount" units="Extensions" - expires_after="2021-01-31"> - <obsolete> - Code removed 2021/06. - </obsolete> - <owner>rdevlin.cronin@chromium.org</owner> - <owner>extensions-core@chromium.org</owner> - <summary> - The total number of extensions found to be wiped by SideloadWipeout, logged - when the wipeout bubble is shown, which is once per startup per profile. - </summary> -</histogram> - <histogram name="ExtensionContentHashFetcher.CreateHashesTime" units="ms" expires_after="never"> <!-- expires-never: Used for monitoring extension content verification latency. --> @@ -175,61 +135,6 @@ </summary> </histogram> -<histogram name="ExtensionOverrideBubble.NtpOverriddenUserSelection" - enum="ExtensionBubbleAction" expires_after="2021-04-01"> - <obsolete> - Code removed 2021/03. - </obsolete> - <owner>rdevlin.cronin@chromium.org</owner> - <owner>extensions-core@chromium.org</owner> - <summary> - The action taken by the user when seeing the bubble, notifing them of an - extension overriding their new tab page. Logged right after the action is - taken. - </summary> -</histogram> - -<histogram name="ExtensionOverrideBubble.SettingsApiUserSelectionHomePage" - enum="ExtensionBubbleAction" expires_after="2021-06-01"> - <obsolete> - Code removed 2021/06. - </obsolete> - <owner>rdevlin.cronin@chromium.org</owner> - <owner>extensions-core@chromium.org</owner> - <summary> - The action taken by the user when seeing the bubble, notifing them of an - extension overriding their homepage. Logged right after the action is taken. - </summary> -</histogram> - -<histogram name="ExtensionOverrideBubble.SettingsApiUserSelectionSearchEngine" - enum="ExtensionBubbleAction" expires_after="2021-04-01"> - <obsolete> - Code removed 2021/06. - </obsolete> - <owner>rdevlin.cronin@chromium.org</owner> - <owner>extensions-core@chromium.org</owner> - <summary> - The action taken by the user when seeing the bubble, notifing them of an - extension overriding their search engine. Logged right after the action is - taken. - </summary> -</histogram> - -<histogram name="ExtensionOverrideBubble.SettingsApiUserSelectionStartupPage" - enum="ExtensionBubbleAction" expires_after="2021-04-01"> - <obsolete> - Code removed 2021/06. - </obsolete> - <owner>rdevlin.cronin@chromium.org</owner> - <owner>extensions-core@chromium.org</owner> - <summary> - The action taken by the user when seeing the bubble, notifing them of an - extension overriding their startup page. Logged right after the action is - taken. - </summary> -</histogram> - <histogram name="ExtensionService.AddVerified" enum="BooleanSuccess" expires_after="2018-08-30"> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> @@ -272,23 +177,6 @@ </summary> </histogram> -<histogram name="ExtensionToolbarModel.BrowserActionsVisible" units="units" - expires_after="2021-12-01"> - <obsolete> - Replaced by Extensions.Toolbar.PinnedExtensionCount2 and - Extensions.Toolbar.PinnedExtensionPercentage3. Code removed 2021/11. - </obsolete> - <owner>rdevlin.cronin@chromium.org</owner> - <owner>extensions-core@chromium.org</owner> - <summary> - The number of visible icons in the Browser Actions Container (visible as in - number of icons not in the overflow bucket). 0 means all icons are in the - overflow bucket. MAX_INT means the toolbar is always showing all icons. - Measured once per startup per (non-incognito) profile but only for those - profiles that have one or more browser actions showing in the toolbar. - </summary> -</histogram> - <histogram name="ExtensionUrlRequest.Latency" units="ms" expires_after="2020-11-30"> <owner>lazyboy@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/file/histograms.xml b/tools/metrics/histograms/metadata/file/histograms.xml index 409c180..106b435 100644 --- a/tools/metrics/histograms/metadata/file/histograms.xml +++ b/tools/metrics/histograms/metadata/file/histograms.xml
@@ -256,32 +256,6 @@ </summary> </histogram> -<histogram name="FileBrowser.LauncherSearch.Drive" units="ms" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - The time taken to execute launcher search for drive files. Recorded when the - complete result set is returned from drive. - </summary> -</histogram> - -<histogram name="FileBrowser.LauncherSearch.Local" units="ms" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - The time taken to execute launcher search for local files. Recorded when the - complete result set has been calculated for files on the local disk. - </summary> -</histogram> - <histogram name="FileBrowser.Load{FileBrowserLoad}" units="ms" expires_after="M108"> <owner>simmonsjosh@google.com</owner> @@ -301,23 +275,6 @@ summary="Time to create a window on restart."/> <variant name=".BackgroundScript" summary="Time to initialize backend script to wait for events."/> - <variant name=".Construct" - summary="Time spent constructing the main Javascript object."> - <obsolete> - Deprecated as of 12/2016. - </obsolete> - </variant> - <variant name=".DOM" summary="Time to initialize DOM."> - <obsolete> - Deprecated as of 12/2016. - </obsolete> - </variant> - <variant name=".FileSystem" - summary="Time to get access to the local file system."> - <obsolete> - Deprecated as of 9/2013. - </obsolete> - </variant> <variant name=".ImportElements" summary="Time to initialize the polymer elements."/> <variant name=".InitBackgroundPage" @@ -328,20 +285,9 @@ <variant name=".InitUI" summary="Time to initialize all UI after all elements are initialized."/> - <variant name=".Parse" - summary="Time to parse Javascript and CSS (Deprecated)."> - <obsolete> - Deprecated as of 12/2016. - </obsolete> - </variant> <variant name=".ProcessInitialSearchQuery" summary="Time to process LaunchParam.searchQuery (time to find a query-matched directory)."/> - <variant name=".Roots" summary="Time to enumerate file system roots."> - <obsolete> - Deprecated as of 12/2016. - </obsolete> - </variant> <variant name=".Script" summary="Time to parse Javascript and CSS."/> <variant name=".Total" summary="Total load time from the moment the Javascript started @@ -489,108 +435,6 @@ </summary> </histogram> -<histogram name="FileBrowser.PhotoEditor.DisplayTime" units="ms" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS Photo Editor: time to display an image. Measured from the moment - the user selected the image till the moment it is displayed (not counting - the low resolution preview). - </summary> -</histogram> - -<histogram name="FileBrowser.PhotoEditor.FileType" enum="PhotoEditorFileType" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary>Chrome OS Photo Editor: the type of the file opened.</summary> -</histogram> - -<histogram name="FileBrowser.PhotoEditor.LoadMode" enum="PhotoEditorLoadMode" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary>Chrome OS Photo Editor: the way the image has been loaded.</summary> -</histogram> - -<histogram name="FileBrowser.PhotoEditor.LoadTime" units="ms" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary>Chrome OS Photo Editor: time to load an image from a file.</summary> -</histogram> - -<histogram name="FileBrowser.PhotoEditor.SaveResult" - enum="PhotoEditorSaveResult" expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS Photo Editor: the result of a file save operation. - </summary> -</histogram> - -<histogram name="FileBrowser.PhotoEditor.SaveTime" units="ms" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary>Chrome OS Photo Editor: time to save an image to a file.</summary> -</histogram> - -<histogram name="FileBrowser.PhotoEditor.Size.MB" units="MBytes" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS Photo Editor: size of an image file in megabytes. Measured on - every image load. - </summary> -</histogram> - -<histogram name="FileBrowser.PhotoEditor.Size.MPix" units="MPixels" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS Photo Editor: size of an image in megapixels. Measured on every - image load. - </summary> -</histogram> - -<histogram name="FileBrowser.PhotoEditor.Tool" enum="PhotoEditorToolType" - expires_after="M98"> - <obsolete> - Removed in M92. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary>Chrome OS Photo Editor: the button which the user clicked.</summary> -</histogram> - <histogram name="FileBrowser.QuickView.DialogType" enum="FileDialogType" expires_after="2022-04-10"> <owner>simmonsjosh@google.com</owner> @@ -678,97 +522,6 @@ </summary> </histogram> -<histogram name="FileBrowser.Share.ActionSource" enum="SharingActionSource" - expires_after="2022-04-24"> - <obsolete> - Removed in M97. File sharing is now done by Sharesheet, not Files.app. - Replaced with ChromeOS.Sharesheet.LaunchSource. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary>Chrome OS File Browser: the source of file sharing action.</summary> -</histogram> - -<histogram name="FileBrowser.Share.FileCount" units="files" - expires_after="2022-04-17"> - <obsolete> - Removed in M97. File sharing is now done by Sharesheet, not Files.app. - Replaced with ChromeOS.Sharesheet.FileCount. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS File Browser: The number of files shared via a single Share - action. - </summary> -</histogram> - -<histogram name="FileBrowser.Share.FileType" enum="ViewFileType" - expires_after="2022-04-24"> - <obsolete> - Removed in M99. File sharing is now done by Sharesheet, not Files.app. - Replaced with ChromeOS.Sharesheet.Invocation.Mimetype. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS File Browser: The type of the file shared via Share action. - Recorded for each file being shared by a share action - </summary> -</histogram> - -<histogram name="FileBrowser.SuggestApps.CloseDialog" - enum="SuggestAppsDialogCloseReason" expires_after="M92"> - <obsolete> - Removed in M90. Files.app no longer displays CWS dialog. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS File Browser: the reason why the suggest apps dialog was closed. - </summary> -</histogram> - -<histogram name="FileBrowser.SuggestApps.Install" - enum="SuggestAppsDialogInstall" expires_after="2021-08-09"> - <obsolete> - Removed in M90. Files.app no longer displays CWS dialog. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS File Browser: whether the Webstore item user selected was - successfully installed or not. - </summary> -</histogram> - -<histogram name="FileBrowser.SuggestApps.Load" enum="SuggestAppsDialogLoad" - expires_after="2021-08-09"> - <obsolete> - Removed in M90. Files.app no longer displays CWS dialog. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS File Browser: whether the initialization of the dialog succeeded - or not. - </summary> -</histogram> - -<histogram name="FileBrowser.SuggestApps.LoadTime" units="ms" - expires_after="M92"> - <obsolete> - Removed in M90. Files.app no longer displays CWS dialog. - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS File Browser: time to load the suggest apps dialog. Measured - between the moment window appears and the moment all the contents in the - dialog including the Chrome Webstore widget are ready. - </summary> -</histogram> - <histogram name="FileBrowser.SWA.Create" enum="FileDialogType" expires_after="2022-04-17"> <owner>simmonsjosh@google.com</owner> @@ -917,19 +670,6 @@ </summary> </histogram> -<histogram name="FileBrowser.ZipFileTask" enum="FileManagerZipHandlerType" - expires_after="M98"> - <obsolete> - Related to NaCl-based ZipArchiver extension, removed in M96 - </obsolete> - <owner>simmonsjosh@google.com</owner> - <owner>src/ui/file_manager/OWNERS</owner> - <summary> - Chrome OS File Browser: counts the number of times ZIP file was opened or - created, categorized by component extensions and its operation types. - </summary> -</histogram> - <histogram name="FileReaderSync.WorkerType" enum="FileReaderSyncWorkerType" expires_after="M85"> <owner>mek@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/fingerprint/histograms.xml b/tools/metrics/histograms/metadata/fingerprint/histograms.xml index b05b881..70dc453 100644 --- a/tools/metrics/histograms/metadata/fingerprint/histograms.xml +++ b/tools/metrics/histograms/metadata/fingerprint/histograms.xml
@@ -174,18 +174,6 @@ </summary> </histogram> -<histogram name="Fingerprint.Unlock.MigrationForPositiveMatchSecretResult" - enum="BooleanSuccess" expires_after="M85"> - <obsolete> - Removed 09/2020 as the migration is no longer supported after M85. - </obsolete> - <owner>hesling@chromium.org</owner> - <owner>chromeos-fingerprint@google.com</owner> - <summary> - Whether migrating a record to positive match secret succeeded. - </summary> -</histogram> - <histogram name="Fingerprint.Unlock.NoMatch.Duration.Capture" units="ms" expires_after="2022-05-01"> <owner>rsorokin@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/gcm/histograms.xml b/tools/metrics/histograms/metadata/gcm/histograms.xml index c7bd260..5b676e7a 100644 --- a/tools/metrics/histograms/metadata/gcm/histograms.xml +++ b/tools/metrics/histograms/metadata/gcm/histograms.xml
@@ -316,15 +316,6 @@ </summary> </histogram> -<histogram name="GCM.RegistrationSenderIdCount" units="units" - expires_after="M85"> - <obsolete> - Removed 10/2020 because there no longer was a need for the data. - </obsolete> - <owner>jianli@chromium.org</owner> - <summary>Number of sender IDs specified in a registration request.</summary> -</histogram> - <histogram name="GCM.RemoveAccountMappingWhenLoading" enum="BooleanDeletedOrNot" expires_after="2020-11-30"> <owner>msarda@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml index 40477df..4af5f61 100644 --- a/tools/metrics/histograms/metadata/histogram_suffixes_list.xml +++ b/tools/metrics/histograms/metadata/histogram_suffixes_list.xml
@@ -2489,7 +2489,6 @@ Deprecated December 2020 because it isn't recorded. </obsolete> </suffix> - <affected-histogram name="PasswordManager.CompromisedCredentials"/> </histogram_suffixes> <histogram_suffixes name="ConnCountImpact" separator="_"> @@ -3001,13 +3000,6 @@ <affected-histogram name="Cras.Busyloop"/> </histogram_suffixes> -<histogram_suffixes name="CrosFirstRunStep" separator=""> - <suffix name="AppList" label=""/> - <suffix name="Help" label=""/> - <suffix name="Tray" label=""/> - <affected-histogram name="CrosFirstRun.TimeSpentOnStep"/> -</histogram_suffixes> - <histogram_suffixes name="CrosNotificationActions" separator="."> <suffix name="CountOfNotificationShownInFirstMinutePerUser" label="Count of notifications displayed in the first minute since login @@ -7103,23 +7095,6 @@ <affected-histogram name="Media.MSE.CodecChangeTime"/> </histogram_suffixes> -<histogram_suffixes name="MediaTimelineWidths" separator="."> - <obsolete> - Deprecated as of 2020/10. - </obsolete> - <suffix name="32_47" label=""/> - <suffix name="48_79" label=""/> - <suffix name="80_127" label=""/> - <suffix name="128_255" label=""/> - <suffix name="256_511" label=""/> - <suffix name="512_inf" label=""/> - <affected-histogram name="Media.Timeline.DragGestureDuration"/> - <affected-histogram name="Media.Timeline.DragPercent"/> - <affected-histogram name="Media.Timeline.DragSumAbsTimeDelta"/> - <affected-histogram name="Media.Timeline.DragTimeDelta"/> - <affected-histogram name="Media.Timeline.SeekType"/> -</histogram_suffixes> - <histogram_suffixes name="MediaVideoCaptureManagerTime" separator="."> <suffix name="GetAvailableDevicesInfoOnDeviceThreadTime" label="Measures the time taken to enumerate devices and their
diff --git a/tools/metrics/histograms/metadata/history/histograms.xml b/tools/metrics/histograms/metadata/history/histograms.xml index b5f2326..0f57157 100644 --- a/tools/metrics/histograms/metadata/history/histograms.xml +++ b/tools/metrics/histograms/metadata/history/histograms.xml
@@ -338,19 +338,6 @@ </summary> </histogram> -<histogram name="History.ClearBrowsingData.TimeSpentInDialog" units="ms" - expires_after="M85"> - <obsolete> - Removed 12/2020 - </obsolete> - <owner>dullweber@chromium.org</owner> - <owner>msramek@chromium.org</owner> - <summary> - Time spent in Clear Browsing Data dialog. From opening the dialog until data - is cleared. This does not record users who exit the dialog without clearing. - </summary> -</histogram> - <histogram name="History.ClearBrowsingData.UserDeletedCookieOrCache" enum="CookieOrCacheDeletion" expires_after="never"> <!-- expires-never: tracked as an important privacy metric. --> @@ -775,48 +762,6 @@ </summary> </histogram> -<histogram name="History.DomainCount1Day" units="domains" - expires_after="2022-06-19"> - <obsolete> - Replaced in M99 by History.DomainCount1Day_V2, which limits the metric - recording to regular profiles. - </obsolete> - <owner>mpearson@chromium.org</owner> - <owner>mjzhang@chromium.org</owner> - <owner>chrome-analysis-team@google.com</owner> - <summary> - Number of unique domains visited by the user within a calendar day in user's - local timezone. For each profile, reported at profile open (which usually - happens at startup) for each unreported day (up to 7 days) prior to the - current date, and also reported once every 24 hours thereafter for the - latest unreported day, while the profile remains open. If no domains are - visited in a given day, a count of 0 will be reported for that day. - - Warning: this histogram is logged incorrectly on ChromeOS. See - http://crbug.com/1237591 - - Warning about delayed data: Chrome may upload logs on a given day without - uploading this histogram. This can happen because Chrome uploads logs - initially upon startup. This histogram is emitted shortly _after_ startup. - In the case of short sessions, it's possible the log with this histogram did - not have time to be uploaded. Generally the log will be cached and uploaded - the next time the user starts Chrome. We should still get one count per - calendar day; it simply may not be on the day the metric was computed. - (Exception: on Android before M-91, sometimes these emitted histograms were - lost due to lack of robust "background logging".) - - Note: for users syncing between multiple devices, this count may include - some URLs/domains that weren't visited on this device. In other words, some - domains may be counted for multiple client_ids even though they were only - visited once, on one device. However, at this time (Feb 2020), only URLs - navigated to via the omnibox ("typed URLs") are synced, not all - visited URLs. There are no plans to change this behavior. As such, because - the mis-counting only occurs for users who are syncing across multiple - devices and only for a subset of visited URLs, the effect of double-counting - is likely to be small. - </summary> -</histogram> - <histogram name="History.DomainCount1Day_V2" units="domains" expires_after="2022-06-19"> <owner>mpearson@chromium.org</owner> @@ -853,49 +798,6 @@ </summary> </histogram> -<histogram name="History.DomainCount28Day" units="domains" - expires_after="2022-06-19"> - <obsolete> - Replaced in M99 by History.DomainCount28Day_V2, which limits the metric - recording to regular profiles. - </obsolete> - <owner>mpearson@chromium.org</owner> - <owner>mjzhang@chromium.org</owner> - <owner>chrome-analysis-team@google.com</owner> - <summary> - Number of unique domains visited by the user within a 28 calendar day period - in user's local timezone. For each profile, reported at profile open (which - usually happens at startup) for each unreported 28-day period (up to 7 - periods) ending on the current day, current day - 1, current day - 2, etc. - Also reported once every 24 hours thereafter for the latest unreported - period, while the profile remains open. If no domains are visited during a - 28-day period, a count of 0 will be reported for that period. - - Warning: this histogram is logged incorrectly on ChromeOS. See - http://crbug.com/1237591 - - Warning about delayed data: Chrome may upload logs on a given day without - uploading this histogram. This can happen because Chrome uploads logs - initially upon startup. This histogram is emitted shortly _after_ startup. - In the case of short sessions, it's possible the log with this histogram did - not have time to be uploaded. Generally the log will be cached and uploaded - the next time the user starts Chrome. We should still get one count per - calendar day; it simply may not be on the day the metric was computed. - (Exception: on Android before M-91, sometimes these emitted histograms were - lost due to lack of robust "background logging".) - - Note: for users syncing between multiple devices, this count may include - some URLs/domains that weren't visited on this device. In other words, some - domains may be counted for multiple client_ids even though they were only - visited once, on one device. However, at this time (Feb 2020), only URLs - navigated to via the omnibox ("typed URLs") are synced, not all - visited URLs. There are no plans to change this behavior. As such, because - the mis-counting only occurs for users who are syncing across multiple - devices and only for a subset of visited URLs, the effect of double-counting - is likely to be small. - </summary> -</histogram> - <histogram name="History.DomainCount28Day_V2" units="domains" expires_after="2022-06-19"> <owner>mpearson@chromium.org</owner> @@ -933,49 +835,6 @@ </summary> </histogram> -<histogram name="History.DomainCount7Day" units="domains" - expires_after="2022-06-19"> - <obsolete> - Replaced in M99 by History.DomainCount7Day_V2, which limits the metric - recording to regular profiles. - </obsolete> - <owner>mpearson@chromium.org</owner> - <owner>mjzhang@chromium.org</owner> - <owner>chrome-analysis-team@google.com</owner> - <summary> - Number of unique domains visited by the user within a 7 calendar day period - in user's local timezone. For each profile, reported at profile open (which - usually happens at startup) for each unreported 7-day period (up to 7 - periods) ending on the current day, current day - 1, current day - 2, etc. - Also reported once every 24 hours thereafter for the latest unreported - period, while the profile remains open. If no domains are visited during a - 7-day period, a count 0 will be reported for that period. - - Warning: this histogram is logged incorrectly on ChromeOS. See - http://crbug.com/1237591 - - Warning about delayed data: Chrome may upload logs on a given day without - uploading this histogram. This can happen because Chrome uploads logs - initially upon startup. This histogram is emitted shortly _after_ startup. - In the case of short sessions, it's possible the log with this histogram did - not have time to be uploaded. Generally the log will be cached and uploaded - the next time the user starts Chrome. We should still get one count per - calendar day; it simply may not be on the day the metric was computed. - (Exception: on Android before M-91, sometimes these emitted histograms were - lost due to lack of robust "background logging".) - - Note: for users syncing between multiple devices, this count may include - some URLs/domains that weren't visited on this device. In other words, some - domains may be counted for multiple client_ids even though they were only - visited once, on one device. However, at this time (Feb 2020), only URLs - navigated to via the omnibox ("typed URLs") are synced, not all - visited URLs. There are no plans to change this behavior. As such, because - the mis-counting only occurs for users who are syncing across multiple - devices and only for a subset of visited URLs, the effect of double-counting - is likely to be small. - </summary> -</histogram> - <histogram name="History.DomainCount7Day_V2" units="domains" expires_after="2022-06-19"> <owner>mpearson@chromium.org</owner> @@ -1013,26 +872,6 @@ </summary> </histogram> -<histogram name="History.DomainCountQueryTime" units="ms" - expires_after="2022-02-20"> - <obsolete> - Replaced in M99 by History.DomainCountQueryTime_V2, which limits the metric - recording to regular profiles. - </obsolete> - <owner>mpearson@chromium.org</owner> - <owner>mjzhang@chromium.org</owner> - <owner>chrome-analysis-team@google.com</owner> - <summary> - Time spent on a scheduled computation task of domain visit counts. Each such - task computes a number of (at least 1 and up to 7) sets of domain counts, - where each set includes 3 results, for a 1-day, 7-day and 28-day period - respectively. Note that for each computation task, only one query time is - reported which covers the entire duration of the task. A task is scheduled - once per profile at startup and every 24 hours per profile thereafter while - the profile remains open. - </summary> -</histogram> - <histogram name="History.DomainCountQueryTime_V2" units="ms" expires_after="2022-06-19"> <owner>mpearson@chromium.org</owner> @@ -1174,24 +1013,6 @@ </summary> </histogram> -<histogram name="History.InMemoryDBPopulate" units="ms" - expires_after="2022-07-30"> - <obsolete> - Removed August 2021 because it was not meaningful. It did not seem to - reflect anything about the user experience or about contention in the - system; it moved in unexpected ways. - </obsolete> - <owner>sky@chromium.org</owner> - <owner>mpearson@chromium.org</owner> - <summary> - The time it takes to read the typed URLs from the main history database into - the "in memory" history database. This in memory copy of the typed - URLs is used for synchronous inline autocomplete on the UI thread, while the - larger slower service is run off of disk on a background thread. Recorded on - profile open. - </summary> -</histogram> - <histogram name="History.InMemoryURLHistoryItems" units="items" expires_after="2022-06-12"> <owner>mpearson@chromium.org</owner> @@ -1285,19 +1106,6 @@ </summary> </histogram> -<histogram name="History.MonthlyVisitCount" units="visits" - expires_after="2021-10-04"> - <obsolete> - Removed September 2021. - </obsolete> - <owner>mpearson@chromium.org</owner> - <owner>sky@chromium.org</owner> - <summary> - Number of rows in History visits table with visit times in the last 30 days. - Metrics are logged on initialization of the History DB on 1% of starts. - </summary> -</histogram> - <histogram name="History.NumFaviconBitmapsInDB" units="units" expires_after="M77"> <owner>rogerm@chromium.org</owner> @@ -1452,19 +1260,6 @@ </summary> </histogram> -<histogram name="History.WeeklyVisitCount" units="visits" - expires_after="2021-10-04"> - <obsolete> - Removed September 2021. - </obsolete> - <owner>mpearson@chromium.org</owner> - <owner>sky@chromium.org</owner> - <summary> - Number of rows in History visits table with visit times in the last 7 days. - Metrics are logged on initialization of the History DB on 1% of starts. - </summary> -</histogram> - <histogram name="HistoryPage.ClickAgeInDays" units="units" expires_after="2020-02-29"> <owner>msramek@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/invalidation/histograms.xml b/tools/metrics/histograms/metadata/invalidation/histograms.xml index 53bbeee..612215d43 100644 --- a/tools/metrics/histograms/metadata/invalidation/histograms.xml +++ b/tools/metrics/histograms/metadata/invalidation/histograms.xml
@@ -23,21 +23,6 @@ <histograms> -<histogram name="DeprecatedInvalidatorRegistrar.CrashStatus" - enum="HandlerOwnerType" expires_after="M75"> - <obsolete> - Expired in M75. - </obsolete> - <owner>melandory@chromium.org</owner> - <summary> - DeprecatedInvlalidatorRegistrar is crashing on the browser shut down. The - reason for the crash is that not all invalidation handlers de-registister - themselves. Histogram records the type of the handler which hasn't - unregistered itself. Analyzing the histogram will allow us to understand, - which handlers are causing the crash. - </summary> -</histogram> - <histogram name="FCMInvalidations.FailedSubscriptionsErrorCode" enum="NetErrorCodes" expires_after="never"> <!-- expires-never: For monitoring FCM based invalidations. --> @@ -79,19 +64,6 @@ </summary> </histogram> -<histogram name="FCMInvalidations.ResetClientIDStatus" enum="InstanceIDResult" - expires_after="2020-10-19"> - <obsolete> - Removed 2020-10. - </obsolete> - <owner>tschumann@chromium.org</owner> - <owner>treib@chromium.org</owner> - <summary> - Status of resetting the client instance ID, which includes unregistering - from FCM servers. - </summary> -</histogram> - <histogram name="FCMInvalidations.SubscriptionRequestStatus" enum="FCMInvalidationSubscriptionStatus" expires_after="never"> <!-- expires-never: For monitoring FCM based invalidations. --> @@ -151,18 +123,6 @@ </summary> </histogram> -<histogram name="Invalidations.StatusChanged" enum="InvalidatorState" - expires_after="M85"> - <obsolete> - Expired in M85. - </obsolete> - <owner>melandory@chromium.org</owner> - <summary> - Status of the invalidation component. The metric is recorded on startup - unless invalidations are disabled, plus when the state changes. - </summary> -</histogram> - </histograms> </histogram-configuration>
diff --git a/tools/metrics/histograms/metadata/ios/histograms.xml b/tools/metrics/histograms/metadata/ios/histograms.xml index d51d2448..4e81c9e1 100644 --- a/tools/metrics/histograms/metadata/ios/histograms.xml +++ b/tools/metrics/histograms/metadata/ios/histograms.xml
@@ -294,25 +294,6 @@ </summary> </histogram> -<histogram name="IOS.CriticalActionBackgroundTimeRemaining" units="ms" - expires_after="2021-05-30"> - <obsolete> - Recording removed 12/2020. - </obsolete> - <owner>justincohen@chromium.org</owner> - <summary> - Recorded when app is running in the background and posted a background task. - This time is obtained by calling UIApplication.backgroundTimeRemaining. When - backgroundTimeRemaining reaches 0 and there is at least one running - background task, then iOS terminates the app instead of suspending it. The - lower recorded value is, the higher chances that posted task will keep - running when backgroundTimeRemaining reaches 0, causing the app termination. - When app is relaunched after termination the app starts cold which is slower - and does not fully restore the prior UI state, so terminations are worse - than suspensions. - </summary> -</histogram> - <histogram name="IOS.CRWWKNavigationStatesRemoveOldPending" enum="Boolean" expires_after="2022-12-11"> <owner>justincohen@chromium.org</owner> @@ -440,29 +421,6 @@ </token> </histogram> -<histogram name="IOS.Dialogs.JavaScriptDialogClosed" - enum="IOSJavaScriptDialogDismissalCause" expires_after="M80"> - <obsolete> - Deprecated 07/2021 as it is no longer used for analysis. - </obsolete> - <owner>kkhorimoto@chromium.org</owner> - <owner>michaeldo@chromium.org</owner> - <summary>Tracks the way JavaScript dialogs are closed on iOS.</summary> -</histogram> - -<histogram name="IOS.DragAndDrop.DragContent" enum="DragContent" - expires_after="2020-03-01"> - <obsolete> - Removed 12/2020 as it is no longer needed for analysis. - </obsolete> - <owner>jif@chromium.org</owner> - <summary> - The type of content that the user is dragging into Chrome. Because a drag - can contain multiple types of objects, multiple DragContent values may be - recorded for a single drag event. - </summary> -</histogram> - <histogram name="IOS.EnterTabSwitcherSnapshotResult" enum="EnterTabSwitcherSnapshotResult" expires_after="2021-08-01"> <owner>edchin@chromium.org</owner> @@ -668,17 +626,6 @@ </summary> </histogram> -<histogram name="IOS.IPHBubbleDismissalReason" enum="BubbleDismissalReason" - expires_after="M77"> - <obsolete> - Deprecated 12/2020 as it is no longer used for analysis. - </obsolete> - <owner>pkl@chromium.org</owner> - <summary> - Tracks the reason for why the In Product Help bubble was dismissed. - </summary> -</histogram> - <histogram name="IOS.IsDefaultBrowser" enum="Boolean" expires_after="never"> <!-- expires-never: used internally for filtering --> @@ -747,32 +694,6 @@ </summary> </histogram> -<histogram name="IOS.LocationPermissions.FirstRunModal.Interaction" - enum="LocationPermissionsFirstRunModalIOSEnum" expires_after="M97"> - <obsolete> - Deprecated 10/2021 as it was removed - </obsolete> - <owner>thegreenfrog@chromium.org</owner> - <owner>rohitrao@chromium.org</owner> - <summary> - The user engagement of the Location permissions first run modal. - </summary> -</histogram> - -<histogram name="IOS.LocationPermissionsUI" enum="LocationPermissionsIOSUI" - expires_after="M96"> - <obsolete> - Deprecated 09/2021 as it is launched - </obsolete> - <owner>thegreenfrog@chromium.org</owner> - <owner>rohitrao@chromium.org</owner> - <summary> - The user was shown an arm of the location permissions experiment. Recorded - when the user is shown the UI of an experiment arm. Not recorded for the - control arm. - </summary> -</histogram> - <histogram name="IOS.MainThreadFreezeDetection.HangWithCleanExit" enum="Boolean" expires_after="2022-09-12"> <owner>justincohen@chromium.org</owner> @@ -1297,17 +1218,6 @@ </summary> </histogram> -<histogram name="IOS.SharePageLatency" units="ms" expires_after="M77"> - <obsolete> - Deprecated 12/2020 as it is no longer used for analysis. - </obsolete> - <owner>pkl@chromium.org</owner> - <summary> - The latency in milliseconds between the start of the Share Page operation - and when the UI is ready to be presented. - </summary> -</histogram> - <histogram name="IOS.SiriShortcuts.Count" units="shortcuts" expires_after="2023-02-06"> <owner>gujen@google.com</owner> @@ -1577,18 +1487,6 @@ </summary> </histogram> -<histogram name="IOS.WKWebViewLinkPreview" enum="IOSWKWebViewLinkPreviewAction" - expires_after="M73"> - <obsolete> - Deprecated 12/2020 as it is no longer used for analysis. - </obsolete> - <owner>kkhorimoto@chromium.org</owner> - <owner>pkl@chromium.org</owner> - <summary> - Records the user actions related to the WKWebView 3D touch link preview API. - </summary> -</histogram> - <histogram name="ManualFallback.PresentedOptions.AllPasswords" units="Credentials" expires_after="2022-12-11"> <owner>djean@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/media/histograms.xml b/tools/metrics/histograms/metadata/media/histograms.xml index 62d73f9..3ba028b 100644 --- a/tools/metrics/histograms/metadata/media/histograms.xml +++ b/tools/metrics/histograms/metadata/media/histograms.xml
@@ -76,22 +76,6 @@ </summary> </histogram> -<histogram name="Media.Android.BackgroundVideoTime" units="ms" - expires_after="2020-04-05"> - <obsolete> - Removed as of 2021/02. - </obsolete> - <owner>mlamouri@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Android-specific metric. The time between the moment the backgrounded video - playback is started (meaning the user just resumed the backgrounded video - allowing playback) and the moment it stops being background playback by the - current playing video either going foreground or being paused by the user. - Note: on Android, videos are suspended when backgrounded. - </summary> -</histogram> - <histogram name="Media.Android.BecomingNoisy" enum="Boolean" expires_after="2022-07-01"> <owner>liberato@chromium.org</owner> @@ -428,22 +412,6 @@ </summary> </histogram> -<histogram name="Media.Audio.Capture.Win.MonotonicTimestamps" - enum="BooleanSuccess" expires_after="2021-10-08"> - <obsolete> - Removed as of 2021-09-30. - </obsolete> - <owner>henrika@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Each audio frame which is recorded when an audio input stream is active also - comes with a timestamp. By design, the sequcence of timestamps should be - monotonic. This metric should therefore always result in 'Success', hence - 'Failure' should never happen and is seen as an error that must be fixed. - This value is logged when an audio input stream is closed on Windows. - </summary> -</histogram> - <histogram name="Media.Audio.Capture.Win.Open" enum="AudioStreamOpenResult" expires_after="2022-06-12"> <owner>gudiou@chromium.org</owner> @@ -453,37 +421,6 @@ </summary> </histogram> -<histogram name="Media.Audio.Capture.Win.TimestampErrors" units="errors" - expires_after="2021-10-08"> - <obsolete> - Removed as of 2021-09-30. - </obsolete> - <owner>henrika@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - The number of timestamp errors that were detected at the OS level while an - audio input stream was active. A timestamp error in this case corresponds to - a certain error code from the IAudioCaptureClient::GetBuffer() API: - AUDCLNT_BUFFERFLAGS_TIMESTAMP_ERROR. This value is logged when an audio - input stream is closed on Windows. - </summary> -</histogram> - -<histogram name="Media.Audio.Capture.Win.TimeUntilFirstTimestampError" - units="ms" expires_after="2021-10-08"> - <obsolete> - Removed as of 2021-09-30. - </obsolete> - <owner>henrika@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - The time from the start of an input audio stream until the first timestamp - error is detected. Logged once when the input stream stops but only if at - least one error was detected. Only implemented on Windows. See - Media.Audio.Capture.Win.TimestampErrors for more details. - </summary> -</histogram> - <histogram name="Media.Audio.Capture.Win.VolumeRangeAvailable" enum="BooleanAvailable" expires_after="2021-09-30"> <owner>alessiob@chromium.org</owner> @@ -495,20 +432,6 @@ </summary> </histogram> -<histogram name="Media.Audio.Capture.Win.VolumeRangeMax" units="dB" - expires_after="2021-09-30"> - <obsolete> - Removed as of 2021-05-07. - </obsolete> - <owner>alessiob@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Volume range maximum for the audio capture stream on Windows. Only uploaded - when volume range information is available and when analog AGC is enabled - - i.e., for WebRTC-based audio input streams. - </summary> -</histogram> - <histogram name="Media.Audio.Capture.Win.VolumeRangeMax2" units="dB" expires_after="2021-09-30"> <owner>alessiob@chromium.org</owner> @@ -521,20 +444,6 @@ </summary> </histogram> -<histogram name="Media.Audio.Capture.Win.VolumeRangeMin" units="dB" - expires_after="2021-09-30"> - <obsolete> - Removed as of 2021-05-07. - </obsolete> - <owner>alessiob@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Volume range minimum for the audio capture stream on Windows. Only uploaded - when volume range information is available and when analog AGC is enabled - - i.e., for WebRTC-based audio input streams. - </summary> -</histogram> - <histogram name="Media.Audio.Capture.Win.VolumeRangeMin2" units="dB" expires_after="2021-09-30"> <owner>alessiob@chromium.org</owner> @@ -1835,19 +1744,6 @@ </summary> </histogram> -<histogram name="Media.D3D11.AV1Status" enum="MediaStatusCode" - expires_after="2021-06-13"> - <obsolete> - Deprecated as of 2021/10. - </obsolete> - <owner>liberato@chromium.org</owner> - <owner>tmathmeyer@chromium.org</owner> - <summary> - This records the media::StatusCode from the AV1 accelerator. It is emitted - when the accelerator encounters an error during decoding. - </summary> -</histogram> - <histogram name="Media.D3D11.DecoderLifetimeProgression" enum="D3D11LifetimeProgression" expires_after="2022-07-03"> <owner>liberato@chromium.org</owner> @@ -1859,19 +1755,6 @@ </summary> </histogram> -<histogram name="Media.D3D11.H264Status" enum="MediaStatusCode" - expires_after="2022-05-01"> - <obsolete> - Deprecated as of 2021/10. - </obsolete> - <owner>liberato@chromium.org</owner> - <owner>tmathmeyer@chromium.org</owner> - <summary> - This records the media::StatusCode from the H264 accelerator. It is emitted - when the accelerator encounters an error during decoding. - </summary> -</histogram> - <histogram name="Media.D3D11.NotifyErrorStatus" enum="MediaStatusCode" expires_after="2022-06-26"> <owner>liberato@chromium.org</owner> @@ -1884,33 +1767,6 @@ </summary> </histogram> -<histogram name="Media.D3D11.VP9Status" enum="MediaStatusCode" - expires_after="2022-01-02"> - <obsolete> - Deprecated as of 2021/10. - </obsolete> - <owner>liberato@chromium.org</owner> - <owner>tmathmeyer@chromium.org</owner> - <summary> - This records the media::StatusCode from the VP9 accelerator. It is emitted - when the accelerator encounters an error during decoding. - </summary> -</histogram> - -<histogram name="Media.D3D11.WasVideoSupported" - enum="D3D11VideoNotSupportedReason" expires_after="2021-12-19"> - <obsolete> - Deprecated as of 2021/12. - </obsolete> - <owner>liberato@chromium.org</owner> - <owner>sandersd@chromium.org</owner> - <owner>tmathmeyer@chromium.org</owner> - <summary> - This enum measures whether or not d3d11 is supported and if not, what the - reason is. - </summary> -</histogram> - <histogram name="Media.DetectedAudioCodecHash" enum="FFmpegCodecHashes" expires_after="never"> <!-- expires-never: Codec support planning metric. --> @@ -2168,20 +2024,6 @@ </summary> </histogram> -<histogram name="Media.EME.MaxCdmProcessCount" units="processes" - expires_after="2022-05-07"> - <obsolete> - Deprecated as of 2021/04. - </obsolete> - <owner>xhwang@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Reported at most once during browser process shutdown the max number of - concurrent CDM processes at any time during the lifetime of that browser - process. Will NOT be reported if no CDM process has ever been created. - </summary> -</histogram> - <histogram name="Media.EME.MediaCryptoAvailable" enum="BooleanAvailable" expires_after="2022-05-07"> <owner>xhwang@chromium.org</owner> @@ -2355,17 +2197,6 @@ <token key="KeySystem" variants="KeySystemWithRobustness"/> </histogram> -<histogram name="Media.EME.{KeySystem}.CreateSession" enum="EmeSessionType" - expires_after="2022-05-07"> - <obsolete> - Replaced by GenerateRequest on 2015-01. - </obsolete> - <owner>xhwang@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary>Result of EME CreateSesson promise.</summary> - <token key="KeySystem" variants="KeySystem"/> -</histogram> - <histogram name="Media.EME.{KeySystem}.CreateSession.SessionType" enum="EmeSessionType" expires_after="2022-05-07"> <owner>xhwang@chromium.org</owner> @@ -2527,72 +2358,6 @@ </summary> </histogram> -<histogram name="Media.Feeds.AggregateWatchtime" units="ms" - expires_after="2021-08-09"> - <obsolete> - Removed in M91. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Records the aggregate watchtime for all Media Feeds on startup. The - aggregate watchtime is the total watchtime for a website recorded across - sessions. It is also cleared every 90 days. - </summary> -</histogram> - -<histogram name="Media.Feeds.Feed.ReadResult" enum="MediaFeedReadResult" - expires_after="2021-08-09"> - <obsolete> - Removed in M91. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded when a Media Feed is loaded from the database. If there was an - error reading from the database then the result will include the reason. - </summary> -</histogram> - -<histogram name="Media.Feeds.FeedItem.ReadResult" - enum="MediaFeedItemReadResult" expires_after="2021-05-09"> - <obsolete> - Removed in M91. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded when a Media Feed item is loaded from the database. If there was an - error reading from the database then the result will include the reason. - </summary> -</histogram> - -<histogram name="Media.Feeds.Fetch.Size" units="KB" expires_after="2021-05-09"> - <obsolete> - Removed in M91. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Records the size of the fetched feed when a Media Feed is periodically - fetched in the background. - </summary> -</histogram> - -<histogram name="Media.Feeds.SafeSearch.Result" - enum="MediaFeedSafeSearchResult" expires_after="2021-05-09"> - <obsolete> - Removed in M91. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded when a Media Feed Item is checked against Safe Search. This happens - automatically when Chrome fetches the feed so long as the user has opted - into Safe Search checking. - </summary> -</histogram> - <histogram name="Media.GlobalMediaControls.DeviceSelectorAvailable" enum="Boolean" expires_after="2022-08-01"> <owner>steimel@chromium.org</owner> @@ -2915,101 +2680,6 @@ </summary> </histogram> -<histogram name="Media.Kaleidoscope.DialogClosed" - enum="KaleidoscopeDialogClosedBoolean" expires_after="2021-08-19"> - <obsolete> - Deprecated as of 2020/12. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded each time a user closes a dialog inside Kaleidoscope with whether - the user opened a watch action from that dialog. - </summary> -</histogram> - -<histogram name="Media.Kaleidoscope.FirstRunProgress" - enum="KaleidoscopeFirstRunProgress" expires_after="2021-08-19"> - <obsolete> - Deprecated as of 2020/12. - </obsolete> - <owner>steimel@chromium.org</owner> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded each time the Kaleidoscope First Run Experience is shown when - either the tab is closed or the FRE is completed. Records how far into the - FRE the user got before exiting (or completing). - </summary> -</histogram> - -<histogram name="Media.Kaleidoscope.Navigation" enum="KaleidoscopeNavigation" - expires_after="2021-08-19"> - <obsolete> - Deprecated as of 2020/12. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded each time a user selects a media recommendation inside Kaleidoscope - and this triggers a navigation to a media partner's site. - </summary> -</histogram> - -<histogram name="Media.Kaleidoscope.NewTabPage.CacheHitWhenForced" - enum="KaleidoscopeCacheHit" expires_after="2021-08-19"> - <obsolete> - Deprecated as of 2020/12. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded each time the Kaleidoscope module is loaded on the New Tab Page - with whether the data was loaded from the server or whether it hit the - cache. - </summary> -</histogram> - -<histogram name="Media.Kaleidoscope.NewTabPage.ServerFetchTime" units="ms" - expires_after="2021-08-19"> - <obsolete> - Deprecated as of 2020/12. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded each time the Kaleidoscope module is loaded on the New Tab Page - with the time it takes to fetch the data from the server. - </summary> -</histogram> - -<histogram name="Media.Kaleidoscope.OpenedMediaRecommendation" enum="Boolean" - expires_after="2021-08-19"> - <obsolete> - Deprecated as of 2020/12. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded each time that Kaleidoscope is closed with whether the user opened - a media recommendation from Kaleidoscope during that session. - </summary> -</histogram> - -<histogram name="Media.Kaleidoscope.TimeTakenToStartWatch" units="ms" - expires_after="2021-08-19"> - <obsolete> - Deprecated as of 2020/12. - </obsolete> - <owner>beccahughes@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Recorded the first time in a Kaleidoscope session a user selects a watch - action in Kaleidoscope with the time taken from loading the page to the user - clicking on the watch action. - </summary> -</histogram> - <histogram base="true" name="Media.Learning.BinaryThreshold.Aggregate" enum="ConfusionMatrix" expires_after="2019-10-30"> <!-- Name completed by histogram_suffixes @@ -3084,17 +2754,6 @@ </summary> </histogram> -<histogram name="Media.LinuxAudioIO" enum="LinuxAudioIO" - expires_after="2021-10-25"> - <obsolete> - Deprecated as of 2021/09. - </obsolete> - <owner>dalecurtis@chromium.org</owner> - <summary> - Audio IO layer used by the Linux OS, sampled once at startup of the browser. - </summary> -</histogram> - <histogram name="Media.LoadType" enum="MediaLoadType" expires_after="2022-05-07"> <owner>xhwang@chromium.org</owner> @@ -3703,18 +3362,6 @@ </summary> </histogram> -<histogram name="Media.Pepper.PlayedSound" enum="Boolean" - expires_after="2021-03-01"> - <obsolete> - Deprecated as of 2021/01. - </obsolete> - <owner>mlamouri@google.com</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Whether Pepper players have played sound through its lifetime. - </summary> -</histogram> - <histogram name="Media.PepperVideoDecoderError" enum="VideoDecodeAcceleratorError" expires_after="M77"> <owner>ihf@chromium.org</owner> @@ -4390,94 +4037,6 @@ </summary> </histogram> -<histogram base="true" name="Media.Timeline.DragGestureDuration" units="ms" - expires_after="2020-10-23"> - <obsolete> - Deprecated as of 2020/10. - </obsolete> -<!-- Name completed by histogram_suffixes name="MediaTimelineWidths" --> - - <owner>mlamouri@google.com</owner> - <owner>media-dev@chromium.org</owner> - <summary> - The duration of the user gesture (how long their finger is down), recorded - at the end of each drag gesture. This histogram is split according to the - width of the slider track in CSS px - see histogram name suffix. - </summary> -</histogram> - -<histogram base="true" name="Media.Timeline.DragPercent" - enum="MediaTimelinePercent" expires_after="2020-10-23"> - <obsolete> - Deprecated as of 2020/10. - </obsolete> -<!-- Name completed by histogram_suffixes name="MediaTimelineWidths" --> - - <owner>mlamouri@google.com</owner> - <owner>media-dev@chromium.org</owner> - <summary> - The net distance the media scrubber moved, recorded at the end of each drag - gesture, as a percentage of the width of the slider track. This histogram is - split according to the width of the slider track in CSS px - see histogram - name suffix. - </summary> -</histogram> - -<histogram base="true" name="Media.Timeline.DragSumAbsTimeDelta" - enum="MediaTimelineAbsTimeDelta" expires_after="2020-10-23"> - <obsolete> - Deprecated as of 2020/10. - </obsolete> -<!-- Name completed by histogram_suffixes name="MediaTimelineWidths" --> - - <owner>mlamouri@google.com</owner> - <owner>media-dev@chromium.org</owner> - <summary> - The sum of absolute distances the media scrubber incrementally moved, - recorded at the end of each drag gesture, each measured as the change in - media current time. If the scrubber was dragged back and forth before being - released, this will be larger than the value recorded for - Media.Timeline.DragTimeDelta (and may even be larger than the media - duration), otherwise it will be the same as DragTimeDelta. This histogram is - split according to the width of the slider track in CSS px - see histogram - name suffix. - </summary> -</histogram> - -<histogram base="true" name="Media.Timeline.DragTimeDelta" - enum="MediaTimelineTimeDelta" expires_after="2020-10-23"> - <obsolete> - Deprecated as of 2020/10. - </obsolete> -<!-- Name completed by histogram_suffixes name="MediaTimelineWidths" --> - - <owner>mlamouri@google.com</owner> - <owner>media-dev@chromium.org</owner> - <summary> - The net distance the media scrubber moved, recorded at the end of each drag - gesture, measured as the change in media current time. This histogram is - split according to the width of the slider track in CSS px - see histogram - name suffix. - </summary> -</histogram> - -<histogram base="true" name="Media.Timeline.SeekType" - enum="MediaTimelineSeekType" expires_after="2020-10-23"> - <obsolete> - Deprecated as of 2020/10. - </obsolete> -<!-- Name completed by histogram_suffixes name="MediaTimelineWidths" --> - - <owner>mlamouri@google.com</owner> - <owner>media-dev@chromium.org</owner> - <summary> - The type of user gesture, recorded at the end of each input sequence. For - example holding down the right arrow key with the scrubber focused will only - be logged as a single event. This histogram is split according to the width - of the slider track in CSS px - see histogram name suffix. - </summary> -</histogram> - <histogram base="true" name="Media.TimeToFirstFrame" units="ms" expires_after="never"> <!-- expires-never: Media pipeline health metric. --> @@ -4521,23 +4080,6 @@ <summary>Size of HTML5 media (when known), in MB.</summary> </histogram> -<histogram - name="Media.Ui.GetCurrentBrowsingContextMedia.ExplicitSelection.UserInteraction" - enum="GetCurrentBrowsingContextMediaExplicitSelectionUserInteraction" - expires_after="2022-01-01"> - <obsolete> - Removed in July 2021. - </obsolete> - <owner>eladalon@chromium.org</owner> - <owner>guidou@chromium.org</owner> - <owner>agpalak@chromium.org</owner> - <summary> - Records the result of the user's interaction with the media picker dialog - which is displayed following a call to getCurrentBrowsingContextMedia. This - histogram refers to the explicit-selection variant of the dialog. - </summary> -</histogram> - <histogram name="Media.Ui.GetDisplayMedia.DisplayCapturePolicyResult" enum="DisplayCapturePolicyResult" expires_after="2022-06-21"> <owner>eladalon@chromium.org</owner> @@ -4665,16 +4207,6 @@ </summary> </histogram> -<histogram name="Media.Video.Autoplay.Muted" enum="AutoplaySource" - expires_after="2021-06-01"> - <obsolete> - Removed in May 2021. - </obsolete> - <owner>dalecurtis@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary>Records the autoplay source of muted videos.</summary> -</histogram> - <histogram name="Media.Video.Autoplay.Muted.PlayMethod.BecomesVisible" enum="Boolean" expires_after="2022-06-26"> <owner>dalecurtis@chromium.org</owner> @@ -5166,19 +4698,6 @@ </summary> </histogram> -<histogram name="Media.VideoCaptureManager.Event" enum="VideoCaptureEvent" - expires_after="M82"> - <obsolete> - Expired in M82. - </obsolete> - <owner>chfremer@chromium.org</owner> - <owner>mcasas@chromium.org</owner> - <summary> - Counts video capture event, such as start and stop capture. Note that the - ideal case is 50% start events and 50% normal stop events. - </summary> -</histogram> - <histogram name="Media.VideoCaptureService.DurationFromLastConnectToClosingConnectionAfterCapture" units="ms" expires_after="M78"> @@ -5393,14 +4912,6 @@ </summary> </histogram> -<histogram name="Media.VideoRotation" enum="VideoRotation" expires_after="M79"> - <obsolete> - Went untouched since M79. Removed as of 11/21. - </obsolete> - <owner>dalecurtis@chromium.org</owner> - <summary>Metadata rotation in mp4 videos. Emitted during demuxing.</summary> -</histogram> - <histogram name="Media.VirtualAudioCaptureStartupSuccess" enum="AudioCaptureStartupResult" expires_after="2020-10-01"> <owner>armax@chromium.org</owner> @@ -5422,20 +4933,6 @@ </summary> </histogram> -<histogram name="Media.VTVDA.InitializationFailureReason" - enum="VTVDAInitializationFailureType" expires_after="2021-08-01"> - <obsolete> - No longer recorded. - </obsolete> - <owner>sandersd@chromium.org</owner> - <owner>media-dev@chromium.org</owner> - <summary> - Count of VideoToolbox initialization failure reasons. Successful - initializations are counted as a special failure type. The sum of successes - and failures gives a lower bound on the number of attempted initializations. - </summary> -</histogram> - <histogram name="Media.VTVDA.SessionFailureReason" enum="VTVDASessionFailureType" expires_after="2022-12-01"> <owner>sandersd@chromium.org</owner> @@ -5830,20 +5327,6 @@ </summary> </histogram> -<histogram name="MediaRouter.CastStreaming.Start.Failure" - enum="MirrorFailureType" expires_after="2021-08-09"> - <obsolete> - Unused after August 2021. - </obsolete> - <owner>takumif@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - Whenever a Cast Streaming session fails to start, record the error - associated with the event. This is recorded only for the extension Cast MRP. - See MediaRouter.CastStreaming.Start.Failure.Native for the native MRP. - </summary> -</histogram> - <histogram name="MediaRouter.CastStreaming.Start.Failure.Native" enum="MirroringServiceErrorType" expires_after="2022-07-11"> <owner>takumif@chromium.org</owner> @@ -5865,45 +5348,6 @@ </summary> </histogram> -<histogram name="MediaRouter.CastWebSenderExtensionLoaded" - enum="BooleanEnabled" expires_after="2021-10-01"> - <obsolete> - The Media Router component extension was removed in M93. - </obsolete> - <owner>takumif@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - Whenever a resource is loaded from the Media Router Component Extension, - this metric gets logged. The value for this metric is always true. - </summary> -</histogram> - -<histogram name="MediaRouter.Cloud.PrefAtDialogOpen" enum="BooleanEnabled" - expires_after="2021-10-01"> - <obsolete> - The Media Router component extension was removed in M93. - </obsolete> - <owner>takumif@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - The pref value to enable the cloud services. Recorded whenever the Cast - dialog is opened. - </summary> -</histogram> - -<histogram name="MediaRouter.Cloud.PrefAtInit" enum="BooleanEnabled" - expires_after="2021-10-01"> - <obsolete> - The Media Router component extension was removed in M93. - </obsolete> - <owner>takumif@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - The pref value to enable the cloud services. Recorded whenever the browser - is initialized for a regular (not incognito or guest) profile. - </summary> -</histogram> - <histogram name="MediaRouter.Dial.AvailableDevicesCount" units="devices" expires_after="2022-06-19"> <owner>mfoltz@chromium.org</owner> @@ -6001,32 +5445,6 @@ </summary> </histogram> -<histogram name="MediaRouter.NetworkMonitor.ConnectionType" - enum="DiscoveryNetworkMonitorConnectionType" expires_after="2021-06-06"> - <obsolete> - Unused after 2021-01-06. - </obsolete> - <owner>btolsch@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - Network connection type reported by DiscoveryNetworkMonitor whenever it - detects a change in the set of networks connected to the host device which - may affect local discovery. - </summary> -</histogram> - -<histogram name="MediaRouter.NetworkMonitor.NetworkChangeEventDelta" units="ms" - expires_after="2021-02-01"> - <obsolete> - Unused after 2021-01-06. - </obsolete> - <owner>btolsch@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - Time between network change events reported by DiscoveryNetworkMonitor. - </summary> -</histogram> - <histogram name="MediaRouter.PresentationRequest.AvailabilityUrlType" enum="PresentationUrlType" expires_after="2022-06-26"> <owner>takumif@chromium.org</owner> @@ -6089,43 +5507,6 @@ </summary> </histogram> -<histogram name="MediaRouter.Provider.Version" enum="MediaRouteProviderVersion" - expires_after="M93"> - <obsolete> - Removed in M93. - </obsolete> - <owner>mfoltz@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - Records how the major version of the Media Router component extension - compares to the major version of the browser. - </summary> -</histogram> - -<histogram name="MediaRouter.Provider.WakeReason" - enum="MediaRouteProviderWakeReason" expires_after="M93"> - <obsolete> - Removed in M93. - </obsolete> - <owner>mfoltz@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - Reason that the Media Router woke the Media Route Provider event page. - </summary> -</histogram> - -<histogram name="MediaRouter.Provider.Wakeup" enum="MediaRouteProviderWakeup" - expires_after="M93"> - <obsolete> - Removed in M93. - </obsolete> - <owner>mfoltz@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - Records the outcome of waking the Media Router component's event page. - </summary> -</histogram> - <histogram name="MediaRouter.Route.CreationOutcome" enum="MediaRouterCreateRouteOutcome" expires_after="2023-01-03"> <owner>takumif@chromium.org</owner> @@ -6186,35 +5567,6 @@ </summary> </histogram> -<histogram name="MediaRouter.Source.LocalFileFormat" enum="MediaContainers" - expires_after="2022-02-01"> - <obsolete> - Unused after 2022-01. - </obsolete> - <owner>takumif@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - The file format of a local media Media Router session. This is recorded when - a casting session begins to keep track of what kind of media is being - streamed. - </summary> -</histogram> - -<histogram name="MediaRouter.Source.LocalFileSize" units="MB" - expires_after="2022-02-01"> - <obsolete> - Unused after 2022-01. - </obsolete> - <owner>takumif@chromium.org</owner> - <owner>openscreen-eng@google.com</owner> - <summary> - The file size of a local media Media Router session. This is recorded when a - casting session begins to keep track of what kind of media is being - streamed, specifically, whether it is a clip or a song, or a full length - film or podcast. - </summary> -</histogram> - <histogram name="MediaRouter.Ui.Action.CloseLatency" units="ms" expires_after="2023-01-03"> <owner>takumif@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/mobile/histograms.xml b/tools/metrics/histograms/metadata/mobile/histograms.xml index 67f26256..e166664 100644 --- a/tools/metrics/histograms/metadata/mobile/histograms.xml +++ b/tools/metrics/histograms/metadata/mobile/histograms.xml
@@ -132,6 +132,8 @@ <variant name="RecentTabsHeader" summary="Recent Tabs header/device"/> <variant name="TabGrid" summary="Tab Grid Entry"/> <variant name="TabGridAddTo" summary="Tab Grid Add To"/> + <variant name="TabGridEdit" summary="Tab Grid Add To"/> + <variant name="Toolbar" summary="Menu from a toolbar button"/> <variant name="WebImage" summary="Image on a Web page"/> <variant name="WebImageLink" summary="Image-Link on a Web page"/> <variant name="WebLink" summary="Link on a Web page"/>
diff --git a/tools/metrics/histograms/metadata/password/histograms.xml b/tools/metrics/histograms/metadata/password/histograms.xml index 6d198e1..b805b6d 100644 --- a/tools/metrics/histograms/metadata/password/histograms.xml +++ b/tools/metrics/histograms/metadata/password/histograms.xml
@@ -219,17 +219,6 @@ </summary> </histogram> -<histogram name="PasswordGeneration.IsTriggeredManually" - enum="BooleanIsGenerationTriggeredManually" expires_after="M81"> - <obsolete> - Expired in M82; deleted in M90. - </obsolete> - <owner>kolos@chromium.org</owner> - <summary> - Measures the frequency of manually triggered password generations. - </summary> -</histogram> - <histogram name="PasswordGeneration.PopupShown" enum="PasswordGenerationPopupShown" expires_after="2022-06-26"> <owner>kazinova@google.com</owner> @@ -487,20 +476,6 @@ </summary> </histogram> -<histogram name="PasswordManager.AccountStore.EmptyUsernames.CountInDatabase" - units="units" expires_after="M95"> - <obsolete> - Obsolete since M95. - </obsolete> - <owner>vasilii@chromium.org</owner> - <owner>mamir@chromium.org</owner> - <owner>treib@chromium.org</owner> - <summary> - Number of password forms with empty username in the account-scoped Login - Database. This is recorded on startup. - </summary> -</histogram> - <histogram name="PasswordManager.AccountStoreBlocklistedEntriesAfterOptIn" units="credentials" expires_after="2022-05-31"> <owner>treib@chromium.org</owner> @@ -521,37 +496,6 @@ </summary> </histogram> -<histogram name="PasswordManager.AccountStoreVsProfileStore.{DifferenceType}" - units="accounts" expires_after="M95"> - <obsolete> - Obsolete since M95. - </obsolete> - <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. Recorded independent of whether the user is opted in to - the account-scoped storage or not, i.e. will contain a lot of useless - entries - you might want to look at AccountStoreVsProfileStore2 instead. - </summary> - <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.AccountStoreVsProfileStore2.{DifferenceType}" units="accounts" expires_after="2022-05-31"> <owner>mamir@chromium.org</owner> @@ -676,31 +620,6 @@ </summary> </histogram> -<histogram name="PasswordManager.AllPasswordsBottomSheet.UserAction" - enum="AllPasswordsBottomSheetActions" expires_after="M96"> - <obsolete> - Obsolete since M96. - </obsolete> - <owner>redatawfik@google.com</owner> - <owner>fhorschig@chromium.org</owner> - <summary> - Android only. Records the user action on the all passwords bottom sheet. - </summary> -</histogram> - -<histogram name="PasswordManager.AllPasswordsBottomSheet.WarningActions" - enum="AllPasswordsWarningActions" expires_after="M90"> - <obsolete> - Obsolete since M88. - </obsolete> - <owner>redatawfik@google.com</owner> - <owner>fhorschig@chromium.org</owner> - <summary> - Android only. Records the number of times the all passwords warning dialog - is shown and user action on it. - </summary> -</histogram> - <histogram name="PasswordManager.Android.PasswordCredentialEntry" enum="PasswordManagerAndroidPasswordEntryActions" expires_after="M95"> <owner>fhorschig@chromium.org</owner> @@ -885,19 +804,6 @@ </summary> </histogram> -<histogram name="PasswordManager.BulkCheck.CanceledCredentials" - units="credentials" expires_after="2021-07-01"> - <obsolete> - Deprecated in M93. - </obsolete> - <owner>vasilii@chromium.org</owner> - <owner>vsemeniuk@google.com</owner> - <summary> - Count of credentials initially to be checked when the password bulk check - was canceled. - </summary> -</histogram> - <histogram name="PasswordManager.BulkCheck.CanceledTime" units="ms" expires_after="2022-06-26"> <owner>vasilii@chromium.org</owner> @@ -1075,20 +981,6 @@ </summary> </histogram> -<histogram name="PasswordManager.ChromeSignInPageHashSaved" - enum="ChromeSignInPageHashSaved" expires_after="2021-02-01"> - <obsolete> - Removed in 10-2021, since it expired long ago. - </obsolete> - <owner>vakh@chromium.org</owner> - <owner>vasilii@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - Records whether a password hash was saved or not on Chrome sign-in page. - Recorded whenever the user types a password on Chrome sign-in page. - </summary> -</histogram> - <histogram name="PasswordManager.CleanedUpPasswords" units="units" expires_after="2022-12-05"> <owner>vasilii@chromium.org</owner> @@ -1101,22 +993,6 @@ </summary> </histogram> -<histogram name="PasswordManager.CompromisedCredentials" - enum="InsecureCredentialsType" expires_after="2021-12-05"> - <obsolete> - Removed 07/2021 - </obsolete> - <owner>bdea@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - Collects the type of insecure credential when it is added to or removed from - the table. Insecure credentials are properties of saved passwords that are - added when they are identified as leaked, phished, weak, or reused. They are - removed when the password is dropped from the password_manager or the - password has changed. - </summary> -</histogram> - <histogram name="PasswordManager.CompromisedCredentials.{Issue}" units="credentials" expires_after="2022-06-12"> <owner>vasilii@chromium.org</owner> @@ -1309,33 +1185,6 @@ </summary> </histogram> -<histogram name="PasswordManager.EmptyUsernames.CountInDatabase" units="units" - expires_after="M89"> - <obsolete> - Obsolete since M90. - </obsolete> - <owner>vasilii@chromium.org</owner> - <owner>kazinova@google.com</owner> - <summary> - Number of password forms with empty username in the profile-scoped Login - Database. This is recorded on startup. - </summary> -</histogram> - -<histogram name="PasswordManager.Enabled" enum="BooleanEnabled" - expires_after="M96"> - <obsolete> - Obsolete since M97. This histogram changed semantics in M95, but was only - replaced by PasswordManager.Enabled2 in M97. - </obsolete> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Indicates whether the password manager is enabled when a tab is opened. This - includes prerendered tabs. - </summary> -</histogram> - <histogram name="PasswordManager.Enabled2" enum="BooleanEnabled" expires_after="2022-06-26"> <owner>kazinova@google.com</owner> @@ -1346,19 +1195,6 @@ </summary> </histogram> -<histogram name="PasswordManager.FieldInfoTableRows" units="rows" - expires_after="M92"> - <obsolete> - Obsolete since M92. - </obsolete> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Records number of rows in FieldInfoTable, which contains locally learned - predictions about field types. Recorded once for the profile on startup. - </summary> -</histogram> - <histogram name="PasswordManager.FieldNameCollisionInVotes" enum="Boolean" expires_after="2022-06-19"> <owner>kolos@chromium.org</owner> @@ -1491,50 +1327,6 @@ </summary> </histogram> -<histogram name="PasswordManager.GooglePasswordManager.NavigationResult" - enum="GooglePasswordManagerNavigationResult" expires_after="2019-12-31"> - <obsolete> - Expired in M80. Removed in M92. - </obsolete> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - The result of an attempted navigation to the Google Password Manager. - Recorded when a signed-in and password syncing user navigates to - https://passwords.google.com by clicking a link. - </summary> -</histogram> - -<histogram name="PasswordManager.GooglePasswordManager.TimeToFailure" - units="units" expires_after="2019-12-31"> - <obsolete> - Expired in M80. Removed in M92. - </obsolete> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - The time it took for a failed navigation to the Google Password Manager. - Recorded when a signed-in and password syncing user navigates to - https://passwords.google.com by clicking a link and the navigation fails - before timing out. - </summary> -</histogram> - -<histogram name="PasswordManager.GooglePasswordManager.TimeToSuccess" - units="units" expires_after="2019-12-31"> - <obsolete> - Expired in M80. Removed in M92. - </obsolete> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - The time it took for a successful navigation to the Google Password Manager. - Recorded when a signed-in and password syncing user navigates to - https://passwords.google.com by clicking a link and the navigation succeeds - before timing out. - </summary> -</histogram> - <histogram name="PasswordManager.HttpCredentials" enum="PasswordManagerHttpCredentialType" expires_after="2022-05-15"> <owner>kazinova@google.com</owner> @@ -1647,32 +1439,6 @@ </summary> </histogram> -<histogram name="PasswordManager.LeakDetection.AccessTokenFetchStatus" - enum="GoogleServiceAuthError" expires_after="2021-08-09"> - <obsolete> - Removed in M93. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Status of an attempted fetch of an access token. Recorded when a token fetch - completes. - </summary> -</histogram> - -<histogram name="PasswordManager.LeakDetection.AccessTokenNetErrorCode" - enum="NetErrorCodes" expires_after="2021-08-09"> - <obsolete> - Removed in M93. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Net Error Code of a failed attempt to fetch an access token. Recorded when a - token fetch completes with an error state. - </summary> -</histogram> - <histogram name="PasswordManager.LeakDetection.AnalyzeSingleLeakResponseResult" enum="PasswordAnalyzeLeakResponseResult" expires_after="2022-06-26"> <owner>vsemeniuk@google.com</owner> @@ -1680,16 +1446,6 @@ <summary>Result of analyzing a single leak response.</summary> </histogram> -<histogram name="PasswordManager.LeakDetection.AnalyzeSingleLeakResponseTime" - units="ms" expires_after="2021-08-09"> - <obsolete> - Removed in M93. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary>The time it took to analyze a single leak lookup response.</summary> -</histogram> - <histogram name="PasswordManager.LeakDetection.DialogDismissalReason" enum="PasswordLeakDetectionDialogDismissalReason" expires_after="2022-06-19"> @@ -1701,19 +1457,6 @@ </summary> </histogram> -<histogram name="PasswordManager.LeakDetection.Enabled" enum="BooleanEnabled" - expires_after="M92"> - <obsolete> - Removed in M92. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Indicates whether the password manager leak detection feature is enabled. - Recorded for each profile on browser start-up. - </summary> -</histogram> - <histogram name="PasswordManager.LeakDetection.Error" enum="PasswordLeakDetectionError" expires_after="2022-06-19"> <owner>vsemeniuk@google.com</owner> @@ -1752,19 +1495,6 @@ </summary> </histogram> -<histogram name="PasswordManager.LeakDetection.IsSyncing" enum="Boolean" - expires_after="M92"> - <obsolete> - Removed in M92. - </obsolete> - <owner>vasilii@chromium.org</owner> - <owner>vsemeniuk@google.com</owner> - <summary> - When a password is determined as leaked, records if the user is syncing - passwords without passphrase. - </summary> -</histogram> - <histogram name="PasswordManager.LeakDetection.LookupSingleLeakResponseResult" enum="PasswordLeakLookupResponseResult" expires_after="2022-06-12"> <owner>vsemeniuk@google.com</owner> @@ -1775,19 +1505,6 @@ </summary> </histogram> -<histogram name="PasswordManager.LeakDetection.NetErrorCode" - enum="NetErrorCodes" expires_after="M92"> - <obsolete> - Removed in M92. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Network error code of a leak lookup request. Only recoded for each network - fetch that failed due to network/server errors. - </summary> -</histogram> - <histogram name="PasswordManager.LeakDetection.NotifyIsLeakedTime" units="ms" expires_after="2022-06-26"> <owner>vsemeniuk@google.com</owner> @@ -1865,20 +1582,6 @@ </summary> </histogram> -<histogram name="PasswordManager.ManagePasswordsReferrerSignedInAndSyncing" - enum="ManagePasswordsReferrer" expires_after="M87"> - <obsolete> - Removed in M87. - </obsolete> - <owner>ioanap@chromium.org</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Referrer of a navigation to the "Manage Passwords" page. Recorded - only for signed in users syncing passwords without a custom passprase, when - the user attempts to see their list of passwords. - </summary> -</histogram> - <histogram name="PasswordManager.MatchedFormType" enum="PasswordManagerMatchedFormType" expires_after="2022-06-26"> <owner>vsemeniuk@google.com</owner> @@ -1978,58 +1681,6 @@ </summary> </histogram> -<histogram name="PasswordManager.NumFormManagersCleared" units="count" - expires_after="2021-09-19"> - <obsolete> - Removed in M96. - </obsolete> - <owner>vasilii@chromium.org</owner> - <owner>kazinova@google.com</owner> - <summary> - Records how many FormManagers are deleted on the main frame navigation. This - metric is useful for estimation of memory footprint. - </summary> -</histogram> - -<histogram name="PasswordManager.NumPasswordsNotShown" units="count" - expires_after="M79"> - <obsolete> - Removed in M79. - </obsolete> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - The password manager only shows those credentials that are considered the - best match for a particular form. This stat keep track of the credentials - that were not as good of a match and were suppressed. - </summary> -</histogram> - -<histogram name="PasswordManager.OsPasswordStatus" - enum="PasswordManagerOsPasswordStatus" expires_after="2021-09-23"> - <obsolete> - Removed in M96. - </obsolete> - <owner>vasilii@chromium.org</owner> - <owner>kazinova@google.com</owner> - <summary> - Indicates whether the user's OS password is blank or not at browser startup. - </summary> -</histogram> - -<histogram name="PasswordManager.OtherPossibleUsernamesUsage" - enum="OtherPossibleUsernamesUsage" expires_after="M90"> - <obsolete> - Obsolete since M90. - </obsolete> - <owner>kazinova@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Breakdown of how other possible usernames are displayed. Recorded every time - we autofill a password form. - </summary> -</histogram> - <histogram name="PasswordManager.PasswordDropdownItemSelected" enum="PasswordDropdownSelectedOption" expires_after="2022-06-26"> <owner>kazinova@google.com</owner> @@ -2086,26 +1737,6 @@ </summary> </histogram> -<histogram name="PasswordManager.PasswordReuse.PasswordLength" - units="characters" expires_after="2021-01-30"> - <obsolete> - Removed 10-2021 due to lack of use. - </obsolete> - <owner>vakh@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - This metric shows the length of the reused password. - - Change in M63: If multiple passwords are matched simultaneously, this logs - the length of the longest password. Also, before M63, a "0" was - logged for sync-reuse. - - A "password reuse" is when the user typed a string that is equal - to a saved password on another domain or is equal to the sync password on a - non google-login domain. - </summary> -</histogram> - <histogram name="PasswordManager.PasswordReuse.TotalPasswords" units="credentials" expires_after="2022-06-12"> <owner>vakh@chromium.org</owner> @@ -2124,18 +1755,6 @@ </summary> </histogram> -<histogram name="PasswordManager.PasswordSavedWithManualFallback" - enum="BooleanPasswordSavedWithFallback" expires_after="2020-05-24"> - <obsolete> - Obsolete since M90. - </obsolete> - <owner>kolos@chromium.org</owner> - <summary> - Measures whether users save passwords with automatic prompt or manual - fallback. - </summary> -</histogram> - <histogram name="PasswordManager.PasswordScriptsFetcher.CacheState" enum="PasswordScriptsFetcherCacheState" expires_after="2022-06-19"> <owner>kolos@chromium.org</owner> @@ -2173,34 +1792,6 @@ </summary> </histogram> -<histogram name="PasswordManager.PasswordStore.GetAllLoginsAsync" units="ms" - expires_after="2021-09-29"> - <obsolete> - Renamed to PasswordManager.PasswordStore.GetAllLoginsAsync.Latency on - 2021-09-29. - </obsolete> - <owner>fhorschig@chromium.org</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Real-time duration of the asynchronous call to get all logins from the - PasswordStore backend. - </summary> -</histogram> - -<histogram name="PasswordManager.PasswordStoreAndroidBackend.APIErros" - enum="PasswordStoreAndroidBackendAPIError" expires_after="2022-06-30"> - <obsolete> - Deleted due to a typo in the name. Changed to - PasswordManager.PasswordStoreAndroidBackend.APIError on 2021-11-03. - </obsolete> - <owner>fhorschig@chromium.org</owner> - <owner>vasilii@chromium.org</owner> - <summary> - The error codes returned by the GMS Core ChromeSync 1P API. Recorded when - the asynchronous job has returned. - </summary> -</histogram> - <histogram name="PasswordManager.PasswordStoreAndroidBackend.ClearAllLocalPasswords.LoginsToRemove" units="count" expires_after="2022-06-30"> @@ -2340,23 +1931,6 @@ </token> </histogram> -<histogram name="PasswordManager.PasswordStoreDeletionsHaveSynced" - enum="BooleanSuccess" expires_after="M92"> - <obsolete> - Removed in M93. - </obsolete> - <owner>dullweber@chromium.org</owner> - <owner>treib@chromium.org</owner> - <owner>mamir@chromium.org</owner> - <summary> - Records how often browsing data succeeds to delete account store passwords - from the Sync server. False is emitted in the rare situations when the - operation times out or the user disables Sync before the deletions are fully - propagated to the Sync server. True is emitted when the password deletion is - successfully propagated to the server. - </summary> -</histogram> - <histogram name="PasswordManager.PasswordStoreInitResult" enum="BooleanSuccess" expires_after="M105"> <owner>vasilii@chromium.org</owner> @@ -2487,19 +2061,6 @@ </summary> </histogram> -<histogram name="PasswordManager.RemoveCompromisedCredentials" - enum="PasswordStoreChange" expires_after="2021-08-09"> - <obsolete> - Obsolete since M91. - </obsolete> - <owner>bdea@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - Collects the cause of the change in the Password Store login which causes a - call of a remove SQL statement on the compromised credentials table. - </summary> -</histogram> - <histogram name="PasswordManager.RemoveCompromisedCredentials.RemoveReason" enum="RemoveCompromisedCredentialsReason" expires_after="2022-05-29"> <owner>drubery@chromium.org</owner> @@ -2558,20 +2119,6 @@ </summary> </histogram> -<histogram name="PasswordManager.SavedEnterprisePasswordHashCount" - units="units" expires_after="2021-01-30"> - <obsolete> - Removed 10-2021 due to lack of use. - </obsolete> - <owner>vakh@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - Records the number of enterprise password hashes that have been saved for - password reuse detection. This is logged during the initialization of - PasswordStore class. - </summary> -</histogram> - <histogram name="PasswordManager.SavedGaiaPasswordHashCount" units="count" expires_after="2022-05-14"> <owner>vsemeniuk@google.com</owner> @@ -2680,19 +2227,6 @@ </summary> </histogram> -<histogram name="PasswordManager.SubmittedNonSecureFormType" - enum="PasswordFormType" expires_after="M77"> - <obsolete> - Expired in M77, code removed in M98 - </obsolete> - <owner>estark@chromium.org</owner> - <summary> - The type (e.g. signup, login, change password) of all submitted password - forms on non-secure pages. This is logged on form submission, but doesn't - require that the password manager saves. - </summary> -</histogram> - <histogram name="PasswordManager.SuccessfulLoginHappened" enum="BooleanSuccessfulLoginHappenedOnHttps" expires_after="2022-06-26"> <owner>kazinova@google.com</owner> @@ -2858,19 +2392,6 @@ </token> </histogram> -<histogram name="PasswordManager.UpdateLoginPasswordIssuesHasValue" - enum="BooleanSet" expires_after="2021-09-30"> - <obsolete> - Obsolete since Aug 2021. - </obsolete> - <owner>ioanap@chromium.org</owner> - <owner>chrome-password-manager-metrics-alerts@google.com</owner> - <summary> - Recorded when UpdateLogin is called on the login database. Records whether - the form passed to the method has a value set for password_issues or not. - </summary> -</histogram> - <histogram name="PasswordManager.UpdateUIDismissalReason" enum="PasswordManagerUIDismissalReason" expires_after="2022-06-26"> <owner>vasilii@chromium.org</owner> @@ -2888,21 +2409,6 @@ </summary> </histogram> -<histogram name="PasswordManager.UsernameCorrectionFound" - enum="BooleanUsernameCorrectionVote" expires_after="M85"> - <obsolete> - Obsolete since M86. - </obsolete> - <owner>kolos@chromium.org</owner> - <summary> - Chrome saves locally all fields a user typed on a sign-up form. If Chrome - saved an incorrect username and the user changes the username on a sign-in - form to a value of another field from the sign-up form, then Chrome uploads - a username correction vote which points to the correct username field. This - histogram measures how many correction votes are uploaded. - </summary> -</histogram> - <histogram name="PasswordManager.UsernameDetectionMethod" enum="UsernameDetectionMethod" expires_after="2022-05-15"> <owner>kazinova@google.com</owner> @@ -2954,69 +2460,6 @@ </histogram> <histogram - name="PasswordManager.WellKnownChangePassword.GetChangePasswordUsage" - enum="GetChangePasswordUrlMetric" expires_after="2021-12-12"> - <obsolete> - Obsolete since M93. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - A JSON file with change password form url is fetched from gstatic. This - metric logs if the response arrived in time and if the url override was - available for a given origin. - </summary> -</histogram> - -<histogram name="PasswordManager.WellKnownChangePassword.GstaticFetchErrorCode" - enum="NetErrorCodes" expires_after="2021-09-05"> - <obsolete> - Obsolete since M93. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Logs the error code when the fetch to the gstatic file failed. - </summary> -</histogram> - -<histogram - name="PasswordManager.WellKnownChangePassword.GstaticFetchHttpResponseCode" - enum="HttpResponseCode" expires_after="2021-09-05"> - <obsolete> - Obsolete since M93. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Logs the response code when the fetch to the gstatic file failed. - </summary> -</histogram> - -<histogram name="PasswordManager.WellKnownChangePassword.GstaticFetchResult" - enum="ChangePasswordUrlFetchResult" expires_after="2021-12-12"> - <obsolete> - Obsolete since M93. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary> - Logs if the request for the gstatic file succeeded, failed or if the - response was malformed. - </summary> -</histogram> - -<histogram name="PasswordManager.WellKnownChangePassword.GstaticFetchTime" - units="ms" expires_after="2021-12-12"> - <obsolete> - Obsolete since M93. - </obsolete> - <owner>vsemeniuk@google.com</owner> - <owner>vasilii@chromium.org</owner> - <summary>Logs the loading time for the gstatic file request.</summary> -</histogram> - -<histogram name="PasswordManager.{Store}BlacklistedSitesHiRes{CustomPassphraseStatus}" units="sites" expires_after="2022-05-01"> <owner>kazinova@google.com</owner> @@ -3157,70 +2600,6 @@ <token key="CustomPassphraseStatus" variants="CustomPassphraseStatus"/> </histogram> -<histogram name="PasswordProtection.AndroidVisualFeaturesNativeViewHeight" - units="dip" expires_after="2021-10-04"> - <obsolete> - Removed 09-2021 - </obsolete> - <owner>drubery@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - Records the height of the content area, according to the NativeView on - Android. This is logged on every ping by an SBER user due to an unfamiliar - login page, when the NativeView is available. - - Added as part of https://crbug.com/1211045 - </summary> -</histogram> - -<histogram name="PasswordProtection.AndroidVisualFeaturesNativeViewNull" - enum="BooleanNull" expires_after="2021-10-04"> - <obsolete> - Removed 09-2021 - </obsolete> - <owner>drubery@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - Records whether or not we were able to get a NativeView to query the size of - the content area on Android. This is logged on every ping by an SBER user - due to an unfamiliar login page, when the RenderWidgetHostView is not null. - - Added as part of https://crbug.com/1211045 - </summary> -</histogram> - -<histogram name="PasswordProtection.AndroidVisualFeaturesNativeViewWidth" - units="dip" expires_after="2021-10-04"> - <obsolete> - Removed 09-2021 - </obsolete> - <owner>drubery@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - Records the width of the content area, according to the NativeView on - Android. This is logged on every ping by an SBER user due to an unfamiliar - login page, when the NativeView is available. - - Added as part of https://crbug.com/1211045 - </summary> -</histogram> - -<histogram name="PasswordProtection.AndroidVisualFeaturesViewNull" - enum="BooleanNull" expires_after="2021-10-04"> - <obsolete> - Removed 09-2021 - </obsolete> - <owner>drubery@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - Records whether or not we were able to get a RenderWidgetHostView to query - the size of the content area on Android. This is logged on every ping by an - SBER user due to an unfamiliar login page. - - Added as part of https://crbug.com/1211045 - </summary> -</histogram> - <histogram name="PasswordProtection.DomFeatureExtractionDuration" units="ms" expires_after="2022-07-03"> <owner>drubery@chromium.org</owner> @@ -3231,23 +2610,6 @@ </summary> </histogram> -<histogram - name="PasswordProtection.GaiaPasswordReusesBeforeGaiaPasswordChanged" - units="reuses" expires_after="2021-01-30"> - <obsolete> - Removed 10-2021 due to lack of use - </obsolete> - <owner>vakh@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - The number of Gaia password reuse warnings shown to user before user changes - their password. Logged when we see that user has changed their Gaia - password. The number of reuses will be reset to zero if current session of - browser process ends. This count doesn't include the reuses that user marked - as legitimate. - </summary> -</histogram> - <histogram name="PasswordProtection.InterstitialAction" enum="PasswordProtectionWarningAction" expires_after="2022-10-25"> <owner>xinghuilu@chromium.org</owner> @@ -3304,19 +2666,6 @@ </summary> </histogram> -<histogram name="PasswordProtection.PageZoomFactor" units="units" - expires_after="2021-01-30"> - <obsolete> - Removed 10-2021 due to lack of use - </obsolete> - <owner>vakh@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - Reports the zoom factor for a login page, when the protected password is - entered. - </summary> -</histogram> - <histogram base="true" name="PasswordProtection.PasswordAlertModeOutcome" enum="PasswordProtectionRequestOutcome" expires_after="2022-10-25"> <owner>xinghuilu@chromium.org</owner> @@ -3353,20 +2702,6 @@ </summary> </histogram> -<histogram name="PasswordProtection.RendererDomFeatureResult" - enum="ClientSidePhishingResult" expires_after="2020-05-23"> - <obsolete> - Removed 10-2021 due to being long-expired. - </obsolete> - <owner>drubery@chromium.org</owner> - <owner>chrome-safebrowsing-alerts@google.com</owner> - <summary> - The result from the renderer after DOM feature extraction. This is collected - when Chrome password protection detects password reuse, or (for SBER users), - when the user focuses on a password field. - </summary> -</histogram> - <histogram name="PasswordProtection.RequestNetworkDuration" units="ms" expires_after="2022-10-10"> <owner>drubery@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/permissions/histograms.xml b/tools/metrics/histograms/metadata/permissions/histograms.xml index efcf2fb..373ad12e 100644 --- a/tools/metrics/histograms/metadata/permissions/histograms.xml +++ b/tools/metrics/histograms/metadata/permissions/histograms.xml
@@ -720,10 +720,18 @@ prompt has been resolved. </summary> <token key="Disposition"> + <variant name="AnchoredBubble"/> + <variant name="CustomModalDialog"/> <variant name="LocationBarLeftChip"/> <variant name="LocationBarLeftChipAutoBubble"/> <variant name="LocationBarLeftQuietAbusiveChip"/> <variant name="LocationBarLeftQuietChip"/> + <variant name="LocationBarRightAnimatedIcon"/> + <variant name="LocationBarRightStaticIcon"/> + <variant name="MessageUI"/> + <variant name="MiniInfobar"/> + <variant name="ModalDialog"/> + <variant name="NoneVisible"/> </token> <token key="PermissionType"> <variant name="AR"/> @@ -782,17 +790,25 @@ expired. </summary> <token key="Action"> + <variant name="Accepted"/> + <variant name="AcceptedOnce"/> <variant name="Denied"/> <variant name="Dismissed"/> - <variant name="Granted"/> - <variant name="GrantedOnce"/> <variant name="Ignored"/> </token> <token key="Disposition"> + <variant name="AnchoredBubble"/> + <variant name="CustomModalDialog"/> <variant name="LocationBarLeftChip"/> <variant name="LocationBarLeftChipAutoBubble"/> <variant name="LocationBarLeftQuietAbusiveChip"/> <variant name="LocationBarLeftQuietChip"/> + <variant name="LocationBarRightAnimatedIcon"/> + <variant name="LocationBarRightStaticIcon"/> + <variant name="MessageUI"/> + <variant name="MiniInfobar"/> + <variant name="ModalDialog"/> + <variant name="NoneVisible"/> </token> <token key="PermissionType"> <variant name="AR"/> @@ -824,10 +840,10 @@ <variant name="DidClickManage"/> </token> <token key="Action"> + <variant name="Accepted"/> + <variant name="AcceptedOnce"/> <variant name="Denied"/> <variant name="Dismissed"/> - <variant name="Granted"/> - <variant name="GrantedOnce"/> <variant name="Ignored"/> </token> <token key="Disposition">
diff --git a/tools/metrics/histograms/metadata/platform/histograms.xml b/tools/metrics/histograms/metadata/platform/histograms.xml index b5263e1..ffa3faf 100644 --- a/tools/metrics/histograms/metadata/platform/histograms.xml +++ b/tools/metrics/histograms/metadata/platform/histograms.xml
@@ -117,32 +117,6 @@ </summary> </histogram> -<histogram name="Platform.Cast.MeminfoMemAvailable2" units="MiB" - expires_after="2021-11-30"> - <obsolete> - Removed from code Nov 2021, expiry approaching and we don't use this data - any longer (newer cgroup memory data is more useful). - </obsolete> - <owner>halliwell@chromium.org</owner> - <summary> - /proc/meminfo's 'MemAvailable' in MiB. Collected every 5s on Cast devices - with kernel version 3.14 and above and capped at 2000. - </summary> -</histogram> - -<histogram name="Platform.Cast.MeminfoMemFreeDerived2" units="MiB" - expires_after="2021-11-30"> - <obsolete> - Removed from code Nov 2021, expiry approaching and we don't use this data - any longer (newer cgroup memory data is more useful). - </obsolete> - <owner>halliwell@chromium.org</owner> - <summary> - Collect free + buffers + cache memory in MiB every 5s on Cast devices, - capped at 2000. - </summary> -</histogram> - <histogram name="Platform.CompressedSwapSize" units="MB" expires_after="2021-11-07"> <owner>sonnyrao@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/quota/histograms.xml b/tools/metrics/histograms/metadata/quota/histograms.xml index 9abb560..c255220 100644 --- a/tools/metrics/histograms/metadata/quota/histograms.xml +++ b/tools/metrics/histograms/metadata/quota/histograms.xml
@@ -62,20 +62,6 @@ </summary> </histogram> -<histogram name="Quota.DaysBetweenRepeatedOriginEvictions" units="units" - expires_after="2021-11-29"> - <obsolete> - Removed as of 2021/05. - </obsolete> - <owner>jarrydg@chromium.org</owner> - <owner>chrome-owp-storage@google.com</owner> - <summary> - The number of days since an origin was last chosen to be evicted from the - storage, recorded each time the origin is evicted (except for the first - eviction). - </summary> -</histogram> - <histogram name="Quota.DiskspaceShortage" units="MB" expires_after="2022-06-19"> <owner>jarrydg@chromium.org</owner> <owner>chrome-owp-storage@google.com</owner> @@ -127,50 +113,6 @@ </summary> </histogram> -<histogram name="Quota.EvictedOriginAccessCount" units="units" - expires_after="2021-09-19"> - <obsolete> - Removed as of 2021/07. Replaced by Quota.EvictedBucketAccessCount. - </obsolete> - <owner>jarrydg@chromium.org</owner> - <owner>chrome-owp-storage@google.com</owner> - <summary> - The number of times the evicted storage key was accessed. Logged when the - storage key is evicted. Prior to M93, evictions were based on the Origin, - not StorageKey, but we chose not to rename the metric in order to maintain - historical data. - </summary> -</histogram> - -<histogram name="Quota.EvictedOriginDaysSinceAccess" units="units" - expires_after="2021-09-19"> - <obsolete> - Removed as of 2021/07. Replaced by Quota.EvictedBucketDaysSinceAccess. - </obsolete> - <owner>jarrydg@chromium.org</owner> - <owner>chrome-owp-storage@google.com</owner> - <summary> - The number of days since the evicted storage key was last accessed. Logged - when the storage key is evicted. Prior to M93, evictions were based on the - Origin, not StorageKey, but we chose not to rename the metric in order to - maintain historical data. - </summary> -</histogram> - -<histogram name="Quota.EvictedOriginsPerHour" units="units" - expires_after="2021-09-05"> - <obsolete> - Removed as of 2021/07. Replaced by Quota.EvictedBucketPerHour. - </obsolete> - <owner>jarrydg@chromium.org</owner> - <owner>chrome-owp-storage@google.com</owner> - <summary> - Number of evicted storage keys in an hour. Prior to M93, evictions were - based on the Origin, not StorageKey, but we chose not to rename the metric - in order to maintain historical data. - </summary> -</histogram> - <histogram name="Quota.EvictionRoundsPerHour" units="units" expires_after="2020-10-18"> <owner>jarrydg@chromium.org</owner> @@ -206,33 +148,6 @@ <summary>Number of evicted buckets per round.</summary> </histogram> -<histogram name="Quota.NumberOfEvictedOriginsPerRound" units="units" - expires_after="2022-05-18"> - <obsolete> - Removed as of 2021/07. Replaced by Quota.NumberOfEvictedBucketsPerRound. - </obsolete> - <owner>jarrydg@chromium.org</owner> - <owner>chrome-owp-storage@google.com</owner> - <summary> - Number of evicted storage keys per round. Prior to M93, evictions were based - on the Origin, not StorageKey, but we chose not to rename the metric in - order to maintain historical data. - </summary> -</histogram> - -<histogram name="Quota.OSAccomodationDelta" units="MB" expires_after="M85"> - <obsolete> - Expired in M85. - </obsolete> - <owner>jarrydg@chromium.org</owner> - <summary> - If our hardcoded OS accomodation is too large for the volume size, we define - the value as a fraction of the total volume size instead. The - OSAccomodationDelta is the difference between the hardcoded and computed - values. - </summary> -</histogram> - <histogram name="Quota.PercentDiskAvailable" units="%" expires_after="2022-06-19"> <owner>jarrydg@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/web_audio/histograms.xml b/tools/metrics/histograms/metadata/web_audio/histograms.xml index 6509a39..33f70a4 100644 --- a/tools/metrics/histograms/metadata/web_audio/histograms.xml +++ b/tools/metrics/histograms/metadata/web_audio/histograms.xml
@@ -208,19 +208,6 @@ </summary> </histogram> -<histogram name="WebAudio.OfflineAudioContext.ChannelCount" units="units" - expires_after="2022-06-30"> - <obsolete> - Removed 2021-01-12. See crbug.com/1165240. - </obsolete> - <owner>hongchan@chromium.org</owner> - <summary> - The number of channels specified for the offline audio context. Recorded for - every offline context created. Probably only a few per page, but could be - potentially much more (thousands). - </summary> -</histogram> - <histogram name="WebAudio.OfflineAudioContext.CreateTime" units="ms" expires_after="2022-08-12"> <owner>hongchan@chromium.org</owner> @@ -231,32 +218,6 @@ </summary> </histogram> -<histogram name="WebAudio.OfflineAudioContext.Length" units="frames" - expires_after="2021-05-23"> - <obsolete> - Removed 2021-01-12. See crbug.com/1165240. - </obsolete> - <owner>hongchan@chromium.org</owner> - <summary> - The length (in frames) specified for the offline audio context. Recorded for - every offline context created. Probably only a few per page, but could be - potentially much more (thousands). - </summary> -</histogram> - -<histogram name="WebAudio.OfflineAudioContext.SampleRate384kHz" units="Hz" - expires_after="2021-02-18"> - <obsolete> - Removed 2021-01-12. See crbug.com/1165240. - </obsolete> - <owner>hongchan@chromium.org</owner> - <summary> - The sample rate (in Hz) specified for the offline audio context. Recorded - for every offline context created. Probably only a few per page, but could - be potentially much more (thousands). - </summary> -</histogram> - <histogram name="WebAudio.PannerNode.PanningModel" enum="PanningModelType" expires_after="2022-04-24"> <owner>hongchan@chromium.org</owner>
diff --git a/tools/metrics/histograms/metadata/webauthn/histograms.xml b/tools/metrics/histograms/metadata/webauthn/histograms.xml index 7d3b83a..4425a78 100644 --- a/tools/metrics/histograms/metadata/webauthn/histograms.xml +++ b/tools/metrics/histograms/metadata/webauthn/histograms.xml
@@ -22,23 +22,6 @@ <histograms> -<histogram name="WebAuthentication.AttestationPromptResult" - enum="WebAuthenticationAttestationPromptResult" expires_after="2020-11-29"> - <obsolete> - Removed 12/2020. - </obsolete> - <owner>agl@chromium.org</owner> - <summary> - Tracks events related to prompting users for permission to pass WebAuthn - attestation information back to origins. "Queried" means that the - embedder was queried for a decision. (Since such decisions can be resolved - by enterprise policy, that doesn't imply that a user saw a permissions - prompt in every case.) Then one of four things can happen: a timeout, a - positive or negative resolution, or the request is abandoned. The latter - case occurs when, for example, the tab is closed or the user navigates away. - </summary> -</histogram> - <histogram name="WebAuthentication.CableV1DiscoveryEvent" enum="WebAuthenticationCableV1DiscoveryEvent" expires_after="2022-07-03"> <owner>agl@chromium.org</owner> @@ -185,35 +168,6 @@ </summary> </histogram> -<histogram name="WebAuthentication.ChromeOS.UserVerificationRequired" - enum="Boolean" expires_after="2021-11-19"> - <obsolete> - Removed 12/2021. - </obsolete> - <owner>martinkr@google.com</owner> - <owner>chrome-webauthn@google.com</owner> - <summary> - Records whether the Chrome OS platform authenticator should try to verify - the user (instead of requiring power button press). Note that a - presence-only request may get upgraded to user-verification. Also note that - "true" does not mean the user is actually verified. - </summary> -</histogram> - -<histogram name="WebAuthentication.CredentialRequestAllowCredentialsCount" - units="credentials" expires_after="2021-05-16"> - <obsolete> - Removed 12/2020. - </obsolete> - <owner>kenrb@chromium.org</owner> - <owner>martinkr@google.com</owner> - <summary> - When a relying party is attempting to authenticate a user using the - WebAuthentication API, this metric reports the number of valid credentials - that the RP has registered for the user. - </summary> -</histogram> - <histogram name="WebAuthentication.GetAssertionRequestTransport" enum="WebAuthenticationFidoTransport" expires_after="2022-06-26"> <owner>kenrb@chromium.org</owner> @@ -235,20 +189,6 @@ </summary> </histogram> -<histogram name="WebAuthentication.IsUVPlatformAuthenticatorAvailable" - enum="Boolean" expires_after="2021-12-01"> - <obsolete> - Replaced by WebAuthentication.IsUVPlatformAuthenticatorAvailable2 in M92. - </obsolete> - <owner>kenrb@chromium.org</owner> - <owner>martinkr@google.com</owner> - <summary> - Record at startup whether the current system has a platform authenticator - available; i.e. whether IsUVPAA JS call would return true or false. This - metric is downsampled by factor 10,000 on macOS. - </summary> -</histogram> - <histogram name="WebAuthentication.IsUVPlatformAuthenticatorAvailable2" enum="Boolean" expires_after="2022-07-03"> <owner>kenrb@chromium.org</owner> @@ -260,20 +200,6 @@ </summary> </histogram> -<histogram name="WebAuthentication.MakeCredentialExcludeCredentialsCount" - units="credentials" expires_after="2021-05-16"> - <obsolete> - Removed 12/2020. - </obsolete> - <owner>kenrb@chromium.org</owner> - <owner>martinkr@google.com</owner> - <summary> - When a relying party is attempting to register a credential for a new user - using the WebAuthentication API, this metric reports the number of existing - credentials already registered in order to prevent re-registration. - </summary> -</histogram> - <histogram name="WebAuthentication.MakeCredentialRequestTransport" enum="WebAuthenticationFidoTransport" expires_after="2022-12-01"> <owner>kenrb@chromium.org</owner> @@ -295,43 +221,6 @@ </summary> </histogram> -<histogram name="WebAuthentication.RelyingPartySecurityCheckFailure" - enum="WebAuthenticationRelyingPartySecurityCheckFailure" - expires_after="2020-12-31"> - <obsolete> - Removed 12/2020. - </obsolete> - <owner>kenrb@chromium.org</owner> - <owner>martinkr@google.com</owner> - <summary> - Records failures associated with verifying the relying party origin when - that relying party is attempting to make a credential or get an assertion - using the WebAuthentication API. Failures include when the relying party's - origin is opaque or non-secure, or when the caller-provided relying party ID - or app ID is not valid for this origin. - </summary> -</histogram> - -<histogram name="WebAuthentication.U2FAttestationPromptResult" - enum="WebAuthenticationU2FAttestationPromptResult" - expires_after="2021-06-06"> - <obsolete> - Removed 12/2020. - </obsolete> - <owner>agl@chromium.org</owner> - <summary> - Tracks events related to prompting users for permission to pass U2F - attestation information back to origins. "Queried" means that the - embedder was queried for a decision. (Since such decisions can be resolved - by enterprise policy, that doesn't imply that a user saw a permissions - prompt in every case.) Then either a positive or negative result can happen. - However, note some complications: a negative will be recorded when the tab - is closed or the user navigates away, and a positive result will be recorded - when the user accepts the permission prompt but the request has already - timed out. - </summary> -</histogram> - </histograms> </histogram-configuration>
diff --git a/tools/metrics/histograms/metadata/weblayer/histograms.xml b/tools/metrics/histograms/metadata/weblayer/histograms.xml index 779a70b..8769ae0 100644 --- a/tools/metrics/histograms/metadata/weblayer/histograms.xml +++ b/tools/metrics/histograms/metadata/weblayer/histograms.xml
@@ -22,20 +22,6 @@ <histograms> -<histogram name="WebLayer.MainFrameNavigationStart.ConsentDetermined" - enum="Boolean" expires_after="M94"> - <obsolete> - Obsoleted on 2021-11-23 as not needed. Also note that code used the name - WebLayer.NavigationStart.ConsentDetermined. - </obsolete> - <owner>sky@chromium.org</owner> - <owner>src/weblayer/OWNERS</owner> - <summary> - Tracks whether user consent to metrics reporting has been determined when a - navigation starts. - </summary> -</histogram> - <histogram name="WebLayer.Startup.{Component}CreationTime" units="ms" expires_after="2022-10-13"> <owner>cduvall@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 98cd7a7..e9c696d9 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": "506ae0908440dc39042a8d43734e482d8653e8d8", - "remote_path": "perfetto_binaries/trace_processor_shell/win/bc44c3c7533c00e56f88c06c592d634aecc884be/trace_processor_shell.exe" + "hash": "1f8f101b063880b66384f5907ecdf61bec885f30", + "remote_path": "perfetto_binaries/trace_processor_shell/win/eff1df5f6a0a9d7124731cab1eed4043c5d186e8/trace_processor_shell.exe" }, "linux_arm": { "hash": "58893933be305d3bfe0a72ebebcacde2ac3ca893", "remote_path": "perfetto_binaries/trace_processor_shell/linux_arm/49b4b5dcbc312d8d2c3751cf29238b8efeb4e494/trace_processor_shell" }, "mac": { - "hash": "4d2bff6c9f76aa8c660d714def3b3542bb7d638c", - "remote_path": "perfetto_binaries/trace_processor_shell/mac/eff1df5f6a0a9d7124731cab1eed4043c5d186e8/trace_processor_shell" + "hash": "3caf1f21388c5dc864c6208b8d44ca482e273450", + "remote_path": "perfetto_binaries/trace_processor_shell/mac/cab0b04a19036bc1003ee08b1dd57f994be39d65/trace_processor_shell" }, "mac_arm64": { "hash": "c0397e87456ad6c6a7aa0133e5b81c97adbab4ab", "remote_path": "perfetto_binaries/trace_processor_shell/mac_arm64/cefb3e0ec3a0580c996f801e854fe02963c03d5c/trace_processor_shell" }, "linux": { - "hash": "a53633fb7692caa3176a66b00fd38a23d742ceaa", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/eff1df5f6a0a9d7124731cab1eed4043c5d186e8/trace_processor_shell" + "hash": "611229add1f0c98cea6e0122a9b32bc9206aba49", + "remote_path": "perfetto_binaries/trace_processor_shell/linux/cab0b04a19036bc1003ee08b1dd57f994be39d65/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/ui/accessibility/platform/fuchsia/semantic_provider_unittest.cc b/ui/accessibility/platform/fuchsia/semantic_provider_unittest.cc index 40dd014..dc2ed67 100644 --- a/ui/accessibility/platform/fuchsia/semantic_provider_unittest.cc +++ b/ui/accessibility/platform/fuchsia/semantic_provider_unittest.cc
@@ -175,7 +175,8 @@ std::unique_ptr<AXFuchsiaSemanticProvider> semantic_provider_; }; -TEST_F(AXFuchsiaSemanticProviderTest, HandlesOnSemanticsConnectionClosed) { +TEST_F(AXFuchsiaSemanticProviderTest, + DISABLED_HandlesOnSemanticsConnectionClosed) { semantic_tree_binding_.Close(ZX_ERR_PEER_CLOSED); // Spin the loop to allow the channel-close to be handled. @@ -184,7 +185,7 @@ EXPECT_TRUE(delegate_->on_semantics_manager_connection_closed_called_); } -TEST_F(AXFuchsiaSemanticProviderTest, HandlesOnAccessibilityAction) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_HandlesOnAccessibilityAction) { bool action_handled = false; semantic_listener_->OnAccessibilityActionRequested( /*node_id=*/1u, fuchsia::accessibility::semantics::Action::DEFAULT, @@ -200,7 +201,7 @@ fuchsia::accessibility::semantics::Action::DEFAULT); } -TEST_F(AXFuchsiaSemanticProviderTest, HandlesOnHitTest) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_HandlesOnHitTest) { // Note that the point is sent here and will be converted according to the // device scale used. Only then it gets sent to the handler, which receives // the value already with the proper scaling. @@ -217,7 +218,7 @@ EXPECT_EQ(delegate_->on_hit_test_point_.y, 12.0); } -TEST_F(AXFuchsiaSemanticProviderTest, HandlesOnSemanticsEnabled) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_HandlesOnSemanticsEnabled) { semantic_listener_->OnSemanticsModeChanged(false, [](auto...) {}); // Spin the loop to handle the call. @@ -226,7 +227,7 @@ EXPECT_TRUE(delegate_->on_semantics_enabled_called_); } -TEST_F(AXFuchsiaSemanticProviderTest, SendsRootOnly) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_SendsRootOnly) { Node root; root.set_node_id(0u); EXPECT_TRUE(semantic_provider_->Update(std::move(root))); @@ -238,7 +239,7 @@ EXPECT_FALSE(semantic_provider_->HasPendingUpdates()); } -TEST_F(AXFuchsiaSemanticProviderTest, SendsNodesFromRootToLeaves) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_SendsNodesFromRootToLeaves) { auto tree_nodes = TreeNodes(); for (auto& node : tree_nodes) { EXPECT_TRUE(semantic_provider_->Update(std::move(node))); @@ -251,7 +252,7 @@ EXPECT_FALSE(semantic_provider_->HasPendingUpdates()); } -TEST_F(AXFuchsiaSemanticProviderTest, SendsNodesFromLeavesToRoot) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_SendsNodesFromLeavesToRoot) { auto nodes = TreeNodes(); std::reverse(nodes.begin(), nodes.end()); for (auto& node : nodes) { @@ -266,7 +267,7 @@ } TEST_F(AXFuchsiaSemanticProviderTest, - SendsNodesOnlyAfterParentNoLongerPointsToDeletedChild) { + DISABLED_SendsNodesOnlyAfterParentNoLongerPointsToDeletedChild) { auto tree_nodes = TreeNodes(); for (auto& node : tree_nodes) { EXPECT_TRUE(semantic_provider_->Update(std::move(node))); @@ -302,7 +303,7 @@ } TEST_F(AXFuchsiaSemanticProviderTest, - SendsNodesOnlyAfterDanglingChildIsDeleted) { + DISABLED_SendsNodesOnlyAfterDanglingChildIsDeleted) { auto tree_nodes = TreeNodes(); for (auto& node : tree_nodes) { EXPECT_TRUE(semantic_provider_->Update(std::move(node))); @@ -334,7 +335,7 @@ EXPECT_FALSE(semantic_provider_->HasPendingUpdates()); } -TEST_F(AXFuchsiaSemanticProviderTest, ReparentsNodeWithADeletion) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_ReparentsNodeWithADeletion) { auto tree_nodes = TreeNodes(); for (auto& node : tree_nodes) { EXPECT_TRUE(semantic_provider_->Update(std::move(node))); @@ -378,7 +379,7 @@ EXPECT_FALSE(semantic_provider_->HasPendingUpdates()); } -TEST_F(AXFuchsiaSemanticProviderTest, ReparentsNodeWithAnUpdate) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_ReparentsNodeWithAnUpdate) { auto tree_nodes = TreeNodes(); for (auto& node : tree_nodes) { EXPECT_TRUE(semantic_provider_->Update(std::move(node))); @@ -416,7 +417,7 @@ EXPECT_FALSE(semantic_provider_->HasPendingUpdates()); } -TEST_F(AXFuchsiaSemanticProviderTest, ChangesRoot) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_ChangesRoot) { auto tree_nodes = TreeNodes(); for (auto& node : tree_nodes) { EXPECT_TRUE(semantic_provider_->Update(std::move(node))); @@ -441,7 +442,7 @@ EXPECT_FALSE(semantic_provider_->HasPendingUpdates()); } -TEST_F(AXFuchsiaSemanticProviderTest, BatchesUpdates) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_BatchesUpdates) { std::vector<Node> updates; for (uint32_t i = 0; i < 30; ++i) { Node node; @@ -464,7 +465,7 @@ EXPECT_FALSE(semantic_provider_->HasPendingUpdates()); } -TEST_F(AXFuchsiaSemanticProviderTest, ClearsTree) { +TEST_F(AXFuchsiaSemanticProviderTest, DISABLED_ClearsTree) { auto tree_nodes = TreeNodes(); for (auto& node : tree_nodes) { EXPECT_TRUE(semantic_provider_->Update(std::move(node)));
diff --git a/ui/android/java/src/org/chromium/ui/modaldialog/ModalDialogProperties.java b/ui/android/java/src/org/chromium/ui/modaldialog/ModalDialogProperties.java index 0510c1a6..fab3f38 100644 --- a/ui/android/java/src/org/chromium/ui/modaldialog/ModalDialogProperties.java +++ b/ui/android/java/src/org/chromium/ui/modaldialog/ModalDialogProperties.java
@@ -102,6 +102,14 @@ public static final WritableObjectPropertyKey<String> POSITIVE_BUTTON_TEXT = new WritableObjectPropertyKey<>(); + /** + * The icon on the positive button. + * Note: Not intended for general usage; please seek Chrome UX approval for + * an exception. + */ + public static final WritableObjectPropertyKey<Drawable> POSITIVE_BUTTON_ICON = + new WritableObjectPropertyKey(); + /** Content description for the positive button. */ public static final WritableObjectPropertyKey<String> POSITIVE_BUTTON_CONTENT_DESCRIPTION = new WritableObjectPropertyKey<>(); @@ -166,8 +174,8 @@ public static final PropertyKey[] ALL_KEYS = new PropertyKey[] {CONTROLLER, CONTENT_DESCRIPTION, TITLE, TITLE_MAX_LINES, TITLE_ICON, MESSAGE, CUSTOM_VIEW, POSITIVE_BUTTON_TEXT, - POSITIVE_BUTTON_CONTENT_DESCRIPTION, POSITIVE_BUTTON_DISABLED, NEGATIVE_BUTTON_TEXT, - NEGATIVE_BUTTON_CONTENT_DESCRIPTION, NEGATIVE_BUTTON_DISABLED, CANCEL_ON_TOUCH_OUTSIDE, - FILTER_TOUCH_FOR_SECURITY, TOUCH_FILTERED_CALLBACK, TITLE_SCROLLABLE, BUTTON_STYLES, - FULLSCREEN_DIALOG, DIALOG_WHEN_LARGE, FOCUS_DIALOG}; + POSITIVE_BUTTON_ICON, POSITIVE_BUTTON_CONTENT_DESCRIPTION, POSITIVE_BUTTON_DISABLED, + NEGATIVE_BUTTON_TEXT, NEGATIVE_BUTTON_CONTENT_DESCRIPTION, NEGATIVE_BUTTON_DISABLED, + CANCEL_ON_TOUCH_OUTSIDE, FILTER_TOUCH_FOR_SECURITY, TOUCH_FILTERED_CALLBACK, + TITLE_SCROLLABLE, BUTTON_STYLES, FULLSCREEN_DIALOG, DIALOG_WHEN_LARGE, FOCUS_DIALOG}; }
diff --git a/ui/ozone/platform/windows/windows_surface_factory.cc b/ui/ozone/platform/windows/windows_surface_factory.cc index 757f9704..5d525bd 100644 --- a/ui/ozone/platform/windows/windows_surface_factory.cc +++ b/ui/ozone/platform/windows/windows_surface_factory.cc
@@ -70,14 +70,13 @@ WindowsSurfaceFactory::GetAllowedGLImplementations() { return std::vector<gl::GLImplementationParts>{ gl::GLImplementationParts(gl::kGLImplementationEGLGLES2), - gl::GLImplementationParts(gl::kGLImplementationSwiftShaderGL), + gl::GLImplementationParts(gl::ANGLEImplementation::kSwiftShader), gl::GLImplementationParts(gl::kGLImplementationEGLANGLE)}; } GLOzone* WindowsSurfaceFactory::GetGLOzone( const gl::GLImplementationParts& implementation) { switch (implementation.gl) { - case gl::kGLImplementationSwiftShaderGL: case gl::kGLImplementationEGLGLES2: case gl::kGLImplementationEGLANGLE: return egl_implementation_.get();
diff --git a/weblayer/browser/overlay_popup_ad_intervention_browsertest.cc b/weblayer/browser/overlay_popup_ad_intervention_browsertest.cc index b95d142..e950a7ca 100644 --- a/weblayer/browser/overlay_popup_ad_intervention_browsertest.cc +++ b/weblayer/browser/overlay_popup_ad_intervention_browsertest.cc
@@ -79,8 +79,16 @@ subresource_filter::mojom::AdsViolation::kOverlayPopupAd, 0); } +// TODO(https://crbug.com/1287783): Fails on the linux and android. +#if defined(OS_LINUX) || defined(OS_ANDROID) +#define MAYBE_OverlayPopupAd_AdInterventionTriggered \ + DISABLED_OverlayPopupAd_AdInterventionTriggered +#else +#define MAYBE_OverlayPopupAd_AdInterventionTriggered \ + OverlayPopupAd_AdInterventionTriggered +#endif IN_PROC_BROWSER_TEST_F(OverlayPopupAdViolationBrowserTest, - OverlayPopupAd_AdInterventionTriggered) { + MAYBE_OverlayPopupAd_AdInterventionTriggered) { base::HistogramTester histogram_tester; GURL url = embedded_test_server()->GetURL(