diff --git a/.gn b/.gn index fd37dd3..c3e6a5a 100644 --- a/.gn +++ b/.gn
@@ -65,11 +65,8 @@ no_check_targets = [ "//chrome/test:browser_tests", "//chrome/test:browser_tests_runner", - "//chrome/test:chrome_app_unittests", - "//chrome/test:chrome_app_unittests__library", "//chrome/test:interactive_ui_tests", "//chrome/test:test_support_ui", - "//chrome/test:test_support_unit", "//chrome/test:unit_tests", "//chrome/test:unit_tests__library", "//chrome/test:usage_time_limit_unittests",
diff --git a/DEPS b/DEPS index 5569f17..ffddb65f 100644 --- a/DEPS +++ b/DEPS
@@ -177,7 +177,7 @@ # luci-go CIPD package version. # Make sure the revision is uploaded by infra-packagers builder. # https://ci.chromium.org/p/infra-internal/g/infra-packagers/console - 'luci_go': 'git_revision:bbac8f199026d706b08e53ca46d1a9560ae580d2', + 'luci_go': 'git_revision:5a038afb97f6b77e0fcefe1185317da216fced1f', # This can be overridden, e.g. with custom_vars, to build clang from HEAD # instead of downloading the prebuilt pinned revision. @@ -209,11 +209,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling Skia # and whatever else without interference from each other. - 'skia_revision': '3d854bade6de6a6c9d5b4458087e463d669de118', + 'skia_revision': '66125eac158dc6594c46749bfc4ef2a241dcd606', # 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': '5fc0bd541bc9157a8e72c985c53447a4ce96687d', + 'v8_revision': '4ceb4961cb95d6c7e91b2ac86cf18ed70ce1fc66', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -288,7 +288,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': '4325d86475a5841294a589fd388bb942699c6669', + 'devtools_frontend_revision': 'c87525026921d80cffe27b08408ae318f614ec54', # 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. @@ -328,11 +328,11 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'dawn_revision': '21ce5d2965485853c2f87e386fd356689486b7c2', + 'dawn_revision': '880a3d6311971046304506bd18dc2e936447cb15', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling feed # and whatever else without interference from each other. - 'quiche_revision': '15093ba5655b9fb7dd487c8ad3bcc25e47feaf5b', + 'quiche_revision': '6b479616d4254c23c18ffad3118e19dd1ad431bd', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling ios_webkit # and whatever else without interference from each other. @@ -1349,7 +1349,7 @@ }, 'src/third_party/perfetto': - Var('android_git') + '/platform/external/perfetto.git' + '@' + 'b91884a97a74eee3d9dde816a107e934550ccf26', + Var('android_git') + '/platform/external/perfetto.git' + '@' + '9109f50a742ab7b4cb70717308281137a8734b2b', 'src/third_party/perl': { 'url': Var('chromium_git') + '/chromium/deps/perl.git' + '@' + '6f3e5028eb65d0b4c5fdd792106ac4c84eee1eb3', @@ -1574,7 +1574,7 @@ Var('chromium_git') + '/external/github.com/gpuweb/cts.git' + '@' + 'a03bb38c0e771a0b404753b8e65250e98719870f', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + '2e929eae1b77ab9fe3ed93471218ece7868900f3', + Var('webrtc_git') + '/src.git' + '@' + '92bd9020afa45194f6d02dd9deba527a08cef21e', 'src/third_party/libgifcodec': Var('skia_git') + '/libgifcodec' + '@'+ Var('libgifcodec_revision'), @@ -1635,7 +1635,7 @@ Var('chromium_git') + '/v8/v8.git' + '@' + Var('v8_revision'), 'src-internal': { - 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@726234f85a4f2c84a756e43cd900338b9890e6d3', + 'url': 'https://chrome-internal.googlesource.com/chrome/src-internal.git@a9f25d3e722671adc08f9b10b111b29f2794789c', 'condition': 'checkout_src_internal', },
diff --git a/ash/BUILD.gn b/ash/BUILD.gn index 06f4c9b..c9cc78e 100644 --- a/ash/BUILD.gn +++ b/ash/BUILD.gn
@@ -2626,6 +2626,7 @@ "//chrome/test:accessibility_live_site_tests", "//chrome/test:captured_sites_interactive_tests", "//chrome/test:test_support", + "//chrome/test:test_support_unit", "//components/exo:*", "//components/exo/wayland:*", "//ash/public/cpp/external_arc:*",
diff --git a/ash/constants/ash_switches.cc b/ash/constants/ash_switches.cc index ff046ba1..0b46057 100644 --- a/ash/constants/ash_switches.cc +++ b/ash/constants/ash_switches.cc
@@ -39,6 +39,10 @@ const char kAllowFailedPolicyFetchForTest[] = "allow-failed-policy-fetch-for-test"; +// When this flag is set, the OS installation UI can be accessed. This +// allows the user to install from USB to disk. +const char kAllowOsInstall[] = "allow-os-install"; + // Allows remote attestation (RA) in dev mode for testing purpose. Usually RA // is disabled in dev mode because it will always fail. However, there are cases // in testing where we do want to go through the permission flow even in dev @@ -558,6 +562,11 @@ const char kOfflineSignInTimeLimitInSecondsOverrideForTesting[] = "offline-signin-timelimit-in-seconds-override-for-testing"; +// Used for overriding the required user activity time before running the +// onboarding survey. +const char kTimeBeforeOnboardingSurveyInSecondsForTesting[] = + "time-before-onboarding-survey-in-seconds-for-testing"; + // Used for overriding the preference set by the policy // kSamlLockScreenReauthenticationEnabled to true. // TODO(crbug.com/1177416): Clean up once testing is complete @@ -737,5 +746,9 @@ kEnableRequisitionEdits); } +bool IsOsInstallAllowed() { + return base::CommandLine::ForCurrentProcess()->HasSwitch(kAllowOsInstall); +} + } // namespace switches } // namespace chromeos
diff --git a/ash/constants/ash_switches.h b/ash/constants/ash_switches.h index 8c78c73e..0c20adfe 100644 --- a/ash/constants/ash_switches.h +++ b/ash/constants/ash_switches.h
@@ -21,6 +21,7 @@ extern const char kAggressiveCacheDiscardThreshold[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kAllowFailedPolicyFetchForTest[]; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kAllowOsInstall[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kAllowRAInDevMode[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kAppAutoLaunched[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kAppOemManifestFile[]; @@ -206,6 +207,8 @@ COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kOfflineSignInTimeLimitInSecondsOverrideForTesting[]; COMPONENT_EXPORT(ASH_CONSTANTS) +extern const char kTimeBeforeOnboardingSurveyInSecondsForTesting[]; +COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kSamlLockScreenReauthenticationEnabledOverrideForTesting[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kShelfHoverPreviews[]; COMPONENT_EXPORT(ASH_CONSTANTS) extern const char kShelfHotseat[]; @@ -304,6 +307,9 @@ COMPONENT_EXPORT(ASH_CONSTANTS) bool IsDeviceRequisitionConfigurable(); +// Returns true if the OS installation UI flow can be entered. +COMPONENT_EXPORT(ASH_CONSTANTS) bool IsOsInstallAllowed(); + } // namespace switches } // namespace chromeos
diff --git a/base/BUILD.gn b/base/BUILD.gn index 5a3c730..2e85cd0e 100644 --- a/base/BUILD.gn +++ b/base/BUILD.gn
@@ -80,10 +80,6 @@ # have on by default. enable_backup_ref_ptr_slow_checks = false - # Set to true to lower normal bucket bitmap to PartitionPageSize() on 32bit - # systems. - make_gigacage_granularity_partition_page_size = true - # Ensure that a non-BRP memory region can't be reused for the BRP pool while # there are associated CheckedPtr instances left. use_brp_pool_blocklist = false @@ -2528,7 +2524,6 @@ "PUT_REF_COUNT_IN_PREVIOUS_SLOT=$should_put_ref_count_in_previous_slot", "USE_BRP_POOL_BLOCKLIST=$should_use_brp_pool_blocklist", "NEVER_REMOVE_FROM_BRP_POOL_BLOCKLIST=$should_never_remove_from_brp_pool_from_blocklist", - "MAKE_GIGACAGE_GRANULARITY_PARTITION_PAGE_SIZE=$make_gigacage_granularity_partition_page_size", "USE_DEDICATED_PARTITION_FOR_ALIGNED_ALLOC=$use_dedicated_partition_for_aligned_alloc", ] }
diff --git a/base/allocator/allocator_shim.h b/base/allocator/allocator_shim.h index a562630..4ec8919 100644 --- a/base/allocator/allocator_shim.h +++ b/base/allocator/allocator_shim.h
@@ -69,10 +69,8 @@ using FreeFn = void(const AllocatorDispatch* self, void* address, void* context); - // Returns the best available estimate for the actual amount of memory - // consumed by the allocation |address|. If possible, this should include - // heap overhead or at least a decent estimate of the full cost of the - // allocation. If no good estimate is possible, returns zero. + // Returns the allocated size of user data (not including heap overhead). + // Can be larger than the requested size. using GetSizeEstimateFn = size_t(const AllocatorDispatch* self, void* address, void* context);
diff --git a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc index 8b378b0c..a6b7dac6c 100644 --- a/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc +++ b/base/allocator/allocator_shim_default_dispatch_to_partition_alloc.cc
@@ -17,6 +17,7 @@ #include "base/allocator/partition_allocator/partition_root.h" #include "base/allocator/partition_allocator/partition_stats.h" #include "base/bits.h" +#include "base/compiler_specific.h" #include "base/memory/nonscannable_memory.h" #include "base/no_destructor.h" #include "base/numerics/checked_math.h" @@ -31,8 +32,6 @@ namespace { -std::atomic<bool> g_initialization_lock{false}; - // We can't use a "static local" or a base::LazyInstance, as: // - static local variables call into the runtime on Windows, which is not // prepared to handle it, as the first allocation happens during CRT init. @@ -63,6 +62,7 @@ std::atomic<T*> instance_; alignas(T) uint8_t instance_buffer_[sizeof(T)]; + std::atomic<bool> initialization_lock_; }; template <typename T, typename Constructor> @@ -88,7 +88,7 @@ // Lock. bool expected = false; // Semantically equivalent to base::Lock::Acquire(). - while (!g_initialization_lock.compare_exchange_strong( + while (!initialization_lock_.compare_exchange_strong( expected, true, std::memory_order_acquire, std::memory_order_acquire)) { expected = false; } @@ -97,7 +97,7 @@ // Someone beat us. if (instance) { // Unlock. - g_initialization_lock.store(false, std::memory_order_release); + initialization_lock_.store(false, std::memory_order_release); return instance; } @@ -105,7 +105,7 @@ instance_.store(instance, std::memory_order_release); // Unlock. - g_initialization_lock.store(false, std::memory_order_release); + initialization_lock_.store(false, std::memory_order_release); return instance; } @@ -184,14 +184,14 @@ }; LeakySingleton<base::ThreadSafePartitionRoot, AlignedPartitionConstructor> - g_aligned_root = {}; + g_aligned_root CONSTINIT = {}; #endif // BUILDFLAG(USE_DEDICATED_PARTITION_FOR_ALIGNED_ALLOC) // Original g_root_ if it was replaced by ConfigurePartitionRefCountSupport(). std::atomic<base::ThreadSafePartitionRoot*> g_original_root_(nullptr); -LeakySingleton<base::ThreadSafePartitionRoot, MainPartitionConstructor> g_root = - {}; +LeakySingleton<base::ThreadSafePartitionRoot, MainPartitionConstructor> g_root + CONSTINIT = {}; base::ThreadSafePartitionRoot* Allocator() { return g_root.Get(); } @@ -350,28 +350,28 @@ void* address, size_t size, void* context) { -#if defined(OS_MAC) +#if defined(OS_APPLE) if (!base::IsManagedByPartitionAlloc(address)) { // A memory region allocated by the system allocator is passed in this // function. Forward the request to `realloc` which supports zone- // dispatching so that it appropriately selects the right zone. return realloc(address, size); } -#endif // defined(OS_MAC) +#endif // defined(OS_APPLE) return Allocator()->ReallocFlags(base::PartitionAllocNoHooks, address, MaybeAdjustSize(size), ""); } void PartitionFree(const AllocatorDispatch*, void* address, void* context) { -#if defined(OS_MAC) +#if defined(OS_APPLE) if (!base::IsManagedByPartitionAlloc(address)) { // A memory region allocated by the system allocator is passed in this // function. Forward the request to `free` which supports zone- // dispatching so that it appropriately selects the right zone. return free(address); } -#endif // defined(OS_MAC) +#endif // defined(OS_APPLE) base::ThreadSafePartitionRoot::FreeNoHooks(address); } @@ -379,18 +379,23 @@ size_t PartitionGetSizeEstimate(const AllocatorDispatch*, void* address, void* context) { -#if defined(OS_MAC) +#if defined(OS_APPLE) if (!base::IsManagedByPartitionAlloc(address)) { // The object pointed to by `address` is not allocated by the // PartitionAlloc. The return value `0` means that the pointer does not // belong to this malloc zone. return 0; } -#endif // defined(OS_MAC) +#endif // defined(OS_APPLE) // TODO(lizeb): Returns incorrect values for aligned allocations. const size_t size = base::ThreadSafePartitionRoot::GetUsableSize(address); +#if defined(OS_APPLE) + // The object pointed to by `address` is allocated by the PartitionAlloc. + // So, this function must not return zero so that the malloc zone dispatcher + // finds the appropriate malloc zone. PA_DCHECK(size); +#endif // defined(OS_APPLE) return size; }
diff --git a/base/allocator/partition_allocator/address_pool_manager.cc b/base/allocator/partition_allocator/address_pool_manager.cc index 409071a..e368a440 100644 --- a/base/allocator/partition_allocator/address_pool_manager.cc +++ b/base/allocator/partition_allocator/address_pool_manager.cc
@@ -312,30 +312,28 @@ } else { PA_DCHECK(handle == kBRPPoolHandle); PA_DCHECK(!(length & kSuperPageOffsetMask)); - // If BUILDFLAG(MAKE_GIGACAGE_GRANULARITY_PARTITION_PAGE_SIZE) is defined, - // make IsManagedByBRPPoolPool return false when an address - // inside the first or the last PartitionPageSize()-bytes - // block is given: + + // Make IsManagedByBRPPoolPool() return false when an address inside the + // first or the last PartitionPageSize()-bytes block is given: // // ------+---+---------------+---+---- // memory ..... | B | managed by PA | B | ... // regions ------+---+---------------+---+---- // - // B: PartitionPageSize()-bytes block. This is used by - // PartitionAllocator and is not available for callers. + // B: PartitionPageSize()-bytes block. This is used internally by the + // allocator and is not available for callers. // // This is required to avoid crash caused by the following code: + // { + // // Assume this allocation happens outside of PartitionAlloc. + // CheckedPtr<T> ptr = new T[20]; + // for (size_t i = 0; i < 20; i ++) { ptr++; } + // // |ptr| may point to an address inside 'B'. + // } // - // { - // CheckedPtr<T> ptr = allocateFromNotPartitionAllocator(X * sizeof(T)); - // for (size_t i = 0; i < X; i ++) { ...; ptr++; } - // // |ptr| may point an address inside 'B'. - // } - // - // Suppose that |ptr| points to an address inside B after the loop. So when - // exiting the scope, IsManagedByBRPPoolPool(ptr) returns true without - // the barrier blocks. Since the memory is not allocated by Partition - // Allocator, ~CheckedPtr will cause crash. + // Suppose that |ptr| points to an address inside B after the loop. If + // IsManagedByBRPPoolPool(ptr) were to return true, ~CheckedPtr would crash, + // since the memory is not allocated by Partition. SetBitmap( AddressPoolManagerBitmap::brp_pool_bits_, (ptr_as_uintptr >> AddressPoolManagerBitmap::kBitShiftOfBRPPoolBitmap) + @@ -359,9 +357,8 @@ } else { PA_DCHECK(handle == kBRPPoolHandle); PA_DCHECK(!(length & kSuperPageOffsetMask)); - // If BUILDFLAG(MAKE_GIGACAGE_GRANULARITY_PARTITION_PAGE_SIZE) is defined, - // make IsManagedByBRPPoolPool return false when an address - // inside the first or the last PartitionPageSize()-bytes block is given. + // Make IsManagedByBRPPoolPool() return false when an address inside the + // first or the last PartitionPageSize()-bytes block is given. // (See MarkUsed comment) ResetBitmap( AddressPoolManagerBitmap::brp_pool_bits_,
diff --git a/base/allocator/partition_allocator/address_pool_manager_bitmap.h b/base/allocator/partition_allocator/address_pool_manager_bitmap.h index bbe50c89..c3f949b 100644 --- a/base/allocator/partition_allocator/address_pool_manager_bitmap.h +++ b/base/allocator/partition_allocator/address_pool_manager_bitmap.h
@@ -30,30 +30,21 @@ static constexpr uint64_t kGiB = 1024 * 1024 * 1024ull; static constexpr uint64_t kAddressSpaceSize = 4ull * kGiB; - // BRP pool includes only normal buckets. 2MB granularity is used, unless - // MAKE_GIGACAGE_GRANULARITY_PARTITION_PAGE_SIZE is on, in which case we need - // to lower granularity down to partition page level to eliminate the guard - // pages at the end. This is needed so that pointers immediately past an - // allocation that immediately precede a super page in BRP pool don't - // accidentally fall into that pool. -#if BUILDFLAG(MAKE_GIGACAGE_GRANULARITY_PARTITION_PAGE_SIZE) + // BRP pool includes only normal buckets. Despite normal buckets operate at + // the 2MB super page granularity, we need to lower granularity down to + // partition page level to eliminate the guard pages at the ends. This is + // needed so that pointers immediately past an allocation that immediately + // precede a super page in BRP pool don't accidentally fall into that pool. static constexpr size_t kBitShiftOfBRPPoolBitmap = PartitionPageShift(); static constexpr size_t kBytesPer1BitOfBRPPoolBitmap = PartitionPageSize(); static constexpr size_t kGuardOffsetOfBRPPoolBitmap = 1; static constexpr size_t kGuardBitsOfBRPPoolBitmap = 2; -#else - static constexpr size_t kBitShiftOfBRPPoolBitmap = kSuperPageShift; - static constexpr size_t kBytesPer1BitOfBRPPoolBitmap = kSuperPageSize; - static constexpr size_t kGuardOffsetOfBRPPoolBitmap = 0; - static constexpr size_t kGuardBitsOfBRPPoolBitmap = 0; -#endif static constexpr size_t kBRPPoolBits = kAddressSpaceSize / kBytesPer1BitOfBRPPoolBitmap; // Non-BRP pool includes both normal bucket and direct map allocations, so // PageAllocationGranularity() has to be used. No need to eliminate guard - // pages at the ends in the MAKE_GIGACAGE_GRANULARITY_PARTITION_PAGE_SIZE - // case, as this is a BackupRefPtr-specific concern. + // pages at the ends, as this is a BackupRefPtr-specific concern. static constexpr size_t kNonBRPPoolBits = kAddressSpaceSize / PageAllocationGranularity();
diff --git a/base/allocator/partition_allocator/partition_alloc_unittest.cc b/base/allocator/partition_allocator/partition_alloc_unittest.cc index 350f161..97ed054 100644 --- a/base/allocator/partition_allocator/partition_alloc_unittest.cc +++ b/base/allocator/partition_allocator/partition_alloc_unittest.cc
@@ -1292,7 +1292,9 @@ static_assert(kExtraAllocSize < 64, ""); size_t very_small_size = (kExtraAllocSize <= 32) ? (32 - kExtraAllocSize) : (64 - kExtraAllocSize); - bucket_index = SizeToIndex(very_small_size + kExtraAllocSize); + size_t very_small_adjusted_size = + allocator.root()->AdjustSize0IfNeeded(very_small_size); + bucket_index = SizeToIndex(very_small_adjusted_size + kExtraAllocSize); bucket = &allocator.root()->buckets[bucket_index]; EXPECT_EQ(nullptr, bucket->empty_slot_spans_head); @@ -1301,11 +1303,12 @@ slot_span = SlotSpan::FromSlotStartPtr( allocator.root()->AdjustPointerForExtrasSubtract(ptr)); EXPECT_EQ(1, slot_span->num_allocated_slots); + size_t very_small_actual_size = allocator.root()->GetUsableSize(ptr); total_slots = (slot_span->bucket->num_system_pages_per_slot_span * SystemPageSize()) / - (very_small_size + kExtraAllocSize); + (very_small_actual_size + kExtraAllocSize); first_slot_span_slots = - SystemPageSize() / (very_small_size + kExtraAllocSize); + SystemPageSize() / (very_small_actual_size + kExtraAllocSize); EXPECT_EQ(total_slots - first_slot_span_slots, slot_span->num_unprovisioned_slots);
diff --git a/base/allocator/partition_allocator/partition_root.h b/base/allocator/partition_allocator/partition_root.h index 67077c38..e7f05bd 100644 --- a/base/allocator/partition_allocator/partition_root.h +++ b/base/allocator/partition_allocator/partition_root.h
@@ -470,6 +470,25 @@ #endif // BUILDFLAG(USE_BACKUP_REF_PTR) && // (!BUILDFLAG(PUT_REF_COUNT_IN_PREVIOUS_SLOT) || // defined(PA_REF_COUNT_FILLS_ENTIRE_SMALLEST_SLOT)) + +#if defined(OS_APPLE) && DCHECK_IS_ON() + // On macOS and iOS, malloc zone's `size` function is used for two purposes; + // as a zone dispatcher and as an underlying implementation of + // malloc_size(3). As a zone dispatcher, `size` function must not return + // zero as long as the given pointer belongs to this zone. At the same + // time, the return value of `size` function is used as the result of + // malloc_size(3), so we have to actually allocate at least that size of + // memory. + // + // When DCHECK_IS_ON() and the requested size is zero, extras occupy the + // allocated memory entirely and the size of user data will be zero. In + // order to avoid an allocation of zero bytes of user data, always allocate + // at least 1 byte memory. When DCHECK is off, there is no extras and + // there is no case of zero bytes of user data. + if (UNLIKELY(size == 0)) + return 1; +#endif // defined(OS_APPLE) && DCHECK_IS_ON() + return size; }
diff --git a/base/allocator/partition_allocator/starscan/pcscan.cc b/base/allocator/partition_allocator/starscan/pcscan.cc index c2139294..0b843724 100644 --- a/base/allocator/partition_allocator/starscan/pcscan.cc +++ b/base/allocator/partition_allocator/starscan/pcscan.cc
@@ -76,7 +76,7 @@ PCScanInternal::Instance().FinishScanForTesting(); // IN-TEST } -PCScan PCScan::instance_ PA_CONSTINIT; +PCScan PCScan::instance_ CONSTINIT; } // namespace internal } // namespace base
diff --git a/base/allocator/partition_allocator/starscan/pcscan.h b/base/allocator/partition_allocator/starscan/pcscan.h index d117c952..1c43430 100644 --- a/base/allocator/partition_allocator/starscan/pcscan.h +++ b/base/allocator/partition_allocator/starscan/pcscan.h
@@ -15,14 +15,6 @@ #include "base/base_export.h" #include "base/compiler_specific.h" -#if defined(__has_attribute) -#if __has_attribute(require_constant_initialization) -#define PA_CONSTINIT __attribute__((require_constant_initialization)) -#else -#define PA_CONSTINIT -#endif -#endif - #define PCSCAN_DISABLE_SAFEPOINTS 0 namespace base { @@ -144,8 +136,8 @@ size_t epoch() const { return scheduler_.epoch(); } - // PA_CONSTINIT for fast access (avoiding static thread-safe initialization). - static PCScan instance_ PA_CONSTINIT; + // CONSTINIT for fast access (avoiding static thread-safe initialization). + static PCScan instance_ CONSTINIT; PCScanScheduler scheduler_{}; std::atomic<State> state_{State::kNotRunning};
diff --git a/base/compiler_specific.h b/base/compiler_specific.h index a707648..457334d3 100644 --- a/base/compiler_specific.h +++ b/base/compiler_specific.h
@@ -382,4 +382,15 @@ #define REINITIALIZES_AFTER_MOVE #endif +// Requires constant initialization. See constinit in C++20. Allows to rely on a +// variable being initialized before execution, and not requiring a global +// constructor. +#if defined(__has_attribute) +#if __has_attribute(require_constant_initialization) +#define CONSTINIT __attribute__((require_constant_initialization)) +#else +#define CONSTINIT +#endif +#endif + #endif // BASE_COMPILER_SPECIFIC_H_
diff --git a/base/containers/small_map.h b/base/containers/small_map.h index e4433d3..0d22849 100644 --- a/base/containers/small_map.h +++ b/base/containers/small_map.h
@@ -10,7 +10,6 @@ #include <limits> #include <map> #include <new> -#include <string> #include <unordered_map> #include <utility>
diff --git a/base/fuchsia/intl_profile_watcher_unittest.cc b/base/fuchsia/intl_profile_watcher_unittest.cc index af65ff8..b08e88c 100644 --- a/base/fuchsia/intl_profile_watcher_unittest.cc +++ b/base/fuchsia/intl_profile_watcher_unittest.cc
@@ -109,8 +109,8 @@ fidl::InterfaceRequest<::fuchsia::intl::PropertyProvider> provider_request) : thread_("Property Provider Thread") { - base::Thread::Options options(base::MessagePumpType::IO, 0); - CHECK(thread_.StartWithOptions(std::move(options))); + CHECK(thread_.StartWithOptions( + base::Thread::Options(base::MessagePumpType::IO, 0))); property_provider_ = base::SequenceBound<FakePropertyProvider>( thread_.task_runner(), std::move(provider_request)); }
diff --git a/base/memory/checked_ptr.h b/base/memory/checked_ptr.h index e7a71fe3..b7c76b40 100644 --- a/base/memory/checked_ptr.h +++ b/base/memory/checked_ptr.h
@@ -117,10 +117,13 @@ __builtin_assume(ptr != nullptr || !ret); #endif -#if BUILDFLAG(MAKE_GIGACAGE_GRANULARITY_PARTITION_PAGE_SIZE) // There may be pointers immediately after the allocation, e.g. - // CheckedPtr<T> ptr = AllocateNotFromPartitionAlloc(X * sizeof(T)); - // for (size_t i = 0; i < X; i++) { ptr++; } + // { + // // Assume this allocation happens outside of PartitionAlloc. + // CheckedPtr<T> ptr = new T[20]; + // for (size_t i = 0; i < 20; i ++) { ptr++; } + // } + // // Such pointers are *not* at risk of accidentally falling into BRP pool, // because: // 1) On 64-bit systems, BRP pool is preceded by non-BRP pool. @@ -135,26 +138,6 @@ DCHECK(reinterpret_cast<uintptr_t>(ptr) % kSuperPageSize >= PartitionPageSize()); } -#else - // There is a problem on 32-bit systems, where the fake "GigaCage" has many - // BRP pool regions spread throughout the address space. A pointer - // immediately past an allocation may accidentally fall into the BRP pool, - // hence check if |ptr-1| belongs to that pool. However, checking only - // |ptr-1| causes a problem with pointers to the beginning of an - // out-of-the-pool allocation that happen to be where the pool ends, so - // checking for |ptr| is also necessary. - // - // Note, if |ptr| is in the BRP pool, |ptr-1| will not fall out of it, - // thanks to the leading guard pages (i.e. |ptr| will never point to the - // beginning of GigaCage). - // - // 64-bit systems don't have this problem, because there is only one BRP - // pool region, positioned *after* the non-BRP pool. -#if !defined(PA_HAS_64_BITS_POINTERS) - auto* adjusted_ptr = static_cast<char*>(ptr) - 1; - ret &= IsManagedByPartitionAllocBRPPool(adjusted_ptr); -#endif -#endif return ret; }
diff --git a/base/metrics/histogram_snapshot_manager.h b/base/metrics/histogram_snapshot_manager.h index cf7c149..8264997 100644 --- a/base/metrics/histogram_snapshot_manager.h +++ b/base/metrics/histogram_snapshot_manager.h
@@ -9,7 +9,6 @@ #include <atomic> #include <map> -#include <string> #include <vector> #include "base/gtest_prod_util.h"
diff --git a/base/optional.h b/base/optional.h index 9ecd6ee..b105cc0 100644 --- a/base/optional.h +++ b/base/optional.h
@@ -9,12 +9,14 @@ namespace base { -template <typename T> -using Optional = absl::optional<T>; +// These aliases are deprecated. Use abseil directly instead. -using absl::make_optional; -using absl::nullopt; -using absl::nullopt_t; +template <typename T> +using Optional [[deprecated]] = absl::optional<T>; + +using absl::make_optional [[deprecated]]; +using absl::nullopt [[deprecated]]; +using absl::nullopt_t [[deprecated]]; } // namespace base
diff --git a/base/process/memory_unittest.cc b/base/process/memory_unittest.cc index 33ed610..2c0216e 100644 --- a/base/process/memory_unittest.cc +++ b/base/process/memory_unittest.cc
@@ -38,6 +38,9 @@ #include <malloc.h> #include "base/test/malloc_wrapper.h" #endif +#if defined(OS_ANDROID) +#include "base/android/build_info.h" +#endif #if defined(OS_WIN) @@ -170,11 +173,21 @@ base::allocator::UninterceptMallocZonesForTesting(); } #endif + + // These tests don't work properly on old x86 Android; crbug.com/1181112 + bool ShouldSkipTest() { +#if defined(OS_ANDROID) && defined(ARCH_CPU_X86) + return base::android::BuildInfo::GetInstance()->sdk_int() < + base::android::SDK_VERSION_NOUGAT; +#endif + return false; + } }; -// Failing on x86 android, crbug.com/1181112 -#if !defined(OS_ANDROID) || !defined(ARCH_CPU_X86) TEST_F(OutOfMemoryDeathTest, New) { + if (ShouldSkipTest()) { + return; + } ASSERT_OOM_DEATH({ SetUpInDeathAssert(); value_ = operator new(test_size_); @@ -182,6 +195,9 @@ } TEST_F(OutOfMemoryDeathTest, NewArray) { + if (ShouldSkipTest()) { + return; + } ASSERT_OOM_DEATH({ SetUpInDeathAssert(); value_ = new char[test_size_]; @@ -189,6 +205,9 @@ } TEST_F(OutOfMemoryDeathTest, Malloc) { + if (ShouldSkipTest()) { + return; + } ASSERT_OOM_DEATH({ SetUpInDeathAssert(); value_ = malloc(test_size_); @@ -196,6 +215,9 @@ } TEST_F(OutOfMemoryDeathTest, Realloc) { + if (ShouldSkipTest()) { + return; + } ASSERT_OOM_DEATH({ SetUpInDeathAssert(); value_ = realloc(nullptr, test_size_); @@ -203,6 +225,9 @@ } TEST_F(OutOfMemoryDeathTest, Calloc) { + if (ShouldSkipTest()) { + return; + } ASSERT_OOM_DEATH({ SetUpInDeathAssert(); value_ = calloc(1024, test_size_ / 1024L); @@ -210,16 +235,21 @@ } TEST_F(OutOfMemoryDeathTest, AlignedAlloc) { + if (ShouldSkipTest()) { + return; + } ASSERT_OOM_DEATH({ SetUpInDeathAssert(); value_ = base::AlignedAlloc(test_size_, 8); }); } -#endif // POSIX does not define an aligned realloc function. #if defined(OS_WIN) TEST_F(OutOfMemoryDeathTest, AlignedRealloc) { + if (ShouldSkipTest()) { + return; + } ASSERT_OOM_DEATH({ SetUpInDeathAssert(); value_ = _aligned_realloc(nullptr, test_size_, 8);
diff --git a/base/process/process_metrics.h b/base/process/process_metrics.h index a97433d..8e50332b 100644 --- a/base/process/process_metrics.h +++ b/base/process/process_metrics.h
@@ -14,6 +14,7 @@ #include <memory> #include "base/base_export.h" +#include "base/compiler_specific.h" #include "base/gtest_prod_util.h" #include "base/macros.h" #include "base/process/process_handle.h"
diff --git a/base/strings/string_number_conversions_internal.h b/base/strings/string_number_conversions_internal.h index 990c3e98..d35f3cf 100644 --- a/base/strings/string_number_conversions_internal.h +++ b/base/strings/string_number_conversions_internal.h
@@ -213,16 +213,16 @@ return result; } -template <typename CharT, typename VALUE> -bool StringToIntImpl(BasicStringPiece<CharT> input, VALUE& output) { - auto result = StringToNumber<VALUE, 10>(input); +template <typename T, typename VALUE, typename CharT = typename T::value_type> +bool StringToIntImpl(T input, VALUE& output) { + auto result = StringToNumber<VALUE, 10, CharT>(input); output = result.value; return result.valid; } -template <typename CharT, typename VALUE> -bool HexStringToIntImpl(BasicStringPiece<CharT> input, VALUE& output) { - auto result = StringToNumber<VALUE, 16>(input); +template <typename T, typename VALUE, typename CharT = typename T::value_type> +bool HexStringToIntImpl(T input, VALUE& output) { + auto result = StringToNumber<VALUE, 16, CharT>(input); output = result.value; return result.valid; }
diff --git a/base/strings/string_piece.cc b/base/strings/string_piece.cc index 802c99e..95170da 100644 --- a/base/strings/string_piece.cc +++ b/base/strings/string_piece.cc
@@ -56,10 +56,8 @@ namespace internal { -template <typename CharT> -size_t findT(BasicStringPiece<CharT> self, - BasicStringPiece<CharT> s, - size_t pos) { +template <typename T, typename CharT = typename T::value_type> +size_t findT(T self, T s, size_t pos) { if (pos > self.size()) return BasicStringPiece<CharT>::npos; @@ -78,10 +76,8 @@ return findT(self, s, pos); } -template <typename CharT> -size_t rfindT(BasicStringPiece<CharT> self, - BasicStringPiece<CharT> s, - size_t pos) { +template <typename T, typename CharT = typename T::value_type> +size_t rfindT(T self, T s, size_t pos) { if (self.size() < s.size()) return BasicStringPiece<CharT>::npos; @@ -124,10 +120,8 @@ } // Generic brute force version. -template <typename CharT> -size_t find_first_ofT(BasicStringPiece<CharT> self, - BasicStringPiece<CharT> s, - size_t pos) { +template <typename T, typename CharT = typename T::value_type> +size_t find_first_ofT(T self, T s, size_t pos) { // Use the faster std::find() if searching for a single character. typename BasicStringPiece<CharT>::const_iterator found = s.size() == 1 ? std::find(self.begin() + pos, self.end(), s[0]) @@ -165,10 +159,8 @@ } // Generic brute-force version. -template <typename CharT> -size_t find_first_not_ofT(BasicStringPiece<CharT> self, - BasicStringPiece<CharT> s, - size_t pos) { +template <typename T, typename CharT = typename T::value_type> +size_t find_first_not_ofT(T self, T s, size_t pos) { if (self.size() == 0) return BasicStringPiece<CharT>::npos; @@ -211,10 +203,8 @@ } // Generic brute-force version. -template <typename CharT> -size_t find_last_ofT(BasicStringPiece<CharT> self, - BasicStringPiece<CharT> s, - size_t pos) { +template <typename T, typename CharT = typename T::value_type> +size_t find_last_ofT(T self, T s, size_t pos) { if (self.size() == 0) return BasicStringPiece<CharT>::npos; @@ -259,10 +249,8 @@ } // Generic brute-force version. -template <typename CharT> -size_t find_last_not_ofT(BasicStringPiece<CharT> self, - BasicStringPiece<CharT> s, - size_t pos) { +template <typename T, typename CharT = typename T::value_type> +size_t find_last_not_ofT(T self, T s, size_t pos) { if (self.size() == 0) return StringPiece::npos;
diff --git a/base/strings/string_split_internal.h b/base/strings/string_split_internal.h index d5bf462..cd42d8f4 100644 --- a/base/strings/string_split_internal.h +++ b/base/strings/string_split_internal.h
@@ -29,12 +29,13 @@ // General string splitter template. Can take 8- or 16-bit input, can produce // the corresponding string or StringPiece output. -template <typename OutputStringType, typename CharT> -static std::vector<OutputStringType> SplitStringT( - BasicStringPiece<CharT> str, - BasicStringPiece<CharT> delimiter, - WhitespaceHandling whitespace, - SplitResult result_type) { +template <typename OutputStringType, + typename T, + typename CharT = typename T::value_type> +static std::vector<OutputStringType> SplitStringT(T str, + T delimiter, + WhitespaceHandling whitespace, + SplitResult result_type) { std::vector<OutputStringType> result; if (str.empty()) return result; @@ -61,10 +62,12 @@ return result; } -template <typename OutputStringType, typename CharT> +template <typename OutputStringType, + typename T, + typename CharT = typename T::value_type> std::vector<OutputStringType> SplitStringUsingSubstrT( - BasicStringPiece<CharT> input, - BasicStringPiece<CharT> delimiter, + T input, + T delimiter, WhitespaceHandling whitespace, SplitResult result_type) { using Piece = BasicStringPiece<CharT>;
diff --git a/base/strings/string_util_internal.h b/base/strings/string_util_internal.h index 3c64603..9544500 100644 --- a/base/strings/string_util_internal.h +++ b/base/strings/string_util_internal.h
@@ -43,8 +43,8 @@ return !(reinterpret_cast<MachineWord>(pointer) & (sizeof(MachineWord) - 1)); } -template <typename CharT> -std::basic_string<CharT> ToLowerASCIIImpl(BasicStringPiece<CharT> str) { +template <typename T, typename CharT = typename T::value_type> +std::basic_string<CharT> ToLowerASCIIImpl(T str) { std::basic_string<CharT> ret; ret.reserve(str.size()); for (size_t i = 0; i < str.size(); i++) @@ -52,8 +52,8 @@ return ret; } -template <typename CharT> -std::basic_string<CharT> ToUpperASCIIImpl(BasicStringPiece<CharT> str) { +template <typename T, typename CharT = typename T::value_type> +std::basic_string<CharT> ToUpperASCIIImpl(T str) { std::basic_string<CharT> ret; ret.reserve(str.size()); for (size_t i = 0; i < str.size(); i++) @@ -61,9 +61,8 @@ return ret; } -template <class CharT> -int CompareCaseInsensitiveASCIIT(BasicStringPiece<CharT> a, - BasicStringPiece<CharT> b) { +template <typename T, typename CharT = typename T::value_type> +int CompareCaseInsensitiveASCIIT(T a, T b) { // Find the first characters that aren't equal and compare them. If the end // of one of the strings is found before a nonequal character, the lengths // of the strings are compared. @@ -88,9 +87,9 @@ return 1; } -template <typename CharT> -TrimPositions TrimStringT(BasicStringPiece<CharT> input, - BasicStringPiece<CharT> trim_chars, +template <typename T, typename CharT = typename T::value_type> +TrimPositions TrimStringT(T input, + T trim_chars, TrimPositions positions, std::basic_string<CharT>* output) { // Find the edges of leading/trailing whitespace as desired. Need to use @@ -124,10 +123,8 @@ (last_good_char == last_char ? TRIM_NONE : TRIM_TRAILING)); } -template <typename CharT> -BasicStringPiece<CharT> TrimStringPieceT(BasicStringPiece<CharT> input, - BasicStringPiece<CharT> trim_chars, - TrimPositions positions) { +template <typename T, typename CharT = typename T::value_type> +T TrimStringPieceT(T input, T trim_chars, TrimPositions positions) { size_t begin = (positions & TRIM_LEADING) ? input.find_first_not_of(trim_chars) : 0; size_t end = (positions & TRIM_TRAILING) @@ -136,9 +133,9 @@ return input.substr(std::min(begin, input.size()), end - begin); } -template <typename CharT> +template <typename T, typename CharT = typename T::value_type> std::basic_string<CharT> CollapseWhitespaceT( - BasicStringPiece<CharT> text, + T text, bool trim_sequences_with_line_breaks) { std::basic_string<CharT> result; result.resize(text.size()); @@ -258,18 +255,15 @@ // The hardcoded strings are typically very short so it doesn't matter, and the // string piece gives additional flexibility for the caller (doesn't have to be // null terminated) so we choose the StringPiece route. -template <typename CharT> -inline bool DoLowerCaseEqualsASCII(BasicStringPiece<CharT> str, - StringPiece lowercase_ascii) { +template <typename T, typename CharT = typename T::value_type> +inline bool DoLowerCaseEqualsASCII(T str, StringPiece lowercase_ascii) { return std::equal( str.begin(), str.end(), lowercase_ascii.begin(), lowercase_ascii.end(), [](auto lhs, auto rhs) { return ToLowerASCII(lhs) == rhs; }); } -template <typename CharT> -bool StartsWithT(BasicStringPiece<CharT> str, - BasicStringPiece<CharT> search_for, - CompareCase case_sensitivity) { +template <typename T, typename CharT = typename T::value_type> +bool StartsWithT(T str, T search_for, CompareCase case_sensitivity) { if (search_for.size() > str.size()) return false; @@ -289,10 +283,8 @@ } } -template <typename CharT> -bool EndsWithT(BasicStringPiece<CharT> str, - BasicStringPiece<CharT> search_for, - CompareCase case_sensitivity) { +template <typename T, typename CharT = typename T::value_type> +bool EndsWithT(T str, T search_for, CompareCase case_sensitivity) { if (search_for.size() > str.size()) return false; @@ -325,8 +317,8 @@ }; // Type deduction helper for SubstringMatcher. -template <class CharT> -auto MakeSubstringMatcher(BasicStringPiece<CharT> find_this) { +template <typename T, typename CharT = typename T::value_type> +auto MakeSubstringMatcher(T find_this) { return SubstringMatcher<CharT>{find_this}; } @@ -343,8 +335,8 @@ }; // Type deduction helper for CharacterMatcher. -template <class CharT> -auto MakeCharacterMatcher(BasicStringPiece<CharT> find_any_of_these) { +template <typename T, typename CharT = typename T::value_type> +auto MakeCharacterMatcher(T find_any_of_these) { return CharacterMatcher<CharT>{find_any_of_these}; } @@ -355,11 +347,11 @@ // // This is parameterized on a |Matcher| traits type, so that it can be the // implementation for both ReplaceChars() and ReplaceSubstringsAfterOffset(). -template <class CharT, class Matcher> +template <typename Matcher, typename T, typename CharT = typename T::value_type> bool DoReplaceMatchesAfterOffset(std::basic_string<CharT>* str, size_t initial_offset, Matcher matcher, - BasicStringPiece<CharT> replace_with, + T replace_with, ReplaceType replace_type) { using CharTraits = std::char_traits<CharT>; @@ -499,10 +491,10 @@ return true; } -template <class CharT> -bool ReplaceCharsT(BasicStringPiece<CharT> input, - BasicStringPiece<CharT> find_any_of_these, - BasicStringPiece<CharT> replace_with, +template <typename T, typename CharT = typename T::value_type> +bool ReplaceCharsT(T input, + T find_any_of_these, + T replace_with, std::basic_string<CharT>* output) { // Commonly, this is called with output and input being the same string; in // that case, skip the copy. @@ -527,9 +519,10 @@ // (base::span or std::initializer_list) of strings/StringPieces (std::string, // std::u16string, StringPiece or StringPiece16). |CharT| is either char or // char16_t. -template <typename list_type, typename CharT> -static std::basic_string<CharT> JoinStringT(list_type parts, - BasicStringPiece<CharT> sep) { +template <typename list_type, + typename T, + typename CharT = typename T::value_type> +static std::basic_string<CharT> JoinStringT(list_type parts, T sep) { if (base::empty(parts)) return std::basic_string<CharT>(); @@ -557,9 +550,9 @@ return result; } -template <class CharT> +template <typename T, typename CharT = typename T::value_type> std::basic_string<CharT> DoReplaceStringPlaceholders( - BasicStringPiece<CharT> format_string, + T format_string, const std::vector<std::basic_string<CharT>>& subst, std::vector<size_t>* offsets) { size_t substitutions = subst.size();
diff --git a/base/test/test_suite.h b/base/test/test_suite.h index ed63073..b64eed3 100644 --- a/base/test/test_suite.h +++ b/base/test/test_suite.h
@@ -10,7 +10,6 @@ // any gtest based tests that are linked into your executable. #include <memory> -#include <string> #include "base/at_exit.h" #include "base/check.h"
diff --git a/base/threading/platform_thread.cc b/base/threading/platform_thread.cc index f167af4..0fc082fa 100644 --- a/base/threading/platform_thread.cc +++ b/base/threading/platform_thread.cc
@@ -8,6 +8,7 @@ #include <memory> #include "base/feature_list.h" +#include "base/time/time.h" namespace base {
diff --git a/build/fuchsia/linux.sdk.sha1 b/build/fuchsia/linux.sdk.sha1 index 8a99fbf1..0519f7e 100644 --- a/build/fuchsia/linux.sdk.sha1 +++ b/build/fuchsia/linux.sdk.sha1
@@ -1 +1 @@ -4.20210517.5.1 +4.20210518.1.1
diff --git a/build/fuchsia/mac.sdk.sha1 b/build/fuchsia/mac.sdk.sha1 index 8a99fbf1..0519f7e 100644 --- a/build/fuchsia/mac.sdk.sha1 +++ b/build/fuchsia/mac.sdk.sha1
@@ -1 +1 @@ -4.20210517.5.1 +4.20210518.1.1
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java index b475582..7a5b192 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantGenericUiTest.java
@@ -69,6 +69,7 @@ import org.chromium.chrome.browser.autofill_assistant.generic_ui.AssistantDimension; import org.chromium.chrome.browser.autofill_assistant.proto.ActionProto; import org.chromium.chrome.browser.autofill_assistant.proto.AutofillFormatProto; +import org.chromium.chrome.browser.autofill_assistant.proto.AutofillProfileProto; import org.chromium.chrome.browser.autofill_assistant.proto.BooleanAndProto; import org.chromium.chrome.browser.autofill_assistant.proto.BooleanList; import org.chromium.chrome.browser.autofill_assistant.proto.BooleanNotProto; @@ -105,12 +106,14 @@ import org.chromium.chrome.browser.autofill_assistant.proto.InteractionsProto; import org.chromium.chrome.browser.autofill_assistant.proto.LinearLayoutProto; import org.chromium.chrome.browser.autofill_assistant.proto.ModelProto; +import org.chromium.chrome.browser.autofill_assistant.proto.ModelProto.ModelValue; import org.chromium.chrome.browser.autofill_assistant.proto.OnModelValueChangedEventProto; import org.chromium.chrome.browser.autofill_assistant.proto.OnTextLinkClickedProto; import org.chromium.chrome.browser.autofill_assistant.proto.OnUserActionCalled; import org.chromium.chrome.browser.autofill_assistant.proto.OnViewClickedEventProto; import org.chromium.chrome.browser.autofill_assistant.proto.ProcessedActionProto; import org.chromium.chrome.browser.autofill_assistant.proto.ProcessedActionStatusProto; +import org.chromium.chrome.browser.autofill_assistant.proto.ProfileList; import org.chromium.chrome.browser.autofill_assistant.proto.PromptProto; import org.chromium.chrome.browser.autofill_assistant.proto.SelectorProto; import org.chromium.chrome.browser.autofill_assistant.proto.SetModelValueProto; @@ -3518,4 +3521,79 @@ waitUntilViewMatchesCondition(withText("End"), isDisplayed()); onView(withText("callback")).check(doesNotExist()); } + + @Test + @MediumTest + public void testDisplaySelectedAddressInfo() throws Exception { + mHelper.addDummyCreditCard( + mHelper.addDummyProfile("Jane Doe", "johndoe@google.com"), "4111111111111111"); + + ViewProto rootView = + (ViewProto) ViewProto.newBuilder() + .setTextView(TextViewProto.newBuilder().setModelIdentifier("profile_name")) + .setIdentifier("textView") + .build(); + + List<InteractionProto> interactions = new ArrayList<>(); + interactions.add( + (InteractionProto) InteractionProto.newBuilder() + .addTriggerEvent(EventProto.newBuilder().setOnValueChanged( + OnModelValueChangedEventProto.newBuilder().setModelIdentifier( + "profile"))) + .addCallbacks(createAutofillToStringCallback("profile[0]", "profile_name", + ValueExpression.newBuilder().addChunk( + Chunk.newBuilder().setKey(3)))) + .build()); + List<ModelProto.ModelValue> modelValues = new ArrayList<>(); + modelValues.add( + ModelValue.newBuilder() + .setValue(ValueProto.newBuilder().setProfiles( + ProfileList.newBuilder().addValues( + AutofillProfileProto.newBuilder().setSelectedProfileName( + "SHIPPING_ADDRESS")))) + .setIdentifier("profile") + .build()); + + ArrayList<ActionProto> list = new ArrayList<>(); + list.add((ActionProto) ActionProto.newBuilder() + .setCollectUserData( + CollectUserDataProto.newBuilder() + .setRequestTermsAndConditions(false) + .setShippingAddressSectionTitle("Delivery address") + .setShippingAddressName("SHIPPING_ADDRESS")) + .build()); + list.add((ActionProto) ActionProto.newBuilder() + .setSetPersistentUi( + SetPersistentUiProto.newBuilder().setGenericUserInterface( + GenericUserInterfaceProto.newBuilder() + .setRootView(rootView) + .setModel(ModelProto.newBuilder().addAllValues( + modelValues)) + .setInteractions(InteractionsProto.newBuilder() + .addAllInteractions( + interactions)))) + .build()); + list.add((ActionProto) ActionProto.newBuilder() + .setPrompt(PromptProto.newBuilder().setMessage("End").addChoices( + PromptProto.Choice.newBuilder())) + .build()); + + AutofillAssistantTestScript script = new AutofillAssistantTestScript( + (SupportedScriptProto) SupportedScriptProto.newBuilder() + .setPath("autofill_assistant_target_website.html") + .setPresentation(PresentationProto.newBuilder().setAutostart(true).setChip( + ChipProto.newBuilder().setText("Autostart"))) + .build(), + list); + + AutofillAssistantTestService testService = + new AutofillAssistantTestService(Collections.singletonList(script)); + startAutofillAssistant(mTestRule.getActivity(), testService); + + waitUntilViewMatchesCondition(withText("Continue"), isDisplayed()); + onView(withText("Continue")).perform(click()); + + waitUntilViewMatchesCondition(withText("End"), isDisplayed()); + waitUntilViewMatchesCondition(withText("Jane"), isCompletelyDisplayed()); + } }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/PasswordChangeFixtureTest.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/PasswordChangeFixtureTest.java index fea1efe..227f348 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/PasswordChangeFixtureTest.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/PasswordChangeFixtureTest.java
@@ -14,6 +14,7 @@ import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.waitUntil; import static org.chromium.chrome.browser.autofill_assistant.AutofillAssistantUiTestUtil.waitUntilViewMatchesCondition; +import static org.chromium.chrome.browser.autofill_assistant.PasswordChangeFixtureTestUtils.MAX_WAIT_BETWEEN_TESTS_IN_MS; import static org.chromium.chrome.browser.autofill_assistant.PasswordChangeFixtureTestUtils.MAX_WAIT_TIME_IN_MS; import static org.chromium.chrome.browser.autofill_assistant.PasswordChangeFixtureTestUtils.TAG; import static org.chromium.chrome.browser.autofill_assistant.PasswordChangeFixtureTestUtils.checkCredentialsDifferByPassword; @@ -150,28 +151,21 @@ } /** - * Runs the script a single time. Checks the script successfully changes password in Chrome - * password manager. - */ - @Test - @Manual - public void testSingleRun() throws Exception { - testRun(mParameters.getUsername()); - logPasswordStoreCredentials(mPasswordStoreBridge, "Final password store state"); - } - - /** * Runs the script multiple times (defined by --num-runs) consecutively. Checks the script * successfully changes password in Chrome password manager. There should be only one entry for * that domain with the new password. */ @Test @Manual - public void testMultipleRuns() throws Exception { + public void testDefaultRuns() throws Exception { for (int i = 0; i < mParameters.getNumRuns(); i++) { // Run and test script. testRun(mParameters.getUsername()); - Log.i(TAG, "[EVENT: Run #%s succeded]", String.valueOf(i + 1)); + + if (i + 1 < mParameters.getNumRuns()) { + Log.i(TAG, "[Run #%s succeeded]", String.valueOf(i + 1)); + Thread.sleep(MAX_WAIT_BETWEEN_TESTS_IN_MS); + } } logPasswordStoreCredentials(mPasswordStoreBridge, "Final password store state"); @@ -183,14 +177,21 @@ */ @Test @Manual - public void testSingleRunNoCookies() throws Exception { - clearBrowsingData(new int[] {BrowsingDataType.HISTORY, BrowsingDataType.CACHE, - BrowsingDataType.COOKIES, BrowsingDataType.SITE_SETTINGS}, - TimePeriod.ALL_TIME); - Log.i(TAG, "[EVENT: Site settings cleared]"); + public void testNoCookies() throws Exception { + for (int i = 0; i < mParameters.getNumRuns(); i++) { + clearBrowsingData(new int[] {BrowsingDataType.HISTORY, BrowsingDataType.CACHE, + BrowsingDataType.COOKIES, BrowsingDataType.SITE_SETTINGS}, + TimePeriod.ALL_TIME); + Log.i(TAG, "[Site settings cleared]"); - // Run and test password change. - testRun(mParameters.getUsername()); + // Run and test password change. + testRun(mParameters.getUsername()); + + if (i + 1 < mParameters.getNumRuns()) { + Log.i(TAG, "[Run #%s succeeded]", String.valueOf(i + 1)); + Thread.sleep(MAX_WAIT_BETWEEN_TESTS_IN_MS); + } + } logPasswordStoreCredentials(mPasswordStoreBridge, "Final password store state"); } @@ -212,8 +213,8 @@ withText("Opening site's settings..."), isDisplayed(), MAX_WAIT_TIME_IN_MS); // Should fail during login. Wait for error opening site's settings. - waitUntilViewMatchesCondition(withText("Sorry, could not open site's settings"), - isDisplayed(), MAX_WAIT_TIME_IN_MS); + waitUntilViewMatchesCondition( + withText("Can't open site's settings"), isDisplayed(), MAX_WAIT_TIME_IN_MS); // Assert initial credential has not changed. PasswordStoreCredential newCredential = getCredentialForDomainAndUser( @@ -274,8 +275,15 @@ for (int i = 0; i < initialCredentials.length; i++) { // Run and test script. testRun(initialCredentials[i].getUsername()); + if (i + 1 < initialCredentials.length) { + Thread.sleep(MAX_WAIT_BETWEEN_TESTS_IN_MS); + } } - Log.i(TAG, "[EVENT: Run #%s succeded]", String.valueOf(run + 1)); + + if (run + 1 < mParameters.getNumRuns()) { + Log.i(TAG, "[Run #%s succeeded]", String.valueOf(run + 1)); + Thread.sleep(MAX_WAIT_BETWEEN_TESTS_IN_MS); + } } logPasswordStoreCredentials(mPasswordStoreBridge, "Final password store state"); @@ -283,13 +291,12 @@ @Override public void onSavedPasswordsChanged(int count) { - logPasswordStoreCredentials( - mPasswordStoreBridge, "EVENT: New set of credentials available"); + logPasswordStoreCredentials(mPasswordStoreBridge, "New set of credentials available"); mCredentials = mPasswordStoreBridge.getAllCredentials(); } @Override public void onEdit(PasswordStoreCredential credential) { - Log.i(TAG, "[EVENT: Credential %s edited]", credential.toString()); + Log.i(TAG, "[Credential %s edited]", credential.toString()); } }
diff --git a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/PasswordChangeFixtureTestUtils.java b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/PasswordChangeFixtureTestUtils.java index ae5ad9d..c0d49dd 100644 --- a/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/PasswordChangeFixtureTestUtils.java +++ b/chrome/android/features/autofill_assistant/javatests/src/org/chromium/chrome/browser/autofill_assistant/PasswordChangeFixtureTestUtils.java
@@ -29,6 +29,13 @@ public final class PasswordChangeFixtureTestUtils { /** The default maximum time to wait for a criteria to become valid. */ public static final long MAX_WAIT_TIME_IN_MS = 60000; + /** + * The default maximum time to wait in-between consecutive tests. + * + * The small delay in-between tests allows for easier visualization during consecutive test + * runs. + * */ + public static final long MAX_WAIT_BETWEEN_TESTS_IN_MS = 1000; /** Default tag to log password change integration tests information. */ public static final String TAG = "PasswordChangeTest";
diff --git a/chrome/android/features/autofill_assistant/tools/password_change_tests_runner/runner.py b/chrome/android/features/autofill_assistant/tools/password_change_tests_runner/runner.py index 8d024ee..e3c9ca8 100755 --- a/chrome/android/features/autofill_assistant/tools/password_change_tests_runner/runner.py +++ b/chrome/android/features/autofill_assistant/tools/password_change_tests_runner/runner.py
@@ -20,9 +20,8 @@ import sys tests_list = [ - 'testSingleRun', - 'testMultipleRuns', - 'testSingleRunNoCookies', + 'testDefaultRuns', + 'testNoCookies', 'testInvalidCredentials', 'testUserDeclinesGeneratedPassword', 'testMultipleCredentials'
diff --git a/chrome/android/java/res/layout/autofill_update_address_profile_prompt.xml b/chrome/android/java/res/layout/autofill_update_address_profile_prompt.xml index e6e1549..0c560de1 100644 --- a/chrome/android/java/res/layout/autofill_update_address_profile_prompt.xml +++ b/chrome/android/java/res/layout/autofill_update_address_profile_prompt.xml
@@ -13,7 +13,6 @@ android:id="@+id/subtitle" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginBottom="4dp" android:paddingStart="@dimen/dialog_padding_sides" android:paddingEnd="@dimen/dialog_padding_sides" android:ellipsize="end" @@ -23,6 +22,7 @@ <org.chromium.components.browser_ui.widget.FadingEdgeScrollView android:layout_width="match_parent" android:layout_height="0dp" + android:layout_marginTop="4dp" android:layout_weight="1" android:fadeScrollbars="false">
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/tab_activity_glue/ActivityTabWebContentsDelegateAndroid.java b/chrome/android/java/src/org/chromium/chrome/browser/app/tab_activity_glue/ActivityTabWebContentsDelegateAndroid.java index 0534745..3ebd738e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/tab_activity_glue/ActivityTabWebContentsDelegateAndroid.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/tab_activity_glue/ActivityTabWebContentsDelegateAndroid.java
@@ -355,6 +355,12 @@ } @Override + public boolean controlsResizeView() { + return mCompositorViewHolderSupplier.hasValue() + && mCompositorViewHolderSupplier.get().controlsResizeView(); + } + + @Override public void enterFullscreenModeForTab(boolean prefersNavigationBar) { if (mFullscreenManager != null) { mFullscreenManager.onEnterFullscreen(mTab, new FullscreenOptions(prefersNavigationBar));
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/SaveAddressProfilePrompt.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/SaveAddressProfilePrompt.java index b2124fa..449b640a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/SaveAddressProfilePrompt.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/SaveAddressProfilePrompt.java
@@ -148,7 +148,7 @@ */ @CalledByNative private void setUpdateDetails(String subtitle, String oldDetails, String newDetails) { - ((TextView) mDialogView.findViewById(R.id.subtitle)).setText(subtitle); + showTextIfNotEmpty(mDialogView.findViewById(R.id.subtitle), subtitle); showHeaders(!TextUtils.isEmpty(oldDetails)); showTextIfNotEmpty(mDialogView.findViewById(R.id.details_old), oldDetails); showTextIfNotEmpty(mDialogView.findViewById(R.id.details_new), newDetails);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java index a0c3066..bda3eb0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill_assistant/AutofillAssistantPreferenceFragment.java
@@ -20,7 +20,6 @@ import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.signin.services.UnifiedConsentServiceBridge; import org.chromium.chrome.browser.sync.settings.GoogleServicesSettings; -import org.chromium.chrome.browser.sync.settings.SyncAndServicesSettings; import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.browser_ui.settings.SettingsUtils; @@ -93,14 +92,7 @@ mGoogleServicesSettingsLink = findPreference(PREF_GOOGLE_SERVICES_SETTINGS_LINK); NoUnderlineClickableSpan linkSpan = new NoUnderlineClickableSpan(getResources(), view -> { SettingsLauncher settingsLauncher = new SettingsLauncherImpl(); - if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) { - settingsLauncher.launchSettingsActivity( - getActivity(), GoogleServicesSettings.class); - } else { - settingsLauncher.launchSettingsActivity(getActivity(), - SyncAndServicesSettings.class, - SyncAndServicesSettings.createArguments(false)); - } + settingsLauncher.launchSettingsActivity(requireContext(), GoogleServicesSettings.class); }); mGoogleServicesSettingsLink.setSummary( SpanApplier.applySpans(getString(R.string.prefs_proactive_help_sync_link),
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java index 74a0b404..221f603b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java
@@ -975,7 +975,7 @@ */ private void updateViewportSize() { if (mInGesture || mContentViewScrolling) return; - + boolean controlsResizeViewChanged = false; if (mBrowserControlsManager != null) { // Update content viewport size only if the browser controls are not moving, i.e. not // scrolling or animating. @@ -985,12 +985,17 @@ BrowserControlsUtils.controlsResizeView(mBrowserControlsManager); if (controlsResizeView != mControlsResizeView) { mControlsResizeView = controlsResizeView; - onControlsResizeViewChanged(getWebContents(), mControlsResizeView); + controlsResizeViewChanged = true; } } // Reflect the changes that may have happened in in view/control size. Point viewportSize = getViewportSize(); setSize(getWebContents(), getContentView(), viewportSize.x, viewportSize.y); + if (controlsResizeViewChanged) { + // Send this after setSize, so that RenderWidgetHost doesn't SynchronizeVisualProperties + // in a partly-updated state. + onControlsResizeViewChanged(getWebContents(), mControlsResizeView); + } } // View.OnHierarchyChangeListener implementation @@ -1265,6 +1270,13 @@ : 0; } + /** + * @return {@code true} if browser controls shrink Blink view's size. + */ + public boolean controlsResizeView() { + return mControlsResizeView; + } + @Override public float getOverlayTranslateY() { return mBrowserControlsManager.getTopVisibleContentOffset();
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java index 80706af..4395691 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/firstrun/FirstRunSignInProcessor.java
@@ -11,7 +11,6 @@ import androidx.annotation.VisibleForTesting; import org.chromium.chrome.browser.SyncFirstSetupCompleteSource; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.profiles.Profile; @@ -22,7 +21,6 @@ import org.chromium.chrome.browser.signin.services.UnifiedConsentServiceBridge; import org.chromium.chrome.browser.sync.ProfileSyncService; import org.chromium.chrome.browser.sync.settings.ManageSyncSettings; -import org.chromium.chrome.browser.sync.settings.SyncAndServicesSettings; import org.chromium.components.browser_ui.settings.SettingsLauncher; import org.chromium.components.signin.AccountManagerFacadeProvider; import org.chromium.components.signin.AccountUtils; @@ -111,13 +109,8 @@ */ private static void openSignInSettings(Activity activity) { SettingsLauncher settingsLauncher = new SettingsLauncherImpl(); - if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) { - settingsLauncher.launchSettingsActivity( - activity, ManageSyncSettings.class, ManageSyncSettings.createArguments(true)); - } else { - settingsLauncher.launchSettingsActivity(activity, SyncAndServicesSettings.class, - SyncAndServicesSettings.createArguments(true)); - } + settingsLauncher.launchSettingsActivity( + activity, ManageSyncSettings.class, ManageSyncSettings.createArguments(true)); } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/identity_disc/IdentityDiscController.java b/chrome/android/java/src/org/chromium/chrome/browser/identity_disc/IdentityDiscController.java index 5eb8641..0bb56898 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/identity_disc/IdentityDiscController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/identity_disc/IdentityDiscController.java
@@ -16,7 +16,6 @@ import org.chromium.base.supplier.ObservableSupplier; import org.chromium.chrome.R; import org.chromium.chrome.browser.feature_engagement.TrackerFactory; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.lifecycle.NativeInitObserver; import org.chromium.chrome.browser.ntp.NewTabPage; @@ -25,7 +24,6 @@ import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.browser.signin.services.ProfileDataCache; -import org.chromium.chrome.browser.sync.settings.SyncAndServicesSettings; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.toolbar.ButtonData; import org.chromium.chrome.browser.toolbar.ButtonData.ButtonSpec; @@ -109,11 +107,7 @@ -> { recordIdentityDiscUsed(); SettingsLauncher settingsLauncher = new SettingsLauncherImpl(); - settingsLauncher.launchSettingsActivity(mContext, - ChromeFeatureList.isEnabled( - ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) - ? MainSettings.class - : SyncAndServicesSettings.class); + settingsLauncher.launchSettingsActivity(mContext, MainSettings.class); }, R.string.accessibility_toolbar_btn_identity_disc, /*supportsTinting=*/false, new IPHCommandBuilder(mContext.getResources(), @@ -322,13 +316,9 @@ * @return account info for the current profile. Returns null for OTR profile. */ private CoreAccountInfo getSignedInAccountInfo() { - @ConsentLevel - int consentLevel = - ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) - ? ConsentLevel.SIGNIN - : ConsentLevel.SYNC; - return mIdentityManager != null ? mIdentityManager.getPrimaryAccountInfo(consentLevel) - : null; + return mIdentityManager != null + ? mIdentityManager.getPrimaryAccountInfo(ConsentLevel.SIGNIN) + : null; } /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBar.java index b6cee61..c8eb898 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBar.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/SyncErrorInfoBar.java
@@ -18,11 +18,9 @@ import org.chromium.base.annotations.NativeMethods; import org.chromium.base.metrics.RecordHistogram; import org.chromium.chrome.R; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.settings.SettingsLauncherImpl; import org.chromium.chrome.browser.sync.ProfileSyncService; import org.chromium.chrome.browser.sync.settings.ManageSyncSettings; -import org.chromium.chrome.browser.sync.settings.SyncAndServicesSettings; import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils; import org.chromium.chrome.browser.sync.settings.SyncSettingsUtils.SyncError; import org.chromium.components.browser_ui.settings.SettingsLauncher; @@ -98,13 +96,8 @@ recordHistogram(mType, SyncErrorInfoBarAction.OPEN_SETTINGS_CLICKED); SettingsLauncher settingsLauncher = new SettingsLauncherImpl(); - if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) { - settingsLauncher.launchSettingsActivity(getApplicationContext(), - ManageSyncSettings.class, ManageSyncSettings.createArguments(false)); - } else { - settingsLauncher.launchSettingsActivity(getApplicationContext(), - SyncAndServicesSettings.class, SyncAndServicesSettings.createArguments(false)); - } + settingsLauncher.launchSettingsActivity(getApplicationContext(), ManageSyncSettings.class, + ManageSyncSettings.createArguments(false)); } @CalledByNative
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java index b5bd2ee..43fcbaf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java
@@ -12,7 +12,6 @@ import org.chromium.base.metrics.RecordUserAction; import org.chromium.base.task.PostTask; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.invalidation.SessionsInvalidationManager; import org.chromium.chrome.browser.ntp.ForeignSessionHelper.ForeignSession; import org.chromium.chrome.browser.ntp.ForeignSessionHelper.ForeignSessionTab; @@ -374,10 +373,8 @@ if (!mSignInManager.isSignInAllowed()) { return PromoState.PROMO_NONE; } - if (ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) - && mSignInManager.getIdentityManager().getPrimaryAccountInfo( - ConsentLevel.SIGNIN) - != null) { + if (mSignInManager.getIdentityManager().getPrimaryAccountInfo(ConsentLevel.SIGNIN) + != null) { return PromoState.PROMO_SYNC_PERSONALIZED; } return PromoState.PROMO_SIGNIN_PERSONALIZED;
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SignInPromo.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SignInPromo.java index fc437c1..f0ccbe50 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SignInPromo.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/SignInPromo.java
@@ -12,7 +12,6 @@ import org.chromium.base.Callback; import org.chromium.base.ContextUtils; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; import org.chromium.chrome.browser.profiles.Profile; @@ -133,9 +132,6 @@ } public boolean isUserSignedInButNotSyncing() { - if (!ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) { - return false; - } IdentityManager identityManager = IdentityServicesProvider.get().getIdentityManager( Profile.getLastUsedRegularProfile()); return identityManager.getPrimaryAccountInfo(ConsentLevel.SIGNIN) != null
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java index f337e39e..8f178e7b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
@@ -17,7 +17,6 @@ import org.chromium.chrome.R; import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncherImpl; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.preferences.Pref; import org.chromium.chrome.browser.privacy.secure_dns.SecureDnsSettings; import org.chromium.chrome.browser.privacy_sandbox.PrivacySandboxBridge; @@ -31,7 +30,6 @@ import org.chromium.chrome.browser.signin.services.IdentityServicesProvider; import org.chromium.chrome.browser.sync.settings.GoogleServicesSettings; import org.chromium.chrome.browser.sync.settings.ManageSyncSettings; -import org.chromium.chrome.browser.sync.settings.SyncAndServicesSettings; import org.chromium.chrome.browser.usage_stats.UsageStatsConsentDialog; import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; import org.chromium.components.browser_ui.settings.ManagedPreferenceDelegate; @@ -119,17 +117,6 @@ private SpannableString buildSyncAndServicesLink() { SettingsLauncher settingsLauncher = new SettingsLauncherImpl(); - if (!ChromeFeatureList.isEnabled(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY)) { - NoUnderlineClickableSpan syncAndServicesLink = - new NoUnderlineClickableSpan(getResources(), v -> { - settingsLauncher.launchSettingsActivity(getActivity(), - SyncAndServicesSettings.class, - SyncAndServicesSettings.createArguments(false)); - }); - return SpanApplier.applySpans(getString(R.string.privacy_sync_and_services_link_legacy), - new SpanApplier.SpanInfo("<link>", "</link>", syncAndServicesLink)); - } - NoUnderlineClickableSpan servicesLink = new NoUnderlineClickableSpan(getResources(), v -> { settingsLauncher.launchSettingsActivity(getActivity(), GoogleServicesSettings.class); });
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java index 528cf765..456770e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/sync/settings/ManageSyncSettings.java
@@ -294,6 +294,9 @@ Profile.getLastUsedRegularProfile(), null); return true; } + if (item.getItemId() == android.R.id.home) { + return onBackPressed(); + } return false; }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroidImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroidImpl.java index 645893c..cbd9b8a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroidImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabWebContentsDelegateAndroidImpl.java
@@ -356,6 +356,11 @@ return mDelegate.shouldAnimateBrowserControlsHeightChanges(); } + @Override + public boolean controlsResizeView() { + return mDelegate.controlsResizeView(); + } + @VisibleForTesting void showFramebustBlockInfobarForTesting(String url) { TabWebContentsDelegateAndroidImplJni.get().showFramebustBlockInfoBar(
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java index 8e1dabfa..74374c6 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/fullscreen/FullscreenManagerTest.java
@@ -7,6 +7,7 @@ // (http://crbug/642336) // import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_END_DEVICE; +import android.graphics.Point; import android.graphics.Rect; import android.graphics.Region; import android.os.Build; @@ -36,6 +37,7 @@ import org.chromium.base.test.util.FlakyTest; import org.chromium.base.test.util.UrlUtils; import org.chromium.chrome.R; +import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.compositor.layouts.OverviewModeController; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; @@ -53,6 +55,7 @@ import org.chromium.content_public.browser.GestureStateListener; import org.chromium.content_public.browser.SelectionPopupController; import org.chromium.content_public.browser.UiThreadTaskTraits; +import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.browser.test.util.JavaScriptUtils; import org.chromium.content_public.browser.test.util.TestThreadUtils; import org.chromium.content_public.browser.test.util.TestTouchUtils; @@ -134,6 +137,24 @@ + "<body style='height:10000px;' onclick='toggleFullScreen();'>" + "</body>" + "</html>"); + private static final String SCROLL_OFFSET_TEST_PAGE = UrlUtils.encodeHtmlDataUri("<html>" + + "<head>" + + " <meta name=viewport content='width=device-width, initial-scale=1.0'>" + + "</head>" + + "<body style='margin: 0; height: 200vh'>" + + " <div style='width: 150vw'>wide</div>" + + " <script>" + + " load_promise = new Promise(r => {onload = r});" + + " resize_promise = new Promise(r => {onresize = r});" + + " reached_bottom = () => {" + + " return Math.abs(" + + " (se => se.scrollHeight - (se.scrollTop + visualViewport.offsetTop +" + + " visualViewport.height))(document.scrollingElement)" + + " ) < 1;" + + " };" + + " </script>" + + "</body>" + + "</html>"); @Before public void setUp() { @@ -406,6 +427,36 @@ @Test @LargeTest + @Features.DisableFeatures({ChromeFeatureList.OFFLINE_INDICATOR}) + public void testHidingBrowserControlsPreservesScrollOffset() throws TimeoutException { + FullscreenManagerTestUtils.disableBrowserOverrides(); + mActivityTestRule.startMainActivityWithURL(SCROLL_OFFSET_TEST_PAGE); + + ChromeActivity activity = mActivityTestRule.getActivity(); + BrowserControlsManager browserControlsManager = activity.getBrowserControlsManager(); + + CriteriaHelper.pollUiThread( + () -> { return browserControlsManager.getTopControlOffset() == 0f; }); + + Point displaySize = new Point(); + activity.getWindowManager().getDefaultDisplay().getSize(displaySize); + + WebContents webContents = activity.getActivityTab().getWebContents(); + FullscreenManagerTestUtils.waitForPageToBeScrollable(activity.getActivityTab()); + + JavaScriptUtils.runJavascriptWithAsyncResult( + webContents, "load_promise.then(() => { domAutomationController.send(true); });"); + + FullscreenManagerTestUtils.fling(mActivityTestRule, 0, -displaySize.y * 20); + Assert.assertEquals("true", + JavaScriptUtils.runJavascriptWithAsyncResult(webContents, + "resize_promise.then(() => {" + + " domAutomationController.send(reached_bottom());" + + "});")); + } + + @Test + @LargeTest @Feature({"Fullscreen"}) @DisabledTest(message = "Flaky. crbug.com/936252") public void testManualFullscreenDisabledForChromePages() {
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/identity_disc/IdentityDiscControllerTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/identity_disc/IdentityDiscControllerTest.java index c5bc035..2dc5737e7 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/identity_disc/IdentityDiscControllerTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/identity_disc/IdentityDiscControllerTest.java
@@ -31,14 +31,12 @@ import org.chromium.base.test.util.CommandLineFlags; import org.chromium.chrome.R; -import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.flags.ChromeSwitches; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.test.ChromeJUnit4ClassRunner; import org.chromium.chrome.test.ChromeTabbedActivityTestRule; import org.chromium.chrome.test.util.ChromeTabUtils; import org.chromium.chrome.test.util.NewTabPageTestUtils; -import org.chromium.chrome.test.util.browser.Features; import org.chromium.chrome.test.util.browser.signin.AccountManagerTestRule; import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.content_public.browser.test.util.TestThreadUtils; @@ -49,7 +47,6 @@ */ @RunWith(ChromeJUnit4ClassRunner.class) @CommandLineFlags.Add({ChromeSwitches.DISABLE_FIRST_RUN_EXPERIENCE}) -@Features.DisableFeatures({ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY}) public class IdentityDiscControllerTest { private final ChromeTabbedActivityTestRule mActivityTestRule = new ChromeTabbedActivityTestRule(); @@ -88,7 +85,6 @@ @Test @MediumTest - @Features.EnableFeatures(ChromeFeatureList.MOBILE_IDENTITY_CONSISTENCY) public void testIdentityDiscWithSignin() { // When user is signed out, Identity Disc should not be visible on the NTP. onView(withId(R.id.optional_toolbar_button)).check((view, noViewException) -> {
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index bce8c45f..850fa69 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd
@@ -1101,6 +1101,9 @@ <message name="IDS_EULA_SCREEN_ACCESSIBLE_TITLE" desc="Title to be spoken on opening the OOBE EULA screen"> Chromium OS terms </message> + <message name="IDS_OOBE_WELCOME_START_OS_INSTALL" desc="Label for button shown on the OOBE welcome screen to show the OS installation screens"> + Install Chromium OS + </message> </if> <!-- Welcome page (chrome://welcome) strings -->
diff --git a/chrome/app/chromium_strings_grd/IDS_OOBE_WELCOME_START_OS_INSTALL.png.sha1 b/chrome/app/chromium_strings_grd/IDS_OOBE_WELCOME_START_OS_INSTALL.png.sha1 new file mode 100644 index 0000000..514d7a2 --- /dev/null +++ b/chrome/app/chromium_strings_grd/IDS_OOBE_WELCOME_START_OS_INSTALL.png.sha1
@@ -0,0 +1 @@ +2e21c9a9be9942bdb546429c972d1e3912dde8ff \ No newline at end of file
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index a2f4d34..72ec36f 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd
@@ -8559,9 +8559,6 @@ <message name="IDS_SYNC_ERROR_USER_MENU_RETRIEVE_KEYS_BUTTON" desc="Button in the header of desktop user menu that prompts the user to reauthentication to fix the sync error affecting encrypted datatypes."> Verify it's you </message> - <message name="IDS_SYNC_ERROR_USER_MENU_SIGNIN_AGAIN_BUTTON" desc="Button in the header of desktop user menu that signs out and signs back in in an attempt to resolve an unrecoverable error."> - Sign in again - </message> <message name="IDS_SYNC_ERROR_USER_MENU_SIGNOUT_BUTTON" desc="Button in the header of desktop user menu for managed users to sign out in an attempt to resolve an unrecoverable error."> Sign out </message>
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index cb0bab9..cd0b721 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd
@@ -1116,6 +1116,9 @@ <message name="IDS_EULA_SCREEN_ACCESSIBLE_TITLE" desc="Title to be spoken on opening the OOBE EULA screen"> Chrome OS terms </message> + <message name="IDS_OOBE_WELCOME_START_OS_INSTALL" desc="Label for button shown on the OOBE welcome screen to show the OS installation screens"> + Install Chrome OS + </message> </if> <!-- Welcome page (chrome://welcome) strings -->
diff --git a/chrome/app/google_chrome_strings_grd/IDS_OOBE_WELCOME_START_OS_INSTALL.png.sha1 b/chrome/app/google_chrome_strings_grd/IDS_OOBE_WELCOME_START_OS_INSTALL.png.sha1 new file mode 100644 index 0000000..ff36420 --- /dev/null +++ b/chrome/app/google_chrome_strings_grd/IDS_OOBE_WELCOME_START_OS_INSTALL.png.sha1
@@ -0,0 +1 @@ +6e3b11567fae4217d0632ef13b4df96826b89151 \ No newline at end of file
diff --git a/chrome/app/vector_icons/BUILD.gn b/chrome/app/vector_icons/BUILD.gn index e8c0a8c..ec9f35ca 100644 --- a/chrome/app/vector_icons/BUILD.gn +++ b/chrome/app/vector_icons/BUILD.gn
@@ -17,6 +17,7 @@ "account_box.icon", "account_child.icon", "account_child_circle.icon", + "account_circle.icon", "add.icon", "apps.icon", "autofill/gpay_offer.icon",
diff --git a/chrome/app/vector_icons/account_circle.icon b/chrome/app/vector_icons/account_circle.icon new file mode 100644 index 0000000..b1ea8cf --- /dev/null +++ b/chrome/app/vector_icons/account_circle.icon
@@ -0,0 +1,25 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +CANVAS_DIMENSIONS, 24, +MOVE_TO, 12, 2, +CUBIC_TO, 6.48f, 2, 2, 6.48f, 2, 12, +R_CUBIC_TO, 0, 5.52f, 4.48f, 10, 10, 10, +R_CUBIC_TO, 5.52f, 0, 10, -4.48f, 10, -10, +CUBIC_TO_SHORTHAND, 17.52f, 2, 12, 2, +CLOSE, +R_MOVE_TO, 6.14f, 15.12f, +R_ARC_TO, 9.95f, 9.95f, 0, 0, 0, -12.28f, 0, +ARC_TO, 7.96f, 7.96f, 0, 0, 1, 4, 12, +R_CUBIC_TO, 0, -4.42f, 3.58f, -8, 8, -8, +R_CUBIC_TO, 4.42f, 0, 8, 3.58f, 8, 8, +R_CUBIC_TO, 0, 1.95f, -0.7f, 3.73f, -1.86f, 5.12f, +CLOSE, +NEW_PATH, +MOVE_TO, 12, 6, +R_CUBIC_TO, -1.93f, 0, -3.5f, 1.57f, -3.5f, 3.5f, +CUBIC_TO_SHORTHAND, 10.07f, 13, 12, 13, +R_CUBIC_TO, 1.93f, 0, 3.5f, -1.57f, 3.5f, -3.5f, +CUBIC_TO_SHORTHAND, 13.93f, 6, 12, 6, +CLOSE
diff --git a/chrome/browser/android/autofill_assistant/generic_ui_root_controller_android.h b/chrome/browser/android/autofill_assistant/generic_ui_root_controller_android.h index df9686e..a4b92c2 100644 --- a/chrome/browser/android/autofill_assistant/generic_ui_root_controller_android.h +++ b/chrome/browser/android/autofill_assistant/generic_ui_root_controller_android.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include "base/android/jni_android.h" #include "base/android/scoped_java_ref.h"
diff --git a/chrome/browser/android/autofill_assistant/starter_android.h b/chrome/browser/android/autofill_assistant/starter_android.h index af4ddd3..120e460 100644 --- a/chrome/browser/android/autofill_assistant/starter_android.h +++ b/chrome/browser/android/autofill_assistant/starter_android.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ANDROID_AUTOFILL_ASSISTANT_STARTER_ANDROID_H_ #include <memory> -#include <string> #include "base/android/jni_android.h" #include "base/android/jni_weak_ref.h"
diff --git a/chrome/browser/android/history_report/data_observer.h b/chrome/browser/android/history_report/data_observer.h index a821e8aa..5c315004 100644 --- a/chrome/browser/android/history_report/data_observer.h +++ b/chrome/browser/android/history_report/data_observer.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_ANDROID_HISTORY_REPORT_DATA_OBSERVER_H_ #define CHROME_BROWSER_ANDROID_HISTORY_REPORT_DATA_OBSERVER_H_ -#include <string> - #include "base/callback.h" #include "base/macros.h" #include "base/scoped_observation.h"
diff --git a/chrome/browser/android/history_report/history_report_jni_bridge.h b/chrome/browser/android/history_report/history_report_jni_bridge.h index cb8a5ed..893ed35 100644 --- a/chrome/browser/android/history_report/history_report_jni_bridge.h +++ b/chrome/browser/android/history_report/history_report_jni_bridge.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ANDROID_HISTORY_REPORT_HISTORY_REPORT_JNI_BRIDGE_H_ #include <memory> -#include <string> #include "base/android/jni_weak_ref.h" #include "base/android/scoped_java_ref.h"
diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.h b/chrome/browser/android/omnibox/autocomplete_controller_android.h index 5b9d7769..bbb295f5 100644 --- a/chrome/browser/android/omnibox/autocomplete_controller_android.h +++ b/chrome/browser/android/omnibox/autocomplete_controller_android.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ANDROID_OMNIBOX_AUTOCOMPLETE_CONTROLLER_ANDROID_H_ #include <memory> -#include <string> #include "base/android/jni_weak_ref.h" #include "base/macros.h"
diff --git a/chrome/browser/android/vr/gvr_scheduler_delegate.h b/chrome/browser/android/vr/gvr_scheduler_delegate.h index 16e67fd..10c4795 100644 --- a/chrome/browser/android/vr/gvr_scheduler_delegate.h +++ b/chrome/browser/android/vr/gvr_scheduler_delegate.h
@@ -7,7 +7,6 @@ #include <limits> #include <memory> -#include <string> #include <utility> #include <vector>
diff --git a/chrome/browser/android/vr/scoped_gpu_trace.h b/chrome/browser/android/vr/scoped_gpu_trace.h index 6dcf239b..7774d99 100644 --- a/chrome/browser/android/vr/scoped_gpu_trace.h +++ b/chrome/browser/android/vr/scoped_gpu_trace.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ANDROID_VR_SCOPED_GPU_TRACE_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/time/time.h"
diff --git a/chrome/browser/apps/intent_helper/apps_navigation_throttle.h b/chrome/browser/apps/intent_helper/apps_navigation_throttle.h index c18a8801..90f2098d 100644 --- a/chrome/browser/apps/intent_helper/apps_navigation_throttle.h +++ b/chrome/browser/apps/intent_helper/apps_navigation_throttle.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_APPS_INTENT_HELPER_APPS_NAVIGATION_THROTTLE_H_ #include <memory> -#include <string> #include <vector> #include "base/gtest_prod_util.h"
diff --git a/chrome/browser/ash/apps/intent_helper/ash_intent_picker_helpers.h b/chrome/browser/ash/apps/intent_helper/ash_intent_picker_helpers.h index 4e90757..2657603 100644 --- a/chrome/browser/ash/apps/intent_helper/ash_intent_picker_helpers.h +++ b/chrome/browser/ash/apps/intent_helper/ash_intent_picker_helpers.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_ASH_APPS_INTENT_HELPER_ASH_INTENT_PICKER_HELPERS_H_ #define CHROME_BROWSER_ASH_APPS_INTENT_HELPER_ASH_INTENT_PICKER_HELPERS_H_ -#include <string> #include <vector> #include "chrome/browser/apps/intent_helper/apps_navigation_types.h"
diff --git a/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.h b/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.h index b78ca29..96367ca6 100644 --- a/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.h +++ b/chrome/browser/ash/apps/intent_helper/common_apps_navigation_throttle.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_APPS_INTENT_HELPER_COMMON_APPS_NAVIGATION_THROTTLE_H_ #include <memory> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/ash/arc/enterprise/arc_force_installed_apps_tracker.h b/chrome/browser/ash/arc/enterprise/arc_force_installed_apps_tracker.h index dc6acff..c4b4497 100644 --- a/chrome/browser/ash/arc/enterprise/arc_force_installed_apps_tracker.h +++ b/chrome/browser/ash/arc/enterprise/arc_force_installed_apps_tracker.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_ARC_ENTERPRISE_ARC_FORCE_INSTALLED_APPS_TRACKER_H_ #include <memory> -#include <string> #include "base/callback.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/ash/arc/optin/arc_terms_of_service_default_negotiator.h b/chrome/browser/ash/arc/optin/arc_terms_of_service_default_negotiator.h index deda901..a0462eb 100644 --- a/chrome/browser/ash/arc/optin/arc_terms_of_service_default_negotiator.h +++ b/chrome/browser/ash/arc/optin/arc_terms_of_service_default_negotiator.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_ARC_OPTIN_ARC_TERMS_OF_SERVICE_DEFAULT_NEGOTIATOR_H_ #include <memory> -#include <string> #include "base/callback.h" #include "base/macros.h"
diff --git a/chrome/browser/ash/arc/tracing/arc_app_performance_tracing_session.h b/chrome/browser/ash/arc/tracing/arc_app_performance_tracing_session.h index 9d545d87..b72be177 100644 --- a/chrome/browser/ash/arc/tracing/arc_app_performance_tracing_session.h +++ b/chrome/browser/ash/arc/tracing/arc_app_performance_tracing_session.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_ARC_TRACING_ARC_APP_PERFORMANCE_TRACING_SESSION_H_ #include <memory> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/ash/customization/customization_wallpaper_downloader.h b/chrome/browser/ash/customization/customization_wallpaper_downloader.h index 397ba43..c8933c96 100644 --- a/chrome/browser/ash/customization/customization_wallpaper_downloader.h +++ b/chrome/browser/ash/customization/customization_wallpaper_downloader.h
@@ -7,8 +7,6 @@ #include <stddef.h> -#include <string> - #include "base/bind.h" #include "base/files/file_path.h" #include "base/macros.h"
diff --git a/chrome/browser/ash/file_system_provider/provided_file_system_observer.h b/chrome/browser/ash/file_system_provider/provided_file_system_observer.h index c58fdc0..b4e9066f 100644 --- a/chrome/browser/ash/file_system_provider/provided_file_system_observer.h +++ b/chrome/browser/ash/file_system_provider/provided_file_system_observer.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_ASH_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERVER_H_ #define CHROME_BROWSER_ASH_FILE_SYSTEM_PROVIDER_PROVIDED_FILE_SYSTEM_OBSERVER_H_ -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.cc b/chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.cc new file mode 100644 index 0000000..a988635 --- /dev/null +++ b/chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.cc
@@ -0,0 +1,165 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.h" + +#include <utility> + +#include "base/bind.h" +#include "base/callback.h" +#include "base/json/json_reader.h" +#include "base/json/json_writer.h" +#include "base/logging.h" +#include "base/memory/weak_ptr.h" +#include "base/single_thread_task_runner.h" +#include "base/unguessable_token.h" +#include "base/values.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/extensions/api/messaging/native_message_port.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "content/public/browser/browser_context.h" +#include "extensions/browser/api/messaging/channel_endpoint.h" +#include "extensions/browser/api/messaging/message_service.h" +#include "extensions/browser/api/messaging/native_message_host.h" +#include "extensions/browser/extension_registry.h" +#include "extensions/common/api/messaging/messaging_endpoint.h" +#include "extensions/common/extension.h" +#include "url/gurl.h" + +namespace ash { +namespace guest_os { + +// static +const char* const VmSKForwardingNativeMessageHost::kHostName = + "com.google.vm_sk_forwarding"; + +// static +const char* const VmSKForwardingNativeMessageHost::kOrigins[] = { + "chrome-extension://lehkgnicackihfeppclgiffgbgbhmbdp/", + "chrome-extension://lcooaekmckohjjnpaaokodoepajbnill/"}; + +// static +const char* const + VmSKForwardingNativeMessageHost::kHostCreatedByExtensionNotSupportedError = + "{\"error\":\"Communication initiated by extension is not " + "supported.\"}"; + +// static +const int VmSKForwardingNativeMessageHost::kOriginCount = base::size(kOrigins); + +// static +std::unique_ptr<extensions::NativeMessageHost> +VmSKForwardingNativeMessageHost::CreateFromExtension( + content::BrowserContext* browser_context) { + ResponseCallback do_nothing = base::DoNothing(); + return std::make_unique<VmSKForwardingNativeMessageHost>( + kHostCreatedByExtensionNotSupportedError, std::move(do_nothing)); +} + +// static +std::unique_ptr<extensions::NativeMessageHost> +VmSKForwardingNativeMessageHost::CreateFromDBus( + const std::string& json_message, + VmSKForwardingNativeMessageHost::ResponseCallback response_callback) { + return std::make_unique<VmSKForwardingNativeMessageHost>( + json_message, std::move(response_callback)); +} + +VmSKForwardingNativeMessageHost::VmSKForwardingNativeMessageHost( + const std::string& json_message_to_send, + ResponseCallback response_callback) + : response_callback_(std::move(response_callback)), + json_message_to_send_(json_message_to_send) { + DCHECK(response_callback_); +} + +VmSKForwardingNativeMessageHost::~VmSKForwardingNativeMessageHost() { + if (response_callback_) { + // If no response was received from the extension, pass the empty result + // to the callback to signal the error. + std::move(response_callback_).Run(std::string() /* response */); + } +} + +void VmSKForwardingNativeMessageHost::Start( + extensions::NativeMessageHost::Client* client) { + DCHECK(!client_); + client_ = client; + if (!json_message_to_send_.empty()) { + client_->PostMessageFromNativeHost(json_message_to_send_); + } +} + +void VmSKForwardingNativeMessageHost::OnMessage(const std::string& message) { + if (!response_callback_) { + // This happens when the extension sent more than one message via the + // message channel. This class doesn't support this, thus we + // discard extra messages. + VLOG(1) << "VmSKForwardingNativeMessageHost received an extra message. " + << "Discarding the message."; + return; + } + DCHECK(client_); + + std::move(response_callback_).Run(message /* response */); + client_->CloseChannel(std::string() /* error_message */); +} + +scoped_refptr<base::SingleThreadTaskRunner> +VmSKForwardingNativeMessageHost::task_runner() const { + return base::ThreadTaskRunnerHandle::Get(); +} + +void VmSKForwardingNativeMessageHost::DeliverMessageToExtensionByID( + Profile* profile, + const std::string& extension_id, + const std::string& json_message, + base::OnceCallback<void(const std::string& response)> response_callback) { + const extensions::PortId port_id(base::UnguessableToken::Create(), + 1 /* port_number */, true /* is_opener */); + + extensions::MessageService* const message_service = + extensions::MessageService::Get(profile); + + auto native_message_host = VmSKForwardingNativeMessageHost::CreateFromDBus( + json_message, std::move(response_callback)); + + auto native_message_port = std::make_unique<extensions::NativeMessagePort>( + message_service->GetChannelDelegate(), port_id, + std::move(native_message_host)); + + message_service->OpenChannelToExtension( + extensions::ChannelEndpoint(profile), port_id, + extensions::MessagingEndpoint::ForNativeApp( + VmSKForwardingNativeMessageHost::kHostName), + std::move(native_message_port), extension_id, GURL(), + std::string() /* channel_name */); +} + +void VmSKForwardingNativeMessageHost::DeliverMessageToSKForwardingExtension( + Profile* profile, + const std::string& json_message, + base::OnceCallback<void(const std::string& response)> response_callback) { + DCHECK(profile); + DCHECK(response_callback); + + // Send the message to the first enabled extension from the origins list. + for (const auto* extension_url : VmSKForwardingNativeMessageHost::kOrigins) { + GURL url = GURL(extension_url); + if (extensions::ExtensionRegistry::Get(profile) + ->enabled_extensions() + .GetExtensionOrAppByURL(url)) { + DeliverMessageToExtensionByID(profile, url.host(), json_message, + std::move(response_callback)); + return; + } + } + + // No extension to accept the message. Pass the empty result to the callback + // to signal the error. + std::move(response_callback).Run("" /* response */); +} + +} // namespace guest_os +} // namespace ash
diff --git a/chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.h b/chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.h new file mode 100644 index 0000000..bed7cd4 --- /dev/null +++ b/chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.h
@@ -0,0 +1,100 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_ASH_GUEST_OS_VM_SK_FORWARDING_NATIVE_MESSAGE_HOST_H_ +#define CHROME_BROWSER_ASH_GUEST_OS_VM_SK_FORWARDING_NATIVE_MESSAGE_HOST_H_ + +#include <memory> +#include <string> + +#include "extensions/browser/api/messaging/native_message_host.h" + +namespace base { +class SingleThreadTaskRunner; +} // namespace base + +namespace { +class BrowserContext; +} + +class Profile; + +namespace ash { +namespace guest_os { + +// Implements a message pipe to communicate with a Chrome Extension for +// Security Key forwarding. +// Supports only one-off request-response message exchange initiated from +// Chrome side. It sends the message to the extension once message channel is +// opened and closes the channel once a response is received. +class VmSKForwardingNativeMessageHost : public extensions::NativeMessageHost { + public: + static const char* const kHostName; + static const char* const kOrigins[]; + static const char* const kHostCreatedByExtensionNotSupportedError; + static const int kOriginCount; + + using ResponseCallback = + base::OnceCallback<void(const std::string& response)>; + + // Used when extension tries to create a message channel with NM Host. + // Extension-initiated communication is not supported for SK forwarding. + // However, this method is required by NativeMessageBuiltInHost to register + // the NM host in Chrome OS. Created NM host will post an error message to the + // extension (for debugging) and close the channel. + static std::unique_ptr<NativeMessageHost> CreateFromExtension( + content::BrowserContext* browser_context); + + // Meant to be used by for communication initiated from Chrome side (e.g. from + // D-Bus service provider). + // Created instance sends |json_message| to the extension once communication + // channel is opened and uses |response_callback| to return the response + // message from the extension. + static std::unique_ptr<NativeMessageHost> CreateFromDBus( + const std::string& json_message, + VmSKForwardingNativeMessageHost::ResponseCallback response_callback); + + // Delivers |json_message| to the first enabled extension from kOrigins. + // It creates a new native message host for this one-off delivery. + // |response_callback| will be called with the response from the extension. + static void DeliverMessageToSKForwardingExtension( + Profile* profile, + const std::string& json_message, + VmSKForwardingNativeMessageHost::ResponseCallback response_callback); + + // Prefer using CreateFrom*() methods to this constructor. + VmSKForwardingNativeMessageHost(const std::string& json_message_to_send, + ResponseCallback response_callback); + VmSKForwardingNativeMessageHost(const VmSKForwardingNativeMessageHost&) = + delete; + VmSKForwardingNativeMessageHost& operator=( + const VmSKForwardingNativeMessageHost&) = delete; + ~VmSKForwardingNativeMessageHost() override; + + // NativeMessageHost implementation. + void Start(extensions::NativeMessageHost::Client* client) override; + void OnMessage(const std::string& request_string) override; + scoped_refptr<base::SingleThreadTaskRunner> task_runner() const override; + + private: + static void DeliverMessageToExtensionByID( + Profile* profile, + const std::string& extension_id, + const std::string& json_message, + base::OnceCallback<void(const std::string& response)> response_callback); + + // Callback for sending message back to the caller once extension responses. + ResponseCallback response_callback_; + + // Message to be sent to the extension once communication channel is set up. + const std::string json_message_to_send_; + + // Unowned. |client_| must outlive this instance. + extensions::NativeMessageHost::Client* client_ = nullptr; +}; + +} // namespace guest_os +} // namespace ash + +#endif // CHROME_BROWSER_ASH_GUEST_OS_VM_SK_FORWARDING_NATIVE_MESSAGE_HOST_H_
diff --git a/chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host_unittest.cc b/chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host_unittest.cc new file mode 100644 index 0000000..255b8cb5 --- /dev/null +++ b/chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host_unittest.cc
@@ -0,0 +1,121 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.h" + +#include "base/bind.h" +#include "base/callback.h" +#include "base/callback_helpers.h" +#include "base/check.h" +#include "base/run_loop.h" +#include "base/test/bind.h" +#include "base/test/task_environment.h" +#include "extensions/browser/api/messaging/native_message_host.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +using testing::_; +using testing::DoAll; +using testing::InSequence; +using testing::Invoke; +using testing::InvokeWithoutArgs; +using testing::Return; +using testing::SaveArg; +using testing::StrictMock; +using testing::WithArg; + +namespace ash { + +namespace guest_os { + +namespace { + +const char kMessageFromExtension[] = + "{\"text\":\"test message from extension\"}"; +const char kMessageFromDBus[] = "{\"text\":\"test message from DBus\"}"; + +class MockNativeMessageHostClient + : public extensions::NativeMessageHost::Client { + public: + MOCK_METHOD1(PostMessageFromNativeHost, void(const std::string& message)); + MOCK_METHOD1(CloseChannel, void(const std::string& error_message)); +}; + +} // namespace + +// Test NM host returns "Not Supported" error for communication channel +// initiated by an extension. +TEST(VmSKForwardingNativeMessageHostTests, ChannelCreatedByExtension) { + // Create the message host. + std::unique_ptr<extensions::NativeMessageHost> message_host = + VmSKForwardingNativeMessageHost::CreateFromExtension(nullptr); + + StrictMock<MockNativeMessageHostClient> message_host_client; + EXPECT_CALL( + message_host_client, + PostMessageFromNativeHost(VmSKForwardingNativeMessageHost :: + kHostCreatedByExtensionNotSupportedError)); + message_host->Start(&message_host_client); + EXPECT_CALL(message_host_client, CloseChannel("")); + message_host->OnMessage(kMessageFromExtension); +} + +// Test the basic successful scenario when NM host is created with message and +// callback (resembles situation when channel is initiated from DBus +// service provider). Message is delivered to extension once channel is created +// and response from extension is forwarded to callback method. +TEST(VmSKForwardingNativeMessageHostTests, SimpleRequestResponse) { + base::test::SingleThreadTaskEnvironment task_environment; + + std::string captured_response; + VmSKForwardingNativeMessageHost::ResponseCallback callback = + base::BindLambdaForTesting( + [&](const std::string& response) { captured_response = response; }); + + base::RunLoop run_loop; + + // Create the message host. + std::unique_ptr<extensions::NativeMessageHost> message_host = + VmSKForwardingNativeMessageHost::CreateFromDBus(kMessageFromDBus, + std::move(callback)); + + StrictMock<MockNativeMessageHostClient> message_host_client; + EXPECT_CALL(message_host_client, PostMessageFromNativeHost(kMessageFromDBus)) + .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); + message_host->Start(&message_host_client); + EXPECT_CALL(message_host_client, CloseChannel("")); + + message_host->OnMessage(kMessageFromExtension); + run_loop.Run(); + EXPECT_EQ(captured_response, kMessageFromExtension); +} + +// Test scenario when extension sends multiple messages to the channel. +// On consecuitive messages NM's OnMessage should be no-op. +TEST(VmSKForwardingNativeMessageHostTests, MultipleMessagesFromExtension) { + base::test::SingleThreadTaskEnvironment task_environment; + + VmSKForwardingNativeMessageHost::ResponseCallback callback = + base::DoNothing(); + + base::RunLoop run_loop; + + // Create the message host. + std::unique_ptr<extensions::NativeMessageHost> message_host = + VmSKForwardingNativeMessageHost::CreateFromDBus(kMessageFromDBus, + std::move(callback)); + + StrictMock<MockNativeMessageHostClient> message_host_client; + EXPECT_CALL(message_host_client, PostMessageFromNativeHost(kMessageFromDBus)) + .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); + message_host->Start(&message_host_client); + EXPECT_CALL(message_host_client, CloseChannel("")); + + message_host->OnMessage(kMessageFromExtension); + run_loop.Run(); + message_host->OnMessage(kMessageFromExtension); +} + +} // namespace guest_os +} // namespace ash
diff --git a/chrome/browser/ash/login/demo_mode/demo_mode_detector.h b/chrome/browser/ash/login/demo_mode/demo_mode_detector.h index 8400ed0..8841838 100644 --- a/chrome/browser/ash/login/demo_mode/demo_mode_detector.h +++ b/chrome/browser/ash/login/demo_mode/demo_mode_detector.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_LOGIN_DEMO_MODE_DEMO_MODE_DETECTOR_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/ash/login/onboarding_user_activity_counter.cc b/chrome/browser/ash/login/onboarding_user_activity_counter.cc index 7cc5be0..c7e237d 100644 --- a/chrome/browser/ash/login/onboarding_user_activity_counter.cc +++ b/chrome/browser/ash/login/onboarding_user_activity_counter.cc
@@ -131,8 +131,7 @@ return; profile->GetPrefs()->SetTimeDelta( - chromeos::prefs::kActivityTimeAfterOnboarding, - base::TimeDelta::FromMinutes(1)); + chromeos::prefs::kActivityTimeAfterOnboarding, base::TimeDelta()); } // static
diff --git a/chrome/browser/ash/login/screen_manager.h b/chrome/browser/ash/login/screen_manager.h index 49938682..b35081fd 100644 --- a/chrome/browser/ash/login/screen_manager.h +++ b/chrome/browser/ash/login/screen_manager.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include "base/gtest_prod_util.h" #include "base/macros.h"
diff --git a/chrome/browser/ash/login/screens/os_install_screen_browsertest.cc b/chrome/browser/ash/login/screens/os_install_screen_browsertest.cc new file mode 100644 index 0000000..9d469ef5 --- /dev/null +++ b/chrome/browser/ash/login/screens/os_install_screen_browsertest.cc
@@ -0,0 +1,48 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ash/constants/ash_switches.h" +#include "chrome/browser/ash/login/screens/welcome_screen.h" +#include "chrome/browser/ash/login/test/oobe_base_test.h" +#include "chrome/browser/ash/login/test/oobe_screen_waiter.h" +#include "chrome/browser/ash/login/wizard_controller.h" +#include "chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.h" +#include "content/public/test/browser_test.h" + +namespace chromeos { + +namespace { + +const test::UIPath kWelcomeScreen = {"connect", "welcomeScreen"}; +const test::UIPath kOsInstallButton = {"connect", "welcomeScreen", "osInstall"}; + +} // namespace + +class OsInstallScreenTest : public OobeBaseTest { + public: + void SetUpCommandLine(base::CommandLine* command_line) override { + OobeBaseTest::SetUpCommandLine(command_line); + command_line->AppendSwitch(switches::kAllowOsInstall); + } +}; + +// If the kAllowOsInstall switch is not set, the welcome screen should +// not show the OS install button. +IN_PROC_BROWSER_TEST_F(OobeBaseTest, InstallButtonHiddenByDefault) { + OobeScreenWaiter(WelcomeView::kScreenId).Wait(); + + test::OobeJS().ExpectVisiblePath(kWelcomeScreen); + test::OobeJS().ExpectHiddenPath(kOsInstallButton); +} + +// If the kAllowOsInstall is set, the welcome screen should show the +// OS install button. +IN_PROC_BROWSER_TEST_F(OsInstallScreenTest, InstallButtonVisibleWithSwitch) { + OobeScreenWaiter(WelcomeView::kScreenId).Wait(); + + test::OobeJS().ExpectVisiblePath(kWelcomeScreen); + test::OobeJS().ExpectVisiblePath(kOsInstallButton); +} + +} // namespace chromeos
diff --git a/chrome/browser/ash/login/screens/pin_setup_screen.cc b/chrome/browser/ash/login/screens/pin_setup_screen.cc index 964db30..7e4aaca 100644 --- a/chrome/browser/ash/login/screens/pin_setup_screen.cc +++ b/chrome/browser/ash/login/screens/pin_setup_screen.cc
@@ -22,6 +22,7 @@ #include "chrome/browser/policy/profile_policy_connector.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/ui/webui/chromeos/login/pin_setup_screen_handler.h" +#include "chromeos/login/auth/cryptohome_key_constants.h" #include "chromeos/login/auth/user_context.h" #include "components/prefs/pref_service.h" @@ -186,6 +187,12 @@ quick_unlock_storage->MarkStrongAuth(); std::unique_ptr<UserContext> user_context = std::move(context()->extra_factors_auth_session); + + // Due to crbug.com/1203420 we need to mark the key as a wildcard (no label). + if (user_context->GetKey()->GetLabel() == chromeos::kCryptohomeGaiaKeyLabel) { + user_context->GetKey()->SetLabel(chromeos::kCryptohomeWildcardLabel); + } + const std::string token = quick_unlock_storage->CreateAuthToken(*user_context);
diff --git a/chrome/browser/ash/login/screens/welcome_screen.cc b/chrome/browser/ash/login/screens/welcome_screen.cc index 3f73ac9..41fc5244 100644 --- a/chrome/browser/ash/login/screens/welcome_screen.cc +++ b/chrome/browser/ash/login/screens/welcome_screen.cc
@@ -86,6 +86,7 @@ "activateRemoraRequisition"; constexpr const char kUserActionEditDeviceRequisition[] = "editDeviceRequisition"; +constexpr const char kUserActionStartOsInstall[] = "startOsInstall"; struct WelcomeScreenA11yUserAction { const char* name_; @@ -169,6 +170,8 @@ return "SetupDemo"; case Result::ENABLE_DEBUGGING: return "EnableDebugging"; + case Result::START_OS_INSTALL: + return "StartOsInstall"; } } @@ -411,6 +414,11 @@ return; } + if (action_id == kUserActionStartOsInstall) { + OnStartOsInstall(); + return; + } + if (IsA11yUserAction(action_id)) { RecordA11yUserAction(action_id); if (action_id == kUserActionEnableSpokenFeedback) { @@ -520,6 +528,11 @@ exit_callback_.Run(Result::ENABLE_DEBUGGING); } +void WelcomeScreen::OnStartOsInstall() { + demo_mode_detector_.reset(); + exit_callback_.Run(Result::START_OS_INSTALL); +} + void WelcomeScreen::OnLanguageChangedCallback( const InputEventsBlocker* /* input_events_blocker */, const std::string& input_method,
diff --git a/chrome/browser/ash/login/screens/welcome_screen.h b/chrome/browser/ash/login/screens/welcome_screen.h index b743d7af..3585660 100644 --- a/chrome/browser/ash/login/screens/welcome_screen.h +++ b/chrome/browser/ash/login/screens/welcome_screen.h
@@ -66,7 +66,7 @@ virtual void OnLanguageListReloaded() = 0; }; - enum class Result { NEXT, SETUP_DEMO, ENABLE_DEBUGGING }; + enum class Result { NEXT, SETUP_DEMO, ENABLE_DEBUGGING, START_OS_INSTALL }; using ScreenExitCallback = base::RepeatingCallback<void(Result result)>; @@ -138,6 +138,8 @@ void OnSetupDemoMode(); // Proceed with Enable debugging features flow. void OnEnableDebugging(); + // Proceed with OS installation flow. + void OnStartOsInstall(); // Async callback after ReloadResourceBundle(locale) completed. void OnLanguageChangedCallback(
diff --git a/chrome/browser/ash/login/session/user_session_manager.cc b/chrome/browser/ash/login/session/user_session_manager.cc index 6b635b5..74c1296 100644 --- a/chrome/browser/ash/login/session/user_session_manager.cc +++ b/chrome/browser/ash/login/session/user_session_manager.cc
@@ -31,6 +31,7 @@ #include "base/path_service.h" #include "base/scoped_observation.h" #include "base/single_thread_task_runner.h" +#include "base/strings/string_number_conversions.h" #include "base/system/sys_info.h" #include "base/task/post_task.h" #include "base/threading/thread_task_runner_handle.h" @@ -215,6 +216,26 @@ constexpr base::TimeDelta kActivityTimeBeforeOnboardingSurvey = base::TimeDelta::FromHours(1); +base::TimeDelta GetActivityTimeBeforeOnboardingSurvey() { + auto* command_line = base::CommandLine::ForCurrentProcess(); + const auto& time_switch = + chromeos::switches::kTimeBeforeOnboardingSurveyInSecondsForTesting; + + if (!command_line->HasSwitch(time_switch)) { + return kActivityTimeBeforeOnboardingSurvey; + } + int seconds; + if (!base::StringToInt(command_line->GetSwitchValueASCII(time_switch), + &seconds)) { + return kActivityTimeBeforeOnboardingSurvey; + } + + if (seconds <= 0) + return kActivityTimeBeforeOnboardingSurvey; + + return base::TimeDelta::FromSeconds(seconds); +} + void InitLocaleAndInputMethodsForNewUser( UserSessionManager* session_manager, Profile* profile, @@ -1723,7 +1744,7 @@ if (OnboardingUserActivityCounter::ShouldStart(profile->GetPrefs())) { onboarding_user_activity_counter_ = std::make_unique<OnboardingUserActivityCounter>( - profile->GetPrefs(), kActivityTimeBeforeOnboardingSurvey, + profile->GetPrefs(), GetActivityTimeBeforeOnboardingSurvey(), base::BindOnce( &UserSessionManager::OnUserEligibleForOnboardingSurvey, weak_factory_.GetWeakPtr(), profile)); @@ -2425,8 +2446,9 @@ return; if (!HatsNotificationController::ShouldShowSurveyToProfile( - profile, ash::kHatsOnboardingSurvey)) + profile, ash::kHatsOnboardingSurvey)) { return; + } hats_notification_controller_ = new HatsNotificationController(profile, ash::kHatsOnboardingSurvey);
diff --git a/chrome/browser/ash/login/signin/oauth2_token_initializer.h b/chrome/browser/ash/login/signin/oauth2_token_initializer.h index ab8f368..85f607d4 100644 --- a/chrome/browser/ash/login/signin/oauth2_token_initializer.h +++ b/chrome/browser/ash/login/signin/oauth2_token_initializer.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_LOGIN_SIGNIN_OAUTH2_TOKEN_INITIALIZER_H_ #include <memory> -#include <string> #include "base/callback.h" #include "base/macros.h"
diff --git a/chrome/browser/ash/login/test/hid_controller_mixin.h b/chrome/browser/ash/login/test/hid_controller_mixin.h index 01cb5bf..0629aa5 100644 --- a/chrome/browser/ash/login/test/hid_controller_mixin.h +++ b/chrome/browser/ash/login/test/hid_controller_mixin.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_LOGIN_TEST_HID_CONTROLLER_MIXIN_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/memory/ref_counted.h"
diff --git a/chrome/browser/ash/login/ui/captive_portal_view.h b/chrome/browser/ash/login/ui/captive_portal_view.h index e17672b..4effddcb 100644 --- a/chrome/browser/ash/login/ui/captive_portal_view.h +++ b/chrome/browser/ash/login/ui/captive_portal_view.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_ASH_LOGIN_UI_CAPTIVE_PORTAL_VIEW_H_ #define CHROME_BROWSER_ASH_LOGIN_UI_CAPTIVE_PORTAL_VIEW_H_ -#include <string> #include "base/macros.h" #include "chrome/browser/ash/login/ui/simple_web_view_dialog.h"
diff --git a/chrome/browser/ash/login/ui/login_display_host_webui.h b/chrome/browser/ash/login/ui/login_display_host_webui.h index 19524ff9..22bd15a 100644 --- a/chrome/browser/ash/login/ui/login_display_host_webui.h +++ b/chrome/browser/ash/login/ui/login_display_host_webui.h
@@ -8,7 +8,6 @@ #include <stdint.h> #include <memory> -#include <string> #include <vector> #include "ash/components/audio/cras_audio_handler.h"
diff --git a/chrome/browser/ash/login/ui/login_screen_extension_ui/web_dialog_view.h b/chrome/browser/ash/login/ui/login_screen_extension_ui/web_dialog_view.h index 91c695b..2cb66ae 100644 --- a/chrome/browser/ash/login/ui/login_screen_extension_ui/web_dialog_view.h +++ b/chrome/browser/ash/login/ui/login_screen_extension_ui/web_dialog_view.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_LOGIN_UI_LOGIN_SCREEN_EXTENSION_UI_WEB_DIALOG_VIEW_H_ #include <memory> -#include <string> #include "ash/public/cpp/system_tray_observer.h" #include "base/macros.h"
diff --git a/chrome/browser/ash/login/ui/simple_web_view_dialog.h b/chrome/browser/ash/login/ui/simple_web_view_dialog.h index d5ca29c..1b68808 100644 --- a/chrome/browser/ash/login/ui/simple_web_view_dialog.h +++ b/chrome/browser/ash/login/ui/simple_web_view_dialog.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_LOGIN_UI_SIMPLE_WEB_VIEW_DIALOG_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/observer_list.h"
diff --git a/chrome/browser/ash/login/wizard_controller.cc b/chrome/browser/ash/login/wizard_controller.cc index 2b60cad..cf201e9 100644 --- a/chrome/browser/ash/login/wizard_controller.cc +++ b/chrome/browser/ash/login/wizard_controller.cc
@@ -1114,6 +1114,10 @@ case WelcomeScreen::Result::ENABLE_DEBUGGING: ShowEnableDebuggingScreen(); return; + case WelcomeScreen::Result::START_OS_INSTALL: + // TODO(b/182386612): show OS installation screen once it's implemented. + NOTIMPLEMENTED(); + return; case WelcomeScreen::Result::NEXT: ShowNetworkScreen(); return;
diff --git a/chrome/browser/ash/system_extensions/system_extensions_install_manager.h b/chrome/browser/ash/system_extensions/system_extensions_install_manager.h index c352c29..4d5a778 100644 --- a/chrome/browser/ash/system_extensions/system_extensions_install_manager.h +++ b/chrome/browser/ash/system_extensions/system_extensions_install_manager.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ASH_SYSTEM_EXTENSIONS_SYSTEM_EXTENSIONS_INSTALL_MANAGER_H_ #include <map> -#include <string> #include "chrome/browser/ash/system_extensions/system_extension.h"
diff --git a/chrome/browser/autofill/android/personal_data_manager_android.h b/chrome/browser/autofill/android/personal_data_manager_android.h index 6a10b8c..b356a6c 100644 --- a/chrome/browser/autofill/android/personal_data_manager_android.h +++ b/chrome/browser/autofill/android/personal_data_manager_android.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ #define CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ -#include <string> #include <vector> #include "base/android/jni_weak_ref.h"
diff --git a/chrome/browser/autofill/android/save_address_profile_message_controller.cc b/chrome/browser/autofill/android/save_address_profile_message_controller.cc index 2f70d34..3c4debd 100644 --- a/chrome/browser/autofill/android/save_address_profile_message_controller.cc +++ b/chrome/browser/autofill/android/save_address_profile_message_controller.cc
@@ -113,19 +113,14 @@ std::u16string SaveAddressProfileMessageController::GetTitle() { // TODO(crbug.com/1167061): Replace with proper localized strings. - // TODO(crbug.com/1167061): Make update title reflect fields to be updated. return original_profile_ ? u"Update address?" : u"Save address?"; } std::u16string SaveAddressProfileMessageController::GetDescription() { - const std::string locale = g_browser_process->GetApplicationLocale(); - if (original_profile_) { - // TODO(crbug.com/1167061): Replace with proper localized string. - return u"For " + - GetDescriptionForProfileToUpdate(*original_profile_, locale); - } else { - return GetDescriptionForProfileToSave(profile_, locale); - } + return GetProfileDescription( + original_profile_ ? *original_profile_ : profile_, + g_browser_process->GetApplicationLocale(), + /*include_address_and_contacts=*/true); } std::u16string SaveAddressProfileMessageController::GetPrimaryButtonText() {
diff --git a/chrome/browser/autofill/android/save_address_profile_message_controller_unittest.cc b/chrome/browser/autofill/android/save_address_profile_message_controller_unittest.cc index d3520074..87300d4 100644 --- a/chrome/browser/autofill/android/save_address_profile_message_controller_unittest.cc +++ b/chrome/browser/autofill/android/save_address_profile_message_controller_unittest.cc
@@ -150,7 +150,7 @@ EXPECT_EQ(u"Update address?", GetMessageWrapper()->GetTitle()); EXPECT_EQ(u"Update…", GetMessageWrapper()->GetPrimaryButtonText()); - EXPECT_EQ(u"For Jane A. Smith — 123 Main Street", + EXPECT_EQ(u"Jane A. Smith, 123 Main Street", GetMessageWrapper()->GetDescription()); EXPECT_EQ(ResourceMapper::MapToJavaDrawableId(IDR_ANDROID_AUTOFILL_ADDRESS), GetMessageWrapper()->GetIconResourceId());
diff --git a/chrome/browser/autofill/android/save_address_profile_prompt_controller.cc b/chrome/browser/autofill/android/save_address_profile_prompt_controller.cc index 676c267..860ecdb 100644 --- a/chrome/browser/autofill/android/save_address_profile_prompt_controller.cc +++ b/chrome/browser/autofill/android/save_address_profile_prompt_controller.cc
@@ -88,14 +88,23 @@ std::u16string SaveAddressProfilePromptController::GetSubtitle() { DCHECK(original_profile_); - return u"For " + GetDescriptionForProfileToUpdate( - original_profile_.value(), - g_browser_process->GetApplicationLocale()); + const std::string locale = g_browser_process->GetApplicationLocale(); + std::vector<ProfileValueDifference> differences = + GetProfileDifferenceForUi(original_profile_.value(), profile_, locale); + bool address_updated = + std::find_if(differences.begin(), differences.end(), + [](const ProfileValueDifference& diff) { + return diff.type == ADDRESS_HOME_ADDRESS; + }) != differences.end(); + return GetProfileDescription( + original_profile_.value(), locale, + /*include_address_and_contacts=*/!address_updated); } std::pair<std::u16string, std::u16string> SaveAddressProfilePromptController::GetDiffFromOldToNewProfile() { DCHECK(original_profile_); + // TODO(crbug.com/1167061): Switch to using GetProfileDifferenceForUi. base::flat_map<ServerFieldType, std::pair<std::u16string, std::u16string>> differences = AutofillProfileComparator::GetProfileDifferenceMap( original_profile_.value(), profile_,
diff --git a/chrome/browser/autofill/android/save_address_profile_prompt_controller_unittest.cc b/chrome/browser/autofill/android/save_address_profile_prompt_controller_unittest.cc index eb801f9a..4cbcf0bc 100644 --- a/chrome/browser/autofill/android/save_address_profile_prompt_controller_unittest.cc +++ b/chrome/browser/autofill/android/save_address_profile_prompt_controller_unittest.cc
@@ -183,7 +183,7 @@ ShouldReturnDataToDisplay_Update) { SetUpController(/*is_update=*/true); EXPECT_EQ(u"Update address?", controller_->GetTitle()); - EXPECT_EQ(u"For John Doe — 666 Erebus St.", controller_->GetSubtitle()); + EXPECT_EQ(u"John Doe, 666 Erebus St.", controller_->GetSubtitle()); std::pair<std::u16string, std::u16string> differences = controller_->GetDiffFromOldToNewProfile(); EXPECT_EQ(u"John Doe", differences.first);
diff --git a/chrome/browser/autofill/autofill_uitest.h b/chrome/browser/autofill/autofill_uitest.h index 8d67e2b..bc4090d 100644 --- a/chrome/browser/autofill/autofill_uitest.h +++ b/chrome/browser/autofill/autofill_uitest.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_H_ #define CHROME_BROWSER_AUTOFILL_AUTOFILL_UITEST_H_ -#include <string> - #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/interactive_test_utils.h" #include "components/autofill/core/browser/browser_autofill_manager.h"
diff --git a/chrome/browser/autofill/manual_filling_controller_impl.h b/chrome/browser/autofill/manual_filling_controller_impl.h index 79654a8..650ddee1 100644 --- a/chrome/browser/autofill/manual_filling_controller_impl.h +++ b/chrome/browser/autofill/manual_filling_controller_impl.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_AUTOFILL_MANUAL_FILLING_CONTROLLER_IMPL_H_ #include <memory> -#include <string> #include "base/callback_forward.h" #include "base/containers/flat_set.h"
diff --git a/chrome/browser/autofill/manual_filling_view_interface.h b/chrome/browser/autofill/manual_filling_view_interface.h index 429b98b..7eef076 100644 --- a/chrome/browser/autofill/manual_filling_view_interface.h +++ b/chrome/browser/autofill/manual_filling_view_interface.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_AUTOFILL_MANUAL_FILLING_VIEW_INTERFACE_H_ #include <memory> -#include <string> #include <vector> #include "build/build_config.h"
diff --git a/chrome/browser/browser_process_platform_part_chromeos.h b/chrome/browser/browser_process_platform_part_chromeos.h index 3e057d1b..bf80694 100644 --- a/chrome/browser/browser_process_platform_part_chromeos.h +++ b/chrome/browser/browser_process_platform_part_chromeos.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_BROWSER_PROCESS_PLATFORM_PART_CHROMEOS_H_ #include <memory> -#include <string> #include "base/compiler_specific.h" #include "base/macros.h"
diff --git a/chrome/browser/browser_process_platform_part_mac.mm b/chrome/browser/browser_process_platform_part_mac.mm index ed238976..b4e379f 100644 --- a/chrome/browser/browser_process_platform_part_mac.mm +++ b/chrome/browser/browser_process_platform_part_mac.mm
@@ -4,7 +4,6 @@ #include "chrome/browser/browser_process_platform_part_mac.h" -#include "base/feature_list.h" #include "base/mac/foundation_util.h" #include "base/metrics/histogram_macros.h" #include "base/time/time.h" @@ -13,7 +12,6 @@ #include "chrome/browser/apps/app_shim/web_app_shim_manager_delegate_mac.h" #include "chrome/browser/apps/platform_apps/extension_app_shim_manager_delegate_mac.h" #include "chrome/browser/chrome_browser_application_mac.h" -#include "chrome/common/chrome_features.h" #include "services/device/public/cpp/geolocation/geolocation_manager_impl_mac.h" BrowserProcessPlatformPart::BrowserProcessPlatformPart() { @@ -63,11 +61,9 @@ // ExtensionAppShimManagerDelegate may be changed to nullptr here. std::unique_ptr<apps::AppShimManager::Delegate> app_shim_manager_delegate = std::make_unique<apps::ExtensionAppShimManagerDelegate>(); - if (base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)) { - app_shim_manager_delegate = - std::make_unique<web_app::WebAppShimManagerDelegate>( - std::move(app_shim_manager_delegate)); - } + app_shim_manager_delegate = + std::make_unique<web_app::WebAppShimManagerDelegate>( + std::move(app_shim_manager_delegate)); app_shim_manager_ = std::make_unique<apps::AppShimManager>( std::move(app_shim_manager_delegate));
diff --git a/chrome/browser/browsing_data/local_data_container.h b/chrome/browser/browsing_data/local_data_container.h index 64a93dc..034c817 100644 --- a/chrome/browser/browsing_data/local_data_container.h +++ b/chrome/browser/browsing_data/local_data_container.h
@@ -7,7 +7,6 @@ #include <list> #include <map> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/browsing_data/site_data_size_collector.h b/chrome/browser/browsing_data/site_data_size_collector.h index 2bc5928..d7fd6c7 100644 --- a/chrome/browser/browsing_data/site_data_size_collector.h +++ b/chrome/browser/browsing_data/site_data_size_collector.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_BROWSING_DATA_SITE_DATA_SIZE_COLLECTOR_H_ #include <list> -#include <string> #include <vector> #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/chromeos/BUILD.gn b/chrome/browser/chromeos/BUILD.gn index 28132496..ac0359b 100644 --- a/chrome/browser/chromeos/BUILD.gn +++ b/chrome/browser/chromeos/BUILD.gn
@@ -41,6 +41,7 @@ "//chromeos/dbus:seneschal_proto", "//chromeos/dbus:vm_applications_apps_proto", "//chromeos/dbus:vm_permission_service_proto", + "//chromeos/dbus:vm_sk_forwarding_proto", "//chromeos/dbus/power:power_manager_proto", "//chromeos/services/assistant/public/mojom", "//chromeos/strings", @@ -1350,6 +1351,8 @@ "../ash/guest_os/guest_os_stability_monitor.h", "../ash/guest_os/virtual_machines/virtual_machines_util.cc", "../ash/guest_os/virtual_machines/virtual_machines_util.h", + "../ash/guest_os/vm_sk_forwarding_native_message_host.cc", + "../ash/guest_os/vm_sk_forwarding_native_message_host.h", "../ash/hats/hats_config.cc", "../ash/hats/hats_config.h", "../ash/hats/hats_dialog.cc", @@ -2156,6 +2159,8 @@ "dbus/virtual_file_request_service_provider.h", "dbus/vm/vm_permission_service_provider.cc", "dbus/vm/vm_permission_service_provider.h", + "dbus/vm/vm_sk_forwarding_service_provider.cc", + "dbus/vm/vm_sk_forwarding_service_provider.h", "dbus/vm_applications_service_provider.cc", "dbus/vm_applications_service_provider.h", "device_name_store.cc", @@ -3382,6 +3387,7 @@ "dbus/org.chromium.VirtualFileRequestService.conf", "dbus/org.chromium.VmApplicationsService.conf", "dbus/vm/org.chromium.VmPermissionService.conf", + "dbus/vm/org.chromium.VmSKForwardingService.conf", ] output_conf_file = "$root_out_dir/dbus/chrome_dbus_services.conf" outputs = [ output_conf_file ] @@ -3836,6 +3842,7 @@ "../ash/guest_os/guest_os_registry_service_unittest.cc", "../ash/guest_os/guest_os_share_path_unittest.cc", "../ash/guest_os/guest_os_stability_monitor_unittest.cc", + "../ash/guest_os/vm_sk_forwarding_native_message_host_unittest.cc", "../ash/hats/hats_finch_helper_unittest.cc", "../ash/hats/hats_notification_controller_unittest.cc", "../ash/kerberos/kerberos_credentials_manager_test.cc",
diff --git a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc index de996c4..05acb6e 100644 --- a/chrome/browser/chromeos/chrome_browser_main_chromeos.cc +++ b/chrome/browser/chromeos/chrome_browser_main_chromeos.cc
@@ -103,6 +103,7 @@ #include "chrome/browser/chromeos/dbus/smb_fs_service_provider.h" #include "chrome/browser/chromeos/dbus/virtual_file_request_service_provider.h" #include "chrome/browser/chromeos/dbus/vm/vm_permission_service_provider.h" +#include "chrome/browser/chromeos/dbus/vm/vm_sk_forwarding_service_provider.h" #include "chrome/browser/chromeos/dbus/vm_applications_service_provider.h" #include "chrome/browser/chromeos/device_name_store.h" #include "chrome/browser/chromeos/events/event_rewriter_delegate_impl.h" @@ -352,6 +353,12 @@ CrosDBusService::CreateServiceProviderList( std::make_unique<VmApplicationsServiceProvider>())); + vm_sk_forwarding_service_ = CrosDBusService::Create( + system_bus, vm_tools::sk_forwarding::kVmSKForwardingServiceName, + dbus::ObjectPath(vm_tools::sk_forwarding::kVmSKForwardingServicePath), + CrosDBusService::CreateServiceProviderList( + std::make_unique<VmSKForwardingServiceProvider>())); + vm_permission_service_ = CrosDBusService::Create( system_bus, kVmPermissionServiceName, dbus::ObjectPath(kVmPermissionServicePath), @@ -451,6 +458,7 @@ component_updater_service_.reset(); chrome_features_service_.reset(); vm_applications_service_.reset(); + vm_sk_forwarding_service_.reset(); vm_permission_service_.reset(); drive_file_stream_service_.reset(); cryptohome_key_delegate_service_.reset(); @@ -479,6 +487,7 @@ std::unique_ptr<CrosDBusService> component_updater_service_; std::unique_ptr<CrosDBusService> chrome_features_service_; std::unique_ptr<CrosDBusService> vm_applications_service_; + std::unique_ptr<CrosDBusService> vm_sk_forwarding_service_; std::unique_ptr<CrosDBusService> vm_permission_service_; std::unique_ptr<CrosDBusService> drive_file_stream_service_; std::unique_ptr<CrosDBusService> cryptohome_key_delegate_service_;
diff --git a/chrome/browser/chromeos/dbus/printers_service_provider.h b/chrome/browser/chromeos/dbus/printers_service_provider.h index 5b340f01..60cc9c6 100644 --- a/chrome/browser/chromeos/dbus/printers_service_provider.h +++ b/chrome/browser/chromeos/dbus/printers_service_provider.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_CHROMEOS_DBUS_PRINTERS_SERVICE_PROVIDER_H_ #define CHROME_BROWSER_CHROMEOS_DBUS_PRINTERS_SERVICE_PROVIDER_H_ -#include <string> - #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/scoped_observation.h"
diff --git a/chrome/browser/chromeos/dbus/vm/org.chromium.VmSKForwardingService.conf b/chrome/browser/chromeos/dbus/vm/org.chromium.VmSKForwardingService.conf new file mode 100644 index 0000000..1628c62b8 --- /dev/null +++ b/chrome/browser/chromeos/dbus/vm/org.chromium.VmSKForwardingService.conf
@@ -0,0 +1,18 @@ +<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" + "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> +<!-- + Copyright 2018 The Chromium Authors. All rights reserved. + Use of this source code is governed by a BSD-style license that can be + found in the LICENSE file. +--> + +<busconfig> + <policy user="chronos"> + <allow own="org.chromium.VmSKForwardingService"/> + </policy> + + <policy user="vm_cicerone"> + <allow send_destination="org.chromium.VmSKForwardingService" + send_interface="org.chromium.VmSKForwardingService"/> + </policy> +</busconfig>
diff --git a/chrome/browser/chromeos/dbus/vm/vm_sk_forwarding_service_provider.cc b/chrome/browser/chromeos/dbus/vm/vm_sk_forwarding_service_provider.cc new file mode 100644 index 0000000..82cd116 --- /dev/null +++ b/chrome/browser/chromeos/dbus/vm/vm_sk_forwarding_service_provider.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/dbus/vm/vm_sk_forwarding_service_provider.h" + +#include <string> + +#include "base/bind.h" +#include "base/logging.h" +#include "chrome/browser/ash/crostini/crostini_features.h" +#include "chrome/browser/ash/crostini/crostini_util.h" +#include "chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chromeos/dbus/vm_sk_forwarding/sk_forwarding.pb.h" +#include "dbus/bus.h" +#include "dbus/message.h" +#include "third_party/cros_system_api/dbus/service_constants.h" + +namespace chromeos { + +VmSKForwardingServiceProvider::VmSKForwardingServiceProvider() {} + +VmSKForwardingServiceProvider::~VmSKForwardingServiceProvider() = default; + +void VmSKForwardingServiceProvider::Start( + scoped_refptr<dbus::ExportedObject> exported_object) { + exported_object->ExportMethod( + vm_tools::sk_forwarding::kVmSKForwardingServiceInterface, + vm_tools::sk_forwarding:: + kVmSKForwardingServiceForwardSecurityKeyMessageMethod, + base::BindRepeating( + &VmSKForwardingServiceProvider::ForwardSecurityKeyMessage, + weak_ptr_factory_.GetWeakPtr()), + + base::BindOnce(&VmSKForwardingServiceProvider::OnExported, + weak_ptr_factory_.GetWeakPtr())); +} + +void VmSKForwardingServiceProvider::OnExported( + const std::string& interface_name, + const std::string& method_name, + bool success) { + LOG_IF(ERROR, !success) << "Failed to export " << interface_name << "." + << method_name; +} + +void VmSKForwardingServiceProvider::ForwardSecurityKeyMessage( + dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender) { + dbus::MessageReader reader(method_call); + + vm_tools::sk_forwarding::ForwardSecurityKeyMessageRequest request; + + if (!reader.PopArrayOfBytesAsProto(&request)) { + constexpr char error_message[] = + "Unable to parse ForwardSecurityKeyMessageRequest from message"; + std::move(response_sender) + .Run(dbus::ErrorResponse::FromMethodCall( + method_call, DBUS_ERROR_INVALID_ARGS, error_message)); + return; + } + + Profile* profile = ProfileManager::GetPrimaryUserProfile(); + if (request.owner_id() != crostini::CryptohomeIdForProfile(profile)) { + constexpr char error_message[] = "Primary user is not the owner of the VM"; + std::move(response_sender) + .Run(dbus::ErrorResponse::FromMethodCall( + method_call, DBUS_ERROR_INVALID_ARGS, error_message)); + return; + } + + ash::guest_os::VmSKForwardingNativeMessageHost:: + DeliverMessageToSKForwardingExtension( + profile, request.message(), + base::BindOnce(&VmSKForwardingServiceProvider::OnResponse, + weak_ptr_factory_.GetWeakPtr(), method_call, + std::move(response_sender))); +} + +void VmSKForwardingServiceProvider::OnResponse( + dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender, + const std::string& response_message) { + std::unique_ptr<dbus::Response> dbus_response = + dbus::Response::FromMethodCall(method_call); + + vm_tools::sk_forwarding::ForwardSecurityKeyMessageResponse response_proto; + response_proto.set_message(response_message); + + dbus::MessageWriter writer(dbus_response.get()); + writer.AppendProtoAsArrayOfBytes(response_proto); + + std::move(response_sender).Run(std::move(dbus_response)); +} + +} // namespace chromeos
diff --git a/chrome/browser/chromeos/dbus/vm/vm_sk_forwarding_service_provider.h b/chrome/browser/chromeos/dbus/vm/vm_sk_forwarding_service_provider.h new file mode 100644 index 0000000..646987c1 --- /dev/null +++ b/chrome/browser/chromeos/dbus/vm/vm_sk_forwarding_service_provider.h
@@ -0,0 +1,61 @@ +// Copyright 2018 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_BROWSER_CHROMEOS_DBUS_VM_VM_SK_FORWARDING_SERVICE_PROVIDER_H_ +#define CHROME_BROWSER_CHROMEOS_DBUS_VM_VM_SK_FORWARDING_SERVICE_PROVIDER_H_ + +#include "base/compiler_specific.h" +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "chromeos/dbus/services/cros_dbus_service.h" +#include "dbus/exported_object.h" + +namespace dbus { +class MethodCall; +} // namespace dbus + +namespace chromeos { + +// This class exports D-Bus methods for functions used by Crostini VMs for +// Security Key forwarding. +class VmSKForwardingServiceProvider + : public CrosDBusService::ServiceProviderInterface { + public: + VmSKForwardingServiceProvider(); + VmSKForwardingServiceProvider(const VmSKForwardingServiceProvider&) = delete; + VmSKForwardingServiceProvider& operator=( + const VmSKForwardingServiceProvider&) = delete; + ~VmSKForwardingServiceProvider() override; + + // CrosDBusService::ServiceProviderInterface overrides: + void Start(scoped_refptr<dbus::ExportedObject> exported_object) override; + + private: + // Called from ExportedObject when ForwardSecurityKeyMessage is exported as a + // D-Bus method or failed to be exported. + void OnExported(const std::string& interface_name, + const std::string& method_name, + bool success); + + // Called on UI thread in response to a D-Bus request. + // Forwards message to the extension and returns response from extensions, + // if any. + void ForwardSecurityKeyMessage( + dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender); + + // Callback executed after a response to a Security Key request is available. + // Passes the response to the client over D-Bus. + void OnResponse(dbus::MethodCall* method_call, + dbus::ExportedObject::ResponseSender response_sender, + const std::string& response_message); + + // Keep this last so that all weak pointers will be invalidated at the + // beginning of destruction. + base::WeakPtrFactory<VmSKForwardingServiceProvider> weak_ptr_factory_{this}; +}; + +} // namespace chromeos + +#endif // CHROME_BROWSER_CHROMEOS_DBUS_VM_VM_SK_FORWARDING_SERVICE_PROVIDER_H_
diff --git a/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader.h b/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader.h index df8831d..7f6c257 100644 --- a/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader.h +++ b/chrome/browser/chromeos/extensions/device_local_account_external_policy_loader.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_DEVICE_LOCAL_ACCOUNT_EXTERNAL_POLICY_LOADER_H_ #include <memory> -#include <string> #include "base/callback_forward.h" #include "base/compiler_specific.h"
diff --git a/chrome/browser/chromeos/extensions/media_player_api.h b/chrome/browser/chromeos/extensions/media_player_api.h index ce243b9..a87b525 100644 --- a/chrome/browser/chromeos/extensions/media_player_api.h +++ b/chrome/browser/chromeos/extensions/media_player_api.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/chromeos/extensions/users_private/users_private_delegate.h b/chrome/browser/chromeos/extensions/users_private/users_private_delegate.h index ef17fdca..89fa9bc 100644 --- a/chrome/browser/chromeos/extensions/users_private/users_private_delegate.h +++ b/chrome/browser/chromeos/extensions/users_private/users_private_delegate.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include "base/macros.h" #include "chrome/browser/extensions/api/settings_private/prefs_util.h"
diff --git a/chrome/browser/chromeos/fileapi/recent_arc_media_source.h b/chrome/browser/chromeos/fileapi/recent_arc_media_source.h index 0ae0d4dc..7d0813d2 100644 --- a/chrome/browser/chromeos/fileapi/recent_arc_media_source.h +++ b/chrome/browser/chromeos/fileapi/recent_arc_media_source.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_FILEAPI_RECENT_ARC_MEDIA_SOURCE_H_ #include <memory> -#include <string> #include <vector> #include "base/gtest_prod_util.h"
diff --git a/chrome/browser/chromeos/fileapi/recent_drive_source.h b/chrome/browser/chromeos/fileapi/recent_drive_source.h index c31febe..8776059 100644 --- a/chrome/browser/chromeos/fileapi/recent_drive_source.h +++ b/chrome/browser/chromeos/fileapi/recent_drive_source.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_FILEAPI_RECENT_DRIVE_SOURCE_H_ #include <memory> -#include <string> #include <vector> #include "base/files/file.h"
diff --git a/chrome/browser/chromeos/fileapi/recent_source.h b/chrome/browser/chromeos/fileapi/recent_source.h index 4f0cddb0..128f1db 100644 --- a/chrome/browser/chromeos/fileapi/recent_source.h +++ b/chrome/browser/chromeos/fileapi/recent_source.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_FILEAPI_RECENT_SOURCE_H_ #include <memory> -#include <string> #include <vector> #include "base/callback_forward.h"
diff --git a/chrome/browser/chromeos/input_method/suggestions_service_client.cc b/chrome/browser/chromeos/input_method/suggestions_service_client.cc index 81ae477..e4d977e 100644 --- a/chrome/browser/chromeos/input_method/suggestions_service_client.cc +++ b/chrome/browser/chromeos/input_method/suggestions_service_client.cc
@@ -5,8 +5,8 @@ #include "chrome/browser/chromeos/input_method/suggestions_service_client.h" #include "base/bind.h" -#include "base/optional.h" #include "chromeos/services/machine_learning/public/cpp/service_connection.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace chromeos { namespace { @@ -29,7 +29,7 @@ } } -base::Optional<TextSuggestion> ToTextSuggestion( +absl::optional<TextSuggestion> ToTextSuggestion( const TextSuggestionCandidatePtr& candidate, const TextSuggestionMode& suggestion_mode) { if (!candidate->is_multi_word()) {
diff --git a/chrome/browser/chromeos/input_method/ui/infolist_window.h b/chrome/browser/chromeos/input_method/ui/infolist_window.h index 78b1e759..aaa79d6 100644 --- a/chrome/browser/chromeos/input_method/ui/infolist_window.h +++ b/chrome/browser/chromeos/input_method/ui/infolist_window.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_UI_INFOLIST_WINDOW_H_ #include <memory> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.h b/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.h index 022320252..b4a3e82 100644 --- a/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.h +++ b/chrome/browser/chromeos/net/network_diagnostics/https_latency_routine.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_DIAGNOSTICS_HTTPS_LATENCY_ROUTINE_H_ #include <memory> -#include <string> #include <vector> #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/chromeos/net/network_diagnostics/tls_prober.h b/chrome/browser/chromeos/net/network_diagnostics/tls_prober.h index 16994da5..2a9eadf 100644 --- a/chrome/browser/chromeos/net/network_diagnostics/tls_prober.h +++ b/chrome/browser/chromeos/net/network_diagnostics/tls_prober.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_DIAGNOSTICS_TLS_PROBER_H_ #define CHROME_BROWSER_CHROMEOS_NET_NETWORK_DIAGNOSTICS_TLS_PROBER_H_ -#include <string> - #include "base/callback.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h index 0cb52aa5..fadca979 100644 --- a/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h +++ b/chrome/browser/chromeos/policy/affiliated_invalidation_service_provider_impl.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_POLICY_AFFILIATED_INVALIDATION_SERVICE_PROVIDER_IMPL_H_ #include <memory> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/chromeos/policy/extension_install_event_log_collector.h b/chrome/browser/chromeos/policy/extension_install_event_log_collector.h index fd4b4c9..8ed3810 100644 --- a/chrome/browser/chromeos/policy/extension_install_event_log_collector.h +++ b/chrome/browser/chromeos/policy/extension_install_event_log_collector.h
@@ -9,7 +9,6 @@ #include <memory> #include <set> -#include <string> #include "base/logging.h" #include "base/scoped_observation.h"
diff --git a/chrome/browser/chromeos/policy/extension_install_event_logger.h b/chrome/browser/chromeos/policy/extension_install_event_logger.h index 0c71255..dd062dd 100644 --- a/chrome/browser/chromeos/policy/extension_install_event_logger.h +++ b/chrome/browser/chromeos/policy/extension_install_event_logger.h
@@ -7,7 +7,6 @@ #include <memory> #include <set> -#include <string> #include "chrome/browser/chromeos/policy/extension_install_event_log_collector.h" #include "chrome/browser/chromeos/policy/install_event_logger_base.h"
diff --git a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h index ae6ae6c..df281063 100644 --- a/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h +++ b/chrome/browser/chromeos/policy/scheduled_update_checker/device_scheduled_update_checker.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_POLICY_SCHEDULED_UPDATE_CHECKER_DEVICE_SCHEDULED_UPDATE_CHECKER_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter.h b/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter.h index 0c81e23c..90454e9 100644 --- a/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter.h +++ b/chrome/browser/chromeos/power/auto_screen_brightness/metrics_reporter.h
@@ -7,7 +7,6 @@ #include <array> #include <memory> -#include <string> #include "base/macros.h" #include "base/scoped_observation.h"
diff --git a/chrome/browser/chromeos/power/freezer_cgroup_process_manager.h b/chrome/browser/chromeos/power/freezer_cgroup_process_manager.h index eebe82f..65b3885 100644 --- a/chrome/browser/chromeos/power/freezer_cgroup_process_manager.h +++ b/chrome/browser/chromeos/power/freezer_cgroup_process_manager.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_POWER_FREEZER_CGROUP_PROCESS_MANAGER_H_ #include <memory> -#include <string> #include "base/callback.h" #include "base/macros.h"
diff --git a/chrome/browser/chromeos/printing/enterprise_printers_provider.h b/chrome/browser/chromeos/printing/enterprise_printers_provider.h index 6ae6ecf..e1323459 100644 --- a/chrome/browser/chromeos/printing/enterprise_printers_provider.h +++ b/chrome/browser/chromeos/printing/enterprise_printers_provider.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_PRINTING_ENTERPRISE_PRINTERS_PROVIDER_H_ #include <memory> -#include <string> #include "base/macros.h" #include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/chromeos/printing/print_servers_policy_provider.h b/chrome/browser/chromeos/printing/print_servers_policy_provider.h index 79ea474..3c84219 100644 --- a/chrome/browser/chromeos/printing/print_servers_policy_provider.h +++ b/chrome/browser/chromeos/printing/print_servers_policy_provider.h
@@ -6,7 +6,6 @@ #include <map> #include <memory> -#include <string> #include "base/callback_forward.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/chromeos/printing/printer_event_tracker.h b/chrome/browser/chromeos/printing/printer_event_tracker.h index e9cd8bf5..93a92ab 100644 --- a/chrome/browser/chromeos/printing/printer_event_tracker.h +++ b/chrome/browser/chromeos/printing/printer_event_tracker.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_EVENT_TRACKER_H_ #define CHROME_BROWSER_CHROMEOS_PRINTING_PRINTER_EVENT_TRACKER_H_ -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/chromeos/smb_client/discovery/netbios_client.h b/chrome/browser/chromeos/smb_client/discovery/netbios_client.h index e00c7a0..07aa3eec 100644 --- a/chrome/browser/chromeos/smb_client/discovery/netbios_client.h +++ b/chrome/browser/chromeos/smb_client/discovery/netbios_client.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_CHROMEOS_SMB_CLIENT_DISCOVERY_NETBIOS_CLIENT_H_ #include <memory> -#include <string> #include <vector> #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.h b/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.h index 5eb976f..8277b550 100644 --- a/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.h +++ b/chrome/browser/chromeos/smb_client/smb_persisted_share_registry.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_PERSISTED_SHARE_REGISTRY_H_ #define CHROME_BROWSER_CHROMEOS_SMB_CLIENT_SMB_PERSISTED_SHARE_REGISTRY_H_ -#include <string> #include <vector> #include "chrome/browser/chromeos/smb_client/smb_share_info.h"
diff --git a/chrome/browser/client_hints/client_hints_browsertest.cc b/chrome/browser/client_hints/client_hints_browsertest.cc index 67224a4..816c7307 100644 --- a/chrome/browser/client_hints/client_hints_browsertest.cc +++ b/chrome/browser/client_hints/client_hints_browsertest.cc
@@ -60,7 +60,7 @@ namespace { -const unsigned expected_client_hints_number = 12u; +const unsigned expected_client_hints_number = 13u; const int32_t uma_histogram_max_value = 1471228928; // An interceptor that records count of fetches and client hint headers for @@ -265,7 +265,7 @@ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); feature_list->InitializeFromCommandLine( "UserAgentClientHint,LangClientHintHeader,CriticalClientHint," - "AcceptCHFrame", + "AcceptCHFrame,PrefersColorSchemeClientHintHeader", ""); return feature_list; } @@ -813,7 +813,8 @@ std::unique_ptr<base::FeatureList> EnabledFeatures() override { std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); feature_list->InitializeFromCommandLine( - "AllowClientHintsToThirdParty,UserAgentClientHint,LangClientHintHeader", + "AllowClientHintsToThirdParty,UserAgentClientHint," + "LangClientHintHeader,PrefersColorSchemeClientHintHeader", ""); return feature_list; } @@ -2099,7 +2100,9 @@ std::unique_ptr<base::FeatureList> feature_list(new base::FeatureList); feature_list->InitializeFromCommandLine( - "UserAgentClientHint,LangClientHintHeader", ""); + "UserAgentClientHint,LangClientHintHeader," + "PrefersColorSchemeClientHintHeader", + ""); feature_list->RegisterFieldTrialOverride( features::kNetworkQualityEstimatorWebHoldback.name, base::FeatureList::OVERRIDE_ENABLE_FEATURE, trial.get());
diff --git a/chrome/browser/component_updater/chrome_origin_trials_component_installer.h b/chrome/browser/component_updater/chrome_origin_trials_component_installer.h index e90b25c..04fed6fb 100644 --- a/chrome/browser/component_updater/chrome_origin_trials_component_installer.h +++ b/chrome/browser/component_updater/chrome_origin_trials_component_installer.h
@@ -8,7 +8,6 @@ #include <stdint.h> #include <memory> -#include <string> #include <vector> #include "base/files/file_path.h"
diff --git a/chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h b/chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h index e72fa9d..c5e2daf 100644 --- a/chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h +++ b/chrome/browser/data_reduction_proxy/data_reduction_proxy_chrome_settings.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_DATA_REDUCTION_PROXY_DATA_REDUCTION_PROXY_CHROME_SETTINGS_H_ #include <memory> -#include <string> #include "base/macros.h" #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h"
diff --git a/chrome/browser/enterprise/reporting/profile_report_generator_desktop.h b/chrome/browser/enterprise/reporting/profile_report_generator_desktop.h index d6bc8c43..ec97fd6 100644 --- a/chrome/browser/enterprise/reporting/profile_report_generator_desktop.h +++ b/chrome/browser/enterprise/reporting/profile_report_generator_desktop.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_ENTERPRISE_REPORTING_PROFILE_REPORT_GENERATOR_DESKTOP_H_ #include <memory> -#include <string> #include "base/macros.h" #include "components/enterprise/browser/reporting/profile_report_generator.h"
diff --git a/chrome/browser/extensions/active_tab_permission_granter.cc b/chrome/browser/extensions/active_tab_permission_granter.cc index 95b64e30..dabd5e7 100644 --- a/chrome/browser/extensions/active_tab_permission_granter.cc +++ b/chrome/browser/extensions/active_tab_permission_granter.cc
@@ -52,8 +52,8 @@ process->GetBrowserContext()) ->GetRenderer(process); if (renderer) { - renderer->UpdateTabSpecificPermissions(extension_id, new_hosts, tab_id, - update_origin_whitelist); + renderer->UpdateTabSpecificPermissions(extension_id, new_hosts.Clone(), + tab_id, update_origin_whitelist); } }
diff --git a/chrome/browser/extensions/active_tab_permission_granter.h b/chrome/browser/extensions/active_tab_permission_granter.h index 7e6909e..5a90e550 100644 --- a/chrome/browser/extensions/active_tab_permission_granter.h +++ b/chrome/browser/extensions/active_tab_permission_granter.h
@@ -7,7 +7,6 @@ #include <memory> #include <set> -#include <string> #include "base/macros.h" #include "base/scoped_observation.h"
diff --git a/chrome/browser/extensions/activity_log/activity_log_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_unittest.cc index d0e9695ff..903fab97 100644 --- a/chrome/browser/extensions/activity_log/activity_log_unittest.cc +++ b/chrome/browser/extensions/activity_log/activity_log_unittest.cc
@@ -80,6 +80,9 @@ // mojom::Renderer implementation: void ActivateExtension(const std::string& extension_id) override {} void SetActivityLoggingEnabled(bool enabled) override {} + void LoadExtensions( + std::vector<mojom::ExtensionLoadedParamsPtr> loaded_extensions) override { + } void UnloadExtension(const std::string& extension_id) override {} void SuspendExtension( const std::string& extension_id, @@ -102,10 +105,10 @@ std::move(callback).Run(); } void UpdateDefaultPolicyHostRestrictions( - const URLPatternSet& default_policy_blocked_hosts, - const URLPatternSet& default_policy_allowed_hosts) override {} + URLPatternSet default_policy_blocked_hosts, + URLPatternSet default_policy_allowed_hosts) override {} void UpdateTabSpecificPermissions(const std::string& extension_id, - const URLPatternSet& new_hosts, + URLPatternSet new_hosts, int tab_id, bool update_origin_whitelist) override {} void UpdateUserScripts(base::ReadOnlySharedMemoryRegion shared_memory,
diff --git a/chrome/browser/extensions/api/autofill_private/autofill_util.h b/chrome/browser/extensions/api/autofill_private/autofill_util.h index 7dabff6..3abc2a4 100644 --- a/chrome/browser/extensions/api/autofill_private/autofill_util.h +++ b/chrome/browser/extensions/api/autofill_private/autofill_util.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include "base/macros.h" #include "chrome/common/extensions/api/autofill_private.h"
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc index a4382679..1fe7e65 100644 --- a/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc +++ b/chrome/browser/extensions/api/declarative_content/declarative_content_css_condition_tracker_unittest.cc
@@ -60,6 +60,9 @@ // mojom::Renderer implementation: void ActivateExtension(const std::string& extension_id) override {} void SetActivityLoggingEnabled(bool enabled) override {} + void LoadExtensions( + std::vector<mojom::ExtensionLoadedParamsPtr> loaded_extensions) override { + } void UnloadExtension(const std::string& extension_id) override {} void SuspendExtension( const std::string& extension_id, @@ -82,10 +85,10 @@ std::move(callback).Run(); } void UpdateDefaultPolicyHostRestrictions( - const URLPatternSet& default_policy_blocked_hosts, - const URLPatternSet& default_policy_allowed_hosts) override {} + URLPatternSet default_policy_blocked_hosts, + URLPatternSet default_policy_allowed_hosts) override {} void UpdateTabSpecificPermissions(const std::string& extension_id, - const URLPatternSet& new_hosts, + URLPatternSet new_hosts, int tab_id, bool update_origin_allowlist) override {} void UpdateUserScripts(base::ReadOnlySharedMemoryRegion shared_memory,
diff --git a/chrome/browser/extensions/api/identity/identity_mint_queue.h b/chrome/browser/extensions/api/identity/identity_mint_queue.h index e2a0b010..b7fc4ea6 100644 --- a/chrome/browser/extensions/api/identity/identity_mint_queue.h +++ b/chrome/browser/extensions/api/identity/identity_mint_queue.h
@@ -8,7 +8,6 @@ #include <list> #include <map> #include <set> -#include <string> #include "chrome/browser/extensions/api/identity/extension_token_key.h"
diff --git a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc index 7a173035..b0161601 100644 --- a/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc +++ b/chrome/browser/extensions/api/messaging/native_message_host_chromeos.cc
@@ -11,6 +11,7 @@ #include "base/stl_util.h" #include "chrome/browser/ash/arc/extensions/arc_support_message_host.h" #include "chrome/browser/ash/drive/drivefs_native_message_host.h" +#include "chrome/browser/ash/guest_os/vm_sk_forwarding_native_message_host.h" #include "chrome/browser/ash/wilco_dtc_supportd/wilco_dtc_supportd_messaging.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/api/messaging/native_message_built_in_host.h" @@ -49,6 +50,10 @@ drive::kDriveFsNativeMessageHostOrigins, drive::kDriveFsNativeMessageHostOriginsSize, &drive::CreateDriveFsNativeMessageHost}, + {ash::guest_os::VmSKForwardingNativeMessageHost::kHostName, + ash::guest_os::VmSKForwardingNativeMessageHost::kOrigins, + ash::guest_os::VmSKForwardingNativeMessageHost::kOriginCount, + &ash::guest_os::VmSKForwardingNativeMessageHost::CreateFromExtension}, }; const size_t kBuiltInHostsCount = base::size(kBuiltInHosts);
diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h b/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h index d1fbebc0..d4a0735 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_utils.h
@@ -7,7 +7,6 @@ #include <functional> #include <map> -#include <string> #include "base/containers/flat_map.h" #include "chrome/common/extensions/api/passwords_private.h"
diff --git a/chrome/browser/extensions/api/permissions/permissions_api.h b/chrome/browser/extensions/api/permissions/permissions_api.h index e25d14c..7b8c249 100644 --- a/chrome/browser/extensions/api/permissions/permissions_api.h +++ b/chrome/browser/extensions/api/permissions/permissions_api.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ #define CHROME_BROWSER_EXTENSIONS_API_PERMISSIONS_PERMISSIONS_API_H_ -#include <string> - #include "base/compiler_specific.h" #include "base/macros.h" #include "chrome/browser/extensions/extension_install_prompt.h"
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.cc b/chrome/browser/extensions/api/tabs/tabs_api.cc index cbd28ad..44546d5 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api.cc
@@ -580,9 +580,10 @@ // Find the tab. |source_tab_strip| and |tab_index| will later be used to // move the tab into the created window. Browser* source_browser = nullptr; + content::WebContents* web_contents = nullptr; if (!GetTabById(*create_data->tab_id, calling_profile, include_incognito_information(), &source_browser, - &source_tab_strip, nullptr, &tab_index, &error)) { + &source_tab_strip, &web_contents, &tab_index, &error)) { return RespondNow(Error(std::move(error))); } @@ -592,6 +593,9 @@ if (source_browser->profile() != window_profile) return RespondNow( Error(tabs_constants::kCanOnlyMoveTabsWithinSameProfileError)); + + if (DevToolsWindow::IsDevToolsWindow(web_contents)) + return RespondNow(Error(tabs_constants::kNotAllowedForDevToolsError)); } if (!IsValidStateForWindowsCreateFunction(create_data)) @@ -1377,6 +1381,9 @@ return RespondNow(Error(std::move(error))); } + if (DevToolsWindow::IsDevToolsWindow(contents)) + return RespondNow(Error(tabs_constants::kNotAllowedForDevToolsError)); + if (!ExtensionTabUtil::BrowserSupportsTabs(browser)) return RespondNow(Error(tabs_constants::kNoCurrentWindowError)); @@ -1613,6 +1620,11 @@ return false; } + if (DevToolsWindow::IsDevToolsWindow(contents)) { + *error = tabs_constants::kNotAllowedForDevToolsError; + return false; + } + // Don't let the extension move the tab if the user is dragging tabs. if (!ExtensionTabUtil::IsTabStripEditable()) { *error = tabs_constants::kTabStripNotEditableError; @@ -1866,11 +1878,15 @@ tab_browsers.reserve(tab_ids.size()); for (int tab_id : tab_ids) { Browser* tab_browser = nullptr; + content::WebContents* web_contents = nullptr; if (!GetTabById(tab_id, browser_context(), include_incognito_information(), - &tab_browser, nullptr, nullptr, nullptr, &error)) { + &tab_browser, nullptr, &web_contents, nullptr, &error)) { return RespondNow(Error(std::move(error))); } tab_browsers.push_back(tab_browser); + + if (DevToolsWindow::IsDevToolsWindow(web_contents)) + return RespondNow(Error(tabs_constants::kNotAllowedForDevToolsError)); } // Move all tabs to the target browser, appending to the end each time. Only @@ -2509,6 +2525,9 @@ nullptr, nullptr, &contents, nullptr, &error)) { return RespondNow(Error(std::move(error))); } + + if (DevToolsWindow::IsDevToolsWindow(contents)) + return RespondNow(Error(tabs_constants::kNotAllowedForDevToolsError)); } // Discard the tab. contents =
diff --git a/chrome/browser/extensions/api/tabs/tabs_constants.cc b/chrome/browser/extensions/api/tabs/tabs_constants.cc index 0e1640ae..925c8b1 100644 --- a/chrome/browser/extensions/api/tabs/tabs_constants.cc +++ b/chrome/browser/extensions/api/tabs/tabs_constants.cc
@@ -129,6 +129,11 @@ const char kCannotNavigateToDevtools[] = "Cannot navigate to a devtools:// page without either the devtools or " "debugger permission."; +const char kCannotHighlightTabs[] = + "Cannot change tab highlight. This may be due to user dragging in " + "progress."; +const char kNotAllowedForDevToolsError[] = + "Operation not allowed for DevTools windows"; } // namespace tabs_constants } // namespace extensions
diff --git a/chrome/browser/extensions/api/tabs/tabs_constants.h b/chrome/browser/extensions/api/tabs/tabs_constants.h index 2be2762..6df59cef 100644 --- a/chrome/browser/extensions/api/tabs/tabs_constants.h +++ b/chrome/browser/extensions/api/tabs/tabs_constants.h
@@ -112,6 +112,8 @@ extern const char kLockedFullscreenModeNewTabError[]; extern const char kGroupParamsError[]; extern const char kCannotNavigateToDevtools[]; +extern const char kCannotHighlightTabs[]; +extern const char kNotAllowedForDevToolsError[]; } // namespace tabs_constants } // namespace extensions
diff --git a/chrome/browser/extensions/api/tabs/tabs_test.cc b/chrome/browser/extensions/api/tabs/tabs_test.cc index 0ccbbee..8c4aae125 100644 --- a/chrome/browser/extensions/api/tabs/tabs_test.cc +++ b/chrome/browser/extensions/api/tabs/tabs_test.cc
@@ -905,12 +905,13 @@ EXPECT_TRUE(base::MatchPattern( utils::RunFunctionAndReturnError( - function.get(), base::StringPrintf( + function.get(), + base::StringPrintf( "[%d, {\"url\":\"http://example.com\"}]", ExtensionTabUtil::GetTabId( DevToolsWindowTesting::Get(devtools)->main_web_contents())), DevToolsWindowTesting::Get(devtools)->browser()), - tabs_constants::kNoCurrentWindowError)); + tabs_constants::kNotAllowedForDevToolsError)); DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); } @@ -2521,4 +2522,77 @@ test_contents->GetMainFrame()->GetProcess()); } +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, + ExtensionAPICannotCreateWindowForDevtools) { + DevToolsWindow* devtools = DevToolsWindowTesting::OpenDevToolsWindowSync( + browser()->tab_strip_model()->GetWebContentsAt(0), false /* is_docked */); + scoped_refptr<WindowsCreateFunction> function = new WindowsCreateFunction(); + + EXPECT_TRUE(base::MatchPattern( + utils::RunFunctionAndReturnError( + function.get(), + base::StringPrintf( + R"([{"tabId": %d}])", + ExtensionTabUtil::GetTabId( + DevToolsWindowTesting::Get(devtools)->main_web_contents())), + DevToolsWindowTesting::Get(devtools)->browser()), + tabs_constants::kNotAllowedForDevToolsError)); + + DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); +} + +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ExtensionAPICannotMoveDevtoolsTab) { + DevToolsWindow* devtools = DevToolsWindowTesting::OpenDevToolsWindowSync( + browser()->tab_strip_model()->GetWebContentsAt(0), false /* is_docked */); + scoped_refptr<TabsMoveFunction> function = new TabsMoveFunction(); + + EXPECT_TRUE(base::MatchPattern( + utils::RunFunctionAndReturnError( + function.get(), + base::StringPrintf( + R"([%d, {"index": -1}])", + ExtensionTabUtil::GetTabId( + DevToolsWindowTesting::Get(devtools)->main_web_contents())), + DevToolsWindowTesting::Get(devtools)->browser()), + tabs_constants::kNotAllowedForDevToolsError)); + + DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); +} + +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ExtensionAPICannotGroupDevtoolsTab) { + DevToolsWindow* devtools = DevToolsWindowTesting::OpenDevToolsWindowSync( + browser()->tab_strip_model()->GetWebContentsAt(0), false /* is_docked */); + scoped_refptr<TabsGroupFunction> function = new TabsGroupFunction(); + + EXPECT_TRUE(base::MatchPattern( + utils::RunFunctionAndReturnError( + function.get(), + base::StringPrintf( + R"([{"tabIds": %d}])", + ExtensionTabUtil::GetTabId( + DevToolsWindowTesting::Get(devtools)->main_web_contents())), + DevToolsWindowTesting::Get(devtools)->browser()), + tabs_constants::kNotAllowedForDevToolsError)); + + DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); +} + +IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ExtensionAPICannotDiscardDevtoolsTab) { + DevToolsWindow* devtools = DevToolsWindowTesting::OpenDevToolsWindowSync( + browser()->tab_strip_model()->GetWebContentsAt(0), false /* is_docked */); + scoped_refptr<TabsDiscardFunction> function = new TabsDiscardFunction(); + + EXPECT_TRUE(base::MatchPattern( + utils::RunFunctionAndReturnError( + function.get(), + base::StringPrintf( + "[%d]", + ExtensionTabUtil::GetTabId( + DevToolsWindowTesting::Get(devtools)->main_web_contents())), + DevToolsWindowTesting::Get(devtools)->browser()), + tabs_constants::kNotAllowedForDevToolsError)); + + DevToolsWindowTesting::CloseDevToolsWindowSync(devtools); +} + } // namespace extensions
diff --git a/chrome/browser/extensions/forced_extensions/force_installed_tracker.cc b/chrome/browser/extensions/forced_extensions/force_installed_tracker.cc index 1cb8c4e..f176389 100644 --- a/chrome/browser/extensions/forced_extensions/force_installed_tracker.cc +++ b/chrome/browser/extensions/forced_extensions/force_installed_tracker.cc
@@ -25,7 +25,9 @@ namespace extensions { namespace { +constexpr int kHttpErrorCodeBadRequest = 400; constexpr int kHttpErrorCodeForbidden = 403; +constexpr int kHttpErrorCodeNotFound = 404; } // namespace ForceInstalledTracker::ForceInstalledTracker(ExtensionRegistry* registry, @@ -264,9 +266,12 @@ if (installation_data.failure_reason == InstallStageTracker::FailureReason::MANIFEST_FETCH_FAILED) { auto extension = extensions_.find(id); - if (installation_data.response_code == kHttpErrorCodeForbidden && - extension != extensions_.end() && !extension->second.is_from_store) { - return true; + if (extension != extensions_.end() && !extension->second.is_from_store) { + if (installation_data.response_code == kHttpErrorCodeBadRequest || + installation_data.response_code == kHttpErrorCodeForbidden || + installation_data.response_code == kHttpErrorCodeNotFound) { + return true; + } } }
diff --git a/chrome/browser/extensions/menu_manager_test_observer.h b/chrome/browser/extensions/menu_manager_test_observer.h index 4023055..10e04086 100644 --- a/chrome/browser/extensions/menu_manager_test_observer.h +++ b/chrome/browser/extensions/menu_manager_test_observer.h
@@ -8,7 +8,6 @@ #include "chrome/browser/extensions/menu_manager.h" #include <set> -#include <string> #include "base/run_loop.h" #include "base/scoped_observation.h"
diff --git a/chrome/browser/extensions/mock_extension_special_storage_policy.h b/chrome/browser/extensions/mock_extension_special_storage_policy.h index 86f191f..e06a4d9 100644 --- a/chrome/browser/extensions/mock_extension_special_storage_policy.h +++ b/chrome/browser/extensions/mock_extension_special_storage_policy.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_EXTENSIONS_MOCK_EXTENSION_SPECIAL_STORAGE_POLICY_H_ #include <set> -#include <string> #include "base/macros.h" #include "chrome/browser/extensions/extension_special_storage_policy.h"
diff --git a/chrome/browser/extensions/permissions_updater.cc b/chrome/browser/extensions/permissions_updater.cc index aec31e2..b4a9a3e 100644 --- a/chrome/browser/extensions/permissions_updater.cc +++ b/chrome/browser/extensions/permissions_updater.cc
@@ -42,6 +42,7 @@ #include "extensions/common/extension.h" #include "extensions/common/extension_messages.h" #include "extensions/common/manifest_handlers/permissions_parser.h" +#include "extensions/common/mojom/permission_set.mojom.h" #include "extensions/common/mojom/renderer.mojom.h" #include "extensions/common/permissions/permission_set.h" #include "extensions/common/permissions/permissions_data.h" @@ -699,7 +700,8 @@ ->GetRenderer(host); if (renderer) { renderer->UpdateDefaultPolicyHostRestrictions( - default_runtime_blocked_hosts, default_runtime_allowed_hosts); + default_runtime_blocked_hosts.Clone(), + default_runtime_allowed_hosts.Clone()); } } }
diff --git a/chrome/browser/extensions/permissions_updater.h b/chrome/browser/extensions/permissions_updater.h index 217ca019..8d9fcfe 100644 --- a/chrome/browser/extensions/permissions_updater.h +++ b/chrome/browser/extensions/permissions_updater.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_EXTENSIONS_PERMISSIONS_UPDATER_H__ #include <memory> -#include <string> #include "base/callback_forward.h" #include "base/macros.h"
diff --git a/chrome/browser/extensions/scripting_permissions_modifier.h b/chrome/browser/extensions/scripting_permissions_modifier.h index 7a05fed..833aa6f 100644 --- a/chrome/browser/extensions/scripting_permissions_modifier.h +++ b/chrome/browser/extensions/scripting_permissions_modifier.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_EXTENSIONS_SCRIPTING_PERMISSIONS_MODIFIER_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/memory/ref_counted.h"
diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json index 0b1f3c64..ffae604b 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json
@@ -2225,7 +2225,7 @@ }, { "name": "enable-process-sharing-with-default-site-instances", - "owners": [ "acolwell" ], + "owners": [ "creis" ], "expiry_milestone": 81 }, { @@ -3421,7 +3421,7 @@ }, { "name": "location-permissions-prompt", - "owners": [ "thegreenfrog", "bling-team" ], + "owners": [ "thegreenfrog", "bling-flags@google.com" ], "expiry_milestone": 91 }, {
diff --git a/chrome/browser/install_verification/win/module_verification_common.h b/chrome/browser/install_verification/win/module_verification_common.h index 424b7e5..ee7e6421 100644 --- a/chrome/browser/install_verification/win/module_verification_common.h +++ b/chrome/browser/install_verification/win/module_verification_common.h
@@ -8,7 +8,6 @@ #include <stddef.h> #include <set> -#include <string> #include <vector> struct ModuleInfo;
diff --git a/chrome/browser/local_discovery/endpoint_resolver.h b/chrome/browser/local_discovery/endpoint_resolver.h index 516f391..04ea2920 100644 --- a/chrome/browser/local_discovery/endpoint_resolver.h +++ b/chrome/browser/local_discovery/endpoint_resolver.h
@@ -8,7 +8,6 @@ #include <stdint.h> #include <memory> -#include <string> #include "base/callback.h" #include "base/macros.h"
diff --git a/chrome/browser/long_screenshots/long_screenshots_tab_service.h b/chrome/browser/long_screenshots/long_screenshots_tab_service.h index 4a96ab22..8c8808a 100644 --- a/chrome/browser/long_screenshots/long_screenshots_tab_service.h +++ b/chrome/browser/long_screenshots/long_screenshots_tab_service.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_LONG_SCREENSHOTS_LONG_SCREENSHOTS_TAB_SERVICE_H_ #include <memory> -#include <string> #include <vector> #include "base/android/jni_android.h"
diff --git a/chrome/browser/lookalikes/lookalike_url_service.h b/chrome/browser/lookalikes/lookalike_url_service.h index 634b4ea..aa0f06c 100644 --- a/chrome/browser/lookalikes/lookalike_url_service.h +++ b/chrome/browser/lookalikes/lookalike_url_service.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_LOOKALIKES_LOOKALIKE_URL_SERVICE_H_ #define CHROME_BROWSER_LOOKALIKES_LOOKALIKE_URL_SERVICE_H_ -#include <string> #include <vector> #include "base/callback_forward.h"
diff --git a/chrome/browser/lookalikes/lookalike_url_tab_storage.h b/chrome/browser/lookalikes/lookalike_url_tab_storage.h index ca766f6..4d7fdce 100644 --- a/chrome/browser/lookalikes/lookalike_url_tab_storage.h +++ b/chrome/browser/lookalikes/lookalike_url_tab_storage.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_LOOKALIKES_LOOKALIKE_URL_TAB_STORAGE_H_ #include <set> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/media/router/discovery/mdns/media_sink_util.h b/chrome/browser/media/router/discovery/mdns/media_sink_util.h index fb1e5a5..c7ee457 100644 --- a/chrome/browser/media/router/discovery/mdns/media_sink_util.h +++ b/chrome/browser/media/router/discovery/mdns/media_sink_util.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_MEDIA_SINK_UTIL_H_ #define CHROME_BROWSER_MEDIA_ROUTER_DISCOVERY_MDNS_MEDIA_SINK_UTIL_H_ -#include <string> #include <vector> #include "components/media_router/common/discovery/media_sink_internal.h"
diff --git a/chrome/browser/media/webrtc/desktop_capture_access_handler.h b/chrome/browser/media/webrtc/desktop_capture_access_handler.h index 0f1be04..34e049c1 100644 --- a/chrome/browser/media/webrtc/desktop_capture_access_handler.h +++ b/chrome/browser/media/webrtc/desktop_capture_access_handler.h
@@ -7,7 +7,6 @@ #include <list> #include <memory> -#include <string> #include <utility> #include "base/containers/flat_map.h"
diff --git a/chrome/browser/media/webrtc/display_media_access_handler.h b/chrome/browser/media/webrtc/display_media_access_handler.h index d03cc19..f17bcc3a 100644 --- a/chrome/browser/media/webrtc/display_media_access_handler.h +++ b/chrome/browser/media/webrtc/display_media_access_handler.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_MEDIA_WEBRTC_DISPLAY_MEDIA_ACCESS_HANDLER_H_ #include <memory> -#include <string> #include "base/containers/flat_map.h" #include "base/macros.h"
diff --git a/chrome/browser/media_galleries/chromeos/snapshot_file_details.h b/chrome/browser/media_galleries/chromeos/snapshot_file_details.h index f5b31d7..9df76dcd 100644 --- a/chrome/browser/media_galleries/chromeos/snapshot_file_details.h +++ b/chrome/browser/media_galleries/chromeos/snapshot_file_details.h
@@ -7,8 +7,6 @@ #include <stdint.h> -#include <string> - #include "base/callback.h" #include "base/files/file.h" #include "base/files/file_path.h"
diff --git a/chrome/browser/media_galleries/fileapi/media_path_filter.h b/chrome/browser/media_galleries/fileapi/media_path_filter.h index ce87605..cd38f8ab 100644 --- a/chrome/browser/media_galleries/fileapi/media_path_filter.h +++ b/chrome/browser/media_galleries/fileapi/media_path_filter.h
@@ -8,7 +8,6 @@ #include <stddef.h> #include <map> -#include <string> #include <vector> #include "base/files/file_path.h"
diff --git a/chrome/browser/metrics/perf/process_type_collector.h b/chrome/browser/metrics/perf/process_type_collector.h index 210f2eb..ac39ea5 100644 --- a/chrome/browser/metrics/perf/process_type_collector.h +++ b/chrome/browser/metrics/perf/process_type_collector.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_METRICS_PERF_PROCESS_TYPE_COLLECTOR_H_ #include <map> -#include <string> #include <vector> #include "third_party/metrics_proto/execution_context.pb.h"
diff --git a/chrome/browser/navigation_predictor/navigation_predictor.h b/chrome/browser/navigation_predictor/navigation_predictor.h index 07d6bd81..a6c0a35e 100644 --- a/chrome/browser/navigation_predictor/navigation_predictor.h +++ b/chrome/browser/navigation_predictor/navigation_predictor.h
@@ -7,7 +7,6 @@ #include <deque> #include <set> -#include <string> #include <unordered_map> #include <vector>
diff --git a/chrome/browser/nearby_sharing/nearby_connection.h b/chrome/browser/nearby_sharing/nearby_connection.h index 17ed2fd..0d94f1e 100644 --- a/chrome/browser/nearby_sharing/nearby_connection.h +++ b/chrome/browser/nearby_sharing/nearby_connection.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_NEARBY_SHARING_NEARBY_CONNECTION_H_ #include <stdint.h> -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/browser/net/system_network_context_manager.h b/chrome/browser/net/system_network_context_manager.h index c8019b0e..ba2ab4b9 100644 --- a/chrome/browser/net/system_network_context_manager.h +++ b/chrome/browser/net/system_network_context_manager.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_NET_SYSTEM_NETWORK_CONTEXT_MANAGER_H_ #include <memory> -#include <string> #include <vector> #include "base/gtest_prod_util.h"
diff --git a/chrome/browser/notifications/scheduler/internal/init_aware_scheduler.h b/chrome/browser/notifications/scheduler/internal/init_aware_scheduler.h index 6d57fdaf..12462e0 100644 --- a/chrome/browser/notifications/scheduler/internal/init_aware_scheduler.h +++ b/chrome/browser/notifications/scheduler/internal/init_aware_scheduler.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_INTERNAL_INIT_AWARE_SCHEDULER_H_ #include <memory> -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/browser/notifications/scheduler/internal/noop_notification_schedule_service.h b/chrome/browser/notifications/scheduler/internal/noop_notification_schedule_service.h index 3dbdfc30..091b7be 100644 --- a/chrome/browser/notifications/scheduler/internal/noop_notification_schedule_service.h +++ b/chrome/browser/notifications/scheduler/internal/noop_notification_schedule_service.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_INTERNAL_NOOP_NOTIFICATION_SCHEDULE_SERVICE_H_ #include <memory> -#include <string> #include "chrome/browser/notifications/scheduler/public/notification_schedule_service.h" #include "chrome/browser/notifications/scheduler/public/user_action_handler.h"
diff --git a/chrome/browser/notifications/scheduler/internal/notification_schedule_service_impl.h b/chrome/browser/notifications/scheduler/internal/notification_schedule_service_impl.h index b7ff504..c37f106d 100644 --- a/chrome/browser/notifications/scheduler/internal/notification_schedule_service_impl.h +++ b/chrome/browser/notifications/scheduler/internal/notification_schedule_service_impl.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_NOTIFICATIONS_SCHEDULER_INTERNAL_NOTIFICATION_SCHEDULE_SERVICE_IMPL_H_ #include <memory> -#include <string> #include "base/memory/weak_ptr.h" #include "chrome/browser/notifications/scheduler/public/notification_schedule_service.h"
diff --git a/chrome/browser/notifications/scheduler/internal/scheduler_utils.h b/chrome/browser/notifications/scheduler/internal/scheduler_utils.h index acb5938..0f1101f 100644 --- a/chrome/browser/notifications/scheduler/internal/scheduler_utils.h +++ b/chrome/browser/notifications/scheduler/internal/scheduler_utils.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include "base/time/clock.h" #include "base/time/default_clock.h"
diff --git a/chrome/browser/offline_pages/android/offline_page_archive_publisher_impl.h b/chrome/browser/offline_pages/android/offline_page_archive_publisher_impl.h index 890b551..1c402ea1 100644 --- a/chrome/browser/offline_pages/android/offline_page_archive_publisher_impl.h +++ b/chrome/browser/offline_pages/android/offline_page_archive_publisher_impl.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_OFFLINE_PAGES_ANDROID_OFFLINE_PAGE_ARCHIVE_PUBLISHER_IMPL_H_ #include <cstdint> -#include <string> #include "base/callback.h" #include "components/offline_pages/core/offline_page_archive_publisher.h"
diff --git a/chrome/browser/offline_pages/prefetch/prefetch_background_task_handler_impl.cc b/chrome/browser/offline_pages/prefetch/prefetch_background_task_handler_impl.cc index 495622e1..a662c27 100644 --- a/chrome/browser/offline_pages/prefetch/prefetch_background_task_handler_impl.cc +++ b/chrome/browser/offline_pages/prefetch/prefetch_background_task_handler_impl.cc
@@ -117,9 +117,9 @@ void PrefetchBackgroundTaskHandlerImpl::UpdateBackoff( net::BackoffEntry* backoff) { - std::unique_ptr<base::Value> value = + base::Value value = net::BackoffEntrySerializer::SerializeToValue(*backoff, OfflineTimeNow()); - prefs_->Set(prefetch_prefs::kBackoff, *value); + prefs_->Set(prefetch_prefs::kBackoff, value); } } // namespace offline_pages
diff --git a/chrome/browser/optimization_guide/optimization_guide_navigation_data.h b/chrome/browser/optimization_guide/optimization_guide_navigation_data.h index b84e250..6d63ad9e0 100644 --- a/chrome/browser/optimization_guide/optimization_guide_navigation_data.h +++ b/chrome/browser/optimization_guide/optimization_guide_navigation_data.h
@@ -7,7 +7,6 @@ #include <stdint.h> #include <memory> -#include <string> #include <utility> #include "base/containers/flat_map.h"
diff --git a/chrome/browser/optimization_guide/optimization_guide_web_contents_observer.h b/chrome/browser/optimization_guide/optimization_guide_web_contents_observer.h index 7c70a89..bc2ce99 100644 --- a/chrome/browser/optimization_guide/optimization_guide_web_contents_observer.h +++ b/chrome/browser/optimization_guide/optimization_guide_web_contents_observer.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_OPTIMIZATION_GUIDE_OPTIMIZATION_GUIDE_WEB_CONTENTS_OBSERVER_H_ #define CHROME_BROWSER_OPTIMIZATION_GUIDE_OPTIMIZATION_GUIDE_WEB_CONTENTS_OBSERVER_H_ -#include <string> #include <vector> #include "base/containers/flat_map.h"
diff --git a/chrome/browser/page_load_metrics/observers/third_party_metrics_observer.h b/chrome/browser/page_load_metrics/observers/third_party_metrics_observer.h index 6ff74e13..666e279 100644 --- a/chrome/browser/page_load_metrics/observers/third_party_metrics_observer.h +++ b/chrome/browser/page_load_metrics/observers/third_party_metrics_observer.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_THIRD_PARTY_METRICS_OBSERVER_H_ #include <map> -#include <string> #include "base/macros.h" #include "components/page_load_metrics/browser/page_load_metrics_observer.h"
diff --git a/chrome/browser/paint_preview/services/paint_preview_tab_service.h b/chrome/browser/paint_preview/services/paint_preview_tab_service.h index 5d84d0b..fa9bace 100644 --- a/chrome/browser/paint_preview/services/paint_preview_tab_service.h +++ b/chrome/browser/paint_preview/services/paint_preview_tab_service.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_PAINT_PREVIEW_SERVICES_PAINT_PREVIEW_TAB_SERVICE_H_ #include <memory> -#include <string> #include <vector> #include "base/callback_forward.h"
diff --git a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.cc b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.cc index 628f106..ab6f185 100644 --- a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.cc +++ b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.cc
@@ -10,6 +10,7 @@ #include "chrome/browser/ui/android/passwords/all_passwords_bottom_sheet_view_impl.h" #include "components/password_manager/content/browser/content_password_manager_driver.h" #include "components/password_manager/content/browser/content_password_manager_driver_factory.h" +#include "components/password_manager/core/browser/biometric_authenticator.h" #include "components/password_manager/core/browser/password_form.h" #include "components/password_manager/core/browser/password_manager_client.h" #include "components/password_manager/core/browser/password_manager_driver.h" @@ -57,8 +58,12 @@ client_ = ChromePasswordManagerClient::FromWebContents(web_contents_); } -AllPasswordsBottomSheetController::~AllPasswordsBottomSheetController() = - default; +AllPasswordsBottomSheetController::~AllPasswordsBottomSheetController() { + if (authenticator_) { + authenticator_->Cancel( + password_manager::BiometricAuthRequester::kAllPasswordsList); + } +} void AllPasswordsBottomSheetController::Show() { store_->GetAllLoginsWithAffiliationAndBrandingInformation(this); @@ -80,20 +85,34 @@ const std::u16string password) { const bool is_password_field = focused_field_type_ == FocusedFieldType::kFillablePasswordField; - DCHECK(driver_); - if (is_password_field) { - driver_->FillIntoFocusedField(is_password_field, password); + if (!driver_) { + OnDismiss(); + return; + } + if (is_password_field) { // `client_` is guaranteed to be valid here. // Both the `client_` and `PasswordAccessoryController` are attached to // WebContents. And AllPasswordBottomSheetController is owned by // PasswordAccessoryController. DCHECK(client_); - client_->OnPasswordSelected(password); + scoped_refptr<password_manager::BiometricAuthenticator> authenticator = + client_->GetBiometricAuthenticator(); + if (authenticator && + authenticator->CanAuthenticate() == + password_manager::BiometricsAvailability::kAvailable) { + authenticator_ = std::move(authenticator); + authenticator_->Authenticate( + password_manager::BiometricAuthRequester::kAllPasswordsList, + base::BindOnce(&AllPasswordsBottomSheetController::OnReauthCompleted, + base::Unretained(this), password)); + return; + } + + FillPassword(password); } else { driver_->FillIntoFocusedField(is_password_field, username); } - // Consumes the dismissal callback to destroy the native controller and java // controller after the user selects a credential. OnDismiss(); @@ -106,3 +125,25 @@ const GURL& AllPasswordsBottomSheetController::GetFrameUrl() { return driver_->GetLastCommittedURL(); } + +void AllPasswordsBottomSheetController::OnReauthCompleted( + const std::u16string& password, + bool auth_succeeded) { + authenticator_.reset(); + + if (auth_succeeded) { + FillPassword(password); + } + + // Consumes the dismissal callback to destroy the native controller and java + // controller after the user selects a credential. + OnDismiss(); +} + +void AllPasswordsBottomSheetController::FillPassword( + const std::u16string& password) { + if (!driver_) + return; + driver_->FillIntoFocusedField(true, password); + client_->OnPasswordSelected(password); +}
diff --git a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.h b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.h index 0fced051..ccace51 100644 --- a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.h +++ b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.h
@@ -8,6 +8,7 @@ #include "base/callback.h" #include "base/types/pass_key.h" #include "components/autofill/core/common/mojom/autofill_types.mojom-forward.h" +#include "components/password_manager/core/browser/biometric_authenticator.h" #include "components/password_manager/core/browser/password_store_consumer.h" #include "ui/gfx/native_widget_types.h" #include "url/gurl.h" @@ -71,6 +72,13 @@ const GURL& GetFrameUrl(); private: + // Called when the biometric re-auth completes. |password| is the password + // to be filled and |auth_succeded| is the authentication result. + void OnReauthCompleted(const std::u16string& password, bool auth_succeeded); + + // Fills the password into the focused field. + void FillPassword(const std::u16string& password); + // The controller takes |view_| ownership. std::unique_ptr<AllPasswordsBottomSheetView> view_; @@ -89,6 +97,9 @@ // constructor specified for tests. base::WeakPtr<password_manager::PasswordManagerDriver> driver_; + // Authenticator used to trigger a biometric re-auth before password filling. + scoped_refptr<password_manager::BiometricAuthenticator> authenticator_; + // The type of field on which the user is focused, e.g. PASSWORD. autofill::mojom::FocusedFieldType focused_field_type_;
diff --git a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller_unittest.cc b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller_unittest.cc index 3e20bf60..0ecd060b3 100644 --- a/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller_unittest.cc +++ b/chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller_unittest.cc
@@ -5,12 +5,15 @@ #include "chrome/browser/password_manager/android/all_passwords_bottom_sheet_controller.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/gmock_callback_support.h" #include "base/test/mock_callback.h" #include "base/types/pass_key.h" #include "chrome/browser/password_manager/password_manager_test_util.h" #include "chrome/browser/ui/android/passwords/all_passwords_bottom_sheet_view.h" #include "chrome/test/base/testing_profile.h" #include "components/autofill/core/common/mojom/autofill_types.mojom-forward.h" +#include "components/password_manager/core/browser/biometric_authenticator.h" +#include "components/password_manager/core/browser/mock_biometric_authenticator.h" #include "components/password_manager/core/browser/origin_credential_store.h" #include "components/password_manager/core/browser/password_form.h" #include "components/password_manager/core/browser/password_manager_test_utils.h" @@ -24,13 +27,19 @@ using ::testing::_; using ::testing::Eq; using ::testing::Pointee; +using ::testing::Return; using ::testing::UnorderedElementsAre; +using autofill::mojom::FocusedFieldType; +using base::test::RunOnceCallback; +using password_manager::BiometricAuthRequester; +using password_manager::BiometricsAvailability; +using password_manager::MockBiometricAuthenticator; using password_manager::PasswordForm; using password_manager::TestPasswordStore; using password_manager::UiCredential; + using CallbackFunctionMock = testing::MockFunction<void()>; -using autofill::mojom::FocusedFieldType; using DismissCallback = base::MockCallback<base::OnceCallback<void()>>; @@ -68,6 +77,11 @@ : public password_manager::StubPasswordManagerClient { public: MOCK_METHOD(void, OnPasswordSelected, (const std::u16string&), (override)); + + MOCK_METHOD(scoped_refptr<password_manager::BiometricAuthenticator>, + GetBiometricAuthenticator, + (), + (override)); }; UiCredential MakeUiCredential(const std::u16string& username, @@ -134,6 +148,10 @@ return *mock_pwd_manager_client_.get(); } + scoped_refptr<password_manager::MockBiometricAuthenticator> authenticator() { + return mock_authenticator_; + } + private: content::BrowserTaskEnvironment task_env_; MockPasswordManagerDriver driver_; @@ -145,6 +163,8 @@ std::unique_ptr<AllPasswordsBottomSheetController> all_passwords_controller_; std::unique_ptr<MockPasswordManagerClient> mock_pwd_manager_client_ = std::make_unique<MockPasswordManagerClient>(); + scoped_refptr<MockBiometricAuthenticator> mock_authenticator_ = + base::MakeRefCounted<MockBiometricAuthenticator>(); }; TEST_F(AllPasswordsBottomSheetControllerTest, Show) { @@ -171,14 +191,95 @@ RunUntilIdle(); } -TEST_F(AllPasswordsBottomSheetControllerTest, OnCredentialSelected) { +TEST_F(AllPasswordsBottomSheetControllerTest, FillsUsernameWithoutAuth) { + createAllPasswordsController(FocusedFieldType::kFillableUsernameField); + + UiCredential credential = MakeUiCredential(kUsername1, kPassword); + + EXPECT_CALL(client(), GetBiometricAuthenticator).Times(0); + EXPECT_CALL(driver(), + FillIntoFocusedField(false, std::u16string(kUsername1))); + EXPECT_CALL(dismissal_callback(), Run()); + + all_passwords_controller()->OnCredentialSelected(kUsername1, kPassword); +} + +TEST_F(AllPasswordsBottomSheetControllerTest, FillsPasswordIfNoAuth) { UiCredential credential = MakeUiCredential(kUsername1, kPassword); EXPECT_CALL(driver(), FillIntoFocusedField(true, std::u16string(kPassword))); + EXPECT_CALL(dismissal_callback(), Run()); all_passwords_controller()->OnCredentialSelected(kUsername1, kPassword); } +TEST_F(AllPasswordsBottomSheetControllerTest, FillsPasswordIfAuthNotAvailable) { + UiCredential credential = MakeUiCredential(kUsername1, kPassword); + + EXPECT_CALL(client(), GetBiometricAuthenticator) + .WillOnce(Return(authenticator())); + EXPECT_CALL(*authenticator().get(), CanAuthenticate) + .WillOnce(Return(BiometricsAvailability::kNotEnrolled)); + EXPECT_CALL(driver(), FillIntoFocusedField(true, std::u16string(kPassword))); + EXPECT_CALL(dismissal_callback(), Run()); + + all_passwords_controller()->OnCredentialSelected(kUsername1, kPassword); +} + +TEST_F(AllPasswordsBottomSheetControllerTest, FillsPasswordIfAuthSuccessful) { + UiCredential credential = MakeUiCredential(kUsername1, kPassword); + + EXPECT_CALL(client(), GetBiometricAuthenticator) + .WillOnce(Return(authenticator())); + EXPECT_CALL(*authenticator().get(), CanAuthenticate) + .WillOnce(Return(BiometricsAvailability::kAvailable)); + EXPECT_CALL(*authenticator().get(), + Authenticate(BiometricAuthRequester::kAllPasswordsList, _)) + .WillOnce(RunOnceCallback<1>(true)); + + EXPECT_CALL(driver(), FillIntoFocusedField(true, std::u16string(kPassword))); + EXPECT_CALL(dismissal_callback(), Run()); + + all_passwords_controller()->OnCredentialSelected(kUsername1, kPassword); +} + +TEST_F(AllPasswordsBottomSheetControllerTest, DoesntFillPasswordIfAuthFailed) { + UiCredential credential = MakeUiCredential(kUsername1, kPassword); + + EXPECT_CALL(client(), GetBiometricAuthenticator) + .WillOnce(Return(authenticator())); + EXPECT_CALL(*authenticator().get(), CanAuthenticate) + .WillOnce(Return(BiometricsAvailability::kAvailable)); + EXPECT_CALL(*authenticator().get(), + Authenticate(BiometricAuthRequester::kAllPasswordsList, _)) + .WillOnce(RunOnceCallback<1>(false)); + + EXPECT_CALL(driver(), FillIntoFocusedField(true, std::u16string(kPassword))) + .Times(0); + EXPECT_CALL(dismissal_callback(), Run()); + + all_passwords_controller()->OnCredentialSelected(kUsername1, kPassword); +} + +TEST_F(AllPasswordsBottomSheetControllerTest, CancelsAuthIfDestroyed) { + UiCredential credential = MakeUiCredential(kUsername1, kPassword); + + EXPECT_CALL(client(), GetBiometricAuthenticator) + .WillOnce(Return(authenticator())); + EXPECT_CALL(*authenticator().get(), CanAuthenticate) + .WillOnce(Return(BiometricsAvailability::kAvailable)); + EXPECT_CALL(*authenticator().get(), + Authenticate(BiometricAuthRequester::kAllPasswordsList, _)); + + EXPECT_CALL(driver(), FillIntoFocusedField(true, std::u16string(kPassword))) + .Times(0); + + all_passwords_controller()->OnCredentialSelected(kUsername1, kPassword); + + EXPECT_CALL(*authenticator().get(), + Cancel(BiometricAuthRequester::kAllPasswordsList)); +} + TEST_F(AllPasswordsBottomSheetControllerTest, OnDismiss) { EXPECT_CALL(dismissal_callback(), Run()); all_passwords_controller()->OnDismiss();
diff --git a/chrome/browser/picture_in_picture/DEPS b/chrome/browser/picture_in_picture/DEPS index 3196882..982ccc5 100644 --- a/chrome/browser/picture_in_picture/DEPS +++ b/chrome/browser/picture_in_picture/DEPS
@@ -1,8 +1,11 @@ specific_include_rules = { "picture_in_picture_window_controller_browsertest\.cc": [ + "+chrome/browser/ui/views/overlay/hang_up_button.h", "+chrome/browser/ui/views/overlay/overlay_window_views.h", "+chrome/browser/ui/views/overlay/playback_image_button.h", "+chrome/browser/ui/views/overlay/skip_ad_label_button.h", + "+chrome/browser/ui/views/overlay/toggle_camera_button.h", + "+chrome/browser/ui/views/overlay/toggle_microphone_button.h", "+chrome/browser/ui/views/overlay/track_image_button.h", ], }
diff --git a/chrome/browser/picture_in_picture/picture_in_picture_window_controller_browsertest.cc b/chrome/browser/picture_in_picture/picture_in_picture_window_controller_browsertest.cc index f01a6a7..5ea707362 100644 --- a/chrome/browser/picture_in_picture/picture_in_picture_window_controller_browsertest.cc +++ b/chrome/browser/picture_in_picture/picture_in_picture_window_controller_browsertest.cc
@@ -20,9 +20,12 @@ #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" +#include "chrome/browser/ui/views/overlay/hang_up_button.h" #include "chrome/browser/ui/views/overlay/overlay_window_views.h" #include "chrome/browser/ui/views/overlay/playback_image_button.h" #include "chrome/browser/ui/views/overlay/skip_ad_label_button.h" +#include "chrome/browser/ui/views/overlay/toggle_camera_button.h" +#include "chrome/browser/ui/views/overlay/toggle_microphone_button.h" #include "chrome/browser/ui/views/overlay/track_image_button.h" #include "chrome/browser/ui/web_applications/app_browser_controller.h" #include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h" @@ -58,6 +61,7 @@ #include "ui/events/base_event_utils.h" #include "ui/gfx/codec/png_codec.h" #include "ui/views/controls/button/image_button.h" +#include "ui/views/test/button_test_api.h" #include "ui/views/view_observer.h" #include "ui/views/widget/widget_observer.h" @@ -100,6 +104,9 @@ const base::FilePath::CharType kPictureInPictureWindowSizePage[] = FILE_PATH_LITERAL("media/picture-in-picture/window-size.html"); +const base::FilePath::CharType kPictureInPictureVideoConferencingPage[] = + FILE_PATH_LITERAL("media/picture-in-picture/video-conferencing.html"); + // Determines whether |control| is visible taking into account OverlayWindow's // custom control hiding that includes setting the size to 0x0. bool IsOverlayWindowControlVisible(views::View* control) { @@ -176,6 +183,14 @@ base::RunLoop run_loop_; }; +// Waits until the given WebContents has the expected title. +void WaitForTitle(content::WebContents* web_contents, + const std::u16string& expected_title) { + EXPECT_EQ( + expected_title, + content::TitleWatcher(web_contents, expected_title).WaitAndGetTitle()); +} + } // namespace class PictureInPictureWindowControllerBrowserTest @@ -233,10 +248,7 @@ void ExpectLeavePictureInPicture(content::WebContents* web_contents) { // 'leavepictureinpicture' is the title of the tab when the event is // received. - const std::u16string expected_title = u"leavepictureinpicture"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents, expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents, u"leavepictureinpicture"); bool in_picture_in_picture = true; EXPECT_TRUE(ExecuteScriptAndExtractBool( @@ -283,6 +295,12 @@ window->OnMouseEvent(&moved_over); } + void ClickButton(views::Button* button) { + const ui::MouseEvent event(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), + ui::EventTimeForNow(), 0, 0); + views::test::ButtonTestApi(button).NotifyClick(event); + } + private: content::PictureInPictureWindowController* pip_window_controller_ = nullptr; MockPictureInPictureWindowController mock_controller_; @@ -610,10 +628,7 @@ GetOverlayWindow()->SetSize(gfx::Size(400, 400)); - std::u16string expected_title = u"resized"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"resized"); } // Tests that when closing a Picture-in-Picture window, the video element is @@ -648,10 +663,7 @@ window_controller()->Close(true /* should_pause_video */); - std::u16string expected_title = u"leavepictureinpicture"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"leavepictureinpicture"); bool is_paused = false; EXPECT_TRUE(ExecuteScriptAndExtractBool(active_web_contents, "isPaused();", @@ -686,10 +698,7 @@ ASSERT_TRUE(window_controller()); window_controller()->Close(true /* should_pause_video */); - std::u16string expected_title = u"leavepictureinpicture"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"leavepictureinpicture"); } // Tests that when closing a Picture-in-Picture window, the video element @@ -723,11 +732,8 @@ ASSERT_TRUE(window_controller()); window_controller()->Close(true /* should_pause_video */); - std::u16string expected_title = - u"failed to enter Picture-in-Picture after leaving"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, + u"failed to enter Picture-in-Picture after leaving"); } // Tests that when closing a Picture-in-Picture window from the Web API, the @@ -759,10 +765,7 @@ content::ExecuteScript(active_web_contents, "exitPictureInPicture();")); // 'left' is sent when the first video leaves Picture-in-Picture. - std::u16string expected_title = u"leavepictureinpicture"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"leavepictureinpicture"); bool is_paused = false; EXPECT_TRUE(ExecuteScriptAndExtractBool(active_web_contents, "isPaused();", @@ -804,10 +807,7 @@ content::ExecuteScript(active_web_contents, "exitPictureInPicture();")); // 'left' is sent when the video leaves Picture-in-Picture. - std::u16string expected_title = u"leavepictureinpicture"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"leavepictureinpicture"); { bool result = false; @@ -1002,10 +1002,7 @@ window_controller()->Close(true /* should_pause_video */); // Wait for the window to close. - std::u16string expected_title = u"leavepictureinpicture"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"leavepictureinpicture"); bool video_paused = false; @@ -1125,10 +1122,7 @@ EXPECT_TRUE(pip_window_controller->GetWindowForTesting()->IsVisible()); // 'left' is sent when the first tab leaves Picture-in-Picture. - std::u16string expected_title = u"leavepictureinpicture"; - EXPECT_EQ(expected_title, - content::TitleWatcher(initial_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(initial_web_contents, u"leavepictureinpicture"); } // Closing the initial tab should not get the new tab to leave @@ -1266,10 +1260,7 @@ : render_frame_hosts[0]; // Wait for video metadata to load. - std::u16string expected_title = u"loadedmetadata"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"loadedmetadata"); bool result = false; ASSERT_TRUE(content::ExecuteScriptAndExtractBool( @@ -1310,10 +1301,7 @@ : render_frame_hosts[0]; // Wait for video metadata to load. - std::u16string expected_title = u"loadedmetadata"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"loadedmetadata"); bool result = false; ASSERT_TRUE(content::ExecuteScriptAndExtractBool( @@ -1567,10 +1555,7 @@ : render_frame_hosts[0]; // Wait for video metadata to load. - std::u16string expected_title = u"loadedmetadata"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"loadedmetadata"); // Attaching devtools triggers the change in timing that leads to the crash. DevToolsWindow* window = DevToolsWindowTesting::OpenDevToolsWindowSync( @@ -1756,24 +1741,15 @@ // Hide page and check that the document visibility is hidden. active_web_contents->WasHidden(); - std::u16string expected_title = u"hidden"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"hidden"); // Show page and check that the document visibility is visible. active_web_contents->WasShown(); - expected_title = u"visible"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"visible"); // Occlude page and check that the document visibility is hidden. active_web_contents->WasOccluded(); - expected_title = u"hidden"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"hidden"); } // Check that page visibility API events are fired even when video is in @@ -1800,10 +1776,7 @@ // Hide page and check that the document visibility is hidden. active_web_contents->WasHidden(); - std::u16string expected_title = u"hidden"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"hidden"); // Check that the video is still in Picture-in-Picture and playing. bool in_picture_in_picture = false; @@ -1816,10 +1789,7 @@ // Show page and check that the document visibility is visible. active_web_contents->WasShown(); - expected_title = u"visible"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"visible"); // Check that the video is still in Picture-in-Picture and playing. ASSERT_TRUE(ExecuteScriptAndExtractBool( @@ -1831,10 +1801,7 @@ // Occlude page and check that the document visibility is hidden. active_web_contents->WasOccluded(); - expected_title = u"hidden"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"hidden"); // Check that the video is still in Picture-in-Picture and playing. ASSERT_TRUE(ExecuteScriptAndExtractBool( @@ -2024,10 +1991,7 @@ // Simulates user clicking "Skip Ad" and check the handler function is called. window_controller()->SkipAd(); - std::u16string expected_title = u"skipad"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"skipad"); } // Tests that clicking the Play/Pause button in the Picture-in-Picture window @@ -2071,10 +2035,7 @@ // Simulates user clicking "Play/Pause" and check that the "pause" handler // function is called. window_controller()->TogglePlayPause(); - std::u16string expected_title = u"pause"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"pause"); EXPECT_TRUE(content::ExecuteScript(active_web_contents, "video.pause();")); WaitForPlaybackState(active_web_contents, @@ -2083,10 +2044,7 @@ // Simulates user clicking "Play/Pause" and check that the "play" handler // function is called. window_controller()->TogglePlayPause(); - expected_title = u"play"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"play"); } // Tests that clicking the Next Track button in the Picture-in-Picture window @@ -2113,10 +2071,7 @@ // Simulates user clicking "Next Track" and check the handler function is // called. window_controller()->NextTrack(); - std::u16string expected_title = u"nexttrack"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"nexttrack"); } // Tests that clicking the Previous Track button in the Picture-in-Picture @@ -2143,10 +2098,7 @@ // Simulates user clicking "Previous Track" and check the handler function is // called. window_controller()->PreviousTrack(); - std::u16string expected_title = u"previoustrack"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"previoustrack"); } // Tests that stopping Media Sessions closes the Picture-in-Picture window. @@ -2165,10 +2117,7 @@ content::MediaSession::Get(active_web_contents) ->Stop(content::MediaSession::SuspendType::kUI); - std::u16string expected_title = u"leavepictureinpicture"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"leavepictureinpicture"); } class AutoPictureInPictureWindowControllerBrowserTest @@ -2204,10 +2153,7 @@ // Hide page and check that there is no video that enters Picture-in-Picture // automatically. active_web_contents->WasHidden(); - std::u16string expected_title = u"hidden"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"hidden"); bool in_picture_in_picture = false; ASSERT_TRUE(ExecuteScriptAndExtractBool( @@ -2237,10 +2183,7 @@ // Hide page. active_web_contents->WasHidden(); - std::u16string expected_title = u"hidden"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"hidden"); // Enter Picture-in-Picture manually. bool result = false; @@ -2250,10 +2193,7 @@ // Show page and check that video left Picture-in-Picture automatically. active_web_contents->WasShown(); - expected_title = u"visible"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"visible"); bool in_picture_in_picture = false; ASSERT_TRUE(ExecuteScriptAndExtractBool( active_web_contents, "isInPictureInPicture();", &in_picture_in_picture)); @@ -2337,17 +2277,11 @@ // Hide page and check that video entered Picture-in-Picture automatically. web_contents()->WasHidden(); - std::u16string expected_title = u"video.enterpictureinpicture"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"video.enterpictureinpicture"); // Show page and check that video left Picture-in-Picture automatically. web_contents()->WasShown(); - expected_title = u"video.leavepictureinpicture"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"video.leavepictureinpicture"); } // Show pwa page and check that Auto Picture-in-Picture is not triggered if @@ -2372,10 +2306,7 @@ // Hide page and check that the video did not entered // Picture-in-Picture automatically. web_contents()->WasHidden(); - std::u16string expected_title = u"hidden"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"hidden"); bool in_picture_in_picture = false; ASSERT_TRUE(ExecuteScriptAndExtractBool( @@ -2398,10 +2329,7 @@ // Hide page and check that the video did not entered // Picture-in-Picture automatically. web_contents()->WasHidden(); - std::u16string expected_title = u"hidden"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"hidden"); bool in_picture_in_picture = false; ASSERT_TRUE(ExecuteScriptAndExtractBool( @@ -2434,10 +2362,7 @@ // Hide page and check that the second video did not entered // Picture-in-Picture automatically. web_contents()->WasHidden(); - std::u16string expected_title = u"hidden"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"hidden"); // Check that the first video is still in Picture-in-Picture. bool in_picture_in_picture = false; @@ -2469,10 +2394,7 @@ // automatically as it doesn't have the Auto Picture-in-Picture attribute // set. web_contents()->WasShown(); - const std::u16string expected_title = u"visible"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"visible"); // Check that the video is still in Picture-in-Picture. bool in_picture_in_picture = false; @@ -2501,51 +2423,33 @@ // Hide page and check that second video is the video that enters // Picture-in-Picture automatically. web_contents()->WasHidden(); - std::u16string expected_title = u"secondVideo.enterpictureinpicture"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"secondVideo.enterpictureinpicture"); // Show page and unset Auto Picture-in-Picture attribute on second video. web_contents()->WasShown(); - expected_title = u"visible"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"visible"); ASSERT_TRUE(content::ExecuteScript( web_contents(), "secondVideo.autoPictureInPicture = false;")); // Hide page and check that first video is the video that enters // Picture-in-Picture automatically. web_contents()->WasHidden(); - expected_title = u"video.enterpictureinpicture"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"video.enterpictureinpicture"); // Show page and unset Auto Picture-in-Picture attribute on first video. web_contents()->WasShown(); - expected_title = u"visible"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"visible"); ASSERT_TRUE(content::ExecuteScript(web_contents(), "video.autoPictureInPicture = false;")); // Hide page and check that there is no video that enters Picture-in-Picture // automatically. web_contents()->WasHidden(); - expected_title = u"hidden"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"hidden"); // Show page and append a video with Auto Picture-in-Picture attribute. web_contents()->WasShown(); - expected_title = u"visible"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"visible"); ASSERT_TRUE(content::ExecuteScriptAndExtractBool( web_contents(), "addHtmlVideoWithAutoPictureInPicture();", &result)); ASSERT_TRUE(result); @@ -2553,10 +2457,7 @@ // Hide page and check that the html video is the video that enters // Picture-in-Picture automatically. web_contents()->WasHidden(); - expected_title = u"htmlVideo.enterpictureinpicture"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"htmlVideo.enterpictureinpicture"); } // Check that video does not leave Picture-in-Picture automatically when it @@ -2574,10 +2475,7 @@ // Hide page and check that video entered Picture-in-Picture automatically. web_contents()->WasHidden(); - std::u16string expected_title = u"video.enterpictureinpicture"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"video.enterpictureinpicture"); ASSERT_TRUE(content::ExecuteScriptAndExtractBool( web_contents(), "playSecondVideo();", &result)); @@ -2589,10 +2487,7 @@ // automatically as it's not the most recent element with the Auto // Picture-in-Picture attribute set anymore. web_contents()->WasShown(); - expected_title = u"visible"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"visible"); // Check that the video is still in Picture-in-Picture. bool in_picture_in_picture = false; @@ -2618,10 +2513,7 @@ // Hide page and check that video entered Picture-in-Picture automatically // and is playing. web_contents()->WasHidden(); - std::u16string expected_title = u"video.enterpictureinpicture"; - EXPECT_EQ( - expected_title, - content::TitleWatcher(web_contents(), expected_title).WaitAndGetTitle()); + WaitForTitle(web_contents(), u"video.enterpictureinpicture"); // Check that video playback is still playing. bool is_paused = false; @@ -2653,10 +2545,7 @@ // Hide page and check that the video is paused first. active_web_contents->WasHidden(); - std::u16string expected_title = u"pause"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"pause"); ASSERT_TRUE( content::ExecuteScript(active_web_contents, "addPlayEventListener();")); @@ -2667,10 +2556,7 @@ EXPECT_TRUE(result); // Check that video playback has resumed. - expected_title = u"play"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"play"); } // Tests that exiting Picture-in-Picture when the video has no source fires the @@ -2686,10 +2572,7 @@ "video.src=''; exitPictureInPicture();")); // 'left' is sent when the first video leaves Picture-in-Picture. - std::u16string expected_title = u"leavepictureinpicture"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"leavepictureinpicture"); } // Tests that when closing the window after the player was reset, the <video> @@ -2712,10 +2595,7 @@ // Reset video source and wait for the notification. ASSERT_TRUE(content::ExecuteScript(active_web_contents, "resetVideo();")); - std::u16string expected_title = u"emptied"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"emptied"); window_controller()->Close(true /* should_pause_video */); @@ -2744,8 +2624,66 @@ ui::DomCode::SPACE, ui::EF_NONE); GetOverlayWindow()->OnKeyEvent(&space_key_pressed); - std::u16string expected_title = u"pause"; - EXPECT_EQ(expected_title, - content::TitleWatcher(active_web_contents, expected_title) - .WaitAndGetTitle()); + WaitForTitle(active_web_contents, u"pause"); +} + +class VideoConferencingPictureInPictureWindowControllerBrowserTest + : public PictureInPictureWindowControllerBrowserTest { + public: + void SetUpCommandLine(base::CommandLine* command_line) override { + feature_list_.InitAndEnableFeature(media::kMediaSessionWebRTC); + PictureInPictureWindowControllerBrowserTest::SetUpCommandLine(command_line); + } + + private: + base::test::ScopedFeatureList feature_list_; +}; + +// Test that video conferencing action buttons function correctly. +IN_PROC_BROWSER_TEST_F( + VideoConferencingPictureInPictureWindowControllerBrowserTest, + VideoConferencingActions) { + // Enter PiP. + LoadTabAndEnterPictureInPicture( + browser(), base::FilePath(kPictureInPictureVideoConferencingPage)); + + // The overlay window should exist. + ASSERT_NE(GetOverlayWindow(), nullptr); + + content::WebContents* active_web_contents = + browser()->tab_strip_model()->GetActiveWebContents(); + ToggleMicrophoneButton* toggle_microphone_button = + GetOverlayWindow()->toggle_microphone_button_for_testing(); + ToggleCameraButton* toggle_camera_button = + GetOverlayWindow()->toggle_camera_button_for_testing(); + HangUpButton* hang_up_button = + GetOverlayWindow()->hang_up_button_for_testing(); + + // Wait for the controls to become visible. + GetOverlayWindow()->ForceControlsVisibleForTesting(true); + EXPECT_NO_FATAL_FAILURE(AssertControlsVisible( + {toggle_microphone_button, toggle_camera_button, hang_up_button}, true)); + + // The ToggleMicrophoneButton should be in the muted state (set by the page). + EXPECT_TRUE(toggle_microphone_button->is_muted_for_testing()); + + // Pressing the ToggleMicrophoneButton should call the page's handler, which + // sets the page title and sets the muted state to unmuted. + ClickButton(toggle_microphone_button); + WaitForTitle(active_web_contents, u"togglemicrophone"); + EXPECT_FALSE(toggle_microphone_button->is_muted_for_testing()); + + // The ToggleCameraButton should be in the off state (set by the page). + EXPECT_FALSE(toggle_camera_button->is_turned_on_for_testing()); + + // Pressing the ToggleCameraButton should call the page's handler, which sets + // the page title and sets the button state the turned on. + ClickButton(toggle_camera_button); + WaitForTitle(active_web_contents, u"togglecamera"); + EXPECT_TRUE(toggle_camera_button->is_turned_on_for_testing()); + + // Pressing the HangUpButton should call the page's handler, which sets the + // page title. + ClickButton(hang_up_button); + WaitForTitle(active_web_contents, u"hangup"); }
diff --git a/chrome/browser/policy/chrome_browser_cloud_management_register_watcher.h b/chrome/browser/policy/chrome_browser_cloud_management_register_watcher.h index f761e8b..773d87a3 100644 --- a/chrome/browser/policy/chrome_browser_cloud_management_register_watcher.h +++ b/chrome/browser/policy/chrome_browser_cloud_management_register_watcher.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_POLICY_CHROME_BROWSER_CLOUD_MANAGEMENT_REGISTER_WATCHER_H_ #include <memory> -#include <string> #include "base/callback_forward.h" #include "base/gtest_prod_util.h"
diff --git a/chrome/browser/policy/messaging_layer/upload/record_handler_impl.h b/chrome/browser/policy/messaging_layer/upload/record_handler_impl.h index cc4df31f..547e4ed 100644 --- a/chrome/browser/policy/messaging_layer/upload/record_handler_impl.h +++ b/chrome/browser/policy/messaging_layer/upload/record_handler_impl.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_POLICY_MESSAGING_LAYER_UPLOAD_RECORD_HANDLER_IMPL_H_ #define CHROME_BROWSER_POLICY_MESSAGING_LAYER_UPLOAD_RECORD_HANDLER_IMPL_H_ -#include <string> #include <utility> #include "base/callback.h"
diff --git a/chrome/browser/predictors/loading_predictor.h b/chrome/browser/predictors/loading_predictor.h index b6bca5f..57d1e9521 100644 --- a/chrome/browser/predictors/loading_predictor.h +++ b/chrome/browser/predictors/loading_predictor.h
@@ -8,7 +8,6 @@ #include <map> #include <memory> #include <set> -#include <string> #include <utility> #include <vector>
diff --git a/chrome/browser/predictors/loading_stats_collector.h b/chrome/browser/predictors/loading_stats_collector.h index ab830900..7007367 100644 --- a/chrome/browser/predictors/loading_stats_collector.h +++ b/chrome/browser/predictors/loading_stats_collector.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include <utility> #include "base/macros.h"
diff --git a/chrome/browser/predictors/prefetch_manager.h b/chrome/browser/predictors/prefetch_manager.h index 23c8962..a881141 100644 --- a/chrome/browser/predictors/prefetch_manager.h +++ b/chrome/browser/predictors/prefetch_manager.h
@@ -8,7 +8,6 @@ #include <list> #include <map> #include <memory> -#include <string> #include <vector> #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/printing/print_preview_data_service.h b/chrome/browser/printing/print_preview_data_service.h index d55251a..13d2585 100644 --- a/chrome/browser/printing/print_preview_data_service.h +++ b/chrome/browser/printing/print_preview_data_service.h
@@ -9,7 +9,6 @@ #include <map> #include <memory> -#include <string> #include "base/macros.h" #include "base/memory/ref_counted.h"
diff --git a/chrome/browser/privacy_sandbox/android/BUILD.gn b/chrome/browser/privacy_sandbox/android/BUILD.gn index 7ce578d..39f2b28 100644 --- a/chrome/browser/privacy_sandbox/android/BUILD.gn +++ b/chrome/browser/privacy_sandbox/android/BUILD.gn
@@ -10,6 +10,7 @@ android_library("java") { sources = [ + "java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java", "java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxBridge.java", "java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxHelpers.java", "java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxReferrer.java", @@ -55,8 +56,10 @@ sources = [ "java/res/drawable-night/privacy_sandbox_illustration.xml", "java/res/drawable/privacy_sandbox_illustration.xml", + "java/res/layout/floc_button.xml", "java/res/layout/privacy_sandbox_header.xml", "java/res/values/dimens.xml", + "java/res/xml/floc_preferences.xml", "java/res/xml/privacy_sandbox_preferences.xml", ] deps = [
diff --git a/chrome/browser/privacy_sandbox/android/java/res/layout/floc_button.xml b/chrome/browser/privacy_sandbox/android/java/res/layout/floc_button.xml new file mode 100644 index 0000000..bc3ce99 --- /dev/null +++ b/chrome/browser/privacy_sandbox/android/java/res/layout/floc_button.xml
@@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. +--> + +<LinearLayout + xmlns:android="http://schemas.android.com/apk/res/android" + android:gravity="start" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:orientation="horizontal"> + + <org.chromium.ui.widget.ButtonCompat + android:id="@+id/floc_reset_button" + style="@style/FilledButton.Flat" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/floc_button_margin" + android:focusable="true" + android:text="@string/privacy_sandbox_floc_reset_button" /> + +</LinearLayout>
diff --git a/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml b/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml index 4a865aa..d568c90 100644 --- a/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml +++ b/chrome/browser/privacy_sandbox/android/java/res/values/dimens.xml
@@ -4,6 +4,7 @@ found in the LICENSE file. --> <resources> + <dimen name="floc_button_margin">16dp</dimen> <dimen name="privacy_sandbox_illustration_height">120dp</dimen> <dimen name="privacy_sandbox_illustration_width">120dp</dimen> </resources>
diff --git a/chrome/browser/privacy_sandbox/android/java/res/xml/floc_preferences.xml b/chrome/browser/privacy_sandbox/android/java/res/xml/floc_preferences.xml new file mode 100644 index 0000000..8276a5f --- /dev/null +++ b/chrome/browser/privacy_sandbox/android/java/res/xml/floc_preferences.xml
@@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- 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. --> + +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <org.chromium.components.browser_ui.settings.ChromeSwitchPreference + android:key="floc_toggle" + android:title="@string/prefs_privacy_sandbox_floc" + android:persistent="false" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.LongSummaryTextMessagePreference + android:key="floc_description" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="floc_status" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="floc_group" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="floc_update" + app:allowDividerBelow="false" /> + + <org.chromium.components.browser_ui.settings.TextMessagePreference + android:summary="@string/privacy_sandbox_floc_reset_description" + app:allowDividerBelow="false" /> + +</PreferenceScreen>
diff --git a/chrome/browser/privacy_sandbox/android/java/res/xml/privacy_sandbox_preferences.xml b/chrome/browser/privacy_sandbox/android/java/res/xml/privacy_sandbox_preferences.xml index cbedc97..dff0a5f0 100644 --- a/chrome/browser/privacy_sandbox/android/java/res/xml/privacy_sandbox_preferences.xml +++ b/chrome/browser/privacy_sandbox/android/java/res/xml/privacy_sandbox_preferences.xml
@@ -12,6 +12,7 @@ app:allowDividerBelow="false" /> <org.chromium.components.browser_ui.settings.TextMessagePreference + android:key="privacy_sandbox_title" android:title="@string/privacy_sandbox_description_title" app:allowDividerBelow="false" /> @@ -27,6 +28,13 @@ <org.chromium.components.browser_ui.settings.LongSummaryTextMessagePreference android:key="privacy_sandbox_toggle_description" - app:allowDividerBelow="false" /> + app:allowDividerBelow="true" /> + + <Preference + android:fragment="org.chromium.chrome.browser.privacy_sandbox.FlocSettingsFragment" + android:key="floc_page" + android:title="@string/prefs_privacy_sandbox_floc" + app:allowDividerAbove="true" + app:allowDividerBelow="true" /> </PreferenceScreen>
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 new file mode 100644 index 0000000..2deebfb2 --- /dev/null +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/FlocSettingsFragment.java
@@ -0,0 +1,59 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +package org.chromium.chrome.browser.privacy_sandbox; + +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; + +import androidx.preference.PreferenceFragmentCompat; + +import org.chromium.components.browser_ui.settings.SettingsUtils; + +/** + * Settings fragment for FLoC settings as part of Privacy Sandbox. + */ +public class FlocSettingsFragment extends PreferenceFragmentCompat { + public static final String FLOC_DESCRIPTION = "floc_description"; + public static final String FLOC_STATUS = "floc_status"; + public static final String FLOC_GROUP = "floc_group"; + public static final String FLOC_UPDATE = "floc_update"; + + /** + * Initializes all the objects related to the preferences page. + */ + @Override + public void onCreatePreferences(Bundle bundle, String s) { + // Add all preferences and set the title. + getActivity().setTitle(R.string.prefs_privacy_sandbox_floc); + SettingsUtils.addPreferencesFromResource(this, R.xml.floc_preferences); + findPreference(FLOC_DESCRIPTION).setSummary(R.string.privacy_sandbox_floc_description); + updateInformation(); + } + + @Override + public View onCreateView( + LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + LinearLayout view = + (LinearLayout) super.onCreateView(inflater, container, savedInstanceState); + // Add a button to the bottom of the preferences view. + LinearLayout buttonView = + (LinearLayout) inflater.inflate(R.layout.floc_button, view, false); + view.addView(buttonView); + return view; + } + + private void updateInformation() { + findPreference(FLOC_STATUS) + .setSummary(getContext().getString(R.string.privacy_sandbox_floc_status_title) + + "\n" + PrivacySandboxBridge.getFlocStatusString()); + findPreference(FLOC_GROUP) + .setSummary(getContext().getString(R.string.privacy_sandbox_floc_group_title) + "\n" + + PrivacySandboxBridge.getFlocGroupString()); + findPreference(FLOC_UPDATE).setSummary(R.string.privacy_sandbox_floc_update_title); + } +}
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxBridge.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxBridge.java index 85bad715..6b8904e6 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxBridge.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxBridge.java
@@ -24,11 +24,26 @@ PrivacySandboxBridgeJni.get().setPrivacySandboxEnabled(enabled); } + public static boolean isFlocEnabled() { + return PrivacySandboxBridgeJni.get().isFlocEnabled(); + } + + public static String getFlocStatusString() { + return PrivacySandboxBridgeJni.get().getFlocStatusString(); + } + + public static String getFlocGroupString() { + return PrivacySandboxBridgeJni.get().getFlocGroupString(); + } + @NativeMethods interface Natives { boolean isPrivacySandboxSettingsFunctional(); boolean isPrivacySandboxEnabled(); boolean isPrivacySandboxManaged(); void setPrivacySandboxEnabled(boolean enabled); + boolean isFlocEnabled(); + String getFlocStatusString(); + String getFlocGroupString(); } }
diff --git a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragment.java b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragment.java index 74a27a2e..07f238e 100644 --- a/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragment.java +++ b/chrome/browser/privacy_sandbox/android/java/src/org/chromium/chrome/browser/privacy_sandbox/PrivacySandboxSettingsFragment.java
@@ -35,17 +35,18 @@ */ public class PrivacySandboxSettingsFragment extends PreferenceFragmentCompat implements Preference.OnPreferenceChangeListener { - public static final String PRIVACY_SANDBOX_DEFAULT_URL = - "https://web.dev/digging-into-the-privacy-sandbox/"; + public static final String PRIVACY_SANDBOX_DEFAULT_URL = "https://www.privacysandbox.com"; public static final String EXPERIMENT_URL_PARAM = "website-url"; // Key for the argument with which the PrivacySandbox fragment will be launched. The value for // this argument should be part of the PrivacySandboxReferrer enum, which contains all points of // entry to the Privacy Sandbox UI. public static final String PRIVACY_SANDBOX_REFERRER = "privacy-sandbox-referrer"; + public static final String EXPERIMENT_DESCRIPTION_TITLE = "privacy_sandbox_title"; public static final String EXPERIMENT_DESCRIPTION_PREFERENCE = "privacy_sandbox_description"; public static final String TOGGLE_DESCRIPTION_PREFERENCE = "privacy_sandbox_toggle_description"; public static final String TOGGLE_PREFERENCE = "privacy_sandbox_toggle"; + public static final String FLOC_PREFERENCE = "floc_page"; private @PrivacySandboxReferrer int mPrivacySandboxReferrer; private PrivacySandboxHelpers.CustomTabIntentHelper mCustomTabHelper; @@ -65,6 +66,21 @@ // Add all preferences and set the title. getActivity().setTitle(R.string.prefs_privacy_sandbox); SettingsUtils.addPreferencesFromResource(this, R.xml.privacy_sandbox_preferences); + + // Remove the FLoC page Preference if the Phase 2 flag is disabled. + Preference flocPreference = findPreference(FLOC_PREFERENCE); + if (!ChromeFeatureList.isEnabled(ChromeFeatureList.PRIVACY_SANDBOX_SETTINGS_2)) { + getPreferenceScreen().removePreference(flocPreference); + } else { + // Modify the Privacy Sandbox elements. + getPreferenceScreen().removePreference(findPreference(EXPERIMENT_DESCRIPTION_TITLE)); + flocPreference.setSummary(PrivacySandboxBridge.getFlocStatusString()); + // When the entire Privacy Sandbox is disabled, deactivate the preference. + if (!PrivacySandboxBridge.isPrivacySandboxEnabled()) { + flocPreference.setEnabled(false); + } + } + // Format the Privacy Sandbox description, which has a link. findPreference(EXPERIMENT_DESCRIPTION_PREFERENCE) .setSummary(SpanApplier.applySpans( @@ -99,6 +115,12 @@ RecordUserAction.record(enabled ? "Settings.PrivacySandbox.ApisEnabled" : "Settings.PrivacySandbox.ApisDisabled"); PrivacySandboxBridge.setPrivacySandboxEnabled(enabled); + // Update the Preference linking to the FLoC page if shown. + Preference flocPreference = findPreference(FLOC_PREFERENCE); + if (flocPreference != null) { + flocPreference.setEnabled(enabled); + flocPreference.setSummary(PrivacySandboxBridge.getFlocStatusString()); + } return true; }
diff --git a/chrome/browser/privacy_sandbox/android/privacy_sandbox_bridge.cc b/chrome/browser/privacy_sandbox/android/privacy_sandbox_bridge.cc index c5c7808..819c2259 100644 --- a/chrome/browser/privacy_sandbox/android/privacy_sandbox_bridge.cc +++ b/chrome/browser/privacy_sandbox/android/privacy_sandbox_bridge.cc
@@ -2,11 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/android/jni_string.h" #include "chrome/browser/privacy_sandbox/android/jni_headers/PrivacySandboxBridge_jni.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings.h" #include "chrome/browser/privacy_sandbox/privacy_sandbox_settings_factory.h" #include "chrome/browser/profiles/profile_manager.h" +using base::android::ConvertUTF16ToJavaString; +using base::android::ScopedJavaLocalRef; + static jboolean JNI_PrivacySandboxBridge_IsPrivacySandboxSettingsFunctional( JNIEnv* env) { return PrivacySandboxSettingsFactory::GetForProfile( @@ -33,3 +37,25 @@ ProfileManager::GetActiveUserProfile()) ->SetPrivacySandboxEnabled(enabled); } + +static jboolean JNI_PrivacySandboxBridge_IsFlocEnabled(JNIEnv* env) { + return PrivacySandboxSettingsFactory::GetForProfile( + ProfileManager::GetActiveUserProfile()) + ->IsFlocAllowed(); +} + +static ScopedJavaLocalRef<jstring> JNI_PrivacySandboxBridge_GetFlocStatusString( + JNIEnv* env) { + return ConvertUTF16ToJavaString(env, + PrivacySandboxSettingsFactory::GetForProfile( + ProfileManager::GetActiveUserProfile()) + ->GetFlocStatusForDisplay()); +} + +static ScopedJavaLocalRef<jstring> JNI_PrivacySandboxBridge_GetFlocGroupString( + JNIEnv* env) { + return ConvertUTF16ToJavaString(env, + PrivacySandboxSettingsFactory::GetForProfile( + ProfileManager::GetActiveUserProfile()) + ->GetFlocIdForDisplay()); +}
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc index 3ce4b15..a65d18f5 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.cc
@@ -223,6 +223,21 @@ IDS_PRIVACY_SANDBOX_FLOC_RESET_EXPLANATION, floc_compute_days); } +std::u16string PrivacySandboxSettings::GetFlocStatusForDisplay() const { + const bool floc_feature_enabled = base::FeatureList::IsEnabled( + blink::features::kInterestCohortAPIOriginTrial); + const bool floc_setting_enabled = 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); + } + + return l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE); +} + bool PrivacySandboxSettings::IsConversionMeasurementAllowed( const url::Origin& top_frame_origin, const url::Origin& reporting_origin) const { @@ -528,19 +543,28 @@ } if (pref_service_->GetBoolean(prefs::kPrivacySandboxApisEnabled)) { + const bool floc_enabled = + pref_service_->GetBoolean(prefs::kPrivacySandboxFlocEnabled); + if (default_cookie_setting == ContentSetting::CONTENT_SETTING_BLOCK) { RecordPrivacySandboxHistogram( - PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: - kPSEnabledBlockAll); + floc_enabled ? PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: + kPSEnabledBlockAll + : PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: + kPSEnabledFlocDisabledBlockAll); } else if (cookie_controls_mode_value == content_settings::CookieControlsMode::kBlockThirdParty) { RecordPrivacySandboxHistogram( - PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: - kPSEnabledBlock3P); + floc_enabled ? PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: + kPSEnabledBlock3P + : PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: + kPSEnabledFlocDisabledBlock3P); } else { RecordPrivacySandboxHistogram( - PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: - kPSEnabledAllowAll); + floc_enabled ? PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: + kPSEnabledAllowAll + : PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: + kPSEnabledFlocDisabledAllowAll); } } else { if (default_cookie_setting == ContentSetting::CONTENT_SETTING_BLOCK) {
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h index 644a80d..77fe792 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings.h
@@ -86,6 +86,10 @@ // resets the FLoC cohort identifier. std::u16string GetFlocResetExplanationForDisplay() const; + // Returns a display ready string explaining the current status of FloC. E.g. + // the effective state of the Finch experiment, and the user's setting. + std::u16string GetFlocStatusForDisplay() const; + // Determines whether Conversion Measurement is allowable in a particular // context. Should be called at both impression & conversion. At each of these // points |top_frame_origin| is the same as either the impression origin or @@ -189,15 +193,11 @@ FRIEND_TEST_ALL_PREFIXES(PrivacySandboxSettingsTest, MetricsLoggingOccursCorrectly); - /** - * Contains all possible privacy sandbox states, recorded on startup. - * - * These values are persisted to logs. Entries should not be renumbered and - * numeric values should never be reused. - * - * Must be kept in sync with the SettingsPrivacySandboxEnabled enum in - * histograms/enums.xml and privacy_sandbox_settings_unittest.cc. - */ + // Contains all possible privacy sandbox states, recorded on startup. + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. + // Must be kept in sync with the SettingsPrivacySandboxEnabled enum in + // histograms/enums.xml. enum class SettingsPrivacySandboxEnabled { kPSEnabledAllowAll = 0, kPSEnabledBlock3P = 1, @@ -207,9 +207,12 @@ kPSDisabledBlockAll = 5, kPSDisabledPolicyBlock3P = 6, kPSDisabledPolicyBlockAll = 7, + kPSEnabledFlocDisabledAllowAll = 8, + kPSEnabledFlocDisabledBlock3P = 9, + kPSEnabledFlocDisabledBlockAll = 10, // Add values above this line with a corresponding label in // tools/metrics/histograms/enums.xml - kMaxValue = kPSDisabledPolicyBlockAll, + kMaxValue = kPSEnabledFlocDisabledBlockAll, }; // Determines based on the current features, preferences and provided
diff --git a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc index 003c6c4..b948bcc 100644 --- a/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc +++ b/chrome/browser/privacy_sandbox/privacy_sandbox_settings_unittest.cc
@@ -917,6 +917,45 @@ } } +TEST_F(PrivacySandboxSettingsTest, GetFlocStatusForDisplay) { + // 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. + 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_settings()->GetFlocStatusForDisplay()); + + // The Privacy Sandbox APIs pref & FLoC pref should disable the trial when + // either is disabled. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, false); + EXPECT_EQ( + l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE), + privacy_sandbox_settings()->GetFlocStatusForDisplay()); + + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxApisEnabled, true); + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, false); + EXPECT_EQ( + l10n_util::GetStringUTF16(IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE), + privacy_sandbox_settings()->GetFlocStatusForDisplay()); + + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + feature_list()->Reset(); + feature_list()->InitWithFeatures( + {}, {blink::features::kInterestCohortAPIOriginTrial}); + EXPECT_EQ(l10n_util::GetStringUTF16( + IDS_PRIVACY_SANDBOX_FLOC_STATUS_ELIGIBLE_NOT_ACTIVE), + privacy_sandbox_settings()->GetFlocStatusForDisplay()); +} + TEST_F(PrivacySandboxSettingsTest, ReconciliationOutcome) { // Check that reconciling preferences has the appropriate outcome based on // the current user cookie settings. @@ -1337,6 +1376,11 @@ // The histogram should start off empty. histograms.ExpectTotalCount(histogram_name, 0); + // For buckets that do not explicitly mention FLoC, it is assumed to be on, + // or its state is irrelevant, i.e. overriden by the Privacy Sandbox pref. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, true); + SetupTestState( /*privacy_sandbox_available=*/true, /*privacy_sandbox_enabled=*/true, @@ -1511,6 +1555,64 @@ static_cast<int>(PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: kPSDisabledPolicyBlockAll), 1); + + // Disable FLoC and test the buckets that reflect a disabled FLoC state. + profile()->GetTestingPrefService()->SetBoolean( + prefs::kPrivacySandboxFlocEnabled, false); + + SetupTestState( + /*privacy_sandbox_available=*/true, + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/false, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + privacy_sandbox_settings()->MaybeReconcilePrivacySandboxPref(); + + histograms.ExpectTotalCount(histogram_name, 9); + histograms.ExpectBucketCount( + histogram_name, + static_cast<int>(PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: + kPSEnabledFlocDisabledAllowAll), + 1); + + SetupTestState( + /*privacy_sandbox_available=*/true, + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/true, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_ALLOW, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + privacy_sandbox_settings()->MaybeReconcilePrivacySandboxPref(); + + histograms.ExpectTotalCount(histogram_name, 10); + histograms.ExpectBucketCount( + histogram_name, + static_cast<int>(PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: + kPSEnabledFlocDisabledBlock3P), + 1); + + SetupTestState( + /*privacy_sandbox_available=*/true, + /*privacy_sandbox_enabled=*/true, + /*block_third_party_cookies=*/true, + /*default_cookie_setting=*/ContentSetting::CONTENT_SETTING_BLOCK, + /*user_cookie_exceptions=*/{}, + /*managed_cookie_setting=*/kNoSetting, + /*managed_cookie_exceptions=*/{}); + + privacy_sandbox_settings()->MaybeReconcilePrivacySandboxPref(); + + histograms.ExpectTotalCount(histogram_name, 11); + histograms.ExpectBucketCount( + histogram_name, + static_cast<int>(PrivacySandboxSettings::SettingsPrivacySandboxEnabled:: + kPSEnabledFlocDisabledBlockAll), + 1); } class PrivacySandboxSettingsTestCookiesClearOnExitTurnedOff
diff --git a/chrome/browser/profiles/profile_statistics.h b/chrome/browser/profiles/profile_statistics.h index 6825e3a..804c5c1 100644 --- a/chrome/browser/profiles/profile_statistics.h +++ b/chrome/browser/profiles/profile_statistics.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_PROFILES_PROFILE_STATISTICS_H_ #include <memory> -#include <string> #include "base/memory/weak_ptr.h" #include "chrome/browser/profiles/profile_statistics_common.h"
diff --git a/chrome/browser/profiles/renderer_updater.h b/chrome/browser/profiles/renderer_updater.h index f4aab406..076fe26 100644 --- a/chrome/browser/profiles/renderer_updater.h +++ b/chrome/browser/profiles/renderer_updater.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_PROFILES_RENDERER_UPDATER_H_ #define CHROME_BROWSER_PROFILES_RENDERER_UPDATER_H_ -#include <string> #include <vector> #include "base/scoped_observation.h"
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h index 913d2e6d0..6b568a76 100644 --- a/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h +++ b/chrome/browser/renderer_context_menu/render_view_context_menu_browsertest_util.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BROWSERTEST_UTIL_H_ #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_RENDER_VIEW_CONTEXT_MENU_BROWSERTEST_UTIL_H_ -#include <string> - #include "base/macros.h" #include "base/run_loop.h" #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
diff --git a/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h b/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h index 5abff45..8757b7f 100644 --- a/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h +++ b/chrome/browser/renderer_context_menu/spelling_options_submenu_observer.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_RENDERER_CONTEXT_MENU_SPELLING_OPTIONS_SUBMENU_OBSERVER_H_ #include <cstddef> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/resource_coordinator/tab_manager.h b/chrome/browser/resource_coordinator/tab_manager.h index 94bb45d..11678078 100644 --- a/chrome/browser/resource_coordinator/tab_manager.h +++ b/chrome/browser/resource_coordinator/tab_manager.h
@@ -8,7 +8,6 @@ #include <stdint.h> #include <memory> -#include <string> #include <vector> #include "base/callback_helpers.h"
diff --git a/chrome/browser/resources/chromeos/login/images/pin_illustration.svg b/chrome/browser/resources/chromeos/login/images/pin_illustration.svg new file mode 100644 index 0000000..00ee831 --- /dev/null +++ b/chrome/browser/resources/chromeos/login/images/pin_illustration.svg
@@ -0,0 +1 @@ +<svg width="520" height="320" viewBox="0 0 520 320" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M0 0h520v320H0z"/><path fill="#fff" d="M3 33h515v254H3z"/><path d="M153.753 210.321l-2.719-2.718a1.262 1.262 0 0 0-1.785 0l-2.719 2.718a1.263 1.263 0 0 0 0 1.784l2.719 2.718a1.262 1.262 0 0 0 1.785 0l2.719-2.718a1.26 1.26 0 0 0 0-1.784z" fill="#E6E6E6"/><path d="M114.824 135.724a20.12 20.12 0 0 0-2.447 3.896l-2.617 4.179a17.046 17.046 0 0 1-9.562 7.131c-5.476 1.767-11.339 1.965-14.944 7.079a14.03 14.03 0 0 0-1.262 13.841c.112.232.224.464.344.687a13.968 13.968 0 0 0 20.806 4.419c1.957-1.484 3.673-3.286 5.467-4.951a16.476 16.476 0 0 1 11.811-4.402l4.935.18a19.854 19.854 0 0 0 18.802-7.633 19.834 19.834 0 0 0 2.262-20.161 19.85 19.85 0 0 0-15.583-11.544 19.854 19.854 0 0 0-17.987 7.253l-.025.026z" stroke="#F882FF" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><path d="M74.328 203.171c14.335 0 25.956-11.617 25.956-25.949 0-14.331-11.621-25.949-25.956-25.949-14.336 0-25.956 11.618-25.956 25.949 0 14.332 11.62 25.949 25.956 25.949z" fill="#E6E7EA"/><mask id="a" maskUnits="userSpaceOnUse" x="48" y="151" width="53" height="53"><path d="M74.328 203.171c14.335 0 25.956-11.617 25.956-25.949 0-14.331-11.621-25.949-25.956-25.949-14.336 0-25.956 11.618-25.956 25.949 0 14.332 11.62 25.949 25.956 25.949z" fill="#E6E7EA"/></mask><g mask="url(#a)"><path d="M114.824 135.724a20.12 20.12 0 0 0-2.447 3.896l-2.617 4.179a17.046 17.046 0 0 1-9.562 7.131c-5.476 1.767-11.339 1.965-14.944 7.079a14.03 14.03 0 0 0-1.262 13.841c.112.232.224.464.344.687a13.968 13.968 0 0 0 20.806 4.419c1.957-1.484 3.673-3.286 5.467-4.951a16.476 16.476 0 0 1 11.811-4.402l4.935.18a19.854 19.854 0 0 0 18.802-7.633 19.834 19.834 0 0 0 2.262-20.161 19.85 19.85 0 0 0-15.583-11.544 19.854 19.854 0 0 0-17.987 7.253l-.025.026z" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></g><path d="M361.028 178.896a4.309 4.309 0 1 0 .001-8.617 4.309 4.309 0 0 0-.001 8.617z" fill="#34A853"/><path d="M105.425 101.623a6.694 6.694 0 1 0 0-13.386 6.694 6.694 0 1 0 0 13.386z" fill="#EA4335"/><path d="M431.669 208.32l-10.378-.961a4.663 4.663 0 0 0-2.372.408 4.66 4.66 0 0 0-1.851 1.54l-6.008 8.495a4.656 4.656 0 0 0-.429 4.625l4.36 9.44a4.646 4.646 0 0 0 3.794 2.685l10.36.961a4.67 4.67 0 0 0 4.223-1.947l6.009-8.496a4.65 4.65 0 0 0 .429-4.633l-4.352-9.44a4.655 4.655 0 0 0-3.785-2.677v0z" stroke="#E6E6E6" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><path d="M311.854 116.382H209.146c-7.585 0-13.733 6.147-13.733 13.73v102.681c0 7.583 6.148 13.73 13.733 13.73h102.708c7.585 0 13.733-6.147 13.733-13.73V130.112c0-7.583-6.148-13.73-13.733-13.73z" fill="#D2E3FC"/><path d="M264.74 203.163h-8.48a5.492 5.492 0 0 1-5.365-6.65l4.738-21.925h9.734l4.738 21.925c.172.8.164 1.629-.025 2.426a5.502 5.502 0 0 1-2.973 3.685 5.495 5.495 0 0 1-2.367.539z" fill="#4285F4"/><path d="M260.5 177.463c6.826 0 12.36-5.533 12.36-12.357 0-6.825-5.534-12.357-12.36-12.357s-12.36 5.532-12.36 12.357c0 6.824 5.534 12.357 12.36 12.357z" fill="#4285F4"/><path d="M229.239 116.382v-11.627a31.268 31.268 0 0 1 9.152-22.11 31.282 31.282 0 0 1 22.109-9.168v0a31.29 31.29 0 0 1 22.122 9.161 31.271 31.271 0 0 1 9.164 22.117" stroke="#2A84FC" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><path d="M229.239 116.382V198.1a31.278 31.278 0 0 0 31.261 31.278v0a31.288 31.288 0 0 0 22.122-9.161 31.273 31.273 0 0 0 9.164-22.117v-81.718" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><path d="M401.121 101.443a14.762 14.762 0 0 1 20.84-1.124l25.75 23.014a14.726 14.726 0 0 1 4.879 10.18 14.735 14.735 0 0 1-3.754 10.646v0a14.74 14.74 0 0 1-15.88 4.067 14.743 14.743 0 0 1-4.952-2.934l-25.75-23.014a14.763 14.763 0 0 1-4.884-10.183 14.76 14.76 0 0 1 .815-5.699 14.76 14.76 0 0 1 2.936-4.953v0z" stroke="#2A84FC" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/><path d="M420.15 126.911l-28.248 9.731a1.815 1.815 0 0 0-1.118 2.305c.104.3.285.568.526.776l22.557 19.59a1.808 1.808 0 0 0 2.559-.176 1.81 1.81 0 0 0 .411-.845l5.691-29.321a1.816 1.816 0 0 0-.597-1.714 1.819 1.819 0 0 0-1.781-.346z" fill="#FFBA00"/><mask id="b" maskUnits="userSpaceOnUse" x="390" y="126" width="33" height="34"><path d="M420.15 126.911l-28.248 9.731a1.815 1.815 0 0 0-1.118 2.305c.104.3.285.568.526.776l22.557 19.591a1.816 1.816 0 0 0 1.781.348 1.82 1.82 0 0 0 1.189-1.37l5.691-29.321a1.816 1.816 0 0 0-.597-1.714 1.819 1.819 0 0 0-1.781-.346z" fill="#FFBA00"/></mask><g mask="url(#b)"><path d="M401.121 101.443a14.762 14.762 0 0 1 20.84-1.124l25.75 23.014a14.726 14.726 0 0 1 4.879 10.18 14.735 14.735 0 0 1-3.754 10.646v0a14.74 14.74 0 0 1-15.88 4.067 14.743 14.743 0 0 1-4.952-2.934l-25.75-23.014a14.763 14.763 0 0 1-4.884-10.183 14.76 14.76 0 0 1 .815-5.699 14.76 14.76 0 0 1 2.936-4.953v0z" fill="#FFBA00" stroke="#fff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/></g></svg> \ No newline at end of file
diff --git a/chrome/browser/resources/chromeos/login/images/pin_illustration_1x.svg b/chrome/browser/resources/chromeos/login/images/pin_illustration_1x.svg deleted file mode 100644 index 0d59105..0000000 --- a/chrome/browser/resources/chromeos/login/images/pin_illustration_1x.svg +++ /dev/null
@@ -1,21 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="264" height="264"> - <defs> - <path id="a" d="M0 0h228v228H0z"/> - </defs> - <g fill="none" fill-rule="evenodd"> - <g transform="translate(18 18)"> - <mask id="b" fill="#fff"> - <use xlink:href="#a"/> - </mask> - <path fill="#DADCE0" d="M114 0C51.04 0 0 51.04 0 114s51.04 114 114 114 114-51.04 114-114S176.96 0 114 0m0 4c29.382 0 57.005 11.442 77.781 32.218 20.777 20.777 32.22 48.4 32.22 77.782 0 29.382-11.443 57.005-32.22 77.782C171.005 212.558 143.382 224 114.001 224c-29.384 0-57.007-11.442-77.783-32.218C15.441 171.005 4 143.382 4 114c0-29.382 11.441-57.005 32.218-77.782C56.994 15.442 84.618 4 114 4" mask="url(#b)"/> - </g> - <path fill="#D2E3FC" d="M171.62 108H93.38C85.99 108 80 114.005 80 121.412v58.177C80 186.996 85.99 193 93.38 193h78.24c7.39 0 13.38-6.004 13.38-13.41v-58.178c0-7.407-5.99-13.412-13.38-13.412m0 8.031c2.96 0 5.367 2.414 5.367 5.38v58.178c0 2.967-2.408 5.38-5.367 5.38H93.38c-2.96 0-5.367-2.413-5.367-5.38v-58.177c0-2.967 2.408-5.38 5.367-5.38h78.24"/> - <path stroke="#4285F4" stroke-width="4" d="M88.826 193h87.348c4.875 0 8.826-3.961 8.826-8.847v-67.306c0-4.887-3.951-8.847-8.826-8.847H88.826c-4.874 0-8.826 3.96-8.826 8.847v67.306c0 4.886 3.952 8.847 8.826 8.847z"/> - <path stroke="#34A853" stroke-width="4" d="M123 55c-8.815 3.705-15 12.38-15 22.49V91"/> - <path stroke="#FBBC05" stroke-width="4" d="M153 64c-4.331-6.616-11.902-11-20.518-11-3.364 0-6.568.668-9.482 1.876"/> - <path stroke="#EA4335" stroke-width="4" d="M157 94V77.964c0-4.774-1.47-9.224-4-12.964"/> - <path stroke="#4285F4" stroke-width="4" d="M157 107V93"/> - <path stroke="#34A853" stroke-width="4" d="M120 151.996l9.002 9.004L149 141"/> - <path d="M0 0h264v264H0z"/> - </g> -</svg>
diff --git a/chrome/browser/resources/chromeos/login/images/pin_illustration_2x.svg b/chrome/browser/resources/chromeos/login/images/pin_illustration_2x.svg deleted file mode 100644 index 301a912..0000000 --- a/chrome/browser/resources/chromeos/login/images/pin_illustration_2x.svg +++ /dev/null
@@ -1,21 +0,0 @@ -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="528" height="528"> - <defs> - <path id="a" d="M.001 0H456v456H.001z"/> - </defs> - <g fill="none" fill-rule="evenodd"> - <g transform="translate(36 36)"> - <mask id="b" fill="#fff"> - <use xlink:href="#a"/> - </mask> - <path fill="#DADCE0" d="M228 0C102.08 0 0 102.08 0 228S102.08 456 228 456c125.92 0 228-102.08 228-228S353.92 0 228 0m0 8c58.765 0 114.01 22.884 155.563 64.436C425.117 113.99 448 169.236 448 228c0 58.764-22.884 114.01-64.438 155.564C342.01 425.116 286.765 448 228 448c-58.766 0-114.012-22.884-155.564-64.436C30.883 342.01 8 286.764 8 228c0-58.764 22.882-114.01 64.436-155.564C113.989 30.884 169.235 8 228 8" mask="url(#b)"/> - </g> - <path fill="#D2E3FC" d="M343.24 216H186.76c-14.779 0-26.76 12.01-26.76 26.823v116.355C160 373.991 171.981 386 186.76 386h156.48c14.78 0 26.76-12.009 26.76-26.822V242.823C370 228.01 358.02 216 343.24 216m0 16.063c5.918 0 10.734 4.827 10.734 10.76v116.355c0 5.934-4.816 10.76-10.734 10.76H186.76c-5.918 0-10.734-4.826-10.734-10.76V242.823c0-5.933 4.816-10.76 10.734-10.76h156.48"/> - <path stroke="#4285F4" stroke-width="8" d="M177.653 386h174.696c9.749 0 17.651-7.922 17.651-17.693V233.693c0-9.772-7.902-17.693-17.651-17.693H177.653c-9.749 0-17.653 7.92-17.653 17.693v134.614c0 9.77 7.904 17.693 17.653 17.693z"/> - <path stroke="#34A853" stroke-width="8" d="M246 110c-17.63 7.41-30 24.759-30 44.98V182"/> - <path stroke="#FBBC05" stroke-width="8" d="M306 128c-8.663-13.232-23.804-22-41.036-22A49.417 49.417 0 0 0 246 109.752"/> - <path stroke="#EA4335" stroke-width="8" d="M314 188v-32.072c0-9.548-2.938-18.447-8-25.928"/> - <path stroke="#4285F4" stroke-width="8" d="M314 214v-28"/> - <path stroke="#34A853" stroke-width="8" d="M240 303.993L258.005 322 298 282"/> - <path d="M0 0h528v528H0z"/> - </g> -</svg>
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome.html b/chrome/browser/resources/chromeos/login/oobe_welcome.html index 1c3749d..d52c63b 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome.html +++ b/chrome/browser/resources/chromeos/login/oobe_welcome.html
@@ -101,6 +101,7 @@ on-accessibility-button-clicked="onWelcomeAccessibilityButtonClicked_" on-timezone-button-clicked="onWelcomeTimezoneButtonClicked_" on-next-button-clicked="onWelcomeNextButtonClicked_" + on-os-install-clicked="onOsInstallButtonClicked_" on-enable-debugging-clicked="onEnableDebuggingClicked_" on-launch-advanced-options="onWelcomeLaunchAdvancedOptions_" on-chromevox-hint-accepted="onChromeVoxHintAccepted_"
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome.js b/chrome/browser/resources/chromeos/login/oobe_welcome.js index 9f132c37..008ad15 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome.js +++ b/chrome/browser/resources/chromeos/login/oobe_welcome.js
@@ -293,6 +293,15 @@ }, /** + * Handle OS install button for "Welcome" screen. + * + * @private + */ + onOsInstallButtonClicked_() { + this.userActed('startOsInstall'); + }, + + /** * Handles "enable-debugging" link for "Welcome" screen. * * @private
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html index 3b16b40..e3d632cf 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html +++ b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.html
@@ -107,13 +107,13 @@ justify-self: start; } - :host-context([orientation=vertical]) #getStarted { + :host-context([orientation=vertical]) #bottomButtons { align-self: end; grid-column: 1 / span 1; grid-row: 3 / span 1; justify-self: center; } - :host-context([orientation=horizontal]) #getStarted { + :host-context([orientation=horizontal]) #bottomButtons { align-self: end; grid-column: 1 / span 1; grid-row: 2 / span 1; @@ -244,11 +244,18 @@ hidden="[[!debuggingLinkVisible]]"> </oobe-welcome-secondary-button> </div> - <oobe-text-button id="getStarted" - inverse on-click="onNextClicked_" - disabled="[[!isNewLayout_]]" - text-key="welcomeScreenGetStarted"> - </oobe-text-button> + <div id="bottomButtons"> + <oobe-text-button id="osInstall" + on-click="onOsInstallClicked_" + hidden="[[!osInstallEnabled_]]" + text-key="welcomeScreenOsInstall"> + </oobe-text-button> + <oobe-text-button id="getStarted" + inverse on-click="onNextClicked_" + disabled="[[!isNewLayout_]]" + text-key="welcomeScreenGetStarted"> + </oobe-text-button> + </div> <div id="newWelcomeAnimationSlot"> <cr-lottie id="newWelcomeAnimation" hidden="[[isMeet_]]" animation-url="welcome_screen_animation.json">
diff --git a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.js b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.js index 2fba5dd..563c33f 100644 --- a/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.js +++ b/chrome/browser/resources/chromeos/login/oobe_welcome_dialog.js
@@ -330,6 +330,15 @@ }, readOnly: true, }, + + osInstallEnabled_: { + type: Boolean, + value() { + return loadTimeData.valueExists('osInstallEnabled') && + loadTimeData.getBoolean('osInstallEnabled'); + }, + readOnly: true, + }, }, onBeforeShow() { @@ -404,6 +413,10 @@ this.fire('next-button-clicked'); }, + onOsInstallClicked_() { + this.fire('os-install-clicked'); + }, + onDebuggingLinkClicked_() { this.fire('enable-debugging-clicked'); },
diff --git a/chrome/browser/resources/chromeos/login/pin_setup.html b/chrome/browser/resources/chromeos/login/pin_setup.html index 8b45f20a..4225ac6 100644 --- a/chrome/browser/resources/chromeos/login/pin_setup.html +++ b/chrome/browser/resources/chromeos/login/pin_setup.html
@@ -83,8 +83,7 @@ <div slot="content" class="flex layout vertical center center-justified"> <img id="done-illustration" class="oobe-illustration" - srcset="images/pin_illustration_1x.svg 1x, - images/pin_illustration_2x.svg 2x"> + src="images/pin_illustration.svg"> </div> <div slot="bottom-buttons"> <oobe-text-button id="doneButton" inverse on-click="onDoneButton_"
diff --git a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.h b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.h index 524fa36..f755edfe 100644 --- a/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.h +++ b/chrome/browser/resources/chromeos/zip_archiver/cpp/compressor_io_javascript_stream.h
@@ -7,7 +7,6 @@ #include <cstdint> #include <memory> -#include <string> #include "base/synchronization/condition_variable.h" #include "base/synchronization/lock.h"
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h index 7f669f9..671fa7b 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
@@ -29,7 +29,6 @@ #define CHROME_BROWSER_SAFE_BROWSING_SAFE_BROWSING_BLOCKING_PAGE_H_ #include <map> -#include <string> #include <vector> #include "base/gtest_prod_util.h"
diff --git a/chrome/browser/safe_browsing/services_delegate.h b/chrome/browser/safe_browsing/services_delegate.h index 01acbf26..0b446b10 100644 --- a/chrome/browser/safe_browsing/services_delegate.h +++ b/chrome/browser/safe_browsing/services_delegate.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_SAFE_BROWSING_SERVICES_DELEGATE_H_ #include <memory> -#include <string> #include "base/memory/ref_counted.h" #include "build/build_config.h"
diff --git a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h index e83d79cf..4ff6cf47 100644 --- a/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h +++ b/chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_model.h
@@ -8,7 +8,6 @@ #include <stdint.h> #include <memory> -#include <string> #include <unordered_set> #include <vector>
diff --git a/chrome/browser/safe_browsing/telemetry/android/android_telemetry_service.h b/chrome/browser/safe_browsing/telemetry/android/android_telemetry_service.h index 61994c5..fb6db8e 100644 --- a/chrome/browser/safe_browsing/telemetry/android/android_telemetry_service.h +++ b/chrome/browser/safe_browsing/telemetry/android/android_telemetry_service.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_SAFE_BROWSING_TELEMETRY_ANDROID_ANDROID_TELEMETRY_SERVICE_H_ #include <memory> -#include <string> #include "base/memory/weak_ptr.h" #include "chrome/browser/safe_browsing/telemetry/telemetry_service.h"
diff --git a/chrome/browser/security_events/security_event_recorder_impl.h b/chrome/browser/security_events/security_event_recorder_impl.h index c3e79ee..5ddc621 100644 --- a/chrome/browser/security_events/security_event_recorder_impl.h +++ b/chrome/browser/security_events/security_event_recorder_impl.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_SECURITY_EVENTS_SECURITY_EVENT_RECORDER_IMPL_H_ #include <memory> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/signin/chrome_signin_client.cc b/chrome/browser/signin/chrome_signin_client.cc index 118395b..ddee1ff 100644 --- a/chrome/browser/signin/chrome_signin_client.cc +++ b/chrome/browser/signin/chrome_signin_client.cc
@@ -257,7 +257,7 @@ // We only verifiy the token once when Profile is just created. if (signin_util::IsForceSigninEnabled() && !force_signin_verifier_) force_signin_verifier_ = std::make_unique<ForceSigninVerifier>( - IdentityManagerFactory::GetForProfile(profile_)); + profile_, IdentityManagerFactory::GetForProfile(profile_)); #endif }
diff --git a/chrome/browser/signin/force_signin_verifier.cc b/chrome/browser/signin/force_signin_verifier.cc index 8073828e..281cac1a 100644 --- a/chrome/browser/signin/force_signin_verifier.cc +++ b/chrome/browser/signin/force_signin_verifier.cc
@@ -7,7 +7,17 @@ #include "chrome/browser/signin/force_signin_verifier.h" #include "base/bind.h" +#include "base/callback_helpers.h" +#include "base/files/file_path.h" #include "base/metrics/histogram_macros.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_attributes_entry.h" +#include "chrome/browser/profiles/profile_attributes_storage.h" +#include "chrome/browser/profiles/profile_manager.h" +#include "chrome/browser/ui/browser_list.h" +#include "chrome/browser/ui/profile_picker.h" +#include "chrome/browser/ui/ui_features.h" #include "components/signin/public/base/signin_metrics.h" #include "components/signin/public/identity_manager/access_token_info.h" #include "components/signin/public/identity_manager/identity_manager.h" @@ -32,10 +42,12 @@ } // namespace ForceSigninVerifier::ForceSigninVerifier( + Profile* profile, signin::IdentityManager* identity_manager) : has_token_verified_(false), backoff_entry_(&kForceSigninVerifierBackoffPolicy), creation_time_(base::TimeTicks::Now()), + profile_(profile), identity_manager_(identity_manager) { content::GetNetworkConnectionTracker()->AddNetworkConnectionObserver(this); // Most of time (~94%), sign-in token can be verified with server. @@ -135,14 +147,40 @@ } void ForceSigninVerifier::CloseAllBrowserWindows() { - // Do not close window if there is ongoing reauth. If it fails later, the - // signin process should take care of the signout. - auto* primary_account_mutator = identity_manager_->GetPrimaryAccountMutator(); - if (!primary_account_mutator) + if (base::FeatureList::IsEnabled(features::kForceSignInReauth)) { + // Do not sign the user out to allow them to reauthenticate from the profile + // picker. + BrowserList::CloseAllBrowsersWithProfile( + profile_, + base::BindRepeating(&ForceSigninVerifier::OnCloseBrowsersSuccess, + weak_factory_.GetWeakPtr()), + base::DoNothing(), + /*skip_beforeunload=*/true); + } else { + // Do not close window if there is ongoing reauth. If it fails later, the + // signin process should take care of the signout. + auto* primary_account_mutator = + identity_manager_->GetPrimaryAccountMutator(); + if (!primary_account_mutator) + return; + primary_account_mutator->ClearPrimaryAccount( + signin_metrics::AUTHENTICATION_FAILED_WITH_FORCE_SIGNIN, + signin_metrics::SignoutDelete::kIgnoreMetric); + } +} + +void ForceSigninVerifier::OnCloseBrowsersSuccess( + const base::FilePath& profile_path) { + Cancel(); + + ProfileAttributesEntry* entry = + g_browser_process->profile_manager() + ->GetProfileAttributesStorage() + .GetProfileAttributesWithPath(profile_path); + if (!entry) return; - primary_account_mutator->ClearPrimaryAccount( - signin_metrics::AUTHENTICATION_FAILED_WITH_FORCE_SIGNIN, - signin_metrics::SignoutDelete::kIgnoreMetric); + entry->LockForceSigninProfile(true); + ProfilePicker::Show(ProfilePicker::EntryPoint::kProfileLocked); } signin::PrimaryAccountAccessTokenFetcher*
diff --git a/chrome/browser/signin/force_signin_verifier.h b/chrome/browser/signin/force_signin_verifier.h index 6afd3762..b864082 100644 --- a/chrome/browser/signin/force_signin_verifier.h +++ b/chrome/browser/signin/force_signin_verifier.h
@@ -6,15 +6,21 @@ #define CHROME_BROWSER_SIGNIN_FORCE_SIGNIN_VERIFIER_H_ #include <memory> -#include <string> #include "base/macros.h" +#include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "base/timer/timer.h" #include "google_apis/gaia/google_service_auth_error.h" #include "net/base/backoff_entry.h" #include "services/network/public/cpp/network_connection_tracker.h" +class Profile; + +namespace base { +class FilePath; +} + namespace signin { class IdentityManager; class PrimaryAccountAccessTokenFetcher; @@ -27,7 +33,8 @@ class ForceSigninVerifier : public network::NetworkConnectionTracker::NetworkConnectionObserver { public: - explicit ForceSigninVerifier(signin::IdentityManager* identity_manager); + explicit ForceSigninVerifier(Profile* profile, + signin::IdentityManager* identity_manager); ~ForceSigninVerifier() override; void OnAccessTokenFetchComplete(GoogleServiceAuthError error, @@ -48,7 +55,6 @@ // - There is no on going verification. // - There is network connection. // - The profile has signed in. - // void SendRequest(); // Send the request if |network_type| is not CONNECTION_NONE and @@ -59,6 +65,7 @@ bool ShouldSendRequest(); virtual void CloseAllBrowserWindows(); + void OnCloseBrowsersSuccess(const base::FilePath& profile_path); signin::PrimaryAccountAccessTokenFetcher* GetAccessTokenFetcherForTesting(); net::BackoffEntry* GetBackoffEntryForTesting(); @@ -75,8 +82,11 @@ base::OneShotTimer backoff_request_timer_; base::TimeTicks creation_time_; + Profile* profile_ = nullptr; signin::IdentityManager* identity_manager_ = nullptr; + base::WeakPtrFactory<ForceSigninVerifier> weak_factory_{this}; + DISALLOW_COPY_AND_ASSIGN(ForceSigninVerifier); };
diff --git a/chrome/browser/signin/force_signin_verifier_unittest.cc b/chrome/browser/signin/force_signin_verifier_unittest.cc index 3528d68..a58c6a21 100644 --- a/chrome/browser/signin/force_signin_verifier_unittest.cc +++ b/chrome/browser/signin/force_signin_verifier_unittest.cc
@@ -7,6 +7,7 @@ #include "base/run_loop.h" #include "base/test/task_environment.h" #include "base/threading/thread_task_runner_handle.h" +#include "chrome/browser/profiles/profile.h" #include "components/signin/public/identity_manager/identity_test_environment.h" #include "content/public/browser/network_service_instance.h" #include "services/network/test/test_network_connection_tracker.h" @@ -20,7 +21,7 @@ public: explicit ForceSigninVerifierWithAccessToInternalsForTesting( signin::IdentityManager* identity_manager) - : ForceSigninVerifier(identity_manager) {} + : ForceSigninVerifier(nullptr, identity_manager) {} bool IsDelayTaskPosted() { return GetOneShotTimerForTesting()->IsRunning(); }
diff --git a/chrome/browser/signin/identity_test_environment_profile_adaptor.h b/chrome/browser/signin/identity_test_environment_profile_adaptor.h index 08579b0..e5d0716 100644 --- a/chrome/browser/signin/identity_test_environment_profile_adaptor.h +++ b/chrome/browser/signin/identity_test_environment_profile_adaptor.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_SIGNIN_IDENTITY_TEST_ENVIRONMENT_PROFILE_ADAPTOR_H_ #define CHROME_BROWSER_SIGNIN_IDENTITY_TEST_ENVIRONMENT_PROFILE_ADAPTOR_H_ -#include <string> - #include "chrome/test/base/testing_profile.h" #include "components/signin/public/identity_manager/identity_test_environment.h" #include "components/sync_preferences/testing_pref_service_syncable.h"
diff --git a/chrome/browser/subresource_redirect/origin_robots_rules_cache.h b/chrome/browser/subresource_redirect/origin_robots_rules_cache.h index a63be69..4e03ddec 100644 --- a/chrome/browser/subresource_redirect/origin_robots_rules_cache.h +++ b/chrome/browser/subresource_redirect/origin_robots_rules_cache.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_SUBRESOURCE_REDIRECT_ORIGIN_ROBOTS_RULES_CACHE_H_ #define CHROME_BROWSER_SUBRESOURCE_REDIRECT_ORIGIN_ROBOTS_RULES_CACHE_H_ -#include <string> - #include "base/containers/mru_cache.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/supervised_user/child_accounts/child_account_service.h b/chrome/browser/supervised_user/child_accounts/child_account_service.h index db8509c1..595e77d 100644 --- a/chrome/browser/supervised_user/child_accounts/child_account_service.h +++ b/chrome/browser/supervised_user/child_accounts/child_account_service.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_CHILD_ACCOUNT_SERVICE_H_ #include <memory> -#include <string> #include <vector> #include "base/callback_forward.h"
diff --git a/chrome/browser/supervised_user/permission_request_creator_mock.h b/chrome/browser/supervised_user/permission_request_creator_mock.h index 7946b53d..3e0f2464 100644 --- a/chrome/browser/supervised_user/permission_request_creator_mock.h +++ b/chrome/browser/supervised_user/permission_request_creator_mock.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_MOCK_H_ #define CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_MOCK_H_ -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/sync/chrome_sync_client.cc b/chrome/browser/sync/chrome_sync_client.cc index 9c4a6d0..9a87da5 100644 --- a/chrome/browser/sync/chrome_sync_client.cc +++ b/chrome/browser/sync/chrome_sync_client.cc
@@ -414,7 +414,6 @@ controllers.push_back(CreateAppSettingsModelTypeController(sync_service)); } - // Web Apps sync is disabled by default. if (web_app::WebAppProvider::Get(profile_)) { bool enable_web_apps_sync = !disabled_types.Has(syncer::WEB_APPS); #if BUILDFLAG(IS_CHROMEOS_ASH)
diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc index 3c0b3320b..8a841a6f 100644 --- a/chrome/browser/sync/sync_ui_util.cc +++ b/chrome/browser/sync/sync_ui_util.cc
@@ -228,14 +228,14 @@ return GetStatusLabels(profile).message_type; } -AvatarSyncErrorType GetAvatarSyncErrorType(Profile* profile) { +absl::optional<AvatarSyncErrorType> GetAvatarSyncErrorType(Profile* profile) { const syncer::SyncService* service = ProfileSyncServiceFactory::GetForProfile(profile); // If there is no SyncService (probably because sync is disabled from the // command line), then there's no error to show. if (!service) - return NO_SYNC_ERROR; + return absl::nullopt; // The order or priority is going to be: 1. Unrecoverable errors. // 2. Auth errors. 3. Outdated client errors. 4. Passphrase errors. @@ -289,7 +289,7 @@ } // There is no error. - return NO_SYNC_ERROR; + return absl::nullopt; } bool ShouldRequestSyncConfirmation(const syncer::SyncService* service) {
diff --git a/chrome/browser/sync/sync_ui_util.h b/chrome/browser/sync/sync_ui_util.h index 5e174a4..18a8449 100644 --- a/chrome/browser/sync/sync_ui_util.h +++ b/chrome/browser/sync/sync_ui_util.h
@@ -7,6 +7,7 @@ #include "build/build_config.h" #include "components/sync/driver/sync_service_utils.h" +#include "third_party/abseil-cpp/absl/types/optional.h" class Browser; class GURL; @@ -55,8 +56,6 @@ // Sync errors that should be exposed to the user through the avatar button. enum AvatarSyncErrorType { - // No sync error. - NO_SYNC_ERROR, // Unrecoverable error for managed users. MANAGED_USER_UNRECOVERABLE_ERROR, // Unrecoverable error for regular users. @@ -105,7 +104,7 @@ // Gets the error type (if any) that should be exposed to the user through the // titlebar avatar button. -AvatarSyncErrorType GetAvatarSyncErrorType(Profile* profile); +absl::optional<AvatarSyncErrorType> GetAvatarSyncErrorType(Profile* profile); // Whether sync is currently blocked from starting because the sync // confirmation dialog hasn't been shown. Note that once the dialog is
diff --git a/chrome/browser/sync/test/integration/migration_waiter.h b/chrome/browser/sync/test/integration/migration_waiter.h index 1f24f64..0b9a0b1 100644 --- a/chrome/browser/sync/test/integration/migration_waiter.h +++ b/chrome/browser/sync/test/integration/migration_waiter.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WAITER_H_ #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_MIGRATION_WAITER_H_ -#include <string> - #include "base/macros.h" #include "chrome/browser/sync/test/integration/status_change_checker.h" #include "components/sync/base/model_type.h"
diff --git a/chrome/browser/sync/test/integration/multi_client_status_change_checker.h b/chrome/browser/sync/test/integration/multi_client_status_change_checker.h index c2acd3ea..9b40ea97 100644 --- a/chrome/browser/sync/test/integration/multi_client_status_change_checker.h +++ b/chrome/browser/sync/test/integration/multi_client_status_change_checker.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_MULTI_CLIENT_STATUS_CHANGE_CHECKER_H_ #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_MULTI_CLIENT_STATUS_CHANGE_CHECKER_H_ -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/sync/test/integration/performance/sync_timing_helper.h b/chrome/browser/sync/test/integration/performance/sync_timing_helper.h index 5ecdff7..db09f54 100644 --- a/chrome/browser/sync/test/integration/performance/sync_timing_helper.h +++ b/chrome/browser/sync/test/integration/performance/sync_timing_helper.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_PERFORMANCE_SYNC_TIMING_HELPER_H_ #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_PERFORMANCE_SYNC_TIMING_HELPER_H_ -#include <string> #include <vector> namespace base {
diff --git a/chrome/browser/sync/test/integration/quiesce_status_change_checker.h b/chrome/browser/sync/test/integration/quiesce_status_change_checker.h index 75c1598..2d1b01386 100644 --- a/chrome/browser/sync/test/integration/quiesce_status_change_checker.h +++ b/chrome/browser/sync/test/integration/quiesce_status_change_checker.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_QUIESCE_STATUS_CHANGE_CHECKER_H_ #include <memory> -#include <string> #include <vector> #include "base/compiler_specific.h"
diff --git a/chrome/browser/sync/test/integration/single_client_nigori_sync_test.cc b/chrome/browser/sync/test/integration/single_client_nigori_sync_test.cc index 510d3464..0448bb8 100644 --- a/chrome/browser/sync/test/integration/single_client_nigori_sync_test.cc +++ b/chrome/browser/sync/test/integration/single_client_nigori_sync_test.cc
@@ -637,8 +637,7 @@ #if !BUILDFLAG(IS_CHROMEOS_ASH) // Verify the profile-menu error string is empty. - EXPECT_EQ(sync_ui_util::NO_SYNC_ERROR, - sync_ui_util::GetAvatarSyncErrorType(GetProfile(0))); + EXPECT_FALSE(sync_ui_util::GetAvatarSyncErrorType(GetProfile(0)).has_value()); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) } @@ -698,8 +697,7 @@ #if !BUILDFLAG(IS_CHROMEOS_ASH) // Verify the profile-menu error string is empty. - EXPECT_EQ(sync_ui_util::NO_SYNC_ERROR, - sync_ui_util::GetAvatarSyncErrorType(GetProfile(0))); + EXPECT_FALSE(sync_ui_util::GetAvatarSyncErrorType(GetProfile(0)).has_value()); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) } @@ -1109,8 +1107,7 @@ #if !BUILDFLAG(IS_CHROMEOS_ASH) // Verify the profile-menu error string is empty. - EXPECT_EQ(sync_ui_util::NO_SYNC_ERROR, - sync_ui_util::GetAvatarSyncErrorType(GetProfile(0))); + EXPECT_FALSE(sync_ui_util::GetAvatarSyncErrorType(GetProfile(0)).has_value()); #endif // !BUILDFLAG(IS_CHROMEOS_ASH) }
diff --git a/chrome/browser/sync/test/integration/updated_progress_marker_checker.h b/chrome/browser/sync/test/integration/updated_progress_marker_checker.h index 5ad40f67..6965c00 100644 --- a/chrome/browser/sync/test/integration/updated_progress_marker_checker.h +++ b/chrome/browser/sync/test/integration/updated_progress_marker_checker.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_UPDATED_PROGRESS_MARKER_CHECKER_H_ #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_UPDATED_PROGRESS_MARKER_CHECKER_H_ -#include <string> - #include "base/memory/weak_ptr.h" #include "chrome/browser/sync/test/integration/single_client_status_change_checker.h" #include "components/sync/driver/sync_service_observer.h"
diff --git a/chrome/browser/sync/test/integration/user_events_helper.h b/chrome/browser/sync/test/integration/user_events_helper.h index e87d2acd..30e75f10 100644 --- a/chrome/browser/sync/test/integration/user_events_helper.h +++ b/chrome/browser/sync/test/integration/user_events_helper.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_SYNC_TEST_INTEGRATION_USER_EVENTS_HELPER_H_ #define CHROME_BROWSER_SYNC_TEST_INTEGRATION_USER_EVENTS_HELPER_H_ -#include <string> #include <vector> #include "base/time/time.h"
diff --git a/chrome/browser/sync_file_system/fake_remote_change_processor.h b/chrome/browser/sync_file_system/fake_remote_change_processor.h index 6db4d73..0055d32 100644 --- a/chrome/browser/sync_file_system/fake_remote_change_processor.h +++ b/chrome/browser/sync_file_system/fake_remote_change_processor.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_FAKE_REMOTE_CHANGE_PROCESSOR_H_ #include <map> -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/browser/sync_file_system/local/local_file_change_tracker.h b/chrome/browser/sync_file_system/local/local_file_change_tracker.h index 5a86016..935c6ec 100644 --- a/chrome/browser/sync_file_system/local/local_file_change_tracker.h +++ b/chrome/browser/sync_file_system/local/local_file_change_tracker.h
@@ -9,7 +9,6 @@ #include <map> #include <memory> -#include <string> #include "base/compiler_specific.h" #include "base/containers/circular_deque.h"
diff --git a/chrome/browser/sync_file_system/local/local_file_sync_service.h b/chrome/browser/sync_file_system/local/local_file_sync_service.h index 30f166303..a4d9bb5 100644 --- a/chrome/browser/sync_file_system/local/local_file_sync_service.h +++ b/chrome/browser/sync_file_system/local/local_file_sync_service.h
@@ -10,7 +10,6 @@ #include <map> #include <memory> #include <set> -#include <string> #include "base/callback.h" #include "base/macros.h"
diff --git a/chrome/browser/sync_file_system/logger.h b/chrome/browser/sync_file_system/logger.h index 90abc24..8948c002 100644 --- a/chrome/browser/sync_file_system/logger.h +++ b/chrome/browser/sync_file_system/logger.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOGGER_H_ #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOGGER_H_ -#include <string> #include <vector> #include "base/location.h"
diff --git a/chrome/browser/thumbnail/cc/thumbnail_cache.h b/chrome/browser/thumbnail/cc/thumbnail_cache.h index dc00d4e..1835151 100644 --- a/chrome/browser/thumbnail/cc/thumbnail_cache.h +++ b/chrome/browser/thumbnail/cc/thumbnail_cache.h
@@ -10,7 +10,6 @@ #include <list> #include <map> #include <set> -#include <string> #include "base/bind.h" #include "base/files/file_path.h"
diff --git a/chrome/browser/thumbnail/generator/android/thumbnail_generator.h b/chrome/browser/thumbnail/generator/android/thumbnail_generator.h index d3f3383..0978ac1 100644 --- a/chrome/browser/thumbnail/generator/android/thumbnail_generator.h +++ b/chrome/browser/thumbnail/generator/android/thumbnail_generator.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_THUMBNAIL_GENERATOR_ANDROID_THUMBNAIL_GENERATOR_H_ #include <memory> -#include <string> #include "base/android/jni_android.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/ui/android/infobars/generated_password_saved_infobar.h b/chrome/browser/ui/android/infobars/generated_password_saved_infobar.h index 95b737c..d9f2a8b7 100644 --- a/chrome/browser/ui/android/infobars/generated_password_saved_infobar.h +++ b/chrome/browser/ui/android/infobars/generated_password_saved_infobar.h
@@ -7,8 +7,6 @@ #include <jni.h> -#include <string> - #include "base/android/scoped_java_ref.h" #include "base/macros.h" #include "chrome/browser/password_manager/android/generated_password_saved_infobar_delegate_android.h"
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd index e97e0956..991c723 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -816,6 +816,27 @@ <message name="IDS_PRIVACY_SANDBOX_SNACKBAR_MESSAGE" desc="The text displayed in the snackbar, which gives the user an option to navigate to the Privacy Sandbox settings page. 'Privacy sandbox' has TC ID 5753235213964358658."> Learn about and control new technologies that aim to replace third-party cookies </message> + <message name="IDS_PREFS_PRIVACY_SANDBOX_FLOC" desc="Title for the FLoC preferences as part of the Privacy Sandbox."> + FLoC + </message> + <message name="IDS_PRIVACY_SANDBOX_FLOC_DESCRIPTION" desc="Describes the FLoC technology as part of Privacy Sandbox."> + When on and the status is active, Chrome uses your browsing history over 7 days to determine a group, or “cohort”, that you’re in. Advertisers can select ads for the group. Your browsing history is not shared and is kept private on your device. In some regions, this trial is not active. + </message> + <message name="IDS_PRIVACY_SANDBOX_FLOC_STATUS_TITLE" desc="Title for FLoC experiment status."> + Status + </message> + <message name="IDS_PRIVACY_SANDBOX_FLOC_GROUP_TITLE" desc="Title for FLoC group."> + Group ID + </message> + <message name="IDS_PRIVACY_SANDBOX_FLOC_UPDATE_TITLE" desc="Title for FLoC update."> + Next update + </message> + <message name="IDS_PRIVACY_SANDBOX_FLOC_RESET_DESCRIPTION" desc="Describes the ability to reset FLoC group ID."> + You can reset your group at any time. It takes 7 days to determine your group. + </message> + <message name="IDS_PRIVACY_SANDBOX_FLOC_RESET_BUTTON" desc="Button text to reset FLoC group ID."> + Reset group + </message> <!-- Secure DNS Settings. Used by //chrome/browser/privacy. --> <message name="IDS_SETTINGS_CUSTOM" desc="Label for a custom option in a dropdown menu.">
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PREFS_PRIVACY_SANDBOX_FLOC.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PREFS_PRIVACY_SANDBOX_FLOC.png.sha1 new file mode 100644 index 0000000..a866ce88 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PREFS_PRIVACY_SANDBOX_FLOC.png.sha1
@@ -0,0 +1 @@ +20fb22d50e31d4de808ad77f8966958649b6933a \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_DESCRIPTION.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..4a6ec44 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +c5bb0dcbea93ce730deed86f56d47b5a1c0846d5 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_GROUP_TITLE.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_GROUP_TITLE.png.sha1 new file mode 100644 index 0000000..4a6ec44 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_GROUP_TITLE.png.sha1
@@ -0,0 +1 @@ +c5bb0dcbea93ce730deed86f56d47b5a1c0846d5 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_RESET_BUTTON.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_RESET_BUTTON.png.sha1 new file mode 100644 index 0000000..4a6ec44 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_RESET_BUTTON.png.sha1
@@ -0,0 +1 @@ +c5bb0dcbea93ce730deed86f56d47b5a1c0846d5 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_RESET_DESCRIPTION.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_RESET_DESCRIPTION.png.sha1 new file mode 100644 index 0000000..4a6ec44 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_RESET_DESCRIPTION.png.sha1
@@ -0,0 +1 @@ +c5bb0dcbea93ce730deed86f56d47b5a1c0846d5 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_STATUS_TITLE.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_STATUS_TITLE.png.sha1 new file mode 100644 index 0000000..4a6ec44 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_STATUS_TITLE.png.sha1
@@ -0,0 +1 @@ +c5bb0dcbea93ce730deed86f56d47b5a1c0846d5 \ No newline at end of file
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_UPDATE_TITLE.png.sha1 b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_UPDATE_TITLE.png.sha1 new file mode 100644 index 0000000..4a6ec44 --- /dev/null +++ b/chrome/browser/ui/android/strings/android_chrome_strings_grd/IDS_PRIVACY_SANDBOX_FLOC_UPDATE_TITLE.png.sha1
@@ -0,0 +1 @@ +c5bb0dcbea93ce730deed86f56d47b5a1c0846d5 \ No newline at end of file
diff --git a/chrome/browser/ui/app_list/search/search_result_ranker/chip_ranker.h b/chrome/browser/ui/app_list/search/search_result_ranker/chip_ranker.h index 32d13a2..7c76a6de 100644 --- a/chrome/browser/ui/app_list/search/search_result_ranker/chip_ranker.h +++ b/chrome/browser/ui/app_list/search/search_result_ranker/chip_ranker.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include <vector> #include "chrome/browser/history/history_service_factory.h"
diff --git a/chrome/browser/ui/ash/assistant/assistant_context_util.h b/chrome/browser/ui/ash/assistant/assistant_context_util.h index 70a58ae..818e20ee 100644 --- a/chrome/browser/ui/ash/assistant/assistant_context_util.h +++ b/chrome/browser/ui/ash/assistant/assistant_context_util.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_UI_ASH_ASSISTANT_ASSISTANT_CONTEXT_UTIL_H_ #define CHROME_BROWSER_UI_ASH_ASSISTANT_ASSISTANT_CONTEXT_UTIL_H_ -#include <string> - #include "base/callback.h" #include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/accessibility/mojom/ax_assistant_structure.mojom.h"
diff --git a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h index fdc775e..0f3173c 100644 --- a/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h +++ b/chrome/browser/ui/ash/holding_space/holding_space_keyed_service.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_ASH_HOLDING_SPACE_HOLDING_SPACE_KEYED_SERVICE_H_ #include <memory> -#include <string> #include <vector> #include "ash/public/cpp/holding_space/holding_space_model.h"
diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h index 88423e2..3f7a0b0 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h
@@ -8,7 +8,6 @@ #include <map> #include <memory> #include <set> -#include <string> #include "base/macros.h"
diff --git a/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu.h b/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu.h index 90f2669..60b6735 100644 --- a/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu.h +++ b/chrome/browser/ui/ash/shelf/app_service/app_service_shelf_context_menu.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_ASH_SHELF_APP_SERVICE_APP_SERVICE_SHELF_CONTEXT_MENU_H_ #include <memory> -#include <string> #include <vector> #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc index aebd225..b6c2a72 100644 --- a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc +++ b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.cc
@@ -32,7 +32,6 @@ #include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/web_app_helpers.h" #include "chrome/browser/web_applications/components/web_app_provider_base.h" -#include "chrome/common/chrome_features.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/web_contents.h" @@ -197,19 +196,6 @@ if (browser->app_controller() && browser->app_controller()->HasAppId()) return browser->app_controller()->GetAppId() == app_id_; - // Bookmark apps set to launch in app windows should not match contents - // running in tabs. - if (registrar_->GetAppUserDisplayMode(app_id_) != - web_app::DisplayMode::kBrowser && - // TODO(crbug.com/1054116): when the flag is on, we allow web - // contents in a normal browser to match a web app. This is going to - // be weird because GetAppMenuItems(0) and HasRunningApplications() - // does not consider normal browsers. - !base::FeatureList::IsEnabled( - features::kDesktopPWAsWithoutExtensions)) { - return false; - } - // There are three ways to identify the association of a URL with this // web app: // - The refocus pattern is matched (needed for apps like drive).
diff --git a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h index 5d1b7dc..3085764 100644 --- a/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h +++ b/chrome/browser/ui/ash/shelf/app_shortcut_shelf_item_controller.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_ASH_SHELF_APP_SHORTCUT_SHELF_ITEM_CONTROLLER_H_ #include <memory> -#include <string> #include <vector> #include "ash/public/cpp/shelf_item_delegate.h"
diff --git a/chrome/browser/ui/ash/shelf/app_window_shelf_item_controller.h b/chrome/browser/ui/ash/shelf/app_window_shelf_item_controller.h index 72622b4..e6f12022 100644 --- a/chrome/browser/ui/ash/shelf/app_window_shelf_item_controller.h +++ b/chrome/browser/ui/ash/shelf/app_window_shelf_item_controller.h
@@ -7,7 +7,6 @@ #include <list> #include <memory> -#include <string> #include "ash/public/cpp/shelf_item_delegate.h" #include "base/macros.h"
diff --git a/chrome/browser/ui/ash/shelf/crostini_app_window.h b/chrome/browser/ui/ash/shelf/crostini_app_window.h index cf899fe..edd83d23 100644 --- a/chrome/browser/ui/ash/shelf/crostini_app_window.h +++ b/chrome/browser/ui/ash/shelf/crostini_app_window.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_ASH_SHELF_CROSTINI_APP_WINDOW_H_ #include <memory> -#include <string> #include "ash/public/cpp/shelf_types.h" #include "chrome/browser/ui/ash/shelf/app_window_base.h"
diff --git a/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc b/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc index 32ae348..b0d889c0 100644 --- a/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc +++ b/chrome/browser/ui/ash/shelf/shelf_controller_helper.cc
@@ -35,7 +35,6 @@ #include "chrome/browser/web_applications/components/web_app_id.h" #include "chrome/browser/web_applications/components/web_app_provider_base.h" #include "chrome/browser/web_applications/extensions/bookmark_app_util.h" -#include "chrome/common/chrome_features.h" #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" #include "components/arc/arc_util.h" #include "components/arc/metrics/arc_metrics_constants.h" @@ -78,25 +77,23 @@ absl::optional<std::string> GetAppIdForTab(Profile* profile, content::WebContents* tab) { - if (base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)) { - if (web_app::WebAppProviderBase* provider = - web_app::WebAppProviderBase::GetProviderBase(profile)) { - // Use the Browser's app name to determine the web app for app windows and - // use the tab's url for app tabs. + if (web_app::WebAppProviderBase* provider = + web_app::WebAppProviderBase::GetProviderBase(profile)) { + // Use the Browser's app name to determine the web app for app windows and + // use the tab's url for app tabs. - // Note: It is possible to come here after a tab got removed from the - // browser before it gets destroyed, in which case there is no browser. - if (Browser* browser = chrome::FindBrowserWithWebContents(tab)) { - if (browser->app_controller() && browser->app_controller()->HasAppId()) - return browser->app_controller()->GetAppId(); - } + // Note: It is possible to come here after a tab got removed from the + // browser before it gets destroyed, in which case there is no browser. + if (Browser* browser = chrome::FindBrowserWithWebContents(tab)) { + if (browser->app_controller() && browser->app_controller()->HasAppId()) + return browser->app_controller()->GetAppId(); + } - absl::optional<web_app::AppId> app_id = - provider->registrar().FindAppWithUrlInScope(tab->GetURL()); - if (app_id && provider->registrar().GetAppUserDisplayMode(*app_id) == - web_app::DisplayMode::kBrowser) { - return app_id; - } + absl::optional<web_app::AppId> app_id = + provider->registrar().FindAppWithUrlInScope(tab->GetURL()); + if (app_id && provider->registrar().GetAppUserDisplayMode(*app_id) == + web_app::DisplayMode::kBrowser) { + return app_id; } } @@ -109,9 +106,7 @@ return web_app::GetAppIdFromApplicationName(browser->app_name()); const extensions::Extension* extension = GetExtensionForTab(profile, tab); - if (extension && - (!extension->from_bookmark() || - !base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions))) + if (extension && !extension->from_bookmark()) return extension->id(); return absl::nullopt; }
diff --git a/chrome/browser/ui/commander/commander_frontend.h b/chrome/browser/ui/commander/commander_frontend.h index 396d7add..7de87e7 100644 --- a/chrome/browser/ui/commander/commander_frontend.h +++ b/chrome/browser/ui/commander/commander_frontend.h
@@ -6,8 +6,6 @@ #define CHROME_BROWSER_UI_COMMANDER_COMMANDER_FRONTEND_H_ #include <memory> -#include <string> - class Browser;
diff --git a/chrome/browser/ui/crypto_module_password_dialog_nss.h b/chrome/browser/ui/crypto_module_password_dialog_nss.h index d01844b..ecfda5d 100644 --- a/chrome/browser/ui/crypto_module_password_dialog_nss.h +++ b/chrome/browser/ui/crypto_module_password_dialog_nss.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_NSS_H_ #define CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_NSS_H_ -#include <string> #include <vector> #include "base/callback_forward.h"
diff --git a/chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc index c16d37e..0f3db50 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_interactive_uitest.cc
@@ -38,7 +38,7 @@ bool forward, bool case_sensitive, int* ordinal) { - std::u16string search_str16(ASCIIToUTF16(search_str)); + std::u16string search_str16(base::ASCIIToUTF16(search_str)); Browser* browser = chrome::FindBrowserWithWebContents(web_contents); browser->GetFindBarController()->find_bar()->SetFindTextAndSelectedRange( search_str16, gfx::Range());
diff --git a/chrome/browser/ui/hung_plugin_tab_helper.h b/chrome/browser/ui/hung_plugin_tab_helper.h index feef151..d5bb5ca 100644 --- a/chrome/browser/ui/hung_plugin_tab_helper.h +++ b/chrome/browser/ui/hung_plugin_tab_helper.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include "base/macros.h" #include "base/scoped_multi_source_observation.h"
diff --git a/chrome/browser/ui/intent_picker_tab_helper.h b/chrome/browser/ui/intent_picker_tab_helper.h index 48cd519..3367b53 100644 --- a/chrome/browser/ui/intent_picker_tab_helper.h +++ b/chrome/browser/ui/intent_picker_tab_helper.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_UI_INTENT_PICKER_TAB_HELPER_H_ #define CHROME_BROWSER_UI_INTENT_PICKER_TAB_HELPER_H_ -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/browser/ui/passwords/manage_passwords_state.h b/chrome/browser/ui/passwords/manage_passwords_state.h index 9b8d0779..f48212e 100644 --- a/chrome/browser/ui/passwords/manage_passwords_state.h +++ b/chrome/browser/ui/passwords/manage_passwords_state.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_STATE_H_ #include <memory> -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/browser/ui/passwords/passwords_client_ui_delegate.h b/chrome/browser/ui/passwords/passwords_client_ui_delegate.h index 3419608..d08c5c4 100644 --- a/chrome/browser/ui/passwords/passwords_client_ui_delegate.h +++ b/chrome/browser/ui/passwords/passwords_client_ui_delegate.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/browser/ui/passwords/settings/password_ui_view.h b/chrome/browser/ui/passwords/settings/password_ui_view.h index 76cb0a0e..6986bf6 100644 --- a/chrome/browser/ui/passwords/settings/password_ui_view.h +++ b/chrome/browser/ui/passwords/settings/password_ui_view.h
@@ -8,7 +8,6 @@ #include <stddef.h> #include <memory> -#include <string> #include <vector> #include "build/build_config.h"
diff --git a/chrome/browser/ui/passwords/settings/password_ui_view_mock.h b/chrome/browser/ui/passwords/settings/password_ui_view_mock.h index 6b08730..2ee1880 100644 --- a/chrome/browser/ui/passwords/settings/password_ui_view_mock.h +++ b/chrome/browser/ui/passwords/settings/password_ui_view_mock.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_PASSWORDS_SETTINGS_PASSWORD_UI_VIEW_MOCK_H_ #include <memory> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.h b/chrome/browser/ui/startup/startup_browser_creator_impl.h index 00a326f..a751afd 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.h +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ #include <memory> -#include <string> #include <vector> #include "base/files/file_path.h"
diff --git a/chrome/browser/ui/views/apps/app_dialog/app_uninstall_dialog_view.cc b/chrome/browser/ui/views/apps/app_dialog/app_uninstall_dialog_view.cc index bbf80a3..660b39e 100644 --- a/chrome/browser/ui/views/apps/app_dialog/app_uninstall_dialog_view.cc +++ b/chrome/browser/ui/views/apps/app_dialog/app_uninstall_dialog_view.cc
@@ -7,7 +7,6 @@ #include <string> #include "base/bind.h" -#include "base/compiler_specific.h" #include "base/feature_list.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -181,13 +180,8 @@ case apps::mojom::AppType::kWeb: case apps::mojom::AppType::kSystemWeb: - if (base::FeatureList::IsEnabled( - features::kDesktopPWAsWithoutExtensions)) { - InitializeViewForWebApp(profile, app_id); - break; - } - // Otherwise fallback to Extension-based Bookmark Apps. - FALLTHROUGH; + InitializeViewForWebApp(profile, app_id); + break; case apps::mojom::AppType::kExtension: InitializeViewForExtension(profile, app_id); break;
diff --git a/chrome/browser/ui/views/autofill/update_address_profile_view.cc b/chrome/browser/ui/views/autofill/update_address_profile_view.cc index 45e5036d..eee7c80 100644 --- a/chrome/browser/ui/views/autofill/update_address_profile_view.cc +++ b/chrome/browser/ui/views/autofill/update_address_profile_view.cc
@@ -40,7 +40,7 @@ // TODO(crbug.com/1167060): Update icons upon having final mocks. switch (type) { case NAME_FULL_WITH_HONORIFIC_PREFIX: - return kUserAccountAvatarIcon; + return kAccountCircleIcon; case EMAIL_ADDRESS: return vector_icons::kEmailIcon; case PHONE_HOME_WHOLE_NUMBER: @@ -198,9 +198,11 @@ /*horizontal=*/0)); views::Label* subtitle_label = AddChildView(std::make_unique<views::Label>( - GetDescriptionForProfileToUpdate( - *controller_->GetOriginalProfile(), - g_browser_process->GetApplicationLocale()), + // TODO(crbug.com/1167060): Pass proper `include_address_and_contacts` + // value and handle empty description if needed. + GetProfileDescription(*controller_->GetOriginalProfile(), + g_browser_process->GetApplicationLocale(), + /*include_address_and_contacts=*/true), views::style::CONTEXT_LABEL, views::style::STYLE_SECONDARY)); subtitle_label->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
diff --git a/chrome/browser/ui/views/extensions/extension_install_friction_dialog_view.h b/chrome/browser/ui/views/extensions/extension_install_friction_dialog_view.h index 8f40e99f..962a6900 100644 --- a/chrome/browser/ui/views/extensions/extension_install_friction_dialog_view.h +++ b/chrome/browser/ui/views/extensions/extension_install_friction_dialog_view.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALL_FRICTION_DIALOG_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALL_FRICTION_DIALOG_VIEW_H_ -#include <string> - #include "base/callback.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
diff --git a/chrome/browser/ui/views/extensions/extensions_menu_view_unittest.cc b/chrome/browser/ui/views/extensions/extensions_menu_view_unittest.cc index 87bee64..8fc58f2 100644 --- a/chrome/browser/ui/views/extensions/extensions_menu_view_unittest.cc +++ b/chrome/browser/ui/views/extensions/extensions_menu_view_unittest.cc
@@ -425,6 +425,131 @@ testing::ElementsAre(kName3, kName1, kName2)); } +TEST_F(ExtensionsMenuViewUnitTest, RunDropCallback) { + constexpr char kName1[] = "Test 1"; + auto ext1 = AddSimpleExtension(kName1); + constexpr char kName2[] = "Test 2"; + auto ext2 = AddSimpleExtension(kName2); + constexpr char kName3[] = "Test 3"; + auto ext3 = AddSimpleExtension(kName3); + + auto* toolbar_model = ToolbarActionsModel::Get(profile()); + ASSERT_TRUE(toolbar_model); + + toolbar_model->SetActionVisibility(ext1->id(), true); + toolbar_model->SetActionVisibility(ext2->id(), true); + toolbar_model->SetActionVisibility(ext3->id(), true); + WaitForAnimation(); + + EXPECT_THAT(GetPinnedExtensionNames(), + testing::ElementsAre(kName1, kName2, kName3)); + + // Simulate dragging "Test 3" to the first slot. + ToolbarActionView* drag_view = GetPinnedExtensionView(kName3); + ui::OSExchangeData drag_data; + extensions_container()->WriteDragDataForView(drag_view, gfx::Point(), + &drag_data); + gfx::PointF drop_point(GetPinnedExtensionView(kName1)->origin()); + ui::DropTargetEvent drop_event(drag_data, drop_point, drop_point, + ui::DragDropTypes::DRAG_MOVE); + extensions_container()->OnDragUpdated(drop_event); + auto cb = extensions_container()->GetDropCallback(drop_event); + ui::mojom::DragOperation output_drag_op = ui::mojom::DragOperation::kNone; + std::move(cb).Run(drop_event, output_drag_op); + WaitForAnimation(); + + EXPECT_THAT(GetPinnedExtensionNames(), + testing::ElementsAre(kName3, kName1, kName2)); + EXPECT_EQ(output_drag_op, ui::mojom::DragOperation::kMove); +} + +TEST_F(ExtensionsMenuViewUnitTest, ResetDropCallback) { + constexpr char kName1[] = "Test 1"; + auto ext1 = AddSimpleExtension(kName1); + constexpr char kName2[] = "Test 2"; + auto ext2 = AddSimpleExtension(kName2); + constexpr char kName3[] = "Test 3"; + auto ext3 = AddSimpleExtension(kName3); + + auto* toolbar_model = ToolbarActionsModel::Get(profile()); + ASSERT_TRUE(toolbar_model); + + toolbar_model->SetActionVisibility(ext1->id(), true); + toolbar_model->SetActionVisibility(ext2->id(), true); + toolbar_model->SetActionVisibility(ext3->id(), true); + WaitForAnimation(); + + EXPECT_THAT(GetPinnedExtensionNames(), + testing::ElementsAre(kName1, kName2, kName3)); + + // Simulate dragging "Test 3" to the first slot. + ToolbarActionView* drag_view = GetPinnedExtensionView(kName3); + ui::OSExchangeData drag_data; + extensions_container()->WriteDragDataForView(drag_view, gfx::Point(), + &drag_data); + gfx::PointF drop_point(GetPinnedExtensionView(kName1)->origin()); + ui::DropTargetEvent drop_event(drag_data, drop_point, drop_point, + ui::DragDropTypes::DRAG_MOVE); + extensions_container()->OnDragUpdated(drop_event); + auto cb = extensions_container()->GetDropCallback(drop_event); + WaitForAnimation(); + + EXPECT_THAT(GetPinnedExtensionNames(), + testing::ElementsAre(kName3, kName1, kName2)); + + // If the drop callback is reset (and never invoked), the drag should be + // aborted, and items should be back in their original order. + cb.Reset(); + WaitForAnimation(); + + EXPECT_THAT(GetPinnedExtensionNames(), + testing::ElementsAre(kName1, kName2, kName3)); +} + +TEST_F(ExtensionsMenuViewUnitTest, InvalidateDropCallback) { + constexpr char kName1[] = "Test 1"; + auto ext1 = AddSimpleExtension(kName1); + constexpr char kName2[] = "Test 2"; + auto ext2 = AddSimpleExtension(kName2); + + auto* toolbar_model = ToolbarActionsModel::Get(profile()); + ASSERT_TRUE(toolbar_model); + + toolbar_model->SetActionVisibility(ext1->id(), true); + toolbar_model->SetActionVisibility(ext2->id(), true); + WaitForAnimation(); + + EXPECT_THAT(GetPinnedExtensionNames(), testing::ElementsAre(kName1, kName2)); + + // Simulate dragging "Test 2" to the first slot. + ToolbarActionView* drag_view = GetPinnedExtensionView(kName2); + ui::OSExchangeData drag_data; + extensions_container()->WriteDragDataForView(drag_view, gfx::Point(), + &drag_data); + gfx::PointF drop_point(GetPinnedExtensionView(kName1)->origin()); + ui::DropTargetEvent drop_event(drag_data, drop_point, drop_point, + ui::DragDropTypes::DRAG_MOVE); + extensions_container()->OnDragUpdated(drop_event); + auto cb = extensions_container()->GetDropCallback(drop_event); + WaitForAnimation(); + + EXPECT_THAT(GetPinnedExtensionNames(), testing::ElementsAre(kName2, kName1)); + + constexpr char kName3[] = "Test 3"; + auto ext3 = AddSimpleExtension(kName3); + toolbar_model->SetActionVisibility(ext3->id(), true); + WaitForAnimation(); + + // The drop callback should be invalidated, and items should be back in their + // original order. + ui::mojom::DragOperation output_drag_op = ui::mojom::DragOperation::kNone; + std::move(cb).Run(drop_event, output_drag_op); + WaitForAnimation(); + + EXPECT_THAT(GetPinnedExtensionNames(), + testing::ElementsAre(kName1, kName2, kName3)); +} + TEST_F(ExtensionsMenuViewUnitTest, PinnedExtensionsReorderOnPrefChange) { constexpr char kName1[] = "Test 1"; const extensions::ExtensionId id1 = AddSimpleExtension(kName1)->id();
diff --git a/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc b/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc index d0a682c..a7ad8365 100644 --- a/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc +++ b/chrome/browser/ui/views/extensions/extensions_toolbar_container.cc
@@ -4,6 +4,8 @@ #include "chrome/browser/ui/views/extensions/extensions_toolbar_container.h" +#include "base/bind.h" +#include "base/callback_helpers.h" #include "base/numerics/ranges.h" #include "build/build_config.h" #include "chrome/browser/ui/browser.h" @@ -20,6 +22,7 @@ #include "chrome/browser/ui/views/toolbar/toolbar_actions_bar_bubble_views.h" #include "chrome/browser/ui/views/web_apps/frame_toolbar/web_app_frame_toolbar_view.h" #include "ui/base/dragdrop/drag_drop_types.h" +#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h" #include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h" #include "ui/base/metadata/metadata_impl_macros.h" #include "ui/views/layout/animating_layout_manager.h" @@ -421,6 +424,8 @@ // only due to user interaction. if (display_mode_ != DisplayMode::kAutoHide) UpdateContainerVisibility(); + + drop_weak_ptr_factory_.InvalidateWeakPtrs(); } void ExtensionsToolbarContainer::OnToolbarActionRemoved( @@ -445,6 +450,8 @@ icons_.erase(action_id); UpdateContainerVisibilityAfterAnimation(); + + drop_weak_ptr_factory_.InvalidateWeakPtrs(); } void ExtensionsToolbarContainer::OnToolbarActionUpdated( @@ -587,6 +594,11 @@ return BrowserActionDragData::CanDrop(data, browser_->profile()); } +void ExtensionsToolbarContainer::OnDragEntered( + const ui::DropTargetEvent& event) { + drop_weak_ptr_factory_.InvalidateWeakPtrs(); +} + int ExtensionsToolbarContainer::OnDragUpdated( const ui::DropTargetEvent& event) { BrowserActionDragData data; @@ -625,22 +637,35 @@ const ToolbarActionsModel::ActionId dragged_extension_id = drop_info_->action_id; drop_info_.reset(); - ReorderViews(); - GetAnimatingLayoutManager()->PostOrQueueAction(base::BindOnce( - &ExtensionsToolbarContainer::SetExtensionIconVisibility, - weak_ptr_factory_.GetWeakPtr(), dragged_extension_id, true)); + DragDropCleanup(dragged_extension_id); } DragOperation ExtensionsToolbarContainer::OnPerformDrop( const ui::DropTargetEvent& event) { - BrowserActionDragData data; - if (!data.Read(event.data())) + auto drop_callback = GetDropCallback(event); + if (!drop_callback) return DragOperation::kNone; - model_->MovePinnedAction(drop_info_->action_id, drop_info_->index); + DragOperation output_drag_op = DragOperation::kNone; + std::move(drop_callback).Run(event, output_drag_op); + return output_drag_op; +} - OnDragExited(); // Perform clean up after dragging. - return DragOperation::kMove; +views::View::DropCallback ExtensionsToolbarContainer::GetDropCallback( + const ui::DropTargetEvent& event) { + BrowserActionDragData data; + if (!data.Read(event.data())) + return base::NullCallback(); + + auto action_id = std::move(drop_info_->action_id); + auto index = drop_info_->index; + drop_info_.reset(); + base::ScopedClosureRunner cleanup( + base::BindOnce(&ExtensionsToolbarContainer::DragDropCleanup, + weak_ptr_factory_.GetWeakPtr(), action_id)); + return base::BindOnce(&ExtensionsToolbarContainer::MovePinnedAction, + drop_weak_ptr_factory_.GetWeakPtr(), action_id, index, + std::move(cleanup)); } void ExtensionsToolbarContainer::OnWidgetClosing(views::Widget* widget) { @@ -744,5 +769,26 @@ UpdateContainerVisibility(); } +void ExtensionsToolbarContainer::MovePinnedAction( + const ToolbarActionsModel::ActionId& action_id, + size_t index, + base::ScopedClosureRunner cleanup, + const ui::DropTargetEvent& event, + ui::mojom::DragOperation& output_drag_op) { + model_->MovePinnedAction(action_id, index); + + output_drag_op = DragOperation::kMove; + // `cleanup` will run automatically when it goes out of scope to finish + // up the drag. +} + +void ExtensionsToolbarContainer::DragDropCleanup( + const ToolbarActionsModel::ActionId& dragged_extension_id) { + ReorderViews(); + GetAnimatingLayoutManager()->PostOrQueueAction(base::BindOnce( + &ExtensionsToolbarContainer::SetExtensionIconVisibility, + weak_ptr_factory_.GetWeakPtr(), dragged_extension_id, true)); +} + BEGIN_METADATA(ExtensionsToolbarContainer, ToolbarIconContainerView) END_METADATA
diff --git a/chrome/browser/ui/views/extensions/extensions_toolbar_container.h b/chrome/browser/ui/views/extensions/extensions_toolbar_container.h index 7c9b303..8906ed4 100644 --- a/chrome/browser/ui/views/extensions/extensions_toolbar_container.h +++ b/chrome/browser/ui/views/extensions/extensions_toolbar_container.h
@@ -111,10 +111,13 @@ std::set<ui::ClipboardFormatType>* format_types) override; bool AreDropTypesRequired() override; bool CanDrop(const ui::OSExchangeData& data) override; + void OnDragEntered(const ui::DropTargetEvent& event) override; int OnDragUpdated(const ui::DropTargetEvent& event) override; void OnDragExited() override; ui::mojom::DragOperation OnPerformDrop( const ui::DropTargetEvent& event) override; + views::View::DropCallback GetDropCallback( + const ui::DropTargetEvent& event) override; // ExtensionsContainer: ToolbarActionViewController* GetActionForId( @@ -233,6 +236,17 @@ void OnWidgetClosing(views::Widget* widget) override; void OnWidgetDestroying(views::Widget* widget) override; + // Moves the dragged extension `action_id`. + void MovePinnedAction(const ToolbarActionsModel::ActionId& action_id, + size_t index, + base::ScopedClosureRunner cleanup, + const ui::DropTargetEvent& event, + ui::mojom::DragOperation& output_drag_op); + + // Performs clean up after dragging. + void DragDropCleanup( + const ToolbarActionsModel::ActionId& dragged_extension_id); + Browser* const browser_; ToolbarActionsModel* const model_; base::ScopedObservation<ToolbarActionsModel, ToolbarActionsModel::Observer> @@ -263,6 +277,8 @@ std::unique_ptr<DropInfo> drop_info_; base::WeakPtrFactory<ExtensionsToolbarContainer> weak_ptr_factory_{this}; + + base::WeakPtrFactory<ExtensionsToolbarContainer> drop_weak_ptr_factory_{this}; }; #endif // CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSIONS_TOOLBAR_CONTAINER_H_
diff --git a/chrome/browser/ui/views/folder_upload_confirmation_view.h b/chrome/browser/ui/views/folder_upload_confirmation_view.h index 4610620..fb77121a 100644 --- a/chrome/browser/ui/views/folder_upload_confirmation_view.h +++ b/chrome/browser/ui/views/folder_upload_confirmation_view.h
@@ -5,8 +5,6 @@ #ifndef CHROME_BROWSER_UI_VIEWS_FOLDER_UPLOAD_CONFIRMATION_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_FOLDER_UPLOAD_CONFIRMATION_VIEW_H_ -#include <string> - #include "base/macros.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/shell_dialogs/selected_file_info.h"
diff --git a/chrome/browser/ui/views/overlay/toggle_camera_button.h b/chrome/browser/ui/views/overlay/toggle_camera_button.h index cd515a1f..e716a55 100644 --- a/chrome/browser/ui/views/overlay/toggle_camera_button.h +++ b/chrome/browser/ui/views/overlay/toggle_camera_button.h
@@ -16,6 +16,8 @@ void SetCameraState(bool is_turned_on); + bool is_turned_on_for_testing() const { return is_turned_on_; } + protected: // views::View: void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
diff --git a/chrome/browser/ui/views/overlay/toggle_microphone_button.h b/chrome/browser/ui/views/overlay/toggle_microphone_button.h index a61542d..3b1f8bcb 100644 --- a/chrome/browser/ui/views/overlay/toggle_microphone_button.h +++ b/chrome/browser/ui/views/overlay/toggle_microphone_button.h
@@ -16,6 +16,8 @@ void SetMutedState(bool is_muted); + bool is_muted_for_testing() const { return is_muted_; } + protected: // views::View: void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
diff --git a/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc b/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc index ae88a4e..ad6450e3 100644 --- a/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc +++ b/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.cc
@@ -183,8 +183,11 @@ } // Show any existing sync errors. - const sync_ui_util::AvatarSyncErrorType error = + const absl::optional<sync_ui_util::AvatarSyncErrorType> error = sync_ui_util::GetAvatarSyncErrorType(profile_); + if (!error) + return AvatarToolbarButton::State::kNormal; + if (error == sync_ui_util::AUTH_ERROR && AccountConsistencyModeManager::IsDiceEnabledForProfile(profile_)) { return AvatarToolbarButton::State::kSyncPaused; @@ -193,9 +196,7 @@ if (error == sync_ui_util::TRUSTED_VAULT_KEY_MISSING_FOR_PASSWORDS_ERROR) return AvatarToolbarButton::State::kPasswordsOnlySyncError; - return error == sync_ui_util::NO_SYNC_ERROR - ? AvatarToolbarButton::State::kNormal - : AvatarToolbarButton::State::kSyncError; + return AvatarToolbarButton::State::kSyncError; } void AvatarToolbarButtonDelegate::ShowHighlightAnimation() { @@ -354,7 +355,7 @@ } void AvatarToolbarButtonDelegate::OnStateChanged(syncer::SyncService*) { - sync_ui_util::AvatarSyncErrorType error = + const absl::optional<sync_ui_util::AvatarSyncErrorType> error = sync_ui_util::GetAvatarSyncErrorType(profile_); if (last_avatar_error_ == error) return;
diff --git a/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h b/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h index cedf27d6..8eafcf7 100644 --- a/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h +++ b/chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h
@@ -18,6 +18,7 @@ #include "components/signin/public/identity_manager/identity_manager.h" #include "components/sync/driver/sync_service.h" #include "components/sync/driver/sync_service_observer.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/gfx/image/image.h" class Profile; @@ -133,7 +134,7 @@ // Caches the value of the last error so the class can detect when it changes // and notify |avatar_toolbar_button_|. - sync_ui_util::AvatarSyncErrorType last_avatar_error_; + absl::optional<sync_ui_util::AvatarSyncErrorType> last_avatar_error_; base::WeakPtrFactory<AvatarToolbarButtonDelegate> weak_ptr_factory_{this};
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view.cc b/chrome/browser/ui/views/profiles/profile_menu_view.cc index 1da352c..0f805bdb 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view.cc
@@ -71,66 +71,64 @@ // Helpers -------------------------------------------------------------------- -// Most error cases get displayed the same way, only the button string changes. -ProfileMenuViewBase::SyncInfo GetStandardSyncErrorInfo(int button_string_id) { - return {IDS_SYNC_ERROR_USER_MENU_TITLE, button_string_id, - ProfileMenuViewBase::SyncInfoContainerBackgroundState::kError}; -} - -ProfileMenuViewBase::SyncInfo GetSyncInfoForAvatarErrorType( - sync_ui_util::AvatarSyncErrorType error) { +std::u16string GetSyncErrorButtonText(sync_ui_util::AvatarSyncErrorType error) { switch (error) { - case sync_ui_util::NO_SYNC_ERROR: - NOTREACHED(); - // TODO(crbug.com/1191411): Convert NO_SYNC_ERROR to absl::nullopt. This - // case is treated differently in a few places in this file today, and - // will be even more in the future. - return {42, 42, - ProfileMenuViewBase::SyncInfoContainerBackgroundState::kError}; case sync_ui_util::AUTH_ERROR: - // Sync paused. The user can reauth to resolve the signin error. - return {IDS_PROFILES_DICE_SYNC_PAUSED_TITLE, - IDS_SYNC_ERROR_USER_MENU_SIGNIN_BUTTON, - ProfileMenuViewBase::SyncInfoContainerBackgroundState::kPaused}; - case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: - // For a managed user, the user is directed to the signout confirmation - // dialogue in the settings page. - return GetStandardSyncErrorInfo(IDS_SYNC_ERROR_USER_MENU_SIGNOUT_BUTTON); case sync_ui_util::UNRECOVERABLE_ERROR: - // For a non-managed user, we sign out on the user's behalf and prompt the - // user to sign in again. - return GetStandardSyncErrorInfo( - IDS_SYNC_ERROR_USER_MENU_SIGNIN_AGAIN_BUTTON); + // The user was signed out. Offer them to sign in again. + return l10n_util::GetStringUTF16(IDS_SYNC_ERROR_USER_MENU_SIGNIN_BUTTON); + case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: + // As opposed to the corresponding error in an unmanaged account + // (sync_ui_util::UNRECOVERABLE_ERROR), sign-out hasn't happened here yet. + // The button directs to the sign-out confirmation dialog in settings. + return l10n_util::GetStringUTF16(IDS_SYNC_ERROR_USER_MENU_SIGNOUT_BUTTON); case sync_ui_util::UPGRADE_CLIENT_ERROR: - return GetStandardSyncErrorInfo(IDS_SYNC_ERROR_USER_MENU_UPGRADE_BUTTON); + return l10n_util::GetStringUTF16(IDS_SYNC_ERROR_USER_MENU_UPGRADE_BUTTON); case sync_ui_util::PASSPHRASE_ERROR: - return GetStandardSyncErrorInfo( + return l10n_util::GetStringUTF16( IDS_SYNC_ERROR_USER_MENU_PASSPHRASE_BUTTON); case sync_ui_util::TRUSTED_VAULT_KEY_MISSING_FOR_EVERYTHING_ERROR: - return GetStandardSyncErrorInfo( - IDS_SYNC_ERROR_USER_MENU_RETRIEVE_KEYS_BUTTON); case sync_ui_util::TRUSTED_VAULT_KEY_MISSING_FOR_PASSWORDS_ERROR: - return {IDS_SYNC_ERROR_PASSWORDS_USER_MENU_TITLE, - IDS_SYNC_ERROR_USER_MENU_RETRIEVE_KEYS_BUTTON, - ProfileMenuViewBase::SyncInfoContainerBackgroundState::kError}; + return l10n_util::GetStringUTF16( + IDS_SYNC_ERROR_USER_MENU_RETRIEVE_KEYS_BUTTON); case sync_ui_util:: TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING_ERROR: - return { - IDS_SYNC_ERROR_RECOVERABILITY_DEGRADED_FOR_EVERYTHING_USER_MENU_TITLE, - IDS_SYNC_ERROR_USER_MENU_RECOVERABILITY_BUTTON, - ProfileMenuViewBase::SyncInfoContainerBackgroundState::kError}; case sync_ui_util:: TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS_ERROR: - return { - IDS_SYNC_ERROR_RECOVERABILITY_DEGRADED_FOR_PASSWORDS_USER_MENU_TITLE, - IDS_SYNC_ERROR_USER_MENU_RECOVERABILITY_BUTTON, - ProfileMenuViewBase::SyncInfoContainerBackgroundState::kError}; + return l10n_util::GetStringUTF16( + IDS_SYNC_ERROR_USER_MENU_RECOVERABILITY_BUTTON); case sync_ui_util::SETTINGS_UNCONFIRMED_ERROR: - return GetStandardSyncErrorInfo( + return l10n_util::GetStringUTF16( IDS_SYNC_ERROR_USER_MENU_CONFIRM_SYNC_SETTINGS_BUTTON); } } +std::u16string GetSyncErrorDescription( + sync_ui_util::AvatarSyncErrorType error) { + switch (error) { + case sync_ui_util::AUTH_ERROR: + return l10n_util::GetStringUTF16(IDS_PROFILES_DICE_SYNC_PAUSED_TITLE); + case sync_ui_util::TRUSTED_VAULT_KEY_MISSING_FOR_PASSWORDS_ERROR: + return l10n_util::GetStringUTF16( + IDS_SYNC_ERROR_PASSWORDS_USER_MENU_TITLE); + case sync_ui_util:: + TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS_ERROR: + return l10n_util::GetStringUTF16( + IDS_SYNC_ERROR_RECOVERABILITY_DEGRADED_FOR_PASSWORDS_USER_MENU_TITLE); + case sync_ui_util:: + TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING_ERROR: + return l10n_util::GetStringUTF16( + IDS_SYNC_ERROR_RECOVERABILITY_DEGRADED_FOR_EVERYTHING_USER_MENU_TITLE); + case sync_ui_util::SETTINGS_UNCONFIRMED_ERROR: + case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: + case sync_ui_util::UNRECOVERABLE_ERROR: + case sync_ui_util::UPGRADE_CLIENT_ERROR: + case sync_ui_util::PASSPHRASE_ERROR: + case sync_ui_util::TRUSTED_VAULT_KEY_MISSING_FOR_EVERYTHING_ERROR: + return l10n_util::GetStringUTF16(IDS_SYNC_ERROR_USER_MENU_TITLE); + } +} + ProfileAttributesEntry* GetProfileAttributesEntry(Profile* profile) { ProfileAttributesEntry* entry = g_browser_process->profile_manager() @@ -223,7 +221,6 @@ gfx::ImageSkia ProfileMenuView::GetSyncIcon() const { Profile* profile = browser()->profile(); - if (profile->IsOffTheRecord()) return gfx::ImageSkia(); @@ -232,34 +229,20 @@ return ColoredImageForMenu(kSyncPausedCircleIcon, gfx::kGoogleGrey500); } - const gfx::VectorIcon* icon = nullptr; - ui::NativeTheme::ColorId color_id; - switch (sync_ui_util::GetAvatarSyncErrorType(profile)) { - case sync_ui_util::NO_SYNC_ERROR: - icon = &kSyncCircleIcon; - color_id = ui::NativeTheme::kColorId_AlertSeverityLow; - break; - case sync_ui_util::AUTH_ERROR: - icon = &kSyncPausedCircleIcon; - color_id = ui::NativeTheme::kColorId_ProminentButtonColor; - break; - case sync_ui_util::MANAGED_USER_UNRECOVERABLE_ERROR: - case sync_ui_util::UNRECOVERABLE_ERROR: - case sync_ui_util::UPGRADE_CLIENT_ERROR: - case sync_ui_util::PASSPHRASE_ERROR: - case sync_ui_util::TRUSTED_VAULT_KEY_MISSING_FOR_EVERYTHING_ERROR: - case sync_ui_util::TRUSTED_VAULT_KEY_MISSING_FOR_PASSWORDS_ERROR: - case sync_ui_util:: - TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_EVERYTHING_ERROR: - case sync_ui_util:: - TRUSTED_VAULT_RECOVERABILITY_DEGRADED_FOR_PASSWORDS_ERROR: - case sync_ui_util::SETTINGS_UNCONFIRMED_ERROR: - icon = &kSyncPausedCircleIcon; - color_id = ui::NativeTheme::kColorId_AlertSeverityHigh; - break; + absl::optional<sync_ui_util::AvatarSyncErrorType> error = + sync_ui_util::GetAvatarSyncErrorType(profile); + if (!error) { + return ColoredImageForMenu(kSyncCircleIcon, + GetNativeTheme()->GetSystemColor( + ui::NativeTheme::kColorId_AlertSeverityLow)); } - const SkColor image_color = GetNativeTheme()->GetSystemColor(color_id); - return ColoredImageForMenu(*icon, image_color); + + ui::NativeTheme::ColorId color_id = + error == sync_ui_util::AUTH_ERROR + ? ui::NativeTheme::kColorId_ProminentButtonColor + : ui::NativeTheme::kColorId_AlertSeverityHigh; + return ColoredImageForMenu(kSyncPausedCircleIcon, + GetNativeTheme()->GetSystemColor(color_id)); } std::u16string ProfileMenuView::GetAccessibleWindowTitle() const { @@ -391,9 +374,6 @@ case sync_ui_util::SETTINGS_UNCONFIRMED_ERROR: chrome::ShowSettingsSubPage(browser(), chrome::kSyncSetupSubPage); break; - case sync_ui_util::NO_SYNC_ERROR: - NOTREACHED(); - break; } #endif } @@ -578,20 +558,22 @@ if (identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSync)) { // Show sync state. - const sync_ui_util::AvatarSyncErrorType error = + const absl::optional<sync_ui_util::AvatarSyncErrorType> error = sync_ui_util::GetAvatarSyncErrorType(browser()->profile()); - - if (error == sync_ui_util::NO_SYNC_ERROR) { + if (error) { + BuildSyncInfoWithCallToAction( + GetSyncErrorDescription(*error), GetSyncErrorButtonText(*error), + error == sync_ui_util::AUTH_ERROR + ? ui::NativeTheme::kColorId_SyncInfoContainerPaused + : ui::NativeTheme::kColorId_SyncInfoContainerError, + base::BindRepeating(&ProfileMenuView::OnSyncErrorButtonClicked, + base::Unretained(this), *error), + /*show_badge=*/true); + } else { BuildSyncInfoWithoutCallToAction( - IDS_PROFILES_OPEN_SYNC_SETTINGS_BUTTON, + l10n_util::GetStringUTF16(IDS_PROFILES_OPEN_SYNC_SETTINGS_BUTTON), base::BindRepeating(&ProfileMenuView::OnSyncSettingsButtonClicked, base::Unretained(this))); - } else { - BuildSyncInfoWithCallToAction( - GetSyncInfoForAvatarErrorType(error), - base::BindRepeating(&ProfileMenuView::OnSyncErrorButtonClicked, - base::Unretained(this), error), - /*show_badge=*/true); } return; } @@ -605,8 +587,9 @@ if (account_info.has_value()) { BuildSyncInfoWithCallToAction( - {IDS_PROFILES_DICE_NOT_SYNCING_TITLE, IDS_PROFILES_DICE_SIGNIN_BUTTON, - SyncInfoContainerBackgroundState::kNoPrimaryAccount}, + l10n_util::GetStringUTF16(IDS_PROFILES_DICE_NOT_SYNCING_TITLE), + l10n_util::GetStringUTF16(IDS_PROFILES_DICE_SIGNIN_BUTTON), + ui::NativeTheme::kColorId_SyncInfoContainerNoPrimaryAccount, base::BindRepeating(&ProfileMenuView::OnSigninAccountButtonClicked, base::Unretained(this), account_info.value()), /*show_badge=*/true); @@ -616,8 +599,9 @@ NOTREACHED(); #else BuildSyncInfoWithCallToAction( - {IDS_PROFILES_DICE_SYNC_PROMO, IDS_PROFILES_DICE_SIGNIN_BUTTON, - SyncInfoContainerBackgroundState::kNoPrimaryAccount}, + l10n_util::GetStringUTF16(IDS_PROFILES_DICE_SYNC_PROMO), + l10n_util::GetStringUTF16(IDS_PROFILES_DICE_SIGNIN_BUTTON), + ui::NativeTheme::kColorId_SyncInfoContainerNoPrimaryAccount, base::BindRepeating(&ProfileMenuView::OnSigninButtonClicked, base::Unretained(this)), /*show_badge=*/false);
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc index e323882..905c775 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_base.cc +++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.cc
@@ -683,13 +683,11 @@ } void ProfileMenuViewBase::BuildSyncInfoWithCallToAction( - const SyncInfo& sync_info, + const std::u16string& description, + const std::u16string& button_text, + ui::NativeTheme::ColorId background_color_id, const base::RepeatingClosure& action, bool show_badge) { - const std::u16string description = - l10n_util::GetStringUTF16(sync_info.description_string_id); - const std::u16string clickable_text = - l10n_util::GetStringUTF16(sync_info.button_string_id); const int kDescriptionIconSpacing = ChromeLayoutProvider::Get()->GetDistanceMetric( views::DISTANCE_RELATED_LABEL_HORIZONTAL); @@ -755,23 +753,23 @@ sync_info_container_->AddChildView(std::make_unique<views::MdTextButton>( base::BindRepeating(&ProfileMenuViewBase::ButtonPressed, base::Unretained(this), std::move(action)), - clickable_text)); + button_text)); button->SetProminent(true); sync_info_background_callback_ = base::BindRepeating( &ProfileMenuViewBase::BuildSyncInfoCallToActionBackground, - base::Unretained(this), sync_info.background_state); + base::Unretained(this), background_color_id); } void ProfileMenuViewBase::BuildSyncInfoWithoutCallToAction( - int text_string_id, + const std::u16string& text, const base::RepeatingClosure& action) { sync_info_container_->RemoveAllChildViews(/*delete_children=*/true); sync_info_container_->SetLayoutManager(std::make_unique<views::FillLayout>()); sync_info_container_->AddChildView(std::make_unique<SyncButton>( base::BindRepeating(&ProfileMenuViewBase::ButtonPressed, base::Unretained(this), std::move(action)), - this, l10n_util::GetStringUTF16(text_string_id))); + this, text)); // No background required, so ui::NativeTheme isn't needed and // |sync_info_background_callback_| can be set to base::DoNothing(). @@ -1029,23 +1027,12 @@ } void ProfileMenuViewBase::BuildSyncInfoCallToActionBackground( - SyncInfoContainerBackgroundState background_state, + ui::NativeTheme::ColorId background_color_id, ui::NativeTheme* native_theme) { - ui::NativeTheme::ColorId bg_color; - switch (background_state) { - case SyncInfoContainerBackgroundState::kPaused: - bg_color = ui::NativeTheme::kColorId_SyncInfoContainerPaused; - break; - case SyncInfoContainerBackgroundState::kError: - bg_color = ui::NativeTheme::kColorId_SyncInfoContainerError; - break; - case SyncInfoContainerBackgroundState::kNoPrimaryAccount: - bg_color = ui::NativeTheme::kColorId_SyncInfoContainerNoPrimaryAccount; - } const int radius = views::LayoutProvider::Get()->GetCornerRadiusMetric( views::Emphasis::kHigh); sync_info_container_->SetBackground(views::CreateRoundedRectBackground( - native_theme->GetSystemColor(bg_color), radius)); + native_theme->GetSystemColor(background_color_id), radius)); sync_info_container_->SetBorder(views::CreatePaddedBorder( views::CreateRoundedRectBorder( 1, radius,
diff --git a/chrome/browser/ui/views/profiles/profile_menu_view_base.h b/chrome/browser/ui/views/profiles/profile_menu_view_base.h index 154e2bb7..a70cd56 100644 --- a/chrome/browser/ui/views/profiles/profile_menu_view_base.h +++ b/chrome/browser/ui/views/profiles/profile_menu_view_base.h
@@ -9,6 +9,7 @@ #include <map> #include <memory> +#include <string> #include <vector> #include "base/macros.h" @@ -66,21 +67,6 @@ kMaxValue = kCreateIncognitoShortcutButton, }; - // TODO(crbug.com/1191411): Remove this enum and plumb the color ids directly. - enum class SyncInfoContainerBackgroundState { - kPaused, - kError, - kNoPrimaryAccount, - }; - - // TODO(crbug.com/1191411): Dismantle this struct, it doesn't cover all sync - // info cases. - struct SyncInfo { - int description_string_id; - int button_string_id; - SyncInfoContainerBackgroundState background_state; - }; - struct EditButtonParams { EditButtonParams(const gfx::VectorIcon* edit_icon, const std::u16string& edit_tooltip_text, @@ -136,13 +122,15 @@ const ui::ThemedVectorIcon& avatar_header_art = ui::ThemedVectorIcon()); // Displays the sync info section as a rounded rectangle with text on top and // a button on the bottom. Clicking the button triggers |action|. - // |sync_info.background_state| determines the rectangle's background color. - void BuildSyncInfoWithCallToAction(const SyncInfo& sync_info, - const base::RepeatingClosure& action, - bool show_badge); + void BuildSyncInfoWithCallToAction( + const std::u16string& description, + const std::u16string& button_text, + ui::NativeTheme::ColorId background_color_id, + const base::RepeatingClosure& action, + bool show_badge); // Displays the sync info section as a rectangle with text. Clicking the // rectangle triggers |action|. - void BuildSyncInfoWithoutCallToAction(int text_string_id, + void BuildSyncInfoWithoutCallToAction(const std::u16string& text, const base::RepeatingClosure& action); void AddShortcutFeatureButton(const gfx::VectorIcon& icon, const std::u16string& text, @@ -193,7 +181,7 @@ void FocusButtonOnKeyboardOpen(); void BuildSyncInfoCallToActionBackground( - SyncInfoContainerBackgroundState background_state, + ui::NativeTheme::ColorId background_color_id, ui::NativeTheme* native_theme); // views::BubbleDialogDelegateView:
diff --git a/chrome/browser/ui/views/profiles/profile_picker_test_base.cc b/chrome/browser/ui/views/profiles/profile_picker_test_base.cc index f006731e..d41d24f 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_test_base.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_test_base.cc
@@ -157,6 +157,12 @@ ASSERT_FALSE(ProfilePicker::IsOpen()); } +void ProfilePickerTestBase::WaitForPickerClosedAndReopenedImmediately() { + ASSERT_TRUE(ProfilePicker::IsOpen()); + ViewDeletedWaiter(view()).Wait(); + EXPECT_TRUE(ProfilePicker::IsOpen()); +} + content::WebContents* ProfilePickerTestBase::web_contents() { if (!web_view()) return nullptr;
diff --git a/chrome/browser/ui/views/profiles/profile_picker_test_base.h b/chrome/browser/ui/views/profiles/profile_picker_test_base.h index 07a8eef6..31c7562 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_test_base.h +++ b/chrome/browser/ui/views/profiles/profile_picker_test_base.h
@@ -44,6 +44,7 @@ // Waits until the picker gets closed. void WaitForPickerClosed(); + void WaitForPickerClosedAndReopenedImmediately(); // Gets the picker's web contents. content::WebContents* web_contents();
diff --git a/chrome/browser/ui/views/profiles/profile_picker_view.cc b/chrome/browser/ui/views/profiles/profile_picker_view.cc index 2b9919b..5781279 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_view.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_view.cc
@@ -421,8 +421,12 @@ } void ProfilePickerView::Clear() { + if (state_ == kClosing) + return; + if (state_ == kReady) { GetWidget()->Close(); + state_ = kClosing; return; } @@ -515,6 +519,12 @@ if (state_ == kInitializing) return; + if (state_ == kClosing) { + if (!restart_with_entry_point_on_window_closing_.has_value()) + restart_with_entry_point_on_window_closing_ = entry_point; + return; + } + GetWidget()->Activate(); } @@ -665,6 +675,12 @@ // may have already opened a new instance). if (g_profile_picker_view == this) g_profile_picker_view = nullptr; + + // Show a new profile window if it has been requested while the current window + // was closing. + if (state_ == kClosing && restart_with_entry_point_on_window_closing_) { + ProfilePicker::Show(*restart_with_entry_point_on_window_closing_); + } } views::ClientView* ProfilePickerView::CreateClientView(views::Widget* widget) {
diff --git a/chrome/browser/ui/views/profiles/profile_picker_view.h b/chrome/browser/ui/views/profiles/profile_picker_view.h index b2583e2..82ef392 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_view.h +++ b/chrome/browser/ui/views/profiles/profile_picker_view.h
@@ -16,6 +16,7 @@ #include "chrome/browser/ui/webui/signin/enterprise_profile_welcome_ui.h" #include "components/keep_alive_registry/scoped_keep_alive.h" #include "components/signin/public/identity_manager/identity_manager.h" +#include "third_party/abseil-cpp/absl/types/optional.h" #include "ui/base/metadata/metadata_header_macros.h" #include "ui/views/controls/webview/unhandled_keyboard_event_handler.h" #include "ui/views/controls/webview/webview.h" @@ -98,7 +99,7 @@ ProfilePickerView(); ~ProfilePickerView() override; - enum State { kNotStarted = 0, kInitializing = 1, kReady = 2 }; + enum State { kNotStarted = 0, kInitializing = 1, kReady = 2, kClosing = 3 }; class NavigationFinishedObserver : public content::WebContentsObserver { public: @@ -201,6 +202,8 @@ ProfilePicker::EntryPoint entry_point_ = ProfilePicker::EntryPoint::kOnStartup; State state_ = State::kNotStarted; + absl::optional<ProfilePicker::EntryPoint> + restart_with_entry_point_on_window_closing_; // A mapping between accelerators and command IDs. std::map<ui::Accelerator, int> accelerator_table_;
diff --git a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc index e8a3f50..642eb37 100644 --- a/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc +++ b/chrome/browser/ui/views/profiles/profile_picker_view_browsertest.cc
@@ -740,6 +740,33 @@ StartSigninFlow(); } +IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, + OpenPickerAndClose) { + ProfilePicker::Show(ProfilePicker::EntryPoint::kProfileMenuManageProfiles); + WaitForLayoutWithoutToolbar(); + EXPECT_TRUE(ProfilePicker::IsOpen()); + ProfilePicker::Hide(); + WaitForPickerClosed(); +} + +// Regression test for https://crbug.com/1205147. +IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, + OpenPickerWhileClosing) { + // Open the first picker. + ProfilePicker::Show(ProfilePicker::EntryPoint::kProfileMenuManageProfiles); + WaitForLayoutWithoutToolbar(); + EXPECT_TRUE(ProfilePicker::IsOpen()); + + // Request to open the second picker window while the first one is still + // closing. + ProfilePicker::Hide(); + ProfilePicker::Show(ProfilePicker::EntryPoint::kProfileLocked); + + // The first picker should be closed and the second picker should be + // displayed. + WaitForPickerClosedAndReopenedImmediately(); +} + IN_PROC_BROWSER_TEST_F(ProfilePickerCreationFlowBrowserTest, OpenProfile) { AvatarToolbarButton::SetIPHMinDelayAfterCreationForTesting( base::TimeDelta::FromSeconds(0));
diff --git a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model_unittest.cc b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model_unittest.cc index 047f4d9..963d0f2 100644 --- a/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model_unittest.cc +++ b/chrome/browser/ui/views/toolbar/chrome_labs_bubble_view_model_unittest.cc
@@ -18,7 +18,8 @@ // Trim common separator character used in about_flags char kSeparators[] = "-"; base::RemoveChars(original_string, kSeparators, &new_string); - return ToLowerASCII(TrimWhitespaceASCII(new_string, base::TRIM_ALL)); + return base::ToLowerASCII( + base::TrimWhitespaceASCII(new_string, base::TRIM_ALL)); } } // namespace
diff --git a/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h b/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h index 1a02c57..7168b2b 100644 --- a/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h +++ b/chrome/browser/ui/views/touch_selection_menu_runner_chromeos.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_VIEWS_TOUCH_SELECTION_MENU_RUNNER_CHROMEOS_H_ #include <memory> -#include <string> #include <vector> #include "components/arc/mojom/intent_helper.mojom-forward.h"
diff --git a/chrome/browser/ui/views/web_apps/web_app_protocol_handler_intent_picker_dialog_view.h b/chrome/browser/ui/views/web_apps/web_app_protocol_handler_intent_picker_dialog_view.h index c5116d9..8f634fc 100644 --- a/chrome/browser/ui/views/web_apps/web_app_protocol_handler_intent_picker_dialog_view.h +++ b/chrome/browser/ui/views/web_apps/web_app_protocol_handler_intent_picker_dialog_view.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_VIEWS_WEB_APPS_WEB_APP_PROTOCOL_HANDLER_INTENT_PICKER_DIALOG_VIEW_H_ #include <memory> -#include <string> #include <vector> #include "base/callback_forward.h"
diff --git a/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_view.h b/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_view.h index 28d3e32a..cf7d0fa 100644 --- a/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_view.h +++ b/chrome/browser/ui/views/web_apps/web_app_uninstall_dialog_view.h
@@ -7,7 +7,6 @@ #include <map> #include <memory> -#include <string> #include "base/callback.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/ui/views/webauthn/authenticator_request_sheet_view.h b/chrome/browser/ui/views/webauthn/authenticator_request_sheet_view.h index 8028933..4abe6282 100644 --- a/chrome/browser/ui/views/webauthn/authenticator_request_sheet_view.h +++ b/chrome/browser/ui/views/webauthn/authenticator_request_sheet_view.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_VIEWS_WEBAUTHN_AUTHENTICATOR_REQUEST_SHEET_VIEW_H_ #include <memory> -#include <string> #include <utility> #include "base/macros.h"
diff --git a/chrome/browser/ui/views/webid/webid_signin_page_view.h b/chrome/browser/ui/views/webid/webid_signin_page_view.h index 50b2515..b37d1949 100644 --- a/chrome/browser/ui/views/webid/webid_signin_page_view.h +++ b/chrome/browser/ui/views/webid/webid_signin_page_view.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UI_VIEWS_WEBID_WEBID_SIGNIN_PAGE_VIEW_H_ #include <memory> -#include <string> #include "base/callback.h" #include "chrome/browser/ui/views/webid/webid_dialog_views.h"
diff --git a/chrome/browser/ui/web_applications/app_browser_controller.cc b/chrome/browser/ui/web_applications/app_browser_controller.cc index e9a68d2..1a7ae7202 100644 --- a/chrome/browser/ui/web_applications/app_browser_controller.cc +++ b/chrome/browser/ui/web_applications/app_browser_controller.cc
@@ -105,11 +105,9 @@ std::unique_ptr<AppBrowserController> controller; #if BUILDFLAG(ENABLE_EXTENSIONS) const AppId app_id = GetAppIdFromApplicationName(browser->app_name()); - if (base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)) { - auto* provider = WebAppProvider::Get(browser->profile()); - if (provider && provider->registrar().IsInstalled(app_id)) - controller = std::make_unique<WebAppBrowserController>(browser); - } + auto* provider = WebAppProvider::Get(browser->profile()); + if (provider && provider->registrar().IsInstalled(app_id)) + controller = std::make_unique<WebAppBrowserController>(browser); if (!controller) { const extensions::Extension* extension = extensions::ExtensionRegistry::Get(browser->profile())
diff --git a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc index 3a0278ee..e8ea66e3 100644 --- a/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/welcome_screen_handler.cc
@@ -8,6 +8,7 @@ #include <utility> +#include "ash/constants/ash_switches.h" #include "base/bind.h" #include "base/callback_helpers.h" #include "base/command_line.h" @@ -30,6 +31,7 @@ #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" #include "chrome/browser/ui/webui/chromeos/login/reset_screen_handler.h" #include "chrome/common/pref_names.h" +#include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" #include "chromeos/dbus/constants/dbus_switches.h" #include "components/login/localized_values_builder.h" @@ -146,6 +148,7 @@ } builder->Add("welcomeScreenGetStarted", IDS_LOGIN_GET_STARTED); + builder->Add("welcomeScreenOsInstall", IDS_OOBE_WELCOME_START_OS_INSTALL); // MD-OOBE (oobe-welcome-element) builder->Add("debuggingFeaturesLink", IDS_WELCOME_ENABLE_DEV_FEATURES_LINK); @@ -291,6 +294,10 @@ dict->Set("timezoneList", GetTimezoneList()); dict->Set("demoModeCountryList", base::Value::ToUniquePtrValue(DemoSession::GetCountryList())); + + // This switch is set by the session manager if the OS install + // service is enabled and the OS is running from a USB installer. + dict->SetKey("osInstallEnabled", base::Value(switches::IsOsInstallAllowed())); } void WelcomeScreenHandler::Initialize() {
diff --git a/chrome/browser/ui/webui/feed_internals/feedv2_internals_page_handler.h b/chrome/browser/ui/webui/feed_internals/feedv2_internals_page_handler.h index 66fccf9..b31f6069 100644 --- a/chrome/browser/ui/webui/feed_internals/feedv2_internals_page_handler.h +++ b/chrome/browser/ui/webui/feed_internals/feedv2_internals_page_handler.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_UI_WEBUI_FEED_INTERNALS_FEEDV2_INTERNALS_PAGE_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_FEED_INTERNALS_FEEDV2_INTERNALS_PAGE_HANDLER_H_ -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/browser/ui/webui/internals/web_app/web_app_internals_page_handler_impl.cc b/chrome/browser/ui/webui/internals/web_app/web_app_internals_page_handler_impl.cc index 503faf09..1f4dbcaa 100644 --- a/chrome/browser/ui/webui/internals/web_app/web_app_internals_page_handler_impl.cc +++ b/chrome/browser/ui/webui/internals/web_app/web_app_internals_page_handler_impl.cc
@@ -46,8 +46,7 @@ void WebAppInternalsPageHandlerImpl::IsBmoEnabled( IsBmoEnabledCallback callback) { - std::move(callback).Run( - base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)); + std::move(callback).Run(true); } void WebAppInternalsPageHandlerImpl::GetWebApps(GetWebAppsCallback callback) {
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc index 622e704..7329a78d 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.cc +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.cc
@@ -161,10 +161,6 @@ info->SetBoolean(kPackagedAppKey, false); } -bool DesktopPWAsWithoutExtensions() { - return base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions); -} - bool HasMatchingOrGreaterThanIcon(const SortedSizesPx& downloaded_icon_sizes, int pixels) { if (downloaded_icon_sizes.empty()) @@ -1265,8 +1261,7 @@ if (!extension_id_prompting_.empty()) return; // Only one prompt at a time. - if (DesktopPWAsWithoutExtensions() && - web_app_provider_->registrar().IsInstalled(extension_id_prompting_)) { + if (web_app_provider_->registrar().IsInstalled(extension_id_prompting_)) { NOTIMPLEMENTED(); return; } @@ -1312,8 +1307,7 @@ void AppLauncherHandler::ExtensionEnableFlowAborted(bool user_initiated) { DCHECK_EQ(extension_id_prompting_, extension_enable_flow_->extension_id()); - if (DesktopPWAsWithoutExtensions() && - web_app_provider_->registrar().IsInstalled(extension_id_prompting_)) { + if (web_app_provider_->registrar().IsInstalled(extension_id_prompting_)) { NOTIMPLEMENTED(); return; }
diff --git a/chrome/browser/ui/webui/ntp/app_launcher_handler.h b/chrome/browser/ui/webui/ntp/app_launcher_handler.h index fe3704b..c9d5ded 100644 --- a/chrome/browser/ui/webui/ntp/app_launcher_handler.h +++ b/chrome/browser/ui/webui/ntp/app_launcher_handler.h
@@ -225,8 +225,7 @@ extensions::ExtensionService* const extension_service_; // The apps are represented in the web apps model, which outlives us since - // it's owned by our containing profile. Populated iff - // features::kDesktopPWAsWithoutExtensions is enabled. + // it's owned by our containing profile. web_app::WebAppProvider* const web_app_provider_; base::ScopedObservation<web_app::AppRegistrar, web_app::AppRegistrarObserver>
diff --git a/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h b/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h index ade2cb2..fd8ac40 100644 --- a/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h +++ b/chrome/browser/ui/webui/settings/chromeos/account_manager_handler.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ACCOUNT_MANAGER_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_ACCOUNT_MANAGER_HANDLER_H_ -#include <string> #include <vector> #include "ash/components/account_manager/account_manager.h"
diff --git a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h index 817a37f..922fed54 100644 --- a/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h +++ b/chrome/browser/ui/webui/settings/chromeos/calculator/size_calculator.h
@@ -8,7 +8,6 @@ #include <array> #include <bitset> #include <memory> -#include <string> #include <vector> #include "base/files/file_util.h"
diff --git a/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h b/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h index 80d8ab9f..de7ceae6 100644 --- a/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h +++ b/chrome/browser/ui/webui/settings/chromeos/device_power_handler.h
@@ -7,7 +7,6 @@ #include <memory> #include <set> -#include <string> #include "base/macros.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/browser/updates/announcement_notification/announcement_notification_service.h b/chrome/browser/updates/announcement_notification/announcement_notification_service.h index a093b8a..b8fd1bcd 100644 --- a/chrome/browser/updates/announcement_notification/announcement_notification_service.h +++ b/chrome/browser/updates/announcement_notification/announcement_notification_service.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UPDATES_ANNOUNCEMENT_NOTIFICATION_ANNOUNCEMENT_NOTIFICATION_SERVICE_H_ #include <memory> -#include <string> #include "base/feature_list.h" #include "base/macros.h"
diff --git a/chrome/browser/updates/update_notification_config.h b/chrome/browser/updates/update_notification_config.h index 0d35988..9bee5fa5 100644 --- a/chrome/browser/updates/update_notification_config.h +++ b/chrome/browser/updates/update_notification_config.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_UPDATES_UPDATE_NOTIFICATION_CONFIG_H_ #include <memory> -#include <string> #include <utility> #include "base/macros.h"
diff --git a/chrome/browser/web_applications/README.md b/chrome/browser/web_applications/README.md index a3511fc..9a4d9cf 100644 --- a/chrome/browser/web_applications/README.md +++ b/chrome/browser/web_applications/README.md
@@ -152,11 +152,7 @@ `Extension`s and in that mode there were no `WebApp`s; instead everything was stored on an `Extension`. See `WebAppRegistrar`'s sibling [`BookmarkAppRegistrar`](extensions/bookmark_app_registrar.h) for that -implementation. Since the backing object was decided based on the feature flag -`kDesktopPWAsWithoutExtensions` the rest of the logic had to go through a -generic interface [`AppRegistrar`](components/app_registrar.h) with a separate -getter for each field. -Note that the Extensions based implementation is obsolete and needs cleaning up. +implementation. ### [`WebAppInstallManager`](web_app_install_manager.h)
diff --git a/chrome/browser/web_applications/components/externally_installed_web_app_prefs.h b/chrome/browser/web_applications/components/externally_installed_web_app_prefs.h index 597547b9..900d633 100644 --- a/chrome/browser/web_applications/components/externally_installed_web_app_prefs.h +++ b/chrome/browser/web_applications/components/externally_installed_web_app_prefs.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_EXTERNALLY_INSTALLED_WEB_APP_PREFS_H_ #include <map> -#include <string> #include "chrome/browser/web_applications/components/web_app_constants.h" #include "chrome/browser/web_applications/components/web_app_id.h"
diff --git a/chrome/browser/web_applications/components/externally_managed_app_manager.h b/chrome/browser/web_applications/components/externally_managed_app_manager.h index c6d19a9..ce09b75f 100644 --- a/chrome/browser/web_applications/components/externally_managed_app_manager.h +++ b/chrome/browser/web_applications/components/externally_managed_app_manager.h
@@ -8,7 +8,6 @@ #include <map> #include <memory> #include <ostream> -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/browser/web_applications/components/file_handler_manager.h b/chrome/browser/web_applications/components/file_handler_manager.h index 614f902..c0e69a27 100644 --- a/chrome/browser/web_applications/components/file_handler_manager.h +++ b/chrome/browser/web_applications/components/file_handler_manager.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_FILE_HANDLER_MANAGER_H_ #include <set> -#include <string> #include <vector> #include "chrome/browser/web_applications/components/app_registrar.h"
diff --git a/chrome/browser/web_applications/components/url_handler_prefs.h b/chrome/browser/web_applications/components/url_handler_prefs.h index 5ab0c343..156c4606 100644 --- a/chrome/browser/web_applications/components/url_handler_prefs.h +++ b/chrome/browser/web_applications/components/url_handler_prefs.h
@@ -5,7 +5,6 @@ #ifndef CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_URL_HANDLER_PREFS_H_ #define CHROME_BROWSER_WEB_APPLICATIONS_COMPONENTS_URL_HANDLER_PREFS_H_ -#include <string> #include <vector> #include "base/time/time.h"
diff --git a/chrome/browser/web_applications/extensions/bookmark_app_provider.cc b/chrome/browser/web_applications/extensions/bookmark_app_provider.cc index bf1165aa..2858fff4 100644 --- a/chrome/browser/web_applications/extensions/bookmark_app_provider.cc +++ b/chrome/browser/web_applications/extensions/bookmark_app_provider.cc
@@ -5,12 +5,6 @@ #include <utility> #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_file_handler_manager.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_icon_manager.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_install_finalizer.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_registrar.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_registry_controller.h" -#include "chrome/browser/web_applications/extensions/bookmark_app_shortcut_manager.h" #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/web_applications/web_app_provider_factory.h" #include "extensions/browser/extension_system.h" @@ -19,30 +13,6 @@ namespace web_app { -void WebAppProvider::CreateBookmarkAppsSubsystems(Profile* profile) { - std::unique_ptr<extensions::BookmarkAppRegistrar> registrar = - std::make_unique<extensions::BookmarkAppRegistrar>(profile); - std::unique_ptr<extensions::BookmarkAppRegistryController> - registry_controller = - std::make_unique<extensions::BookmarkAppRegistryController>( - profile, registrar.get()); - icon_manager_ = std::make_unique<extensions::BookmarkAppIconManager>(profile); - install_finalizer_ = - std::make_unique<extensions::BookmarkAppInstallFinalizer>(profile); - - auto file_handler_manager = - std::make_unique<extensions::BookmarkAppFileHandlerManager>(profile); - auto shortcut_manager = - std::make_unique<extensions::BookmarkAppShortcutManager>(profile); - os_integration_manager_ = std::make_unique<OsIntegrationManager>( - profile, std::move(shortcut_manager), std::move(file_handler_manager), - /*protocol_handler_manager*/ nullptr, /*url_handler_manager*/ nullptr); - - // Upcast to unified subsystem types: - registrar_ = std::move(registrar); - registry_controller_ = std::move(registry_controller); -} - void WebAppProvider::WaitForExtensionSystemReady() { extensions::ExtensionSystem::Get(profile_)->ready().Post( FROM_HERE, base::BindOnce(&WebAppProvider::OnExtensionSystemReady,
diff --git a/chrome/browser/web_applications/externally_managed_app_manager_impl.h b/chrome/browser/web_applications/externally_managed_app_manager_impl.h index a244578..8af2ee5f 100644 --- a/chrome/browser/web_applications/externally_managed_app_manager_impl.h +++ b/chrome/browser/web_applications/externally_managed_app_manager_impl.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_WEB_APPLICATIONS_EXTERNALLY_MANAGED_APP_MANAGER_IMPL_H_ #include <memory> -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc index e8af8ad..f52ba76 100644 --- a/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc +++ b/chrome/browser/web_applications/system_web_apps/test/system_web_app_manager_browsertest.cc
@@ -1110,71 +1110,6 @@ #endif // BUILDFLAG(IS_CHROMEOS_ASH) -// Tests that SWA-specific data is correctly migrated to Web Apps without -// Extensions. -class SystemWebAppManagerMigrationTest : public SystemWebAppBrowserTestBase { - public: - SystemWebAppManagerMigrationTest() - : SystemWebAppBrowserTestBase(/*install_mock=*/false) { - maybe_installation_ = - TestSystemWebAppInstallation::SetUpAppWithAdditionalSearchTerms(); - maybe_installation_->set_update_policy( - SystemWebAppManager::UpdatePolicy::kOnVersionChange); - - if (content::IsPreTest()) { - scoped_feature_list_.InitAndDisableFeature( - features::kDesktopPWAsWithoutExtensions); - } else { - scoped_feature_list_.InitAndEnableFeature( - features::kDesktopPWAsWithoutExtensions); - } - } - ~SystemWebAppManagerMigrationTest() override = default; - - private: - base::test::ScopedFeatureList scoped_feature_list_; -}; - -// These tests use the App Service which is only enabled on Chrome OS. -// TODO(crbug.com/1201318): Re-enable this test on Chrome OS. -IN_PROC_BROWSER_TEST_F(SystemWebAppManagerMigrationTest, - DISABLED_PRE_ExtraDataIsMigrated) { - WaitForTestSystemAppInstall(); - AppId app_id = GetManager().GetAppIdForSystemApp(GetMockAppType()).value(); - - const bool app_found = - GetAppServiceProxy(browser()->profile()) - ->AppRegistryCache() - .ForOneApp(app_id, [](const apps::AppUpdate& update) { - EXPECT_EQ(std::vector<std::string>({"Security"}), - update.AdditionalSearchTerms()); - EXPECT_EQ(apps::mojom::OptionalBool::kFalse, - update.ShowInManagement()); - }); - ASSERT_TRUE(app_found); -} - -// These tests use the App Service which is only enabled on Chrome OS. -#if BUILDFLAG(IS_CHROMEOS_ASH) -#define MAYBE_ExtraDataIsMigrated ExtraDataIsMigrated -#else -#define MAYBE_ExtraDataIsMigrated DISABLED_ExtraDataIsMigrated -#endif -IN_PROC_BROWSER_TEST_F(SystemWebAppManagerMigrationTest, - MAYBE_ExtraDataIsMigrated) { - WaitForTestSystemAppInstall(); - AppId app_id = GetManager().GetAppIdForSystemApp(GetMockAppType()).value(); - - auto* proxy = GetAppServiceProxy(browser()->profile()); - const bool app_found = proxy->AppRegistryCache().ForOneApp( - app_id, [](const apps::AppUpdate& update) { - EXPECT_EQ(std::vector<std::string>({"Security"}), - update.AdditionalSearchTerms()); - EXPECT_EQ(apps::mojom::OptionalBool::kFalse, update.ShowInManagement()); - }); - ASSERT_TRUE(app_found); -} - class SystemWebAppManagerChromeUntrustedTest : public SystemWebAppManagerBrowserTest { public: @@ -1475,7 +1410,6 @@ EXPECT_FALSE(apps::IconEffects::kBlocked & GetAppIconKey(*settings_id)->icon_effects); } -// This feature will only work when DesktopPWAsWithoutExtensions launches. INSTANTIATE_SYSTEM_WEB_APP_MANAGER_TEST_SUITE_REGULAR_PROFILE_P( SystemWebAppManagerAppSuspensionBrowserTest);
diff --git a/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.h b/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.h index 7128d9a..f57b5ac 100644 --- a/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.h +++ b/chrome/browser/web_applications/system_web_apps/test/test_system_web_app_installation.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_WEB_APPLICATIONS_SYSTEM_WEB_APPS_TEST_TEST_SYSTEM_WEB_APP_INSTALLATION_H_ #include <memory> -#include <string> #include "chrome/browser/web_applications/components/web_application_info.h" #include "chrome/browser/web_applications/system_web_apps/system_web_app_manager.h"
diff --git a/chrome/browser/web_applications/test/test_externally_managed_app_manager.h b/chrome/browser/web_applications/test/test_externally_managed_app_manager.h index 1543d0e..57ec2f44 100644 --- a/chrome/browser/web_applications/test/test_externally_managed_app_manager.h +++ b/chrome/browser/web_applications/test/test_externally_managed_app_manager.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_WEB_APPLICATIONS_TEST_TEST_EXTERNALLY_MANAGED_APP_MANAGER_H_ #include <map> -#include <string> #include <vector> #include "chrome/browser/web_applications/components/externally_managed_app_manager.h"
diff --git a/chrome/browser/web_applications/test/web_app_install_test_utils.cc b/chrome/browser/web_applications/test/web_app_install_test_utils.cc index 4c73452..6c009a64 100644 --- a/chrome/browser/web_applications/test/web_app_install_test_utils.cc +++ b/chrome/browser/web_applications/test/web_app_install_test_utils.cc
@@ -5,7 +5,6 @@ #include "chrome/browser/web_applications/test/web_app_install_test_utils.h" #include "base/command_line.h" -#include "base/feature_list.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "base/test/bind.h" @@ -19,7 +18,6 @@ #include "chrome/browser/web_applications/system_web_apps/test/test_system_web_app_manager.h" #include "chrome/browser/web_applications/test/test_web_app_provider.h" #include "chrome/browser/web_applications/web_app_provider.h" -#include "chrome/common/chrome_features.h" #include "chrome/common/chrome_switches.h" #include "components/webapps/browser/installable/installable_metrics.h" #include "testing/gtest/include/gtest/gtest.h" @@ -57,7 +55,6 @@ AppId InstallDummyWebApp(Profile* profile, const std::string& app_name, const GURL& start_url) { - DCHECK(base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)); const AppId app_id = GenerateAppIdFromURL(start_url); WebApplicationInfo web_app_info;
diff --git a/chrome/browser/web_applications/test/web_app_test_utils.h b/chrome/browser/web_applications/test/web_app_test_utils.h index 5106d1d..b6d07b21 100644 --- a/chrome/browser/web_applications/test/web_app_test_utils.h +++ b/chrome/browser/web_applications/test/web_app_test_utils.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_TEST_UTILS_H_ #include <memory> -#include <string> #include "chrome/browser/web_applications/components/install_manager.h" #include "chrome/browser/web_applications/components/web_app_install_utils.h"
diff --git a/chrome/browser/web_applications/web_app_mover.cc b/chrome/browser/web_applications/web_app_mover.cc index 841a240..5aa654a 100644 --- a/chrome/browser/web_applications/web_app_mover.cc +++ b/chrome/browser/web_applications/web_app_mover.cc
@@ -44,7 +44,6 @@ InstallFinalizer* install_finalizer, InstallManager* install_manager, AppRegistryController* controller) { - DCHECK(base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)); if (g_disabled_for_testing) return nullptr;
diff --git a/chrome/browser/web_applications/web_app_provider.cc b/chrome/browser/web_applications/web_app_provider.cc index a4eff90..07b03d1 100644 --- a/chrome/browser/web_applications/web_app_provider.cc +++ b/chrome/browser/web_applications/web_app_provider.cc
@@ -7,7 +7,6 @@ #include <utility> #include "base/bind.h" -#include "base/feature_list.h" #include "build/build_config.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/web_applications/components/externally_installed_web_app_prefs.h" @@ -37,7 +36,6 @@ #include "chrome/browser/web_applications/web_app_registrar.h" #include "chrome/browser/web_applications/web_app_shortcut_manager.h" #include "chrome/browser/web_applications/web_app_sync_bridge.h" -#include "chrome/common/chrome_features.h" #include "components/pref_registry/pref_registry_syncable.h" #include "content/public/browser/web_contents.h" @@ -78,10 +76,7 @@ CreateCommonSubsystems(profile_); - if (base::FeatureList::IsEnabled(features::kDesktopPWAsWithoutExtensions)) - CreateWebAppsSubsystems(profile_); - else - CreateBookmarkAppsSubsystems(profile_); + CreateWebAppsSubsystems(profile_); } WebAppProvider::~WebAppProvider() = default;
diff --git a/chrome/browser/web_applications/web_app_provider.h b/chrome/browser/web_applications/web_app_provider.h index 412f1fee..594e2ec 100644 --- a/chrome/browser/web_applications/web_app_provider.h +++ b/chrome/browser/web_applications/web_app_provider.h
@@ -110,11 +110,6 @@ // Create extension-independent subsystems. void CreateWebAppsSubsystems(Profile* profile); - // Create legacy extension-based subsystems. - void CreateBookmarkAppsSubsystems(Profile* profile); - std::unique_ptr<InstallFinalizer> CreateBookmarkAppInstallFinalizer( - Profile* profile); - // Wire together subsystems but do not start them (yet). void ConnectSubsystems();
diff --git a/chrome/browser/webauthn/authenticator_request_scheduler.h b/chrome/browser/webauthn/authenticator_request_scheduler.h index b96cf28..b40784b 100644 --- a/chrome/browser/webauthn/authenticator_request_scheduler.h +++ b/chrome/browser/webauthn/authenticator_request_scheduler.h
@@ -6,7 +6,6 @@ #define CHROME_BROWSER_WEBAUTHN_AUTHENTICATOR_REQUEST_SCHEDULER_H_ #include <memory> -#include <string> #include "base/macros.h"
diff --git a/chrome/browser/webauthn/observable_authenticator_list.h b/chrome/browser/webauthn/observable_authenticator_list.h index 526764ca..4b48d1d3 100644 --- a/chrome/browser/webauthn/observable_authenticator_list.h +++ b/chrome/browser/webauthn/observable_authenticator_list.h
@@ -7,7 +7,6 @@ #include <stddef.h> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/build/win32.pgo.txt b/chrome/build/win32.pgo.txt index 10fe3164..e22e1559 100644 --- a/chrome/build/win32.pgo.txt +++ b/chrome/build/win32.pgo.txt
@@ -1 +1 @@ -chrome-win32-master-1621295939-5e3a052a5ca44d71eb09eaecaed845e63fd6b5fb.profdata +chrome-win32-master-1621338723-4b4a10d1ccd4f2a6d2dd12e54a1717fccb7ef5d2.profdata
diff --git a/chrome/build/win64.pgo.txt b/chrome/build/win64.pgo.txt index d6c42a9..a14fed083 100644 --- a/chrome/build/win64.pgo.txt +++ b/chrome/build/win64.pgo.txt
@@ -1 +1 @@ -chrome-win64-master-1621317594-47b478011c6406da2b339aae76448ec925fdf8a5.profdata +chrome-win64-master-1621338723-3bb0eb2008be56ccc36f831b10d82cdcc69d34af.profdata
diff --git a/chrome/chrome_cleaner/components/component_unpacker.h b/chrome/chrome_cleaner/components/component_unpacker.h index a1cbb37..89acfa3f 100644 --- a/chrome/chrome_cleaner/components/component_unpacker.h +++ b/chrome/chrome_cleaner/components/component_unpacker.h
@@ -8,7 +8,6 @@ #include <stdint.h> -#include <string> #include <vector> #include "base/files/file_path.h"
diff --git a/chrome/chrome_cleaner/constants/chrome_cleaner_switches.cc b/chrome/chrome_cleaner/constants/chrome_cleaner_switches.cc index bfd5288..63641037 100644 --- a/chrome/chrome_cleaner/constants/chrome_cleaner_switches.cc +++ b/chrome/chrome_cleaner/constants/chrome_cleaner_switches.cc
@@ -31,6 +31,11 @@ // are properly recorded by crashpad. const char kCrashSwitch[] = "crash"; +// Instead of showing an elevation prompt, proceed as if the user denied the +// elevation. (Do this even if the cleaner is already running elevated, so that +// it behaves the same in unit tests run from elevated command shells.) +const char kDenyElevationForTestingSwitch[] = "deny-elevation-for-testing"; + // Dump the raw logs to a file with the same base name as the executable. The // dumped file is a raw protobuf and has a "pb" extension. // WARNING: this switch is used by internal test systems. Be careful when making
diff --git a/chrome/chrome_cleaner/constants/chrome_cleaner_switches.h b/chrome/chrome_cleaner/constants/chrome_cleaner_switches.h index 48096c9..4b4ce12 100644 --- a/chrome/chrome_cleaner/constants/chrome_cleaner_switches.h +++ b/chrome/chrome_cleaner/constants/chrome_cleaner_switches.h
@@ -14,6 +14,7 @@ extern const char kCleanupIdSwitch[]; extern const char kCrashHandlerSwitch[]; extern const char kCrashSwitch[]; +extern const char kDenyElevationForTestingSwitch[]; extern const char kDumpRawLogsSwitch[]; extern const char kElevatedSwitch[]; extern const char kFileSizeLimitSwitch[];
diff --git a/chrome/chrome_cleaner/engines/broker/engine_client.h b/chrome/chrome_cleaner/engines/broker/engine_client.h index 467c7f5..2e9c0eb 100644 --- a/chrome/chrome_cleaner/engines/broker/engine_client.h +++ b/chrome/chrome_cleaner/engines/broker/engine_client.h
@@ -8,7 +8,6 @@ #include <windows.h> #include <memory> -#include <string> #include <vector> #include "base/callback.h"
diff --git a/chrome/chrome_cleaner/engines/broker/sandbox_setup.h b/chrome/chrome_cleaner/engines/broker/sandbox_setup.h index b4cc248..30139d5 100644 --- a/chrome/chrome_cleaner/engines/broker/sandbox_setup.h +++ b/chrome/chrome_cleaner/engines/broker/sandbox_setup.h
@@ -6,7 +6,6 @@ #define CHROME_CHROME_CLEANER_ENGINES_BROKER_SANDBOX_SETUP_H_ #include <memory> -#include <string> #include <utility> #include "base/callback.h"
diff --git a/chrome/chrome_cleaner/engines/controllers/elevating_facade.cc b/chrome/chrome_cleaner/engines/controllers/elevating_facade.cc index 10471a27..43fb3f3 100644 --- a/chrome/chrome_cleaner/engines/controllers/elevating_facade.cc +++ b/chrome/chrome_cleaner/engines/controllers/elevating_facade.cc
@@ -20,6 +20,7 @@ #include "base/threading/thread_task_runner_handle.h" #include "base/time/time.h" #include "chrome/chrome_cleaner/constants/chrome_cleaner_switches.h" +#include "chrome/chrome_cleaner/logging/logging_service_api.h" #include "chrome/chrome_cleaner/os/disk_util.h" #include "chrome/chrome_cleaner/os/pre_fetched_paths.h" #include "chrome/chrome_cleaner/os/system_util_cleaner.h" @@ -128,17 +129,29 @@ done_callback_ = std::move(done_callback); // Re-launch with administrator privileges. - privileged_process_ = - chrome_cleaner::HasAdminRights() - ? base::LaunchProcess(GetElevatedCommandLine(), - base::LaunchOptions()) - : LaunchElevatedProcessWithAssociatedWindow( - GetElevatedCommandLine(), GetForegroundChromeWindow()); + DCHECK(!privileged_process_.IsValid()); + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( + kDenyElevationForTestingSwitch)) { + privileged_process_ = + chrome_cleaner::HasAdminRights() + ? base::LaunchProcess(GetElevatedCommandLine(), + base::LaunchOptions()) + : LaunchElevatedProcessWithAssociatedWindow( + GetElevatedCommandLine(), GetForegroundChromeWindow()); + } if (!privileged_process_.IsValid()) { ReportDone(RESULT_CODE_ELEVATION_PROMPT_DECLINED); } else { process_started_at_ = base::Time::Now(); + + // The privileged process will take over logs uploading. It's not + // important to clear pending uploads from the registry logger since the + // user is not opting out here - if the privileged process fails, pending + // logs should still be uploaded. + LoggingServiceAPI::GetInstance()->EnableUploads( + false, /*registry_logger=*/nullptr); + CheckDone(); } }
diff --git a/chrome/chrome_cleaner/engines/controllers/scanner_impl.h b/chrome/chrome_cleaner/engines/controllers/scanner_impl.h index d229f0d..7a23139 100644 --- a/chrome/chrome_cleaner/engines/controllers/scanner_impl.h +++ b/chrome/chrome_cleaner/engines/controllers/scanner_impl.h
@@ -6,7 +6,6 @@ #define CHROME_CHROME_CLEANER_ENGINES_CONTROLLERS_SCANNER_IMPL_H_ #include <set> -#include <string> #include "base/sequence_checker.h" #include "base/sequenced_task_runner.h"
diff --git a/chrome/chrome_cleaner/ipc/BUILD.gn b/chrome/chrome_cleaner/ipc/BUILD.gn index b400601..8f52b79 100644 --- a/chrome/chrome_cleaner/ipc/BUILD.gn +++ b/chrome/chrome_cleaner/ipc/BUILD.gn
@@ -87,6 +87,25 @@ ] } +source_set("chrome_prompt_test_util") { + testonly = true + + sources = [ + "chrome_prompt_test_util.cc", + "chrome_prompt_test_util.h", + ] + + deps = [ + ":chrome_prompt_ipc", + "//base", + "//base/test:test_support", + "//components/chrome_cleaner/public/constants", + "//components/chrome_cleaner/public/proto", + "//testing/gmock", + "//testing/gtest", + ] +} + source_set("unittest_sources") { testonly = true @@ -122,20 +141,3 @@ "//testing/gtest", ] } - -source_set("chrome_prompt_test_util") { - testonly = true - - sources = [ - "chrome_prompt_test_util.cc", - "chrome_prompt_test_util.h", - ] - - deps = [ - ":chrome_prompt_ipc", - "//base", - "//components/chrome_cleaner/public/constants", - "//testing/gmock", - "//testing/gtest", - ] -}
diff --git a/chrome/chrome_cleaner/ipc/chrome_prompt_test_util.cc b/chrome/chrome_cleaner/ipc/chrome_prompt_test_util.cc index 03c8f310..ba56fae 100644 --- a/chrome/chrome_cleaner/ipc/chrome_prompt_test_util.cc +++ b/chrome/chrome_cleaner/ipc/chrome_prompt_test_util.cc
@@ -8,18 +8,24 @@ #include <utility> +#include "base/callback_helpers.h" #include "base/check.h" #include "base/logging.h" #include "base/strings/strcat.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "base/test/bind.h" #include "base/unguessable_token.h" #include "base/win/win_util.h" #include "components/chrome_cleaner/public/constants/constants.h" +#include "testing/gtest/include/gtest/gtest.h" namespace chrome_cleaner { using base::win::ScopedHandle; +using ::testing::_; +using ::testing::InvokeWithoutArgs; namespace { @@ -124,6 +130,128 @@ ChromePromptPipeHandles& ChromePromptPipeHandles::operator=( ChromePromptPipeHandles&& other) = default; +MockChromePromptResponder::MockChromePromptResponder( + ChromePromptPipeHandles handles) + : handles_(std::move(handles)) { + // Stop reading immediately on receiving an unhandled mock call, since the + // other end of the pipe may be waiting on a response. + ON_CALL(*this, CloseConnectionRequest()) + .WillByDefault( + InvokeWithoutArgs(this, &MockChromePromptResponder::StopReading)); + ON_CALL(*this, QueryCapabilityRequest()) + .WillByDefault( + InvokeWithoutArgs(this, &MockChromePromptResponder::StopReading)); + ON_CALL(*this, PromptUserRequest(_, _)) + .WillByDefault( + InvokeWithoutArgs(this, &MockChromePromptResponder::StopReading)); +} + +MockChromePromptResponder::~MockChromePromptResponder() = default; + +// This is basically ServiceChromePromptRequests from +// chrome/browser/safe_browsing/chrome_cleaner/chrome_prompt_channel_win.cc +// with assertions instead of error handling. +void MockChromePromptResponder::ReadRequests( + base::WaitableEvent* done_reading_event) { + DCHECK(handles_.IsValid()); + + // Close our copy of the handles that the child reads and writes. They are + // unused in this process. + handles_.request_write_handle.Close(); + handles_.response_read_handle.Close(); + + DCHECK(done_reading_event); + base::ScopedClosureRunner done_reading( + base::BindLambdaForTesting([this, done_reading_event]() { + // Close the parent's handles when exiting the read loop. If the child + // is still running the handles on the other end of the pipe will get + // errors, causing it to exit. If the child exited normally it will + // already have closed its handles so this will be harmless. + handles_.request_read_handle.Close(); + handles_.response_write_handle.Close(); + done_reading_event->Signal(); + })); + + HANDLE read_handle = handles_.request_read_handle.Get(); + + // Read the protocol version handshake. + uint8_t version; + ASSERT_TRUE( + ::ReadFile(read_handle, &version, sizeof(version), nullptr, nullptr)) + << "errno " << ::GetLastError(); + ASSERT_EQ(version, 1); // kVersion from proto_chrome_prompt_ipc.cc + + while (!stop_reading_) { + // Read the length of the next message. + uint32_t message_length; + ASSERT_TRUE(::ReadFile(read_handle, &message_length, sizeof(message_length), + nullptr, nullptr)) + << "errno " << ::GetLastError(); + + // Read the next message. + std::string message; + ASSERT_TRUE(::ReadFile(read_handle, + base::WriteInto(&message, message_length + 1), + message_length, nullptr, nullptr)) + << "errno " << ::GetLastError(); + + // Parse the message into a proto and invoke a mocked function for each + // message type. + ChromePromptRequest request; + ASSERT_TRUE(request.ParseFromString(message)); + switch (request.request_case()) { + case ChromePromptRequest::kCloseConnection: + CloseConnectionRequest(); + break; + case ChromePromptRequest::kQueryCapability: + QueryCapabilityRequest(); + break; + case ChromePromptRequest::kPromptUser: { + ASSERT_TRUE(request.prompt_user().extension_ids().empty()) + << "RemoveExtensions is deprecated and unsupported."; + std::vector<std::string> files_to_delete( + request.prompt_user().files_to_delete().begin(), + request.prompt_user().files_to_delete().end()); + std::vector<std::string> registry_keys( + request.prompt_user().registry_keys().begin(), + request.prompt_user().registry_keys().end()); + PromptUserRequest(files_to_delete, registry_keys); + } break; + case ChromePromptRequest::kRemoveExtensions: + FAIL() << "RemoveExtensions is deprecated and unsupported."; + break; + default: + FAIL() << "Unhandled ChromePromptRequest " << request.request_case(); + break; + } + } +} + +void MockChromePromptResponder::SendQueryCapabilityResponse() { + chrome_cleaner::QueryCapabilityResponse response; + WriteResponseMessage(response); +} + +void MockChromePromptResponder::SendPromptUserResponse( + PromptUserResponse::PromptAcceptance acceptance) { + chrome_cleaner::PromptUserResponse response; + response.set_prompt_acceptance(acceptance); + WriteResponseMessage(response); +} + +void MockChromePromptResponder::WriteResponseMessage( + const google::protobuf::MessageLite& message) { + std::string response_string; + ASSERT_TRUE(message.SerializeToString(&response_string)); + + HANDLE write_handle = handles_.response_write_handle.Get(); + uint32_t message_size = response_string.size(); + ASSERT_TRUE(::WriteFile(write_handle, &message_size, sizeof(uint32_t), + nullptr, nullptr)); + ASSERT_TRUE(::WriteFile(write_handle, response_string.data(), message_size, + nullptr, nullptr)); +} + ChromePromptPipeHandles CreateTestChromePromptMessagePipes( ChromePromptServerProcess server_process, base::CommandLine* command_line,
diff --git a/chrome/chrome_cleaner/ipc/chrome_prompt_test_util.h b/chrome/chrome_cleaner/ipc/chrome_prompt_test_util.h index 8de1e88..02209aa 100644 --- a/chrome/chrome_cleaner/ipc/chrome_prompt_test_util.h +++ b/chrome/chrome_cleaner/ipc/chrome_prompt_test_util.h
@@ -11,8 +11,10 @@ #include "base/command_line.h" #include "base/files/file_path.h" #include "base/process/launch.h" +#include "base/synchronization/waitable_event.h" #include "base/win/scoped_handle.h" #include "chrome/chrome_cleaner/ipc/chrome_prompt_ipc.h" +#include "components/chrome_cleaner/public/proto/chrome_prompt.pb.h" #include "testing/gmock/include/gmock/gmock.h" namespace chrome_cleaner { @@ -70,6 +72,48 @@ base::win::ScopedHandle response_read_handle; }; +// A mock class that can send replies to ChromePrompt requests, faking the +// Chrome side of an IPC connection. This is suitable for high-level tests of +// cleaner and Chrome behaviour. +class MockChromePromptResponder { + public: + explicit MockChromePromptResponder(ChromePromptPipeHandles handles); + ~MockChromePromptResponder(); + + MockChromePromptResponder(const MockChromePromptResponder& other) = delete; + MockChromePromptResponder& operator=(const MockChromePromptResponder& other) = + delete; + + // Enters a loop reading ChromePrompt requests, calling the appropriate + // mock method for each request. When the other end of the pipe closes or + // there is an error this will signal |done_reading_event| and return. It + // will also log a gtest failure for any error. + // + // This must be called after passing the client end of the handles to the + // child side of the IPC connection, because it will close the parent's copy + // of those handles. + void ReadRequests(base::WaitableEvent* done_reading_event); + + // Exits the ReadRequests loop. + void StopReading() { stop_reading_ = true; } + + void SendQueryCapabilityResponse(); + void SendPromptUserResponse(PromptUserResponse::PromptAcceptance acceptance); + + MOCK_METHOD(void, CloseConnectionRequest, ()); + MOCK_METHOD(void, QueryCapabilityRequest, ()); + MOCK_METHOD(void, + PromptUserRequest, + (const std::vector<std::string>& files_to_delete, + const std::vector<std::string>& registry_keys)); + + private: + void WriteResponseMessage(const google::protobuf::MessageLite& message); + + ChromePromptPipeHandles handles_; + bool stop_reading_ = false; +}; + // The parent process (which is generally the test framework) must always be // the server end of a named pipe. In some tests the test framework will mock // the cleaner end of the connection, and in others it will mock the Chrome
diff --git a/chrome/chrome_cleaner/logging/cleaner_logging_service.cc b/chrome/chrome_cleaner/logging/cleaner_logging_service.cc index de5c7b2..52c7ba5 100644 --- a/chrome/chrome_cleaner/logging/cleaner_logging_service.cc +++ b/chrome/chrome_cleaner/logging/cleaner_logging_service.cc
@@ -411,7 +411,7 @@ // Make sure not to keep any scheduled logs upload if the user opts-out of // logs upload. TODO(csharp): maybe we should also clear all other pending // logs, not just ours. - if (!enable) + if (!enable && registry_logger) ClearTempLogFile(registry_logger); }
diff --git a/chrome/chrome_cleaner/os/file_remover.h b/chrome/chrome_cleaner/os/file_remover.h index 3e93c3d..fe21a30 100644 --- a/chrome/chrome_cleaner/os/file_remover.h +++ b/chrome/chrome_cleaner/os/file_remover.h
@@ -6,7 +6,6 @@ #define CHROME_CHROME_CLEANER_OS_FILE_REMOVER_H_ #include <memory> -#include <string> #include <utility> #include <vector>
diff --git a/chrome/chrome_cleaner/pup_data/BUILD.gn b/chrome/chrome_cleaner/pup_data/BUILD.gn index e1c8fb9..b30c6df 100644 --- a/chrome/chrome_cleaner/pup_data/BUILD.gn +++ b/chrome/chrome_cleaner/pup_data/BUILD.gn
@@ -16,12 +16,12 @@ deps = [ ":test_uws", - "//base", "//chrome/chrome_cleaner/os:common_os", "//chrome/chrome_cleaner/proto:shared_pup_enums_proto", ] public_deps = [ + "//base", "//chrome/chrome_cleaner/constants:uws_id", "//chrome/chrome_cleaner/logging/proto:shared_data_proto", "//chrome/chrome_cleaner/settings:matching_options",
diff --git a/chrome/chrome_cleaner/test/BUILD.gn b/chrome/chrome_cleaner/test/BUILD.gn index dc004c7..699ca86 100644 --- a/chrome/chrome_cleaner/test/BUILD.gn +++ b/chrome/chrome_cleaner/test/BUILD.gn
@@ -225,6 +225,7 @@ "//base/test:test_support", "//chrome/chrome_cleaner:buildflags", "//chrome/chrome_cleaner/constants:common_strings", + "//chrome/chrome_cleaner/ipc:chrome_prompt_test_util", "//chrome/chrome_cleaner/logging/proto:chrome_cleaner_report_proto", "//chrome/chrome_cleaner/logging/proto:reporter_logs_proto", "//chrome/chrome_cleaner/logging/proto:shared_data_proto", @@ -234,7 +235,9 @@ "//chrome/chrome_cleaner/test:test_util", "//chrome/chrome_cleaner/zip_archiver:common", "//components/chrome_cleaner/public/constants", + "//components/chrome_cleaner/public/proto", "//components/chrome_cleaner/test:test_name_helper", + "//net:test_support", "//testing/gtest", ]
diff --git a/chrome/chrome_cleaner/test/DEPS b/chrome/chrome_cleaner/test/DEPS new file mode 100644 index 0000000..ddf1571 --- /dev/null +++ b/chrome/chrome_cleaner/test/DEPS
@@ -0,0 +1,5 @@ +include_rules = [ + # Chrome Cleanup itself should not depend on //net but tests can use it for + # test support. + "+net/test/embedded_test_server", +]
diff --git a/chrome/chrome_cleaner/test/cleaner_test.cc b/chrome/chrome_cleaner/test/cleaner_test.cc index 47f95c0..0b02d8f 100644 --- a/chrome/chrome_cleaner/test/cleaner_test.cc +++ b/chrome/chrome_cleaner/test/cleaner_test.cc
@@ -2,9 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> #include <string> #include <tuple> +#include <utility> +#include <vector> +#include "base/bind.h" #include "base/command_line.h" #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -12,10 +16,15 @@ #include "base/path_service.h" #include "base/process/launch.h" #include "base/strings/string_number_conversions.h" +#include "base/synchronization/waitable_event.h" +#include "base/task/task_traits.h" +#include "base/task/thread_pool.h" +#include "base/test/task_environment.h" #include "base/test/test_timeouts.h" #include "base/win/windows_version.h" #include "chrome/chrome_cleaner/buildflags.h" #include "chrome/chrome_cleaner/constants/chrome_cleaner_switches.h" +#include "chrome/chrome_cleaner/ipc/chrome_prompt_test_util.h" #include "chrome/chrome_cleaner/logging/proto/chrome_cleaner_report.pb.h" #include "chrome/chrome_cleaner/logging/proto/reporter_logs.pb.h" #include "chrome/chrome_cleaner/logging/proto/shared_data.pb.h" @@ -29,15 +38,24 @@ #include "chrome/chrome_cleaner/zip_archiver/sandboxed_zip_archiver.h" #include "components/chrome_cleaner/public/constants/constants.h" #include "components/chrome_cleaner/public/constants/result_codes.h" +#include "components/chrome_cleaner/public/proto/chrome_prompt.pb.h" #include "components/chrome_cleaner/test/test_name_helper.h" +#include "net/test/embedded_test_server/embedded_test_server.h" +#include "net/test/embedded_test_server/http_request.h" +#include "net/test/embedded_test_server/http_response.h" #include "testing/gtest/include/gtest/gtest.h" namespace { using chrome_cleaner::Engine; using chrome_cleaner::ExecutionMode; +using chrome_cleaner::MockChromePromptResponder; +using chrome_cleaner::PromptUserResponse; using chrome_cleaner::PUPData; using ::testing::Combine; +using ::testing::InvokeWithoutArgs; +using ::testing::IsEmpty; +using ::testing::UnorderedElementsAre; using ::testing::Values; using ::testing::ValuesIn; @@ -222,41 +240,10 @@ return !::testing::Test::HasFailure(); } -enum class TestFeatures { - kNone, - kWithoutSandbox, -}; - -// We can't use testing::Range with an enum so create an array to use with -// testing::ValuesIn. -// clang-format off -constexpr TestFeatures kAllTestFeatures[] = { - TestFeatures::kNone, - TestFeatures::kWithoutSandbox, -}; -// clang-format on - -std::ostream& operator<<(std::ostream& stream, TestFeatures features) { - switch (features) { - case TestFeatures::kNone: - stream << "None"; - break; - case TestFeatures::kWithoutSandbox: - stream << "WithoutSandbox"; - break; - default: - stream << "Unknown" << static_cast<int>(features); - break; - } - return stream; -} - -class CleanerTest - : public ::testing::TestWithParam<std::tuple<TestFeatures, Engine::Name>> { +// Base class for tests that use various engines. +class CleanerTestBase : public ::testing::Test { public: void SetUp() override { - std::tie(test_features_, engine_) = GetParam(); - // Make sure the test UwS has the flags we expect. ASSERT_FALSE(PUPData::IsConfirmedUwS(chrome_cleaner::kGoogleTestAUwSID)); ASSERT_FALSE(PUPData::IsRemovable(chrome_cleaner::kGoogleTestAUwSID)); @@ -267,8 +254,10 @@ CHECK(base::PathService::Get(base::DIR_START_MENU, &start_menu_folder)); base::FilePath startup_dir = start_menu_folder.Append(L"Startup"); - scan_only_test_uws_ = startup_dir.Append(chrome_cleaner::kTestUwsAFilename); - removable_test_uws_ = startup_dir.Append(chrome_cleaner::kTestUwsBFilename); + scan_only_test_uws_ = chrome_cleaner::NormalizePath( + startup_dir.Append(chrome_cleaner::kTestUwsAFilename)); + removable_test_uws_ = chrome_cleaner::NormalizePath( + startup_dir.Append(chrome_cleaner::kTestUwsBFilename)); // Always create scan-only UwS. Only some tests will have removable UwS. ASSERT_NE(-1, base::WriteFile(scan_only_test_uws_, @@ -315,18 +304,43 @@ base::File::FLAG_WRITE); } + // Launches the process given on |command_line|, and expects it to exit with + // |expected_exit_code|. The child process is also given access to + // |handles_to_inherit| if it isn't empty. If |mock_responder| is not null, + // it will read ChromePrompt requests from the child process in a background + // thread while the child is running. void ExpectExitCode(const base::CommandLine& command_line, - int expected_exit_code) { + int expected_exit_code, + base::HandlesToInheritVector handles_to_inherit = {}, + MockChromePromptResponder* mock_responder = nullptr) { chrome_cleaner::ChildProcessLogger logger; ASSERT_TRUE(logger.Initialize()); base::LaunchOptions options; + options.handles_to_inherit = handles_to_inherit; logger.UpdateLaunchOptions(&options); base::Process process(base::LaunchProcess(command_line, options)); if (!process.IsValid()) logger.DumpLogs(); ASSERT_TRUE(process.IsValid()); + // Past this point, do not return without waiting on |done_reading_event|, + // so that it doesn't go out of scope while another thread has a pointer to + // it. + base::WaitableEvent done_reading_event; + if (!mock_responder) { + // Nothing to read. + done_reading_event.Signal(); + } else { + // Unretained is safe because this function will not return until + // |done_reading_event| is signalled. + base::ThreadPool::PostTask( + FROM_HERE, {base::MayBlock()}, + base::BindOnce(&MockChromePromptResponder::ReadRequests, + base::Unretained(mock_responder), + base::Unretained(&done_reading_event))); + } + int exit_code = -1; bool exited_within_timeout = process.WaitForExitWithTimeout( base::TimeDelta::FromMinutes(10), &exit_code); @@ -336,9 +350,12 @@ logger.DumpLogs(); if (!exited_within_timeout) process.Terminate(/*exit_code=*/-1, /*wait=*/false); + + // Wait until any last messages the child process wrote are processed. + done_reading_event.TimedWait(TestTimeouts::action_timeout()); } - base::CommandLine BuildCommandLine( + virtual base::CommandLine BuildCommandLine( const wchar_t* executable_path, ExecutionMode execution_mode = ExecutionMode::kNone) { base::FilePath path(executable_path); @@ -354,7 +371,63 @@ } command_line.AppendSwitchPath(chrome_cleaner::kQuarantineDirSwitch, temp_dir_.GetPath()); + return command_line; + } + + protected: + base::test::TaskEnvironment task_environment_; + Engine::Name engine_ = Engine::TEST_ONLY; + base::FilePath scan_only_test_uws_; + base::FilePath removable_test_uws_; + base::FilePath expected_uws_archive_; + base::File locked_file_; + + private: + base::ScopedTempDir temp_dir_; +}; + +enum class TestFeatures { + kNone, + kWithoutSandbox, +}; + +// We can't use testing::Range with an enum so create an array to use with +// testing::ValuesIn. +// clang-format off +constexpr TestFeatures kAllTestFeatures[] = { + TestFeatures::kNone, + TestFeatures::kWithoutSandbox, +}; +// clang-format on + +std::ostream& operator<<(std::ostream& stream, TestFeatures features) { + switch (features) { + case TestFeatures::kNone: + stream << "None"; + break; + case TestFeatures::kWithoutSandbox: + stream << "WithoutSandbox"; + break; + default: + stream << "Unknown" << static_cast<int>(features); + break; + } + return stream; +} + +class CleanerTest : public CleanerTestBase, + public ::testing::WithParamInterface< + std::tuple<TestFeatures, Engine::Name>> { + public: + CleanerTest() { std::tie(test_features_, engine_) = GetParam(); } + + base::CommandLine BuildCommandLine( + const wchar_t* executable_path, + ExecutionMode execution_mode = ExecutionMode::kNone) override { + base::CommandLine command_line = + CleanerTestBase::BuildCommandLine(executable_path, execution_mode); #if !BUILDFLAG(IS_OFFICIAL_CHROME_CLEANER_BUILD) + // WithoutSandbox switch is not supported in the official build. if (test_features_ == TestFeatures::kWithoutSandbox) { command_line.AppendSwitch( chrome_cleaner::kRunWithoutSandboxForTestingSwitch); @@ -374,14 +447,6 @@ protected: TestFeatures test_features_; - Engine::Name engine_; - base::FilePath scan_only_test_uws_; - base::FilePath removable_test_uws_; - base::FilePath expected_uws_archive_; - base::File locked_file_; - - private: - base::ScopedTempDir temp_dir_; }; TEST_P(CleanerTest, Scanner_ScanOnly) { @@ -487,7 +552,6 @@ CreateRemovableUwS(); base::CommandLine command_line = BuildCommandLine(kCleanerExecutable); - LOG(ERROR) << command_line.GetCommandLineString(); command_line.AppendSwitch(chrome_cleaner::kDumpRawLogsSwitch); command_line.AppendSwitchASCII( chrome_cleaner::kExecutionModeSwitch, @@ -522,4 +586,244 @@ #endif // NDEBUG #endif // BUILDFLAG(IS_INTERNAL_CHROME_CLEANER_BUILD) +// In Scanning mode, the cleaner communicates with Chrome over a ChromePrompt +// IPC connection, to report the names of found UwS and receive the user's +// permission to start cleaning. These tests validate the behaviour of the +// cleaner depending on the response from Chrome. They only run under the +// test-only engine, because the ESET engine is slower and they don't depend on +// the implementation of the UwS scanner, only on its output. +// Parameters are (enable scanning mode logs, enable cleaning mode logs). +class CleanerScanningModeTest + : public CleanerTestBase, + public ::testing::WithParamInterface<std::tuple<bool, bool>> { + public: + using StrictMockChromePromptResponder = + ::testing::StrictMock<MockChromePromptResponder>; + + void SetUp() override { + CleanerTestBase::SetUp(); + + command_line_ = + BuildCommandLine(kCleanerExecutable, ExecutionMode::kScanning); + chrome_cleaner::ChromePromptPipeHandles pipe_handles = + chrome_cleaner::CreateTestChromePromptMessagePipes( + chrome_cleaner::ChromePromptServerProcess::kChromeIsServer, + &command_line_, &handles_to_inherit_); + ASSERT_TRUE(pipe_handles.IsValid()); + mock_responder_ = std::make_unique<StrictMockChromePromptResponder>( + std::move(pipe_handles)); + + // Start a test server to receive logs uploads. + test_safe_browsing_server_.RegisterRequestHandler( + base::BindRepeating(&CleanerScanningModeTest::HandleLogsUploadRequest, + base::Unretained(this))); + ASSERT_TRUE(test_server_handle_ = + test_safe_browsing_server_.StartAndReturnHandle()); + command_line_.AppendSwitchASCII( + chrome_cleaner::kTestLoggingURLSwitch, + test_safe_browsing_server_.base_url().spec()); + // kNoReportUploadsSwitch was added in the base class by AppendTestSwitches + // to prevent tests from uploading logs to the real safe browsing server. + command_line_.RemoveSwitch(chrome_cleaner::kNoReportUploadSwitch); + + // See SwReporterInvocationType at + // https://source.chromium.org/chromium/chromium/src/+/main:chrome/browser/safe_browsing/chrome_cleaner/sw_reporter_invocation_win.h;l=55;drc=4a5ef27e49b17f08b306284ad933d243a1d6b310 + // for a full description of when logs are sent. It boils down to two + // scenarios: + // - If the user initiated a scan from the Settings page and chose "report + // details to Google", send logs from the cleaner in scanning mode. + // - Otherwise, do not send logs in scanning mode. (Either because the user + // has opted out of logs entirely, or because they were already sent by + // the reporter.) + // In both cases, if removable UwS is found, the response from PromptUser + // will control whether logs are sent in cleaning mode. + std::tie(scanning_mode_logs_, cleaning_mode_logs_) = GetParam(); + if (scanning_mode_logs_) { + // kWithScanningModeLogs is added by Chrome when the user has allowed + // "report details to Google" in the UI. + command_line_.AppendSwitch(chrome_cleaner::kWithScanningModeLogsSwitch); + } + } + + void TearDown() override { + // Add an error to all tests if there were any malformed logs requests. + EXPECT_EQ(logs_upload_errors_, 0); + CleanerTestBase::TearDown(); + } + + void LaunchCleanerAndExpectExitCode(int expected_exit_code) { + ExpectExitCode(command_line_, expected_exit_code, handles_to_inherit_, + mock_responder_.get()); + } + + void ExpectCloseConnectionRequest() { + EXPECT_CALL(*mock_responder_, CloseConnectionRequest()) + .WillOnce( + InvokeWithoutArgs([this] { mock_responder_->StopReading(); })); + } + + std::unique_ptr<net::test_server::HttpResponse> HandleLogsUploadRequest( + const net::test_server::HttpRequest& request) { + auto http_response = + std::make_unique<net::test_server::BasicHttpResponse>(); + http_response->set_code(net::HTTP_OK); + if (!request.has_content) { + logs_upload_errors_++; + return http_response; + } + chrome_cleaner::ChromeCleanerReport report; + if (!report.ParseFromString(request.content)) { + logs_upload_errors_++; + return http_response; + } + if (report.exit_code() == chrome_cleaner::RESULT_CODE_PENDING) + intermediate_logs_upload_request_count_++; + else + logs_upload_request_count_++; + return http_response; + } + + protected: + base::CommandLine command_line_{base::CommandLine::NO_PROGRAM}; + base::HandlesToInheritVector handles_to_inherit_; + std::unique_ptr<StrictMockChromePromptResponder> mock_responder_; + + bool scanning_mode_logs_ = false; + bool cleaning_mode_logs_ = false; + int logs_upload_request_count_ = 0; + int intermediate_logs_upload_request_count_ = 0; + int logs_upload_errors_ = 0; + net::test_server::EmbeddedTestServer test_safe_browsing_server_; + net::test_server::EmbeddedTestServerHandle test_server_handle_; +}; + +TEST_P(CleanerScanningModeTest, ReportOnly) { + // Report-only UwS should not be reported to the user (files to remove should + // be empty). Chrome will automatically reply with DENIED instead of showing + // a prompt. + { + ::testing::InSequence seq; + EXPECT_CALL(*mock_responder_, PromptUserRequest(IsEmpty(), IsEmpty())) + .WillOnce(InvokeWithoutArgs([this] { + mock_responder_->SendPromptUserResponse(PromptUserResponse::DENIED); + })); + ExpectCloseConnectionRequest(); + } + LaunchCleanerAndExpectExitCode( + chrome_cleaner::RESULT_CODE_REPORT_ONLY_PUPS_FOUND); + + EXPECT_TRUE(base::PathExists(scan_only_test_uws_)); + + // Cleaning mode did not run so the only logs are from scanning mode. + EXPECT_EQ(logs_upload_request_count_, scanning_mode_logs_ ? 1 : 0); + + // Intermediate logs are only sent before starting a cleanup. + EXPECT_EQ(intermediate_logs_upload_request_count_, 0); +} + +TEST_P(CleanerScanningModeTest, RemovableDenied) { + CreateRemovableUwS(); + + // Removable UwS is reported to the user, who denies the cleanup. + { + ::testing::InSequence seq; + EXPECT_CALL(*mock_responder_, + PromptUserRequest( + UnorderedElementsAre(removable_test_uws_.AsUTF8Unsafe()), + IsEmpty())) + .WillOnce(InvokeWithoutArgs([this] { + mock_responder_->SendPromptUserResponse(PromptUserResponse::DENIED); + })); + ExpectCloseConnectionRequest(); + } + LaunchCleanerAndExpectExitCode( + chrome_cleaner::RESULT_CODE_CLEANUP_PROMPT_DENIED); + + EXPECT_TRUE(base::PathExists(scan_only_test_uws_)); + EXPECT_TRUE(base::PathExists(removable_test_uws_)); + + // Cleaning mode did not run so the only logs are from scanning mode. + EXPECT_EQ(logs_upload_request_count_, scanning_mode_logs_ ? 1 : 0); + + // Intermediate logs are only sent before starting a cleanup. + EXPECT_EQ(intermediate_logs_upload_request_count_, 0); +} + +TEST_P(CleanerScanningModeTest, RemovableAccepted) { + CreateRemovableUwS(); + + // Removable UwS is reported to the user, who accepts the cleanup. + { + ::testing::InSequence seq; + EXPECT_CALL(*mock_responder_, + PromptUserRequest( + UnorderedElementsAre(removable_test_uws_.AsUTF8Unsafe()), + IsEmpty())) + .WillOnce(InvokeWithoutArgs([this] { + mock_responder_->SendPromptUserResponse( + cleaning_mode_logs_ ? PromptUserResponse::ACCEPTED_WITH_LOGS + : PromptUserResponse::ACCEPTED_WITHOUT_LOGS); + })); + ExpectCloseConnectionRequest(); + } + LaunchCleanerAndExpectExitCode(chrome_cleaner::RESULT_CODE_SUCCESS); + + EXPECT_TRUE(base::PathExists(scan_only_test_uws_)); + EXPECT_FALSE(base::PathExists(removable_test_uws_)); + + // The final log should not be sent until cleaning is finished, so the + // cleaning mode logs setting controls uploads. + EXPECT_EQ(logs_upload_request_count_, cleaning_mode_logs_ ? 1 : 0); + + // Intermediate logs are sent before the cleanup in each mode that has logs + // enabled. + int expected_intermediate_logs = 0; + if (scanning_mode_logs_) + expected_intermediate_logs++; + if (cleaning_mode_logs_) + expected_intermediate_logs++; + EXPECT_EQ(intermediate_logs_upload_request_count_, + expected_intermediate_logs); +} + +TEST_P(CleanerScanningModeTest, RemovableAcceptedElevationDenied) { + CreateRemovableUwS(); + + // Removable UwS is reported to the user, who accepts the cleanup but then + // refuses the Windows UAC elevation prompt. + command_line_.AppendSwitch(chrome_cleaner::kDenyElevationForTestingSwitch); + { + ::testing::InSequence seq; + EXPECT_CALL(*mock_responder_, + PromptUserRequest( + UnorderedElementsAre(removable_test_uws_.AsUTF8Unsafe()), + IsEmpty())) + .WillOnce(InvokeWithoutArgs([this] { + mock_responder_->SendPromptUserResponse( + cleaning_mode_logs_ ? PromptUserResponse::ACCEPTED_WITH_LOGS + : PromptUserResponse::ACCEPTED_WITHOUT_LOGS); + })); + ExpectCloseConnectionRequest(); + } + LaunchCleanerAndExpectExitCode( + chrome_cleaner::RESULT_CODE_ELEVATION_PROMPT_DECLINED); + + EXPECT_TRUE(base::PathExists(scan_only_test_uws_)); + EXPECT_TRUE(base::PathExists(removable_test_uws_)); + + // Cleaning mode did not actually run so the scanning mode logs should be + // sent. + EXPECT_EQ(logs_upload_request_count_, scanning_mode_logs_ ? 1 : 0); + + // Intermediate logs are sent from scanning mode before the cleanup was + // attempted. + EXPECT_EQ(intermediate_logs_upload_request_count_, + scanning_mode_logs_ ? 1 : 0); +} + +INSTANTIATE_TEST_SUITE_P(AllLogsScenarios, + CleanerScanningModeTest, + Combine(Values(true, false), Values(true, false)), + chrome_cleaner::GetParamNameForTest()); + } // namespace
diff --git a/chrome/chrome_cleaner/test/test_registry_util.h b/chrome/chrome_cleaner/test/test_registry_util.h index 97903f22..2aa84f6 100644 --- a/chrome/chrome_cleaner/test/test_registry_util.h +++ b/chrome/chrome_cleaner/test/test_registry_util.h
@@ -7,7 +7,6 @@ #include <windows.h> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc index bb3ec2a..5e984f2 100644 --- a/chrome/common/chrome_features.cc +++ b/chrome/common/chrome_features.cc
@@ -297,8 +297,7 @@ // Enables or disables usage of shared LevelDB instance (ModelTypeStoreService). // If this flag is disabled, the new Web Apps system uses its own isolated -// LevelDB instance for manual testing purposes. Requires -// kDesktopPWAsWithoutExtensions to be enabled. +// LevelDB instance for manual testing purposes. // // TODO(crbug.com/1065748): Delete this feature flag. const base::Feature kDesktopPWAsSharedStoreService{ @@ -315,13 +314,6 @@ const base::Feature kDesktopPWAsTabStripLinkCapturing{ "DesktopPWAsTabStripLinkCapturing", base::FEATURE_DISABLED_BY_DEFAULT}; -// Enables or disables new Desktop PWAs implementation that does not use -// extensions. -// -// TODO(crbug.com/1065748): Delete this feature flag. -const base::Feature kDesktopPWAsWithoutExtensions{ - "DesktopPWAsWithoutExtensions", base::FEATURE_ENABLED_BY_DEFAULT}; - // Enable DNS over HTTPS (DoH). const base::Feature kDnsOverHttps { "DnsOverHttps",
diff --git a/chrome/common/chrome_features.h b/chrome/common/chrome_features.h index f492cf07..919a28ae 100644 --- a/chrome/common/chrome_features.h +++ b/chrome/common/chrome_features.h
@@ -213,9 +213,6 @@ extern const base::Feature kDesktopPWAsTabStripLinkCapturing; COMPONENT_EXPORT(CHROME_FEATURES) -extern const base::Feature kDesktopPWAsWithoutExtensions; - -COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kDnsOverHttps; COMPONENT_EXPORT(CHROME_FEATURES) extern const base::FeatureParam<bool> kDnsOverHttpsFallbackParam;
diff --git a/chrome/common/extensions/permissions/chrome_permission_message_provider.h b/chrome/common/extensions/permissions/chrome_permission_message_provider.h index fa27b87..93d5faf 100644 --- a/chrome/common/extensions/permissions/chrome_permission_message_provider.h +++ b/chrome/common/extensions/permissions/chrome_permission_message_provider.h
@@ -6,7 +6,6 @@ #define CHROME_COMMON_EXTENSIONS_PERMISSIONS_CHROME_PERMISSION_MESSAGE_PROVIDER_H_ #include <set> -#include <string> #include <vector> #include "base/macros.h"
diff --git a/chrome/common/mac/app_mode_common.h b/chrome/common/mac/app_mode_common.h index 6653152d..5a06d4f 100644 --- a/chrome/common/mac/app_mode_common.h +++ b/chrome/common/mac/app_mode_common.h
@@ -7,8 +7,6 @@ #include <CoreServices/CoreServices.h> -#include <string> - #include "base/strings/stringize_macros.h" #ifdef __OBJC__
diff --git a/chrome/credential_provider/extension/app_inventory_manager.h b/chrome/credential_provider/extension/app_inventory_manager.h index 6e0fa35..64ca7d57 100644 --- a/chrome/credential_provider/extension/app_inventory_manager.h +++ b/chrome/credential_provider/extension/app_inventory_manager.h
@@ -5,8 +5,6 @@ #ifndef CHROME_CREDENTIAL_PROVIDER_EXTENSION_APP_INVENTORY_MANAGER_H_ #define CHROME_CREDENTIAL_PROVIDER_EXTENSION_APP_INVENTORY_MANAGER_H_ -#include <string> - #include "base/time/time.h" #include "base/win/windows_types.h" #include "chrome/credential_provider/extension/task_manager.h"
diff --git a/chrome/gpu/chrome_content_gpu_client.h b/chrome/gpu/chrome_content_gpu_client.h index d53cf7c..95e5011c 100644 --- a/chrome/gpu/chrome_content_gpu_client.h +++ b/chrome/gpu/chrome_content_gpu_client.h
@@ -6,7 +6,6 @@ #define CHROME_GPU_CHROME_CONTENT_GPU_CLIENT_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/memory/scoped_refptr.h"
diff --git a/chrome/renderer/chrome_render_thread_observer.h b/chrome/renderer/chrome_render_thread_observer.h index ddb753a..7011b6e 100644 --- a/chrome/renderer/chrome_render_thread_observer.h +++ b/chrome/renderer/chrome_render_thread_observer.h
@@ -6,7 +6,6 @@ #define CHROME_RENDERER_CHROME_RENDER_THREAD_OBSERVER_H_ #include <memory> -#include <string> #include "base/compiler_specific.h" #include "base/macros.h"
diff --git a/chrome/renderer/sync_encryption_keys_extension.h b/chrome/renderer/sync_encryption_keys_extension.h index 8422ba90..01c5a095 100644 --- a/chrome/renderer/sync_encryption_keys_extension.h +++ b/chrome/renderer/sync_encryption_keys_extension.h
@@ -6,7 +6,6 @@ #define CHROME_RENDERER_SYNC_ENCRYPTION_KEYS_EXTENSION_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/service/service_process.h b/chrome/service/service_process.h index 01eee52..2b6abfc 100644 --- a/chrome/service/service_process.h +++ b/chrome/service/service_process.h
@@ -6,7 +6,6 @@ #define CHROME_SERVICE_SERVICE_PROCESS_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/memory/ref_counted.h"
diff --git a/chrome/services/media_gallery_util/ipc_data_source.h b/chrome/services/media_gallery_util/ipc_data_source.h index 3bd33fd..caf5c87 100644 --- a/chrome/services/media_gallery_util/ipc_data_source.h +++ b/chrome/services/media_gallery_util/ipc_data_source.h
@@ -7,8 +7,6 @@ #include <stdint.h> -#include <string> - #include "base/memory/ref_counted.h" #include "base/threading/thread_checker.h" #include "chrome/services/media_gallery_util/public/mojom/media_parser.mojom.h"
diff --git a/chrome/services/media_gallery_util/video_thumbnail_parser.h b/chrome/services/media_gallery_util/video_thumbnail_parser.h index 7b2d857..c85b582 100644 --- a/chrome/services/media_gallery_util/video_thumbnail_parser.h +++ b/chrome/services/media_gallery_util/video_thumbnail_parser.h
@@ -6,7 +6,6 @@ #define CHROME_SERVICES_MEDIA_GALLERY_UTIL_VIDEO_THUMBNAIL_PARSER_H_ #include <memory> -#include <string> #include "base/macros.h" #include "base/memory/scoped_refptr.h"
diff --git a/chrome/services/sharing/nearby/decoder/advertisement_decoder.h b/chrome/services/sharing/nearby/decoder/advertisement_decoder.h index 5d24a9a..a129a9cc 100644 --- a/chrome/services/sharing/nearby/decoder/advertisement_decoder.h +++ b/chrome/services/sharing/nearby/decoder/advertisement_decoder.h
@@ -7,7 +7,6 @@ #include <stdint.h> #include <memory> -#include <string> #include <vector> #include "base/containers/span.h"
diff --git a/chrome/services/sharing/nearby/platform/bluetooth_socket.h b/chrome/services/sharing/nearby/platform/bluetooth_socket.h index 1c9946b7..5300d5c9 100644 --- a/chrome/services/sharing/nearby/platform/bluetooth_socket.h +++ b/chrome/services/sharing/nearby/platform/bluetooth_socket.h
@@ -5,8 +5,6 @@ #ifndef CHROME_SERVICES_SHARING_NEARBY_PLATFORM_BLUETOOTH_SOCKET_H_ #define CHROME_SERVICES_SHARING_NEARBY_PLATFORM_BLUETOOTH_SOCKET_H_ -#include <string> - #include "chrome/services/sharing/nearby/platform/bluetooth_device.h" #include "device/bluetooth/public/mojom/adapter.mojom.h" #include "mojo/public/cpp/bindings/shared_remote.h"
diff --git a/chrome/services/speech/cros_speech_recognition_recognizer_impl.h b/chrome/services/speech/cros_speech_recognition_recognizer_impl.h index ba8e5ab8..b298afc 100644 --- a/chrome/services/speech/cros_speech_recognition_recognizer_impl.h +++ b/chrome/services/speech/cros_speech_recognition_recognizer_impl.h
@@ -6,7 +6,6 @@ #define CHROME_SERVICES_SPEECH_CROS_SPEECH_RECOGNITION_RECOGNIZER_IMPL_H_ #include <memory> -#include <string> #include "base/files/file_path.h" #include "base/memory/weak_ptr.h"
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn index a1d7cd3..5485be4 100644 --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn
@@ -2754,6 +2754,7 @@ "../browser/ash/login/screens/mock_wrong_hwid_screen.h", "../browser/ash/login/screens/multidevice_setup_screen_browsertest.cc", "../browser/ash/login/screens/network_screen_browsertest.cc", + "../browser/ash/login/screens/os_install_screen_browsertest.cc", "../browser/ash/login/screens/packaged_license_screen_browsertest.cc", "../browser/ash/login/screens/parental_handoff_screen_browsertest.cc", "../browser/ash/login/screens/pin_setup_screen_browsertest.cc", @@ -6596,6 +6597,10 @@ deps += [ "//ash:test_support" ] } + + if (is_chromeos_lacros) { + deps += [ "//chromeos/lacros:test_support" ] + } } if (!is_android) {
diff --git a/chrome/test/base/chrome_render_view_test.h b/chrome/test/base/chrome_render_view_test.h index 1dc2b9a..92d8bcc 100644 --- a/chrome/test/base/chrome_render_view_test.h +++ b/chrome/test/base/chrome_render_view_test.h
@@ -6,7 +6,6 @@ #define CHROME_TEST_BASE_CHROME_RENDER_VIEW_TEST_H_ #include <memory> -#include <string> #include "content/public/test/render_view_test.h" #include "services/service_manager/public/cpp/binder_registry.h"
diff --git a/chrome/test/base/mojo_web_ui_browser_test.h b/chrome/test/base/mojo_web_ui_browser_test.h index c898ab4..16bbd8e 100644 --- a/chrome/test/base/mojo_web_ui_browser_test.h +++ b/chrome/test/base/mojo_web_ui_browser_test.h
@@ -5,8 +5,6 @@ #ifndef CHROME_TEST_BASE_MOJO_WEB_UI_BROWSER_TEST_H_ #define CHROME_TEST_BASE_MOJO_WEB_UI_BROWSER_TEST_H_ -#include <string> - #include "chrome/test/base/web_ui_browser_test.h" // The runner of Mojo WebUI javascript based tests. The main difference between
diff --git a/chrome/test/chromedriver/session_commands.h b/chrome/test/chromedriver/session_commands.h index 79eaa04..0e48cb87 100644 --- a/chrome/test/chromedriver/session_commands.h +++ b/chrome/test/chromedriver/session_commands.h
@@ -6,7 +6,6 @@ #define CHROME_TEST_CHROMEDRIVER_SESSION_COMMANDS_H_ #include <memory> -#include <string> #include "chrome/test/chromedriver/command.h" #include "chrome/test/chromedriver/net/sync_websocket_factory.h"
diff --git a/chrome/test/chromedriver/window_commands.h b/chrome/test/chromedriver/window_commands.h index ae00910..6309861 100644 --- a/chrome/test/chromedriver/window_commands.h +++ b/chrome/test/chromedriver/window_commands.h
@@ -6,7 +6,6 @@ #define CHROME_TEST_CHROMEDRIVER_WINDOW_COMMANDS_H_ #include <memory> -#include <string> #include "base/callback_forward.h" #include "base/values.h"
diff --git a/chrome/test/data/client_hints/accept_ch_with_lifetime.html.mock-http-headers b/chrome/test/data/client_hints/accept_ch_with_lifetime.html.mock-http-headers index ec59c82..69d9b0bc 100644 --- a/chrome/test/data/client_hints/accept_ch_with_lifetime.html.mock-http-headers +++ b/chrome/test/data/client_hints/accept_ch_with_lifetime.html.mock-http-headers
@@ -1,3 +1,3 @@ HTTP/1.1 200 OK -Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version +Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version,sec-ch-prefers-color-scheme Accept-CH-Lifetime: 3600
diff --git a/chrome/test/data/client_hints/accept_ch_with_short_lifetime.html.mock-http-headers b/chrome/test/data/client_hints/accept_ch_with_short_lifetime.html.mock-http-headers index 551597b7..c898801 100644 --- a/chrome/test/data/client_hints/accept_ch_with_short_lifetime.html.mock-http-headers +++ b/chrome/test/data/client_hints/accept_ch_with_short_lifetime.html.mock-http-headers
@@ -1,3 +1,3 @@ HTTP/1.1 200 OK -Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version +Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version,sec-ch-prefers-color-scheme Accept-CH-Lifetime: 1
diff --git a/chrome/test/data/client_hints/accept_ch_without_lifetime.html.mock-http-headers b/chrome/test/data/client_hints/accept_ch_without_lifetime.html.mock-http-headers index 3b37eca..066a3ff 100644 --- a/chrome/test/data/client_hints/accept_ch_without_lifetime.html.mock-http-headers +++ b/chrome/test/data/client_hints/accept_ch_without_lifetime.html.mock-http-headers
@@ -1,2 +1,2 @@ HTTP/1.1 200 OK -Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version +Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version,sec-ch-prefers-color-scheme
diff --git a/chrome/test/data/client_hints/accept_ch_without_lifetime_img_localhost.html.mock-http-headers b/chrome/test/data/client_hints/accept_ch_without_lifetime_img_localhost.html.mock-http-headers index 3b37eca..066a3ff 100644 --- a/chrome/test/data/client_hints/accept_ch_without_lifetime_img_localhost.html.mock-http-headers +++ b/chrome/test/data/client_hints/accept_ch_without_lifetime_img_localhost.html.mock-http-headers
@@ -1,2 +1,2 @@ HTTP/1.1 200 OK -Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version +Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version,sec-ch-prefers-color-scheme
diff --git a/chrome/test/data/client_hints/http_equiv_accept_ch_merge.html b/chrome/test/data/client_hints/http_equiv_accept_ch_merge.html index c1cc8a3..5ab981b 100644 --- a/chrome/test/data/client_hints/http_equiv_accept_ch_merge.html +++ b/chrome/test/data/client_hints/http_equiv_accept_ch_merge.html
@@ -2,7 +2,7 @@ <!-- This is split in two since data from header may round trip quickly enough from browser to be used, so this makes sure we actually merge --> <meta http-equiv="Accept-CH" content="lang,sec-ch-ua-arch,sec-ch-ua-platform"> -<meta http-equiv="Accept-CH" content="sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version"> +<meta http-equiv="Accept-CH" content="sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version,sec-ch-prefers-color-scheme"> <link rel="icon" href="data:;base64,="> <!-- A subresource! --> <img src="non-existing-image.jpg"></img>
diff --git a/chrome/test/data/client_hints/http_equiv_accept_ch_without_lifetime_img_localhost.html b/chrome/test/data/client_hints/http_equiv_accept_ch_without_lifetime_img_localhost.html index 79a5f0eb..fd6cda7 100644 --- a/chrome/test/data/client_hints/http_equiv_accept_ch_without_lifetime_img_localhost.html +++ b/chrome/test/data/client_hints/http_equiv_accept_ch_without_lifetime_img_localhost.html
@@ -1,5 +1,5 @@ <html> -<meta http-equiv="Accept-CH" content="dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version"> +<meta http-equiv="Accept-CH" content="dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-ua-full-version,sec-ch-prefers-color-scheme"> <link rel="icon" href="data:;base64,="> <head></head> Empty file which uses link-rel to disable favicon fetches. The corresponding
diff --git a/chrome/test/data/media/picture-in-picture/video-conferencing.html b/chrome/test/data/media/picture-in-picture/video-conferencing.html new file mode 100644 index 0000000..47edb7d --- /dev/null +++ b/chrome/test/data/media/picture-in-picture/video-conferencing.html
@@ -0,0 +1,42 @@ +<!DOCTYPE html> +<html> + <head> + <title>Picture-in-Picture video conferencing test</title> + </head> + <body> + <video id="video" preload=auto src='../bigbuck.webm'></video> + </body> +<script> +const video = document.getElementById('video'); + +let isMicrophoneActive = false; +let isCameraActive = false; +navigator.mediaSession.setMicrophoneActive(isMicrophoneActive); +navigator.mediaSession.setCameraActive(isCameraActive); + +async function enterPictureInPicture() { + await video.play(); + video.requestPictureInPicture().then(() => { + window.domAutomationController.send(true); + }).catch(e => { + window.domAutomationController.send(false); + }); +} + +navigator.mediaSession.setActionHandler('togglemicrophone', () => { + isMicrophoneActive = !isMicrophoneActive; + navigator.mediaSession.setMicrophoneActive(isMicrophoneActive); + document.title = 'togglemicrophone'; +}); + +navigator.mediaSession.setActionHandler('togglecamera', () => { + isCameraActive = !isCameraActive; + navigator.mediaSession.setCameraActive(isCameraActive); + document.title = 'togglecamera'; +}); + +navigator.mediaSession.setActionHandler('hangup', () => { + document.title = 'hangup'; +}); +</script> +</html>
diff --git a/chrome/test/media_router/media_router_e2e_browsertest.h b/chrome/test/media_router/media_router_e2e_browsertest.h index 9018acf..66c94a9 100644 --- a/chrome/test/media_router/media_router_e2e_browsertest.h +++ b/chrome/test/media_router/media_router_e2e_browsertest.h
@@ -6,7 +6,6 @@ #define CHROME_TEST_MEDIA_ROUTER_MEDIA_ROUTER_E2E_BROWSERTEST_H_ #include <memory> -#include <string> #include "chrome/test/media_router/media_router_integration_browsertest.h" #include "chrome/test/media_router/test_media_sinks_observer.h" @@ -28,7 +27,6 @@ void SetUpOnMainThread() override; void TearDownOnMainThread() override; - // Callback from MediaRouter when a response to a media route request is // received. void OnRouteResponseReceived(mojom::RoutePresentationConnectionPtr,
diff --git a/chrome/updater/app/server/win/server.h b/chrome/updater/app/server/win/server.h index d176da6..d4cfd19 100644 --- a/chrome/updater/app/server/win/server.h +++ b/chrome/updater/app/server/win/server.h
@@ -7,7 +7,6 @@ #include <windows.h> -#include <string> #include <vector> #include "base/callback_forward.h"
diff --git a/chromeos/CHROMEOS_LKGM b/chromeos/CHROMEOS_LKGM index 53be4ec..2e83fff 100644 --- a/chromeos/CHROMEOS_LKGM +++ b/chromeos/CHROMEOS_LKGM
@@ -1 +1 @@ -13975.0.0 \ No newline at end of file +13976.0.0 \ No newline at end of file
diff --git a/chromeos/dbus/BUILD.gn b/chromeos/dbus/BUILD.gn index fbb9535..8fc6eff 100644 --- a/chromeos/dbus/BUILD.gn +++ b/chromeos/dbus/BUILD.gn
@@ -36,6 +36,7 @@ ":vm_applications_apps_proto", ":vm_permission_service_proto", ":vm_plugin_dispatcher_proto", + ":vm_sk_forwarding_proto", "//base", "//components/account_id", "//components/device_event_log", @@ -314,6 +315,14 @@ proto_out_dir = "chromeos/dbus/vm_applications" } +proto_library("vm_sk_forwarding_proto") { + sources = [ + "//third_party/cros_system_api/dbus/vm_sk_forwarding/sk_forwarding.proto", + ] + + proto_out_dir = "chromeos/dbus/vm_sk_forwarding" +} + proto_library("vm_permission_service_proto") { sources = [ "//third_party/cros_system_api/dbus/vm_permission_service/vm_permission_service.proto" ]
diff --git a/chromeos/lacros/BUILD.gn b/chromeos/lacros/BUILD.gn index aa0f4cba..fa4892a 100644 --- a/chromeos/lacros/BUILD.gn +++ b/chromeos/lacros/BUILD.gn
@@ -59,10 +59,16 @@ # A list of tests that are known to work reliably. # TODO(crbug.com/1158590): use --attr-expr instead of hard-coding the tests. tast_tests = [ - "lacros.AppLauncherLaunch", - "lacros.AudioPlay", + # TODO(crbug.com/1202407): Enable this test again. + #"lacros.AudioPlay", + + # TODO(crbug.com/1208845): Enable this test again. + #"lacros.AppLauncherLaunch", + "lacros.Basic", - "lacros.ShelfLaunch", + + # TODO(crbug.com/1205526): Enable this test again. + #"lacros.ShelfLaunch", ] }
diff --git a/chromeos/login/auth/cryptohome_key_constants.cc b/chromeos/login/auth/cryptohome_key_constants.cc index bedc09a..4d76969 100644 --- a/chromeos/login/auth/cryptohome_key_constants.cc +++ b/chromeos/login/auth/cryptohome_key_constants.cc
@@ -17,4 +17,6 @@ const char kCryptohomePinLabel[] = "pin"; +const char kCryptohomeWildcardLabel[] = ""; + } // namespace chromeos
diff --git a/chromeos/login/auth/cryptohome_key_constants.h b/chromeos/login/auth/cryptohome_key_constants.h index 117e7a53..7fe016f 100644 --- a/chromeos/login/auth/cryptohome_key_constants.h +++ b/chromeos/login/auth/cryptohome_key_constants.h
@@ -15,6 +15,9 @@ COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) extern const char kCryptohomePinLabel[]; +COMPONENT_EXPORT(CHROMEOS_LOGIN_AUTH) +extern const char kCryptohomeWildcardLabel[]; + } // namespace chromeos // TODO(https://crbug.com/1164001): remove after the //chrome/browser/chromeos
diff --git a/chromeos/tast_control.gni b/chromeos/tast_control.gni index f72319a4..d272e95e 100644 --- a/chromeos/tast_control.gni +++ b/chromeos/tast_control.gni
@@ -32,9 +32,6 @@ # crbug.com/1154794 "policy.DefaultGeolocationSetting", - # crbug.com/1204092 - "policy.DisableScreenshotsExtension", - # crbug.com/1115622 "inputs.VirtualKeyboardOOBE",
diff --git a/components/autofill/core/browser/address_profile_save_manager.cc b/components/autofill/core/browser/address_profile_save_manager.cc index de060d5..963dc1d 100644 --- a/components/autofill/core/browser/address_profile_save_manager.cc +++ b/components/autofill/core/browser/address_profile_save_manager.cc
@@ -74,7 +74,7 @@ void AddressProfileSaveManager::OfferSavePrompt( std::unique_ptr<ProfileImportProcess> import_process) { // The prompt should not have been shown yet. - DCHECK(import_process->prompt_shown()); + DCHECK(!import_process->prompt_shown()); // TODO(crbug.com/1175693): Pass the correct SaveAddressProfilePromptOptions // below.
diff --git a/components/autofill/core/browser/autofill_address_util.cc b/components/autofill/core/browser/autofill_address_util.cc index 41d2565..68585f8 100644 --- a/components/autofill/core/browser/autofill_address_util.cc +++ b/components/autofill/core/browser/autofill_address_util.cc
@@ -165,9 +165,9 @@ return base::UTF8ToUTF16(address); } -std::u16string GetDescriptionForProfileToSave( - const AutofillProfile& profile, - const std::string& ui_language_code) { +std::u16string GetProfileDescription(const AutofillProfile& profile, + const std::string& ui_language_code, + bool include_address_and_contacts) { // All user-visible fields. static constexpr ServerFieldType kDetailsFields[] = { NAME_FULL, @@ -182,42 +182,15 @@ COMPANY_NAME, ADDRESS_HOME_COUNTRY}; + if (!include_address_and_contacts) { + return profile.GetInfo(NAME_FULL, ui_language_code); + } + return profile.ConstructInferredLabel( kDetailsFields, base::size(kDetailsFields), /*num_fields_to_include=*/2, ui_language_code); } -std::u16string GetDescriptionForProfileToUpdate( - const AutofillProfile& profile, - const std::string& ui_language_code) { - // All user-visible fields, except for NAME_FULL, which is used as a preceding - // label. - static constexpr ServerFieldType kDetailsFields[] = { - ADDRESS_HOME_LINE1, - ADDRESS_HOME_LINE2, - ADDRESS_HOME_DEPENDENT_LOCALITY, - ADDRESS_HOME_CITY, - ADDRESS_HOME_STATE, - ADDRESS_HOME_ZIP, - EMAIL_ADDRESS, - PHONE_HOME_WHOLE_NUMBER, - COMPANY_NAME, - ADDRESS_HOME_COUNTRY}; - - std::vector<std::u16string> description_components; - std::u16string label = profile.GetInfo(NAME_FULL, ui_language_code); - if (!label.empty()) - description_components.push_back(label); - std::u16string details = profile.ConstructInferredLabel( - kDetailsFields, base::size(kDetailsFields), - /*num_fields_to_include=*/label.empty() ? 2 : 1, ui_language_code); - DCHECK(!details.empty()); - description_components.push_back(details); - // TODO(crbug.com/1135178): Replace the separator with proper localized - // string. - return base::JoinString(description_components, u" — "); -} - std::vector<ProfileValueDifference> GetProfileDifferenceForUi( const AutofillProfile& first_profile, const AutofillProfile& second_profile,
diff --git a/components/autofill/core/browser/autofill_address_util.h b/components/autofill/core/browser/autofill_address_util.h index ec0f239..5401252 100644 --- a/components/autofill/core/browser/autofill_address_util.h +++ b/components/autofill/core/browser/autofill_address_util.h
@@ -48,18 +48,12 @@ // Returns a one-line `profile` description, listing (at max) 2 significant // user-visible fields with respect to UI BCP 47 language code in -// `ui_language_code`. -std::u16string GetDescriptionForProfileToSave( - const AutofillProfile& profile, - const std::string& ui_language_code); - -// Returns a one-line `profile` description with respect to UI BCP 47 -// language code in `ui_language_code`. It consists of (at max) 2 user-visible -// fields: the label referring to the profile (full name if exists) and other -// details, separated by hyphen. -std::u16string GetDescriptionForProfileToUpdate( - const AutofillProfile& profile, - const std::string& ui_language_code); +// `ui_language_code`. If `include_address_and_contacts` is false, only full +// name is included, and the returned string can be empty if the name is not +// present. +std::u16string GetProfileDescription(const AutofillProfile& profile, + const std::string& ui_language_code, + bool include_address_and_contacts); // Fields in order they should appear in differences for AutofillProfile update. static constexpr ServerFieldType kVisibleTypesForProfileDifferences[] = {
diff --git a/components/autofill/core/browser/autofill_address_util_unittest.cc b/components/autofill/core/browser/autofill_address_util_unittest.cc index eef06ff7..eb2c215 100644 --- a/components/autofill/core/browser/autofill_address_util_unittest.cc +++ b/components/autofill/core/browser/autofill_address_util_unittest.cc
@@ -161,28 +161,29 @@ /*include_country=*/true)})); } -TEST(GetDescriptionForProfileToSave, NameAndAddress) { +TEST(GetProfileDescription, NameAndAddress) { AutofillProfile profile = test::GetFullProfile(); - std::u16string description = GetDescriptionForProfileToSave(profile, "en-US"); + std::u16string description = GetProfileDescription( + profile, "en-US", /*include_address_and_contacts=*/true); // Should contain full name and address line 1. EXPECT_EQ(description, u"John H. Doe, 666 Erebus St."); } -TEST(GetDescriptionForProfileToUpdate, LabelAndDetails) { - AutofillProfile profile = test::GetFullProfile(); - std::u16string description = - GetDescriptionForProfileToUpdate(profile, "en-US"); - // Should contain full name as label and address line 1, separated by hyphen. - EXPECT_EQ(description, u"John H. Doe — 666 Erebus St."); -} - -TEST(GetDescriptionForProfileToUpdate, NoLabelOnlyDetails) { +TEST(GetProfileDescription, EmptyName) { AutofillProfile profile = test::GetFullProfile(); profile.SetInfo(NAME_FULL, u"", "en-US"); - std::u16string description = - GetDescriptionForProfileToUpdate(profile, "en-US"); - // Should contain no label, but 2 components: address lines 1 & 2. + std::u16string description = GetProfileDescription( + profile, "en-US", /*include_address_and_contacts=*/true); + // Should contain 2 address components: address lines 1 & 2. EXPECT_EQ(description, u"666 Erebus St., Apt 8"); } +TEST(GetProfileDescription, NotIncludeAddressAndContacts) { + AutofillProfile profile = test::GetFullProfile(); + std::u16string description = GetProfileDescription( + profile, "en-US", /*include_address_and_contacts=*/false); + // Should contain full name only. + EXPECT_EQ(description, u"John H. Doe"); +} + } // namespace autofill
diff --git a/components/autofill/core/browser/autofill_metrics_unittest.cc b/components/autofill/core/browser/autofill_metrics_unittest.cc index c0d5a460..1dc9c8b 100644 --- a/components/autofill/core/browser/autofill_metrics_unittest.cc +++ b/components/autofill/core/browser/autofill_metrics_unittest.cc
@@ -17,6 +17,7 @@ #include "base/macros.h" #include "base/metrics/metrics_hashes.h" #include "base/metrics/statistics_recorder.h" +#include "base/strings/strcat.h" #include "base/strings/utf_string_conversions.h" #include "base/test/metrics/histogram_tester.h" #include "base/test/metrics/user_action_tester.h" @@ -11019,6 +11020,83 @@ } } +// Verify that no key metrics are logged in the ablation state. +TEST_F(AutofillMetricsFunnelTest, AblationState) { + base::FieldTrialParams feature_parameters{ + {features::kAutofillAblationStudyEnabledForAddressesParam.name, "true"}, + {features::kAutofillAblationStudyEnabledForPaymentsParam.name, "true"}, + {features::kAutofillAblationStudyAblationWeightPerMilleParam.name, + "1000"}, + }; + base::test::ScopedFeatureList scoped_feature_list; + scoped_feature_list.InitAndEnableFeatureWithParameters( + features::kAutofillEnableAblationStudy, feature_parameters); + + // Create a profile. + RecreateProfile(/*is_server=*/false); + + // Load a fillable form. + FormData form; + form.host_frame = test::GetLocalFrameToken(); + form.unique_renderer_id = test::MakeFormRendererId(); + form.name = u"TestForm"; + form.url = GURL("https://example.com/form.html"); + form.action = GURL("https://example.com/submit.html"); + form.main_frame_origin = url::Origin::Create(autofill_client_.form_origin()); + + FormFieldData field; + std::vector<ServerFieldType> field_types; + test::CreateTestFormField("State", "state", "", "text", &field); + form.fields.push_back(field); + field_types.push_back(ADDRESS_HOME_STATE); + test::CreateTestFormField("City", "city", "", "text", &field); + form.fields.push_back(field); + field_types.push_back(ADDRESS_HOME_CITY); + test::CreateTestFormField("Street", "street", "", "text", &field); + form.fields.push_back(field); + field_types.push_back(ADDRESS_HOME_STREET_ADDRESS); + + base::HistogramTester histogram_tester; + + // Simulate that the autofill manager has seen this form on page load. + browser_autofill_manager_->OnFormsSeen({form}); + + // Simulate interacting with the form. + browser_autofill_manager_->OnQueryFormFieldAutofill( + /*query_id=*/0, form, form.fields[0], gfx::RectF(), + /*autoselect_first_suggestion=*/false); + + // Don't simulate a suggestion but simulate the user typing. + browser_autofill_manager_->OnTextFieldDidChange(form, form.fields[0], + gfx::RectF(), TimeTicks()); + + // Simulate form submission. + browser_autofill_manager_->OnFormSubmitted(form, /*known_success=*/false, + SubmissionSource::FORM_SUBMISSION); + + // Reset |browser_autofill_manager_| to commit UMA metrics. + browser_autofill_manager_.reset(); + + // Phase 2: Validate Funnel expectations. + const char* kMetrics[] = { + "Autofill.Funnel.ParsedAsType", + "Autofill.Funnel.InteractionAfterParsedAsType", + "Autofill.Funnel.SuggestionAfterInteraction", + "Autofill.Funnel.FillAfterSuggestion", + "Autofill.Funnel.SubmissionAfterFill", + "Autofill.KeyMetrics.FillingReadiness", + "Autofill.KeyMetrics.FillingAcceptance", + "Autofill.KeyMetrics.FillingCorrectness", + "Autofill.KeyMetrics.FillingAssistance", + "Autofill.Autocomplete.NotOff.FillingAcceptance", + "Autofill.Autocomplete.Off.FillingAcceptance", + }; + for (const char* metric : kMetrics) { + histogram_tester.ExpectTotalCount(base::StrCat({metric, ".Address"}), 0); + histogram_tester.ExpectTotalCount(base::StrCat({metric, ".CreditCard"}), 0); + } +} + // Tests for Autofill.KeyMetrics.* metrics. class AutofillMetricsKeyMetricsTest : public AutofillMetricsTest { public:
diff --git a/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.cc b/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.cc index 13ba155..a40fab8 100644 --- a/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.cc +++ b/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios.cc
@@ -63,9 +63,11 @@ std::u16string AutofillSaveUpdateAddressProfileDelegateIOS::GetDescription() const { - return original_profile_ - ? GetDescriptionForProfileToUpdate(*original_profile_, locale_) - : GetDescriptionForProfileToSave(profile_, locale_); + // TODO(crbug.com/1167062): Pass proper `include_address_and_contacts` value + // and handle in UI empty description if needed. + return GetProfileDescription( + original_profile_ ? *original_profile_ : profile_, locale_, + /*include_address_and_contacts=*/true); } std::u16string
diff --git a/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios_unittest.cc b/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios_unittest.cc index 3954560..f34fb216 100644 --- a/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios_unittest.cc +++ b/components/autofill/core/browser/autofill_save_update_address_profile_delegate_ios_unittest.cc
@@ -57,7 +57,7 @@ EXPECT_EQ(delegate->GetMessageActionText(), std::u16string(u"Update...")); EXPECT_EQ(delegate->GetMessageText(), std::u16string(u"Update Address?")); EXPECT_EQ(delegate->GetDescription(), - std::u16string(u"John Doe \x2014 666 Erebus St.")); + std::u16string(u"John Doe, 666 Erebus St.")); } // Tests that delegate returns the correct profile difference.
diff --git a/components/autofill/core/browser/browser_autofill_manager.cc b/components/autofill/core/browser/browser_autofill_manager.cc index d36fc9b..8d3f0462 100644 --- a/components/autofill/core/browser/browser_autofill_manager.cc +++ b/components/autofill/core/browser/browser_autofill_manager.cc
@@ -2618,12 +2618,23 @@ context->conditional_ablation_group = !suggestions->empty() ? ablation_group : AblationGroup::kDefault; + // In both cases (credit card and address forms), we inform the other event + // logger also about the ablation. + // This prevents for example that for an encountered address form we log a + // sample Autofill.Funnel.ParsedAsType.CreditCard = 0 (which would be recorded + // by the credit_card_form_event_logger_). + // For the complementary event logger, the conditional ablation status is + // logged as kDefault to not imply that data would be filled without ablation. if (context->is_filling_credit_card) { credit_card_form_event_logger_->SetAblationStatus( context->ablation_group, context->conditional_ablation_group); + address_form_event_logger_->SetAblationStatus(context->ablation_group, + AblationGroup::kDefault); } else { address_form_event_logger_->SetAblationStatus( context->ablation_group, context->conditional_ablation_group); + credit_card_form_event_logger_->SetAblationStatus(context->ablation_group, + AblationGroup::kDefault); } if (!suggestions->empty() && ablation_group == AblationGroup::kAblation) {
diff --git a/components/autofill/core/browser/metrics/form_event_logger_base.cc b/components/autofill/core/browser/metrics/form_event_logger_base.cc index 89d80b5..924a995 100644 --- a/components/autofill/core/browser/metrics/form_event_logger_base.cc +++ b/components/autofill/core/browser/metrics/form_event_logger_base.cc
@@ -46,7 +46,10 @@ log_manager_(log_manager) {} FormEventLoggerBase::~FormEventLoggerBase() { - RecordFunnelAndKeyMetrics(); + // Don't record Funnel and Key metrics for the ablation group as they don't + // represent the true quality metrics. + if (ablation_group_ != AblationGroup::kAblation) + RecordFunnelAndKeyMetrics(); RecordAblationMetrics(); }
diff --git a/components/autofill/core/browser/payments/payments_client_unittest.cc b/components/autofill/core/browser/payments/payments_client_unittest.cc index de72a4e1..5919a012 100644 --- a/components/autofill/core/browser/payments/payments_client_unittest.cc +++ b/components/autofill/core/browser/payments/payments_client_unittest.cc
@@ -366,13 +366,14 @@ base::StringPiece phone_number) { AutofillProfile profile; - profile.SetInfo(NAME_FIRST, ASCIIToUTF16(first_name), "en-US"); - profile.SetInfo(NAME_LAST, ASCIIToUTF16(last_name), "en-US"); - profile.SetInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16(address_line), "en-US"); - profile.SetInfo(ADDRESS_HOME_CITY, ASCIIToUTF16(city), "en-US"); - profile.SetInfo(ADDRESS_HOME_STATE, ASCIIToUTF16(state), "en-US"); - profile.SetInfo(ADDRESS_HOME_ZIP, ASCIIToUTF16(zip), "en-US"); - profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, ASCIIToUTF16(phone_number), + profile.SetInfo(NAME_FIRST, base::ASCIIToUTF16(first_name), "en-US"); + profile.SetInfo(NAME_LAST, base::ASCIIToUTF16(last_name), "en-US"); + profile.SetInfo(ADDRESS_HOME_LINE1, base::ASCIIToUTF16(address_line), + "en-US"); + profile.SetInfo(ADDRESS_HOME_CITY, base::ASCIIToUTF16(city), "en-US"); + profile.SetInfo(ADDRESS_HOME_STATE, base::ASCIIToUTF16(state), "en-US"); + profile.SetInfo(ADDRESS_HOME_ZIP, base::ASCIIToUTF16(zip), "en-US"); + profile.SetInfo(PHONE_HOME_WHOLE_NUMBER, base::ASCIIToUTF16(phone_number), "en-US"); profile.FinalizeAfterImport(); return profile;
diff --git a/components/autofill/core/common/logging/log_buffer.cc b/components/autofill/core/common/logging/log_buffer.cc index 0020815c..caa66a1 100644 --- a/components/autofill/core/common/logging/log_buffer.cc +++ b/components/autofill/core/common/logging/log_buffer.cc
@@ -238,9 +238,8 @@ namespace { // Highlights the first |needle| in |haystack| by wrapping it in <b> tags. -template <typename CharT> -LogBuffer HighlightValueInternal(base::BasicStringPiece<CharT> haystack, - base::BasicStringPiece<CharT> needle) { +template <typename T, typename CharT = typename T::value_type> +LogBuffer HighlightValueInternal(T haystack, T needle) { using StringPieceT = base::BasicStringPiece<CharT>; LogBuffer buffer; size_t pos = haystack.find(needle);
diff --git a/components/autofill_assistant/browser/actions/show_generic_ui_action_unittest.cc b/components/autofill_assistant/browser/actions/show_generic_ui_action_unittest.cc index d701343..1f5eed8b 100644 --- a/components/autofill_assistant/browser/actions/show_generic_ui_action_unittest.cc +++ b/components/autofill_assistant/browser/actions/show_generic_ui_action_unittest.cc
@@ -254,6 +254,9 @@ autofill::test::SetProfileInfo( &profile_a, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "16505678910"); + AutofillProfileProto profile_a_proto; + profile_a_proto.set_guid(profile_a.guid()); + ON_CALL(mock_personal_data_manager_, IsAutofillProfileEnabled) .WillByDefault(Return(true)); ON_CALL(mock_personal_data_manager_, GetProfiles) @@ -264,7 +267,7 @@ // Keep action alive by storing it in local variable. auto action = Run(); - EXPECT_THAT(user_model_.GetProfile(profile_a.guid())->Compare(profile_a), + EXPECT_THAT(user_model_.GetProfile(profile_a_proto)->Compare(profile_a), Eq(0)); ValueProto expected_value; expected_value.set_is_client_side_only(true); @@ -277,13 +280,15 @@ "editor@gmail.com", "", "203 Barfield Lane", "", "Mountain View", "CA", "94043", "US", "+12345678901"); + AutofillProfileProto profile_b_proto; + profile_b_proto.set_guid(profile_b.guid()); ON_CALL(mock_personal_data_manager_, GetProfiles) .WillByDefault(Return( std::vector<autofill::AutofillProfile*>({&profile_a, &profile_b}))); mock_personal_data_manager_.NotifyPersonalDataObserver(); - EXPECT_THAT(user_model_.GetProfile(profile_a.guid())->Compare(profile_a), + EXPECT_THAT(user_model_.GetProfile(profile_a_proto)->Compare(profile_a), Eq(0)); - EXPECT_THAT(user_model_.GetProfile(profile_b.guid())->Compare(profile_b), + EXPECT_THAT(user_model_.GetProfile(profile_b_proto)->Compare(profile_b), Eq(0)); expected_value.mutable_profiles()->add_values()->set_guid(profile_b.guid()); EXPECT_THAT(user_model_.GetValue("profiles")->profiles().values(), @@ -294,8 +299,8 @@ .WillByDefault( Return(std::vector<autofill::AutofillProfile*>({&profile_b}))); mock_personal_data_manager_.NotifyPersonalDataObserver(); - EXPECT_EQ(user_model_.GetProfile(profile_a.guid()), nullptr); - EXPECT_THAT(user_model_.GetProfile(profile_b.guid())->Compare(profile_b), + EXPECT_EQ(user_model_.GetProfile(profile_a_proto), nullptr); + EXPECT_THAT(user_model_.GetProfile(profile_b_proto)->Compare(profile_b), Eq(0)); expected_value.Clear(); expected_value.set_is_client_side_only(true); @@ -309,8 +314,8 @@ .WillByDefault(Return( std::vector<autofill::AutofillProfile*>({&profile_a, &profile_b}))); mock_personal_data_manager_.NotifyPersonalDataObserver(); - EXPECT_EQ(user_model_.GetProfile(profile_a.guid()), nullptr); - EXPECT_THAT(user_model_.GetProfile(profile_b.guid())->Compare(profile_b), + EXPECT_EQ(user_model_.GetProfile(profile_a_proto), nullptr); + EXPECT_THAT(user_model_.GetProfile(profile_b_proto)->Compare(profile_b), Eq(0)); expected_value.Clear(); expected_value.set_is_client_side_only(true);
diff --git a/components/autofill_assistant/browser/actions/use_address_action.cc b/components/autofill_assistant/browser/actions/use_address_action.cc index 95f7af1..7cc2242 100644 --- a/components/autofill_assistant/browser/actions/use_address_action.cc +++ b/components/autofill_assistant/browser/actions/use_address_action.cc
@@ -96,9 +96,9 @@ return; } auto* profile = delegate_->GetUserModel()->GetProfile( - profile_value->profiles().values(0).guid()); + profile_value->profiles().values(0)); if (profile == nullptr) { - VLOG(1) << "UseAddress failed: profile not found for guid " + VLOG(1) << "UseAddress failed: profile not found for: " << *profile_value; EndAction(ClientStatus(PRECONDITION_FAILED)); return;
diff --git a/components/autofill_assistant/browser/basic_interactions.cc b/components/autofill_assistant/browser/basic_interactions.cc index 5964d283..dc73b0e 100644 --- a/components/autofill_assistant/browser/basic_interactions.cc +++ b/components/autofill_assistant/browser/basic_interactions.cc
@@ -187,8 +187,7 @@ DVLOG(2) << "Error evaluating " << __func__ << ": pattern not set"; return false; } - auto* profile = - user_model->GetProfile(value->profiles().values(i).guid()); + auto* profile = user_model->GetProfile(value->profiles().values(i)); if (!profile) { DVLOG(2) << "Error evaluating " << __func__ << ": profile not found"; return false;
diff --git a/components/autofill_assistant/browser/metrics.cc b/components/autofill_assistant/browser/metrics.cc index 53b9f56..143fe41 100644 --- a/components/autofill_assistant/browser/metrics.cc +++ b/components/autofill_assistant/browser/metrics.cc
@@ -197,10 +197,11 @@ } // static -void Metrics::RecordTriggerScriptFinished(ukm::UkmRecorder* ukm_recorder, - ukm::SourceId source_id, - TriggerUIType trigger_ui_type, - TriggerScriptFinishedState event) { +void Metrics::RecordTriggerScriptFinished( + ukm::UkmRecorder* ukm_recorder, + ukm::SourceId source_id, + TriggerScriptProto::TriggerUIType trigger_ui_type, + TriggerScriptFinishedState event) { ukm::builders::AutofillAssistant_LiteScriptFinished(source_id) .SetTriggerUIType(static_cast<int64_t>(trigger_ui_type)) .SetLiteScriptFinished(static_cast<int64_t>(event)) @@ -208,10 +209,11 @@ } // static -void Metrics::RecordTriggerScriptShownToUser(ukm::UkmRecorder* ukm_recorder, - ukm::SourceId source_id, - TriggerUIType trigger_ui_type, - TriggerScriptShownToUser event) { +void Metrics::RecordTriggerScriptShownToUser( + ukm::UkmRecorder* ukm_recorder, + ukm::SourceId source_id, + TriggerScriptProto::TriggerUIType trigger_ui_type, + TriggerScriptShownToUser event) { ukm::builders::AutofillAssistant_LiteScriptShownToUser(source_id) .SetTriggerUIType(static_cast<int64_t>(trigger_ui_type)) .SetLiteScriptShownToUser(static_cast<int64_t>(event)) @@ -219,10 +221,11 @@ } // static -void Metrics::RecordTriggerScriptOnboarding(ukm::UkmRecorder* ukm_recorder, - ukm::SourceId source_id, - TriggerUIType trigger_ui_type, - TriggerScriptOnboarding event) { +void Metrics::RecordTriggerScriptOnboarding( + ukm::UkmRecorder* ukm_recorder, + ukm::SourceId source_id, + TriggerScriptProto::TriggerUIType trigger_ui_type, + TriggerScriptOnboarding event) { ukm::builders::AutofillAssistant_LiteScriptOnboarding(source_id) .SetTriggerUIType(static_cast<int64_t>(trigger_ui_type)) .SetLiteScriptOnboarding(static_cast<int64_t>(event)) @@ -230,6 +233,15 @@ } // static +void Metrics::RecordInChromeTriggerAction(ukm::UkmRecorder* ukm_recorder, + ukm::SourceId source_id, + InChromeTriggerAction event) { + ukm::builders::AutofillAssistant_InChromeTriggering(source_id) + .SetInChromeTriggerAction(static_cast<int64_t>(event)) + .Record(ukm_recorder); +} + +// static void Metrics::RecordOnboardingResult(OnBoarding event) { DCHECK_LE(event, OnBoarding::kMaxValue); base::UmaHistogramEnumeration(kOnboardingEnumName, event);
diff --git a/components/autofill_assistant/browser/metrics.h b/components/autofill_assistant/browser/metrics.h index 99563c9e..12f421f 100644 --- a/components/autofill_assistant/browser/metrics.h +++ b/components/autofill_assistant/browser/metrics.h
@@ -335,6 +335,36 @@ kMaxValue = ONBOARDING_SEEN_AND_INTERRUPTED_BY_NAVIGATION }; + // Metric describing in-Chrome triggering. Only reported if the corresponding + // feature is enabled. + // + // This enum is used in UKM metrics, do not remove/renumber entries. Only add + // at the end and update kMaxValue. Also remember to update the + // AutofillAssistantInChromeTriggerAction enum listing in + // tools/metrics/histograms/enums.xml and the description in + // tools/metrics/ukm/ukm.xml as necessary. + enum class InChromeTriggerAction { + // No trigger script was requested for an unspecified reason. This is + // intended as a catch-all bucket and should ideally always be empty. + OTHER = 0, + // No trigger script was requested because the user has temporarily opted + // out of receiving implicit prompts for this domain (either until tab close + // or until the cache entry is stale, whichever is sooner). + USER_DENYLISTED_DOMAIN = 1, + // No trigger script was requested because an earlier request to the same + // domain failed and the cache was still fresh. + CACHE_HIT_UNSUPPORTED_DOMAIN = 2, + // No trigger script was requested because the heuristic response did not + // match any trigger intent. + NO_HEURISTIC_MATCH = 3, + // The heuristic reported a match and a trigger script was requested. + // Note that this does not indicate that a trigger script was fetched + // successfully, merely that it was requested. + TRIGGER_SCRIPT_REQUESTED = 4, + + kMaxValue = TRIGGER_SCRIPT_REQUESTED + }; + static void RecordDropOut(DropOutReason reason, const std::string& intent); static void RecordPaymentRequestPrefilledSuccess(bool initially_complete, bool success); @@ -351,18 +381,24 @@ StartupUtil::StartupMode startup_mode, bool feature_module_installed, bool is_first_time_user); - static void RecordTriggerScriptFinished(ukm::UkmRecorder* ukm_recorder, + static void RecordTriggerScriptFinished( + ukm::UkmRecorder* ukm_recorder, + ukm::SourceId source_id, + TriggerScriptProto::TriggerUIType trigger_ui_type, + TriggerScriptFinishedState event); + static void RecordTriggerScriptShownToUser( + ukm::UkmRecorder* ukm_recorder, + ukm::SourceId source_id, + TriggerScriptProto::TriggerUIType trigger_ui_type, + TriggerScriptShownToUser event); + static void RecordTriggerScriptOnboarding( + ukm::UkmRecorder* ukm_recorder, + ukm::SourceId source_id, + TriggerScriptProto::TriggerUIType trigger_ui_type, + TriggerScriptOnboarding event); + static void RecordInChromeTriggerAction(ukm::UkmRecorder* ukm_recorder, ukm::SourceId source_id, - TriggerUIType trigger_ui_type, - TriggerScriptFinishedState event); - static void RecordTriggerScriptShownToUser(ukm::UkmRecorder* ukm_recorder, - ukm::SourceId source_id, - TriggerUIType trigger_ui_type, - TriggerScriptShownToUser event); - static void RecordTriggerScriptOnboarding(ukm::UkmRecorder* ukm_recorder, - ukm::SourceId source_id, - TriggerUIType trigger_ui_type, - TriggerScriptOnboarding event); + InChromeTriggerAction event); static void RecordOnboardingResult(OnBoarding event); static void RecordFeatureModuleInstallation(FeatureModuleInstallation event);
diff --git a/components/autofill_assistant/browser/model.proto b/components/autofill_assistant/browser/model.proto index dc107d2b..f597857 100644 --- a/components/autofill_assistant/browser/model.proto +++ b/components/autofill_assistant/browser/model.proto
@@ -370,8 +370,12 @@ } message AutofillProfileProto { - // The GUID of the profile. - optional string guid = 1; + oneof identifier { + // The GUID of the profile. + string guid = 1; + // The selected profile for the given profile name. + string selected_profile_name = 2; + } } message LoginOptionProto {
diff --git a/components/autofill_assistant/browser/service.proto b/components/autofill_assistant/browser/service.proto index 9a96c55..76e08ae 100644 --- a/components/autofill_assistant/browser/service.proto +++ b/components/autofill_assistant/browser/service.proto
@@ -59,6 +59,10 @@ // triggered one. optional bool is_in_chrome_triggered = 17; + // The type of trigger script that was shown and accepted at the beginning of + // this flow, if any. + optional TriggerScriptProto.TriggerUIType trigger_ui_type = 18; + message DeviceContextProto { message VersionProto { // The Android SDK version of the device. @@ -597,6 +601,31 @@ ACCEPT = 5; } + // Set of TriggerUIType to group UKM metrics by. + // + // The set of available values is defined by AutofillAssistantTriggerUIType in + // tools/metrics/histograms/enums.xml + enum TriggerUIType { + UNSPECIFIED_TRIGGER_UI_TYPE = 0; + + // Explicit trigger requests by some external trigger surface, i.e., a link + // or button. + SHOPPING_CART_FIRST_TIME_USER = 1; + SHOPPING_CART_RETURNING_USER = 2; + SHOPPING_CHECKOUT_FIRST_TIME_USER = 3; + SHOPPING_CHECKOUT_RETURNING_USER = 4; + FOOD_ORDERING_CART_FIRST_TIME_USER = 9; + FOOD_ORDERING_CART_RETURNING_USER = 10; + + // Implicit trigger requests started by Chrome itself. + IN_CHROME_SHOPPING_CART_FIRST_TIME_USER = 5; + IN_CHROME_SHOPPING_CART_RETURNING_USER = 6; + IN_CHROME_SHOPPING_CHECKOUT_FIRST_TIME_USER = 7; + IN_CHROME_SHOPPING_CHECKOUT_RETURNING_USER = 8; + IN_CHROME_FOOD_ORDERING_CART_FIRST_TIME_USER = 11; + IN_CHROME_FOOD_ORDERING_CART_RETURNING_USER = 12; + } + // The |trigger_condition| must be true for the script to trigger. optional TriggerScriptConditionProto trigger_condition = 1; @@ -608,30 +637,9 @@ [default = CANCEL_SESSION]; // An identifier for the type of trigger UI this trigger represents, for UKM. - optional TriggerUIType trigger_ui_type = 5; + optional TriggerUIType trigger_ui_type = 7; - reserved 2, 6; -} - -// Set of TriggerUIType to group UKM metrics by. -// -// The set of available values is defined by AutofillAssistantTriggerUIType in -// tools/metrics/histograms/enums.xml -enum TriggerUIType { - UNSPECIFIED_TRIGGER_UI_TYPE = 0; - - // Explicit trigger requests by some external trigger surface, i.e., a link - // or button. - CART_FIRST_TIME_USER = 1; - CART_RETURNING_USER = 2; - CHECKOUT_FIRST_TIME_USER = 3; - CHECKOUT_RETURNING_USER = 4; - - // Implicit trigger requests started by Chrome itself. - IN_CHROME_CART_FIRST_TIME_USER = 5; - IN_CHROME_CART_RETURNING_USER = 6; - IN_CHROME_CHECKOUT_FIRST_TIME_USER = 7; - IN_CHROME_CHECKOUT_RETURNING_USER = 8; + reserved 2, 5, 6; } message TriggerScriptConditionProto {
diff --git a/components/autofill_assistant/browser/starter.cc b/components/autofill_assistant/browser/starter.cc index 22b5a72..bbb855bb 100644 --- a/components/autofill_assistant/browser/starter.cc +++ b/components/autofill_assistant/browser/starter.cc
@@ -249,11 +249,15 @@ } if (navigation_handle->HasCommitted() && !navigation_handle->IsErrorPage()) { - MaybeStartImplicitlyForUrl(navigation_handle->GetURL()); + MaybeStartImplicitlyForUrl( + navigation_handle->GetURL(), + ukm::ConvertToSourceId(navigation_handle->GetNavigationId(), + ukm::SourceIdType::NAVIGATION_ID)); } } -void Starter::MaybeStartImplicitlyForUrl(const GURL& url) { +void Starter::MaybeStartImplicitlyForUrl(const GURL& url, + const ukm::SourceId source_id) { if (!fetch_trigger_scripts_on_navigation_ || IsStartupPending() || platform_delegate_->IsRegularScriptRunning() || !url.is_valid()) { return; @@ -263,24 +267,44 @@ // the user has denylisted the domain, don't try again. base::TimeTicks now_ticks = tick_clock_->NowTicks(); if (HasFreshCacheEntry(*cached_failed_trigger_script_fetches_, url, - now_ticks - kMaxFailedTriggerScriptsCacheDuration) || - HasFreshCacheEntry(user_denylisted_domains_, url, + now_ticks - kMaxFailedTriggerScriptsCacheDuration)) { + Metrics::RecordInChromeTriggerAction( + ukm_recorder_, source_id, + Metrics::InChromeTriggerAction::CACHE_HIT_UNSUPPORTED_DOMAIN); + return; + } + if (HasFreshCacheEntry(user_denylisted_domains_, url, now_ticks - kMaxUserDenylistedCacheDuration)) { + Metrics::RecordInChromeTriggerAction( + ukm_recorder_, source_id, + Metrics::InChromeTriggerAction::USER_DENYLISTED_DOMAIN); return; } // Run the heuristic in a separate task. starter_heuristic_->RunHeuristicAsync( url, base::BindOnce(&Starter::OnHeuristicMatch, - weak_ptr_factory_.GetWeakPtr(), url)); + weak_ptr_factory_.GetWeakPtr(), url, source_id)); } void Starter::OnHeuristicMatch(const GURL& url, + const ukm::SourceId source_id, absl::optional<std::string> intent) { - if (!intent || IsStartupPending() || !fetch_trigger_scripts_on_navigation_) { + if (!intent) { + Metrics::RecordInChromeTriggerAction( + ukm_recorder_, source_id, + Metrics::InChromeTriggerAction::NO_HEURISTIC_MATCH); + return; + } + if (IsStartupPending() || !fetch_trigger_scripts_on_navigation_) { + Metrics::RecordInChromeTriggerAction(ukm_recorder_, source_id, + Metrics::InChromeTriggerAction::OTHER); return; } + Metrics::RecordInChromeTriggerAction( + ukm_recorder_, source_id, + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED); std::map<std::string, std::string> script_parameters = { {"ENABLED", "true"}, {"START_IMMEDIATELY", "false"}, @@ -369,7 +393,9 @@ } } else if (!prev_fetch_trigger_scripts_on_navigation && fetch_trigger_scripts_on_navigation_) { - MaybeStartImplicitlyForUrl(web_contents()->GetLastCommittedURL()); + MaybeStartImplicitlyForUrl( + web_contents()->GetLastCommittedURL(), + ukm::GetSourceIdForWebContentsDocument(web_contents())); } } @@ -520,7 +546,8 @@ script_parameters.GetBase64TriggerScriptsResponseProto().value()); if (!service_request_sender) { Metrics::RecordTriggerScriptFinished( - ukm_recorder_, next_ukm_source_id_, UNSPECIFIED_TRIGGER_UI_TYPE, + ukm_recorder_, next_ukm_source_id_, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptFinishedState::BASE64_DECODING_ERROR); OnTriggerScriptFinished( Metrics::TriggerScriptFinishedState::BASE64_DECODING_ERROR,
diff --git a/components/autofill_assistant/browser/starter.h b/components/autofill_assistant/browser/starter.h index 0a165a1..73ccb9b 100644 --- a/components/autofill_assistant/browser/starter.h +++ b/components/autofill_assistant/browser/starter.h
@@ -72,7 +72,8 @@ // Starts a flow for |url| if possible. Will fail (do nothing) if the feature // is disabled or if there is already a pending startup. - void MaybeStartImplicitlyForUrl(const GURL& url); + void MaybeStartImplicitlyForUrl(const GURL& url, + const ukm::SourceId source_id); // Cancels the currently pending startup request, if any. If a trigger script // is currently running, this will record |state| as the reason for stopping. @@ -118,7 +119,9 @@ absl::optional<TriggerScriptProto> trigger_script = absl::nullopt); // Called when the heuristic result for |url| is available. - void OnHeuristicMatch(const GURL& url, absl::optional<std::string> intent); + void OnHeuristicMatch(const GURL& url, + const ukm::SourceId source_id, + absl::optional<std::string> intent); // Returns whether there is a currently pending call to |Start| or not. bool IsStartupPending() const;
diff --git a/components/autofill_assistant/browser/starter_unittest.cc b/components/autofill_assistant/browser/starter_unittest.cc index f5b6ec8..3c9ade6 100644 --- a/components/autofill_assistant/browser/starter_unittest.cc +++ b/components/autofill_assistant/browser/starter_unittest.cc
@@ -151,29 +151,54 @@ // Returns a serialized GetTriggerScriptsResponseProto containing a single // trigger script without any trigger conditions. As such, it will be shown // immediately upon startup. - std::string CreateTriggerScriptResponseForTest() { + std::string CreateTriggerScriptResponseForTest( + TriggerScriptProto::TriggerUIType trigger_ui_type = + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE) { GetTriggerScriptsResponseProto get_trigger_scripts_response; - get_trigger_scripts_response.add_trigger_scripts(); + get_trigger_scripts_response.add_trigger_scripts()->set_trigger_ui_type( + trigger_ui_type); std::string serialized_get_trigger_scripts_response; get_trigger_scripts_response.SerializeToString( &serialized_get_trigger_scripts_response); return serialized_get_trigger_scripts_response; } - // Returns true if a specific |state| was recorded for |entry_name| and - // |metric_name|. - bool RecordedUkmMetric(base::StringPiece entry_name, - base::StringPiece metric_name, - int64_t expected_state, - const GURL& source_url) { + // Returns true if all |expected_impressions| were recorded, and there were no + // other impressions for the same metric. |expected_impressions| may contain + // duplicate values if multiple equivalent impressions are expected. + // Impressions can be specified in any order. + bool RecordedUkmMetric( + base::StringPiece entry_name, + base::StringPiece metric_name, + const std::vector<std::pair<GURL, int64_t>>& expected_impressions) { auto entries = ukm_recorder_.GetEntriesByName(entry_name); - if (entries.size() != 1) { + if (entries.size() != expected_impressions.size()) { + LOG(ERROR) << "Expected " << expected_impressions.size() + << " impressions, but got " << entries.size(); return false; } - ukm_recorder_.ExpectEntrySourceHasUrl(entries[0], source_url); - const int64_t* actual_state = - ukm_recorder_.GetEntryMetric(entries[0], metric_name); - return actual_state != nullptr && *actual_state == expected_state; + + auto remaining_impressions = expected_impressions; + while (!remaining_impressions.empty()) { + auto it = + std::find_if(entries.begin(), entries.end(), [&](const auto& entry) { + const ukm::UkmSource* src = + ukm_recorder_.GetSourceForSourceId(entry->source_id); + CHECK(src != nullptr); + return *ukm_recorder_.GetEntryMetric(entry, metric_name) == + remaining_impressions.begin()->second && + src->url() == remaining_impressions.begin()->first; + }); + if (it == entries.end()) { + LOG(ERROR) << "Impression not recorded: " + << remaining_impressions.begin()->first << ": " + << remaining_impressions.begin()->second; + return false; + } + + remaining_impressions.erase(remaining_impressions.begin()); + } + return true; } // Returns whether anything was recorded for |entry_name|. @@ -185,16 +210,16 @@ Metrics::TriggerScriptStarted state, const GURL& source_url = GURL(kExampleDeeplink)) { return RecordedUkmMetric("AutofillAssistant.LiteScriptStarted", - "LiteScriptStarted", static_cast<int64_t>(state), - source_url); + "LiteScriptStarted", + {{source_url, static_cast<int64_t>(state)}}); } bool UkmTriggerScriptFinished( Metrics::TriggerScriptFinishedState state, const GURL& source_url = GURL(kExampleDeeplink)) { return RecordedUkmMetric("AutofillAssistant.LiteScriptFinished", - "LiteScriptFinished", static_cast<int64_t>(state), - source_url); + "LiteScriptFinished", + {{source_url, static_cast<int64_t>(state)}}); } bool UkmTriggerScriptOnboarding( @@ -202,7 +227,24 @@ const GURL& source_url = GURL(kExampleDeeplink)) { return RecordedUkmMetric("AutofillAssistant.LiteScriptOnboarding", "LiteScriptOnboarding", - static_cast<int64_t>(result), source_url); + {{source_url, static_cast<int64_t>(result)}}); + } + + bool UkmInChromeTriggerAction( + const std::vector<std::pair<GURL, Metrics::InChromeTriggerAction>>& + expected_impressions) { + std::vector<std::pair<GURL, int64_t>> transformed_expected_impressions; + std::transform(expected_impressions.begin(), expected_impressions.end(), + std::back_inserter(transformed_expected_impressions), + [&](const auto& impression) { + return std::make_pair( + impression.first, + static_cast<int64_t>(impression.second)); + }); + + return RecordedUkmMetric("AutofillAssistant.InChromeTriggering", + "InChromeTriggerAction", + transformed_expected_impressions); } bool UkmTriggerScriptStarted() { @@ -217,6 +259,10 @@ return RecordedUkmMetric("AutofillAssistant.LiteScriptOnboarding"); } + bool UkmInChromeTriggerAction() { + return RecordedUkmMetric("AutofillAssistant.InChromeTriggering"); + } + // Simulates a navigation from the last committed URL to urls[size-1] along // the intermediate redirect-hops in |urls|. void SimulateRedirectToUrl(const std::vector<GURL>& urls) { @@ -639,16 +685,24 @@ ASSERT_TRUE(request.ParseFromString(request_body)); EXPECT_THAT(request.url(), Eq(GURL(kExampleDeeplink))); EXPECT_FALSE(request.client_context().is_in_chrome_triggered()); - std::move(callback).Run(net::HTTP_OK, - CreateTriggerScriptResponseForTest()); + std::move(callback).Run( + net::HTTP_OK, + CreateTriggerScriptResponseForTest( + TriggerScriptProto::SHOPPING_CART_FIRST_TIME_USER)); })); GetTriggerScriptsResponseProto get_trigger_scripts_response; get_trigger_scripts_response.ParseFromString( - CreateTriggerScriptResponseForTest()); - EXPECT_CALL(mock_start_regular_script_callback_, - Run(GURL(kExampleDeeplink), - Pointee(Property(&TriggerContext::GetOnboardingShown, true)), - Optional(get_trigger_scripts_response.trigger_scripts(0)))); + CreateTriggerScriptResponseForTest( + TriggerScriptProto::SHOPPING_CART_FIRST_TIME_USER)); + EXPECT_CALL( + mock_start_regular_script_callback_, + Run(GURL(kExampleDeeplink), + Pointee(AllOf( + Property(&TriggerContext::GetOnboardingShown, true), + Property(&TriggerContext::GetInChromeTriggered, false), + Property(&TriggerContext::GetTriggerUIType, + TriggerScriptProto::SHOPPING_CART_FIRST_TIME_USER))), + Optional(get_trigger_scripts_response.trigger_scripts(0)))); starter_->Start(std::make_unique<TriggerContext>( std::make_unique<ScriptParameters>(script_parameters), options)); @@ -984,8 +1038,10 @@ EXPECT_THAT(request.url(), Eq(GURL("https://www.some-website.com/cart"))); EXPECT_TRUE(request.client_context().is_in_chrome_triggered()); - std::move(callback).Run(net::HTTP_OK, - CreateTriggerScriptResponseForTest()); + std::move(callback).Run( + net::HTTP_OK, + CreateTriggerScriptResponseForTest( + TriggerScriptProto::SHOPPING_CART_RETURNING_USER)); })); EXPECT_CALL(*mock_trigger_script_ui_delegate_, ShowTriggerScript) .WillOnce([&]() { @@ -993,10 +1049,15 @@ trigger_script_coordinator_->PerformTriggerScriptAction( TriggerScriptProto::ACCEPT); }); - EXPECT_CALL(mock_start_regular_script_callback_, - Run(GURL("https://www.some-website.com/cart"), - Pointee(Property(&TriggerContext::GetOnboardingShown, false)), - testing::Ne(absl::nullopt))); + EXPECT_CALL( + mock_start_regular_script_callback_, + Run(GURL("https://www.some-website.com/cart"), + Pointee(AllOf( + Property(&TriggerContext::GetOnboardingShown, false), + Property(&TriggerContext::GetInChromeTriggered, true), + Property(&TriggerContext::GetTriggerUIType, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER))), + testing::Ne(absl::nullopt))); // Implicit startup by navigating to an autofill-assistant-enabled site. content::WebContentsTester::For(web_contents()) @@ -1012,6 +1073,12 @@ EXPECT_TRUE(UkmTriggerScriptOnboarding( Metrics::TriggerScriptOnboarding::ONBOARDING_ALREADY_ACCEPTED, GURL("https://www.some-website.com/cart"))); + EXPECT_TRUE(UkmInChromeTriggerAction( + {{GURL(kExampleDeeplink), + Metrics::InChromeTriggerAction::NO_HEURISTIC_MATCH}, + {GURL("https://www.some-website.com/cart"), + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED}})); + histogram_tester_.ExpectUniqueSample( "Android.AutofillAssistant.FeatureModuleInstallation", Metrics::FeatureModuleInstallation::DFM_ALREADY_INSTALLED, 1u); @@ -1032,6 +1099,8 @@ content::WebContentsTester::For(web_contents()) ->NavigateAndCommit(GURL("https://www.some-website.com/cart")); task_environment()->RunUntilIdle(); + + EXPECT_FALSE(UkmInChromeTriggerAction()); } TEST_F(StarterTest, ImplicitStartupOnCurrentUrlAfterSettingEnabled) { @@ -1065,6 +1134,9 @@ GURL("https://www.some-website.com/cart"))); EXPECT_FALSE(UkmTriggerScriptFinished()); EXPECT_FALSE(UkmTriggerScriptOnboarding()); + EXPECT_TRUE(UkmInChromeTriggerAction( + {{GURL("https://www.some-website.com/cart"), + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED}})); histogram_tester_.ExpectUniqueSample( "Android.AutofillAssistant.FeatureModuleInstallation", Metrics::FeatureModuleInstallation::DFM_ALREADY_INSTALLED, 1u); @@ -1275,6 +1347,7 @@ EXPECT_FALSE(UkmTriggerScriptStarted()); EXPECT_FALSE(UkmTriggerScriptFinished()); EXPECT_FALSE(UkmTriggerScriptOnboarding()); + EXPECT_FALSE(UkmInChromeTriggerAction()); histogram_tester_.ExpectTotalCount( "Android.AutofillAssistant.FeatureModuleInstallation", 0u); histogram_tester_.ExpectTotalCount("Android.AutofillAssistant.OnBoarding", @@ -1328,6 +1401,22 @@ content::WebContentsTester::For(web_contents()) ->NavigateAndCommit(GURL("https://www.different-website.com/cart")); task_environment()->RunUntilIdle(); + + EXPECT_TRUE(UkmInChromeTriggerAction( + {{GURL(kExampleDeeplink), + Metrics::InChromeTriggerAction::NO_HEURISTIC_MATCH}, + {GURL("https://www.some-website.com/cart"), + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED}, + {GURL("https://www.some-website.com/checkout"), + Metrics::InChromeTriggerAction::CACHE_HIT_UNSUPPORTED_DOMAIN}, + {GURL("https://some-website.com/signin"), + Metrics::InChromeTriggerAction::CACHE_HIT_UNSUPPORTED_DOMAIN}, + {GURL("https://signin.some-website.com"), + Metrics::InChromeTriggerAction::CACHE_HIT_UNSUPPORTED_DOMAIN}, + {GURL("https://www.some-website.com/cart"), + Metrics::InChromeTriggerAction::CACHE_HIT_UNSUPPORTED_DOMAIN}, + {GURL("https://www.different-website.com/cart"), + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED}})); } TEST_F(StarterTest, @@ -1381,6 +1470,22 @@ content::WebContentsTester::For(web_contents()) ->NavigateAndCommit(GURL("https://www.different-website.com/cart")); task_environment()->RunUntilIdle(); + + EXPECT_TRUE(UkmInChromeTriggerAction( + {{GURL(kExampleDeeplink), + Metrics::InChromeTriggerAction::NO_HEURISTIC_MATCH}, + {GURL("https://www.some-website.com/cart"), + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED}, + {GURL("https://www.some-website.com/checkout"), + Metrics::InChromeTriggerAction::USER_DENYLISTED_DOMAIN}, + {GURL("https://some-website.com/signin"), + Metrics::InChromeTriggerAction::USER_DENYLISTED_DOMAIN}, + {GURL("https://signin.some-website.com"), + Metrics::InChromeTriggerAction::USER_DENYLISTED_DOMAIN}, + {GURL("https://www.some-website.com/cart"), + Metrics::InChromeTriggerAction::USER_DENYLISTED_DOMAIN}, + {GURL("https://www.different-website.com/cart"), + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED}})); } TEST_F(StarterTest, EmptyTriggerScriptFetchesForImplicitStartupAreCached) { @@ -1434,6 +1539,20 @@ starter_->Start(std::make_unique<TriggerContext>( std::make_unique<ScriptParameters>(script_parameters), TriggerContext::Options{})); + + EXPECT_TRUE(UkmInChromeTriggerAction( + {{GURL(kExampleDeeplink), + Metrics::InChromeTriggerAction::NO_HEURISTIC_MATCH}, + {GURL("https://www.some-website.com/cart"), + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED}, + {GURL("https://www.some-website.com/checkout"), + Metrics::InChromeTriggerAction::CACHE_HIT_UNSUPPORTED_DOMAIN}, + {GURL("https://some-website.com/signin"), + Metrics::InChromeTriggerAction::CACHE_HIT_UNSUPPORTED_DOMAIN}, + {GURL("https://signin.some-website.com"), + Metrics::InChromeTriggerAction::CACHE_HIT_UNSUPPORTED_DOMAIN}, + {GURL("https://www.some-website.com/cart"), + Metrics::InChromeTriggerAction::CACHE_HIT_UNSUPPORTED_DOMAIN}})); } TEST_F(StarterTest, FailedExplicitTriggerFetchesAreCached) { @@ -1465,6 +1584,7 @@ EXPECT_THAT(*GetFailedTriggerFetchesCacheForTest(), UnorderedElementsAre(Pair("example.com", now_ticks), Pair("different.com", now_ticks))); + EXPECT_FALSE(UkmInChromeTriggerAction()); } TEST_F(StarterTest, FailedImplicitTriggerFetchesAreCached) { @@ -1493,6 +1613,13 @@ *GetFailedTriggerFetchesCacheForTest(), UnorderedElementsAre(Pair("example-shopping-site.com", now_ticks), Pair("different-shopping-site.com", now_ticks))); + EXPECT_TRUE(UkmInChromeTriggerAction( + {{GURL(kExampleDeeplink), + Metrics::InChromeTriggerAction::NO_HEURISTIC_MATCH}, + {GURL("https://www.example-shopping-site.com/cart"), + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED}, + {GURL("https://different-shopping-site.com/cart"), + Metrics::InChromeTriggerAction::TRIGGER_SCRIPT_REQUESTED}})); } TEST_F(StarterTest, FailedTriggerFetchesCacheEntriesExpire) {
diff --git a/components/autofill_assistant/browser/trigger_context.cc b/components/autofill_assistant/browser/trigger_context.cc index 0cecc56a..61d052d 100644 --- a/components/autofill_assistant/browser/trigger_context.cc +++ b/components/autofill_assistant/browser/trigger_context.cc
@@ -76,6 +76,9 @@ if (initial_url_.empty()) { initial_url_ = context->GetInitialUrl(); } + if (trigger_ui_type_ == TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE) { + trigger_ui_type_ = context->GetTriggerUIType(); + } } } @@ -121,4 +124,13 @@ return is_in_chrome_triggered_; } +TriggerScriptProto::TriggerUIType TriggerContext::GetTriggerUIType() const { + return trigger_ui_type_; +} + +void TriggerContext::SetTriggerUIType( + TriggerScriptProto::TriggerUIType trigger_ui_type) { + trigger_ui_type_ = trigger_ui_type; +} + } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/trigger_context.h b/components/autofill_assistant/browser/trigger_context.h index e208057..a14e614 100644 --- a/components/autofill_assistant/browser/trigger_context.h +++ b/components/autofill_assistant/browser/trigger_context.h
@@ -99,6 +99,14 @@ // i.e., a button or link on a website, or whether this is from within Chrome. virtual bool GetInChromeTriggered() const; + // Returns the trigger type of the trigger script that was shown and accepted + // at the beginning of the flow, if any. + virtual TriggerScriptProto::TriggerUIType GetTriggerUIType() const; + + // Sets the trigger type of the shown trigger script. + virtual void SetTriggerUIType( + TriggerScriptProto::TriggerUIType trigger_ui_type); + private: std::unique_ptr<ScriptParameters> script_parameters_; @@ -113,6 +121,8 @@ // The initial url at the time of triggering. std::string initial_url_; + TriggerScriptProto::TriggerUIType trigger_ui_type_ = + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE; }; } // namespace autofill_assistant
diff --git a/components/autofill_assistant/browser/trigger_context_unittest.cc b/components/autofill_assistant/browser/trigger_context_unittest.cc index e029318..bc1ffa35 100644 --- a/components/autofill_assistant/browser/trigger_context_unittest.cc +++ b/components/autofill_assistant/browser/trigger_context_unittest.cc
@@ -44,9 +44,14 @@ EXPECT_TRUE(context.GetDirectAction()); EXPECT_EQ(context.GetInitialUrl(), "https://www.example.com"); EXPECT_TRUE(context.GetInChromeTriggered()); + EXPECT_EQ(context.GetTriggerUIType(), + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE); context.SetOnboardingShown(false); EXPECT_FALSE(context.GetOnboardingShown()); + context.SetTriggerUIType(TriggerScriptProto::SHOPPING_CART_FIRST_TIME_USER); + EXPECT_EQ(context.GetTriggerUIType(), + TriggerScriptProto::SHOPPING_CART_FIRST_TIME_USER); } TEST(TriggerContextTest, MergeEmpty) { @@ -58,6 +63,8 @@ EXPECT_FALSE(merged.GetOnboardingShown()); EXPECT_FALSE(merged.GetDirectAction()); EXPECT_FALSE(merged.GetInChromeTriggered()); + EXPECT_EQ(merged.GetTriggerUIType(), + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE); } TEST(TriggerContextTest, MergeEmptyWithNonEmpty) { @@ -76,6 +83,9 @@ EXPECT_FALSE(merged.GetCCT()); EXPECT_FALSE(merged.GetOnboardingShown()); EXPECT_FALSE(merged.GetDirectAction()); + EXPECT_FALSE(merged.GetInChromeTriggered()); + EXPECT_EQ(merged.GetTriggerUIType(), + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE); } TEST(TriggerContextTest, MergeNonEmptyWithNonEmpty) { @@ -94,6 +104,8 @@ /* is_direct_action = */ true, /* initial_url = */ "https://www.example.com", /* is_in_chrome_triggered = */ true}; + context2.SetTriggerUIType( + TriggerScriptProto::SHOPPING_CHECKOUT_FIRST_TIME_USER); // Adding empty to make sure empty contexts are properly skipped. TriggerContext empty; @@ -107,6 +119,8 @@ EXPECT_TRUE(merged.GetDirectAction()); EXPECT_EQ(merged.GetInitialUrl(), "https://www.example.com"); EXPECT_TRUE(merged.GetInChromeTriggered()); + EXPECT_EQ(merged.GetTriggerUIType(), + TriggerScriptProto::SHOPPING_CHECKOUT_FIRST_TIME_USER); } TEST(TriggerContextTest, HasExperimentId) {
diff --git a/components/autofill_assistant/browser/trigger_scripts/trigger_script.h b/components/autofill_assistant/browser/trigger_scripts/trigger_script.h index bf6b4f9..54bf1bd 100644 --- a/components/autofill_assistant/browser/trigger_scripts/trigger_script.h +++ b/components/autofill_assistant/browser/trigger_scripts/trigger_script.h
@@ -33,7 +33,9 @@ bool waiting_for_precondition_no_longer_true() const; void waiting_for_precondition_no_longer_true(bool waiting); - TriggerUIType trigger_ui_type() const { return proto_.trigger_ui_type(); } + TriggerScriptProto::TriggerUIType trigger_ui_type() const { + return proto_.trigger_ui_type(); + } private: friend class TriggerScriptTest;
diff --git a/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator.cc b/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator.cc index db35f42..78630f5 100644 --- a/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator.cc +++ b/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator.cc
@@ -119,7 +119,8 @@ initial_trigger_condition_evaluations_; Metrics::RecordTriggerScriptShownToUser( - ukm_recorder_, ukm_source_id_, UNSPECIFIED_TRIGGER_UI_TYPE, + ukm_recorder_, ukm_source_id_, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptShownToUser::RUNNING); ui_delegate_->Attach(this); StartCheckingTriggerConditions(); @@ -170,7 +171,8 @@ // at all relevant places waiting_for_onboarding_ = false; if (visible_trigger_script_ != -1) { - TriggerUIType trigger_ui_type = GetTriggerUiTypeForVisibleScript(); + TriggerScriptProto::TriggerUIType trigger_ui_type = + GetTriggerUiTypeForVisibleScript(); if (onboardingShown) { switch (result) { case OnboardingResult::DISMISSED: @@ -262,7 +264,8 @@ void TriggerScriptCoordinator::Stop(Metrics::TriggerScriptFinishedState state) { VLOG(2) << "Stopping with status " << state; - TriggerUIType trigger_ui_type = GetTriggerUiTypeForVisibleScript(); + TriggerScriptProto::TriggerUIType trigger_ui_type = + GetTriggerUiTypeForVisibleScript(); HideTriggerScript(); StopCheckingTriggerConditions(); ui_delegate_->Detach(); @@ -533,7 +536,7 @@ } void TriggerScriptCoordinator::RunCallback( - TriggerUIType trigger_ui_type, + TriggerScriptProto::TriggerUIType trigger_ui_type, Metrics::TriggerScriptFinishedState state, const absl::optional<TriggerScriptProto>& trigger_script) { if (!finished_state_recorded_) { @@ -541,16 +544,17 @@ Metrics::RecordTriggerScriptFinished(ukm_recorder_, ukm_source_id_, trigger_ui_type, state); } + trigger_context_->SetTriggerUIType(trigger_ui_type); std::move(callback_).Run(state, std::move(trigger_context_), trigger_script); } -TriggerUIType TriggerScriptCoordinator::GetTriggerUiTypeForVisibleScript() - const { +TriggerScriptProto::TriggerUIType +TriggerScriptCoordinator::GetTriggerUiTypeForVisibleScript() const { if (visible_trigger_script_ >= 0 && static_cast<size_t>(visible_trigger_script_) < trigger_scripts_.size()) { return trigger_scripts_[visible_trigger_script_]->trigger_ui_type(); } - return UNSPECIFIED_TRIGGER_UI_TYPE; + return TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE; } GURL TriggerScriptCoordinator::GetCurrentURL() const {
diff --git a/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator.h b/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator.h index a53f496a..3d572af5 100644 --- a/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator.h +++ b/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator.h
@@ -145,7 +145,7 @@ // previous results to reuse. void RunOutOfScheduleTriggerConditionCheck(); - void RunCallback(TriggerUIType trigger_ui_type, + void RunCallback(TriggerScriptProto::TriggerUIType trigger_ui_type, Metrics::TriggerScriptFinishedState state, const absl::optional<TriggerScriptProto>& trigger_script); @@ -153,7 +153,7 @@ // // When recording a hide or stop action, be sure to capture the type before // hiding the script. - TriggerUIType GetTriggerUiTypeForVisibleScript() const; + TriggerScriptProto::TriggerUIType GetTriggerUiTypeForVisibleScript() const; // Delegate used to access settings and show the onboarding. StarterPlatformDelegate* starter_delegate_ = nullptr;
diff --git a/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator_unittest.cc b/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator_unittest.cc index 7bf7e435..cf401d2 100644 --- a/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator_unittest.cc +++ b/components/autofill_assistant/browser/trigger_scripts/trigger_script_coordinator_unittest.cc
@@ -119,7 +119,7 @@ content::WebContentsTester::For(web_contents())->TestSetIsLoading(false); } - void AssertRecordedFinishedState(TriggerUIType type, + void AssertRecordedFinishedState(TriggerScriptProto::TriggerUIType type, Metrics::TriggerScriptFinishedState state) { auto entries = ukm_recorder_.GetEntriesByName("AutofillAssistant.LiteScriptFinished"); @@ -133,7 +133,7 @@ // Make sure that an UKM entry with |state| has been recorded // |expected_times|, and has been associated each time with |type|. - void AssertRecordedShownToUserState(TriggerUIType type, + void AssertRecordedShownToUserState(TriggerScriptProto::TriggerUIType type, Metrics::TriggerScriptShownToUser state, int expected_times) { auto entries = ukm_recorder_.GetEntriesByName( @@ -152,7 +152,7 @@ } void AssertRecordedTriggerScriptOnboardingState( - TriggerUIType type, + TriggerScriptProto::TriggerUIType type, Metrics::TriggerScriptOnboarding state, int expected_times) { auto entries = ukm_recorder_.GetEntriesByName( @@ -247,7 +247,7 @@ coordinator_->Start(GURL(kFakeDeepLink), std::make_unique<TriggerContext>(), mock_callback_.Get()); AssertRecordedFinishedState( - UNSPECIFIED_TRIGGER_UI_TYPE, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptFinishedState::GET_ACTIONS_FAILED); } @@ -260,7 +260,7 @@ coordinator_->Start(GURL(kFakeDeepLink), std::make_unique<TriggerContext>(), mock_callback_.Get()); AssertRecordedFinishedState( - UNSPECIFIED_TRIGGER_UI_TYPE, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptFinishedState::GET_ACTIONS_PARSE_ERROR); } @@ -274,7 +274,7 @@ coordinator_->Start(GURL(kFakeDeepLink), std::make_unique<TriggerContext>(), mock_callback_.Get()); AssertRecordedFinishedState( - UNSPECIFIED_TRIGGER_UI_TYPE, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptFinishedState::NO_TRIGGER_SCRIPT_AVAILABLE); } @@ -427,7 +427,7 @@ TriggerScriptProto* script = response.add_trigger_scripts(); *script->mutable_trigger_condition()->mutable_selector() = ToSelectorProto("#selector"); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -448,7 +448,7 @@ EXPECT_CALL(*mock_ui_delegate_, HideTriggerScript).Times(1); coordinator_->PerformTriggerScriptAction(TriggerScriptProto::CANCEL_SESSION); AssertRecordedFinishedState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptFinishedState::PROMPT_FAILED_CANCEL_SESSION); } @@ -457,7 +457,7 @@ TriggerScriptProto* script = response.add_trigger_scripts(); *script->mutable_trigger_condition()->mutable_selector() = ToSelectorProto("#selector"); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -478,7 +478,7 @@ EXPECT_CALL(*mock_ui_delegate_, HideTriggerScript).Times(1); coordinator_->PerformTriggerScriptAction(TriggerScriptProto::CANCEL_FOREVER); AssertRecordedFinishedState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptFinishedState::PROMPT_FAILED_CANCEL_FOREVER); } @@ -487,7 +487,8 @@ TriggerScriptProto* script = response.add_trigger_scripts(); *script->mutable_trigger_condition()->mutable_selector() = ToSelectorProto("#selector"); - script->set_trigger_ui_type(CHECKOUT_RETURNING_USER); + script->set_trigger_ui_type( + TriggerScriptProto::SHOPPING_CHECKOUT_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -510,7 +511,7 @@ TriggerScriptProto* script = response.add_trigger_scripts(); *script->mutable_trigger_condition()->mutable_selector() = ToSelectorProto("#selector"); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -543,7 +544,7 @@ Run(Metrics::TriggerScriptFinishedState::PROMPT_FAILED_NAVIGATE, _, _)); SimulateNavigateToUrl(GURL("https://example.different.com/page")); AssertRecordedFinishedState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptFinishedState::PROMPT_FAILED_NAVIGATE); } @@ -552,7 +553,7 @@ TriggerScriptProto* script = response.add_trigger_scripts(); *script->mutable_trigger_condition()->mutable_selector() = ToSelectorProto("#selector"); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -588,7 +589,7 @@ _)); SimulateWebContentsVisibilityChanged(content::Visibility::VISIBLE); AssertRecordedFinishedState( - UNSPECIFIED_TRIGGER_UI_TYPE, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptFinishedState::NO_TRIGGER_SCRIPT_AVAILABLE); } @@ -596,7 +597,7 @@ GetTriggerScriptsResponseProto response; TriggerScriptProto* script = response.add_trigger_scripts(); script->set_on_swipe_to_dismiss(TriggerScriptProto::NOT_NOW); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -611,8 +612,8 @@ EXPECT_CALL(*mock_ui_delegate_, HideTriggerScript).Times(1); coordinator_->OnBottomSheetClosedWithSwipe(); AssertRecordedShownToUserState( - CART_RETURNING_USER, Metrics::TriggerScriptShownToUser::SWIPE_DISMISSED, - 1); + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, + Metrics::TriggerScriptShownToUser::SWIPE_DISMISSED, 1); } TEST_F(TriggerScriptCoordinatorTest, TimeoutAfterInvisibleForTooLong) { @@ -620,7 +621,8 @@ TriggerScriptProto* script = response.add_trigger_scripts(); *script->mutable_trigger_condition()->mutable_selector() = ToSelectorProto("#selector"); - script->set_trigger_ui_type(CHECKOUT_RETURNING_USER); + script->set_trigger_ui_type( + TriggerScriptProto::SHOPPING_CHECKOUT_RETURNING_USER); response.set_timeout_ms(3000); response.set_trigger_condition_check_interval_ms(1000); std::string serialized_response; @@ -648,7 +650,7 @@ _)); task_environment()->FastForwardBy(base::TimeDelta::FromSeconds(1)); AssertRecordedFinishedState( - UNSPECIFIED_TRIGGER_UI_TYPE, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptFinishedState::TRIGGER_CONDITION_TIMEOUT); } @@ -657,7 +659,7 @@ TriggerScriptProto* script = response.add_trigger_scripts(); *script->mutable_trigger_condition()->mutable_selector() = ToSelectorProto("#selector"); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); response.set_timeout_ms(3000); response.set_trigger_condition_check_interval_ms(1000); std::string serialized_response; @@ -694,7 +696,7 @@ _)); task_environment()->FastForwardBy(base::TimeDelta::FromSeconds(1)); AssertRecordedFinishedState( - UNSPECIFIED_TRIGGER_UI_TYPE, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptFinishedState::TRIGGER_CONDITION_TIMEOUT); } @@ -768,7 +770,7 @@ _)); task_environment()->FastForwardBy(base::TimeDelta::FromSeconds(1)); AssertRecordedFinishedState( - UNSPECIFIED_TRIGGER_UI_TYPE, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptFinishedState::TRIGGER_CONDITION_TIMEOUT); } @@ -861,7 +863,7 @@ TEST_F(TriggerScriptCoordinatorTest, OnTriggerScriptFailedToShow) { GetTriggerScriptsResponseProto response; TriggerScriptProto* script = response.add_trigger_scripts(); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -879,7 +881,8 @@ coordinator_->Start(GURL(kFakeDeepLink), std::make_unique<TriggerContext>(), mock_callback_.Get()); AssertRecordedFinishedState( - CART_RETURNING_USER, Metrics::TriggerScriptFinishedState::FAILED_TO_SHOW); + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, + Metrics::TriggerScriptFinishedState::FAILED_TO_SHOW); } TEST_F(TriggerScriptCoordinatorTest, OnProactiveHelpSettingDisabled) { @@ -906,7 +909,7 @@ SimulateWebContentsInteractabilityChanged(false); SimulateWebContentsInteractabilityChanged(true); AssertRecordedFinishedState( - UNSPECIFIED_TRIGGER_UI_TYPE, + TriggerScriptProto::UNSPECIFIED_TRIGGER_UI_TYPE, Metrics::TriggerScriptFinishedState::DISABLED_PROACTIVE_HELP_SETTING); } @@ -955,7 +958,7 @@ TEST_F(TriggerScriptCoordinatorTest, OnboardingShownAndAccepted) { GetTriggerScriptsResponseProto response; auto* script = response.add_trigger_scripts(); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -978,10 +981,10 @@ EXPECT_THAT(fake_platform_delegate_.num_show_onboarding_called_, Eq(1)); AssertRecordedTriggerScriptOnboardingState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptOnboarding::ONBOARDING_SEEN_AND_ACCEPTED, 1); AssertRecordedFinishedState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptFinishedState::PROMPT_SUCCEEDED); } @@ -991,7 +994,7 @@ GetTriggerScriptsResponseProto response; auto* script = response.add_trigger_scripts(); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -1029,18 +1032,18 @@ EXPECT_THAT(fake_platform_delegate_.num_show_onboarding_called_, Eq(4)); AssertRecordedTriggerScriptOnboardingState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptOnboarding::ONBOARDING_SEEN_AND_REJECTED, 1); AssertRecordedTriggerScriptOnboardingState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptOnboarding::ONBOARDING_SEEN_AND_ACCEPTED, 1); AssertRecordedTriggerScriptOnboardingState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptOnboarding:: ONBOARDING_SEEN_AND_INTERRUPTED_BY_NAVIGATION, 1); AssertRecordedFinishedState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptFinishedState::PROMPT_SUCCEEDED); } @@ -1050,7 +1053,7 @@ GetTriggerScriptsResponseProto response; auto* script = response.add_trigger_scripts(); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -1075,17 +1078,17 @@ EXPECT_THAT(fake_platform_delegate_.num_show_onboarding_called_, Eq(1)); AssertRecordedTriggerScriptOnboardingState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptOnboarding::ONBOARDING_SEEN_AND_REJECTED, 1); AssertRecordedFinishedState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptFinishedState::BOTTOMSHEET_ONBOARDING_REJECTED); } TEST_F(TriggerScriptCoordinatorTest, OnboardingNotShown) { GetTriggerScriptsResponseProto response; auto* script = response.add_trigger_scripts(); - script->set_trigger_ui_type(CART_RETURNING_USER); + script->set_trigger_ui_type(TriggerScriptProto::SHOPPING_CART_RETURNING_USER); std::string serialized_response; response.SerializeToString(&serialized_response); @@ -1106,10 +1109,10 @@ coordinator_->PerformTriggerScriptAction(TriggerScriptProto::ACCEPT); AssertRecordedTriggerScriptOnboardingState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptOnboarding::ONBOARDING_ALREADY_ACCEPTED, 1); AssertRecordedFinishedState( - CART_RETURNING_USER, + TriggerScriptProto::SHOPPING_CART_RETURNING_USER, Metrics::TriggerScriptFinishedState::PROMPT_SUCCEEDED); }
diff --git a/components/autofill_assistant/browser/user_model.cc b/components/autofill_assistant/browser/user_model.cc index cd24996..cde6943 100644 --- a/components/autofill_assistant/browser/user_model.cc +++ b/components/autofill_assistant/browser/user_model.cc
@@ -219,12 +219,20 @@ } const autofill::AutofillProfile* UserModel::GetProfile( - const std::string& guid) const { - auto it = profiles_.find(guid); - if (it == profiles_.end()) { - return nullptr; + const AutofillProfileProto& proto) const { + switch (proto.identifier_case()) { + case AutofillProfileProto::kGuid: { + auto it = profiles_.find(proto.guid()); + if (it == profiles_.end()) { + return nullptr; + } + return it->second.get(); + } + case AutofillProfileProto::kSelectedProfileName: + return GetSelectedAutofillProfile(proto.selected_profile_name()); + case AutofillProfileProto::IDENTIFIER_NOT_SET: + return nullptr; } - return it->second.get(); } const autofill::AutofillProfile* UserModel::GetSelectedAutofillProfile(
diff --git a/components/autofill_assistant/browser/user_model.h b/components/autofill_assistant/browser/user_model.h index 6b90767..6c54a43d 100644 --- a/components/autofill_assistant/browser/user_model.h +++ b/components/autofill_assistant/browser/user_model.h
@@ -109,8 +109,10 @@ // Returns the selected credit card or nullptr if no card has been selected. const autofill::CreditCard* GetSelectedCreditCard() const; - // Returns the profile with |guid| or nullptr if there is no such profile. - const autofill::AutofillProfile* GetProfile(const std::string& guid) const; + // Returns the profile specified by |proto| or nullptr if there is no such + // profile. + const autofill::AutofillProfile* GetProfile( + const AutofillProfileProto& proto) const; // Returns the selected profile for the specified |profile_name| or nullptr if // there is no such profile.
diff --git a/components/autofill_assistant/browser/user_model_unittest.cc b/components/autofill_assistant/browser/user_model_unittest.cc index 4657cc2..ffa865f2 100644 --- a/components/autofill_assistant/browser/user_model_unittest.cc +++ b/components/autofill_assistant/browser/user_model_unittest.cc
@@ -348,8 +348,13 @@ profiles->emplace_back( std::make_unique<autofill::AutofillProfile>(profile_b)); model_.SetAutofillProfiles(std::move(profiles)); - EXPECT_THAT(model_.GetProfile(profile_a.guid())->Compare(profile_a), Eq(0)); - EXPECT_THAT(model_.GetProfile(profile_b.guid())->Compare(profile_b), Eq(0)); + AutofillProfileProto profile_a_proto; + profile_a_proto.set_guid(profile_a.guid()); + AutofillProfileProto profile_b_proto; + profile_b_proto.set_guid(profile_b.guid()); + + EXPECT_THAT(model_.GetProfile(profile_a_proto)->Compare(profile_a), Eq(0)); + EXPECT_THAT(model_.GetProfile(profile_b_proto)->Compare(profile_b), Eq(0)); } TEST_F(UserModelTest, ClientSideOnlyNotifications) { @@ -385,6 +390,21 @@ EXPECT_THAT(user_data.selected_address("contact"), IsNull()); } +TEST_F(UserModelTest, GetProfileByProfileName) { + autofill::AutofillProfile profile(base::GenerateGUID(), kFakeUrl); + autofill::test::SetProfileInfo( + &profile, "Marion", "Mitchell", "Morrison", "marion@me.xyz", "Fox", + "123 Zoo St.", "unit 5", "Hollywood", "CA", "91601", "US", "16505678910"); + + UserData user_data; + model_.SetSelectedAutofillProfile( + "contact", std::make_unique<autofill::AutofillProfile>(profile), + &user_data); + AutofillProfileProto profile_proto; + profile_proto.set_selected_profile_name("contact"); + EXPECT_THAT(model_.GetProfile(profile_proto)->Compare(profile), Eq(0)); +} + TEST_F(UserModelTest, SetSelectedCreditCard) { autofill::CreditCard credit_card(base::GenerateGUID(), kFakeUrl); autofill::test::SetCreditCardInfo(&credit_card, "Marion Mitchell",
diff --git a/components/autofill_assistant/browser/value_util.cc b/components/autofill_assistant/browser/value_util.cc index 0c9d59d..de8730c 100644 --- a/components/autofill_assistant/browser/value_util.cc +++ b/components/autofill_assistant/browser/value_util.cc
@@ -168,7 +168,17 @@ bool operator==(const AutofillProfileProto& value_a, const AutofillProfileProto& value_b) { - return value_a.guid() == value_b.guid(); + if (value_a.identifier_case() != value_b.identifier_case()) + return false; + + switch (value_a.identifier_case()) { + case AutofillProfileProto::kGuid: + return value_a.guid() == value_b.guid(); + case AutofillProfileProto::kSelectedProfileName: + return value_a.selected_profile_name() == value_b.selected_profile_name(); + case AutofillProfileProto::IDENTIFIER_NOT_SET: + return true; + } } bool operator==(const LoginOptionProto& value_a, @@ -227,7 +237,16 @@ } std::ostream& operator<<(std::ostream& out, const AutofillProfileProto& value) { - out << value.guid(); + switch (value.identifier_case()) { + case AutofillProfileProto::kGuid: + out << "guid:" << value.guid(); + break; + case AutofillProfileProto::kSelectedProfileName: + out << "profile name:" << value.selected_profile_name(); + break; + case AutofillProfileProto::IDENTIFIER_NOT_SET: + break; + } return out; }
diff --git a/components/autofill_assistant/browser/value_util_unittest.cc b/components/autofill_assistant/browser/value_util_unittest.cc index 09caa4a..e580b728 100644 --- a/components/autofill_assistant/browser/value_util_unittest.cc +++ b/components/autofill_assistant/browser/value_util_unittest.cc
@@ -398,5 +398,34 @@ EXPECT_FALSE(ContainsClientOnlyValue({value_a, value_c})); } +TEST_F(ValueUtilTest, TestEqualOperatorForAutofillProfile) { + AutofillProfileProto profile_a; + AutofillProfileProto profile_b; + EXPECT_TRUE(profile_a == profile_b); + + profile_a.set_guid("guid_a"); + EXPECT_FALSE(profile_a == profile_b); + + profile_b.set_guid("guid_b"); + EXPECT_FALSE(profile_a == profile_b); + + profile_b.set_guid("guid_a"); + EXPECT_TRUE(profile_a == profile_b); + + profile_a.clear_guid(); + profile_a.set_selected_profile_name("name_a"); + EXPECT_FALSE(profile_a == profile_b); + + profile_b.clear_guid(); + profile_b.set_selected_profile_name("name_b"); + EXPECT_FALSE(profile_a == profile_b); + + profile_b.set_selected_profile_name("name_a"); + EXPECT_TRUE(profile_a == profile_b); + + profile_a.clear_selected_profile_name(); + EXPECT_FALSE(profile_a == profile_b); +} + } // namespace value_util } // namespace autofill_assistant
diff --git a/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTask.java b/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTask.java index ba2e6de..bac7af1 100644 --- a/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTask.java +++ b/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTask.java
@@ -121,7 +121,7 @@ String whereClause = directoryColumnName + " LIKE ? OR " + directoryColumnName + " LIKE ? OR " + directoryColumnName + " LIKE ? OR " + directoryColumnName - + " LIKE ?"; + + " LIKE ? OR " + directoryColumnName + " LIKE ?"; String additionalClause = ""; if (mIncludeImages) { additionalClause = MediaStore.Files.FileColumns.MEDIA_TYPE + "=" @@ -139,11 +139,16 @@ String downloadsDir = Environment.DIRECTORY_DOWNLOADS; // Files downloaded from the user's Google Photos library go to a Restored folder. String restoredDir = Environment.DIRECTORY_DCIM + "/Restored"; + // On some devices, such as Samsung and Redmi, the Screenshots folder is located under + // DCIM/Screenshots, as opposed to DCIM/Pictures/Screenshots. + String screenshotsDir = Environment.DIRECTORY_DCIM + "/Screenshots"; if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) { cameraDir = Environment.getExternalStoragePublicDirectory(cameraDir).toString(); picturesDir = Environment.getExternalStoragePublicDirectory(picturesDir).toString(); downloadsDir = Environment.getExternalStoragePublicDirectory(downloadsDir).toString(); restoredDir = Environment.getExternalStoragePublicDirectory(restoredDir).toString(); + screenshotsDir = + Environment.getExternalStoragePublicDirectory(screenshotsDir).toString(); } String[] whereArgs = new String[] { @@ -152,6 +157,7 @@ picturesDir + "%", downloadsDir + "%", restoredDir + "%", + screenshotsDir + "%", }; final String orderBy = MediaStore.MediaColumns.DATE_ADDED + " DESC";
diff --git a/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTaskTest.java b/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTaskTest.java index a50f8d4..2e915a5a 100644 --- a/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTaskTest.java +++ b/components/browser_ui/photo_picker/android/java/src/org/chromium/components/browser_ui/photo_picker/FileEnumWorkerTaskTest.java
@@ -204,7 +204,8 @@ String[] selectColumns = {MediaStore.Files.FileColumns._ID, MediaStore.Files.FileColumns.DATE_ADDED, MediaStore.Files.FileColumns.MEDIA_TYPE, MediaStore.Files.FileColumns.MIME_TYPE, MediaStore.Files.FileColumns.DATA}; - String whereClause = "_data LIKE ? OR _data LIKE ? OR _data LIKE ? OR _data LIKE ?"; + String whereClause = + "_data LIKE ? OR _data LIKE ? OR _data LIKE ? OR _data LIKE ? OR _data LIKE ?"; String orderBy = MediaStore.MediaColumns.DATE_ADDED + " DESC"; ArgumentCaptor<String[]> argument = ArgumentCaptor.forClass(String[].class); @@ -212,7 +213,7 @@ .query(eq(contentUri), eq(selectColumns), eq(whereClause), argument.capture(), eq(orderBy)); String[] actualWhereArgs = argument.getValue(); - Assert.assertEquals(4, actualWhereArgs.length); + Assert.assertEquals(5, actualWhereArgs.length); Assert.assertTrue(actualWhereArgs[0], actualWhereArgs[0].contains(Environment.DIRECTORY_DCIM + "/Camera")); Assert.assertTrue( @@ -221,6 +222,8 @@ actualWhereArgs[2], actualWhereArgs[2].contains(Environment.DIRECTORY_DOWNLOADS)); Assert.assertTrue(actualWhereArgs[3], actualWhereArgs[3].contains(Environment.DIRECTORY_DCIM + "/Restored")); + Assert.assertTrue(actualWhereArgs[4], + actualWhereArgs[4].contains(Environment.DIRECTORY_DCIM + "/Screenshots")); } @Test
diff --git a/components/client_hints/README.md b/components/client_hints/README.md index a75d8db0..202a31d 100644 --- a/components/client_hints/README.md +++ b/components/client_hints/README.md
@@ -83,7 +83,7 @@ **NOTE:** It’s very important that the order of these arrays remain in sync. -There should also be a new feature policy created, which should go in [/third_party/blink/renderer/core/feature_policy/feature_policy_features.json5](/third_party/blink/renderer/core/feature_policy/feature_policy_features.json5), and the header should be added to the cors `safe_names` list in [/services/network/public/cpp/cors/cors.cc](/services/network/public/cpp/cors/cors.cc) +There should also be a new feature policy created, which should go in [/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5](/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5), and the header should be added to the cors `safe_names` list in [/services/network/public/cpp/cors/cors.cc](/services/network/public/cpp/cors/cors.cc) TODO(crbug.com/1176808): There should be UseCounters measuring usage, but there are not currently.
diff --git a/components/continuous_search/common/title_validator.cc b/components/continuous_search/common/title_validator.cc index 177af6e..8cd5dee 100644 --- a/components/continuous_search/common/title_validator.cc +++ b/components/continuous_search/common/title_validator.cc
@@ -24,8 +24,8 @@ c != 0x000B; } -template <typename CharT> -std::basic_string<CharT> ValidateTitleT(base::BasicStringPiece<CharT> input) { +template <typename T, typename CharT = typename T::value_type> +std::basic_string<CharT> ValidateTitleT(T input) { auto begin_it = std::find_if(input.begin(), input.end(), base::not_fn(IsUnicodeWhitespaceOrControl)); auto end_it = std::find_if(input.rbegin(), input.rend(),
diff --git a/components/embedder_support/android/delegate/web_contents_delegate_android.cc b/components/embedder_support/android/delegate/web_contents_delegate_android.cc index e878f49..821efb22 100644 --- a/components/embedder_support/android/delegate/web_contents_delegate_android.cc +++ b/components/embedder_support/android/delegate/web_contents_delegate_android.cc
@@ -405,7 +405,11 @@ bool WebContentsDelegateAndroid::DoBrowserControlsShrinkRendererSize( content::WebContents* contents) { - return contents->GetNativeView()->ControlsResizeView(); + JNIEnv* env = AttachCurrentThread(); + ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); + if (obj.is_null()) + return false; + return Java_WebContentsDelegateAndroid_controlsResizeView(env, obj); } blink::mojom::DisplayMode WebContentsDelegateAndroid::GetDisplayMode(
diff --git a/components/embedder_support/android/java/src/org/chromium/components/embedder_support/delegate/WebContentsDelegateAndroid.java b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/delegate/WebContentsDelegateAndroid.java index 6f6200b..d015a39 100644 --- a/components/embedder_support/android/java/src/org/chromium/components/embedder_support/delegate/WebContentsDelegateAndroid.java +++ b/components/embedder_support/android/java/src/org/chromium/components/embedder_support/delegate/WebContentsDelegateAndroid.java
@@ -175,6 +175,14 @@ } /** + * @return Whether or not the browser controls resize Blink's view size. + */ + @CalledByNative + public boolean controlsResizeView() { + return false; + } + + /** * Check and return the {@link DisplayMode} value. * * @return The {@link DisplayMode} value.
diff --git a/components/error_page/common/localized_error.cc b/components/error_page/common/localized_error.cc index 09c0fdc3..c92890e 100644 --- a/components/error_page/common/localized_error.cc +++ b/components/error_page/common/localized_error.cc
@@ -928,6 +928,9 @@ result.strings.SetString( "dinoGameA11yStartGame", l10n_util::GetStringUTF16(IDS_ERRORPAGE_DINO_GAME_START)); + result.strings.SetString( + "dinoGameA11ySpeedToggle", + l10n_util::GetStringUTF16(IDS_ERRORPAGE_DINO_SLOW_SPEED_TOGGLE)); if (EnableAltGameMode()) { result.strings.SetBoolean("enableAltGameMode", true);
diff --git a/components/error_page_strings.grdp b/components/error_page_strings.grdp index 4c09565..2d96432c 100644 --- a/components/error_page_strings.grdp +++ b/components/error_page_strings.grdp
@@ -397,4 +397,7 @@ <message name="IDS_ERRORPAGE_DINO_JUMP" desc="Message to be spoken by a screen reader while the dino game is running to tell the user to jump because an obstacle is near."> Jump! </message> + <message name="IDS_ERRORPAGE_DINO_SLOW_SPEED_TOGGLE" desc="Label for a toggle which allows a user to select a slower speed for the dino game."> + Start slower + </message> </grit-part>
diff --git a/components/error_page_strings_grdp/IDS_ERRORPAGE_DINO_SLOW_SPEED_TOGGLE.png.sha1 b/components/error_page_strings_grdp/IDS_ERRORPAGE_DINO_SLOW_SPEED_TOGGLE.png.sha1 new file mode 100644 index 0000000..af61812 --- /dev/null +++ b/components/error_page_strings_grdp/IDS_ERRORPAGE_DINO_SLOW_SPEED_TOGGLE.png.sha1
@@ -0,0 +1 @@ +1fd277f722ecd0a83b5f711d8b52c8cf6fdbbe21 \ No newline at end of file
diff --git a/components/language/content/browser/ulp_language_code_locator/BUILD.gn b/components/language/content/browser/ulp_language_code_locator/BUILD.gn index 9b711fdb..b80435d4 100644 --- a/components/language/content/browser/ulp_language_code_locator/BUILD.gn +++ b/components/language/content/browser/ulp_language_code_locator/BUILD.gn
@@ -6,8 +6,7 @@ import("//build/config/python.gni") import("//testing/test.gni") -# TODO(crbug.com/1112471): Get this to run correctly under Python3. -python2_action("ulp_serialized_to_static_c") { +action("ulp_serialized_to_static_c") { script = "ulp_serialized_to_static_c.py" inputs = [ "geolanguage-data_rank0.bin",
diff --git a/components/language/content/browser/ulp_language_code_locator/ulp_serialized_to_static_c.py b/components/language/content/browser/ulp_language_code_locator/ulp_serialized_to_static_c.py index c3bf08c..009ec4a 100644 --- a/components/language/content/browser/ulp_language_code_locator/ulp_serialized_to_static_c.py +++ b/components/language/content/browser/ulp_language_code_locator/ulp_serialized_to_static_c.py
@@ -27,7 +27,7 @@ linebreak = data.index(b'\n') # First line is comma-separated list of languages. - language_codes = data[:linebreak].strip().split(b',') + language_codes = data[:linebreak].strip().decode(encoding="utf-8").split(',') # Rest of the file is the serialized tree. tree_bytes = data[linebreak+1:]
diff --git a/components/metrics/metrics_service_unittest.cc b/components/metrics/metrics_service_unittest.cc index 07ea5343..ebdd2065 100644 --- a/components/metrics/metrics_service_unittest.cc +++ b/components/metrics/metrics_service_unittest.cc
@@ -193,7 +193,7 @@ // the histogram was not found. int GetHistogramSampleCount(const ChromeUserMetricsExtension& uma_log, base::StringPiece histogram_name) { - const auto histogram_name_hash = HashMetricName(histogram_name); + const auto histogram_name_hash = base::HashMetricName(histogram_name); int samples = 0; for (int i = 0; i < uma_log.histogram_event_size(); ++i) { const auto& histogram = uma_log.histogram_event(i);
diff --git a/components/neterror/resources/neterror.css b/components/neterror/resources/neterror.css index c67d28ff..d16e7ae 100644 --- a/components/neterror/resources/neterror.css +++ b/components/neterror/resources/neterror.css
@@ -812,16 +812,9 @@ display: none; } -/* iOS WKWebView inverts the background color set at the HTML level -whereas Blink does not. */ .offline.inverted { - filter: invert(1); -<if expr="not is_ios"> - background-color: #000; -</if> -<if expr="is_ios"> background-color: #fff; -</if> + filter: invert(1); } .offline.inverted body { @@ -835,6 +828,7 @@ margin: 0 auto; max-width: 600px; padding-top: 100px; + position: relative; width: 100%; } @@ -896,6 +890,90 @@ font-size: xx-small; position: absolute; text-align: center; + transition: color 1.5s cubic-bezier(0.65, 0.05, 0.36, 1); +} + +/* Custom toggle */ +.slow-speed-toggle { + align-items: center; + background: var(--google-gray-50); + border-radius: 24px/50%; + bottom: 0; + color: var(--error-code-color); + display: inline-flex; + font-size: 1em; + left: 0; + line-height: 1.1em; + margin: 5px auto; + padding: 2px 12px 3px 20px; + position: absolute; + right: 0; + width: max-content; + z-index: 999; +} + +.slow-speed-toggle.hidden { + display: none; +} + +.slow-speed-toggle [type=checkbox] { + opacity: 0; + pointer-events: none; + position: absolute; +} + +.slow-speed-toggle .slow-speed-toggle { + cursor: pointer; + margin-inline-start: 8px; + padding: 8px 4px; + position: relative; +} + +.slow-speed-toggle [type=checkbox] { + opacity: 0; + pointer-events: none; + position: absolute; +} + +.slow-speed-toggle .slow-speed-toggle::before, +.slow-speed-toggle .slow-speed-toggle::after { + content: ''; + display: block; + margin: 0 3px; + transition: all 100ms cubic-bezier(0.4, 0, 1, 1); +} + +.slow-speed-toggle .slow-speed-toggle::before { + background: rgb(189,193,198); + border-radius: 0.65em; + height: 0.9em; + width: 2em; +} + +.slow-speed-toggle .slow-speed-toggle::after { + background: #fff; + border-radius: 50%; + box-shadow: 0 1px 3px 0 rgb(0 0 0 / 40%); + height: 1.2em; + position: absolute; + top: 51%; + transform: translate(-20%, -50%); + width: 1.1em; +} + +.slow-speed-toggle [type=checkbox]:focus + .slow-speed-toggle { + box-shadow: 0 0 8px rgb(94, 158, 214); + outline: 1px solid rgb(93, 157, 213); +} + +.slow-speed-toggle [type=checkbox]:checked + .slow-speed-toggle::before { + background: var(--google-blue-600); + opacity: 0.5; +} + +.slow-speed-toggle [type=checkbox]:checked + .slow-speed-toggle::after { + background: var(--google-blue-600); + transform: translate(calc(2em - 90%), -50%); } @media (max-width: 420px) { @@ -1030,19 +1108,18 @@ } .offline.inverted { - filter: invert(0); - <if expr="not is_ios"> background-color: var(--background-color); - </if> - <if expr="is_ios"> - background-color: #fff; - </if> + filter: invert(0); } .offline.inverted body { background-color: #fff; } + .offline.inverted .offline-runner-live-region { + color: #fff; + } + #suggestions-list a { color: var(--link-color); } @@ -1050,4 +1127,18 @@ #error-information-button { filter: invert(0.6); } + + .slow-speed-toggle { + background: var(--google-gray-800); + color: var(--google-gray-100); + } + + .slow-speed-toggle .slow-speed-toggle::before { + background: rgb(189,193,198); + } + + .slow-speed-toggle [type=checkbox]:checked + .slow-speed-toggle::after, + .slow-speed-toggle [type=checkbox]:checked + .slow-speed-toggle::before { + background: var(--google-blue-300); + } }
diff --git a/components/neterror/resources/offline.js b/components/neterror/resources/offline.js index 024a6fb..b8f34a0 100644 --- a/components/neterror/resources/offline.js +++ b/components/neterror/resources/offline.js
@@ -23,7 +23,7 @@ // A div to intercept touch events. Only set while (playing && useTouch). this.touchController = null; - this.config = opt_config || Runner.config; + this.config = opt_config || Object.assign(Runner.config, Runner.normalConfig); // Logical dimensions of the container. this.dimensions = Runner.defaultDimensions; @@ -50,6 +50,7 @@ this.runningTime = 0; this.msPerFrame = 1000 / FPS; this.currentSpeed = this.config.SPEED; + Runner.slowDown = false; this.obstacles = []; @@ -132,14 +133,16 @@ gameOver: 'dinoGameA11yGameOver', highScore: 'dinoGameA11yHighScore', jump: 'dinoGameA11yJump', - started: 'dinoGameA11yStartGame' + started: 'dinoGameA11yStartGame', + speedLabel: 'dinoGameA11ySpeedToggle' }; /** * Default game configuration. + * Shared config for all versions of the game. Additional parameters are + * defined in Runner.normalConfig and Runner.slowConfig. */ Runner.config = { - ACCELERATION: 0.001, AUDIOCUE_PROXIMITY_THRESHOLD: 190, AUDIOCUE_PROXIMITY_THRESHOLD_MOBILE_A11Y: 250, BG_CLOUD_SPEED: 0.2, @@ -151,18 +154,12 @@ FADE_DURATION: 1, FLASH_DURATION: 1000, GAMEOVER_CLEAR_TIME: 1200, - GAP_COEFFICIENT: 0.6, - GRAVITY: 0.6, INITIAL_JUMP_VELOCITY: 12, INVERT_FADE_DURATION: 12000, - INVERT_DISTANCE: 700, MAX_BLINK_COUNT: 3, MAX_CLOUDS: 6, MAX_OBSTACLE_LENGTH: 3, MAX_OBSTACLE_DUPLICATION: 2, - MAX_SPEED: 13, - MIN_JUMP_HEIGHT: 35, - MOBILE_SPEED_COEFFICIENT: 1.2, RESOURCE_TEMPLATE_ID: 'audio-resources', SPEED: 6, SPEED_DROP_COEFFICIENT: 3, @@ -170,6 +167,29 @@ ARCADE_MODE_TOP_POSITION_PERCENT: 0.1 }; +Runner.normalConfig = { + ACCELERATION: 0.001, + AUDIOCUE_PROXIMITY_THRESHOLD: 190, + AUDIOCUE_PROXIMITY_THRESHOLD_MOBILE_A11Y: 250, + GAP_COEFFICIENT: 0.6, + INVERT_DISTANCE: 700, + MAX_SPEED: 13, + MOBILE_SPEED_COEFFICIENT: 1.2, + SPEED: 6 +}; + + +Runner.slowConfig = { + ACCELERATION: 0.0005, + AUDIOCUE_PROXIMITY_THRESHOLD: 170, + AUDIOCUE_PROXIMITY_THRESHOLD_MOBILE_A11Y: 220, + GAP_COEFFICIENT: 0.3, + INVERT_DISTANCE: 350, + MAX_SPEED: 9, + MOBILE_SPEED_COEFFICIENT: 1.5, + SPEED: 4.2 +}; + /** * Default dimensions. @@ -393,8 +413,9 @@ // Reduce the speed on smaller mobile screens. if (this.dimensions.WIDTH < DEFAULT_WIDTH) { - const mobileSpeed = speed * this.dimensions.WIDTH / DEFAULT_WIDTH * - this.config.MOBILE_SPEED_COEFFICIENT; + const mobileSpeed = Runner.slowDown ? speed : + speed * this.dimensions.WIDTH / + DEFAULT_WIDTH * this.config.MOBILE_SPEED_COEFFICIENT; this.currentSpeed = mobileSpeed > speed ? speed : mobileSpeed; } else if (opt_speed) { this.currentSpeed = opt_speed; @@ -431,6 +452,25 @@ this.a11yStatusEl.textContent = ''; Runner.a11yStatusEl = this.a11yStatusEl; + // Add checkbox to slow down the game. + this.slowSpeedCheckboxLabel = document.createElement('label'); + this.slowSpeedCheckboxLabel.className = 'slow-speed-toggle hidden'; + this.slowSpeedCheckboxLabel.textContent = + getA11yString(A11Y_STRINGS.speedLabel); + + this.slowSpeedCheckbox = document.createElement('input'); + this.slowSpeedCheckbox.setAttribute('type', 'checkbox'); + this.slowSpeedCheckbox.setAttribute( + 'title', getA11yString(A11Y_STRINGS.speedLabel)); + this.slowSpeedCheckbox.setAttribute('tabindex', '0'); + this.slowSpeedCheckbox.setAttribute('checked', 'checked'); + + this.slowSpeedToggleEl = document.createElement('span'); + this.slowSpeedToggleEl.className = 'slow-speed-toggle'; + + this.slowSpeedCheckboxLabel.appendChild(this.slowSpeedCheckbox); + this.slowSpeedCheckboxLabel.appendChild(this.slowSpeedToggleEl); + if (IS_IOS) { this.outerContainerEl.appendChild(this.a11yStatusEl); } else { @@ -457,6 +497,7 @@ this.tRex = new Trex(this.canvas, this.spriteDef.TREX); this.outerContainerEl.appendChild(this.containerEl); + this.outerContainerEl.appendChild(this.slowSpeedCheckboxLabel); this.startListening(); this.update(); @@ -580,6 +621,7 @@ if (this.isArcadeMode()) { this.setArcadeMode(); } + this.toggleSpeed(); this.runningTime = 0; this.playingIntro = false; this.tRex.playingIntro = false; @@ -808,6 +850,7 @@ */ handleCanvasKeyPress(e) { if (!this.activated) { + this.toggleSpeed(); Runner.audioCues = true; this.generatedSoundFx.init(); Runner.generatedSoundFx = this.generatedSoundFx; @@ -828,12 +871,62 @@ }, /** + * Toggle speed setting if toggle is shown. + */ + toggleSpeed() { + if (Runner.audioCues) { + const speedChange = Runner.slowDown != this.slowSpeedCheckbox.checked; + + if (speedChange) { + Runner.slowDown = this.slowSpeedCheckbox.checked; + const updatedConfig = + Runner.slowDown ? Runner.slowConfig : Runner.normalConfig; + + Runner.config = Object.assign(Runner.config, updatedConfig); + this.currentSpeed = updatedConfig.SPEED; + this.tRex.enableSlowConfig(); + this.horizon.adjustObstacleSpeed(); + } + this.disableSpeedToggle(true); + } + }, + + /** + * Show the speed toggle. + * From focus event or when audio cues are activated. + * @param {Event=} e + */ + showSpeedToggle(e) { + const isFocusEvent = e && e.type == 'focus'; + if (Runner.audioCues || isFocusEvent) { + this.slowSpeedCheckboxLabel.classList.toggle( + HIDDEN_CLASS, isFocusEvent ? false : !this.crashed); + } + }, + + /** + * Disable the speed toggle. + * @param {boolean} disable + */ + disableSpeedToggle(disable) { + if (disable) { + this.slowSpeedCheckbox.setAttribute('disabled', 'disabled'); + } else { + this.slowSpeedCheckbox.removeAttribute('disabled'); + } + }, + + /** * Bind relevant key / mouse / touch listeners. */ startListening() { // A11y keyboard / screen reader activation. this.containerEl.addEventListener( Runner.events.KEYDOWN, this.handleCanvasKeyPress.bind(this)); + if (!IS_MOBILE) { + this.containerEl.addEventListener( + Runner.events.FOCUS, this.showSpeedToggle.bind(this)); + } this.canvas.addEventListener( Runner.events.KEYDOWN, this.preventScrolling.bind(this)); this.canvas.addEventListener( @@ -886,6 +979,12 @@ } if (this.isCanvasInView()) { + // Allow toggling of speed toggle. + if (Runner.keycodes.JUMP[e.keyCode] && + e.target == this.slowSpeedCheckbox) { + return; + } + if (!this.crashed && !this.paused) { // For a11y, screen reader activation. const isMobileMouseInput = IS_MOBILE && @@ -937,11 +1036,6 @@ this.tRex.setDuck(true); } } - // iOS only triggers touchstart and no pointer events. - } else if ( - IS_IOS && this.crashed && e.type === Runner.events.TOUCHSTART && - e.currentTarget === this.containerEl) { - this.handleGameOverClicks(e); } } }, @@ -1072,19 +1166,21 @@ * @param {Event} e */ handleGameOverClicks(e) { - e.preventDefault(); - if (this.distanceMeter.hasClickedOnHighScore(e) && this.highestScore) { - if (this.distanceMeter.isHighScoreFlashing()) { - // Subsequent click, reset the high score. - this.saveHighScore(0, true); - this.distanceMeter.resetHighScore(); + if (e.target != this.slowSpeedCheckbox) { + e.preventDefault(); + if (this.distanceMeter.hasClickedOnHighScore(e) && this.highestScore) { + if (this.distanceMeter.isHighScoreFlashing()) { + // Subsequent click, reset the high score. + this.saveHighScore(0, true); + this.distanceMeter.resetHighScore(); + } else { + // First click, flash the high score. + this.distanceMeter.startHighScoreFlashing(); + } } else { - // First click, flash the high score. - this.distanceMeter.startHighScoreFlashing(); + this.distanceMeter.cancelHighScoreFlashing(); + this.restart(); } - } else { - this.distanceMeter.cancelHighScoreFlashing(); - this.restart(); } }, @@ -1214,6 +1310,8 @@ this.distanceMeter.getActualDistance(this.highestScore) .toString())); } + this.showSpeedToggle(); + this.disableSpeedToggle(false); }, stop() { @@ -1240,6 +1338,7 @@ this.playCount++; this.runningTime = 0; this.setPlayStatus(true); + this.toggleSpeed(); this.paused = false; this.crashed = false; this.distanceRan = 0; @@ -1531,8 +1630,8 @@ jump() { if (this.audioCues) { const now = this.context.currentTime; - this.playNote(659.25, now, 0.116, null, -0.6); - this.playNote(880, now + 0.116, 0.232, null, -0.6); + this.playNote(659.25, now, 0.116, 0.3, -0.6); + this.playNote(880, now + 0.116, 0.232, 0.3, -0.6); } }, }; @@ -2089,7 +2188,7 @@ this.canvasCtx = canvasCtx; this.spritePos = spriteImgPos; this.typeConfig = type; - this.gapCoefficient = gapCoefficient; + this.gapCoefficient = Runner.slowDown ? gapCoefficient * 2 : gapCoefficient; this.size = getRandomNum(1, Obstacle.MAX_OBSTACLE_LENGTH); this.dimensions = dimensions; this.remove = false; @@ -2296,7 +2395,7 @@ this.animStartTime = 0; this.timer = 0; this.msPerFrame = 1000 / FPS; - this.config = Trex.config; + this.config = Object.assign(Trex.config, Trex.normalJumpConfig); // Current status. this.status = Trex.status.WAITING; this.jumping = false; @@ -2320,13 +2419,9 @@ DROP_VELOCITY: -5, FLASH_OFF: 175, FLASH_ON: 100, - GRAVITY: 0.6, HEIGHT: 47, HEIGHT_DUCK: 25, - INITIAL_JUMP_VELOCITY: -10, INTRO_DURATION: 1500, - MAX_JUMP_HEIGHT: 30, - MIN_JUMP_HEIGHT: 30, SPEED_DROP_COEFFICIENT: 3, SPRITE_WIDTH: 262, START_X_POS: 50, @@ -2334,22 +2429,30 @@ WIDTH_DUCK: 59 }; +Trex.slowJumpConfig = { + GRAVITY: 0.25, + MAX_JUMP_HEIGHT: 50, + MIN_JUMP_HEIGHT: 45, + INITIAL_JUMP_VELOCITY: -20, +}; + +Trex.normalJumpConfig = { + GRAVITY: 0.6, + MAX_JUMP_HEIGHT: 30, + MIN_JUMP_HEIGHT: 30, + INITIAL_JUMP_VELOCITY: -10, +}; /** * Used in collision detection. * @enum {Array<CollisionBox>} */ Trex.collisionBoxes = { - DUCKING: [ - new CollisionBox(1, 18, 55, 25) - ], + DUCKING: [new CollisionBox(1, 18, 55, 25)], RUNNING: [ - new CollisionBox(22, 0, 17, 16), - new CollisionBox(1, 18, 30, 9), - new CollisionBox(10, 35, 14, 8), - new CollisionBox(1, 24, 29, 5), - new CollisionBox(5, 30, 21, 4), - new CollisionBox(9, 34, 15, 4) + new CollisionBox(22, 0, 17, 16), new CollisionBox(1, 18, 30, 9), + new CollisionBox(10, 35, 14, 8), new CollisionBox(1, 24, 29, 5), + new CollisionBox(5, 30, 21, 4), new CollisionBox(9, 34, 15, 4) ] }; @@ -2416,6 +2519,16 @@ this.update(0, Trex.status.WAITING); }, + /** + * Assign the appropriate jump parameters based on the game speed. + */ + enableSlowConfig: function() { + const jumpConfig = + Runner.slowDown ? Trex.slowJumpConfig : Trex.normalJumpConfig; + Trex.config = Object.assign(Trex.config, jumpConfig); + + this.adjustAltGameConfigForSlowSpeed(); + }, /** * Enables the alternative game. Redefines the dino config. @@ -2450,6 +2563,7 @@ Trex.config.WIDTH_JUMP = spriteDefinition.JUMPING.w; Trex.config.INVERT_JUMP = spriteDefinition.INVERT_JUMP; + this.adjustAltGameConfigForSlowSpeed(spriteDefinition.GRAVITY); this.config = Trex.config; // Adjust bottom horizon placement. @@ -2460,6 +2574,22 @@ }, /** + * Slow speeds adjustments for the alt game modes. + * @param {number=} opt_gravityValue + */ + adjustAltGameConfigForSlowSpeed: function(opt_gravityValue) { + if (Runner.slowDown) { + if (opt_gravityValue) { + Trex.config.GRAVITY = opt_gravityValue / 1.5; + } + Trex.config.MIN_JUMP_HEIGHT *= 1.5; + Trex.config.MAX_JUMP_HEIGHT *= 1.5; + Trex.config.INITIAL_JUMP_VELOCITY = + Trex.config.INITIAL_JUMP_VELOCITY * 1.5; + } + }, + + /** * Setter whether dino is flashing. * @param {boolean} status */ @@ -3739,6 +3869,25 @@ }, /** + * Update obstacle definitions based on the speed of the game. + */ + adjustObstacleSpeed: function() { + for (let i = 0; i < Obstacle.types.length; i++) { + if (Runner.slowDown) { + Obstacle.types[i].multipleSpeed = Obstacle.types[i].multipleSpeed / 2; + Obstacle.types[i].minGap *= 1.5; + Obstacle.types[i].minSpeed = Obstacle.types[i].minSpeed / 2; + + // Convert variable y position obstacles to fixed. + if (typeof (Obstacle.types[i].yPos) == 'object') { + Obstacle.types[i].yPos = Obstacle.types[i].yPos[0]; + Obstacle.types[i].yPosMobile = Obstacle.types[i].yPos[0]; + } + } + } + }, + + /** * Update sprites to correspond to change in sprite sheet. * @param {number} spritePos */ @@ -3751,6 +3900,8 @@ this.spritePos = spritePos; Obstacle.types = Runner.spriteDefinition.OBSTACLES; + this.adjustObstacleSpeed(); + Obstacle.MAX_GAP_COEFFICIENT = Runner.spriteDefinition.MAX_GAP_COEFFICIENT; Obstacle.MAX_OBSTACLE_LENGTH = Runner.spriteDefinition.MAX_OBSTACLE_LENGTH;
diff --git a/components/password_manager/core/browser/biometric_authenticator.h b/components/password_manager/core/browser/biometric_authenticator.h index faffa52..fd65d406 100644 --- a/components/password_manager/core/browser/biometric_authenticator.h +++ b/components/password_manager/core/browser/biometric_authenticator.h
@@ -33,6 +33,10 @@ // The keyboard accessory sheet displaying suggestions for manual filling. kFallbackSheet = 2, + + // The list displaying all saved passwords. Can be used for filling on + // Android. + kAllPasswordsList = 3, }; // This interface encapsulates operations related to biometric authentication.
diff --git a/components/password_manager/core/browser/leak_detection/encryption_utils.cc b/components/password_manager/core/browser/leak_detection/encryption_utils.cc index 03dce41d..ec458fe 100644 --- a/components/password_manager/core/browser/leak_detection/encryption_utils.cc +++ b/components/password_manager/core/browser/leak_detection/encryption_utils.cc
@@ -23,9 +23,8 @@ namespace { -template <typename CharT> -std::basic_string<CharT> CanonicalizeUsernameT( - base::BasicStringPiece<CharT> username) { +template <typename T, typename CharT = typename T::value_type> +std::basic_string<CharT> CanonicalizeUsernameT(T username) { static constexpr CharT kPeriod = '.'; std::basic_string<CharT> email_lower = base::ToLowerASCII(username);
diff --git a/components/privacy_sandbox_strings.grdp b/components/privacy_sandbox_strings.grdp index 92ce05e..dcadce2 100644 --- a/components/privacy_sandbox_strings.grdp +++ b/components/privacy_sandbox_strings.grdp
@@ -9,4 +9,13 @@ =1 {When you reset ID, your current ID will become invalid and a new one will be issued in 1 day} other {When you reset ID, your current ID will become invalid and a new one will be issued in {NUM_DAYS} days}} </message> + <message name="IDS_PRIVACY_SANDBOX_FLOC_STATUS_ACTIVE" desc="Description of the user's FLoC status when they have the FLoC setting enabled, and the Origin Trial feature enabled, and so FLoC is fully active."> + Trial is active + </message> + <message name="IDS_PRIVACY_SANDBOX_FLOC_STATUS_ELIGIBLE_NOT_ACTIVE" desc="Description of the user's FLoC status when FLoC is not operational because the user was not placed in the origin trial. When the user is placed in the trial, because their FLoC setting is enabled, FLoC will become operational"> + Eligible for trial but not active + </message> + <message name="IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE" desc="Description of the user's FLoC status when FLoC is not operational, either because the user does not have the FLoC setting enabled, or the user was not placed in the origin trial, or both."> + Off + </message> </grit-part>
diff --git a/components/privacy_sandbox_strings_grdp/IDS_PRIVACY_SANDBOX_FLOC_STATUS_ACTIVE.png.sha1 b/components/privacy_sandbox_strings_grdp/IDS_PRIVACY_SANDBOX_FLOC_STATUS_ACTIVE.png.sha1 new file mode 100644 index 0000000..d4aed4d --- /dev/null +++ b/components/privacy_sandbox_strings_grdp/IDS_PRIVACY_SANDBOX_FLOC_STATUS_ACTIVE.png.sha1
@@ -0,0 +1 @@ +1e5dfe1174e1a2c3019c4cd948b8982ac6b3fb7a \ No newline at end of file
diff --git a/components/privacy_sandbox_strings_grdp/IDS_PRIVACY_SANDBOX_FLOC_STATUS_ELIGIBLE_NOT_ACTIVE.png.sha1 b/components/privacy_sandbox_strings_grdp/IDS_PRIVACY_SANDBOX_FLOC_STATUS_ELIGIBLE_NOT_ACTIVE.png.sha1 new file mode 100644 index 0000000..e8cb55c --- /dev/null +++ b/components/privacy_sandbox_strings_grdp/IDS_PRIVACY_SANDBOX_FLOC_STATUS_ELIGIBLE_NOT_ACTIVE.png.sha1
@@ -0,0 +1 @@ +235572bf892a3558861dc6d9ac736f27d8acc645 \ No newline at end of file
diff --git a/components/privacy_sandbox_strings_grdp/IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE.png.sha1 b/components/privacy_sandbox_strings_grdp/IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE.png.sha1 new file mode 100644 index 0000000..1ddf33ff --- /dev/null +++ b/components/privacy_sandbox_strings_grdp/IDS_PRIVACY_SANDBOX_FLOC_STATUS_NOT_ACTIVE.png.sha1
@@ -0,0 +1 @@ +dc3df7a7eb31c3c09aa9480946aeb873b9c3d0fc \ No newline at end of file
diff --git a/components/query_tiles/internal/tile_service_scheduler_impl.cc b/components/query_tiles/internal/tile_service_scheduler_impl.cc index ea3882d..badee9aa 100644 --- a/components/query_tiles/internal/tile_service_scheduler_impl.cc +++ b/components/query_tiles/internal/tile_service_scheduler_impl.cc
@@ -220,9 +220,9 @@ } void TileServiceSchedulerImpl::UpdateBackoff(net::BackoffEntry* backoff) { - std::unique_ptr<base::Value> value = + base::Value value = net::BackoffEntrySerializer::SerializeToValue(*backoff, clock_->Now()); - prefs_->Set(kBackoffEntryKey, *value); + prefs_->Set(kBackoffEntryKey, value); } void TileServiceSchedulerImpl::MarkFirstRunScheduled() {
diff --git a/components/reading_list/core/reading_list_entry.cc b/components/reading_list/core/reading_list_entry.cc index e346848..42cfdeb4 100644 --- a/components/reading_list/core/reading_list_entry.cc +++ b/components/reading_list/core/reading_list_entry.cc
@@ -597,12 +597,12 @@ pb_entry->set_failed_download_counter(failed_download_counter_); if (backoff_) { - std::unique_ptr<base::Value> backoff = + base::Value backoff = net::BackoffEntrySerializer::SerializeToValue(*backoff_, now); std::string output; JSONStringValueSerializer serializer(&output); - serializer.Serialize(*backoff); + serializer.Serialize(backoff); pb_entry->set_backoff(output); }
diff --git a/components/signin/ios/browser/account_consistency_service.mm b/components/signin/ios/browser/account_consistency_service.mm index edd2412..535e7dbf 100644 --- a/components/signin/ios/browser/account_consistency_service.mm +++ b/components/signin/ios/browser/account_consistency_service.mm
@@ -427,7 +427,7 @@ const std::string domain = GetDomainFromUrl(url); std::string cookie_value = signin::BuildMirrorRequestCookieIfPossible( url, - identity_manager_->GetPrimaryAccountInfo(signin::ConsentLevel::kSync) + identity_manager_->GetPrimaryAccountInfo(signin::ConsentLevel::kSignin) .gaia, signin::AccountConsistencyMethod::kMirror, cookie_settings_.get(), signin::PROFILE_MODE_DEFAULT);
diff --git a/components/viz/service/compositor_frame_fuzzer/BUILD.gn b/components/viz/service/compositor_frame_fuzzer/BUILD.gn index 5aa76fa6..175cc8f5 100644 --- a/components/viz/service/compositor_frame_fuzzer/BUILD.gn +++ b/components/viz/service/compositor_frame_fuzzer/BUILD.gn
@@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/python.gni") import("//testing/libfuzzer/fuzzer_test.gni") import("//third_party/protobuf/proto_library.gni") @@ -20,8 +19,7 @@ # The messages must be of type RenderPass, as defined in the proto2 file # compositor_frame_fuzzer.proto (these assumptions are all hardcoded into # generate_renderpass_binary.py) -# TODO(crbug.com/1112471): Get this to run cleanly under Python 3. -python2_action_foreach("generate_seed_corpus") { +action_foreach("generate_seed_corpus") { script = "generate_renderpass_binary.py" pyproto_path = "$root_out_dir/pyproto"
diff --git a/components/viz/service/compositor_frame_fuzzer/generate_renderpass_binary.py b/components/viz/service/compositor_frame_fuzzer/generate_renderpass_binary.py index 30ff934..d1190b8 100755 --- a/components/viz/service/compositor_frame_fuzzer/generate_renderpass_binary.py +++ b/components/viz/service/compositor_frame_fuzzer/generate_renderpass_binary.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # 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.
diff --git a/components/viz/service/display/direct_renderer.cc b/components/viz/service/display/direct_renderer.cc index cebe0662..71261f1 100644 --- a/components/viz/service/display/direct_renderer.cc +++ b/components/viz/service/display/direct_renderer.cc
@@ -33,7 +33,6 @@ #include "components/viz/service/display/output_surface.h" #include "components/viz/service/display/skia_output_surface.h" #include "ui/gfx/geometry/quad_f.h" -#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/transform.h" @@ -741,6 +740,18 @@ if (render_pass == current_frame()->root_render_pass) return false; + // TODO(crbug.com/783275): It's possible to skip a child RenderPass if damage + // does not overlap it, since that means nothing has changed: + // ComputeScissorRectForRenderPass(render_pass).IsEmpty() + // However that caused crashes where the RenderPass' texture was not present + // (never seen the RenderPass before, or the texture was deleted when not used + // for a frame). It could avoid skipping if there is no texture present, which + // is what was done for a while, but this seems to papering over a missing + // damage problem, or we're failing to understand the system wholey. + // If attempted again this should probably CHECK() that the texture exists, + // and attempt to figure out where the new RenderPass texture without damage + // is coming from. + // If the RenderPass wants to be cached, then we only draw it if we need to. // When damage is present, then we can't skip the RenderPass. Or if the // texture does not exist (first frame, or was deleted) then we can't skip @@ -751,13 +762,6 @@ return IsRenderPassResourceAllocated(render_pass->id); } - // Only render what is damaged. If there are copy requests associated with - // this pass the damage should always be the full |output_rect|. - if (use_partial_swap_ && - ComputeScissorRectForRenderPass(render_pass).IsEmpty()) { - return true; - } - return false; } @@ -874,10 +878,8 @@ // If the root damage rect has been expanded due to overlays, all the other // damage rect calculations are incorrect. - if (!root_damage_rect.IsEmpty() && - !root_render_pass->damage_rect.Contains(root_damage_rect)) { + if (!root_render_pass->damage_rect.Contains(root_damage_rect)) return render_pass->output_rect; - } DCHECK(render_pass->copy_requests.empty() || (render_pass->damage_rect == render_pass->output_rect));
diff --git a/components/viz/service/display/overlay_processor_using_strategy.cc b/components/viz/service/display/overlay_processor_using_strategy.cc index 514cc7f2..d29e9f6c 100644 --- a/components/viz/service/display/overlay_processor_using_strategy.cc +++ b/components/viz/service/display/overlay_processor_using_strategy.cc
@@ -202,14 +202,15 @@ SurfaceDamageRectList* surface_damage_rect_list, const gfx::Rect& existing_damage, const gfx::Rect& display_rect, - bool is_opaque_pure_overlay) { + bool is_opaque, + bool is_underlay) { gfx::Rect root_damage_rect; if (overlay_damage_index == OverlayCandidate::kInvalidDamageIndex) { // An opaque overlay that is on top will hide any damage underneath. // TODO(petermcneeley): This is a special case optimization which could be // removed if we had more reliable damage. - if (is_opaque_pure_overlay) { + if (is_opaque && !is_underlay) { return gfx::SubtractRects(existing_damage, display_rect); } return existing_damage; @@ -235,7 +236,9 @@ // |surface_damage_rect_list| is ordered such that from here on the // |display_rect| for the overlay will act as an occluder for damage // after. - occluding_rect = display_rect; + if (is_opaque) { + occluding_rect = display_rect; + } } } return root_damage_rect; @@ -272,12 +275,11 @@ // If an overlay candidate comes from output surface, its z-order should // be 0. overlay_damage_rect_.Union(this_frame_overlay_rect); - if (overlay.is_opaque) { - is_opaque_overlay = true; - exclude_overlay_index = overlay.overlay_damage_index; - } + is_opaque_overlay = overlay.is_opaque; + exclude_overlay_index = overlay.overlay_damage_index; } else { // Underlay candidate is assumed to be opaque. + is_opaque_overlay = true; is_underlay = true; exclude_overlay_index = overlay.overlay_damage_index; } @@ -292,7 +294,7 @@ // Removes all damage from this overlay and occluded surface damages. *damage_rect = ComputeDamageExcludingIndex( exclude_overlay_index, surface_damage_rect_list, *damage_rect, - this_frame_overlay_rect, is_opaque_overlay && !is_underlay); + this_frame_overlay_rect, is_opaque_overlay, is_underlay); // Drawing on the overlay_rect usually occurs on a different plane, but we // still need to damage the overlay_rect when certain changes occur from one @@ -307,7 +309,7 @@ // black transparent hole is made for the underlay to show through // but its possible that the damage for this quad is less than the // complete size of the underlay. https://crbug.com/1130733 - if (!is_opaque_overlay) { + if (is_underlay) { damage_rect->Union(this_frame_overlay_rect); } }
diff --git a/components/viz/service/display/overlay_unittest.cc b/components/viz/service/display/overlay_unittest.cc index 61dd56f..fff8853 100644 --- a/components/viz/service/display/overlay_unittest.cc +++ b/components/viz/service/display/overlay_unittest.cc
@@ -45,6 +45,7 @@ #include "gpu/config/gpu_finch_features.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "ui/gfx/geometry/rect.h" #include "ui/gfx/geometry/rect_conversions.h" #include "ui/gfx/geometry/size.h" #include "ui/latency/latency_info.h" @@ -1051,6 +1052,69 @@ } } +TEST_F(SingleOverlayOnTopTest, NonOpaquePureOverlayNonOccludingDamage) { + // This tests a specific damage optimization where a pure overlay (aka not an + // underlay) which is non opaque removes the damage associated with the + // overlay quad but occludes no other surface damage. This is in contrast to + // opaque overlays which can occlude damage beneath them. + constexpr int kCandidateSmall = 64; + const gfx::Rect kOverlayDisplayRect = {10, 10, kCandidateSmall, + kCandidateSmall}; + const gfx::Rect kInFrontDamage = {0, 0, 16, 16}; + const gfx::Rect kBehindOverlayDamage = {10, 10, 32, 32}; + + const gfx::Rect kExpectedDamage[] = { + kInFrontDamage, kInFrontDamage, + gfx::UnionRects(kInFrontDamage, kBehindOverlayDamage)}; + + AddExpectedRectToOverlayProcessor(gfx::RectF(kOverlayDisplayRect)); + for (size_t i = 0; i < base::size(kExpectedDamage); ++i) { + SCOPED_TRACE(i); + + auto pass = CreateRenderPass(); + SharedQuadState* damaged_shared_quad_state = + pass->shared_quad_state_list.AllocateAndCopyFrom( + pass->shared_quad_state_list.back()); + damaged_shared_quad_state->no_damage = false; + + // Create surface damages corresponding to the in front damage, the overlay + // damage, and finally the behind overlay damage. + SurfaceDamageRectList surface_damage_rect_list; + surface_damage_rect_list.push_back(kInFrontDamage); + surface_damage_rect_list.push_back(kOverlayDisplayRect); + damaged_shared_quad_state->overlay_damage_index = 1; + surface_damage_rect_list.push_back(kBehindOverlayDamage); + + auto* quad = CreateCandidateQuadAt( + resource_provider_.get(), child_resource_provider_.get(), + child_provider_.get(), damaged_shared_quad_state, pass.get(), + kOverlayDisplayRect); + + // On the last iteration we test non opaque overlays. + quad->needs_blending = i == 2; + + CreateFullscreenOpaqueQuad(resource_provider_.get(), + pass->shared_quad_state_list.back(), pass.get()); + + // Check for potential candidates. + OverlayCandidateList candidate_list; + OverlayProcessorInterface::FilterOperationsMap render_pass_filters; + OverlayProcessorInterface::FilterOperationsMap render_pass_backdrop_filters; + AggregatedRenderPassList pass_list; + + pass_list.push_back(std::move(pass)); + damage_rect_ = kOverlayRect; + + overlay_processor_->ProcessForOverlays( + resource_provider_.get(), &pass_list, GetIdentityColorMatrix(), + render_pass_filters, render_pass_backdrop_filters, + std::move(surface_damage_rect_list), nullptr, &candidate_list, + &damage_rect_, &content_bounds_); + LOG(ERROR) << "iter=" << i << " damage =" << damage_rect_.ToString(); + EXPECT_RECT_EQ(damage_rect_, kExpectedDamage[i]); + } +} + TEST_F(SingleOverlayOnTopTest, DamageRect) { auto pass = CreateRenderPass(); CreateFullscreenCandidateQuad(
diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index 4848657..d34cc83 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc
@@ -2987,6 +2987,10 @@ RunRegressionTest(FILE_PATH_LITERAL("reused-map-change-usemap.html")); } +IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, TitleInShadow) { + RunRegressionTest(FILE_PATH_LITERAL("title-in-shadow.html")); +} + // TODO(https://crbug.com/1175562): Flaky IN_PROC_BROWSER_TEST_P(DumpAccessibilityTreeTest, DISABLED_ReusedMapChangeMapName) {
diff --git a/content/browser/client_hints/client_hints.cc b/content/browser/client_hints/client_hints.cc index 61337d3..053e876 100644 --- a/content/browser/client_hints/client_hints.cc +++ b/content/browser/client_hints/client_hints.cc
@@ -354,6 +354,19 @@ GetContentClient()->browser()->GetAcceptLangs(context))); } +void AddPrefersColorSchemeHeader(net::HttpRequestHeaders* headers, + FrameTreeNode* frame_tree_node) { + blink::mojom::PreferredColorScheme preferred_color_scheme = + WebContents::FromRenderFrameHost(frame_tree_node->current_frame_host()) + ->GetOrCreateWebPreferences() + .preferred_color_scheme; + bool is_dark_mode = + preferred_color_scheme == blink::mojom::PreferredColorScheme::kDark; + SetHeaderToString(headers, + network::mojom::WebClientHintsType::kPrefersColorScheme, + is_dark_mode ? "dark" : "light"); +} + bool IsValidURLForClientHints(const GURL& url) { if (!url.is_valid() || !url.SchemeIsHTTPOrHTTPS() || (url.SchemeIs(url::kHttpScheme) && !net::IsLocalhost(url))) @@ -368,6 +381,11 @@ return base::FeatureList::IsEnabled(features::kLangClientHintHeader); } +bool PrefersColorSchemeClientHintEnabled() { + return base::FeatureList::IsEnabled( + features::kPrefersColorSchemeClientHintHeader); +} + void AddUAHeader(net::HttpRequestHeaders* headers, network::mojom::WebClientHintsType type, const std::string& value) { @@ -650,12 +668,17 @@ ClientUaHeaderCallType::kDuringCreation, headers); } + if (ShouldAddClientHint( + data, network::mojom::WebClientHintsType::kPrefersColorScheme)) { + AddPrefersColorSchemeHeader(headers, frame_tree_node); + } + // Static assert that triggers if a new client hint header is added. If a // new client hint header is added, the following assertion should be updated. // If possible, logic should be added above so that the request headers for // the newly added client hint can be added to the request. static_assert( - network::mojom::WebClientHintsType::kUAPlatformVersion == + network::mojom::WebClientHintsType::kPrefersColorScheme == network::mojom::WebClientHintsType::kMaxValue, "Consider adding client hint request headers from the browser process"); @@ -750,7 +773,8 @@ absl::optional<std::vector<network::mojom::WebClientHintsType>> parsed = blink::FilterAcceptCH(headers->accept_ch.value(), LangClientHintEnabled(), - delegate->UserAgentClientHintEnabled()); + delegate->UserAgentClientHintEnabled(), + PrefersColorSchemeClientHintEnabled()); if (!parsed.has_value()) return absl::nullopt;
diff --git a/content/browser/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc index 4e41edb..5561074 100644 --- a/content/browser/renderer_host/navigation_request.cc +++ b/content/browser/renderer_host/navigation_request.cc
@@ -4123,6 +4123,11 @@ GURL::Replacements replacements; replacements.SetSchemeStr(url::kHttpScheme); url = common_params_->url.ReplaceComponents(replacements); + } else if (common_params_->url.SchemeIs(url::kUrnScheme) && + begin_params_->web_bundle_token.has_value()) { + // When navigating to a urn:uuid resource in a web bundle, we check the + // bundle URL instead of the urn:uuid URL. + url = begin_params_->web_bundle_token->bundle_url; } else { url = common_params_->url; }
diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc index e8e10b2..f5c6782 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc
@@ -383,6 +383,8 @@ blink::features::kOffsetParentNewSpecBehavior}, {"OriginPolicy", features::kOriginPolicy}, {"OriginIsolationHeader", features::kOriginIsolationHeader}, + {"PrefersColorSchemeClientHintHeader", + features::kPrefersColorSchemeClientHintHeader}, {"RawClipboard", blink::features::kRawClipboard}, {"SanitizerAPI", blink::features::kSanitizerAPI}, {"StorageAccessAPI", blink::features::kStorageAccessAPI},
diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc index 9615cfd..3164947 100644 --- a/content/public/common/content_features.cc +++ b/content/public/common/content_features.cc
@@ -502,6 +502,11 @@ const base::Feature kPepperCrossOriginRedirectRestriction{ "PepperCrossOriginRedirectRestriction", base::FEATURE_ENABLED_BY_DEFAULT}; +// Experimental handling of prefers-color-scheme user preference media feature +// via client hints. +const base::Feature kPrefersColorSchemeClientHintHeader{ + "PrefersColorSchemeClientHintHeader", base::FEATURE_DISABLED_BY_DEFAULT}; + // All ProcessHost objects live on UI thread. // https://crbug.com/904556 const base::Feature kProcessHostOnUI{"ProcessHostOnUI",
diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h index 346cb8a..2450380 100644 --- a/content/public/common/content_features.h +++ b/content/public/common/content_features.h
@@ -129,6 +129,7 @@ CONTENT_EXPORT extern const base::Feature kFeaturePolicyHeader; CONTENT_EXPORT extern const base::Feature kPepper3DImageChromium; CONTENT_EXPORT extern const base::Feature kPepperCrossOriginRedirectRestriction; +CONTENT_EXPORT extern const base::Feature kPrefersColorSchemeClientHintHeader; CONTENT_EXPORT extern const base::Feature kProcessHostOnUI; CONTENT_EXPORT extern const base::Feature kPlzServiceWorker; CONTENT_EXPORT extern const base::Feature kHighPriorityBeforeUnload;
diff --git a/content/public/common/content_switch_dependent_feature_overrides.cc b/content/public/common/content_switch_dependent_feature_overrides.cc index 74527b3..1e8c5bd4 100644 --- a/content/public/common/content_switch_dependent_feature_overrides.cc +++ b/content/public/common/content_switch_dependent_feature_overrides.cc
@@ -78,6 +78,9 @@ {switches::kEnableExperimentalWebPlatformFeatures, std::cref(network::features::kAcceptCHFrame), base::FeatureList::OVERRIDE_ENABLE_FEATURE}, + {switches::kEnableExperimentalWebPlatformFeatures, + std::cref(features::kPrefersColorSchemeClientHintHeader), + base::FeatureList::OVERRIDE_ENABLE_FEATURE}, // Overrides for --enable-experimental-cookie-features. {switches::kEnableExperimentalCookieFeatures,
diff --git a/content/test/data/accessibility/regression/title-in-shadow-expected-blink.txt b/content/test/data/accessibility/regression/title-in-shadow-expected-blink.txt new file mode 100644 index 0000000..8da5e6b6 --- /dev/null +++ b/content/test/data/accessibility/regression/title-in-shadow-expected-blink.txt
@@ -0,0 +1,8 @@ +rootWebArea name='' +++genericContainer ignored +++++genericContainer +++++++meter valueForRange=0.00 minValueForRange=0.00 maxValueForRange=1.00 +++++++++genericContainer ignored +++++++++++genericContainer +++++++++++++genericContainer ignored +++++++++genericContainer ignored invisible \ No newline at end of file
diff --git a/content/test/data/accessibility/regression/title-in-shadow.html b/content/test/data/accessibility/regression/title-in-shadow.html new file mode 100644 index 0000000..6d4b7b1 --- /dev/null +++ b/content/test/data/accessibility/regression/title-in-shadow.html
@@ -0,0 +1 @@ +<meter><title id> \ No newline at end of file
diff --git a/docs/speed/apk_size_regressions.md b/docs/speed/apk_size_regressions.md index a9f2110..f41bc4a1 100644 --- a/docs/speed/apk_size_regressions.md +++ b/docs/speed/apk_size_regressions.md
@@ -135,6 +135,8 @@ and `Performance-Size` [here](https://bugs.chromium.org/p/chromium/issues/list?q=label:Performance-Sheriff%20label:Performance-Size&sort=-modified). * After resolving the bug by finding an owner or debugging or commenting, remove the `Performance-Sheriff` label. + * Process for Chrome OS bugs is at [go/cros-image-size-triage](https://goto.google.com/cros-image-size-triage). + * Generally just expected to ignore these. ## Step 2: Check Alerts Regularly
diff --git a/extensions/browser/renderer_startup_helper.cc b/extensions/browser/renderer_startup_helper.cc index c623ce1b..48bbd3324 100644 --- a/extensions/browser/renderer_startup_helper.cc +++ b/extensions/browser/renderer_startup_helper.cc
@@ -54,6 +54,38 @@ return absl::nullopt; } +PermissionSet CreatePermissionSet(const PermissionSet& set) { + return PermissionSet(set.apis().Clone(), set.manifest_permissions().Clone(), + set.explicit_hosts().Clone(), + set.scriptable_hosts().Clone()); +} + +mojom::ExtensionLoadedParamsPtr CreateExtensionLoadedParams( + const Extension& extension, + bool include_tab_permissions, + BrowserContext* browser_context) { + const PermissionsData* permissions_data = extension.permissions_data(); + + base::flat_map<int, PermissionSet> tab_specific_permissions; + if (include_tab_permissions) { + for (const auto& pair : permissions_data->tab_specific_permissions()) { + tab_specific_permissions[pair.first] = CreatePermissionSet(*pair.second); + } + } + + return mojom::ExtensionLoadedParams::New( + static_cast<base::DictionaryValue&&>( + extension.manifest()->value()->Clone()), + extension.location(), extension.path(), + CreatePermissionSet(permissions_data->active_permissions()), + CreatePermissionSet(permissions_data->withheld_permissions()), + std::move(tab_specific_permissions), + permissions_data->policy_blocked_hosts(), + permissions_data->policy_allowed_hosts(), + permissions_data->UsesDefaultPolicyHostRestrictions(), extension.id(), + GetWorkerActivationSequence(browser_context, extension), + extension.creation_flags(), extension.guid()); +} } // namespace RendererStartupHelper::RendererStartupHelper(BrowserContext* browser_context) @@ -134,7 +166,7 @@ PermissionsData::GetDefaultPolicyAllowedHosts(context_id)); // Loaded extensions. - std::vector<ExtensionMsg_Loaded_Params> loaded_extensions; + std::vector<mojom::ExtensionLoadedParamsPtr> loaded_extensions; const ExtensionSet& extensions = ExtensionRegistry::Get(browser_context_)->enabled_extensions(); for (const auto& ext : extensions) { @@ -149,15 +181,13 @@ // processes, no other process needs it, so it's mildly wasteful. // I am not sure this is possible to know this here, at such a low // level of the stack. Perhaps site isolation can help. - bool include_tab_permissions = true; - loaded_extensions.push_back(ExtensionMsg_Loaded_Params( - ext.get(), include_tab_permissions, - GetWorkerActivationSequence(renderer_context, *ext))); + loaded_extensions.push_back(CreateExtensionLoadedParams( + *ext, true /* include tab permissions*/, renderer_context)); extension_process_map_[ext->id()].insert(process); } // Activate pending extensions. - process->Send(new ExtensionMsg_Loaded(loaded_extensions)); + renderer->LoadExtensions(std::move(loaded_extensions)); auto iter = pending_active_extensions_.find(process); if (iter != pending_active_extensions_.end()) { for (const ExtensionId& id : iter->second) { @@ -246,20 +276,24 @@ if (extension.is_theme()) return; - // We don't need to include tab permisisons here, since the extension - // was just loaded. - // Uninitialized renderers will be informed of the extension load during the - // first batch of messages. - std::vector<ExtensionMsg_Loaded_Params> params; - params.emplace_back(&extension, false /* no tab permissions */, - GetWorkerActivationSequence(browser_context_, extension)); - for (auto& process_entry : process_mojo_map_) { content::RenderProcessHost* process = process_entry.first; if (!util::IsExtensionVisibleToContext(extension, process->GetBrowserContext())) continue; - process->Send(new ExtensionMsg_Loaded(params)); + + // We don't need to include tab permissions here, since the extension + // was just loaded. + // Uninitialized renderers will be informed of the extension load during the + // first batch of messages. + std::vector<mojom::ExtensionLoadedParamsPtr> params; + params.emplace_back(CreateExtensionLoadedParams( + extension, false /* no tab permissions */, browser_context_)); + + mojom::Renderer* renderer = GetRenderer(process); + if (renderer) + renderer->LoadExtensions(std::move(params)); + loaded_process_set.insert(process); } }
diff --git a/extensions/browser/renderer_startup_helper.h b/extensions/browser/renderer_startup_helper.h index e10fd0c..9dc0ae5 100644 --- a/extensions/browser/renderer_startup_helper.h +++ b/extensions/browser/renderer_startup_helper.h
@@ -81,6 +81,7 @@ private: friend class RendererStartupHelperTest; + friend class RendererStartupHelperInterceptor; // Initializes the specified process, informing it of system state and loaded // extensions.
diff --git a/extensions/browser/renderer_startup_helper_unittest.cc b/extensions/browser/renderer_startup_helper_unittest.cc index de2c220..deede6a 100644 --- a/extensions/browser/renderer_startup_helper_unittest.cc +++ b/extensions/browser/renderer_startup_helper_unittest.cc
@@ -23,17 +23,31 @@ // Class that implements the binding of a new Renderer mojom interface and // can receive callbacks on it for testing validation. -class InterceptingRendererStartupHelper : public RendererStartupHelper, - public mojom::Renderer { +class RendererStartupHelperInterceptor : public RendererStartupHelper, + public mojom::Renderer { public: - explicit InterceptingRendererStartupHelper( + explicit RendererStartupHelperInterceptor( content::BrowserContext* browser_context) - : RendererStartupHelper(browser_context) {} + : RendererStartupHelper(browser_context), + browser_context_(browser_context) {} size_t num_activated_extensions() { return activated_extensions_.size(); } + size_t num_loaded_extensions() { return num_loaded_extensions_; } + + size_t num_loaded_extensions_in_incognito() { + return num_loaded_extensions_in_incognito_; + } + size_t num_unloaded_extensions() { return unloaded_extensions_.size(); } + void clear_extensions() { + activated_extensions_.clear(); + num_loaded_extensions_ = 0; + num_loaded_extensions_in_incognito_ = 0; + unloaded_extensions_.clear(); + } + const URLPatternSet& default_policy_blocked_hosts() const { return default_blocked_hosts_; } @@ -57,6 +71,25 @@ } void SetActivityLoggingEnabled(bool enabled) override {} + void LoadExtensions( + std::vector<mojom::ExtensionLoadedParamsPtr> loaded_extensions) override { + for (const auto& param : loaded_extensions) { + const std::set<content::RenderProcessHost*>& process_set = + extension_process_map_[param->id]; + for (content::RenderProcessHost* process : process_set) { + // Count the invocation of the LoadExtensions method on the normal + // renderer or the incognito renderer. + if (process->GetBrowserContext() == browser_context_) { + num_loaded_extensions_++; + } else { + // If RenderProcessHost's context isn't the same as |browser_context_| + // , assume that the RenderProcessHost is the incognito renderer. + num_loaded_extensions_in_incognito_++; + } + } + } + } + void UnloadExtension(const std::string& extension_id) override { unloaded_extensions_.push_back(extension_id); } @@ -89,14 +122,14 @@ } void UpdateDefaultPolicyHostRestrictions( - const URLPatternSet& default_policy_blocked_hosts, - const URLPatternSet& default_policy_allowed_hosts) override { + URLPatternSet default_policy_blocked_hosts, + URLPatternSet default_policy_allowed_hosts) override { default_blocked_hosts_.AddPatterns(default_policy_blocked_hosts); default_allowed_hosts_.AddPatterns(default_policy_allowed_hosts); } void UpdateTabSpecificPermissions(const std::string& extension_id, - const URLPatternSet& new_hosts, + URLPatternSet new_hosts, int tab_id, bool update_origin_whitelist) override {} @@ -113,7 +146,10 @@ URLPatternSet default_blocked_hosts_; URLPatternSet default_allowed_hosts_; std::vector<std::string> activated_extensions_; + size_t num_loaded_extensions_; + size_t num_loaded_extensions_in_incognito_; std::vector<std::string> unloaded_extensions_; + content::BrowserContext* browser_context_; mojo::AssociatedReceiverSet<mojom::Renderer> receivers_; }; @@ -125,7 +161,7 @@ void SetUp() override { ExtensionsTest::SetUp(); helper_ = - std::make_unique<InterceptingRendererStartupHelper>(browser_context()); + std::make_unique<RendererStartupHelperInterceptor>(browser_context()); registry_ = ExtensionRegistryFactory::GetForBrowserContext(browser_context()); render_process_host_ = @@ -222,7 +258,7 @@ extension.id()); } - std::unique_ptr<InterceptingRendererStartupHelper> helper_; + std::unique_ptr<RendererStartupHelperInterceptor> helper_; ExtensionRegistry* registry_; // Weak. std::unique_ptr<content::MockRenderProcessHost> render_process_host_; std::unique_ptr<content::MockRenderProcessHost> @@ -248,12 +284,11 @@ // Initialize render process. EXPECT_FALSE(IsProcessInitialized(render_process_host_.get())); SimulateRenderProcessCreated(render_process_host_.get()); + base::RunLoop().RunUntilIdle(); EXPECT_TRUE(IsProcessInitialized(render_process_host_.get())); - IPC::TestSink& sink = render_process_host_->sink(); - // Enable extension. - sink.ClearMessages(); + helper_->clear_extensions(); EXPECT_FALSE(IsExtensionLoaded(*extension_)); AddExtensionToRegistry(extension_); helper_->OnExtensionLoaded(*extension_); @@ -261,12 +296,10 @@ IsExtensionLoadedInProcess(*extension_, render_process_host_.get())); EXPECT_FALSE(IsExtensionPendingActivationInProcess( *extension_, render_process_host_.get())); - ASSERT_EQ(1u, sink.message_count()); - EXPECT_EQ(static_cast<uint32_t>(ExtensionMsg_Loaded::ID), - sink.GetMessageAt(0)->type()); + base::RunLoop().RunUntilIdle(); + ASSERT_EQ(1u, helper_->num_loaded_extensions()); // Activate extension. - sink.ClearMessages(); helper_->ActivateExtensionInProcess(*extension_, render_process_host_.get()); EXPECT_FALSE(IsExtensionPendingActivationInProcess( *extension_, render_process_host_.get())); @@ -274,7 +307,7 @@ ASSERT_EQ(1u, helper_->num_activated_extensions()); // Disable extension. - sink.ClearMessages(); + helper_->clear_extensions(); RemoveExtensionFromRegistry(extension_); helper_->OnExtensionUnloaded(*extension_); EXPECT_FALSE(IsExtensionLoaded(*extension_)); @@ -282,16 +315,15 @@ ASSERT_EQ(1u, helper_->num_unloaded_extensions()); // Extension enabled again. - sink.ClearMessages(); + helper_->clear_extensions(); AddExtensionToRegistry(extension_); helper_->OnExtensionLoaded(*extension_); EXPECT_TRUE( IsExtensionLoadedInProcess(*extension_, render_process_host_.get())); EXPECT_FALSE(IsExtensionPendingActivationInProcess( *extension_, render_process_host_.get())); - ASSERT_EQ(1u, sink.message_count()); - EXPECT_EQ(static_cast<uint32_t>(ExtensionMsg_Loaded::ID), - sink.GetMessageAt(0)->type()); + base::RunLoop().RunUntilIdle(); + ASSERT_EQ(1u, helper_->num_loaded_extensions()); // Render Process terminated. SimulateRenderProcessTerminated(render_process_host_.get()); @@ -307,15 +339,14 @@ // fine. TEST_F(RendererStartupHelperTest, EnabledBeforeProcessInitialized) { EXPECT_FALSE(IsProcessInitialized(render_process_host_.get())); - IPC::TestSink& sink = render_process_host_->sink(); // Enable extension. The render process isn't initialized yet, so the // extension should be added to the list of extensions awaiting activation. - sink.ClearMessages(); + helper_->clear_extensions(); AddExtensionToRegistry(extension_); helper_->OnExtensionLoaded(*extension_); helper_->ActivateExtensionInProcess(*extension_, render_process_host_.get()); - EXPECT_EQ(0u, sink.message_count()); + ASSERT_EQ(0u, helper_->num_loaded_extensions()); EXPECT_TRUE(IsExtensionLoaded(*extension_)); EXPECT_FALSE( IsExtensionLoadedInProcess(*extension_, render_process_host_.get())); @@ -339,7 +370,8 @@ SimulateRenderProcessCreated(render_process_host_.get()); // The renderer would have been sent multiple initialization messages // including the loading and activation messages for the extension. - EXPECT_LE(1u, sink.message_count()); + base::RunLoop().RunUntilIdle(); + ASSERT_EQ(1u, helper_->num_loaded_extensions()); // Method UpdateDefaultPolicyHostRestrictions() from mojom::Renderer should // have been called with the default policy for blocked/allowed hosts given by @@ -395,19 +427,15 @@ SimulateRenderProcessCreated(incognito_render_process_host_.get()); EXPECT_TRUE(IsProcessInitialized(incognito_render_process_host_.get())); - IPC::TestSink& sink = render_process_host_->sink(); - IPC::TestSink& incognito_sink = incognito_render_process_host_->sink(); - // Enable the extension. It should not be loaded in the initialized incognito // renderer. - sink.ClearMessages(); - incognito_sink.ClearMessages(); + helper_->clear_extensions(); EXPECT_FALSE(util::IsIncognitoEnabled(extension_->id(), browser_context())); EXPECT_FALSE(IsExtensionLoaded(*extension_)); AddExtensionToRegistry(extension_); helper_->OnExtensionLoaded(*extension_); - EXPECT_EQ(0u, sink.message_count()); - EXPECT_EQ(0u, incognito_sink.message_count()); + EXPECT_EQ(0u, helper_->num_loaded_extensions()); + EXPECT_EQ(0u, helper_->num_loaded_extensions_in_incognito()); EXPECT_TRUE(IsExtensionLoaded(*extension_)); EXPECT_FALSE(IsExtensionLoadedInProcess( *extension_, incognito_render_process_host_.get())); @@ -415,8 +443,7 @@ IsExtensionLoadedInProcess(*extension_, render_process_host_.get())); // Initialize the normal renderer. The extension should get loaded in it. - sink.ClearMessages(); - incognito_sink.ClearMessages(); + helper_->clear_extensions(); EXPECT_FALSE(IsProcessInitialized(render_process_host_.get())); SimulateRenderProcessCreated(render_process_host_.get()); EXPECT_TRUE(IsProcessInitialized(render_process_host_.get())); @@ -426,12 +453,12 @@ *extension_, incognito_render_process_host_.get())); // Multiple initialization messages including the extension load message // should be dispatched to the non-incognito renderer. - EXPECT_LE(1u, sink.message_count()); - EXPECT_EQ(0u, incognito_sink.message_count()); + base::RunLoop().RunUntilIdle(); + ASSERT_EQ(1u, helper_->num_loaded_extensions()); + ASSERT_EQ(0u, helper_->num_loaded_extensions_in_incognito()); // Enable the extension in incognito mode. This will reload the extension. - sink.ClearMessages(); - incognito_sink.ClearMessages(); + helper_->clear_extensions(); ExtensionPrefs::Get(browser_context()) ->SetIsIncognitoEnabled(extension_->id(), true); helper_->OnExtensionUnloaded(*extension_); @@ -442,15 +469,17 @@ IsExtensionLoadedInProcess(*extension_, render_process_host_.get())); // The extension would not have been unloaded from the incognito renderer // since it wasn't loaded. - ASSERT_EQ(1u, incognito_sink.message_count()); - EXPECT_EQ(static_cast<uint32_t>(ExtensionMsg_Loaded::ID), - incognito_sink.GetMessageAt(0)->type()); + base::RunLoop().RunUntilIdle(); + // LoadExtensions are called twice because it's also called by + // RendererStartupHelper::InitializeProcess as soon as a RenderProcessHost + // instance is created. + ASSERT_EQ(2u, helper_->num_loaded_extensions_in_incognito()); + // The extension would be first unloaded and then loaded from the normal // renderer. base::RunLoop().RunUntilIdle(); ASSERT_EQ(1u, helper_->num_unloaded_extensions()); - EXPECT_EQ(static_cast<uint32_t>(ExtensionMsg_Loaded::ID), - sink.GetMessageAt(0)->type()); + ASSERT_EQ(2u, helper_->num_loaded_extensions()); } // Tests that platform apps are always loaded in an incognito renderer. @@ -458,10 +487,9 @@ // Initialize the incognito renderer. EXPECT_FALSE(IsProcessInitialized(incognito_render_process_host_.get())); SimulateRenderProcessCreated(incognito_render_process_host_.get()); + base::RunLoop().RunUntilIdle(); EXPECT_TRUE(IsProcessInitialized(incognito_render_process_host_.get())); - IPC::TestSink& incognito_sink = incognito_render_process_host_->sink(); - scoped_refptr<const Extension> platform_app( CreatePlatformApp("platform_app")); ASSERT_TRUE(platform_app->is_platform_app()); @@ -471,14 +499,13 @@ // Enable the app. It should get loaded in the incognito renderer even though // IsIncognitoEnabled returns false for it, since it can't be enabled for // incognito. - incognito_sink.ClearMessages(); + helper_->clear_extensions(); AddExtensionToRegistry(platform_app); helper_->OnExtensionLoaded(*platform_app); EXPECT_TRUE(IsExtensionLoadedInProcess(*platform_app, incognito_render_process_host_.get())); - ASSERT_EQ(1u, incognito_sink.message_count()); - EXPECT_EQ(static_cast<uint32_t>(ExtensionMsg_Loaded::ID), - incognito_sink.GetMessageAt(0)->type()); + base::RunLoop().RunUntilIdle(); + ASSERT_EQ(1u, helper_->num_loaded_extensions_in_incognito()); } } // namespace extensions
diff --git a/extensions/common/BUILD.gn b/extensions/common/BUILD.gn index ff4e299..4bb9be0 100644 --- a/extensions/common/BUILD.gn +++ b/extensions/common/BUILD.gn
@@ -40,6 +40,7 @@ sources = [ "mojom/action_type.mojom", + "mojom/activation_sequence.mojom", "mojom/api_permission_id.mojom", "mojom/app_window.mojom", "mojom/channel.mojom", @@ -52,6 +53,7 @@ "mojom/injection_type.mojom", "mojom/keep_alive.mojom", "mojom/manifest.mojom", + "mojom/permission_set.mojom", "mojom/renderer.mojom", "mojom/run_location.mojom", "mojom/url_pattern_set.mojom", @@ -80,12 +82,46 @@ { types = [ { + mojom = "extensions.mojom.APIPermission" + cpp = "::std::unique_ptr<::extensions::APIPermission>" + move_only = true + }, + { + mojom = "extensions.mojom.APIPermissionSet" + cpp = "::extensions::APIPermissionSet" + move_only = true + }, + { + mojom = "extensions.mojom.ManifestPermission" + cpp = "::std::unique_ptr<::extensions::ManifestPermission>" + move_only = true + }, + { + mojom = "extensions.mojom.ManifestPermissionSet" + cpp = "::extensions::ManifestPermissionSet" + move_only = true + }, + { + mojom = "extensions.mojom.PermissionSet" + cpp = "::extensions::PermissionSet" + move_only = true + }, + ] + traits_headers = + [ "//extensions/common/mojom/permission_set_mojom_traits.h" ] + traits_sources = + [ "//extensions/common/mojom/permission_set_mojom_traits.cc" ] + }, + { + types = [ + { mojom = "extensions.mojom.URLPattern" cpp = "::URLPattern" }, { mojom = "extensions.mojom.URLPatternSet" cpp = "::extensions::URLPatternSet" + move_only = true }, ] traits_headers = @@ -93,6 +129,18 @@ traits_sources = [ "//extensions/common/mojom/url_pattern_set_mojom_traits.cc" ] }, + { + types = [ + { + mojom = "extensions.mojom.ActivationSequence" + cpp = "::extensions::ActivationSequence" + }, + ] + traits_headers = + [ "//extensions/common/mojom/activation_sequence_mojom_traits.h" ] + traits_sources = + [ "//extensions/common/mojom/activation_sequence_mojom_traits.cc" ] + }, ] overridden_deps = [ "//content/public/common:interfaces" ] @@ -369,6 +417,10 @@ "//skia", ] + # Allows including manifest_handler.h and permissions/permissions_info.h + # from mojom/permission_set_mojom_traits.cc. + allow_circular_includes_from = [ ":mojom" ] + deps = [ "//base", "//build:branding_buildflags", @@ -469,7 +521,6 @@ "extension_builder_unittest.cc", "extension_icon_set_unittest.cc", "extension_l10n_util_unittest.cc", - "extension_messages_unittest.cc", "extension_resource_path_normalizer_unittest.cc", "extension_resource_unittest.cc", "extension_set_unittest.cc", @@ -501,6 +552,7 @@ "manifest_handlers/web_app_shortcut_icons_handler_unittest.cc", "manifest_unittest.cc", "message_bundle_unittest.cc", + "mojom/permission_set_mojom_traits_unittest.cc", "mojom/url_pattern_set_mojom_traits_unittest.cc", "permissions/api_permission_set_unittest.cc", "permissions/api_permission_unittest.cc",
diff --git a/extensions/common/extension_messages.cc b/extensions/common/extension_messages.cc index be39bb0..48f9ad22 100644 --- a/extensions/common/extension_messages.cc +++ b/extensions/common/extension_messages.cc
@@ -56,75 +56,6 @@ scriptable_hosts.Clone()); } -ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params() - : location(ManifestLocation::kInvalidLocation), - creation_flags(Extension::NO_FLAGS) {} - -ExtensionMsg_Loaded_Params::~ExtensionMsg_Loaded_Params() {} - -ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( - const Extension* extension, - bool include_tab_permissions, - absl::optional<ActivationSequence> worker_activation_sequence) - : manifest(static_cast<base::DictionaryValue&&>( - extension->manifest()->value()->Clone())), - location(extension->location()), - path(extension->path()), - active_permissions(extension->permissions_data()->active_permissions()), - withheld_permissions( - extension->permissions_data()->withheld_permissions()), - policy_blocked_hosts( - extension->permissions_data()->policy_blocked_hosts().Clone()), - policy_allowed_hosts( - extension->permissions_data()->policy_allowed_hosts().Clone()), - uses_default_policy_blocked_allowed_hosts( - extension->permissions_data()->UsesDefaultPolicyHostRestrictions()), - id(extension->id()), - worker_activation_sequence(worker_activation_sequence), - creation_flags(extension->creation_flags()), - guid(extension->guid()) { - if (include_tab_permissions) { - for (const auto& pair : - extension->permissions_data()->tab_specific_permissions()) { - tab_specific_permissions[pair.first] = - ExtensionMsg_PermissionSetStruct(*pair.second); - } - } -} - -ExtensionMsg_Loaded_Params::ExtensionMsg_Loaded_Params( - ExtensionMsg_Loaded_Params&& other) = default; -ExtensionMsg_Loaded_Params& ExtensionMsg_Loaded_Params::operator=( - ExtensionMsg_Loaded_Params&& other) = default; - -scoped_refptr<Extension> ExtensionMsg_Loaded_Params::ConvertToExtension( - const int context_id, - std::string* error) const { - // We pass in the |id| to the create call because it will save work in the - // normal case, and because in tests, extensions may not have paths or keys, - // but it's important to retain the same id. - scoped_refptr<Extension> extension = - Extension::Create(path, location, manifest, creation_flags, id, error); - if (extension.get()) { - const extensions::PermissionsData* permissions_data = - extension->permissions_data(); - permissions_data->SetPermissions(active_permissions.ToPermissionSet(), - withheld_permissions.ToPermissionSet()); - if (uses_default_policy_blocked_allowed_hosts) { - permissions_data->SetUsesDefaultHostRestrictions(context_id); - } else { - permissions_data->SetPolicyHostRestrictions(policy_blocked_hosts, - policy_allowed_hosts); - } - for (const auto& pair : tab_specific_permissions) { - permissions_data->UpdateTabSpecificPermissions( - pair.first, *pair.second.ToPermissionSet()); - } - extension->SetGUID(guid); - } - return extension; -} - namespace IPC { void ParamTraits<URLPattern>::Write(base::Pickle* m, const param_type& p) { @@ -296,43 +227,4 @@ LogParam(p.scriptable_hosts, l); } -void ParamTraits<ExtensionMsg_Loaded_Params>::Write(base::Pickle* m, - const param_type& p) { - WriteParam(m, p.location); - WriteParam(m, p.path); - WriteParam(m, p.manifest); - WriteParam(m, p.creation_flags); - WriteParam(m, p.id); - WriteParam(m, p.active_permissions); - WriteParam(m, p.withheld_permissions); - WriteParam(m, p.tab_specific_permissions); - WriteParam(m, p.policy_blocked_hosts); - WriteParam(m, p.policy_allowed_hosts); - WriteParam(m, p.uses_default_policy_blocked_allowed_hosts); - WriteParam(m, p.worker_activation_sequence); - WriteParam(m, p.guid); -} - -bool ParamTraits<ExtensionMsg_Loaded_Params>::Read(const base::Pickle* m, - base::PickleIterator* iter, - param_type* p) { - p->manifest.Clear(); - return ReadParam(m, iter, &p->location) && ReadParam(m, iter, &p->path) && - ReadParam(m, iter, &p->manifest) && - ReadParam(m, iter, &p->creation_flags) && ReadParam(m, iter, &p->id) && - ReadParam(m, iter, &p->active_permissions) && - ReadParam(m, iter, &p->withheld_permissions) && - ReadParam(m, iter, &p->tab_specific_permissions) && - ReadParam(m, iter, &p->policy_blocked_hosts) && - ReadParam(m, iter, &p->policy_allowed_hosts) && - ReadParam(m, iter, &p->uses_default_policy_blocked_allowed_hosts) && - ReadParam(m, iter, &p->worker_activation_sequence) && - ReadParam(m, iter, &p->guid); -} - -void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, - std::string* l) { - l->append(p.id); -} - } // namespace IPC
diff --git a/extensions/common/extension_messages.h b/extensions/common/extension_messages.h index 55e768d..b6b27e9 100644 --- a/extensions/common/extension_messages.h +++ b/extensions/common/extension_messages.h
@@ -314,65 +314,6 @@ DISALLOW_COPY_AND_ASSIGN(ExtensionMsg_PermissionSetStruct); }; -struct ExtensionMsg_Loaded_Params { - ExtensionMsg_Loaded_Params(); - ~ExtensionMsg_Loaded_Params(); - ExtensionMsg_Loaded_Params(const extensions::Extension* extension, - bool include_tab_permissions, - absl::optional<extensions::ActivationSequence> - worker_activation_sequence); - - ExtensionMsg_Loaded_Params(ExtensionMsg_Loaded_Params&& other); - ExtensionMsg_Loaded_Params& operator=(ExtensionMsg_Loaded_Params&& other); - - // Creates a new extension from the data in this object. - // A context_id needs to be passed because each browser context can have - // different values for default_policy_blocked/allowed_hosts. - // (see extension_util.cc#GetBrowserContextId) - scoped_refptr<extensions::Extension> ConvertToExtension( - int context_id, - std::string* error) const; - - // The subset of the extension manifest data we send to renderers. - base::DictionaryValue manifest; - - // The location the extension was installed from. - extensions::mojom::ManifestLocation location; - - // The path the extension was loaded from. This is used in the renderer only - // to generate the extension ID for extensions that are loaded unpacked. - base::FilePath path; - - // The extension's active and withheld permissions. - ExtensionMsg_PermissionSetStruct active_permissions; - ExtensionMsg_PermissionSetStruct withheld_permissions; - std::map<int, ExtensionMsg_PermissionSetStruct> tab_specific_permissions; - - // Contains URLPatternSets defining which URLs an extension may not interact - // with by policy. - extensions::URLPatternSet policy_blocked_hosts; - extensions::URLPatternSet policy_allowed_hosts; - - // If the extension uses the default list of blocked / allowed URLs. - bool uses_default_policy_blocked_allowed_hosts = true; - - // We keep this separate so that it can be used in logging. - std::string id; - - // If this extension is Service Worker based, then this contains the - // activation sequence of the extension. - absl::optional<extensions::ActivationSequence> worker_activation_sequence; - - // Send creation flags so extension is initialized identically. - int creation_flags; - - // Reuse the extension guid when creating the extension in the renderer. - extensions::ExtensionGuid guid; - - private: - DISALLOW_COPY_AND_ASSIGN(ExtensionMsg_Loaded_Params); -}; - struct ExtensionHostMsg_AutomationQuerySelector_Error { enum Value { kNone, kNoDocument, kNodeDestroyed }; @@ -442,17 +383,6 @@ param_type* p); static void Log(const param_type& p, std::string* l); }; - -template <> -struct ParamTraits<ExtensionMsg_Loaded_Params> { - typedef ExtensionMsg_Loaded_Params param_type; - static void Write(base::Pickle* m, const param_type& p); - static bool Read(const base::Pickle* m, - base::PickleIterator* iter, - param_type* p); - static void Log(const param_type& p, std::string* l); -}; - } // namespace IPC #endif // INTERNAL_EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ @@ -484,10 +414,6 @@ ExtensionMsg_DispatchEvent_Params /* params */, base::ListValue /* event_args */) -// Notifies the renderer that extensions were loaded in the browser. -IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded, - std::vector<ExtensionMsg_Loaded_Params>) - // Tell the render view which browser window it's being attached to. IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId, int /* id of browser window */)
diff --git a/extensions/common/extension_messages_unittest.cc b/extensions/common/extension_messages_unittest.cc deleted file mode 100644 index ac9e10e..0000000 --- a/extensions/common/extension_messages_unittest.cc +++ /dev/null
@@ -1,135 +0,0 @@ -// Copyright 2016 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "extensions/common/extension_messages.h" - -#include "components/crx_file/id_util.h" -#include "extensions/common/extension.h" -#include "extensions/common/extension_builder.h" -#include "extensions/common/manifest_handlers/permissions_parser.h" -#include "extensions/common/permissions/extensions_api_permissions.h" -#include "extensions/common/permissions/permissions_data.h" -#include "extensions/common/value_builder.h" -#include "ipc/ipc_message.h" -#include "testing/gtest/include/gtest/gtest.h" - -using extensions::mojom::APIPermissionID; - -namespace extensions { - -namespace { - -void CompareExtension(const Extension& extension1, - const Extension& extension2) { - EXPECT_EQ(extension1.name(), extension2.name()); - EXPECT_EQ(extension1.id(), extension2.id()); - EXPECT_EQ(extension1.path(), extension2.path()); - EXPECT_EQ(extension1.permissions_data()->active_permissions(), - extension2.permissions_data()->active_permissions()); - EXPECT_TRUE(extension1.manifest()->EqualsForTesting(*extension2.manifest())); - const PermissionsData::TabPermissionsMap& second_tab_permissions = - extension2.permissions_data()->tab_specific_permissions(); - for (const auto& tab_permissions : - extension1.permissions_data()->tab_specific_permissions()) { - ASSERT_NE(0u, second_tab_permissions.count(tab_permissions.first)); - EXPECT_EQ(*tab_permissions.second, - *(second_tab_permissions.at(tab_permissions.first))) - << tab_permissions.first; - } - EXPECT_EQ(extension1.permissions_data()->policy_blocked_hosts(), - extension2.permissions_data()->policy_blocked_hosts()); - EXPECT_EQ(extension1.permissions_data()->policy_allowed_hosts(), - extension2.permissions_data()->policy_allowed_hosts()); -} - -void AddPattern(const std::string& pattern, URLPatternSet* extent) { - URLPattern parsed(URLPattern::SCHEME_ALL); - parsed.Parse(pattern); - extent->AddPattern(parsed); -} - -} // namespace - -TEST(ExtensionMessageTypesTest, TestLoadedParams) { - std::unique_ptr<base::DictionaryValue> manifest = - DictionaryBuilder() - .Set("name", "extension") - .Set("description", "an extension") - .Set("permissions", ListBuilder().Append("alarms").Build()) - .Set("manifest_version", 2) - .Set("version", "0.1") - .Build(); - scoped_refptr<const Extension> extension = - ExtensionBuilder() - .SetManifest(std::move(manifest)) - .SetID(crx_file::id_util::GenerateId("foo")) - .Build(); - const PermissionSet& required_permissions = - PermissionsParser::GetRequiredPermissions(extension.get()); - LOG(WARNING) << required_permissions.apis().size(); - EXPECT_TRUE(extension->permissions_data()->HasAPIPermission( - APIPermissionID::kAlarms)); - { - APIPermissionSet tab_permissions; - tab_permissions.insert(APIPermissionID::kDns); - extension->permissions_data()->UpdateTabSpecificPermissions( - 1, PermissionSet(std::move(tab_permissions), ManifestPermissionSet(), - URLPatternSet(), URLPatternSet())); - } - URLPatternSet runtime_blocked_hosts; - AddPattern("*://*.example.com/*", &runtime_blocked_hosts); - URLPatternSet runtime_allowed_hosts; - AddPattern("*://good.example.com/*", &runtime_allowed_hosts); - extension->permissions_data()->SetPolicyHostRestrictions( - runtime_blocked_hosts, runtime_allowed_hosts); - - ExtensionMsg_Loaded_Params params_in(extension.get(), true, absl::nullopt); - EXPECT_EQ(extension->id(), params_in.id); - EXPECT_EQ(extension->guid(), params_in.guid); - - { - // First, test just converting back to an extension. - std::string error; - // TODO(devlin): Move this to a renderer-specific location in order to - // better enforce this restriction. - - // The logic is only called in the render context that's why it's - // safe to pass 0 as context_id. - scoped_refptr<const Extension> extension_out = - params_in.ConvertToExtension(0, &error); - EXPECT_TRUE(error.empty()); - ASSERT_TRUE(extension_out); - CompareExtension(*extension, *extension_out); - } - - { - // Second, try bouncing the params and then converting back. - IPC::Message msg; - IPC::ParamTraits<ExtensionMsg_Loaded_Params>::Write(&msg, params_in); - ExtensionMsg_Loaded_Params params_out; - base::PickleIterator iter(msg); - EXPECT_TRUE(IPC::ParamTraits<ExtensionMsg_Loaded_Params>::Read( - &msg, &iter, ¶ms_out)); - - EXPECT_EQ(params_in.id, params_out.id); - EXPECT_TRUE(params_in.manifest.Equals(¶ms_out.manifest)); - EXPECT_EQ(params_in.location, params_out.location); - EXPECT_EQ(params_in.path, params_out.path); - EXPECT_EQ(params_in.creation_flags, params_out.creation_flags); - // Permission equaliy on the params will be tested through the conversion to - // an extension. - - std::string error; - scoped_refptr<const Extension> extension_out = - params_out.ConvertToExtension(0, &error); - EXPECT_TRUE(error.empty()); - ASSERT_TRUE(extension_out); - CompareExtension(*extension, *extension_out); - - // Check for guid in converted extension. - EXPECT_EQ(extension->guid(), extension_out->guid()); - } -} - -} // namespace extensions
diff --git a/extensions/common/mojom/activation_sequence.mojom b/extensions/common/mojom/activation_sequence.mojom new file mode 100644 index 0000000..0cb7d1a5 --- /dev/null +++ b/extensions/common/mojom/activation_sequence.mojom
@@ -0,0 +1,13 @@ +// 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. + +module extensions.mojom; + +// Mojo struct to represent extensions::ActivationSequence that is an unique +// identifier for an extension's activation->deactivation span. As it is an +// optional field in ExtensionLoadedParams, we use an struct to represent it +// (primitive numeric types are not nullable). +struct ActivationSequence { + int32 value; +};
diff --git a/extensions/common/mojom/activation_sequence_mojom_traits.cc b/extensions/common/mojom/activation_sequence_mojom_traits.cc new file mode 100644 index 0000000..dd0efb68 --- /dev/null +++ b/extensions/common/mojom/activation_sequence_mojom_traits.cc
@@ -0,0 +1,17 @@ +// 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 "extensions/common/mojom/activation_sequence_mojom_traits.h" + +namespace mojo { + +bool StructTraits<extensions::mojom::ActivationSequenceDataView, + extensions::ActivationSequence>:: + Read(extensions::mojom::ActivationSequenceDataView data, + extensions::ActivationSequence* out) { + *out = extensions::ActivationSequence(data.value()); + return true; +} + +} // namespace mojo
diff --git a/extensions/common/mojom/activation_sequence_mojom_traits.h b/extensions/common/mojom/activation_sequence_mojom_traits.h new file mode 100644 index 0000000..4160cf7 --- /dev/null +++ b/extensions/common/mojom/activation_sequence_mojom_traits.h
@@ -0,0 +1,27 @@ +// 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 EXTENSIONS_COMMON_MOJOM_ACTIVATION_SEQUENCE_MOJOM_TRAITS_H_ +#define EXTENSIONS_COMMON_MOJOM_ACTIVATION_SEQUENCE_MOJOM_TRAITS_H_ + +#include "extensions/common/activation_sequence.h" +#include "extensions/common/mojom/activation_sequence.mojom-shared.h" +#include "mojo/public/cpp/bindings/struct_traits.h" + +namespace mojo { + +template <> +struct StructTraits<extensions::mojom::ActivationSequenceDataView, + extensions::ActivationSequence> { + static int value(const extensions::ActivationSequence& activation_sequence) { + return static_cast<int>(activation_sequence); + } + + static bool Read(extensions::mojom::ActivationSequenceDataView data, + extensions::ActivationSequence* out); +}; + +} // namespace mojo + +#endif // EXTENSIONS_COMMON_MOJOM_ACTIVATION_SEQUENCE_MOJOM_TRAITS_H_
diff --git a/extensions/common/mojom/permission_set.mojom b/extensions/common/mojom/permission_set.mojom new file mode 100644 index 0000000..5e8103a --- /dev/null +++ b/extensions/common/mojom/permission_set.mojom
@@ -0,0 +1,43 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module extensions.mojom; + +import "extensions/common/mojom/api_permission_id.mojom"; +import "extensions/common/mojom/url_pattern_set.mojom"; +import "mojo/public/mojom/base/values.mojom"; + +// Mojo struct to represent extensions::APIPermission class that is to handle +// some complex permissions. +struct APIPermission { + APIPermissionID id; + mojo_base.mojom.Value? value; +}; + +// Mojo struct to represent extensions::APIPermissionSet class. +struct APIPermissionSet { + map<APIPermissionID, APIPermission> permission_map; +}; + +// Mojo struct to represent extensions::ManifestPermission class that represents +// the custom behavior of a top-level manifest entry contributing to permission +// messages and storage. +struct ManifestPermission { + string id; + mojo_base.mojom.Value? value; +}; + +// Mojo struct to represent extensions::ManifestPermissionSet class. +struct ManifestPermissionSet { + map<string, ManifestPermission> permission_map; +}; + +// Mojo struct to represent an extensions::PermissionSet which encapsulates an +// extension's permissions. +struct PermissionSet { + APIPermissionSet apis; + ManifestPermissionSet manifest_permissions; + URLPatternSet hosts; // explicit_hosts_ + URLPatternSet user_script_hosts; // scriptable_hosts_ +};
diff --git a/extensions/common/mojom/permission_set_mojom_traits.cc b/extensions/common/mojom/permission_set_mojom_traits.cc new file mode 100644 index 0000000..10a991d --- /dev/null +++ b/extensions/common/mojom/permission_set_mojom_traits.cc
@@ -0,0 +1,120 @@ +// 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 "extensions/common/mojom/permission_set_mojom_traits.h" +#include "extensions/common/manifest_handler.h" +#include "extensions/common/permissions/permissions_info.h" + +namespace mojo { + +bool StructTraits<extensions::mojom::APIPermissionDataView, + std::unique_ptr<extensions::APIPermission>>:: + Read(extensions::mojom::APIPermissionDataView data, + std::unique_ptr<extensions::APIPermission>* out) { + extensions::mojom::APIPermissionID id; + if (!data.ReadId(&id)) + return false; + + const extensions::APIPermissionInfo* permission_info = + extensions::PermissionsInfo::GetInstance()->GetByID(id); + if (!permission_info) + return false; + + std::unique_ptr<extensions::APIPermission> api_permission = + permission_info->CreateAPIPermission(); + + absl::optional<base::Value> value; + if (!data.ReadValue(&value)) + return false; + + if (!api_permission->FromValue(value ? &*value : nullptr, nullptr, nullptr)) + return false; + + *out = std::move(api_permission); + return true; +} + +bool StructTraits<extensions::mojom::APIPermissionSetDataView, + extensions::APIPermissionSet>:: + Read(extensions::mojom::APIPermissionSetDataView data, + extensions::APIPermissionSet* out) { + using MapType = std::map<extensions::mojom::APIPermissionID, + std::unique_ptr<extensions::APIPermission>>; + MapType permissions_map; + + if (!data.ReadPermissionMap(&permissions_map)) + return false; + + for (MapType::iterator it = permissions_map.begin(); + it != permissions_map.end(); ++it) { + out->insert(std::move(it->second)); + } + + return true; +} + +bool StructTraits<extensions::mojom::ManifestPermissionDataView, + std::unique_ptr<extensions::ManifestPermission>>:: + Read(extensions::mojom::ManifestPermissionDataView data, + std::unique_ptr<extensions::ManifestPermission>* out) { + std::string id; + if (!data.ReadId(&id)) + return false; + + std::unique_ptr<extensions::ManifestPermission> permission = + base::WrapUnique(extensions::ManifestHandler::CreatePermission(id)); + if (!permission) + return false; + + absl::optional<base::Value> value; + if (!data.ReadValue(&value)) + return false; + + if (!permission->FromValue(value ? &*value : nullptr)) + return false; + + *out = std::move(permission); + return true; +} + +bool StructTraits<extensions::mojom::ManifestPermissionSetDataView, + extensions::ManifestPermissionSet>:: + Read(extensions::mojom::ManifestPermissionSetDataView data, + extensions::ManifestPermissionSet* out) { + using MapType = + std::map<std::string, std::unique_ptr<extensions::ManifestPermission>>; + MapType permissions_map; + + if (!data.ReadPermissionMap(&permissions_map)) + return false; + + for (MapType::iterator it = permissions_map.begin(); + it != permissions_map.end(); ++it) { + out->insert(std::move(it->second)); + } + + return true; +} + +bool StructTraits<extensions::mojom::PermissionSetDataView, + extensions::PermissionSet>:: + Read(extensions::mojom::PermissionSetDataView data, + extensions::PermissionSet* out) { + extensions::APIPermissionSet apis; + extensions::ManifestPermissionSet manifest_permissions; + extensions::URLPatternSet hosts; + extensions::URLPatternSet user_script_hosts; + if (!data.ReadApis(&apis) || + !data.ReadManifestPermissions(&manifest_permissions) || + !data.ReadHosts(&hosts) || !data.ReadUserScriptHosts(&user_script_hosts)) + return false; + + *out = extensions::PermissionSet( + std::move(apis), std::move(manifest_permissions), std::move(hosts), + std::move(user_script_hosts)); + + return true; +} + +} // namespace mojo
diff --git a/extensions/common/mojom/permission_set_mojom_traits.h b/extensions/common/mojom/permission_set_mojom_traits.h new file mode 100644 index 0000000..686358d0 --- /dev/null +++ b/extensions/common/mojom/permission_set_mojom_traits.h
@@ -0,0 +1,117 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef EXTENSIONS_COMMON_MOJOM_PERMISSION_SET_MOJOM_TRAITS_H_ +#define EXTENSIONS_COMMON_MOJOM_PERMISSION_SET_MOJOM_TRAITS_H_ + +#include "extensions/common/mojom/api_permission_id.mojom-shared.h" +#include "extensions/common/mojom/permission_set.mojom-shared.h" +#include "extensions/common/mojom/url_pattern_set_mojom_traits.h" +#include "extensions/common/permissions/api_permission_set.h" +#include "extensions/common/permissions/manifest_permission_set.h" +#include "extensions/common/permissions/permission_set.h" +#include "mojo/public/cpp/base/values_mojom_traits.h" +#include "mojo/public/cpp/bindings/struct_traits.h" +#include "third_party/abseil-cpp/absl/types/optional.h" + +namespace mojo { + +template <> +struct StructTraits<extensions::mojom::APIPermissionDataView, + std::unique_ptr<extensions::APIPermission>> { + static extensions::mojom::APIPermissionID id( + const std::unique_ptr<extensions::APIPermission>& permission) { + return permission->id(); + } + + static absl::optional<base::Value> value( + const std::unique_ptr<extensions::APIPermission>& permission) { + std::unique_ptr<base::Value> value = permission->ToValue(); + + if (value == nullptr) + return absl::nullopt; + return base::Value::FromUniquePtrValue(std::move(value)); + } + + static bool Read(extensions::mojom::APIPermissionDataView data, + std::unique_ptr<extensions::APIPermission>* out); +}; + +template <> +struct StructTraits<extensions::mojom::APIPermissionSetDataView, + extensions::APIPermissionSet> { + static const std::map<extensions::mojom::APIPermissionID, + std::unique_ptr<extensions::APIPermission>>& + permission_map(const extensions::APIPermissionSet& set) { + return set.map(); + } + + static bool Read(extensions::mojom::APIPermissionSetDataView data, + extensions::APIPermissionSet* out); +}; + +template <> +struct StructTraits<extensions::mojom::ManifestPermissionDataView, + std::unique_ptr<extensions::ManifestPermission>> { + static std::string id( + const std::unique_ptr<extensions::ManifestPermission>& permission) { + return permission->id(); + } + + static absl::optional<base::Value> value( + const std::unique_ptr<extensions::ManifestPermission>& permission) { + std::unique_ptr<base::Value> value = permission->ToValue(); + + if (value == nullptr) + return absl::nullopt; + return base::Value::FromUniquePtrValue(std::move(value)); + } + + static bool Read(extensions::mojom::ManifestPermissionDataView data, + std::unique_ptr<extensions::ManifestPermission>* out); +}; + +template <> +struct StructTraits<extensions::mojom::ManifestPermissionSetDataView, + extensions::ManifestPermissionSet> { + static const std::map<std::string, + std::unique_ptr<extensions::ManifestPermission>>& + permission_map(const extensions::ManifestPermissionSet& set) { + return set.map(); + } + + static bool Read(extensions::mojom::ManifestPermissionSetDataView data, + extensions::ManifestPermissionSet* out); +}; + +template <> +struct StructTraits<extensions::mojom::PermissionSetDataView, + extensions::PermissionSet> { + static const extensions::APIPermissionSet& apis( + const extensions::PermissionSet& set) { + return set.apis(); + } + + static const extensions::ManifestPermissionSet& manifest_permissions( + const extensions::PermissionSet& set) { + return set.manifest_permissions(); + } + + static const extensions::URLPatternSet& hosts( + const extensions::PermissionSet& set) { + return set.explicit_hosts(); + } + + static const extensions::URLPatternSet& user_script_hosts( + const extensions::PermissionSet& set) { + return set.scriptable_hosts(); + } + + static bool Read(extensions::mojom::PermissionSetDataView data, + extensions::PermissionSet* out); +}; + +} // namespace mojo + +#endif // EXTENSIONS_COMMON_MOJOM_PERMISSION_SET_MOJOM_TRAITS_H_
diff --git a/extensions/common/mojom/permission_set_mojom_traits_unittest.cc b/extensions/common/mojom/permission_set_mojom_traits_unittest.cc new file mode 100644 index 0000000..17aa4899 --- /dev/null +++ b/extensions/common/mojom/permission_set_mojom_traits_unittest.cc
@@ -0,0 +1,191 @@ +// 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 "extensions/common/mojom/permission_set_mojom_traits.h" + +#include "extensions/common/manifest_handler.h" +#include "extensions/common/mojom/permission_set.mojom.h" +#include "extensions/common/permissions/api_permission_set.h" +#include "extensions/common/permissions/mock_manifest_permission.h" +#include "extensions/common/permissions/permissions_info.h" +#include "extensions/common/scoped_testing_manifest_handler_registry.h" +#include "mojo/public/cpp/test_support/test_utils.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace extensions { + +using mojo::test::SerializeAndDeserialize; + +class MockManifestHandler : public ManifestHandler { + public: + MockManifestHandler() {} + MockManifestHandler(const MockManifestHandler&) = delete; + MockManifestHandler& operator=(const MockManifestHandler&) = delete; + ~MockManifestHandler() override {} + + bool Parse(Extension* extension, std::u16string* error) override { + return true; + } + + ManifestPermission* CreatePermission() override { + return new MockManifestPermission("mock_keys::key"); + } + + base::span<const char* const> Keys() const override { + static constexpr const char* kKeys[] = {"mock_keys::key"}; + return kKeys; + } +}; + +TEST(PermissionSetMojomTraitsTest, BasicAPIPermission) { + const APIPermissionInfo* permission_info = + PermissionsInfo::GetInstance()->GetByID(mojom::APIPermissionID::kSocket); + std::unique_ptr<APIPermission> input = permission_info->CreateAPIPermission(); + { + base::Value value(base::Value::Type::LIST); + value.Append("tcp-connect:*.example.com:80"); + value.Append("udp-bind::8080"); + value.Append("udp-send-to::8888"); + ASSERT_TRUE( + input->FromValue(&base::Value::AsListValue(value), nullptr, nullptr)); + } + + std::unique_ptr<APIPermission> output = nullptr; + EXPECT_TRUE( + SerializeAndDeserialize<extensions::mojom::APIPermission>(input, output)); + EXPECT_TRUE(input->Equal(output.get())); +} + +TEST(PermissionSetMojomTraitsTest, BasicAPIPermissionSet) { + const APIPermissionInfo* permission_info = + PermissionsInfo::GetInstance()->GetByID(mojom::APIPermissionID::kSocket); + std::unique_ptr<APIPermission> permission = + permission_info->CreateAPIPermission(); + { + base::Value value(base::Value::Type::LIST); + value.Append("tcp-connect:*.example.com:80"); + value.Append("udp-bind::8080"); + value.Append("udp-send-to::8888"); + ASSERT_TRUE(permission->FromValue(&base::Value::AsListValue(value), nullptr, + nullptr)); + } + + APIPermissionSet input; + input.insert(mojom::APIPermissionID::kAudioCapture); + input.insert(mojom::APIPermissionID::kDns); + input.insert(mojom::APIPermissionID::kHid); + input.insert(mojom::APIPermissionID::kPower); + input.insert(mojom::APIPermissionID::kSerial); + input.insert(std::move(permission)); + + APIPermissionSet output; + EXPECT_TRUE(SerializeAndDeserialize<extensions::mojom::APIPermissionSet>( + input, output)); + EXPECT_EQ(input, output); +} + +TEST(PermissionSetMojomTraitsTest, BasicManifestPermission) { + ScopedTestingManifestHandlerRegistry scoped_registry; + ManifestHandlerRegistry::Get()->RegisterHandler( + std::make_unique<MockManifestHandler>()); + ManifestHandler::FinalizeRegistration(); + + std::unique_ptr<extensions::ManifestPermission> input( + extensions::ManifestHandler::CreatePermission("mock_keys::key")); + ASSERT_TRUE(input); + base::Value value("value"); + input->FromValue(&value); + + std::unique_ptr<extensions::ManifestPermission> output = nullptr; + EXPECT_TRUE(SerializeAndDeserialize<extensions::mojom::ManifestPermission>( + input, output)); + EXPECT_EQ(input->id(), output->id()); + EXPECT_TRUE(input->Equal(output.get())); +} + +TEST(PermissionSetMojomTraitsTest, BasicManifestPermissionSet) { + ScopedTestingManifestHandlerRegistry scoped_registry; + ManifestHandlerRegistry::Get()->RegisterHandler( + std::make_unique<MockManifestHandler>()); + ManifestHandler::FinalizeRegistration(); + std::unique_ptr<extensions::ManifestPermission> permission1( + extensions::ManifestHandler::CreatePermission("mock_keys::key")); + std::unique_ptr<extensions::ManifestPermission> permission2( + extensions::ManifestHandler::CreatePermission("mock_keys::key")); + base::Value value("value"); + permission2->FromValue(&value); + ManifestPermissionSet input; + input.insert(std::move(permission1)); + input.insert(std::move(permission2)); + + ManifestPermissionSet output; + EXPECT_TRUE(SerializeAndDeserialize<extensions::mojom::ManifestPermissionSet>( + input, output)); + EXPECT_EQ(input, output); +} + +TEST(PermissionSetMojomTraitsTest, BasicPermissionSet) { + const APIPermissionInfo* permission_info = + PermissionsInfo::GetInstance()->GetByID(mojom::APIPermissionID::kSocket); + std::unique_ptr<APIPermission> permission = + permission_info->CreateAPIPermission(); + { + base::Value value(base::Value::Type::LIST); + value.Append("tcp-connect:*.example.com:80"); + value.Append("udp-bind::8080"); + value.Append("udp-send-to::8888"); + ASSERT_TRUE(permission->FromValue(&base::Value::AsListValue(value), nullptr, + nullptr)); + } + + APIPermissionSet apis; + apis.insert(mojom::APIPermissionID::kAudioCapture); + apis.insert(mojom::APIPermissionID::kDns); + apis.insert(std::move(permission)); + + ScopedTestingManifestHandlerRegistry scoped_registry; + ManifestHandlerRegistry::Get()->RegisterHandler( + std::make_unique<MockManifestHandler>()); + ManifestHandler::FinalizeRegistration(); + std::unique_ptr<extensions::ManifestPermission> permission1( + extensions::ManifestHandler::CreatePermission("mock_keys::key")); + std::unique_ptr<extensions::ManifestPermission> permission2( + extensions::ManifestHandler::CreatePermission("mock_keys::key")); + { + base::Value value("value"); + permission2->FromValue(&value); + } + ManifestPermissionSet manifest_permissions; + manifest_permissions.insert(std::move(permission1)); + manifest_permissions.insert(std::move(permission2)); + + URLPattern pattern1(URLPattern::SCHEME_ALL); + EXPECT_EQ(URLPattern::ParseResult::kSuccess, + pattern1.Parse("http://*.foo:1234/bar")) + << "Got unexpected error in the URLPattern parsing"; + URLPattern pattern2(URLPattern::SCHEME_HTTPS); + EXPECT_EQ(URLPattern::ParseResult::kSuccess, + pattern2.Parse("https://www.google.com/foobar")) + << "Got unexpected error in the URLPattern parsing"; + URLPatternSet hosts; + hosts.AddPattern(pattern1); + hosts.AddPattern(pattern2); + + URLPattern pattern3(URLPattern::SCHEME_HTTP); + EXPECT_EQ(URLPattern::ParseResult::kSuccess, + pattern3.Parse("http://127.0.0.1/*")) + << "Got unexpected error in the URLPattern parsing"; + URLPatternSet user_script_hosts; + user_script_hosts.AddPattern(pattern3); + + PermissionSet input(std::move(apis), std::move(manifest_permissions), + std::move(hosts), std::move(user_script_hosts)); + + PermissionSet output; + EXPECT_TRUE( + SerializeAndDeserialize<extensions::mojom::PermissionSet>(input, output)); + EXPECT_EQ(input, output); +} + +} // namespace extensions
diff --git a/extensions/common/mojom/renderer.mojom b/extensions/common/mojom/renderer.mojom index 8f63ed3..ca9cad6 100644 --- a/extensions/common/mojom/renderer.mojom +++ b/extensions/common/mojom/renderer.mojom
@@ -5,10 +5,55 @@ module extensions.mojom; import "mojo/public/mojom/base/shared_memory.mojom"; +import "extensions/common/mojom/activation_sequence.mojom"; +import "extensions/common/mojom/api_permission_id.mojom"; import "extensions/common/mojom/channel.mojom"; import "extensions/common/mojom/host_id.mojom"; import "extensions/common/mojom/feature_session_type.mojom"; +import "extensions/common/mojom/manifest.mojom"; +import "extensions/common/mojom/permission_set.mojom"; import "extensions/common/mojom/url_pattern_set.mojom"; +import "mojo/public/mojom/base/values.mojom"; +import "mojo/public/mojom/base/file_path.mojom"; + +// Mojo struct to be used as argument on the LoadExtension method. +struct ExtensionLoadedParams { + // The subset of the extension manifest data we send to renderers. + mojo_base.mojom.Value manifest; + + // The location the extension was installed from. This is used in the renderer + // only to generate the extension ID for extensions that are loaded unpacked. + ManifestLocation location; + + // The path the extension was loaded from. + mojo_base.mojom.FilePath path; + + // The extension's active and withheld permissions. + PermissionSet active_permissions; + PermissionSet withheld_permissions; + map<int32, PermissionSet> tab_specific_permissions; + + // Contains URLPatternSets defining which URLs an extension may not interact + // with by policy. + URLPatternSet policy_blocked_hosts; + URLPatternSet policy_allowed_hosts; + + // If the extension uses the default list of blocked / allowed URLs. + bool uses_default_policy_blocked_allowed_hosts; + + // We keep this separate so that it can be used in logging and testing. + string id; + + // If this extension is Service Worker based, then this contains the + // activation sequence of the extension + ActivationSequence? worker_activation_sequence; + + // Send creation flags so that extension is initialized identically. + int32 creation_flags; + + // Reuse the extension guid when creating the extension in the renderer. + string guid; +}; // This should be used for implementing browser-to-renderer control messages // which need to retain FIFO with respect to other mojo interfaces like @@ -24,6 +69,9 @@ // otherwise. SetActivityLoggingEnabled(bool enabled); + // Notifies the renderer that extensions were loaded in the browser. + LoadExtensions(array<ExtensionLoadedParams> params); + // Notifies the renderer that an extension was unloaded in the browser. UnloadExtension(string extension_id);
diff --git a/extensions/common/permissions/mock_manifest_permission.cc b/extensions/common/permissions/mock_manifest_permission.cc index dfc1121..49014cff 100644 --- a/extensions/common/permissions/mock_manifest_permission.cc +++ b/extensions/common/permissions/mock_manifest_permission.cc
@@ -12,6 +12,10 @@ MockManifestPermission::MockManifestPermission(const std::string& name) : name_(name) {} +MockManifestPermission::MockManifestPermission(const std::string& name, + const std::string& value) + : name_(name), value_(value) {} + std::string MockManifestPermission::name() const { return name_; } @@ -25,11 +29,11 @@ } bool MockManifestPermission::FromValue(const base::Value* value) { - return true; + return value && value->GetAsString(&value_); } std::unique_ptr<base::Value> MockManifestPermission::ToValue() const { - return std::make_unique<base::Value>(); + return std::make_unique<base::Value>(value_); } std::unique_ptr<ManifestPermission> MockManifestPermission::Diff( @@ -45,7 +49,7 @@ const MockManifestPermission* other = static_cast<const MockManifestPermission*>(rhs); EXPECT_EQ(name_, other->name_); - return std::make_unique<MockManifestPermission>(name_); + return std::make_unique<MockManifestPermission>(name_, value_); } std::unique_ptr<ManifestPermission> MockManifestPermission::Intersect( @@ -53,7 +57,7 @@ const MockManifestPermission* other = static_cast<const MockManifestPermission*>(rhs); EXPECT_EQ(name_, other->name_); - return std::make_unique<MockManifestPermission>(name_); + return std::make_unique<MockManifestPermission>(name_, value_); } bool MockManifestPermission::RequiresManagementUIWarning() const {
diff --git a/extensions/common/permissions/mock_manifest_permission.h b/extensions/common/permissions/mock_manifest_permission.h index 65b8bcd..f7ddba1 100644 --- a/extensions/common/permissions/mock_manifest_permission.h +++ b/extensions/common/permissions/mock_manifest_permission.h
@@ -21,6 +21,8 @@ class MockManifestPermission : public ManifestPermission { public: explicit MockManifestPermission(const std::string& name); + explicit MockManifestPermission(const std::string& name, + const std::string& value); std::string name() const override; std::string id() const override; @@ -40,6 +42,8 @@ private: std::string name_; + // value_ is ignored for the Diff, Union and Intersect operations + std::string value_; DISALLOW_COPY_AND_ASSIGN(MockManifestPermission); };
diff --git a/extensions/common/permissions/permission_set.cc b/extensions/common/permissions/permission_set.cc index d3cbe968..eb6ab44 100644 --- a/extensions/common/permissions/permission_set.cc +++ b/extensions/common/permissions/permission_set.cc
@@ -56,6 +56,10 @@ PermissionSet::~PermissionSet() {} +PermissionSet::PermissionSet(PermissionSet&& other) = default; + +PermissionSet& PermissionSet::operator=(PermissionSet&& other) = default; + // static std::unique_ptr<const PermissionSet> PermissionSet::CreateDifference( const PermissionSet& set1,
diff --git a/extensions/common/permissions/permission_set.h b/extensions/common/permissions/permission_set.h index f21e4e1a..2f4d6cf 100644 --- a/extensions/common/permissions/permission_set.h +++ b/extensions/common/permissions/permission_set.h
@@ -42,6 +42,9 @@ URLPatternSet scriptable_hosts); ~PermissionSet(); + PermissionSet(PermissionSet&& other); + PermissionSet& operator=(PermissionSet&& other); + // Creates a new permission set equal to |set1| - |set2|. static std::unique_ptr<const PermissionSet> CreateDifference( const PermissionSet& set1,
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc index 3f04137..6a93985 100644 --- a/extensions/renderer/dispatcher.cc +++ b/extensions/renderer/dispatcher.cc
@@ -207,6 +207,49 @@ base::LazyInstance<WorkerScriptContextSet>::DestructorAtExit g_worker_script_context_set = LAZY_INSTANCE_INITIALIZER; +// Creates a new extension from the data in the mojom::ExtensionLoadedParams +// object. A context_id needs to be passed because each browser context can have +// different values for default_policy_blocked/allowed_hosts. +// (see extension_util.cc#GetBrowserContextId) +scoped_refptr<extensions::Extension> ConvertToExtension( + mojom::ExtensionLoadedParamsPtr params, + int context_id, + std::string* error) { + // We pass in the |id| to the create call because it will save work in the + // normal case, and because in tests, extensions may not have paths or keys, + // but it's important to retain the same id. + scoped_refptr<Extension> extension = + Extension::Create(params->path, params->location, + base::Value::AsDictionaryValue(params->manifest), + params->creation_flags, params->id, error); + + if (!extension.get()) + return extension; + + const extensions::PermissionsData* permissions_data = + extension->permissions_data(); + permissions_data->SetPermissions( + std::make_unique<const extensions::PermissionSet>( + std::move(params->active_permissions)), + std::make_unique<const extensions::PermissionSet>( + std::move(params->withheld_permissions))); + + if (params->uses_default_policy_blocked_allowed_hosts) { + permissions_data->SetUsesDefaultHostRestrictions(context_id); + } else { + permissions_data->SetPolicyHostRestrictions(params->policy_blocked_hosts, + params->policy_allowed_hosts); + } + + for (const auto& pair : params->tab_specific_permissions) { + permissions_data->UpdateTabSpecificPermissions(pair.first, pair.second); + } + + extension->SetGUID(params->guid); + + return extension; +} + } // namespace Dispatcher::PendingServiceWorker::PendingServiceWorker( @@ -892,7 +935,6 @@ IPC_MESSAGE_HANDLER(ExtensionMsg_DeliverMessage, OnDeliverMessage) IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnConnect, OnDispatchOnConnect) IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchOnDisconnect, OnDispatchOnDisconnect) - IPC_MESSAGE_HANDLER(ExtensionMsg_Loaded, OnLoaded) IPC_MESSAGE_HANDLER(ExtensionMsg_DispatchEvent, OnDispatchEvent) IPC_MESSAGE_HANDLER(ExtensionMsg_UpdatePermissions, OnUpdatePermissions) IPC_MESSAGE_UNHANDLED(handled = false) @@ -967,6 +1009,71 @@ UpdateActiveExtensions(); } +void Dispatcher::LoadExtensions( + std::vector<mojom::ExtensionLoadedParamsPtr> loaded_extensions) { + for (auto& param : loaded_extensions) { + std::string error; + std::string id = param->id; + absl::optional<::extensions::ActivationSequence> + worker_activation_sequence = param->worker_activation_sequence; + + scoped_refptr<const Extension> extension = + ConvertToExtension(std::move(param), kRendererProfileId, &error); + if (!extension.get()) { + NOTREACHED() << error; + // Note: in tests |param.id| has been observed to be empty (see comment + // just below) so this isn't all that reliable. + extension_load_errors_[id] = error; + continue; + } + + RendererExtensionRegistry* extension_registry = + RendererExtensionRegistry::Get(); + // TODO(kalman): This test is deliberately not a CHECK (though I wish it + // could be) and uses extension->id() not params.id: + // 1. For some reason params.id can be empty. I've only seen it with + // the webstore extension, in tests, and I've spent some time trying to + // figure out why - but cost/benefit won. + // 2. The browser only sends this IPC to RenderProcessHosts once, but the + // Dispatcher is attached to a RenderThread. Presumably there is a + // mismatch there. In theory one would think it's possible for the + // browser to figure this out itself - but again, cost/benefit. + if (!extension_registry->Insert(extension)) { + // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and + // consider making this a release CHECK. + NOTREACHED(); + } + + if (worker_activation_sequence.has_value()) { + extension_registry->SetWorkerActivationSequence( + extension, std::move(*worker_activation_sequence)); + } + + ExtensionsRendererClient::Get()->OnExtensionLoaded(*extension); + + // Resume service worker if it is suspended. + { + base::AutoLock lock(service_workers_paused_for_on_loaded_message_lock_); + auto it = + service_workers_paused_for_on_loaded_message_.find(extension->id()); + if (it != service_workers_paused_for_on_loaded_message_.end()) { + scoped_refptr<base::SingleThreadTaskRunner> task_runner = + std::move(it->second->task_runner); + // Using base::Unretained() should be fine as this won't get destructed. + task_runner->PostTask( + FROM_HERE, + base::BindOnce(&Dispatcher::ResumeEvaluationOnWorkerThread, + base::Unretained(this), extension->id())); + } + } + } + + // Update the available bindings for all contexts. These may have changed if + // an externally_connectable extension was loaded that can connect to an + // open webpage. + UpdateAllBindings(); +} + void Dispatcher::UnloadExtension(const std::string& extension_id) { // See comment in OnLoaded for why it would be nice, but perhaps incorrect, // to CHECK here rather than guarding. @@ -1056,8 +1163,8 @@ } void Dispatcher::UpdateDefaultPolicyHostRestrictions( - const URLPatternSet& default_policy_blocked_hosts, - const URLPatternSet& default_policy_allowed_hosts) { + URLPatternSet default_policy_blocked_hosts, + URLPatternSet default_policy_allowed_hosts) { PermissionsData::SetDefaultPolicyHostRestrictions( kRendererProfileId, default_policy_blocked_hosts, default_policy_allowed_hosts); @@ -1075,7 +1182,7 @@ } void Dispatcher::UpdateTabSpecificPermissions(const std::string& extension_id, - const URLPatternSet& new_hosts, + URLPatternSet new_hosts, int tab_id, bool update_origin_whitelist) { const Extension* extension = @@ -1150,72 +1257,6 @@ NULL); // All render frames. } -void Dispatcher::OnLoaded( - const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions) { - for (const auto& param : loaded_extensions) { - std::string error; - scoped_refptr<const Extension> extension = - param.ConvertToExtension(kRendererProfileId, &error); - if (!extension.get()) { - NOTREACHED() << error; - // Note: in tests |param.id| has been observed to be empty (see comment - // just below) so this isn't all that reliable. - extension_load_errors_[param.id] = error; - continue; - } - RendererExtensionRegistry* extension_registry = - RendererExtensionRegistry::Get(); - // TODO(kalman): This test is deliberately not a CHECK (though I wish it - // could be) and uses extension->id() not params.id: - // 1. For some reason params.id can be empty. I've only seen it with - // the webstore extension, in tests, and I've spent some time trying to - // figure out why - but cost/benefit won. - // 2. The browser only sends this IPC to RenderProcessHosts once, but the - // Dispatcher is attached to a RenderThread. Presumably there is a - // mismatch there. In theory one would think it's possible for the - // browser to figure this out itself - but again, cost/benefit. - if (!extension_registry->Insert(extension)) { - // TODO(devlin): This may be fixed by crbug.com/528026. Monitor, and - // consider making this a release CHECK. - NOTREACHED(); - } - if (param.worker_activation_sequence) { - extension_registry->SetWorkerActivationSequence( - extension, *param.worker_activation_sequence); - } - if (param.uses_default_policy_blocked_allowed_hosts) { - extension->permissions_data()->SetUsesDefaultHostRestrictions( - kRendererProfileId); - } else { - extension->permissions_data()->SetPolicyHostRestrictions( - param.policy_blocked_hosts, param.policy_allowed_hosts); - } - - ExtensionsRendererClient::Get()->OnExtensionLoaded(*extension); - - // Resume service worker if it is suspended. - { - base::AutoLock lock(service_workers_paused_for_on_loaded_message_lock_); - auto it = - service_workers_paused_for_on_loaded_message_.find(extension->id()); - if (it != service_workers_paused_for_on_loaded_message_.end()) { - scoped_refptr<base::SingleThreadTaskRunner> task_runner = - std::move(it->second->task_runner); - // Using base::Unretained() should be fine as this won't get destructed. - task_runner->PostTask( - FROM_HERE, - base::BindOnce(&Dispatcher::ResumeEvaluationOnWorkerThread, - base::Unretained(this), extension->id())); - } - } - } - - // Update the available bindings for all contexts. These may have changed if - // an externally_connectable extension was loaded that can connect to an - // open webpage. - UpdateAllBindings(); -} - void Dispatcher::OnDispatchEvent( const ExtensionMsg_DispatchEvent_Params& params, const base::ListValue& event_args) {
diff --git a/extensions/renderer/dispatcher.h b/extensions/renderer/dispatcher.h index 20e1fdd..54ef43d 100644 --- a/extensions/renderer/dispatcher.h +++ b/extensions/renderer/dispatcher.h
@@ -42,7 +42,6 @@ class ModuleSystem; struct ExtensionMsg_DispatchEvent_Params; struct ExtensionMsg_ExternalConnectionInfo; -struct ExtensionMsg_Loaded_Params; struct ExtensionMsg_TabConnectionInfo; struct ExtensionMsg_UpdatePermissions_Params; @@ -223,6 +222,8 @@ // mojom::Renderer implementation: void ActivateExtension(const std::string& extension_id) override; void SetActivityLoggingEnabled(bool enabled) override; + void LoadExtensions(std::vector<extensions::mojom::ExtensionLoadedParamsPtr> + loaded_extensions) override; void UnloadExtension(const std::string& extension_id) override; void SuspendExtension( const std::string& extension_id, @@ -239,10 +240,10 @@ void ShouldSuspend(ShouldSuspendCallback callback) override; void TransferBlobs(TransferBlobsCallback callback) override; void UpdateDefaultPolicyHostRestrictions( - const extensions::URLPatternSet& default_policy_blocked_hosts, - const extensions::URLPatternSet& default_policy_allowed_hosts) override; + extensions::URLPatternSet default_policy_blocked_hosts, + extensions::URLPatternSet default_policy_allowed_hosts) override; void UpdateTabSpecificPermissions(const std::string& extension_id, - const extensions::URLPatternSet& new_hosts, + extensions::URLPatternSet new_hosts, int tab_id, bool update_origin_whitelist) override; void UpdateUserScripts(base::ReadOnlySharedMemoryRegion shared_memory, @@ -266,8 +267,6 @@ void OnDispatchOnDisconnect(int worker_thread_id, const PortId& port_id, const std::string& error_message); - void OnLoaded( - const std::vector<ExtensionMsg_Loaded_Params>& loaded_extensions); void OnDispatchEvent(const ExtensionMsg_DispatchEvent_Params& params, const base::ListValue& event_args); void OnUpdatePermissions(const ExtensionMsg_UpdatePermissions_Params& params);
diff --git a/ios/chrome/browser/link_to_text/link_to_text_response.h b/ios/chrome/browser/link_to_text/link_to_text_response.h index 1e5db0b..9838956a 100644 --- a/ios/chrome/browser/link_to_text/link_to_text_response.h +++ b/ios/chrome/browser/link_to_text/link_to_text_response.h
@@ -7,9 +7,9 @@ #import <UIKit/UIKit.h> -#import "base/optional.h" #import "components/shared_highlighting/core/common/shared_highlighting_metrics.h" #import "ios/chrome/browser/link_to_text/link_generation_outcome.h" +#import "third_party/abseil-cpp/absl/types/optional.h" #import "url/gurl.h" namespace base {
diff --git a/ios/chrome/browser/link_to_text/link_to_text_tab_helper.mm b/ios/chrome/browser/link_to_text/link_to_text_tab_helper.mm index 85fdfff..a111d75 100644 --- a/ios/chrome/browser/link_to_text/link_to_text_tab_helper.mm +++ b/ios/chrome/browser/link_to_text/link_to_text_tab_helper.mm
@@ -6,7 +6,6 @@ #import "base/bind.h" #import "base/metrics/histogram_functions.h" -#import "base/optional.h" #import "base/timer/elapsed_timer.h" #import "base/values.h" #import "components/shared_highlighting/core/common/disabled_sites.h" @@ -15,6 +14,7 @@ #import "ios/web/public/js_messaging/web_frames_manager.h" #import "ios/web/public/ui/crw_web_view_proxy.h" #import "ios/web/public/ui/crw_web_view_scroll_view_proxy.h" +#import "third_party/abseil-cpp/absl/types/optional.h" #import "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc)
diff --git a/ios/chrome/browser/link_to_text/link_to_text_utils.h b/ios/chrome/browser/link_to_text/link_to_text_utils.h index 39e6513..7e96e1b 100644 --- a/ios/chrome/browser/link_to_text/link_to_text_utils.h +++ b/ios/chrome/browser/link_to_text/link_to_text_utils.h
@@ -10,9 +10,9 @@ #include <string> -#import "base/optional.h" #import "components/shared_highlighting/core/common/shared_highlighting_metrics.h" #import "ios/chrome/browser/link_to_text/link_generation_outcome.h" +#import "third_party/abseil-cpp/absl/types/optional.h" namespace base { class TimeDelta;
diff --git a/ios/chrome/browser/policy/BUILD.gn b/ios/chrome/browser/policy/BUILD.gn index c6593c6..bfcb74b 100644 --- a/ios/chrome/browser/policy/BUILD.gn +++ b/ios/chrome/browser/policy/BUILD.gn
@@ -24,6 +24,9 @@ "policy_conversions_client_ios.mm", "policy_watcher_browser_agent.h", "policy_watcher_browser_agent.mm", + "policy_watcher_browser_agent_observer.h", + "policy_watcher_browser_agent_observer_bridge.h", + "policy_watcher_browser_agent_observer_bridge.mm", "reporting/browser_report_generator_ios.h", "reporting/browser_report_generator_ios.mm", "reporting/profile_report_generator_ios.h",
diff --git a/ios/chrome/browser/policy/policy_watcher_browser_agent.h b/ios/chrome/browser/policy/policy_watcher_browser_agent.h index cff8372..a0903602 100644 --- a/ios/chrome/browser/policy/policy_watcher_browser_agent.h +++ b/ios/chrome/browser/policy/policy_watcher_browser_agent.h
@@ -8,10 +8,11 @@ #include <memory> #include "base/macros.h" +#include "base/observer_list.h" #import "ios/chrome/browser/main/browser_user_data.h" -#import "ios/chrome/browser/ui/commands/application_commands.h" class Browser; +class PolicyWatcherBrowserAgentObserver; class PrefChangeRegistrar; // Service that listens for policy-controlled prefs changes and sends commands @@ -21,9 +22,12 @@ public: ~PolicyWatcherBrowserAgent() override; - // Sets the command dispatcher to use for sneding UI commands when prefs - // change. Also starts observing the kSigninAllowed pref. - void SetApplicationCommandsHandler(id<ApplicationCommands> handler); + void AddObserver(PolicyWatcherBrowserAgentObserver* observer); + void RemoveObserver(PolicyWatcherBrowserAgentObserver* observer); + + // Starts observing the kSigninAllowed pref and trigger a SignOut if the pref + // has changed before the BrowserAgent start the observation. + void Initialize(); private: explicit PolicyWatcherBrowserAgent(Browser* browser); @@ -38,12 +42,11 @@ // The owning Browser. Browser* browser_; - // The command handler to use for sending ApplicationCommands. Must be set by - // - id<ApplicationCommands> application_commands_handler_; - // Registrar for pref change notifications. std::unique_ptr<PrefChangeRegistrar> prefs_change_observer_; + + // List of observers notified of changes to the policy. + base::ObserverList<PolicyWatcherBrowserAgentObserver, true> observers_; }; #endif // IOS_CHROME_BROWSER_POLICY_POLICY_WATCHER_BROWSER_AGENT_H_
diff --git a/ios/chrome/browser/policy/policy_watcher_browser_agent.mm b/ios/chrome/browser/policy/policy_watcher_browser_agent.mm index 5ae3cce..b3258b2 100644 --- a/ios/chrome/browser/policy/policy_watcher_browser_agent.mm +++ b/ios/chrome/browser/policy/policy_watcher_browser_agent.mm
@@ -10,7 +10,7 @@ #include "components/prefs/pref_service.h" #include "components/signin/public/base/signin_pref_names.h" #import "ios/chrome/browser/browser_state/chrome_browser_state.h" -#import "ios/chrome/browser/ui/commands/command_dispatcher.h" +#include "ios/chrome/browser/policy/policy_watcher_browser_agent_observer.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -24,12 +24,7 @@ prefs_change_observer_->Init(browser_->GetBrowserState()->GetPrefs()); } -PolicyWatcherBrowserAgent::~PolicyWatcherBrowserAgent() {} - -void PolicyWatcherBrowserAgent::SetApplicationCommandsHandler( - id<ApplicationCommands> handler) { - application_commands_handler_ = handler; - +void PolicyWatcherBrowserAgent::Initialize() { // BrowserSignin policy: start observing the kSigninAllowed pref for non-OTR // browsers. When the pref becomes false, send a UI command to sign the user // out. This requires the given command dispatcher to be fully configured. @@ -44,11 +39,23 @@ ForceSignOutIfSigninDisabled(); } +PolicyWatcherBrowserAgent::~PolicyWatcherBrowserAgent() {} + void PolicyWatcherBrowserAgent::ForceSignOutIfSigninDisabled() { if (!browser_->GetBrowserState()->GetPrefs()->GetBoolean( prefs::kSigninAllowed)) { - // Trigger the command to interrupt any in-progress sign-in and to force - // sign out existing users. - [application_commands_handler_ forceSignOut]; + for (auto& observer : observers_) { + observer.OnSignInDisallowed(this); + } } } + +void PolicyWatcherBrowserAgent::AddObserver( + PolicyWatcherBrowserAgentObserver* observer) { + observers_.AddObserver(observer); +} + +void PolicyWatcherBrowserAgent::RemoveObserver( + PolicyWatcherBrowserAgentObserver* observer) { + observers_.RemoveObserver(observer); +}
diff --git a/ios/chrome/browser/policy/policy_watcher_browser_agent_observer.h b/ios/chrome/browser/policy/policy_watcher_browser_agent_observer.h new file mode 100644 index 0000000..91be1ac --- /dev/null +++ b/ios/chrome/browser/policy/policy_watcher_browser_agent_observer.h
@@ -0,0 +1,25 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_POLICY_POLICY_WATCHER_BROWSER_AGENT_OBSERVER_H_ +#define IOS_CHROME_BROWSER_POLICY_POLICY_WATCHER_BROWSER_AGENT_OBSERVER_H_ + +#import <Foundation/Foundation.h> + +#include "base/macros.h" +#include "base/observer_list_types.h" + +class PolicyWatcherBrowserAgent; + +// Interface for listening to events occurring to PolicyWatcherBrowserAgent. +class PolicyWatcherBrowserAgentObserver : public base::CheckedObserver { + public: + // Notify the observer that SignIn is no longer allowed. + virtual void OnSignInDisallowed(PolicyWatcherBrowserAgent* policy_watcher) {} + + protected: + PolicyWatcherBrowserAgentObserver() = default; +}; + +#endif // IOS_CHROME_BROWSER_POLICY_POLICY_WATCHER_BROWSER_AGENT_OBSERVER_H_
diff --git a/ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.h b/ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.h new file mode 100644 index 0000000..d91997ae --- /dev/null +++ b/ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.h
@@ -0,0 +1,35 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IOS_CHROME_BROWSER_POLICY_POLICY_WATCHER_BROWSER_AGENT_OBSERVER_BRIDGE_H_ +#define IOS_CHROME_BROWSER_POLICY_POLICY_WATCHER_BROWSER_AGENT_OBSERVER_BRIDGE_H_ + +#import "ios/chrome/browser/policy/policy_watcher_browser_agent_observer.h" + +// Protocol that corresponds to the PolicyWatcherBrowserAgentObserver API. +@protocol PolicyWatcherBrowserAgentObserving + +// Invoked when the policy has changed and it is no longer possible to SignIn. +- (void)policyWatcherBrowserAgentNotifySignInDisabled: + (PolicyWatcherBrowserAgent*)policyWatcher; + +@end + +// Observer that bridges PolicyWatcherBrowserAgentObserver events to an +// Objective-C observer. +class PolicyWatcherBrowserAgentObserverBridge + : public PolicyWatcherBrowserAgentObserver { + public: + explicit PolicyWatcherBrowserAgentObserverBridge( + id<PolicyWatcherBrowserAgentObserving> observer); + ~PolicyWatcherBrowserAgentObserverBridge() override = default; + + // PolicyWatcherBrowserAgentObserver implementation. + void OnSignInDisallowed(PolicyWatcherBrowserAgent* policy_watcher) final; + + private: + __weak id<PolicyWatcherBrowserAgentObserving> observer_ = nil; +}; + +#endif // IOS_CHROME_BROWSER_POLICY_POLICY_WATCHER_BROWSER_AGENT_OBSERVER_BRIDGE_H_
diff --git a/ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.mm b/ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.mm new file mode 100644 index 0000000..4e30e97 --- /dev/null +++ b/ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.mm
@@ -0,0 +1,19 @@ +// Copyright 2021 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.h" + +#if !defined(__has_feature) || !__has_feature(objc_arc) +#error "This file requires ARC support." +#endif + +PolicyWatcherBrowserAgentObserverBridge:: + PolicyWatcherBrowserAgentObserverBridge( + id<PolicyWatcherBrowserAgentObserving> observer) + : observer_(observer) {} + +void PolicyWatcherBrowserAgentObserverBridge::OnSignInDisallowed( + PolicyWatcherBrowserAgent* policy_watcher) { + [observer_ policyWatcherBrowserAgentNotifySignInDisabled:policy_watcher]; +}
diff --git a/ios/chrome/browser/policy/policy_watcher_browser_agent_unittest.mm b/ios/chrome/browser/policy/policy_watcher_browser_agent_unittest.mm index e176a092..43c9c20 100644 --- a/ios/chrome/browser/policy/policy_watcher_browser_agent_unittest.mm +++ b/ios/chrome/browser/policy/policy_watcher_browser_agent_unittest.mm
@@ -11,6 +11,7 @@ #import "components/sync_preferences/pref_service_syncable.h" #import "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #import "ios/chrome/browser/main/test_browser.h" +#include "ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.h" #import "ios/chrome/browser/prefs/browser_prefs.h" #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/command_dispatcher.h" @@ -52,9 +53,9 @@ #pragma mark - Tests. -// Tests that the browser agent monitors the kSigninAllowed pref and dispatches -// the appropriate command when the pref becomes false. -TEST_F(PolicyWatcherBrowserAgentTest, observesSigninAllowed) { +// Tests that the browser agent doesn't monitor the pref if Initialize hasn't +// been called. +TEST_F(PolicyWatcherBrowserAgentTest, NoObservationIfNoInitialize) { // Set the initial pref value. chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, true); @@ -63,17 +64,51 @@ std::make_unique<TestBrowser>(chrome_browser_state_.get()); PolicyWatcherBrowserAgent::CreateForBrowser(browser.get()); - // Set up the mock ApplicationCommands handler and inject it in the browser - // agent. - id applicationCommandHandler = - [OCMockObject mockForProtocol:@protocol(ApplicationCommands)]; - [((id<ApplicationCommands>)[applicationCommandHandler expect]) forceSignOut]; - PolicyWatcherBrowserAgent::FromBrowser(browser.get()) - ->SetApplicationCommandsHandler(applicationCommandHandler); + // Set up the mock observer handler as strict mock. Calling it will fail the + // test. + id mockObserver = + OCMStrictProtocolMock(@protocol(PolicyWatcherBrowserAgentObserving)); + PolicyWatcherBrowserAgentObserverBridge bridge(mockObserver); + PolicyWatcherBrowserAgent* agent = + PolicyWatcherBrowserAgent::FromBrowser(browser.get()); + agent->AddObserver(&bridge); + + // Action: disable browser sign-in. + chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); + + agent->RemoveObserver(&bridge); +} + +// Tests that the browser agent monitors the kSigninAllowed pref and notifies +// its observers when it changes. +TEST_F(PolicyWatcherBrowserAgentTest, ObservesSigninAllowed) { + // Set the initial pref value. + chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, true); + + // Set up the test browser and attach the browser agent under test. + std::unique_ptr<Browser> browser = + std::make_unique<TestBrowser>(chrome_browser_state_.get()); + PolicyWatcherBrowserAgent::CreateForBrowser(browser.get()); + + // Set up the mock observer handler as strict mock. Calling it will fail the + // test. + id mockObserver = + OCMStrictProtocolMock(@protocol(PolicyWatcherBrowserAgentObserving)); + PolicyWatcherBrowserAgentObserverBridge bridge(mockObserver); + PolicyWatcherBrowserAgent* agent = + PolicyWatcherBrowserAgent::FromBrowser(browser.get()); + agent->AddObserver(&bridge); + agent->Initialize(); + + // Setup the expectation after the Initialize to make sure that the observers + // are notified when the pref is updated and not during Initialize(). + OCMExpect([mockObserver policyWatcherBrowserAgentNotifySignInDisabled:agent]); // Action: disable browser sign-in. chrome_browser_state_->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); // Verify the forceSignOut command was dispatched by the browser agent. - EXPECT_OCMOCK_VERIFY(applicationCommandHandler); + EXPECT_OCMOCK_VERIFY(mockObserver); + + agent->RemoveObserver(&bridge); }
diff --git a/ios/chrome/browser/ui/autofill/autofill_ui_type.h b/ios/chrome/browser/ui/autofill/autofill_ui_type.h index e36bd54..712e3d7 100644 --- a/ios/chrome/browser/ui/autofill/autofill_ui_type.h +++ b/ios/chrome/browser/ui/autofill/autofill_ui_type.h
@@ -34,6 +34,7 @@ AutofillUITypeProfileHomeAddressCountry, AutofillUITypeProfileHomePhoneWholeNumber, AutofillUITypeProfileEmailAddress, + AutofillUITypeNameFullWithHonorificPrefix }; #endif // IOS_CHROME_BROWSER_UI_AUTOFILL_AUTOFILL_UI_TYPE_H_
diff --git a/ios/chrome/browser/ui/autofill/autofill_ui_type_util.mm b/ios/chrome/browser/ui/autofill/autofill_ui_type_util.mm index bac899d..23c9131f 100644 --- a/ios/chrome/browser/ui/autofill/autofill_ui_type_util.mm +++ b/ios/chrome/browser/ui/autofill/autofill_ui_type_util.mm
@@ -50,6 +50,8 @@ return AutofillUITypeProfileHomePhoneWholeNumber; case autofill::EMAIL_ADDRESS: return AutofillUITypeProfileEmailAddress; + case autofill::NAME_FULL_WITH_HONORIFIC_PREFIX: + return AutofillUITypeNameFullWithHonorificPrefix; default: NOTREACHED(); return AutofillUITypeUnknown; @@ -96,6 +98,8 @@ return autofill::PHONE_HOME_WHOLE_NUMBER; case AutofillUITypeProfileEmailAddress: return autofill::EMAIL_ADDRESS; + case AutofillUITypeNameFullWithHonorificPrefix: + return autofill::NAME_FULL_WITH_HONORIFIC_PREFIX; case AutofillUITypeCreditCardExpDate: case AutofillUITypeCreditCardBillingAddress: case AutofillUITypeCreditCardSaveToChrome:
diff --git a/ios/chrome/browser/ui/badges/badge_button.mm b/ios/chrome/browser/ui/badges/badge_button.mm index befd39e..b8e3ac72 100644 --- a/ios/chrome/browser/ui/badges/badge_button.mm +++ b/ios/chrome/browser/ui/badges/badge_button.mm
@@ -104,6 +104,10 @@ case BadgeType::kBadgeTypeSaveCard: return accepted ? kBadgeButtonSaveCardAcceptedAccessibilityIdentifier : kBadgeButtonSaveCardAccessibilityIdentifier; + case BadgeType::kBadgeTypeSaveAddressProfile: + return accepted + ? kBadgeButtonSaveAddressProfileAcceptedAccessibilityIdentifier + : kBadgeButtonSaveAddressProfileAccessibilityIdentifier; case BadgeType::kBadgeTypeTranslate: return accepted ? kBadgeButtonTranslateAcceptedAccessibilityIdentifier : kBadgeButtonTranslateAccessibilityIdentifier;
diff --git a/ios/chrome/browser/ui/badges/badge_button_factory.mm b/ios/chrome/browser/ui/badges/badge_button_factory.mm index d371c9d..4b5e336 100644 --- a/ios/chrome/browser/ui/badges/badge_button_factory.mm +++ b/ios/chrome/browser/ui/badges/badge_button_factory.mm
@@ -36,6 +36,8 @@ return [self incognitoBadgeButton]; case BadgeType::kBadgeTypeOverflow: return [self overflowBadgeButton]; + case BadgeType::kBadgeTypeSaveAddressProfile: + return [self saveAddressProfileBadgeButton]; case BadgeType::kBadgeTypeNone: NOTREACHED() << "A badge should not have kBadgeTypeNone"; return nil; @@ -134,6 +136,20 @@ return button; } +- (BadgeButton*)saveAddressProfileBadgeButton { + BadgeButton* button = + [self createButtonForType:BadgeType::kBadgeTypeSaveAddressProfile + imageNamed:@"ic_place" + renderingMode:UIImageRenderingModeAlwaysTemplate]; + [button addTarget:self.delegate + action:@selector(saveAddressProfileBadgeButtonTapped:) + forControlEvents:UIControlEventTouchUpInside]; + button.accessibilityIdentifier = + kBadgeButtonSaveAddressProfileAccessibilityIdentifier; + // TODO(crbug.com/1014652): Create a11y label hint. + return button; +} + - (BadgeButton*)createButtonForType:(BadgeType)badgeType imageNamed:(NSString*)imageName renderingMode:(UIImageRenderingMode)renderingMode {
diff --git a/ios/chrome/browser/ui/badges/badge_constants.h b/ios/chrome/browser/ui/badges/badge_constants.h index 7736bd5..f73c7b7d 100644 --- a/ios/chrome/browser/ui/badges/badge_constants.h +++ b/ios/chrome/browser/ui/badges/badge_constants.h
@@ -15,6 +15,9 @@ kBadgeButtonUpdatePasswordAccpetedAccessibilityIdentifier; extern NSString* const kBadgeButtonIncognitoAccessibilityIdentifier; extern NSString* const kBadgeButtonOverflowAccessibilityIdentifier; +extern NSString* const kBadgeButtonSaveAddressProfileAccessibilityIdentifier; +extern NSString* const + kBadgeButtonSaveAddressProfileAcceptedAccessibilityIdentifier; extern NSString* const kBadgeButtonSaveCardAccessibilityIdentifier; extern NSString* const kBadgeButtonSaveCardAcceptedAccessibilityIdentifier; extern NSString* const kBadgeButtonTranslateAccessibilityIdentifier;
diff --git a/ios/chrome/browser/ui/badges/badge_constants.mm b/ios/chrome/browser/ui/badges/badge_constants.mm index 65720ff..c422c27 100644 --- a/ios/chrome/browser/ui/badges/badge_constants.mm +++ b/ios/chrome/browser/ui/badges/badge_constants.mm
@@ -26,6 +26,12 @@ NSString* const kBadgeButtonOverflowAccessibilityIdentifier = @"badgeButtonOverflowAXID"; +NSString* const kBadgeButtonSaveAddressProfileAccessibilityIdentifier = + @"badgeButtonSaveAddressProfileAXID"; + +NSString* const kBadgeButtonSaveAddressProfileAcceptedAccessibilityIdentifier = + @"badgeButtonSaveAddressProfileAcceptedAXID"; + NSString* const kBadgeButtonSaveCardAccessibilityIdentifier = @"badgeButtonSaveCardAXID";
diff --git a/ios/chrome/browser/ui/badges/badge_delegate.h b/ios/chrome/browser/ui/badges/badge_delegate.h index 516fd95..18c6f41 100644 --- a/ios/chrome/browser/ui/badges/badge_delegate.h +++ b/ios/chrome/browser/ui/badges/badge_delegate.h
@@ -10,6 +10,9 @@ // Action when a Passwords badge is tapped. - (void)passwordsBadgeButtonTapped:(id)sender; +// Action when a Save Address Profile badge is tapped. +- (void)saveAddressProfileBadgeButtonTapped:(id)sender; + // Action when a Save Card badge is tapped. - (void)saveCardBadgeButtonTapped:(id)sender;
diff --git a/ios/chrome/browser/ui/badges/badge_mediator.mm b/ios/chrome/browser/ui/badges/badge_mediator.mm index 3881902..b02cbfed 100644 --- a/ios/chrome/browser/ui/badges/badge_mediator.mm +++ b/ios/chrome/browser/ui/badges/badge_mediator.mm
@@ -205,6 +205,13 @@ [self handleTappedBadgeButton:badgeButton]; } +- (void)saveAddressProfileBadgeButtonTapped:(id)sender { + BadgeButton* badgeButton = base::mac::ObjCCastStrict<BadgeButton>(sender); + DCHECK_EQ(badgeButton.badgeType, BadgeType::kBadgeTypeSaveAddressProfile); + + [self handleTappedBadgeButton:badgeButton]; +} + - (void)saveCardBadgeButtonTapped:(id)sender { BadgeButton* badgeButton = base::mac::ObjCCastStrict<BadgeButton>(sender); DCHECK_EQ(badgeButton.badgeType, BadgeType::kBadgeTypeSaveCard);
diff --git a/ios/chrome/browser/ui/badges/badge_popup_menu_coordinator.mm b/ios/chrome/browser/ui/badges/badge_popup_menu_coordinator.mm index 86a8f26..6ccd9e9 100644 --- a/ios/chrome/browser/ui/badges/badge_popup_menu_coordinator.mm +++ b/ios/chrome/browser/ui/badges/badge_popup_menu_coordinator.mm
@@ -115,6 +115,13 @@ kInfobarTypePasswordUpdate]; break; } + case PopupMenuActionShowSaveAddressProfileOptions: { + // TODO(crbug.com/1167062): Record this event. + + [self addModalRequestForInfobarType: + InfobarType::kInfobarTypeSaveAutofillAddressProfile]; + break; + } case PopupMenuActionShowSaveCardOptions: { UMA_HISTOGRAM_ENUMERATION(kInfobarOverflowMenuTappedHistogram, MobileMessagesInfobarType::SaveCard);
diff --git a/ios/chrome/browser/ui/badges/badge_popup_menu_item.mm b/ios/chrome/browser/ui/badges/badge_popup_menu_item.mm index 12f2e80..4748130 100644 --- a/ios/chrome/browser/ui/badges/badge_popup_menu_item.mm +++ b/ios/chrome/browser/ui/badges/badge_popup_menu_item.mm
@@ -61,6 +61,10 @@ _title = l10n_util::GetNSString( IDS_IOS_PASSWORD_MANAGER_UPDATE_PASSWORD_TITLE); break; + case BadgeType::kBadgeTypeSaveAddressProfile: + _actionIdentifier = PopupMenuActionShowSaveAddressProfileOptions; + _title = @"Save Address"; + break; case BadgeType::kBadgeTypeSaveCard: _actionIdentifier = PopupMenuActionShowSaveCardOptions; _title = l10n_util::GetNSString(IDS_IOS_AUTOFILL_SAVE_CARD); @@ -96,6 +100,10 @@ badgeImage = [[UIImage imageNamed:@"password_key"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; break; + case BadgeType::kBadgeTypeSaveAddressProfile: + badgeImage = [[UIImage imageNamed:@"ic_place"] + imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate]; + break; case BadgeType::kBadgeTypeSaveCard: badgeImage = [[UIImage imageNamed:@"infobar_save_card_icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
diff --git a/ios/chrome/browser/ui/badges/badge_type.h b/ios/chrome/browser/ui/badges/badge_type.h index c780932b..efe619b 100644 --- a/ios/chrome/browser/ui/badges/badge_type.h +++ b/ios/chrome/browser/ui/badges/badge_type.h
@@ -23,6 +23,8 @@ kBadgeTypeSaveCard = 5, // Badge type for the Translate Infobar. kBadgeTypeTranslate = 6, + // Badge type for the Save Address Profile Infobar. + kBadgeTypeSaveAddressProfile = 7, }; #endif // IOS_CHROME_BROWSER_UI_BADGES_BADGE_TYPE_H_
diff --git a/ios/chrome/browser/ui/badges/badge_type_util.cc b/ios/chrome/browser/ui/badges/badge_type_util.cc index a308053..aaac68d 100644 --- a/ios/chrome/browser/ui/badges/badge_type_util.cc +++ b/ios/chrome/browser/ui/badges/badge_type_util.cc
@@ -14,6 +14,8 @@ return BadgeType::kBadgeTypePasswordSave; case InfobarType::kInfobarTypePasswordUpdate: return BadgeType::kBadgeTypePasswordUpdate; + case InfobarType::kInfobarTypeSaveAutofillAddressProfile: + return BadgeType::kBadgeTypeSaveAddressProfile; case InfobarType::kInfobarTypeSaveCard: return BadgeType::kBadgeTypeSaveCard; case InfobarType::kInfobarTypeTranslate: @@ -29,6 +31,8 @@ return InfobarType::kInfobarTypePasswordSave; case BadgeType::kBadgeTypePasswordUpdate: return InfobarType::kInfobarTypePasswordUpdate; + case BadgeType::kBadgeTypeSaveAddressProfile: + return InfobarType::kInfobarTypeSaveAutofillAddressProfile; case BadgeType::kBadgeTypeSaveCard: return InfobarType::kInfobarTypeSaveCard; case BadgeType::kBadgeTypeTranslate:
diff --git a/ios/chrome/browser/ui/commands/application_commands.h b/ios/chrome/browser/ui/commands/application_commands.h index 97c51bb1..e390ecbb 100644 --- a/ios/chrome/browser/ui/commands/application_commands.h +++ b/ios/chrome/browser/ui/commands/application_commands.h
@@ -156,9 +156,6 @@ - (void)showSignin:(ShowSigninCommand*)command baseViewController:(UIViewController*)baseViewController; -// Signs the user out and dismisses UI for any in-progress sign-in. -- (void)forceSignOut; - // TODO(crbug.com/779791) : Do not pass baseViewController through dispatcher. // Shows the consistency promo UI that allows users to sign in to Chrome using // the default accounts on the device.
diff --git a/ios/chrome/browser/ui/main/scene_controller.mm b/ios/chrome/browser/ui/main/scene_controller.mm index 0c197fe6..16bb42016 100644 --- a/ios/chrome/browser/ui/main/scene_controller.mm +++ b/ios/chrome/browser/ui/main/scene_controller.mm
@@ -23,6 +23,7 @@ #include "components/prefs/pref_service.h" #import "components/previous_session_info/previous_session_info.h" #include "components/signin/public/base/signin_metrics.h" +#include "components/signin/public/base/signin_pref_names.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "components/url_formatter/url_formatter.h" #include "components/version_info/version_info.h" @@ -59,6 +60,8 @@ #include "ios/chrome/browser/ntp/features.h" #import "ios/chrome/browser/policy/policy_util.h" #import "ios/chrome/browser/policy/policy_watcher_browser_agent.h" +#include "ios/chrome/browser/policy/policy_watcher_browser_agent.h" +#import "ios/chrome/browser/policy/policy_watcher_browser_agent_observer_bridge.h" #include "ios/chrome/browser/screenshot/screenshot_delegate.h" #import "ios/chrome/browser/signin/authentication_service.h" #import "ios/chrome/browser/signin/authentication_service_factory.h" @@ -183,12 +186,15 @@ @interface SceneController () <AppStateObserver, FirstRunCoordinatorDelegate, LocationPermissionsCommands, + PolicyWatcherBrowserAgentObserving, SettingsNavigationControllerDelegate, SceneURLLoadingServiceDelegate, TabGridCoordinatorDelegate, UserFeedbackDataSource, WebStateListObserving> { std::unique_ptr<WebStateListObserverBridge> _webStateListForwardingObserver; + std::unique_ptr<PolicyWatcherBrowserAgentObserverBridge> + _policyWatcherObserverBridge; } // Navigation View controller for the settings. @@ -298,6 +304,9 @@ _webStateListForwardingObserver = std::make_unique<WebStateListObserverBridge>(self); + _policyWatcherObserverBridge = + std::make_unique<PolicyWatcherBrowserAgentObserverBridge>(self); + // Add agents. [_sceneState addAgent:[[UIBlockerSceneAgent alloc] init]]; [_sceneState addAgent:[[IncognitoBlockerSceneAgent alloc] init]]; @@ -796,14 +805,12 @@ // Create and start the BVC. [self.browserViewWrangler createMainCoordinatorAndInterface]; - // Now that the main browser's command dispatcher is created and the newly - // started UI coordinators have registered with it, inject it into the - // PolicyWatcherBrowserAgent so it can start monitoring UI-impacting policy - // changes. - id<ApplicationCommands> handler = - HandlerForProtocol(mainCommandDispatcher, ApplicationCommands); - PolicyWatcherBrowserAgent::FromBrowser(self.mainInterface.browser) - ->SetApplicationCommandsHandler(handler); + // Start observing PolicyWatcherBrowserAgent so it can start monitoring + // UI-impacting policy changes. + PolicyWatcherBrowserAgent* policyWatcherAgent = + PolicyWatcherBrowserAgent::FromBrowser(self.mainInterface.browser); + policyWatcherAgent->AddObserver(_policyWatcherObserverBridge.get()); + policyWatcherAgent->Initialize(); if (@available(iOS 14, *)) { if (base::ios::IsSceneStartupSupported() && @@ -1049,6 +1056,9 @@ self.incognitoInterface.browser->GetWebStateList()->RemoveObserver( _webStateListForwardingObserver.get()); + PolicyWatcherBrowserAgent::FromBrowser(self.mainInterface.browser) + ->RemoveObserver(_policyWatcherObserverBridge.get()); + [self.browserViewWrangler shutdown]; self.browserViewWrangler = nil; @@ -1508,47 +1518,6 @@ [self startSigninCoordinatorWithCompletion:command.callback]; } -- (void)forceSignOut { - AuthenticationService* service = - AuthenticationServiceFactory::GetForBrowserState( - self.mainInterface.browser->GetBrowserState()); - auto signOut = ^{ - if (!service->IsAuthenticated()) { - return; - } - UMA_HISTOGRAM_BOOLEAN("Enterprise.BrowserSigninIOS.SignedOutByPolicy", - true); - // Sign the user out, but keep synced data (bookmarks, passwords, etc) - // locally to be consistent with the policy's behavior on other platforms. - service->SignOut( - signin_metrics::ProfileSignout::SIGNOUT_PREF_CHANGED, - /*force_clear_browsing_data=*/false, ^{ - BOOL sceneIsActive = self.sceneState.activationLevel >= - SceneActivationLevelForegroundActive; - if (sceneIsActive) { - id<PolicySignoutPromptCommands> handler = HandlerForProtocol( - self.mainInterface.browser->GetCommandDispatcher(), - PolicySignoutPromptCommands); - [handler showPolicySignoutPrompt]; - } else { - self.sceneState.appState.shouldShowPolicySignoutPrompt = YES; - } - }); - }; - - if (self.signinCoordinator) { - [self interruptSigninCoordinatorAnimated:YES completion:signOut]; - UMA_HISTOGRAM_BOOLEAN( - "Enterprise.BrowserSigninIOS.SignInInterruptedByPolicy", true); - } else if (self.sceneState.presentingFirstRunUI && - self.welcomeToChromeController) { - [self.welcomeToChromeController - interruptSigninCoordinatorWithCompletion:signOut]; - } else { - signOut(); - } -} - - (void)showAdvancedSigninSettingsFromViewController: (UIViewController*)baseViewController { DCHECK(!self.signinCoordinator); @@ -3145,4 +3114,55 @@ } } +#pragma mark - PolicyWatcherBrowserAgentObserving + +- (void)policyWatcherBrowserAgentNotifySignInDisabled: + (PolicyWatcherBrowserAgent*)policyWatcher { + auto signOut = ^{ + [self signOutIfNeeded]; + }; + + if (self.signinCoordinator) { + [self interruptSigninCoordinatorAnimated:YES completion:signOut]; + UMA_HISTOGRAM_BOOLEAN( + "Enterprise.BrowserSigninIOS.SignInInterruptedByPolicy", true); + } else if (self.sceneState.presentingFirstRunUI && + self.welcomeToChromeController) { + [self.welcomeToChromeController + interruptSigninCoordinatorWithCompletion:signOut]; + } else { + signOut(); + } +} + +// TODO(crbug.com/1205793): Move this method to the BrowserAgent. +- (void)signOutIfNeeded { + AuthenticationService* service = + AuthenticationServiceFactory::GetForBrowserState( + self.mainInterface.browser->GetBrowserState()); + if (self.mainInterface.browser->GetBrowserState()->GetPrefs()->GetBoolean( + prefs::kSigninAllowed) || + !service->IsAuthenticated()) { + return; + } + + UMA_HISTOGRAM_BOOLEAN("Enterprise.BrowserSigninIOS.SignedOutByPolicy", true); + // Sign the user out, but keep synced data (bookmarks, passwords, etc) + // locally to be consistent with the policy's behavior on other platforms. + service->SignOut( + signin_metrics::ProfileSignout::SIGNOUT_PREF_CHANGED, + /*force_clear_browsing_data=*/false, ^{ + BOOL sceneIsActive = self.sceneState.activationLevel >= + SceneActivationLevelForegroundActive; + if (sceneIsActive) { + id<PolicySignoutPromptCommands> handler = HandlerForProtocol( + self.mainInterface.browser->GetCommandDispatcher(), + PolicySignoutPromptCommands); + [handler showPolicySignoutPrompt]; + } else { + self.sceneState.appState.shouldShowPolicySignoutPrompt = YES; + } + }); +} + @end
diff --git a/ios/chrome/browser/ui/popup_menu/public/cells/popup_menu_item.h b/ios/chrome/browser/ui/popup_menu/public/cells/popup_menu_item.h index 5e422ac..85191f3c 100644 --- a/ios/chrome/browser/ui/popup_menu/public/cells/popup_menu_item.h +++ b/ios/chrome/browser/ui/popup_menu/public/cells/popup_menu_item.h
@@ -53,6 +53,7 @@ // Badge overflow popup menu PopupMenuActionShowSavePasswordOptions, PopupMenuActionShowUpdatePasswordOptions, + PopupMenuActionShowSaveAddressProfileOptions, PopupMenuActionShowSaveCardOptions, PopupMenuActionShowTranslateOptions, // Textual popup menu
diff --git a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm index 631e5fe11..c9bfcc2 100644 --- a/ios/chrome/browser/ui/settings/settings_navigation_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_navigation_controller.mm
@@ -331,8 +331,10 @@ self.toolbar.translucent = NO; self.navigationBar.barTintColor = [UIColor colorNamed:kSecondaryBackgroundColor]; - self.toolbar.barTintColor = [UIColor colorNamed:kSecondaryBackgroundColor]; - self.view.backgroundColor = [UIColor colorNamed:kSecondaryBackgroundColor]; + self.toolbar.barTintColor = + [UIColor colorNamed:kGroupedPrimaryBackgroundColor]; + self.view.backgroundColor = + [UIColor colorNamed:kGroupedPrimaryBackgroundColor]; } self.navigationBar.prefersLargeTitles = YES;
diff --git a/ios/chrome/browser/ui/table_view/chrome_table_view_styler.mm b/ios/chrome/browser/ui/table_view/chrome_table_view_styler.mm index 6ee04a2..2cf99e05 100644 --- a/ios/chrome/browser/ui/table_view/chrome_table_view_styler.mm +++ b/ios/chrome/browser/ui/table_view/chrome_table_view_styler.mm
@@ -18,7 +18,7 @@ if ((self = [super init])) { if (base::FeatureList::IsEnabled(kSettingsRefresh)) { _tableViewBackgroundColor = - [UIColor colorNamed:kSecondaryBackgroundColor]; + [UIColor colorNamed:kGroupedPrimaryBackgroundColor]; _cellBackgroundColor = [UIColor colorNamed:kGroupedSecondaryBackgroundColor]; } else {
diff --git a/ios/chrome/browser/ui/table_view/table_view_navigation_controller.mm b/ios/chrome/browser/ui/table_view/table_view_navigation_controller.mm index 08c4369..908d51c9 100644 --- a/ios/chrome/browser/ui/table_view/table_view_navigation_controller.mm +++ b/ios/chrome/browser/ui/table_view/table_view_navigation_controller.mm
@@ -38,9 +38,11 @@ if (base::FeatureList::IsEnabled(kSettingsRefresh)) { self.navigationBar.barTintColor = - [UIColor colorNamed:kSecondaryBackgroundColor]; - self.toolbar.barTintColor = [UIColor colorNamed:kSecondaryBackgroundColor]; - self.view.backgroundColor = [UIColor colorNamed:kSecondaryBackgroundColor]; + [UIColor colorNamed:kGroupedPrimaryBackgroundColor]; + self.toolbar.barTintColor = + [UIColor colorNamed:kGroupedPrimaryBackgroundColor]; + self.view.backgroundColor = + [UIColor colorNamed:kGroupedPrimaryBackgroundColor]; } else { self.navigationBar.barTintColor = [UIColor colorNamed:kPrimaryBackgroundColor];
diff --git a/ios/showcase/badges/sc_badge_coordinator.mm b/ios/showcase/badges/sc_badge_coordinator.mm index 51617a1..a286740b 100644 --- a/ios/showcase/badges/sc_badge_coordinator.mm +++ b/ios/showcase/badges/sc_badge_coordinator.mm
@@ -142,6 +142,9 @@ - (void)saveCardBadgeButtonTapped:(id)sender { } +- (void)saveAddressProfileBadgeButtonTapped:(id)sender { +} + - (void)translateBadgeButtonTapped:(id)sender { }
diff --git a/ipc/ipc_cpu_perftest.cc b/ipc/ipc_cpu_perftest.cc index 48ce8a4..9e15961 100644 --- a/ipc/ipc_cpu_perftest.cc +++ b/ipc/ipc_cpu_perftest.cc
@@ -5,6 +5,7 @@ #include <memory> #include "base/bind.h" +#include "base/check_op.h" #include "base/process/process_metrics.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h"
diff --git a/net/base/backoff_entry_serializer.cc b/net/base/backoff_entry_serializer.cc index a6e5af85..3375397 100644 --- a/net/base/backoff_entry_serializer.cc +++ b/net/base/backoff_entry_serializer.cc
@@ -36,13 +36,12 @@ namespace net { -std::unique_ptr<base::Value> BackoffEntrySerializer::SerializeToValue( - const BackoffEntry& entry, - base::Time time_now) { - std::unique_ptr<base::ListValue> serialized(new base::ListValue()); - serialized->AppendInteger(kSerializationFormatVersion); +base::Value BackoffEntrySerializer::SerializeToValue(const BackoffEntry& entry, + base::Time time_now) { + std::vector<base::Value> serialized; + serialized.emplace_back(kSerializationFormatVersion); - serialized->AppendInteger(entry.failure_count()); + serialized.emplace_back(entry.failure_count()); // Convert both |base::TimeTicks| values into |base::TimeDelta| values by // subtracting |kZeroTicks. This way, the top-level subtraction uses @@ -67,11 +66,11 @@ // Redundantly stores both the remaining time delta and the absolute time. // The delta is used to work around some cases where wall clock time changes. - serialized->Append(backoff_duration.InSecondsF()); - serialized->AppendString( + serialized.emplace_back(backoff_duration.InSecondsF()); + serialized.emplace_back( base::NumberToString(absolute_release_time.ToInternalValue())); - return std::move(serialized); + return base::Value(std::move(serialized)); } std::unique_ptr<BackoffEntry> BackoffEntrySerializer::DeserializeFromValue( @@ -79,29 +78,35 @@ const BackoffEntry::Policy* policy, const base::TickClock* tick_clock, base::Time time_now) { - const base::ListValue* serialized_list = nullptr; - if (!serialized.GetAsList(&serialized_list)) + if (!serialized.is_list()) return nullptr; - if (serialized_list->GetSize() != 4) - return nullptr; - int version_number; - if (!serialized_list->GetInteger(0, &version_number) || - version_number != kSerializationFormatVersion) { - return nullptr; - } + const base::Value::ConstListView& list_view = serialized.GetList(); - int failure_count; - if (!serialized_list->GetInteger(1, &failure_count) || failure_count < 0) { + if (list_view.size() != 4) + return nullptr; + + if (!list_view[0].is_int()) + return nullptr; + int version_number = list_view[0].GetInt(); + if (version_number != kSerializationFormatVersion) + return nullptr; + + if (!list_view[1].is_int()) + return nullptr; + int failure_count = list_view[1].GetInt(); + if (failure_count < 0) { return nullptr; } failure_count = std::min(failure_count, kMaxFailureCount); - double original_backoff_duration_double; - if (!serialized_list->GetDouble(2, &original_backoff_duration_double)) + if (!list_view[2].is_double()) return nullptr; - std::string absolute_release_time_string; - if (!serialized_list->GetString(3, &absolute_release_time_string)) + double original_backoff_duration_double = list_view[2].GetDouble(); + + if (!list_view[3].is_string()) return nullptr; + std::string absolute_release_time_string = list_view[3].GetString(); + int64_t absolute_release_time_us; if (!base::StringToInt64(absolute_release_time_string, &absolute_release_time_us)) {
diff --git a/net/base/backoff_entry_serializer.h b/net/base/backoff_entry_serializer.h index d5fde2c768..2b79f79 100644 --- a/net/base/backoff_entry_serializer.h +++ b/net/base/backoff_entry_serializer.h
@@ -31,9 +31,8 @@ // be converted to an absolute timestamp, thus the time will continue counting // down even whilst the device is powered off, and will be partially // vulnerable to changes in the system clock time. - static std::unique_ptr<base::Value> SerializeToValue( - const BackoffEntry& entry, - base::Time time_now); + static base::Value SerializeToValue(const BackoffEntry& entry, + base::Time time_now); // Deserializes a ListValue back to a BackoffEntry. |policy| MUST be the same // Policy as the serialized entry had. |clock| may be NULL. Both |policy| and
diff --git a/net/base/backoff_entry_serializer_fuzzer.cc b/net/base/backoff_entry_serializer_fuzzer.cc index f4877bf..0ec77af2 100644 --- a/net/base/backoff_entry_serializer_fuzzer.cc +++ b/net/base/backoff_entry_serializer_fuzzer.cc
@@ -108,9 +108,8 @@ if (!entry) return; - std::unique_ptr<base::Value> reserialized = + base::Value reserialized = BackoffEntrySerializer::SerializeToValue(*entry, translator.parse_time()); - CHECK(reserialized); // Due to fuzzy interpretation in BackoffEntrySerializer:: // DeserializeFromValue, we cannot assert that |*reserialized == *value|. @@ -118,7 +117,7 @@ // properties are preserved. std::unique_ptr<BackoffEntry> entry_reparsed = BackoffEntrySerializer::DeserializeFromValue( - *reserialized, &policy, &clock, translator.parse_time()); + reserialized, &policy, &clock, translator.parse_time()); CHECK(entry_reparsed); CHECK_EQ(entry_reparsed->failure_count(), entry->failure_count()); CHECK_LE(entry_reparsed->GetReleaseTime(), entry->GetReleaseTime()); @@ -133,17 +132,16 @@ // Serialize the BackoffEntry. BackoffEntry native_entry(&policy); - std::unique_ptr<base::Value> serialized = - BackoffEntrySerializer::SerializeToValue(native_entry, - translator.serialize_time()); - CHECK(serialized); + base::Value serialized = BackoffEntrySerializer::SerializeToValue( + native_entry, translator.serialize_time()); + CHECK(serialized.is_list()); MockClock clock; clock.SetNow(translator.now_ticks()); // Deserialize it. std::unique_ptr<BackoffEntry> deserialized_entry = - BackoffEntrySerializer::DeserializeFromValue(*serialized, &policy, &clock, + BackoffEntrySerializer::DeserializeFromValue(serialized, &policy, &clock, translator.parse_time()); // Even though SerializeToValue was successful, we're not guaranteed to have a // |deserialized_entry|. One reason deserialization may fail is if the parsed
diff --git a/net/base/backoff_entry_serializer_unittest.cc b/net/base/backoff_entry_serializer_unittest.cc index 10d0b97..f662059 100644 --- a/net/base/backoff_entry_serializer_unittest.cc +++ b/net/base/backoff_entry_serializer_unittest.cc
@@ -136,12 +136,12 @@ BackoffEntry original(&base_policy, &original_ticks); // Set the custom release time. original.SetCustomReleaseTime(test_case.release_time); - std::unique_ptr<base::Value> serialized = + base::Value serialized = BackoffEntrySerializer::SerializeToValue(original, original_time); // Check that the serialized backoff duration matches our expectation. double serialized_backoff_duration_double; - EXPECT_TRUE(serialized->GetList()[2].GetAsDouble( + EXPECT_TRUE(serialized.GetList()[2].GetAsDouble( &serialized_backoff_duration_double)); base::TimeDelta serialized_backoff_duration = base::TimeDelta::FromSecondsD(serialized_backoff_duration_double); @@ -166,12 +166,12 @@ original_ticks.set_now(TimeTicks()); BackoffEntry original(&base_policy, &original_ticks); original.SetCustomReleaseTime(release_time); - std::unique_ptr<base::Value> serialized = + base::Value serialized = BackoffEntrySerializer::SerializeToValue(original, original_time); // Reach into the serialization and check the string-formatted release time. const std::string& serialized_release_time = - serialized->GetList()[3].GetString(); + serialized.GetList()[3].GetString(); EXPECT_EQ(serialized_release_time, "0"); // Test that |DeserializeFromValue| notices this zero-valued release time and @@ -179,7 +179,7 @@ const Time parse_time = Time::FromJsTime(1430907555111); // May 2015 for realism std::unique_ptr<BackoffEntry> deserialized = - BackoffEntrySerializer::DeserializeFromValue(*serialized, &base_policy, + BackoffEntrySerializer::DeserializeFromValue(serialized, &base_policy, &original_ticks, parse_time); ASSERT_TRUE(deserialized.get()); EXPECT_EQ(original.GetReleaseTime(), deserialized->GetReleaseTime()); @@ -190,12 +190,12 @@ TestTickClock original_ticks; original_ticks.set_now(TimeTicks::Now()); BackoffEntry original(&base_policy, &original_ticks); - std::unique_ptr<base::Value> serialized = + base::Value serialized = BackoffEntrySerializer::SerializeToValue(original, original_time); std::unique_ptr<BackoffEntry> deserialized = BackoffEntrySerializer::DeserializeFromValue( - *serialized, &base_policy, &original_ticks, original_time); + serialized, &base_policy, &original_ticks, original_time); ASSERT_TRUE(deserialized.get()); EXPECT_EQ(original.failure_count(), deserialized->failure_count()); EXPECT_EQ(original.GetReleaseTime(), deserialized->GetReleaseTime()); @@ -208,14 +208,14 @@ // 2 errors. original.InformOfRequest(false); original.InformOfRequest(false); - std::unique_ptr<base::Value> serialized = + base::Value serialized = BackoffEntrySerializer::SerializeToValue(original, original_time); { // Test that immediate deserialization round-trips. std::unique_ptr<BackoffEntry> deserialized = BackoffEntrySerializer::DeserializeFromValue( - *serialized, &base_policy, &original_ticks, original_time); + serialized, &base_policy, &original_ticks, original_time); ASSERT_TRUE(deserialized.get()); EXPECT_EQ(original.failure_count(), deserialized->failure_count()); EXPECT_EQ(original.GetReleaseTime(), deserialized->GetReleaseTime()); @@ -227,7 +227,7 @@ Time later_time = original_time + TimeDelta::FromDays(1); std::unique_ptr<BackoffEntry> deserialized = BackoffEntrySerializer::DeserializeFromValue( - *serialized, &base_policy, &original_ticks, later_time); + serialized, &base_policy, &original_ticks, later_time); ASSERT_TRUE(deserialized.get()); EXPECT_EQ(original.failure_count(), deserialized->failure_count()); // Remaining backoff duration continues decreasing while device is off. @@ -246,7 +246,7 @@ later_ticks.set_now(TimeTicks() + TimeDelta::FromDays(1)); std::unique_ptr<BackoffEntry> deserialized = BackoffEntrySerializer::DeserializeFromValue( - *serialized, &base_policy, &later_ticks, original_time); + serialized, &base_policy, &later_ticks, original_time); ASSERT_TRUE(deserialized.get()); EXPECT_EQ(original.failure_count(), deserialized->failure_count()); // According to the wall clock, no time has passed. So remaining backoff @@ -269,7 +269,7 @@ later_ticks.set_now(TimeTicks() + TimeDelta::FromDays(1)); Time later_time = original_time + TimeDelta::FromDays(1); std::unique_ptr<BackoffEntry> deserialized = - BackoffEntrySerializer::DeserializeFromValue(*serialized, &base_policy, + BackoffEntrySerializer::DeserializeFromValue(serialized, &base_policy, &later_ticks, later_time); ASSERT_TRUE(deserialized.get()); EXPECT_EQ(original.failure_count(), deserialized->failure_count()); @@ -288,7 +288,7 @@ Time earlier_time = original_time - TimeDelta::FromSeconds(1); std::unique_ptr<BackoffEntry> deserialized = BackoffEntrySerializer::DeserializeFromValue( - *serialized, &base_policy, &original_ticks, earlier_time); + serialized, &base_policy, &original_ticks, earlier_time); ASSERT_TRUE(deserialized.get()); EXPECT_EQ(original.failure_count(), deserialized->failure_count()); // If only the absolute wall clock time was serialized, subtracting the
diff --git a/net/base/escape.cc b/net/base/escape.cc index 552a86b0..9d28bf6 100644 --- a/net/base/escape.cc +++ b/net/base/escape.cc
@@ -84,9 +84,8 @@ } // Convert |input| string to a form that will not be interpreted as HTML. -template <class CharT> -std::basic_string<CharT> EscapeForHTMLImpl( - base::BasicStringPiece<CharT> input) { +template <typename T, typename CharT = typename T::value_type> +std::basic_string<CharT> EscapeForHTMLImpl(T input) { std::basic_string<CharT> result; result.reserve(input.size()); // Optimize for no escaping.
diff --git a/net/base/registry_controlled_domains/registry_controlled_domain.cc b/net/base/registry_controlled_domains/registry_controlled_domain.cc index ee783ac8..8f84c30c 100644 --- a/net/base/registry_controlled_domains/registry_controlled_domain.cc +++ b/net/base/registry_controlled_domains/registry_controlled_domain.cc
@@ -227,8 +227,8 @@ // Backend for PermissiveGetHostRegistryLength that handles both UTF-8 and // UTF-16 input. -template <typename CharT> -size_t DoPermissiveGetHostRegistryLength(base::BasicStringPiece<CharT> host, +template <typename T, typename CharT = typename T::value_type> +size_t DoPermissiveGetHostRegistryLength(T host, UnknownRegistryFilter unknown_filter, PrivateRegistryFilter private_filter) { std::string canonical_host; // Do not modify outside of canon_output.
diff --git a/net/disk_cache/blockfile/backend_impl.cc b/net/disk_cache/blockfile/backend_impl.cc index ff387412..05e0733 100644 --- a/net/disk_cache/blockfile/backend_impl.cc +++ b/net/disk_cache/blockfile/backend_impl.cc
@@ -1607,14 +1607,9 @@ IncreaseNumRefs(); *entry = nullptr; - TimeTicks start = TimeTicks::Now(); if (!cache_entry->entry()->Load()) return ERR_READ_FAILURE; - if (IsLoaded()) { - CACHE_UMA(AGE_MS, "LoadTime", 0, start); - } - if (!cache_entry->SanityCheck()) { LOG(WARNING) << "Messed up entry found."; STRESS_NOTREACHED();
diff --git a/net/quic/quic_chromium_client_session.cc b/net/quic/quic_chromium_client_session.cc index 9575411..a5d398bb 100644 --- a/net/quic/quic_chromium_client_session.cc +++ b/net/quic/quic_chromium_client_session.cc
@@ -3365,37 +3365,38 @@ base::DictionaryValue dict; dict.SetString("version", ParsedQuicVersionToString(connection()->version())); dict.SetInteger("open_streams", GetNumActiveStreams()); - std::unique_ptr<base::ListValue> stream_list(new base::ListValue()); - auto* stream_list_ptr = stream_list.get(); + + std::vector<base::Value> stream_list; + auto* stream_list_ptr = &stream_list; PerformActionOnActiveStreams([stream_list_ptr](quic::QuicStream* stream) { - stream_list_ptr->AppendString(base::NumberToString(stream->id())); + stream_list_ptr->emplace_back(base::NumberToString(stream->id())); return true; }); - dict.Set("active_streams", std::move(stream_list)); + dict.SetKey("active_streams", base::Value(std::move(stream_list))); - dict.SetInteger("total_streams", num_total_streams_); - dict.SetString("peer_address", peer_address().ToString()); - dict.SetString("network_isolation_key", - session_key_.network_isolation_key().ToDebugString()); - dict.SetString("connection_id", connection_id().ToString()); + dict.SetIntKey("total_streams", num_total_streams_); + dict.SetStringKey("peer_address", peer_address().ToString()); + dict.SetStringKey("network_isolation_key", + session_key_.network_isolation_key().ToDebugString()); + dict.SetStringKey("connection_id", connection_id().ToString()); if (!connection()->client_connection_id().IsEmpty()) { - dict.SetString("client_connection_id", - connection()->client_connection_id().ToString()); + dict.SetStringKey("client_connection_id", + connection()->client_connection_id().ToString()); } - dict.SetBoolean("connected", connection()->connected()); + dict.SetBoolKey("connected", connection()->connected()); const quic::QuicConnectionStats& stats = connection()->GetStats(); - dict.SetInteger("packets_sent", stats.packets_sent); - dict.SetInteger("packets_received", stats.packets_received); - dict.SetInteger("packets_lost", stats.packets_lost); + dict.SetIntKey("packets_sent", stats.packets_sent); + dict.SetIntKey("packets_received", stats.packets_received); + dict.SetIntKey("packets_lost", stats.packets_lost); SSLInfo ssl_info; - std::unique_ptr<base::ListValue> alias_list(new base::ListValue()); + std::vector<base::Value> alias_list; for (const auto& alias : aliases) { - alias_list->AppendString(alias.ToString()); + alias_list.emplace_back(alias.ToString()); } - dict.Set("aliases", std::move(alias_list)); + dict.SetKey("aliases", base::Value(std::move(alias_list))); return std::move(dict); }
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index f39707a..a54dbb1c 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc
@@ -299,15 +299,15 @@ base::Value NetLogSpdySendSettingsParams(const spdy::SettingsMap* settings) { base::Value dict(base::Value::Type::DICTIONARY); - base::ListValue settings_list; + std::vector<base::Value> settings_list; for (auto it = settings->begin(); it != settings->end(); ++it) { const spdy::SpdySettingsId id = it->first; const uint32_t value = it->second; - settings_list.AppendString( + settings_list.emplace_back( base::StringPrintf("[id:%u (%s) value:%u]", id, spdy::SettingsIdToString(id).c_str(), value)); } - dict.SetKey("settings", std::move(settings_list)); + dict.SetKey("settings", base::Value(std::move(settings_list))); return dict; }
diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc index 0f23babc..cfcf0dc 100644 --- a/net/test/spawned_test_server/base_test_server.cc +++ b/net/test/spawned_test_server/base_test_server.cc
@@ -66,40 +66,40 @@ } } -void GetKeyExchangesList(int key_exchange, base::ListValue* values) { +void GetKeyExchangesList(int key_exchange, std::vector<base::Value>* values) { if (key_exchange & BaseTestServer::SSLOptions::KEY_EXCHANGE_RSA) - values->AppendString("rsa"); + values->emplace_back("rsa"); if (key_exchange & BaseTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA) - values->AppendString("dhe_rsa"); + values->emplace_back("dhe_rsa"); if (key_exchange & BaseTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA) - values->AppendString("ecdhe_rsa"); + values->emplace_back("ecdhe_rsa"); } -void GetCiphersList(int cipher, base::ListValue* values) { +void GetCiphersList(int cipher, std::vector<base::Value>* values) { if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_RC4) - values->AppendString("rc4"); + values->emplace_back("rc4"); if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES128) - values->AppendString("aes128"); + values->emplace_back("aes128"); if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES256) - values->AppendString("aes256"); + values->emplace_back("aes256"); if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_3DES) - values->AppendString("3des"); + values->emplace_back("3des"); if (cipher & BaseTestServer::SSLOptions::BULK_CIPHER_AES128GCM) - values->AppendString("aes128gcm"); + values->emplace_back("aes128gcm"); } -std::unique_ptr<base::Value> GetTLSIntoleranceType( +base::Value GetTLSIntoleranceType( BaseTestServer::SSLOptions::TLSIntoleranceType type) { switch (type) { case BaseTestServer::SSLOptions::TLS_INTOLERANCE_ALERT: - return std::make_unique<base::Value>("alert"); + return base::Value("alert"); case BaseTestServer::SSLOptions::TLS_INTOLERANCE_CLOSE: - return std::make_unique<base::Value>("close"); + return base::Value("close"); case BaseTestServer::SSLOptions::TLS_INTOLERANCE_RESET: - return std::make_unique<base::Value>("reset"); + return base::Value("reset"); default: NOTREACHED(); - return std::make_unique<base::Value>(""); + return base::Value(""); } } @@ -417,27 +417,26 @@ bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { DCHECK(arguments); - arguments->SetString("host", host_port_pair_.host()); - arguments->SetInteger("port", host_port_pair_.port()); + arguments->SetStringKey("host", host_port_pair_.host()); + arguments->SetIntKey("port", host_port_pair_.port()); arguments->SetStringKey("data-dir", document_root_.AsUTF8Unsafe()); if (VLOG_IS_ON(1) || log_to_console_) - arguments->Set("log-to-console", std::make_unique<base::Value>()); + arguments->SetKey("log-to-console", base::Value()); if (ws_basic_auth_) { DCHECK(type_ == TYPE_WS || type_ == TYPE_WSS); - arguments->Set("ws-basic-auth", std::make_unique<base::Value>()); + arguments->SetKey("ws-basic-auth", base::Value()); } if (no_anonymous_ftp_user_) { DCHECK_EQ(TYPE_FTP, type_); - arguments->Set("no-anonymous-ftp-user", std::make_unique<base::Value>()); + arguments->SetKey("no-anonymous-ftp-user", base::Value()); } if (redirect_connect_to_localhost_) { DCHECK(type_ == TYPE_BASIC_AUTH_PROXY || type_ == TYPE_PROXY); - arguments->Set("redirect-connect-to-localhost", - std::make_unique<base::Value>()); + arguments->SetKey("redirect-connect-to-localhost", base::Value()); } if (UsingSSL(type_)) { @@ -458,8 +457,9 @@ // Check the client certificate related arguments. if (ssl_options_.request_client_certificate) - arguments->Set("ssl-client-auth", std::make_unique<base::Value>()); - std::unique_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); + arguments->SetKey("ssl-client-auth", base::Value()); + + std::vector<base::Value> ssl_client_certs; std::vector<base::FilePath>::const_iterator it; for (it = ssl_options_.client_authorities.begin(); @@ -469,82 +469,90 @@ << " doesn't exist. Can't launch https server."; return false; } - ssl_client_certs->Append(it->AsUTF8Unsafe()); + ssl_client_certs.emplace_back(it->AsUTF8Unsafe()); } - if (ssl_client_certs->GetSize()) - arguments->Set("ssl-client-ca", std::move(ssl_client_certs)); + if (ssl_client_certs.size()) { + arguments->SetKey("ssl-client-ca", + base::Value(std::move(ssl_client_certs))); + } - std::unique_ptr<base::ListValue> client_cert_types(new base::ListValue()); + std::vector<base::Value> client_cert_types; for (size_t i = 0; i < ssl_options_.client_cert_types.size(); i++) { - client_cert_types->AppendString( + client_cert_types.emplace_back( GetClientCertType(ssl_options_.client_cert_types[i])); } - if (client_cert_types->GetSize()) - arguments->Set("ssl-client-cert-type", std::move(client_cert_types)); + if (client_cert_types.size()) { + arguments->SetKey("ssl-client-cert-type", + base::Value(std::move(client_cert_types))); + } } if (type_ == TYPE_HTTPS) { - arguments->Set("https", std::make_unique<base::Value>()); + arguments->SetKey("https", base::Value()); // Check key exchange argument. - std::unique_ptr<base::ListValue> key_exchange_values(new base::ListValue()); - GetKeyExchangesList(ssl_options_.key_exchanges, key_exchange_values.get()); - if (key_exchange_values->GetSize()) - arguments->Set("ssl-key-exchange", std::move(key_exchange_values)); + std::vector<base::Value> key_exchange_values; + GetKeyExchangesList(ssl_options_.key_exchanges, &key_exchange_values); + if (key_exchange_values.size()) { + arguments->SetKey("ssl-key-exchange", + base::Value(std::move(key_exchange_values))); + } // Check bulk cipher argument. - std::unique_ptr<base::ListValue> bulk_cipher_values(new base::ListValue()); - GetCiphersList(ssl_options_.bulk_ciphers, bulk_cipher_values.get()); - if (bulk_cipher_values->GetSize()) - arguments->Set("ssl-bulk-cipher", std::move(bulk_cipher_values)); + std::vector<base::Value> bulk_cipher_values; + GetCiphersList(ssl_options_.bulk_ciphers, &bulk_cipher_values); + if (bulk_cipher_values.size()) { + arguments->SetKey("ssl-bulk-cipher", + base::Value(std::move(bulk_cipher_values))); + } if (ssl_options_.record_resume) - arguments->Set("https-record-resume", std::make_unique<base::Value>()); + arguments->SetKey("https-record-resume", base::Value()); if (ssl_options_.tls_intolerant != SSLOptions::TLS_INTOLERANT_NONE) { - arguments->SetInteger("tls-intolerant", ssl_options_.tls_intolerant); - arguments->Set("tls-intolerance-type", GetTLSIntoleranceType( - ssl_options_.tls_intolerance_type)); + arguments->SetIntKey("tls-intolerant", ssl_options_.tls_intolerant); + arguments->SetKey( + "tls-intolerance-type", + GetTLSIntoleranceType(ssl_options_.tls_intolerance_type)); } if (ssl_options_.tls_max_version != SSLOptions::TLS_MAX_VERSION_DEFAULT) { - arguments->SetInteger("tls-max-version", ssl_options_.tls_max_version); + arguments->SetIntKey("tls-max-version", ssl_options_.tls_max_version); } if (ssl_options_.fallback_scsv_enabled) - arguments->Set("fallback-scsv", std::make_unique<base::Value>()); + arguments->SetKey("fallback-scsv", base::Value()); if (!ssl_options_.signed_cert_timestamps_tls_ext.empty()) { std::string b64_scts_tls_ext; base::Base64Encode(ssl_options_.signed_cert_timestamps_tls_ext, &b64_scts_tls_ext); - arguments->SetString("signed-cert-timestamps-tls-ext", b64_scts_tls_ext); + arguments->SetStringKey("signed-cert-timestamps-tls-ext", + b64_scts_tls_ext); } if (!ssl_options_.alpn_protocols.empty()) { - std::unique_ptr<base::ListValue> alpn_protocols(new base::ListValue()); + std::vector<base::Value> alpn_protocols; for (const std::string& proto : ssl_options_.alpn_protocols) { - alpn_protocols->AppendString(proto); + alpn_protocols.emplace_back(proto); } - arguments->Set("alpn-protocols", std::move(alpn_protocols)); + arguments->SetKey("alpn-protocols", + base::Value(std::move(alpn_protocols))); } if (!ssl_options_.npn_protocols.empty()) { - std::unique_ptr<base::ListValue> npn_protocols(new base::ListValue()); + std::vector<base::Value> npn_protocols; for (const std::string& proto : ssl_options_.npn_protocols) { - npn_protocols->AppendString(proto); + npn_protocols.emplace_back(proto); } - arguments->Set("npn-protocols", std::move(npn_protocols)); + arguments->SetKey("npn-protocols", base::Value(std::move(npn_protocols))); } if (ssl_options_.alert_after_handshake) - arguments->Set("alert-after-handshake", std::make_unique<base::Value>()); + arguments->SetKey("alert-after-handshake", base::Value()); if (ssl_options_.disable_channel_id) - arguments->Set("disable-channel-id", std::make_unique<base::Value>()); + arguments->SetKey("disable-channel-id", base::Value()); if (ssl_options_.disable_extended_master_secret) { - arguments->Set("disable-extended-master-secret", - std::make_unique<base::Value>()); + arguments->SetKey("disable-extended-master-secret", base::Value()); } if (ssl_options_.simulate_tls13_downgrade) { - arguments->Set("simulate-tls13-downgrade", - std::make_unique<base::Value>()); + arguments->SetKey("simulate-tls13-downgrade", base::Value()); } if (ssl_options_.simulate_tls12_downgrade) { - arguments->Set("simulate-tls12-downgrade", - std::make_unique<base::Value>()); + arguments->SetKey("simulate-tls12-downgrade", base::Value()); } }
diff --git a/net/third_party/quiche/BUILD.gn b/net/third_party/quiche/BUILD.gn index d67e6cb..76acb80 100644 --- a/net/third_party/quiche/BUILD.gn +++ b/net/third_party/quiche/BUILD.gn
@@ -39,7 +39,9 @@ "src/common/platform/api/quiche_flag_utils.h", "src/common/platform/api/quiche_flags.h", "src/common/platform/api/quiche_logging.h", + "src/common/platform/api/quiche_prefetch.h", "src/common/platform/api/quiche_time_utils.h", + "src/common/platform/default/quiche_platform_impl/quiche_prefetch_impl.h", "src/common/quiche_circular_deque.h", "src/common/quiche_data_reader.cc", "src/common/quiche_data_reader.h", @@ -570,7 +572,6 @@ "src/quic/platform/api/quic_mem_slice_storage.h", "src/quic/platform/api/quic_mutex.cc", "src/quic/platform/api/quic_mutex.h", - "src/quic/platform/api/quic_prefetch.h", "src/quic/platform/api/quic_reference_counted.h", "src/quic/platform/api/quic_server_stats.h", "src/quic/platform/api/quic_sleep.h",
diff --git a/services/network/public/cpp/client_hints.cc b/services/network/public/cpp/client_hints.cc index c87ee808..fb9d1441f 100644 --- a/services/network/public/cpp/client_hints.cc +++ b/services/network/public/cpp/client_hints.cc
@@ -32,7 +32,8 @@ "sec-ch-ua-model", "sec-ch-ua-mobile", "sec-ch-ua-full-version", - "sec-ch-ua-platform-version"}; + "sec-ch-ua-platform-version", + "sec-ch-prefers-color-scheme"}; const size_t kClientHintsMappingsCount = base::size(kClientHintsNameMapping);
diff --git a/services/network/public/cpp/cors/cors.cc b/services/network/public/cpp/cors/cors.cc index 54d3974..2e96043 100644 --- a/services/network/public/cpp/cors/cors.cc +++ b/services/network/public/cpp/cors/cors.cc
@@ -457,6 +457,15 @@ "sec-ch-ua-mobile", "sec-ch-ua-full-version", "sec-ch-ua-platform-version", + + // The `Sec-CH-Prefers-Color-Scheme` header field is modeled after the + // prefers-color-scheme user preference media feature. It reflects the + // user’s desire that the page use a light or dark color theme. This is + // currently pull from operating system preferences, although there may be + // internal UI in the future. + // + // https://tomayac.github.io/user-preference-media-features-headers/#sec-ch-prefers-color-scheme + "sec-ch-prefers-color-scheme", }; if (std::find(std::begin(safe_names), std::end(safe_names), lower_name) == std::end(safe_names))
diff --git a/services/network/public/cpp/cors/cors_unittest.cc b/services/network/public/cpp/cors/cors_unittest.cc index 098dedd..be31a56 100644 --- a/services/network/public/cpp/cors/cors_unittest.cc +++ b/services/network/public/cpp/cors/cors_unittest.cc
@@ -452,6 +452,11 @@ IsCorsSafelistedHeader("aCcEPT-lAngUAge", std::string(129, 'a'))); } +TEST_F(CorsTest, SafelistedSecCHPrefersColorScheme) { + EXPECT_TRUE(IsCorsSafelistedHeader("Sec-CH-Prefers-Color-Scheme", + "\"Prefers-Color-Scheme!\"")); +} + TEST_F(CorsTest, SafelistedSecCHLang) { EXPECT_TRUE(IsCorsSafelistedHeader("Sec-CH-Lang", "\"en\", \"de\""));
diff --git a/services/network/public/mojom/web_client_hints_types.mojom b/services/network/public/mojom/web_client_hints_types.mojom index aadac68..54916d9 100644 --- a/services/network/public/mojom/web_client_hints_types.mojom +++ b/services/network/public/mojom/web_client_hints_types.mojom
@@ -31,6 +31,7 @@ kUAMobile = 12, kUAFullVersion = 13, kUAPlatformVersion = 14, + kPrefersColorScheme = 15, // Warning: Before adding a new client hint, read the warning at the top. };
diff --git a/testing/buildbot/chromium.devtools-frontend.json b/testing/buildbot/chromium.devtools-frontend.json index 480ed2f..edfe099 100644 --- a/testing/buildbot/chromium.devtools-frontend.json +++ b/testing/buildbot/chromium.devtools-frontend.json
@@ -7,14 +7,11 @@ ], "gtest_tests": [ { - "args": [ - "--disable-blink-features=LayoutNG" - ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "webkit_unit_tests_ng", + "name": "blink_unit_tests", "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [
diff --git a/testing/buildbot/client.devtools-frontend.integration.json b/testing/buildbot/client.devtools-frontend.integration.json index c120bcf2..b8340a2 100644 --- a/testing/buildbot/client.devtools-frontend.integration.json +++ b/testing/buildbot/client.devtools-frontend.integration.json
@@ -7,14 +7,11 @@ ], "gtest_tests": [ { - "args": [ - "--disable-blink-features=LayoutNG" - ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "webkit_unit_tests_ng", + "name": "blink_unit_tests", "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [
diff --git a/testing/buildbot/client.v8.fyi.json b/testing/buildbot/client.v8.fyi.json index 1112a48..449d14b 100644 --- a/testing/buildbot/client.v8.fyi.json +++ b/testing/buildbot/client.v8.fyi.json
@@ -1543,14 +1543,11 @@ ], "gtest_tests": [ { - "args": [ - "--disable-blink-features=LayoutNG" - ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "webkit_unit_tests_ng", + "name": "blink_unit_tests", "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ @@ -1601,14 +1598,11 @@ ], "gtest_tests": [ { - "args": [ - "--disable-blink-features=LayoutNG" - ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "webkit_unit_tests_ng", + "name": "blink_unit_tests", "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ @@ -1662,14 +1656,11 @@ ], "gtest_tests": [ { - "args": [ - "--disable-blink-features=LayoutNG" - ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "webkit_unit_tests_ng", + "name": "blink_unit_tests", "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ @@ -1718,14 +1709,11 @@ "V8 Blink Linux Layout NG": { "gtest_tests": [ { - "args": [ - "--disable-blink-features=LayoutNG" - ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "webkit_unit_tests_ng", + "name": "blink_unit_tests", "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [ @@ -1778,14 +1766,11 @@ ], "gtest_tests": [ { - "args": [ - "--disable-blink-features=LayoutNG" - ], "merge": { "args": [], "script": "//testing/merge_scripts/standard_gtest_merge.py" }, - "name": "webkit_unit_tests_ng", + "name": "blink_unit_tests", "swarming": { "can_use_on_swarming_builders": true, "dimension_sets": [
diff --git a/testing/buildbot/test_suites.pyl b/testing/buildbot/test_suites.pyl index b0364e7..7cfb22f 100644 --- a/testing/buildbot/test_suites.pyl +++ b/testing/buildbot/test_suites.pyl
@@ -383,6 +383,12 @@ }, }, + 'blink_unittests': { + 'blink_unit_tests': { + 'test': 'blink_unittests', + }, + }, + 'cast_audio_specific_chromium_gtests': { 'cast_audio_backend_unittests': {}, 'cast_base_unittests': {}, @@ -5949,7 +5955,7 @@ 'devtools_gtests': [ 'devtools_browser_tests', - 'layout_ng_gtests', + 'blink_unittests', ], 'fuchsia_arm64_isolated_scripts': [
diff --git a/testing/buildbot/waterfalls.pyl b/testing/buildbot/waterfalls.pyl index f47aa8e..a476a7e 100644 --- a/testing/buildbot/waterfalls.pyl +++ b/testing/buildbot/waterfalls.pyl
@@ -2367,7 +2367,7 @@ ], 'additional_compile_targets': ['blink_tests'], 'test_suites': { - 'gtest_tests': 'layout_ng_gtests', + 'gtest_tests': 'blink_unittests', 'isolated_scripts': 'devtools_webkit_isolated_scripts', }, }, @@ -6136,7 +6136,7 @@ ], 'additional_compile_targets': ['blink_tests'], 'test_suites': { - 'gtest_tests': 'layout_ng_gtests', + 'gtest_tests': 'blink_unittests', 'isolated_scripts': 'chromium_webkit_isolated_scripts', }, }, @@ -6146,7 +6146,7 @@ ], 'additional_compile_targets': ['blink_tests'], 'test_suites': { - 'gtest_tests': 'layout_ng_gtests', + 'gtest_tests': 'blink_unittests', 'isolated_scripts': 'chromium_webkit_isolated_scripts', }, }, @@ -6156,7 +6156,7 @@ ], 'additional_compile_targets': ['blink_tests'], 'test_suites': { - 'gtest_tests': 'layout_ng_gtests', + 'gtest_tests': 'blink_unittests', 'isolated_scripts': 'chromium_webkit_isolated_scripts', }, }, @@ -6170,7 +6170,7 @@ 'hard_timeout': 900, }, 'test_suites': { - 'gtest_tests': 'layout_ng_gtests', + 'gtest_tests': 'blink_unittests', 'isolated_scripts': 'chromium_webkit_isolated_scripts', }, }, @@ -6185,7 +6185,7 @@ }, 'additional_compile_targets': ['blink_tests'], 'test_suites': { - 'gtest_tests': 'layout_ng_gtests', + 'gtest_tests': 'blink_unittests', 'isolated_scripts': 'chromium_webkit_isolated_scripts', }, },
diff --git a/testing/variations/fieldtrial_testing_config.json b/testing/variations/fieldtrial_testing_config.json index 4a6e9e2..45073ba0 100644 --- a/testing/variations/fieldtrial_testing_config.json +++ b/testing/variations/fieldtrial_testing_config.json
@@ -1181,14 +1181,21 @@ "name": "EnabledForSpecificDomain", "params": { "TimeToLiveInBackForwardCacheInSeconds": "180", - "allowed_websites": "https://domain1.org,https://domain2.org", + "blocked_websites": "https://domain1.org,https://domain2.org", + "cache_size": "6", "check_eligibility_after_pagehide": "true", "enable_same_site": "true", + "file_system_api_supported": "true", + "foreground_cache_size": "2", "geolocation_supported": "true", + "max_buffered_bytes": "100000", + "max_buffered_bytes_per_process": "512000", "service_worker_supported": "true" }, "enable_features": [ - "BackForwardCache" + "BackForwardCache", + "FreezeWhileKeepActive", + "LoadingTasksUnfreezable" ] } ]
diff --git a/third_party/androidx/README.chromium b/third_party/androidx/README.chromium index c447902d..0da326d1 100644 --- a/third_party/androidx/README.chromium +++ b/third_party/androidx/README.chromium
@@ -9,7 +9,20 @@ Description: A gradle-specified repository for Androidx dependencies. -Snapshots originate from https://androidx.dev -They are made into CIPD packages by this bot: https://ci.chromium.org/p/chromium/builders/ci/android-androidx-packager -They are then rolled in by this autoroller: https://autoroll.skia.org/r/androidx-chromium -Googlers can trigger manual runs: https://luci-scheduler.appspot.com/jobs/chromium/android-androidx-packager +Where the snapshots come from: +* Snapshots originate from https://androidx.dev +* They are made into CIPD packages by this bot: https://ci.chromium.org/p/chromium/builders/ci/android-androidx-packager +* They are then rolled in by this autoroller: https://autoroll.skia.org/r/androidx-chromium +* Googlers can trigger manual runs: https://luci-scheduler.appspot.com/jobs/chromium/android-androidx-packager + +Mapping snapshot version to git revision: +* The current version of the snapshot is written to VERSION.txt (sibling of this + README, but does not appear in codesearch). +* Open the "BUILD_INFO" JSON file from https://androidx.dev/snapshots/builds for + the given version, and search for the "platform/frameworks/support" entry. + * That entry will have a "revision" field, which is the git revision the + snapshot was created from. + +Viewing Source Code: +Git viewer: https://android.googlesource.com/platform/frameworks/support/ +Code Search: https://cs.android.com/androidx/platform/frameworks/support
diff --git a/third_party/blink/common/client_hints/client_hints.cc b/third_party/blink/common/client_hints/client_hints.cc index 1f83f4cb3..7d195ffc 100644 --- a/third_party/blink/common/client_hints/client_hints.cc +++ b/third_party/blink/common/client_hints/client_hints.cc
@@ -35,6 +35,7 @@ "sec-ch-ua-mobile", "sec-ch-ua-full-version", "sec-ch-ua-platform-version", + "sec-ch-prefers-color-scheme", }; const unsigned kClientHintsNumberOfLegacyHints = 4; @@ -58,6 +59,7 @@ mojom::PermissionsPolicyFeature::kClientHintUAMobile, mojom::PermissionsPolicyFeature::kClientHintUAFullVersion, mojom::PermissionsPolicyFeature::kClientHintUAPlatformVersion, + mojom::PermissionsPolicyFeature::kClientHintPrefersColorScheme, }; const size_t kClientHintsMappingsCount = base::size(kClientHintsHeaderMapping); @@ -95,7 +97,8 @@ absl::optional<std::vector<network::mojom::WebClientHintsType>> FilterAcceptCH( absl::optional<std::vector<network::mojom::WebClientHintsType>> in, bool permit_lang_hints, - bool permit_ua_hints) { + bool permit_ua_hints, + bool permit_prefers_color_scheme_hints) { if (!in.has_value()) return absl::nullopt; @@ -117,6 +120,10 @@ if (permit_ua_hints) result.push_back(hint); break; + case network::mojom::WebClientHintsType::kPrefersColorScheme: + if (permit_prefers_color_scheme_hints) + result.push_back(hint); + break; default: result.push_back(hint); }
diff --git a/third_party/blink/common/client_hints/client_hints_unittest.cc b/third_party/blink/common/client_hints/client_hints_unittest.cc index 8f21d67..f32cf38 100644 --- a/third_party/blink/common/client_hints/client_hints_unittest.cc +++ b/third_party/blink/common/client_hints/client_hints_unittest.cc
@@ -33,7 +33,10 @@ } TEST(ClientHintsTest, FilterAcceptCH) { - EXPECT_FALSE(FilterAcceptCH(absl::nullopt, true, true).has_value()); + EXPECT_FALSE(FilterAcceptCH(absl::nullopt, /*permit_lang_hints=*/true, + /*permit_ua_hints=*/true, + /*permit_prefers_color_scheme_hints=*/true) + .has_value()); absl::optional<std::vector<network::mojom::WebClientHintsType>> result; @@ -42,8 +45,9 @@ {network::mojom::WebClientHintsType::kDeviceMemory, network::mojom::WebClientHintsType::kRtt, network::mojom::WebClientHintsType::kUA}), - /* permit_lang_hints = */ false, - /* permit_ua_hints = */ true); + /*permit_lang_hints=*/false, + /*permit_ua_hints=*/true, + /*permit_prefers_color_scheme_hints=*/false); ASSERT_TRUE(result.has_value()); EXPECT_THAT( result.value(), @@ -51,6 +55,21 @@ network::mojom::WebClientHintsType::kRtt, network::mojom::WebClientHintsType::kUA)); + result = FilterAcceptCH( + std::vector<network::mojom::WebClientHintsType>( + {network::mojom::WebClientHintsType::kDeviceMemory, + network::mojom::WebClientHintsType::kRtt, + network::mojom::WebClientHintsType::kPrefersColorScheme}), + /*permit_lang_hints=*/false, + /*permit_ua_hints=*/false, + /*permit_prefers_color_scheme_hints=*/true); + ASSERT_TRUE(result.has_value()); + EXPECT_THAT(result.value(), + UnorderedElementsAre( + network::mojom::WebClientHintsType::kDeviceMemory, + network::mojom::WebClientHintsType::kRtt, + network::mojom::WebClientHintsType::kPrefersColorScheme)); + std::vector<network::mojom::WebClientHintsType> in{ network::mojom::WebClientHintsType::kRtt, network::mojom::WebClientHintsType::kLang, @@ -60,19 +79,22 @@ network::mojom::WebClientHintsType::kUAPlatformVersion, network::mojom::WebClientHintsType::kUAModel, network::mojom::WebClientHintsType::kUAMobile, - network::mojom::WebClientHintsType::kUAFullVersion}; + network::mojom::WebClientHintsType::kUAFullVersion, + network::mojom::WebClientHintsType::kPrefersColorScheme}; result = FilterAcceptCH(in, - /* permit_lang_hints = */ true, - /* permit_ua_hints = */ false); + /*permit_lang_hints=*/true, + /*permit_ua_hints=*/false, + /*permit_prefers_color_scheme_hints=*/false); ASSERT_TRUE(result.has_value()); EXPECT_THAT(result.value(), UnorderedElementsAre(network::mojom::WebClientHintsType::kRtt, network::mojom::WebClientHintsType::kLang)); result = FilterAcceptCH(in, - /* permit_lang_hints = */ true, - /* permit_ua_hints = */ true); + /*permit_lang_hints=*/true, + /*permit_ua_hints=*/true, + /*permit_prefers_color_scheme_hints=*/true); ASSERT_TRUE(result.has_value()); EXPECT_THAT(result.value(), UnorderedElementsAre( @@ -84,11 +106,13 @@ network::mojom::WebClientHintsType::kUAPlatformVersion, network::mojom::WebClientHintsType::kUAModel, network::mojom::WebClientHintsType::kUAMobile, - network::mojom::WebClientHintsType::kUAFullVersion)); + network::mojom::WebClientHintsType::kUAFullVersion, + network::mojom::WebClientHintsType::kPrefersColorScheme)); result = FilterAcceptCH(in, - /* permit_lang_hints = */ false, - /* permit_ua_hints = */ false); + /*permit_lang_hints=*/false, + /*permit_ua_hints=*/false, + /*permit_prefers_color_scheme_hints=*/false); ASSERT_TRUE(result.has_value()); EXPECT_THAT(result.value(), UnorderedElementsAre(network::mojom::WebClientHintsType::kRtt)); @@ -106,7 +130,8 @@ UnorderedElementsAre("rtt", "downlink", "ect", "sec-ch-lang", "sec-ch-ua-arch", "sec-ch-ua-platform", "sec-ch-ua-model", "sec-ch-ua-full-version", - "sec-ch-ua-platform-version")); + "sec-ch-ua-platform-version", + "sec-ch-prefers-color-scheme")); } // Checks that the removed header list includes legacy headers but not the @@ -117,11 +142,12 @@ features::kAllowClientHintsToThirdParty); std::vector<std::string> removed_headers; FindClientHintsToRemove(nullptr, GURL(), &removed_headers); - EXPECT_THAT(removed_headers, - UnorderedElementsAre( - "device-memory", "dpr", "width", "viewport-width", "rtt", - "downlink", "ect", "sec-ch-lang", "sec-ch-ua-arch", - "sec-ch-ua-platform", "sec-ch-ua-model", - "sec-ch-ua-full-version", "sec-ch-ua-platform-version")); + EXPECT_THAT( + removed_headers, + UnorderedElementsAre( + "device-memory", "dpr", "width", "viewport-width", "rtt", "downlink", + "ect", "sec-ch-lang", "sec-ch-ua-arch", "sec-ch-ua-platform", + "sec-ch-ua-model", "sec-ch-ua-full-version", + "sec-ch-ua-platform-version", "sec-ch-prefers-color-scheme")); } } // namespace blink
diff --git a/third_party/blink/public/common/client_hints/client_hints.h b/third_party/blink/public/common/client_hints/client_hints.h index 587b579..6843776d 100644 --- a/third_party/blink/public/common/client_hints/client_hints.h +++ b/third_party/blink/public/common/client_hints/client_hints.h
@@ -54,11 +54,13 @@ // is currently conditional on experiments: // Language hints will only be kept if |permit_lang_hints| is true; // UA-related ones if |permit_ua_hints| is. +// Prefers-color-scheme ones if |permit_prefers_color_scheme_hints| is. BLINK_COMMON_EXPORT absl::optional<std::vector<network::mojom::WebClientHintsType>> FilterAcceptCH( absl::optional<std::vector<network::mojom::WebClientHintsType>> in, bool permit_lang_hints, - bool permit_ua_hints); + bool permit_ua_hints, + bool permit_prefers_color_scheme_hints); // Indicates that a hint is sent by default, regardless of an opt-in. BLINK_COMMON_EXPORT
diff --git a/third_party/blink/public/devtools_protocol/browser_protocol.pdl b/third_party/blink/public/devtools_protocol/browser_protocol.pdl index 7175eabe..c049c77 100644 --- a/third_party/blink/public/devtools_protocol/browser_protocol.pdl +++ b/third_party/blink/public/devtools_protocol/browser_protocol.pdl
@@ -6441,7 +6441,7 @@ PerformanceProfile # All Permissions Policy features. This enum should match the one defined - # in renderer/core/feature_policy/feature_policy_features.json5. + # in third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5. experimental type PermissionsPolicyFeature extends string enum accelerometer @@ -6454,6 +6454,7 @@ ch-downlink ch-ect ch-lang + ch-prefers-color-scheme ch-rtt ch-ua ch-ua-arch
diff --git a/third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom b/third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom index ea697187..5695984 100644 --- a/third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom +++ b/third_party/blink/public/mojom/permissions_policy/permissions_policy_feature.mojom
@@ -138,6 +138,9 @@ // Controls access to Direct Sockets. kDirectSockets = 84, + // Client Hint for the preferred color scheme. + kClientHintPrefersColorScheme = 85, + // Don't change assigned numbers of any item, and don't reuse removed slots. // Add new features at the end of the enum. // Also, run update_permissions_policy_enum.py in
diff --git a/third_party/blink/public/mojom/web_feature/web_feature.mojom b/third_party/blink/public/mojom/web_feature/web_feature.mojom index 9fbaa772..9be467c 100644 --- a/third_party/blink/public/mojom/web_feature/web_feature.mojom +++ b/third_party/blink/public/mojom/web_feature/web_feature.mojom
@@ -3227,6 +3227,7 @@ kSVGText = 3912, kGetBBoxForText = 3913, kSVGTextHangingFromPath = 3914, + kClientHintsPrefersColorScheme = 3915, // Add new features immediately above this line. Don't change assigned // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/blink/renderer/build/scripts/templates/instrumenting_probes_impl.cc.tmpl b/third_party/blink/renderer/build/scripts/templates/instrumenting_probes_impl.cc.tmpl index e703c4e..f879377 100644 --- a/third_party/blink/renderer/build/scripts/templates/instrumenting_probes_impl.cc.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/instrumenting_probes_impl.cc.tmpl
@@ -7,11 +7,11 @@ {% set sink_class = (name | to_singular) + "Sink" %} {% set sink_class_header = (header | to_singular) + "_sink" %} -{% for file in files %} +{% for file in files|sort %} #include "{{output_path_in_gen_dir}}{{file.name}}_inl.h" {% endfor %} #include "{{output_path_in_gen_dir}}{{sink_class_header}}.h" -{% for agent in agents %} +{% for agent in agents|sort %} #include "{{agent | agent_name_to_include}}" {% endfor %} #include "third_party/blink/renderer/platform/wtf/threading_primitives.h" @@ -34,13 +34,13 @@ {{sink_class}}::~{{sink_class}}() { MutexLocker lock(AgentCountMutex()); -{% for agent in agents %} +{% for agent in agents|sort %} if (Has{{agent}}s() && --s_numSinksWith{{agent}} == 0) s_existingAgents &= ~k{{agent}}; {% endfor %} } -{% for agent in agents %} +{% for agent in agents|sort %} {% set class_name = agent | agent_name_to_class %} {% set getter_name = agent | to_snake_case %} @@ -80,7 +80,7 @@ void {{sink_class}}::Trace(Visitor* visitor) const { -{% for agent in agents %} +{% for agent in agents|sort %} {% set getter_name = agent | to_snake_case %} visitor->Trace({{getter_name}}s_); {% endfor %} @@ -98,7 +98,7 @@ {% set agent_probe_name = method_name(common_name or probe.name) %} if (!probe_sink) return; -{% for agent in probe.agents %} +{% for agent in probe.agents|sort %} {% set class_name = agent | agent_name_to_class %} if (probe_sink->Has{{agent}}s()) { for ({{class_name}}* agent : probe_sink->{{class_name}}s()) @@ -107,7 +107,7 @@ {% endfor %} {% endmacro -%} -{% for file in files %} +{% for file in files|sort %} {% for probe in file.declarations %} {% if probe.is_scoped %} {{probe.name}}::{{probe.name}}({{ params_list(probe) }}) :
diff --git a/third_party/blink/renderer/build/scripts/templates/instrumenting_probes_inl.h.tmpl b/third_party/blink/renderer/build/scripts/templates/instrumenting_probes_inl.h.tmpl index c10b8a23..e85b68c 100644 --- a/third_party/blink/renderer/build/scripts/templates/instrumenting_probes_inl.h.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/instrumenting_probes_inl.h.tmpl
@@ -60,7 +60,7 @@ {{export_symbol}} void {{probe.name}}Impl({{ params_decl(probe) }}); inline void {{probe.name}}({{params_list(probe)}}) { if (!{{sink_class}}::HasAgentsGlobal( - {%- for agent in probe.agents %} + {%- for agent in probe.agents|sort %} {% if not loop.first %} | {% endif -%} {{sink_class}}::k{{agent}} {%- endfor %}))
diff --git a/third_party/blink/renderer/build/scripts/templates/probe_sink.h.tmpl b/third_party/blink/renderer/build/scripts/templates/probe_sink.h.tmpl index 0cc0ba0..28c3591 100644 --- a/third_party/blink/renderer/build/scripts/templates/probe_sink.h.tmpl +++ b/third_party/blink/renderer/build/scripts/templates/probe_sink.h.tmpl
@@ -19,7 +19,7 @@ namespace blink { -{% for agent in agents %} +{% for agent in agents|sort %} class {{ agent | agent_name_to_class }}; {% endfor %} @@ -27,7 +27,7 @@ public: enum AgentType : unsigned { -{% for agent in agents %} +{% for agent in agents|sort %} k{{agent}} = 1u << {{loop.index0}}, {% endfor %} }; @@ -39,7 +39,7 @@ void Trace(Visitor*) const; -{% for agent in agents %} +{% for agent in agents|sort %} {% set class_name = agent | agent_name_to_class %} {% set getter_name = agent | to_snake_case %} bool Has{{agent}}s() const { return !{{getter_name}}s_.IsEmpty(); } @@ -54,7 +54,7 @@ } private: -{% for agent in agents %} +{% for agent in agents|sort %} {% set class_name = agent | agent_name_to_class %} {% set getter_name = agent | to_snake_case %} HeapListHashSet<Member<{{class_name}}>> {{getter_name}}s_; @@ -63,7 +63,7 @@ // Number of sinks with an enabled agent of each type, used to keep // |s_existingAgents| up to date. // Access must be guarded by AgentCountMutex in the source file. -{% for agent in agents %} +{% for agent in agents|sort %} static unsigned s_numSinksWith{{agent}}; {% endfor %}
diff --git a/third_party/blink/renderer/core/editing/substring_util.mm b/third_party/blink/renderer/core/editing/substring_util.mm index 33b1a74c..ba676fc 100644 --- a/third_party/blink/renderer/core/editing/substring_util.mm +++ b/third_party/blink/renderer/core/editing/substring_util.mm
@@ -106,18 +106,16 @@ .ComputedSize() * font_scale]; } - [attrs setObject:font forKey:NSFontAttributeName]; + attrs[NSFontAttributeName] = font; if (style->VisitedDependentColor(GetCSSPropertyColor()).Alpha()) - [attrs - setObject:NsColor(style->VisitedDependentColor(GetCSSPropertyColor())) - forKey:NSForegroundColorAttributeName]; + attrs[NSForegroundColorAttributeName] = + NsColor(style->VisitedDependentColor(GetCSSPropertyColor())); else [attrs removeObjectForKey:NSForegroundColorAttributeName]; if (style->VisitedDependentColor(GetCSSPropertyBackgroundColor()).Alpha()) - [attrs setObject:NsColor(style->VisitedDependentColor( - GetCSSPropertyBackgroundColor())) - forKey:NSBackgroundColorAttributeName]; + attrs[NSBackgroundColorAttributeName] = NsColor( + style->VisitedDependentColor(GetCSSPropertyBackgroundColor())); else [attrs removeObjectForKey:NSBackgroundColorAttributeName]; @@ -145,7 +143,7 @@ if ([string length]) { NSDictionary* attributes = [string attributesAtIndex:0 effectiveRange:nullptr]; - if (NSFont* font = [attributes objectForKey:NSFontAttributeName]) + if (NSFont* font = attributes[NSFontAttributeName]) string_point.Move(0, ceil([font descender])); } return string_point;
diff --git a/third_party/blink/renderer/core/html/html_html_element.cc b/third_party/blink/renderer/core/html/html_html_element.cc index 542fe67..da95b0e 100644 --- a/third_party/blink/renderer/core/html/html_html_element.cc +++ b/third_party/blink/renderer/core/html/html_html_element.cc
@@ -118,7 +118,7 @@ layout_style.Direction() != propagated_style.Direction(); } -scoped_refptr<ComputedStyle> CreateLayoutStyle( +scoped_refptr<const ComputedStyle> CreateLayoutStyle( const ComputedStyle& style, const ComputedStyle& propagated_style) { scoped_refptr<ComputedStyle> layout_style = ComputedStyle::Clone(style); @@ -160,7 +160,19 @@ propagated_style = style; if (NeedsLayoutStylePropagation(layout_object->StyleRef(), *propagated_style)) { - layout_object->SetStyle(CreateLayoutStyle(*style, *propagated_style)); + scoped_refptr<const ComputedStyle> new_style = + CreateLayoutStyle(*style, *propagated_style); + layout_object->SetStyle(new_style); + // We need to propagate the style to text children because the used + // writing-mode and direction affects text children. Child elements, + // however, inherit the computed value, which is unaffected by the + // propagated used value from body. + for (Node* node = firstChild(); node; node = node->nextSibling()) { + if (!node->IsTextNode() || node->NeedsReattachLayoutTree()) + continue; + if (LayoutObject* layout_text = node->GetLayoutObject()) + layout_text->SetStyle(new_style); + } } }
diff --git a/third_party/blink/renderer/core/html/html_wbr_element.cc b/third_party/blink/renderer/core/html/html_wbr_element.cc index e09ec10..b92e0ad 100644 --- a/third_party/blink/renderer/core/html/html_wbr_element.cc +++ b/third_party/blink/renderer/core/html/html_wbr_element.cc
@@ -31,7 +31,7 @@ #include "third_party/blink/renderer/core/html/html_wbr_element.h" #include "third_party/blink/renderer/core/html_names.h" -#include "third_party/blink/renderer/core/layout/layout_word_break.h" +#include "third_party/blink/renderer/core/layout/layout_object_factory.h" namespace blink { @@ -39,8 +39,8 @@ : HTMLElement(html_names::kWbrTag, document) {} LayoutObject* HTMLWBRElement::CreateLayoutObject(const ComputedStyle& style, - LegacyLayout) { - return new LayoutWordBreak(this); + LegacyLayout legacy) { + return LayoutObjectFactory::CreateWordBreak(this, legacy); } } // namespace blink
diff --git a/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc b/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc index 2b26fab..bf07c43 100644 --- a/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc +++ b/third_party/blink/renderer/core/inspector/inspector_style_sheet.cc
@@ -791,9 +791,11 @@ if (!source_property_names.insert(name.DeprecatedLower()).is_new_entry) continue; - String value = style_->getPropertyValue(name); - if (value.IsEmpty()) + if (!IsValidCSSPropertyID( + CssPropertyID(style_->GetExecutionContext(), name))) continue; + + String value = style_->getPropertyValue(name); bool important = !style_->getPropertyPriority(name).IsEmpty(); if (important) value = value + " !important";
diff --git a/third_party/blink/renderer/core/layout/build.gni b/third_party/blink/renderer/core/layout/build.gni index 207853d..dff46b0b 100644 --- a/third_party/blink/renderer/core/layout/build.gni +++ b/third_party/blink/renderer/core/layout/build.gni
@@ -336,6 +336,7 @@ "ng/inline/layout_ng_br.h", "ng/inline/layout_ng_text.h", "ng/inline/layout_ng_text_fragment.h", + "ng/inline/layout_ng_word_break.h", "ng/inline/ng_abstract_inline_text_box.cc", "ng/inline/ng_abstract_inline_text_box.h", "ng/inline/ng_bidi_paragraph.cc",
diff --git a/third_party/blink/renderer/core/layout/layout_object_factory.cc b/third_party/blink/renderer/core/layout/layout_object_factory.cc index f375c0de..6906d4f 100644 --- a/third_party/blink/renderer/core/layout/layout_object_factory.cc +++ b/third_party/blink/renderer/core/layout/layout_object_factory.cc
@@ -35,6 +35,7 @@ #include "third_party/blink/renderer/core/layout/ng/inline/layout_ng_br.h" #include "third_party/blink/renderer/core/layout/ng/inline/layout_ng_text.h" #include "third_party/blink/renderer/core/layout/ng/inline/layout_ng_text_fragment.h" +#include "third_party/blink/renderer/core/layout/ng/inline/layout_ng_word_break.h" #include "third_party/blink/renderer/core/layout/ng/layout_ng_block_flow.h" #include "third_party/blink/renderer/core/layout/ng/layout_ng_button.h" #include "third_party/blink/renderer/core/layout/ng/layout_ng_fieldset.h" @@ -358,6 +359,12 @@ return CreateObject<LayoutObject, LayoutNGBR, LayoutBR>(*node, legacy); } +LayoutObject* LayoutObjectFactory::CreateWordBreak(HTMLElement* element, + LegacyLayout legacy) { + return CreateObject<LayoutObject, LayoutNGWordBreak, LayoutWordBreak>( + *element, legacy); +} + LayoutBox* LayoutObjectFactory::CreateAnonymousTableWithParent( const LayoutObject& parent, bool child_forces_legacy) {
diff --git a/third_party/blink/renderer/core/layout/layout_object_factory.h b/third_party/blink/renderer/core/layout/layout_object_factory.h index 4cb7024..1c53fd7 100644 --- a/third_party/blink/renderer/core/layout/layout_object_factory.h +++ b/third_party/blink/renderer/core/layout/layout_object_factory.h
@@ -12,6 +12,7 @@ namespace blink { class ComputedStyle; +class HTMLElement; class LayoutBlock; class LayoutBlockFlow; class LayoutObject; @@ -107,6 +108,7 @@ LegacyLayout legacy); static LayoutObject* CreateBR(Node*, LegacyLayout); + static LayoutObject* CreateWordBreak(HTMLElement*, LegacyLayout); // Anonymous creation methods
diff --git a/third_party/blink/renderer/core/layout/layout_word_break.cc b/third_party/blink/renderer/core/layout/layout_word_break.cc index a1c5f38b..55d5dce 100644 --- a/third_party/blink/renderer/core/layout/layout_word_break.cc +++ b/third_party/blink/renderer/core/layout/layout_word_break.cc
@@ -27,12 +27,14 @@ #include "third_party/blink/renderer/core/layout/layout_word_break.h" #include "third_party/blink/renderer/core/editing/position.h" -#include "third_party/blink/renderer/core/html/html_element.h" +#include "third_party/blink/renderer/core/html/html_wbr_element.h" namespace blink { -LayoutWordBreak::LayoutWordBreak(HTMLElement* element) - : LayoutText(element, StringImpl::empty_) {} +LayoutWordBreak::LayoutWordBreak(Node* node) + : LayoutText(node, StringImpl::empty_) { + DCHECK(IsA<HTMLWBRElement>(node)) << node; +} bool LayoutWordBreak::IsWordBreak() const { NOT_DESTROYED();
diff --git a/third_party/blink/renderer/core/layout/layout_word_break.h b/third_party/blink/renderer/core/layout/layout_word_break.h index 997a742..106b151 100644 --- a/third_party/blink/renderer/core/layout/layout_word_break.h +++ b/third_party/blink/renderer/core/layout/layout_word_break.h
@@ -31,11 +31,9 @@ namespace blink { -class HTMLElement; - -class LayoutWordBreak final : public LayoutText { +class LayoutWordBreak : public LayoutText { public: - explicit LayoutWordBreak(HTMLElement*); + explicit LayoutWordBreak(Node* node); Position PositionForCaretOffset(unsigned offset) const final; absl::optional<unsigned> CaretOffsetForPosition(const Position&) const final;
diff --git a/third_party/blink/renderer/core/layout/ng/inline/layout_ng_word_break.h b/third_party/blink/renderer/core/layout/ng/inline/layout_ng_word_break.h new file mode 100644 index 0000000..e00c6211 --- /dev/null +++ b/third_party/blink/renderer/core/layout/ng/inline/layout_ng_word_break.h
@@ -0,0 +1,41 @@ +// 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 THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_LAYOUT_NG_WORD_BREAK_H_ +#define THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_LAYOUT_NG_WORD_BREAK_H_ + +#include "third_party/blink/renderer/core/layout/layout_word_break.h" + +namespace blink { + +// This class is identical to |LayoutWordBreak| except for this class returns +// true for |IsLayoutNGObject()| and |NGInlineItem| support, to become child +// of |LayoutNGTextCombine|. See also |LayoutNGBR|. +// TODO(yosin): Once we get rid of |IsLayoutNGObject()|, we should unify this +// class |LayoutWordBreak|. +class CORE_EXPORT LayoutNGWordBreak final : public LayoutWordBreak { + public: + explicit LayoutNGWordBreak(Node* node) : LayoutWordBreak(node) {} + + bool IsLayoutNGObject() const final { + NOT_DESTROYED(); + return true; + } + + private: + const base::span<NGInlineItem>* GetNGInlineItems() const final { + NOT_DESTROYED(); + return &inline_items_; + } + base::span<NGInlineItem>* GetNGInlineItems() final { + NOT_DESTROYED(); + return &inline_items_; + } + + base::span<NGInlineItem> inline_items_; +}; + +} // namespace blink + +#endif // THIRD_PARTY_BLINK_RENDERER_CORE_LAYOUT_NG_INLINE_LAYOUT_NG_WORD_BREAK_H_
diff --git a/third_party/blink/renderer/core/loader/base_fetch_context.cc b/third_party/blink/renderer/core/loader/base_fetch_context.cc index 7f35290..63bd481 100644 --- a/third_party/blink/renderer/core/loader/base_fetch_context.cc +++ b/third_party/blink/renderer/core/loader/base_fetch_context.cc
@@ -121,6 +121,7 @@ const PermissionsPolicy* policy, const absl::optional<ClientHintImageInfo>& image_info, const absl::optional<WTF::AtomicString>& lang, + const absl::optional<WTF::AtomicString>& prefers_color_scheme, ResourceRequest& request) { // If the feature is enabled, then client hints are allowed only on secure // URLs. @@ -334,6 +335,17 @@ SerializeHeaderString(ua->full_version)); } } + + if (ShouldSendClientHint( + ClientHintsMode::kStandard, policy, resource_origin, is_1p_origin, + network::mojom::blink::WebClientHintsType::kPrefersColorScheme, + hints_preferences) && + prefers_color_scheme) { + request.SetHttpHeaderField( + blink::kClientHintsHeaderMapping[static_cast<size_t>( + network::mojom::blink::WebClientHintsType::kPrefersColorScheme)], + prefers_color_scheme.value()); + } } void BaseFetchContext::PrintAccessDeniedMessage(const KURL& url) const {
diff --git a/third_party/blink/renderer/core/loader/base_fetch_context.h b/third_party/blink/renderer/core/loader/base_fetch_context.h index 8c4697c..333cd9c 100644 --- a/third_party/blink/renderer/core/loader/base_fetch_context.h +++ b/third_party/blink/renderer/core/loader/base_fetch_context.h
@@ -110,6 +110,7 @@ const PermissionsPolicy* policy, const absl::optional<ClientHintImageInfo>& image_info, const absl::optional<WTF::AtomicString>& lang, + const absl::optional<WTF::AtomicString>& prefers_color_scheme, ResourceRequest& request); protected:
diff --git a/third_party/blink/renderer/core/loader/frame_client_hints_preferences_context.cc b/third_party/blink/renderer/core/loader/frame_client_hints_preferences_context.cc index 7ffc211..2304e7d5 100644 --- a/third_party/blink/renderer/core/loader/frame_client_hints_preferences_context.cc +++ b/third_party/blink/renderer/core/loader/frame_client_hints_preferences_context.cc
@@ -32,6 +32,7 @@ WebFeature::kClientHintsUAMobile, WebFeature::kClientHintsUAFullVersion, WebFeature::kClientHintsUAPlatformVersion, + WebFeature::kClientHintsPrefersColorScheme, }; static_assert(static_cast<int>(network::mojom::WebClientHintsType::kMaxValue) +
diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context.cc b/third_party/blink/renderer/core/loader/frame_fetch_context.cc index f6c2bb2..2a3f4ed 100644 --- a/third_party/blink/renderer/core/loader/frame_fetch_context.cc +++ b/third_party/blink/renderer/core/loader/frame_fetch_context.cc
@@ -458,6 +458,7 @@ absl::optional<ClientHintImageInfo> image_info; absl::optional<WTF::AtomicString> lang; + absl::optional<WTF::AtomicString> prefers_color_scheme; if (document_) { // Only get frame info if the frame is not detached image_info = ClientHintImageInfo(); @@ -471,6 +472,8 @@ ->navigator() ->SerializeLanguagesForClientHintHeader(); + prefers_color_scheme = document_->InDarkMode() ? "dark" : "light"; + // TODO(crbug.com/1151050): |SerializeLanguagesForClientHintHeader| getter // affects later calls if there is a DevTools override. The following blink // test fails unless set to "dirty" to manually reset languages: @@ -487,9 +490,9 @@ prefs.CombineWith(hints_preferences); prefs.CombineWith(GetClientHintsPreferences()); - BaseFetchContext::AddClientHintsIfNecessary(prefs, resource_origin, - is_1p_origin, ua, policy, - image_info, lang, request); + BaseFetchContext::AddClientHintsIfNecessary( + prefs, resource_origin, is_1p_origin, ua, policy, image_info, lang, + prefers_color_scheme, request); } void FrameFetchContext::PopulateResourceRequest(
diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc b/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc index 094bb41..dd9ee9c 100644 --- a/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc +++ b/third_party/blink/renderer/core/loader/frame_fetch_context_test.cc
@@ -836,6 +836,30 @@ } } +TEST_F(FrameFetchContextHintsTest, MonitorPrefersColorSchemeHint) { + ExpectHeader("https://www.example.com/1.gif", "Sec-CH-Prefers-Color-Scheme", + false, ""); + ExpectHeader("http://www.example.com/1.gif", "Sec-CH-Prefers-Color-Scheme", + false, ""); + + ClientHintsPreferences preferences; + preferences.SetShouldSend( + network::mojom::WebClientHintsType::kPrefersColorScheme); + document->GetFrame()->GetClientHintsPreferences().UpdateFrom(preferences); + + ExpectHeader("https://www.example.com/1.gif", "Sec-CH-Prefers-Color-Scheme", + true, "light"); + ExpectHeader("http://www.example.com/1.gif", "Sec-CH-Prefers-Color-Scheme", + false, ""); + + document->GetSettings()->SetPreferredColorScheme( + mojom::PreferredColorScheme::kDark); + ExpectHeader("https://www.example.com/1.gif", "Sec-CH-Prefers-Color-Scheme", + true, "dark"); + ExpectHeader("http://www.example.com/1.gif", "Sec-CH-Prefers-Color-Scheme", + false, ""); +} + TEST_F(FrameFetchContextHintsTest, MonitorAllHints) { ExpectHeader("https://www.example.com/1.gif", "Device-Memory", false, ""); ExpectHeader("https://www.example.com/1.gif", "DPR", false, ""); @@ -851,6 +875,8 @@ ExpectHeader("https://www.example.com/1.gif", "Sec-CH-UA-Platform-Version", false, ""); ExpectHeader("https://www.example.com/1.gif", "Sec-CH-UA-Model", false, ""); + ExpectHeader("https://www.example.com/1.gif", "Sec-CH-Prefers-Color-Scheme", + false, ""); // `Sec-CH-UA` is special. ExpectHeader("https://www.example.com/1.gif", "Sec-CH-UA", true, ""); @@ -870,6 +896,8 @@ preferences.SetShouldSend( network::mojom::WebClientHintsType::kUAPlatformVersion); preferences.SetShouldSend(network::mojom::WebClientHintsType::kUAModel); + preferences.SetShouldSend( + network::mojom::WebClientHintsType::kPrefersColorScheme); ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(4096); document->GetFrame()->GetClientHintsPreferences().UpdateFrom(preferences); ExpectHeader("https://www.example.com/1.gif", "Device-Memory", true, "4"); @@ -889,6 +917,8 @@ ExpectHeader("https://www.example.com/1.gif", "Sec-CH-UA-Platform-Version", true, ""); ExpectHeader("https://www.example.com/1.gif", "Sec-CH-UA-Model", true, ""); + ExpectHeader("https://www.example.com/1.gif", "Sec-CH-Prefers-Color-Scheme", + true, "light"); // Value of network quality client hints may vary, so only check if the // header is present and the values are non-negative/non-empty. @@ -918,7 +948,7 @@ "ch-dpr *; ch-device-memory *; ch-downlink *; ch-ect *; ch-lang *;" "ch-rtt *; ch-ua *; ch-ua-arch *; ch-ua-platform *; " "ch-ua-platform-version *; ch-ua-model *;" - "ch-viewport-width *; ch-width *"); + "ch-viewport-width *; ch-width *; ch-prefers-color-scheme *"); document->GetSettings()->SetScriptEnabled(true); ClientHintsPreferences preferences; preferences.SetShouldSend(network::mojom::WebClientHintsType::kDeviceMemory); @@ -935,6 +965,8 @@ preferences.SetShouldSend( network::mojom::WebClientHintsType::kUAPlatformVersion); preferences.SetShouldSend(network::mojom::WebClientHintsType::kUAModel); + preferences.SetShouldSend( + network::mojom::WebClientHintsType::kPrefersColorScheme); ApproximatedDeviceMemory::SetPhysicalMemoryMBForTesting(4096); document->GetFrame()->GetClientHintsPreferences().UpdateFrom(preferences); @@ -956,6 +988,8 @@ ExpectHeader("https://www.example.net/1.gif", "Sec-CH-UA-Model", true, ""); ExpectHeader("https://www.example.net/1.gif", "Width", true, "400", 400); ExpectHeader("https://www.example.net/1.gif", "Viewport-Width", true, "500"); + ExpectHeader("https://www.example.net/1.gif", "Sec-CH-Prefers-Color-Scheme", + true, "light"); // Value of network quality client hints may vary, so only check if the // header is present and the values are non-negative/non-empty. @@ -1021,6 +1055,8 @@ ExpectHeader("https://www.example.net/1.gif", "Sec-CH-UA-Model", false, ""); ExpectHeader("https://www.example.net/1.gif", "Width", false, ""); ExpectHeader("https://www.example.net/1.gif", "Viewport-Width", false, ""); + ExpectHeader("https://www.example.net/1.gif", "Sec-CH-Prefers-Color-Scheme", + false, ""); } // Verify that the client hints are not attached for third-party subresources
diff --git a/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5 b/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5 index 91545025..2ce8e7d 100644 --- a/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5 +++ b/third_party/blink/renderer/core/permissions_policy/permissions_policy_features.json5
@@ -75,6 +75,11 @@ depends_on: ["FeaturePolicyForClientHints"], }, { + name: "ClientHintPrefersColorScheme", + permissions_policy_name: "ch-prefers-color-scheme", + depends_on: ["FeaturePolicyForClientHints"], + }, + { name: "ClientHintRTT", permissions_policy_name: "ch-rtt", depends_on: ["FeaturePolicyForClientHints"],
diff --git a/third_party/blink/renderer/core/probe/BUILD.gn b/third_party/blink/renderer/core/probe/BUILD.gn index 8283599f..6944d32 100644 --- a/third_party/blink/renderer/core/probe/BUILD.gn +++ b/third_party/blink/renderer/core/probe/BUILD.gn
@@ -2,11 +2,9 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//build/config/python.gni") import("//third_party/blink/renderer/core/core.gni") -# TODO(crbug.com/1194277): Investigate non-determinism in Py3 builds. -python2_action("instrumentation_probes") { +action("instrumentation_probes") { script = "../../build/scripts/make_instrumenting_probes.py" inputs = [
diff --git a/third_party/blink/renderer/core/scroll/mac_scrollbar_animator_impl.mm b/third_party/blink/renderer/core/scroll/mac_scrollbar_animator_impl.mm index c86071f..6756e9c 100644 --- a/third_party/blink/renderer/core/scroll/mac_scrollbar_animator_impl.mm +++ b/third_party/blink/renderer/core/scroll/mac_scrollbar_animator_impl.mm
@@ -62,12 +62,12 @@ @interface BlinkScrollbarPainterControllerDelegate : NSObject { blink::ScrollableArea* _scrollableArea; } -- (id)initWithScrollableArea:(blink::ScrollableArea*)scrollableArea; +- (instancetype)initWithScrollableArea:(blink::ScrollableArea*)scrollableArea; @end @implementation BlinkScrollbarPainterControllerDelegate -- (id)initWithScrollableArea:(blink::ScrollableArea*)scrollableArea { +- (instancetype)initWithScrollableArea:(blink::ScrollableArea*)scrollableArea { self = [super init]; if (!self) return nil; @@ -236,23 +236,24 @@ CGFloat _startValue; CGFloat _endValue; } -- (id)initWithScrollbar:(blink::Scrollbar*)scrollbar - featureToAnimate:(FeatureToAnimate)featureToAnimate - animateFrom:(CGFloat)startValue - animateTo:(CGFloat)endValue - duration:(NSTimeInterval)duration - taskRunner:(scoped_refptr<base::SingleThreadTaskRunner>)taskRunner; +- (instancetype)initWithScrollbar:(blink::Scrollbar*)scrollbar + featureToAnimate:(FeatureToAnimate)featureToAnimate + animateFrom:(CGFloat)startValue + animateTo:(CGFloat)endValue + duration:(NSTimeInterval)duration + taskRunner:(scoped_refptr<base::SingleThreadTaskRunner>) + taskRunner; @end @implementation BlinkScrollbarPartAnimation -- (id)initWithScrollbar:(blink::Scrollbar*)scrollbar - featureToAnimate:(FeatureToAnimate)featureToAnimate - animateFrom:(CGFloat)startValue - animateTo:(CGFloat)endValue - duration:(NSTimeInterval)duration - taskRunner: - (scoped_refptr<base::SingleThreadTaskRunner>)taskRunner { +- (instancetype)initWithScrollbar:(blink::Scrollbar*)scrollbar + featureToAnimate:(FeatureToAnimate)featureToAnimate + animateFrom:(CGFloat)startValue + animateTo:(CGFloat)endValue + duration:(NSTimeInterval)duration + taskRunner:(scoped_refptr<base::SingleThreadTaskRunner>) + taskRunner { self = [super init]; if (!self) return nil; @@ -353,17 +354,18 @@ _expansionTransitionAnimation; BOOL _hasExpandedSinceInvisible; } -- (id)initWithScrollbar:(blink::Scrollbar*)scrollbar - taskRunner:(scoped_refptr<base::SingleThreadTaskRunner>)taskRunner; +- (instancetype)initWithScrollbar:(blink::Scrollbar*)scrollbar + taskRunner:(scoped_refptr<base::SingleThreadTaskRunner>) + taskRunner; - (void)updateVisibilityImmediately:(bool)show; - (void)cancelAnimations; @end @implementation BlinkScrollbarPainterDelegate -- (id)initWithScrollbar:(blink::Scrollbar*)scrollbar - taskRunner: - (scoped_refptr<base::SingleThreadTaskRunner>)taskRunner { +- (instancetype)initWithScrollbar:(blink::Scrollbar*)scrollbar + taskRunner:(scoped_refptr<base::SingleThreadTaskRunner>) + taskRunner { self = [super init]; if (!self) return nil;
diff --git a/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm b/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm index 45c4c3e..05b828f 100644 --- a/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm +++ b/third_party/blink/renderer/core/scroll/scrollbar_theme_mac.mm
@@ -48,15 +48,16 @@ BOOL _suppressSetScrollbarsHidden; CGFloat _saved_knob_alpha; } -- (id)initWithScrollbar:(blink::Scrollbar*)scrollbar - painter:(const base::scoped_nsobject<ScrollbarPainter>&)painter; +- (instancetype) + initWithScrollbar:(blink::Scrollbar*)scrollbar + painter:(const base::scoped_nsobject<ScrollbarPainter>&)painter; @end @implementation BlinkScrollbarObserver -- (id)initWithScrollbar:(blink::Scrollbar*)scrollbar - painter: - (const base::scoped_nsobject<ScrollbarPainter>&)painter { +- (instancetype) + initWithScrollbar:(blink::Scrollbar*)scrollbar + painter:(const base::scoped_nsobject<ScrollbarPainter>&)painter { if (!(self = [super init])) return nil; _scrollbar = scrollbar;
diff --git a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc index 06706a0c..f849ed5 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_node_object.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_node_object.cc
@@ -4896,30 +4896,13 @@ if (name_sources) { name_sources->push_back(NameSource(*found_text_alternative)); - name_sources->back().type = name_from; - name_sources->back().native_source = kAXTextFromNativeHTMLTitleElement; - } - - Element* title_element = document->TitleElement(); - AXObject* title_ax_object = AXObjectCache().GetOrCreate( - title_element, AXObjectCache().Get(document)); - if (title_ax_object) { - if (related_objects) { - local_related_objects.push_back( - MakeGarbageCollected<NameSourceRelatedObject>(title_ax_object, - text_alternative)); - *related_objects = local_related_objects; - local_related_objects.clear(); - } - - if (name_sources) { - NameSource& source = name_sources->back(); - source.related_objects = *related_objects; - source.text = text_alternative; - *found_text_alternative = true; - } else { - return text_alternative; - } + NameSource& source = name_sources->back(); + source.type = name_from; + source.native_source = kAXTextFromNativeHTMLTitleElement; + source.text = text_alternative; + *found_text_alternative = true; + } else { + return text_alternative; } } }
diff --git a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc index 3ed1c24f..725d3c06 100644 --- a/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc +++ b/third_party/blink/renderer/modules/accessibility/ax_object_cache_impl.cc
@@ -359,6 +359,11 @@ return !select->UsesMenuList(); } + // An HTML <title> does not require an AXObject: the document's name is + // retrieved directly via the inner text. + if (IsA<HTMLTitleElement>(node)) + return node->IsSVGElement(); + return true; } @@ -449,6 +454,11 @@ return true; } + // An HTML <title> does not require an AXObject: the document's name is + // retrieved directly via the inner text. + if (IsA<HTMLTitleElement>(node)) + return node->IsSVGElement(); + // The node is either hidden or display locked: // Do not consider <head>/<style>/<script> relevant in these cases. if (IsA<HTMLHeadElement>(node)) @@ -472,9 +482,10 @@ // <style> element. if (parent_ax_known) return true; // No need to check inside if the parent exists. - // Objects inside <head> are irrelevant, except <title> (collects title text). + + // Objects inside <head> are irrelevant. if (Traversal<HTMLHeadElement>::FirstAncestor(*node)) - return IsA<HTMLTitleElement>(node); + return false; // Objects inside a <style> are irrelevant. if (Traversal<HTMLStyleElement>::FirstAncestor(*node)) return false;
diff --git a/third_party/blink/renderer/platform/fonts/mac/attributed_string_type_converter.mm b/third_party/blink/renderer/platform/fonts/mac/attributed_string_type_converter.mm index 683669b..9bc9f01 100644 --- a/third_party/blink/renderer/platform/fonts/mac/attributed_string_type_converter.mm +++ b/third_party/blink/renderer/platform/fonts/mac/attributed_string_type_converter.mm
@@ -27,7 +27,7 @@ [ns_attributed_string attributesAtIndex:i effectiveRange:&effective_range]; - NSFont* font = [ns_attributes objectForKey:NSFontAttributeName]; + NSFont* font = ns_attributes[NSFontAttributeName]; String font_name; float font_point_size; // Only encode the attributes if the filtered set contains font information.
diff --git a/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm b/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm index 7144cab..2f6a9fd 100644 --- a/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm +++ b/third_party/blink/renderer/platform/fonts/mac/font_matcher_mac.mm
@@ -233,14 +233,13 @@ unsigned n = [fonts count]; unsigned i; for (i = 0; i < n; i++) { - NSArray* font_info = [fonts objectAtIndex:i]; + NSArray* font_info = fonts[i]; // Array indices must be hard coded because of lame AppKit API. - NSString* font_full_name = [font_info objectAtIndex:0]; - NSInteger font_weight = [[font_info objectAtIndex:2] intValue]; + NSString* font_full_name = font_info[0]; + NSInteger font_weight = [font_info[2] intValue]; - NSFontTraitMask font_traits = - [[font_info objectAtIndex:3] unsignedIntValue]; + NSFontTraitMask font_traits = [font_info[3] unsignedIntValue]; BOOL new_winner; if (!chose_font)
diff --git a/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder.cc b/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder.cc index f96bfc44d..223ef25 100644 --- a/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder.cc +++ b/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder.cc
@@ -49,44 +49,46 @@ JxlDecoderDestroy(dec_); } -inline bool DecodeToHalfFloat(const JxlPixelFormat& format) { - return format.data_type == JXL_TYPE_FLOAT16; -} - void JXLImageDecoder::Decode(bool only_size) { + if (Failed()) + return; + if (IsDecodedSizeAvailable() && only_size) { // Also SetEmbeddedProfile is done already if the size was set. return; } + if (!dec_) { dec_ = JxlDecoderCreate(nullptr); + // Subscribe to color encoding event even when only getting size, because + // SetSize must be called after SetEmbeddedColorProfile + const int events = + JXL_DEC_BASIC_INFO | JXL_DEC_COLOR_ENCODING | JXL_DEC_FULL_IMAGE; + + if (JXL_DEC_SUCCESS != JxlDecoderSubscribeEvents(dec_, events)) { + SetFailed(); + return; + } } else { - JxlDecoderReset(dec_); + offset_ -= JxlDecoderReleaseInput(dec_); } - // Subscribe to color encoding event even when only getting size, because - // SetSize must be called after SetEmbeddedColorProfile - const int events = JXL_DEC_BASIC_INFO | JXL_DEC_COLOR_ENCODING | - (only_size ? 0 : JXL_DEC_FULL_IMAGE); - - if (JXL_DEC_SUCCESS != JxlDecoderSubscribeEvents(dec_, events)) { - SetFailed(); - return; - } - - JxlBasicInfo info; - FastSharedBufferReader reader(data_.get()); - size_t offset = 0; - // SetEmbeddedColorProfile may only be used if !size_available at the - // beginning of Decode. This means even if only_size is true, we must already - // read the color profile as well, or we cannot set it anymore later. + const JxlPixelFormat format = {4, JXL_TYPE_FLOAT, JXL_NATIVE_ENDIAN, 0}; + const bool size_available = IsDecodedSizeAvailable(); - // Our API guarantees that we either get JXL_DEC_ERROR, JXL_DEC_SUCCESS or - // JXL_DEC_NEED_MORE_INPUT, and we exit the loop below in either case. + if (have_color_info_) { + xform_ = ColorTransform(); + } + + // The JXL API guarantees that we eventually get JXL_DEC_ERROR, + // JXL_DEC_SUCCESS or JXL_DEC_NEED_MORE_INPUT, and we exit the loop below in + // each case. for (;;) { + if (only_size && have_color_info_) + return; JxlDecoderStatus status = JxlDecoderProcessInput(dec_); switch (status) { case JXL_DEC_ERROR: { @@ -96,21 +98,19 @@ } case JXL_DEC_NEED_MORE_INPUT: { const size_t remaining = JxlDecoderReleaseInput(dec_); - if (remaining != 0) { - DVLOG(1) << "api needs more input but didn't use all " << remaining; - SetFailed(); - return; - } - if (offset >= reader.size()) { + offset_ -= remaining; + if (offset_ >= reader.size()) { if (IsAllDataReceived()) { DVLOG(1) << "need more input but all data received"; SetFailed(); return; } + // Return because we need more input from the reader, to continue + // decoding in the next call. return; } const char* buffer = nullptr; - size_t read = reader.GetSomeData(buffer, offset); + size_t read = reader.GetSomeData(buffer, offset_); if (JXL_DEC_SUCCESS != JxlDecoderSetInput(dec_, reinterpret_cast<const uint8_t*>(buffer), read)) { @@ -118,21 +118,22 @@ SetFailed(); return; } - offset += read; + offset_ += read; break; } case JXL_DEC_BASIC_INFO: { - if (JXL_DEC_SUCCESS != JxlDecoderGetBasicInfo(dec_, &info)) { + if (JXL_DEC_SUCCESS != JxlDecoderGetBasicInfo(dec_, &info_)) { DVLOG(1) << "JxlDecoderGetBasicInfo failed"; SetFailed(); return; } - if (!size_available && !SetSize(info.xsize, info.ysize)) + if (!size_available && !SetSize(info_.xsize, info_.ysize)) return; break; } case JXL_DEC_COLOR_ENCODING: { if (IgnoresColorSpace()) { + have_color_info_ = true; continue; } @@ -146,12 +147,12 @@ // Detect whether the JXL image is intended to be an HDR image: when it // uses more than 8 bits per pixel, or when it has explicitly marked // PQ or HLG color profile. - if (info.bits_per_sample > 8) { + if (info_.bits_per_sample > 8) { is_hdr_ = true; } JxlColorEncoding color_encoding; if (JXL_DEC_SUCCESS == JxlDecoderGetColorAsEncodedProfile( - dec_, &format_, + dec_, &format, JXL_COLOR_PROFILE_TARGET_ORIGINAL, &color_encoding)) { if (color_encoding.transfer_function == JXL_TRANSFER_FUNCTION_PQ || @@ -164,23 +165,17 @@ if (is_hdr_ && high_bit_depth_decoding_option_ == kHighBitDepthToHalfFloat) { - format_.data_type = JXL_TYPE_FLOAT16; - format_.endianness = JXL_LITTLE_ENDIAN; + decode_to_half_float_ = true; } bool have_data_profile = false; - if (JXL_DEC_SUCCESS == - JxlDecoderGetColorAsEncodedProfile(dec_, &format_, - JXL_COLOR_PROFILE_TARGET_DATA, - &color_encoding)) { + if (JXL_DEC_SUCCESS == JxlDecoderGetColorAsEncodedProfile( + dec_, &format, JXL_COLOR_PROFILE_TARGET_DATA, + &color_encoding)) { bool known_transfer_function = true; bool known_gamut = true; skcms_Matrix3x3 gamut; skcms_TransferFunction transfer; - // PQ or HLG as the data may occur if the JXL image was lossless, or - // not in XYB color space. If the JXL image was lossy with XYB, then - // instead linear sRGB is expected here when we treat the image as HDR - // (when format_.data_type == JXL_TYPE_FLOAT), nonlinear sRGB for SDR. if (color_encoding.transfer_function == JXL_TRANSFER_FUNCTION_PQ) { transfer = SkNamedTransferFn::kPQ; } else if (color_encoding.transfer_function == @@ -223,11 +218,11 @@ bool got_size = JXL_DEC_SUCCESS == JxlDecoderGetICCProfileSize( - dec_, &format_, JXL_COLOR_PROFILE_TARGET_DATA, &icc_size); + dec_, &format, JXL_COLOR_PROFILE_TARGET_DATA, &icc_size); std::vector<uint8_t> icc_profile(icc_size); if (got_size && JXL_DEC_SUCCESS == JxlDecoderGetColorAsICCProfile( - dec_, &format_, JXL_COLOR_PROFILE_TARGET_DATA, + dec_, &format, JXL_COLOR_PROFILE_TARGET_DATA, icc_profile.data(), icc_profile.size())) { profile = ColorProfile::Create(icc_profile.data(), icc_profile.size()); @@ -259,8 +254,7 @@ if (is_hdr_ && high_bit_depth_decoding_option_ == kHighBitDepthToHalfFloat) { - format_.data_type = JXL_TYPE_FLOAT16; - format_.endianness = JXL_LITTLE_ENDIAN; + decode_to_half_float_ = true; } if (have_data_profile) { @@ -268,17 +262,10 @@ SetEmbeddedColorProfile(std::move(profile)); } } + have_color_info_ = true; break; } case JXL_DEC_NEED_IMAGE_OUT_BUFFER: { - // Progressive is not yet implemented, and we potentially require some - // color transforms applied on the buffer from the frame. If we let the - // JPEG XL decoder write to the buffer immediately, Chrome may already - // render its intermediate stage with the wrong color format_. Hence, - // for now, only set the buffer and let JXL decode once we have all - // data. - if (!IsAllDataReceived()) - return; // Always 0 because animation is not yet implemented. const size_t frame_index = 0; ImageFrame& frame = frame_buffer_cache_[frame_index]; @@ -289,36 +276,59 @@ SetFailed(); return; } + frame.SetHasAlpha(info_.alpha_bits != 0); + size_t buffer_size; if (JXL_DEC_SUCCESS != - JxlDecoderImageOutBufferSize(dec_, &format_, &buffer_size)) { + JxlDecoderImageOutBufferSize(dec_, &format, &buffer_size)) { DVLOG(1) << "JxlDecoderImageOutBufferSize failed"; SetFailed(); return; } - - void* pixels_buffer; - - if (DecodeToHalfFloat(format_)) { - if (buffer_size != info.xsize * info.ysize * 8) { - DVLOG(1) << "Unexpected buffer size"; - SetFailed(); - return; - } - pixels_buffer = reinterpret_cast<void*>(frame.GetAddrF16(0, 0)); - } else { - if (buffer_size != info.xsize * info.ysize * 4) { - DVLOG(1) << "Unexpected buffer size"; - SetFailed(); - return; - } - pixels_buffer = reinterpret_cast<void*>(frame.GetAddr(0, 0)); + if (buffer_size != info_.xsize * info_.ysize * 16) { + DVLOG(1) << "Unexpected buffer size"; + SetFailed(); + return; } - if (JXL_DEC_SUCCESS != JxlDecoderSetImageOutBuffer(dec_, &format_, - pixels_buffer, - buffer_size)) { - DVLOG(1) << "JxlDecoderSetImageOutBuffer failed"; + // TODO(http://crbug.com/1210465): Add Munsell chart color accuracy + // tests for JXL + xform_ = ColorTransform(); + auto callback = [](void* opaque, size_t x, size_t y, size_t num_pixels, + const void* pixels) { + JXLImageDecoder* self = reinterpret_cast<JXLImageDecoder*>(opaque); + ImageFrame& frame = self->frame_buffer_cache_[0]; + void* row_dst = self->decode_to_half_float_ + ? reinterpret_cast<void*>(frame.GetAddrF16(x, y)) + : reinterpret_cast<void*>(frame.GetAddr(x, y)); + + bool dst_premultiply = frame.PremultiplyAlpha(); + + const skcms_PixelFormat kSrcFormat = skcms_PixelFormat_RGBA_ffff; + const skcms_PixelFormat kDstFormat = self->decode_to_half_float_ + ? skcms_PixelFormat_RGBA_hhhh + : XformColorFormat(); + + if (self->xform_ || (kDstFormat != kSrcFormat) || + (dst_premultiply && frame.HasAlpha())) { + skcms_AlphaFormat src_alpha = skcms_AlphaFormat_Unpremul; + skcms_AlphaFormat dst_alpha = + (dst_premultiply && self->info_.alpha_bits) + ? skcms_AlphaFormat_PremulAsEncoded + : skcms_AlphaFormat_Unpremul; + const auto* src_profile = + self->xform_ ? self->xform_->SrcProfile() : nullptr; + const auto* dst_profile = + self->xform_ ? self->xform_->DstProfile() : nullptr; + bool color_conversion_successful = skcms_Transform( + pixels, kSrcFormat, src_alpha, src_profile, row_dst, kDstFormat, + dst_alpha, dst_profile, num_pixels); + DCHECK(color_conversion_successful); + } + }; + if (JXL_DEC_SUCCESS != + JxlDecoderSetImageOutCallback(dec_, &format, callback, this)) { + DVLOG(1) << "JxlDecoderSetImageOutCallback failed"; SetFailed(); return; } @@ -326,35 +336,6 @@ } case JXL_DEC_FULL_IMAGE: { ImageFrame& frame = frame_buffer_cache_[0]; - frame.SetHasAlpha(info.alpha_bits != 0); - ColorProfileTransform* xform = ColorTransform(); - const skcms_PixelFormat kSrcFormat = DecodeToHalfFloat(format_) - ? skcms_PixelFormat_RGBA_hhhh - : skcms_PixelFormat_RGBA_8888; - const skcms_PixelFormat kDstFormat = DecodeToHalfFloat(format_) - ? skcms_PixelFormat_RGBA_hhhh - : XformColorFormat(); - - if (xform || (kDstFormat != kSrcFormat) || - (frame.PremultiplyAlpha() && frame.HasAlpha())) { - skcms_AlphaFormat src_alpha = skcms_AlphaFormat_Unpremul; - skcms_AlphaFormat dst_alpha = - (frame.PremultiplyAlpha() && info.alpha_bits) - ? skcms_AlphaFormat_PremulAsEncoded - : skcms_AlphaFormat_Unpremul; - const auto* src_profile = xform ? xform->SrcProfile() : nullptr; - const auto* dst_profile = xform ? xform->DstProfile() : nullptr; - for (size_t y = 0; y < info.ysize; ++y) { - void* row = DecodeToHalfFloat(format_) - ? reinterpret_cast<void*>(frame.GetAddrF16(0, y)) - : reinterpret_cast<void*>(frame.GetAddr(0, y)); - bool color_conversion_successful = - skcms_Transform(row, kSrcFormat, src_alpha, src_profile, row, - kDstFormat, dst_alpha, dst_profile, info.xsize); - DCHECK(color_conversion_successful); - } - } - frame.SetPixelsChanged(true); frame.SetStatus(ImageFrame::kFrameComplete); // We do not support animated images yet, so return after the first @@ -393,7 +374,7 @@ void JXLImageDecoder::InitializeNewFrame(size_t index) { auto& buffer = frame_buffer_cache_[index]; - if (DecodeToHalfFloat(format_)) + if (decode_to_half_float_) buffer.SetPixelFormat(ImageFrame::PixelFormat::kRGBA_F16); }
diff --git a/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder.h b/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder.h index c1cecae..9a98617c 100644 --- a/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder.h +++ b/third_party/blink/renderer/platform/image-decoders/jxl/jxl_image_decoder.h
@@ -75,8 +75,14 @@ // The image is considered to be HDR, such as using PQ or HLG transfer // function in the color space. bool is_hdr_ = false; + bool decode_to_half_float_ = false; - JxlPixelFormat format_ = {4, JXL_TYPE_UINT8, JXL_NATIVE_ENDIAN, 0}; + JxlBasicInfo info_; + size_t offset_ = 0; + bool have_color_info_ = false; + + // Preserved for JXL pixel callback. Not owned. + ColorProfileTransform* xform_; }; } // namespace blink
diff --git a/third_party/blink/renderer/platform/loader/fetch/client_hints_preferences.cc b/third_party/blink/renderer/platform/loader/fetch/client_hints_preferences.cc index 6d0dcc1d..bdd7a1f 100644 --- a/third_party/blink/renderer/platform/loader/fetch/client_hints_preferences.cc +++ b/third_party/blink/renderer/platform/loader/fetch/client_hints_preferences.cc
@@ -70,9 +70,11 @@ // Note: .Ascii() would convert tab to ?, which is undesirable. absl::optional<std::vector<network::mojom::WebClientHintsType>> parsed_ch = - FilterAcceptCH(network::ParseClientHintsHeader(header_value.Latin1()), - RuntimeEnabledFeatures::LangClientHintHeaderEnabled(), - UserAgentClientHintEnabled()); + FilterAcceptCH( + network::ParseClientHintsHeader(header_value.Latin1()), + RuntimeEnabledFeatures::LangClientHintHeaderEnabled(), + UserAgentClientHintEnabled(), + RuntimeEnabledFeatures::PrefersColorSchemeClientHintHeaderEnabled()); if (!parsed_ch.has_value()) return;
diff --git a/third_party/blink/renderer/platform/loader/fetch/client_hints_preferences_test.cc b/third_party/blink/renderer/platform/loader/fetch/client_hints_preferences_test.cc index a0db4ee..2bf71e51 100644 --- a/third_party/blink/renderer/platform/loader/fetch/client_hints_preferences_test.cc +++ b/third_party/blink/renderer/platform/loader/fetch/client_hints_preferences_test.cc
@@ -29,34 +29,37 @@ bool expectation_ua_platform; bool expectation_ua_model; bool expectation_ua_full_version; + bool expectation_prefers_color_scheme; } cases[] = { {"width, dpr, viewportWidth", true, true, false, false, false, false, - false, false, false, false, false, false}, - {"WiDtH, dPr, viewport-width, rtt, downlink, ect, lang", true, true, true, - true, true, true, true, false, false, false, false, false}, + false, false, false, false, false, false, false}, + {"WiDtH, dPr, viewport-width, rtt, downlink, ect, lang, " + "sec-ch-prefers-color-scheme", + true, true, true, true, true, true, true, false, false, false, false, + false, true}, {"WiDtH, dPr, viewport-width, rtt, downlink, effective-connection-type", true, true, true, true, true, false, false, false, false, false, false, - false}, + false, false}, {"WIDTH, DPR, VIWEPROT-Width", true, true, false, false, false, false, - false, false, false, false, false, false}, + false, false, false, false, false, false, false}, {"VIewporT-Width, wutwut, width", true, false, true, false, false, false, - false, false, false, false, false, false}, + false, false, false, false, false, false, false}, {"dprw", false, false, false, false, false, false, false, false, false, - false, false, false}, - {"DPRW", false, false, false, false, false, false, false, false, false, - false, false, false}, - {"sec-ch-ua", false, false, false, false, false, false, false, true, false, false, false, false}, + {"DPRW", false, false, false, false, false, false, false, false, false, + false, false, false, false}, + {"sec-ch-ua", false, false, false, false, false, false, false, true, + false, false, false, false, false}, {"sec-ch-ua-arch", false, false, false, false, false, false, false, false, - true, false, false, false}, + true, false, false, false, false}, {"sec-ch-ua-platform", false, false, false, false, false, false, false, - false, false, true, false, false}, + false, false, true, false, false, false}, {"sec-ch-ua-model", false, false, false, false, false, false, false, - false, false, false, true, false}, + false, false, false, true, false, false}, {"sec-ch-ua, sec-ch-ua-arch, sec-ch-ua-platform, sec-ch-ua-model, " "sec-ch-ua-full-version", false, false, false, false, false, false, false, true, true, true, true, - true}, + true, false}, }; for (const auto& test_case : cases) { @@ -94,6 +97,9 @@ EXPECT_EQ( test_case.expectation_ua_model, preferences.ShouldSend(network::mojom::WebClientHintsType::kUAModel)); + EXPECT_EQ(test_case.expectation_prefers_color_scheme, + preferences.ShouldSend( + network::mojom::WebClientHintsType::kPrefersColorScheme)); // Calling UpdateFromHttpEquivAcceptCH with an invalid header should // have no impact on client hint preferences. @@ -149,6 +155,8 @@ preferences.ShouldSend(network::mojom::WebClientHintsType::kUAPlatform)); EXPECT_FALSE( preferences.ShouldSend(network::mojom::WebClientHintsType::kUAModel)); + EXPECT_FALSE(preferences.ShouldSend( + network::mojom::WebClientHintsType::kPrefersColorScheme)); // Calling UpdateFromHttpEquivAcceptCH with an invalid header should // have no impact on client hint preferences. @@ -169,6 +177,8 @@ preferences.ShouldSend(network::mojom::WebClientHintsType::kUAPlatform)); EXPECT_FALSE( preferences.ShouldSend(network::mojom::WebClientHintsType::kUAModel)); + EXPECT_FALSE(preferences.ShouldSend( + network::mojom::WebClientHintsType::kPrefersColorScheme)); // Calling UpdateFromHttpEquivAcceptCH with "width" header should // replace add width to preferences @@ -189,6 +199,8 @@ preferences.ShouldSend(network::mojom::WebClientHintsType::kUAPlatform)); EXPECT_FALSE( preferences.ShouldSend(network::mojom::WebClientHintsType::kUAModel)); + EXPECT_FALSE(preferences.ShouldSend( + network::mojom::WebClientHintsType::kPrefersColorScheme)); // Calling UpdateFromHttpEquivAcceptCH with empty header should not // change anything. @@ -209,6 +221,8 @@ preferences.ShouldSend(network::mojom::WebClientHintsType::kUAPlatform)); EXPECT_FALSE( preferences.ShouldSend(network::mojom::WebClientHintsType::kUAModel)); + EXPECT_FALSE(preferences.ShouldSend( + network::mojom::WebClientHintsType::kPrefersColorScheme)); } TEST_F(ClientHintsPreferencesTest, Insecure) { @@ -241,25 +255,27 @@ bool expect_ua_platform; bool expect_ua_model; bool expect_ua_full_version; + bool expect_prefers_color_scheme; } test_cases[] = { - {"width, dpr, viewportWidth, lang", false, true, true, false, false, - false, false, true, false, false, false, false, false}, + {"width, dpr, viewportWidth, lang, sec-ch-prefers-color-scheme", false, + true, true, false, false, false, false, true, false, false, false, false, + false, true}, {"width, dpr, viewportWidth", false, true, true, false, false, false, - false, false, false, false, false, false, false}, + false, false, false, false, false, false, false, false}, {"width, dpr, viewportWidth", false, true, true, false, false, false, - false, false, false, false, false, false, false}, + false, false, false, false, false, false, false, false}, {"width, dpr, viewportWidth", false, true, true, false, false, false, - false, false, false, false, false, false, false}, + false, false, false, false, false, false, false, false}, {"width, dpr, rtt, downlink, ect", false, true, true, false, true, true, - true, false, false, false, false, false, false}, + true, false, false, false, false, false, false, false}, {"device-memory", true, false, false, false, false, false, false, false, - false, false, false, false, false}, + false, false, false, false, false, false}, {"dpr rtt", false, false, false, false, false, false, false, false, false, - false, false, false, false}, + false, false, false, false, false}, {"sec-ch-ua, sec-ch-ua-arch, sec-ch-ua-platform, sec-ch-ua-model, " "sec-ch-ua-full-version", false, false, false, false, false, false, false, false, true, true, true, - true, true}, + true, true, false}, }; for (const auto& test : test_cases) { @@ -290,6 +306,8 @@ network::mojom::WebClientHintsType::kUAPlatform)); EXPECT_FALSE( enabled_types.IsEnabled(network::mojom::WebClientHintsType::kUAModel)); + EXPECT_FALSE(enabled_types.IsEnabled( + network::mojom::WebClientHintsType::kPrefersColorScheme)); const KURL kurl(String::FromUTF8("https://www.google.com/")); preferences.UpdateFromHttpEquivAcceptCH(test.accept_ch_header_value, kurl, @@ -328,6 +346,9 @@ EXPECT_EQ( test.expect_ua_model, enabled_types.IsEnabled(network::mojom::WebClientHintsType::kUAModel)); + EXPECT_EQ(test.expect_lang, + enabled_types.IsEnabled( + network::mojom::WebClientHintsType::kPrefersColorScheme)); } }
diff --git a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc index bf6609a..af1a1f14 100644 --- a/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc +++ b/third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc
@@ -785,6 +785,21 @@ resource_type == ResourceType::kRaw || resource_type == ResourceType::kXSLStyleSheet); + KURL bundle_url_for_urn_resources; + if (resource_request.GetWebBundleTokenParams()) { + DCHECK_EQ(resource_request.GetRequestDestination(), + network::mojom::RequestDestination::kWebBundle); + } else { + AttachWebBundleTokenIfNeeded(resource_request); + if (resource_request.Url().Protocol() == "urn" && + resource_request.GetWebBundleTokenParams()) { + // We use the bundle URL for urn resources for security checks. + bundle_url_for_urn_resources = + MemoryCache::RemoveFragmentIdentifierIfNeeded( + resource_request.GetWebBundleTokenParams()->bundle_url); + } + } + params.OverrideContentType(factory.ContentType()); // No CSP reports are sent for: @@ -828,8 +843,10 @@ Context().CheckCSPForRequest( resource_request.GetRequestContext(), resource_request.GetRequestDestination(), - MemoryCache::RemoveFragmentIdentifierIfNeeded(params.Url()), options, - reporting_disposition, + MemoryCache::RemoveFragmentIdentifierIfNeeded( + bundle_url_for_urn_resources.IsValid() ? bundle_url_for_urn_resources + : params.Url()), + options, reporting_disposition, MemoryCache::RemoveFragmentIdentifierIfNeeded(url_before_redirects), redirect_status); @@ -893,8 +910,12 @@ KURL url = MemoryCache::RemoveFragmentIdentifierIfNeeded(params.Url()); absl::optional<ResourceRequestBlockedReason> blocked_reason = - Context().CanRequest(resource_type, resource_request, url, options, - reporting_disposition, + Context().CanRequest(resource_type, resource_request, + MemoryCache::RemoveFragmentIdentifierIfNeeded( + bundle_url_for_urn_resources.IsValid() + ? bundle_url_for_urn_resources + : params.Url()), + options, reporting_disposition, resource_request.GetRedirectInfo()); if (Context().CalculateIfAdSubresource(resource_request, @@ -919,13 +940,6 @@ resource_request.SetAllowStoredCredentials(false); } - if (resource_request.GetWebBundleTokenParams()) { - DCHECK_EQ(resource_request.GetRequestDestination(), - network::mojom::RequestDestination::kWebBundle); - } else { - AttachWebBundleTokenIfNeeded(resource_request); - } - return absl::nullopt; }
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 index 9d2b37a6..eb69d7d 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
@@ -1666,6 +1666,10 @@ settable_from_internals: true, }, { + name: "PrefersColorSchemeClientHintHeader", + status: "experimental", + }, + { name: "PrefersContrast", depends_on: ["ForcedColors"], },
diff --git a/third_party/blink/renderer/platform/text/locale_mac.mm b/third_party/blink/renderer/platform/text/locale_mac.mm index c72f103f..989dff5 100644 --- a/third_party/blink/renderer/platform/text/locale_mac.mm +++ b/third_party/blink/renderer/platform/text/locale_mac.mm
@@ -125,7 +125,7 @@ NSArray* array = [ShortDateFormatter() monthSymbols]; if ([array count] == 12) { for (unsigned i = 0; i < 12; ++i) - month_labels_.push_back(String([array objectAtIndex:i])); + month_labels_.push_back(String(array[i])); return month_labels_; } for (unsigned i = 0; i < base::size(WTF::kMonthFullName); ++i) @@ -142,7 +142,7 @@ : [ShortDateFormatter() shortWeekdaySymbols]; if ([array count] == 7) { for (unsigned i = 0; i < 7; ++i) - week_day_short_labels_.push_back(String([array objectAtIndex:i])); + week_day_short_labels_.push_back(String(array[i])); return week_day_short_labels_; } for (unsigned i = 0; i < base::size(WTF::kWeekdayName); ++i) { @@ -255,7 +255,7 @@ NSArray* array = [ShortDateFormatter() shortMonthSymbols]; if ([array count] == 12) { for (unsigned i = 0; i < 12; ++i) - short_month_labels_.push_back([array objectAtIndex:i]); + short_month_labels_.push_back(array[i]); return short_month_labels_; } for (unsigned i = 0; i < base::size(WTF::kMonthName); ++i) @@ -270,7 +270,7 @@ if ([array count] == 12) { stand_alone_month_labels_.ReserveCapacity(12); for (unsigned i = 0; i < 12; ++i) - stand_alone_month_labels_.push_back([array objectAtIndex:i]); + stand_alone_month_labels_.push_back(array[i]); return stand_alone_month_labels_; } stand_alone_month_labels_ = ShortMonthLabels(); @@ -284,7 +284,7 @@ if ([array count] == 12) { short_stand_alone_month_labels_.ReserveCapacity(12); for (unsigned i = 0; i < 12; ++i) - short_stand_alone_month_labels_.push_back([array objectAtIndex:i]); + short_stand_alone_month_labels_.push_back(array[i]); return short_stand_alone_month_labels_; } short_stand_alone_month_labels_ = ShortMonthLabels();
diff --git a/third_party/blink/web_tests/TestExpectations b/third_party/blink/web_tests/TestExpectations index 6a594f57..22f7cff 100644 --- a/third_party/blink/web_tests/TestExpectations +++ b/third_party/blink/web_tests/TestExpectations
@@ -4791,6 +4791,7 @@ crbug.com/757165 [ Win ] fast/spatial-navigation/snav-two-elements-one-line.html [ Pass Failure Timeout Crash ] crbug.com/757165 [ Win ] fast/spatial-navigation/snav-unit-overflow-and-scroll-in-direction.html [ Pass Failure Timeout Crash ] crbug.com/757165 [ Win ] fast/spatial-navigation/snav-z-index.html [ Pass Failure Timeout Crash ] +crbug.com/757165 [ Win ] http/tests/devtools/console/console-filter-test.js [ Skip ] crbug.com/757165 [ Win ] http/tests/devtools/console/console-links-in-errors-with-trace.js [ Skip ] crbug.com/757165 [ Win ] http/tests/devtools/sources/ui-source-code-metadata.js [ Skip ] crbug.com/757165 [ Win ] http/tests/misc/client-hints-accept-meta-preloader.html [ Skip ] @@ -6896,16 +6897,6 @@ # Will be passed when compositing-after-paint is used by default 2021-05-13 crbug.com/1208213 external/wpt/css/css-transforms/add-child-in-empty-layer.html [ Failure ] -# Required for DevTools roll -crbug.com/1208357 http/tests/devtools/console/console-bad-stacktrace.js [ Skip ] -crbug.com/1208357 http/tests/devtools/console/console-filter-test.js [ Skip ] -crbug.com/1208357 http/tests/devtools/console/console-group-similar.js [ Skip ] -crbug.com/1208357 http/tests/devtools/console/console-links-on-messages-before-inspection.js [ Skip ] -crbug.com/1208357 http/tests/devtools/console/console-preserve-log.js [ Skip ] -crbug.com/1208357 http/tests/devtools/console/console-revoke-error-in-worker.js [ Skip ] -crbug.com/1208357 http/tests/devtools/console/console-timestamp.js [ Skip ] -crbug.com/1208357 http/tests/devtools/sources/debugger-ui/monitor-console-command.js [ Skip ] - # Sheriff 2021-05-12 crbug.com/1095540 [ Linux Debug ] virtual/compositor-threaded-percent-based-scrolling/fast/scrolling/resize-corner-tracking-touch.html [ Pass Failure ]
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-cache-revalidation.https.html b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-cache-revalidation.https.html index 453b6fc..84555a0 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-cache-revalidation.https.html +++ b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-cache-revalidation.https.html
@@ -30,6 +30,7 @@ "sec-ch-ua-platform-version", "sec-ch-ua-model", "sec-ch-ua-mobile", + "sec-ch-prefers-color-scheme", ]; const response = await fetch(`resources/stale-echo-client-hints.py?token=` + request_token);
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-cache-revalidation.https.html.headers b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-cache-revalidation.https.html.headers index 6f01afb9..ed61fa2 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-cache-revalidation.https.html.headers +++ b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-cache-revalidation.https.html.headers
@@ -1 +1 @@ -Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model +Accept-CH: dpr,device-memory,viewport-width,rtt,downlink,ect,lang,sec-ch-ua,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-prefers-color-scheme
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy-navigation.https.html.headers b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy-navigation.https.html.headers index 557140f..5f5f807c 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy-navigation.https.html.headers +++ b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy-navigation.https.html.headers
@@ -1,3 +1,3 @@ Accept-CH: Device-Memory, DPR, Viewport-Width Accept-CH-Lifetime: 100 -Feature-Policy: ch-device-memory *; ch-dpr 'none'; ch-viewport-width 'self'; ch-lang 'none'; ch-ua 'self'; ch-ua-mobile 'none' +Feature-Policy: ch-device-memory *; ch-dpr 'none'; ch-viewport-width 'self'; ch-lang 'none'; ch-ua 'self'; ch-ua-mobile 'none'; ch-prefers-color-scheme 'none'
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy.sub.https.html b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy.sub.https.html index 381e8a1b..f9e5db8 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy.sub.https.html +++ b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy.sub.https.html
@@ -41,6 +41,7 @@ assert_true(r.headers.has("mobile-received")); assert_in_array(r.headers.get("mobile-received"), ["?0", "?1"], 'mobile is unexpected'); + assert_false(r.headers.has("prefers-color-scheme-received"), "prefers-color-scheme-received"); }); }, "Accept-CH header test"); @@ -56,6 +57,7 @@ assert_false(r.headers.has("rtt-received"), "rtt-received"); assert_false(r.headers.has("downlink-received"), "downlink-received"); assert_false(r.headers.has("ect-received"), "ect-received"); + assert_false(r.headers.has("prefers-color-scheme-received"), "prefers-color-scheme-received"); }); }, "Cross-Origin Accept-CH header test");
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy.sub.https.html.headers b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy.sub.https.html.headers index cf453cf3..d620a5b 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy.sub.https.html.headers +++ b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-feature-policy.sub.https.html.headers
@@ -1,2 +1,2 @@ -Accept-CH: device-memory, dpr, viewport-width, rtt, downlink, ect, lang, mobile -Feature-Policy: ch-device-memory *; ch-dpr 'none'; ch-viewport-width 'self'; ch-lang 'none'; ch-mobile +Accept-CH: device-memory, dpr, viewport-width, rtt, downlink, ect, lang, mobile, sec-ch-prefers-color-scheme +Feature-Policy: ch-device-memory *; ch-dpr 'none'; ch-viewport-width 'self'; ch-lang 'none'; ch-mobile; ch-prefers-color-scheme 'none'
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-no-feature-policy-navigation.https.html b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-no-feature-policy-navigation.https.html index 24749ba..559e5a6 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-no-feature-policy-navigation.https.html +++ b/third_party/blink/web_tests/external/wpt/client-hints/accept-ch-no-feature-policy-navigation.https.html
@@ -17,7 +17,7 @@ "", "Client hints loaded on same-origin iframe request with no feature policy."); - let allow = "ch-device-memory *; ch-dpr 'src'; ch-viewport-width 'self'; ch-lang 'none'"; + let allow = "ch-device-memory *; ch-dpr 'src'; ch-viewport-width 'self'; ch-lang 'none'; ch-prefers-color-scheme 'none'"; await test_frame( "HTTPS_REMOTE_ORIGIN", "device-memory=true&dpr=true&viewport-width=false&sec-ch-ua=true&sec-ch-ua-mobile=true",
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/http-equiv-accept-ch-merge.https.html b/third_party/blink/web_tests/external/wpt/client-hints/http-equiv-accept-ch-merge.https.html index 177a836..4ed2291 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/http-equiv-accept-ch-merge.https.html +++ b/third_party/blink/web_tests/external/wpt/client-hints/http-equiv-accept-ch-merge.https.html
@@ -1,7 +1,7 @@ <html> <head> <meta http-equiv="Accept-CH" content="viewport-width, rtt"> -<meta http-equiv="Accept-CH" content="downlink, ect, lang"> +<meta http-equiv="Accept-CH" content="downlink, ect, lang, sec-ch-prefers-color-scheme"> <body> <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -35,6 +35,7 @@ assert_in_array(r.headers.get("ect-received"), ["slow-2g", "2g", "3g", "4g"], 'ect-received is unexpected'); + assert_true(r.headers.has("prefers-color-scheme-received"), "prefers-color-scheme-received"); }); }, "Accept-CH header test");
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/http-equiv-accept-ch-non-secure.http.html b/third_party/blink/web_tests/external/wpt/client-hints/http-equiv-accept-ch-non-secure.http.html index 909ab5f..4820af4 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/http-equiv-accept-ch-non-secure.http.html +++ b/third_party/blink/web_tests/external/wpt/client-hints/http-equiv-accept-ch-non-secure.http.html
@@ -28,6 +28,7 @@ assert_false(r.headers.has("downlink-received"), "downlink-received"); assert_false(r.headers.has("ect-received"), "ect-received"); assert_false(r.headers.has("lang-received"), "lang-received"); + assert_false(r.headers.has("prefers-color-scheme-received"), "prefers-color-scheme-received"); }); }, "Accept-CH http-equiv test over insecure transport");
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/resources/echo-client-hints-received.py b/third_party/blink/web_tests/external/wpt/client-hints/resources/echo-client-hints-received.py index ca623d4..ef750bd 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/resources/echo-client-hints-received.py +++ b/third_party/blink/web_tests/external/wpt/client-hints/resources/echo-client-hints-received.py
@@ -24,3 +24,5 @@ response.headers.set(b"lang-received", request.headers.get(b"Sec-CH-Lang")) if b"sec-ch-ua-mobile" in request.headers: response.headers.set(b"mobile-received", request.headers.get(b"sec-ch-ua-mobile")) + if b"sec-ch-prefers-color-scheme" in request.headers: + response.headers.set(b"prefers-color-scheme-received", request.headers.get(b"sec-ch-prefers-color-scheme"))
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/resources/stale-echo-client-hints.py b/third_party/blink/web_tests/external/wpt/client-hints/resources/stale-echo-client-hints.py index 664f7c4..51e09b8 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/resources/stale-echo-client-hints.py +++ b/third_party/blink/web_tests/external/wpt/client-hints/resources/stale-echo-client-hints.py
@@ -22,6 +22,7 @@ b"sec-ch-ua-platform", b"sec-ch-ua-platform-version", b"sec-ch-ua-model", + b"sec-ch-prefers-color-scheme", ] client_hints_curr = {i:request.headers.get(i) for i in client_hint_headers}
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/sec-ch-quotes.https.html b/third_party/blink/web_tests/external/wpt/client-hints/sec-ch-quotes.https.html index d60bf4c..f48c8c0 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/sec-ch-quotes.https.html +++ b/third_party/blink/web_tests/external/wpt/client-hints/sec-ch-quotes.https.html
@@ -25,6 +25,7 @@ "sec-ch-ua-platform-version", "sec-ch-ua-model", "sec-ch-ua-full-version", + "sec-ch-prefers-color-scheme", ]; const boolean_client_hint_headers = [ "sec-ch-mobile",
diff --git a/third_party/blink/web_tests/external/wpt/client-hints/sec-ch-quotes.https.html.headers b/third_party/blink/web_tests/external/wpt/client-hints/sec-ch-quotes.https.html.headers index 7ce817385..abec79a3 100644 --- a/third_party/blink/web_tests/external/wpt/client-hints/sec-ch-quotes.https.html.headers +++ b/third_party/blink/web_tests/external/wpt/client-hints/sec-ch-quotes.https.html.headers
@@ -1 +1 @@ -Accept-CH: sec-ch-ua,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model +Accept-CH: sec-ch-ua,sec-ch-ua-arch,sec-ch-ua-platform,sec-ch-ua-platform-version,sec-ch-ua-model,sec-ch-prefers-color-scheme
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/wm-propagation-body-dynamic-change-003-ref.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/wm-propagation-body-dynamic-change-003-ref.html new file mode 100644 index 0000000..30e72f0d --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/wm-propagation-body-dynamic-change-003-ref.html
@@ -0,0 +1,4 @@ +<!doctype html> +<meta charset="utf-8"> +<title>CSS Test Reference</title> +<body style="margin:0">This text must be horizontal.</body>
diff --git a/third_party/blink/web_tests/external/wpt/css/css-writing-modes/wm-propagation-body-dynamic-change-003.html b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/wm-propagation-body-dynamic-change-003.html new file mode 100644 index 0000000..8e8bf03c --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/css/css-writing-modes/wm-propagation-body-dynamic-change-003.html
@@ -0,0 +1,12 @@ +<!doctype html> +<meta charset="utf-8"> +<title>CSS Writing Modes Test: propagation of the writing-mode property from body to root with text children</title> +<link rel=help href="https://drafts.csswg.org/css-writing-modes-3/#principal-flow"> +<link rel="match" href="wm-propagation-body-dynamic-change-003-ref.html"> +<body style="writing-mode: vertical-rl"></body> +<script> + document.documentElement.insertBefore( + document.createTextNode("This text must be horizontal."), document.body); + document.body.offsetTop; + document.body.style.writingMode = "horizontal-tb"; +</script>
diff --git a/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-allowed.https.tentative.html b/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-allowed.https.tentative.html index 72a7593..ceec645 100644 --- a/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-allowed.https.tentative.html +++ b/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-allowed.https.tentative.html
@@ -6,9 +6,16 @@ /> <meta http-equiv="Content-Security-Policy" - content="script-src urn: 'self' 'unsafe-inline'; - img-src https://web-platform.test:8444/web-bundle/resources/wbn/pass.png; - frame-src urn:" + content=" + script-src + https://web-platform.test:8444/web-bundle/resources/wbn/urn-uuid.wbn + https://web-platform.test:8444/resources/testharness.js + https://web-platform.test:8444/resources/testharnessreport.js + 'unsafe-inline'; + img-src + https://web-platform.test:8444/web-bundle/resources/wbn/pass.png; + frame-src + https://web-platform.test:8444/web-bundle/resources/wbn/urn-uuid.wbn" > <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -27,7 +34,8 @@ img.onerror = reject; document.body.appendChild(img); }); - }, 'URL matching of CSP should be done based on the subresource URL'); + }, 'URL matching of CSP should be done based on the subresource URL ' + + 'when the subresource URL is HTTPS URL.'); promise_test(async () => { const result = await new Promise((resolve) => { @@ -38,9 +46,10 @@ document.body.appendChild(script); }); assert_equals(result, 'OK'); - }, '"script-src urn:" CSP directive should allow urn: scripts'); + }, 'URL matching of script-src CSP should be done based on the bundle URL ' + + 'when the subresource URL is urn:uuid URL.'); - promise_test(() => { + promise_test(async () => { const frame_url = 'urn:uuid:429fcc4e-0696-4bad-b099-ee9175f023ae'; const iframe = document.createElement('iframe'); iframe.src = frame_url; @@ -48,7 +57,22 @@ iframe.addEventListener('load', resolve); }); document.body.appendChild(iframe); - return load_promise; - }, '"frame-src urn:" CSP directive should allow urn:uuid iframes'); + await load_promise; + assert_equals( + await evalInIframe(iframe, 'location.href'), + frame_url); + }, 'URL matching of frame-src CSP should be done based on the bundle URL ' + + 'when the frame URL is urn:uuid URL.'); + + async function evalInIframe(iframe, code) { + const message_promise = new Promise((resolve) => { + window.addEventListener( + 'message', + (e) => { resolve(e.data); }, + { once : true }); + }); + iframe.contentWindow.postMessage(code,'*'); + return message_promise; + } </script> </body>
diff --git a/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-blocked.https.tentative.html b/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-blocked.https.tentative.html index dc5ffb8..319ae65c 100644 --- a/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-blocked.https.tentative.html +++ b/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-blocked.https.tentative.html
@@ -2,13 +2,22 @@ <title>CSP for subresource WebBundle (blocked cases)</title> <link rel="help" - href="https://github.com/WICG/webpackage/blob/master/explainers/subresource-loading.md" + href="https://github.com/WICG/webpackage/blob/main/explainers/subresource-loading.md" /> <meta http-equiv="Content-Security-Policy" - content="script-src * 'unsafe-inline'; - img-src https://web-platform.test:8444/web-bundle/resources/wbn/subresource.wbn; - frame-src *" + content=" + script-src + urn: + https://web-platform.test:8444/resources/testharness.js + https://web-platform.test:8444/resources/testharnessreport.js + 'unsafe-inline'; + img-src + https://web-platform.test:8444/web-bundle/resources/wbn/subresource.wbn; + frame-src + urn:; + report-to + csp-group" > <script src="/resources/testharness.js"></script> <script src="/resources/testharnessreport.js"></script> @@ -19,8 +28,10 @@ resources="urn:uuid:020111b3-437a-4c5c-ae07-adb6bbffb720 urn:uuid:429fcc4e-0696-4bad-b099-ee9175f023ae" /> <script> + const bundle_url = 'https://web-platform.test:8444/web-bundle/resources/wbn/urn-uuid.wbn'; + function expect_violation() { - return new Promise((resolve) => { + return new Promise(resolve => { document.addEventListener('securitypolicyviolation', (e) => { e.stopPropagation(); resolve(e); @@ -28,14 +39,37 @@ }); } + function getReportID() { + const cookies = document.cookie.split(';'); + for (var i = 0; i < cookies.length; i++) { + const name_value = cookies[i].split('='); + const cookieName = name_value[0].trim(); + if (cookieName === 'csp-blocked-report-id') { + return name_value[1].trim(); + } + } + } + + function sortReportsByEffectiveDirective(reports) { + reports.sort(function(report1, report2) { + return report1.body.effectiveDirective.localeCompare( + report2.body.effectiveDirective); + }); + } + promise_test(async () => { const p = expect_violation(); const img = document.createElement('img'); + const error_promise = new Promise(resolve => { + img.onerror = resolve; + }); img.src = 'https://web-platform.test:8444/web-bundle/resources/wbn/fail.png'; document.body.appendChild(img); const e = await p; assert_equals(e.blockedURI, img.src); - }, 'URL matching of CSP should be done based on the subresource URL, not on the bundle URL'); + await error_promise; + }, 'URL matching of CSP should be done based on the subresource URL, ' + + 'not on the bundle URL, when the subresource URL is HTTPS URL.'); promise_test(async () => { const urn_uuid = 'urn:uuid:020111b3-437a-4c5c-ae07-adb6bbffb720'; @@ -44,19 +78,60 @@ script.src = urn_uuid; document.body.appendChild(script); const e = await p; - // Use prefix check because browsers may strip cross-origin blockedURI. - assert_true(urn_uuid.startsWith(e.blockedURI)); - }, '"script-src *" CSP directive should block urn:uuid scripts'); + // Currently Chromium is reporting the bundle URL. + // TODO(crbug.com/1208659): Consider deeper integration with CSP for + // providing the both URLs. + assert_equals(e.blockedURI, bundle_url); + assert_equals(e.violatedDirective, 'script-src-elem'); + }, 'URL matching of script-src CSP should be done based on the bundle URL ' + + 'when the subresource URL is urn:uuid URL.'); promise_test(async () => { const urn_uuid = 'urn:uuid:429fcc4e-0696-4bad-b099-ee9175f023ae'; const p = expect_violation(); const iframe = document.createElement('iframe'); iframe.src = urn_uuid; + const load_promise = new Promise(resolve => { + iframe.addEventListener('load', resolve); + }); document.body.appendChild(iframe); const e = await p; - // Use prefix check because browsers may strip cross-origin blockedURI. - assert_true(urn_uuid.startsWith(e.blockedURI)); - }, '"frame-src *" CSP directive should block urn:uuid iframes'); + // Currently Chromium is reporting the bundle URL. + // TODO(crbug.com/1208659): Consider deeper integration with CSP for + // providing the both URLs. + assert_equals(e.blockedURI, bundle_url); + assert_equals(e.violatedDirective, 'frame-src'); + + // Make sure that the blocked iframe load is finished. + await load_promise; + + // The blocked iframe is cross-origin. So accessing + // iframe.contentWindow.location should throw a SecurityError. + assert_throws_dom( + "SecurityError", + () => { iframe.contentWindow.location.href; }); + }, 'URL matching of frame-src CSP should be done based on the bundle URL ' + + 'when the frame URL is urn:uuid URL.'); + + promise_test(async () => { + const retrieve_report_url = + "/reporting/resources/report.py?op=retrieve_report&timeout=3&reportID=" + + getReportID(); + const reports = await (await fetch(retrieve_report_url)).json(); + sortReportsByEffectiveDirective(reports); + + assert_equals(reports.length, 3, "Report count."); + + assert_equals(reports[0].body.blockedURL, bundle_url); + assert_equals(reports[0].body.effectiveDirective, 'frame-src'); + + assert_equals( + reports[1].body.blockedURL, + 'https://web-platform.test:8444/web-bundle/resources/wbn/fail.png'); + assert_equals(reports[1].body.effectiveDirective, 'img-src',); + + assert_equals(reports[2].body.blockedURL, bundle_url); + assert_equals(reports[2].body.effectiveDirective, 'script-src-elem'); + }, 'Check the CSP violation reports.'); </script> </body>
diff --git a/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-blocked.https.tentative.html.sub.headers b/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-blocked.https.tentative.html.sub.headers new file mode 100644 index 0000000..ac826f8 --- /dev/null +++ b/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/csp-blocked.https.tentative.html.sub.headers
@@ -0,0 +1,6 @@ +Expires: Mon, 26 Jul 1997 05:00:00 GMT +Cache-Control: no-store, no-cache, must-revalidate +Cache-Control: post-check=0, pre-check=0, false +Pragma: no-cache +Set-Cookie: csp-blocked-report-id={{$id:uuid()}}; Path=/web-bundle/subresource-loading/ +Report-To: { "group": "csp-group", "max_age": 10886400, "endpoints": [{ "url": "https://{{host}}:{{ports[https][0]}}/reporting/resources/report.py?op=put&reportID={{$id}}" }] }
diff --git a/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/subframe-from-web-bundle.https.tentative.html b/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/subframe-from-web-bundle.https.tentative.html index f6f2b769..a5bd9bc 100644 --- a/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/subframe-from-web-bundle.https.tentative.html +++ b/third_party/blink/web_tests/external/wpt/web-bundle/subresource-loading/subframe-from-web-bundle.https.tentative.html
@@ -11,6 +11,15 @@ const frame_url = 'urn:uuid:429fcc4e-0696-4bad-b099-ee9175f023ae'; +promise_test(async (t) => { + const iframe = await createLinkAndIframe(t); + // The urn:uuid URL iframe is cross-origin. So accessing + // iframe.contentWindow.location should throws a SecurityError. + assert_throws_dom( + "SecurityError", + () => { iframe.contentWindow.location.href; }); + }, 'The urn:uuid URL iframe must be cross-origin.'); + urn_uuid_iframe_test( 'location.href', frame_url, @@ -70,25 +79,30 @@ 'window.caches should be undefined.'); function urn_uuid_iframe_test(code, expected, name) { - promise_test(async () => { - const link = document.createElement('link'); - link.rel = 'webbundle'; - link.href = '../resources/wbn/urn-uuid.wbn'; - link.resources = frame_url; - document.body.appendChild(link); - const iframe = document.createElement('iframe'); - iframe.src = frame_url; - const load_promise = new Promise((resolve) => { - iframe.addEventListener('load', resolve); - }); - document.body.appendChild(iframe); - await load_promise; - assert_equals( - await evalInIframe(iframe, code), - expected); + promise_test(async (t) => { + const iframe = await createLinkAndIframe(t); + assert_equals(await evalInIframe(iframe, code), expected); + }, name); +} + +async function createLinkAndIframe(t) { + const link = document.createElement('link'); + link.rel = 'webbundle'; + link.href = '../resources/wbn/urn-uuid.wbn'; + link.resources = frame_url; + document.body.appendChild(link); + const iframe = document.createElement('iframe'); + t.add_cleanup(() => { document.body.removeChild(link); document.body.removeChild(iframe); - }, name); + }); + iframe.src = frame_url; + const load_promise = new Promise((resolve) => { + iframe.addEventListener('load', resolve); + }); + document.body.appendChild(iframe); + await load_promise; + return iframe; } async function evalInIframe(iframe, code) {
diff --git a/third_party/blink/web_tests/http/tests/devtools/elements/styles-2/inactive-properties-with-variables-expected.txt b/third_party/blink/web_tests/http/tests/devtools/elements/styles-2/inactive-properties-with-variables-expected.txt new file mode 100644 index 0000000..01a9bbd --- /dev/null +++ b/third_party/blink/web_tests/http/tests/devtools/elements/styles-2/inactive-properties-with-variables-expected.txt
@@ -0,0 +1,33 @@ +Tests that longhands overridden by a shorthand with var() are displayed as inactive in the sidebar. + +display: block; + block - div user agent stylesheet +margin-bottom: 100px; + - #inspected <style> +margin-left: 100px; + - #inspected <style> +margin-right: 100px; + - #inspected <style> +margin-top: 100px; + - #inspected <style> + OVERLOADED 1px - div <style> +[expanded] +element.style { () + +[expanded] +#inspected { (<style>) + margin: var(--m, 100px); + margin-top: ; + margin-right: ; + margin-bottom: ; + margin-left: ; + +[expanded] +div { (<style>) +/-- overloaded --/ margin-top: 1px; + +[expanded] +div { (user agent stylesheet) + display: block; + +
diff --git a/third_party/blink/web_tests/http/tests/devtools/elements/styles-2/inactive-properties-with-variables.js b/third_party/blink/web_tests/http/tests/devtools/elements/styles-2/inactive-properties-with-variables.js new file mode 100644 index 0000000..3518221a --- /dev/null +++ b/third_party/blink/web_tests/http/tests/devtools/elements/styles-2/inactive-properties-with-variables.js
@@ -0,0 +1,27 @@ +// 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. + +(async function() { + TestRunner.addResult(`Tests that longhands overridden by a shorthand with var() are displayed as inactive in the sidebar.\n`); + await TestRunner.loadModule('elements'); await TestRunner.loadTestModule('elements_test_runner'); + await TestRunner.showPanel('elements'); + await TestRunner.loadHTML(` + <style> + div { + margin-top: 1px; + } + #inspected { + margin: var(--m, 100px); + } + </style> + <div id="inspected">Test</div> + `); + + ElementsTestRunner.selectNodeAndWaitForStylesWithComputed('inspected', step1); + + async function step1() { + await ElementsTestRunner.dumpSelectedElementStyles(false, false); + TestRunner.completeTest(); + } +})();
diff --git a/third_party/blink/web_tests/platform/mac/virtual/jxl-enabled/images/jxl/jxl-images-expected.png b/third_party/blink/web_tests/platform/mac/virtual/jxl-enabled/images/jxl/jxl-images-expected.png index 338a3729..4253a841 100644 --- a/third_party/blink/web_tests/platform/mac/virtual/jxl-enabled/images/jxl/jxl-images-expected.png +++ b/third_party/blink/web_tests/platform/mac/virtual/jxl-enabled/images/jxl/jxl-images-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/jxl-enabled/images/jxl/jxl-images-expected.png b/third_party/blink/web_tests/virtual/jxl-enabled/images/jxl/jxl-images-expected.png index cf07c16..07bb176 100644 --- a/third_party/blink/web_tests/virtual/jxl-enabled/images/jxl/jxl-images-expected.png +++ b/third_party/blink/web_tests/virtual/jxl-enabled/images/jxl/jxl-images-expected.png Binary files differ
diff --git a/third_party/blink/web_tests/virtual/stable/webexposed/feature-policy-features-expected.txt b/third_party/blink/web_tests/virtual/stable/webexposed/feature-policy-features-expected.txt index c0da977..ab87e91 100644 --- a/third_party/blink/web_tests/virtual/stable/webexposed/feature-policy-features-expected.txt +++ b/third_party/blink/web_tests/virtual/stable/webexposed/feature-policy-features-expected.txt
@@ -9,6 +9,7 @@ ch-dpr ch-ect ch-lang +ch-prefers-color-scheme ch-rtt ch-ua ch-ua-arch
diff --git a/third_party/blink/web_tests/webexposed/feature-policy-features-expected.txt b/third_party/blink/web_tests/webexposed/feature-policy-features-expected.txt index f3a73b1b..59ecdc54 100644 --- a/third_party/blink/web_tests/webexposed/feature-policy-features-expected.txt +++ b/third_party/blink/web_tests/webexposed/feature-policy-features-expected.txt
@@ -11,6 +11,7 @@ ch-dpr ch-ect ch-lang +ch-prefers-color-scheme ch-rtt ch-ua ch-ua-arch
diff --git a/third_party/protobuf/proto_library.gni b/third_party/protobuf/proto_library.gni index bf0b143..a6943f5 100644 --- a/third_party/protobuf/proto_library.gni +++ b/third_party/protobuf/proto_library.gni
@@ -314,17 +314,8 @@ ":$javascript_name", ":$source_set_name", ] - if ((defined(invoker.run_under_python2) && invoker.run_under_python2) || - true) { - # TODO(crbug.com/1112471) - get all users of this to run cleanly under - # Python 3 and then remove this option. - script = "//build/util/python2_action.py" - args = [ rebase_path("//tools/protoc_wrapper/protoc_wrapper.py", - root_build_dir) ] + protos - } else { - script = "//tools/protoc_wrapper/protoc_wrapper.py" - args = protos - } + script = "//tools/protoc_wrapper/protoc_wrapper.py" + args = protos sources = proto_sources outputs = get_path_info(protogens + protogens_cc + protogens_js, "abspath")
diff --git a/tools/android/modularization/convenience/lookup_dep.py b/tools/android/modularization/convenience/lookup_dep.py index 1c3c9bff..c10429e82 100755 --- a/tools/android/modularization/convenience/lookup_dep.py +++ b/tools/android/modularization/convenience/lookup_dep.py
@@ -219,18 +219,19 @@ def _compute_full_class_names_for_build_config(self, deps_info: Dict) -> Set[str]: """Returns set of fully qualified class names for build config.""" + + full_class_names = set() + # Read the location of the java_sources_file from the build_config sources_path = deps_info.get('java_sources_file') if sources_path: # Read the java_sources_file, indexing the classes found with open(self._abs_build_output_dir / sources_path) as sources_contents: - out = set() for source_line in sources_contents: source_path = pathlib.Path(source_line.strip()) java_class = self._parse_full_java_class(source_path) if java_class: - out.add(java_class) - return out + full_class_names.add(java_class) # |unprocessed_jar_path| is set for prebuilt targets. (ex: # android_aar_prebuilt()) @@ -245,10 +246,11 @@ abs_unprocessed_jar_path = (abs_unprocessed_jar_path.parent.resolve() / abs_unprocessed_jar_path.name) - return self._extract_full_class_names_from_jar( - self._abs_build_output_dir, abs_unprocessed_jar_path) + full_class_names.update( + self._extract_full_class_names_from_jar(self._abs_build_output_dir, + abs_unprocessed_jar_path)) - return set() + return full_class_names @staticmethod def _extract_full_class_names_from_jar(abs_build_output_dir: pathlib.Path,
diff --git a/tools/binary_size/libsupersize/apkanalyzer.py b/tools/binary_size/libsupersize/apkanalyzer.py index 59ac9b0..a53e793c 100644 --- a/tools/binary_size/libsupersize/apkanalyzer.py +++ b/tools/binary_size/libsupersize/apkanalyzer.py
@@ -178,28 +178,38 @@ return outer_class, full_name # Example: package.AnimatedProgressBar$$InternalSyntheticLambda$3$81073ff6$0 + # Example: package.Class$$Lambda$2$$InternalSyntheticOutline$8$cbe941dd782$0 match = re.fullmatch( - r'(.+)\$\$InternalSyntheticLambda\$\d+\$[0-9a-f]+\$\d+', class_path) + # The base_name group needs to be non-greedy/minimal (using +?) since we + # want it to not include $$Lambda$28 when present. + r'(?P<base_name>.+?)(\$\$Lambda\$\d+)?' + r'\$\$InternalSynthetic(Lambda|Outline)' + r'\$\d+\$[0-9a-f]+\$\d+', + class_path) if match: new_name = self._GetLambdaName(class_path=class_path, - base_name=match.group(1)) + base_name=match.group('base_name')) return outer_class, full_name.replace(class_path, new_name) # Example: AnimatedProgressBar$$ExternalSyntheticLambda0 - match = re.fullmatch(r'(.+)\$\$ExternalSyntheticLambda\d+', class_path) + # Example: AutofillAssistant$$Lambda$2$$ExternalSyntheticOutline0 + match = re.fullmatch( + r'(?P<base_name>.+?)(\$\$Lambda\$\d+)?' + r'\$\$ExternalSynthetic(Lambda|Outline)\d+', class_path) if match: new_name = self._GetLambdaName(class_path=class_path, - base_name=match.group(1), + base_name=match.group('base_name'), prefix=_OUTLINED_PREFIX) return outer_class, full_name.replace(class_path, new_name) # Example: package.FirebaseInstallationsRegistrar$$Lambda$1 - match = re.fullmatch(r'(.+)\$\$Lambda\$\d+', class_path) + match = re.fullmatch(r'(?P<base_name>.+)\$\$Lambda\$\d+', class_path) if match: # Although these are already valid names, re-number them to avoid name # collisions with renamed InternalSyntheticLambdas. new_name = self._GetLambdaName(class_path=class_path, - base_name=match.group(1)) + base_name=match.group('base_name')) return outer_class, full_name.replace(class_path, new_name) # Example: org.-$$Lambda$StackAnimation$Nested1$kjevdDQ8V2zqCrdieLqWLHzk + # Assume that the last portion of the name after $ is the hash identifier. match = re.fullmatch( r'(?P<package>.+)-\$\$Lambda\$(?P<class>[^$]+)(?P<nested>.*)\$[^$]+', class_path)
diff --git a/tools/binary_size/libsupersize/apkanalyzer_test.py b/tools/binary_size/libsupersize/apkanalyzer_test.py index 18d3b92..01f5119 100755 --- a/tools/binary_size/libsupersize/apkanalyzer_test.py +++ b/tools/binary_size/libsupersize/apkanalyzer_test.py
@@ -115,6 +115,13 @@ expected_name=('$$Outlined$AnimatedProgressBar$$Lambda$0'), ) + def testLambdaNormalizer_externalSyntheticOutlineLambda(self): + self.assertNormalizedTo( + class_path='AutofillAssistant$$Lambda$2$$ExternalSyntheticOutline0', + expected_outer_class='AutofillAssistant', + expected_name=('$$Outlined$AutofillAssistant$$Lambda$0'), + ) + def testLambdaNormalizer_internalSyntheticLambda(self): self.assertNormalizedTo( class_path= @@ -124,6 +131,15 @@ expected_name='package.AnimatedProgressBar$$Lambda$0', ) + def testLambdaNormalizer_internalSyntheticOutlineLambda(self): + self.assertNormalizedTo( + class_path= + # pylint: disable=line-too-long + 'package.ChromeActivity$$Lambda$28$$InternalSyntheticOutline$807$cbe941dd7bdbd82d4d93f21de2ea4e38c4468513f97dc90dcb54501b2fc335a6$0', + expected_outer_class='package.ChromeActivity', + expected_name='package.ChromeActivity$$Lambda$0', + ) + def testLambdaNormalizer_oldLambdaFormat(self): self.assertNormalizedTo( class_path=
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 87bfa43..9ad5dc3 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -5030,6 +5030,14 @@ <int value="3" label="Already installed"/> </enum> +<enum name="AutofillAssistantInChromeTriggerAction"> + <int value="0" label="Other"/> + <int value="1" label="User denylisted domain"/> + <int value="2" label="Cache hit, unsupported domain"/> + <int value="3" label="No heuristic match"/> + <int value="4" label="Trigger script requested"/> +</enum> + <enum name="AutofillAssistantLiteScriptFinished"> <int value="0" label="Unknown failure"/> <int value="1" label="Service deleted"/> @@ -5134,14 +5142,18 @@ <enum name="AutofillAssistantTriggerUIType"> <int value="0" label="UNSPECIFIED_TRIGGER_UI_TYPE"/> - <int value="1" label="CART_FIRST_TIME_USER"/> - <int value="2" label="CART_RETURNING_USER"/> - <int value="3" label="CHECKOUT_FIRST_TIME_USER"/> - <int value="4" label="CHECKOUT_RETURNING_TIME_USER"/> - <int value="5" label="IN_CHROME_CART_FIRST_TIME_USER"/> - <int value="6" label="IN_CHROME_CART_RETURNING_USER"/> - <int value="7" label="IN_CHROME_CHECKOUT_FIRST_TIME_USER"/> - <int value="8" label="IN_CHROME_CHECKOUT_RETURNING_USER"/> + <int value="1" label="(External) Shopping cart, first time user"/> + <int value="2" label="(External) Shopping cart, returning user"/> + <int value="3" label="(External) Shopping checkout, first time user"/> + <int value="4" label="(External) Shopping checkout, returning user"/> + <int value="5" label="(In-Chrome) Shopping cart, first time user"/> + <int value="6" label="(In-Chrome) Shopping cart, returning user"/> + <int value="7" label="(In-Chrome) Shopping checkout, first time user"/> + <int value="8" label="(In-Chrome) Shopping checkout, returning user"/> + <int value="9" label="(External) Food ordering cart, first time user"/> + <int value="10" label="(External) Food ordering cart, returning user"/> + <int value="11" label="(In-Chrome) Food ordering cart, first time user"/> + <int value="12" label="(In-Chrome) Food ordering cart, returning user"/> </enum> <enum name="AutofillAwGSuggestionAvailability"> @@ -18438,6 +18450,8 @@ <int value="55" label="CorsIssue::PreflightInvalidAllowExternal"/> <int value="56" label="CorsIssue::InvalidResponse"/> <int value="57" label="CorsIssue::NoCorsRedirectModeNotFollow"/> + <int value="58" label="QuirksModeIssue::QuirksMode"/> + <int value="59" label="QuirksModeIssue::LimitedQuirksMode"/> </enum> <enum name="DevToolsIssuesPanelIssueExpanded"> @@ -32517,6 +32531,7 @@ <int value="3912" label="SVGText"/> <int value="3913" label="GetBBoxForText"/> <int value="3914" label="SVGTextHangingFromPath"/> + <int value="3915" label="ClientHintsPrefersColorScheme"/> </enum> <enum name="FeaturePolicyAllowlistType"> @@ -32621,6 +32636,7 @@ <int value="82" label="InterestCohort"/> <int value="83" label="SharedAutofill"/> <int value="84" label="DirectSockets"/> + <int value="85" label="ClientHintPrefersColorScheme"/> </enum> <enum name="FeaturePolicyImageCompressionFormat"> @@ -71521,6 +71537,9 @@ <int value="5" label="PS disabled, block all cookies"/> <int value="6" label="PS disabled, policy block 3P cookies"/> <int value="7" label="PS disabled, policy block all cookies"/> + <int value="8" label="PS enabled, FLoC disabled, allow all cookies"/> + <int value="9" label="PS enabled, FLoC disabled, block 3P cookies"/> + <int value="10" label="PS enabled, FLoC disabled, block all cookies"/> </enum> <enum name="SettingsResetPromptConfigError">
diff --git a/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml b/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml index 43067f5..ee3ebb1 100644 --- a/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/accessibility/histograms.xml
@@ -256,7 +256,7 @@ </histogram> <histogram name="Accessibility.CrosCursorHighlight" enum="BooleanEnabled" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dmazzoni@chromium.org</owner> <owner>chrome-a11y-core@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/apps/histograms.xml b/tools/metrics/histograms/histograms_xml/apps/histograms.xml index 182f9a11..2452d97a 100644 --- a/tools/metrics/histograms/histograms_xml/apps/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/apps/histograms.xml
@@ -2131,7 +2131,7 @@ </histogram> <histogram name="Apps.StateTransition.AnimationSmoothness" units="%" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <!-- Name completed by histogram_suffixes name="TabletOrClamshellMode" and name="EnterOrExitOverview" and
diff --git a/tools/metrics/histograms/histograms_xml/arc/histograms.xml b/tools/metrics/histograms/histograms_xml/arc/histograms.xml index ae7845d8..b6c6bb5 100644 --- a/tools/metrics/histograms/histograms_xml/arc/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/arc/histograms.xml
@@ -230,7 +230,7 @@ </histogram> <histogram base="true" name="Arc.Auth.Checkin.Attempts" units="attempts" - expires_after="2021-09-15"> + expires_after="2021-11-14"> <!-- Name completed by histogram_suffixes name="ArcUserTypes" --> <owner>mhasank@google.com</owner> @@ -243,7 +243,7 @@ </histogram> <histogram base="true" name="Arc.Auth.Checkin.TimeDelta" units="ms" - expires_after="2021-09-15"> + expires_after="2021-11-14"> <!-- Name completed by histogram_suffixes name="ArcUserTypes" --> <owner>mhasank@google.com</owner> @@ -274,7 +274,7 @@ </histogram> <histogram base="true" name="Arc.Auth.SignIn.TimeDelta" units="ms" - expires_after="2021-09-15"> + expires_after="2021-11-14"> <!-- Name completed by histogram_suffixes name="ArcUserTypes" --> <owner>mhasank@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/ash/histograms.xml b/tools/metrics/histograms/histograms_xml/ash/histograms.xml index d1e4f75..e0cdfb8 100644 --- a/tools/metrics/histograms/histograms_xml/ash/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ash/histograms.xml
@@ -1536,7 +1536,7 @@ </histogram> <histogram name="Ash.NightLight.ScheduleType" enum="AshNightLightScheduleType" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>afakhry@chromium.org</owner> <summary> The selected Night Light schedule type. Emitted when the user changes the
diff --git a/tools/metrics/histograms/histograms_xml/assistant/histograms.xml b/tools/metrics/histograms/histograms_xml/assistant/histograms.xml index 8b9466b3..98f6ed96 100644 --- a/tools/metrics/histograms/histograms_xml/assistant/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/assistant/histograms.xml
@@ -283,7 +283,7 @@ </histogram> <histogram name="QuickAnswers.ActiveImpression.Duration" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>llin@google.com</owner> <owner>croissant-eng@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/background/histograms.xml b/tools/metrics/histograms/histograms_xml/background/histograms.xml index fca49e98..4aa8bdd 100644 --- a/tools/metrics/histograms/histograms_xml/background/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/background/histograms.xml
@@ -360,7 +360,7 @@ <histogram name="BackgroundSync.Registration.OneShot.EventSucceededAtCompletion" - enum="BooleanSuccess" expires_after="2021-09-12"> + enum="BooleanSuccess" expires_after="2021-11-14"> <owner>nator@chromium.org</owner> <owner>rayankans@chromium.org</owner> <owner>peter@chromium.org</owner> @@ -382,7 +382,7 @@ <histogram name="BackgroundSync.Registration.OneShot.NumAttemptsForSuccessfulEvent" - units="attempts" expires_after="2021-09-12"> + units="attempts" expires_after="2021-11-14"> <owner>nator@chromium.org</owner> <owner>rayankans@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/blink/histograms.xml b/tools/metrics/histograms/histograms_xml/blink/histograms.xml index 3763d0f..b7d9e42 100644 --- a/tools/metrics/histograms/histograms_xml/blink/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/blink/histograms.xml
@@ -1456,7 +1456,7 @@ </histogram> <histogram base="true" name="Blink.ImageDecoders.IncrementallyDecodedByteSize" - units="bytes" expires_after="2021-09-12"> + units="bytes" expires_after="2021-11-14"> <owner>mbarowsky@chromium.org</owner> <owner>andrescj@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/bluetooth/histograms.xml b/tools/metrics/histograms/histograms_xml/bluetooth/histograms.xml index e7b5dfc..acdde7a 100644 --- a/tools/metrics/histograms/histograms_xml/bluetooth/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/bluetooth/histograms.xml
@@ -157,7 +157,7 @@ </histogram> <histogram name="Bluetooth.ChromeOS.UserInitiatedReconnectionAttempt.Result" - enum="BooleanSuccess" expires_after="2021-09-12"> + enum="BooleanSuccess" expires_after="2021-11-14"> <!-- Name completed by histogram_suffixes name="BluetoothUISurfaces" --> <owner>hansberry@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/browser/histograms.xml b/tools/metrics/histograms/histograms_xml/browser/histograms.xml index c7dd471d..55a63b5 100644 --- a/tools/metrics/histograms/histograms_xml/browser/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/browser/histograms.xml
@@ -513,7 +513,7 @@ </histogram> <histogram base="true" name="Browser.Tabs.TabSwitchResult" - enum="TabSwitchResult" expires_after="2021-09-12"> + enum="TabSwitchResult" expires_after="2021-11-14"> <!-- Name completed by histogram_suffixes name="TabSwitchingType" --> <owner>fdoray@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/cookie/histograms.xml b/tools/metrics/histograms/histograms_xml/cookie/histograms.xml index 087aef8..3688a1d 100644 --- a/tools/metrics/histograms/histograms_xml/cookie/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cookie/histograms.xml
@@ -110,7 +110,6 @@ <histogram name="Cookie.CorruptMetaTable" units="units" expires_after="2021-06-25"> <owner>chlily@chromium.org</owner> - <owner>tnagel@chromium.org</owner> <summary> Records the detection of a corrupted meta table. See http://crbug.com/111376 .
diff --git a/tools/metrics/histograms/histograms_xml/cros/histograms.xml b/tools/metrics/histograms/histograms_xml/cros/histograms.xml index 3ef3105..dd5637d 100644 --- a/tools/metrics/histograms/histograms_xml/cros/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cros/histograms.xml
@@ -84,7 +84,7 @@ </histogram> <histogram name="CrosDisksClient.FormatCompletedError" - enum="CrosDisksClientFormatError" expires_after="2021-09-12"> + enum="CrosDisksClientFormatError" expires_after="2021-11-14"> <owner>austinct@chromium.org</owner> <summary> The error code of disk format signals received from the Chrome OS cros-disks
diff --git a/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml b/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml index 52eb2b0..93ab3534 100644 --- a/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/cryptohome/histograms.xml
@@ -213,7 +213,7 @@ </histogram> <histogram name="Cryptohome.Errors" enum="CryptohomeError" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>apronin@chromium.org</owner> <owner>cros-hwsec+uma@chromium.org</owner> <summary>Cryptohome errors.</summary>
diff --git a/tools/metrics/histograms/histograms_xml/custom_tabs/histograms.xml b/tools/metrics/histograms/histograms_xml/custom_tabs/histograms.xml index edfe695..edf28aa3 100644 --- a/tools/metrics/histograms/histograms_xml/custom_tabs/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/custom_tabs/histograms.xml
@@ -35,7 +35,7 @@ </histogram> <histogram name="CustomTabs.ClientAppId" enum="ClientAppId" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>yusufo@chromium.org</owner> <summary> Android: AppId declared by the launching application in EXTRA_APPLICATION_ID
diff --git a/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml b/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml index decc0cd..ab98b2be 100644 --- a/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/data_reduction_proxy/histograms.xml
@@ -385,7 +385,7 @@ </histogram> <histogram name="DataReductionProxy.StartupState" - enum="DataReductionProxyStartupState" expires_after="2021-09-12"> + enum="DataReductionProxyStartupState" expires_after="2021-11-14"> <owner>rajendrant@chromium.org</owner> <owner>tbansal@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/disk/histograms.xml b/tools/metrics/histograms/histograms_xml/disk/histograms.xml index 25ea916..2719ecd 100644 --- a/tools/metrics/histograms/histograms_xml/disk/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/disk/histograms.xml
@@ -292,6 +292,9 @@ </histogram> <histogram name="DiskCache.0.LoadTime" units="ms" expires_after="M85"> + <obsolete> + Removed 05/2021. Not used. + </obsolete> <owner>rvargas@chromium.org</owner> <summary> The time to load the main entry data from disk, with a "loaded" @@ -780,6 +783,9 @@ </histogram> <histogram name="DiskCache.2.LoadTime" units="ms" expires_after="M85"> + <obsolete> + Removed 05/2021. Not used. + </obsolete> <owner>rvargas@chromium.org</owner> <summary> The time to load the main entry data from disk, with a "loaded" @@ -1203,6 +1209,9 @@ </histogram> <histogram name="DiskCache.3.LoadTime" units="ms" expires_after="M79"> + <obsolete> + Removed 05/2021. Not used. + </obsolete> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <summary> The time to load the main entry data from disk, with a "loaded" @@ -1594,6 +1603,9 @@ </histogram> <histogram name="DiskCache.4.LoadTime" units="ms" expires_after="M79"> + <obsolete> + Removed 05/2021. Not used. + </obsolete> <owner>Please list the metric's owners. Add more owner tags as needed.</owner> <summary> The time to load the main entry data from disk, with a "loaded"
diff --git a/tools/metrics/histograms/histograms_xml/download/histograms.xml b/tools/metrics/histograms/histograms_xml/download/histograms.xml index 61cbc678..9f5fa7a0 100644 --- a/tools/metrics/histograms/histograms_xml/download/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/download/histograms.xml
@@ -83,7 +83,7 @@ </histogram> <histogram base="true" name="Download.Counts" enum="DownloadCountType" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <!-- Name completed by histogram_suffixes name="DownloadSource" --> <owner>xingliu@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/event/histograms.xml b/tools/metrics/histograms/histograms_xml/event/histograms.xml index 97212feb..2dc3833d 100644 --- a/tools/metrics/histograms/histograms_xml/event/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/event/histograms.xml
@@ -281,7 +281,7 @@ </histogram> <histogram name="Event.Latency.EndToEnd.KeyPress" units="microseconds" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>flackr@chromium.org</owner> <owner>input-dev@chromium.org</owner> <summary> @@ -344,7 +344,7 @@ </histogram> <histogram name="Event.Latency.HitTest" units="microseconds" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>schenney@chromium.org</owner> <owner>paint-dev@chromium.org</owner> <summary> @@ -363,7 +363,7 @@ </histogram> <histogram name="Event.Latency.HitTestRecursive" units="microseconds" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>schenney@chromium.org</owner> <owner>paint-dev@chromium.org</owner> <summary> @@ -658,7 +658,7 @@ </histogram> <histogram name="Event.Latency.ScrollBegin.TimeToScrollUpdateSwapBegin2" - units="microseconds" expires_after="2021-09-12"> + units="microseconds" expires_after="2021-11-14"> <owner>nzolghadr@chromium.org</owner> <summary> Time between initial creation of a wheel/touch event and start of the frame @@ -1824,7 +1824,7 @@ </histogram> <histogram base="true" name="EventLatency" units="microseconds" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>mohsen@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml index fe64598..686bb775 100644 --- a/tools/metrics/histograms/histograms_xml/extensions/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/extensions/histograms.xml
@@ -582,7 +582,7 @@ </histogram> <histogram name="Extensions.DeclarativeNetRequest.CreateVerifiedMatcherTime" - units="ms" expires_after="2021-09-12"> + units="ms" expires_after="2021-11-14"> <owner>karandeepb@chromium.org</owner> <owner>extensions-core@chromium.org</owner> <summary> @@ -633,7 +633,7 @@ </histogram> <histogram name="Extensions.DeclarativeNetRequest.IsLargeRegexRule" - enum="RegexRuleStatus" expires_after="2021-09-12"> + enum="RegexRuleStatus" expires_after="2021-11-14"> <owner>karandeepb@chromium.org</owner> <owner>extensions-core@chromium.org</owner> <summary> @@ -643,7 +643,7 @@ </histogram> <histogram name="Extensions.DeclarativeNetRequest.LoadRulesetResult" - enum="LoadRulesetResult" expires_after="2021-09-12"> + enum="LoadRulesetResult" expires_after="2021-11-14"> <owner>karandeepb@chromium.org</owner> <owner>extensions-core@chromium.org</owner> <summary> @@ -724,7 +724,7 @@ </histogram> <histogram name="Extensions.DeclarativeNetRequest.ResponseHeaderAdded" - enum="WebRequest.ResponseHeader" expires_after="2021-09-05"> + enum="WebRequest.ResponseHeader" expires_after="2021-11-14"> <owner>karandeepb@chromium.org</owner> <owner>rdevlin.cronin@chromium.org</owner> <owner>kelvinjiang@chromium.org</owner> @@ -772,7 +772,7 @@ </histogram> <histogram name="Extensions.DeclarativeNetRequest.UpdateDynamicRulesStatus" - enum="UpdateDynamicRulesStatus" expires_after="2021-09-12"> + enum="UpdateDynamicRulesStatus" expires_after="2021-11-14"> <owner>karandeepb@chromium.org</owner> <owner>rdevlin.cronin@chromium.org</owner> <summary> @@ -1245,7 +1245,7 @@ </histogram> <histogram name="Extensions.ExtensionUninstalled" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>rdevlin.cronin@chromium.org</owner> <owner>extensions-core@chromium.org</owner> <summary>An extension has been uninstalled.</summary> @@ -3475,7 +3475,7 @@ </histogram> <histogram name="Extensions.UsedMimeTypeHandler" enum="UsedMimeTypeHandler" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>apotapchuk@chromium.org</owner> <owner>anqing@chromium.org</owner> <summary> @@ -3671,7 +3671,7 @@ </histogram> <histogram name="Extensions.WebRequestBlockingCount" units="extensions" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>karandeepb@chromium.org</owner> <owner>extensions-core@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/gcm/histograms.xml b/tools/metrics/histograms/histograms_xml/gcm/histograms.xml index 6def5ae..2714986 100644 --- a/tools/metrics/histograms/histograms_xml/gcm/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/gcm/histograms.xml
@@ -306,7 +306,7 @@ </histogram> <histogram name="GCM.RegistrationRequestStatus" - enum="GCMRegistrationRequestStatus" expires_after="2021-09-12"> + enum="GCMRegistrationRequestStatus" expires_after="2021-11-14"> <owner>peter@chromium.org</owner> <summary> Status code of the outcome of a GCM registration request. The Unknown error
diff --git a/tools/metrics/histograms/histograms_xml/gpu/histograms.xml b/tools/metrics/histograms/histograms_xml/gpu/histograms.xml index 9d2a886..cc62c10 100644 --- a/tools/metrics/histograms/histograms_xml/gpu/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/gpu/histograms.xml
@@ -789,7 +789,7 @@ </histogram> <histogram name="GPU.GPUProcessLaunchTime" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>vmiura@chromium.org</owner> <summary> Startup time of the GPU process as measured by the GPU process host.
diff --git a/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml b/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml index c282cb4..601939c4 100644 --- a/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml +++ b/tools/metrics/histograms/histograms_xml/histogram_suffixes_list.xml
@@ -12408,6 +12408,7 @@ <suffix name="Connect.Next" label=""/> <suffix name="Connect.SetupDemo" label=""/> <suffix name="Connect.StartDemo" label=""/> + <suffix name="Connect.StartOsInstall" label=""/> <suffix name="Debugging.Next" label=""/> <suffix name="Demo-preferences.Canceled" label=""/> <suffix name="Demo-preferences.Completed" label=""/>
diff --git a/tools/metrics/histograms/histograms_xml/ios/histograms.xml b/tools/metrics/histograms/histograms_xml/ios/histograms.xml index 49a5de1..6a32532 100644 --- a/tools/metrics/histograms/histograms_xml/ios/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ios/histograms.xml
@@ -583,7 +583,7 @@ </histogram> <histogram name="IOS.MetricKit.ApplicationResumeTime" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>justincohen@chromium.org</owner> <owner>olivierrobin@chromium.org</owner> <summary> @@ -736,7 +736,7 @@ </histogram> <histogram name="IOS.MultiWindow.OpenInNewWindow" enum="WindowActivityOrigin" - expires_after="2021-08-29"> + expires_after="2021-11-14"> <owner>marq@chromium.org</owner> <owner>djean@chromium.org</owner> <summary> @@ -756,7 +756,7 @@ </histogram> <histogram name="IOS.NTP.Impression" enum="IOSNTPImpression" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>gambard@chromium.org</owner> <summary> The type of NTP impressions on iOS, split by type of suggestions shown @@ -1000,7 +1000,7 @@ </summary> </histogram> -<histogram name="IOS.Snapshots.CacheSize" units="KB" expires_after="2021-09-12"> +<histogram name="IOS.Snapshots.CacheSize" units="KB" expires_after="2021-11-14"> <owner>ajuma@chromium.org</owner> <owner>edchin@chromium.org</owner> <summary> @@ -1052,7 +1052,7 @@ </histogram> <histogram name="IOS.Spotlight.BookmarksInitialIndexSize" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>olivierrobin@chromium.org</owner> <owner>rohitrao@chromium.org</owner> <summary>Number of bookmarks indexed during initial indexation.</summary>
diff --git a/tools/metrics/histograms/histograms_xml/login/histograms.xml b/tools/metrics/histograms/histograms_xml/login/histograms.xml index c7ebb3bc..f1edd47 100644 --- a/tools/metrics/histograms/histograms_xml/login/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/login/histograms.xml
@@ -204,7 +204,7 @@ </histogram> <histogram name="Login.PromptToCompleteLoginTime" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>rsorokin@chromium.org</owner> <owner>achuith@chromium.org</owner> <owner>cros-oac@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/media/histograms.xml b/tools/metrics/histograms/histograms_xml/media/histograms.xml index 5aa40f7..a4aa4cc3 100644 --- a/tools/metrics/histograms/histograms_xml/media/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/media/histograms.xml
@@ -1469,7 +1469,7 @@ </histogram> <histogram name="Media.D3D11.H264Status" enum="MediaStatusCode" - expires_after="2021-08-15"> + expires_after="2021-11-14"> <owner>liberato@chromium.org</owner> <owner>tmathmeyer@chromium.org</owner> <summary> @@ -1651,7 +1651,7 @@ </histogram> <histogram base="true" name="Media.EME.CdmFileIO.TimeTo" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>jrummell@chromium.org</owner> <owner>media-dev@chromium.org</owner> <summary> @@ -4115,7 +4115,7 @@ </summary> </histogram> -<histogram name="Media.Video.Roughness" units="ms" expires_after="2021-09-12"> +<histogram name="Media.Video.Roughness" units="ms" expires_after="2021-11-14"> <owner>eugene@chromium.org</owner> <owner>videostack-eng@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/memory/histograms.xml b/tools/metrics/histograms/histograms_xml/memory/histograms.xml index f668ab9..181137e 100644 --- a/tools/metrics/histograms/histograms_xml/memory/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/memory/histograms.xml
@@ -352,7 +352,7 @@ </histogram> <histogram name="Memory.Browser.MemoryFootprint.NumOpenTabs" units="tabs" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>ajuma@chromium.org</owner> <owner>rkgibson@google.com</owner> <summary> @@ -497,7 +497,7 @@ </histogram> <histogram name="Memory.Discardable.LockingSuccess" - enum="BooleanLockingSuccess" expires_after="2021-09-12"> + enum="BooleanLockingSuccess" expires_after="2021-11-14"> <owner>thiabaud@google.com</owner> <owner>lizeb@chromium.org</owner> <summary> @@ -1097,7 +1097,7 @@ </histogram> <histogram name="Memory.Experimental.Renderer.HighestPrivateMemoryFootprint" - units="MB" expires_after="2021-09-12"> + units="MB" expires_after="2021-11-14"> <owner>tasak@google.com</owner> <owner>bartekn@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/navigation/histograms.xml b/tools/metrics/histograms/histograms_xml/navigation/histograms.xml index c3b6eb9a..8a8ba323 100644 --- a/tools/metrics/histograms/histograms_xml/navigation/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/navigation/histograms.xml
@@ -818,7 +818,7 @@ </histogram> <histogram name="Navigation.IsSameSiteInstance" - enum="NavigationIsSameSiteInstance" expires_after="2021-09-12"> + enum="NavigationIsSameSiteInstance" expires_after="2021-11-14"> <owner>arthursonzogni@chromium.org</owner> <owner>clamy@chromium.org</owner> <owner>nasko@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/net/histograms.xml b/tools/metrics/histograms/histograms_xml/net/histograms.xml index 321823d..2e8bcb1 100644 --- a/tools/metrics/histograms/histograms_xml/net/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/net/histograms.xml
@@ -51,7 +51,7 @@ </histogram> <histogram name="Net.AlternateProtocolUsage" enum="AlternateProtocolUsage" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/OWNERS</owner> <summary> @@ -61,7 +61,7 @@ </histogram> <histogram name="Net.AlternateProtocolUsageGoogle" - enum="AlternateProtocolUsage" expires_after="2021-09-12"> + enum="AlternateProtocolUsage" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/OWNERS</owner> <summary> @@ -383,7 +383,7 @@ </histogram> <histogram name="Net.ConnectionInfo.MainFrame" enum="ConnectionInfo" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/OWNERS</owner> <summary> @@ -996,7 +996,7 @@ <histogram name="Net.DNS.HTTPSSVC.RecordHttps.AnyProvider.ExpectNoerror.Parsable" - enum="BooleanValid" expires_after="2021-09-14"> + enum="BooleanValid" expires_after="2021-11-14"> <owner>ericorth@chromium.org</owner> <owner>dmcardle@chromium.org</owner> <summary> @@ -1483,7 +1483,7 @@ </histogram> <histogram base="true" name="Net.DNS.UI.DropdownSelectionEvent" - enum="DohProviderId" expires_after="2021-09-12"> + enum="DohProviderId" expires_after="2021-11-14"> <!-- Name completed by histogram_suffixes name="DnsDropdownSelectionEvent" --> @@ -1980,7 +1980,7 @@ </histogram> <histogram name="Net.HttpProxy.ConnectLatency" units="ms" - expires_after="2021-09-14"> + expires_after="2021-11-14"> <owner>eroman@chromium.org</owner> <owner>tbansal@chromium.org</owner> <summary> @@ -2385,7 +2385,7 @@ </histogram> <histogram name="Net.QuicActiveSessions" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -2755,7 +2755,7 @@ </histogram> <histogram name="Net.QuicNumSentClientHellos" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary>The number of client hello messages sent.</summary> @@ -3038,7 +3038,7 @@ </histogram> <histogram name="Net.QuicSession.ConnectionCloseErrorCodeClient" - enum="QuicErrorCodes" expires_after="2021-09-12"> + enum="QuicErrorCodes" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3048,7 +3048,7 @@ </histogram> <histogram name="Net.QuicSession.ConnectionCloseErrorCodeClientGoogle" - enum="QuicErrorCodes" expires_after="2021-09-12"> + enum="QuicErrorCodes" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3058,7 +3058,7 @@ </histogram> <histogram name="Net.QuicSession.ConnectionCloseErrorCodeServer" - enum="QuicErrorCodes" expires_after="2021-09-12"> + enum="QuicErrorCodes" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3068,7 +3068,7 @@ </histogram> <histogram name="Net.QuicSession.ConnectionCloseErrorCodeServerGoogle" - enum="QuicErrorCodes" expires_after="2021-09-12"> + enum="QuicErrorCodes" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3334,7 +3334,7 @@ </histogram> <histogram name="Net.QuicSession.FinchConfigIsValid" enum="Boolean" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3387,7 +3387,7 @@ </histogram> <histogram name="Net.QuicSession.HandshakeConfirmedTime" units="Milliseconds" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3625,7 +3625,7 @@ </histogram> <histogram name="Net.QuicSession.MaxReorderingTimeLongRtt" units="%" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3644,7 +3644,7 @@ </summary> </histogram> -<histogram name="Net.QuicSession.MinRTT" units="ms" expires_after="2021-09-12"> +<histogram name="Net.QuicSession.MinRTT" units="ms" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3699,7 +3699,7 @@ </histogram> <histogram name="Net.QuicSession.NumPendingStreamRequests" - units="stream requests" expires_after="2021-09-12"> + units="stream requests" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3803,7 +3803,7 @@ </histogram> <histogram name="Net.QuicSession.PacketLossRate" units="1/10th Percent" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3813,7 +3813,7 @@ </histogram> <histogram name="Net.QuicSession.PacketRetransmitsPerMille" units="permille" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3863,7 +3863,7 @@ </histogram> <histogram name="Net.QuicSession.PortMigration" - enum="QuicConnectionMigrationStatus" expires_after="2021-09-12"> + enum="QuicConnectionMigrationStatus" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary>The result of a QUIC port migration attempt.</summary> @@ -3920,7 +3920,7 @@ </histogram> <histogram name="Net.QuicSession.PushedAndClaimed" units="count" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -3990,14 +3990,14 @@ </histogram> <histogram name="Net.QuicSession.QuicVersion" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary>Version of the QUIC protocol used for this connection.</summary> </histogram> <histogram name="Net.QuicSession.ReadError" enum="NetErrorCodes" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4007,7 +4007,7 @@ </histogram> <histogram name="Net.QuicSession.ReadError.CurrentNetwork.HandshakeConfirmed" - enum="NetErrorCodes" expires_after="2021-09-12"> + enum="NetErrorCodes" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4162,7 +4162,7 @@ </histogram> <histogram name="Net.QuicSession.SmoothedRTT" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4242,7 +4242,7 @@ </histogram> <histogram name="Net.QuicSession.StreamCloseErrorCodeServer.HandshakeConfirmed" - enum="QuicErrorCodes" expires_after="2021-09-12"> + enum="QuicErrorCodes" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4324,7 +4324,7 @@ </histogram> <histogram name="Net.QuicSession.TimedOutWithOpenStreams.HasUnackedPackets" - units="units" expires_after="2021-09-12"> + units="units" expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4448,7 +4448,7 @@ </histogram> <histogram name="Net.QuicSession.VerifyProofTime" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4459,7 +4459,7 @@ </histogram> <histogram name="Net.QuicSession.WriteError" enum="NetErrorCodes" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4499,7 +4499,7 @@ </histogram> <histogram name="Net.QuicSession.ZeroRttReason" - enum="SSLHandshakeEarlyDataReason" expires_after="2021-09-12"> + enum="SSLHandshakeEarlyDataReason" expires_after="2021-11-14"> <owner>nharper@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4509,7 +4509,7 @@ </histogram> <histogram name="Net.QuicSession.ZeroRttReasonGoogle" - enum="SSLHandshakeEarlyDataReason" expires_after="2021-09-12"> + enum="SSLHandshakeEarlyDataReason" expires_after="2021-11-14"> <owner>renjietang@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4520,7 +4520,7 @@ </histogram> <histogram name="Net.QuicSession.ZeroRttReasonNonGoogle" - enum="SSLHandshakeEarlyDataReason" expires_after="2021-09-12"> + enum="SSLHandshakeEarlyDataReason" expires_after="2021-11-14"> <owner>renjietang@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary> @@ -4531,7 +4531,7 @@ </histogram> <histogram name="Net.QuicSession.ZeroRttState" enum="ZeroRttState" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>renjietang@chromium.org</owner> <owner>src/net/quic/OWNERS</owner> <summary>Whether 0-RTT was successfully used in the connection.</summary> @@ -4900,7 +4900,7 @@ </histogram> <histogram name="Net.SpdyPushedStreamFate" enum="SpdyPushedStreamFate" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/OWNERS</owner> <summary> @@ -4967,7 +4967,7 @@ </histogram> <histogram name="Net.SpdySession.ClosedOnError" enum="NetErrorCodes" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/OWNERS</owner> <summary>Net error codes when SpdySession was closed.</summary> @@ -5061,7 +5061,7 @@ </histogram> <histogram name="Net.SpdyStreamsPushedAndClaimedPerSession" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dschinazi@chromium.org</owner> <owner>src/net/OWNERS</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/new_tab_page/histograms.xml b/tools/metrics/histograms/histograms_xml/new_tab_page/histograms.xml index 7a023b8..be2d5e85 100644 --- a/tools/metrics/histograms/histograms_xml/new_tab_page/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/new_tab_page/histograms.xml
@@ -220,7 +220,7 @@ </histogram> <histogram name="NewTabPage.ContentSuggestions.MenuOpened" units="index" - expires_after="2021-09-05"> + expires_after="2021-11-14"> <owner>freedjm@chromium.org</owner> <owner>feed@chromium.org</owner> <summary> @@ -640,7 +640,7 @@ </histogram> <histogram name="NewTabPage.Customized" enum="NTPCustomizedFeatures" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>tiborg@chromium.org</owner> <owner>yyushkina@chromium.org</owner> <owner>chrome-desktop-ntp@google.com</owner> @@ -818,7 +818,7 @@ </histogram> <histogram name="NewTabPage.LogoShown" enum="NewTabPageLogoShown" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>tiborg@chromium.org</owner> <owner>yyushkina@chromium.org</owner> <owner>chrome-desktop-ntp@google.com</owner> @@ -1085,7 +1085,7 @@ </histogram> <histogram name="NewTabPage.NumberOfTiles" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>tiborg@chromium.org</owner> <owner>yyushkina@chromium.org</owner> <owner>chrome-desktop-ntp@google.com</owner> @@ -1113,7 +1113,7 @@ </histogram> <histogram name="NewTabPage.OneGoogleBar.ShownTime" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>tiborg@chromium.org</owner> <owner>yyushkina@chromium.org</owner> <owner>chrome-desktop-ntp@google.com</owner> @@ -1135,7 +1135,7 @@ <histogram name="NewTabPage.Promo.EnhancedProtectionPromo.ImpressionUntilAction" - units="units" expires_after="2021-09-12"> + units="units" expires_after="2021-11-14"> <owner>bdea@chromium.org</owner> <owner>chrome-safebrowsing-core@google.com</owner> <summary> @@ -1236,7 +1236,7 @@ </histogram> <histogram name="NewTabPage.Promos.ShownTime" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>tiborg@chromium.org</owner> <owner>yyushkina@chromium.org</owner> <owner>chrome-desktop-ntp@google.com</owner> @@ -1891,7 +1891,7 @@ </histogram> <histogram name="NewTabPage.VoiceActions" enum="NewTabPageVoiceAction" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>tiborg@chromium.org</owner> <owner>yyushkina@chromium.org</owner> <owner>chrome-desktop-ntp@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/offline/histograms.xml b/tools/metrics/histograms/histograms_xml/offline/histograms.xml index ddeeac0..12a29941 100644 --- a/tools/metrics/histograms/histograms_xml/offline/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/offline/histograms.xml
@@ -106,7 +106,7 @@ </histogram> <histogram name="OfflineIndicator.ConnectivityChanged.DeviceState.Offline" - enum="OfflineIndicatorSurfaceState" expires_after="2021-09-12"> + enum="OfflineIndicatorSurfaceState" expires_after="2021-11-14"> <owner>curranmax@chromium.org</owner> <owner>tbansal@chromium.org</owner> <owner>sinansahin@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/others/histograms.xml b/tools/metrics/histograms/histograms_xml/others/histograms.xml index ae70b0fa..583f8ba 100644 --- a/tools/metrics/histograms/histograms_xml/others/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/others/histograms.xml
@@ -639,7 +639,7 @@ </histogram> <histogram name="AppBanners.DisplayEvent" enum="AppBannersDisplayEvent" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>pjmclachlan@google.com</owner> <owner>pcovell@google.com</owner> <summary> @@ -664,7 +664,7 @@ </histogram> <histogram name="AppBanners.InstallEvent" enum="AppBannersInstallEvent" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>pjmclachlan@google.com</owner> <owner>pcovell@google.com</owner> <summary> @@ -688,7 +688,7 @@ </histogram> <histogram name="AppBanners.UserResponse" enum="AppBannersUserResponse" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dominickn@chromium.org</owner> <owner>pjmclachlan@google.com</owner> <summary> @@ -1069,7 +1069,7 @@ </histogram> <histogram name="Aura.WebContentsWindowUnOccludedTime" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>alemate@chromium.org</owner> <owner>oshima@chromium.org</owner> <summary> @@ -2836,7 +2836,7 @@ </histogram> <histogram name="Clipboard.Read" enum="ClipboardFormatRead" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>huangdarwin@chromium.org</owner> <owner>src/ui/base/clipboard/OWNERS</owner> <summary> @@ -2861,7 +2861,7 @@ </histogram> <histogram name="Clipboard.Write" enum="ClipboardFormatWrite" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>huangdarwin@chromium.org</owner> <owner>src/ui/base/clipboard/OWNERS</owner> <summary> @@ -2927,7 +2927,7 @@ </histogram> <histogram base="true" name="CompositorLatency" units="microseconds" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>sadrul@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> <summary> @@ -4523,7 +4523,7 @@ </histogram> <histogram name="Display.ParseEdidFailure" enum="ParseEdidFailure" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>sashamcintosh@chromium.org</owner> <owner>chromeos-gfx@google.com</owner> <summary> @@ -5690,7 +5690,7 @@ </histogram> <histogram name="FamilyUser.SessionEngagement.Weekday" units="Hour of day" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>agawronska@chromium.org</owner> <owner>tobyhuang@chromium.org</owner> <owner>xiqiruan@chromium.org</owner> @@ -5703,7 +5703,7 @@ </histogram> <histogram name="FamilyUser.SessionEngagement.Weekend" units="Hour of day" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>agawronska@chromium.org</owner> <owner>tobyhuang@chromium.org</owner> <owner>xiqiruan@chromium.org</owner> @@ -6545,7 +6545,7 @@ </histogram> <histogram name="Graphics.Smoothness.Checkerboarding" units="%" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>sadrul@chromium.org</owner> <owner>graphics-dev@chromium.org</owner> <summary> @@ -7446,7 +7446,7 @@ </histogram> <histogram name="ImportantFile.FileCreateError" enum="PlatformFileError" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>grt@chromium.org</owner> <owner>xaerox@yandex-team.ru</owner> <summary> @@ -7455,7 +7455,7 @@ </histogram> <histogram name="ImportantFile.FileDeleteNoRetryError" enum="PlatformFileError" - expires_after="2021-08-15"> + expires_after="2021-11-14"> <owner>grt@chromium.org</owner> <owner>xaerox@yandex-team.ru</owner> <summary> @@ -9189,7 +9189,7 @@ <histogram base="true" name="MachineLearningService.CreateGraphExecutorResult.Event" enum="MachineLearningServiceCreateGraphExecutorResultEvent" - expires_after="2021-09-15"> + expires_after="2021-11-14"> <owner>amoylan@chromium.org</owner> <owner>alanlxl@chromium.org</owner> <summary> @@ -9198,7 +9198,7 @@ </histogram> <histogram base="true" name="MachineLearningService.ExecuteResult.Event" - enum="MachineLearningServiceExecuteResultEvent" expires_after="2021-09-15"> + enum="MachineLearningServiceExecuteResultEvent" expires_after="2021-11-14"> <owner>amoylan@chromium.org</owner> <owner>alanlxl@chromium.org</owner> <summary> @@ -9263,7 +9263,7 @@ <histogram base="true" name="MachineLearningService.LoadModelResult.Event" enum="MachineLearningServiceLoadModelResultEvent" - expires_after="2021-09-15"> + expires_after="2021-11-14"> <owner>amoylan@chromium.org</owner> <owner>alanlxl@chromium.org</owner> <summary> @@ -10268,7 +10268,7 @@ </histogram> <histogram name="NCN.NetworkOperatorMCCMNC" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>tbansal@chromium.org</owner> <owner>bengr@google.com</owner> <summary> @@ -10462,7 +10462,7 @@ </histogram> <histogram name="NQE.RTT.OnECTComputation" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>bengr@chromium.org</owner> <owner>tbansal@chromium.org</owner> <summary> @@ -10473,7 +10473,7 @@ </histogram> <histogram base="true" name="NQE.SignalStrengthQueried" enum="Boolean" - expires_after="2021-09-14"> + expires_after="2021-11-14"> <owner>tbansal@chromium.org</owner> <owner>mcrouse@chromium.org</owner> <summary> @@ -11083,7 +11083,7 @@ </histogram> <histogram name="PDF.LoadStatus" enum="ChromePDFViewerLoadStatus" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>kmoon@chromium.org</owner> <owner>thestig@chromium.org</owner> <summary> @@ -11093,7 +11093,7 @@ </summary> </histogram> -<histogram name="PDF.PageCount" units="pages" expires_after="2021-09-12"> +<histogram name="PDF.PageCount" units="pages" expires_after="2021-11-14"> <owner>hnakashima@chromium.org</owner> <owner>thestig@chromium.org</owner> <summary> @@ -13652,7 +13652,7 @@ </histogram> <histogram name="SB2.ResourceTypes2" enum="ContentResourceType2" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -14717,7 +14717,7 @@ </histogram> <histogram name="SiteEngagementService.TotalEngagement" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>calamity@chromium.org</owner> <owner>dominickn@chromium.org</owner> <summary> @@ -14728,7 +14728,7 @@ </histogram> <histogram name="SiteIsolatedCodeCache.JS.Behaviour" - enum="SiteIsolatedCodeCacheJSBehaviour" expires_after="2021-09-12"> + enum="SiteIsolatedCodeCacheJSBehaviour" expires_after="2021-11-14"> <owner>mythria@chromium.org</owner> <owner>v8-team@google.com</owner> <summary> @@ -15185,7 +15185,7 @@ </histogram> <histogram name="SpellCheck.SpellingService.RequestDuration" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>yyushkina@google.com</owner> <owner>gujen@google.com</owner> <owner>chrome-language@google.com</owner> @@ -15840,7 +15840,7 @@ </histogram> <histogram name="SupervisedUsers.PerAppTimeLimits.BlockedAppsCount" - units="Apps" expires_after="2021-09-12"> + units="Apps" expires_after="2021-11-14"> <owner>agawronska@chromium.org</owner> <owner>yilkal@chromium.org</owner> <owner>cros-families@google.com</owner> @@ -17336,7 +17336,7 @@ </histogram> <histogram name="UsageStats.Events" enum="UsageStatsEvents" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>pnoland@chromium.org</owner> <owner>fgorski@chromium.org</owner> <summary> @@ -18073,7 +18073,7 @@ </histogram> <histogram base="true" name="WebApp.Engagement" - enum="SiteEngagementServiceEngagementType" expires_after="2021-09-12"> + enum="SiteEngagementServiceEngagementType" expires_after="2021-11-14"> <owner>calamity@chromium.org</owner> <owner>mgiuca@chromium.org</owner> <owner>loyso@chromium.org</owner> @@ -18148,7 +18148,7 @@ </histogram> <histogram name="Webapp.Install.InstallEvent" enum="WebappInstallSource" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>dominickn@chromium.org</owner> <owner>loyso@chromium.org</owner> <owner>calamity@chromium.org</owner> @@ -18192,7 +18192,7 @@ </histogram> <histogram name="Webapp.InstallResult" enum="WebAppInstallResultCode" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <!-- Name completed by histogram_suffixes name="WebAppType" --> <owner>calamity@chromium.org</owner> @@ -18363,7 +18363,7 @@ </histogram> <histogram name="Webapp.SystemApps.FreshInstallDuration" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>calamity@chromium.org</owner> <owner>ortuno@chromium.org</owner> <summary> @@ -18403,7 +18403,7 @@ </histogram> <histogram name="Webapp.UninstallDialogAction" - enum="WebappUninstallDialogAction" expires_after="2021-09-12"> + enum="WebappUninstallDialogAction" expires_after="2021-11-14"> <owner>benwells@chromium.org</owner> <owner>dominickn@chromium.org</owner> <owner>loyso@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/page/histograms.xml b/tools/metrics/histograms/histograms_xml/page/histograms.xml index 72f919e..d0da524b 100644 --- a/tools/metrics/histograms/histograms_xml/page/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/page/histograms.xml
@@ -1332,7 +1332,7 @@ <histogram name="PageLoad.Experimental.NavigationTiming.NavigationStartToFirstRequestStart" - units="ms" expires_after="2021-09-12"> + units="ms" expires_after="2021-11-14"> <owner>nhiroki@chromium.org</owner> <owner>chrome-loading@google.com</owner> <summary> @@ -1354,7 +1354,7 @@ <histogram name="PageLoad.Experimental.NavigationTiming.NavigationStartToNavigationCommitSent" - units="ms" expires_after="2021-09-12"> + units="ms" expires_after="2021-11-14"> <owner>nhiroki@chromium.org</owner> <owner>chrome-loading@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/password/histograms.xml b/tools/metrics/histograms/histograms_xml/password/histograms.xml index 7f984ba..59e1011 100644 --- a/tools/metrics/histograms/histograms_xml/password/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/password/histograms.xml
@@ -27,7 +27,7 @@ </variants> <histogram name="PasswordBubble.CompromisedBubble.CheckClicked" - enum="BooleanClicked" expires_after="2021-09-12"> + enum="BooleanClicked" expires_after="2021-11-14"> <owner>vasilii@chromium.org</owner> <owner>kazinova@google.com</owner> <summary> @@ -37,7 +37,7 @@ </histogram> <histogram name="PasswordBubble.CompromisedBubble.Type" - enum="PasswordBubbleFollowupType" expires_after="2021-09-12"> + enum="PasswordBubbleFollowupType" expires_after="2021-11-14"> <owner>vasilii@chromium.org</owner> <owner>kazinova@google.com</owner> <summary> @@ -72,7 +72,7 @@ </histogram> <histogram name="PasswordGeneration.GeneratedPasswordWasEdited" - enum="BooleanGeneratedPasswordWasEdited" expires_after="2021-09-12"> + enum="BooleanGeneratedPasswordWasEdited" expires_after="2021-11-14"> <owner>kolos@chromium.org</owner> <summary> Measures the frequency of user editing of generated passwords. Uploaded once @@ -110,7 +110,7 @@ </histogram> <histogram name="PasswordGeneration.SubmissionEvent" - enum="PasswordSubmissionEvent" expires_after="2021-09-12"> + enum="PasswordSubmissionEvent" expires_after="2021-11-14"> <owner>kazinova@google.com</owner> <owner>kolos@chromium.org</owner> <summary> @@ -2063,7 +2063,7 @@ </histogram> <histogram name="PasswordManager.SavedGaiaPasswordHashCount" units="count" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>vakh@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -2491,7 +2491,7 @@ </histogram> <histogram name="PasswordProtection.ModalWarningDialogLifetime" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/platform/histograms.xml b/tools/metrics/histograms/histograms_xml/platform/histograms.xml index 3a421b2..e6a76a7 100644 --- a/tools/metrics/histograms/histograms_xml/platform/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/platform/histograms.xml
@@ -352,7 +352,7 @@ </histogram> <histogram name="Platform.DetachableBase.ROUpdateResult" - enum="DetachableBaseROUpdateResult" expires_after="2021-09-12"> + enum="DetachableBaseROUpdateResult" expires_after="2021-11-14"> <owner>drinkcat@chromium.org</owner> <owner>fshao@chromium.org</owner> <owner>chromeos-kukui@google.com</owner> @@ -474,7 +474,7 @@ </histogram> <histogram name="Platform.IntelMaxMicroArchitecture" - enum="IntelMaxMicroArchitecture" expires_after="2021-09-12"> + enum="IntelMaxMicroArchitecture" expires_after="2021-11-14"> <owner>fbarchard@chromium.org</owner> <owner>pwnall@chromium.org</owner> <summary> @@ -593,7 +593,7 @@ </summary> </histogram> -<histogram name="Platform.Meminfo" units="KB" expires_after="2021-11-07"> +<histogram name="Platform.Meminfo" units="KB" expires_after="2021-11-14"> <owner>hajimehoshi@chromium.org</owner> <owner>kouhei@chromium.org</owner> <owner>sonnyrao@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/power/histograms.xml b/tools/metrics/histograms/histograms_xml/power/histograms.xml index ffe565c..ec55377 100644 --- a/tools/metrics/histograms/histograms_xml/power/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/power/histograms.xml
@@ -310,7 +310,7 @@ </histogram> <histogram name="Power.CpuTimeSecondsPerProcessType" enum="ProcessType2" - expires_after="2021-11-07"> + expires_after="2021-11-14"> <owner>eseckler@chromium.org</owner> <owner>skyostil@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/print/histograms.xml b/tools/metrics/histograms/histograms_xml/print/histograms.xml index efe42e0..8f238f3 100644 --- a/tools/metrics/histograms/histograms_xml/print/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/print/histograms.xml
@@ -129,7 +129,7 @@ </histogram> <histogram name="PrintPreview.PrintSettings" enum="PrintSettings" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>thestig@chromium.org</owner> <owner>awscreen@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/profile/histograms.xml b/tools/metrics/histograms/histograms_xml/profile/histograms.xml index 1a8d9be..0a0ef72 100644 --- a/tools/metrics/histograms/histograms_xml/profile/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/profile/histograms.xml
@@ -97,7 +97,7 @@ </histogram> <histogram name="Profile.BrowserActive.PerProfile" enum="Profile" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>msarda@chromium.org</owner> <owner>tangltom@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/safe_browsing/histograms.xml b/tools/metrics/histograms/histograms_xml/safe_browsing/histograms.xml index 813c269b..33d5f80c 100644 --- a/tools/metrics/histograms/histograms_xml/safe_browsing/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/safe_browsing/histograms.xml
@@ -1152,7 +1152,7 @@ </histogram> <histogram name="SafeBrowsing.RT.CanCheckDatabase" enum="BooleanEnabled" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -1198,7 +1198,7 @@ </histogram> <histogram name="SafeBrowsing.RT.GetToken.Time" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -1209,7 +1209,7 @@ </histogram> <histogram name="SafeBrowsing.RT.HasTokenFromFetcher" enum="BooleanHasToken" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -1220,7 +1220,7 @@ </histogram> <histogram name="SafeBrowsing.RT.HasTokenInRequest" enum="BooleanHasToken" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -1242,7 +1242,7 @@ </histogram> <histogram name="SafeBrowsing.RT.IsLookupServiceAvailable" - enum="BooleanAvailable" expires_after="2021-09-12"> + enum="BooleanAvailable" expires_after="2021-11-14"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -1254,7 +1254,7 @@ </histogram> <histogram name="SafeBrowsing.RT.IsLookupSuccessful" enum="BooleanSuccess" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary> @@ -1321,7 +1321,7 @@ </histogram> <histogram name="SafeBrowsing.RT.Request.UserPopulation" - enum="SafeBrowsingUserPopulation" expires_after="2021-09-12"> + enum="SafeBrowsingUserPopulation" expires_after="2021-11-14"> <owner>xinghuilu@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml b/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml index 6eacce4..59f1c6f7 100644 --- a/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/sb_client/histograms.xml
@@ -107,7 +107,7 @@ </histogram> <histogram name="SBClientDownload.DownloadRequestNetError" enum="NetErrorCodes" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>drubery@chromium.org</owner> <owner>chrome-safebrowsing-alerts@google.com</owner> <owner>mattm@chromium.org</owner>
diff --git a/tools/metrics/histograms/histograms_xml/session/histograms.xml b/tools/metrics/histograms/histograms_xml/session/histograms.xml index e157320..72d1498 100644 --- a/tools/metrics/histograms/histograms_xml/session/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/session/histograms.xml
@@ -336,7 +336,7 @@ </histogram> <histogram name="Session.TotalDuration.TouchMode" units="times" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>collinbaker@chromium.org</owner> <owner>chrome-desktop-ui-sea@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/settings/histograms.xml b/tools/metrics/histograms/histograms_xml/settings/histograms.xml index f1fdc55..9a7b49b7 100644 --- a/tools/metrics/histograms/histograms_xml/settings/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/settings/histograms.xml
@@ -178,7 +178,7 @@ <summary> Whether or not privacy sandbox apis are enabled, including the current state of cookie settings, and if it is disabled by policy. Recorded on profile - startup. + startup. Values 8, 9, and 10 were added with M92. </summary> </histogram> @@ -376,7 +376,7 @@ </histogram> <histogram name="Settings.StartupPageLoadSettings" enum="SessionStartupPref" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>mpearson@chromium.org</owner> <owner>tiborg@chromium.org</owner> <owner>chrome-desktop-ntp@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/signin/histograms.xml b/tools/metrics/histograms/histograms_xml/signin/histograms.xml index 826d975..6f9a8bf 100644 --- a/tools/metrics/histograms/histograms_xml/signin/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/signin/histograms.xml
@@ -758,7 +758,7 @@ </histogram> <histogram name="Signin.OAuth2MintToken.ApiCallResult" - enum="OAuth2MintTokenApiCallResult" expires_after="2021-09-12"> + enum="OAuth2MintTokenApiCallResult" expires_after="2021-11-14"> <owner>alexilin@chromium.org</owner> <owner>droger@chromium.org</owner> <summary> @@ -1200,7 +1200,7 @@ <histogram name="Signin.SSOIdentityListRequest.FetchIdentitiesWithCallback.Duration" - units="ms" expires_after="2021-09-12"> + units="ms" expires_after="2021-11-14"> <owner>jlebel@chromium.org</owner> <owner>fernandex@chromium.org</owner> <owner>chrome-signin-team@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/stability/histograms.xml b/tools/metrics/histograms/histograms_xml/stability/histograms.xml index ed26a019..6e5a2aa 100644 --- a/tools/metrics/histograms/histograms_xml/stability/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/stability/histograms.xml
@@ -147,7 +147,7 @@ </histogram> <histogram name="Stability.BadMessageTerminated.Content" - enum="BadMessageReasonContent" expires_after="2021-09-12"> + enum="BadMessageReasonContent" expires_after="2021-11-14"> <owner>jam@chromium.org</owner> <owner>jamescook@chromium.org</owner> <summary> @@ -328,7 +328,7 @@ </histogram> <histogram name="Stability.Experimental.PageLoads" enum="StabilityPageLoadType" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>fdoray@chromium.org</owner> <owner>catan-team@chromium.org</owner> <summary> @@ -543,7 +543,7 @@ </histogram> <histogram name="Stability.iOS.UTE.MobileSessionAppWillTerminateWasReceived" - enum="AppWillTerminateReceived" expires_after="2021-09-12"> + enum="AppWillTerminateReceived" expires_after="2021-11-14"> <owner>eugenebut@google.com</owner> <owner>olivierrobin@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/startup/histograms.xml b/tools/metrics/histograms/histograms_xml/startup/histograms.xml index d01b000c..d06d57f 100644 --- a/tools/metrics/histograms/histograms_xml/startup/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/startup/histograms.xml
@@ -66,7 +66,7 @@ </histogram> <histogram base="true" name="Startup.Android.Cold.TimeToFirstContentfulPaint" - units="ms" expires_after="2021-09-12"> + units="ms" expires_after="2021-11-14"> <owner>pasko@chromium.org</owner> <owner>alexilin@chromium.org</owner> <summary> @@ -79,7 +79,7 @@ </histogram> <histogram base="true" name="Startup.Android.Cold.TimeToFirstNavigationCommit" - units="ms" expires_after="2021-09-12"> + units="ms" expires_after="2021-11-14"> <owner>pasko@chromium.org</owner> <owner>alexilin@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/subresource/histograms.xml b/tools/metrics/histograms/histograms_xml/subresource/histograms.xml index 1cf9a3a..8117372 100644 --- a/tools/metrics/histograms/histograms_xml/subresource/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/subresource/histograms.xml
@@ -431,7 +431,7 @@ </histogram> <histogram name="SubresourceFilter.PageLoad.ActivationState" - enum="SubresourceFilterActivationState" expires_after="2021-09-12"> + enum="SubresourceFilterActivationState" expires_after="2021-11-14"> <owner>alexmt@chromium.org</owner> <owner>chrome-ads-histograms@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/sync/histograms.xml b/tools/metrics/histograms/histograms_xml/sync/histograms.xml index 3a6a3547..731398e9 100644 --- a/tools/metrics/histograms/histograms_xml/sync/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/sync/histograms.xml
@@ -79,7 +79,7 @@ </histogram> <histogram name="Sync.BookmarkGUIDSource2" enum="BookmarkGUIDSource" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>rushans@google.com</owner> <owner>mastiz@chromium.org</owner> <component>Services>Sync</component> @@ -203,7 +203,7 @@ </histogram> <histogram name="Sync.ConfigureDataTypeManagerOption" - enum="SyncFeatureOrTransport" expires_after="2021-09-12"> + enum="SyncFeatureOrTransport" expires_after="2021-11-14"> <owner>treib@chromium.org</owner> <component>Services>Sync</component> <summary> @@ -1033,7 +1033,7 @@ </histogram> <histogram name="Sync.PostedDataTypeCommitRequest" enum="SyncModelTypes" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>mastiz@chromium.org</owner> <owner>jkrcal@chromium.org</owner> <component>Services>Sync</component> @@ -1047,7 +1047,7 @@ </histogram> <histogram name="Sync.PostedDataTypeGetUpdatesRequest" enum="SyncModelTypes" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>mastiz@chromium.org</owner> <owner>jkrcal@chromium.org</owner> <component>Services>Sync</component> @@ -1242,7 +1242,7 @@ </histogram> <histogram name="Sync.StopSource" enum="SyncStopSource" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>treib@chromium.org</owner> <owner>mastiz@chromium.org</owner> <component>Services>Sync</component>
diff --git a/tools/metrics/histograms/histograms_xml/tab/histograms.xml b/tools/metrics/histograms/histograms_xml/tab/histograms.xml index 8f9ca0d..36d37bad 100644 --- a/tools/metrics/histograms/histograms_xml/tab/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/tab/histograms.xml
@@ -602,7 +602,7 @@ </histogram> <histogram name="TabGroups.CollapsedGroupCountPerLoad" units="groups" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>cyan@chromium.org</owner> <owner>chrome-desktop-ui-sea@google.com</owner> <summary> @@ -690,7 +690,7 @@ </histogram> <histogram name="TabGroups.UserCustomizedGroupCountPerLoad" units="groups" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>connily@chromium.org</owner> <owner>cyan@chromium.org</owner> <owner>chrome-desktop-ui-sea@google.com</owner> @@ -711,7 +711,7 @@ </histogram> <histogram name="TabGroups.UserGroupCountPerLoad" units="groups" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>connily@chromium.org</owner> <owner>cyan@chromium.org</owner> <owner>chrome-desktop-ui-sea@google.com</owner> @@ -1384,7 +1384,7 @@ </histogram> <histogram name="TabManager.TimeSinceTabClosedUntilRestored" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>aebacanu@chromium.org</owner> <owner>carlscab@chromium.org</owner> <owner>sreejakshetty@chromium.org</owner> @@ -2850,7 +2850,7 @@ </summary> </histogram> -<histogram name="TabStrip.TimeToSwitch" units="ms" expires_after="2021-09-12"> +<histogram name="TabStrip.TimeToSwitch" units="ms" expires_after="2021-11-14"> <owner>connily@chromium.org</owner> <owner>cyan@chromium.org</owner> <owner>chrome-desktop-ui-sea@google.com</owner>
diff --git a/tools/metrics/histograms/histograms_xml/translate/histograms.xml b/tools/metrics/histograms/histograms_xml/translate/histograms.xml index 4a67233d..90af6826 100644 --- a/tools/metrics/histograms/histograms_xml/translate/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/translate/histograms.xml
@@ -248,7 +248,7 @@ </histogram> <histogram name="Translate.HrefHint.PrefsFilterStatus" - enum="HrefTranslatePrefsFilterStatus" expires_after="2021-09-12"> + enum="HrefTranslatePrefsFilterStatus" expires_after="2021-11-14"> <owner>sclittle@google.com</owner> <owner>megjablon@google.com</owner> <owner>chrome-language@google.com</owner> @@ -263,7 +263,7 @@ </histogram> <histogram name="Translate.HrefHint.Status" enum="HrefTranslateStatus" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>megjablon@google.com</owner> <owner>chrome-language@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/ukm/histograms.xml b/tools/metrics/histograms/histograms_xml/ukm/histograms.xml index c4e20fc..c77b6d94 100644 --- a/tools/metrics/histograms/histograms_xml/ukm/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/ukm/histograms.xml
@@ -80,7 +80,7 @@ </histogram> <histogram name="UKM.Entries.Dropped.ByEntryHash" enum="UkmEventNameHash" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>jwd@chromium.org</owner> <owner>ukm-team@google.com</owner> <summary> @@ -135,7 +135,7 @@ </histogram> <histogram name="UKM.IOSLog.OnSuccess" units="records" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>rkaplow@chromium.org</owner> <summary> Number of times when UKM.LogSize.OnSuccess was recorded on iOS. Recorded
diff --git a/tools/metrics/histograms/histograms_xml/uma/histograms.xml b/tools/metrics/histograms/histograms_xml/uma/histograms.xml index 0acbbe40..4981455a 100644 --- a/tools/metrics/histograms/histograms_xml/uma/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/uma/histograms.xml
@@ -172,7 +172,7 @@ </histogram> <histogram name="UMA.IsClonedInstall" enum="BooleanCloned" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>asvitkine@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> <summary> @@ -265,7 +265,7 @@ </histogram> <histogram name="UMA.LogUpload.Canceled.CellularConstraint" - enum="BooleanCanceled" expires_after="2021-09-12"> + enum="BooleanCanceled" expires_after="2021-11-14"> <owner>holte@chromium.org</owner> <owner>asvitkine@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> @@ -589,7 +589,7 @@ </histogram> <histogram name="UMA.TruncatedEvents.UserAction" units="events" - expires_after="2021-11-07"> + expires_after="2021-11-14"> <owner>rkaplow@chromium.org</owner> <owner>src/base/metrics/OWNERS</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/update_engine/histograms.xml b/tools/metrics/histograms/histograms_xml/update_engine/histograms.xml index e10908d..09292de 100644 --- a/tools/metrics/histograms/histograms_xml/update_engine/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/update_engine/histograms.xml
@@ -597,7 +597,7 @@ <histogram name="UpdateEngine.SuccessfulUpdate.DurationFromSeenDays.NoTimeRestriction" - units="days" expires_after="2021-09-12"> + units="days" expires_after="2021-11-14"> <owner>snijhara@google.com</owner> <owner>managed-platforms@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/v8/histograms.xml b/tools/metrics/histograms/histograms_xml/v8/histograms.xml index afd5aaf5..a96f733 100644 --- a/tools/metrics/histograms/histograms_xml/v8/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/v8/histograms.xml
@@ -355,7 +355,7 @@ </summary> </histogram> -<histogram name="V8.Execute" units="ms" expires_after="2021-09-12"> +<histogram name="V8.Execute" units="ms" expires_after="2021-11-14"> <owner>rmcilroy@chromium.org</owner> <summary> Time spent in JavaScript Execution, including runtime calls, callbacks, and
diff --git a/tools/metrics/histograms/histograms_xml/video_tutorials/histograms.xml b/tools/metrics/histograms/histograms_xml/video_tutorials/histograms.xml index 828f620..9af4baaf 100644 --- a/tools/metrics/histograms/histograms_xml/video_tutorials/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/video_tutorials/histograms.xml
@@ -53,7 +53,7 @@ </histogram> <histogram name="VideoTutorials.Player.LoadTimeLatency" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>shaktisahu@chromium.org</owner> <owner>chrome-upboarding-eng@google.com</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/web_audio/histograms.xml b/tools/metrics/histograms/histograms_xml/web_audio/histograms.xml index 16e2385..332079b 100644 --- a/tools/metrics/histograms/histograms_xml/web_audio/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/web_audio/histograms.xml
@@ -32,7 +32,7 @@ </histogram> <histogram name="WebAudio.AudioBuffer.NumberOfChannels" units="units" - expires_after="2021-09-05"> + expires_after="2021-11-14"> <owner>rtoy@chromium.org</owner> <owner>hongchan@chromium.org</owner> <summary>
diff --git a/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml b/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml index 5899f6c..a4e4d22 100644 --- a/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml +++ b/tools/metrics/histograms/histograms_xml/web_rtc/histograms.xml
@@ -423,7 +423,7 @@ </histogram> <histogram name="WebRTC.Audio.DelayedPacketOutageEventMs" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>hlundin@chromium.org</owner> <summary> Measures the duration of each packet loss concealment (a.k.a. expand) event @@ -747,7 +747,7 @@ </histogram> <histogram name="WebRTC.Audio.ExpandRatePercent" units="%" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>hlundin@chromium.org</owner> <summary> Measures the expand rate for an incoming WebRTC audio stream. The expand @@ -951,7 +951,7 @@ </histogram> <histogram name="WebRTC.BWE.Probing.TimePerProbeCluster" units="ms" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>jonasolsson@chromium.org</owner> <owner>crodbro@chromium.org</owner> <summary> @@ -971,7 +971,7 @@ </histogram> <histogram name="WebRTC.BWE.Probing.TotalProbeClustersRequested" units="units" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>jonasolsson@chromium.org</owner> <owner>crodbro@chromium.org</owner> <summary> @@ -3662,7 +3662,7 @@ </histogram> <histogram name="WebRTC.webkitApiCount" enum="RTCAPIName" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>guidou@chromium.org</owner> <owner>hbos@chromium.org</owner> <owner>mcasas@chromium.org</owner> @@ -3712,7 +3712,7 @@ </histogram> <histogram name="WebRtcEventLogging.Upload" enum="WebRtcEventLoggingUploadEnum" - expires_after="2021-09-12"> + expires_after="2021-11-14"> <owner>eladalon@chromium.org</owner> <owner>saeedj@google.com</owner> <owner>manj@google.com</owner>
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml index 988bacf0..0ef84c7 100644 --- a/tools/metrics/ukm/ukm.xml +++ b/tools/metrics/ukm/ukm.xml
@@ -1767,6 +1767,31 @@ </metric> </event> +<event name="AutofillAssistant.InChromeTriggering"> + <owner>arbesser@google.com</owner> + <owner>mcarlen@google.com</owner> + <owner>marianfe@google.com</owner> + <summary> + Recorded when a navigation finishes successfully (is committed and not an + error page), if autofill_assistant and its proactive help setting are + enabled and MSBB is turned on. + </summary> + <metric name="InChromeTriggerAction" + enum="AutofillAssistantInChromeTriggerAction"> + <summary> + An enum that captures the trigger action the client chose for a specific + URL. + </summary> + <aggregation> + <history> + <statistics> + <enumeration/> + </statistics> + </history> + </aggregation> + </metric> +</event> + <event name="AutofillAssistant.LiteScriptFinished"> <owner>arbesser@google.com</owner> <owner>mcarlen@google.com</owner>
diff --git a/tools/perf/core/perfetto_binary_roller/binary_deps.json b/tools/perf/core/perfetto_binary_roller/binary_deps.json index 0b9ed6e..e27d532 100644 --- a/tools/perf/core/perfetto_binary_roller/binary_deps.json +++ b/tools/perf/core/perfetto_binary_roller/binary_deps.json
@@ -1,16 +1,16 @@ { "trace_processor_shell": { "win": { - "hash": "0b862ab5462ce76e070e5cc8da2bfef9657fec01", - "remote_path": "perfetto_binaries/trace_processor_shell/win/5e76bff1ab36ae7b07baa0ee2cad749954312590/trace_processor_shell.exe" + "hash": "6c9d1659449dd8f1930cfcf263ab1005aa602320", + "remote_path": "perfetto_binaries/trace_processor_shell/win/b91884a97a74eee3d9dde816a107e934550ccf26/trace_processor_shell.exe" }, "mac": { - "hash": "3739b206be05974814710b0d89234088dafad257", - "remote_path": "perfetto_binaries/trace_processor_shell/mac/b91884a97a74eee3d9dde816a107e934550ccf26/trace_processor_shell" + "hash": "b71e08180101b61191679d51b089504977d8c19c", + "remote_path": "perfetto_binaries/trace_processor_shell/mac/5e860d49ed384a4785abec0eb68f4ce2f652dca6/trace_processor_shell" }, "linux": { "hash": "49882ef6447cc9a26ae7226e86416be1bce74b30", - "remote_path": "perfetto_binaries/trace_processor_shell/linux/b91884a97a74eee3d9dde816a107e934550ccf26/trace_processor_shell" + "remote_path": "perfetto_binaries/trace_processor_shell/linux/5e860d49ed384a4785abec0eb68f4ce2f652dca6/trace_processor_shell" } }, "power_profile.sql": {
diff --git a/tools/protoc_wrapper/protoc_wrapper.py b/tools/protoc_wrapper/protoc_wrapper.py index 5afc775..dc8a3f1 100755 --- a/tools/protoc_wrapper/protoc_wrapper.py +++ b/tools/protoc_wrapper/protoc_wrapper.py
@@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file.
diff --git a/ui/android/view_android.cc b/ui/android/view_android.cc index 20cc2db..2a24accc 100644 --- a/ui/android/view_android.cc +++ b/ui/android/view_android.cc
@@ -561,10 +561,6 @@ child->OnControlsResizeViewChanged(controls_resize_view); } -bool ViewAndroid::ControlsResizeView() { - return controls_resize_view_; -} - gfx::Size ViewAndroid::GetPhysicalBackingSize() const { return physical_size_; }
diff --git a/ui/android/view_android.h b/ui/android/view_android.h index 03d0fc6e..35a572d 100644 --- a/ui/android/view_android.h +++ b/ui/android/view_android.h
@@ -173,7 +173,6 @@ void OnVerticalScrollDirectionChanged(bool direction_up, float current_scroll_ratio); void OnControlsResizeViewChanged(bool controls_resize_view); - bool ControlsResizeView(); // Gets the Visual Viewport inset to apply in physical pixels. int GetViewportInsetBottom();
diff --git a/ui/native_theme/caption_style_win.cc b/ui/native_theme/caption_style_win.cc index 9574168..8aa03bc 100644 --- a/ui/native_theme/caption_style_win.cc +++ b/ui/native_theme/caption_style_win.cc
@@ -12,6 +12,7 @@ #include "base/check_op.h" #include "base/notreached.h" #include "base/numerics/safe_conversions.h" +#include "base/trace_event/trace_event.h" #include "base/win/core_winrt_util.h" #include "base/win/windows_version.h" #include "skia/ext/skia_utils_win.h" @@ -171,6 +172,7 @@ } absl::optional<CaptionStyle> InitializeFromSystemSettings() { + TRACE_EVENT0("ui", "InitializeFromSystemSettings"); DCHECK_GE(base::win::GetVersion(), base::win::Version::WIN10); DCHECK(base::FeatureList::IsEnabled(features::kSystemCaptionStyle));
diff --git a/url/gurl.cc b/url/gurl.cc index 82ae837..cf50ecc 100644 --- a/url/gurl.cc +++ b/url/gurl.cc
@@ -51,7 +51,7 @@ } GURL::GURL(const std::string& url_string, RetainWhiteSpaceSelector) { - InitCanonical(base::StringPiece(url_string), false); + InitCanonical(url_string, false); } GURL::GURL(const char* canonical_spec, @@ -69,9 +69,8 @@ InitializeFromCanonicalSpec(); } -template <typename CharT> -void GURL::InitCanonical(base::BasicStringPiece<CharT> input_spec, - bool trim_path_end) { +template <typename T, typename CharT> +void GURL::InitCanonical(T input_spec, bool trim_path_end) { url::StdStringCanonOutput output(&spec_); is_valid_ = url::Canonicalize( input_spec.data(), static_cast<int>(input_spec.length()), trim_path_end,
diff --git a/url/gurl.h b/url/gurl.h index c7fd090..74c6e746 100644 --- a/url/gurl.h +++ b/url/gurl.h
@@ -448,9 +448,8 @@ enum RetainWhiteSpaceSelector { RETAIN_TRAILING_PATH_WHITEPACE }; GURL(const std::string& url_string, RetainWhiteSpaceSelector); - template <typename CharT> - void InitCanonical(base::BasicStringPiece<CharT> input_spec, - bool trim_path_end); + template <typename T, typename CharT = typename T::value_type> + void InitCanonical(T input_spec, bool trim_path_end); void InitializeFromCanonicalSpec();